From: pines Date: Tue, 29 Aug 2006 19:43:19 +0000 (+0000) Subject: move global_util.js to chrome X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=68a7c64496e9dd23123c53855a26691755a5d463;p=Evergreen.git move global_util.js to chrome git-svn-id: svn://svn.open-ils.org/ILS/trunk@5762 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/Makefile b/Open-ILS/xul/staff_client/Makefile index 7570693c2d..e9c71703a2 100644 --- a/Open-ILS/xul/staff_client/Makefile +++ b/Open-ILS/xul/staff_client/Makefile @@ -48,7 +48,7 @@ build_dir: cp build/chrome/content/main/lang.js build/server/main/lang.js cp build/chrome/content/main/simple_auth.xul build/server/main/simple_auth.xul cp build/chrome/content/OpenILS/data.js build/server/OpenILS/data.js - cp build/server/OpenILS/global_util.js build/chrome/content/OpenILS/global_util.js + cp build/chrome/content/OpenILS/global_util.js build/server/OpenILS/global_util.js external/prune_dirs.sh build/ stamp: 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 new file mode 100644 index 0000000000..79bdc6a64b --- /dev/null +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js @@ -0,0 +1,68 @@ + function ses(a) { + JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); + switch(a) { + case 'authtime' : + return data.session.authtime; + break; + case 'key': + default: + return data.session.key; + break; + } + } + + function font_helper() { + try { + JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); + removeCSSClass(document.documentElement,'ALL_FONTS_LARGER'); + removeCSSClass(document.documentElement,'ALL_FONTS_SMALLER'); + removeCSSClass(document.documentElement,'ALL_FONTS_XX_SMALL'); + removeCSSClass(document.documentElement,'ALL_FONTS_X_SMALL'); + removeCSSClass(document.documentElement,'ALL_FONTS_SMALL'); + removeCSSClass(document.documentElement,'ALL_FONTS_MEDIUM'); + removeCSSClass(document.documentElement,'ALL_FONTS_LARGE'); + removeCSSClass(document.documentElement,'ALL_FONTS_X_LARGE'); + removeCSSClass(document.documentElement,'ALL_FONTS_XX_LARGE'); + addCSSClass(document.documentElement,data.global_font_adjust); + } catch(E) { + alert("Error with adjusting the font size: " + E); + } + } + + function get_bool(a) { + // Normal javascript interpretation except 'f' == false, per postgres, and 'F' == false + // So false includes 'f', '', 0, null, and undefined + if (a == 'f') return false; + if (a == 'F') return false; + if (a) return true; else return false; + } + + function get_db_true() { + return 't'; + } + + function get_db_false() { + return 'f'; + } + + function copy_to_clipboard(ev) { + try { + netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); + var text; + if (typeof ev == 'object') { + if (typeof ev.target != 'undefined') { + if (typeof ev.target.textContent != 'undefined') if (ev.target.textContent) text = ev.target.textContent; + if (typeof ev.target.value != 'undefined') if (ev.target.value) text = ev.target.value; + } + } else if (typeof ev == 'string') { + text = ev; + } + const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"] + .getService(Components.interfaces.nsIClipboardHelper); + gClipboardHelper.copyString(text); + alert('Copied "'+text+'" to clipboard.'); + } catch(E) { + alert('Clipboard action failed: ' + E); + } + } + diff --git a/Open-ILS/xul/staff_client/server/OpenILS/global_util.js b/Open-ILS/xul/staff_client/server/OpenILS/global_util.js deleted file mode 100644 index 79bdc6a64b..0000000000 --- a/Open-ILS/xul/staff_client/server/OpenILS/global_util.js +++ /dev/null @@ -1,68 +0,0 @@ - function ses(a) { - JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); - switch(a) { - case 'authtime' : - return data.session.authtime; - break; - case 'key': - default: - return data.session.key; - break; - } - } - - function font_helper() { - try { - JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); - removeCSSClass(document.documentElement,'ALL_FONTS_LARGER'); - removeCSSClass(document.documentElement,'ALL_FONTS_SMALLER'); - removeCSSClass(document.documentElement,'ALL_FONTS_XX_SMALL'); - removeCSSClass(document.documentElement,'ALL_FONTS_X_SMALL'); - removeCSSClass(document.documentElement,'ALL_FONTS_SMALL'); - removeCSSClass(document.documentElement,'ALL_FONTS_MEDIUM'); - removeCSSClass(document.documentElement,'ALL_FONTS_LARGE'); - removeCSSClass(document.documentElement,'ALL_FONTS_X_LARGE'); - removeCSSClass(document.documentElement,'ALL_FONTS_XX_LARGE'); - addCSSClass(document.documentElement,data.global_font_adjust); - } catch(E) { - alert("Error with adjusting the font size: " + E); - } - } - - function get_bool(a) { - // Normal javascript interpretation except 'f' == false, per postgres, and 'F' == false - // So false includes 'f', '', 0, null, and undefined - if (a == 'f') return false; - if (a == 'F') return false; - if (a) return true; else return false; - } - - function get_db_true() { - return 't'; - } - - function get_db_false() { - return 'f'; - } - - function copy_to_clipboard(ev) { - try { - netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); - var text; - if (typeof ev == 'object') { - if (typeof ev.target != 'undefined') { - if (typeof ev.target.textContent != 'undefined') if (ev.target.textContent) text = ev.target.textContent; - if (typeof ev.target.value != 'undefined') if (ev.target.value) text = ev.target.value; - } - } else if (typeof ev == 'string') { - text = ev; - } - const gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"] - .getService(Components.interfaces.nsIClipboardHelper); - gClipboardHelper.copyString(text); - alert('Copied "'+text+'" to clipboard.'); - } catch(E) { - alert('Clipboard action failed: ' + E); - } - } -