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'); error = new util.error();
10 error.sdump('D_TRACE','my_init() for main_test.xul');
12 /*if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
13 try { window.xulG.set_tab_name('Test'); } catch(E) { alert(E); }
16 // Both interfaces look for this
17 xulG.unified_interface = true;
19 // Item Attribute Editor looks for these
20 xulG.not_modal = true;
23 // Volume Creator looks for these
24 xulG.no_bib_summary = true;
25 xulG.volume_ui_callback_for_unified_interface = function() {
26 on_volume_pane_load();
29 // Spawn the volume/copy creator
30 JSAN.use('util.browser');
31 var volume_pane = new util.browser();
34 'url' : urls.XUL_VOLUME_COPY_CREATOR_ORIGINAL,
37 'browser_id' : 'volume_pane',
38 'passthru_content_params' : xulG
44 // Spawn the item attribute editor
45 var item_pane = new util.browser();
48 'url' : urls.XUL_COPY_EDITOR,
51 'browser_id' : 'item_pane',
52 'passthru_content_params' : xulG,
53 'on_url_load' : g.clone_template_bar // from setup_templates()
58 alert('Error in volume_copy_editor.js, my_init(): ' + E);
62 function setup_templates() {
64 JSAN.use('util.widgets'); JSAN.use('util.functional');
66 // Once the item attribute editor is loaded, clone and import its template menu to this window with this callback
67 g.clone_template_bar = function() {
68 var item_editor_template_bar = get_contentWindow( $('item_pane') ).document.getElementById('template_bar');
69 $('template_bar_holder').appendChild(
71 item_editor_template_bar,
75 item_editor_template_bar.hidden = true;
76 g.apply_template = function() {
77 xulG.update_item_editor_template_selection( $('template_menu').value );
78 xulG.item_editor_apply_template();
80 g.delete_template = function() {
81 xulG.update_item_editor_template_selection( $('template_menu').value );
82 xulG.item_editor_delete_template();
84 g.save_template = function() { xulG.item_editor_save_template(); };
85 g.import_templates = function() { xulG.item_editor_import_templates(); };
86 g.export_templates = function() { xulG.item_editor_export_templates(); };
87 g.reset = function() { xulG.item_editor_reset(); };
89 // just do this once; not sure if on_url_load could fire multiple times
90 g.clone_template_bar = function() {};
93 // callback for populating the list of templates
94 xulG.update_unified_template_list = function(list) {
96 util.widgets.remove_children('template_placeholder');
97 g.template_menu = util.widgets.make_menulist( list );
98 g.template_menu.setAttribute('id','template_menu');
99 $('template_placeholder').appendChild(g.template_menu);
100 g.template_menu.addEventListener(
103 xulG.update_item_editor_template_selection( g.template_menu.value );
108 alert('Error in volume_copy_editor.js, xulG.update_unified_template_list(): ' + E);
112 // used for loading default template selection
113 xulG.update_unified_template_selection = function(value) {
114 g.template_menu.setAttribute('value', value);
115 g.template_menu.value = value;
119 alert('Error in volume_copy_editor.js, setup_templates(): ' + E);
123 function on_volume_pane_load() {
125 var f_content = get_contentWindow( $('volume_pane' ) );
127 // horizontal UI variant has its own create button
129 var original_btn = f_content.document.getElementById('Create');
130 original_btn.hidden = true;
131 $('Create').setAttribute(
133 $('catStrings').getString('staff.cat.volume_copy_creator.create.btn.label')
135 $('Create').setAttribute(
137 $('catStrings').getString('staff.cat.volume_copy_creator.create.btn.accesskey')
139 g.stash_and_close = function(p) {
140 // Wire up the method for the replacement button
141 f_content.g.stash_and_close(p);
145 // load the bib summary pane
146 var sb = document.getElementById('summary_box');
147 while(sb.firstChild) sb.removeChild(sb.lastChild);
148 var summary = document.createElement('iframe'); sb.appendChild(summary);
149 summary.setAttribute('src',urls.XUL_BIB_BRIEF);
150 summary.setAttribute('flex','1');
151 get_contentWindow(summary).xulG = { 'docid' : f_content.g.doc_id };
152 dump('f_content.g.doc_id = ' + f_content.g.doc_id + '\n');
154 alert('Error in volume_copy_editor.js, on_volume_pane_load(): ' + E);