r1682 - in branches/bxe_2_0: js relaxng

[email protected] Tue, 22 May 2007 16:15:30 +0200 (CEST)
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Tue May 22 16:15:29 2007
New Revision: 1682

Log:
fix for BXEB-9
Choicelist bei Edit Attributes startet mit Leerzeichen


Modified:
   branches/bxe_2_0/js/widget.js
   branches/bxe_2_0/relaxng/AttributeVDOM.js

Modified: branches/bxe_2_0/js/widget.js
==============================================================================
--- branches/bxe_2_0/js/widget.js	(original)
+++ branches/bxe_2_0/js/widget.js	Tue May 22 16:15:29 2007
@@ -1305,7 +1305,6 @@
 				} else {
 					description['displayName']= false;
 				}
-				
 				if (attr[i].bxeNoteditable) {
 					this.addItem(attr[i].name,xmlnode.getAttribute(attr[i].name),"noteditable",description);
 				} else if (i == "__bxe_choices") {
@@ -1333,9 +1332,15 @@
 		text = text + " *";
 	}
 	if (attr.dataType == "choice") {
-		this.addItem(text,value,"select",null,attr.choices);
+		var choices = attr.choices;
+		
+		if (attr.optional) {
+			choices[0] = '--- delete attribute ---';
+		}
+		this.addItem(text,value,"select",null,choices);
 		
 	} else if (attr.bxeSelector) {
+		
 		if (attr.bxeSelectorType == "popup") {
 			this.addItem(text,value,"selectorPopup", helptext, attr.bxeSelector );
 			/*var pop = window.open(attr[i].bxeSelector,"popup","width=600,height=600,resizable=yes,scrollbars=yes");
@@ -1354,7 +1359,7 @@
 	try {
 	for (var attrName in values) {
 		attrValue = values[attrName];
-		if (attrValue) {
+		if (attrValue && attrValue != '--- delete attribute ---') {
 			xmlnode.setAttribute(attrName, attrValue);
 		} else {
 			xmlnode.removeAttribute(attrName);

Modified: branches/bxe_2_0/relaxng/AttributeVDOM.js
==============================================================================
--- branches/bxe_2_0/relaxng/AttributeVDOM.js	(original)
+++ branches/bxe_2_0/relaxng/AttributeVDOM.js	Tue May 22 16:15:29 2007
@@ -62,7 +62,9 @@
 			this.dataType = "choice";
 			this.choices = new Array();
 			var choice = childNodes[i].childNodes;
-			this.choices.push("");
+			if (this.optional) {
+				this.choices.push("");
+			}
 			for (var j = 0; j < choice.length; j++) {
 				if (choice[j].localName == "value" && choice[j].firstChild) {
 					this.choices.push(choice[j].firstChild.data);
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs