6 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
7 if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
8 JSAN.errorLevel = "die"; // none, warn, or die
9 JSAN.addRepository('/xul/server/');
10 JSAN.use('util.error'); error = new util.error();
11 error.sdump('D_TRACE','my_init() for main_test.xul');
13 /*if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
14 try { window.xulG.set_tab_name('Test'); } catch(E) { alert(E); }
17 // Both interfaces look for this
18 xulG.unified_interface = true;
20 // Item Attribute Editor looks for these
21 xulG.not_modal = true;
24 // Volume Creator looks for these
25 xulG.no_bib_summary = true;
26 xulG.volume_ui_callback_for_unified_interface = function() {
27 on_volume_pane_load();
30 // Spawn the volume/copy creator
31 JSAN.use('util.browser');
32 var volume_pane = new util.browser();
35 'url' : urls.XUL_VOLUME_COPY_CREATOR_ORIGINAL,
38 'browser_id' : 'volume_pane',
39 'passthru_content_params' : xulG
45 // Spawn the item attribute editor
46 var item_pane = new util.browser();
49 'url' : urls.XUL_COPY_EDITOR,
52 'browser_id' : 'item_pane',
53 'passthru_content_params' : xulG,
54 'on_url_load' : g.clone_template_bar // from setup_templates()
59 alert('Error in volume_copy_editor.js, my_init(): ' + E);
63 function setup_templates() {
65 JSAN.use('util.widgets'); JSAN.use('util.functional');
67 // Once the item attribute editor is loaded, clone and import its template menu to this window with this callback
68 g.clone_template_bar = function() {
69 var item_editor_template_bar = get_contentWindow( $('item_pane') ).document.getElementById('template_bar');
70 $('template_bar_holder').appendChild(
72 item_editor_template_bar,
76 item_editor_template_bar.hidden = true;
77 g.apply_template = function() {
78 xulG.update_item_editor_template_selection( $('template_menu').value );
79 xulG.item_editor_apply_template();
81 g.delete_template = function() {
82 xulG.update_item_editor_template_selection( $('template_menu').value );
83 xulG.item_editor_delete_template();
85 g.save_template = function() { xulG.item_editor_save_template(); };
86 g.import_templates = function() { xulG.item_editor_import_templates(); };
87 g.export_templates = function() { xulG.item_editor_export_templates(); };
88 g.reset = function() { xulG.item_editor_reset(); };
90 // just do this once; not sure if on_url_load could fire multiple times
91 g.clone_template_bar = function() {};
94 // callback for populating the list of templates
95 xulG.update_unified_template_list = function(list) {
97 util.widgets.remove_children('template_placeholder');
98 g.template_menu = util.widgets.make_menulist( list );
99 g.template_menu.setAttribute('id','template_menu');
100 $('template_placeholder').appendChild(g.template_menu);
101 g.template_menu.addEventListener(
104 xulG.update_item_editor_template_selection( g.template_menu.value );
109 alert('Error in volume_copy_editor.js, xulG.update_unified_template_list(): ' + E);
113 // used for loading default template selection
114 xulG.update_unified_template_selection = function(value) {
115 g.template_menu.setAttribute('value', value);
116 g.template_menu.value = value;
120 alert('Error in volume_copy_editor.js, setup_templates(): ' + E);
124 function on_volume_pane_load() {
126 var f_content = get_contentWindow( $('volume_pane' ) );
128 // horizontal UI variant has its own create button
130 var original_btn = f_content.document.getElementById('Create');
131 original_btn.hidden = true;
132 $('Create').setAttribute(
134 $('catStrings').getString('staff.cat.volume_copy_creator.create.btn.label')
136 $('Create').setAttribute(
138 $('catStrings').getString('staff.cat.volume_copy_creator.create.btn.accesskey')
140 g.stash_and_close = function(p) {
141 // Wire up the method for the replacement button
142 f_content.g.stash_and_close(p);
146 // load the bib summary pane
147 var sb = document.getElementById('summary_box');
148 while(sb.firstChild) sb.removeChild(sb.lastChild);
149 var summary = document.createElement('iframe'); sb.appendChild(summary);
150 summary.setAttribute('src',urls.XUL_BIB_BRIEF);
151 summary.setAttribute('flex','1');
152 get_contentWindow(summary).xulG = { 'docid' : f_content.g.doc_id };
153 dump('f_content.g.doc_id = ' + f_content.g.doc_id + '\n');
155 alert('Error in volume_copy_editor.js, on_volume_pane_load(): ' + E);