get_frame_in_tab()
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 30 Jun 2005 05:37:59 +0000 (05:37 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 30 Jun 2005 05:37:59 +0000 (05:37 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1000 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/staff_client/chrome/content/evergreen/main/app_shell.js

index 84da7f6..7a7a1aa 100644 (file)
@@ -7,6 +7,7 @@ function app_shell_init(p) {
        p.w.find_free_tab = function (tabs) { return find_free_tab(tabs); };
        p.w.new_tab = function () { return new_tab(p.d,p.tabbox); };
        p.w.replace_tab = function (label,chrome,params) { return replace_tab(p.d,p.tabbox,label,chrome,params); };
+       p.w.get_frame_in_tab = function (idx, all_or_vis) { return get_frame_in_tab( p.d, p.tabbox, idx, all_or_vis ); }; 
        
        p.w.replace_tab('Tab','chrome://evergreen/content/main/about.xul');
 }
@@ -105,6 +106,30 @@ function find_free_tab(tabs) {
        return -1;
 }
 
+function get_frame_in_tab( d, tabbox, idx, all_or_visible ) {
+       sdump('D_TAB',arg_dump(arguments));
+       if (typeof(tabbox)!='object')
+               tabbox = d.getElementById(tabbox);
+       if (typeof(tabbox)!='object')
+               throw('Could not find tabbox. d = ' + d + ' tabbox = ' + tabbox + '\n');
+       var tabs = tabbox.firstChild;
+       var panels = tabbox.lastChild;
+       try {
+               if (all_or_visible == 'visible') {
+                       var count = 0;
+                       for (var i = 0; i < tabs.childNodes.length; i++) {
+                               if (!tabs.childNodes[i].hidden) count++;
+                               if (count==idx) return panels.childNodes[i].getElementsByTagName('iframe')[0];
+                       }
+               } else {
+                       return panels.childNodes[ idx ].getElementsByTagName('iframe')[0];
+               }
+       } catch(E) {
+               dump(js2JSON(E) + '\n');
+       }
+       return null;
+}
+
 function new_tab( d, tabbox ) {
        sdump('D_TAB',arg_dump(arguments));
        if (typeof(tabbox)!='object')