CODE STYLE

files modified:
conditionalShowHide.php
conditionalShowHide_Ajax.php
datemask.php
dynaform_Fields.php
dynaforms_Ajax.php
dynaforms_AssignVariables.php
dynaforms_ChoseType.php
dynaforms_Delete.php
dynaforms_Edit.php
dynaforms_FlatEditor.php
dynaforms_List.php
dynaforms_NewPlugin.php
dynaforms_PagedTableAjax.php
dynaforms_Preview.php
dynaforms_Save.php
dynaforms_SaveProperties.php
dynaforms_Save_as.php
dynaforms_Saveas.php
dynaforms_ToolbarAjax.php
dynaforms_checkDependentFields.php
fieldsGetterAjax.php
fieldsHandler.php
fieldsHandlerAjax.php
fieldsHandlerViewer.php
fields_Ajax.php
fields_Delete.php
fields_Edit.php
fields_List.php
fields_Order.php
test.php
This commit is contained in:
Ralph Asendeteufrer
2012-10-18 11:53:05 -04:00
parent 23d74542be
commit 17631d0082
30 changed files with 1683 additions and 1767 deletions

View File

@@ -1,8 +1,8 @@
<?php
/**
/**
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* 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
@@ -10,87 +10,65 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/*
/*
* @Author Erik Amaru Ortiz <erik@colosa.com>
* @Date Aug 26th, 2009
* @Date Aug 26th, 2009
*/
require_once "classes/model/FieldCondition.php";
G::LoadClass('ArrayPeer');
$G_PUBLISH = new Publisher;
$oHeadPublisher =& headPublisher::getSingleton();
$DISPLAY_MAX_SIZE = 25;
global $_DBArray;
$oFieldCondition = new FieldCondition;
$DYN_UID = $_SESSION['Current_Dynafom']['Parameters']['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'
);
//Routines to limit the show in list max size for some fields that can have large size
$inndex = 0;
$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( $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_EVENT_OWNERS']) > $DISPLAY_MAX_SIZE ){
$aRow['FCD_EVENT_OWNERS'] = substr($aRow['FCD_EVENT_OWNERS'], 0, $DISPLAY_MAX_SIZE) . '...';
}
array_push($aRowsTmp, $aRow);
}
$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');
require_once "classes/model/FieldCondition.php";
G::LoadClass( 'ArrayPeer' );
$G_PUBLISH = new Publisher();
$oHeadPublisher = & headPublisher::getSingleton();
$DISPLAY_MAX_SIZE = 25;
global $_DBArray;
$oFieldCondition = new FieldCondition();
$DYN_UID = $_SESSION['Current_Dynafom']['Parameters']['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' );
//Routines to limit the show in list max size for some fields that can have large size
$inndex = 0;
$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 ($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_EVENT_OWNERS'] ) > $DISPLAY_MAX_SIZE) {
$aRow['FCD_EVENT_OWNERS'] = substr( $aRow['FCD_EVENT_OWNERS'], 0, $DISPLAY_MAX_SIZE ) . '...';
}
array_push( $aRowsTmp, $aRow );
}
$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' );

View File

