diff options
| author | 2019-06-21 08:42:06 +0200 | |
|---|---|---|
| committer | 2019-06-21 08:42:06 +0200 | |
| commit | 2decc82c3eaeaf205295667e836087f309156822 (patch) | |
| tree | 7a93066acdb15e57b695a4627b1278b771e8417c /app/Controllers/subscriptionController.php | |
| parent | 6cc73d03c34214755d571faba9b3617776021c1c (diff) | |
Change category configuration (#2410)
* Change category configuration
Before, we had a drop-down list to interract on categories. It was not
working the same way as feeds.
Now, categories and feeds behave in a similar manner. At the moment,
there is no change in features but it will allow to expand them.
See #2369
* Minor whitespace
Diffstat (limited to 'app/Controllers/subscriptionController.php')
| -rw-r--r-- | app/Controllers/subscriptionController.php | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index 9cf41ed0b..79da39751 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -35,9 +35,20 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { $this->view->onlyFeedsWithError = Minz_Request::paramTernary('error'); $id = Minz_Request::param('id'); - if ($id !== false) { - $feedDAO = FreshRSS_Factory::createFeedDao(); - $this->view->feed = $feedDAO->searchById($id); + $this->view->displaySlider = false; + if (false !== $id) { + $type = Minz_Request::param('type'); + $this->view->displaySlider = true; + switch ($type) { + case 'category': + $categoryDAO = FreshRSS_Factory::createCategoryDao(); + $this->view->category = $categoryDAO->searchById($id); + break; + default: + $feedDAO = FreshRSS_Factory::createFeedDao(); + $this->view->feed = $feedDAO->searchById($id); + break; + } } } @@ -140,6 +151,35 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { } } + public function categoryAction() { + $this->view->_useLayout(false); + + $categoryDAO = FreshRSS_Factory::createCategoryDao(); + + $id = Minz_Request::param('id'); + $category = $categoryDAO->searchById($id); + if ($id === false || null === $category) { + Minz_Error::error(404); + return; + } + $this->view->category = $category; + + if (Minz_Request::isPost()) { + $values = array( + 'name' => Minz_Request::param('name', ''), + ); + + invalidateHttpCache(); + + $url_redirect = array('c' => 'subscription', 'params' => array('id' => $id, 'type' => 'category')); + if (false !== $categoryDAO->updateCategory($id, $values)) { + Minz_Request::good(_t('feedback.sub.category.updated'), $url_redirect); + } else { + Minz_Request::bad(_t('feedback.sub.category.error'), $url_redirect); + } + } + } + /** * This action displays the bookmarklet page. */ |
