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 +- h-source/Application/Include/myFunctions.php | 3 ++ h-source/Application/Views/Issues/view.php | 29 ++++++++++++- h-source/Config/Route.php | 2 + 5 files changed, 79 insertions(+), 4 deletions(-) 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) diff --git a/h-source/Application/Include/myFunctions.php b/h-source/Application/Include/myFunctions.php index fa87b08..7e509cd 100644 --- a/h-source/Application/Include/myFunctions.php +++ b/h-source/Application/Include/myFunctions.php @@ -386,6 +386,9 @@ function goToModeratedItem( $row = array() ) case 'user': $url = 'meet/user/'.Lang::$current.'/'.getUserName($row['id']); break; + case 'issue': + $url = 'issues/view/'.Lang::$current.'/'.$row['id']; + break; } return 'http://'.DOMAIN_NAME.'/'.$url; } diff --git a/h-source/Application/Views/Issues/view.php b/h-source/Application/Views/Issues/view.php index 1575d23..5789837 100644 --- a/h-source/Application/Views/Issues/view.php +++ b/h-source/Application/Views/Issues/view.php @@ -38,7 +38,32 @@
- + + + +
+ + This issue is opened + + ">close the issue + + + This issue is closed + + ">open the issue again + + + + +
+
issue
+ ">view details +
+
+ +
+ +
@@ -46,7 +71,7 @@
submitted by getUser($row['issues']['created_by']));?>,
- +
diff --git a/h-source/Config/Route.php b/h-source/Config/Route.php index 1a3161a..c90f99d 100644 --- a/h-source/Config/Route.php +++ b/h-source/Config/Route.php @@ -100,6 +100,8 @@ class Route 'history,show', 'history,block', 'history,unblock', + 'history,open', + 'history,close', 'history,viewall', 'threegcards,catalogue', 'threegcards,view', -- cgit v1.2.3