ソースを参照

Change notification code

Before, it was using the old way to display notifications to the user.
Now, it uses the encapsulated method to do that.
Alexis Degrugillier 11 年 前
コミット
f87dfbc528
1 ファイル変更12 行追加51 行削除
  1. 12 51
      app/Controllers/configureController.php

+ 12 - 51
app/Controllers/configureController.php

@@ -72,13 +72,8 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
 			}
 			}
 			invalidateHttpCache();
 			invalidateHttpCache();
 
 
-			$notif = array(
-				'type' => 'good',
-				'content' => Minz_Translate::t('categories_updated')
-			);
-			Minz_Session::_param('notification', $notif);
-
-			Minz_Request::forward(array('c' => 'configure', 'a' => 'categorize'), true);
+			Minz_Request::good(_t('categories_updated'),
+		                   array('c' => 'configure', 'a' => 'categorize'));
 		}
 		}
 
 
 		$this->view->categories = $catDAO->listCategories(false);
 		$this->view->categories = $catDAO->listCategories(false);
@@ -107,8 +102,6 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
 	 *   - number of article to retain (default: -2)
 	 *   - number of article to retain (default: -2)
 	 *   - refresh frequency (default: -2)
 	 *   - refresh frequency (default: -2)
 	 * Default values are empty strings unless specified.
 	 * Default values are empty strings unless specified.
