Add Toggle option to portal for TPac use
authorThomas Berezansky <tsbere@mvlc.org>
Wed, 21 Sep 2011 17:25:38 +0000 (13:25 -0400)
committerDan Scott <dscott@laurentian.ca>
Thu, 22 Sep 2011 04:04:46 +0000 (00:04 -0400)
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
Open-ILS/xul/staff_client/server/index.xhtml

index 16b3325..a63abdf 100644 (file)
 <!ENTITY staff.client.portal.receipts "Edit Receipt Templates">
 <!ENTITY staff.client.portal.copyright "Copyright &copy; 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">
index 0068c4d..b60be0d 100644 (file)
                         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">
               "#" 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>