aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-06-23 19:45:28 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-06-23 19:45:28 +0000
commite29f02659a5328a52042fb43bd3baad321ee3e91 (patch)
treeb8f6fc9ba122bc5094974e932458f069285fc6b0
parent34adb20d0ffe996bf454ade33ff02fef70968730 (diff)
administrators can now approve device page submitted by anonymous users
-rw-r--r--h-source/Application/Controllers/GenericController.php3
-rw-r--r--h-source/Application/Controllers/HistoryController.php52
-rw-r--r--h-source/Application/Include/hardware.php1
-rw-r--r--h-source/Application/Include/languages.php4
-rw-r--r--h-source/Application/Include/myFunctions.php4
-rw-r--r--h-source/Application/Models/HardwareModel.php7
-rw-r--r--h-source/Application/Views/top_left.php7
-rw-r--r--h-source/Config/Route.php1
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() . " &raquo; <span class='last_tree_element'>".$data['ne_name']."</span>";
$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 @@
<!--delete the page-->
<?php if ($isadmin) { ?>
<div class="moderator_box_deleted clear_right">
- <?php if ($isDeleted) { ?>
+ <?php if ($isDeleted and $isApproved) { ?>
<?php echo gtext('This device page has been hidden'); ?>
<a id="<?php echo $id_hard;?>" class="deviceshow_device block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_ok.png"><?php echo gtext('restore the device page'); ?></a>
+ <?php } else if ($isDeleted and !$isApproved) { ?>
+ <?php echo gtext("This device page has not been approved yet");?>
+
+ <a id="<?php echo $id_hard;?>" class="deviceapprove_device_approved block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_ok.png"><?php echo gtext('approve the device page'); ?></a>
+
<?php } else { ?>
<a id="<?php echo $id_hard;?>" class="devicehide_device block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_cancel.png"><?php echo gtext('hide the device page'); ?></a>
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',