From 8521c876d4b2ce69ff5d4313493017f26aa2cd6b Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sun, 4 May 2014 08:57:19 -0400 Subject: Add user queries It's an intermediary step to remove the favorite button. I add a button to store the current query as a favorite query. It redirects automatically to the configuration page where it is possible to name and remove user queries. To make the queries more straigtforward, I removed the default behavior when searching for a string. This way, when we search for a string, the filter is not defaulted to all articles. --- app/Controllers/configureController.php | 54 +++++++++++++++++++++++++++++++++ app/Controllers/indexController.php | 3 -- app/Models/Configuration.php | 7 +++++ app/Models/Themes.php | 1 + app/i18n/en.php | 22 ++++++++++++++ app/i18n/fr.php | 22 ++++++++++++++ app/layout/aside_configure.phtml | 3 ++ app/layout/aside_flux.phtml | 17 +++++++++++ app/layout/header.phtml | 1 + app/layout/nav_menu.phtml | 8 +++++ app/views/configure/queries.phtml | 45 +++++++++++++++++++++++++++ 11 files changed, 180 insertions(+), 3 deletions(-) create mode 100644 app/views/configure/queries.phtml (limited to 'app') diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index df5212041..573c42d64 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -298,4 +298,58 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $this->view->size_total = $entryDAO->size(true); } } + + public function queriesAction () { + if (Minz_Request::isPost ()) { + $params = Minz_Request::params(); + $this->view->conf->_queries ($params['queries']); + $this->view->conf->save(); + + $notif = array ( + 'type' => 'good', + 'content' => Minz_Translate::t ('configuration_updated') + ); + Minz_Session::_param ('notification', $notif); + + Minz_Request::forward (array ('c' => 'configure', 'a' => 'queries'), true); + } else { + $this->view->query_get = array(); + foreach ($this->view->conf->queries as $key => $query) { + if (isset($query['get'])) { + switch ($query['get'][0]) { + case 'c': + $dao = new FreshRSS_CategoryDAO(); + $category = $dao->searchById(substr($query['get'], 2)); + $this->view->query_get[$key] = array( + 'type' => 'category', + 'name' => $category->name(), + ); + break; + case 'f': + $dao = new FreshRSS_FeedDAO(); + $feed = $dao->searchById(substr($query['get'], 2)); + $this->view->query_get[$key] = array( + 'type' => 'feed', + 'name' => $feed->name(), + ); + break; + } + } + } + } + + Minz_View::prependTitle (Minz_Translate::t ('queries') . ' · '); + } + + public function addQueryAction () { + $queries = $this->view->conf->queries; + $query = Minz_Request::params(); + unset($query['output']); + unset($query['token']); + $queries[] = $query; + $this->view->conf->_queries($queries); + $this->view->conf->save(); + + Minz_Request::forward(array('c' => 'configure', 'a' => 'queries'), true); + } } diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 3445c0bd4..d45ce5510 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -84,9 +84,6 @@ class FreshRSS_index_Controller extends Minz_ActionController { $this->view->state = $state = Minz_Request::param ('state', $this->view->conf->default_view); $state_param = Minz_Request::param ('state', null); $filter = Minz_Request::param ('search', ''); - if (!empty($filter)) { - $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', ''); diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index 8d3e69a1c..deeae0826 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -52,6 +52,7 @@ class FreshRSS_Configuration { 'bottomline_date' => true, 'bottomline_link' => true, 'sharing' => array(), + 'queries' => array(), ); private $available_languages = array( @@ -218,6 +219,12 @@ class FreshRSS_Configuration { $this->data['sharing'][] = $value; } } + public function _queries ($values) { + $this->data['queries'] = array(); + foreach ($values as $value) { + $this->data['queries'][] = array_filter($value); + } + } public function _theme($value) { $this->data['theme'] = $value; } diff --git a/app/Models/Themes.php b/app/Models/Themes.php index 17b95bb9e..5fcbe78e0 100644 --- a/app/Models/Themes.php +++ b/app/Models/Themes.php @@ -70,6 +70,7 @@ class FreshRSS_Themes extends Minz_Model { 'add' => '✚', 'all' => '☰', 'bookmark' => '★', + 'bookmark-add' => '✚', 'category' => '☷', 'category-white' => '☷', 'close' => '❌', diff --git a/app/i18n/en.php b/app/i18n/en.php index 21d37f475..57ca0985d 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -15,6 +15,28 @@ return array ( 'feed' => 'Feed', 'feeds' => 'Feeds', 'shortcuts' => 'Shortcuts', + 'queries' => 'User queries', + 'query-search' => 'Search for "%s"', + 'query-order-asc' => 'Display oldest articles first', + 'query-order-desc' => 'Display newest articles first', + 'query-get-category'=> 'Display "%s" category', + 'query-get-feed' => 'Display "%s" feed', + 'query-state-0' => 'Display all articles', + 'query-state-1' => 'Display read articles', + 'query-state-2' => 'Display unread articles', + 'query-state-3' => 'Display all articles', + 'query-state-4' => 'Display favorite articles', + 'query-state-5' => 'Display read favorite articles', + 'query-state-6' => 'Display unread favorite articles', + 'query-state-7' => 'Display favorite articles', + 'query-state-8' => 'Display not favorite articles', + 'query-state-9' => 'Display read not favorite articles', + 'query-state-10' => 'Display unread not favorite articles', + 'query-state-11' => 'Display not favorite articles', + 'query-state-12' => 'Display all articles', + 'query-state-13' => 'Display read articles', + 'query-state-14' => 'Display unread articles', + 'query-state-15' => 'Display all articles', 'about' => 'About', 'stats' => 'Statistics', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index f42115fcd..d99b8eb1d 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -15,6 +15,28 @@ return array ( 'feed' => 'Flux', 'feeds' => 'Flux', 'shortcuts' => 'Raccourcis', + 'queries' => 'Filtres utilisateurs', + 'query-search' => 'Chercher "%s"', + 'query-order-asc' => 'Afficher les articles les plus anciens en premier', + 'query-order-desc' => 'Afficher les articles les plus récents en premier', + 'query-get-category'=> 'Afficher la catégorie "%s"', + 'query-get-feed' => 'Afficher le flux "%s"', + 'query-state-0' => 'Afficher tous les articles', + 'query-state-1' => 'Afficher les articles lus', + 'query-state-2' => 'Afficher les articles non lus', + 'query-state-3' => 'Afficher tous les articles', + 'query-state-4' => 'Afficher les articles favoris', + 'query-state-5' => 'Afficher les articles lus et favoris', + 'query-state-6' => 'Afficher les articles non lus et favoris', + 'query-state-7' => 'Afficher les articles favoris', + 'query-state-8' => 'Afficher les articles non favoris', + 'query-state-9' => 'Afficher les articles lus et non favoris', + 'query-state-10' => 'Afficher les articles non lus et non favoris', + 'query-state-11' => 'Afficher les articles non favoris', + 'query-state-12' => 'Afficher tous les articles', + 'query-state-13' => 'Afficher les articles lus', + 'query-state-14' => 'Afficher les articles non lus', + 'query-state-15' => 'Afficher tous les articles', 'about' => 'À propos', 'stats' => 'Statistiques', diff --git a/app/layout/aside_configure.phtml b/app/layout/aside_configure.phtml index 43adeb3c6..e66f2f64c 100644 --- a/app/layout/aside_configure.phtml +++ b/app/layout/aside_configure.phtml @@ -15,6 +15,9 @@
  • +
  • + +
  • diff --git a/app/layout/aside_flux.phtml b/app/layout/aside_flux.phtml index 817dae676..8f8d436e1 100644 --- a/app/layout/aside_flux.phtml +++ b/app/layout/aside_flux.phtml @@ -36,6 +36,23 @@
  • + + conf->queries as $query_conf): + $count++; + $name = $count; + if (isset($query_conf['name'])) { + $name = $query_conf['name']; + unset($query_conf['name']); + } + $url_user_query = array('c' => 'index', 'a' => 'index', 'params' => $query_conf); ?> +
  • +
    + +
    +
  • + cat_aside as $cat) { diff --git a/app/layout/header.phtml b/app/layout/header.phtml index 08aa7715d..3eedc8ea7 100644 --- a/app/layout/header.phtml +++ b/app/layout/header.phtml @@ -72,6 +72,7 @@ if (Minz_Configuration::canLogIn()) {
  • +
  • diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index 9990448ba..6db172904 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -241,6 +241,14 @@ + loginOk): + $url_query = $this->url; + $url_query['c'] = 'configure'; + $url_query['a'] = 'addQuery'; + ?> + + + diff --git a/app/views/configure/queries.phtml b/app/views/configure/queries.phtml new file mode 100644 index 000000000..38755edc5 --- /dev/null +++ b/app/views/configure/queries.phtml @@ -0,0 +1,45 @@ +partial ('aside_configure'); ?> + +
    + + +
    + + + conf->queries as $key => $query):?> +
    + +
    + + + + + + +
      + +
    • + + +
    • + + +
    • + + +
    • query_get[$key]['type'], $this->query_get[$key]['name']); ?>
    • + +
    +
    +
    + + +
    +
    + + +
    +
    +
    + +
    \ No newline at end of file -- cgit v1.2.3 From 5d69d6c43d5e1ebdae416dceaffee35ae5965cab Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 17 May 2014 23:25:03 -0400 Subject: Fix tabs --- app/i18n/en.php | 4 ++-- app/i18n/fr.php | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/i18n/en.php b/app/i18n/en.php index 57ca0985d..9a0104a54 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -17,8 +17,8 @@ return array ( 'shortcuts' => 'Shortcuts', 'queries' => 'User queries', 'query-search' => 'Search for "%s"', - 'query-order-asc' => 'Display oldest articles first', - 'query-order-desc' => 'Display newest articles first', + 'query-order-asc' => 'Display oldest articles first', + 'query-order-desc' => 'Display newest articles first', 'query-get-category'=> 'Display "%s" category', 'query-get-feed' => 'Display "%s" feed', 'query-state-0' => 'Display all articles', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index d99b8eb1d..ea16da6f5 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -17,10 +17,10 @@ return array ( 'shortcuts' => 'Raccourcis', 'queries' => 'Filtres utilisateurs', 'query-search' => 'Chercher "%s"', - 'query-order-asc' => 'Afficher les articles les plus anciens en premier', - 'query-order-desc' => 'Afficher les articles les plus récents en premier', - 'query-get-category'=> 'Afficher la catégorie "%s"', - 'query-get-feed' => 'Afficher le flux "%s"', + 'query-order-asc' => 'Afficher les articles les plus anciens en premier', + 'query-order-desc' => 'Afficher les articles les plus récents en premier', + 'query-get-category' => 'Afficher la catégorie "%s"', + 'query-get-feed' => 'Afficher le flux "%s"', 'query-state-0' => 'Afficher tous les articles', 'query-state-1' => 'Afficher les articles lus', 'query-state-2' => 'Afficher les articles non lus', -- cgit v1.2.3 From 1032d2ea75e22567b0518a7e408e5ee377a139b7 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 17 May 2014 23:31:56 -0400 Subject: fix tabs --- app/i18n/en.php | 42 +++++++++++++++++++++--------------------- app/i18n/fr.php | 42 +++++++++++++++++++++--------------------- 2 files changed, 42 insertions(+), 42 deletions(-) (limited to 'app') diff --git a/app/i18n/en.php b/app/i18n/en.php index 9a0104a54..004228ccd 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -16,27 +16,27 @@ return array ( 'feeds' => 'Feeds', 'shortcuts' => 'Shortcuts', 'queries' => 'User queries', - 'query-search' => 'Search for "%s"', - 'query-order-asc' => 'Display oldest articles first', - 'query-order-desc' => 'Display newest articles first', - 'query-get-category'=> 'Display "%s" category', - 'query-get-feed' => 'Display "%s" feed', - 'query-state-0' => 'Display all articles', - 'query-state-1' => 'Display read articles', - 'query-state-2' => 'Display unread articles', - 'query-state-3' => 'Display all articles', - 'query-state-4' => 'Display favorite articles', - 'query-state-5' => 'Display read favorite articles', - 'query-state-6' => 'Display unread favorite articles', - 'query-state-7' => 'Display favorite articles', - 'query-state-8' => 'Display not favorite articles', - 'query-state-9' => 'Display read not favorite articles', - 'query-state-10' => 'Display unread not favorite articles', - 'query-state-11' => 'Display not favorite articles', - 'query-state-12' => 'Display all articles', - 'query-state-13' => 'Display read articles', - 'query-state-14' => 'Display unread articles', - 'query-state-15' => 'Display all articles', + 'query-search' => 'Search for "%s"', + 'query-order-asc' => 'Display oldest articles first', + 'query-order-desc' => 'Display newest articles first', + 'query-get-category' => 'Display "%s" category', + 'query-get-feed' => 'Display "%s" feed', + 'query-state-0' => 'Display all articles', + 'query-state-1' => 'Display read articles', + 'query-state-2' => 'Display unread articles', + 'query-state-3' => 'Display all articles', + 'query-state-4' => 'Display favorite articles', + 'query-state-5' => 'Display read favorite articles', + 'query-state-6' => 'Display unread favorite articles', + 'query-state-7' => 'Display favorite articles', + 'query-state-8' => 'Display not favorite articles', + 'query-state-9' => 'Display read not favorite articles', + 'query-state-10' => 'Display unread not favorite articles', + 'query-state-11' => 'Display not favorite articles', + 'query-state-12' => 'Display all articles', + 'query-state-13' => 'Display read articles', + 'query-state-14' => 'Display unread articles', + 'query-state-15' => 'Display all articles', 'about' => 'About', 'stats' => 'Statistics', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index ea16da6f5..921abb7f1 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -16,27 +16,27 @@ return array ( 'feeds' => 'Flux', 'shortcuts' => 'Raccourcis', 'queries' => 'Filtres utilisateurs', - 'query-search' => 'Chercher "%s"', - 'query-order-asc' => 'Afficher les articles les plus anciens en premier', - 'query-order-desc' => 'Afficher les articles les plus récents en premier', - 'query-get-category' => 'Afficher la catégorie "%s"', - 'query-get-feed' => 'Afficher le flux "%s"', - 'query-state-0' => 'Afficher tous les articles', - 'query-state-1' => 'Afficher les articles lus', - 'query-state-2' => 'Afficher les articles non lus', - 'query-state-3' => 'Afficher tous les articles', - 'query-state-4' => 'Afficher les articles favoris', - 'query-state-5' => 'Afficher les articles lus et favoris', - 'query-state-6' => 'Afficher les articles non lus et favoris', - 'query-state-7' => 'Afficher les articles favoris', - 'query-state-8' => 'Afficher les articles non favoris', - 'query-state-9' => 'Afficher les articles lus et non favoris', - 'query-state-10' => 'Afficher les articles non lus et non favoris', - 'query-state-11' => 'Afficher les articles non favoris', - 'query-state-12' => 'Afficher tous les articles', - 'query-state-13' => 'Afficher les articles lus', - 'query-state-14' => 'Afficher les articles non lus', - 'query-state-15' => 'Afficher tous les articles', + 'query-search' => 'Chercher "%s"', + 'query-order-asc' => 'Afficher les articles les plus anciens en premier', + 'query-order-desc' => 'Afficher les articles les plus récents en premier', + 'query-get-category' => 'Afficher la catégorie "%s"', + 'query-get-feed' => 'Afficher le flux "%s"', + 'query-state-0' => 'Afficher tous les articles', + 'query-state-1' => 'Afficher les articles lus', + 'query-state-2' => 'Afficher les articles non lus', + 'query-state-3' => 'Afficher tous les articles', + 'query-state-4' => 'Afficher les articles favoris', + 'query-state-5' => 'Afficher les articles lus et favoris', + 'query-state-6' => 'Afficher les articles non lus et favoris', + 'query-state-7' => 'Afficher les articles favoris', + 'query-state-8' => 'Afficher les articles non favoris', + 'query-state-9' => 'Afficher les articles lus et non favoris', + 'query-state-10' => 'Afficher les articles non lus et non favoris', + 'query-state-11' => 'Afficher les articles non favoris', + 'query-state-12' => 'Afficher tous les articles', + 'query-state-13' => 'Afficher les articles lus', + 'query-state-14' => 'Afficher les articles non lus', + 'query-state-15' => 'Afficher tous les articles', 'about' => 'À propos', 'stats' => 'Statistiques', -- cgit v1.2.3 From eaf6f5bb73a1a93fd0647af850913e3e640f477a Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 17 May 2014 23:32:57 -0400 Subject: fix tabs --- app/i18n/en.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/i18n/en.php b/app/i18n/en.php index 004228ccd..56aa5ad54 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -20,7 +20,7 @@ return array ( 'query-order-asc' => 'Display oldest articles first', 'query-order-desc' => 'Display newest articles first', 'query-get-category' => 'Display "%s" category', - 'query-get-feed' => 'Display "%s" feed', + 'query-get-feed' => 'Display "%s" feed', 'query-state-0' => 'Display all articles', 'query-state-1' => 'Display read articles', 'query-state-2' => 'Display unread articles', -- cgit v1.2.3 From a61180032f6c663ed3946fe0bbdb70ac3b8ec96a Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sun, 18 May 2014 06:55:12 -0400 Subject: Fix array values --- app/Controllers/configureController.php | 2 +- app/views/configure/queries.phtml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index 573c42d64..c6746aba8 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -302,7 +302,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { public function queriesAction () { if (Minz_Request::isPost ()) { $params = Minz_Request::params(); - $this->view->conf->_queries ($params['queries']); + $this->view->conf->_queries (isset($params['queries']) ? $params['queries'] : array()); $this->view->conf->save(); $notif = array ( diff --git a/app/views/configure/queries.phtml b/app/views/configure/queries.phtml index 38755edc5..f0c551742 100644 --- a/app/views/configure/queries.phtml +++ b/app/views/configure/queries.phtml @@ -10,11 +10,11 @@
    - - - - - + "/> + "/> + "/> + "/> + "/>
      -- cgit v1.2.3