|
From: <net...@us...> - 2013-01-24 21:04:06
|
Revision: 1356
http://openautomation.svn.sourceforge.net/openautomation/?rev=1356&view=rev
Author: netzkind
Date: 2013-01-24 21:03:57 +0000 (Thu, 24 Jan 2013)
Log Message:
-----------
fixed recursive checking for validity of config, made additions to upgrader (namespace, encapsulate diagram_-content, fixed filename-issue with upgrader
Modified Paths:
--------------
CometVisu/trunk/visu/editor/lib/Configuration.js
CometVisu/trunk/visu/editor/lib/Editor.js
CometVisu/trunk/visu/editor/lib/Schema.js
CometVisu/trunk/visu/upgrade/ConfigurationUpgrader.class.php
CometVisu/trunk/visu/upgrade/index.php
CometVisu/trunk/visu/visu_config.xml
Modified: CometVisu/trunk/visu/editor/lib/Configuration.js
===================================================================
--- CometVisu/trunk/visu/editor/lib/Configuration.js 2013-01-24 19:59:15 UTC (rev 1355)
+++ CometVisu/trunk/visu/editor/lib/Configuration.js 2013-01-24 21:03:57 UTC (rev 1356)
@@ -504,6 +504,12 @@
} else {
childrenString += child.name + ';';
}
+
+ // do the recursion
+ if (false === child.isValid()) {
+ isValid = false;
+ return;
+ }
});
if (false == regExp.test(childrenString)) {
Modified: CometVisu/trunk/visu/editor/lib/Editor.js
===================================================================
--- CometVisu/trunk/visu/editor/lib/Editor.js 2013-01-24 19:59:15 UTC (rev 1355)
+++ CometVisu/trunk/visu/editor/lib/Editor.js 2013-01-24 21:03:57 UTC (rev 1356)
@@ -1087,9 +1087,9 @@
},
/**
- * toggle show
+ * actually insert the attributs-HTML into the DOM
*/
- toggleDisplay: function () {
+ renderHTML: function () {
var $attributes = Attributes.$attributes;
@@ -1099,18 +1099,29 @@
Attributes.$htmlPlaceholder.replaceWith($attributes);
Attributes.$htmlPlaceholder = undefined;
}
-
+ },
+
+ /**
+ * toggle show
+ */
+ toggleDisplay: function () {
+ Attributes.renderHTML();
+ var $attributes = Attributes.$attributes;
+
// first hide
-
if ($('ul.attributes:visible').not($attributes).length > 0) {
// some other attributes are visible, we need to hide them first
$('ul.attributes:visible').not($attributes)
.slideToggle('fast', function () {
- $attributes.slideToggle('fast');
+ if (typeof $attributes != 'undefined') {
+ $attributes.slideToggle('fast');
+ }
});
} else {
// no other attributes are currently visible
- $attributes.slideToggle('fast');
+ if (typeof $attributes != 'undefined') {
+ $attributes.slideToggle('fast');
+ }
}
return;
@@ -1129,6 +1140,7 @@
* @param attributeName string name of the attribute
*/
markAttributeInvalid: function (attributeName) {
+ Attributes.renderHTML();
var $attributes = Attributes.$attributes;
var $invalidAttribute = $attributes.find('span.name:contains(' + attributeName + ')').closest('li.attribute');
Modified: CometVisu/trunk/visu/editor/lib/Schema.js
===================================================================
--- CometVisu/trunk/visu/editor/lib/Schema.js 2013-01-24 19:59:15 UTC (rev 1355)
+++ CometVisu/trunk/visu/editor/lib/Schema.js 2013-01-24 21:03:57 UTC (rev 1356)
@@ -1169,7 +1169,7 @@
if (allowedContent._grouping == undefined) {
// not really something to match
- return new RegExp(/^/);
+ return '^';
}
var regexString = allowedContent._grouping.getRegex(separator);
Modified: CometVisu/trunk/visu/upgrade/ConfigurationUpgrader.class.php
===================================================================
--- CometVisu/trunk/visu/upgrade/ConfigurationUpgrader.class.php 2013-01-24 19:59:15 UTC (rev 1355)
+++ CometVisu/trunk/visu/upgrade/ConfigurationUpgrader.class.php 2013-01-24 21:03:57 UTC (rev 1356)
@@ -117,6 +117,10 @@
$objXPath = new DOMXPath($this->objDOM);
+ // append namespaces to schema
+ $this->objDOM->getElementsByTagName('pages')->item(0)->setAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
+ $this->objDOM->getElementsByTagName('pages')->item(0)->setAttribute('xsi:noNamespaceSchemaLocation', './visu_config.xsd');
+
// rename iframe to web
$objElements = $objXPath->query('//iframe');
$i = 0;
@@ -192,6 +196,26 @@
}
$this->log('encapsulated content of ' . $i . ' \'text\'-nodes in \'label\'-nodes');
+ // encapsulate content of 'diagram_'-nodes in a label
+ $objElements = $objXPath->query('//diagram_inline[not(child::*)]|//diagram_popup[not(child::*)]');
+ $i = 0;
+ foreach ($objElements as $objElementNode) {
+ $objLabelNode = $objElementNode->ownerDocument->createElement('label');
+
+ // first, move all nodes to the childnode
+ if ($objElementNode->childNodes->length > 0) {
+ foreach ($objElementNode->childNodes as $objChildNode) {
+ $objLabelNode->appendChild($objChildNode);
+ }
+ }
+
+ $objElementNode->nodeValue = '';
+
+ $objElementNode->appendChild($objLabelNode);
+
+ ++$i;
+ }
+ $this->log('encapsulated content of ' . $i . ' \'diagram_*\'-nodes in \'label\'-nodes');
// FROM readonly / writeonly TO disable/read/write/readwrite
$objElements = $objXPath->query('//address');
Modified: CometVisu/trunk/visu/upgrade/index.php
===================================================================
--- CometVisu/trunk/visu/upgrade/index.php 2013-01-24 19:59:15 UTC (rev 1355)
+++ CometVisu/trunk/visu/upgrade/index.php 2013-01-24 21:03:57 UTC (rev 1356)
@@ -34,8 +34,8 @@
require_once('ConfigurationUpgrader.class.php');
-define('CONFIG_FILENAME', '../visu_config_%s.xml');
-define('BACKUP_FILENAME', '../backup/visu_config_%s-%s.xml');
+define('CONFIG_FILENAME', '../visu_config%s.xml');
+define('BACKUP_FILENAME', '../backup/visu_config%s-%s.xml');
// get everything the user has provided ...
$strConfigSuffix = (true === isset($_GET['config'])) ? $_GET['config'] : null;
@@ -43,6 +43,11 @@
// clean-up filename, we want no security-holes. work with a whitelist.
$strConfigCleaned = preg_replace("/[^\-\_0-9a-z]/i", "", $strConfigSuffix);
+if (false === empty($strConfigCleaned)) {
+ // prefix the postfix with an underscore
+ $strConfigCleaned = '_' . $strConfigCleaned;
+}
+
// generate the configurations filename
$strConfigFilename = sprintf(CONFIG_FILENAME, $strConfigCleaned);
// .. as a fully qualified filename
Modified: CometVisu/trunk/visu/visu_config.xml
===================================================================
--- CometVisu/trunk/visu/visu_config.xml 2013-01-24 19:59:15 UTC (rev 1355)
+++ CometVisu/trunk/visu/visu_config.xml 2013-01-24 21:03:57 UTC (rev 1356)
@@ -59,9 +59,5 @@
<label>Welcome to the CometVisu!</label>
</text>
<line/>
- <colorchooser>
- <label/>
- <address transform="bla">1/2/3</address>
- </colorchooser>
</page>
</pages>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|