Merged colosa/processmaker into master
This commit is contained in:
@@ -294,10 +294,10 @@ class Publisher
|
||||
|
||||
//This dynaform has show/hide field conditions
|
||||
if (isset($_SESSION['CURRENT_DYN_UID']) && $_SESSION['CURRENT_DYN_UID'] != '') {
|
||||
$ConditionalShowHideRoutines = $oFieldCondition->getConditionScript($_SESSION["CURRENT_DYN_UID"]); //lsl
|
||||
$ConditionalShowHideRoutines = $oFieldCondition->getConditionScript($_SESSION["CURRENT_DYN_UID"]);
|
||||
} else {
|
||||
if (isset($_SESSION['CONDITION_DYN_UID']) && $_SESSION['CONDITION_DYN_UID'] != '') {
|
||||
$ConditionalShowHideRoutines = $oFieldCondition->getConditionScript($_SESSION["CONDITION_DYN_UID"]); //lsl
|
||||
$ConditionalShowHideRoutines = $oFieldCondition->getConditionScript($_SESSION["CONDITION_DYN_UID"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -649,4 +649,3 @@ class Publisher
|
||||
$G_TABLE = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/**
|
||||
* class.pmDynaform.php
|
||||
* Implementing pmDynaform library in the running case.
|
||||
*
|
||||
*
|
||||
* @author Roly Rudy Gutierrez Pinto
|
||||
* @package engine.classes
|
||||
*/
|
||||
@@ -80,19 +80,37 @@ class pmDynaform
|
||||
|
||||
public function jsonr(&$json)
|
||||
{
|
||||
foreach ($json as $key => $value) {
|
||||
foreach ($json as $key => &$value) {
|
||||
$sw1 = is_array($value);
|
||||
$sw2 = is_object($value);
|
||||
if ($sw1 || $sw2) {
|
||||
$this->jsonr($value);
|
||||
}
|
||||
if (!$sw1 && !$sw2) {
|
||||
//property
|
||||
//set properties from trigger
|
||||
$prefixs = array("@@", "@#", "@%", "@?", "@$", "@=");
|
||||
if (is_string($value) && in_array(substr($value, 0, 2), $prefixs)) {
|
||||
$triggerValue = substr($value, 2);
|
||||
if (isset($this->fields["APP_DATA"][$triggerValue])) {
|
||||
$json->$key = $this->fields["APP_DATA"][$triggerValue];
|
||||
$json->{$key} = $this->fields["APP_DATA"][$triggerValue];
|
||||
}
|
||||
}
|
||||
//set properties from 'formInstance' variable
|
||||
if (isset($this->fields["APP_DATA"]["formInstance"])) {
|
||||
$formInstance = $this->fields["APP_DATA"]["formInstance"];
|
||||
if (!is_array($formInstance)) {
|
||||
$formInstance = array($formInstance);
|
||||
}
|
||||
$nfi = count($formInstance);
|
||||
for ($ifi = 0; $ifi < $nfi; $ifi++) {
|
||||
$fi = $formInstance[$ifi];
|
||||
if (is_object($fi) && isset($fi->id) && $key === "id" && $json->{$key} === $fi->id) {
|
||||
foreach ($fi as $keyfi => $valuefi) {
|
||||
if (isset($json->{$keyfi})) {
|
||||
$json->{$keyfi} = $valuefi;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//query & options
|
||||
@@ -136,11 +154,17 @@ class pmDynaform
|
||||
array_push($json->options, $option);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if (isset($json->options[0])) {
|
||||
$json->data = $json->options[0];
|
||||
$no = count($json->options);
|
||||
for ($io = 0; $io < $no; $io++) {
|
||||
if ($json->options[$io]["value"] === $json->defaultValue) {
|
||||
$json->data = $json->options[$io];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//data
|
||||
@@ -187,7 +211,7 @@ class pmDynaform
|
||||
if ($column->type === "text" || $column->type === "textarea" || $column->type === "dropdown" || $column->type === "datetime" || $column->type === "checkbox" || $column->type === "file" || $column->type === "link") {
|
||||
array_push($cells, array(
|
||||
"value" => isset($row[$column->name]) ? $row[$column->name] : "",
|
||||
"label" => isset($row[$column->name . "_label"]) ? $row[$column->name . "_label"] : ""
|
||||
"label" => isset($row[$column->name . "_label"]) ? $row[$column->name . "_label"] : (isset($row[$column->name]) ? $row[$column->name] : "")
|
||||
));
|
||||
}
|
||||
if ($column->type === "suggest") {
|
||||
@@ -208,11 +232,15 @@ class pmDynaform
|
||||
$this->lang = $json->language;
|
||||
}
|
||||
if ($this->langs !== null) {
|
||||
if (($key === "label" || $key === "hint" || $key === "placeholder" || $key === "validateMessage" || $key === "alternateText" || $key === "comment" || $key === "alt") && isset($json->{$key}) && isset($this->langs->{$this->lang})) {
|
||||
if (($key === "label" || $key === "title" || $key === "hint" || $key === "placeholder" || $key === "validateMessage" || $key === "alternateText" || $key === "comment" || $key === "alt") && isset($this->langs->{$this->lang})) {
|
||||
$langs = $this->langs->{$this->lang}->Labels;
|
||||
foreach ($langs as $langsValue) {
|
||||
if ($json->{$key} === $langsValue->msgid)
|
||||
if (is_object($json) && $json->{$key} === $langsValue->msgid) {
|
||||
$json->{$key} = $langsValue->msgstr;
|
||||
}
|
||||
if (is_array($json) && $json[$key] === $langsValue->msgid) {
|
||||
$json[$key] = $langsValue->msgstr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -225,6 +253,72 @@ class pmDynaform
|
||||
return $this->record != null && $this->record["DYN_VERSION"] == 2 ? true : false;
|
||||
}
|
||||
|
||||
public function printViewWithoutSubmit()
|
||||
{
|
||||
ob_clean();
|
||||
|
||||
$json = G::json_decode($this->record["DYN_CONTENT"]);
|
||||
|
||||
foreach ($json->items[0]->items as $key => $value) {
|
||||
switch ($json->items[0]->items[$key][0]->type) {
|
||||
case "submit":
|
||||
unset($json->items[0]->items[$key]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$this->jsonr($json);
|
||||
|
||||
$javascript = "
|
||||
<script type=\"text/javascript\">
|
||||
var jsondata = " . G::json_encode($json) . ";
|
||||
var pm_run_outside_main_app = \"\";
|
||||
var dyn_uid = \"" . $this->fields["CURRENT_DYNAFORM"] . "\";
|
||||
var __DynaformName__ = \"" . $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"] . "\";
|
||||
var app_uid = \"" . $this->fields["APP_UID"] . "\";
|
||||
var prj_uid = \"" . $this->fields["PRO_UID"] . "\";
|
||||
var step_mode = \"\";
|
||||
var workspace = \"" . SYS_SYS . "\";
|
||||
var credentials = " . G::json_encode($this->credentials) . ";
|
||||
var filePost = \"\";
|
||||
var fieldsRequired = null;
|
||||
var triggerDebug = false;
|
||||
|
||||
$(window).load(function ()
|
||||
{
|
||||
var data = jsondata;
|
||||
data.items[0].mode = \"disabled\";
|
||||
|
||||
window.project = new PMDynaform.core.Project({
|
||||
data: data,
|
||||
keys: {
|
||||
server: location.host,
|
||||
projectId: prj_uid,
|
||||
workspace: workspace
|
||||
},
|
||||
token: credentials,
|
||||
submitRest: false
|
||||
});
|
||||
$(document).find(\"form\").submit(function (e) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<div style=\"margin: 10px 20px 10px 0;\">
|
||||
<div style=\"float: right\"><a href=\"javascript: window.history.go(-1);\" style=\"text-decoration: none;\">< " . G::LoadTranslation("ID_BACK") . "</a></div>
|
||||
<div style=\"clear: both\"></div>
|
||||
</div>
|
||||
";
|
||||
|
||||
$file = file_get_contents(PATH_HOME . "public_html" . PATH_SEP . "lib" . PATH_SEP . "pmdynaform" . PATH_SEP . "build" . PATH_SEP . "pmdynaform.html");
|
||||
$file = str_replace("{javascript}", $javascript, $file);
|
||||
|
||||
echo $file;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
public function printView()
|
||||
{
|
||||
ob_clean();
|
||||
@@ -409,6 +503,8 @@ class pmDynaform
|
||||
$json->name = $newVariable["VAR_NAME"];
|
||||
if (isset($json->dbConnection) && $json->dbConnection === $oldVariable["VAR_DBCONNECTION"])
|
||||
$json->dbConnection = $newVariable["VAR_DBCONNECTION"];
|
||||
if (isset($json->dbConnectionLabel) && $json->dbConnectionLabel === $oldVariable["VAR_DBCONNECTION_LABEL"])
|
||||
$json->dbConnectionLabel = $newVariable["VAR_DBCONNECTION_LABEL"];
|
||||
if (isset($json->sql) && $json->sql === $oldVariable["VAR_SQL"])
|
||||
$json->sql = $newVariable["VAR_SQL"];
|
||||
if (isset($json->options) && G::json_encode($json->options) === $oldVariable["VAR_ACCEPTED_VALUES"]) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
$DYN_UID = $_GET["dyn_uid"];
|
||||
$_SESSION['PROCESS'] = $_GET["prj_uid"];
|
||||
G::LoadClass('pmDynaform');
|
||||
$a = new pmDynaform(array("CURRENT_DYNAFORM" => $DYN_UID));
|
||||
$a->printPmDynaform();
|
||||
|
||||
@@ -54,11 +54,27 @@ switch ($_GET['CTO_TYPE_OBJ']) {
|
||||
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PRINT_PREVIEW'] = '#';
|
||||
$Fields['APP_DATA']['__DYNAFORM_OPTIONS']['PRINT_PREVIEW_ACTION'] = 'tracker_PrintView?CTO_UID_OBJ=' . $_GET['CTO_UID_OBJ'] . '&CTO_TYPE_OBJ=PRINT_PREVIEW';
|
||||
$_SESSION['CTO_UID_OBJ'] = $_GET['CTO_UID_OBJ'];
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent( 'dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['CTO_UID_OBJ'], '', $Fields['APP_DATA'], '', '', 'view' );
|
||||
G::RenderPage( 'publish' );
|
||||
break;
|
||||
|
||||
$dynaForm = new Dynaform();
|
||||
$arrayDynaFormData = $dynaForm->Load($_GET["CTO_UID_OBJ"]);
|
||||
|
||||
if (isset($arrayDynaFormData["DYN_VERSION"]) && $arrayDynaFormData["DYN_VERSION"] == 2) {
|
||||
G::LoadClass("pmDynaform");
|
||||
|
||||
$Fields["PRO_UID"] = $_SESSION["PROCESS"];
|
||||
$Fields["CURRENT_DYNAFORM"] = $_GET["CTO_UID_OBJ"];
|
||||
|
||||
$pmDynaForm = new pmDynaform($Fields);
|
||||
|
||||
if ($pmDynaForm->isResponsive()) {
|
||||
$pmDynaForm->printViewWithoutSubmit();
|
||||
}
|
||||
} else {
|
||||
$G_PUBLISH = new Publisher();
|
||||
$G_PUBLISH->AddContent("dynaform", "xmlform", $_SESSION["PROCESS"] . "/" . $_GET["CTO_UID_OBJ"], "", $Fields["APP_DATA"], "", "", "view");
|
||||
G::RenderPage("publish");
|
||||
}
|
||||
break;
|
||||
case 'INPUT_DOCUMENT':
|
||||
G::LoadClass( 'case' );
|
||||
$oCase = new Cases();
|
||||
|
||||
@@ -129,10 +129,13 @@ class Variable
|
||||
$cnn = \Propel::getConnection("workflow");
|
||||
try {
|
||||
$variable = \ProcessVariablesPeer::retrieveByPK($variableUid);
|
||||
$dbConnection = \DbSourcePeer::retrieveByPK($variable->getVarDbconnection(), $variable->getPrjUid());
|
||||
|
||||
$oldVariable = array(
|
||||
"VAR_NAME" => $variable->getVarName(),
|
||||
"VAR_FIELD_TYPE" => $variable->getVarFieldType(),
|
||||
"VAR_DBCONNECTION" => $variable->getVarDbconnection(),
|
||||
"VAR_DBCONNECTION_LABEL" => $dbConnection !== null ? '[' . $dbConnection->getDbsServer() . ':' . $dbConnection->getDbsPort() . '] ' . $dbConnection->getDbsType() . ': ' . $dbConnection->getDbsDatabaseName() : 'PM Database',
|
||||
"VAR_SQL" => $variable->getVarSql(),
|
||||
"VAR_ACCEPTED_VALUES" => $variable->getVarAcceptedValues()
|
||||
);
|
||||
@@ -170,10 +173,12 @@ class Variable
|
||||
$variable->save();
|
||||
$cnn->commit();
|
||||
//update dynaforms
|
||||
$dbConnection = \DbSourcePeer::retrieveByPK($variable->getVarDbconnection(), $variable->getPrjUid());
|
||||
$newVariable = array(
|
||||
"VAR_NAME" => $variable->getVarName(),
|
||||
"VAR_FIELD_TYPE" => $variable->getVarFieldType(),
|
||||
"VAR_DBCONNECTION" => $variable->getVarDbconnection(),
|
||||
"VAR_DBCONNECTION_LABEL" => $dbConnection !== null ? '[' . $dbConnection->getDbsServer() . ':' . $dbConnection->getDbsPort() . '] ' . $dbConnection->getDbsType() . ': ' . $dbConnection->getDbsDatabaseName() : 'PM Database',
|
||||
"VAR_SQL" => $variable->getVarSql(),
|
||||
"VAR_ACCEPTED_VALUES" => $variable->getVarAcceptedValues()
|
||||
);
|
||||
@@ -265,9 +270,14 @@ class Variable
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_NULL);
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_DEFAULT);
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_ACCEPTED_VALUES);
|
||||
$criteria->addSelectColumn(\DbSourcePeer::DBS_SERVER);
|
||||
$criteria->addSelectColumn(\DbSourcePeer::DBS_PORT);
|
||||
$criteria->addSelectColumn(\DbSourcePeer::DBS_DATABASE_NAME);
|
||||
$criteria->addSelectColumn(\DbSourcePeer::DBS_TYPE);
|
||||
|
||||
$criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL);
|
||||
$criteria->add(\ProcessVariablesPeer::VAR_UID, $variableUid, \Criteria::EQUAL);
|
||||
$criteria->addJoin(\ProcessVariablesPeer::VAR_DBCONNECTION, \DbSourcePeer::DBS_UID, \Criteria::LEFT_JOIN);
|
||||
|
||||
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
|
||||
|
||||
@@ -283,7 +293,8 @@ class Variable
|
||||
'var_field_type' => $aRow['VAR_FIELD_TYPE'],
|
||||
'var_field_size' => (int)$aRow['VAR_FIELD_SIZE'],
|
||||
'var_label' => $aRow['VAR_LABEL'],
|
||||
'var_dbconnection' => $aRow['VAR_DBCONNECTION'],
|
||||
'var_dbconnection' => $aRow['VAR_DBCONNECTION'] === 'none' ? 'workflow' : $aRow['VAR_DBCONNECTION'],
|
||||
'var_dbconnection_label' => $aRow['DBS_SERVER'] !== null ? '[' . $aRow['DBS_SERVER'] . ':' . $aRow['DBS_PORT'] . '] ' . $aRow['DBS_TYPE'] . ': ' . $aRow['DBS_DATABASE_NAME'] : 'PM Database',
|
||||
'var_sql' => $aRow['VAR_SQL'],
|
||||
'var_null' => (int)$aRow['VAR_NULL'],
|
||||
'var_default' => $aRow['VAR_DEFAULT'],
|
||||
@@ -326,8 +337,13 @@ class Variable
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_NULL);
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_DEFAULT);
|
||||
$criteria->addSelectColumn(\ProcessVariablesPeer::VAR_ACCEPTED_VALUES);
|
||||
$criteria->addSelectColumn(\DbSourcePeer::DBS_SERVER);
|
||||
$criteria->addSelectColumn(\DbSourcePeer::DBS_PORT);
|
||||
$criteria->addSelectColumn(\DbSourcePeer::DBS_DATABASE_NAME);
|
||||
$criteria->addSelectColumn(\DbSourcePeer::DBS_TYPE);
|
||||
|
||||
$criteria->add(\ProcessVariablesPeer::PRJ_UID, $processUid, \Criteria::EQUAL);
|
||||
$criteria->addJoin(\ProcessVariablesPeer::VAR_DBCONNECTION, \DbSourcePeer::DBS_UID, \Criteria::LEFT_JOIN);
|
||||
|
||||
$rsCriteria = \ProcessVariablesPeer::doSelectRS($criteria);
|
||||
|
||||
@@ -343,7 +359,8 @@ class Variable
|
||||
'var_field_type' => $aRow['VAR_FIELD_TYPE'],
|
||||
'var_field_size' => (int)$aRow['VAR_FIELD_SIZE'],
|
||||
'var_label' => $aRow['VAR_LABEL'],
|
||||
'var_dbconnection' => $aRow['VAR_DBCONNECTION'],
|
||||
'var_dbconnection' => $aRow['VAR_DBCONNECTION'] === 'none' ? 'workflow' : $aRow['VAR_DBCONNECTION'],
|
||||
'var_dbconnection_label' => $aRow['DBS_SERVER'] !== null ? '[' . $aRow['DBS_SERVER'] . ':' . $aRow['DBS_PORT'] . '] ' . $aRow['DBS_TYPE'] . ': ' . $aRow['DBS_DATABASE_NAME'] : 'PM Database',
|
||||
'var_sql' => $aRow['VAR_SQL'],
|
||||
'var_null' => (int)$aRow['VAR_NULL'],
|
||||
'var_default' => $aRow['VAR_DEFAULT'],
|
||||
@@ -690,4 +707,3 @@ class Variable
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<USR_USERNAME type="text" size="30" maxlength="50" required="true" validate="Any" autocomplete="0">
|
||||
<en><![CDATA[User]]></en>
|
||||
</USR_USERNAME>
|
||||
<USR_EMAIL type="text" size="30" required="true" maxlength="64" autocomplete="0">
|
||||
<USR_EMAIL type="text" size="30" required="true" maxlength="254" autocomplete="0">
|
||||
<en><![CDATA[Email]]></en>
|
||||
</USR_EMAIL>
|
||||
<URL type="hidden"/>
|
||||
|
||||
Reference in New Issue
Block a user