I really need to come up with a good way for xul to work both remotely and in chrome...
authorpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 12 Jan 2006 15:06:56 +0000 (15:06 +0000)
committerpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 12 Jan 2006 15:06:56 +0000 (15:06 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@2695 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/evergreen/cat/details.xul [new file with mode: 0644]
Open-ILS/xul/staff_client/chrome/content/evergreen/main/constants.js
Open-ILS/xul/staff_client/chrome/content/evergreen/main/menu.js

diff --git a/Open-ILS/xul/staff_client/chrome/content/evergreen/cat/details.xul b/Open-ILS/xul/staff_client/chrome/content/evergreen/cat/details.xul
new file mode 100644 (file)
index 0000000..143586a
--- /dev/null
@@ -0,0 +1,131 @@
+<?xml version="1.0"?>
+<!-- Application: Evergreen Staff Client -->
+<!-- Screen: Cataloger's Search Result Screen -->
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- STYLESHEETS -->
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://evergreen/skin/evergreen.css" type="text/css"?>
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- LOCALIZATION -->
+<!DOCTYPE window SYSTEM "chrome://evergreen/locale/lang.dtd">
+
+<!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+<!-- OVERLAYS -->
+<?xul-overlay href="chrome://evergreen/content/OpenILS/util_overlay.xul"?>
+
+<window id="details_win"
+       onload="try { my_init(); } catch(E) { alert(E); }"
+       xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+       <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
+       <!-- BEHAVIOR -->
+        <script type="text/javascript">
+               var myPackageDir = 'evergreen'; var IAMXUL = true; var g = {};
+               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+       </script>
+        <scripts id="openils_util_scripts"/>
+
+       <script type="text/javascript" src="chrome://evergreen/content/main/JSAN.js"/>
+       <script>
+       <![CDATA[
+
+               var session; var docid; var marc_html; var top_pane; var bottom_pane;
+
+               function my_init() {
+                       try {
+                               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                               if (typeof JSAN == 'undefined') { throw( "The JSAN library object is missing."); }
+                               JSAN.errorLevel = "die"; // none, warn, or die
+                               JSAN.addRepository('..');
+                               JSAN.use('util.error'); g.error = new util.error();
+                               g.error.sdump('D_TRACE','my_init() for cat/details.xul');
+
+                               g.cgi = new CGI();
+                               session = g.cgi.param('session');
+                               docid = g.cgi.param('docid');
+
+                               JSAN.use('util.deck');
+                               top_pane = new util.deck('top_pane');
+
+                               setTimeout(
+                                       function() {
+                                               set_brief_view();
+                                       }, 0
+                               );
+                               
+                               JSAN.use('util.network'); g.network = new util.network();
+                               bottom_pane = new util.deck('bottom_pane');
+
+                               set_marc_view();
+
+                       } catch(E) {
+                               var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
+                                       "system administrator or software developer the following:\ncat/details.xul\n" + E + '\n';
+                               try { g.error.sdump('D_ERROR',err_msg); } catch(E) { dump(err_msg); }
+                               alert(err_msg);
+                       }
+               }
+
+               function set_brief_view() {
+                       top_pane.set_iframe( 
+                               xulG.url_prefix( urls.XUL_BIB_BRIEF ) + '?docid=' + window.escape(docid), 
+                               {}, 
+                               { 
+                                       'set_tab_name' : function(n) { 
+                                               if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
+                                                       try { window.xulG.set_tab_name('Bib Record: ' + n); } catch(E) { alert(E); }
+                                               } else {
+                                                       dump('no set_tab_name\n');
+                                               }
+                                       }
+                               }  
+                       );
+               }
+
+               function set_marc_view() {
+                       bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_MARC_VIEW ) + '?docid=' + window.escape(docid),{},{});
+               }
+
+               function my_init_spawn_marc_editor() {
+                       spawn_marc_editor(
+                               document, 'replace_iframe', 'marc_edit', {
+                                       'find_this_id' : find_this_id
+                               }
+                       ).find_this_id = find_this_id;
+               }
+
+               function my_init_spawn_copy_browser() {
+                       var w = spawn_copy_browser(
+                               document, 'replace_iframe', 'copy_browser', {
+                                       'find_this_id' : find_this_id
+                               }
+                       );
+                       w.find_this_id = find_this_id;
+                       w.parent_window = window;
+               }
+
+               function my_init_spawn_opac_view() {
+                       dump('trying to spawn: ' + params.opac_url + '\n');
+                       spawn_interface(
+                               document, 'replace_browser', 'opac_view',
+                               params.opac_url, 'OPAC View', {}
+                       );
+               }
+       ]]>
+       </script>
+
+       <vbox flex="1">
+               <deck id="top_pane"/>
+               <hbox>
+                       <button label="MARC View" id="marc_view" oncommand="set_marc_view();"/>
+                       <button label="MARC Edit" id="marc_edit"/>
+                       <button label="Copy Browser" id="copy_browse"/>
+                       <button label="Copy Editor" id="copy_edit" />
+               </hbox>
+               <deck id="bottom_pane" flex="1"/>
+       </vbox>
+
+</window>
+
index de25ecb..9db0ee0 100644 (file)
@@ -47,13 +47,14 @@ var urls = {
        'XUL_BROWSER' : 'chrome://evergreen/content/util/browser.xul',
        'XUL_CHECKIN' : '/xul/server/circ/checkin.xul',
        'XUL_CHECKOUT' : '/xul/server/circ/checkout.xul',
-       'XUL_CAT_DETAILS' : '/xul/server/cat/details.xul',
+       'XUL_CAT_DETAILS' : 'chrome://evergreen/content/cat/details.xul',
        'XUL_DEBUG_CONSOLE' : 'chrome://global/content/console.xul',
        'XUL_DEBUG_FIELDMAPPER' : '/xul/server/util/fm_view.xul',
        'XUL_DEBUG_FILTER_CONSOLE' : '/xul/server/util/filter_console.xul',
        'XUL_DEBUG_SHELL' : '/xul/server/util/shell.html',
        'XUL_DEBUG_XULEDITOR' : '/xul/server/util/xuledit.xul',
        'XUL_HOLD_CAPTURE' : '/xul/server/circ/hold_capture.xul',
+       'XUL_MARC_EDIT' : 'chrome://evergreen/content/legacy/marc.xul',
        'XUL_MARC_VIEW' : '/xul/server/cat/marc_view.xul',
        'XUL_MENU_FRAME' : 'chrome://evergreen/content/main/menu_frame.xul',
        'XUL_PATRON_BARCODE_ENTRY' : '/xul/server/patron/barcode_entry.xul',
index 8bcdaf8..5de396e 100644 (file)
@@ -11,18 +11,18 @@ main.menu = function () {
 
 main.menu.prototype = {
 
+       'url_prefix' : function(url) {
+               if (url.match(/^\//)) url = urls.remote + url;
+               if (! url.match(/^(http|chrome):\/\//) && ! url.match(/^data:/) ) url = 'http://' + url;
+               return url;
+       },
+
        'init' : function( params ) {
 
                var session = params['session'];
                var authtime = params['authtime'];
                urls.remote = params['server'];
 
-               function url_prefix(url) {
-                       if (url.match(/^\//)) url = urls.remote + url;
-                       if (! url.match(/^(http|chrome):\/\//) && ! url.match(/^data:/) ) url = 'http://' + url;
-                       return url;
-               }
-
                var obj = this;
 
                var cmd_map = {
@@ -39,7 +39,7 @@ main.menu.prototype = {
                        'cmd_new_window' : [
                                ['oncommand'],
                                function() {
-                                       obj.window.open(url_prefix(urls.XUL_MENU_FRAME),'test' + 
+                                       obj.window.open(obj.url_prefix(urls.XUL_MENU_FRAME),'test' + 
                                                obj.window.appshell_name_increment++ ,'chrome'); 
                                }
                        ],
@@ -56,7 +56,7 @@ main.menu.prototype = {
                        'cmd_patron_search' : [
                                ['oncommand'],
                                function() {
-                                       obj.set_tab(url_prefix(urls.XUL_PATRON_DISPLAY)
+                                       obj.set_tab(obj.url_prefix(urls.XUL_PATRON_DISPLAY)
                                                + '?session='+obj.w.escape(session),{},{});
                                }
                        ],
@@ -73,7 +73,7 @@ main.menu.prototype = {
                                                                f.contentWindow.wrappedJSObject.attachEvt("rdetail", "recordRetrieved",
                                                                        function(id){
                                                                                obj.new_tab(
-                                                                                       url_prefix(urls.XUL_CAT_DETAILS) + '?session=' +
+                                                                                       obj.url_prefix(urls.XUL_CAT_DETAILS) + '?session=' +
                                                                                        window.escape(session) + '&docid=' + window.escape(id),
                                                                                        { 'tab_name' : 'Retrieving Bib Record...' },
                                                                                        {}
@@ -82,7 +82,7 @@ main.menu.prototype = {
                                                                );
                                                        },
                                                };
-                                               obj.set_tab(url_prefix(urls.XUL_BROWSER) + '?name=Catalog', {}, content_params);
+                                               obj.set_tab(obj.url_prefix(urls.XUL_BROWSER) + '?name=Catalog', {}, content_params);
                                        } catch(E) {
                                                obj.error.sdump('D_ERROR','cmd_search_opac: ' + E);
                                        }
@@ -94,19 +94,19 @@ main.menu.prototype = {
                        'cmd_circ_checkin' : [
                                ['oncommand'],
                                function() { 
-                                       obj.set_tab(url_prefix(urls.XUL_CHECKIN) + '?session='+obj.w.escape(session),{},{});
+                                       obj.set_tab(obj.url_prefix(urls.XUL_CHECKIN) + '?session='+obj.w.escape(session),{},{});
                                }
                        ],
                        'cmd_circ_checkout' : [
                                ['oncommand'],
                                function() { 
-                                       obj.set_tab(url_prefix(urls.XUL_PATRON_BARCODE_ENTRY) + '?session='+obj.w.escape(session),{},{});
+                                       obj.set_tab(obj.url_prefix(urls.XUL_PATRON_BARCODE_ENTRY) + '?session='+obj.w.escape(session),{},{});
                                }
                        ],
                        'cmd_circ_hold_capture' : [
                                ['oncommand'],
                                function() { 
-                                       obj.set_tab(url_prefix(urls.XUL_HOLD_CAPTURE) + '?session='+obj.w.escape(session),{},{});
+                                       obj.set_tab(obj.url_prefix(urls.XUL_HOLD_CAPTURE) + '?session='+obj.w.escape(session),{},{});
                                }
                        ],
 
@@ -116,49 +116,49 @@ main.menu.prototype = {
                                ['oncommand'],
                                function() {
                                        var content_params = { 'authtoken' : session, 'authtime' : authtime };
-                                       obj.set_tab(url_prefix(urls.XUL_BROWSER), {}, content_params);
+                                       obj.set_tab(obj.url_prefix(urls.XUL_BROWSER), {}, content_params);
                                }
                        ],
                        'cmd_test_html' : [
                                ['oncommand'],
                                function() {
-                                       obj.set_tab(url_prefix(urls.TEST_HTML) + '?session='+obj.w.escape(session),{},{});
+                                       obj.set_tab(obj.url_prefix(urls.TEST_HTML) + '?session='+obj.w.escape(session),{},{});
                                }
                        ],
                        'cmd_test_xul' : [
                                ['oncommand'],
                                function() {
-                                       obj.set_tab(url_prefix(urls.TEST_XUL) + '?session='+obj.w.escape(session),{},{});
+                                       obj.set_tab(obj.url_prefix(urls.TEST_XUL) + '?session='+obj.w.escape(session),{},{});
                                }
                        ],
                        'cmd_console' : [
                                ['oncommand'],
                                function() {
-                                       obj.set_tab(url_prefix(urls.XUL_DEBUG_CONSOLE),{},{});
+                                       obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_CONSOLE),{},{});
                                }
                        ],
                        'cmd_shell' : [
                                ['oncommand'],
                                function() {
-                                       obj.set_tab(url_prefix(urls.XUL_DEBUG_SHELL),{},{});
+                                       obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_SHELL),{},{});
                                }
                        ],
                        'cmd_xuleditor' : [
                                ['oncommand'],
                                function() {
-                                       obj.set_tab(url_prefix(urls.XUL_DEBUG_XULEDITOR),{},{});
+                                       obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_XULEDITOR),{},{});
                                }
                        ],
                        'cmd_fieldmapper' : [
                                ['oncommand'],
                                function() {
-                                       obj.set_tab(url_prefix(urls.XUL_DEBUG_FIELDMAPPER),{},{});
+                                       obj.set_tab(obj.url_prefix(urls.XUL_DEBUG_FIELDMAPPER),{},{});
                                }
                        ],
                        'cmd_survey_wizard' : [
                                ['oncommand'],
                                function() {
-                                       obj.window.open(url_prefix(urls.XUL_SURVEY_WIZARD)+ '?session='+obj.w.escape(session),'survey_wizard','chrome'); 
+                                       obj.window.open(obj.url_prefix(urls.XUL_SURVEY_WIZARD)+ '?session='+obj.w.escape(session),'survey_wizard','chrome'); 
                                }
                        ],
 
@@ -278,6 +278,7 @@ main.menu.prototype = {
                content_params.set_tab = function(a,b,c) { obj.set_tab(a,b,c); };
                content_params.set_tab_name = function(name) { tab.setAttribute('label',(idx + 1) + ' ' + name); };
                content_params.open_chrome_window = function(a,b,c) { obj.window.open(a,b,c); };
+               content_params.url_prefix = function(url) { return obj.url_prefix(url); };
                if (params && params.tab_name) content_params.set_tab_name( params.tab_name );
                
                var frame = this.w.document.createElement('iframe');