Dialplan: Implemented bulk-delete.
Default Settings: Minor fixes and enhancements.
This commit is contained in:
@@ -45,41 +45,51 @@ else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//set the dialplan uuid
|
//set the dialplan uuid
|
||||||
if (count($_GET) > 0) {
|
$dialplan_uuids = $_REQUEST["id"];
|
||||||
$dialplan_uuid = check_str($_GET["id"]);
|
$app_uuid = check_str($_REQUEST['app_uuid']);
|
||||||
}
|
|
||||||
|
|
||||||
if (strlen($dialplan_uuid) > 0) {
|
if (sizeof($dialplan_uuids) > 0) {
|
||||||
//get the dialplan data
|
|
||||||
$sql = "select * from v_dialplans ";
|
//get dialplan contexts
|
||||||
//$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
foreach ($dialplan_uuids as $dialplan_uuid) {
|
||||||
$sql .= "where dialplan_uuid = '$dialplan_uuid' ";
|
|
||||||
$prep_statement = $db->prepare(check_sql($sql));
|
//check each
|
||||||
$prep_statement->execute();
|
$dialplan_uuid = check_str($dialplan_uuid);
|
||||||
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
||||||
foreach ($result as &$row) {
|
//get the dialplan data
|
||||||
$database_dialplan_uuid = $row["dialplan_uuid"];
|
$sql = "select * from v_dialplans ";
|
||||||
$dialplan_context = $row["dialplan_context"];
|
$sql .= "where dialplan_uuid = '".$dialplan_uuid."' ";
|
||||||
$app_uuid = $row["app_uuid"];
|
$prep_statement = $db->prepare(check_sql($sql));
|
||||||
}
|
$prep_statement->execute();
|
||||||
unset ($prep_statement);
|
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
||||||
|
foreach ($result as &$row) {
|
||||||
|
$database_dialplan_uuid = $row["dialplan_uuid"];
|
||||||
|
$dialplan_contexts[] = $row["dialplan_context"];
|
||||||
|
}
|
||||||
|
unset($prep_statement);
|
||||||
|
}
|
||||||
|
|
||||||
//start the atomic transaction
|
//start the atomic transaction
|
||||||
$db->beginTransaction();
|
$db->beginTransaction();
|
||||||
|
|
||||||
//delete child data
|
//delete dialplan and details
|
||||||
$sql = "delete from v_dialplan_details ";
|
$dialplans_deleted = 0;
|
||||||
//$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
foreach ($dialplan_uuids as $dialplan_uuid) {
|
||||||
$sql .= "where dialplan_uuid = '$dialplan_uuid'; ";
|
|
||||||
$db->query($sql);
|
|
||||||
unset($sql);
|
|
||||||
|
|
||||||
//delete parent data
|
//delete child data
|
||||||
$sql = "delete from v_dialplans ";
|
$sql = "delete from v_dialplan_details ";
|
||||||
//$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
|
$sql .= "where dialplan_uuid = '".$dialplan_uuid."'; ";
|
||||||
$sql .= "where dialplan_uuid = '$dialplan_uuid'; ";
|
$db->query($sql);
|
||||||
$db->query($sql);
|
unset($sql);
|
||||||
unset($sql);
|
|
||||||
|
//delete parent data
|
||||||
|
$sql = "delete from v_dialplans ";
|
||||||
|
$sql .= "where dialplan_uuid = '".$dialplan_uuid."'; ";
|
||||||
|
$db->query($sql);
|
||||||
|
unset($sql);
|
||||||
|
|
||||||
|
$dialplans_deleted++;
|
||||||
|
}
|
||||||
|
|
||||||
//commit the atomic transaction
|
//commit the atomic transaction
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@@ -87,26 +97,22 @@ if (strlen($dialplan_uuid) > 0) {
|
|||||||
//synchronize the xml config
|
//synchronize the xml config
|
||||||
save_dialplan_xml();
|
save_dialplan_xml();
|
||||||
|
|
||||||
//delete the dialplan context from memcache
|
//strip duplicate contexts
|
||||||
|
$dialplan_contexts = array_unique($dialplan_contexts, SORT_STRING);
|
||||||
|
|
||||||
|
//delete the dialplan contexts from memcache
|
||||||
|
if (sizeof($dialplan_contexts) > 0) {
|
||||||
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
|
||||||
if ($fp) {
|
if ($fp) {
|
||||||
$switch_cmd = "memcache delete dialplan:".$dialplan_context;
|
foreach($dialplan_contexts as $dialplan_context) {
|
||||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
$switch_cmd = "memcache delete dialplan:".$dialplan_context;
|
||||||
|
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$_SESSION["message"] = $text['message-delete'];
|
$_SESSION["message"] = $text['message-delete'].(($dialplans_deleted > 1) ? ": ".$dialplans_deleted : null);
|
||||||
switch ($app_uuid) {
|
header("Location: ".PROJECT_PATH."/app/dialplan/dialplans.php".(($app_uuid != '') ? "?app_uuid=".$app_uuid : null));
|
||||||
case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4": //inbound routes
|
|
||||||
case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3": //outbound routes
|
|
||||||
case "4b821450-926b-175a-af93-a03c441818b1": //time conditions
|
|
||||||
$redirect_url = PROJECT_PATH."/app/dialplan/dialplans.php?app_uuid=".$app_uuid;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$redirect_url = PROJECT_PATH."/app/dialplan/dialplans.php";
|
|
||||||
}
|
|
||||||
header("Location: ".$redirect_url);
|
|
||||||
return;
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -47,8 +47,8 @@ else {
|
|||||||
//set the variables
|
//set the variables
|
||||||
if (count($_GET) > 0) {
|
if (count($_GET) > 0) {
|
||||||
$dialplan_detail_uuid = check_str($_GET["id"]);
|
$dialplan_detail_uuid = check_str($_GET["id"]);
|
||||||
$app_uuid = check_str($_REQUEST["app_uuid"]);
|
|
||||||
$dialplan_uuid = check_str($_REQUEST["dialplan_uuid"]);
|
$dialplan_uuid = check_str($_REQUEST["dialplan_uuid"]);
|
||||||
|
$app_uuid = check_str($_REQUEST["app_uuid"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//delete the dialplan detail
|
//delete the dialplan detail
|
||||||
@@ -75,7 +75,7 @@ else {
|
|||||||
$_SESSION['message'] = $text['message-delete'];
|
$_SESSION['message'] = $text['message-delete'];
|
||||||
|
|
||||||
//redirect the browser
|
//redirect the browser
|
||||||
header("Location: dialplan_edit.php?id=".$dialplan_uuid."&app_uuid=".$app_uuid);
|
header("Location: dialplan_edit.php?id=".$dialplan_uuid.(($app_uuid != '') ? "&app_uuid=".$app_uuid : null));
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@@ -175,7 +175,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
else if ($action == "update") {
|
else if ($action == "update") {
|
||||||
$_SESSION['message'] = $text['message-update'];
|
$_SESSION['message'] = $text['message-update'];
|
||||||
}
|
}
|
||||||
header("Location: ?id=".$dialplan_uuid."&app_uuid=".$app_uuid);
|
header("Location: ?id=".$dialplan_uuid.(($app_uuid != '') ? "&app_uuid=".$app_uuid : null));
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
|
||||||
@@ -190,7 +190,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
//$message = $orm->message;
|
//$message = $orm->message;
|
||||||
foreach ($result as &$row) {
|
foreach ($result as &$row) {
|
||||||
$domain_uuid = $row["domain_uuid"];
|
$domain_uuid = $row["domain_uuid"];
|
||||||
$app_uuid = $row["app_uuid"];
|
//$app_uuid = $row["app_uuid"];
|
||||||
$dialplan_name = $row["dialplan_name"];
|
$dialplan_name = $row["dialplan_name"];
|
||||||
$dialplan_number = $row["dialplan_number"];
|
$dialplan_number = $row["dialplan_number"];
|
||||||
$dialplan_order = $row["dialplan_order"];
|
$dialplan_order = $row["dialplan_order"];
|
||||||
@@ -325,6 +325,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo " <br>";
|
echo " <br>";
|
||||||
|
|
||||||
echo "<form method='post' name='frm' action=''>\n";
|
echo "<form method='post' name='frm' action=''>\n";
|
||||||
|
echo "<input type='hidden' name='app_uuid' value='".$app_uuid."'>\n";
|
||||||
echo "<div align='center'>\n";
|
echo "<div align='center'>\n";
|
||||||
|
|
||||||
echo "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\">\n";
|
echo "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"0\">\n";
|
||||||
@@ -333,12 +334,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo" <span class=\"title\">".$text['title-dialplan_edit']."</span><br />\n";
|
echo" <span class=\"title\">".$text['title-dialplan_edit']."</span><br />\n";
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo " <td width='70%' align='right'>\n";
|
echo " <td width='70%' align='right'>\n";
|
||||||
if (strlen($app_uuid) > 0) {
|
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='dialplans.php".((strlen($app_uuid) > 0) ? "?app_uuid=".$app_uuid : null)."';\" value='".$text['button-back']."'>\n";
|
||||||
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='dialplans.php?app_uuid=$app_uuid'\" value='".$text['button-back']."'>\n";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo " <input type='button' class='btn' name='' alt='".$text['button-back']."' onclick=\"window.location='dialplans.php'\" value='".$text['button-back']."'>\n";
|
|
||||||
}
|
|
||||||
echo " <input type='button' class='btn' name='' alt='".$text['button-copy']."' onclick=\"if (confirm('".$text['confirm-copy']."')){window.location='dialplan_copy.php?id=".$dialplan_uuid."';}\" value='".$text['button-copy']."'>\n";
|
echo " <input type='button' class='btn' name='' alt='".$text['button-copy']."' onclick=\"if (confirm('".$text['confirm-copy']."')){window.location='dialplan_copy.php?id=".$dialplan_uuid."';}\" value='".$text['button-copy']."'>\n";
|
||||||
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
|
echo " <input type='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
@@ -764,7 +760,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo " <td class='list_control_icon'>\n";
|
echo " <td class='list_control_icon'>\n";
|
||||||
if ($element['hidden']) {
|
if ($element['hidden']) {
|
||||||
//echo " <a href='dialplan_detail_edit.php?id=".$dialplan_detail_uuid."&dialplan_uuid=".$dialplan_uuid."&app_uuid=".$app_uuid."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
|
//echo " <a href='dialplan_detail_edit.php?id=".$dialplan_detail_uuid."&dialplan_uuid=".$dialplan_uuid."&app_uuid=".$app_uuid."' alt='".$text['button-edit']."'>$v_link_label_edit</a>\n";
|
||||||
echo " <a href='dialplan_detail_delete.php?id=".$dialplan_detail_uuid."&dialplan_uuid=".$dialplan_uuid."&app_uuid=".$app_uuid."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
|
echo " <a href='dialplan_detail_delete.php?id=".$dialplan_detail_uuid."&dialplan_uuid=".$dialplan_uuid.(($app_uuid != '') ? "&app_uuid=".$app_uuid : null)."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
|
||||||
}
|
}
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
//end the row
|
//end the row
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ else {
|
|||||||
echo " </span>\n";
|
echo " </span>\n";
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
|
|
||||||
echo " <form method='get' action=''>\n";
|
echo " <form name='frm_search' method='get' action=''>\n";
|
||||||
echo " <td width='50%' align='right'>\n";
|
echo " <td width='50%' align='right'>\n";
|
||||||
echo " <input type='text' class='txt' style='width: 150px' name='search' value='$search'>";
|
echo " <input type='text' class='txt' style='width: 150px' name='search' value='$search'>";
|
||||||
if (strlen($app_uuid) > 0) {
|
if (strlen($app_uuid) > 0) {
|
||||||
@@ -231,8 +231,13 @@ else {
|
|||||||
$row_style["1"] = "row_style1";
|
$row_style["1"] = "row_style1";
|
||||||
|
|
||||||
echo "<div align='center'>\n";
|
echo "<div align='center'>\n";
|
||||||
|
echo "<form name='frm_delete' method='post' action='dialplan_delete.php'>\n";
|
||||||
|
echo "<input type='hidden' name='app_uuid' value='".$app_uuid."'>\n";
|
||||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
|
if (permission_exists('dialplan_delete') && $result_count > 0) {
|
||||||
|
echo "<th style='text-align: center;' style='text-align: center; padding: 3px 0px 0px 0px;'><input type='checkbox' onchange=\"(this.checked) ? check('all') : check('none');\"></th>";
|
||||||
|
}
|
||||||
echo th_order_by('dialplan_name', $text['label-name'], $order_by, $order, $app_uuid);
|
echo th_order_by('dialplan_name', $text['label-name'], $order_by, $order, $app_uuid);
|
||||||
echo th_order_by('dialplan_number', $text['label-number'], $order_by, $order, $app_uuid);
|
echo th_order_by('dialplan_number', $text['label-number'], $order_by, $order, $app_uuid);
|
||||||
echo th_order_by('dialplan_context', $text['label-context'], $order_by, $order, $app_uuid);
|
echo th_order_by('dialplan_context', $text['label-context'], $order_by, $order, $app_uuid);
|
||||||
@@ -255,6 +260,9 @@ else {
|
|||||||
elseif (permission_exists('dialplan_add')) {
|
elseif (permission_exists('dialplan_add')) {
|
||||||
echo "<a href='dialplan_add.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
echo "<a href='dialplan_add.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
||||||
}
|
}
|
||||||
|
if (permission_exists('dialplan_delete') && $result_count > 0) {
|
||||||
|
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.forms.frm_delete.submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
|
||||||
|
}
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
|
|
||||||
@@ -286,6 +294,18 @@ else {
|
|||||||
}
|
}
|
||||||
unset ($prep_statement);
|
unset ($prep_statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// blank app id if doesn't match others, so will return to dialplan manager
|
||||||
|
switch ($app_uuid) {
|
||||||
|
case "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" : // inbound route
|
||||||
|
case "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3" : // outbound route
|
||||||
|
case "16589224-c876-aeb3-f59f-523a1c0801f7" : // fifo
|
||||||
|
case "4b821450-926b-175a-af93-a03c441818b1" : // time condition
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
unset($app_uuid);
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" && permission_exists('inbound_route_edit')) ||
|
($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" && permission_exists('inbound_route_edit')) ||
|
||||||
($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3" && permission_exists('outbound_route_edit')) ||
|
($app_uuid == "8c914ec3-9fc0-8ab5-4cda-6c9288bdc9a3" && permission_exists('outbound_route_edit')) ||
|
||||||
@@ -293,9 +313,13 @@ else {
|
|||||||
($app_uuid == "4b821450-926b-175a-af93-a03c441818b1" && permission_exists('time_condition_edit')) ||
|
($app_uuid == "4b821450-926b-175a-af93-a03c441818b1" && permission_exists('time_condition_edit')) ||
|
||||||
permission_exists('dialplan_edit')
|
permission_exists('dialplan_edit')
|
||||||
) {
|
) {
|
||||||
$tr_link = "href='dialplan_edit.php?id=".$row['dialplan_uuid']."&app_uuid=".$app_uuid."'";
|
$tr_link = "href='dialplan_edit.php?id=".$row['dialplan_uuid'].(($app_uuid != '') ? "&app_uuid=".$app_uuid : null)."'";
|
||||||
}
|
}
|
||||||
echo "<tr ".$tr_link.">\n";
|
echo "<tr ".$tr_link.">\n";
|
||||||
|
if (permission_exists("dialplan_delete")) {
|
||||||
|
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center; padding: 3px 0px 0px 0px;'><input type='checkbox' name='id[]' id='checkbox_".$row['dialplan_uuid']."' value='".$row['dialplan_uuid']."'></td>\n";
|
||||||
|
$dialplan_ids[] = 'checkbox_'.$row['dialplan_uuid'];
|
||||||
|
}
|
||||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||||
if (
|
if (
|
||||||
($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" && permission_exists('inbound_route_edit')) ||
|
($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" && permission_exists('inbound_route_edit')) ||
|
||||||
@@ -304,7 +328,7 @@ else {
|
|||||||
($app_uuid == "4b821450-926b-175a-af93-a03c441818b1" && permission_exists('time_condition_edit')) ||
|
($app_uuid == "4b821450-926b-175a-af93-a03c441818b1" && permission_exists('time_condition_edit')) ||
|
||||||
permission_exists('dialplan_edit')
|
permission_exists('dialplan_edit')
|
||||||
) {
|
) {
|
||||||
echo "<a href='dialplan_edit.php?id=".$row['dialplan_uuid']."&app_uuid=$app_uuid'>".$row['dialplan_name']."</a>";
|
echo "<a href='dialplan_edit.php?id=".$row['dialplan_uuid'].(($app_uuid != '') ? "&app_uuid=".$app_uuid : null)."'>".$row['dialplan_name']."</a>";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo $row['dialplan_name'];
|
echo $row['dialplan_name'];
|
||||||
@@ -323,7 +347,7 @@ else {
|
|||||||
($app_uuid == "4b821450-926b-175a-af93-a03c441818b1" && permission_exists('time_condition_edit')) ||
|
($app_uuid == "4b821450-926b-175a-af93-a03c441818b1" && permission_exists('time_condition_edit')) ||
|
||||||
permission_exists('dialplan_edit')
|
permission_exists('dialplan_edit')
|
||||||
) {
|
) {
|
||||||
echo "<a href='dialplan_edit.php?id=".$row['dialplan_uuid']."&app_uuid=$app_uuid' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
echo "<a href='dialplan_edit.php?id=".$row['dialplan_uuid'].(($app_uuid != '') ? "&app_uuid=".$app_uuid : null)."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" && permission_exists('inbound_route_delete')) ||
|
($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" && permission_exists('inbound_route_delete')) ||
|
||||||
@@ -332,7 +356,7 @@ else {
|
|||||||
($app_uuid == "4b821450-926b-175a-af93-a03c441818b1" && permission_exists('time_condition_delete')) ||
|
($app_uuid == "4b821450-926b-175a-af93-a03c441818b1" && permission_exists('time_condition_delete')) ||
|
||||||
permission_exists('dialplan_delete')
|
permission_exists('dialplan_delete')
|
||||||
) {
|
) {
|
||||||
echo "<a href='dialplan_delete.php?id=".$row['dialplan_uuid']."&app_uuid=$app_uuid' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
echo "<a href=\"dialplan_delete.php?id[]=".$row['dialplan_uuid'].(($app_uuid != '') ? "&app_uuid=".$app_uuid : null)."\" alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
||||||
}
|
}
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
@@ -342,7 +366,7 @@ else {
|
|||||||
} //end if results
|
} //end if results
|
||||||
|
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
echo "<td colspan='7'>\n";
|
echo "<td colspan='8'>\n";
|
||||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||||
echo " <tr>\n";
|
echo " <tr>\n";
|
||||||
echo " <td width='33.3%' nowrap> </td>\n";
|
echo " <td width='33.3%' nowrap> </td>\n";
|
||||||
@@ -363,6 +387,9 @@ else {
|
|||||||
elseif (permission_exists('dialplan_add')) {
|
elseif (permission_exists('dialplan_add')) {
|
||||||
echo "<a href='dialplan_add.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
echo "<a href='dialplan_add.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
||||||
}
|
}
|
||||||
|
if (permission_exists('dialplan_delete') && $result_count > 0) {
|
||||||
|
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.forms.frm_delete.submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
|
||||||
|
}
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo " </tr>\n";
|
echo " </tr>\n";
|
||||||
echo " </table>\n";
|
echo " </table>\n";
|
||||||
@@ -377,9 +404,20 @@ else {
|
|||||||
echo "</td>";
|
echo "</td>";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
echo "</table>";
|
echo "</table>";
|
||||||
|
echo "</form>";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
echo "<br><br>";
|
echo "<br><br>";
|
||||||
|
|
||||||
|
if (sizeof($dialplan_ids) > 0) {
|
||||||
|
echo "<script>\n";
|
||||||
|
echo " function check(what) {\n";
|
||||||
|
foreach ($dialplan_ids as $checkbox_id) {
|
||||||
|
echo "document.getElementById('".$checkbox_id."').checked = (what == 'all') ? true : false;\n";
|
||||||
|
}
|
||||||
|
echo " }\n";
|
||||||
|
echo "</script>\n";
|
||||||
|
}
|
||||||
|
|
||||||
//include the footer
|
//include the footer
|
||||||
require_once "resources/footer.php";
|
require_once "resources/footer.php";
|
||||||
|
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ else {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//get http post variables and set them to php variables
|
//get http post variables and set them to php variables
|
||||||
if (count($_POST) > 0) {
|
if (count($_REQUEST) > 0) {
|
||||||
$default_setting_category = strtolower(check_str($_POST["default_setting_category"]));
|
$default_setting_category = strtolower(check_str($_REQUEST["default_setting_category"]));
|
||||||
$default_setting_subcategory = strtolower(check_str($_POST["default_setting_subcategory"]));
|
$default_setting_subcategory = strtolower(check_str($_POST["default_setting_subcategory"]));
|
||||||
$default_setting_name = strtolower(check_str($_POST["default_setting_name"]));
|
$default_setting_name = strtolower(check_str($_POST["default_setting_name"]));
|
||||||
$default_setting_value = check_str($_POST["default_setting_value"]);
|
$default_setting_value = check_str($_POST["default_setting_value"]);
|
||||||
@@ -226,7 +226,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo " ".$text['label-subcategory'].":\n";
|
echo " ".$text['label-subcategory'].":\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "<td class='vtable' align='left'>\n";
|
echo "<td class='vtable' align='left'>\n";
|
||||||
echo " <input class='formfld' type='text' name='default_setting_subcategory' maxlength='255' value=\"$default_setting_subcategory\">\n";
|
echo " <input class='formfld' type='text' name='default_setting_subcategory' id='default_setting_subcategory' maxlength='255' value=\"$default_setting_subcategory\">\n";
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
echo $text['description-subcategory']."\n";
|
echo $text['description-subcategory']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
@@ -496,7 +496,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo " ".$text['label-description'].":\n";
|
echo " ".$text['label-description'].":\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
echo "<td class='vtable' align='left'>\n";
|
echo "<td class='vtable' align='left'>\n";
|
||||||
echo " <input class='formfld' type='text' name='default_setting_description' maxlength='255' value=\"$default_setting_description\">\n";
|
echo " <input class='formfld' type='text' name='default_setting_description' maxlength='255' value=\"".$default_setting_description."\">\n";
|
||||||
echo "<br />\n";
|
echo "<br />\n";
|
||||||
echo $text['description-description']."\n";
|
echo $text['description-description']."\n";
|
||||||
echo "</td>\n";
|
echo "</td>\n";
|
||||||
@@ -505,7 +505,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo " <tr>\n";
|
echo " <tr>\n";
|
||||||
echo " <td colspan='2' align='right'>\n";
|
echo " <td colspan='2' align='right'>\n";
|
||||||
if ($action == "update") {
|
if ($action == "update") {
|
||||||
echo " <input type='hidden' name='default_setting_uuid' value='$default_setting_uuid'>\n";
|
echo " <input type='hidden' name='default_setting_uuid' value='".$default_setting_uuid."'>\n";
|
||||||
}
|
}
|
||||||
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
echo " <input type='submit' name='submit' class='btn' value='".$text['button-save']."'>\n";
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
@@ -518,6 +518,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
|
|||||||
echo "</table>";
|
echo "</table>";
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
|
||||||
|
if ($_REQUEST["id"] == '' && $_REQUEST["default_setting_category"] != '') {
|
||||||
|
echo "<script>document.getElementById('default_setting_subcategory').focus();</script>";
|
||||||
|
}
|
||||||
|
|
||||||
//include the footer
|
//include the footer
|
||||||
require_once "resources/footer.php";
|
require_once "resources/footer.php";
|
||||||
?>
|
?>
|
||||||
@@ -318,7 +318,7 @@ if (permission_exists("domain_select") && permission_exists("domain_setting_add"
|
|||||||
|
|
||||||
if ($previous_category != $row['default_setting_category']) {
|
if ($previous_category != $row['default_setting_category']) {
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
echo " <td colspan='4' align='left'>\n";
|
echo " <td colspan='7' align='left'>\n";
|
||||||
if ($previous_category != '') { echo " <br /><br />"; }
|
if ($previous_category != '') { echo " <br /><br />"; }
|
||||||
echo " <br />\n";
|
echo " <br />\n";
|
||||||
echo " <b>\n";
|
echo " <b>\n";
|
||||||
@@ -335,7 +335,10 @@ if (permission_exists("domain_select") && permission_exists("domain_setting_add"
|
|||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo "</tr>\n";
|
echo "</tr>\n";
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
if (permission_exists("domain_select") && permission_exists("domain_setting_add") && count($_SESSION['domains']) > 1) {
|
if (
|
||||||
|
(permission_exists("domain_select") && permission_exists("domain_setting_add") && count($_SESSION['domains']) > 1) ||
|
||||||
|
permission_exists('default_setting_delete')
|
||||||
|
) {
|
||||||
echo "<th style='text-align: center;' style='text-align: center; padding: 3px 0px 0px 0px;'><input type='checkbox' onchange=\"(this.checked) ? check('all','".strtolower($row['default_setting_category'])."') : check('none','".strtolower($row['default_setting_category'])."');\"></th>";
|
echo "<th style='text-align: center;' style='text-align: center; padding: 3px 0px 0px 0px;'><input type='checkbox' onchange=\"(this.checked) ? check('all','".strtolower($row['default_setting_category'])."') : check('none','".strtolower($row['default_setting_category'])."');\"></th>";
|
||||||
}
|
}
|
||||||
echo "<th>".$text['label-subcategory']."</th>";
|
echo "<th>".$text['label-subcategory']."</th>";
|
||||||
@@ -345,7 +348,7 @@ if (permission_exists("domain_select") && permission_exists("domain_setting_add"
|
|||||||
echo "<th>".$text['label-description']."</th>";
|
echo "<th>".$text['label-description']."</th>";
|
||||||
echo "<td class='list_control_icons'>";
|
echo "<td class='list_control_icons'>";
|
||||||
if (permission_exists('default_setting_add')) {
|
if (permission_exists('default_setting_add')) {
|
||||||
echo "<a href='default_setting_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
|
echo "<a href='default_setting_edit.php?default_setting_category=".urlencode($row['default_setting_category'])."' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
|
||||||
}
|
}
|
||||||
if (permission_exists('default_setting_delete')) {
|
if (permission_exists('default_setting_delete')) {
|
||||||
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('action').value = 'delete'; document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
|
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('action').value = 'delete'; document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
|
||||||
@@ -357,7 +360,10 @@ if (permission_exists("domain_select") && permission_exists("domain_setting_add"
|
|||||||
|
|
||||||
$tr_link = (permission_exists('default_setting_edit')) ? "href='default_setting_edit.php?id=".$row['default_setting_uuid']."'" : null;
|
$tr_link = (permission_exists('default_setting_edit')) ? "href='default_setting_edit.php?id=".$row['default_setting_uuid']."'" : null;
|
||||||
echo "<tr ".$tr_link.">\n";
|
echo "<tr ".$tr_link.">\n";
|
||||||
if (permission_exists("domain_select") && permission_exists("domain_setting_add") && count($_SESSION['domains']) > 1) {
|
if (
|
||||||
|
(permission_exists("domain_select") && permission_exists("domain_setting_add") && count($_SESSION['domains']) > 1) ||
|
||||||
|
permission_exists("default_setting_delete")
|
||||||
|
) {
|
||||||
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center; padding: 3px 0px 0px 0px;'><input type='checkbox' name='id[]' id='checkbox_".$row['default_setting_uuid']."' value='".$row['default_setting_uuid']."'></td>\n";
|
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center; padding: 3px 0px 0px 0px;'><input type='checkbox' name='id[]' id='checkbox_".$row['default_setting_uuid']."' value='".$row['default_setting_uuid']."'></td>\n";
|
||||||
$subcat_ids[strtolower($row['default_setting_category'])][] = 'checkbox_'.$row['default_setting_uuid'];
|
$subcat_ids[strtolower($row['default_setting_category'])][] = 'checkbox_'.$row['default_setting_uuid'];
|
||||||
}
|
}
|
||||||
@@ -412,14 +418,26 @@ if (permission_exists("domain_select") && permission_exists("domain_setting_add"
|
|||||||
} //end if results
|
} //end if results
|
||||||
|
|
||||||
echo "<tr>\n";
|
echo "<tr>\n";
|
||||||
echo "<td colspan='".((permission_exists("domain_select") && permission_exists("domain_setting_add") && count($_SESSION['domains']) > 1) ? 7 : 6)."' align='left'>\n";
|
if (
|
||||||
|
(permission_exists("domain_select") && permission_exists("domain_setting_add") && count($_SESSION['domains']) > 1) ||
|
||||||
|
permission_exists("domain_delete")
|
||||||
|
) {
|
||||||
|
$colspan = 7;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$colspan = 6;
|
||||||
|
}
|
||||||
|
echo "<td colspan='".$colspan."' align='left'>\n";
|
||||||
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
echo " <table width='100%' cellpadding='0' cellspacing='0'>\n";
|
||||||
echo " <tr>\n";
|
echo " <tr>\n";
|
||||||
echo " <td width='33.3%' nowrap> </td>\n";
|
echo " <td width='33.3%' nowrap> </td>\n";
|
||||||
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
echo " <td width='33.3%' align='center' nowrap>$paging_controls</td>\n";
|
||||||
echo " <td class='list_control_icons'>";
|
echo " <td class='list_control_icons'>";
|
||||||
if (permission_exists('default_setting_add')) {
|
if (permission_exists('default_setting_add')) {
|
||||||
echo "<a href='default_setting_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
echo "<a href='default_setting_edit.php?' alt='".$text['button-add']."'>$v_link_label_add</a>";
|
||||||
|
}
|
||||||
|
if (permission_exists('default_setting_delete')) {
|
||||||
|
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.getElementById('action').value = 'delete'; document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
|
||||||
}
|
}
|
||||||
echo " </td>\n";
|
echo " </td>\n";
|
||||||
echo " </tr>\n";
|
echo " </tr>\n";
|
||||||
@@ -441,8 +459,8 @@ if (permission_exists("domain_select") && permission_exists("domain_setting_add"
|
|||||||
|
|
||||||
echo "<br /><br />";
|
echo "<br /><br />";
|
||||||
|
|
||||||
|
// check or uncheck all category checkboxes
|
||||||
if (sizeof($subcat_ids) > 0) {
|
if (sizeof($subcat_ids) > 0) {
|
||||||
|
|
||||||
echo "<script>\n";
|
echo "<script>\n";
|
||||||
echo " function check(what, category) {\n";
|
echo " function check(what, category) {\n";
|
||||||
foreach ($subcat_ids as $default_setting_category => $checkbox_ids) {
|
foreach ($subcat_ids as $default_setting_category => $checkbox_ids) {
|
||||||
@@ -454,7 +472,6 @@ if (permission_exists("domain_select") && permission_exists("domain_setting_add"
|
|||||||
}
|
}
|
||||||
echo " }\n";
|
echo " }\n";
|
||||||
echo "</script>\n";
|
echo "</script>\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//include the footer
|
//include the footer
|
||||||
|
|||||||
Reference in New Issue
Block a user