BUG 9286 Comments are deleted from the XML code for DynaForms SOLVED
- ProcessMaker deletes comments from XML code. For example if I have: - Change in the way of creating XML files in DynaForms.
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
/**
|
||||
* class.dynaformhandler.php
|
||||
* @package gulliver.system
|
||||
* @package gulliver.system
|
||||
|
||||
* ProcessMaker Open Source Edition
|
||||
* Copyright (C) 2004 - 2008 Colosa Inc.
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
@@ -15,13 +15,13 @@
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
*
|
||||
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
|
||||
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -45,7 +45,7 @@ class dynaFormHandler
|
||||
*/
|
||||
function __construct($file=null)
|
||||
{
|
||||
if( !isset($file) )
|
||||
if( !isset($file) )
|
||||
throw new Exception('[Class dynaFormHandler] ERROR: xml file was not set!!');
|
||||
$this->xmlfile = $file;
|
||||
$this->load();
|
||||
@@ -76,7 +76,7 @@ class dynaFormHandler
|
||||
* @return void
|
||||
*/
|
||||
function __cloneEmpty()
|
||||
{
|
||||
{
|
||||
$xPath = new DOMXPath($this->dom);
|
||||
$nodeList = $xPath->query('/dynaForm/*');
|
||||
foreach ($nodeList as $domElement){
|
||||
@@ -99,7 +99,7 @@ class dynaFormHandler
|
||||
default: return file_get_contents($this->xmlfile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function getNode
|
||||
* @access public
|
||||
@@ -135,6 +135,12 @@ class dynaFormHandler
|
||||
function add($name, $attributes, $childs, $childs_childs=null)
|
||||
{
|
||||
$newnode = $this->root->appendChild($this->dom->createElement($name));
|
||||
if( isset($attributes['#cdata']) ) {
|
||||
$newnode->appendChild($this->dom->createTextNode("\n"));
|
||||
$newnode->appendChild($this->dom->createCDATASection($attributes['#cdata']));
|
||||
$newnode->appendChild($this->dom->createTextNode("\n"));
|
||||
unset($attributes['#cdata']);
|
||||
}
|
||||
foreach($attributes as $att_name => $att_value) {
|
||||
$newnode->setAttribute($att_name, $att_value);
|
||||
}
|
||||
@@ -159,6 +165,35 @@ class dynaFormHandler
|
||||
$this->save();
|
||||
}
|
||||
|
||||
private function hasChild($p)
|
||||
{
|
||||
if ($p->hasChildNodes()) {
|
||||
foreach ($p->childNodes as $c) {
|
||||
if ($c->nodeType == XML_ELEMENT_NODE) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function getChildNode($x)
|
||||
{
|
||||
$chidNode = array();
|
||||
foreach ($x->childNodes as $p) {
|
||||
if ($this->hasChild($p)) {
|
||||
getChildNode($p);
|
||||
} else {
|
||||
if ($p->nodeType == XML_ELEMENT_NODE) {
|
||||
|
||||
$chidNode[] = array('node' => $x->nodeName, 'nodeName' => $p->nodeName,
|
||||
'name' => $p->getAttribute('name'), 'nodeValue' => $p->nodeValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
return array($x->nodeName => $chidNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function replace
|
||||
* @access public
|
||||
@@ -171,39 +206,69 @@ class dynaFormHandler
|
||||
*/
|
||||
function replace($replaced, $name, $attributes, $childs=null, $childs_childs=null)
|
||||
{
|
||||
$chidNode= array();
|
||||
$element = $this->root->getElementsByTagName($replaced)->item(0);
|
||||
$this->root->replaceChild($this->dom->createElement($name), $element);
|
||||
$newnode = $element = $this->root->getElementsByTagName($name)->item(0);
|
||||
|
||||
// $newnode = $element = $this->root->getElementsByTagName($name)->item(0);
|
||||
$newnode = $this->root->getElementsByTagName($name)->item(0);
|
||||
|
||||
if( isset($attributes['#text']) ) {
|
||||
$newnode->appendChild($this->dom->createTextNode($attributes['#text']));
|
||||
unset($attributes['#text']);
|
||||
}
|
||||
if( isset($attributes['#cdata']) ) {
|
||||
$newnode->appendChild($this->dom->createTextNode("\n"));
|
||||
$newnode->appendChild($this->dom->createCDATASection($attributes['#cdata']));
|
||||
$newnode->appendChild($this->dom->createTextNode("\n"));
|
||||
unset($attributes['#cdata']);
|
||||
}
|
||||
|
||||
|
||||
foreach($attributes as $att_name => $att_value) {
|
||||
$newnode->setAttribute($att_name, $att_value);
|
||||
if (!is_array($att_value)) {
|
||||
$newnode->setAttribute($att_name, $att_value);
|
||||
}
|
||||
|
||||
}
|
||||
if(is_array($childs)){
|
||||
foreach ($element->childNodes as $pNode) {
|
||||
if( $pNode->nodeName != SYS_LANG && $pNode->nodeName != '#cdata-section' && $pNode->nodeName != '#text') {
|
||||
$chidNode[] = $this->getChildNode($pNode);
|
||||
$childs[$pNode->nodeName] = $pNode->firstChild->nodeValue;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($childs as $child_name => $child_text) {
|
||||
|
||||
$newnode->appendChild($this->dom->createTextNode(" "));
|
||||
$newnode_child = $newnode->appendChild($this->dom->createElement($child_name));
|
||||
if( is_string($child_text) )
|
||||
$newnode_child->appendChild($this->dom->createTextNode($child_text));
|
||||
else if( is_array($child_text) && isset($child_text['cdata']) )
|
||||
$newnode_child->appendChild($this->dom->createCDATASection($child_text));
|
||||
|
||||
if($childs_childs != null and is_array($childs_childs)){
|
||||
foreach($childs_childs as $cc) {
|
||||
$ccmode = $newnode_child->appendChild($this->dom->createElement($cc['name']));
|
||||
$ccmode->appendChild($this->dom->createTextNode($cc['value']));
|
||||
foreach($cc['attributes'] as $cc_att_name => $cc_att_value) {
|
||||
$ccmode->setAttribute($cc_att_name, $cc_att_value);
|
||||
if ($child_name == SYS_LANG ) {
|
||||
if($childs_childs != null and is_array($childs_childs)){
|
||||
foreach($childs_childs as $cc) {
|
||||
$ccmode = $newnode_child->appendChild($this->dom->createElement($cc['name']));
|
||||
$ccmode->appendChild($this->dom->createTextNode($cc['value']));
|
||||
foreach($cc['attributes'] as $cc_att_name => $cc_att_value) {
|
||||
$ccmode->setAttribute($cc_att_name, $cc_att_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
foreach ($chidNode as $valueNode) {
|
||||
if ( array_key_exists($child_name, $valueNode) ) {
|
||||
foreach($valueNode[$child_name] as $valOption) {
|
||||
$ccmode = $newnode_child->appendChild($this->dom->createElement($valOption['nodeName']));
|
||||
$ccmode->appendChild($this->dom->createTextNode($valOption['nodeValue']));
|
||||
$ccmode->setAttribute('name', $valOption['name']);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$newnode->appendChild($this->dom->createTextNode("\n"));
|
||||
}
|
||||
} else if( isset($childs) ){
|
||||
$text_node = $childs;
|
||||
@@ -257,7 +322,10 @@ class dynaFormHandler
|
||||
$this->root->setAttribute($att_name, $att_value);
|
||||
$this->save();
|
||||
}
|
||||
|
||||
function getHeaderAttribute($att_name)
|
||||
{
|
||||
return $this->root->getAttribute($att_name);
|
||||
}
|
||||
/**
|
||||
* Function modifyHeaderAttribute
|
||||
* @param string $att_name
|
||||
@@ -317,7 +385,7 @@ class dynaFormHandler
|
||||
}
|
||||
$this->save();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function nodeExists
|
||||
* @param string $node_name
|
||||
@@ -335,7 +403,7 @@ class dynaFormHandler
|
||||
}
|
||||
}
|
||||
|
||||
//new features
|
||||
//new features
|
||||
/**
|
||||
* Function moveUp
|
||||
* @param string $selected_node
|
||||
@@ -409,7 +477,7 @@ class dynaFormHandler
|
||||
}
|
||||
$this->save();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function getFields
|
||||
* @param array $aFilter
|
||||
@@ -446,7 +514,7 @@ class dynaFormHandler
|
||||
}
|
||||
return $aList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function getFieldNames
|
||||
* @param array $aFilter
|
||||
@@ -461,8 +529,8 @@ class dynaFormHandler
|
||||
}
|
||||
return $aFieldNames;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
function addChilds($name, $childs, $childs_childs=null)
|
||||
{
|
||||
//
|
||||
@@ -471,35 +539,35 @@ class dynaFormHandler
|
||||
if( ! $nodeList ){
|
||||
throw new Exception("Error trying get the field dynaform $name, maybe it doesn't exist in {$this->xmlfile}");
|
||||
}
|
||||
|
||||
|
||||
if( $nodeList->length == 0 ) {
|
||||
$element = $this->root->appendChild($this->dom->createElement($name));
|
||||
} else
|
||||
$element = $this->root->getElementsByTagName($name)->item(0);
|
||||
|
||||
|
||||
if( is_array($childs) ) {
|
||||
foreach( $childs as $child_name => $child_text ) {
|
||||
|
||||
|
||||
$nodeList = $xpath->query("/dynaForm/$name/$child_name");
|
||||
|
||||
|
||||
if( $nodeList->length == 0 ){ //the node doesn't exist
|
||||
//$newnode_child
|
||||
//$newnode_child
|
||||
$childNode = $element->appendChild($this->dom->createElement($child_name));
|
||||
$childNode->appendChild($this->dom->createCDATASection($child_text));
|
||||
} else { // the node already exists
|
||||
//update its value
|
||||
$childNode = $element->getElementsByTagName($child_name)->item(0);
|
||||
|
||||
|
||||
//
|
||||
if($child_text !== NULL){
|
||||
$xnode = $this->dom->createElement($childNode->nodeName);
|
||||
$xnode->appendChild($this->dom->createCDATASection($child_text));
|
||||
|
||||
$element->replaceChild($xnode, $childNode);
|
||||
|
||||
$element->replaceChild($xnode, $childNode);
|
||||
$childNode = $element->getElementsByTagName($child_name)->item(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($childs_childs != null and is_array($childs_childs)){
|
||||
foreach($childs_childs as $cc) {
|
||||
$ccnode = $childNode->appendChild($this->dom->createElement($cc['name']));
|
||||
@@ -518,14 +586,14 @@ class dynaFormHandler
|
||||
}
|
||||
|
||||
|
||||
function addOrUpdateChild($xnode, $childName, $childValue, $childAttributes){
|
||||
function addOrUpdateChild($xnode, $childName, $childValue, $childAttributes){
|
||||
$newNode = $this->dom->createElement($childName);
|
||||
$newNode->appendChild($this->dom->createCDATASection($childValue));
|
||||
|
||||
|
||||
foreach($childAttributes as $attName => $attValue) {
|
||||
$newNode->setAttribute($attName, $attValue);
|
||||
}
|
||||
|
||||
|
||||
if( $xnode->hasChildNodes() ) {
|
||||
foreach($xnode->childNodes as $cnode) {
|
||||
if( $cnode->nodeName == $childName ) {
|
||||
@@ -533,17 +601,17 @@ class dynaFormHandler
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else
|
||||
} else
|
||||
$xnode->appendChild($newNode);
|
||||
}
|
||||
|
||||
|
||||
function getArray($node, $attributes = null)
|
||||
{
|
||||
$array = false;
|
||||
$array['__nodeName__'] = $node->nodeName;
|
||||
$text = simplexml_import_dom($node);
|
||||
$array['__nodeText__'] = trim((string) $text);
|
||||
|
||||
|
||||
if ($node->hasAttributes()) {
|
||||
if( isset($attributes) ) {
|
||||
foreach ($attributes as $attr) {
|
||||
@@ -576,5 +644,5 @@ class dynaFormHandler
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
G::LoadClass( 'xmlDb' );
|
||||
G::LoadSystem('dynaformhandler');
|
||||
|
||||
/**
|
||||
* Dynaform Field - DynaformField class
|
||||
@@ -34,6 +35,16 @@ G::LoadClass( 'xmlDb' );
|
||||
*/
|
||||
class DynaFormField extends DBTable
|
||||
{
|
||||
private $fileName;
|
||||
public function getFileName()
|
||||
{
|
||||
return $this->fileName;
|
||||
}
|
||||
|
||||
public function setFileName($fileName)
|
||||
{
|
||||
$this->fileName = $fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SetTo
|
||||
@@ -108,9 +119,9 @@ class DynaFormField extends DBTable
|
||||
$this->Fields = $Fields;
|
||||
unset( $this->Fields['XMLNODE_NAME_OLD'] );
|
||||
/*
|
||||
* MPD-10 to create fields that do not appear many attributes, only the main ones?
|
||||
* The show those who are not white
|
||||
*/
|
||||
* MPD-10 to create fields that do not appear many attributes, only the main ones?
|
||||
* The show those who are not white
|
||||
*/
|
||||
if ($this->is_new) {
|
||||
foreach ($this->Fields as $key => $value) {
|
||||
if ($value == "")
|
||||
@@ -125,12 +136,12 @@ class DynaFormField extends DBTable
|
||||
parent::Save();
|
||||
if ($this->is_new) {
|
||||
/*
|
||||
* Create a new field.
|
||||
*/
|
||||
* Create a new field.
|
||||
*/
|
||||
foreach ($labels as $lang => $value) {
|
||||
/*$res = $this->_dbses->Execute('INSERT INTO dynaForm'.
|
||||
' (XMLNODE_TYPE,XMLNODE_VALUE)'.
|
||||
' VALUES ("cdata", "'."\n".'")');*/
|
||||
' (XMLNODE_TYPE,XMLNODE_VALUE)'.
|
||||
' VALUES ("cdata", "'."\n".'")');*/
|
||||
$res = $this->_dbses->Execute( 'INSERT INTO dynaForm.' . $Fields['XMLNODE_NAME'] . ' (XMLNODE_NAME,XMLNODE_VALUE,XMLNODE_TYPE) ' . 'VALUES ("","' . "\n " . '","cdata")' );
|
||||
$res = $this->_dbses->Execute( 'INSERT INTO dynaForm.' . $Fields['XMLNODE_NAME'] . ' (XMLNODE_NAME,XMLNODE_VALUE) ' . 'VALUES ("' . $lang . '","' . str_replace( '"', '""', $value )/*."\n "*/.'")' );
|
||||
if (isset( $options[$lang] )) {
|
||||
@@ -165,6 +176,63 @@ class DynaFormField extends DBTable
|
||||
}
|
||||
}
|
||||
|
||||
function saveField ($Fields, $attributes = array(), $options = array())
|
||||
{
|
||||
$dynaform = new dynaFormHandler( $this->getFileName());
|
||||
if ($Fields['TYPE'] === 'javascript') {
|
||||
$Fields['XMLNODE_VALUE'] = $Fields['CODE'];
|
||||
unset( $Fields['CODE'] );
|
||||
$attributes = array ();
|
||||
}
|
||||
if ($Fields['XMLNODE_NAME_OLD'] == '') {
|
||||
if (($Fields['XMLNODE_NAME'][0] == '1') || ($Fields['XMLNODE_NAME'][0] == '2') || ($Fields['XMLNODE_NAME'][0] == '3') || ($Fields['XMLNODE_NAME'][0] == '4') || ($Fields['XMLNODE_NAME'][0] == '5') || ($Fields['XMLNODE_NAME'][0] == '6') || ($Fields['XMLNODE_NAME'][0] == '7') || ($Fields['XMLNODE_NAME'][0] == '8') || ($Fields['XMLNODE_NAME'][0] == '9') || ($Fields['XMLNODE_NAME'][0] == '10')) {
|
||||
$Fields['XMLNODE_NAME'] = '_' . $Fields['XMLNODE_NAME'];
|
||||
}
|
||||
$res = $this->_dbses->Execute( 'SELECT * FROM dynaForm WHERE XMLNODE_NAME="' . $Fields['XMLNODE_NAME'] . '"' );
|
||||
} else {
|
||||
if (($Fields['XMLNODE_NAME_OLD'][0] == '1') || ($Fields['XMLNODE_NAME_OLD'][0] == '2') || ($Fields['XMLNODE_NAME_OLD'][0] == '3') || ($Fields['XMLNODE_NAME_OLD'][0] == '4') || ($Fields['XMLNODE_NAME_OLD'][0] == '5') || ($Fields['XMLNODE_NAME_OLD'][0] == '6') || ($Fields['XMLNODE_NAME_OLD'][0] == '7') || ($Fields['XMLNODE_NAME_OLD'][0] == '8') || ($Fields['XMLNODE_NAME_OLD'][0] == '9') || ($Fields['XMLNODE_NAME_OLD'][0] == '10')) {
|
||||
$Fields['XMLNODE_NAME_OLD'] = '_' . $Fields['XMLNODE_NAME_OLD'];
|
||||
}
|
||||
$res = $this->_dbses->Execute( 'SELECT * FROM dynaForm WHERE XMLNODE_NAME="' . $Fields['XMLNODE_NAME_OLD'] . '"' );
|
||||
}
|
||||
$this->is_new = ($res->count() == 0);
|
||||
$this->Fields = $Fields;
|
||||
unset( $this->Fields['XMLNODE_NAME_OLD'] );
|
||||
/*
|
||||
* MPD-10 to create fields that do not appear many attributes, only the main ones?
|
||||
* The show those who are not white
|
||||
*/
|
||||
if ($this->is_new) {
|
||||
foreach ($this->Fields as $key => $value) {
|
||||
if ($value == "") {
|
||||
unset( $this->Fields[$key] );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->Fields['XMLNODE_NAME'] = $Fields['XMLNODE_NAME_OLD'];
|
||||
}
|
||||
|
||||
// parent::Save();
|
||||
if (trim($Fields['XMLNODE_VALUE']) != "") {
|
||||
$attributes['#cdata'] = $Fields['XMLNODE_VALUE'];
|
||||
}
|
||||
|
||||
$aOptions = array();
|
||||
if(isset($Fields['OPTIONS']) && is_array($Fields['OPTIONS']) ) {
|
||||
foreach ($Fields['OPTIONS'] as $key => $value) {
|
||||
$aOptions[] = Array( 'name' => 'option', 'value' => $value['LABEL'],
|
||||
'attributes' => array('name'=>$value['NAME']) );
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->is_new) {
|
||||
// Create a new field
|
||||
$dynaform->add($Fields['XMLNODE_NAME'], $attributes, $options, $aOptions);
|
||||
} else {
|
||||
$dynaform->replace($Fields['XMLNODE_NAME_OLD'], $Fields['XMLNODE_NAME'], $attributes, $options, $aOptions);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if is New the Field
|
||||
*
|
||||
|
||||
@@ -38,7 +38,7 @@ G::LoadClass( 'dynaFormField' );
|
||||
require_once ('classes/model/Process.php');
|
||||
require_once ('classes/model/Dynaform.php');
|
||||
G::LoadClass( 'xmlDb' );
|
||||
|
||||
G::LoadSystem('dynaformhandler');
|
||||
/**
|
||||
*
|
||||
* @package workflow.engine.classes
|
||||
@@ -699,30 +699,40 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
|
||||
$tmp['Properties'] = $Fields;
|
||||
self::_setTmpData( $tmp );
|
||||
}
|
||||
$dynaform = new dynaFormHandler( PATH_DYNAFORM . "{$file}.xml" );
|
||||
$dbc2 = new DBConnection( PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml' );
|
||||
$ses2 = new DBSession( $dbc2 );
|
||||
//if (!isset($Fields['ENABLETEMPLATE'])) $Fields['ENABLETEMPLATE'] ="0";
|
||||
if (isset( $Fields['WIDTH'] )) {
|
||||
$ses2->execute( G::replaceDataField( "UPDATE . SET WIDTH = @@WIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) );
|
||||
}
|
||||
|
||||
/*if (isset($Fields['ENABLETEMPLATE'])) {
|
||||
$ses2->execute(G::replaceDataField("UPDATE . SET ENABLETEMPLATE = @@ENABLETEMPLATE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields));
|
||||
}*/
|
||||
$ses2->execute(G::replaceDataField("UPDATE . SET ENABLETEMPLATE = @@ENABLETEMPLATE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields));
|
||||
}*/
|
||||
if (isset( $Fields['DYN_TYPE'] )) {
|
||||
$ses2->execute( G::replaceDataField( "UPDATE . SET TYPE = @@DYN_TYPE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) );
|
||||
//$ses2->execute( G::replaceDataField( "UPDATE . SET TYPE = @@DYN_TYPE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) );
|
||||
$dynaform->modifyHeaderAttribute('type', $Fields['DYN_TYPE']);
|
||||
}
|
||||
if (isset( $Fields['WIDTH'] )) {
|
||||
// $ses2->execute( G::replaceDataField( "UPDATE . SET WIDTH = @@WIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) );
|
||||
$dynaform->modifyHeaderAttribute('width', $Fields['WIDTH']);
|
||||
//g::pr($dynaform->getHeaderAttribute('width'));
|
||||
}
|
||||
if (isset( $Fields['MODE'] )) {
|
||||
$ses2->execute( G::replaceDataField( "UPDATE . SET MODE = @@MODE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) );
|
||||
// $ses2->execute( G::replaceDataField( "UPDATE . SET MODE = @@MODE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) );
|
||||
$dynaform->modifyHeaderAttribute('mode', $Fields['MODE']);
|
||||
}
|
||||
if (isset( $Fields['NEXTSTEPSAVE'] )) {
|
||||
$ses2->execute( G::replaceDataField( "UPDATE . SET NEXTSTEPSAVE = @@NEXTSTEPSAVE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) );
|
||||
//$ses2->execute( G::replaceDataField( "UPDATE . SET NEXTSTEPSAVE = @@NEXTSTEPSAVE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) );
|
||||
$dynaform->modifyHeaderAttribute('nextstepsave', $Fields['NEXTSTEPSAVE']);
|
||||
}
|
||||
if (isset( $Fields['PRINTDYNAFORM'] )) {
|
||||
$ses2->execute( G::replaceDataField( "UPDATE . SET PRINTDYNAFORM = @@PRINTDYNAFORM WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) );
|
||||
//$ses2->execute( G::replaceDataField( "UPDATE . SET PRINTDYNAFORM = @@PRINTDYNAFORM WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) );
|
||||
$dynaform->modifyHeaderAttribute('printdynaform', $Fields['PRINTDYNAFORM']);
|
||||
}
|
||||
if (isset( $Fields['ADJUSTGRIDSWIDTH'] )) {
|
||||
$ses2->execute( G::replaceDataField( "UPDATE . SET ADJUSTGRIDSWIDTH = @@ADJUSTGRIDSWIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) );
|
||||
//$ses2->execute( G::replaceDataField( "UPDATE . SET ADJUSTGRIDSWIDTH = @@ADJUSTGRIDSWIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) );
|
||||
$dynaform->modifyHeaderAttribute('adjustgridswidth', $Fields['ADJUSTGRIDSWIDTH']);
|
||||
}
|
||||
|
||||
return 0;
|
||||
} catch (Exception $e) {
|
||||
return (array) $e;
|
||||
@@ -753,9 +763,13 @@ class dynaformEditorAjax extends dynaformEditor implements iDynaformEditorAjax
|
||||
{
|
||||
$file = G::decrypt( $A, URL_KEY );
|
||||
$value = $value == "1" ? "1" : "0";
|
||||
$dbc2 = new DBConnection( PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml' );
|
||||
$ses2 = new DBSession( $dbc2 );
|
||||
$ses2->execute( "UPDATE . SET ENABLETEMPLATE = '$value'" );
|
||||
// $dbc2 = new DBConnection( PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml' );
|
||||
// $ses2 = new DBSession( $dbc2 );
|
||||
// $ses2->execute( "UPDATE . SET ENABLETEMPLATE = '$value'" );
|
||||
|
||||
$dynaform = new dynaFormHandler( PATH_DYNAFORM . "{$file}.xml" );
|
||||
$dynaform->modifyHeaderAttribute('enabletemplate', $value);
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,12 +60,12 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons
|
||||
else {
|
||||
$_POST['form']['PME_SAVELABEL'] = 0;
|
||||
}
|
||||
|
||||
if (isset($_POST['form']['PME_SAVELABEL'])
|
||||
$A = $_POST['form']['PME_A'];
|
||||
if (isset($_POST['form']['PME_SAVELABEL'])
|
||||
&& isset($_POST['form']['PME_CODE'])
|
||||
&& $_POST['form']['PME_TYPE'] === 'javascript'){
|
||||
$sType = $_POST['form']['PME_TYPE'];
|
||||
$A = $_POST['form']['PME_A'];
|
||||
// $A = $_POST['form']['PME_A'];
|
||||
$fieldName = $_POST['form']['PME_XMLNODE_NAME'];
|
||||
$pmeCode = $_POST['form']['PME_CODE'];
|
||||
$_POST['form']['PME_CODE'] = '';
|
||||
@@ -82,9 +82,9 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons
|
||||
define('DB_XMLDB_NAME','');
|
||||
define('DB_XMLDB_TYPE','myxml');
|
||||
|
||||
if (isset($_POST['form']['PME_XMLNODE_VALUE'])){
|
||||
$_POST['form']['PME_XMLNODE_VALUE'] = str_replace("'", "''" , $_POST['form']['PME_XMLNODE_VALUE']);
|
||||
}
|
||||
// if (isset($_POST['form']['PME_XMLNODE_VALUE'])){
|
||||
// $_POST['form']['PME_XMLNODE_VALUE'] = str_replace("'", "''" , $_POST['form']['PME_XMLNODE_VALUE']);
|
||||
// }
|
||||
|
||||
if (file_exists( PATH_XMLFORM . 'dynaforms/fields/' . $type . '.xml')) {
|
||||
$form=new Form('dynaforms/fields/' . $type , PATH_XMLFORM);
|
||||
@@ -142,12 +142,12 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons
|
||||
if ($_POST['form']['XMLNODE_NAME']==='') return;
|
||||
|
||||
$attributes = $_POST['form'];
|
||||
|
||||
|
||||
if (isset($attributes['HINT'])) {
|
||||
$attributes['HINT'] = addslashes($attributes['HINT']);
|
||||
$attributes['HINT'] = htmlspecialchars($attributes['HINT'], ENT_QUOTES, "UTF-8");
|
||||
}
|
||||
|
||||
|
||||
if (isset($attributes['CODE'])) $attributes['XMLNODE_VALUE'] = ($attributes['CODE']);
|
||||
|
||||
$labels = array();
|
||||
@@ -202,7 +202,22 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons
|
||||
}
|
||||
}
|
||||
unset($attributes['VALIDATE_NAME']);
|
||||
$fields->Save( $attributes , $labels , $options );
|
||||
$fields->setFileName(PATH_DYNAFORM . $file . '.xml' );
|
||||
|
||||
$FieldAttributes = $attributes;
|
||||
$FieldAttrib = array();
|
||||
unset($FieldAttributes['XMLNODE_NAME']);
|
||||
unset($FieldAttributes['XMLNODE_NAME_OLD']);
|
||||
unset($FieldAttributes['XMLNODE_VALUE']);
|
||||
unset($FieldAttributes['BTN_CANCEL']);
|
||||
unset($FieldAttributes['SAVELABEL']);
|
||||
foreach ($FieldAttributes as $key => $value) {
|
||||
if ($value != "") {
|
||||
$FieldAttrib[strtolower($key)] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
$fields->saveField($attributes, $FieldAttrib, $labels );
|
||||
|
||||
G::LoadClass('xmlDb');
|
||||
$i = 0;
|
||||
|
||||
Reference in New Issue
Block a user