@@ -1,8 +1,8 @@
<?php
/**
/**
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* 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
@@ -10,15 +10,14 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/*
@@ -26,141 +25,111 @@
* @Date Feb 12th, 2010
*/
try {
if(!isset($_POST['request'])) {
throw new Exception('No request set');
if (! isset( $_POST['request'] )) {
throw new Exception( 'No request set' );
}
$request = $_POST['request'];
$G_PUBLISH = new Publisher();
switch($request) {
switch ($request) {
case 'new':
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_ConditionalShowHide', '', '');
G::RenderPage('publish', 'raw');
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_ConditionalShowHide', '', '' );
G::RenderPage( 'publish', 'raw' );
break;
case 'edit':
require_once 'classes/model/FieldCondition.php';
$oFieldCondition = new FieldCondition();
$aRow = $oFieldCondition->get($_POST['FCD_UID']);
$aData = Array();
$aRow = $oFieldCondition->get( $_POST['FCD_UID'] );
$aData = Array ();
$aData['condition'] = 'neyek';
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_ConditionalShowHide', '', $aRow);
G::RenderPage('publish', 'raw');
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_ConditionalShowHide', '', $aRow );
G::RenderPage( 'publish', 'raw' );
//echo '<script>+alert(getField("FCD_CONDITION").value)</script>';
break;
case 'getDynaFieds':
G::LoadThirdParty('pear/json', 'class.json');
G::LoadSystem('dynaformhandler');
G::LoadThirdParty( 'pear/json', 'class.json' );
G::LoadSystem( 'dynaformhandler' );
$_DYN_FILENAME = $_SESSION['Current_Dynafom']['Parameters']['FILE'];
$sFilter = isset($_POST['filter']) ? $_POST['filter'] : '';
$sFilter = isset( $_POST['filter'] ) ? $_POST['filter'] : '';
$oJSON = new Services_JSON();
$oDynaformHandler = new dynaFormHandler(PATH_DYNAFORM . $_DYN_FILENAME . '.xml');
$aFilter = explode(',', $sFilter);
$aAvailableFields = $oDynaformHandler->getFieldNames($aFilter);
print($oJSON->encode($aAvailableFields));
$oDynaformHandler = new dynaFormHandler( PATH_DYNAFORM . $_DYN_FILENAME . '.xml' );
$aFilter = explode( ',', $sFilter );
$aAvailableFields = $oDynaformHandler->getFieldNames( $aFilter );
print ($oJSON->encode( $aAvailableFields )) ;
break;
case 'showDynavars':
G::LoadSystem('dynaformhandler');
G::LoadSystem( 'dynaformhandler' );
$_DYN_FILENAME = $_SESSION['Current_Dynafom']['Parameters']['FILE'];
$sFilter = isset($_POST['filter']) ? $_POST['filter'] : '';
$oDynaformHandler = new dynaFormHandler(PATH_DYNAFORM . $_DYN_FILENAME . '.xml');
$aFilter = explode(',', $sFilter);
$aAvailableFields = $oDynaformHandler->getFieldNames($aFilter);
$aFieldNames = Array(
'id' => 'char',
'name' => 'char'
);
$aRows = Array();
foreach( $aAvailableFields as $sFieldname ) {
array_push($aRows, Array(
'id' => $sFieldname,
'name' => $sFieldname
));
$sFilter = isset( $_POST['filter'] ) ? $_POST['filter'] : '';
$oDynaformHandler = new dynaFormHandler( PATH_DYNAFORM . $_DYN_FILENAME . '.xml' );
$aFilter = explode( ',', $sFilter );
$aAvailableFields = $oDynaformHandler->getFieldNames( $aFilter );
$aFieldNames = Array ('id' => 'char','name' => 'char' );
$aRows = Array ();
foreach ($aAvailableFields as $sFieldname) {
array_push( $aRows, Array ('id' => $sFieldname,'name' => $sFieldname) );
}
$rows = array_merge(Array(
$aFieldNames
), $aRows);
$rows = array_merge( Array ($aFieldNames), $aRows );
global $_DBArray;
$_DBArray['DYNAFIELDS'] = $rows;
$_SESSION['_DBArray'] = $_DBArray;
G::LoadClass('ArrayPeer');
$oCriteria = new Criteria('dbarray');
$oCriteria->setDBArrayTable('DYNAFIELDS');
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_vars', '', '');
G::RenderPage('publish', 'raw');
G::LoadClass( 'ArrayPeer' );
$oCriteria = new Criteria( 'dbarray' );
$oCriteria->setDBArrayTable( 'DYNAFIELDS' );
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_vars', '', '' );
G::RenderPage( 'publish', 'raw' );
break;
case 'testSetup':
$sFields = $_POST['sFields'];
$aFields = Array();
$aFieldsTmp = ($sFields == '') ? Array() : explode(',', $sFields);
$aFields = Array ();
$aFieldsTmp = ($sFields == '') ? Array () : explode( ',', $sFields );
$i = 1;
foreach( $aFieldsTmp as $aField ) {
$aFields['gFields'][$i ++] = Array(
'dynaid' => $aField,
'dynafield' => $aField,
'dynavalue' => ''
foreach ($aFieldsTmp as $aField) {
$aFields['gFields'][$i ++] = Array ('dynaid' => $aField,'dynafield' => $aField,'dynavalue' => ''
);
}
if(sizeof($aFields) > 0) {
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_ConditionalShowHideTest', '', $aFields);
G::RenderPage('publish', 'raw');
if (sizeof( $aFields ) > 0) {
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_ConditionalShowHideTest', '', $aFields );
G::RenderPage( 'publish', 'raw' );
} else {
print('false');
print ('false') ;
}
break;
case 'save':
require_once 'classes/model/FieldCondition.php';
$oFieldCondition = new FieldCondition();
$aDYN = $_SESSION['Current_Dynafom']['Parameters'];
$_POST['FCD_UID'] = ($_POST['FCD_UID']=='0') ? '' : $_POST['FCD_UID'];
$aData = Array(
'FCD_UID' => Isset($_POST['FCD_UID'])?$_POST['FCD_UID']:'',
'FCD_FUNCTION' => $_POST['function'],
'FCD_FIELDS' => $_POST['fields_selected'],
'FCD_CONDITION' => $_POST['condition'],
'FCD_EVENTS' => $_POST['events'],
'FCD_EVENT_OWNERS' => $_POST['event_owner_selected'],
'FCD_STATUS' => $_POST['enabled'],
'FCD_DYN_UID' => $aDYN['DYN_UID']
);
$oFieldCondition->quickSave($aData);
$_POST['FCD_UID'] = ($_POST['FCD_UID'] == '0') ? '' : $_POST['FCD_UID'];
$aData = Array ('FCD_UID' => Isset( $_POST['FCD_UID'] ) ? $_POST['FCD_UID'] : '','FCD_FUNCTION' => $_POST['function'],'FCD_FIELDS' => $_POST['fields_selected'],'FCD_CONDITION' => $_POST['condition'],'FCD_EVENTS' => $_POST['events'],'FCD_EVENT_OWNERS' => $_POST['event_owner_selected'],'FCD_STATUS' => $_POST['enabled'],'FCD_DYN_UID' => $aDYN['DYN_UID']);
$oFieldCondition->quickSave( $aData );
break;
case 'delete':
require_once 'classes/model/FieldCondition.php';
$oFieldCondition = FieldConditionPeer::retrieveByPk($_POST['FCD_UID']);
if( is_object($oFieldCondition) ){
$oFieldCondition = FieldConditionPeer::retrieveByPk( $_POST['FCD_UID'] );
if (is_object( $oFieldCondition )) {
$oFieldCondition->delete();
}
break;
}
} catch( Exception $e) {
print($e->getMessage());
} catch (Exception $e) {
print ($e->getMessage()) ;
}
/*
/*
* <pre>Array
(
[request] => save
@@ -182,24 +151,4 @@ try {
)
</pre>
*/

View File

@@ -1,4 +1,4 @@
<?php
<?php
/**
* fields_Edit.php
*
@@ -12,30 +12,31 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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) return $RBAC_Response;
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
G::LoadClass('dynaFormField');
// if (!(isset($_GET['A']) && $_GET['A']!=='')) return;
// $file = G::decrypt( $_GET['A'] , URL_KEY );
$file='datemask';
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/datemask','','');
//$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/fields/' . $type, '', $Fields , SYS_URI.'dynaforms/fields_Save', SYS_URI.'dynaforms/fields_Ajax');
G::RenderPage( "publish" , "raw" );
?>
G::LoadClass( 'dynaFormField' );
// if (!(isset($_GET['A']) && $_GET['A']!=='')) return;
// $file = G::decrypt( $_GET['A'] , URL_KEY );
$file = 'datemask';
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/datemask', '', '' );
//$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/fields/' . $type, '', $Fields , SYS_URI.'dynaforms/fields_Save', SYS_URI.'dynaforms/fields_Ajax');
G::RenderPage( "publish", "raw" );

View File

@@ -1,10 +1,10 @@
<?php
/**
* dynaform_Fields.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* 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
@@ -12,49 +12,50 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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) return $RBAC_Response;
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
G::LoadClass('xmlDb');
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'processes';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'DYNAFORMS';
$dbc = new DBConnection();
$ses = new DBSession($dbc);
G::LoadClass( 'xmlDb' );
$xdbc = new DBConnection( PATH_XMLFORM . 'dynaforms/dynaform_Fields.xml' ,'','','','myxml' );
$xses = new DBSession($xdbc);
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'processes';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'DYNAFORMS';
$res = $xses->execute('SELECT * FROM dynaForm');
for($r=0 ; $r < $res->count() ; $r ++ ){
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
$xdbc = new DBConnection( PATH_XMLFORM . 'dynaforms/dynaform_Fields.xml', '', '', '', 'myxml' );
$xses = new DBSession( $xdbc );
$res = $xses->execute( 'SELECT * FROM dynaForm' );
for ($r = 0; $r < $res->count(); $r ++) {
$row = $res->read();
// var_dump( $row );echo('<br/>');
}
// var_dump( $row );echo('<br/>');
}
define('DB_XMLDB_HOST', PATH_XMLFORM . 'dynaforms/dynaforms_List.xml' );
define('DB_XMLDB_USER','');
define('DB_XMLDB_PASS','');
define('DB_XMLDB_NAME','');
define('DB_XMLDB_TYPE','myxml');
define( 'DB_XMLDB_HOST', PATH_XMLFORM . 'dynaforms/dynaforms_List.xml' );
define( 'DB_XMLDB_USER', '' );
define( 'DB_XMLDB_PASS', '' );
define( 'DB_XMLDB_NAME', '' );
define( 'DB_XMLDB_TYPE', 'myxml' );
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/dynaform_Fields', '', array('SYS_LANG' => SYS_LANG) , 'dynaforms_Save', 'dynaforms_PagedTableAjax');
G::RenderPage( "publish" );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'pagedtable', 'paged-table', 'dynaforms/dynaform_Fields', '', array ('SYS_LANG' => SYS_LANG
), 'dynaforms_Save', 'dynaforms_PagedTableAjax' );
G::RenderPage( "publish" );
?>

View File

@@ -12,15 +12,14 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/*
* Created on 07/01/2008
@@ -28,11 +27,11 @@
* @author David Callizaya <davidsantos@colosa.com>
*/
global $_DBArray;
if (!isset($_DBArray)) {
$_DBArray = array();
if (! isset( $_DBArray )) {
$_DBArray = array ();
}
G::LoadClass('dynaformEditor');
$oDynaformEditorAjax = new dynaformEditorAjax($_POST);
G::LoadClass( 'dynaformEditor' );
$oDynaformEditorAjax = new dynaformEditorAjax( $_POST );
//if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
//
@@ -226,4 +225,4 @@ $oDynaformEditorAjax = new dynaformEditorAjax($_POST);
// break;
// }
//
?>

View File

@@ -1,29 +1,28 @@
<?php
require_once('classes/model/AdditionalTables.php');
require_once ('classes/model/AdditionalTables.php');
$oAdditionalTables = new AdditionalTables();
$aData = $oAdditionalTables->load($_POST['ADD_TABLE'], true);
$aData = $oAdditionalTables->load( $_POST['ADD_TABLE'], true );
$addTabName = $aData['ADD_TAB_NAME'];
$c = 1;
foreach ($aData['FIELDS'] as $iRow => $aRow) {
if ($aRow['FLD_KEY'] == 1) {
$aRow['PRO_VARIABLE'] = '';
$aFields['FIELDS'][$c++] = $aRow;
$aFields['FIELDS'][$c ++] = $aRow;
}
}
$aFields['DYN_UID'] = $_POST['DYN_UID'];
$aFields['DYN_UID'] = $_POST['DYN_UID'];
$aFields['ADD_TABLE'] = $_POST['ADD_TABLE'];
$aFields['PRO_UID'] = $_POST['PRO_UID'];
$aFields['PRO_UID'] = $_POST['PRO_UID'];
$aFields['DYN_TITLE'] = $_POST['DYN_TITLE'];
$aFields['DYN_TYPE'] = $_POST['DYN_TYPE'];
$aFields['DYN_DESCRIPTION'] = $_POST['DYN_DESCRIPTION'];
$aFields['VALIDATION_MESSAGE'] = G::LoadTranslation('ID_FILL_PRIMARY_KEYS');
$aFields['DYN_TYPE'] = $_POST['DYN_TYPE'];
$aFields['DYN_DESCRIPTION'] = $_POST['DYN_DESCRIPTION'];
$aFields['VALIDATION_MESSAGE'] = G::LoadTranslation( 'ID_FILL_PRIMARY_KEYS' );
G::LoadClass('xmlfield_InputPM');
G::LoadClass( 'xmlfield_InputPM' );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_AssignVariables', '', $aFields,
SYS_URI . 'dynaforms/dynaforms_Save');
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_AssignVariables', '', $aFields, SYS_URI . 'dynaforms/dynaforms_Save' );
G::RenderPage('publish-raw', 'raw');
G::RenderPage( 'publish-raw', 'raw' );

View File

@@ -6,4 +6,4 @@
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_ChoseType', '', $aFields , SYS_URI.'dynaforms/dynaforms_Edit');
G::RenderPage( "publish-raw" , "raw" );
?>

View File

@@ -12,167 +12,167 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
require_once('classes/model/Dynaform.php');
require_once ('classes/model/Dynaform.php');
require_once 'classes/model/ObjectPermission.php';
require_once 'classes/model/Step.php';
require_once 'classes/model/StepSupervisor.php';
require_once 'classes/model/CaseTrackerObject.php';
/*
/*
In here we are deleting all datas about this Dynaform into DB
*/
if(isset($_POST['function']))
$sfunction =$_POST['function'];
else
$sfunction =$_POST['functions'];
switch($sfunction){
if (isset( $_POST['function'] )) {
$sfunction = $_POST['function'];
} else {
$sfunction = $_POST['functions'];
}
case 'getRelationInfDynaform':
$oStepSupervisor = new StepSupervisor();
$fields2=$oStepSupervisor->loadInfo($_POST['DYN_UID']);
$result=false;
if(is_array($fields2)){
$result=true;
}
return print $result;
break;
case 'getDynaformAssign':
$oStep = new Step();
$aDependent=$oStep->loadInfoAssigDynaform($_POST['PRO_UID'],$_POST['DYN_UID']);
$result=false;
if(is_array($aDependent)){
$result=true;
}
return print $result;
break;
case 'deleteDynaform':
$dynaform = new dynaform();
if (!isset($_POST['DYN_UID'])) return;
//in table dynaform
$dynaform->remove( $_POST['DYN_UID'] );
//in table Step
$oStep = new Step();
$oStep->removeStep('DYNAFORM', $_POST['DYN_UID']);
//in table ObjectPermission
$oOP = new ObjectPermission();
$oOP->removeByObject('DYNAFORM', $_POST['DYN_UID']);
//in table Step_supervisor
$oSS = new StepSupervisor();
$oSS->removeByObject('DYNAFORM', $_POST['DYN_UID']);
//in table case_tracker_object
$oCTO = new CaseTrackerObject();
$oCTO->removeByObject('DYNAFORM', $_POST['DYN_UID']);
break;
/** erik: new and improved methods */
case 'getDynaformSupervisorRelations':
try {
$oStepSupervisor = new StepSupervisor();
$DYN_UIDS = explode(',', $_POST['DYN_UID']);
$result->passed = true;
foreach($DYN_UIDS as $i=>$DYN_UID) {
$relationsList = $oStepSupervisor->loadInfo($DYN_UID);
if( is_array($relationsList) ) {
$result->passed = false;
break;
switch ($sfunction) {
case 'getRelationInfDynaform':
$oStepSupervisor = new StepSupervisor();
$fields2 = $oStepSupervisor->loadInfo( $_POST['DYN_UID'] );
$result = false;
if (is_array( $fields2 )) {
$result = true;
}
}
$result->success = true;
$result->msg = $result->passed ? '' : G::LoadTranslation('ID_DYNAFORM_SUPERVISOR_RELATION_EXISTS');
} catch (Exception $e) {
$result->success = false;
$result->passed = false;
$result->msg = $e->getMessage();
}
print G::json_encode($result);
break;
case 'getDynaformTaskRelations':
try {
$oStepSupervisor = new StepSupervisor();
$DYN_UIDS = explode(',', $_POST['DYN_UID']);
$results = Array();
$result->passed = true;
foreach($DYN_UIDS as $i=>$DYN_UID) {
return print $result;
break;
case 'getDynaformAssign':
$oStep = new Step();
$aDependent = $oStep->loadInfoAssigDynaform($_POST['PRO_UID'], $DYN_UID);
if( is_array($aDependent) ) {
$result->passed = false;
break;
$aDependent = $oStep->loadInfoAssigDynaform( $_POST['PRO_UID'], $_POST['DYN_UID'] );
$result = false;
if (is_array( $aDependent )) {
$result = true;
}
}
$result->success = true;
$result->msg = $result->passed ? '' : G::LoadTranslation('ID_DYNAFORM_TASK_RELATION_EXISTS');
} catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
}
return print $result;
break;
case 'deleteDynaform':
$dynaform = new dynaform();
print G::json_encode($result);
break;
if (! isset( $_POST['DYN_UID'] )) {
return;
}
//in table dynaform
$dynaform->remove( $_POST['DYN_UID'] );
case 'removeDynaform':
try {
if ( ! isset($_POST['DYN_UID']) )
throw new Exception('DYN_UID was not set!');
//in table Step
$oStep = new Step();
$oStep->removeStep( 'DYNAFORM', $_POST['DYN_UID'] );
$DYN_UIDS = explode(',', $_POST['DYN_UID']);
//in table ObjectPermission
$oOP = new ObjectPermission();
$oOP->removeByObject( 'DYNAFORM', $_POST['DYN_UID'] );
foreach($DYN_UIDS as $i=>$DYN_UID) {
$dynaform = new dynaform();
//in table dynaform
$dynaform->remove( $DYN_UID );
//in table Step_supervisor
$oSS = new StepSupervisor();
$oSS->removeByObject( 'DYNAFORM', $_POST['DYN_UID'] );
//in table Step
$oStep = new Step();
$oStep->removeStep('DYNAFORM', $DYN_UID);
//in table case_tracker_object
$oCTO = new CaseTrackerObject();
$oCTO->removeByObject( 'DYNAFORM', $_POST['DYN_UID'] );
break;
//in table ObjectPermission
$oOP = new ObjectPermission();
$oOP->removeByObject('DYNAFORM', $DYN_UID);
/**
* erik: new and improved methods
*/
case 'getDynaformSupervisorRelations':
try {
$oStepSupervisor = new StepSupervisor();
$DYN_UIDS = explode( ',', $_POST['DYN_UID'] );
//in table Step_supervisor
$oSS = new StepSupervisor();
$oSS->removeByObject('DYNAFORM', $DYN_UID);
$result->passed = true;
foreach ($DYN_UIDS as $i => $DYN_UID) {
$relationsList = $oStepSupervisor->loadInfo( $DYN_UID );
if (is_array( $relationsList )) {
$result->passed = false;
break;
}
}
//in table case_tracker_object
$oCTO = new CaseTrackerObject();
$oCTO->removeByObject('DYNAFORM', $DYN_UID);
}
$result->success = true;
$result->msg = G::LoadTranslation('ID_DYNAFORM_REMOVED');
} catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
}
$result->success = true;
$result->msg = $result->passed ? '' : G::LoadTranslation( 'ID_DYNAFORM_SUPERVISOR_RELATION_EXISTS' );
} catch (Exception $e) {
$result->success = false;
$result->passed = false;
$result->msg = $e->getMessage();
}
print G::json_encode( $result );
break;
case 'getDynaformTaskRelations':
try {
$oStepSupervisor = new StepSupervisor();
$DYN_UIDS = explode( ',', $_POST['DYN_UID'] );
$results = Array ();
$result->passed = true;
foreach ($DYN_UIDS as $i => $DYN_UID) {
$oStep = new Step();
$aDependent = $oStep->loadInfoAssigDynaform( $_POST['PRO_UID'], $DYN_UID );
if (is_array( $aDependent )) {
$result->passed = false;
break;
}
}
$result->success = true;
$result->msg = $result->passed ? '' : G::LoadTranslation( 'ID_DYNAFORM_TASK_RELATION_EXISTS' );
} catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
}
print G::json_encode( $result );
break;
case 'removeDynaform':
try {
if (! isset( $_POST['DYN_UID'] )) {
throw new Exception( 'DYN_UID was not set!' );
}
$DYN_UIDS = explode( ',', $_POST['DYN_UID'] );
foreach ($DYN_UIDS as $i => $DYN_UID) {
$dynaform = new dynaform();
//in table dynaform
$dynaform->remove( $DYN_UID );
//in table Step
$oStep = new Step();
$oStep->removeStep( 'DYNAFORM', $DYN_UID );
//in table ObjectPermission
$oOP = new ObjectPermission();
$oOP->removeByObject( 'DYNAFORM', $DYN_UID );
//in table Step_supervisor
$oSS = new StepSupervisor();
$oSS->removeByObject( 'DYNAFORM', $DYN_UID );
//in table case_tracker_object
$oCTO = new CaseTrackerObject();
$oCTO->removeByObject( 'DYNAFORM', $DYN_UID );
}
$result->success = true;
$result->msg = G::LoadTranslation( 'ID_DYNAFORM_REMOVED' );
} catch (Exception $e) {
$result->success = false;
$result->msg = $e->getMessage();
}
print G::json_encode( $result );
break;
}
print G::json_encode($result);
break;
}

View File

@@ -1,10 +1,10 @@
<?php
/**
* dynaforms_Edit.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* 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
@@ -12,63 +12,60 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
require_once('classes/model/Dynaform.php');
require_once('classes/model/AdditionalTables.php');
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID);
$oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME);
$oCriteria->add(AdditionalTablesPeer::ADD_TAB_UID, '', Criteria::NOT_EQUAL);
require_once ('classes/model/Dynaform.php');
require_once ('classes/model/AdditionalTables.php');
$oDataset = AdditionalTablesPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( AdditionalTablesPeer::ADD_TAB_UID );
$oCriteria->addSelectColumn( AdditionalTablesPeer::ADD_TAB_NAME );
$oCriteria->add( AdditionalTablesPeer::ADD_TAB_UID, '', Criteria::NOT_EQUAL );
$aTablesList = Array();
array_push($aTablesList, array('ADD_TAB_UID'=>'','ADD_TAB_NAME'=>'----------------'));
while ( $oDataset->next() ) {
array_push($aTablesList, $oDataset->getRow());
}
$oDataset = AdditionalTablesPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$filedNames = Array (
"ADD_TAB_UID",
"ADD_TAB_NAME",
);
$aTablesList = Array ();
array_push( $aTablesList, array ('ADD_TAB_UID' => '','ADD_TAB_NAME' => '----------------') );
while ($oDataset->next()) {
array_push( $aTablesList, $oDataset->getRow() );
}
$aTablesList = array_merge(Array($filedNames), $aTablesList);
$filedNames = Array ("ADD_TAB_UID","ADD_TAB_NAME");
$_DBArray ['ADDITIONAL_TABLES'] = $aTablesList;
$_SESSION['_DBArray'] = $_DBArray;
$aTablesList = array_merge( Array ($filedNames), $aTablesList );
$dynUid=(isset($_GET['DYN_UID'])) ? urldecode($_GET['DYN_UID']):'';
$dynaform = new dynaform();
if ($dynUid=='')
{
$aFields['DYN_UID']= $dynUid ;
}
else
{
$aFields=$dynaform->load( $dynUid );
}
$aFields['PRO_UID'] = isset($dynaform->Fields['PRO_UID'])?$dynaform->Fields['PRO_UID']:$_GET['PRO_UID'];
$_DBArray['ADDITIONAL_TABLES'] = $aTablesList;
$_SESSION['_DBArray'] = $_DBArray;
$dynUid = (isset( $_GET['DYN_UID'] )) ? urldecode( $_GET['DYN_UID'] ) : '';
$dynaform = new dynaform();
if ($dynUid == '') {
$aFields['DYN_UID'] = $dynUid;
} else {
$aFields = $dynaform->load( $dynUid );
}
$aFields['PRO_UID'] = isset( $dynaform->Fields['PRO_UID'] ) ? $dynaform->Fields['PRO_UID'] : $_GET['PRO_UID'];
$aFields['ACTION'] = isset( $_GET['ACTION'] ) ? $_GET['ACTION'] : '';
//$aFields['READ_ONLY'] = ($_GET['ACTION']=='normal')?0:1;
G::LoadClass( 'xmlfield_InputPM' );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_Edit', '', $aFields, SYS_URI . 'dynaforms/dynaforms_Save' );
G::RenderPage( "publish-raw", "raw" );
$aFields['ACTION'] = isset($_GET['ACTION'])?$_GET['ACTION']:'';
//$aFields['READ_ONLY'] = ($_GET['ACTION']=='normal')?0:1;
G::LoadClass('xmlfield_InputPM');
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Edit', '', $aFields , SYS_URI.'dynaforms/dynaforms_Save');
G::RenderPage( "publish-raw" , "raw" );

View File

@@ -1,10 +1,10 @@
<?php
/**
* dynaforms_FlatEditor.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* 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
@@ -12,126 +12,108 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
G::LoadClass('toolBar');
G::LoadClass('dynaFormField');
G::LoadClass('process');
G::LoadClass('dynaform');
//G::LoadClass('configuration');
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'processes';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'FIELDS';
G::LoadClass( 'toolBar' );
G::LoadClass( 'dynaFormField' );
G::LoadClass( 'process' );
G::LoadClass( 'dynaform' );
//G::LoadClass('configuration');
$dbc = new DBConnection();
$ses = new DBSession($dbc);
//Hardcode: UID of the library by default
$PRO_UID=isset($_POST['PRO_UID'])?$_POST['PRO_UID']:'746B734DC23311';
$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'] );
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'processes';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'FIELDS';
if (isset($_POST['DYN_UID']) && ($_POST['DYN_UID']!==''))
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
//Hardcode: UID of the library by default
$PRO_UID = isset( $_POST['PRO_UID'] ) ? $_POST['PRO_UID'] : '746B734DC23311';
$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'] );
if (isset( $_POST['DYN_UID'] ) && ($_POST['DYN_UID'] !== '')) {
$file = $dynaform->Fields['DYN_FILENAME'];
else
//Hardcode: Sample of xmlform.
} else {
//Hardcode: Sample of xmlform.
$file = $PRO_UID . '/' . 'myInfo';
}
/* Start Comment: If file doesn't exist, it is created */
if (!file_exists( PATH_DYNAFORM . $file . '.xml' )) {
/* Start Comment: If file doesn't exist, it is created */
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' );
$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 */
}
/* End Comment */
/* Start Comment: Create and temporal copy. */
$copy = implode('',file(PATH_DYNAFORM . $file . '.xml'));
$file.='_tmp0';
$fcopy=fopen(PATH_DYNAFORM . $file . '.xml',"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']);
$copy = implode( '', file( PATH_DYNAFORM . $file . '.xml' ) );
$file .= '_tmp0';
$fcopy = fopen( PATH_DYNAFORM . $file . '.xml', "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'] );
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'];
$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()
);
$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 )
);
/* Block : Loads the Editor configuration */
$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]"))',
'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,
)
);
/*$configuration = new Configuration($dbc);
$openDoc = new Xml_Document();
$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 )
);
$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]"))',
'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]"))',
'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
)
);
/*$configuration = new Configuration($dbc);
$configuration->load( array('CFG_UID'=>'DynaformEditor') );
if ($configuration->is_new) {
$config = $defaultConfig;
@@ -142,52 +124,44 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons
$config = unserialize( $configuration->Fields['CFG_VALUE'] );
$config = G::array_merges( $defaultConfig , $config );
}*/
$config=$defaultConfig;
/* End Block */
$G_PUBLISH = new Publisher;
$G_PUBLISH->publisherId='dynaformEditor';
$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');
$config = $defaultConfig;
/* End Block */
$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'] );
$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 = new Publisher();
$G_PUBLISH->publisherId = 'dynaformEditor';
$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' );
$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'] );
$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('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::RenderPage( "publish", "raw" );
$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" );
?>
<script>
@@ -211,7 +185,6 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons
}
resizeXmlEditor();
function toolbarWindow ( title , element, x, y, width, height, callbackFn ) {
var myPanel = new leimnud.module.panel();
myPanel.options = {
@@ -237,4 +210,4 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons
myPanel.addContent(element);
return myPanel;
}
</script>
</script>

View File

@@ -1,10 +1,10 @@
<?php
/**
* dynaforms_List.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* 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
@@ -12,35 +12,36 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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) return $RBAC_Response;
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
}
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'processes';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'DYNAFORMS';
$dbc = new DBConnection();
$ses = new DBSession($dbc);
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'processes';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'DYNAFORMS';
//Hardcode: UID of the library by default
$PRO_UID='746B734DC23311';
$Fields['PRO_UID'] = $PRO_UID;
$Fields['SYS_LANG'] = SYS_LANG;
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/dynaforms_List', '', $Fields , 'dynaforms_Save');
G::RenderPage( "publish" );
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
//Hardcode: UID of the library by default
$PRO_UID = '746B734DC23311';
$Fields['PRO_UID'] = $PRO_UID;
$Fields['SYS_LANG'] = SYS_LANG;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'pagedtable', 'paged-table', 'dynaforms/dynaforms_List', '', $Fields, 'dynaforms_Save' );
G::RenderPage( "publish" );
?>

View File

@@ -1,10 +1,10 @@
<?php
/**
* dynaforms_Edit.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* 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
@@ -12,56 +12,57 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
//call plugin
// $oPluginRegistry = &PMPluginRegistry::getSingleton();
// $existsDynaforms = $oPluginRegistry->existsTrigger(PM_NEW_DYNAFORM_LIST );
//call plugin
// $oPluginRegistry = &PMPluginRegistry::getSingleton();
// $existsDynaforms = $oPluginRegistry->existsTrigger(PM_NEW_DYNAFORM_LIST );
//for now, we are going with the default list, because the plugin is not complete
include ('dynaforms_Edit.php');
die;
die();
//---*****************
if ( !$existsDynaforms ) {
include ('dynaforms_Edit.php');
die;
}
print "Existe";
print (class_exists('folderData'));
die;
//end plugin
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
if (! $existsDynaforms) {
include ('dynaforms_Edit.php');
die();
}
print "Existe";
print (class_exists( 'folderData' )) ;
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin =n 'login/login' );
die();
//end plugin
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
require_once('classes/model/Dynaform.php');
$dynUid=(isset($_GET['DYN_UID'])) ? urldecode($_GET['DYN_UID']):'';
$dynaform = new dynaform();
if ($dynUid=='')
{
$aFields['DYN_UID']= $dynUid ;
}
else
{
$aFields=$dynaform->load( $dynUid );
}
$aFields['PRO_UID'] = isset($dynaform->Fields['PRO_UID'])?$dynaform->Fields['PRO_UID']:$_GET['PRO_UID'];
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin =n 'login/login' );
require_once ('classes/model/Dynaform.php');
$dynUid = (isset( $_GET['DYN_UID'] )) ? urldecode( $_GET['DYN_UID'] ) : '';
$dynaform = new dynaform();
if ($dynUid == '') {
$aFields['DYN_UID'] = $dynUid;
} else {
$aFields = $dynaform->load( $dynUid );
}
$aFields['PRO_UID'] = isset( $dynaform->Fields['PRO_UID'] ) ? $dynaform->Fields['PRO_UID'] : $_GET['PRO_UID'];
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_Edit', '', $aFields, SYS_URI . 'dynaforms/dynaforms_Save' );
G::RenderPage( "publish-raw", "raw" );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Edit', '', $aFields , SYS_URI.'dynaforms/dynaforms_Save');
G::RenderPage( "publish-raw" , "raw" );
?>

View File

@@ -1,10 +1,10 @@
<?php
/**
* dynaforms_PagedTableAjax.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* 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
@@ -12,114 +12,129 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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) return $RBAC_Response;
function pagedTable_BeforeQuery(&$ntable)
{
$file = G::decrypt( $ntable->xmlForm->values['URL'] , URL_KEY );
/* Start Block: Defines the virtual XMLDB*/
G::LoadClass('xmlDb');
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');
/* End Block*/
}
require_once(PATH_GULLIVER_HOME.'methods/pagedTableAjax.php');
die;
G::LoadSystem('pagedTable');
G::LoadInclude('ajax');
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
$id=get_ajax_value('ptID');
$ntable= unserialize($_SESSION['pagedTable['.$id.']']);
$page=get_ajax_value('page');
$function=get_ajax_value('function');
function pagedTable_BeforeQuery (&$ntable)
{
$file = G::decrypt( $ntable->xmlForm->values['URL'], URL_KEY );
/* Start Block: Defines the virtual XMLDB*/
G::LoadClass( 'xmlDb' );
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' );
/* End Block*/
}
require_once (PATH_GULLIVER_HOME . 'methods/pagedTableAjax.php');
die();
G::LoadSystem( 'pagedTable' );
G::LoadInclude( 'ajax' );
if (isset($ntable->filterForm_Id) && ($ntable->filterForm_Id!=='')) {
$filterForm=new filterForm(G::getUIDName( $ntable->filterForm_Id ));
$filterForm->values=$_SESSION[$filterForm->id];
parse_str( urldecode(get_ajax_value('filter')) , $newValues);
if (isset($newValues['form'])) {
$filterForm->setValues($newValues['form']);
$filter = array();
foreach($filterForm->fields as $fieldName => $field ){
if (($field->dataCompareField!=='') && (isset($newValues['form'][$fieldName])))
$filter[$field->dataCompareField] = $filterForm->values[$fieldName];
$ntable->filterType[$field->dataCompareField] = $field->dataCompareType;
}
$ntable->filter = $filter;//G::http_build_query($filter);
$id = get_ajax_value( 'ptID' );
$ntable = unserialize( $_SESSION['pagedTable[' . $id . ']'] );
$page = get_ajax_value( 'page' );
$function = get_ajax_value( 'function' );
if (isset( $ntable->filterForm_Id ) && ($ntable->filterForm_Id !== '')) {
$filterForm = new filterForm( G::getUIDName( $ntable->filterForm_Id ) );
$filterForm->values = $_SESSION[$filterForm->id];
parse_str( urldecode( get_ajax_value( 'filter' ) ), $newValues );
if (isset( $newValues['form'] )) {
$filterForm->setValues( $newValues['form'] );
$filter = array ();
foreach ($filterForm->fields as $fieldName => $field) {
if (($field->dataCompareField !== '') && (isset( $newValues['form'][$fieldName] ))) {
$filter[$field->dataCompareField] = $filterForm->values[$fieldName];
}
$ntable->filterType[$field->dataCompareField] = $field->dataCompareType;
}
$ntable->filter = $filter; //G::http_build_query($filter);
}
}
$fastSearch=get_ajax_value('fastSearch');
if (isset($fastSearch)) $ntable->fastSearch= urldecode($fastSearch);
$orderBy=get_ajax_value('order');
if (isset($orderBy)) {
$orderBy=urldecode($orderBy);
$ntable->orderBy=$orderBy;
}
if (isset($page) && $page!=='') $ntable->currentPage=(int) $page;
}
$fastSearch = get_ajax_value( 'fastSearch' );
if (isset( $fastSearch )) {
$ntable->fastSearch = urldecode( $fastSearch );
}
$orderBy = get_ajax_value( 'order' );
if (isset( $orderBy )) {
$orderBy = urldecode( $orderBy );
$ntable->orderBy = $orderBy;
}
if (isset( $page ) && $page !== '') {
$ntable->currentPage = (int) $page;
}
$file = G::decrypt( $ntable->xmlForm->values['URL'] , URL_KEY );
/* Start Block: Defines the virtual XMLDB*/
G::LoadClass('xmlDb');
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');
/* End Block*/
$file = G::decrypt( $ntable->xmlForm->values['URL'], URL_KEY );
/* Start Block: Defines the virtual XMLDB*/
G::LoadClass( 'xmlDb' );
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' );
/* End Block*/
$ntable->prepareQuery();
switch ($function) {
case "showHideField":
$field = get_ajax_value( 'field' );
$ntable->style[$field]['showInTable'] = ($ntable->style[$field]['showInTable'] === '0') ? '1' : '0';
break;
case "paint":
break;
case "delete":
$ntable->prepareQuery();
parse_str( get_ajax_value( 'field' ), $field );
foreach ($field as $key => $value) {
$field[$key] = urldecode( $value );
}
$ntable->ses->execute( $ntable->replaceDataField( $ntable->sqlDelete, $field ) );
break;
case "update":
$ntable->prepareQuery();
parse_str( get_ajax_value( 'field' ), $field );
foreach ($field as $key => $value) {
$field[$key] = urldecode( $value );
}
parse_str( get_ajax_value( 'update' ), $fieldup );
foreach ($fieldup as $key => $value) {
$field['new' . $key] = urldecode( $value ); //join
}
$ntable->ses->execute( $ntable->replaceDataField( $ntable->sqlUpdate, $field ) );
break;
case "insert":
$ntable->prepareQuery();
parse_str( get_ajax_value( 'field' ), $field );
foreach ($field as $key => $value) {
$field[$key] = urldecode( $value );
}
$ntable->ses->execute( $ntable->replaceDataField( $ntable->sqlInsert, $field ) );
break;
case "printForm":
parse_str( get_ajax_value( 'field' ), $field );
parse_str( get_ajax_value( 'field' ), $field );
foreach ($field as $key => $value) {
$field[$key] = urldecode( $value );
}
$ntable->printForm( get_ajax_value( 'filename' ), $field );
return;
}
$ntable->renderTable( 'content' );
G::LoadClass( 'configuration' );
$dbc = new DBConnection();
$conf = new Configuration( $dbc, $ntable );
$conf->setConfig( $ntable->__Configuration, $ntable, $conf->aConfig );
$conf->saveConfig( 'pagedTable', $ntable->__OBJ_UID, '', $_SESSION['USER_LOGGED'], '' );
$ntable->prepareQuery();
switch ($function)
{
case "showHideField":
$field=get_ajax_value('field');
$ntable->style[$field]['showInTable']=
($ntable->style[$field]['showInTable']==='0')?'1':'0';
break;
case "paint":
break;
case "delete":
$ntable->prepareQuery();
parse_str(get_ajax_value('field'),$field);
foreach($field as $key => $value) $field[$key]=urldecode($value);
$ntable->ses->execute($ntable->replaceDataField($ntable->sqlDelete,$field));
break;
case "update":
$ntable->prepareQuery();
parse_str(get_ajax_value('field'),$field);
foreach($field as $key => $value) $field[$key]=urldecode($value);
parse_str(get_ajax_value('update'),$fieldup);
foreach($fieldup as $key => $value) $field['new'.$key]=urldecode($value); //join
$ntable->ses->execute($ntable->replaceDataField($ntable->sqlUpdate,$field));
break;
case "insert":
$ntable->prepareQuery();
parse_str(get_ajax_value('field'),$field);
foreach($field as $key => $value) $field[$key]=urldecode($value);
$ntable->ses->execute($ntable->replaceDataField($ntable->sqlInsert,$field));
break;
case "printForm":
parse_str(get_ajax_value('field'),$field);
parse_str(get_ajax_value('field'),$field);
foreach($field as $key => $value) $field[$key]=urldecode($value);
$ntable->printForm(get_ajax_value('filename'),$field);
return ;
}
$ntable->renderTable( 'content' );
G::LoadClass('configuration');
$dbc = new DBConnection();
$conf = new Configuration( $dbc , $ntable );
$conf->setConfig($ntable->__Configuration,$ntable,$conf->aConfig);
$conf->saveConfig('pagedTable',$ntable->__OBJ_UID,'',$_SESSION['USER_LOGGED'],'');
?>

View File

@@ -1,10 +1,10 @@
<?php
/**
* dynaforms_Preview.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* 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
@@ -12,55 +12,50 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
G::LoadClass('toolBar');
G::LoadClass('dynaFormField');
if (!(isset($_POST['A']) && $_POST['A']!=='')) return;
$file = G::decrypt( $_POST['A'] , URL_KEY );
$G_PUBLISH = new Publisher;
$form = new Form( $file , PATH_DYNAFORM, SYS_LANG, true );
switch(basename($form->template,'.html'))
{
case 'grid': $template='grid';break;
default: $template='xmlform';
}
$G_PUBLISH->AddContent('dynaform', $template , $file, '',
array(
'__DYNAFORM_OPTIONS'=> array(
'PREVIOUS_STEP' => '#',
'NEXT_STEP' => '#',
'PREVIOUS_ACTION' => 'return false;',
'NEXT_ACTION' => 'return false;'
)
), '');
G::RenderPage('publish','raw');
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
/* $toolbar = new ToolBar( '/dynaforms/dynaforms_Toolbar' , PATH_XMLFORM, SYS_LANG, false );
G::LoadClass( 'toolBar' );
G::LoadClass( 'dynaFormField' );
if (! (isset( $_POST['A'] ) && $_POST['A'] !== '')) {
return;
}
$file = G::decrypt( $_POST['A'], URL_KEY );
$G_PUBLISH = new Publisher();
$form = new Form( $file, PATH_DYNAFORM, SYS_LANG, true );
switch (basename( $form->template, '.html' )) {
case 'grid':
$template = 'grid';
break;
default:
$template = 'xmlform';
}
$G_PUBLISH->AddContent( 'dynaform', $template, $file, '', array ('__DYNAFORM_OPTIONS' => array ('PREVIOUS_STEP' => '#','NEXT_STEP' => '#','PREVIOUS_ACTION' => 'return false;','NEXT_ACTION' => 'return false;'
)
), '' );
G::RenderPage( 'publish', 'raw' );
/* $toolbar = new ToolBar( '/dynaforms/dynaforms_Toolbar' , PATH_XMLFORM, SYS_LANG, false );
print($toolbar->render( $toolbar->template , $script ));*/
//$form = new Form( $file , PATH_DYNAFORM, SYS_LANG, true );
//print($form->render( $form->template , $script ));
//$form = new Form( $file , PATH_DYNAFORM, SYS_LANG, true );
//print($form->render( $form->template , $script ));
?>

View File

@@ -12,101 +12,99 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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) return $RBAC_Response;
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
require_once('classes/model/Dynaform.php');
require_once('classes/model/Content.php');
$oJSON = new Services_JSON();
require_once ('classes/model/Dynaform.php');
require_once ('classes/model/Content.php');
if( isset($_POST['function']) )
$oJSON = new Services_JSON();
if (isset( $_POST['function'] )) {
$sfunction = $_POST['function'];
else if( isset($_POST['functions']) )
} elseif (isset( $_POST['functions'] )) {
$sfunction = $_POST['functions'];
}
if( isset($sfunction) && $sfunction == 'lookforNameDynaform' ) {
$snameDyanform = urldecode($_POST['NAMEDYNAFORM']);
$sPRO_UID = urldecode($_POST['proUid']);
if (isset( $sfunction ) && $sfunction == 'lookforNameDynaform') {
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn ( DynaformPeer::DYN_UID );
$oCriteria->add(DynaformPeer::PRO_UID, $sPRO_UID);
$oDataset = DynaformPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$snameDyanform = urldecode( $_POST['NAMEDYNAFORM'] );
$sPRO_UID = urldecode( $_POST['proUid'] );
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( DynaformPeer::DYN_UID );
$oCriteria->add( DynaformPeer::PRO_UID, $sPRO_UID );
$oDataset = DynaformPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$flag = true;
while ($oDataset->next() && $flag) {
$aRow = $oDataset->getRow();
$aRow = $oDataset->getRow();
$oCriteria1 = new Criteria('workflow');
$oCriteria1->addSelectColumn('COUNT(*) AS DYNAFORMS');
$oCriteria1->add(ContentPeer::CON_CATEGORY, 'DYN_TITLE');
$oCriteria1->add(ContentPeer::CON_ID, $aRow['DYN_UID']);
$oCriteria1->add(ContentPeer::CON_VALUE, $snameDyanform);
$oCriteria1->add(ContentPeer::CON_LANG, SYS_LANG);
$oDataset1 = ContentPeer::doSelectRS($oCriteria1);
$oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset1->next();
$aRow1 = $oDataset1->getRow();
$oCriteria1 = new Criteria( 'workflow' );
$oCriteria1->addSelectColumn( 'COUNT(*) AS DYNAFORMS' );
$oCriteria1->add( ContentPeer::CON_CATEGORY, 'DYN_TITLE' );
$oCriteria1->add( ContentPeer::CON_ID, $aRow['DYN_UID'] );
$oCriteria1->add( ContentPeer::CON_VALUE, $snameDyanform );
$oCriteria1->add( ContentPeer::CON_LANG, SYS_LANG );
$oDataset1 = ContentPeer::doSelectRS( $oCriteria1 );
$oDataset1->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset1->next();
$aRow1 = $oDataset1->getRow();
if( $aRow1['DYNAFORMS'] )
$flag = false;
if ($aRow1['DYNAFORMS']) {
$flag = false;
}
}
print $flag;
} else {
$dynaform = new dynaform();
if(isset($_POST['form']))
{
$aData = $_POST['form']; //For old process map form
if ($aData['DYN_UID']==='')
unset($aData['DYN_UID']);
}
else
{
$aData = $_POST; //For Extjs (Since we are not using form in ExtJS)
$aFields = array();
$aVariables = array();
if(isset($aData['FIELDS']))
{
$aFields = G::json_decode($_POST['FIELDS']);
$aVariables = G::json_decode($_POST['VARIABLES']);
}
$aData['FIELDS'] = array();
for($i=0;$i<count($aFields);$i++){
$aData['FIELDS'][$i+1]['FLD_NAME'] = $aFields[$i];
$aData['FIELDS'][$i+1]['PRO_VARIABLE'] = $aVariables[$i];
}
}
//if ($aData['DYN_UID']==='') unset($aData['DYN_UID']);
if (isset($aData['DYN_UID']))
{
$dynaform->Save( $aData );
}
else
{
if (!isset($aData['ADD_TABLE'])||$aData['ADD_TABLE']==""){
$aFields=$dynaform->create( $aData );
} else {
$aFields=$dynaform->createFromPMTable( $aData, $aData['ADD_TABLE']);
} else {
$dynaform = new dynaform();
if (isset( $_POST['form'] )) {
$aData = $_POST['form']; //For old process map form
if ($aData['DYN_UID'] === '') {
unset( $aData['DYN_UID'] );
}
$aData['DYN_UID']=$dynaform->getDynUid();
} else {
$aData = $_POST; //For Extjs (Since we are not using form in ExtJS)
$aFields = array ();
$aVariables = array ();
if (isset( $aData['FIELDS'] )) {
$aFields = G::json_decode( $_POST['FIELDS'] );
$aVariables = G::json_decode( $_POST['VARIABLES'] );
}
$aData['FIELDS'] = array ();
for ($i = 0; $i < count( $aFields ); $i ++) {
$aData['FIELDS'][$i + 1]['FLD_NAME'] = $aFields[$i];
$aData['FIELDS'][$i + 1]['PRO_VARIABLE'] = $aVariables[$i];
}
}
//if ($aData['DYN_UID']==='') unset($aData['DYN_UID']);
if (isset( $aData['DYN_UID'] )) {
$dynaform->Save( $aData );
} else {
if (! isset( $aData['ADD_TABLE'] ) || $aData['ADD_TABLE'] == "") {
$aFields = $dynaform->create( $aData );
} else {
$aFields = $dynaform->createFromPMTable( $aData, $aData['ADD_TABLE'] );
}
$aData['DYN_UID'] = $dynaform->getDynUid();
$dynaform->update( $aData );
}
echo $dynaform->getDynUid();
}
?>
}
echo $dynaform->getDynUid();
}

View File

@@ -1,10 +1,10 @@
<?php
/**
* dynaforms_SaveProperties.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* 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
@@ -12,44 +12,53 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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) return $RBAC_Response;
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
G::LoadInclude('ajax');
G::LoadClass('dynaform');
G::LoadClass('xmlDb');
$dbc = new DBConnection();
$ses = new DBSession($dbc);
//$dynaform = new dynaform( $dbc );
if ($_POST['form']['DYN_UID']==='') unset($_POST['form']['DYN_UID']);
$Fields = $_POST['form'];
if (!isset($Fields['DYN_UID'])) return;
$file = G::decrypt( $Fields['A'] , URL_KEY );
$Fields['DYN_FILENAME'] = (strcasecmp(substr($file,-5),'_tmp0')==0)? substr($file,0,strlen($file)-5) : $file;
$_SESSION['CURRENT_DYNAFORM']=$Fields;
//$dynaform->Save( $Fields );
$dbc2 = new DBConnection( PATH_DYNAFORM . $file . '.xml' ,'','','','myxml' );
$ses2 = new DBSession($dbc2);
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
}
if (!isset($Fields['ENABLETEMPLATE'])) $Fields['ENABLETEMPLATE'] ="0";
$ses2->execute(G::replaceDataField("UPDATE . SET WIDTH = @@WIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields));
$ses2->execute(G::replaceDataField("UPDATE . SET ENABLETEMPLATE = @@ENABLETEMPLATE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields));
$ses2->execute(G::replaceDataField("UPDATE . SET MODE = @@MODE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields));
?>
G::LoadInclude( 'ajax' );
G::LoadClass( 'dynaform' );
G::LoadClass( 'xmlDb' );
$dbc = new DBConnection();
$ses = new DBSession( $dbc );
//$dynaform = new dynaform( $dbc );
if ($_POST['form']['DYN_UID'] === '') {
unset( $_POST['form']['DYN_UID'] );
}
$Fields = $_POST['form'];
if (! isset( $Fields['DYN_UID'] )) {
return;
}
$file = G::decrypt( $Fields['A'], URL_KEY );
$Fields['DYN_FILENAME'] = (strcasecmp( substr( $file, - 5 ), '_tmp0' ) == 0) ? substr( $file, 0, strlen( $file ) - 5 ) : $file;
$_SESSION['CURRENT_DYNAFORM'] = $Fields;
//$dynaform->Save( $Fields );
$dbc2 = new DBConnection( PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml' );
$ses2 = new DBSession( $dbc2 );
if (! isset( $Fields['ENABLETEMPLATE'] )) {
$Fields['ENABLETEMPLATE'] = "0";
}
$ses2->execute( G::replaceDataField( "UPDATE . SET WIDTH = @@WIDTH WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) );
$ses2->execute( G::replaceDataField( "UPDATE . SET ENABLETEMPLATE = @@ENABLETEMPLATE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) );
$ses2->execute( G::replaceDataField( "UPDATE . SET MODE = @@MODE WHERE XMLNODE_NAME = 'dynaForm' ", $Fields ) );

View File

@@ -1,109 +1,106 @@
<?php
/**
* dynaforms_Save_as.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* 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
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* 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.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/*
* dynaforms_Save_as.php
* script that handles the save-as functionality of a dynaform
* replicates the dynaform structure and content physical and in DB
* also handles the complete copy of field-events related and
* the html template if its required too.
*/
require_once('classes/model/Dynaform.php');
if (!class_exists("FieldCondition")){
require_once "classes/model/FieldCondition.php";
}
try
{
$con = Propel::getConnection( DynaformPeer::DATABASE_NAME );
$frm=$_POST['form'];
$PRO_UID=$frm['PRO_UID'];
$DYN_UID=$frm['DYN_UID'];
$DYN_TYPE=$frm['DYN_TYPE'];
// checks if there are conditions attached to the dynaform
$oFieldCondition = new FieldCondition();
$aConditions = $oFieldCondition->getAllByDynUid($DYN_UID);
$dynaform = new dynaform;
/*Save Register*/
$dynUid = ( G::generateUniqueID() );
$dynaform->setDynUid ( $dynUid );
$dynaform->setProUid ( $PRO_UID );
$dynaform->setDynType ( $DYN_TYPE );
$dynaform->setDynFilename ( $PRO_UID . PATH_SEP . $dynUid );
$con->begin();
$res = $dynaform->save();
$dynaform->setDynTitle ( $frm['DYN_TITLENEW'] );
$dynaform->setDynDescription ((!$frm['DYN_DESCRIPTIONNEW'])?'Default Dynaform Description':$frm['DYN_DESCRIPTIONNEW']);
//$con->commit();
$hd = fopen(PATH_DYNAFORM . $PRO_UID . '/' . $DYN_UID . '.xml',"r");
$hd1 = fopen (PATH_DYNAFORM . $PRO_UID . '/' . $dynUid . '.xml' ,"w");
$templateFilename = PATH_DYNAFORM . $PRO_UID . '/' . $DYN_UID . '.html';
// also make a copy of the template file in case that the html edition is enabled
if(file_exists($templateFilename)){
$templateHd = fopen($templateFilename,"r");
$templateHd1 = fopen(PATH_DYNAFORM . $PRO_UID . '/' . $dynUid . '.html' ,"w");
}
// also copy all the necessarily conditions if there are any
foreach ($aConditions as $condition){
$condition['FCD_UID'] = ( G::generateUniqueID() );
$condition['FCD_DYN_UID'] = $dynUid;
$oFieldCondition->quickSave($condition);
}
// checks if the physical dynaform file exists and copy the contents
if($hd){
while(!feof($hd)){
$line=fgets($hd,4096);
fwrite($hd1,str_replace($DYN_UID,$dynUid,$line));
}
}
fclose($hd);
fclose($hd1);
// check if the template file also exists
if(isset($templateHd)){
while(!feof($templateHd)){
$line=fgets($templateHd,4096);
fwrite($templateHd1,str_replace($DYN_UID,$dynUid,$line));
}
fclose($templateHd);
fclose($templateHd1);
}
}
catch(Exception $e)
{
return (array) $e;
}
?>
<?php
/**
* dynaforms_Save_as.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* 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
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* 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.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
/*
* dynaforms_Save_as.php
* script that handles the save-as functionality of a dynaform
* replicates the dynaform structure and content physical and in DB
* also handles the complete copy of field-events related and
* the html template if its required too.
*/
require_once ('classes/model/Dynaform.php');
if (! class_exists( "FieldCondition" )) {
require_once "classes/model/FieldCondition.php";
}
try {
$con = Propel::getConnection( DynaformPeer::DATABASE_NAME );
$frm = $_POST['form'];
$PRO_UID = $frm['PRO_UID'];
$DYN_UID = $frm['DYN_UID'];
$DYN_TYPE = $frm['DYN_TYPE'];
// checks if there are conditions attached to the dynaform
$oFieldCondition = new FieldCondition();
$aConditions = $oFieldCondition->getAllByDynUid( $DYN_UID );
$dynaform = new dynaform();
/*Save Register*/
$dynUid = (G::generateUniqueID());
$dynaform->setDynUid( $dynUid );
$dynaform->setProUid( $PRO_UID );
$dynaform->setDynType( $DYN_TYPE );
$dynaform->setDynFilename( $PRO_UID . PATH_SEP . $dynUid );
$con->begin();
$res = $dynaform->save();
$dynaform->setDynTitle( $frm['DYN_TITLENEW'] );
$dynaform->setDynDescription( (! $frm['DYN_DESCRIPTIONNEW']) ? 'Default Dynaform Description' : $frm['DYN_DESCRIPTIONNEW'] );
//$con->commit();
$hd = fopen( PATH_DYNAFORM . $PRO_UID . '/' . $DYN_UID . '.xml', "r" );
$hd1 = fopen( PATH_DYNAFORM . $PRO_UID . '/' . $dynUid . '.xml', "w" );
$templateFilename = PATH_DYNAFORM . $PRO_UID . '/' . $DYN_UID . '.html';
// also make a copy of the template file in case that the html edition is enabled
if (file_exists( $templateFilename )) {
$templateHd = fopen( $templateFilename, "r" );
$templateHd1 = fopen( PATH_DYNAFORM . $PRO_UID . '/' . $dynUid . '.html', "w" );
}
// also copy all the necessarily conditions if there are any
foreach ($aConditions as $condition) {
$condition['FCD_UID'] = (G::generateUniqueID());
$condition['FCD_DYN_UID'] = $dynUid;
$oFieldCondition->quickSave( $condition );
}
// checks if the physical dynaform file exists and copy the contents
if ($hd) {
while (! feof( $hd )) {
$line = fgets( $hd, 4096 );
fwrite( $hd1, str_replace( $DYN_UID, $dynUid, $line ) );
}
}
fclose( $hd );
fclose( $hd1 );
// check if the template file also exists
if (isset( $templateHd )) {
while (! feof( $templateHd )) {
$line = fgets( $templateHd, 4096 );
fwrite( $templateHd1, str_replace( $DYN_UID, $dynUid, $line ) );
}
fclose( $templateHd );
fclose( $templateHd1 );
}
} catch (Exception $e) {
return (array) $e;
}

View File

@@ -1,44 +1,47 @@
<?php
/**
* dynaforms_Saveas.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* 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
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* 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.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
require_once('classes/model/Dynaform.php');
$dynUid=(isset($_GET['DYN_UID'])) ? urldecode($_GET['DYN_UID']):'';
$dynaform = new dynaform();
$aFields=$dynaform->load( $dynUid );
//print_r($aFields);
//$aFields['PRO_UID'] = isset($dynaform->Fields['PRO_UID'])?$dynaform->Fields['PRO_UID']:$_GET['PRO_UID'];
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/dynaforms_Saveas', '', $aFields , SYS_URI.'dynaforms/dynaforms_Save_as');
G::RenderPage( "publish-raw" , "raw" );
<?php
/**
* dynaforms_Saveas.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* 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
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* 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.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
require_once ('classes/model/Dynaform.php');
$dynUid = (isset( $_GET['DYN_UID'] )) ? urldecode( $_GET['DYN_UID'] ) : '';
$dynaform = new dynaform();
$aFields = $dynaform->load( $dynUid );
//print_r($aFields);
//$aFields['PRO_UID'] = isset($dynaform->Fields['PRO_UID'])?$dynaform->Fields['PRO_UID']:$_GET['PRO_UID'];
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/dynaforms_Saveas', '', $aFields, SYS_URI . 'dynaforms/dynaforms_Save_as' );
G::RenderPage( "publish-raw", "raw" );

View File

@@ -1,34 +1,26 @@
<?php
/**
* evaluates the dynaform type and other parameters in order to
* render the correct toolbar in each case
*
* @author gustavo cruz gustavo-at-colosa.com
* @param POST
* @desc evaluates the dynaform type and other parameters in order to
* render the correct toolbar in each case
*
*/
G::LoadClass('toolBar');
G::LoadClass( 'toolBar' );
global $G_PUBLISH;
$script='';
$G_PUBLISH = new Publisher;
$Parameters = array(
'SYS_LANG' => SYS_LANG,
'URL'=> G::encrypt( $_POST['FILE'] , URL_KEY ),
'DYN_UID'=> $_POST['DYN_UID'],
'PRO_UID'=> $_POST['PRO_UID'],
'DYNAFORM_NAME'=>$_POST['DYN_TITLE'],
'FILE'=>$_POST['FILE'],
);
global $G_PUBLISH;
$script = '';
$G_PUBLISH = new Publisher();
$Parameters = array ('SYS_LANG' => SYS_LANG,'URL' => G::encrypt( $_POST['FILE'], URL_KEY ),'DYN_UID' => $_POST['DYN_UID'],'PRO_UID' => $_POST['PRO_UID'],'DYNAFORM_NAME' => $_POST['DYN_TITLE'],'FILE' => $_POST['FILE']);
//$Parameters = "";
if($_POST['TOOLBAR']=="grid"){
$G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_ToolbarGrid', 'display:none', $Parameters , '', '');
} else {
$G_PUBLISH->AddContent('xmlform', 'toolbar', 'dynaforms/fields_Toolbar', 'display:none', $Parameters , '', '');
}
if ($_POST['TOOLBAR'] == "grid") {
$G_PUBLISH->AddContent( 'xmlform', 'toolbar', 'dynaforms/fields_ToolbarGrid', 'display:none', $Parameters, '', '' );
} else {
$G_PUBLISH->AddContent( 'xmlform', 'toolbar', 'dynaforms/fields_Toolbar', 'display:none', $Parameters, '', '' );
}
G::RenderPage( 'publish', 'raw' );
G::RenderPage('publish', 'raw');
?>

View File

@@ -1,4 +1,5 @@
<?php
/**
* dynaforms_checkDependentFields.php
*
@@ -12,112 +13,121 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/**
* this file is a fix to a dependency bug it was just a minor improvement,
* also the functionality of dependent fields in grids doesn't depends in this
* file so this is somewhat expendable.
*
*/
function subDependencies( $k , &$G_FORM , &$aux, $grid = '') {
/**
* this file is a fix to a dependency bug it was just a minor improvement,
* also the functionality of dependent fields in grids doesn't depends in this
* file so this is somewhat expendable.
*/
function subDependencies ($k, &$G_FORM, &$aux, $grid = '')
{
$myDependentFields = '';
if (array_search( $k, $aux )!==FALSE) return array();
if ($grid == '') {
if (!array_key_exists( $k , $G_FORM->fields )) return array();
if (!isset($G_FORM->fields[$k]->dependentFields)) return array();
$aux[] = $k;
$mydependentFields = $G_FORM->fields[$k]->dependentFields;
if (array_search( $k, $aux ) !== false) {
return array ();
}
else {
if (!array_key_exists( $k , $G_FORM->fields[$grid]->fields )) 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);
if ($grid == '') {
if (! array_key_exists( $k, $G_FORM->fields )) {
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 (! 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 );
}
return $myDependentFields;
}
}
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']));
$json=new Services_JSON();
$formValues=($json->decode($_POST['fields']));
$sFieldName = $_POST['fieldName'];
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'] ) );
$json = new Services_JSON();
$formValues = ($json->decode( $_POST['fields'] ));
$sFieldName = $_POST['fieldName'];
$sMasterField = '';
$sPath = PATH_DYNAFORM;
$G_FORM = new form( $sDynUid , $sPath );
$aux = array();
$newValues=$json->decode(urlDecode(stripslashes($_POST['form'])));
$G_FORM = new form( $sDynUid, $sPath );
$aux = array ();
$newValues = $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] => '');
}
$aValues[$_POST['row']] = array($aKeys[0] => $newValue[$aKeys[0]]);
$newValues[$sKey]->$_POST['grid'] = $aValues;
unset($newValues[$sKey]->$aKeys[0]);
}
}
$dependentFields = array();
$aux = array();
$found =false;
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)){
$sMasterField = $k;
$found=true;
}
$newValue = (array) $newValue;
$aKeys = array_keys( $newValue );
$aValues = array ();
for ($i = 1; $i <= ($_POST['row'] - 1); $i ++) {
$aValues[$i] = array ($aKeys[0] => ''
);
}
$_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)){
$sMasterField = $k1;
$found=true;
$aValues[$_POST['row']] = array ($aKeys[0] => $newValue[$aKeys[0]] );
$newValues[$sKey]->$_POST['grid'] = $aValues;
unset( $newValues[$sKey]->$aKeys[0] );
}
}
$dependentFields = array ();
$aux = array ();
$found = false;
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 )) {
$sMasterField = $k;
$found = true;
}
}
}
$_SESSION[$G_FORM->id][$_POST['grid']][$_POST['row']][$k1] = $v1;
}
}
$dependentFields=array_merge($dependentFields, $myDependentFields);
}
}
switch ($_POST['function']){
$_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 )) {
$sMasterField = $k1;
$found = true;
}
}
$_SESSION[$G_FORM->id][$_POST['grid']][$_POST['row']][$k1] = $v1;
}
}
$dependentFields = array_merge( $dependentFields, $myDependentFields );
}
}
switch ($_POST['function']) {
case 'showDependentFields':
echo $json->encode(array_unique($dependentFields));
break;
echo $json->encode( array_unique( $dependentFields ) );
break;
case 'showDependentOf':
echo $sMasterField;
break;
}
?>
echo $sMasterField;
break;
}

