This commit is contained in:
Marco Antonio Nina Mena
2017-12-04 13:25:35 +00:00
committed by Julio Cesar Laura Avendaño
parent abe71a6ffe
commit 0d533e19d9
363 changed files with 23948 additions and 44623 deletions

View File

@@ -26,49 +26,48 @@
*/
$G_PUBLISH = new Publisher();
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher = headPublisher::getSingleton();
$DISPLAY_MAX_SIZE = 25;
global $_DBArray;
$oFieldCondition = new FieldCondition();
if (isset($_SESSION['Current_Dynafom']['Parameters']['DYN_UID'])) {
$DYN_UID = $_SESSION['Current_Dynafom']['Parameters']['DYN_UID'];
$aRows = $oFieldCondition->getAllByDynUid( $DYN_UID );
$aRows = $oFieldCondition->getAllByDynUid($DYN_UID);
}
$aFieldNames = Array ('FCD_NRO','FCD_UID','FCD_FUNCTION','FCD_FIELDS','FCD_CONDITION','FCD_EVENTS','FCD_EVENT_OWNERS','FCD_STATUS','FCD_DYN_UID' );
$aFieldNames = array('FCD_NRO','FCD_UID','FCD_FUNCTION','FCD_FIELDS','FCD_CONDITION','FCD_EVENTS','FCD_EVENT_OWNERS','FCD_STATUS','FCD_DYN_UID' );
//Routines to limit the show in list max size for some fields that can have large size
$inndex = 0;
$aRowsTmp = Array ();
$aRowsTmp = array();
foreach ($aRows as $aRow) {
$aRow['FCD_NRO'] = ++ $inndex;
if (strlen( $aRow['FCD_FIELDS'] ) > $DISPLAY_MAX_SIZE) {
$aRow['FCD_FIELDS'] = substr( $aRow['FCD_FIELDS'], 0, $DISPLAY_MAX_SIZE ) . '...';
if (strlen($aRow['FCD_FIELDS']) > $DISPLAY_MAX_SIZE) {
$aRow['FCD_FIELDS'] = substr($aRow['FCD_FIELDS'], 0, $DISPLAY_MAX_SIZE) . '...';
}
if ($aRow['FCD_FUNCTION'] == 'showAll' || $aRow['FCD_FUNCTION'] == 'hideAll') {
$aRow['FCD_FIELDS'] = 'ALL';
}
if (strlen( $aRow['FCD_CONDITION'] ) > $DISPLAY_MAX_SIZE) {
$aRow['FCD_CONDITION'] = substr( $aRow['FCD_CONDITION'], 0, $DISPLAY_MAX_SIZE ) . '...';
if (strlen($aRow['FCD_CONDITION']) > $DISPLAY_MAX_SIZE) {
$aRow['FCD_CONDITION'] = substr($aRow['FCD_CONDITION'], 0, $DISPLAY_MAX_SIZE) . '...';
}
if (strlen( $aRow['FCD_EVENT_OWNERS'] ) > $DISPLAY_MAX_SIZE) {
$aRow['FCD_EVENT_OWNERS'] = substr( $aRow['FCD_EVENT_OWNERS'], 0, $DISPLAY_MAX_SIZE ) . '...';
if (strlen($aRow['FCD_EVENT_OWNERS']) > $DISPLAY_MAX_SIZE) {
$aRow['FCD_EVENT_OWNERS'] = substr($aRow['FCD_EVENT_OWNERS'], 0, $DISPLAY_MAX_SIZE) . '...';
}
array_push( $aRowsTmp, $aRow );
array_push($aRowsTmp, $aRow);
}
$aRows = array_merge( Array ($aFieldNames), $aRowsTmp );
$aRows = array_merge(array($aFieldNames), $aRowsTmp);
$_DBArray['virtual_pmtable'] = $aRows;
$_SESSION['_DBArray'] = $_DBArray;
$oCriteria = new Criteria( 'dbarray' );
$oCriteria->setDBArrayTable( 'virtual_pmtable' );
$oHeadPublisher->addScriptFile( '/jscore/dynaforms/dynaforms_conditionalShowHide.js' );
$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'dynaforms/dynaforms_ConditionalShowHideList', $oCriteria, Array ('DYN_UID' => $DYN_UID), '' );
G::RenderPage( 'publish', 'raw' );
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('virtual_pmtable');
$oHeadPublisher->addScriptFile('/jscore/dynaforms/dynaforms_conditionalShowHide.js');
$G_PUBLISH->AddContent('propeltable', 'paged-table', 'dynaforms/dynaforms_ConditionalShowHideList', $oCriteria, array('DYN_UID' => $DYN_UID), '');
G::RenderPage('publish', 'raw');

View File

@@ -21,7 +21,7 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
return $RBAC_Response;
}
@@ -36,19 +36,19 @@ $G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'FIELDS';
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
$ses = new DBSession($dbc);
//Hardcode: UID of the library by default
$PRO_UID = isset( $_POST['PRO_UID'] ) ? $_POST['PRO_UID'] : '746B734DC23311';
$PRO_UID = isset($_POST['PRO_UID']) ? $_POST['PRO_UID'] : '746B734DC23311';
$process = new Process( $dbc );
$process->Load( $PRO_UID );
$process = new Process($dbc);
$process->Load($PRO_UID);
$dynaform = new Dynaform( $dbc );
$dynaform->Fields['DYN_UID'] = (isset( $_POST['DYN_UID'] )) ? urldecode( $_POST['DYN_UID'] ) : '0';
$dynaform->Load( $dynaform->Fields['DYN_UID'] );
$dynaform = new Dynaform($dbc);
$dynaform->Fields['DYN_UID'] = (isset($_POST['DYN_UID'])) ? urldecode($_POST['DYN_UID']) : '0';
$dynaform->Load($dynaform->Fields['DYN_UID']);
if (isset( $_POST['DYN_UID'] ) && ($_POST['DYN_UID'] !== '')) {
if (isset($_POST['DYN_UID']) && ($_POST['DYN_UID'] !== '')) {
$file = $dynaform->Fields['DYN_FILENAME'];
} else {
//Hardcode: Sample of xmlform.
@@ -56,57 +56,57 @@ if (isset( $_POST['DYN_UID'] ) && ($_POST['DYN_UID'] !== '')) {
}
/* Start Comment: If file doesn't exist, it is created */
if (! file_exists( PATH_DYNAFORM . $file . '.xml' )) {
if (! file_exists(PATH_DYNAFORM . $file . '.xml')) {
$newDoc = new Xml_Document();
$newDoc->addChildNode( new Xml_Node( 'dynaForm', 'open', '', array ('type' => 'xmlform','name' => $file
) ) );
$newDoc->children[0]->addChildNode( new Xml_Node( '', 'cdata', "\n" ) );
G::verifyPath( dirname( PATH_DYNAFORM . $file . '.xml' ), true );
$newDoc->save( PATH_DYNAFORM . $file . '.xml' );
unset( $newDoc );
$newDoc->addChildNode(new Xml_Node('dynaForm', 'open', '', array('type' => 'xmlform','name' => $file
)));
$newDoc->children[0]->addChildNode(new Xml_Node('', 'cdata', "\n"));
G::verifyPath(dirname(PATH_DYNAFORM . $file . '.xml'), true);
$newDoc->save(PATH_DYNAFORM . $file . '.xml');
unset($newDoc);
}
/* End Comment */
/* Start Comment: Create and temporal copy. */
$pathFile = $filter->xssFilterHard(PATH_DYNAFORM . $file . '.xml', 'path');
$copy = implode( '', file( $pathFile ) );
$copy = implode('', file($pathFile));
$file .= '_tmp0';
$fcopy = fopen( $pathFile , "w" );
fwrite( $fcopy, $copy );
fclose( $fcopy );
$fcopy = fopen($pathFile, "w");
fwrite($fcopy, $copy);
fclose($fcopy);
/* End Comment */
//Removes any other CURRENT_DYNAFORM that could be pending because of a page refresh or a failure
unset( $_SESSION['CURRENT_DYNAFORM'] );
unset($_SESSION['CURRENT_DYNAFORM']);
define( 'DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml' );
define( 'DB_XMLDB_USER', '' );
define( 'DB_XMLDB_PASS', '' );
define( 'DB_XMLDB_NAME', '' );
define( 'DB_XMLDB_TYPE', 'myxml' );
define('DB_XMLDB_HOST', PATH_DYNAFORM . $file . '.xml');
define('DB_XMLDB_USER', '');
define('DB_XMLDB_PASS', '');
define('DB_XMLDB_NAME', '');
define('DB_XMLDB_TYPE', 'myxml');
$title = $process->Fields['PRO_TITLE'] . ' : ' . $dynaform->Fields['DYN_TITLE'];
$Parameters = array ('SYS_LANG' => SYS_LANG,'URL' => G::encrypt( $file, URL_KEY ),'DYN_UID' => $dynaform->Fields['DYN_UID'],'DYNAFORM_NAME' => $title
$Parameters = array('SYS_LANG' => SYS_LANG,'URL' => G::encrypt($file, URL_KEY),'DYN_UID' => $dynaform->Fields['DYN_UID'],'DYNAFORM_NAME' => $title
);
$openDoc = new Xml_Document();
$openDoc->parseXmlFile( PATH_DYNAFORM . $file . '.xml' );
$XmlEditor = array ('URL' => G::encrypt( $file, URL_KEY ),'XML' => $openDoc->getXml()
$openDoc->parseXmlFile(PATH_DYNAFORM . $file . '.xml');
$XmlEditor = array('URL' => G::encrypt($file, URL_KEY),'XML' => $openDoc->getXml()
);
$form = new Form( $file, PATH_DYNAFORM, SYS_LANG, true );
$HtmlEditor = array ('URL' => G::encrypt( $file, URL_KEY ),'HTML' => $form->printTemplate( $form->template, $script )
$form = new Form($file, PATH_DYNAFORM, SYS_LANG, true);
$HtmlEditor = array('URL' => G::encrypt($file, URL_KEY),'HTML' => $form->printTemplate($form->template, $script)
);
$JSEditor = array ('URL' => G::encrypt( $file, URL_KEY ),'HTML' => $form->printTemplate( $form->template, $script )
$JSEditor = array('URL' => G::encrypt($file, URL_KEY),'HTML' => $form->printTemplate($form->template, $script)
);
/* Block : Loads the Editor configuration */
$defaultConfig = array ('Editor' => array ('left' => '0',//'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))',
$defaultConfig = array('Editor' => array('left' => '0',//'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))',
'top' => '0',//'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))',
'width' => 'document.body.clientWidth-4','height' => 'document.body.clientHeight-2' //'3/4*(document.body.clientWidth-getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))*2)',
),'Toolbar' => array ('left' => 'document.body.clientWidth-2-toolbar.clientWidth-24-3+7',//'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))',
),'Toolbar' => array('left' => 'document.body.clientWidth-2-toolbar.clientWidth-24-3+7',//'getAbsoluteLeft(document.getElementById("dynaformEditor[0]"))',
'top' => '52' //'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))',
),'FieldsList' => array ('left' => '4+toolbar.clientWidth+24','top' => 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))','width' => 268 - 24,'height' => 400
),'FieldsList' => array('left' => '4+toolbar.clientWidth+24','top' => 'getAbsoluteTop(document.getElementById("dynaformEditor[0]"))','width' => 268 - 24,'height' => 400
)
);
/*$configuration = new Configuration($dbc);
@@ -125,39 +125,39 @@ $config = $defaultConfig;
$G_PUBLISH = new Publisher();
$G_PUBLISH->publisherId = 'dynaformEditor';
$oHeadPublisher = & headPublisher::getSingleton();
$oHeadPublisher->setTitle( "Dynaform Editor" );
$oHeadPublisher = headPublisher::getSingleton();
$oHeadPublisher->setTitle("Dynaform Editor");
//$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/fields_ShortList', '', $Parameters , '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax');
$G_PUBLISH->AddContent( 'blank' );
$G_PUBLISH->AddContent('blank');
$panelConf = array ('title' => G::LoadTranslation( 'ID_DYNAFORM_EDITOR' ) . ' - [' . $title . ']','style' => array ('title' => array ('textAlign' => 'left'
$panelConf = array('title' => G::LoadTranslation('ID_DYNAFORM_EDITOR') . ' - [' . $title . ']','style' => array('title' => array('textAlign' => 'left'
)
),'width' => 700,'height' => 600,'tabWidth' => 120,'modal' => true,'drag' => false,'resize' => false,'blinkToFront' => false
);
$panelConf = array_merge( $panelConf, $config['Editor'] );
$panelConf = array_merge($panelConf, $config['Editor']);
$G_PUBLISH->AddContent( 'panel-init', 'mainPanel', $panelConf );
$G_PUBLISH->AddContent( 'xmlform', 'toolbar', 'dynaforms/fields_Toolbar', '', $Parameters, '', '' );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_Editor', '', $Parameters, '', '' );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_XmlEditor', '', $XmlEditor, '', '' );
$G_PUBLISH->AddContent('panel-init', 'mainPanel', $panelConf);
$G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_Toolbar', '', $Parameters, '', '');
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Editor', '', $Parameters, '', '');
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_XmlEditor', '', $XmlEditor, '', '');
//This space will be loaded dynamically by el js function: "changoToHtmlCode"
$G_PUBLISH->AddContent( 'blank' );
$G_PUBLISH->AddContent( 'pagedtable', 'paged-table', 'dynaforms/fields_List', '', $Parameters, '', SYS_URI . 'dynaforms/dynaforms_PagedTableAjax' );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_JSEditor', '', $JSEditor, '', '' );
$G_PUBLISH->AddContent( 'blank' );
$G_PUBLISH->AddContent('blank');
$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/fields_List', '', $Parameters, '', SYS_URI . 'dynaforms/dynaforms_PagedTableAjax');
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_JSEditor', '', $JSEditor, '', '');
$G_PUBLISH->AddContent('blank');
// $G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Properties', '', $JSEditor , '', '');
$G_PUBLISH->AddContent( 'panel-tab', 'Preview', 'dynaformEditor[3]', 'changoToPreview', 'saveCurrentView' );
$G_PUBLISH->AddContent( 'panel-tab', 'XML Code', 'dynaformEditor[4]', 'changoToXmlCode', 'saveCurrentView' );
$G_PUBLISH->AddContent( 'panel-tab', 'HTML Template', 'dynaformEditor[5]', 'changoToHtmlCode', 'saveCurrentView' );
$G_PUBLISH->AddContent( 'panel-tab', 'Fields List', 'dynaformEditor[6]', 'changoToFieldsList', 'saveCurrentView' );
$G_PUBLISH->AddContent( 'panel-tab', 'JavaScripts', 'dynaformEditor[7]', 'changoToJavascripts', 'saveCurrentView' );
$G_PUBLISH->AddContent( 'panel-tab', 'Properties', 'dynaformEditor[8]', 'changoToProperties', 'saveCurrentView' );
$G_PUBLISH->AddContent( 'panel-close' );
$G_PUBLISH->AddContent('panel-tab', 'Preview', 'dynaformEditor[3]', 'changoToPreview', 'saveCurrentView');
$G_PUBLISH->AddContent('panel-tab', 'XML Code', 'dynaformEditor[4]', 'changoToXmlCode', 'saveCurrentView');
$G_PUBLISH->AddContent('panel-tab', 'HTML Template', 'dynaformEditor[5]', 'changoToHtmlCode', 'saveCurrentView');
$G_PUBLISH->AddContent('panel-tab', 'Fields List', 'dynaformEditor[6]', 'changoToFieldsList', 'saveCurrentView');
$G_PUBLISH->AddContent('panel-tab', 'JavaScripts', 'dynaformEditor[7]', 'changoToJavascripts', 'saveCurrentView');
$G_PUBLISH->AddContent('panel-tab', 'Properties', 'dynaformEditor[8]', 'changoToProperties', 'saveCurrentView');
$G_PUBLISH->AddContent('panel-close');
G::RenderPage( "publish", "raw" );
G::RenderPage("publish", "raw");
?>
<script>

View File

@@ -32,80 +32,78 @@
$filter = new InputFilter();
$_POST = $filter->xssFilterHard($_POST);
function subDependencies ($k, &$G_FORM, &$aux, $grid = '')
function subDependencies($k, &$G_FORM, &$aux, $grid = '')
{
$myDependentFields = '';
if (array_search( $k, $aux ) !== false) {
return array ();
if (array_search($k, $aux) !== false) {
return array();
}
if ($grid == '') {
if (! array_key_exists( $k, $G_FORM->fields )) {
return array ();
if (!array_key_exists($k, $G_FORM->fields)) {
return array();
}
if (! isset( $G_FORM->fields[$k]->dependentFields )) {
return array ();
if (!isset($G_FORM->fields[$k]->dependentFields)) {
return array();
}
$aux[] = $k;
$mydependentFields = $G_FORM->fields[$k]->dependentFields;
} else {
if (! array_key_exists( $k, $G_FORM->fields[$grid]->fields )) {
return array ();
if (!array_key_exists($k, $G_FORM->fields[$grid]->fields)) {
return array();
}
if (! isset( $G_FORM->fields[$grid]->fields[$k]->dependentFields )) {
return array ();
if (!isset($G_FORM->fields[$grid]->fields[$k]->dependentFields)) {
return array();
}
$myDependentFields = $G_FORM->fields[$grid]->fields[$k]->dependentFields;
$myDependentFields = explode( ',', $G_FORM->fields[$grid]->fields[$k]->dependentFields );
$myDependentFields = explode(',', $G_FORM->fields[$grid]->fields[$k]->dependentFields);
}
return $myDependentFields;
}
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
return $RBAC_Response;
}
// the script responds an ajax request in order to check the dependent fields,
// and generate a json output of the values that the dependent field must have.
$sDynUid = G::getUIDName( urlDecode( $_POST['DYN_UID'] ) );
// the script responds an ajax request in order to check the dependent fields,
// and generate a json output of the values that the dependent field must have.
$sDynUid = G::getUIDName(urlDecode($_POST['DYN_UID']));
//$json = new Services_JSON();
$formValues = (Bootstrap::json_decode( $_POST['fields'] ));
$formValues = (Bootstrap::json_decode($_POST['fields']));
$sFieldName = $_POST['fieldName'];
$sMasterField = '';
$sPath = PATH_DYNAFORM;
$G_FORM = new Form( $sDynUid, $sPath );
$aux = array ();
$newValues = Bootstrap::json_decode( urlDecode( stripslashes( $_POST['form'] ) ) );
$G_FORM = new Form($sDynUid, $sPath);
$aux = array();
$newValues = Bootstrap::json_decode(urlDecode(stripslashes($_POST['form'])));
if (isset( $_POST['grid'] )) {
$_POST['row'] = (int) $_POST['row'];
$aAux = array ();
if (isset($_POST['grid'])) {
$_POST['row'] = (int)$_POST['row'];
$aAux = array();
foreach ($newValues as $sKey => $newValue) {
$newValue = (array) $newValue;
$aKeys = array_keys( $newValue );
$aValues = array ();
for ($i = 1; $i <= ($_POST['row'] - 1); $i ++) {
$aValues[$i] = array ($aKeys[0] => ''
$newValue = (array)$newValue;
$aKeys = array_keys($newValue);
$aValues = array();
for ($i = 1; $i <= ($_POST['row'] - 1); $i++) {
$aValues[$i] = array($aKeys[0] => ''
);
}
$aValues[$_POST['row']] = array ($aKeys[0] => $newValue[$aKeys[0]] );
$newValues[$sKey]->$_POST['grid'] = $aValues;
unset( $newValues[$sKey]->$aKeys[0] );
$aValues[$_POST['row']] = array($aKeys[0] => $newValue[$aKeys[0]]);
$newValues[$sKey]->{$_POST['grid']} = $aValues;
unset($newValues[$sKey]->{$aKeys[0]});
}
}
$dependentFields = array ();
$aux = array ();
$dependentFields = array();
$aux = array();
$found = false;
for ($r = 0; $r < sizeof( $newValues ); $r ++) {
$newValues[$r] = (array) $newValues[$r];
$G_FORM->setValues( $newValues[$r] );
for ($r = 0; $r < sizeof($newValues); $r++) {
$newValues[$r] = (array)$newValues[$r];
$G_FORM->setValues($newValues[$r]);
//Search dependent fields
foreach ($newValues[$r] as $k => $v) {
if (! is_array( $v )) {
$myDependentFields = subDependencies( $k, $G_FORM, $aux );
if (! $found) {
if (in_array( $sFieldName, $myDependentFields )) {
if (!is_array($v)) {
$myDependentFields = subDependencies($k, $G_FORM, $aux);
if (!$found) {
if (in_array($sFieldName, $myDependentFields)) {
$sMasterField = $k;
$found = true;
}
@@ -113,9 +111,9 @@ for ($r = 0; $r < sizeof( $newValues ); $r ++) {
$_SESSION[$G_FORM->id][$k] = $v;
} else {
foreach ($v[$_POST['row']] as $k1 => $v1) {
$myDependentFields = subDependencies( $k1, $G_FORM, $aux, $_POST['grid'] );
if (! $found) {
if (in_array( $sFieldName, $myDependentFields )) {
$myDependentFields = subDependencies($k1, $G_FORM, $aux, $_POST['grid']);
if (!$found) {
if (in_array($sFieldName, $myDependentFields)) {
$sMasterField = $k1;
$found = true;
}
@@ -123,15 +121,14 @@ for ($r = 0; $r < sizeof( $newValues ); $r ++) {
$_SESSION[$G_FORM->id][$_POST['grid']][$_POST['row']][$k1] = $v1;
}
}
$dependentFields = array_merge( $dependentFields, $myDependentFields );
$dependentFields = array_merge($dependentFields, $myDependentFields);
}
}
switch ($_POST['function']) {
case 'showDependentFields':
echo $json->encode( array_unique( $dependentFields ) );
echo $json->encode(array_unique($dependentFields));
break;
case 'showDependentOf':
echo $sMasterField;
break;
}

View File

@@ -26,7 +26,6 @@
*/
$G_PUBLISH = new Publisher();
$oHeadPublisher = & headPublisher::getSingleton();
$G_PUBLISH->AddContent( 'view', 'dynaforms/fieldsHandlerViewer' );
G::RenderPage( "publish", "raw" );
$oHeadPublisher = headPublisher::getSingleton();
$G_PUBLISH->AddContent('view', 'dynaforms/fieldsHandlerViewer');
G::RenderPage("publish", "raw");

View File

@@ -21,37 +21,37 @@
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
if (! (isset( $_POST['A'] ) && $_POST['A'] !== '')) {
if (! (isset($_POST['A']) && $_POST['A'] !== '')) {
return;
}
if (! (isset( $_POST['XMLNODE_NAME'] ) && $_POST['XMLNODE_NAME'] !== '')) {
if (! (isset($_POST['XMLNODE_NAME']) && $_POST['XMLNODE_NAME'] !== '')) {
return;
}
if (! (isset( $_POST['NEW_POS'] ) && $_POST['NEW_POS'] !== '')) {
if (! (isset($_POST['NEW_POS']) && $_POST['NEW_POS'] !== '')) {
return;
}
$file = PATH_DYNAFORM . G::decrypt( $_POST['A'], URL_KEY ) . '.xml';
$file = PATH_DYNAFORM . G::decrypt($_POST['A'], URL_KEY) . '.xml';
$fieldName = $_POST['XMLNODE_NAME'];
$newPos = intval( $_POST['NEW_POS'] );
$newPos = intval($_POST['NEW_POS']);
if (! file_exists( $file )) {
if (! file_exists($file)) {
return;
}
$xmldoc = new Xml_Document();
$xmldoc->parseXmlFile( $file );
$xmldoc->parseXmlFile($file);
$node = & $xmldoc->findNode( '/dynaForm/' . $fieldName );
$node = $xmldoc->findNode('/dynaForm/' . $fieldName);
if (! isset( $node )) {
if (! isset($node)) {
return;
}
$numFields = 0;
@@ -63,7 +63,7 @@ $newPos = ($newPos < 1) ? 1 : $newPos;
$newPos = ($newPos > $numFields) ? $numFields : $newPos;
$rowCounter = (int) 0;
$newOrder = array ();
$newOrder = array();
foreach ($xmldoc->children[0]->children as $index => $child) {
if ($child->name !== '') {
$rowCounter ++;
@@ -86,19 +86,18 @@ if ($rowCounter < $newPos) {
}
$xmldoc->children[0]->children = $newOrder;
$xmldoc->save( $file );
$xmldoc->save($file);
$i = 0;
$aFields = array ();
$aFields[] = array ('XMLNODE_NAME' => 'char','TYPE' => 'char','UP' => 'char','DOWN' => 'char','row__' => 'integer');
$oSession = new DBSession( new DBConnection( $file, '', '', '', 'myxml' ) );
$oDataset = $oSession->Execute( 'SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" )' );
$aFields = array();
$aFields[] = array('XMLNODE_NAME' => 'char','TYPE' => 'char','UP' => 'char','DOWN' => 'char','row__' => 'integer');
$oSession = new DBSession(new DBConnection($file, '', '', '', 'myxml'));
$oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" )');
$iMaximun = $oDataset->count();
while ($aRow = $oDataset->Read()) {
$aFields[] = array ('XMLNODE_NAME' => $aRow['XMLNODE_NAME'],'TYPE' => $aRow['TYPE'],'UP' => ($i > 0 ? G::LoadTranslation( 'ID_UP' ) : ''),'DOWN' => ($i < $iMaximun - 1 ? G::LoadTranslation( 'ID_DOWN' ) : ''),'row__' => ($i + 1) );
$aFields[] = array('XMLNODE_NAME' => $aRow['XMLNODE_NAME'],'TYPE' => $aRow['TYPE'],'UP' => ($i > 0 ? G::LoadTranslation('ID_UP') : ''),'DOWN' => ($i < $iMaximun - 1 ? G::LoadTranslation('ID_DOWN') : ''),'row__' => ($i + 1) );
$i ++;
}
global $_DBArray;
$_DBArray['fields'] = $aFields;
$_SESSION['_DBArray'] = $_DBArray;