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="/xul/server/skin/global.css" type="text/css"?>
13 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
15 <!DOCTYPE window PUBLIC "" ""[
16 <!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
19 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
21 <?xul-overlay href="/xul/server/OpenILS/util_overlay.xul"?>
23 <window id="example_template_win"
24 onload="try { my_init(); font_helper(); } catch(E) { alert(E); }"
25 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
27 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
29 <script type="text/javascript">
30 var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};
32 <scripts id="openils_util_scripts"/>
34 <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
39 function $(id) { return document.getElementById(id); }
43 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
45 /* load translatable strings for cataloging interfaces */
46 catStrings = document.getElementById('catStrings');
48 if (typeof JSAN == 'undefined') {
49 throw( $('commonStrings').getString('common.jsan.missing') );
51 JSAN.errorLevel = "die"; // none, warn, or die
52 JSAN.addRepository('/xul/server/');
53 JSAN.use('util.error'); g.error = new util.error();
54 g.error.sdump('D_TRACE','my_init() for example_template.xul');
56 if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
57 try { window.xulG.set_tab_name(catStrings.getString('staff.cat.marc_new.tab_name')); } catch(E) { alert(E); }
60 JSAN.use('util.network'); g.network = new util.network();
61 JSAN.use('util.widgets');
62 JSAN.use('util.functional');
64 var templates = g.network.simple_request('MARC_XML_TEMPLATE_LIST',[]);
65 if (typeof templates.ilsevent != 'undefined') throw(templates);
66 var ml = util.widgets.make_menulist(
67 util.functional.map_list(
70 return [ el /* The menu entry label */, el /* The menu entry value */ ];
74 $('menu_placeholder').appendChild(ml);
76 $('load').addEventListener(
83 template_name = $('menu_placeholder').firstChild.value;
84 var marc = g.network.simple_request(
85 'MARC_XML_TEMPLATE_RETRIEVE',
88 if (typeof marc.ilsevent != 'undefined') throw(marc);
90 var url = urls.XUL_MARC_EDIT;
92 'record' : { 'marc' : marc },
93 'fast_add_item' : function(doc_id,cn_label,cp_barcode) {
95 JSAN.use('cat.util'); return cat.util.fast_item_add(doc_id,cn_label,cp_barcode);
101 'label' : catStrings.getString('staff.cat.marc_new.create_record.label'),
102 'func' : function(new_marcxml) {
104 var robj = g.network.simple_request(
105 'MARC_XML_RECORD_IMPORT',
106 [ ses(), new_marcxml, catStrings.getString('staff.cat.marc_new.system_local.label'), 1 ]
108 if (typeof robj.ilsevent != 'undefined') throw(robj);
110 /* Replace tab with OPAC-view of record */
112 var opac_url = xulG.url_prefix( urls.opac_rdetail ) + '?r=' + robj.id();
113 var content_params = {
115 'authtime' : ses('authtime'),
116 'opac_url' : opac_url
120 'on_complete' : function() {
123 xulG.url_prefix(urls.XUL_OPAC_WRAPPER),
124 {'tab_name': catStrings.getString('staff.cat.marc_new.retrieving.label')},
134 g.error.standard_unexpected_error_alert(
135 catStrings.getString('staff.cat.marc_new.creating_record.error'), E
141 var marc_editor = document.createElement('iframe');
142 $('marc_editor_box').appendChild(marc_editor);
143 marc_editor.setAttribute('flex','1');
144 marc_editor.setAttribute('src',url);
145 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
146 get_contentWindow(marc_editor).xulG = params;
148 /* hide template widgets */
149 $('actions').hidden = true;
151 window.xulG.set_tab_name(template_name);
154 g.error.standard_unexpected_error_alert(
155 catStrings.getFormattedString('staff.cat.marc_new.loading_template.error', [template_name]), E
164 g.error.standard_unexpected_error_alert('cat/marc_new.xul',E);
171 <messagecatalog id="catStrings" src="/xul/server/locale/<!--#echo var='locale'-->/cat.properties" />
172 <messagecatalog id="circStrings" src="/xul/server/locale/<!--#echo var='locale'-->/circ.properties" />
174 <vbox id="marc_editor_box" flex="1">
176 <hbox id="menu_placeholder" />
177 <button id="load" label="&staff.cat.marc_new.load.label;" accesskey="&staff.cat.marc_new.load.accesskey;"/>