Merged colosa/processmaker into master

This commit is contained in:
Richard Yujra
2015-03-04 14:13:01 -04:00
7 changed files with 110 additions and 29 deletions

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

@@ -101,7 +101,7 @@ class pmDynaform
);
}
//query & options
if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown" || $value === "suggets")) {
if ($key === "type" && ($value === "text" || $value === "textarea" || $value === "dropdown" || $value === "suggest")) {
if (!isset($json->dbConnection))
$json->dbConnection = "none";
if (!isset($json->sql))
@@ -135,14 +135,14 @@ class pmDynaform
//data
if ($column->type === "text" || $column->type === "textarea" || $column->type === "dropdown") {
array_push($cells, array(
"value" => $row[$column->name],
"label" => $row[$column->name . "_label"]
"value" => isset($row[$column->name]) ? $row[$column->name] : "",
"label" => isset($row[$column->name . "_label"]) ? $row[$column->name . "_label"] : ""
));
}
if ($column->type === "suggest") {
array_push($cells, array(
"value" => $row[$column->name . "_label"],
"label" => $row[$column->name]
"value" => isset($row[$column->name . "_label"]) ? $row[$column->name . "_label"] : "",
"label" => isset($row[$column->name]) ? $row[$column->name] : ""
));
}
}

View File

@@ -1,25 +1,11 @@
function ajax_post(action, form, method, callback, asynchronous) {
document.getElementById("dyn_forward").onclick();
window.onload = function () {
method();
};
}
function dynaFormChanged(frm) {
for (var i1 = 0; i1 <= frm.elements.length - 1; i1++) {
if ((frm.elements[i1].type === "radio" || frm.elements[i1].type === "checkbox") && (frm.elements[i1].checked !== frm.elements[i1].defaultChecked)) {
return true;
}
if ((frm.elements[i1].type === "textarea" || frm.elements[i1].type === "text" || frm.elements[i1].type === "file") && (frm.elements[i1].value !== frm.elements[i1].defaultValue)) {
return true;
}
if (frm.elements[i1].tagName.toLowerCase() === "select") {
var selectDefaultValue = frm.elements[i1].value;
for (var i2 = 0; i2 <= frm.elements[i1].options.length - 1; i2++) {
if (frm.elements[i1].options[i2].defaultSelected) {
selectDefaultValue = frm.elements[i1].options[i2].value;
break;
}
}
if (frm.elements[i1].value !== selectDefaultValue) {
return true;
}
}
}
return false;
return true;
}
$(window).load(function () {
if (pm_run_outside_main_app === 'true') {
@@ -28,6 +14,7 @@ $(window).load(function () {
}
if (parent.setCurrent) {
parent.setCurrent(dyn_uid);
}
}
var data = jsondata;

View File

@@ -592,4 +592,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

@@ -249,7 +249,7 @@ Ext.onReady(function(){
if (iframeDynaForm.getElementsByTagName("form")) {
dynaformChange = iframeDynaForm.getElementsByTagName("form").item(0);
if (typeof(window.frames["openCaseFrame"].dynaFormChanged) == "function") {
if (typeof(window.frames["openCaseFrame"].dynaFormChanged) == "function" && dynaformChange) {
swDynaformChange = (window.frames["openCaseFrame"].dynaFormChanged(dynaformChange))? 1 : 0;
}
}