-	 *
-	 * @todo change the notification code
 	 */
 	 */
 	public function feedAction() {
 	public function feedAction() {
 		$catDAO = new FreshRSS_CategoryDAO();
 		$catDAO = new FreshRSS_CategoryDAO();
@@ -207,7 +200,6 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
 	 * Default values are false unless specified.
 	 * Default values are false unless specified.
 	 *
 	 *
 	 * @todo refactor theme section to use the same syntax everywhere
 	 * @todo refactor theme section to use the same syntax everywhere
-	 * @todo change the notification code
 	 */
 	 */
 	public function displayAction() {
 	public function displayAction() {
 		if (Minz_Request::isPost()) {
 		if (Minz_Request::isPost()) {
@@ -235,13 +227,8 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
 			Minz_Translate::reset();
 			Minz_Translate::reset();
 			invalidateHttpCache();
 			invalidateHttpCache();
 
 
-			$notif = array(
-				'type' => 'good',
-				'content' => Minz_Translate::t('configuration_updated')
-			);
-			Minz_Session::_param('notification', $notif);
-
-			Minz_Request::forward(array('c' => 'configure', 'a' => 'display'), true);
+			Minz_Request::good(_t('configuration_updated'),
+				array('c' => 'configure', 'a' => 'display'));
 		}
 		}
 
 
 		$this->view->themes = FreshRSS_Themes::get();
 		$this->view->themes = FreshRSS_Themes::get();
@@ -275,8 +262,6 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
 	 *       - scrolled
 	 *       - scrolled
 	 *       - received
 	 *       - received
 	 * Default values are false unless specified.
 	 * Default values are false unless specified.
-	 *
-	 * @todo change the notification code
 	 */
 	 */
 	public function readingAction() {
 	public function readingAction() {
 		if (Minz_Request::isPost()) {
 		if (Minz_Request::isPost()) {
@@ -304,13 +289,8 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
 			Minz_Translate::reset();
 			Minz_Translate::reset();
 			invalidateHttpCache();
 			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_Request::good(_t('configuration_updated'),
+				array('c' => 'configure', 'a' => 'reading'));
 		}
 		}
 
 
 		Minz_View::prependTitle(Minz_Translate::t('reading_configuration') . ' · ');
 		Minz_View::prependTitle(Minz_Translate::t('reading_configuration') . ' · ');
@@ -322,8 +302,6 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
 	 * It displays the sharing configuration page.
 	 * It displays the sharing configuration page.
 	 * If this action is reached through a POST request, it stores all
 	 * If this action is reached through a POST request, it stores all
 	 * configuration values then sends a notification to the user.
 	 * configuration values then sends a notification to the user.
-	 *
-	 * @todo change the notification code
 	 */
 	 */
 	public function sharingAction() {
 	public function sharingAction() {
 		if (Minz_Request::isPost()) {
 		if (Minz_Request::isPost()) {
@@ -332,13 +310,8 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
 			$this->view->conf->save();
 			$this->view->conf->save();
 			invalidateHttpCache();
 			invalidateHttpCache();
 
 
-			$notif = array(
-				'type' => 'good',
-				'content' => Minz_Translate::t('configuration_updated')
-			);
-			Minz_Session::_param('notification', $notif);
-
-			Minz_Request::forward(array('c' => 'configure', 'a' => 'sharing'), true);
+			Minz_Request::good(_t('configuration_updated'),
+				array('c' => 'configure', 'a' => 'sharing'));
 		}
 		}
 
 
 		Minz_View::prependTitle(Minz_Translate::t('sharing') . ' · ');
 		Minz_View::prependTitle(Minz_Translate::t('sharing') . ' · ');
@@ -358,7 +331,6 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
 	 *
 	 *
 	 * @todo remove numbers from the list of authorized shortcuts since they
 	 * @todo remove numbers from the list of authorized shortcuts since they
 	 *       are used to access shortcuts and user queries
 	 *       are used to access shortcuts and user queries
-	 * @todo change the notification code
 	 */
 	 */
 	public function shortcutAction() {
 	public function shortcutAction() {
 		$list_keys = array('a', 'b', 'backspace', 'c', 'd', 'delete', 'down', 'e', 'end', 'enter',
 		$list_keys = array('a', 'b', 'backspace', 'c', 'd', 'delete', 'down', 'e', 'end', 'enter',
@@ -384,13 +356,8 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
 			$this->view->conf->save();
 			$this->view->conf->save();
 			invalidateHttpCache();
 			invalidateHttpCache();
 
 
-			$notif = array(
-				'type' => 'good',
-				'content' => Minz_Translate::t('shortcuts_updated')
-			);
-			Minz_Session::_param('notification', $notif);
-
-			Minz_Request::forward(array('c' => 'configure', 'a' => 'shortcut'), true);
+			Minz_Request::good(_t('shortcuts_updated'),
+				array('c' => 'configure', 'a' => 'shortcut'));
 		}
 		}
 
 
 		Minz_View::prependTitle(Minz_Translate::t('shortcuts') . ' · ');
 		Minz_View::prependTitle(Minz_Translate::t('shortcuts') . ' · ');
@@ -419,7 +386,6 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
 	 *
 	 *
 	 * @todo explain why the default value is -2 but this value does not
 	 * @todo explain why the default value is -2 but this value does not
 	 *       exist in the drop-down list
 	 *       exist in the drop-down list
-	 * @todo change the notification code
 	 * @todo refactor configuration setting syntax to be consistent with the
 	 * @todo refactor configuration setting syntax to be consistent with the
 	 *       other methods
 	 *       other methods
 	 */
 	 */
@@ -435,13 +401,8 @@ class FreshRSS_configure_Controller extends Minz_ActionController {
 			$this->view->conf->save();
 			$this->view->conf->save();
 			invalidateHttpCache();
 			invalidateHttpCache();
 
 
-			$notif = array(
-				'type' => 'good',
-				'content' => Minz_Translate::t('configuration_updated')
-			);
-			Minz_Session::_param('notification', $notif);
-
-			Minz_Request::forward(array('c' => 'configure', 'a' => 'archiving'), true);
+			Minz_Request::good(_t('configuration_updated'),
+				array('c' => 'configure', 'a' => 'archiving'));
 		}
 		}
 
 
 		Minz_View::prependTitle(Minz_Translate::t('archiving_configuration') . ' · ');
 		Minz_View::prependTitle(Minz_Translate::t('archiving_configuration') . ' · ');