Adding new project type (bpmn) creation button and loading fe a be and some changes for method PUT /project/{prj_uid} (still not functional)
This commit is contained in:
@@ -2340,7 +2340,7 @@ class G
|
|||||||
* @param string $parameter
|
* @param string $parameter
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function header ($parameter)
|
public static function header ($parameter)
|
||||||
{
|
{
|
||||||
if (defined( 'ENABLE_ENCRYPT' ) && (ENABLE_ENCRYPT == 'yes') && (substr( $parameter, 0, 9 ) == 'location:')) {
|
if (defined( 'ENABLE_ENCRYPT' ) && (ENABLE_ENCRYPT == 'yes') && (substr( $parameter, 0, 9 ) == 'location:')) {
|
||||||
$url = G::encryptUrl( substr( $parameter, 10 ), URL_KEY );
|
$url = G::encryptUrl( substr( $parameter, 10 ), URL_KEY );
|
||||||
|
|||||||
@@ -26,59 +26,32 @@ class BpmnActivity extends BaseBpmnActivity
|
|||||||
$this->bound->setBouContainer('bpmnDiagram');
|
$this->bound->setBouContainer('bpmnDiagram');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DEPRECATED, IT WILL BE REMOVED SOON
|
public function getBound()
|
||||||
public function create($data, $generateUid = true)
|
|
||||||
{
|
{
|
||||||
// validate foreign keys, they must be present into data array
|
return $this->bound;
|
||||||
|
}
|
||||||
if (! array_key_exists('PRJ_UID', $data)) {
|
|
||||||
throw new PropelException("Error, required param 'PRJ_UID' is missing!");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! array_key_exists('PRO_UID', $data)) {
|
|
||||||
throw new PropelException("Error, required param 'PRO_UID' is missing!");
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
|
||||||
|
|
||||||
if ($generateUid) {
|
|
||||||
$this->setActUid(\ProcessMaker\Util\Hash::generateUID());
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->save();
|
|
||||||
$process = BpmnProcessPeer::retrieveByPK($data['PRO_UID']);
|
|
||||||
|
|
||||||
// create related bound
|
|
||||||
$bound = new Bound();
|
|
||||||
$bound->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
|
||||||
$bound->setBouUid(\ProcessMaker\Util\Hash::generateUID());
|
|
||||||
$bound->setPrjUid($this->getPrjUid());
|
|
||||||
$bound->setDiaUid($process->getDiaUid());
|
|
||||||
$bound->setElementUid($this->getActUid());
|
|
||||||
$bound->setBouElementType('bpmnActivity');
|
|
||||||
$bound->setBouElement('pm_canvas');
|
|
||||||
$bound->setBouContainer('bpmnDiagram');
|
|
||||||
$bound->save();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
// OVERRIDES
|
// OVERRIDES
|
||||||
|
|
||||||
public function fromArray($data)
|
public function setActUid($actUid)
|
||||||
{
|
{
|
||||||
parent::fromArray($data, BasePeer::TYPE_FIELDNAME);
|
parent::setActUid($actUid);
|
||||||
|
$this->bound->setElementUid($this->getActUid());
|
||||||
|
}
|
||||||
|
|
||||||
// try resolve the related bound
|
public function setPrjUid($prjUid)
|
||||||
if (array_key_exists('BOU_UID', $data)) {
|
{
|
||||||
//$bound = BpmnBound::findByElement('Activity', $this->getActUid());
|
parent::setPrjUid($prjUid);
|
||||||
$bound = BpmnBoundPeer::retrieveByPK($data['BOU_UID']);
|
$this->bound->setPrjUid($this->getPrjUid());
|
||||||
|
}
|
||||||
|
|
||||||
if (is_object($bound)) {
|
public function setProUid($proUid)
|
||||||
$this->bound = $bound;
|
{
|
||||||
}
|
parent::setProUid($proUid);
|
||||||
}
|
|
||||||
|
|
||||||
$this->bound->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
$process = BpmnProcessPeer::retrieveByPK($this->getProUid());
|
||||||
|
$this->bound->setDiaUid($process->getDiaUid());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save($con = null)
|
public function save($con = null)
|
||||||
@@ -90,6 +63,32 @@ class BpmnActivity extends BaseBpmnActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function delete($con = null)
|
||||||
|
{
|
||||||
|
// first, delete the related bound object
|
||||||
|
if (is_object($this->bound) && get_class($this->bound) == 'BpmnBound') {
|
||||||
|
$this->bound->delete($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::delete($con);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function fromArray($data)
|
||||||
|
{
|
||||||
|
parent::fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||||
|
|
||||||
|
// try resolve the related bound
|
||||||
|
$bound = BpmnBound::findByElement('Activity', $this->getActUid());
|
||||||
|
|
||||||
|
//if (array_key_exists('BOU_UID', $data)) {
|
||||||
|
if (is_object($bound)) {
|
||||||
|
//$bound = BpmnBoundPeer::retrieveByPK($data['BOU_UID']);
|
||||||
|
$this->bound = $bound;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->bound->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||||
|
}
|
||||||
|
|
||||||
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
|
public function toArray($keyType = BasePeer::TYPE_PHPNAME)
|
||||||
{
|
{
|
||||||
$data = parent::toArray($keyType);
|
$data = parent::toArray($keyType);
|
||||||
|
|||||||
@@ -645,13 +645,27 @@ class Process extends BaseProcess
|
|||||||
$casesCnt = $this->getCasesCountInAllProcesses();
|
$casesCnt = $this->getCasesCountInAllProcesses();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getting bpmn projects
|
||||||
|
$c = new Criteria('workflow');
|
||||||
|
$c->addSelectColumn(BpmnProjectPeer::PRJ_UID);
|
||||||
|
$ds = ProcessPeer::doSelectRS($c);
|
||||||
|
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
|
$bpmnProjects = array();
|
||||||
|
|
||||||
|
while ($ds->next()) {
|
||||||
|
$row = $ds->getRow();
|
||||||
|
$bpmnProjects[] = $row['PRJ_UID'];
|
||||||
|
}
|
||||||
|
|
||||||
//execute the query
|
//execute the query
|
||||||
$oDataset = ProcessPeer::doSelectRS( $oCriteria );
|
$oDataset = ProcessPeer::doSelectRS( $oCriteria );
|
||||||
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
$processes = Array ();
|
$processes = Array ();
|
||||||
$uids = array ();
|
$uids = array ();
|
||||||
while ($oDataset->next()) {
|
while ($oDataset->next()) {
|
||||||
$processes[] = $oDataset->getRow();
|
$row = $oDataset->getRow();
|
||||||
|
$row['PROJECT_TYPE'] = in_array($row['PRO_UID'], $bpmnProjects) ? 'bpmn' : 'classic';
|
||||||
|
$processes[] = $row;
|
||||||
$uids[] = $processes[sizeof( $processes ) - 1]['PRO_UID'];
|
$uids[] = $processes[sizeof( $processes ) - 1]['PRO_UID'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,56 +37,74 @@ class ProcessProxy extends HttpProxyController
|
|||||||
*/
|
*/
|
||||||
public function saveProcess ($httpData)
|
public function saveProcess ($httpData)
|
||||||
{
|
{
|
||||||
|
$projectType = empty($_GET['type']) ? 'classicProject' : $_GET['type'];
|
||||||
|
|
||||||
require_once 'classes/model/Task.php';
|
require_once 'classes/model/Task.php';
|
||||||
G::LoadClass( 'processMap' );
|
G::LoadClass( 'processMap' );
|
||||||
$oProcessMap = new ProcessMap();
|
$oProcessMap = new ProcessMap();
|
||||||
|
|
||||||
$httpData->PRO_TITLE = trim( $httpData->PRO_TITLE );
|
$httpData->PRO_TITLE = trim( $httpData->PRO_TITLE );
|
||||||
|
|
||||||
if (! isset( $httpData->PRO_UID )) {
|
try {
|
||||||
|
if (! isset( $httpData->PRO_UID )) {
|
||||||
|
if (Process::existsByProTitle( $httpData->PRO_TITLE )) {
|
||||||
|
$result = array ('success' => false,'msg' => G::LoadTranslation( 'ID_SAVE_PROCESS_ERROR' ),'errors' => array ('PRO_TITLE' => G::LoadTranslation( 'ID_PROCESSTITLE_ALREADY_EXISTS', SYS_LANG, Array ('PRO_TITLE' => $httpData->PRO_TITLE
|
||||||
|
) )
|
||||||
|
)
|
||||||
|
);
|
||||||
|
print G::json_encode( $result );
|
||||||
|
exit( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
if (Process::existsByProTitle( $httpData->PRO_TITLE )) {
|
$processData['USR_UID'] = $_SESSION['USER_LOGGED'];
|
||||||
$result = array ('success' => false,'msg' => G::LoadTranslation( 'ID_SAVE_PROCESS_ERROR' ),'errors' => array ('PRO_TITLE' => G::LoadTranslation( 'ID_PROCESSTITLE_ALREADY_EXISTS', SYS_LANG, Array ('PRO_TITLE' => $httpData->PRO_TITLE
|
$processData['PRO_TITLE'] = $httpData->PRO_TITLE;
|
||||||
) )
|
$processData['PRO_DESCRIPTION'] = $httpData->PRO_DESCRIPTION;
|
||||||
)
|
$processData['PRO_CATEGORY'] = $httpData->PRO_CATEGORY;
|
||||||
);
|
|
||||||
print G::json_encode( $result );
|
$sProUid = $oProcessMap->createProcess( $processData );
|
||||||
exit( 0 );
|
|
||||||
|
//call plugins
|
||||||
|
$oData['PRO_UID'] = $sProUid;
|
||||||
|
$oData['PRO_TEMPLATE'] = isset( $httpData->PRO_TEMPLATE ) && $httpData->PRO_TEMPLATE != '' ? $httpData->PRO_TEMPLATE : '';
|
||||||
|
$oData['PROCESSMAP'] = $oProcessMap;
|
||||||
|
|
||||||
|
$oPluginRegistry = & PMPluginRegistry::getSingleton();
|
||||||
|
$oPluginRegistry->executeTriggers( PM_NEW_PROCESS_SAVE, $oData );
|
||||||
|
|
||||||
|
} else {
|
||||||
|
//$oProcessMap->updateProcess($_POST['form']);
|
||||||
|
$sProUid = $httpData->PRO_UID;
|
||||||
}
|
}
|
||||||
|
|
||||||
$processData['USR_UID'] = $_SESSION['USER_LOGGED'];
|
//Save Calendar ID for this process
|
||||||
$processData['PRO_TITLE'] = $httpData->PRO_TITLE;
|
if (isset( $httpData->PRO_CALENDAR )) {
|
||||||
$processData['PRO_DESCRIPTION'] = $httpData->PRO_DESCRIPTION;
|
G::LoadClass( "calendar" );
|
||||||
$processData['PRO_CATEGORY'] = $httpData->PRO_CATEGORY;
|
$calendarObj = new Calendar();
|
||||||
|
$calendarObj->assignCalendarTo( $sProUid, $httpData->PRO_CALENDAR, 'PROCESS' );
|
||||||
|
}
|
||||||
|
|
||||||
$sProUid = $oProcessMap->createProcess( $processData );
|
// Creating BPMN Project Layer
|
||||||
|
if ($projectType == 'bpmnProject') {
|
||||||
|
$bpmnModel = new ProcessMaker\Adapter\Bpmn\Model();
|
||||||
|
$replaceUids = false;
|
||||||
|
|
||||||
//call plugins
|
$data = array(
|
||||||
$oData['PRO_UID'] = $sProUid;
|
'PRJ_UID' => $sProUid,
|
||||||
$oData['PRO_TEMPLATE'] = isset( $httpData->PRO_TEMPLATE ) && $httpData->PRO_TEMPLATE != '' ? $httpData->PRO_TEMPLATE : '';
|
'PRJ_NAME' => $httpData->PRO_TITLE,
|
||||||
$oData['PROCESSMAP'] = $oProcessMap;
|
'PRJ_DESCRIPTION' => $httpData->PRO_DESCRIPTION,
|
||||||
|
'PRJ_CATEGORY' => $httpData->PRO_CATEGORY
|
||||||
|
);
|
||||||
|
|
||||||
$oPluginRegistry = & PMPluginRegistry::getSingleton();
|
$result = $bpmnModel->createProject($data, $replaceUids);
|
||||||
$oPluginRegistry->executeTriggers( PM_NEW_PROCESS_SAVE, $oData );
|
}
|
||||||
|
|
||||||
} else {
|
$this->success = true;
|
||||||
//$oProcessMap->updateProcess($_POST['form']);
|
$this->PRO_UID = $sProUid;
|
||||||
$sProUid = $httpData->PRO_UID;
|
$this->msg = G::LoadTranslation( 'ID_CREATE_PROCESS_SUCCESS' );
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$this->success = false;
|
||||||
|
$this->msg = $e->getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save Calendar ID for this process
|
|
||||||
if (isset( $httpData->PRO_CALENDAR )) {
|
|
||||||
G::LoadClass( "calendar" );
|
|
||||||
$calendarObj = new Calendar();
|
|
||||||
$calendarObj->assignCalendarTo( $sProUid, $httpData->PRO_CALENDAR, 'PROCESS' );
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->success = true;
|
|
||||||
$this->PRO_UID = $sProUid;
|
|
||||||
$this->msg = G::LoadTranslation( 'ID_CREATE_PROCESS_SUCCESS' );
|
|
||||||
|
|
||||||
//TODO save bpmn project
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
16
workflow/engine/methods/processes/openDesigner.php
Normal file
16
workflow/engine/methods/processes/openDesigner.php
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
if (! array_key_exists('pro_uid', $_REQUEST)) {
|
||||||
|
die('Bad Request: The param "pro_uid" is required!');
|
||||||
|
}
|
||||||
|
|
||||||
|
$proUid = $_GET['pro_uid'];
|
||||||
|
$bpmnProject = BpmnProjectPeer::retrieveByPK($proUid);
|
||||||
|
|
||||||
|
|
||||||
|
if (is_object($bpmnProject)) {
|
||||||
|
$url = '../designer?pro_uid=' . $proUid;
|
||||||
|
} else {
|
||||||
|
$url = 'processes_Map?PRO_UID=' . $proUid;
|
||||||
|
}
|
||||||
|
|
||||||
|
G::header("location: $url");
|
||||||
@@ -27,6 +27,7 @@ use \BpmnArtifactPeer as ArtifactPeer;
|
|||||||
|
|
||||||
use \ProcessMaker\Util\Hash;
|
use \ProcessMaker\Util\Hash;
|
||||||
use \BasePeer;
|
use \BasePeer;
|
||||||
|
use Symfony\Component\Yaml\Exception\RuntimeException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,16 +38,14 @@ use \BasePeer;
|
|||||||
*/
|
*/
|
||||||
class Model
|
class Model
|
||||||
{
|
{
|
||||||
public function createProject($data)
|
public function createProject($data, $replaceUids = false)
|
||||||
{
|
{
|
||||||
$data = array_change_key_case($data, CASE_UPPER);
|
$data = array_change_key_case($data, CASE_UPPER);
|
||||||
$uids = array();
|
$uids = array();
|
||||||
$oldPrjUid = $data['PRJ_UID'];
|
$diagrams = array_key_exists('DIAGRAMS', $data) && is_array($data['DIAGRAMS'])
|
||||||
$diagrams = $data['DIAGRAMS'];
|
&& count($data['DIAGRAMS']) > 0 ? $data['DIAGRAMS'] : null;
|
||||||
$mapId = array();
|
$mapId = array();
|
||||||
|
|
||||||
unset($data['PRJ_UID']);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 1. Create a project record
|
* 1. Create a project record
|
||||||
* 2. Create a default diagram record
|
* 2. Create a default diagram record
|
||||||
@@ -55,38 +54,99 @@ class Model
|
|||||||
|
|
||||||
$project = new Project();
|
$project = new Project();
|
||||||
$project->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
$project->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||||
$project->setPrjUid(Hash::generateUID());
|
|
||||||
|
if (array_key_exists('PRJ_UID', $data)) {
|
||||||
|
if ($replaceUids) {
|
||||||
|
$oldPrjUid = $data['PRJ_UID'];
|
||||||
|
$project->setPrjUid(Hash::generateUID());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$project->setPrjUid(Hash::generateUID());
|
||||||
|
}
|
||||||
|
|
||||||
$project->setPrjCreateDate(date("Y-m-d H:i:s"));
|
$project->setPrjCreateDate(date("Y-m-d H:i:s"));
|
||||||
$project->save();
|
$project->save();
|
||||||
$prjUid = $project->getPrjUid();
|
$prjUid = $project->getPrjUid();
|
||||||
$prjName = $project->getPrjName();
|
$prjName = $project->getPrjName();
|
||||||
$uids[] = array('old_uid' => $oldPrjUid, 'new_uid' => $prjUid, 'object' => 'project');
|
|
||||||
$mapId['project'][$oldPrjUid] = $prjUid;
|
|
||||||
|
|
||||||
// By now, is thought create only one diagram for each project (1:1)
|
if ($replaceUids) {
|
||||||
$diagramData = (array) $diagrams[0];
|
$uids[] = array('old_uid' => $oldPrjUid, 'new_uid' => $prjUid, 'object' => 'project');
|
||||||
$oldDiaUid = $diagramData['dia_uid'];
|
$mapId['project'][$oldPrjUid] = $prjUid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! isset($diagrams)) {
|
||||||
|
if ($replaceUids) {
|
||||||
|
return $uids;
|
||||||
|
} else {
|
||||||
|
return self::loadProject($prjUid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$diagram = new Diagram();
|
$diagram = new Diagram();
|
||||||
$diagram->setDiaUid(Hash::generateUID());
|
|
||||||
|
if (isset($diagrams) && array_key_exists('dia_uid', $diagrams[0])) {
|
||||||
|
if ($replaceUids) {
|
||||||
|
$oldDiaUid = $diagrams[0]['dia_uid'];
|
||||||
|
$diagram->setDiaUid(Hash::generateUID());
|
||||||
|
} else {
|
||||||
|
$diagram->setDiaUid($diagrams[0]['dia_uid']);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$diagram->setDiaUid(Hash::generateUID());
|
||||||
|
}
|
||||||
|
|
||||||
$diagram->setPrjUid($prjUid);
|
$diagram->setPrjUid($prjUid);
|
||||||
$diagram->setDiaName($prjName);
|
$diagram->setDiaName($prjName);
|
||||||
$diagram->save();
|
$diagram->save();
|
||||||
$diaUid = $diagram->getDiaUid();
|
$diaUid = $diagram->getDiaUid();
|
||||||
$uids[] = array('old_uid' => $oldDiaUid, 'new_uid' => $diaUid, 'object' => 'diagram');
|
|
||||||
$mapId['diagram'][$oldDiaUid] = $diaUid;
|
if ($replaceUids) {
|
||||||
|
$uids[] = array('old_uid' => $oldDiaUid, 'new_uid' => $diaUid, 'object' => 'diagram');
|
||||||
|
$mapId['diagram'][$oldDiaUid] = $diaUid;
|
||||||
|
}
|
||||||
|
|
||||||
$process = new Process();
|
$process = new Process();
|
||||||
$process->setProUid(Hash::generateUID());
|
|
||||||
|
if (isset($diagrams) && array_key_exists('pro_uid', $diagrams[0])) {
|
||||||
|
if ($replaceUids) {
|
||||||
|
$oldProUid = $data['pro_uid'];
|
||||||
|
$process->setProUid(Hash::generateUID());
|
||||||
|
} else {
|
||||||
|
$process->setProUid($diagrams[0]['pro_uid']);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$process->setProUid(Hash::generateUID());
|
||||||
|
}
|
||||||
|
|
||||||
$process->setPrjUid($prjUid);
|
$process->setPrjUid($prjUid);
|
||||||
$process->setDiaUid($diaUid);
|
$process->setDiaUid($diaUid);
|
||||||
$process->setProName($prjName);
|
$process->setProName($prjName);
|
||||||
$process->save();
|
$process->save();
|
||||||
$proUid = $process->getProUid();
|
$proUid = $process->getProUid();
|
||||||
|
|
||||||
$uids = array_merge($uids, $this->createDiagram($prjUid, $proUid, $diaUid, $diagramData));
|
if ($replaceUids) {
|
||||||
|
$uids[] = array('old_uid' => $oldProUid, 'new_uid' => $proUid, 'object' => 'project');
|
||||||
|
$mapId['process'][$oldProUid] = $proUid;
|
||||||
|
}
|
||||||
|
|
||||||
return $uids;
|
|
||||||
|
if (isset($diagrams)) {
|
||||||
|
// By now, is thought create only one diagram for each project (1:1)
|
||||||
|
$diagramData = (array) $diagrams[0];
|
||||||
|
|
||||||
|
// there is not a defined diagram to save
|
||||||
|
$diagramUids = $this->createDiagram($prjUid, $proUid, $diaUid, $diagramData, $replaceUids);
|
||||||
|
|
||||||
|
if ($replaceUids) {
|
||||||
|
$uids = array_merge($uids, $diagramUids);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($replaceUids) {
|
||||||
|
return $uids;
|
||||||
|
} else {
|
||||||
|
return self::loadProject($prjUid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createDiagram($prjUid, $proUid, $diaUid, $diagramData)
|
private function createDiagram($prjUid, $proUid, $diaUid, $diagramData)
|
||||||
@@ -311,47 +371,55 @@ class Model
|
|||||||
$project = self::getBpmnObjectBy('Project', ProjectPeer::PRJ_UID, $prjUid, true);
|
$project = self::getBpmnObjectBy('Project', ProjectPeer::PRJ_UID, $prjUid, true);
|
||||||
$process = self::getBpmnObjectBy('Process', ProcessPeer::PRJ_UID, $prjUid, true);
|
$process = self::getBpmnObjectBy('Process', ProcessPeer::PRJ_UID, $prjUid, true);
|
||||||
$diagram = self::getBpmnObjectBy('Diagram', DiagramPeer::DIA_UID, $process['dia_uid'], true);
|
$diagram = self::getBpmnObjectBy('Diagram', DiagramPeer::DIA_UID, $process['dia_uid'], true);
|
||||||
$lanesets = self::getBpmnCollectionBy('Laneset', LanesetPeer::PRJ_UID, $prjUid, true);
|
|
||||||
$lanes = self::getBpmnCollectionBy('Lane', LanePeer::PRJ_UID, $prjUid, true);
|
|
||||||
$activities = self::getBpmnCollectionBy('Activity', ActivityPeer::PRJ_UID, $prjUid, true);
|
|
||||||
$events = self::getBpmnCollectionBy('Event', EventPeer::PRJ_UID, $prjUid, true);
|
|
||||||
$gateways = self::getBpmnCollectionBy('Gateway', GatewayPeer::PRJ_UID, $prjUid, true);
|
|
||||||
$flows = self::getBpmnCollectionBy('Flow', FlowPeer::PRJ_UID, $prjUid, true);
|
|
||||||
$artifacts = self::getBpmnCollectionBy('Artifact', ArtifactPeer::PRJ_UID, $prjUid, true);
|
|
||||||
|
|
||||||
// getting activity bound data
|
|
||||||
foreach ($activities as $i => $activity) {
|
|
||||||
$activities[$i] = array_merge(
|
|
||||||
$activities[$i],
|
|
||||||
self::getBpmnObjectBy('Bound', BoundPeer::ELEMENT_UID, $activity['act_uid'], true)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// getting event bound data
|
|
||||||
foreach ($events as $i => $event) {
|
|
||||||
$events[$i] = array_merge(
|
|
||||||
$events[$i],
|
|
||||||
self::getBpmnObjectBy('Bound', BoundPeer::ELEMENT_UID, $event['evn_uid'], true)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// getting gateway bound data
|
|
||||||
foreach ($gateways as $i => $gateway) {
|
|
||||||
$gateways[$i] = array_merge(
|
|
||||||
$gateways[$i],
|
|
||||||
self::getBpmnObjectBy('Bound', BoundPeer::ELEMENT_UID, $gateway['gat_uid'], true)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$project = array_change_key_case($project);
|
$project = array_change_key_case($project);
|
||||||
$project['diagrams'] = array($diagram);
|
|
||||||
$project['diagrams'][0]['laneset'] = $lanesets;
|
if (! empty($diagram)) {
|
||||||
$project['diagrams'][0]['lanes'] = $lanes;
|
$lanesets = self::getBpmnCollectionBy('Laneset', LanesetPeer::PRJ_UID, $prjUid, true);
|
||||||
$project['diagrams'][0]['activities'] = $activities;
|
$lanes = self::getBpmnCollectionBy('Lane', LanePeer::PRJ_UID, $prjUid, true);
|
||||||
$project['diagrams'][0]['events'] = $events;
|
$activities = self::getBpmnCollectionBy('Activity', ActivityPeer::PRJ_UID, $prjUid, true);
|
||||||
$project['diagrams'][0]['gateways'] = $gateways;
|
$events = self::getBpmnCollectionBy('Event', EventPeer::PRJ_UID, $prjUid, true);
|
||||||
$project['diagrams'][0]['flows'] = $flows;
|
$gateways = self::getBpmnCollectionBy('Gateway', GatewayPeer::PRJ_UID, $prjUid, true);
|
||||||
$project['diagrams'][0]['artifacts'] = $artifacts;
|
$flows = self::getBpmnCollectionBy('Flow', FlowPeer::PRJ_UID, $prjUid, true);
|
||||||
|
$artifacts = self::getBpmnCollectionBy('Artifact', ArtifactPeer::PRJ_UID, $prjUid, true);
|
||||||
|
|
||||||
|
// getting activity bound data
|
||||||
|
foreach ($activities as $i => $activity) {
|
||||||
|
$bound = self::getBpmnObjectBy('Bound', BoundPeer::ELEMENT_UID, $activity['act_uid'], true);
|
||||||
|
|
||||||
|
if (is_object($bound)) {
|
||||||
|
$activities[$i] = array_merge($activities[$i], $bound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// getting event bound data
|
||||||
|
foreach ($events as $i => $event) {
|
||||||
|
$bound = self::getBpmnObjectBy('Bound', BoundPeer::ELEMENT_UID, $event['evn_uid'], true);
|
||||||
|
|
||||||
|
if (is_object($bound)) {
|
||||||
|
$events[$i] = array_merge($events[$i], $bound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// getting gateway bound data
|
||||||
|
foreach ($gateways as $i => $gateway) {
|
||||||
|
$bound = self::getBpmnObjectBy('Bound', BoundPeer::ELEMENT_UID, $gateway['gat_uid'], true);
|
||||||
|
|
||||||
|
if (is_object($bound)) {
|
||||||
|
$gateways[$i] = array_merge($gateways[$i], $bound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$project['diagrams'] = array($diagram);
|
||||||
|
$project['diagrams'][0]['laneset'] = $lanesets;
|
||||||
|
$project['diagrams'][0]['lanes'] = $lanes;
|
||||||
|
$project['diagrams'][0]['activities'] = $activities;
|
||||||
|
$project['diagrams'][0]['events'] = $events;
|
||||||
|
$project['diagrams'][0]['gateways'] = $gateways;
|
||||||
|
$project['diagrams'][0]['flows'] = $flows;
|
||||||
|
$project['diagrams'][0]['artifacts'] = $artifacts;
|
||||||
|
}
|
||||||
|
|
||||||
return $project;
|
return $project;
|
||||||
}
|
}
|
||||||
@@ -384,6 +452,11 @@ class Model
|
|||||||
//print_r($diagramData); die;
|
//print_r($diagramData); die;
|
||||||
|
|
||||||
$diagram = DiagramPeer::retrieveByPK($diagramData['dia_uid']);
|
$diagram = DiagramPeer::retrieveByPK($diagramData['dia_uid']);
|
||||||
|
|
||||||
|
if (! is_object($diagram)) {
|
||||||
|
throw new \RuntimeException("Related Diagram with id: {$diagramData['dia_uid']}, does not exist!");
|
||||||
|
}
|
||||||
|
|
||||||
$diagram->setDiaName($diagramData['dia_name']);
|
$diagram->setDiaName($diagramData['dia_name']);
|
||||||
|
|
||||||
if (!empty($diagramData['dia_is_closable'])) {
|
if (!empty($diagramData['dia_is_closable'])) {
|
||||||
@@ -406,17 +479,17 @@ class Model
|
|||||||
$savedProject = self::loadProject($prjUid);
|
$savedProject = self::loadProject($prjUid);
|
||||||
$diff = self::getDiffFromProjects($savedProject, $projectUpdated);
|
$diff = self::getDiffFromProjects($savedProject, $projectUpdated);
|
||||||
|
|
||||||
self::updateDiagram($diff);
|
self::updateDiagram($prjUid, $process->getProUid(), $diff);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function updateDiagram($diff)
|
public static function updateDiagram($prjUid, $proUid, $diff)
|
||||||
{
|
{
|
||||||
echo 'DIFF'.PHP_EOL; print_r($diff);
|
echo 'DIFF'.PHP_EOL; print_r($diff);
|
||||||
|
|
||||||
//return false;
|
//return false;
|
||||||
$mapId = array();
|
$mapId = array();
|
||||||
|
|
||||||
// updating objects
|
// Updating objects
|
||||||
foreach ($diff['updated'] as $element => $items) {
|
foreach ($diff['updated'] as $element => $items) {
|
||||||
foreach ($items as $data) {
|
foreach ($items as $data) {
|
||||||
$data = array_change_key_case((array) $data, CASE_UPPER);
|
$data = array_change_key_case((array) $data, CASE_UPPER);
|
||||||
@@ -460,34 +533,87 @@ class Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
die;
|
// Creating new records
|
||||||
|
|
||||||
// Creating new objects
|
|
||||||
foreach ($diff['new'] as $element => $items) {
|
foreach ($diff['new'] as $element => $items) {
|
||||||
foreach ($items as $data) {
|
foreach ($items as $data) {
|
||||||
print_r($data); die;
|
$data = array_change_key_case((array) $data, CASE_UPPER);
|
||||||
|
|
||||||
switch ($element) {
|
switch ($element) {
|
||||||
case 'laneset':
|
case 'laneset':
|
||||||
$lanesetData = array_change_key_case((array) $data, CASE_UPPER);
|
break;
|
||||||
|
|
||||||
$laneset = new Laneset();
|
case 'lanes':
|
||||||
$laneset->fromArray($lanesetData, BasePeer::TYPE_FIELDNAME);
|
break;
|
||||||
$laneset->setLnsUid(Hash::generateUID());
|
|
||||||
$laneset->setPrjUid($prjUid);
|
|
||||||
$laneset->setProUid($proUid);
|
|
||||||
$laneset->save();
|
|
||||||
$lnsUid = $laneset->getLnsUid();
|
|
||||||
$oldLnsUid = $lanesetData['LNS_UID'];
|
|
||||||
|
|
||||||
$uids[] = array('old_uid' => $oldLnsUid, 'new_uid' => $lnsUid, 'object' => 'laneset');
|
case 'activities':
|
||||||
$mapId['laneset'][$oldLnsUid] = $lnsUid;
|
$uidData = array('old_uid' => $data['ACT_UID'], 'object' => 'Activity');
|
||||||
|
|
||||||
|
$activity = new Activity();
|
||||||
|
$activity->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||||
|
$activity->setActUid(Hash::generateUID());
|
||||||
|
$activity->setPrjUid($prjUid);
|
||||||
|
$activity->setProUid($proUid);
|
||||||
|
$activity->getBound()->setBouUid(Hash::generateUID());
|
||||||
|
$activity->save();
|
||||||
|
|
||||||
|
$uidData['new_uid'] = $activity->getActUid();
|
||||||
|
$uids[] = $uidData;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'events':
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'gateways':
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'flows':
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'artifacts':
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creating new records
|
||||||
|
foreach ($diff['deleted'] as $element => $items) {
|
||||||
|
foreach ($items as $uid) {
|
||||||
|
$data = array_change_key_case((array) $data, CASE_UPPER);
|
||||||
|
|
||||||
|
switch ($element) {
|
||||||
|
case 'laneset':
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'lanes':
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'activities':
|
||||||
|
$activity = ActivityPeer::retrieveByPK($uid);
|
||||||
|
$activity->delete();
|
||||||
|
|
||||||
|
$uidData['new_uid'] = $activity->getActUid();
|
||||||
|
$uids[] = $uidData;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'events':
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'gateways':
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'flows':
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'artifacts':
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//$activity = ActivityPeer::retrieveByPK($item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getDiffFromProjects($savedProject, $updatedProject)
|
public static function getDiffFromProjects($savedProject, $updatedProject)
|
||||||
@@ -504,11 +630,16 @@ class Model
|
|||||||
|
|
||||||
// Getting Differences
|
// Getting Differences
|
||||||
$newRecords = array();
|
$newRecords = array();
|
||||||
|
$newRecordsUids = array();
|
||||||
$deletedRecords = array();
|
$deletedRecords = array();
|
||||||
$updatedRecords = array();
|
$updatedRecords = array();
|
||||||
|
|
||||||
// Get new records
|
// Get new records
|
||||||
foreach ($diagramElements as $key => $element) {
|
foreach ($diagramElements as $key => $element) {
|
||||||
|
if (! array_key_exists($element, $updatedProject['diagrams'][0])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$arrayDiff = self::arrayDiff(
|
$arrayDiff = self::arrayDiff(
|
||||||
$savedProject['diagrams'][0][$element],
|
$savedProject['diagrams'][0][$element],
|
||||||
$updatedProject['diagrams'][0][$element],
|
$updatedProject['diagrams'][0][$element],
|
||||||
@@ -516,12 +647,22 @@ class Model
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (! empty($arrayDiff)) {
|
if (! empty($arrayDiff)) {
|
||||||
$newRecords[$element] = $arrayDiff;
|
$newRecordsUids[$element] = $arrayDiff;
|
||||||
|
|
||||||
|
foreach ($updatedProject['diagrams'][0][$element] as $item) {
|
||||||
|
if (in_array($item[$key], $newRecordsUids[$element])) {
|
||||||
|
$newRecords[$element][] = $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get deleted records
|
// Get deleted records
|
||||||
foreach ($diagramElements as $key => $element) {
|
foreach ($diagramElements as $key => $element) {
|
||||||
|
if (! array_key_exists($element, $updatedProject['diagrams'][0])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
$arrayDiff = self::arrayDiff(
|
$arrayDiff = self::arrayDiff(
|
||||||
$updatedProject['diagrams'][0][$element],
|
$updatedProject['diagrams'][0][$element],
|
||||||
$savedProject['diagrams'][0][$element],
|
$savedProject['diagrams'][0][$element],
|
||||||
@@ -541,8 +682,14 @@ class Model
|
|||||||
|
|
||||||
|
|
||||||
foreach ($diagramElements as $key => $element) {
|
foreach ($diagramElements as $key => $element) {
|
||||||
|
if (! array_key_exists($element, $updatedProject['diagrams'][0])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($updatedProject['diagrams'][0][$element] as $item) {
|
foreach ($updatedProject['diagrams'][0][$element] as $item) {
|
||||||
if (array_key_exists($element, $newRecords) && (in_array($item[$key], $newRecords[$element]) || in_array($item[$key], $deletedRecords[$element]))) {
|
if ((array_key_exists($element, $newRecordsUids) && in_array($item[$key], $newRecordsUids[$element])) ||
|
||||||
|
(array_key_exists($element, $deletedRecords) && in_array($item[$key], $deletedRecords[$element]))
|
||||||
|
) {
|
||||||
// skip new or deleted records
|
// skip new or deleted records
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,18 +33,31 @@ class Project extends Api
|
|||||||
function post($request_data)
|
function post($request_data)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$bpmnModel = new BpmnModel();
|
$config = array();
|
||||||
$uids = $bpmnModel->createProject($request_data);
|
$config['project'] = array('replace_uids' => true);
|
||||||
|
|
||||||
$wfProcess = Workflow::loadFromBpmnProject($uids[0]['new_uid']);
|
$bpmnModel = new BpmnModel();
|
||||||
|
$result = $bpmnModel->createProject($request_data, $config['project']['replace_uids']);
|
||||||
|
|
||||||
|
if (array_key_exists('prj_uid', $result)) {
|
||||||
|
$prjUid = $result['prj_uid'];
|
||||||
|
} else {
|
||||||
|
$prjUid = $result[0]['new_uid'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$wfProcess = Workflow::loadFromBpmnProject($prjUid);
|
||||||
|
|
||||||
$process = new \BusinessModel\Process();
|
$process = new \BusinessModel\Process();
|
||||||
$userUid = $this->getUserId();
|
$userUid = $this->getUserId();
|
||||||
$data = array('process' => $wfProcess);
|
$data = array('process' => $wfProcess);
|
||||||
|
|
||||||
$process->createProcess($userUid, $data);
|
$process->createProcess($userUid, $data);
|
||||||
|
|
||||||
return $uids;
|
return $result;
|
||||||
} catch (\Exception $e) {
|
} 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());
|
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,8 @@ Ext.onReady(function(){
|
|||||||
{name : 'CASES_COUNT_DRAFT', type:'float'},
|
{name : 'CASES_COUNT_DRAFT', type:'float'},
|
||||||
{name : 'CASES_COUNT_TO_DO', type:'float'},
|
{name : 'CASES_COUNT_TO_DO', type:'float'},
|
||||||
{name : 'CASES_COUNT_COMPLETED', type:'float'},
|
{name : 'CASES_COUNT_COMPLETED', type:'float'},
|
||||||
{name : 'CASES_COUNT_CANCELLED', type:'float'}
|
{name : 'CASES_COUNT_CANCELLED', type:'float'},
|
||||||
|
{name : 'PROJECT_TYPE', type:'string'}
|
||||||
]
|
]
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@@ -197,7 +198,13 @@ Ext.onReady(function(){
|
|||||||
{id:'PRO_UID', dataIndex: 'PRO_UID', hidden:true, hideable:false},
|
{id:'PRO_UID', dataIndex: 'PRO_UID', hidden:true, hideable:false},
|
||||||
{header: "", dataIndex: 'PRO_STATUS', width: 50, hidden:true, hideable:false},
|
{header: "", dataIndex: 'PRO_STATUS', width: 50, hidden:true, hideable:false},
|
||||||
{header: _('ID_PRO_DESCRIPTION'), dataIndex: 'PRO_DESCRIPTION',hidden:true, hideable:false},
|
{header: _('ID_PRO_DESCRIPTION'), dataIndex: 'PRO_DESCRIPTION',hidden:true, hideable:false},
|
||||||
{header: _('ID_PRO_TITLE'), dataIndex: 'PRO_TITLE', width: 300},
|
{header: _('ID_PRO_TITLE'), dataIndex: 'PRO_TITLE', width: 300, renderer:function(v,p,r){
|
||||||
|
// TODO Labels for var 'type' are hardcoded, they must be replaced on the future
|
||||||
|
var color = r.get('PROJECT_TYPE') == 'bpmn'? 'green': 'blue';
|
||||||
|
var type = r.get('PROJECT_TYPE') == 'bpmn'? ' (BPMN Project)': '';
|
||||||
|
return v + ' ' + String.format("<font color='{0}'>{1}</font>", color, type);
|
||||||
|
}},
|
||||||
|
{header: _('ID_TYPE'), dataIndex: 'PROJECT_TYPE', width: 60, hidden:false},
|
||||||
{header: _('ID_CATEGORY'), dataIndex: 'PRO_CATEGORY_LABEL', width: 100, hidden:false},
|
{header: _('ID_CATEGORY'), dataIndex: 'PRO_CATEGORY_LABEL', width: 100, hidden:false},
|
||||||
{header: _('ID_STATUS'), dataIndex: 'PRO_STATUS_LABEL', width: 50, renderer:function(v,p,r){
|
{header: _('ID_STATUS'), dataIndex: 'PRO_STATUS_LABEL', width: 50, renderer:function(v,p,r){
|
||||||
color = r.get('PRO_STATUS') == 'ACTIVE'? 'green': 'red';
|
color = r.get('PRO_STATUS') == 'ACTIVE'? 'green': 'red';
|
||||||
@@ -215,24 +222,52 @@ Ext.onReady(function(){
|
|||||||
}),
|
}),
|
||||||
store: store,
|
store: store,
|
||||||
tbar:[
|
tbar:[
|
||||||
|
{
|
||||||
|
xtype: 'tbsplit',
|
||||||
|
text: _('ID_NEW'),
|
||||||
|
iconCls: 'button_menu_ext ss_sprite ss_add',
|
||||||
|
menu: [
|
||||||
|
{
|
||||||
|
text: "New Project",
|
||||||
|
iconCls: 'silk-add',
|
||||||
|
icon: '/images/delete-16x16.gif',
|
||||||
|
handler: function () {
|
||||||
|
newProcess({type:"bpmnProject"});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "New Project (Old Version)",
|
||||||
|
iconCls: 'silk-add',
|
||||||
|
icon: '/images/delete-16x16.gif',
|
||||||
|
handler: function () {
|
||||||
|
newProcess({type:"classicProject"});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
listeners: {
|
||||||
|
"click": function (obj, e) {
|
||||||
|
obj.showMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},/*
|
||||||
{
|
{
|
||||||
text: _('ID_NEW'),
|
text: _('ID_NEW'),
|
||||||
iconCls: 'button_menu_ext ss_sprite ss_add',
|
iconCls: 'button_menu_ext ss_sprite ss_add',
|
||||||
//icon: '/images/addc.png',
|
//icon: '/images/addc.png',
|
||||||
handler: newProcess
|
handler: newProcess
|
||||||
},
|
},*/
|
||||||
'-'
|
'-'
|
||||||
,{
|
,{
|
||||||
text: _('ID_EDIT'),
|
text: _('ID_EDIT'),
|
||||||
iconCls: 'button_menu_ext ss_sprite ss_pencil',
|
iconCls: 'button_menu_ext ss_sprite ss_pencil',
|
||||||
//icon: '/images/edit.gif',
|
//icon: '/images/edit.gif',
|
||||||
handler: editProcess
|
handler: editProcess
|
||||||
},{
|
},/*{
|
||||||
text: 'Edit (New Editor)',
|
text: 'Edit (New Editor)',
|
||||||
iconCls: 'button_menu_ext',
|
iconCls: 'button_menu_ext',
|
||||||
icon: '/images/pencil_beta.png',
|
icon: '/images/pencil_beta.png',
|
||||||
handler: editNewProcess
|
handler: editNewProcess
|
||||||
},{
|
},*/{
|
||||||
text: _('ID_STATUS'),
|
text: _('ID_STATUS'),
|
||||||
id:'activator',
|
id:'activator',
|
||||||
icon: '',
|
icon: '',
|
||||||
@@ -412,8 +447,14 @@ Ext.onReady(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function newProcess(){
|
function newProcess(params)
|
||||||
// window.location = 'processes_New';
|
{
|
||||||
|
params = typeof params == 'undefined' ? {type:'classicProject'} : params;
|
||||||
|
|
||||||
|
// TODO this variable have hardcoded labels, it must be changed on the future
|
||||||
|
var formTitle = params.type == "classicProject" ? "New Project (Old Version)" : "New Project"
|
||||||
|
|
||||||
|
// window.location = 'processes_New';
|
||||||
var ProcessCategories = new Ext.form.ComboBox({
|
var ProcessCategories = new Ext.form.ComboBox({
|
||||||
fieldLabel : _('ID_CATEGORY'),
|
fieldLabel : _('ID_CATEGORY'),
|
||||||
hiddenName : 'PRO_CATEGORY',
|
hiddenName : 'PRO_CATEGORY',
|
||||||
@@ -445,7 +486,6 @@ function newProcess(){
|
|||||||
ProcessCategories.setValue(store.getAt(0).get('CATEGORY_UID'));
|
ProcessCategories.setValue(store.getAt(0).get('CATEGORY_UID'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
var frm = new Ext.FormPanel( {
|
var frm = new Ext.FormPanel( {
|
||||||
id: 'newProcessForm',
|
id: 'newProcessForm',
|
||||||
labelAlign : 'right',
|
labelAlign : 'right',
|
||||||
@@ -487,27 +527,35 @@ function newProcess(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
var win = new Ext.Window({
|
var win = new Ext.Window({
|
||||||
title: _('ID_CREATE_PROCESS'),
|
id: 'newProjectWin',
|
||||||
|
title: formTitle, //_('ID_CREATE_PROCESS'),
|
||||||
width: 470,
|
width: 470,
|
||||||
height: 220,
|
height: 220,
|
||||||
layout:'fit',
|
layout:'fit',
|
||||||
autoScroll:true,
|
autoScroll:true,
|
||||||
modal: true,
|
modal: true,
|
||||||
maximizable: false,
|
maximizable: false,
|
||||||
items: [frm]
|
items: [frm],
|
||||||
|
_projectType: params.type
|
||||||
});
|
});
|
||||||
win.show();
|
win.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveProcess()
|
function saveProcess()
|
||||||
{
|
{
|
||||||
|
var projectType = Ext.getCmp('newProjectWin')._projectType;
|
||||||
|
|
||||||
Ext.getCmp('newProcessForm').getForm().submit( {
|
Ext.getCmp('newProcessForm').getForm().submit( {
|
||||||
url : '../processProxy/saveProcess',
|
url : '../processProxy/saveProcess?type=' + projectType,
|
||||||
waitMsg : _('ID_SAVING_PROCESS'),
|
waitMsg : _('ID_SAVING_PROCESS'),
|
||||||
waitTitle : " ",
|
waitTitle : " ",
|
||||||
timeout : 36000,
|
timeout : 36000,
|
||||||
success : function(obj, resp) {
|
success : function(obj, resp) {
|
||||||
location.href = 'processes_Map?PRO_UID='+resp.result.PRO_UID;
|
if (projectType == 'classicProject') {
|
||||||
|
location.href = 'processes_Map?PRO_UID='+resp.result.PRO_UID;
|
||||||
|
} else {
|
||||||
|
location.href = '../designer?pro_uid='+resp.result.PRO_UID;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
failure: function(obj, resp) {
|
failure: function(obj, resp) {
|
||||||
PMExt.error( _('ID_ERROR'), resp.result.msg);
|
PMExt.error( _('ID_ERROR'), resp.result.msg);
|
||||||
@@ -527,7 +575,8 @@ function doSearch(){
|
|||||||
editProcess = function(){
|
editProcess = function(){
|
||||||
var rowSelected = processesGrid.getSelectionModel().getSelected();
|
var rowSelected = processesGrid.getSelectionModel().getSelected();
|
||||||
if( rowSelected ) {
|
if( rowSelected ) {
|
||||||
location.href = 'processes_Map?PRO_UID='+rowSelected.data.PRO_UID+'&rand='+Math.random()
|
//location.href = 'processes_Map?PRO_UID='+rowSelected.data.PRO_UID+'&rand='+Math.random()
|
||||||
|
location.href = 'openDesigner?pro_uid='+rowSelected.data.PRO_UID+'&rand='+Math.random()
|
||||||
} else {
|
} else {
|
||||||
Ext.Msg.show({
|
Ext.Msg.show({
|
||||||
title:'',
|
title:'',
|
||||||
|
|||||||
Reference in New Issue
Block a user