r1685 - in branches/bxe_2_0: mozile plugins

[email protected] Thu, 24 May 2007 16:12:43 +0200 (CEST)
Newsgroups gmane.editors.bitflux.cvs
Message-ID <[email protected]>
Author: chregu
Date: Thu May 24 16:12:43 2007
New Revision: 1685

Log:
fix for BXEB-7
abellenimport: Trennzeichen-Schemata
and

https://fosswiki.liip.ch/display/BXE/BXE+2.0+config.xml#BXE2.0config.xml-newtabledelimiterparameter



Modified:
   branches/bxe_2_0/mozile/mozCE.js
   branches/bxe_2_0/plugins/ClipboardPasteDialog.js

Modified: branches/bxe_2_0/mozile/mozCE.js
==============================================================================
--- branches/bxe_2_0/mozile/mozCE.js	(original)
+++ branches/bxe_2_0/mozile/mozCE.js	Thu May 24 16:12:43 2007
@@ -800,14 +800,15 @@
 					content2 += " xmlns='"+elementNamespace +"'";
 				}
 				content += ">";
+				var delimiter = eval("'" + clipboard.delimiter + "'");
 				var _starti = 0;
 				if (paraElementVdom.bxeClipboardFirstChild) {
 					if (! paraElementVdom.bxeClipboardEmptyFirstRow ) {
 						_starti = 1;
 					}
 					content += "<"+ paraElementVdom.bxeClipboardFirstChild +">";
-					row[0] = row[0] + "\t";
-					var cell = row[0].match(/([^\t]*[\t$]+)/g);
+					
+					var cell = row[0].split(delimiter);
 					for (var j = 0; j < cell.length; j++) {
 						content += "<"+paraElementVdom.bxeClipboardFirstGrandChild + ">";
 						if (! paraElementVdom.bxeClipboardEmptyFirstRow  ) {
@@ -821,16 +822,16 @@
 				//find largest row
 				var max = 0;
 				for (var i = _starti; i < row.length; i++) {
-				  	var cell = row[i].match(/([^\t]*[\t$]+)/g);
+				  	row[i] = row[i].replace(/[\n\t\r]+$/,"");
+					var cell = row[i].split(delimiter);
+					
 					if (cell.length > max) {
 						max = cell.length;
 					}
 				}
-				console.log(max);
 				for (var i = _starti; i < row.length; i++) {
 					content += "<"+ elementNameParent +">";
-					row[i] = row[i] + "\t";
-					var cell = row[i].match(/([^\t]*[\t$]+)/g);
+					var cell = row[i].split(delimiter);
 					for (var j = 0; j < max; j++) {
 						content += "<"+elementName_start + ">";
 						if (cell[j]) {

Modified: branches/bxe_2_0/plugins/ClipboardPasteDialog.js
==============================================================================
--- branches/bxe_2_0/plugins/ClipboardPasteDialog.js	(original)
+++ branches/bxe_2_0/plugins/ClipboardPasteDialog.js	Thu May 24 16:12:43 2007
@@ -1,7 +1,8 @@
 function BxeClipboardPasteDialog() {
 	
 	this.init = function (options) {
-		 
+		bxe_config.BxeClipboardPasteDialog = this;
+		 this.tabledelimiter = bxe_config.getContentMultiple("/config/tabledelimiter/delimiter",true);
 	}
 	
 	this.start = function() {
@@ -34,8 +35,13 @@
 	}
 
 	var mod = mozilla.getWidgetModalBox("Paste here", function(values) {
-		
 		var clipboard = mozilla.getClipboard();
+		if (values.delimiter) {
+			clipboard.delimiter = values.delimiter;
+		} else {
+			clipboard.delimiter = '\\t';
+		}
+		
 		var content = clipboard.setData(values.clipboard);
 		clipboard._system = true;
 		window.getSelection().paste(_eles[values['element']]);
@@ -56,13 +62,23 @@
 	
 	mod.addItem("clipboard", "", "textarea");
 	mod.addItem("element", "", "select",null,_chooser,false);
+	
+	
+	var t = bxe_config.BxeClipboardPasteDialog.tabledelimiter;
+	_chooser = new Array();
+	for (i = 0; i < t.length; i++) {
+		_chooser[t[i].name] = t[i].value ;
+	}
+	
+	mod.addItem("delimiter", "", "select",null,_chooser,true);
+	
 	var _modBox = document.getElementById("modalBoxclipboard");
 	
 	 mod.node.style.width = window.innerWidth - 150 + "px"; 
 	_modBox.style.width = window.innerWidth - 250 + "px"; 
 	
 	mod.node.style.height = window.innerHeight - 110 + "px"; 
-	_modBox.style.height= window.innerHeight - 190 + "px"; 
+	_modBox.style.height= window.innerHeight - 210 + "px"; 
 	
 	
 	mod.show(100,50,"fixed");
-- 
Bx-editor-cvs mailing list
[email protected]
http://lists.bitflux.ch/cgi-bin/listinfo/bx-editor-cvs