From 99a6ba9947839d62a3f09f48a0ba962c23794491 Mon Sep 17 00:00:00 2001
From: Antonio Gallo <tonicucoz@gmail.com>
Date: Thu, 6 Oct 2011 19:43:29 +0000
Subject: moderators can now hide issues - part 2

---
 .../Application/Controllers/IssuesController.php   |  6 +--
 h-source/Application/Include/languages.php         |  8 ++++
 h-source/Application/Views/Issues/view.php         | 14 +++----
 h-source/Application/Views/Issues/viewall.php      | 10 +++--
 h-source/Public/Css/main.css                       | 45 +++++++++++++++++-----
 5 files changed, 61 insertions(+), 22 deletions(-)

diff --git a/h-source/Application/Controllers/IssuesController.php b/h-source/Application/Controllers/IssuesController.php
index 274bc56..e69c598 100644
--- a/h-source/Application/Controllers/IssuesController.php
+++ b/h-source/Application/Controllers/IssuesController.php
@@ -98,16 +98,16 @@ class IssuesController extends BaseController
 		//load the Pages helper
 		$this->helper('Pages',$this->controller.'/viewall/'.$this->lang,'page');
 		//get the number of records
-		$this->m['IssuesModel']->from('issues left join messages')->using('id_issue')->aWhere(array('deleted'=>'no'))->groupBy('issues.id_issue')->orderBy('issues.update_date desc');
+		$this->m['IssuesModel']->from('issues')->left('messages')->using('id_issue')->groupBy('issues.id_issue')->orderBy('issues.update_date desc');
 		
 		$recordNumber = $this->m['IssuesModel']->rowNumber();
 		$page = $this->viewArgs['page'];
 		//set the limit clause
 		$this->m['IssuesModel']->limit = $this->h['Pages']->getLimit($page,$recordNumber,20);
-		$data['table'] = $this->m['IssuesModel']->getFields('issues.*,messages.message,count(*) as numb_mess');
+		$data['table'] = $this->m['IssuesModel']->select('issues.*,messages.message,count(*) as numb_mess')->send();
 		
 		$data['pageList'] = $this->h['Pages']->render($page-3,7);
-		
+
 		$this->append($data);
 		$this->load('viewall');
 		$this->right();
diff --git a/h-source/Application/Include/languages.php b/h-source/Application/Include/languages.php
index de36683..4839e43 100644
--- a/h-source/Application/Include/languages.php
+++ b/h-source/Application/Include/languages.php
@@ -303,6 +303,14 @@ class Lang
 				/*0255*/"Would you like to add it to the database?"	=>	"Vorresti inserirlo nel database?",
 				/*0256*/"can free operating systems be installed?"	=>	"possono essere installati sistemi operativi liberi?",
 				/*0257*/"This issue has been deleted"	=>	"Questa questione è stata cancellata",
+				/*0258*/"hidden for those who are not moderators"	=>	"Nascosto per coloro che non sono moderatori",
+				/*0259*/"This issue is hidden for all the users that are not moderators"	=>	"Questa questione è nascosta per tutti gli utenti non moderatori",
+				/*0260*/"hide the issue"	=>	"nascondi la questione",
+				/*0261*/"show the issue"	=>	"mostra la questione",
+				/*0262*/"open the issue again"	=>	"apri nuovamente la questione",
+				/*0263*/"close the issue"	=>	"chiudi la questione",
+				/*0264*/"This issue is closed"	=>	"Questa questione è stata chiusa",
+				/*0265*/"This issue is opened"	=>	"Questa questione è aperta",
 			),
 		'es'	=>	array
 			(
diff --git a/h-source/Application/Views/Issues/view.php b/h-source/Application/Views/Issues/view.php
index cbedcde..769717a 100644
--- a/h-source/Application/Views/Issues/view.php
+++ b/h-source/Application/Views/Issues/view.php
@@ -43,25 +43,25 @@
 			<!--open/close an issue-->
 			<div class="moderator_box">
 				<?php if (strcmp($row['issues']['status'],'opened') == 0) { ?>
-					This issue is opened
+					<?php echo gtext("This issue is opened");?>
 
-					<a id="<?php echo $row['issues']['id_issue'];;?>" class="close_issue block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Glaze/folder_blue.png">close the issue</a>
+					<a id="<?php echo $row['issues']['id_issue'];;?>" class="close_issue block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Glaze/folder_blue.png"><?php echo gtext("close the issue");?></a>
 
 				<?php } else {	?>
-					This issue is closed
+					<?php echo gtext("This issue is closed");?>
 
-					<a id="<?php echo $row['issues']['id_issue'];;?>" class="open_issue block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Glaze/folder_blue_open.png">open the issue again</a>
+					<a id="<?php echo $row['issues']['id_issue'];;?>" class="open_issue block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Glaze/folder_blue_open.png"><?php echo gtext("open the issue again");?></a>
 
 				<?php } ?>
 
 				<?php if (strcmp($row['issues']['deleted'],'no') == 0) { ?>
 
-					<a id="<?php echo $row['issues']['id_issue'];;?>" class="issuehide_issue_del block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_cancel.png">hide the issue</a>
+					<a id="<?php echo $row['issues']['id_issue'];;?>" class="issuehide_issue_del 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 issue");?></a>
 
 				<?php } else {	?>
-					<div class="issue_hidden_notice">This issue is hidden for all the users that are not moderators</div>
+					<div class="issue_hidden_notice"><?php echo gtext("This issue is hidden for all the users that are not moderators");?></div>
 
-					<a id="<?php echo $row['issues']['id_issue'];;?>" class="issueshow_issue_del block_general" href="<?php echo $this->baseUrl."/home/index/$lang";?>"><img src="<?php echo $this->baseUrl;?>/Public/Img/Crystal/button_ok.png">show the issue</a>
+					<a id="<?php echo $row['issues']['id_issue'];;?>" class="issueshow_issue_del 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("show the issue");?></a>
 
 				<?php } ?>
 
