From e29f02659a5328a52042fb43bd3baad321ee3e91 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Thu, 23 Jun 2011 19:45:28 +0000 Subject: administrators can now approve device page submitted by anonymous users --- .../Application/Controllers/GenericController.php | 3 +- .../Application/Controllers/HistoryController.php | 52 ++++++++++++++++++---- 2 files changed, 46 insertions(+), 9 deletions(-) (limited to 'h-source/Application/Controllers') diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php index 92831f7..949f3ae 100644 --- a/h-source/Application/Controllers/GenericController.php +++ b/h-source/Application/Controllers/GenericController.php @@ -472,7 +472,7 @@ class GenericController extends BaseController $data['tree'] = null; $data['isDeleted'] = false; - $data['md_javascript'] = "moderator_dialog(\"devicehide\",\"device\");moderator_dialog(\"deviceshow\",\"device\");"; + $data['md_javascript'] = "moderator_dialog(\"devicehide\",\"device\");moderator_dialog(\"deviceshow\",\"device\");moderator_dialog(\"deviceapprove\",\"device_app\");"; if ($this->mod->checkType($clean['id_hard'])) { @@ -489,6 +489,7 @@ class GenericController extends BaseController $data['title'] = $data['ne_name'].' - '.Website::$generalName; $data['tree'] = $this->getSpecHardLink() . " » ".$data['ne_name'].""; $data['isDeleted'] = $this->m['HardwareModel']->isDeleted($clean['id_hard']); + $data['isApproved'] = strcmp($data['table'][0]['hardware']['approved'],'yes') === 0 ? true : false; if ($data['isDeleted']) { diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php index ead0886..a92f906 100644 --- a/h-source/Application/Controllers/HistoryController.php +++ b/h-source/Application/Controllers/HistoryController.php @@ -24,14 +24,15 @@ class HistoryController extends BaseController { public static $typeTable = array( - 'message' => 'message', - 'talk' => 'talk', - 'user' => 'user', - 'issue' => 'issue', - 'wiki_talk' => 'wiki talk', - 'page' => 'wiki page', - 'page_del' => 'wiki page', - 'device' => 'device page', + 'message' => 'message', + 'talk' => 'talk', + 'user' => 'user', + 'issue' => 'issue', + 'wiki_talk' => 'wiki talk', + 'page' => 'wiki page', + 'page_del' => 'wiki page', + 'device' => 'device page', + 'device_app' => 'device page', ); public static $actionTable = array( @@ -47,6 +48,7 @@ class HistoryController extends BaseController 'pageshow' => 'show', 'devicehide' => 'hide', 'deviceshow' => 'show', + 'deviceapprove' => 'approve', ); protected $strings = array( @@ -170,6 +172,17 @@ class HistoryController extends BaseController 'error_string' => 'Error: the device page is already visible', ), + + 'deviceapprove' => array( + + 'action' => 'deviceapprove', + 'check_status' => 'no', + 'to_status' => 'yes', + 'exec_string' => 'The device page has been approved. Just reload the page', + 'error_string' => 'Error: the device page is already approved', + + ), + ); protected $types = array( @@ -264,6 +277,19 @@ class HistoryController extends BaseController 'group' => 'admin', ), + + //page blocked or not + 'device_app' => array( + + 'clean_type' => 'device_app', + 'model_name' => 'HardwareModel', + 'id_name' => 'id_hard', + 'field_name' => 'approved', + 'actions' => array('deviceapprove'), + 'group' => 'admin', + + ), + ); public function __construct($model, $controller, $queryString) @@ -334,6 +360,11 @@ class HistoryController extends BaseController { $this->generic($lang, $token, 'deviceshow'); } + + public function deviceapprove($lang = 'en', $token = '') + { + $this->generic($lang, $token, 'deviceapprove'); + } protected function generic($lang = 'en', $token = '', $action = 'hide') { @@ -450,6 +481,10 @@ class HistoryController extends BaseController $data['object'] = 'device page'; $data['box_class'] = 'details_of_actions_inner_user'; break; + case 'device_app': + $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'; @@ -479,6 +514,7 @@ class HistoryController extends BaseController 'pageshow' => 'restored', 'devicehide' => 'hidden', 'deviceshow' => 'restored', + 'deviceapprove' => 'approved', ); $this->append($data); -- cgit v1.2.3