( 511, 'PERSISTENT_LOGIN', oils_i18n_gettext( 511,
'Allows a user to authenticate and get a long-lived session (length configured in opensrf.xml)', 'ppl', 'description' )),
( 512, 'ACQ_INVOICE_REOPEN', oils_i18n_gettext( 512,
- 'Allows a user to reopen an Acquisitions invoice', 'ppl', 'description' ));
+ 'Allows a user to reopen an Acquisitions invoice', 'ppl', 'description' )),
+ ( 513, 'DEBUG_CLIENT', oils_i18n_gettext( 513,
+ 'Allows a user to use debug functions in the staff client', 'ppl', 'description' ));
SELECT SETVAL('permission.perm_list_id_seq'::TEXT, 1000);
<button label="Inspect" oncommand="try { var dtb = document.getElementById('debug_tb'); var dx = eval( dtb.value ); var ds = ''; for (var di in dx) { ds += di + '=' + dx[di] + '\r\n'; }; window.open('data:text/plain;charset=UTF-8,'+window.escape(ds),'debug_win','chrome,resizable,modal'); } catch(E) { alert(E); }; dtb.focus();"/>
<button label="js2JSON" oncommand="try { var dtb = document.getElementById('debug_tb'); alert( js2JSON( eval( dtb.value ) ) ); } catch(E) { alert(E); }; dtb.focus();"/>
</hbox>
- <keyset><key id="debug_box_key" keycode="VK_F7" modifiers="control,shift" oncommand="var dtb = document.getElementById('debug_tb'); var dx = document.getElementById('debug_box'); dx.hidden = !dx.hidden; if (!dx.hidden) dtb.focus();"/></keyset>
+ <keyset><key id="debug_box_key" keycode="VK_F7" modifiers="control,shift" oncommand="JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); var dtb = document.getElementById('debug_tb'); var dx = document.getElementById('debug_box'); if(data.enable_debug || !dx.hidden) { dx.hidden = !dx.hidden; if(!dx.hidden) dtb.focus();}"/></keyset>
<script>dump('finished openils_util_overlay\n');</script>
</scripts>
<button label="Inspect" oncommand="try { var dtb = document.getElementById('debug_tb'); var dx = eval( dtb.value ); var ds = ''; for (var di in dx) { ds += di + '=' + dx[di] + '\r\n'; }; window.open('data:text/plain;charset=UTF-8,'+window.escape(ds),'debug_win','chrome,resizable,modal'); } catch(E) { alert(E); }; dtb.focus();"/>
<button label="js2JSON" oncommand="try { var dtb = document.getElementById('debug_tb'); alert( js2JSON( eval( dtb.value ) ) ); } catch(E) { alert(E); }; dtb.focus();"/>
</hbox>
- <keyset><key id="debug_box_key" keycode="VK_F7" modifiers="control,shift" oncommand="var dtb = document.getElementById('debug_tb'); var dx = document.getElementById('debug_box'); dx.hidden = !dx.hidden; if (!dx.hidden) dtb.focus();"/></keyset>
+ <keyset><key id="debug_box_key" keycode="VK_F7" modifiers="control,shift" oncommand="JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); var dtb = document.getElementById('debug_tb'); var dx = document.getElementById('debug_box'); if(data.debug_build || data.enable_debug || !dx.hidden) { dx.hidden = !dx.hidden; if(!dx.hidden) dtb.focus();}"/></keyset>
</scripts>
<script>dump('Loaded OpenILS/util_overlay_offline.xul\n');</script>
this.session.close();
this.data.menu_perms = false;
this.data.current_hotkeyset = undefined;
+ this.data.enable_debug = this.data.debug_client;
this.data.stash('menu_perms');
this.data.stash('current_hotkeyset');
+ this.data.stash('enable_debug');
/* FIXME - need some locking or object destruction for the async tests */
/* this.test_server( this.controller.view.server_prompt.value ); */
var r = network.simple_request('BATCH_PERM_RETRIEVE_WORK_OU', [ G.data.session.key, get_menu_perms.perm_list ]);
for(p in r)
r[p] = (typeof(r[p][0]) == 'number');
+ // Developer-enabled clients override permissions and always allow debugging
+ if(G.data.debug_build) {
+ r['DEBUG_CLIENT'] = true;
+ }
+ // If we have DEBUG_CLIENT (by force or otherwise) we can use debugging interfaces
+ // Doing this here because this function gets called at least once per login
+ // Including operator change
+ G.data.enable_debug = (r['DEBUG_CLIENT'] == true);
+ G.data.stash('enable_debug');
G.data.menu_perms = r;
G.data.stash('menu_perms');
}
} catch(E) {
}
+ // If we are showing the debugging frame then we consider this a debug build
+ // This could be a versionless build, a developer-pref enabled build, or otherwise
+ // If set this will enable all debugging commands, even if you normally don't have permission to use them
+ G.data.debug_build = !document.getElementById('debug_gb').hidden;
+ G.data.stash('debug_build');
+
var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULAppInfo);
xulG.pref.clearUserPref('open-ils.menu.toolbar.labelbelow');
}
],
+ 'cmd_debug_venkman' : [
+ ['oncommand'],
+ function() {
+ try{
+ xulG.window.win.start_debugger();
+ } catch(E) {
+ alert(E);
+ }
+ }
+ ],
+ 'cmd_debug_inspector' : [
+ ['oncommand'],
+ function() {
+ try{
+ xulG.window.win.start_inspector();
+ } catch(E) {
+ alert(E);
+ }
+ }
+ ],
+ 'cmd_debug_chrome_list' : [
+ ['oncommand'],
+ function() {
+ try{
+ xulG.window.win.start_chrome_list();
+ } catch(E) {
+ alert(E);
+ }
+ }
+ ],
+ 'cmd_debug_chrome_shell' : [
+ ['oncommand'],
+ function() {
+ try{
+ xulG.window.win.start_js_shell();
+ } catch(E) {
+ alert(E)
+ }
+ }
+ ],
};
JSAN.use('util.controller');
<command id="cmd_local_admin" />
<command id="cmd_toggle_meters" />
- <command id="cmd_extension_manager" />
- <command id="cmd_theme_manager" />
- <command id="cmd_about_config" />
+ <command id="cmd_extension_manager"
+ perm="DEBUG_CLIENT"
+ />
+ <command id="cmd_theme_manager"
+ perm="DEBUG_CLIENT"
+ />
+ <command id="cmd_about_config"
+ perm="DEBUG_CLIENT"
+ />
<command id="cmd_adv_user_edit" />
- <command id="cmd_console" />
- <command id="cmd_shell" />
- <command id="cmd_xuleditor" />
+ <command id="cmd_console"
+ perm="DEBUG_CLIENT" />
+ <command id="cmd_shell"
+ perm="DEBUG_CIENT"
+ />
+ <command id="cmd_xuleditor"
+ perm="DEBUG_CLIENT"
+ />
<command id="cmd_fieldmapper" />
<command id="cmd_test_html" />
<command id="cmd_test_xul" />
<command id="cmd_toolbar_mode_set" />
<command id="cmd_toolbar_size_set" />
<command id="cmd_toolbar_label_position_set" />
+ <command id="cmd_debug_venkman"
+ perm="DEBUG_CLIENT"
+ />
+ <command id="cmd_debug_inspector"
+ perm="DEBUG_CLIENT"
+ />
+ <command id="cmd_debug_chrome_list"
+ perm="DEBUG_CLIENT"
+ />
+ <command id="cmd_debug_chrome_shell"
+ perm="DEBUG_CLIENT"
+ />
</commandset>
<!-- The File menu on the main menu -->
<menuitem label="&staff.main.menu.admin.fieldmapper.label;" accesskey="&staff.main.menu.admin.fieldmapper.accesskey;" command="cmd_fieldmapper"/>
<menuitem label="&staff.main.menu.admin.cmd_console.label;" accesskey="&staff.main.menu.admin.cmd_console.accesskey;" command="cmd_console"/>
<menuitem label="&staff.main.menu.admin.cmd_shell.label;" accesskey="&staff.main.menu.admin.cmd_shell.accesskey;" command="cmd_shell"/>
- <menuitem label="&staff.main.menu.admin.cmd_chrome_shell.label;" accesskey="&staff.main.menu.admin.cmd_chrome_shell.accesskey;"
- oncommand="try{xulG.window.win.start_js_shell();}catch(E){alert(E);}"/>
+ <menuitem label="&staff.main.menu.admin.cmd_chrome_shell.label;" accesskey="&staff.main.menu.admin.cmd_chrome_shell.accesskey;" command="cmd_debug_chrome_shell"/>
<menuitem label="server/main/test.html" accesskey="1" command="cmd_test_html"/>
<menuitem label="server/main/test.xul" accesskey="2" command="cmd_test_xul"/>
<menuitem label="&staff.main.menu.admin.clear_cache.label;" accesskey="&staff.main.menu.admin.clear_cache.accesskey;" command="cmd_clear_cache"/>
<menuitem label="&staff.main.menu.admin.extension_manager.label;" command="cmd_extension_manager"/>
<menuitem label="&staff.main.menu.admin.theme_manager.label;" command="cmd_theme_manager"/>
<menuitem label="&staff.main.menu.admin.about_config.label;" command="cmd_about_config"/>
- <menuitem label="&staff.main.menu.admin.venkman.label;" oncommand="try{xulG.window.win.start_debugger();}catch(E){alert(E);}"/>
- <menuitem label="&staff.main.auth.debug.inspector;" oncommand="try{xulG.window.win.start_inspector();}catch(E){alert(E);}"/>
- <menuitem label="&staff.main.auth.debug.chrome_list;" oncommand="try{xulG.window.win.start_chrome_list();}catch(E){alert(E);}"/>
+ <menuitem label="&staff.main.menu.admin.venkman.label;" command="cmd_debug_venkman"/>
+ <menuitem label="&staff.main.auth.debug.inspector;" command="cmd_debug_inspector"/>
+ <menuitem label="&staff.main.auth.debug.chrome_list;" command="cmd_debug_chrome_list"/>
<menuitem label="&staff.main.menu.admin.ping;" oncommand="try{netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');JSAN.use('util.network'); var n = new util.network(); alert(n.ping());}catch(E){alert(E);}"/>
</menupopup>
</menu>
<button label="Inspect" oncommand="try { var dtb = document.getElementById('debug_tb'); var dx = eval( dtb.value ); var ds = ''; for (var di in dx) { ds += di + '=' + dx[di] + '\r\n'; }; window.open('data:text/plain;charset=UTF-8,'+window.escape(ds),'debug_win','chrome,resizable,modal'); } catch(E) { alert(E); }; dtb.focus();"/>
<button label="js2JSON" oncommand="try { var dtb = document.getElementById('debug_tb'); alert( js2JSON( eval( dtb.value ) ) ); } catch(E) { alert(E); }; dtb.focus();"/>
</hbox>
- <keyset><key id="debug_box_key" keycode="VK_F7" modifiers="control,shift" oncommand="var dtb = document.getElementById('debug_tb'); var dx = document.getElementById('debug_box'); dx.hidden = !dx.hidden; if (!dx.hidden) dtb.focus();"/></keyset>
+ <keyset><key id="debug_box_key" keycode="VK_F7" modifiers="control,shift" oncommand="JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'}); var dtb = document.getElementById('debug_tb'); var dx = document.getElementById('debug_box'); if(data.enable_debug || !dx.hidden) { dx.hidden = !dx.hidden; if(!dx.hidden) dtb.focus();}"/></keyset>
<script type="text/javascript" src="/xul/server/skin/custom.js" />
<script>dump('finished openils_util_overlay\n');</script>
</scripts>