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

Stephan Richter srichter@cbu.edu
Wed, 15 Jan 2003 15:47:44 -0500


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

Modified Files:
	ToolBar.js 
Log Message:
Open content object object only once. If object is already opened, focus 
on it.


=== Packages/Moztop/moztop/content/Menu/ToolBar.js 1.9 => 1.10 ===
--- Packages/Moztop/moztop/content/Menu/ToolBar.js:1.9	Wed Jan 15 10:06:21 2003
+++ Packages/Moztop/moztop/content/Menu/ToolBar.js	Wed Jan 15 15:47:40 2003
@@ -72,18 +72,29 @@
     while (parent.indexOf(":") > -1)
 	parent = parent.replace(":", "/");
 
+    // Unselect selected item we have a new one
+    tabs.selectedItem.setAttribute('selected', false);
+
+    if (document.getElementById(parent+"-tab") != null) {
+	document.getElementById(parent+"-tab").setAttribute(
+	    'selected', true);
+	tabpanels.selectedPanel = document.getElementById(parent+"-tabpanel");
+	return;
+    }
+
     var newtab = document.createElement("tab");
+    newtab.setAttribute('id', parent+'-tab');
     newtab.setAttribute('label', parent);
     newtab.setAttribute('selected', true);
-    if (tabs.firstChild.selected == true)
-	tabs.firstChild.selected = false;
     tabs.appendChild(newtab);
 
     var newtabpanel = document.createElement("tabpanel");
+    newtabpanel.setAttribute('id', parent+'-tabpanel');
     tabpanels.appendChild(newtabpanel);
 
-    _removeWelcome();
     createViewTabs('Folder', parent, newtabpanel);
+    _removeWelcome();
+    tabpanels.selectedPanel = newtabpanel;
 }
 
 /* Create all view tabs for a content object of the specified type */
@@ -119,6 +130,7 @@
 
 	var iframe = document.createElement("iframe");
 	iframe.setAttribute('src', 
+			    // ZOPE3_HTML + name + '/@@EditMetaData.html')
 	   'chrome://moztop/content/ContentObjects/' + type + '/' +
            sub_tab_ids[index] + '.xul');
 	iframe.setAttribute('flex', '1');