Enable ability to have global gateways.

This commit is contained in:
Mark Crane
2015-01-22 11:10:51 +00:00
parent 60d5951841
commit 96e826bcc9
5 changed files with 76 additions and 29 deletions

View File

@@ -777,17 +777,16 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
} //end if update
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
if ($action == "update") {
echo " <input type='hidden' name='dialplan_uuid' value='$dialplan_uuid'>\n";
}
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo " <tr>\n";
echo " <td colspan='2' align='right'>\n";
if ($action == "update") {
echo " <input type='hidden' name='dialplan_uuid' value='$dialplan_uuid'>\n";
}
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
echo " </td>\n";
echo " </tr>";
echo "</table>";
echo "</form>";
echo " </td>";

View File

@@ -729,7 +729,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
$extension_uuid = $_GET["id"];
$extension_uuid = check_str($_GET["id"]);
$sql = "select * from v_extensions ";
$sql .= "where extension_uuid = '$extension_uuid' ";
$sql .= "and domain_uuid = '".$domain_uuid."' ";

View File

@@ -21,18 +21,22 @@
$apps[$x]['description']['pt-br'] = "";
//permission details
$apps[$x]['permissions'][0]['name'] = "gateway_view";
$apps[$x]['permissions'][0]['menu']['uuid'] = "237a512a-f8fe-1ce4-b5d7-e71c401d7159";
$apps[$x]['permissions'][0]['groups'][] = "superadmin";
$apps[$x]['permissions'][1]['name'] = "gateway_add";
$apps[$x]['permissions'][1]['groups'][] = "superadmin";
$apps[$x]['permissions'][2]['name'] = "gateway_edit";
$apps[$x]['permissions'][2]['groups'][] = "superadmin";
$apps[$x]['permissions'][3]['name'] = "gateway_delete";
$apps[$x]['permissions'][3]['groups'][] = "superadmin";
$y = 0;
$apps[$x]['permissions'][$y]['name'] = "gateway_view";
$apps[$x]['permissions'][$y]['menu']['uuid'] = "237a512a-f8fe-1ce4-b5d7-e71c401d7159";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "gateway_add";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "gateway_edit";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "gateway_delete";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "gateway_domain";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//schema details
$y = 0; //table array index

View File

@@ -269,6 +269,21 @@
$text['description-profile']['pt-pt'] = "Introduza o perfil aqui.";
$text['description-profile']['fr-fr'] = "";
$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

@@ -49,6 +49,7 @@ else {
//get http post variables and set them to php variables
if (count($_POST) > 0) {
$domain_uuid = check_str($_POST["domain_uuid"]);
$gateway = check_str($_POST["gateway"]);
$username = check_str($_POST["username"]);
$password = check_str($_POST["password"]);
@@ -235,10 +236,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "extension_in_contact = '$extension_in_contact', ";
$sql .= "context = '$context', ";
$sql .= "profile = '$profile', ";
$sql .= "domain_uuid = '$domain_uuid', ";
$sql .= "enabled = '$enabled', ";
$sql .= "description = '$description' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and gateway_uuid = '$gateway_uuid'";
$sql .= "where gateway_uuid = '$gateway_uuid'";
$db->exec(check_sql($sql));
unset($sql);
} //if ($action == "update")
@@ -292,12 +293,12 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
$gateway_uuid = check_str($_GET["id"]);
$sql = "select * from v_gateways ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and gateway_uuid = '".$gateway_uuid."' ";
$sql .= "where gateway_uuid = '".$gateway_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$domain_uuid = $row["domain_uuid"];
$gateway = $row["gateway"];
$username = $row["username"];
$password = $row["password"];
@@ -750,6 +751,34 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</td>\n";
echo "</tr>\n";
if (permission_exists('gateway_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 " </table>\n";
echo " </div>";
@@ -835,4 +864,4 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//include the footer
require_once "resources/footer.php";
?>
?>