Merge branch 'master' of bitbucket.org:colosa/processmaker

This commit is contained in:
Wendy Nestor
2014-04-25 16:11:15 -04:00
7 changed files with 123 additions and 51 deletions

View File

@@ -7,36 +7,17 @@
"repositories": [
{
"type": "package",
"package": {
"name": "jquery/jquery",
"version": "1.10.2",
"dist": {
"url": "http://code.jquery.com/jquery-1.10.2.min.js",
"type": "file"
}
}
"packagist": false
},
{
"type": "package",
"package": {
"name": "underscore/underscore",
"version": "1.5.2",
"dist": {
"url": "http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js",
"type": "file"
}
}
"type": "composer",
"url": "http://composer-public.colosa.net/"
},
{
"type": "vcs",
"url": "git@bitbucket.org:colosa/pmUI.git"
},
{
"type": "vcs",
"url": "git@bitbucket.org:colosa/MichelangeloFE.git"
"type": "composer",
"url": "http://composer.colosa.net/"
}
],
],
"minimum-stability": "stable",
"prefer-stable": true,

View File

@@ -69,7 +69,9 @@ class WebApplication
} else {
return self::RUNNING_DEFAULT;
}
} elseif (substr($this->requestUri, 1, 3) === "api") {
} elseif (substr($this->requestUri, 1, 3) === "api"
&& count(explode("/", $this->requestUri)) >= 4 // url api pattern: /api/1.0/<workspace>/<resource>
) {
return self::RUNNING_API;
} else {
return self::RUNNING_WORKFLOW;

View File

@@ -0,0 +1,63 @@
<?php
/**
* cliMafe.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
* @package workflow-engine-bin-tasks
*/
G::LoadSystem("g");
CLI::taskName('flush-cache');
CLI::taskDescription(<<<EOT
Flush cache of all workspaces of a given workspace
EOT
);
CLI::taskArg('workspace', true, true);
CLI::taskRun('run_flush_cache');
function run_flush_cache($args, $opts)
{
$rootDir = realpath(__DIR__."/../../../../");
$app = new Maveriks\WebApplication();
$app->setRootDir($rootDir);
$loadConstants = false;
$workspaces = get_workspaces_from_args($args);
if (! defined("PATH_C")) {
die("ERROR: seems processmaker is not properly installed (System constants are missing).".PHP_EOL);
}
CLI::logging("Flush ".pakeColor::colorize("system", "INFO")." cache ... ");
G::rm_dir(PATH_C);
G::mk_dir(PATH_C, 0777);
echo "DONE" . PHP_EOL;
foreach ($workspaces as $workspace) {
echo "Flush workspace " . pakeColor::colorize($workspace->name, "INFO") . " cache ... ";
G::rm_dir($workspace->path . "/cache");
G::mk_dir($workspace->path . "/cache", 0777);
G::rm_dir($workspace->path . "/cachefiles");
G::mk_dir($workspace->path . "/cachefiles", 0777);
echo "DONE" . PHP_EOL;
}
}

View File

@@ -58,7 +58,7 @@ G::LoadClass( 'pmFunctions' );
//call plugin
if (class_exists( 'folderData' )) {
//$folderData = new folderData($sProUid, $proFields['PRO_TITLE'], $sAppUid, $Fields['APP_TITLE'], $sUsrUid);
$oPluginRegistry = PMPluginRegistry::getSingleton();
$oPluginRegistry = &PMPluginRegistry::getSingleton();
$aAvailablePmFunctions = $oPluginRegistry->getPmFunctions();
foreach ($aAvailablePmFunctions as $key => $class) {
$filePlugin = PATH_PLUGINS . $class . PATH_SEP . 'classes' . PATH_SEP . 'class.pmFunctions.php';
@@ -165,7 +165,7 @@ class PMScript
foreach ($tokens as $token) {
if (is_string($token)) {
$result = $result . $token;
$result .= $token;
} else {
list($id, $text) = $token;
@@ -175,18 +175,18 @@ class PMScript
case T_COMMENT:
case T_ML_COMMENT: //we've defined this
case T_DOC_COMMENT: //and this
if ($text != '<?php ' && $text != '<?php' && $text != '<? ' && $text != '<?' && $text != '<% ' && $text != '<%') {
$result .= $text;
}
break;
default:
$result = $result . $text;
$result .= $text;
break;
}
}
}
$result = trim($result);
$sScript = $result;
$this->sScript = $sScript;
$this->sScript = trim($result);
}
/**

View File

@@ -808,6 +808,19 @@ class Process extends BaseProcess
return $aProcesses;
}
public function getCasesCountForProcess($pro_uid)
{
$oCriteria = new Criteria( 'workflow' );
$oCriteria->addSelectColumn( 'COUNT(*) AS TOTAL_CASES' );
$oCriteria->add( ApplicationPeer::PRO_UID, $pro_uid );
$oDataset = ApplicationPeer::doSelectRS( $oCriteria );
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
$oDataset->next();
$cases = $oDataset->getRow();
return (int)$cases['TOTAL_CASES'];
}
public function getAllProcessesByCategory ()
{
$oCriteria = new Criteria( 'workflow' );

View File

@@ -158,6 +158,9 @@ class Bpmn extends Handler
foreach ($this->getFlows() as $flow) {
$this->removeFlow($flow["FLO_UID"]);
}
foreach ($this->getArtifacts() as $artifacts) {
$this->removeArtifact($artifacts["ART_UID"]);
}
if ($process = $this->getProcess("object")) {
$process->delete();
@@ -213,9 +216,12 @@ class Bpmn extends Handler
public function canRemove()
{
// TODO this must validate if the project can be deleted or not.
// TODO the project can be deleted only if it has not any started cases
return true;
$totalCases = \Process::getCasesCountForProcess($this->prjUid);
if ($totalCases == 0) {
return true;
} else {
return false;
}
}
/*

View File

@@ -54,28 +54,35 @@ class Project extends Api
public function post($request_data)
{
try {
//TODO
} catch (\Exception $e) {
// TODO in case that $process->createProcess($userUid, $data); fails maybe the BPMN project was created successfully
// so, we need remove it or change the creation order.
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
public function put($prjUid, $request_data)
{
try {
return Adapter\BpmnWorkflow::updateFromStruct($prjUid, $request_data);
return Adapter\BpmnWorkflow::createFromStruct($request_data);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
public function delete($prjUid)
/**
* @url PUT /:prj_uid
*
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doPutProject($prj_uid, $request_data)
{
try {
// TODO
return Adapter\BpmnWorkflow::updateFromStruct($prj_uid, $request_data);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @param string $prj_uid {@min 1}{@max 32}
* @url DELETE /:prj_uid
*/
public function delete($prj_uid)
{
try {
$oBpmnWf = Adapter\BpmnWorkflow::load($prj_uid);
$oBpmnWf->remove();
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}