aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-05-13 19:36:34 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-05-13 19:36:34 +0200
commite763cd407a57e4829c2b6ffbddb164e5676670d7 (patch)
tree7f61e697e3bc4407f73f8d341900bca392ac57a3 /app/Controllers
parent4580e177e1986f50c71abb26e90800dc46028693 (diff)
parentc96c80ee9afe03e97229be71e5bc3ea397cfb260 (diff)
Merge branch 'dev' of github.com:marienfressinaud/FreshRSS into dev
Diffstat (limited to 'app/Controllers')
-rwxr-xr-xapp/Controllers/configureController.php50
-rw-r--r--app/Controllers/importExportController.php4
-rwxr-xr-xapp/Controllers/indexController.php13
3 files changed, 44 insertions, 23 deletions
diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php
index b4de19e11..df5212041 100755
--- a/app/Controllers/configureController.php
+++ b/app/Controllers/configureController.php
@@ -140,21 +140,6 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
public function displayAction () {
if (Minz_Request::isPost()) {
$this->view->conf->_language(Minz_Request::param('language', 'en'));
- $this->view->conf->_posts_per_page(Minz_Request::param('posts_per_page', 10));
- $this->view->conf->_view_mode(Minz_Request::param('view_mode', 'normal'));
- $this->view->conf->_default_view (Minz_Request::param('default_view', 'a'));
- $this->view->conf->_auto_load_more(Minz_Request::param('auto_load_more', false));
- $this->view->conf->_display_posts(Minz_Request::param('display_posts', false));
- $this->view->conf->_onread_jump_next(Minz_Request::param('onread_jump_next', false));
- $this->view->conf->_lazyload (Minz_Request::param('lazyload', false));
- $this->view->conf->_sticky_post (Minz_Request::param('sticky_post', false));
- $this->view->conf->_sort_order(Minz_Request::param('sort_order', 'DESC'));
- $this->view->conf->_mark_when (array(
- 'article' => Minz_Request::param('mark_open_article', false),
- 'site' => Minz_Request::param('mark_open_site', false),
- 'scroll' => Minz_Request::param('mark_scroll', false),
- 'reception' => Minz_Request::param('mark_upon_reception', false),
- ));
$themeId = Minz_Request::param('theme', '');
if ($themeId == '') {
$themeId = FreshRSS_Themes::defaultTheme;
@@ -187,6 +172,41 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
$this->view->themes = FreshRSS_Themes::get();
+ Minz_View::prependTitle (Minz_Translate::t ('display_configuration') . ' · ');
+ }
+
+ public function readingAction () {
+ if (Minz_Request::isPost()) {
+ $this->view->conf->_posts_per_page(Minz_Request::param('posts_per_page', 10));
+ $this->view->conf->_view_mode(Minz_Request::param('view_mode', 'normal'));
+ $this->view->conf->_default_view (Minz_Request::param('default_view', 'a'));
+ $this->view->conf->_auto_load_more(Minz_Request::param('auto_load_more', false));
+ $this->view->conf->_display_posts(Minz_Request::param('display_posts', false));
+ $this->view->conf->_onread_jump_next(Minz_Request::param('onread_jump_next', false));
+ $this->view->conf->_lazyload (Minz_Request::param('lazyload', false));
+ $this->view->conf->_sticky_post (Minz_Request::param('sticky_post', false));
+ $this->view->conf->_sort_order(Minz_Request::param('sort_order', 'DESC'));
+ $this->view->conf->_mark_when (array(
+ 'article' => Minz_Request::param('mark_open_article', false),
+ 'site' => Minz_Request::param('mark_open_site', false),
+ 'scroll' => Minz_Request::param('mark_scroll', false),
+ 'reception' => Minz_Request::param('mark_upon_reception', false),
+ ));
+ $this->view->conf->save();
+
+ Minz_Session::_param ('language', $this->view->conf->language);
+ Minz_Translate::reset ();
+ invalidateHttpCache();
+
+ $notif = array (
+ 'type' => 'good',
+ 'content' => Minz_Translate::t ('configuration_updated')
+ );
+ Minz_Session::_param ('notification', $notif);
+
+ Minz_Request::forward (array ('c' => 'configure', 'a' => 'reading'), true);
+ }
+
Minz_View::prependTitle (Minz_Translate::t ('reading_configuration') . ' · ');
}
diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php
index a9b103a34..3cd791781 100644
--- a/app/Controllers/importExportController.php
+++ b/app/Controllers/importExportController.php
@@ -370,7 +370,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {
$this->view->type = 'starred';
$unread_fav = $this->entryDAO->countUnreadReadFavorites();
$this->view->entries = $this->entryDAO->listWhere(
- 's', '', 'all', 'ASC',
+ 's', '', FreshRSS_Entry::STATE_ALL, 'ASC',
$unread_fav['all']
);
} elseif ($type == 'feed' && !is_null($feed)) {
@@ -379,7 +379,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController {
);
$this->view->type = 'feed/' . $feed->id();
$this->view->entries = $this->entryDAO->listWhere(
- 'f', $feed->id(), 'all', 'ASC',
+ 'f', $feed->id(), FreshRSS_Entry::STATE_ALL, 'ASC',
$this->view->conf->posts_per_page
);
$this->view->feed = $feed;
diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php
index 9da1e5022..3445c0bd4 100755
--- a/app/Controllers/indexController.php
+++ b/app/Controllers/indexController.php
@@ -85,18 +85,19 @@ class FreshRSS_index_Controller extends Minz_ActionController {
$state_param = Minz_Request::param ('state', null);
$filter = Minz_Request::param ('search', '');
if (!empty($filter)) {
- $state = 'all'; //Search always in read and unread articles
+ $state = FreshRSS_Entry::STATE_ALL; //Search always in read and unread articles
}
$this->view->order = $order = Minz_Request::param ('order', $this->view->conf->sort_order);
$nb = Minz_Request::param ('nb', $this->view->conf->posts_per_page);
$first = Minz_Request::param ('next', '');
- if ($state === 'not_read') { //Any unread article in this category at all?
+ if ($state === FreshRSS_Entry::STATE_NOT_READ) { //Any unread article in this category at all?
switch ($getType) {
case 'a':
$hasUnread = $this->view->nb_not_read > 0;
break;
case 's':
+ // This is deprecated. The favorite button does not exist anymore
$hasUnread = $this->view->nb_favorites['unread'] > 0;
break;
case 'c':
@@ -111,7 +112,7 @@ class FreshRSS_index_Controller extends Minz_ActionController {
break;
}
if (!$hasUnread && ($state_param === null)) {
- $this->view->state = $state = 'all';
+ $this->view->state = $state = FreshRSS_Entry::STATE_ALL;
}
}
@@ -128,10 +129,10 @@ class FreshRSS_index_Controller extends Minz_ActionController {
// Si on a récupéré aucun article "non lus"
// on essaye de récupérer tous les articles
- if ($state === 'not_read' && empty($entries) && ($state_param === null)) {
+ if ($state === FreshRSS_Entry::STATE_NOT_READ && empty($entries) && ($state_param === null)) {
Minz_Log::record ('Conflicting information about nbNotRead!', Minz_Log::DEBUG);
- $this->view->state = 'all';
- $entries = $entryDAO->listWhere($getType, $getId, 'all', $order, $nb, $first, $filter, $date_min, true, $keepHistoryDefault);
+ $this->view->state = FreshRSS_Entry::STATE_ALL;
+ $entries = $entryDAO->listWhere($getType, $getId, $this->view->state, $order, $nb, $first, $filter, $date_min, true, $keepHistoryDefault);
}
if (count($entries) <= $nb) {