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"/>
39 function $(id) { return document.getElementById(id); }
43 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
44 if (typeof JSAN == 'undefined') {
45 throw( document.getElementById('commonStrings').getString('common.jsan.missing') );
47 JSAN.errorLevel = "die"; // none, warn, or die
48 JSAN.addRepository('/xul/server/');
49 JSAN.use('util.error'); g.error = new util.error();
50 g.error.sdump('D_TRACE','my_init() for example_template.xul');
52 if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
53 try { window.xulG.set_tab_name('MARC Template'); } catch(E) { alert(E); }
56 JSAN.use('util.network'); g.network = new util.network();
57 JSAN.use('util.widgets');
58 JSAN.use('util.functional');
60 var templates = g.network.simple_request('MARC_XML_TEMPLATE_LIST',[]);
61 if (typeof templates.ilsevent != 'undefined') throw(templates);
62 var ml = util.widgets.make_menulist(
63 util.functional.map_list(
66 return [ el /* The menu entry label */, el /* The menu entry value */ ];
70 $('menu_placeholder').appendChild(ml);
72 $('load').addEventListener(
79 template_name = $('menu_placeholder').firstChild.value;
80 var marc = g.network.simple_request(
81 'MARC_XML_TEMPLATE_RETRIEVE',
84 if (typeof marc.ilsevent != 'undefined') throw(marc);
86 var url = urls.XUL_MARC_EDIT;
88 'record' : { 'marc' : marc },
90 'label' : $('catStrings').getString('staff.cat.marc_new.create_record.label'),
91 'func' : function(new_marcxml) {
93 var robj = g.network.simple_request(
94 'MARC_XML_RECORD_IMPORT',
95 [ ses(), new_marcxml, $('catStrings').getString('staff.cat.marc_new.system_local.label'), 1 ]
97 if (typeof robj.ilsevent != 'undefined') throw(robj);
98 alert($('catStrings').getString('staff.cat.marc_new.record_created.label'));
100 /* Replace tab with OPAC-view of record */
102 var opac_url = xulG.url_prefix( urls.opac_rdetail ) + '?r=' + robj.id();
103 var content_params = {
105 'authtime' : ses('authtime'),
106 'opac_url' : opac_url,
109 xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
110 {'tab_name': $('catStrings').getString('staff.cat.marc_new.retrieving.label')},
115 g.error.standard_unexpected_error_alert(
116 $('catStrings').getString('staff.cat.marc_new.creating_record.error'), E
122 $('marc_editor').setAttribute('src',url);
123 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
124 get_contentWindow($('marc_editor')).xulG = params;
126 /* hide template widgets */
127 $('actions').hidden = true;
129 window.xulG.set_tab_name(template_name);
132 g.error.standard_unexpected_error_alert(
133 $('catStrings').getFormattedString('staff.cat.marc_new.loading_template.error', [template_name]), E
142 g.error.standard_unexpected_error_alert('cat/marc_new.xul',E);
149 <messagecatalog id="catStrings" src="/xul/server/locale/<!--#echo var='locale'-->/cat.properties" />
150 <messagecatalog id="circStrings" src="/xul/server/locale/<!--#echo var='locale'-->/circ.properties" />
151 <messagecatalog id="commonStrings" src="/xul/server/locale/<!--#echo var='locale'-->/common.properties" />
155 <hbox id="menu_placeholder" />
156 <button id="load" label="&staff.cat.marc_new.load.label;" accesskey="&staff.cat.marc_new.load.accesskey;"/>
158 <iframe id="marc_editor" flex="1"/>