diff --git a/app/App_FrontController.php b/app/App_FrontController.php index 80c566781e5..83d4372ebfc 100644 --- a/app/App_FrontController.php +++ b/app/App_FrontController.php @@ -13,6 +13,7 @@ public function init () { Session::init (); // lancement de la session doit se faire après chargement des modèles sinon bug (pourquoi ?) $this->loadParamsView (); $this->loadStylesAndScripts (); + $this->loadNotifications (); } private function loadLibs () { @@ -31,6 +32,7 @@ private function loadStylesAndScripts () { View::prependStyle (Url::display ('/theme/base.css')); View::appendScript ('https://login.persona.org/include.js'); View::appendScript (Url::display ('/scripts/jquery.js')); + View::appendScript (Url::display ('/scripts/notification.js')); } private function loadParamsView () { @@ -39,4 +41,12 @@ private function loadParamsView () { $entryDAO = new EntryDAO (); View::_param ('nb_not_read', $entryDAO->countNotRead ()); } + + private function loadNotifications () { + $notif = Session::param ('notification'); + if ($notif) { + View::_param ('notification', $notif); + Session::_param ('notification'); + } + } } diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 40c514b5a94..d86cda14cfe 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -41,6 +41,14 @@ public function categorizeAction () { $catDAO->addCategory ($values); } + // notif + $notif = array ( + 'type' => 'good', + 'content' => 'Les catégories ont été mises à jour' + ); + Session::_param ('notification', $notif); + + Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true); } $this->view->categories = $catDAO->listCategories (); @@ -75,6 +83,15 @@ public function feedAction () { $feedDAO->updateFeed ($id, $values); $this->view->flux->_category ($cat); + + // notif + $notif = array ( + 'type' => 'good', + 'content' => 'Le flux a été mis à jour' + ); + Session::_param ('notification', $notif); + + Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => array ('id' => $id)), true); } View::prependTitle ('Gestion des flux RSS - ' . $this->view->flux->name () . ' - '); @@ -113,6 +130,15 @@ public function displayAction () { $confDAO->update ($values); Session::_param ('conf', $this->view->conf); Session::_param ('mail', $this->view->conf->mailLogin ()); + + // notif + $notif = array ( + 'type' => 'good', + 'content' => 'La configuration a été mise à jour' + ); + Session::_param ('notification', $notif); + + Request::forward (array ('c' => 'configure', 'a' => 'display'), true); } View::prependTitle ('Gestion générale et affichage - '); @@ -183,6 +209,15 @@ public function shortcutAction () { $confDAO = new RSSConfigurationDAO (); $confDAO->update ($values); Session::_param ('conf', $this->view->conf); + + // notif + $notif = array ( + 'type' => 'good', + 'content' => 'Les raccourcis ont été mis à jour' + ); + Session::_param ('notification', $notif); + + Request::forward (array ('c' => 'configure', 'a' => 'shortcut'), true); } View::prependTitle ('Gestion des raccourcis - '); diff --git a/app/controllers/entryController.php b/app/controllers/entryController.php index cf510e36237..ca702191f5a 100755 --- a/app/controllers/entryController.php +++ b/app/controllers/entryController.php @@ -40,6 +40,13 @@ public function readAction () { $entryDAO = new EntryDAO (); if ($id == false) { $entryDAO->updateEntries ($values); + + // notif + $notif = array ( + 'type' => 'good', + 'content' => 'Tous les flux ont été marqués comme lu' + ); + Session::_param ('notification', $notif); } else { $entryDAO->updateEntry ($id, $values); } diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index eed8ccafa3c..d459ba0cb2f 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -43,8 +43,20 @@ public function addAction () { ); $entryDAO->addEntry ($values); } + + // notif + $notif = array ( + 'type' => 'good', + 'content' => 'Le flux ' . $feed->url () . ' a bien été ajouté' + ); + Session::_param ('notification', $notif); } catch (Exception $e) { - // TODO ajouter une erreur : url non valide + // notif + $notif = array ( + 'type' => 'bad', + 'content' => 'L\'url ' . $url . ' est invalide' + ); + Session::_param ('notification', $notif); } Request::forward (array (), true); @@ -81,6 +93,13 @@ public function actualizeAction () { $entryDAO->cleanOldEntries ($this->view->conf->oldEntries ()); + // notif + $notif = array ( + 'type' => 'good', + 'content' => 'Les flux ont été mis à jour' + ); + Session::_param ('notification', $notif); + Request::forward (array (), true); } @@ -139,6 +158,13 @@ public function massiveImportAction () { ); $feedDAO->addFeed ($values); } + + // notif + $notif = array ( + 'type' => 'good', + 'content' => 'Les flux ont été importés' + ); + Session::_param ('notification', $notif); Request::forward (array ('c' => 'configure', 'a' => 'importExport')); } @@ -155,6 +181,13 @@ public function deleteAction () { $feedDAO = new FeedDAO (); $feedDAO->deleteFeed ($id); + + // notif + $notif = array ( + 'type' => 'good', + 'content' => 'Le flux a été supprimé' + ); + Session::_param ('notification', $notif); Request::forward (array ('c' => 'configure', 'a' => 'feed'), true); } diff --git a/app/layout/layout.phtml b/app/layout/layout.phtml index e73f14ba18b..bae39503330 100644 --- a/app/layout/layout.phtml +++ b/app/layout/layout.phtml @@ -17,5 +17,11 @@ partial ('persona'); ?> +notification)) { ?> +