Add a dialplan domain select only available to a user in the superadmin group

This commit is contained in:
Mark Crane
2014-05-22 04:20:28 +00:00
parent 48ba04b0dc
commit a39cbaf094
3 changed files with 53 additions and 2 deletions

View File

@@ -95,6 +95,10 @@
$apps[$x]['permissions'][$y]['name'] = "dialplan_detail_delete";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
$apps[$x]['permissions'][$y]['name'] = 'dialplan_domain';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$y++;
//schema details
$y = 0; //table array index

View File

@@ -195,6 +195,21 @@
$text['label-order']['pt-pt'] = "Ordem";
$text['label-order']['fr-fr'] = "Ordre";
$text['label-domain']['en-us'] = "Domain";
$text['label-domain']['es-cl'] = "Dominio";
$text['label-domain']['pt-pt'] = "Domínio";
$text['label-domain']['fr-fr'] = "Domaine";
$text['description-domain']['en-us'] = "";
$text['description-domain']['es-cl'] = "";
$text['description-domain']['pt-pt'] = "";
$text['description-domain']['fr-fr'] = "";
$text['select-global']['en-us'] = "Global";
$text['select-global']['es-cl'] = "Global";
$text['select-global']['pt-pt'] = "Global";
$text['select-global']['fr-fr'] = "Mondial";
$text['label-enabled']['en-us'] = "Enabled";
$text['label-enabled']['es-cl'] = "Activado";
$text['label-enabled']['pt-pt'] = "Habilitado";

View File

@@ -113,10 +113,12 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$dialplan_name = str_replace("/", "", $dialplan_name);
//build the array
$array['domain_uuid'] = $_SESSION['domain_uuid'];
if (strlen($row["dialplan_uuid"]) > 0) {
$array['dialplan_uuid'] = $_POST["dialplan_uuid"];
}
else {
$array['domain_uuid'] = $_SESSION['domain_uuid'];
}
$array['dialplan_name'] = $dialplan_name;
$array['dialplan_number'] = $_POST["dialplan_number"];
$array['dialplan_context'] = $_POST["dialplan_context"];
@@ -127,10 +129,12 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$x = 0;
foreach ($_POST["dialplan_details"] as $row) {
if (strlen($row["dialplan_detail_tag"]) > 0) {
$array['dialplan_details'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
if (strlen($row["dialplan_detail_uuid"]) > 0) {
$array['dialplan_details'][$x]['dialplan_detail_uuid'] = $row["dialplan_detail_uuid"];
}
else {
$array['dialplan_details'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
}
$array['dialplan_details'][$x]['dialplan_detail_tag'] = $row["dialplan_detail_tag"];
$array['dialplan_details'][$x]['dialplan_detail_type'] = $row["dialplan_detail_type"];
$array['dialplan_details'][$x]['dialplan_detail_data'] = $row["dialplan_detail_data"];
@@ -428,6 +432,34 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</td>\n";
echo "</tr>\n";
if (permission_exists('dialplan_domain')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-domain'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='domain_uuid'>\n";
if (strlen($domain_uuid) == 0) {
echo " <option value='' selected='selected'>".$text['select-global']."</option>\n";
}
else {
echo " <option value=''>".$text['select-global']."</option>\n";
}
foreach ($_SESSION['domains'] as $row) {
if ($row['domain_uuid'] == $domain_uuid) {
echo " <option value='".$row['domain_uuid']."' selected='selected'>".$row['domain_name']."</option>\n";
}
else {
echo " <option value='".$row['domain_uuid']."'>".$row['domain_name']."</option>\n";
}
}
echo " </select>\n";
echo "<br />\n";
echo $text['description-domain_name']."\n";
echo "</td>\n";
echo "</tr>\n";
}
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-enabled']."\n";