View File

@@ -1,110 +1,108 @@
<?php
// added by gustavo cruz gustavo-at-colosa.com
/**
* this function validates which fields cannot be part of a
* grid dynaform those are: password, title, subtitle, button, submit,
* reset, listbox, checkbox, check group, radio group, file, javascript
* and obviously grid.
*
* @name apply_properties
* @author gustavo cruz
* @access public
* @param $gridFields
* @return $invalidFields
* @desc this function validates which fields cannot be part of a
* grid dynaform those are: password, title, subtitle, button, submit,
* reset, listbox, checkbox, check group, radio group, file, javascript
* and obviously grid.
*
**/
G::LoadClass('xmlDb');
*/
G::LoadClass( 'xmlDb' );
function validateGridConversion ($gridFields){
$invalidFields = array();
foreach($gridFields as $value){
function validateGridConversion ($gridFields)
{
$invalidFields = array ();
foreach ($gridFields as $value) {
switch($value['TYPE']){
case 'title':
switch ($value['TYPE']) {
case 'title':
$invalidFields[] = $value['XMLNODE_NAME'];
break;
case 'checkbox':
break;
case 'checkbox':
$invalidFields[] = $value['XMLNODE_NAME'];
break;
case 'radiogroup':
break;
case 'radiogroup':
$invalidFields[] = $value['XMLNODE_NAME'];
break;
case 'submit':
break;
case 'submit':
$invalidFields[] = $value['XMLNODE_NAME'];
break;
case 'password':
break;
case 'password':
$invalidFields[] = $value['XMLNODE_NAME'];
break;
case 'subtitle':
break;
case 'subtitle':
$invalidFields[] = $value['XMLNODE_NAME'];
break;
case 'button':
break;
case 'button':
$invalidFields[] = $value['XMLNODE_NAME'];
break;
case 'reset':
break;
case 'reset':
$invalidFields[] = $value['XMLNODE_NAME'];
break;
case 'listbox':
break;
case 'listbox':
$invalidFields[] = $value['XMLNODE_NAME'];
break;
case 'checkgroup':
break;
case 'checkgroup':
$invalidFields[] = $value['XMLNODE_NAME'];
break;
case 'file':
break;
case 'file':
$invalidFields[] = $value['XMLNODE_NAME'];
break;
case 'javascript':
break;
case 'javascript':
$invalidFields[] = $value['XMLNODE_NAME'];
break;
case 'grid':
break;
case 'grid':
$invalidFields[] = $value['XMLNODE_NAME'];
break;
}
}
return $invalidFields;
break;
}
// end
// added by gustavo cruz gustavo-at-colosa.com
/**
* @name getTemporalFields
* @author gustavo cruz
* @access public
* @param $file - the name of the dynaform file
* @return invalidFields string
* @desc this function get the fields that are part of the temporal
* dynaform file.
**/
function getTemporalFields($file){
try {
//$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/fields_List', 'display:none', $Parameters , '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax');
$i = 0;
$aFields = array();
$aFields[] = array('XMLNODE_NAME' => 'char',
'TYPE' => 'char',
'UP' => 'char',
'DOWN' => 'char');
$oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $file . '_tmp0.xml', '', '', '', 'myxml'));
$oDataset = $oSession->Execute('SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"');
$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));
$i++;
}
// print_r($aFields);
// die;
} catch (Exception $e) {}
$invalidFields = validateGridConversion($aFields);
if (count($invalidFields)> 0){
return (implode(", " , $invalidFields));
} else {
return "ok";
}
}
// here make a response of the invalid fields for the Ajax request
echo getTemporalFields($_POST['FILENAME']);
}
return $invalidFields;
}
// end
?>
// added by gustavo cruz gustavo-at-colosa.com
/**
* this function get the fields that are part of the temporal
* dynaform file.
*
* @name getTemporalFields
* @author gustavo cruz
* @access public
* @param $file - the name of the dynaform file
* @return invalidFields string
*/
function getTemporalFields ($file)
{
try {
//$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/fields_List', 'display:none', $Parameters , '', SYS_URI.'dynaforms/dynaforms_PagedTableAjax');
$i = 0;
$aFields = array ();
$aFields[] = array ('XMLNODE_NAME' => 'char','TYPE' => 'char','UP' => 'char','DOWN' => 'char');
$oSession = new DBSession( new DBConnection( PATH_DYNAFORM . $file . '_tmp0.xml', '', '', '', 'myxml' ) );
$oDataset = $oSession->Execute( 'SELECT * FROM dynaForm WHERE NOT( XMLNODE_NAME = "" ) AND TYPE <> "pmconnection"' );
$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));
$i ++;
}
// print_r($aFields);
// die;
} catch (Exception $e) {
}
$invalidFields = validateGridConversion( $aFields );
if (count( $invalidFields ) > 0) {
return (implode( ", ", $invalidFields ));
} else {
return "ok";
}
}
// here make a response of the invalid fields for the Ajax request
echo getTemporalFields( $_POST['FILENAME'] );
// end

