2 <!-- Application: Evergreen Staff Client -->
3 <!-- Screen: Example Template for remote xul -->
8 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
10 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
11 <?xml-stylesheet href="chrome://open_ils_staff_client/skin/global.css" type="text/css"?>
12 <?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
14 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
16 <!DOCTYPE window PUBLIC "" ""[
17 <!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
20 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
22 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
24 <window id="example_template_win"
25 onload="try { my_init(); font_helper(); } catch(E) { alert(E); }"
26 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
28 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
30 <script type="text/javascript">
31 var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};
33 <scripts id="openils_util_scripts"/>
35 <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
40 function $(id) { return document.getElementById(id); }
44 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
46 /* load translatable strings for cataloging interfaces */
47 catStrings = document.getElementById('catStrings');
49 if (typeof JSAN == 'undefined') {
50 throw( $('commonStrings').getString('common.jsan.missing') );
52 JSAN.errorLevel = "die"; // none, warn, or die
53 JSAN.addRepository('/xul/server/');
54 JSAN.use('util.error'); g.error = new util.error();
55 g.error.sdump('D_TRACE','my_init() for example_template.xul');
57 if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
58 try { window.xulG.set_tab_name(catStrings.getString('staff.cat.marc_new.tab_name')); } catch(E) { alert(E); }
61 JSAN.use('util.network'); g.network = new util.network();
62 JSAN.use('util.widgets');
63 JSAN.use('util.functional');
65 var templates = g.network.simple_request('MARC_XML_TEMPLATE_LIST',[]);
66 if (typeof templates.ilsevent != 'undefined') throw(templates);
67 var ml = util.widgets.make_menulist(
68 util.functional.map_list(
71 return [ el /* The menu entry label */, el /* The menu entry value */ ];
75 $('menu_placeholder').appendChild(ml);
77 $('load').addEventListener(
84 template_name = $('menu_placeholder').firstChild.value;
85 var marc = g.network.simple_request(
86 'MARC_XML_TEMPLATE_RETRIEVE',
89 if (typeof marc.ilsevent != 'undefined') throw(marc);
91 var url = urls.XUL_MARC_EDIT;
93 'record' : { 'marc' : marc },
95 'label' : catStrings.getString('staff.cat.marc_new.create_record.label'),
96 'func' : function(new_marcxml) {
98 var robj = g.network.simple_request(
99 'MARC_XML_RECORD_IMPORT',
100 [ ses(), new_marcxml, catStrings.getString('staff.cat.marc_new.system_local.label'), 1 ]
102 if (typeof robj.ilsevent != 'undefined') throw(robj);
103 alert(catStrings.getString('staff.cat.marc_new.record_created.label'));
105 /* Replace tab with OPAC-view of record */
107 var opac_url = xulG.url_prefix( urls.opac_rdetail ) + '?r=' + robj.id();
108 var content_params = {
110 'authtime' : ses('authtime'),
111 'opac_url' : opac_url
114 xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
115 {'tab_name': catStrings.getString('staff.cat.marc_new.retrieving.label')},
120 g.error.standard_unexpected_error_alert(
121 catStrings.getString('staff.cat.marc_new.creating_record.error'), E
127 $('marc_editor').setAttribute('src',url);
128 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
129 get_contentWindow($('marc_editor')).xulG = params;
131 /* hide template widgets */
132 $('actions').hidden = true;
134 window.xulG.set_tab_name(template_name);
137 g.error.standard_unexpected_error_alert(
138 catStrings.getFormattedString('staff.cat.marc_new.loading_template.error', [template_name]), E
147 g.error.standard_unexpected_error_alert('cat/marc_new.xul',E);
154 <messagecatalog id="catStrings" src="/xul/server/locale/<!--#echo var='locale'-->/cat.properties" />
155 <messagecatalog id="circStrings" src="/xul/server/locale/<!--#echo var='locale'-->/circ.properties" />
156 <messagecatalog id="commonStrings" src="/xul/server/locale/<!--#echo var='locale'-->/common.properties" />
160 <hbox id="menu_placeholder" />
161 <button id="load" label="&staff.cat.marc_new.load.label;" accesskey="&staff.cat.marc_new.load.accesskey;"/>
163 <iframe id="marc_editor" flex="1"/>