r1677 - in branches/bxe_2_0: . js

[email protected] Mon, 21 May 2007 15:14:14 +0200 (CEST)
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Mon May 21 15:14:14 2007
New Revision: 1677

Log:
fix for BXEB-14 params for xsl processor
example (put into config.xml):

<xslparams name="foo" isParam="true" >foo</xslparams>
        </input>

see also https://fosswiki.liip.ch/display/BXE/BXE+2.0+config.xml


Modified:
   branches/bxe_2_0/bxeLoader.js
   branches/bxe_2_0/js/bxeConfig.js
   branches/bxe_2_0/js/bxeXMLDocument.js

Modified: branches/bxe_2_0/bxeLoader.js
==============================================================================
--- branches/bxe_2_0/bxeLoader.js	(original)
+++ branches/bxe_2_0/bxeLoader.js	Mon May 21 15:14:14 2007
@@ -74,6 +74,11 @@
 
 var startTimer = new Date();
 
+function bxe_dump(text) {
+	//console.log(text);
+}
+	
+
 function bxe_start(config_file,fromUrl, configArray) {
 	
 	/*if (! (BX_checkUnsupportedBrowsers())) {
@@ -550,7 +555,4 @@
 	return undefined;
 }
 
-function bxe_dump(text) {
-	dump(text);
-}
-	
+

Modified: branches/bxe_2_0/js/bxeConfig.js
==============================================================================
--- branches/bxe_2_0/js/bxeConfig.js	(original)
+++ branches/bxe_2_0/js/bxeConfig.js	Mon May 21 15:14:14 2007
@@ -72,6 +72,8 @@
 	bxe_config.cssfiles = bxe_config.getContentMultiple("/config/files/css/file");
 	bxe_config.scriptfiles = bxe_config.getContentMultiple("/config/files/scripts/file");
 	
+	bxe_config.xslparams = bxe_config.getContentMultiple("/config/files/input/xslparams",true);
+	console.log("XSLPARAMS",bxe_config.xslparams);
 	var ps = bxe_config.getPlugins();
 	 
 	for (var i=0; i < ps.length; i++) {
@@ -249,7 +251,7 @@
 	return this.pluginOptions[plugin];
 }
 
-bxeConfig.prototype.getContentMultiple = function (xpath)
+bxeConfig.prototype.getContentMultiple = function (xpath, assoc)
 {
     var result = this.doc.evaluate(xpath, this.doc, null, 0, null);
     var node;
@@ -257,7 +259,12 @@
     var i = 0;
     while (node = result.iterateNext())
     {
-        resultArray[i] = this.translateUrl(node);
+        if (assoc) {
+            var name = node.getAttribute("name");
+            resultArray[i] = {"name": name, "value": this.translateUrl(node)};
+        } else {
+            resultArray[i] = this.translateUrl(node);
+        }
         i++;
     }
     return resultArray;

Modified: branches/bxe_2_0/js/bxeXMLDocument.js
==============================================================================
--- branches/bxe_2_0/js/bxeXMLDocument.js	(original)
+++ branches/bxe_2_0/js/bxeXMLDocument.js	Mon May 21 15:14:14 2007
@@ -151,6 +151,8 @@
 			xsltransformdoc = e.currentTarget;
 		}
 		processor.importStylesheet(xsltransformdoc);
+		
+		
 		try {
 			var newDocument = processor.transformToDocument(xsltransformdoc.xsldoc);
 			// we have to reparse the transformed document, otherwise
@@ -175,7 +177,9 @@
 		}
 		processor = new XSLTProcessor();
 		try {
-			
+			for (var i in bxe_config.xslparams) {
+				processor.setParameter("",bxe_config.xslparams[i].name, bxe_config.xslparams[i].value);
+			}
 			processor.importStylesheet(newDocument);
 		} catch(e) {
 			bxe_dump(newDocument.saveXML(newDocument));
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs