Merge branch 'master' of bitbucket.org:colosa/processmaker into BUG-14958

This commit is contained in:
Luis Fernando Saisa Lopez
2014-09-25 17:21:29 -04:00
6 changed files with 25 additions and 57 deletions

View File

@@ -49,7 +49,7 @@ class Designer extends Controller
$request = new \OAuth2\Request(array(), $request, array(), array(), array(), $server, null, $headers); $request = new \OAuth2\Request(array(), $request, array(), array(), array(), $server, null, $headers);
$oauthServer = new \ProcessMaker\Services\OAuth2\Server(); $oauthServer = new \ProcessMaker\Services\OAuth2\Server();
$response = $oauthServer->getServer()->handleTokenRequest($request); $response = $oauthServer->postToken($request, true);
$clientToken = $response->getParameters(); $clientToken = $response->getParameters();
$clientToken["client_id"] = $client['CLIENT_ID']; $clientToken["client_id"] = $client['CLIENT_ID'];
$clientToken["client_secret"] = $client['CLIENT_SECRET']; $clientToken["client_secret"] = $client['CLIENT_SECRET'];

View File

@@ -73,16 +73,6 @@ foreach ($workspaces as $index => $workspace) {
sort( $arrayAux ); sort( $arrayAux );
$arrayWorkspace = array ();
foreach ($arrayAux as $index => $value) {
$arrayWorkspace[] = array ($value,$value
);
}
array_unshift( $arrayWorkspace, array ("ALL",G::LoadTranslation( "ID_ALL_WORKSPACES" )
) );
//Status //Status
$arrayStatus = array (array ("ALL",G::LoadTranslation( "ID_ALL" ) $arrayStatus = array (array ("ALL",G::LoadTranslation( "ID_ALL" )
),array ("COMPLETED",G::LoadTranslation( "COMPLETED" ) ),array ("COMPLETED",G::LoadTranslation( "COMPLETED" )
@@ -95,7 +85,6 @@ $oHeadPublisher->addContent( "setup/cron" ); //Adding a html file .html
$oHeadPublisher->addExtJsScript( "setup/cron", false ); //Adding a javascript file .js $oHeadPublisher->addExtJsScript( "setup/cron", false ); //Adding a javascript file .js
$oHeadPublisher->assign( "CONFIG", $config ); $oHeadPublisher->assign( "CONFIG", $config );
$oHeadPublisher->assign( "CRON", $cronInfo ); $oHeadPublisher->assign( "CRON", $cronInfo );
$oHeadPublisher->assign( "WORKSPACE", $arrayWorkspace );
$oHeadPublisher->assign( "STATUS", $arrayStatus ); $oHeadPublisher->assign( "STATUS", $arrayStatus );
G::RenderPage( "publish", "extJs" ); G::RenderPage( "publish", "extJs" );

View File

@@ -66,7 +66,7 @@ function cronArraySet ($str, $filter)
$arrayData = array (); $arrayData = array ();
if ($sw == 1) { if ($sw == 1) {
$arrayData = array ("DATE" => $date,"WORKSPACE" => $workspace,"ACTION" => $action,"STATUS" => $status,"DESCRIPTION" => $description $arrayData = array ("DATE" => $date, "ACTION" => $action, "STATUS" => $status, "DESCRIPTION" => $description
); );
} }
@@ -116,7 +116,7 @@ $response = array ();
switch ($option) { switch ($option) {
case "LST": case "LST":
$pageSize = $_REQUEST["pageSize"]; $pageSize = $_REQUEST["pageSize"];
$workspace = $_REQUEST["workspace"]; $workspace = SYS_SYS;
$status = $_REQUEST["status"]; $status = $_REQUEST["status"];
$dateFrom = $_REQUEST["dateFrom"]; $dateFrom = $_REQUEST["dateFrom"];
$dateTo = $_REQUEST["dateTo"]; $dateTo = $_REQUEST["dateTo"];

View File

@@ -120,6 +120,13 @@ class Activity extends Api
$task->setArrayParamException(array("taskUid" => "act_uid", "stepUid" => "step_uid")); $task->setArrayParamException(array("taskUid" => "act_uid", "stepUid" => "step_uid"));
$response = $task->getSteps($act_uid); $response = $task->getSteps($act_uid);
$step = new \ProcessMaker\Services\Api\Project\Activity\Step();
for ($i = 0; $i < count($response); $i++) {
$response[$i]["triggers"] = $step->doGetActivityStepTriggers($response[$i]["step_uid"], $act_uid, $prj_uid);
}
return $response; return $response;
} catch (\Exception $e) { } catch (\Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage())); throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));

View File

@@ -222,23 +222,26 @@ class Server implements iAuthenticate
* *
* @format JsonFormat,UploadFormat * @format JsonFormat,UploadFormat
*/ */
public function postToken() public function postToken($request = null, $returnResponse = false)
{ {
// Handle a request for an OAuth2.0 Access Token and send the response to the client // Handle a request for an OAuth2.0 Access Token and send the response to the client
$request = \OAuth2\Request::createFromGlobals(); if ($request == null) {
$request = \OAuth2\Request::createFromGlobals();
}
$response = $this->server->handleTokenRequest($request); $response = $this->server->handleTokenRequest($request);
$token = $response->getParameters(); $token = $response->getParameters();
if (array_key_exists('access_token', $token) if (array_key_exists('access_token', $token)
&& array_key_exists('refresh_token', $token) && array_key_exists('refresh_token', $token)
) { ) {
session_start(); if ($request == null) {
session_start();
}
$data = $this->storage->getAccessToken($token['access_token']); $data = $this->storage->getAccessToken($token['access_token']);
// verify if the client is our local PM Designer client // verify if the client is our local PM Designer client
if ($data['client_id'] == self::getPmClientId()) { if ($data['client_id'] == self::getPmClientId()) {
error_log('do stuff - is a request from local pm client'); //error_log('do stuff - is a request from local pm client');
//require_once "classes/model/PmoauthUserAccessTokens.php"; //require_once "classes/model/PmoauthUserAccessTokens.php";
$userToken = new \PmoauthUserAccessTokens(); $userToken = new \PmoauthUserAccessTokens();
@@ -252,7 +255,11 @@ class Server implements iAuthenticate
} }
} }
$response->send(); if ($returnResponse) {
return $response;
} else {
$response->send();
}
} }
/** /**
@@ -276,10 +283,9 @@ class Server implements iAuthenticate
$pmAccessToken = new \PmoauthUserAccessTokens(); $pmAccessToken = new \PmoauthUserAccessTokens();
$session = $pmAccessToken->getSessionData($token['ACCESS_TOKEN']); $session = $pmAccessToken->getSessionData($token['ACCESS_TOKEN']);
if ($session !== false && array_key_exists($session->getSessionId(), $_COOKIE)) { if ($session !== false && array_key_exists($session->getSessionName(), $_COOKIE)) {
// increase the timeout for local php session cookie // increase the timeout for local php session cookie
$config = \Bootstrap::getSystemConfiguration(); $config = \Bootstrap::getSystemConfiguration();
if (isset($config['session.gc_maxlifetime'])) { if (isset($config['session.gc_maxlifetime'])) {
$lifetime = $config['session.gc_maxlifetime']; $lifetime = $config['session.gc_maxlifetime'];
} else { } else {
@@ -289,7 +295,7 @@ class Server implements iAuthenticate
$lifetime = 1440; $lifetime = 1440;
} }
setcookie($session->getSessionName(), $_COOKIE[$session->getSessionId()], time() + $lifetime, "/"); setcookie($session->getSessionName(), $_COOKIE[$session->getSessionName()], time() + $lifetime, "/");
} }
} }

View File

@@ -63,7 +63,6 @@ cron.application = {
if (typeof record != "undefined") { if (typeof record != "undefined") {
var strData = "<b>" + _("ID_DATE_LABEL") + "</b><br />" + record.get("DATE") + "<br />"; var strData = "<b>" + _("ID_DATE_LABEL") + "</b><br />" + record.get("DATE") + "<br />";
strData = strData + "<b>" + _("ID_WORKSPACE") + "</b><br />" + record.get("WORKSPACE") + "<br />";
strData = strData + "<b>" + _("ID_ACTION") + "</b><br />" + record.get("ACTION") + "<br />"; strData = strData + "<b>" + _("ID_ACTION") + "</b><br />" + record.get("ACTION") + "<br />";
strData = strData + "<b>" + _("ID_STATUS") + "</b><br />" + record.get("STATUS") + "<br />"; strData = strData + "<b>" + _("ID_STATUS") + "</b><br />" + record.get("STATUS") + "<br />";
strData = strData + "<b>" + _("ID_DESCRIPTION") + "</b><br />" + record.get("DESCRIPTION") + "<br />"; strData = strData + "<b>" + _("ID_DESCRIPTION") + "</b><br />" + record.get("DESCRIPTION") + "<br />";
@@ -97,7 +96,6 @@ cron.application = {
totalProperty: "resultTotal", totalProperty: "resultTotal",
fields: [ fields: [
{name: "DATE"}, {name: "DATE"},
{name: "WORKSPACE"},
{name: "ACTION"}, {name: "ACTION"},
{name: "STATUS"}, {name: "STATUS"},
{name: "DESCRIPTION"} {name: "DESCRIPTION"}
@@ -114,7 +112,6 @@ cron.application = {
this.baseParams = { this.baseParams = {
"option": "LST", "option": "LST",
"pageSize": pageSize, "pageSize": pageSize,
"workspace": Ext.getCmp("cboWorkspace").getValue(),
"status": Ext.getCmp("cboStatus").getValue(), "status": Ext.getCmp("cboStatus").getValue(),
"dateFrom": Ext.getCmp("dateFrom").getValue(), "dateFrom": Ext.getCmp("dateFrom").getValue(),
"dateTo": Ext.getCmp("dateTo").getValue() "dateTo": Ext.getCmp("dateTo").getValue()
@@ -129,12 +126,6 @@ cron.application = {
} }
}); });
var storeWorkspace = new Ext.data.ArrayStore({
idIndex: 0,
fields: ["id", "value"],
data: WORKSPACE
});
var storeStatus = new Ext.data.ArrayStore({ var storeStatus = new Ext.data.ArrayStore({
idIndex: 0, idIndex: 0,
fields: ["id", "value"], fields: ["id", "value"],
@@ -166,28 +157,6 @@ cron.application = {
value: "" value: ""
}); });
var cboWorkspace = new Ext.form.ComboBox({
id: "cboWorkspace",
valueField: "id",
displayField: "value",
value: "ALL",
store: storeWorkspace,
triggerAction: "all",
mode: "local",
editable: false,
width: 150,
listeners: {
select: function (combo, record, index)
{
pagingCron.moveFirst();
}
}
});
var cboStatus = new Ext.form.ComboBox({ var cboStatus = new Ext.form.ComboBox({
id: "cboStatus", id: "cboStatus",
@@ -300,7 +269,6 @@ cron.application = {
expander, expander,
{id: "ID", dataIndex: "DATE", hidden: true, hideable: false}, {id: "ID", dataIndex: "DATE", hidden: true, hideable: false},
{header: _("ID_DATE_LABEL"), dataIndex: "DATE", width: 10, align: "center"}, {header: _("ID_DATE_LABEL"), dataIndex: "DATE", width: 10, align: "center"},
{header: _("ID_WORKSPACE"), dataIndex: "WORKSPACE", width: 10},
{header: _("ID_ACTION"), dataIndex: "ACTION", width: 10}, {header: _("ID_ACTION"), dataIndex: "ACTION", width: 10},
{header: _("ID_STATUS"), dataIndex: "STATUS", width: 7, align: "center"}, {header: _("ID_STATUS"), dataIndex: "STATUS", width: 7, align: "center"},
{header: _("ID_DESCRIPTION"), dataIndex: "DESCRIPTION"} {header: _("ID_DESCRIPTION"), dataIndex: "DESCRIPTION"}
@@ -399,8 +367,6 @@ cron.application = {
//"-", //"-",
//btnView, //btnView,
"->", "->",
{xtype: "tbtext", text: _("ID_WORKSPACE") + "&nbsp;"},
cboWorkspace,
"-", "-",
{xtype: "tbtext", text: _("ID_STATUS") + "&nbsp;"}, {xtype: "tbtext", text: _("ID_STATUS") + "&nbsp;"},
cboStatus, cboStatus,