return url;
}
+ function widget_prompt(node,args) {
+ // args is an object that may contain the following keys: title, desc, ok_label, ok_accesskey, cancel_label, cancel_accesskey, access, method
+ // access may contain 'property' or 'attribute' or 'method' for retrieving the value from the node
+ // if 'method', then the method key will reference a function that returns the value
+ try {
+ if (!node) { return false; }
+ if (!args) { args = {}; }
+ args[ 'widget' ] = node;
+
+ var url = location.protocol == 'chrome'
+ ? 'chrome://open_ils_staff_client/content/util/widget_prompt.xul'
+ : '/xul/server/util/widget_prompt.xul';
+
+ JSAN.use('util.window'); var win = new util.window();
+ var my_xulG = win.open(
+ url,
+ args.title || 'widget_prompt',
+ 'chrome,modal',
+ args
+ );
+
+ if (my_xulG.status == 'incomplete') {
+ return false;
+ } else {
+ return my_xulG.value;
+ }
+ } catch(E) {
+ alert('Error in global_utils.js, widget_prompt(): ' + E);
+ }
+ }
--- /dev/null
+var xulG = {};
+var widget;
+
+function my_init() {
+ try {
+ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+ if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
+ JSAN.errorLevel = "die"; // none, warn, or die
+ JSAN.addRepository('/xul/server/');
+ JSAN.use('util.error'); g.error = new util.error();
+ g.error.sdump('D_TRACE','my_init() for widget_prompt.xul');
+
+ widget = xul_param('widget',{'modal_xulG':true});
+ if (widget) {
+ $('widget_prompt_main').appendChild(widget);
+ }
+
+ var ok_label = xul_param('ok_label',{'modal_xulG':true}) || offlineStrings.getString('common.ok.label');
+ $('ok_btn').setAttribute('label',ok_label);
+
+ var ok_accesskey = xul_param('ok_accesskey',{'modal_xulG':true}) || offlineStrings.getString('common.ok.accesskey');
+ $('ok_btn').setAttribute('accesskey',ok_accesskey);
+
+ var cancel_label = xul_param('cancel_label',{'modal_xulG':true}) || offlineStrings.getString('common.cancel.label');
+ $('cancel_btn').setAttribute('label',cancel_label);
+
+ var cancel_accesskey = xul_param('cancel_accesskey',{'modal_xulG':true}) || offlineStrings.getString('common.cancel.accesskey');
+ $('cancel_btn').setAttribute('accesskey',cancel_accesskey);
+
+ var desc = xul_param('desc',{'modal_xulG':true});
+ if (desc) {
+ $('desc').appendChild( document.createTextNode( desc ) );
+ }
+
+ $('ok_btn').addEventListener('command',widget_save,false);
+ $('cancel_btn').addEventListener('command',function(ev) { window.close(); },false);
+
+ if (xul_param('title',{'modal_xulG':true})) {
+ try { window.title = xul_param('title',{'modal_xulG':true}); } catch(E) {}
+ try { document.title = xul_param('title',{'modal_xulG':true}); } catch(E) {}
+ }
+
+ xulG[ 'status' ] = 'incomplete';
+ update_modal_xulG(xulG);
+
+ try { widget.focus(); } catch(E) {}
+
+ } catch(E) {
+ alert('Error in widget_prompt.js, my_init(): ' + E);
+ }
+}
+
+function widget_save(ev) {
+ try {
+ if (widget) {
+ switch( xul_param('access',{'modal_xulG':true}) ) {
+ case 'method' :
+ xulG[ 'value' ] = xulG[ 'method' ]();
+ break;
+ case 'attribute':
+ xulG[ 'value' ] = widget.getAttribute('value');
+ break;
+ case 'property':
+ default:
+ xulG[ 'value' ] = widget.value;
+ break;
+ }
+ }
+ xulG[ 'status' ] = 'complete';
+
+ update_modal_xulG(xulG);
+
+ window.close();
+ } catch(E) {
+ alert('Error in widget_prompt.js, widget_save(): ' + E);
+ }
+}
+
--- /dev/null
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Example Template for remote xul -->
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- STYLESHEETS -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
+<?xml-stylesheet href="/xul/server/skin/patron_display.css" type="text/css"?>
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- LOCALIZATION -->
+<!DOCTYPE window PUBLIC "" ""[
+ <!--#include virtual="/opac/locale/en-US/lang.dtd"-->
+]>
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- OVERLAYS -->
+<?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
+
+<window id="widget_prompt_win"
+ onload="try { my_init(); font_helper(); persist_helper( xul_param('title',{'modal_xulG':true}) ); } catch(E) { alert(E); }"
+ oils_persist="width height"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+ <!-- BEHAVIOR -->
+ <script type="text/javascript">
+ var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};
+ </script>
+ <scripts id="openils_util_scripts"/>
+
+ <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
+ <script type="text/javascript" src="widget_prompt.js"/>
+
+ <vbox id="widget_prompt_topbar">
+ <description id="desc"/>
+ </vbox>
+ <vbox id="widget_prompt_main" flex="1" style="overflow: auto"/>
+ <vbox id="widget_prompt_bottombar">
+ <hbox id="widget_prompt_buttonbar">
+ <spacer flex="1"/>
+ <button id="ok_btn" />
+ <button id="cancel_btn" />
+ </hbox>
+ </vbox>
+
+</window>
+
common.exception=!! This software has encountered an error. Please tell your friendly system administrator or software developer the following:\n%1$s\n%2$s\n
common.jsan.missing=The JSAN library object is missing.
common.ok=Ok
+common.ok.label=Ok
+common.ok.accesskey=O
+common.cancel.label=Cancel
+common.cancel.accesskey=C
common.clear=Clear
common.confirm=Check here to confirm this message.
common.error.default=Please report that this happened.