BUG 11998: No se estan respetando los espacios generados en un XML SOLVED

- Cuando se modifica el XML de un formulario, campos, espacios, etc, y se regresa a la vista XML se puede ver que los espacios añadidos son eliminados.
- Adjustment in the xml file of the tabulated a dynaform.
This commit is contained in:
Hector Cortez
2013-06-05 17:03:41 -04:00
parent 68c631bbaf
commit 384c67aa23

View File

@@ -163,6 +163,7 @@ class dynaFormHandler
} }
if ($childs_childs != null and is_array($childs_childs)) { if ($childs_childs != null and is_array($childs_childs)) {
foreach ($childs_childs as $cc) { foreach ($childs_childs as $cc) {
$newnode_child->appendChild($this->dom->createTextNode("\n" . str_repeat(" ", 6)));
$ccmode = $newnode_child->appendChild($this->dom->createElement($cc['name'])); $ccmode = $newnode_child->appendChild($this->dom->createElement($cc['name']));
$ccmode->appendChild($this->dom->createTextNode($cc['value'])); $ccmode->appendChild($this->dom->createTextNode($cc['value']));
foreach ($cc['attributes'] as $cc_att_name => $cc_att_value) { foreach ($cc['attributes'] as $cc_att_name => $cc_att_value) {
@@ -249,11 +250,16 @@ class dynaFormHandler
foreach ($childs as $child_name => $child_text) { foreach ($childs as $child_name => $child_text) {
$newnode->appendChild($this->dom->createTextNode(" ")); $newnode->appendChild($this->dom->createTextNode("\n" . str_repeat(" ", 4)));
$newnode_child = $newnode->appendChild($this->dom->createElement($child_name)); $newnode_child = $newnode->appendChild($this->dom->createElement($child_name));
if (is_string($child_text)) { if (is_string($child_text)) {
$newnode_child->appendChild($this->dom->createTextNode($child_text)); if (strip_tags($child_text) !== $child_text) {
$newnode_child->appendChild($this->dom->createCDATASection($child_text));
} else {
$newnode_child->appendChild($this->dom->createTextNode($child_text));
}
} else { } else {
if (is_array($child_text) && isset($child_text['cdata'])) { if (is_array($child_text) && isset($child_text['cdata'])) {
$newnode_child->appendChild($this->dom->createCDATASection($child_text)); $newnode_child->appendChild($this->dom->createCDATASection($child_text));
} }
@@ -261,8 +267,9 @@ class dynaFormHandler
if ($child_name == SYS_LANG) { if ($child_name == SYS_LANG) {
if ($childs_childs != null and is_array($childs_childs)) { if ($childs_childs != null and is_array($childs_childs)) {
foreach ($childs_childs as $cc) { foreach ($childs_childs as $cc) {
$newnode_child->appendChild($this->dom->createTextNode("\n" . str_repeat(" ", 6)));
$ccmode = $newnode_child->appendChild($this->dom->createElement($cc['name'])); $ccmode = $newnode_child->appendChild($this->dom->createElement($cc['name']));
$ccmode->appendChild($this->dom->createTextNode($cc['value'])); $ccmode->appendChild($this->dom->createTextNode($cc['value'] ));
foreach ($cc['attributes'] as $cc_att_name => $cc_att_value) { foreach ($cc['attributes'] as $cc_att_name => $cc_att_value) {
$ccmode->setAttribute($cc_att_name, $cc_att_value); $ccmode->setAttribute($cc_att_name, $cc_att_value);
} }
@@ -279,8 +286,7 @@ class dynaFormHandler
} }
} }
} }
$newnode->appendChild($this->dom->createTextNode("\n" . str_repeat(" ", 2)));
$newnode->appendChild($this->dom->createTextNode("\n"));
} }
} else { } else {
if (isset($childs)) { if (isset($childs)) {