From: Jason Etheridge Date: Mon, 4 Feb 2013 07:34:36 +0000 (-0500) Subject: re-implement testString X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a0fcc8d1d1c9e3f55950a1bcb66f96daa817365d;p=evergreen%2Fequinox.git re-implement testString Signed-off-by: Jason Etheridge Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js index b1ffecc909..c41b1c4775 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js @@ -643,3 +643,12 @@ alert('Error in global_utils.js, widget_prompt(): ' + E); } } + + function testString(bundle,key) { + try { + if ($(bundle).getString(key)) { + return true; + } + } catch(E) {} + return false; + } diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index 55a36826ce..2f411a3074 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -128,7 +128,7 @@ main.menu.prototype = { for(var i = 0; i < hotkeysets.length; i++) { var keysetname = hotkeysets[i]; var menuitem = document.createElement('menuitem'); - if(offlineStrings.testString('hotkey.' + keysetname)) + if(testString('offlineStrings','hotkey.' + keysetname)) menuitem.setAttribute('label',offlineStrings.getString('hotkey.' + keysetname)); else menuitem.setAttribute('label',keysetname); @@ -1869,7 +1869,7 @@ main.menu.prototype = { var tab = this.controller.view.tabs.childNodes[i]; tab.curindex = i; tab.label = i + ' ' + tab.origlabel; - if(doAccessKeys && offlineStrings.testString('menu.tab' + i + '.accesskey')) { + if(doAccessKeys && testString('offlineStrings','menu.tab' + i + '.accesskey')) { tab.accessKey = offlineStrings.getString('menu.tab' + i + '.accesskey'); } } @@ -1924,7 +1924,7 @@ main.menu.prototype = { this.controller.view.panels.appendChild(panel); tab.curindex = this.controller.view.tabs.childNodes.length - 1; if(!xulG.pref.getBoolPref('open-ils.disable_accesskeys_on_tabs')) { - if(offlineStrings.testString('menu.tab' + tab.curindex + '.accesskey')) { + if(testString('offlineStrings','menu.tab' + tab.curindex + '.accesskey')) { tab.accessKey = offlineStrings.getString('menu.tab' + tab.curindex + '.accesskey'); } } @@ -2583,7 +2583,7 @@ commands: // If we have more than one context this should label each entry with where it came from // Likely most useful for distinguishing assets from bookings - if(context != valid_r[i].type && offlineStrings.testString('barcode_choice.' + valid_r[i].type + '_label')) + if(context != valid_r[i].type && testString('offlineStrings','barcode_choice.' + valid_r[i].type + '_label')) button_label = offlineStrings.getFormattedString('barcode_choice.' + valid_r[i].type + '_label', [button_label]); xml += '