aboutsummaryrefslogtreecommitdiff
path: root/h-source/Application/Controllers
diff options
context:
space:
mode:
authorAntonio Gallo <tonicucoz@gmail.com>2011-07-13 15:28:30 +0000
committerAntonio Gallo <tonicucoz@gmail.com>2011-07-13 15:28:30 +0000
commitd8e1f81df2e40574c0e685910bf99407f7e66017 (patch)
treea69b5a96dff0f22a37db460d5fb2d88ff49650ec /h-source/Application/Controllers
parentbe1d2d6c4c5623c6af59cf72e74e0335d1aa6cb5 (diff)
administrators can permanently delete a device page - part 1
Diffstat (limited to 'h-source/Application/Controllers')
-rw-r--r--h-source/Application/Controllers/BaseController.php6
-rw-r--r--h-source/Application/Controllers/GenericController.php2
-rw-r--r--h-source/Application/Controllers/HistoryController.php57
-rw-r--r--h-source/Application/Controllers/SpecialController.php2
4 files changed, 53 insertions, 14 deletions
diff --git a/h-source/Application/Controllers/BaseController.php b/h-source/Application/Controllers/BaseController.php
index 02db21d..f40d45f 100644
--- a/h-source/Application/Controllers/BaseController.php
+++ b/h-source/Application/Controllers/BaseController.php
@@ -135,14 +135,14 @@ class BaseController extends Controller
$data['language_links'] = $this->buildLanguageLinks($this->lang);
$data['lastModif'] = $this->m['HistoryModel']
- ->select()
+ ->clear()->select()
->inner('hardware')
->on('hardware.id_hard=history.id')
- ->where(array('type'=>'hardware','gr'=>'registered','approved'=>'yes'))
+ ->where(array('type'=>'hardware','gr'=>'registered','deleted'=>'no'))
->orderBy('id_history desc')
->limit(5)
->send();
-
+
$this->append($data);
$this->load('right');
}
diff --git a/h-source/Application/Controllers/GenericController.php b/h-source/Application/Controllers/GenericController.php
index a5dd24c..2e7a45b 100644
--- a/h-source/Application/Controllers/GenericController.php
+++ b/h-source/Application/Controllers/GenericController.php
@@ -487,7 +487,7 @@ class GenericController extends BaseController
$data['tree'] = null;
$data['isDeleted'] = false;
- $data['md_javascript'] = "moderator_dialog(\"devicehide\",\"device\");moderator_dialog(\"deviceshow\",\"device\");moderator_dialog(\"deviceapprove\",\"device_app\");";
+ $data['md_javascript'] = "moderator_dialog(\"devicehide\",\"device\");moderator_dialog(\"deviceshow\",\"device\");moderator_dialog(\"deviceapprove\",\"device_app\");moderator_dialog(\"deviceclear\",\"device_cl\");";
if ($this->mod->checkType($clean['id_hard']))
{
diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php
index 3b6e1d2..a3421a9 100644
--- a/h-source/Application/Controllers/HistoryController.php
+++ b/h-source/Application/Controllers/HistoryController.php
@@ -32,7 +32,8 @@ class HistoryController extends BaseController
'page' => 'wiki page',
'page_del' => 'wiki page',
'device' => 'device page',
- 'device_app' => 'device page',
+ 'device_app' => 'device page',
+ 'device_cl' => 'device page',
);
public static $actionTable = array(
@@ -49,6 +50,7 @@ class HistoryController extends BaseController
'devicehide' => 'hide',
'deviceshow' => 'show',
'deviceapprove' => 'approve',
+ 'deviceclear' => 'perm deleted',
);
protected $strings = array(
@@ -182,7 +184,17 @@ class HistoryController extends BaseController
'error_string' => 'Error: the device page is already approved',
),
-
+
+ 'deviceclear' => array(
+
+ 'action' => 'deviceclear',
+ 'check_status' => 'no',
+ 'to_status' => 'yes',
+ 'exec_string' => 'The device page has been permanently deleted. Just reload the page',
+ 'error_string' => 'Error: the device page has already been permanently deleted',
+// 'method' => 'oupdate',
+
+ ),
);
protected $types = array(
@@ -266,7 +278,7 @@ class HistoryController extends BaseController
),
- //page blocked or not
+ //device page blocked or not
'device' => array(
'clean_type' => 'device',
@@ -275,11 +287,11 @@ class HistoryController extends BaseController
'field_name' => '-deleted',
'actions' => array('devicehide','deviceshow'),
'group' => 'admin',
- 'types_to_show' => 'device_app,device',
+ 'types_to_show' => 'device_app,device,device_cl',
),
- //page blocked or not
+ //device page approved
'device_app' => array(
'clean_type' => 'device_app',
@@ -290,7 +302,18 @@ class HistoryController extends BaseController
'group' => 'admin',
),
-
+
+ //device page cleared
+ 'device_cl' => array(
+
+ 'clean_type' => 'device_cl',
+ 'model_name' => 'HardwareModel',
+ 'id_name' => 'id_hard',
+ 'field_name' => 'cleared',
+ 'actions' => array('deviceclear'),
+ 'group' => 'admin',
+
+ ),
);
public function __construct($model, $controller, $queryString)
@@ -366,6 +389,11 @@ class HistoryController extends BaseController
{
$this->generic($lang, $token, 'deviceapprove');
}
+
+ public function deviceclear($lang = 'en', $token = '')
+ {
+ $this->generic($lang, $token, 'deviceclear');
+ }
protected function generic($lang = 'en', $token = '', $action = 'hide')
{
@@ -389,7 +417,7 @@ class HistoryController extends BaseController
$message = $this->request->post('message','');
$modelName = 'error';
-
+
if (array_key_exists($type,$this->types))
{
if (in_array($action,$this->types[$type]['actions']))
@@ -406,8 +434,10 @@ class HistoryController extends BaseController
$this->model($modelName);
$model = $this->m[$modelName];
- $count = $model->select()->where(array($clean['id_name'] => $clean['id'],$clean['field_name'] => $this->strings[$action]['check_status']))->rowNumber();
+ $model->select()->where(array($clean['id_name'] => $clean['id'],$clean['field_name'] => $this->strings[$action]['check_status']));
+ $count = $model->rowNumber();
+
if ($count > 0)
{
if (eg_strlen($message) < 500)
@@ -417,7 +447,15 @@ class HistoryController extends BaseController
//hide the message
$model->values = array($clean['field_name'] => $this->strings[$action]['to_status']);
- $model->pUpdate($clean['id']);
+
+ if (isset($this->strings[$action]['method']))
+ {
+ call_user_func(array($model, $this->strings[$action]['method']),$clean['id']);
+ }
+ else
+ {
+ $model->pUpdate($clean['id']);
+ }
if ($model->queryResult)
{
@@ -533,6 +571,7 @@ class HistoryController extends BaseController
'devicehide' => 'hidden',
'deviceshow' => 'restored',
'deviceapprove' => 'approved',
+ 'deviceclear' => 'permanently deleted',
);
$this->append($data);
diff --git a/h-source/Application/Controllers/SpecialController.php b/h-source/Application/Controllers/SpecialController.php
index 6ef632a..db3975b 100644
--- a/h-source/Application/Controllers/SpecialController.php
+++ b/h-source/Application/Controllers/SpecialController.php
@@ -104,7 +104,7 @@ class SpecialController extends BaseController
$whereClauseArray = array(
'gr' => 'registered',
'type' => 'hardware',
- 'approved' => 'yes',
+ 'deleted' => 'no',
);
$this->helper('Pages','special/'.$this->action.'/'.$this->lang,'page');