clam_shell
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 30 Jun 2005 06:02:14 +0000 (06:02 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 30 Jun 2005 06:02:14 +0000 (06:02 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1003 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/staff_client/chrome/content/evergreen/main/clam_shell.js
Evergreen/staff_client/chrome/content/evergreen/main/clam_shell.xul

index a902298..2b105f6 100644 (file)
@@ -4,17 +4,60 @@ function clam_shell_init(p) {
        dump("TESTING: clam_shell.js: " + mw.G['main_test_variable'] + '\n');
        if (p) {
                if (p.horizontal) {
-                       get_widget(p.d,'ClamShell_main').orient = 'horizontal';
+                       get_widget(p.d,p.clamshell).orient = 'horizontal';
                } else if (p.vertical) {
-                       get_widget(p.d,'ClamShell_main').orient = 'vertical';
+                       get_widget(p.d,p.clamshell).orient = 'vertical';
                }
        }
+       var nl = get_widget(p.clamshell).getElementsByTagName('deck');
+       var first_deck = nl[0];
+       var second_deck = nl[1];
+
+       p.w.set_first_deck = function (idx) { return clam_shell_set_first_deck(p.d,first_deck,idx); };
+       p.w.set_second_deck = function (idx) { return clam_shell_set_second_deck(p.d,second_deck,idx); };
+       p.w.replace_card_in_first_deck = function (idx,chrome,params) {
+               return replace_card_in_deck(p.d,first_deck,idx,chrome,params);
+       };
+       p.w.replace_card_in_second_deck = function (idx,chrome,params) {
+               return replace_card_in_deck(p.d,second_deck,idx,chrome,params);
+       };
+       p.w.new_card_in_first_deck = function (chrome,params) {
+               return new_card_in_deck(p.d,first_deck,chrome,params);
+       };
+       p.w.new_card_in_second_deck = function (chrome,params) {
+               return new_card_in_deck(p.d,second_deck,chrome,params);
+       };
+
+}
+
+function clam_shell_set_first_deck(doc,deck,idx) {
+       set_decks(doc,{ deck : idx });
+}
+
+function clam_shell_set_second_deck(doc,deck,idx) {
+       set_decks(doc,{ deck : idx });
 }
 
-function clam_shell_set_first_deck(d,i) {
-       set_decks(d,{ 'ClamShell_first_deck' : i });
+function new_card_in_deck(doc,deck,chrome,params) {
+       deck = get_widget(doc,deck);
+       var new_card = document.createElement('iframe');
+       new_card.setAttribute('flex','1');
+       new_card.setAttribute('src',chrome);
+       deck.appendChild(new_card);
+       new_card.setAttribute('id','card_'+(deck.childNodes.length-1));
 }
 
-function clam_shell_set_second_deck(d,i) {
-       set_decks(d,{ 'ClamShell_second_deck' : i });
+function replace_card_in_deck(doc,deck,idx,chrome,params) {
+       deck = get_widget(doc,deck);
+       var old_card = deck.childNodes[ idx ];
+       var new_card = document.createElement('iframe');
+       new_card.setAttribute('flex','1');
+       new_card.setAttribute('src',chrome);
+       deck.appendChild(new_card);
+       deck.replaceChild(new_card,old_card);
+       new_card.setAttribute('id','card_'+idx);
+       new_card.contentWindow.mw = mw;
+       if (params)
+               new_card.contentWindow.params = params;
+       return new_card.contentWindow;
 }
index 6827840..441e3a0 100644 (file)
@@ -7,7 +7,7 @@
 <page id="clam_shell_win"
        orient="vertical" style="overflow: auto" width="800" height="500"
        sizemode="maximized" persist="width height" 
-       onload="params.w = window; params.d = document; params.app = 'ClamShell'; mw.OpenILS_init(params);"
+       onload="params.clamshell = 'ClamShell_main'; params.w = window; params.d = document; params.app = 'ClamShell'; mw.OpenILS_init(params);"
        onunload="mw.OpenILS_exit(params);"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">