6 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
7 JSAN.errorLevel = "die"; // none, warn, or die
8 JSAN.addRepository('/xul/server/');
9 JSAN.use('util.error'); g.error = new util.error();
10 g.error.sdump('D_TRACE','my_init() for widget_prompt.xul');
12 widget = xul_param('widget');
14 $('widget_prompt_main').appendChild(widget);
17 var ok_label = xul_param('ok_label') || offlineStrings.getString('common.ok.label');
18 $('ok_btn').setAttribute('label',ok_label);
20 var ok_accesskey = xul_param('ok_accesskey') || offlineStrings.getString('common.ok.accesskey');
21 $('ok_btn').setAttribute('accesskey',ok_accesskey);
23 var cancel_label = xul_param('cancel_label') || offlineStrings.getString('common.cancel.label');
24 $('cancel_btn').setAttribute('label',cancel_label);
26 var cancel_accesskey = xul_param('cancel_accesskey') || offlineStrings.getString('common.cancel.accesskey');
27 $('cancel_btn').setAttribute('accesskey',cancel_accesskey);
29 var desc = xul_param('desc');
31 $('desc').appendChild( document.createTextNode( desc ) );
34 $('ok_btn').addEventListener('command',widget_save,false);
35 $('cancel_btn').addEventListener('command',function(ev) { window.close(); },false);
37 if (xul_param('title')) {
38 try { window.title = xul_param('title'); } catch(E) {}
39 try { document.title = xul_param('title'); } catch(E) {}
42 xulG[ 'status' ] = 'incomplete';
44 try { widget.focus(); } catch(E) {}
47 alert('Error in widget_prompt.js, my_init(): ' + E);
51 function widget_save(ev) {
54 switch( xul_param('access') ) {
56 xulG[ 'value' ] = xulG[ 'method' ]();
59 xulG[ 'value' ] = widget.getAttribute('value');
63 xulG[ 'value' ] = widget.value;
67 xulG[ 'status' ] = 'complete';
71 alert('Error in widget_prompt.js, widget_save(): ' + E);