View File

@@ -1,8 +1,8 @@
<?php
/**
/**
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* 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
@@ -10,23 +10,23 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/*
/*
* @Author Erik Amaru Ortiz <erik@colosa.com>
* @Date Aug 26th, 2009
* @Date Aug 26th, 2009
*/
$G_PUBLISH = new Publisher();
$oHeadPublisher =& headPublisher::getSingleton();
$G_PUBLISH->AddContent('view', 'dynaforms/fieldsHandlerViewer');
G::RenderPage( "publish" , "raw" );
$G_PUBLISH = new Publisher();
$oHeadPublisher = & headPublisher::getSingleton();
$G_PUBLISH->AddContent( 'view', 'dynaforms/fieldsHandlerViewer' );
G::RenderPage( "publish", "raw" );

View File

@@ -1,8 +1,8 @@
<?php
/**
/**
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* 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
@@ -10,106 +10,91 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/*
/*
* @Author Erik Amaru Ortiz <erik@colosa.com>
* @Date Aug 26th, 2009
* @Date Aug 26th, 2009
*/
$request = $_POST['request'];
switch($request){
case 'save':
if( isset($_POST['items']) ){
$items = $_POST['items'];
$tmpfilename = $_SESSION['Current_Dynafom']['Parameters']['FILE'];
G::LoadSystem('dynaformhandler');
$o = new dynaFormHandler(PATH_DYNAFORM."{$tmpfilename}.xml");
$list_elements = explode(',', $items);
$e = Array();
foreach($list_elements as $element){
$e[] = $o->getNode($element);
}
$o->__cloneEmpty();
foreach($e as $e1){
$o->setNode($e1);
}
}
break;
case 'saveHidden':
$tmpfilename = $_SESSION['Current_Dynafom']['Parameters']['FILE'];
G::LoadSystem('dynaformhandler');
$o = new dynaFormHandler(PATH_DYNAFORM."{$tmpfilename}.xml");
$hidden_items = Array();
$has_hidden_items = false;
if( isset($_POST['hidden']) ){
if( $_POST['hidden'] != '' ){
$has_hidden_items = true;
$hidden_items = explode(',', $_POST['hidden']);
$hidden_items_tmp = $hidden_items;
$hidden_items = Array();
foreach($hidden_items_tmp as $hItem){
$tmp = explode("@", $hItem);
$hidden_items[] = $tmp[1];
}
$hidden_items_tmp = implode(',', $hidden_items);
}
}
if( $has_hidden_items ){
$hStr = '';
foreach($hidden_items as $hItem){
$hStr .= "hideRowById('$hItem'); ";
}
//echo 'something todo';
//print_r($hidden_items);
$msg = " @! Autogenerated by Processmaker weboot; Do not modify this content, this is autogenerated alway when dynaform is updated ";
if( $o->nodeExists('___pm_boot_strap___') ){
$o->remove('___pm_boot_strap___');
}
$metaEncrypt = G::encrypt($hidden_items_tmp, 'dynafieldsHandler');
$o->add('___pm_boot_strap___', Array('type'=>'javascript', "meta"=>$metaEncrypt), "/*$msg*/ $hStr");
echo $metaEncrypt;
} else { //we must to remove the boot strap node;
$o->remove('___pm_boot_strap___');
}
break;
default:
echo 'no request param.';
}
$request = $_POST['request'];
switch ($request) {
case 'save':
if (isset( $_POST['items'] )) {
$items = $_POST['items'];
$tmpfilename = $_SESSION['Current_Dynafom']['Parameters']['FILE'];
G::LoadSystem( 'dynaformhandler' );
$o = new dynaFormHandler( PATH_DYNAFORM . "{$tmpfilename}.xml" );
$list_elements = explode( ',', $items );
$e = Array ();
foreach ($list_elements as $element) {
$e[] = $o->getNode( $element );
}
$o->__cloneEmpty();
foreach ($e as $e1) {
$o->setNode( $e1 );
}
}
break;
case 'saveHidden':
$tmpfilename = $_SESSION['Current_Dynafom']['Parameters']['FILE'];
G::LoadSystem( 'dynaformhandler' );
$o = new dynaFormHandler( PATH_DYNAFORM . "{$tmpfilename}.xml" );
$hidden_items = Array ();
$has_hidden_items = false;
if (isset( $_POST['hidden'] )) {
if ($_POST['hidden'] != '') {
$has_hidden_items = true;
$hidden_items = explode( ',', $_POST['hidden'] );
$hidden_items_tmp = $hidden_items;
$hidden_items = Array ();
foreach ($hidden_items_tmp as $hItem) {
$tmp = explode( "@", $hItem );
$hidden_items[] = $tmp[1];
}
$hidden_items_tmp = implode( ',', $hidden_items );
}
}
if ($has_hidden_items) {
$hStr = '';
foreach ($hidden_items as $hItem) {
$hStr .= "hideRowById('$hItem'); ";
}
//echo 'something todo';
//print_r($hidden_items);
$msg = " @! Autogenerated by Processmaker weboot; Do not modify this content, this is autogenerated alway when dynaform is updated ";
if ($o->nodeExists( '___pm_boot_strap___' )) {
$o->remove( '___pm_boot_strap___' );
}
$metaEncrypt = G::encrypt( $hidden_items_tmp, 'dynafieldsHandler' );
$o->add( '___pm_boot_strap___', Array ('type' => 'javascript',"meta" => $metaEncrypt
), "/*$msg*/ $hStr" );
echo $metaEncrypt;
} else {
//we must to remove the boot strap node;
$o->remove( '___pm_boot_strap___' );
}
break;
default:
echo 'no request param.';
}

