diff --git a/Rakefile b/Rakefile index 8c314a6fc..e66aa1033 100644 --- a/Rakefile +++ b/Rakefile @@ -230,7 +230,8 @@ def buildMafe(homeDir, targetDir, mode) "#{homeDir}/build/js/designer.js" => "#{mafeDir}/designer.min.js", "#{homeDir}/build/js/mafe.js" => "#{mafeDir}/mafe.min.js", "#{homeDir}/build/css/mafe.css" => "#{mafeDir}/mafe.min.css", - "#{homeDir}/img/*.*" => "#{imgTargetDir}" + "#{homeDir}/img/*.*" => "#{imgTargetDir}", + "#{targetDir}/../lib-dev/pmUI/images/*.*" => "#{imgTargetDir}" }) puts "\nCopying lib files into: #{jsTargetDir}".bold diff --git a/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php index 42fc81e1c..58f0aef75 100644 --- a/framework/src/Maveriks/WebApplication.php +++ b/framework/src/Maveriks/WebApplication.php @@ -297,7 +297,9 @@ class WebApplication $port = empty($port) ? '' : ";port=$port"; Services\OAuth2\Server::setDatabaseSource(DB_USER, DB_PASS, DB_ADAPTER.":host=$host;dbname=".DB_NAME.$port); if (DB_NAME != DB_RBAC_NAME) { //it's PM < 3 - Services\OAuth2\Server::setDatabaseSourceRBAC(DB_RBAC_USER, DB_RBAC_PASS, DB_ADAPTER.":host=".DB_RBAC_HOST.";dbname=".DB_RBAC_NAME.$port); + list($host, $port) = strpos(DB_RBAC_HOST, ':') !== false ? explode(':', DB_RBAC_HOST) : array(DB_RBAC_HOST, ''); + $port = empty($port) ? '' : ";port=$port"; + Services\OAuth2\Server::setDatabaseSourceRBAC(DB_RBAC_USER, DB_RBAC_PASS, DB_ADAPTER.":host=$host;dbname=".DB_RBAC_NAME.$port); } // Setting default OAuth Client id, for local PM Web Designer diff --git a/workflow/engine/classes/class.pmDynaform.php b/workflow/engine/classes/class.pmDynaform.php index 9f6cf0dc3..a6e6806be 100644 --- a/workflow/engine/classes/class.pmDynaform.php +++ b/workflow/engine/classes/class.pmDynaform.php @@ -87,21 +87,8 @@ class pmDynaform $json->$key = $this->app_data[$triggerValue]; } } - //data - if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown")) { - $json->data = array( - "value" => isset($this->data[$json->name]) ? $this->data[$json->name] : "", - "label" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : "" - ); - } - if ($key === "type" && ($value === "suggets")) { - $json->data = array( - "value" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : "", - "label" => isset($this->data[$json->name]) ? $this->data[$json->name] : "" - ); - } //query & options - if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown" || $value === "suggest")) { + if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown" || $value === "suggest" || $value === "checkbox" || $value === "radio")) { if (!isset($json->dbConnection)) $json->dbConnection = "none"; if (!isset($json->sql)) @@ -120,9 +107,24 @@ class pmDynaform ); array_push($json->options, $option); } - $json->data = isset($json->options[0]) ? $json->options[0] : $json->data; + if (isset($json->options[0])) { + $json->data = $json->options[0]; + } } } + //data + if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown" || $value === "checkbox" || $value === "radio")) { + $json->data = array( + "value" => isset($this->data[$json->name]) ? $this->data[$json->name] : "", + "label" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : "" + ); + } + if ($key === "type" && ($value === "suggest")) { + $json->data = array( + "value" => isset($this->data[$json->name . "_label"]) ? $this->data[$json->name . "_label"] : "", + "label" => isset($this->data[$json->name]) ? $this->data[$json->name] : "" + ); + } //grid if ($key === "type" && ($value === "grid")) { if (isset($this->data[$json->name])) { @@ -191,6 +193,7 @@ class pmDynaform "var credentials = " . G::json_encode($clientToken) . ";\n" . "var filePost = null;\n" . "var fieldsRequired = null;\n" . + "var triggerDebug = null;\n" . "$(window).load(function () {\n" . " var data = jsondata;\n" . " data.items[0].mode = 'view';\n" . @@ -221,6 +224,7 @@ class pmDynaform public function printEdit($pm_run_outside_main_app, $application, $headData, $step_mode = 'EDIT') { + error_log(print_r($this->app_data, true)); ob_clean(); $json = G::json_decode($this->record["DYN_CONTENT"]); $this->jsonr($json); @@ -242,6 +246,7 @@ class pmDynaform "var credentials = " . G::json_encode($this->credentials) . ";\n" . "var filePost = null;\n" . "var fieldsRequired = null;\n" . + "var triggerDebug = " . ($this->app_data["TRIGGER_DEBUG"] === 1 ? "true" : "false") . ";\n" . "\n" . "\n" . "\n" . @@ -282,6 +287,7 @@ class pmDynaform "var credentials = " . G::json_encode($this->credentials) . ";\n" . "var filePost = '" . $filename . "';\n" . "var fieldsRequired = " . G::json_encode($this->arrayFieldRequired) . ";\n" . + "var triggerDebug = null;\n" . "\n" . "\n" . "
";
- echo G::json_encode($json);
+ echo G::json_encode(array($this->app_data, $this->data));
echo "";
}
}
diff --git a/workflow/engine/js/cases/core/pmDynaform.js b/workflow/engine/js/cases/core/pmDynaform.js
index befaa4abd..bc6ddf189 100644
--- a/workflow/engine/js/cases/core/pmDynaform.js
+++ b/workflow/engine/js/cases/core/pmDynaform.js
@@ -75,4 +75,7 @@ $(window).load(function () {
form.submit();
return false;
};
+ if (triggerDebug === true) {
+ showdebug();
+ }
});
\ No newline at end of file
diff --git a/workflow/engine/methods/cases/cases_Step.php b/workflow/engine/methods/cases/cases_Step.php
index 5daf495cc..6ee2a1c8d 100755
--- a/workflow/engine/methods/cases/cases_Step.php
+++ b/workflow/engine/methods/cases/cases_Step.php
@@ -272,6 +272,7 @@ try {
$a = new pmDynaform($_GET['UID'], $Fields['APP_DATA']);
if ($a->isResponsive()) {
$a->app_data["PRO_SHOW_MESSAGE"] = $noShowTitle;
+ $a->app_data["TRIGGER_DEBUG"] = $_SESSION['TRIGGER_DEBUG']['ISSET'];
$a->printEdit((!isset($_SESSION["PM_RUN_OUTSIDE_MAIN_APP"])) ? "true" : "false", $_SESSION['APPLICATION'], $array, $oStep->getStepMode());
} else {
$G_PUBLISH->AddContent('dynaform', 'xmlform', $_SESSION['PROCESS'] . '/' . $_GET['UID'], '', $Fields['APP_DATA'], 'cases_SaveData?UID=' . $_GET['UID'] . '&APP_UID=' . $_SESSION['APPLICATION'], '', (strtolower($oStep->getStepMode()) != 'edit' ? strtolower($oStep->getStepMode()) : ''));
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php
index 2d423184f..c55094132 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/Light.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/Light.php
@@ -55,6 +55,7 @@ class Light
$task->setFormatFieldNameInUppercase(false);
$task->setArrayParamException(array("taskUid" => "act_uid", "stepUid" => "step_uid"));
+ $response = array();
foreach ($processList as $key => $processInfo) {
$tempTreeChildren = array ();
foreach ($processList[$key] as $keyChild => $processInfoChild) {
@@ -78,7 +79,7 @@ class Light
$tempTreeChildren[] = $tempTreeChild;
}
}
- $response = $tempTreeChildren;
+ $response = array_merge($response, $tempTreeChildren);
}
} catch (\Exception $e) {
throw $e;
@@ -592,4 +593,78 @@ class Light
return $response;
}
+
+ /**
+ * Get information for status paused and participated or other status
+ *
+ * @param $userUid
+ * @param $type
+ * @param $app_uid
+ * @throws \Exception
+ */
+ public function getInformation($userUid, $type, $app_uid)
+ {
+ switch ($type) {
+ case 'paused':
+ case 'participated':
+ $oCase = new \Cases();
+ $iDelIndex = $oCase->getCurrentDelegationCase( $app_uid );
+ $aFields = $oCase->loadCase( $app_uid, $iDelIndex );
+ $this->getInfoResume($userUid, $aFields, $type);
+ break;
+ }
+ }
+
+ /**
+ * view in html response for status
+ *
+ * @param $userUid
+ * @param $Fields
+ * @param $type
+ * @throws \Exception
+ */
+ public function getInfoResume($userUid, $Fields, $type)
+ {
+ //print_r($Fields);die;
+ /* Includes */
+ G::LoadClass( 'case' );
+ /* Prepare page before to show */
+ //$oCase = new \Cases();
+
+// $participated = $oCase->userParticipatedInCase( $Fields['APP_UID'], $userUid );
+// if ($RBAC->userCanAccess( 'PM_ALLCASES' ) < 0 && $participated == 0) {
+// /*if (strtoupper($Fields['APP_STATUS']) != 'COMPLETED') {
+// $oCase->thisIsTheCurrentUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED'], 'SHOW_MESSAGE');
+// }*/
+// $aMessage['MESSAGE'] = G::LoadTranslation( 'ID_NO_PERMISSION_NO_PARTICIPATED' );
+// $G_PUBLISH = new Publisher();
+// $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
+// G::RenderPage( 'publishBlank', 'blank' );
+// die();
+// }
+
+ $objProc = new \Process();
+ $aProc = $objProc->load( $Fields['PRO_UID'] );
+ $Fields['PRO_TITLE'] = $aProc['PRO_TITLE'];
+
+ $objTask = new \Task();
+
+ if (isset($_SESSION['ACTION']) && ($_SESSION['ACTION'] == 'jump')) {
+ $task = explode('-', $Fields['TAS_UID']);
+ $Fields['TAS_TITLE'] = '';
+ for( $i = 0; $i < sizeof($task)-1; $i ++ ) {
+ $aTask = $objTask->load( $task[$i] );
+ $Fields['TAS_TITLE'][] = $aTask['TAS_TITLE'];
+ }
+ $Fields['TAS_TITLE'] = implode(" - ", array_values($Fields['TAS_TITLE']));
+ } else {
+ $aTask = $objTask->load( $Fields['TAS_UID'] );
+ $Fields['TAS_TITLE'] = $aTask['TAS_TITLE'];
+ }
+
+ require_once(PATH_GULLIVER .'../thirdparty/smarty/libs/Smarty.class.php');
+ $G_PUBLISH = new \Publisher();
+ $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'cases/cases_Resume.xml', '', $Fields, '' );
+ $G_PUBLISH->RenderContent();
+ }
}
diff --git a/workflow/engine/src/ProcessMaker/Services/Api/Light.php b/workflow/engine/src/ProcessMaker/Services/Api/Light.php
index bac12171a..1148d746e 100644
--- a/workflow/engine/src/ProcessMaker/Services/Api/Light.php
+++ b/workflow/engine/src/ProcessMaker/Services/Api/Light.php
@@ -713,4 +713,22 @@ class Light extends Api
}
return $files;
}
+
+ /**
+ * @url GET /:type/case/:app_uid
+ *
+ * @param $access
+ * @param $refresh
+ * @return mixed
+ */
+ public function getInformation($type, $app_uid)
+ {
+ try {
+ $userUid = $this->getUserId();
+ $oMobile = new \ProcessMaker\BusinessModel\Light();
+ $oMobile->getInformation($userUid, $type, $app_uid);
+ } catch (\Exception $e) {
+ throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
+ }
+ }
}
diff --git a/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php b/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php
index fde833117..6ff57df53 100644
--- a/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php
+++ b/workflow/engine/src/ProcessMaker/Services/OAuth2/Server.php
@@ -49,7 +49,7 @@ class Server implements iAuthenticate
$cnn = array('dsn' => self::$dsn, 'username' => self::$dbUser, 'password' => self::$dbPassword);
if (self::$isRBAC) {
- $config = array('user_table' => 'USERS');
+ $config = array();
$cnnrbac = array('dsn' => self::$dsnRBAC, 'username' => self::$dbUserRBAC, 'password' => self::$dbPasswordRBAC);
$this->storage = new PmPdo($cnn, $config, $cnnrbac);
} else {
diff --git a/workflow/engine/templates/cases/pmdynaform.html b/workflow/engine/templates/cases/pmdynaform.html
index e3920be59..b93895beb 100644
--- a/workflow/engine/templates/cases/pmdynaform.html
+++ b/workflow/engine/templates/cases/pmdynaform.html
@@ -7,9 +7,11 @@
+
+
@@ -19,6 +21,7 @@
###TEMPLATES###
+
{javascript}