From 8e1a6083cf4be6b0fb2d31863e409dfcb4705261 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Thu, 14 Jul 2011 09:23:58 +0000 Subject: a page can't be hidden or shown if it has been permanently deleted --- h-source/Application/Controllers/HistoryController.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php index a3421a9..ee68381 100644 --- a/h-source/Application/Controllers/HistoryController.php +++ b/h-source/Application/Controllers/HistoryController.php @@ -162,7 +162,8 @@ class HistoryController extends BaseController 'to_status' => 'yes', 'exec_string' => 'The device page has been hidden. Just reload the page', 'error_string' => 'Error: the device page is already hidden', - + 'allowed_only_if' => array('cleared'=>'no'), + ), 'deviceshow' => array( @@ -172,7 +173,8 @@ class HistoryController extends BaseController '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', - + 'allowed_only_if' => array('cleared'=>'no'), + ), 'deviceapprove' => array( @@ -182,7 +184,8 @@ class HistoryController extends BaseController 'to_status' => 'yes', 'exec_string' => 'The device page has been approved. Just reload the page', 'error_string' => 'Error: the device page is already approved', - + 'allowed_only_if' => array('cleared'=>'no'), + ), 'deviceclear' => array( @@ -436,6 +439,11 @@ class HistoryController extends BaseController $model->select()->where(array($clean['id_name'] => $clean['id'],$clean['field_name'] => $this->strings[$action]['check_status'])); + if (isset($this->strings[$action]['allowed_only_if']) and is_array($this->strings[$action]['allowed_only_if'])) + { + $model->aWhere($this->strings[$action]['allowed_only_if']); + } + $count = $model->rowNumber(); if ($count > 0) -- cgit v1.2.3