View File

@@ -1,8 +1,8 @@
<?php
/**
/**
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* 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
@@ -10,27 +10,25 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
/*
/*
* @Author Erik Amaru Ortiz <erik@colosa.com>
* @Date Aug 26th, 2009
* @Date Aug 26th, 2009
*/
$G_PUBLISH = new Publisher();
$G_PUBLISH = new Publisher();
$_POST['fieldsList'] = Array('button', 'checkbox', 'checkgroup', 'currency', 'date', 'dropdown', 'file', 'grid', 'hidden', 'javascript',
'link', 'listbox', 'password', 'percentage', 'radiogroup', 'radiogroupview', 'reset', 'submit', 'subtitle', 'suggest', 'text',
'textarea', 'title', 'yesno');
$_POST['fieldsList'] = Array ('button','checkbox','checkgroup','currency','date','dropdown','file','grid','hidden','javascript','link','listbox','password','percentage','radiogroup','radiogroupview','reset','submit','subtitle','suggest','text','textarea','title','yesno');
$G_PUBLISH->AddContent( 'view', 'dynaforms/fieldsHandler' );
G::RenderPage( "publish", "raw" );
$G_PUBLISH->AddContent('view', 'dynaforms/fieldsHandler');
G::RenderPage( "publish" , "raw" );