diff --git a/h-source/Application/Views/Issues/viewall.php b/h-source/Application/Views/Issues/viewall.php
index 1705670..d5d652f 100644
--- a/h-source/Application/Views/Issues/viewall.php
+++ b/h-source/Application/Views/Issues/viewall.php
@@ -55,8 +55,10 @@
 				</thead>
 				
 				<?php foreach ($table as $row) { ?>
-				<tr>
-					<td><a href="<?php echo $this->baseUrl."/issues/view/$lang/".$row['issues']['id_issue'].$this->viewStatus;?>"><?php echo $row['issues']['title'];?></a></td>
+
+				<?php if (strcmp($row['issues']['deleted'],'no') === 0 or $ismoderator) { ?>
+				<tr class="issue_deleted_<?php echo $row['issues']['deleted']?>">
+					<td><a href="<?php echo $this->baseUrl."/issues/view/$lang/".$row['issues']['id_issue'].$this->viewStatus;?>"><?php echo $row['issues']['title'];?></a> <span>(<?php echo gtext("hidden for those who are not moderators");?>)</span></td>
 					<td><?php echo str_replace('-',' ',$row['issues']['topic']);?></td>
 					<td><?php echo getLinkToUser($u->getUser($row['issues']['created_by']));?></td>
 					<td><?php echo smartDate($row['issues']['update_date']);?></td>
@@ -76,6 +78,8 @@
 					<td><?php echo $row['issues']['status'];?></td>
 				</tr>
 				<?php } ?>
+				
+				<?php } ?>
 			</table>
 		</div>
 		
@@ -86,7 +90,7 @@
 		<?php if ($islogged === 'yes') { ?>
 			
 			<div class="add_issue_form">
-				 <div class="add_issue_form_title">
+				<div class="add_issue_form_title">
 					<a name="form"><?php echo gtext("Add a new issue");?></a>
 				</div>
 			
diff --git a/h-source/Public/Css/main.css b/h-source/Public/Css/main.css
index 31b120a..dacb52b 100644
--- a/h-source/Public/Css/main.css
+++ b/h-source/Public/Css/main.css
@@ -1069,19 +1069,49 @@ ins
 }
 .issues_viewall_table
 {
-	font:normal 14px/1 sans-serif,arial;
+	font:normal 13px/1 sans-serif,arial;
 }
+
 .issues_viewall_table td
 {
-/* 	background:#E6E6FA; */
+/* 	background:#F0FFFF; */
 	padding:5px;
 /* 	border-bottom:1px solid #E6E6FA; */
 }
+.issues_viewall_table td a
+{
+	color:#3E3E3E;
+}
+.issue_deleted_yes td
+{
+	background-color:#E6E6FA;
+}
+
+.issue_deleted_yes span
+{
+	color:red;
+	padding-left:5px;
+	font-size:10px;
+}
+
+.issue_deleted_no span
+{
+	display:none;
+}
+
+.issue_deleted_yes,
+.issue_deleted_yes td a
+{
+	color:#808080;
+}
+
 .issues_viewall_table th
 {
 	background:#ADD8E6;
-	border-top:1px solid #4169E1;
-	border-bottom:1px solid #4169E1;
+/* 	font-weight:normal; */
+/* 	border-top:1px solid #4169E1; */
+/* 	border-left:4px solid #4169E1; */
+/* 	border-bottom:1px solid #4169E1; */
 	padding:5px;
 }
 
@@ -1958,11 +1988,8 @@ div#description_tabs_content
 {
 	width:500px;
 	float:left;
-	padding:5px;
-	margin:10px 0;
-/* 	font-style:italic; */
-/* 	border: 1px solid #F65637; */
-	background-color:#F65637;
+	margin-bottom:10px;
+	color:red;
 }
 .show_hidden_box_ext
 {
-- 
cgit v1.2.3