2
0
Эх сурвалжийг харах

Update app_menu.php (#64)

* Update app_menu.php

Adds visibility for the domain admin. Perhaps they would like to see a summary of the different accountcodes in their system.

* Update app_languages.php

* Update domain_counts.php

* Update app_config.php
konradSC 8 жил өмнө
parent
commit
1f03685d76

+ 7 - 2
domain_counts/app_config.php

@@ -16,7 +16,12 @@
 		$apps[$x]['permissions'][$y]['name'] = "domain_counts_view";
 		$apps[$x]['permissions'][$y]['menu']['uuid'] = "8db32ec2-85dc-4782-a7b1-d0caf8a4e44e";
 		$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
+		$apps[$x]['permissions'][$y]['groups'][] = "admin";
 		$y++;		
+		$apps[$x]['permissions'][$y]['name'] = "domain_counts_view_domain";
+		$apps[$x]['permissions'][$y]['groups'][] = "admin";
+		$y++;
+		$apps[$x]['permissions'][$y]['name'] = "domain_counts_view_all";
+		$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
+		$y++;			
 		
-
-?>

+ 1 - 1
domain_counts/app_languages.php

@@ -5,7 +5,7 @@ $text['header-domain_counts']['en-us'] = "Domain Counts";
 
 $text['header-domain_counts_accountcodes']['en-us'] = "Accountcodes";
 
-$text['description-domain_counts']['en-us'] = "Displays the number of items from all domains";
+$text['description-domain_counts']['en-us'] = "Displays the number of items for each domain";
 
 $text['description-domain_counts_accountcodes']['en-us'] = "Displays the number of extensions assigned to each domain accountcode.";
 

+ 1 - 0
domain_counts/app_menu.php

@@ -17,5 +17,6 @@ $apps[$x]['menu'][0]['parent_uuid'] = "0438b504-8613-7887-c420-c837ffb20cb1";
 $apps[$x]['menu'][0]['category'] = "internal";
 $apps[$x]['menu'][0]['path'] = "/app/domain_counts/domain_counts.php";
 $apps[$x]['menu'][0]['groups'][] = "superadmin";
+$apps[$x]['menu'][0]['groups'][] = "admin";
 
 ?>

+ 26 - 18
domain_counts/domain_counts.php

@@ -201,13 +201,20 @@
 	echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
 	echo "  <tr>\n";
 	echo "	<td align='left' width='100%'>\n";
-	echo "		<b>".$text['header-domain_counts']." (".$numeric_domain_counts.")</b><br>\n";
+	if (permission_exists('domain_counts_view_all')) {
+		echo "		<b>".$text['header-domain_counts']."  (".$numeric_domain_counts.")</b><br>\n";
+	}
+	if (permission_exists('domain_counts_view_domain')) {
+		echo "		<b>".$text['header-domain_counts']."</b><br>\n";
+	}	
 	echo "	</td>\n";
 	echo "		<td align='right' width='100%' style='vertical-align: top;'>";
 	echo "		<form method='get' action=''>\n";
 	echo "			<td style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
-	echo "				<input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>";
-	echo "				<input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
+	if (permission_exists('domain_counts_view_all')) {
+		echo "				<input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>";
+		echo "				<input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
+	}
 	echo "				<input type='button' class='btn' value='".$text['button-export']."' ";
 	echo "onclick=\"window.location='domain_counts.php?";
 	if (strlen($_SERVER["QUERY_STRING"]) > 0) { 
@@ -251,22 +258,23 @@
 	echo "</tr>\n";
 
 	if (isset($domain_counts)) foreach ($domain_counts as $key => $row) {
-		echo "	<td valign='top' class='".$row_style[$c]."'>".$row['domain_name']."</td>\n";
-		echo "	<td valign='top' class='".$row_style[$c]."'>".$row['extension_count']."&nbsp;</td>\n";
-		echo "	<td valign='top' class='".$row_style[$c]."'>".$row['user_count']."&nbsp;</td>\n";
-		echo "	<td valign='top' class='".$row_style[$c]."'>".$row['device_count']."&nbsp;</td>\n";
-		echo "	<td valign='top' class='".$row_style[$c]."'>".$row['destination_count']."&nbsp;</td>\n";
-		echo "	<td valign='top' class='".$row_style[$c]."'>".$row['fax_count']."&nbsp;</td>\n";
-		echo "	<td valign='top' class='".$row_style[$c]."'>".$row['ivr_count']."&nbsp;</td>\n";
-		echo "	<td valign='top' class='".$row_style[$c]."'>".$row['voicemail_count']."&nbsp;</td>\n";
-		echo "	<td valign='top' class='".$row_style[$c]."'>".$row['ring_group_count']."&nbsp;</td>\n";
-		echo "	<td valign='top' class='".$row_style[$c]."'>".$row['cc_queue_count']."&nbsp;</td>\n";
-		echo "	<td valign='top' class='".$row_style[$c]."'>".$row['contact_count']."&nbsp;</td>\n";
-		echo "	<td valign='top' class='".$row_style[$c]."'><a href='domain_counts_accountcodes.php?id=".$row['domain_uuid']."'>".$row['accountcode_count']."&nbsp;</td>\n";		
-		
 		
-		echo "</tr>\n";
-		$c = ($c==0) ? 1 : 0;
+		if (permission_exists('domain_counts_view_all') || (permission_exists('domain_counts_view_domain') && $_SESSION['domain_name'] == $row['domain_name']) ) {
+			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['domain_name']."</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['extension_count']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['user_count']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['device_count']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['destination_count']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['fax_count']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['ivr_count']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['voicemail_count']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['ring_group_count']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['cc_queue_count']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'>".$row['contact_count']."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$row_style[$c]."'><a href='domain_counts_accountcodes.php?id=".$row['domain_uuid']."'>".$row['accountcode_count']."&nbsp;</td>\n";		
+			echo "</tr>\n";
+			$c = ($c==0) ? 1 : 0;
+		}
 	}
 
 	echo "</table>";