View File

@@ -1,10 +1,10 @@
<?php
/**
* fields_Ajax.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* 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
@@ -12,99 +12,114 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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) return $RBAC_Response;
/*NEXT LINE: Runs any configuration defined to be executed before dependent fields recalc*/
if (isset($_SESSION['CURRENT_PAGE_INITILIZATION'])) eval($_SESSION['CURRENT_PAGE_INITILIZATION']);
//G::LoadSystem('json');
require_once(PATH_THIRDPARTY . 'pear/json/class.json.php');
$json=new Services_JSON();
$G_FORM=new form(G::getUIDName(urlDecode($_POST['form'])));
$G_FORM->id=urlDecode($_POST['form']);
$G_FORM->values=$_SESSION[$G_FORM->id];
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
/*NEXT LINE: Runs any configuration defined to be executed before dependent fields recalc*/
if (isset( $_SESSION['CURRENT_PAGE_INITILIZATION'] )) {
eval( $_SESSION['CURRENT_PAGE_INITILIZATION'] );
}
//G::LoadSystem('json');
require_once (PATH_THIRDPARTY . 'pear/json/class.json.php');
$json = new Services_JSON();
$G_FORM = new form( G::getUIDName( urlDecode( $_POST['form'] ) ) );
$G_FORM->id = urlDecode( $_POST['form'] );
$G_FORM->values = $_SESSION[$G_FORM->id];
G::LoadClass('xmlDb');
$file = G::decrypt( $G_FORM->values['PME_A'] , URL_KEY );
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');
G::LoadClass( 'xmlDb' );
$file = G::decrypt( $G_FORM->values['PME_A'], URL_KEY );
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' );
$newValues=($json->decode(urlDecode(stripslashes($_POST['fields']))));
$newValues = ($json->decode( urlDecode( stripslashes( $_POST['fields'] ) ) ));
//Resolve dependencies
//Returns an array ($dependentFields) with the names of the fields
//that depends of fields passed through AJAX ($_GET/$_POST)
$dependentFields=array(); $aux=array();
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) {
$myDependentFields = subDependencies( $k , $G_FORM , $aux );
$dependentFields=array_merge($dependentFields, $myDependentFields);
}
$dependentFields = array ();
$aux = array ();
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) {
$myDependentFields = subDependencies( $k, $G_FORM, $aux );
$dependentFields = array_merge( $dependentFields, $myDependentFields );
}
}
$dependentFields=array_unique($dependentFields);
$dependentFields = array_unique( $dependentFields );
//Parse and update the new content
$template = PATH_CORE . 'templates/xmlform.html';
$newContent=$G_FORM->getFields($template);
$newContent = $G_FORM->getFields( $template );
//Returns the dependentFields's content
$sendContent=array();
$r=0;
foreach($dependentFields as $d) {
$sendContent[$r]->name=$d;
$sendContent[$r]->content=NULL;
foreach($G_FORM->fields[$d] as $attribute => $value) {
switch($attribute) {
case 'type':
$sendContent[$r]->content->{$attribute}=$value; break;
case 'options':
$sendContent[$r]->content->{$attribute}=toJSArray($value); break;
}
}
$sendContent[$r]->value=$G_FORM->values[$d];
$r++;
$sendContent = array ();
$r = 0;
foreach ($dependentFields as $d) {
$sendContent[$r]->name = $d;
$sendContent[$r]->content = null;
foreach ($G_FORM->fields[$d] as $attribute => $value) {
switch ($attribute) {
case 'type':
$sendContent[$r]->content->{$attribute} = $value;
break;
case 'options':
$sendContent[$r]->content->{$attribute} = toJSArray( $value );
break;
}
}
$sendContent[$r]->value = $G_FORM->values[$d];
$r ++;
}
echo($json->encode($sendContent));
echo ($json->encode( $sendContent ));
function toJSArray($array)
function toJSArray ($array)
{
$result=array();
foreach($array as $k => $v){
$o=NULL;
$o->key=$k;
$o->value=$v;
$result[]=$o;
}
return $result;
$result = array ();
foreach ($array as $k => $v) {
$o = null;
$o->key = $k;
$o->value = $v;
$result[] = $o;
}
return $result;
}
function subDependencies( $k , &$G_FORM , &$aux ) {
if (array_search( $k, $aux )!==FALSE) return array();
if (!array_key_exists( $k , $G_FORM->fields )) return array();
if (!isset($G_FORM->fields[$k]->dependentFields)) return array();
$aux[] = $k;
$myDependentFields = explode( ',', $G_FORM->fields[$k]->dependentFields);
for( $r=0 ; $r < sizeof($myDependentFields) ; $r++ ) {
if ($myDependentFields[$r]=="") unset($myDependentFields[$r]);
}
$mD = $myDependentFields;
foreach( $mD as $ki) {
$myDependentFields = array_merge( $myDependentFields , subDependencies( $ki , $G_FORM , $aux ) );
}
return $myDependentFields;
function subDependencies ($k, &$G_FORM, &$aux)
{
if (array_search( $k, $aux ) !== false) {
return array ();
}
if (! array_key_exists( $k, $G_FORM->fields )) {
return array ();
}
if (! isset( $G_FORM->fields[$k]->dependentFields )) {
return array ();
}
$aux[] = $k;
$myDependentFields = explode( ',', $G_FORM->fields[$k]->dependentFields );
for ($r = 0; $r < sizeof( $myDependentFields ); $r ++) {
if ($myDependentFields[$r] == "") {
unset( $myDependentFields[$r] );
}
}
$mD = $myDependentFields;
foreach ($mD as $ki) {
$myDependentFields = array_merge( $myDependentFields, subDependencies( $ki, $G_FORM, $aux ) );
}
return $myDependentFields;
}
?>

View File

@@ -12,53 +12,53 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
G::LoadClass('dynaFormField');
if (!(isset($_POST['A']) && $_POST['A']!=='')) return;
G::LoadClass( 'dynaFormField' );
$file = G::decrypt( $_POST['A'] , URL_KEY );
if (! (isset( $_POST['A'] ) && $_POST['A'] !== '')) {
return;
}
$dbc = new DBConnection( PATH_DYNAFORM . $file . '.xml' ,'','','','myxml' );
$ses = new DBSession($dbc);
$file = G::decrypt( $_POST['A'], URL_KEY );
$fields = new DynaFormField( $dbc );
$dbc = new DBConnection( PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml' );
$ses = new DBSession( $dbc );
if (!isset($_POST['XMLNODE_NAME'])) return;
$fields = new DynaFormField( $dbc );
$fields->Delete( $_POST['XMLNODE_NAME'] );
if (! isset( $_POST['XMLNODE_NAME'] )) {
return;
}
$fields->Delete( $_POST['XMLNODE_NAME'] );
G::LoadClass( 'xmlDb' );
$i = 0;
$aFields = array ();
$aFields[] = array ('XMLNODE_NAME' => 'char','TYPE' => 'char','UP' => 'char','DOWN' => 'char');
$oSession = new DBSession( new DBConnection( PATH_DYNAFORM . $file . '.xml', '', '', '', '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' ) : '') );
$i ++;
}
global $_DBArray;
$_DBArray['fields'] = $aFields;
$_SESSION['_DBArray'] = $_DBArray;
G::LoadClass('xmlDb');
$i = 0;
$aFields = array();
$aFields[] = array('XMLNODE_NAME' => 'char',
'TYPE' => 'char',
'UP' => 'char',
'DOWN' => 'char');
$oSession = new DBSession(new DBConnection(PATH_DYNAFORM . $file . '.xml', '', '', '', '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') : ''));
$i++;
}
global $_DBArray;
$_DBArray['fields'] = $aFields;
$_SESSION['_DBArray'] = $_DBArray;
?>

