Voicemail: Show Add button even when no Voicemails exist.

Extensions: Integrate keyboard shortcuts (Ctrl+A to select all, Delete to delete checked).
This commit is contained in:
reliberate 2016-03-31 18:03:32 -06:00
parent 9cfedbf2e9
commit d73ea93a14
2 changed files with 83 additions and 70 deletions

View File

@ -138,7 +138,7 @@ require_once "resources/paging.php";
if (if_group("superadmin")) {
echo " <input type='button' class='btn' style='margin-right: 15px;' value='".$text['button-export']."' onclick=\"window.location.href='extension_download.php'\">\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' id='search' value='".$search."'>";
echo " <input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
if ($paging_controls_mini != '') {
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
@ -165,7 +165,7 @@ require_once "resources/paging.php";
echo th_order_by('user_context', $text['label-user_context'], $order_by, $order);
echo th_order_by('enabled', $text['label-enabled'], $order_by, $order);
echo th_order_by('description', $text['label-description'], $order_by, $order);
echo "<td class='list_control_icons'>\n";
echo "<td class='list_control_icon'>\n";
if (permission_exists('extension_add')) {
if ($_SESSION['limit']['extensions']['numeric'] == '' || ($_SESSION['limit']['extensions']['numeric'] != '' && $total_extensions < $_SESSION['limit']['extensions']['numeric'])) {
echo "<a href='extension_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
@ -178,6 +178,7 @@ require_once "resources/paging.php";
echo "</tr>\n";
if ($num_rows > 0) {
foreach($extensions as $row) {
$tr_link = (permission_exists('extension_edit')) ? " href='extension_edit.php?id=".$row['extension_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
@ -209,24 +210,26 @@ require_once "resources/paging.php";
}
echo "</td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $extensions, $row_count);
} //end if results
echo " <tr>\n";
echo " <td colspan='20' class='list_control_icons'>\n";
if (permission_exists('extension_add')) {
if ($_SESSION['limit']['extensions']['numeric'] == '' || ($_SESSION['limit']['extensions']['numeric'] != '' && $total_extensions < $_SESSION['limit']['extensions']['numeric'])) {
echo "<a href='extension_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
$c = ($c) ? 0 : 1;
}
}
if (permission_exists('extension_delete') && $num_rows > 0) {
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
}
echo " </td>\n";
echo " </tr>\n";
unset($extensions, $row);
}
if ($num_rows > 0) {
echo "<tr>\n";
echo " <td colspan='20' class='list_control_icons'>\n";
if (permission_exists('extension_add')) {
if ($_SESSION['limit']['extensions']['numeric'] == '' || ($_SESSION['limit']['extensions']['numeric'] != '' && $total_extensions < $_SESSION['limit']['extensions']['numeric'])) {
echo "<a href='extension_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
}
if (permission_exists('extension_delete')) {
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
}
echo " </td>\n";
echo "</tr>\n";
}
echo "</table>";
echo "</form>";
@ -235,19 +238,28 @@ require_once "resources/paging.php";
echo "<center>".$paging_controls."</center>\n";
}
echo "<br><br>\n";
echo "<br /><br />".(($num_rows == 0) ? "<br /><br />" : null);
// check or uncheck all checkboxes
if (sizeof($ext_ids) > 0) {
echo "<script>\n";
echo " function check(what) {\n";
echo " document.getElementById('chk_all').checked = (what == 'all') ? true : false;\n";
foreach ($ext_ids as $ext_id) {
echo "document.getElementById('".$ext_id."').checked = (what == 'all') ? true : false;\n";
echo " document.getElementById('".$ext_id."').checked = (what == 'all') ? true : false;\n";
}
echo " }\n";
echo "</script>\n";
}
if ($num_rows > 0) {
// check all checkboxes
key_press('ctrl+a', 'down', 'document', null, null, "check('all');", true);
// delete checked
key_press('delete', 'up', 'document', array('#search'), $text['confirm-delete'], 'document.forms.frm.submit();', true);
}
//show the footer
require_once "resources/footer.php";
?>

View File

@ -145,35 +145,36 @@ else {
echo " </tr>\n";
echo "</table>\n";
echo "<form name='frm' method='post' action='voicemail_delete.php'>\n";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
if (permission_exists('voicemail_delete') && $num_rows > 0) {
echo "<th style='width: 30px; text-align: center; padding: 0px;'><input type='checkbox' id='chk_all' onchange=\"(this.checked) ? check('all') : check('none');\"></th>";
}
echo th_order_by('voicemail_id', $text['label-voicemail_id'], $order_by, $order);
echo th_order_by('voicemail_mail_to', $text['label-voicemail_mail_to'], $order_by, $order);
echo th_order_by('voicemail_file', $text['label-voicemail_file_attached'], $order_by, $order);
echo th_order_by('voicemail_local_after_email', $text['label-voicemail_local_after_email'], $order_by, $order);
echo "<th>".$text['label-tools']."</th>\n";
echo th_order_by('voicemail_enabled', $text['label-voicemail_enabled'], $order_by, $order);
echo th_order_by('voicemail_description', $text['label-voicemail_description'], $order_by, $order);
echo "<td class='list_control_icon'>";
if (permission_exists('voicemail_add') || permission_exists('voicemail_edit')) {
echo "<a href='voicemail_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
if (permission_exists('voicemail_delete') && $num_rows > 0) {
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
}
echo "</td>\n";
echo "</tr>\n";
$c = 0;
$row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
if ($num_rows > 0) {
echo "<form name='frm' method='post' action='voicemail_delete.php'>\n";
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
echo "<tr>\n";
if (permission_exists('voicemail_delete') && $num_rows > 0) {
echo "<th style='width: 30px; text-align: center; padding: 0px;'><input type='checkbox' id='chk_all' onchange=\"(this.checked) ? check('all') : check('none');\"></th>";
}
echo th_order_by('voicemail_id', $text['label-voicemail_id'], $order_by, $order);
echo th_order_by('voicemail_mail_to', $text['label-voicemail_mail_to'], $order_by, $order);
echo th_order_by('voicemail_file', $text['label-voicemail_file_attached'], $order_by, $order);
echo th_order_by('voicemail_local_after_email', $text['label-voicemail_local_after_email'], $order_by, $order);
echo "<th>".$text['label-tools']."</th>\n";
echo th_order_by('voicemail_enabled', $text['label-voicemail_enabled'], $order_by, $order);
echo th_order_by('voicemail_description', $text['label-voicemail_description'], $order_by, $order);
echo "<td class='list_control_icons' style='width: 25px;'>";
if (permission_exists('voicemail_add') || permission_exists('voicemail_edit')) {
echo "<a href='voicemail_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
if (permission_exists('voicemail_delete')) {
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
}
echo "</td>\n";
echo "</tr>\n";
foreach($voicemails as $row) {
$tr_link = (permission_exists('voicemail_edit')) ? "href='voicemail_edit.php?id=".$row['voicemail_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
@ -215,53 +216,53 @@ else {
echo " </td>\n";
}
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $voicemails, $row_count);
$c = ($c) ? 0 : 1;
}
unset($voicemails, $row);
}
if ($num_rows > 0) {
echo "<tr>\n";
echo " <td colspan='20' class='list_control_icons'>\n";
if (permission_exists('voicemail_add')) {
echo "<a href='voicemail_edit.php' alt='".$text['button-add']."'>".$v_link_label_add."</a>";
}
if (permission_exists('voicemail_delete') && $num_rows > 0) {
if (permission_exists('voicemail_delete')) {
echo "<a href='javascript:void(0);' onclick=\"if (confirm('".$text['confirm-delete']."')) { document.forms.frm.submit(); }\" alt='".$text['button-delete']."'>".$v_link_label_delete."</a>";
}
echo " </td>\n";
echo "</tr>\n";
}
echo "</table>";
echo "</form>";
echo "</table>";
echo "</form>";
if (strlen($paging_controls) > 0) {
echo "<center>".$paging_controls."</center>\n";
}
// check or uncheck all checkboxes
if (sizeof($vm_ids) > 0) {
echo "<script>\n";
echo " function check(what) {\n";
echo " document.getElementById('chk_all').checked = (what == 'all') ? true : false;\n";
foreach ($vm_ids as $vm_id) {
echo " document.getElementById('".$vm_id."').checked = (what == 'all') ? true : false;\n";
}
echo " }\n";
echo "</script>\n";
if (strlen($paging_controls) > 0) {
echo "<center>".$paging_controls."</center>\n";
}
echo "<br /><br />".(($num_rows == 0) ? "<br /><br />" : null);
// check or uncheck all checkboxes
if (sizeof($vm_ids) > 0) {
echo "<script>\n";
echo " function check(what) {\n";
echo " document.getElementById('chk_all').checked = (what == 'all') ? true : false;\n";
foreach ($vm_ids as $vm_id) {
echo " document.getElementById('".$vm_id."').checked = (what == 'all') ? true : false;\n";
}
echo " }\n";
echo "</script>\n";
}
if ($num_rows > 0) {
// check all checkboxes
key_press('ctrl+a', 'down', 'document', null, null, "check('all');", true);
// delete checked
key_press('delete', 'up', 'document', array('#search'), $text['confirm-delete'], 'document.forms.frm.submit();', true);
}
else {
echo "<br />";
echo $text['message-mailbox_not_found'];
}
echo "<br /><br />";
//include the footer
require_once "resources/footer.php";