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

View File

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

View File

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

View File

@ -2,11 +2,13 @@
namespace Schema; namespace Schema;
function version_7($pdo) 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) function version_6($pdo)
{ {
$pdo->exec('ALTER TABLE config ADD COLUMN autoflush INTEGER DEFAULT 0'); $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_label(t('Remove automatically read items'), 'autoflush') ?>
<?= Helper\form_select('autoflush', $autoflush_options, $values, $errors) ?><br/> <?= 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', t('Do not fetch the content of articles'), 1, $values['nocontent']) ?><br />
<?= Helper\form_checkbox('nocontent', $values) ?><br />
<div class="form-actions"> <div class="form-actions">
<input type="submit" value="<?= t('Update') ?>" class="btn btn-blue"/> <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>'; 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 '<label><input type="checkbox" name="'.$name.'" class="'.$class.'" value="'.escape($value).'" '.($checked ? 'checked="checked"' : '').'>'.escape($label).'</label>';
return '<input type="checkbox" value="1" name="'.$name.'" class="'.$class.'"'.$checkedstr.'>';
} }