From 9a5338f565e600e618cc4546abbf18d30d942b3a Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Sun, 5 Jun 2011 11:09:40 +0000 Subject: improved the way deleted devices are managed --- .../Application/Controllers/HistoryController.php | 71 +++++++++++++++++++--- 1 file changed, 61 insertions(+), 10 deletions(-) (limited to 'h-source/Application/Controllers/HistoryController.php') diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php index e44ce79..71055fc 100644 --- a/h-source/Application/Controllers/HistoryController.php +++ b/h-source/Application/Controllers/HistoryController.php @@ -31,6 +31,7 @@ class HistoryController extends BaseController 'wiki_talk' => 'wiki talk', 'page' => 'wiki page', 'page_del' => 'wiki page', + 'device' => 'device page', ); public static $actionTable = array( @@ -44,6 +45,8 @@ class HistoryController extends BaseController 'pageunblock' => 'unblock', 'pagehide' => 'hide', 'pageshow' => 'show', + 'devicehide' => 'hide', + 'deviceshow' => 'show', ); protected $strings = array( @@ -147,6 +150,26 @@ class HistoryController extends BaseController 'error_string' => 'Error: the wiki page is already visible', ), + + 'devicehide' => array( + + 'action' => 'devicehide', + 'check_status' => 'no', + 'to_status' => 'yes', + 'exec_string' => 'The device page has been hidden. Just reload the page', + 'error_string' => 'Error: the device page is already hidden', + + ), + + 'deviceshow' => array( + + 'action' => 'deviceshow', + 'check_status' => 'yes', + 'to_status' => 'no', + 'exec_string' => 'The device page is no more hidden. Just reload the page', + 'error_string' => 'Error: the device page is already visible', + + ), ); protected $types = array( @@ -229,6 +252,18 @@ class HistoryController extends BaseController 'group' => 'admin', ), + + //page blocked or not + 'device' => array( + + 'clean_type' => 'device', + 'model_name' => 'HardwareModel', + 'id_name' => 'id_hard', + 'field_name' => '-deleted', + 'actions' => array('devicehide','deviceshow'), + 'group' => 'moderator', + + ), ); public function __construct($model, $controller, $queryString) @@ -289,6 +324,16 @@ class HistoryController extends BaseController { $this->generic($lang, $token, 'pageshow'); } + + public function devicehide($lang = 'en', $token = '') + { + $this->generic($lang, $token, 'devicehide'); + } + + public function deviceshow($lang = 'en', $token = '') + { + $this->generic($lang, $token, 'deviceshow'); + } protected function generic($lang = 'en', $token = '', $action = 'hide') { @@ -401,6 +446,10 @@ class HistoryController extends BaseController $data['object'] = 'wiki page'; $data['box_class'] = 'details_of_actions_inner_user'; break; + case 'device': + $data['object'] = 'device page'; + $data['box_class'] = 'details_of_actions_inner_user'; + break; case 'page_del': $data['object'] = 'wiki page'; $data['box_class'] = 'details_of_actions_inner_user'; @@ -418,16 +467,18 @@ class HistoryController extends BaseController $data['res'] = $this->m['HistoryModel']->select()->where(array('id'=>$clean['id'],'type'=>$clean['type'],'gr'=>$clean['group']))->send(); $data['md_action'] = array( - 'hide' => 'hidden', - 'show' => 'restored', - 'block' => 'blocked', - 'unblock' => 'un-blocked', - 'open' => 'opened again', - 'close' => 'closed', - 'pageblock' => 'blocked', - 'pageunblock' => 'un-blocked', - 'pagehide' => 'hidden', - 'pageshow' => 'restored', + 'hide' => 'hidden', + 'show' => 'restored', + 'block' => 'blocked', + 'unblock' => 'un-blocked', + 'open' => 'opened again', + 'close' => 'closed', + 'pageblock' => 'blocked', + 'pageunblock' => 'un-blocked', + 'pagehide' => 'hidden', + 'pageshow' => 'restored', + 'devicehide' => 'hidden', + 'deviceshow' => 'restored', ); $this->append($data); -- cgit v1.2.3