mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
Extensions: Retain current list page through edit, (single) delete, and back operations.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2016
|
||||
Portions created by the Initial Developer are Copyright (C) 2008-2019
|
||||
the Initial Developer. All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
@@ -50,13 +50,14 @@
|
||||
if (!is_numeric($extension_new)) {
|
||||
$number_alias_new = $_REQUEST["alias"];
|
||||
}
|
||||
$page = $_REQUEST['page'];
|
||||
}
|
||||
|
||||
// skip the copy if the domain extension already exists
|
||||
$extension = new extension;
|
||||
if ($extension->exists($_SESSION['domain_uuid'], $extension_new)) {
|
||||
message::add($text['message-duplicate'], 'negative');
|
||||
header("Location: extensions.php");
|
||||
header("Location: extensions.php".(is_numeric($page) ? '?page='.$page : null));
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -194,7 +195,7 @@
|
||||
|
||||
//redirect the user
|
||||
message::add($text['message-copy']);
|
||||
header("Location: extensions.php");
|
||||
header("Location: extensions.php".(is_numeric($page) ? '?page='.$page : null));
|
||||
exit;
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -46,6 +46,7 @@
|
||||
if (is_array($_REQUEST) && sizeof($_REQUEST) > 0) {
|
||||
|
||||
$extension_uuids = $_REQUEST["id"];
|
||||
$page = $_REQUEST['page'];
|
||||
foreach($extension_uuids as $extension_uuid) {
|
||||
if ($extension_uuid != '') {
|
||||
//get the extensions array
|
||||
@@ -112,7 +113,7 @@
|
||||
|
||||
//redirect the browser
|
||||
message::add($text['message-delete']);
|
||||
header("Location: extensions.php");
|
||||
header("Location: extensions.php".(is_numeric($page) ? '?page='.$page : null));
|
||||
exit;
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
The Initial Developer of the Original Code is
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
Copyright (C) 2008-2018 All Rights Reserved.
|
||||
Copyright (C) 2008-2019 All Rights Reserved.
|
||||
|
||||
Contributor(s):
|
||||
Mark J Crane <markjcrane@fusionpbx.com>
|
||||
@@ -46,6 +46,7 @@
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$extension_uuid = $_REQUEST["id"];
|
||||
$page = $_REQUEST['page'];
|
||||
}
|
||||
else {
|
||||
$action = "add";
|
||||
@@ -64,7 +65,7 @@
|
||||
|
||||
if ($total_extensions >= $_SESSION['limit']['extensions']['numeric']) {
|
||||
message::add($text['message-maximum_extensions'].' '.$_SESSION['limit']['extensions']['numeric'], 'negative');
|
||||
header('Location: extensions.php');
|
||||
header('Location: extensions.php'.(is_numeric($page) ? '?page='.$page : null));
|
||||
exit;
|
||||
}
|
||||
}
|
||||
@@ -638,7 +639,7 @@
|
||||
}
|
||||
if ($action == "update") {
|
||||
message::add($text['message-update']);
|
||||
header("Location: extension_edit.php?id=".$extension_uuid);
|
||||
header("Location: extension_edit.php?id=".$extension_uuid.(is_numeric($page) ? '&page='.$page : null));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -837,13 +838,13 @@
|
||||
echo " var new_ext = prompt('".$text['message-extension']."');\n";
|
||||
echo " if (new_ext != null) {\n";
|
||||
echo " if (!isNaN(new_ext)) {\n";
|
||||
echo " document.location.href='extension_copy.php?id=".escape($extension_uuid)."&ext=' + new_ext;\n";
|
||||
echo " document.location.href='extension_copy.php?id=".escape($extension_uuid)."&ext=' + new_ext".(is_numeric($page) ? " + '&page=".$page."'" : null).";\n";
|
||||
echo " }\n";
|
||||
echo " else {\n";
|
||||
echo " var new_number_alias = prompt('".$text['message-number_alias']."');\n";
|
||||
echo " if (new_number_alias != null) {\n";
|
||||
echo " if (!isNaN(new_number_alias)) {\n";
|
||||
echo " document.location.href='extension_copy.php?id=".escape($extension_uuid)."&ext=' + new_ext + '&alias=' + new_number_alias;\n";
|
||||
echo " document.location.href='extension_copy.php?id=".escape($extension_uuid)."&ext=' + new_ext + '&alias=' + new_number_alias".(is_numeric($page) ? " + '&page=".$page."'" : null).";\n";
|
||||
echo " }\n";
|
||||
echo " }\n";
|
||||
echo " }\n";
|
||||
@@ -852,6 +853,9 @@
|
||||
echo "</script>";
|
||||
|
||||
echo "<form method='post' name='frm' id='frm' action=''>\n";
|
||||
if (is_numeric($page)) {
|
||||
echo "<input type='hidden' name='page' value='".$page."'>\n";
|
||||
}
|
||||
echo "<table width='100%' border='0' cellpdding='0' cellspacing='0'>\n";
|
||||
echo "<tr>\n";
|
||||
if ($action == "add") {
|
||||
@@ -861,7 +865,7 @@
|
||||
echo "<td width='30%' nowrap='nowrap' align='left' valign='top'><b>".$text['header-extension-edit']."</b></td>\n";
|
||||
}
|
||||
echo "<td width='70%' align='right' valign='top'>\n";
|
||||
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"window.location='extensions.php'\" value='".$text['button-back']."'>\n";
|
||||
echo " <input type='button' class='btn' alt='".$text['button-back']."' onclick=\"window.location='extensions.php".(is_numeric($page) ? '?page='.$page : null)."'\" value='".$text['button-back']."'>\n";
|
||||
if ($action == 'update' && (permission_exists('follow_me') || permission_exists('call_forward') || permission_exists('do_not_disturb'))) {
|
||||
echo " <input type='button' class='btn' alt='".$text['button-call_routing']."' onclick=\"window.location='../calls/call_edit.php?id=".escape($extension_uuid)."';\" value='".$text['button-call_routing']."'>\n";
|
||||
}
|
||||
@@ -1950,4 +1954,4 @@
|
||||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -84,11 +84,10 @@
|
||||
//prepare to page the results
|
||||
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
|
||||
$param = "&search=".urlencode($search);
|
||||
if (!isset($_GET['page'])) { $_GET['page'] = 0; }
|
||||
$_GET['page'] = $_GET['page'];
|
||||
$page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
|
||||
list($paging_controls_mini, $rows_per_page, $var_3) = paging($total_extensions, $param, $rows_per_page, true); //top
|
||||
list($paging_controls, $rows_per_page, $var_3) = paging($total_extensions, $param, $rows_per_page); //bottom
|
||||
$offset = $rows_per_page * $_GET['page'];
|
||||
$offset = $rows_per_page * $page;
|
||||
|
||||
//get the extensions
|
||||
$sql = "select * from v_extensions ";
|
||||
@@ -194,7 +193,9 @@
|
||||
|
||||
if (is_array($extensions)) {
|
||||
foreach($extensions as $row) {
|
||||
$tr_link = (permission_exists('extension_edit')) ? " href='extension_edit.php?id=".escape($row['extension_uuid'])."'" : null;
|
||||
if (permission_exists('extension_edit')) {
|
||||
$tr_link = "href='extension_edit.php?id=".urlencode($row['extension_uuid']).(is_numeric($page) ? '&page='.$page : null)."'";
|
||||
}
|
||||
echo "<tr ".$tr_link.">\n";
|
||||
if (permission_exists('extension_delete')) {
|
||||
echo " <td valign='top' class='".$row_style[$c]." tr_link_void' style='text-align: center; vertical-align: middle; padding: 0px;'>";
|
||||
@@ -207,7 +208,7 @@
|
||||
}
|
||||
echo " <td valign='top' class='".$row_style[$c]."'>";
|
||||
if (permission_exists('extension_edit')) {
|
||||
echo "<a href='extension_edit.php?id=".escape($row['extension_uuid'])."'>".escape($row['extension'])."</a>";
|
||||
echo "<a ".$tr_link.">".escape($row['extension'])."</a>";
|
||||
}
|
||||
else {
|
||||
echo escape($row['extension']);
|
||||
@@ -250,17 +251,16 @@
|
||||
|
||||
echo " <td class='list_control_icons'>";
|
||||
if (permission_exists('extension_edit')) {
|
||||
echo "<a href='extension_edit.php?id=".escape($row['extension_uuid'])."' alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
||||
echo "<a ".$tr_link." alt='".$text['button-edit']."'>$v_link_label_edit</a>";
|
||||
}
|
||||
if (permission_exists('extension_delete')) {
|
||||
echo "<a href='extension_delete.php?id[]=".escape($row['extension_uuid'])."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
||||
echo "<a href='extension_delete.php?id[]=".escape($row['extension_uuid']).(is_numeric($page) ? '&page='.$page : null)."' alt='".$text['button-delete']."' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>";
|
||||
}
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
$c = ($c) ? 0 : 1;
|
||||
}
|
||||
}
|
||||
unset($extensions, $row);
|
||||
|
||||
if (is_array($extensions)) {
|
||||
echo "<tr>\n";
|
||||
@@ -277,6 +277,8 @@
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
||||
unset($extensions, $row);
|
||||
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user