r1628 - in branches/bxe_2_0: js plugins

[email protected] Fri, 10 Nov 2006 16:27:10 +0100 (CET)
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Fri Nov 10 16:27:09 2006
New Revision: 1628

Modified:
   branches/bxe_2_0/js/bxeFunctions.js
   branches/bxe_2_0/js/widget.js
   branches/bxe_2_0/plugins/ServerClipboard.js
Log:
icons for context 


Modified: branches/bxe_2_0/js/bxeFunctions.js
==============================================================================
--- branches/bxe_2_0/js/bxeFunctions.js	(original)
+++ branches/bxe_2_0/js/bxeFunctions.js	Fri Nov 10 16:27:09 2006
@@ -637,6 +637,7 @@
 	
 }
 function bxe_ContextPopup(e) {
+	
 	try {
 	var node = e.target.XMLNode;
 	var popup = e.additionalInfo;
@@ -649,10 +650,10 @@
 		node = node.parentNode;
 	}
 
-	if (node.vdom && node.vdom.hasAttributes ) {
-		
+	if (node.vdom && node.vdom.hasAttributes && !popup.hasEditAttributes ) {
 		var menui = popup.addMenuItem(bxe_i18n.getText("Edit {0} Attributes",new Array(node.vdom.bxeName)), mozilla.getWidgetGlobals().EditAttributes.popup);
 		menui.MenuPopup._node = node._node;
+		popup.hasEditAttributes = true;
 	}
 	if (BxeClipboardPasteDialog) {
 		popup.addMenuItem(bxe_i18n.getText("Paste from Extern", new Array(node.vdom.bxeName)), function (e) {

Modified: branches/bxe_2_0/js/widget.js
==============================================================================
--- branches/bxe_2_0/js/widget.js	(original)
+++ branches/bxe_2_0/js/widget.js	Fri Nov 10 16:27:09 2006
@@ -176,8 +176,8 @@
 	}
 }
 
-Widget_MenuPopup.prototype.addMenuItem = function 	(label,action,helptext) {
-	var menuitem = new Widget_MenuItem(label,action,helptext);
+Widget_MenuPopup.prototype.addMenuItem = function (label,action,helptext,icon) {
+	var menuitem = new Widget_MenuItem(label,action,helptext,icon);
 	menuitem.MenuPopup = this;
 	this.MenuItems.push(menuitem);
 	this.node.appendChild(menuitem.node);
@@ -191,6 +191,8 @@
 			}
 	}, false);
 	
+	
+	
 	return menuitem;
 }
 
@@ -200,14 +202,20 @@
 	this.MenuItems = new Array();
 }
 
-function Widget_MenuItem(label, action, helptext) {
+function Widget_MenuItem(label, action, helptext,icon) {
 	this.node = this.initNode("div","MenuItem");
 	this.node.style.display = "block";
 		
 	if (helptext) {
 		this.node.setAttribute("title", helptext);
 	}
-
+	console.log(icon);
+	if (icon) {
+		var img = this.node.appendChild(document.createElement("img"));
+		img.src =  icon;
+		img.setAttribute("align","right");
+		this.node.appendChild(img);
+	}
 	this.node.appendChild(document.createTextNode(label));
 	this.node.onclick = action;
 	this.node.Action = action;

Modified: branches/bxe_2_0/plugins/ServerClipboard.js
==============================================================================
--- branches/bxe_2_0/plugins/ServerClipboard.js	(original)
+++ branches/bxe_2_0/plugins/ServerClipboard.js	Fri Nov 10 16:27:09 2006
@@ -8,22 +8,11 @@
 		this.clipNode = "_notloaded";
 		
 		// add button
-		/*
-		var b = bxe_config.getButtons();
-		var tmpArray = new Array();
-		tmpArray['col'] = 0;
-		tmpArray['row'] = 3;
-		tmpArray['action'] = "InsertXMLSnippet";
-		tmpArray['type'] = "action";
-		tmpArray['ns'] = "";
-		tmpArray['data'] = "foobar";
-		b["XMLSnippets"] = tmpArray;
-		*/
 		// it doesn't run from the filesystem, so don't register anything
-		if (window.location.protocol != "file:" ) {
+		//if (window.location.protocol != "file:" ) {
 			//register event	
 			document.eDOMaddEventListener("ContextPopup",BxeServerClipboard_menu, false);
-		}
+		//}
 		
 	}
 	
@@ -47,6 +36,13 @@
 	
 	var popup = e.additionalInfo;
 	var node = e.target.XMLNode;
+	if (node.vdom && node.vdom.hasAttributes && !popup.hasEditAttributes ) {
+		var menui = popup.addMenuItem(bxe_i18n.getText("Edit {0} Attributes",new Array(node.vdom.bxeName)), mozilla.getWidgetGlobals().EditAttributes.popup, null,mozile_root_dir+ "images/editattribute.png");
+		menui.MenuPopup._node = node._node;
+	
+		popup.hasEditAttributes = true;
+	}
+	
 	popup.addMenuItem("Copy "  + e.target.XMLNode.vdom.bxeName  + " to Server", function (e) {
 		var url = eval(bxe_config.ServerClipboard.urlfunction + "('POST')");
 		if (url) {
@@ -89,7 +85,6 @@
 		});
 		}
 	}
-
 }
 
 function BxeServerClipboard_post(e) {
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs