r1410 - in trunk: js relaxng

[email protected]
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Thu Oct  6 20:13:19 2005
New Revision: 1410

Modified:
   trunk/js/bxeXMLNode.js
   trunk/relaxng/ElementVAL.js
   trunk/relaxng/RelaxNG.js
Log:
fix for 
http://bugs.bitflux.ch/cgi-bin/bugzilla/show_bug.cgi?id=892
BXE prompts for first required sub-element instead of inserting all requierd sub-elements when appending element 

(basically backport from 2.0)


Modified: trunk/js/bxeXMLNode.js
==============================================================================
--- trunk/js/bxeXMLNode.js	(original)
+++ trunk/js/bxeXMLNode.js	Thu Oct  6 20:13:19 2005
@@ -763,7 +763,21 @@
 		if (ac.length == 1)  {
 			eDOMEventCall("appendChildNode",document,{"appendToNode": this, "localName":ac[0].nodeName,"namespaceURI":ac[0].namespaceURI});
 		} else if (ac.length > 1) {
-			bxe_context_menu.buildElementChooserPopup(this,ac);
+			var _hasMust = false;
+			for ( var i in ac) {
+				if (!(ac[i].optional ) ) { 
+					eDOMEventCall("appendChildNode",document,{ "appendToNode": this, "localName":ac[i].nodeName,"namespaceURI":ac[i].namespaceURI});
+					_hasMust =true;
+				}
+				
+			}
+			if (!_hasMust) {
+				bxe_context_menu.buildElementChooserPopup(this,ac);
+			} else {
+				ret = this;
+				
+			}
+			
 		}
 		else {
 			var xmlstring = this.getBeforeAndAfterString(false,true);

Modified: trunk/relaxng/ElementVAL.js
==============================================================================
--- trunk/relaxng/ElementVAL.js	(original)
+++ trunk/relaxng/ElementVAL.js	Thu Oct  6 20:13:19 2005
@@ -41,7 +41,7 @@
 					}
 				} while (ctxt.nextVDOM())
 			}
-			ac.sort(bxe_nodeSort);
+			//ac.sort(bxe_nodeSort);
 
 			this._allowedChildren = ac;
 			return ac;

Modified: trunk/relaxng/RelaxNG.js
==============================================================================
--- trunk/relaxng/RelaxNG.js	(original)
+++ trunk/relaxng/RelaxNG.js	Thu Oct  6 20:13:19 2005
@@ -481,6 +481,7 @@
 				break;
 			case "optional":
 				newChoice = new ChoiceVDOM(childNodes[i]);
+				newChoice.optional = true;
 				this.appendChild(newChoice);
 				newChoice.appendChild(new EmptyVDOM());
 				this._hasEmpty = false;
@@ -488,6 +489,7 @@
 				break;
 			case "choice":
 				newChoice = new ChoiceVDOM(childNodes[i]);
+				newChoice.optional = true;
 				this.appendChild(newChoice);
 				newChoice.parseChildren();
 				this._hasEmpty = false;
@@ -887,9 +889,15 @@
 			var subac = child.allowedElements(ctxt);
 			if (subac) {
 				if (subac.nodeName) {
+					if (this.optional) {
+						subac.optional = true;
+					}
 					ac.push(subac);
 				} else {
 					for (var i = 0; i < subac.length; i++) {
+						if (this.optional) {
+							subac[i].optional = true;
+						}
 						ac.push(subac[i]);
 					}
 				}
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.