View File

@@ -12,50 +12,54 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
G::LoadClass('dynaFormField');
if (!(isset($_GET['A']) && $_GET['A']!=='')) return;
G::LoadClass( 'dynaFormField' );
$file = G::decrypt( $_GET['A'] , URL_KEY );
if (! (isset( $_GET['A'] ) && $_GET['A'] !== '')) {
return;
}
$dbc = new DBConnection( PATH_DYNAFORM . $file . '.xml' ,'','','','myxml' );
$ses = new DBSession($dbc);
$file = G::decrypt( $_GET['A'], URL_KEY );
//TODO: Improve how to obtain the PRO_UID.
$aFile=explode('/',str_replace('\\','/',$file));
$proUid=$aFile[0];
$dynUid=str_replace("_tmp0","",$aFile[1]);
require_once 'classes/model/Dynaform.php';
$k=new Criteria('workflow');
$k->addSelectColumn(DynaformPeer::DYN_TYPE);
$k->add(DynaformPeer::DYN_UID,$dynUid);
$ods=DynaformPeer::doSelectRS($k);
$ods->next();
$row=$ods->getRow();
$dynType=$row[0];
$dbc = new DBConnection( PATH_DYNAFORM . $file . '.xml', '', '', '', 'myxml' );
$ses = new DBSession( $dbc );
$Fields['PME_DYN_TYPE']=$dynType;
$fields = new DynaFormField( $dbc );
$fields->Fields['XMLNODE_NAME']=(isset($_GET['XMLNODE_NAME'])) ? urldecode($_GET['XMLNODE_NAME']):'';
$fields->Load( $fields->Fields['XMLNODE_NAME'] );
//TODO: Improve how to obtain the PRO_UID.
$aFile = explode( '/', str_replace( '\\', '/', $file ) );
$proUid = $aFile[0];
$dynUid = str_replace( "_tmp0", "", $aFile[1] );
/* Start Comment: Modify the options grid to set dynamically the language
require_once 'classes/model/Dynaform.php';
$k = new Criteria( 'workflow' );
$k->addSelectColumn( DynaformPeer::DYN_TYPE );
$k->add( DynaformPeer::DYN_UID, $dynUid );
$ods = DynaformPeer::doSelectRS( $k );
$ods->next();
$row = $ods->getRow();
$dynType = $row[0];
$Fields['PME_DYN_TYPE'] = $dynType;
$fields = new DynaFormField( $dbc );
$fields->Fields['XMLNODE_NAME'] = (isset( $_GET['XMLNODE_NAME'] )) ? urldecode( $_GET['XMLNODE_NAME'] ) : '';
$fields->Load( $fields->Fields['XMLNODE_NAME'] );
/* Start Comment: Modify the options grid to set dynamically the language
* label columns.
*/
// $dbc2 = new DBConnection( PATH_XMLFORM . 'dynaforms/fields/_options.xml' ,'','','','myxml' );
@@ -71,128 +75,119 @@ if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Respons
// $ses2->execute("INSERT INTO dynaForm.LABEL_{$LANG} (XMLNODE_NAME,XMLNODE_VALUE) VALUES ('".SYS_LANG."', '{$Label} ({$lang})') ");
// $ses2->execute("INSERT INTO dynaForm (XMLNODE_NAME,XMLNODE_TYPE,XMLNODE_VALUE) VALUES ('', 'cdata', '\n') ");
// }
/* End Comment: */
/* End Comment: */
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');
$form = new Form( $file, PATH_DYNAFORM, SYS_LANG, true );
$form = new Form( $file , PATH_DYNAFORM, SYS_LANG, true );
if (is_array( $fields->Fields )) {
foreach ($fields->Fields as $key => $value) {
$Fields['PME_' . $key] = $value;
}
}
if (is_array($fields->Fields)) {
foreach( $fields->Fields as $key => $value ) {
$Fields['PME_'.$key] = $value;
}
}
$Fields['PME_A'] = $_GET['A'];
$Fields['PME_PRO_UID'] = $proUid;
$Fields['PME_XMLNODE_NAME_OLD'] = (isset( $Fields['PME_XMLNODE_NAME'] ) ? $Fields['PME_XMLNODE_NAME'] : '');
$Fields['PME_A'] = $_GET['A'];
$Fields['PME_PRO_UID'] = $proUid;
$Fields['PME_XMLNODE_NAME_OLD'] = (isset($Fields['PME_XMLNODE_NAME']) ? $Fields['PME_XMLNODE_NAME'] : '');
$G_PUBLISH = new Publisher();
$G_PUBLISH = new Publisher();
if ( !( isset($fields->Fields['XMLNODE_NAME']) && ($fields->Fields['XMLNODE_NAME']!=='') ) ) {
$type = strtolower( $_GET['TYPE'] );
} else {
$type = strtolower( $fields->Fields['TYPE'] );
}
if (! (isset( $fields->Fields['XMLNODE_NAME'] ) && ($fields->Fields['XMLNODE_NAME'] !== ''))) {
$type = strtolower( $_GET['TYPE'] );
} else {
$type = strtolower( $fields->Fields['TYPE'] );
}
if( $type == 'suggest' ||
$type == 'checkgroup' ||
$type == 'dropdown' ||
$type == 'radiogroup' ||
$type == 'text' ||
$type == 'listbox' ||
$type == 'currency' ||
$type == 'percentage' ||
$type == 'textarea' ||
$type == 'hidden' ) {
if ($type == 'suggest' || $type == 'checkgroup' || $type == 'dropdown' || $type == 'radiogroup' || $type == 'text' || $type == 'listbox' || $type == 'currency' || $type == 'percentage' || $type == 'textarea' || $type == 'hidden') {
$aDefaultConnections = array();
$aDBConn = array();
G::LoadClass ( 'dbConnections');
$oDBConn = new DbConnections ();
$aDefaultConnections = array (
array('DBS_UID' => '', 'DBS_NAME' => ''),
array('DBS_UID' => 'dbarray', 'DBS_NAME' => 'dbarray'),
array('DBS_UID' => 'workflow', 'DBS_NAME' => 'Workflow'),
array('DBS_UID' => 'rbac', 'DBS_NAME' => 'RBAC'),
array('DBS_UID' => 'rp', 'DBS_NAME' => 'REPORT')
$aDefaultConnections = array ();
$aDBConn = array ();
G::LoadClass( 'dbConnections' );
$oDBConn = new DbConnections();
$aDefaultConnections = array (array ('DBS_UID' => '','DBS_NAME' => ''
),array ('DBS_UID' => 'dbarray','DBS_NAME' => 'dbarray'
),array ('DBS_UID' => 'workflow','DBS_NAME' => 'Workflow'
),array ('DBS_UID' => 'rbac','DBS_NAME' => 'RBAC'
),array ('DBS_UID' => 'rp','DBS_NAME' => 'REPORT'
)
);
$aDBConn = $oDBConn->getConnectionsProUid($proUid);
$aDbConnections = array_merge($aDefaultConnections, $aDBConn );
$_DBArray ['DB_CONNECTIONS'] = $aDbConnections;
$aDBConn = $oDBConn->getConnectionsProUid( $proUid );
$aDbConnections = array_merge( $aDefaultConnections, $aDBConn );
$_DBArray['DB_CONNECTIONS'] = $aDbConnections;
$_SESSION['_DBArray'] = $_DBArray;
}
}
if ( !( isset($fields->Fields['XMLNODE_NAME']) &&
($fields->Fields['XMLNODE_NAME']!=='') ) ) {
if (! (isset( $fields->Fields['XMLNODE_NAME'] ) && ($fields->Fields['XMLNODE_NAME'] !== ''))) {
$type = strtolower( $_GET['TYPE'] );
$Fields['PME_TYPE'] = $type;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/fields/' . $type, '', $Fields , SYS_URI.'dynaforms/fields_Save', SYS_URI.'dynaforms/fields_Ajax');
} else {
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/fields/' . $type, '', $Fields, SYS_URI . 'dynaforms/fields_Save', SYS_URI . 'dynaforms/fields_Ajax' );
} else {
$Fields['PME_LABEL'] = $form->fields[$fields->Fields['XMLNODE_NAME']]->label;
if (isset($form->fields[$fields->Fields['XMLNODE_NAME']]->code)) $Fields['PME_CODE'] = $form->fields[$fields->Fields['XMLNODE_NAME']]->code;
$options=isset($form->fields[$fields->Fields['XMLNODE_NAME']]->option)?
$form->fields[$fields->Fields['XMLNODE_NAME']]->option:array();
if (!is_array($options) || count($options)==0) $options =array('' => '');
$Fields['PME_OPTIONS'] = array(
'NAME' => array_keys($options),
'LABEL' => array_values($options)
);
if (isset( $form->fields[$fields->Fields['XMLNODE_NAME']]->code )) {
$Fields['PME_CODE'] = $form->fields[$fields->Fields['XMLNODE_NAME']]->code;
}
$options = isset( $form->fields[$fields->Fields['XMLNODE_NAME']]->option ) ? $form->fields[$fields->Fields['XMLNODE_NAME']]->option : array ();
if (! is_array( $options ) || count( $options ) == 0) {
$options = array ('' => '' );
}
$Fields['PME_OPTIONS'] = array ('NAME' => array_keys( $options ),'LABEL' => array_values( $options ) );
$type = strtolower( $fields->Fields['TYPE'] );
if ($type==='checkbox') {
if ($Fields['PME_DEFAULTVALUE']===$Fields['PME_VALUE']) {
$Fields['PME_DEFAULTVALUE']='On';
} else {
$Fields['PME_DEFAULTVALUE']='Off';
}
}
if( $type == 'suggest' && isset($Fields['PME_SQLCONNECTION']) && $Fields['PME_SQLCONNECTION']!='') {
//define the dbArray with the table fields
//g::pr($Fields);
$tableExists = true;
$sDataBase = 'database_' . strtolower(DB_ADAPTER);
if(G::LoadSystemExist($sDataBase)){
G::LoadSystem($sDataBase);
$oDataBase = new database();
$dataBase = $Fields['PME_SQLCONNECTION'];
if($Fields['PME_SQLCONNECTION']=='workflow')
$dataBase = DB_NAME;
$tableExists = $oDataBase->tableExists('USERS', $dataBase);
}
if($tableExists) {
$con = Propel::getConnection($Fields['PME_SQLCONNECTION']);
$rs = $con->executeQuery("SHOW COLUMNS FROM USERS");
$result = Array();
$i=0;
while ($rs->next()) {
$result[$i++] = $rs->getRow();
if ($type === 'checkbox') {
if ($Fields['PME_DEFAULTVALUE'] === $Fields['PME_VALUE']) {
$Fields['PME_DEFAULTVALUE'] = 'On';
} else {
$Fields['PME_DEFAULTVALUE'] = 'Off';
}
}
}
//g::pr($result);
if( isset($Fields['PME_HINT']) ) {
$Fields['PME_HINT'] = stripslashes($Fields['PME_HINT']);
$Fields['PME_HINT'] = htmlspecialchars_decode($Fields['PME_HINT']);
$Fields['PME_HINT'] = str_replace("&#039;", "'", $Fields['PME_HINT']);
}
if (file_exists( PATH_XMLFORM . 'dynaforms/fields/' . $type . '.xml')) {
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'dynaforms/fields/' . $type, '', $Fields , SYS_URI.'dynaforms/fields_Save', SYS_URI.'dynaforms/fields_Ajax');
if ($type == 'suggest' && isset( $Fields['PME_SQLCONNECTION'] ) && $Fields['PME_SQLCONNECTION'] != '') {
//define the dbArray with the table fields
//g::pr($Fields);
$tableExists = true;
$sDataBase = 'database_' . strtolower( DB_ADAPTER );
if (G::LoadSystemExist( $sDataBase )) {
G::LoadSystem( $sDataBase );
$oDataBase = new database();
$dataBase = $Fields['PME_SQLCONNECTION'];
if ($Fields['PME_SQLCONNECTION'] == 'workflow') {
$dataBase = DB_NAME;
}
$tableExists = $oDataBase->tableExists( 'USERS', $dataBase );
}
if ($tableExists) {
$con = Propel::getConnection( $Fields['PME_SQLCONNECTION'] );
$rs = $con->executeQuery( "SHOW COLUMNS FROM USERS" );
$result = Array ();
$i = 0;
while ($rs->next()) {
$result[$i ++] = $rs->getRow();
}
}
}
//g::pr($result);
if (isset( $Fields['PME_HINT'] )) {
$Fields['PME_HINT'] = stripslashes( $Fields['PME_HINT'] );
$Fields['PME_HINT'] = htmlspecialchars_decode( $Fields['PME_HINT'] );
$Fields['PME_HINT'] = str_replace( "&#039;", "'", $Fields['PME_HINT'] );
}
if (file_exists( PATH_XMLFORM . 'dynaforms/fields/' . $type . '.xml' )) {
$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'dynaforms/fields/' . $type, '', $Fields, SYS_URI . 'dynaforms/fields_Save', SYS_URI . 'dynaforms/fields_Ajax' );
} else {
print(G::LoadTranslation('ID_UNKNOWN_FIELD_TYPE'));
print (G::LoadTranslation( 'ID_UNKNOWN_FIELD_TYPE' )) ;
}
}
}
G::RenderPage( "publish", "raw" );
G::RenderPage( "publish" , "raw" );
?>

View File

@@ -12,44 +12,43 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
G::LoadClass('dynaFormField');
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'processes';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'FIELDS';
G::LoadClass( 'dynaFormField' );
$PRO_UID='746B734DC23311';
$file = $PRO_UID . '/' . 'myInfo';
$G_MAIN_MENU = 'processmaker';
$G_SUB_MENU = 'processes';
$G_ID_MENU_SELECTED = 'PROCESSES';
$G_ID_SUB_MENU_SELECTED = 'FIELDS';
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');
$PRO_UID = '746B734DC23311';
$file = $PRO_UID . '/' . 'myInfo';
$G_PUBLISH = new Publisher;
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' );
$Parameters = array(
'SYS_LANG' => SYS_LANG,
'URL'=> G::encrypt( $file , URL_KEY ) );
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('pagedtable', 'paged-table', 'dynaforms/fields_List', '', $Parameters , '', 'dynaforms_PagedTableAjax');
$Parameters = array ('SYS_LANG' => SYS_LANG,'URL' => G::encrypt( $file, URL_KEY ));
G::RenderPage( "publish" );
$G_PUBLISH->AddContent( 'pagedtable', 'paged-table', 'dynaforms/fields_List', '', $Parameters, '', 'dynaforms_PagedTableAjax' );
G::RenderPage( "publish" );
?>

View File

@@ -12,88 +12,94 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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/>.
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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) return $RBAC_Response;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
//G::genericForceLogin( 'WF_MYINFO' , 'login/noViewPage', $urlLogin = 'login/login' );
if (!(isset($_POST['A']) && $_POST['A']!=='')) return;
if (!(isset($_POST['XMLNODE_NAME']) && $_POST['XMLNODE_NAME']!=='')) return;
if (!(isset($_POST['NEW_POS']) && $_POST['NEW_POS']!=='')) return;
if (! (isset( $_POST['A'] ) && $_POST['A'] !== '')) {
return;
}
if (! (isset( $_POST['XMLNODE_NAME'] ) && $_POST['XMLNODE_NAME'] !== '')) {
return;
}
if (! (isset( $_POST['NEW_POS'] ) && $_POST['NEW_POS'] !== '')) {
return;
}
$file = PATH_DYNAFORM . G::decrypt( $_POST['A'] , URL_KEY ) . '.xml';
$fieldName = $_POST['XMLNODE_NAME'];
$newPos = intval($_POST['NEW_POS']);
$file = PATH_DYNAFORM . G::decrypt( $_POST['A'], URL_KEY ) . '.xml';
$fieldName = $_POST['XMLNODE_NAME'];
$newPos = intval( $_POST['NEW_POS'] );
if (!file_exists($file)) return;
if (! file_exists( $file )) {
return;
}
$xmldoc = new Xml_Document();
$xmldoc->parseXmlFile( $file );
$xmldoc = new Xml_Document();
$xmldoc->parseXmlFile( $file );
$node =& $xmldoc->findNode( '/dynaForm/' . $fieldName );
$node = & $xmldoc->findNode( '/dynaForm/' . $fieldName );
if (!isset( $node )) return;
$numFields = 0;
foreach( $xmldoc->children[0]->children as $child )
$numFields += ($child->name!=='')? 1 : 0;
if (! isset( $node )) {
return;
}
$numFields = 0;
foreach ($xmldoc->children[0]->children as $child) {
$numFields += ($child->name !== '') ? 1 : 0;
}
$newPos = ($newPos<1) ? 1 : $newPos;
$newPos = ($newPos>$numFields) ? $numFields : $newPos;
$newPos = ($newPos < 1) ? 1 : $newPos;
$newPos = ($newPos > $numFields) ? $numFields : $newPos;
$rowCounter = (int) 0;
$newOrder = array();
foreach( $xmldoc->children[0]->children as $index => $child ) {
if ($child->name!=='') $rowCounter++;
if ($rowCounter==$newPos) {
$newOrder[] = $node;
$rowCounter++;
$newPos=-1;
$rowCounter = (int) 0;
$newOrder = array ();
foreach ($xmldoc->children[0]->children as $index => $child) {
if ($child->name !== '') {
$rowCounter ++;
}
if ( $child->name !== $node->name ){
$newOrder[] = $xmldoc->children[0]->children[$index];
if ($rowCounter == $newPos) {
$newOrder[] = $node;
$rowCounter ++;
$newPos = - 1;
}
else
$rowCounter--;
}
if ($rowCounter < $newPos) {
$newOrder[] = $node;
$rowCounter++;
$newPos=-1;
}
$xmldoc->children[0]->children = $newOrder;
if ($child->name !== $node->name) {
$newOrder[] = $xmldoc->children[0]->children[$index];
} else {
$rowCounter --;
}
}
if ($rowCounter < $newPos) {
$newOrder[] = $node;
$rowCounter ++;
$newPos = - 1;
}
$xmldoc->children[0]->children = $newOrder;
$xmldoc->save( $file );
$xmldoc->save( $file );
G::LoadClass( 'xmlDb' );
$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 = "" )' );
$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) );
$i ++;
}
global $_DBArray;
$_DBArray['fields'] = $aFields;
$_SESSION['_DBArray'] = $_DBArray;
G::LoadClass('xmlDb');
$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 = "" )');
$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));
$i++;
}
global $_DBArray;
$_DBArray['fields'] = $aFields;
$_SESSION['_DBArray'] = $_DBArray;
?>

