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