From e0d8dbf11299207399fd471afeca45cd1bb8346b Mon Sep 17 00:00:00 2001 From: Thomas Berezansky <tsbere@mvlc.org> Date: Wed, 21 Sep 2011 13:25:38 -0400 Subject: [PATCH] Add Toggle option to portal for TPac use In testing I didn't have to restart the staff client, but as constants.js is loaded pretty much everywhere I have no clue where the URL array may be stale. Signed-off-by: Thomas Berezansky <tsbere@mvlc.org> Signed-off-by: Dan Scott <dscott@laurentian.ca> --- Open-ILS/web/opac/locale/en-US/lang.dtd | 3 +++ Open-ILS/xul/staff_client/server/index.xhtml | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 16b3325f71..a63abdf749 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -3642,6 +3642,9 @@ <!ENTITY staff.client.portal.receipts "Edit Receipt Templates"> <!ENTITY staff.client.portal.copyright "Copyright © 2006-2011 Georgia Public Library Service, and others"> <!ENTITY staff.client.portal.poweredby "Powered by"> +<!ENTITY staff.client.portal.toggle_tpac "Toggle Template Toolkit OPAC Use"> +<!ENTITY staff.client.portal.toggle_tpac.message_on "The use of the Template Toolkit OPAC has been enabled. You may need to restart the staff client for this to take effect."> +<!ENTITY staff.client.portal.toggle_tpac.message_off "The use of the Template Toolkit OPAC has been disabled. You may need to restart the staff client for this to take effect."> <!ENTITY staff.item.batch.hold.groupbox_caption "Request Details"> <!ENTITY staff.item.batch.hold.hold_type_menu.label "Hold Type"> <!ENTITY staff.item.batch.hold.hold_type_menu.accesskey "T"> diff --git a/Open-ILS/xul/staff_client/server/index.xhtml b/Open-ILS/xul/staff_client/server/index.xhtml index 0068c4d1a4..b60be0d7b3 100644 --- a/Open-ILS/xul/staff_client/server/index.xhtml +++ b/Open-ILS/xul/staff_client/server/index.xhtml @@ -257,6 +257,24 @@ else xulG.set_tab(loc, {}, content_params); } + function toggle_tpac(mode) { + var use_tpac = false; + netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); + var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces['nsIPrefBranch']); + try { + use_tpac = prefs.getBoolPref('oils.use_tpac'); + } catch (E) { + dump('Failed to get current use_tpac setting - Assuming false: ' + E); + } + use_tpac = !use_tpac; + prefs.setBoolPref('oils.use_tpac', use_tpac); + var message = document.getElementById('tpac_toggled_on'); + if(!use_tpac) { + message = document.getElementById('tpac_toggled_off'); + } + message = message.textContent; + alert(message); + } // ]]> </script> <style type="text/css"> @@ -547,8 +565,18 @@ "#" onclick= "try { receipt_editor(false); } catch(E) { alert(E); }; return false;">&staff.client.portal.receipts;</a></td> </tr> + + <tr> + <td height="50"><img src="skin/media/images/portal/book.png" height="48" width="48" + onclick="try { toggle_tpac(); } catch(E) { alert(E) }; return false;" alt="&staff.client.portal.toggle_tpac;" /></td> + + <td><a href="#" + onclick="try { toggle_tpac(); } catch(E) { alert(E); }; return false;">&staff.client.portal.toggle_tpac;</a></td> + </tr> </table> </div> + <span style="display:none" id="tpac_toggled_on">&staff.client.portal.toggle_tpac.message_on;</span> + <span style="display:none" id="tpac_toggled_off">&staff.client.portal.toggle_tpac.message_off;</span> </td> </tr> </table> -- 2.11.0