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 +++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'app/Controllers/configureController.php') 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); + } } -- 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/Controllers/configureController.php') 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