Merge branch 'nocontent' of git://github.com/doubleface/miniflux

This commit is contained in:
Frederic Guillot 2013-06-10 21:46:28 -04:00
commit e93517274f
8 changed files with 34 additions and 8 deletions

View File

@ -135,6 +135,10 @@ label {
display: block;
}
.inline-label {
display: inline;
}
input {
-webkit-appearance: none;
}

View File

@ -10,7 +10,7 @@ require 'schema.php';
require 'model.php';
const DB_VERSION = 6;
const DB_VERSION = 7;
const APP_VERSION = 'master';
const APP_USERAGENT = 'Miniflux - http://miniflux.net';
const HTTP_TIMEOUT = 5;

View File

@ -361,7 +361,7 @@ Router\get_action('config', function() {
Router\post_action('config', function() {
$values = Request\values();
$values = Request\values() + array('nocontent' => 0);
list($valid, $errors) = Model\validate_config_update($values);
if ($valid) {

View File

@ -1,6 +1,8 @@
<?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',
'Remove automatically read items' => 'Supprimer automatiquement les éléments lus',
'Never' => 'Jamais',
'After %d day' => 'Après %d jour',

View File

@ -137,7 +137,6 @@ function update_feeds($limit = LIMIT_ALL)
$feeds_id = get_feeds_id($limit);
foreach ($feeds_id as $feed_id) {
update_feed($feed_id);
}
@ -406,6 +405,8 @@ function autoflush()
function update_items($feed_id, array $items)
{
$nocontent = (bool)\PicoTools\singleton('db')->table('config')->findOneColumn('nocontent');
$items_in_feed = array();
$db = \PicoTools\singleton('db');
@ -418,6 +419,7 @@ 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,
@ -425,7 +427,7 @@ function update_items($feed_id, array $items)
'url' => $item->url,
'updated' => $item->updated,
'author' => $item->author,
'content' => $item->content,
'content' => $content,
'status' => 'unread',
'feed_id' => $feed_id
));
@ -456,7 +458,7 @@ function get_config()
{
return \PicoTools\singleton('db')
->table('config')
->columns('username', 'language', 'autoflush')
->columns('username', 'language', 'autoflush', 'nocontent')
->findOne();
}
@ -551,5 +553,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'=>''));
}
return \PicoTools\singleton('db')->table('config')->update($values);
}

View File

@ -2,6 +2,10 @@
namespace Schema;
function version_7($pdo)
{
$pdo->exec('ALTER TABLE config ADD COLUMN nocontent INTEGER');
}
function version_6($pdo)
{

View File

@ -19,6 +19,9 @@
<?= 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 />
<div class="form-actions">
<input type="submit" value="<?= t('Update') ?>" class="btn btn-blue"/>
</div>

View File

@ -182,6 +182,12 @@ 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 = '' )
{
$checkedstr = (bool)$values[$name] ? 'checked' : '';
return '<input type="checkbox" value="1" name="'.$name.'" class="'.$class.'"'.$checkedstr.'>';
}
function form_label($label, $name, $class = '')
{