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 // Spawn the volume/copy creator
25 JSAN.use('util.browser');
26 var volume_pane = new util.browser();
29 'url' : urls.XUL_VOLUME_COPY_CREATOR_ORIGINAL,
32 'browser_id' : 'volume_pane',
33 'passthru_content_params' : xulG
39 // Spawn the item attribute editor
40 var item_pane = new util.browser();
43 'url' : urls.XUL_COPY_EDITOR,
46 'browser_id' : 'item_pane',
47 'passthru_content_params' : xulG,
48 'on_url_load' : g.clone_template_bar // from setup_templates()
53 alert('Error in volume_copy_editor.js, my_init(): ' + E);
57 function setup_templates() {
59 JSAN.use('util.widgets'); JSAN.use('util.functional');
61 // Once the item attribute editor is loaded, clone and import its template menu to this window with this callback
62 g.clone_template_bar = function() {
63 var item_editor_template_bar = get_contentWindow( $('item_pane') ).document.getElementById('template_bar');
64 $('template_bar_holder').appendChild(
66 item_editor_template_bar,
70 item_editor_template_bar.hidden = true;
71 g.apply_template = function() {
72 xulG.update_item_editor_template_selection( $('template_menu').value );
73 xulG.item_editor_apply_template();
75 g.delete_template = function() {
76 xulG.update_item_editor_template_selection( $('template_menu').value );
77 xulG.item_editor_delete_template();
79 g.save_template = function() { xulG.item_editor_save_template(); };
80 g.import_templates = function() { xulG.item_editor_import_templates(); };
81 g.export_templates = function() { xulG.item_editor_apply_templates(); };
82 g.reset = function() { xulG.item_editor_reset(); };
84 // just do this once; not sure if on_url_load could fire multiple times
85 g.clone_template_bar = function() {};
88 // callback for populating the list of templates
89 xulG.update_unified_template_list = function(list) {
91 util.widgets.remove_children('template_placeholder');
92 g.template_menu = util.widgets.make_menulist( list );
93 g.template_menu.setAttribute('id','template_menu');
94 $('template_placeholder').appendChild(g.template_menu);
95 g.template_menu.addEventListener(
98 xulG.update_item_editor_template_selection( g.template_menu.value );
103 alert('Error in volume_copy_editor.js, xulG.update_unified_template_list(): ' + E);
108 alert('Error in volume_copy_editor.js, setup_templates(): ' + E);