diff options
| author | 2013-12-03 19:13:41 +0100 | |
|---|---|---|
| committer | 2013-12-03 19:13:41 +0100 | |
| commit | 0425432271fb709d94194cfd5ca922038c175573 (patch) | |
| tree | 668891d30d9a4e3568cbce9b8a2fdd982bf01872 /app | |
| parent | ed0535b0b0830066ae71b914eff2a5a31f575ec9 (diff) | |
Option pour marquer les articles comme lus dès la réception
https://github.com/marienfressinaud/FreshRSS/issues/237
https://github.com/marienfressinaud/FreshRSS/issues/309
Diffstat (limited to 'app')
| -rwxr-xr-x | app/controllers/configureController.php | 2 | ||||
| -rwxr-xr-x | app/controllers/feedController.php | 6 | ||||
| -rw-r--r-- | app/i18n/en.php | 13 | ||||
| -rw-r--r-- | app/i18n/fr.php | 11 | ||||
| -rwxr-xr-x | app/models/RSSConfiguration.php | 17 | ||||
| -rw-r--r-- | app/views/configure/display.phtml | 4 |
6 files changed, 36 insertions, 17 deletions
diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 68d798581..deec54a2b 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -171,6 +171,7 @@ class configureController extends ActionController { $openArticle = Request::param ('mark_open_article', 'no'); $openSite = Request::param ('mark_open_site', 'no'); $scroll = Request::param ('mark_scroll', 'no'); + $reception = Request::param ('mark_upon_reception', 'no'); $theme = Request::param ('theme', 'default'); $topline_read = Request::param ('topline_read', 'no'); $topline_favorite = Request::param ('topline_favorite', 'no'); @@ -200,6 +201,7 @@ class configureController extends ActionController { 'article' => $openArticle, 'site' => $openSite, 'scroll' => $scroll, + 'reception' => $reception, )); $this->view->conf->_theme ($theme); $this->view->conf->_topline_read ($topline_read); diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index dc0a0ef54..c978857b2 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -88,6 +88,8 @@ class feedController extends ActionController { $feed->_id ($id); $feed->faviconPrepare(); + $is_read = $this->view->conf->markUponReception() === 'yes' ? 1 : 0; + $entryDAO = new EntryDAO (); $entries = $feed->entries (); usort($entries, 'self::entryDateComparer'); @@ -105,6 +107,7 @@ class feedController extends ActionController { $values = $entry->toArray (); $values['id_feed'] = $feed->id (); $values['id'] = min(time(), $entry->date (true)) . '.' . rand(0, 999999); + $values['is_read'] = $is_read; $entryDAO->addEntry ($values); } } @@ -197,6 +200,8 @@ class feedController extends ActionController { $entries = $feed->entries (); usort($entries, 'self::entryDateComparer'); + $is_read = $this->view->conf->markUponReception() === 'yes' ? 1 : 0; + //For this feed, check last n entry GUIDs already in database $existingGuids = array_fill_keys ($entryDAO->listLastGuidsByFeed ($feed->id (), count($entries) + 10), 1); @@ -210,6 +215,7 @@ class feedController extends ActionController { $values = $entry->toArray (); //Use declared date at first import, otherwise use discovery date $values['id'] = empty($existingGuids) ? min(time(), $entry->date (true)) . '.' . rand(0, 999999) : microtime(true); + $values['is_read'] = $is_read; $entryDAO->addEntry ($values); } } diff --git a/app/i18n/en.php b/app/i18n/en.php index 32ed58713..18ff09aab 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -165,16 +165,17 @@ return array ( 'sort_order' => 'Sort order', 'auto_load_more' => 'Load next articles at the page bottom', 'display_articles_unfolded' => 'Show articles unfolded by default', - 'after_onread' => 'After marked as read,', - 'jump_next' => 'jump to next unread sibling', + 'after_onread' => 'After “mark all as read”,', + 'jump_next' => 'jump to next unread sibling (feed or category)', 'reading_icons' => 'Reading icons', 'top_line' => 'Top line', 'bottom_line' => 'Bottom line', 'img_with_lazyload' => 'Use "lazy load" mode to load pictures', - 'auto_read_when' => 'Mark as read when', - 'article_selected' => 'article is selected', - 'article_open_on_website' => 'article is opened on its original website', - 'scroll' => 'page scrolls', + 'auto_read_when' => 'Mark article as read…', + 'article_selected' => 'when article is selected', + 'article_open_on_website' => 'when article is opened on its original website', + 'scroll' => 'during page scrolls', + 'upon_reception' => 'upon reception of new articles', 'your_shaarli' => 'Your Shaarli', 'your_poche' => 'Your Poche', 'your_diaspora_pod' => 'Your Diaspora* pod', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 4c23cfbea..6339fbe18 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -165,16 +165,17 @@ return array ( 'sort_order' => 'Ordre de tri', 'auto_load_more' => 'Charger les articles suivants en bas de page', 'display_articles_unfolded' => 'Afficher les articles dépliés par défaut', - 'after_onread' => 'Après marqué comme lu,', - 'jump_next' => 'sauter au prochain voisin non lu', + 'after_onread' => 'Après “marquer tout comme lu”,', + 'jump_next' => 'sauter au prochain voisin non lu (flux ou catégorie)', 'reading_icons' => 'Icônes de lecture', 'top_line' => 'Ligne du haut', 'bottom_line' => 'Ligne du bas', 'img_with_lazyload' => 'Utiliser le mode “chargement différé” pour les images', - 'auto_read_when' => 'Marquer comme lu lorsque', - 'article_selected' => 'l’article est sélectionné', - 'article_open_on_website' => 'l’article est ouvert sur le site d’origine', + 'auto_read_when' => 'Marquer un article comme lu…', + 'article_selected' => 'lorsque l’article est sélectionné', + 'article_open_on_website' => 'lorsque l’article est ouvert sur le site d’origine', 'scroll' => 'au défilement de la page', + 'upon_reception' => 'dès la réception d’un nouvel article', 'your_shaarli' => 'Votre Shaarli', 'your_poche' => 'Votre Poche', 'your_diaspora_pod' => 'Votre pod Diaspora*', diff --git a/app/models/RSSConfiguration.php b/app/models/RSSConfiguration.php index 5458ba2f3..f3fc3b4f1 100755 --- a/app/models/RSSConfiguration.php +++ b/app/models/RSSConfiguration.php @@ -113,6 +113,9 @@ class RSSConfiguration extends Model { public function markWhenScroll () { return $this->mark_when['scroll']; } + public function markUponReception () { + return $this->mark_when['reception']; + } public function sharing ($key = false) { if ($key === false) { return $this->sharing; @@ -171,11 +174,8 @@ class RSSConfiguration extends Model { $this->language = $value; } public function _postsPerPage ($value) { - if (ctype_digit ($value) && $value > 0) { - $this->posts_per_page = $value; - } else { - $this->posts_per_page = 10; - } + $value = intval($value); + $this->posts_per_page = $value > 0 ? $value : 10; } public function _viewMode ($value) { if ($value == 'global' || $value == 'reader') { @@ -244,10 +244,14 @@ class RSSConfiguration extends Model { if(!isset($values['scroll'])) { $values['scroll'] = 'yes'; } + if(!isset($values['reception'])) { + $values['reception'] = 'no'; + } $this->mark_when['article'] = $values['article']; $this->mark_when['site'] = $values['site']; $this->mark_when['scroll'] = $values['scroll']; + $this->mark_when['reception'] = $values['reception']; } public function _sharing ($values) { $are_url = array ('shaarli', 'poche', 'diaspora'); @@ -345,7 +349,8 @@ class RSSConfigurationDAO extends Model_array { public $mark_when = array ( 'article' => 'yes', 'site' => 'yes', - 'scroll' => 'no' + 'scroll' => 'no', + 'reception' => 'no' ); public $sharing = array ( 'shaarli' => '', diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index e6d867ed1..6ddd99ba0 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -143,6 +143,10 @@ <input type="checkbox" name="mark_scroll" id="check_scroll" value="yes"<?php echo $this->conf->markWhenScroll () == 'yes' ? ' checked="checked"' : ''; ?> /> <?php echo Translate::t ('scroll'); ?> </label> + <label class="checkbox" for="check_reception"> + <input type="checkbox" name="mark_upon_reception" id="check_reception" value="yes"<?php echo $this->conf->markUponReception () == 'yes' ? ' checked="checked"' : ''; ?> /> + <?php echo Translate::t ('upon_reception'); ?> + </label> </div> </div> |
