Merged colosa/processmaker into master

This commit is contained in:
jonathan quispe
2015-03-04 15:28:46 -04:00
9 changed files with 129 additions and 20 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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" .
"</script>\n" .
"<script type='text/javascript' src='/jscore/cases/core/cases_Step.js'></script>\n" .
"<script type='text/javascript' src='/jscore/cases/core/pmDynaform.js'></script>\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" .
"</script>\n" .
"<script type='text/javascript' src='/jscore/cases/core/pmDynaform.js'></script>\n" .
"<div style='width:100%;padding: 0px 10px 0px 10px;margin:15px 0px 0px 0px;'>\n" .
@@ -387,7 +393,7 @@ class pmDynaform
{
if ($this->debugMode) {
echo "<pre>";
echo G::json_encode($json);
echo G::json_encode(array($this->app_data, $this->data));
echo "</pre>";
}
}

View File

@@ -75,4 +75,7 @@ $(window).load(function () {
form.submit();
return false;
};
if (triggerDebug === true) {
showdebug();
}
});

View File

@@ -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()) : ''));

View File

@@ -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();
}
}

View File

@@ -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()));
}
}
}

View File

@@ -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 {

View File

@@ -7,9 +7,11 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" href="/lib/pmdynaform/libs/bootstrap-3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="/lib/pmdynaform/libs/datepicker/bootstrap-datetimepicker.css">
<link rel="stylesheet" href="/lib/pmdynaform/build/css/PMDynaform.css">
<script type="text/javascript" src="/lib/pmdynaform/libs/jquery/jquery-1.11.js"></script>
<script type="text/javascript" src="/lib/pmdynaform/libs/bootstrap-3.1.1/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/lib/pmdynaform/libs/datepicker/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" src="/lib/pmdynaform/libs/underscore/underscore-1.6.js"></script>
<script type="text/javascript" src="/lib/pmdynaform/libs/backbone/backbone-min.js"></script>
<script type="text/javascript" src="/lib/pmdynaform/libs/restclient/restclient.js"></script>
@@ -19,6 +21,7 @@
<body>
<div id="container"></div>
###TEMPLATES###
<script type="text/javascript" src="/lib/pmdynaform/libs/underscore/underscore-1.6.js"></script>
<script type="text/javascript" src="/lib/pmdynaform/build/js/PMDynaform.js"></script>
{javascript}
</body>