(Modified) Usability Enhancement: Click on list rows to Edit items. Now uses jQuery (instead of onclick) to avoid being redirected to Edit when canceling a Delete.

This commit is contained in:
Nate Jones
2014-06-21 08:52:47 +00:00
parent 3c2e32d197
commit 59687a4785
22 changed files with 51 additions and 33 deletions

View File

@@ -150,7 +150,7 @@ else {
if ($result_count > 0) {
foreach($result as $row) {
$tr_url = PROJECT_PATH."/app/calls/call_edit.php?id=".$row['extension_uuid'];
$tr_link = (permission_exists('call_forward') || permission_exists('follow_me') || permission_exists('do_not_disturb')) ? " onclick=\"document.location.href='".$tr_url."';\"" : null;
$tr_link = (permission_exists('call_forward') || permission_exists('follow_me') || permission_exists('do_not_disturb')) ? "href='".$tr_url."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['extension']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>\n";

View File

@@ -96,7 +96,7 @@ $order = $_GET["order"];
echo th_order_by('rss_link', $text['label-link'], $order_by, $order);
//echo th_order_by('rss_sub_category', 'Template', $order_by, $order);
echo th_order_by('rss_group', $text['label-group'], $order_by, $order);
echo th_order_by('rss_order', $text['label-order'], $order_by, $order);
echo th_order_by('rss_order', $text['label-order'], $order_by, $order, '', "style='text-align: center;'");
if ($result_count == 0) { //no results
echo "<td class='list_control_icons'>\n";
}
@@ -110,8 +110,8 @@ $order = $_GET["order"];
if ($result_count > 0) {
foreach($result as $row) {
//print_r( $row );
$tr_link = " onclick=\"document.location.href='rssupdate.php?rss_uuid=".$row[rss_uuid]."';\"";
echo "<tr style='".$row_style[$c]."' ".$tr_link.">\n";
$tr_link = "href='rssupdate.php?rss_uuid=".$row[rss_uuid]."'";
echo "<tr ".$tr_link.">\n";
//echo "<td valign='top'><a href='rssupdate.php?rss_uuid=".$row[rss_uuid]."'>".$row[rss_uuid]."</a></td>";
//echo "<td valign='top'>".$row[rss_category]."</td>";
@@ -141,7 +141,7 @@ $order = $_GET["order"];
//echo "<td valign='top'>".$row[rss_optional_3]."</td>";
//echo "<td valign='top'>".$row[rss_optional_4]."</td>";
//echo "<td valign='top'>".$row[rss_optional_5]."</td>";
echo "<td valign='top' class='".$row_style[$c]."'>".$row[rss_order]."</td>";
echo "<td valign='top' class='".$row_style[$c]."' style='text-align: center;'>".$row[rss_order]."</td>";
//echo "<td valign='top' align='center'>";
//echo " <input type='button' class='btn' name='' onclick=\"window.location='rssmoveup.php?menuparentid=".$row[menuparentid]."&rss_uuid=".$row[rss_uuid]."&rss_order=".$row[rss_order]."'\" value='<' title='".$row[rss_order].". Move Up'>";

View File

@@ -134,7 +134,7 @@ require_once "resources/paging.php";
$row_style["1"] = "row_style1";
echo "<div align='center'>\n";
echo "<table 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 th_order_by('destination_type', $text['label-destination_type'], $order_by, $order);
echo th_order_by('destination_number', $text['label-destination_number'], $order_by, $order);
@@ -144,10 +144,10 @@ require_once "resources/paging.php";
echo "<td class='list_control_icons'>";
echo "<a href='destination_edit.php' alt='".$text['button-add']."'>$v_link_label_add</a>";
echo "</td>\n";
echo "<tr>\n";
if ($result_count > 0) {
foreach($result as $row) {
echo "<tr >\n";
$tr_link = "href='destination_edit.php?id=".$row['destination_uuid']."'";
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".ucwords($row['destination_type'])."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'><a href='destination_edit.php?id=".$row['destination_uuid']."'>".$row['destination_number']."</a></td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['destination_context']."</td>\n";

View File

@@ -164,7 +164,7 @@ else {
$device_mac_address = $row[device_mac_address];
$device_mac_address = substr($device_mac_address, 0,2).'-'.substr($device_mac_address, 2,2).'-'.substr($device_mac_address, 4,2).'-'.substr($device_mac_address, 6,2).'-'.substr($device_mac_address, 8,2).'-'.substr($device_mac_address, 10,2);
$tr_link = (permission_exists('device_edit')) ? " onclick=\"document.location.href='device_edit.php?id=".$row['device_uuid']."';\"" : null;
$tr_link = (permission_exists('device_edit')) ? "href='device_edit.php?id=".$row['device_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
//echo " <td valign='top' class='".$row_style[$c]."'>".$row['device_uuid']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>";

View File

@@ -189,13 +189,13 @@ else {
$row_style["1"] = "row_style1";
echo "<div align='center'>\n";
echo "<table 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 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_context', $text['label-context'], $order_by, $order, $app_uuid);
echo th_order_by('dialplan_order', $text['label-order'], $order_by, $order, $app_uuid);
echo th_order_by('dialplan_enabled', $text['label-enabled'], $order_by, $order, $app_uuid);
echo th_order_by('dialplan_order', $text['label-order'], $order_by, $order, $app_uuid, "style='text-align: center;'");
echo th_order_by('dialplan_enabled', $text['label-enabled'], $order_by, $order, $app_uuid, "style='text-align: center;'");
echo th_order_by('dialplan_description', $text['label-description'], $order_by, $order, $app_uuid);
echo "<td class='list_control_icons'>";
if ($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" && permission_exists('inbound_route_add')) {
@@ -244,7 +244,16 @@ else {
}
unset ($prep_statement);
}
echo "<tr >\n";
if (
($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 == "16589224-c876-aeb3-f59f-523a1c0801f7" && permission_exists('fifo_edit')) ||
($app_uuid == "4b821450-926b-175a-af93-a03c441818b1" && permission_exists('time_condition_edit')) ||
permission_exists('dialplan_edit')
) {
$tr_link = "href='dialplan_edit.php?id=".$row['dialplan_uuid']."&app_uuid=".$app_uuid."'";
}
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if (
($app_uuid == "c03b422e-13a8-bd1b-e42b-b6b9b4d27ce4" && permission_exists('inbound_route_edit')) ||
@@ -261,8 +270,8 @@ else {
echo " </td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".((strlen($row['dialplan_number']) > 0) ? $row['dialplan_number'] : "&nbsp;")."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['dialplan_context']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['dialplan_order']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".ucwords($row['dialplan_enabled'])."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."' style='text-align: center;'>".$row['dialplan_order']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."' style='text-align: center;'>".ucwords($row['dialplan_enabled'])."</td>\n";
echo " <td valign='top' class='row_stylebg' width='30%'>".((strlen($row['dialplan_description']) > 0) ? $row['dialplan_description'] : "&nbsp;")."</td>\n";
echo " <td class='list_control_icons'>\n";
if (

View File

@@ -152,7 +152,7 @@ require_once "resources/paging.php";
if ($result_count > 0) {
foreach($result as $row) {
$tr_link = (permission_exists('extension_edit')) ? " onclick=\"document.location.href='extension_edit.php?id=".$row['extension_uuid']."';\"" : null;
$tr_link = (permission_exists('extension_edit')) ? " href='extension_edit.php?id=".$row['extension_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if (permission_exists('extension_edit')) {

View File

@@ -164,7 +164,7 @@ else {
if ($num_rows > 0) {
foreach($result as $row) {
$tr_link = (permission_exists('gateway_edit')) ? " onclick=\"document.location.href='gateway_edit.php?id=".$row['gateway_uuid']."';\"" : null;
$tr_link = (permission_exists('gateway_edit')) ? "href='gateway_edit.php?id=".$row['gateway_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if (permission_exists('gateway_edit')) {

View File

@@ -156,7 +156,7 @@ if (strlen($_GET["a"]) > 0) {
echo $tmp_module_header;
}
$tr_link = (permission_exists('module_edit')) ? " onclick=\"document.location.href='module_edit.php?id=".$row["module_uuid"]."';\"" : null;
$tr_link = (permission_exists('module_edit')) ? "href='module_edit.php?id=".$row["module_uuid"]."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if (permission_exists('module_edit')) {

View File

@@ -106,7 +106,7 @@ require_once "resources/paging.php";
echo "</td>\n";
if ($num_rows > 0) {
foreach($result as $row) {
$tr_link = (permission_exists('sip_profile_setting_edit')) ? " onclick=\"document.location.href='sip_profile_setting_edit.php?sip_profile_uuid=".$row['sip_profile_uuid']."&id=".$row['sip_profile_setting_uuid']."';\"" : null;
$tr_link = (permission_exists('sip_profile_setting_edit')) ? "href='sip_profile_setting_edit.php?sip_profile_uuid=".$row['sip_profile_uuid']."&id=".$row['sip_profile_setting_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if (permission_exists('sip_profile_setting_edit')) {

View File

@@ -123,7 +123,7 @@ require_once "resources/paging.php";
if ($result_count > 0) {
foreach($result as $row) {
$tr_link = (permission_exists('sip_profile_edit')) ? " onclick=\"document.location.href='sip_profile_edit.php?id=".$row['sip_profile_uuid']."';\"" : null;
$tr_link = (permission_exists('sip_profile_edit')) ? "href='sip_profile_edit.php?id=".$row['sip_profile_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if (permission_exists('sip_profile_edit')) {

View File

@@ -127,7 +127,7 @@ else {
echo $tmp_var_header;
}
$tr_link = (permission_exists('var_edit')) ? " onclick=\"document.location.href='var_edit.php?id=".$row['var_uuid']."';\"" : null;
$tr_link = (permission_exists('var_edit')) ? "href='var_edit.php?id=".$row['var_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' align='left' class='".$row_style[$c]."'>";
if (permission_exists('var_edit')) {

View File

@@ -29,7 +29,7 @@ $row_style["0"] = "row_style0";
$row_style["1"] = "row_style1";
foreach($profiles_array as $profile){
$tr_link = (permission_exists('xmpp_edit')) ? " onclick=\"document.location.href='xmpp_profile_edit.php?id=".$profile['xmpp_profile_uuid']."';\"" : null;
$tr_link = (permission_exists('xmpp_edit')) ? "href='xmpp_profile_edit.php?id=".$profile['xmpp_profile_uuid']."'" : null;
?>
<tr <?php echo $tr_link; ?>>
<td class='<?php echo $row_style[$c]; ?>'>

View File

@@ -100,7 +100,7 @@ require_once "resources/paging.php";
foreach($apps as $row) {
if ($row['uuid'] != "d8704214-75a0-e52f-1336-f0780e29fef8") {
/*
$tr_link = (permission_exists('app_edit')) ? " onclick=\"document.location.href='apps_edit.php?id=".$row['uuid']."';\"" : null;
$tr_link = (permission_exists('app_edit')) ? "href='apps_edit.php?id=".$row['uuid']."'" : null;
*/
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."' nowrap='nowrap'>";

View File

@@ -124,7 +124,7 @@ require_once "resources/paging.php";
if ($result_count > 0) {
foreach($result as $row) {
$tr_link = " onclick=\"document.location.href='database_edit.php?id=".$row['database_uuid']."';\"";
$tr_link = "href='database_edit.php?id=".$row['database_uuid']."'";
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['database_driver']."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['database_type']."&nbsp;</td>\n";

View File

@@ -148,7 +148,7 @@ require_once "resources/paging.php";
echo "</td>\n";
echo "</tr>\n";
}
$tr_link = (permission_exists('default_setting_edit')) ? " onclick=\"document.location.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 " <td valign='top' class='".$row_style[$c]."'>";
if (permission_exists('default_setting_edit')) {

View File

@@ -132,7 +132,7 @@ require_once "resources/paging.php";
echo "</td>\n";
echo "</tr>\n";
}
$tr_link = (permission_exists('domain_setting_edit')) ? " onclick=\"document.location.href='domain_setting_edit.php?domain_uuid=".$row['domain_uuid']."&id=".$row['domain_setting_uuid']."';\"" : null;
$tr_link = (permission_exists('domain_setting_edit')) ? " href='domain_setting_edit.php?domain_uuid=".$row['domain_uuid']."&id=".$row['domain_setting_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if (permission_exists('domain_setting_edit')) {

View File

@@ -177,7 +177,7 @@ else {
if ($result_count > 0) {
foreach($result as $row) {
$tr_link = (permission_exists('domain_edit')) ? " onclick=\"document.location.href='domain_edit.php?id=".$row['domain_uuid']."';\"" : null;
$tr_link = (permission_exists('domain_edit')) ? "href='domain_edit.php?id=".$row['domain_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if (permission_exists('domain_edit')) {

View File

@@ -117,7 +117,7 @@ require_once "resources/paging.php";
if ($result_count > 0) {
foreach($result as $row) {
$tr_link = " onclick=\"document.location.href='menu_edit.php?id=".$row['menu_uuid']."';\"";
$tr_link = "href='menu_edit.php?id=".$row['menu_uuid']."'";
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'><a href='menu_edit.php?id=".$row['menu_uuid']."'>".$row['menu_name']."</a></td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['menu_language']."</td>\n";

View File

@@ -101,7 +101,7 @@ function build_db_child_menu_list ($db, $menu_item_level, $menu_item_uuid, $c) {
}
//display the content of the list
$tr_link = (permission_exists('menu_edit')) ? " onclick=\"document.location.href='menu_item_edit.php?id=".$menu_uuid."&menu_item_uuid=".$row2['menu_item_uuid']."&menu_item_parent_uuid=".$row2['menu_item_parent_uuid']."';\"" : null;
$tr_link = (permission_exists('menu_edit')) ? "href='menu_item_edit.php?id=".$menu_uuid."&menu_item_uuid=".$row2['menu_item_uuid']."&menu_item_parent_uuid=".$row2['menu_item_parent_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]."'>";
echo " <table cellpadding='0' cellspacing='0' border='0'>";
@@ -269,7 +269,7 @@ $order = $_GET["order"];
}
//display the content of the list
$tr_link = (permission_exists('menu_edit')) ? " onclick=\"document.location.href='menu_item_edit.php?id=".$menu_uuid."&menu_item_uuid=".$row['menu_item_uuid']."&menu_uuid=".$menu_uuid."';\"" : null;
$tr_link = (permission_exists('menu_edit')) ? "href='menu_item_edit.php?id=".$menu_uuid."&menu_item_uuid=".$row['menu_item_uuid']."&menu_uuid=".$menu_uuid."'" : null;
echo "<tr style='".$row_style[$c]."' ".$tr_link.">\n";
echo "<td valign='top' class='".$row_style[$c]."'>".$menu_item_title."&nbsp;</td>";
echo "<td valign='top' class='".$row_style[$c]."'>".$group_list."&nbsp;</td>";

View File

@@ -114,7 +114,7 @@ else {
}
else {
/*
$tr_link = (permission_exists('group_edit')) ? " onclick=\"document.location.href='groupedit.php?id=".$group_uuid."';\"" : null;
$tr_link = (permission_exists('group_edit')) ? "href='groupedit.php?id=".$group_uuid."'" : null;
*/
$strlist .= "<tr ".$tr_link.">\n";
$strlist .= "<td class='".$row_style[$c]."' nowrap>";

View File

@@ -149,7 +149,7 @@ echo " <td align=\"center\">\n";
if (if_superadmin($superadmins, $row['user_uuid']) && !if_group("superadmin")) {
//hide
} else {
$tr_link = (permission_exists('user_edit')) ? " onclick=\"document.location.href='usersupdate.php?id=".$row['user_uuid']."';\"" : null;
$tr_link = (permission_exists('user_edit')) ? "href='usersupdate.php?id=".$row['user_uuid']."'" : null;
echo "<tr ".$tr_link.">\n";
echo " <td valign='top' class='".$row_style[$c]."'>";
if (permission_exists('user_edit')) {

View File

@@ -774,7 +774,6 @@ legend {
<script language="javascript" type="text/javascript" src="<?php echo PROJECT_PATH; ?>/resources/jquery/jquery-1.8.3.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo PROJECT_PATH; ?>/resources/jquery/jquery.autosize.input.js"></script>
<script language="JavaScript" type="text/javascript">
function display_message() {
$(document).ready(function() {
@@ -801,6 +800,16 @@ legend {
});
// linkify rows (except the last - the list_control_icons cell)
// on a table with a class of 'tr_hover', according to the href
// attribute of the <tr> tag
$('.tr_hover tr').each(function(i,e) {
$(e).children('td:not(:last)').click(function() {
var href = $(this).closest("tr").attr("href");
if (href) { window.location = href; }
});
});
});
function hide_domains() {