View File

@@ -1,10 +1,10 @@
<?php
/**
* test.php
*
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
*
* 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
@@ -12,47 +12,49 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* 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.,
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* 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) return $RBAC_Response;
/* START BOCK: DAVID CALLIZAYA: PLEASE NO BORRAR ESTE BLOQUE.*/
for($r=1;$r<10;$r++){
/* The timestamp is a 60-bit value. For UUID version 1, this is
* represented by Coordinated Universal Time (UTC) as a count of 100-
* nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of
* Gregorian reform to the Christian calendar).
*/
$t=explode(' ',microtime());
$ts=$t[1].substr($t[0],2,7);
$t[0]=substr('00'.base_convert($ts,10,16),-15);
var_dump($ts);
print("\n<br/>");
var_dump($t);
print("\n<br/>");
}
if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
return $RBAC_Response;
}
/* START BOCK: DAVID CALLIZAYA: PLEASE NO BORRAR ESTE BLOQUE.*/
for ($r = 1; $r < 10; $r ++) {
/* The timestamp is a 60-bit value. For UUID version 1, this is
* represented by Coordinated Universal Time (UTC) as a count of 100-
* nanosecond intervals since 00:00:00.00, 15 October 1582 (the date of
* Gregorian reform to the Christian calendar).
*/
$t = explode( ' ', microtime() );
$ts = $t[1] . substr( $t[0], 2, 7 );
$t[0] = substr( '00' . base_convert( $ts, 10, 16 ), - 15 );
var_dump( $ts );
print ("\n<br/>") ;
var_dump( $t );
print ("\n<br/>") ;
}
/* START BOCK: DAVID CALLIZAYA: PLEASE NO BORRAR ESTE BLOQUE.*/
?>
<form action="test" method="post">
<select name="form[test][]" multiple="multiple">
<option value="one">one</option>
<option value="two">two</option>
<option value="three">three</option>
<option value="four">four</option>
<option value="five">five</option>
</select>
<input type="submit" value="Send" />
<select name="form[test][]" multiple="multiple">
<option value="one">one</option>
<option value="two">two</option>
<option value="three">three</option>
<option value="four">four</option>
<option value="five">five</option>
</select> <input type="submit" value="Send" />
</form>
<?php
$test=$_POST['form']['test'];
if ($test){
foreach ($test as $t){echo 'You selected ',$t,'<br />';}
}
?>
$test = $_POST['form']['test'];
if ($test) {
foreach ($test as $t) {
echo 'You selected ', $t, '<br />';
}
}