|
From: <net...@us...> - 2010-11-28 16:39:48
|
Revision: 170
http://openautomation.svn.sourceforge.net/openautomation/?rev=170&view=rev
Author: netzkind
Date: 2010-11-28 16:39:42 +0000 (Sun, 28 Nov 2010)
Log Message:
-----------
make editor work with jQuery 1.4.4 by going the hard way using inline xml parsing
Modified Paths:
--------------
CometVisu/trunk/visu/edit/visuconfig_edit.js
Modified: CometVisu/trunk/visu/edit/visuconfig_edit.js
===================================================================
--- CometVisu/trunk/visu/edit/visuconfig_edit.js 2010-11-28 15:18:27 UTC (rev 169)
+++ CometVisu/trunk/visu/edit/visuconfig_edit.js 2010-11-28 16:39:42 UTC (rev 170)
@@ -7,7 +7,7 @@
save_bad: "Config not saved. Error: '%s'",
value_required: "Field '%s' is required but empty. Please correct your input.",
value_invalid: "The value for field '%s' is invalid. Please correct your input.",
- regexp_invalid: "There something wrong with the cable."
+ regexp_invalid: "There's something wrong with the cable."
}
if (typeof texts[element] == "undefined") {
@@ -335,10 +335,33 @@
var container = $("#addMaster div.inputs");
- var dataObject = {
- nodeName: jQuery("#addMaster #add_type").val()
- };
+ // dataObject needs to be a real dom-object, so we need to go all the
+ // way through parsing an xml-string ...
+ var name = jQuery("#addMaster #add_type").val();
+ var text = container.find("#add_textContent:input").val();
+ var xml = "<" + name + ">" + text + "</" + name + ">";
+ var dataObject;
+ if (window.DOMParser) {
+ var parser = new DOMParser();
+ dataObject = parser.parseFromString(xml, "text/xml");
+ } else {
+ // Internet Explorer
+ dataObject = new ActiveXObject("Microsoft.XMLDOM");
+ dataObject.async="false";
+ dataObject.loadXML(xml);
+ }
+
+ dataObject = jQuery(dataObject.documentElement);
+ if (typeof (dataObject.nodeName) == "undefined" || dataObject.nodeName == "") {
+ dataObject.nodeName = name;
+ }
+ if (typeof (text) != "undefined"
+ && (typeof (dataObject.textContent) == "undefined" || dataObject.textContent == "")) {
+ dataObject.textContent = text;
+ }
+
+
var error = false;
// alte Werte zwischenspeichern
@@ -346,10 +369,6 @@
var name;
if ($(this).closest("div.add_input").hasClass("attribute")) {
name = $(this).data("name");
- } else if ($(this).closest("div.add_input").hasClass("content")) {
- name = "textContent";
- // preset text-content to be empty
- dataObject[name] = "";
}
if ($(this).val() != "") {
@@ -359,7 +378,7 @@
// do not save
error = true;
}
- dataObject[name] = $(this).val();
+ dataObject.attr(name, $(this).val());
} else if ($(this).data("required") === true) {
// do not save
alert(lingua("value_required", name));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|