From 98cde2db446345b80636fe933702d8fc72179965 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Wed, 29 Dec 2010 22:08:39 +0000 Subject: moderators can now open/close issues - part 1 --- .../Application/Controllers/HistoryController.php | 47 +++++++++++++++++++++- .../Application/Controllers/IssuesController.php | 2 +- 2 files changed, 47 insertions(+), 2 deletions(-) (limited to 'h-source/Application/Controllers') diff --git a/h-source/Application/Controllers/HistoryController.php b/h-source/Application/Controllers/HistoryController.php index 76b1158..f5ae1a2 100644 --- a/h-source/Application/Controllers/HistoryController.php +++ b/h-source/Application/Controllers/HistoryController.php @@ -65,6 +65,26 @@ class HistoryController extends BaseController ), + 'open' => array( + + 'action' => 'open', + 'check_status' => 'closed', + 'to_status' => 'opened', + 'exec_string' => 'The issue has been opened. Just reload the page', + 'error_string' => 'Error: the issue is already opened', + + ), + + 'close' => array( + + 'action' => 'close', + 'check_status' => 'opened', + 'to_status' => 'closed', + 'exec_string' => 'The issue has been closed. Just reload the page', + 'error_string' => 'Error: the issue is already closed', + + ), + ); protected $types = array( @@ -102,6 +122,17 @@ class HistoryController extends BaseController ), + 'issue' => array( + + 'clean_type' => 'issue', + 'model_name' => 'IssuesModel', + 'id_name' => 'id_issue', + 'field_name' => 'status', + 'actions' => array('open','close'), + 'group' => 'moderator', + + ), + ); public function __construct($model, $controller, $queryString) @@ -133,6 +164,16 @@ class HistoryController extends BaseController $this->generic($lang, $token, 'unblock'); } + public function open($lang = 'en', $token = '') + { + $this->generic($lang, $token, 'open'); + } + + public function close($lang = 'en', $token = '') + { + $this->generic($lang, $token, 'close'); + } + protected function generic($lang = 'en', $token = '', $action = 'hide') { header('Content-type: text/html; charset=UTF-8'); @@ -237,6 +278,10 @@ class HistoryController extends BaseController $data['object'] = 'user'; $data['box_class'] = 'details_of_actions_inner_user'; break; + case 'issue': + $data['object'] = 'issue'; + $data['box_class'] = 'details_of_actions_inner_user'; + break; default: $data['object'] = 'message'; $data['box_class'] = 'details_of_actions_inner'; @@ -245,7 +290,7 @@ class HistoryController extends BaseController $data['res'] = $this->m['HistoryModel']->select()->where(array('id'=>$clean['id'],'type'=>$clean['type'],'gr'=>$clean['group']))->send(); - $data['md_action'] = array('hide'=>'hidden','show'=>'restored','block'=>'blocked','unblock'=>'un-blocked'); + $data['md_action'] = array('hide'=>'hidden','show'=>'restored','block'=>'blocked','unblock'=>'un-blocked','open'=>'opened again','close'=>'closed'); $this->append($data); $this->load('viewall'); diff --git a/h-source/Application/Controllers/IssuesController.php b/h-source/Application/Controllers/IssuesController.php index 2a584b7..9c0715d 100644 --- a/h-source/Application/Controllers/IssuesController.php +++ b/h-source/Application/Controllers/IssuesController.php @@ -168,7 +168,7 @@ class IssuesController extends BaseController $data['table'] = $this->m['IssuesModel']->select('id_issue,created_by,title,status,creation_date,topic,priority,message,notice')->where(array('id_issue'=>$clean['id_issue'],'deleted'=>'no'))->send(); // javascript for moderator - $data['md_javascript'] = "moderator_dialog(\"hide\",\"message\");moderator_dialog(\"show\",\"message\");"; + $data['md_javascript'] = "moderator_dialog(\"hide\",\"message\");moderator_dialog(\"show\",\"message\");moderator_dialog(\"open\",\"issue\");moderator_dialog(\"close\",\"issue\");"; $data['go_to'] = $this->currPage."/".$this->lang."/".$clean['id_issue']; if (count($data['table']) > 0) -- cgit v1.2.3