minors cleanup

This commit is contained in:
Frederic Guillot 2013-06-10 22:09:51 -04:00
parent e93517274f
commit c2ca54385f
6 changed files with 18 additions and 20 deletions

View File

@ -135,12 +135,8 @@ label {
display: block;
}
.inline-label {
display: inline;
}
input {
-webkit-appearance: none;
input[type="checkbox"] {
border: 1px solid #ccc;
}
input[type="email"],
@ -154,6 +150,7 @@ input[type="text"] {
font-size: 99%;
margin-bottom: 10px;
margin-top: 5px;
-webkit-appearance: none;
}
input[type="email"]:focus,
@ -252,6 +249,7 @@ textarea.form-error {
/* buttons */
.btn {
-webkit-appearance: none;
display: inline-block;
color: #333;
border: 1px solid #ccc;

View File

@ -1,8 +1,7 @@
<?php
return array(
'Do not fetch the content of articles (and remove it content for previous entries)' =>
'Ne pas récupérer le contenu des articles (et supprimer ce contenu pour les articles précédents',
'Do not fetch the content of articles' => 'Ne pas récupérer le contenu des articles',
'Remove automatically read items' => 'Supprimer automatiquement les éléments lus',
'Never' => 'Jamais',
'After %d day' => 'Après %d jour',

View File

@ -405,7 +405,7 @@ function autoflush()
function update_items($feed_id, array $items)
{
$nocontent = (bool)\PicoTools\singleton('db')->table('config')->findOneColumn('nocontent');
$nocontent = (bool) \PicoTools\singleton('db')->table('config')->findOneColumn('nocontent');
$items_in_feed = array();
$db = \PicoTools\singleton('db');
@ -419,7 +419,6 @@ function update_items($feed_id, array $items)
// Insert only new item
if ($db->table('items')->eq('id', $item->id)->count() !== 1) {
$content = $nocontent ? '' : $item->content;
$db->table('items')->save(array(
'id' => $item->id,
@ -427,7 +426,7 @@ function update_items($feed_id, array $items)
'url' => $item->url,
'updated' => $item->updated,
'author' => $item->author,
'content' => $content,
'content' => $nocontent ? '' : $item->content,
'status' => 'unread',
'feed_id' => $feed_id
));
@ -553,9 +552,10 @@ function save_config(array $values)
\PicoTools\Translator\load($values['language']);
// if the user does not want content of feeds, remote it in previous ones
if ((bool)$values['nocontent']) {
\PicoTools\singleton('db')->table('items')->update(array('content'=>''));
// If the user does not want content of feeds, remove it in previous ones
if ((bool) $values['nocontent']) {
\PicoTools\singleton('db')->table('items')->update(array('content' => ''));
}
return \PicoTools\singleton('db')->table('config')->update($values);

View File

@ -2,11 +2,13 @@
namespace Schema;
function version_7($pdo)
{
$pdo->exec('ALTER TABLE config ADD COLUMN nocontent INTEGER');
$pdo->exec('ALTER TABLE config ADD COLUMN nocontent INTEGER DEFAULT 0');
}
function version_6($pdo)
{
$pdo->exec('ALTER TABLE config ADD COLUMN autoflush INTEGER DEFAULT 0');

View File

@ -19,8 +19,7 @@
<?= Helper\form_label(t('Remove automatically read items'), 'autoflush') ?>
<?= Helper\form_select('autoflush', $autoflush_options, $values, $errors) ?><br/>
<?= Helper\form_label(t('Do not fetch the content of articles (and remove it content for previous entries)'), 'nocontent', "inline-label") ?>
<?= Helper\form_checkbox('nocontent', $values) ?><br />
<?= Helper\form_checkbox('nocontent', t('Do not fetch the content of articles'), 1, $values['nocontent']) ?><br />
<div class="form-actions">
<input type="submit" value="<?= t('Update') ?>" class="btn btn-blue"/>

View File

@ -182,10 +182,10 @@ function form_radio($name, $label, $value, $selected = false, $class = '')
return '<label><input type="radio" name="'.$name.'" class="'.$class.'" value="'.escape($value).'" '.($selected ? 'selected="selected"' : '').'>'.escape($label).'</label>';
}
function form_checkbox($name, $values, $class = '' )
function form_checkbox($name, $label, $value, $checked = false, $class = '')
{
$checkedstr = (bool)$values[$name] ? 'checked' : '';
return '<input type="checkbox" value="1" name="'.$name.'" class="'.$class.'"'.$checkedstr.'>';
return '<label><input type="checkbox" name="'.$name.'" class="'.$class.'" value="'.escape($value).'" '.($checked ? 'checked="checked"' : '').'>'.escape($label).'</label>';
}