[Zope-CVS] CVS: Packages/Moztop/moztop/content/Menu - ToolBar.js:1.8

Stephan Richter srichter@cbu.edu
Wed, 15 Jan 2003 08:53:09 -0500


Update of /cvs-repository/Packages/Moztop/moztop/content/Menu
In directory cvs.zope.org:/tmp/cvs-serv6871/moztop/content/Menu

Modified Files:
	ToolBar.js 
Log Message:
Now the Content Object views are generated and XUL is loaded from the 
correct location. This makes the entire subtabs mechanism somewht flexible 
and dynamic.

However, we might change this to use RDF later on!


=== Packages/Moztop/moztop/content/Menu/ToolBar.js 1.7 => 1.8 ===
--- Packages/Moztop/moztop/content/Menu/ToolBar.js:1.7	Wed Jan 15 08:17:04 2003
+++ Packages/Moztop/moztop/content/Menu/ToolBar.js	Wed Jan 15 08:53:06 2003
@@ -90,12 +90,19 @@
 }
 
 /* Create all view tabs for a content object of the specified type */
-function createViewTabs(type, name, tabpanel) {
+function createViewTabs(type, name, parent_tabpanel) {
+
+    var sub_tab_ids = new Array(4);
+    sub_tab_ids[0] = 'Content'
+    sub_tab_ids[1] = 'Preview'
+    sub_tab_ids[2] = 'MetaData'
+    sub_tab_ids[3] = 'Security'
+
     var tabbox = document.createElement("tabbox");
     tabbox.setAttribute('id', name+'-tabbox');
     tabbox.setAttribute('orient', 'vertical');
     tabbox.setAttribute('flex', '1');
-    tabpanel.appendChild(tabbox);
+    parent_tabpanel.appendChild(tabbox);
     
     var tabs = document.createElement("tabs");
     tabs.setAttribute('orient', 'horizontal');
@@ -105,18 +112,21 @@
     tabpanels.setAttribute('flex', '100%');
     tabbox.appendChild(tabpanels);
      
-    var newtab = document.createElement("tab");
-    newtab.setAttribute("label", "Contents");
-    newtab.setAttribute("selected", true);
-    tabs.appendChild(newtab);
-    var newtabpanel = document.createElement("tabpanel");
-    tabpanel.appendChild(newtabpanel);
-
-    var newtab = document.createElement("tab");
-    newtab.setAttribute("label", "Meta Data");
-    tabs.appendChild(newtab);
-
-    var newtab = document.createElement("tab");
-    newtab.setAttribute("label", "Security");
-    tabs.appendChild(newtab);
+    for (var index = 0; index < 4; index++) {
+	var tab = document.createElement("tab");
+	tab.setAttribute("label", sub_tab_ids[index]);
+	tabs.appendChild(tab);
+
+	var tabpanel = document.createElement("tabpanel");
+	tabpanels.appendChild(tabpanel);
+
+	var iframe = document.createElement("iframe");
+	iframe.setAttribute('src', 
+	   'chrome://moztop/content/ContentObjects/' + type + '/' +
+           sub_tab_ids[index] + '.xul');
+	iframe.setAttribute('flex', '1');
+	tabpanel.appendChild(iframe);
+    }
+
+    tabs.firstChild.setAttribute("selected", true);
 }