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 ++++++++++++++++++---- h-source/Application/Include/hardware.php | 1 + h-source/Application/Include/languages.php | 4 +- h-source/Application/Include/myFunctions.php | 4 ++ h-source/Application/Models/HardwareModel.php | 7 +++ h-source/Application/Views/top_left.php | 7 ++- h-source/Config/Route.php | 1 + 8 files changed, 68 insertions(+), 11 deletions(-) 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); diff --git a/h-source/Application/Include/hardware.php b/h-source/Application/Include/hardware.php index 3e5342f..5f6ea9b 100644 --- a/h-source/Application/Include/hardware.php +++ b/h-source/Application/Include/hardware.php @@ -215,6 +215,7 @@ class Notebooks extends Hardware "Dell" => "Dell", "emachines" => "emachines", "FUJITSU" => "FUJITSU", + "Garlach44" => "Garlach44", "Gateway" => "Gateway", "Hewlett Packard" => "Hewlett-Packard", "IBM" => "IBM", diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php index 798a0aa..b524432 100644 --- a/h-source/Application/Include/languages.php +++ b/h-source/Application/Include/languages.php @@ -237,7 +237,9 @@ class Lang /*0199*/"see the page" => "guarda la pagina", /*0200*/"hidden device pages" => "pagine nascoste di dispositivi", /*0201*/"panel" => "pannello", - /*0202*/"List of hidden device pages" => "Lista di pagine nascoste di dispositivi" + /*0202*/"List of hidden device pages" => "Lista di pagine nascoste di dispositivi", + /*0203*/"approve the device page" => "approva la pagina del dispositivo", + /*0204*/"This device page has not been approved yet" => "La pagina del dispositivo non รจ ancora stata approvata", ), 'es' => array ( diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php index 174c7ea..4876676 100644 --- a/h-source/Application/Include/myFunctions.php +++ b/h-source/Application/Include/myFunctions.php @@ -4708,6 +4708,10 @@ function goToModeratedItem( $row = array() ) $hardInfo = getHardwareInfoFromId($row['id']); $url = $hardInfo['controller'].'/view/'.Lang::$current.'/'.$row['id'].'/'.encodeUrl($hardInfo['model']); break; + case 'device_app': + $hardInfo = getHardwareInfoFromId($row['id']); + $url = $hardInfo['controller'].'/view/'.Lang::$current.'/'.$row['id'].'/'.encodeUrl($hardInfo['model']); + break; } return 'http://'.DOMAIN_NAME.'/'.$url; } diff --git a/h-source/Application/Models/HardwareModel.php b/h-source/Application/Models/HardwareModel.php index 3badd71..11aea59 100644 --- a/h-source/Application/Models/HardwareModel.php +++ b/h-source/Application/Models/HardwareModel.php @@ -74,6 +74,13 @@ class HardwareModel extends Model_Map { public function pUpdate($id) { + if (isset($this->values['approved'])) + { + if (strcmp($this->values['approved'],'yes') === 0) + { + $this->values['deleted'] = 'no'; + } + } return parent::update($id); } diff --git a/h-source/Application/Views/top_left.php b/h-source/Application/Views/top_left.php index 42e621f..148a863 100644 --- a/h-source/Application/Views/top_left.php +++ b/h-source/Application/Views/top_left.php @@ -31,11 +31,16 @@
- + "> + + + + "> + "> diff --git a/h-source/Config/Route.php b/h-source/Config/Route.php index 27070b3..a03e718 100644 --- a/h-source/Config/Route.php +++ b/h-source/Config/Route.php @@ -131,6 +131,7 @@ class Route 'history,pageshow', 'history,devicehide', 'history,deviceshow', + 'history,deviceapprove', 'threegcards,catalogue', 'threegcards,view', 'threegcards,history', -- cgit v1.2.3