Add Zoom support to browser views
[working/Evergreen.git] / Open-ILS / xul / staff_client / chrome / content / util / browser.xul
1 <?xml version="1.0"?>
2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: Patron Display -->
4
5 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
6 <!-- STYLESHEETS -->
7 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
8 <?xml-stylesheet href="chrome://open_ils_staff_client/skin/global.css" type="text/css"?>
9
10 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
11 <!-- LOCALIZATION -->
12 <!DOCTYPE window SYSTEM "chrome://open_ils_staff_client/locale/lang.dtd">
13
14 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
15 <!-- OVERLAYS -->
16 <?xul-overlay href="chrome://open_ils_staff_client/content/OpenILS/util_overlay_chrome.xul"?>
17
18 <window id="util_browser_win" 
19     onload="try { my_init(); font_helper(); } catch(E) { alert(E); }"
20     xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
21
22     <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
23     <!-- BEHAVIOR -->
24         <script type="text/javascript">
25         var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};
26     </script>
27         <scripts id="openils_util_scripts"/>
28
29     <script type="text/javascript" src="chrome://open_ils_staff_client/content/main/JSAN.js"/>
30     <script>
31     <![CDATA[
32         function my_init() {
33             try {
34                         if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
35                 JSAN.errorLevel = "die"; // none, warn, or die
36                 JSAN.addRepository('..');
37                 JSAN.use('util.error'); g.error = new util.error();
38                 g.error.sdump('D_TRACE','my_init() for util_browser.xul');
39
40                 JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
41                 XML_HTTP_SERVER = data.server_unadorned;
42
43                 var name = xul_param('tab_name') || xul_param('name') || null;
44                 var url; try { url = xul_param('url'); } catch(E) { dump(E + '\n'); };
45                 if (!url) url = urls.browser;
46
47                 JSAN.use('util.browser'); g.browser = new util.browser();
48
49                 var push_xulG = true;
50                 if (xul_param('no_xulG')) push_xulG = false;
51
52                 var p =    { 
53                     'url' : url,
54                     'push_xulG' : push_xulG,
55                     'printer_context' : xul_param('printer_context'),
56                     'html_source' : xul_param('html_source'),
57                     'debug_label' : 'debug'
58                 };
59                 if (typeof window.xulG == 'object' && typeof window.xulG.passthru_content_params == 'object') {
60                     p.passthru_content_params = window.xulG.passthru_content_params;
61                 }
62                 if (typeof window.xulG == 'object' && typeof window.xulG.on_url_load == 'function') {
63                     p.on_url_load = window.xulG.on_url_load;
64                 }
65
66                 g.browser.init( p );
67
68                 if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
69                     if (name) try { window.xulG.set_tab_name(name); } catch(E) { alert(E); }
70                 }
71                 if (xul_param('show_nav_buttons')) {
72                     document.getElementById('back').hidden = false;
73                     document.getElementById('forward').hidden = false;
74                 }
75                 if (xul_param('show_print_button')) {
76                     document.getElementById('browser_print').hidden = false;
77                 }
78
79                 if (xul_param('title')) {
80                     try { document.title = xul_param('title'); } catch(E) {}
81                     try { window.title = xul_param('title'); } catch(E) {}
82                 }
83
84             } catch(E) {
85                 var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
86                     "system administrator or software developer the following:\n" + E + '\n';
87                 try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
88                 alert(err_msg);
89             }
90         }
91
92         function default_focus() {
93             try {
94                 dump('entering browser.xul, default_focus()\n');
95                 g.browser.updateNavButtons();
96             } catch(E) {
97                 dump('Error in browser.xul, default_focus(): ' + E + '\n');
98             }
99         }
100
101     ]]>
102     </script>
103
104     <commandset id="util_browser_cmds">
105         <command id="cmd_broken" />
106         <command id="cmd_print" label="&common.browser.print.label;" accesskey="&common.browser.print.accesskey;" />
107         <command id="cmd_debug" />
108         <command id="cmd_view_source" />
109         <command id="cmd_find" />
110         <command id="cmd_back" label="&common.browser.backward.label;" accesskey="&common.browser.backward.accesskey;" />
111         <command id="cmd_reload" label="&common.browser.reload.label;" accesskey="&common.browser.reload.accesskey;" />
112         <command id="cmd_forward" label="&common.browser.forward.label;" accesskey="&common.browser.forward.accesskey;" />
113         <command id="cmd_zoom_in" oncommand="g.browser.controller.view.browser_browser.markupDocumentViewer.fullZoom += 0.1;" />
114         <command id="cmd_zoom_out" oncommand="g.browser.controller.view.browser_browser.markupDocumentViewer.fullZoom -= 0.1;" />
115         <command id="cmd_zoom_reset" oncommand="g.browser.controller.view.browser_browser.markupDocumentViewer.fullZoom = 1;" />
116     </commandset>
117
118     <keyset>
119         <key key="-" command="cmd_zoom_out"   modifiers="accel"/>
120         <key key="+" command="cmd_zoom_in"    modifiers="accel"/>
121         <key key="=" command="cmd_zoom_in"    modifiers="accel"/>
122         <key key="0" command="cmd_zoom_reset" modifiers="accel"/>
123     </keyset>
124
125     <popupset>
126         <menupopup id="debug_popup">
127             <menuitem label="&common.browser.view_source.label;" accesskey="&common.browser.view_source.accesskey;" command="cmd_view_source" />
128             <menuitem label="&common.browser.set_url.label;" accesskey="&common.browser.set_url.accesskey;" command="cmd_debug" />
129             <menuitem label="&common.browser.find.label;" accesskey="&common.browser.find.accesskey;" command="cmd_find" />
130         </menupopup>
131     </popupset>
132
133     <vbox flex="1">
134         <hbox>
135             <button id="back" command="cmd_back" disabled="true" hidden="true"/>
136             <button id="reload" command="cmd_reload" disabled="false" hidden="false"/>
137             <button id="forward" command="cmd_forward" disabled="true" hidden="true"/>
138             <spacer flex="1"/>
139             <label id="debug" value="&common.debug.menu.btn;" disabled="true" popup="debug_popup" />
140             <button id="browser_print" command="cmd_print" hidden="true"/>
141         </hbox>
142         <browser id="browser_browser" flex="1" autoscroll="false" type="content" oils_force_external="true" />
143     </vbox>
144
145 </window>
146