From 4c16d92ae1e1032f23e029d7d2f901a65a4223bc Mon Sep 17 00:00:00 2001 From: Janusz Dobrowolski Date: Thu, 23 Oct 2008 17:21:55 +0000 Subject: [PATCH] Hotkey support for viewer links. --- includes/ui/ui_view.inc | 56 ++++++++++++++++------------------------- js/inserts.js | 10 ++++++-- 2 files changed, 29 insertions(+), 37 deletions(-) diff --git a/includes/ui/ui_view.inc b/includes/ui/ui_view.inc index 5925579b..1cd30802 100644 --- a/includes/ui/ui_view.inc +++ b/includes/ui/ui_view.inc @@ -7,7 +7,7 @@ include_once($path_to_root . "/includes/types.inc"); function get_supplier_trans_view_str($type, $trans_no, $label="") { - global $path_to_root, $use_popup_windows; + global $path_to_root; $viewer = ""; if ($type == systypes::po()) @@ -28,10 +28,8 @@ function get_supplier_trans_view_str($type, $trans_no, $label="") if ($viewer != "") { - if ($use_popup_windows) - $preview_str = "$label"; - else - $preview_str = "$label"; + $pars = access_string($label); + $preview_str = "$pars[0]"; } else $preview_str = $label; @@ -43,17 +41,15 @@ function get_supplier_trans_view_str($type, $trans_no, $label="") function get_gl_view_str($type, $trans_no, $label="", $force=false) { - global $path_to_root, $use_popup_windows; + global $path_to_root; if (!$force && !user_show_gl_info()) return ""; if ($label == "") $label = _("GL"); - if ($use_popup_windows) - $gl_view = "$label"; - else - $gl_view = "$label"; + $pars = access_string($label); + $gl_view = "$pars[0]"; return $gl_view; } @@ -71,7 +67,7 @@ function get_gl_view_str_cell($type, $trans_no, $label="") function get_customer_trans_view_str($type, $trans_no, $label="") { - global $path_to_root, $use_popup_windows; + global $path_to_root; $viewer = ""; if ($type == 10) @@ -99,10 +95,8 @@ function get_customer_trans_view_str($type, $trans_no, $label="") if ($viewer != "") { - if ($use_popup_windows) - $preview_str .= "$lbl"; - else - $preview_str .= "$lbl"; + $pars = access_string($lbl); + $preview_str = "$pars[0]"; } else $preview_str .= $lbl; @@ -115,7 +109,7 @@ function get_customer_trans_view_str($type, $trans_no, $label="") function get_banking_trans_view_str($type, $trans_no, $label="") { - global $path_to_root, $use_popup_windows; + global $path_to_root; $viewer = ""; @@ -135,10 +129,8 @@ function get_banking_trans_view_str($type, $trans_no, $label="") if ($viewer != "") { - if ($use_popup_windows) - $preview_str = "$label"; - else - $preview_str = "$label"; + $pars = access_string($label); + $preview_str = "$pars[0]"; } else $preview_str = $label; @@ -150,7 +142,7 @@ function get_banking_trans_view_str($type, $trans_no, $label="") function get_inventory_trans_view_str($type, $trans_no, $label="") { - global $path_to_root, $use_popup_windows; + global $path_to_root; $viewer = ""; @@ -166,10 +158,8 @@ function get_inventory_trans_view_str($type, $trans_no, $label="") if ($viewer != "") { - if ($use_popup_windows) - $preview_str = "$label"; - else - $preview_str = "$label"; + $pars = access_string($label); + $preview_str = "$pars[0]"; } else $preview_str = $label; @@ -181,7 +171,7 @@ function get_inventory_trans_view_str($type, $trans_no, $label="") function get_manufacturing_trans_view_str($type, $trans_no, $label="") { - global $path_to_root, $use_popup_windows; + global $path_to_root; $viewer = ""; @@ -199,10 +189,8 @@ function get_manufacturing_trans_view_str($type, $trans_no, $label="") if ($viewer != "") { - if ($use_popup_windows) - $preview_str = "$label"; - else - $preview_str = "$label"; + $pars = access_string($label); + $preview_str = "$pars[0]"; } else $preview_str = $label; @@ -214,7 +202,7 @@ function get_manufacturing_trans_view_str($type, $trans_no, $label="") function get_dimensions_trans_view_str($type, $trans_no, $label="") { - global $path_to_root, $use_popup_windows; + global $path_to_root; $viewer = ""; @@ -228,10 +216,8 @@ function get_dimensions_trans_view_str($type, $trans_no, $label="") if ($viewer != "") { - if ($use_popup_windows) - $preview_str = "$label"; - else - $preview_str = "$label"; + $pars = access_string($label); + $preview_str = "$pars[0]"; } else $preview_str = $label; diff --git a/js/inserts.js b/js/inserts.js index 088b3957..f05a8772 100644 --- a/js/inserts.js +++ b/js/inserts.js @@ -203,7 +203,8 @@ var inserts = { // this shows divs for js enabled browsers only e.style.display = 'block'; }, - '.ajaxsubmit,.editbutton,.navibutton': +// '.ajaxsubmit,.editbutton,.navibutton': // much slower on IE7 + 'button.ajaxsubmit,submit.ajaxsubmit,submit.editbutton,submit.navibutton': function(e) { e.onclick = function() { if (this.getAttribute('aspect') == 'process') @@ -343,7 +344,12 @@ function setHotKeys() { if (key == 18) { _hotkeys.alt = false; if (_hotkeys.focus>=0) { - window.location = document.links[_hotkeys.focus].href; + var link = document.links[_hotkeys.focus]; + if (link.target=='_blank') { +// window.open(link.href,'','toolbar=no,scrollbar=no,resizable=yes,menubar=no,width=900,height=500'); + openWindow(link.href,'_blank'); + } else + window.location = link.href; } } return stopEv(ev); -- 2.30.2