Merge branch 'master' of bitbucket.org:colosa/processmaker
This commit is contained in:
32
Rakefile
32
Rakefile
@@ -153,6 +153,38 @@ def buildPmdynaform(homeDir, targetDir, mode)
|
||||
system("rm #{pmdynaformDir}/build/appBuild.js")
|
||||
readyForm = ""
|
||||
system("echo '#{readyForm}' >> #{pmdynaformDir}/build/appBuild.js ")
|
||||
system("cp #{Dir.pwd}/workflow/engine/templates/cases/cases_Step_Pmdynaform.html #{pmdynaformDir}/build/cases_Step_Pmdynaform.html")
|
||||
system("cp #{Dir.pwd}/workflow/engine/templates/cases/cases_Step_Pmdynaform_Preview.html #{pmdynaformDir}/build/cases_Step_Pmdynaform_Preview.html")
|
||||
|
||||
template = ""
|
||||
config = File.read "#{homeDir}/config/templates.json"
|
||||
json = JSON.parse config
|
||||
json.each do |key|
|
||||
s = ""
|
||||
key["files"].each do |source|
|
||||
s += File.read "#{homeDir}/#{source}"
|
||||
s += "\n"
|
||||
end
|
||||
template += s
|
||||
end
|
||||
|
||||
target = "#{pmdynaformDir}/build/cases_Step_Pmdynaform.html"
|
||||
html = File.read target
|
||||
while html['###TEMPLATES##'] do
|
||||
html['###TEMPLATES###'] = template
|
||||
end
|
||||
File.open(target, 'w+') do |file|
|
||||
file.write html
|
||||
end
|
||||
|
||||
target = "#{pmdynaformDir}/build/cases_Step_Pmdynaform_Preview.html"
|
||||
html = File.read target
|
||||
while html['###TEMPLATES##'] do
|
||||
html['###TEMPLATES###'] = template
|
||||
end
|
||||
File.open(target, 'w+') do |file|
|
||||
file.write html
|
||||
end
|
||||
|
||||
puts "\nPmDynaform Build Finished!".magenta
|
||||
end
|
||||
|
||||
@@ -59,6 +59,9 @@
|
||||
border-radius: 10px;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
pre {
|
||||
font: 18px Georgia, "Times New Roman", Times, serif;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -67,7 +70,7 @@
|
||||
<div class="block_exception clear_fix">
|
||||
<h2>
|
||||
<abbr title="RuntimeException">RuntimeException</abbr>:
|
||||
<?php echo $message?>
|
||||
<pre><?php echo $message?></pre>
|
||||
</h2>
|
||||
</div>
|
||||
<div class="block">
|
||||
|
||||
@@ -14,6 +14,163 @@ require_once 'classes/model/om/BaseBpmnData.php';
|
||||
*
|
||||
* @package classes.model
|
||||
*/
|
||||
class BpmnData extends BaseBpmnData {
|
||||
class BpmnData extends BaseBpmnData
|
||||
{
|
||||
private $bound;
|
||||
|
||||
public function __construct($generateUid = true)
|
||||
{
|
||||
$this->bound = new BpmnBound();
|
||||
$this->setBoundDefaults();
|
||||
}
|
||||
|
||||
public function getBound()
|
||||
{
|
||||
return $this->bound;
|
||||
}
|
||||
|
||||
private function setBoundDefaults()
|
||||
{
|
||||
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
|
||||
$this->bound->setBouElement('pm_canvas');
|
||||
$this->bound->setBouContainer('bpmnDiagram');
|
||||
|
||||
$this->bound->setPrjUid($this->getPrjUid());
|
||||
$this->bound->setElementUid($this->getDatUid());
|
||||
|
||||
$process = BpmnProcessPeer::retrieveByPK($this->getProUid());
|
||||
|
||||
if (is_object($process)) {
|
||||
$this->bound->setDiaUid($process->getDiaUid());
|
||||
}
|
||||
}
|
||||
|
||||
public static function findOneBy($field, $value)
|
||||
{
|
||||
$rows = self::findAllBy($field, $value);
|
||||
|
||||
return empty($rows) ? null : $rows[0];
|
||||
}
|
||||
|
||||
public static function findAllBy($field, $value)
|
||||
{
|
||||
$c = new Criteria('workflow');
|
||||
$c->add($field, $value, Criteria::EQUAL);
|
||||
|
||||
return BpmnDataPeer::doSelect($c);
|
||||
}
|
||||
|
||||
public static function getAll($prjUid = null, $start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER)
|
||||
{
|
||||
$c = new Criteria('workflow');
|
||||
$c->addSelectColumn("BPMN_DATA.*");
|
||||
$c->addSelectColumn("BPMN_BOUND.*");
|
||||
$c->addJoin(BpmnDataPeer::DAT_UID, BpmnBoundPeer::ELEMENT_UID, Criteria::LEFT_JOIN);
|
||||
|
||||
if (! is_null($prjUid)) {
|
||||
$c->add(BpmnDataPeer::PRJ_UID, $prjUid, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$rs = BpmnDataPeer::doSelectRS($c);
|
||||
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$data = array();
|
||||
|
||||
while ($rs->next()) {
|
||||
$data[] = $changeCaseTo !== CASE_UPPER ? array_change_key_case($rs->getRow(), CASE_LOWER) : $rs->getRow();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
// OVERRIDES
|
||||
|
||||
public function setDatUid($DatUid)
|
||||
{
|
||||
parent::setDatUid($DatUid);
|
||||
$this->bound->setElementUid($this->getDatUid());
|
||||
}
|
||||
|
||||
public function setPrjUid($prjUid)
|
||||
{
|
||||
parent::setPrjUid($prjUid);
|
||||
$this->bound->setPrjUid($this->getPrjUid());
|
||||
}
|
||||
|
||||
public function setProUid($proUid)
|
||||
{
|
||||
parent::setProUid($proUid);
|
||||
|
||||
$process = BpmnProcessPeer::retrieveByPK($this->getProUid());
|
||||
$this->bound->setDiaUid($process->getDiaUid());
|
||||
}
|
||||
|
||||
public function save($con = null)
|
||||
{
|
||||
parent::save($con);
|
||||
|
||||
$this->setBoundDefaults();
|
||||
|
||||
if ($this->bound->getBouUid() == "") {
|
||||
$this->bound->setBouUid(\ProcessMaker\Util\Common::generateUID());
|
||||
}
|
||||
|
||||
$this->bound->save($con);
|
||||
}
|
||||
|
||||
public function delete($con = null)
|
||||
{
|
||||
// first, delete the related bound object
|
||||
if (! is_object($this->bound) || $this->bound->getBouUid() == "") {
|
||||
$this->bound = BpmnBound::findByElement('Data', $this->getDatUid());
|
||||
}
|
||||
|
||||
if (is_object($this->bound)) {
|
||||
$this->bound->delete($con);
|
||||
}
|
||||
|
||||
parent::delete($con);
|
||||
}
|
||||
|
||||
public function fromArray($data, $type = BasePeer::TYPE_FIELDNAME)
|
||||
{
|
||||
parent::fromArray($data, $type);
|
||||
|
||||
$bound = BpmnBound::findByElement('Data', $this->getDatUid());
|
||||
|
||||
if (is_object($bound)) {
|
||||
$this->bound = $bound;
|
||||
} else {
|
||||
$this->bound = new BpmnBound();
|
||||
$this->bound->setBouUid(ProcessMaker\Util\Common::generateUID());
|
||||
}
|
||||
|
||||
$this->bound->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
}
|
||||
|
||||
public function toArray($type = BasePeer::TYPE_FIELDNAME)
|
||||
{
|
||||
$data = parent::toArray($type);
|
||||
$bouUid = $this->bound->getBouUid();
|
||||
|
||||
if (empty($bouUid)) {
|
||||
$bound = BpmnBound::findByElement('Data', $this->getDatUid());
|
||||
|
||||
if (is_object($bound)) {
|
||||
$this->bound = $bound;
|
||||
}
|
||||
}
|
||||
|
||||
$data = array_merge($data, $this->bound->toArray($type));
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function exists($DatUid)
|
||||
{
|
||||
$c = new Criteria("workflow");
|
||||
$c->add(BpmnDataPeer::DAT_UID, $DatUid);
|
||||
|
||||
return BpmnDataPeer::doCount($c) > 0 ? true : false;
|
||||
}
|
||||
} // BpmnData
|
||||
|
||||
@@ -14,6 +14,163 @@ require_once 'classes/model/om/BaseBpmnParticipant.php';
|
||||
*
|
||||
* @package classes.model
|
||||
*/
|
||||
class BpmnParticipant extends BaseBpmnParticipant {
|
||||
class BpmnParticipant extends BaseBpmnParticipant
|
||||
{
|
||||
private $bound;
|
||||
|
||||
public function __construct($generateUid = true)
|
||||
{
|
||||
$this->bound = new BpmnBound();
|
||||
$this->setBoundDefaults();
|
||||
}
|
||||
|
||||
public function getBound()
|
||||
{
|
||||
return $this->bound;
|
||||
}
|
||||
|
||||
private function setBoundDefaults()
|
||||
{
|
||||
$this->bound->setBouElementType(lcfirst(str_replace(__NAMESPACE__, '', __CLASS__)));
|
||||
$this->bound->setBouElement('pm_canvas');
|
||||
$this->bound->setBouContainer('bpmnDiagram');
|
||||
|
||||
$this->bound->setPrjUid($this->getPrjUid());
|
||||
$this->bound->setElementUid($this->getParUid());
|
||||
|
||||
$process = BpmnProcessPeer::retrieveByPK($this->getProUid());
|
||||
|
||||
if (is_object($process)) {
|
||||
$this->bound->setDiaUid($process->getDiaUid());
|
||||
}
|
||||
}
|
||||
|
||||
public static function findOneBy($field, $value)
|
||||
{
|
||||
$rows = self::findAllBy($field, $value);
|
||||
|
||||
return empty($rows) ? null : $rows[0];
|
||||
}
|
||||
|
||||
public static function findAllBy($field, $value)
|
||||
{
|
||||
$c = new Criteria('workflow');
|
||||
$c->add($field, $value, Criteria::EQUAL);
|
||||
|
||||
return BpmnParticipantPeer::doSelect($c);
|
||||
}
|
||||
|
||||
public static function getAll($prjUid = null, $start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER)
|
||||
{
|
||||
$c = new Criteria('workflow');
|
||||
$c->addSelectColumn("BPMN_PARTICIPANT.*");
|
||||
$c->addSelectColumn("BPMN_BOUND.*");
|
||||
$c->addJoin(BpmnParticipantPeer::PAR_UID, BpmnBoundPeer::ELEMENT_UID, Criteria::LEFT_JOIN);
|
||||
|
||||
if (! is_null($prjUid)) {
|
||||
$c->add(BpmnParticipantPeer::PRJ_UID, $prjUid, Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$rs = BpmnParticipantPeer::doSelectRS($c);
|
||||
$rs->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$participants = array();
|
||||
|
||||
while ($rs->next()) {
|
||||
$participants[] = $changeCaseTo !== CASE_UPPER ? array_change_key_case($rs->getRow(), CASE_LOWER) : $rs->getRow();
|
||||
}
|
||||
|
||||
return $participants;
|
||||
}
|
||||
|
||||
// OVERRIDES
|
||||
|
||||
public function setParUid($actUid)
|
||||
{
|
||||
parent::setParUid($actUid);
|
||||
$this->bound->setElementUid($this->getParUid());
|
||||
}
|
||||
|
||||
public function setPrjUid($prjUid)
|
||||
{
|
||||
parent::setPrjUid($prjUid);
|
||||
$this->bound->setPrjUid($this->getPrjUid());
|
||||
}
|
||||
|
||||
public function setProUid($proUid)
|
||||
{
|
||||
parent::setProUid($proUid);
|
||||
|
||||
$process = BpmnProcessPeer::retrieveByPK($this->getProUid());
|
||||
$this->bound->setDiaUid($process->getDiaUid());
|
||||
}
|
||||
|
||||
public function save($con = null)
|
||||
{
|
||||
parent::save($con);
|
||||
|
||||
$this->setBoundDefaults();
|
||||
|
||||
if ($this->bound->getBouUid() == "") {
|
||||
$this->bound->setBouUid(\ProcessMaker\Util\Common::generateUID());
|
||||
}
|
||||
|
||||
$this->bound->save($con);
|
||||
}
|
||||
|
||||
public function delete($con = null)
|
||||
{
|
||||
// first, delete the related bound object
|
||||
if (! is_object($this->bound) || $this->bound->getBouUid() == "") {
|
||||
$this->bound = BpmnBound::findByElement('Participant', $this->getParUid());
|
||||
}
|
||||
|
||||
if (is_object($this->bound)) {
|
||||
$this->bound->delete($con);
|
||||
}
|
||||
|
||||
parent::delete($con);
|
||||
}
|
||||
|
||||
public function fromArray($data, $type = BasePeer::TYPE_FIELDNAME)
|
||||
{
|
||||
parent::fromArray($data, $type);
|
||||
|
||||
$bound = BpmnBound::findByElement('Participant', $this->getParUid());
|
||||
|
||||
if (is_object($bound)) {
|
||||
$this->bound = $bound;
|
||||
} else {
|
||||
$this->bound = new BpmnBound();
|
||||
$this->bound->setBouUid(ProcessMaker\Util\Common::generateUID());
|
||||
}
|
||||
|
||||
$this->bound->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
}
|
||||
|
||||
public function toArray($type = BasePeer::TYPE_FIELDNAME)
|
||||
{
|
||||
$data = parent::toArray($type);
|
||||
$bouUid = $this->bound->getBouUid();
|
||||
|
||||
if (empty($bouUid)) {
|
||||
$bound = BpmnBound::findByElement('Participant', $this->getParUid());
|
||||
|
||||
if (is_object($bound)) {
|
||||
$this->bound = $bound;
|
||||
}
|
||||
}
|
||||
|
||||
$data = array_merge($data, $this->bound->toArray($type));
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function exists($actUid)
|
||||
{
|
||||
$c = new Criteria("workflow");
|
||||
$c->add(BpmnParticipantPeer::PAR_UID, $actUid);
|
||||
|
||||
return BpmnParticipantPeer::doCount($c) > 0 ? true : false;
|
||||
}
|
||||
} // BpmnParticipant
|
||||
|
||||
39
workflow/engine/js/cases/core/cases_Step_Pmdynaform.js
Normal file
39
workflow/engine/js/cases/core/cases_Step_Pmdynaform.js
Normal file
@@ -0,0 +1,39 @@
|
||||
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;
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
var data = JSON.parse(jsondata);
|
||||
var modelPMDynaform = new PMDynaform.Model.Form(data);
|
||||
var viewPMDynaform = new PMDynaform.View.Form({tagName: "div", renderTo: $(".container"), model: modelPMDynaform});
|
||||
|
||||
if (pm_run_outside_main_app === 'true') {
|
||||
if (parent.showCaseNavigatorPanel) {
|
||||
parent.showCaseNavigatorPanel('DRAFT');
|
||||
}
|
||||
|
||||
if (parent.setCurrent) {
|
||||
parent.setCurrent(dyn_uid);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -257,7 +257,33 @@ try {
|
||||
$oDbConnections->loadAdditionalConnections();
|
||||
$_SESSION['CURRENT_DYN_UID'] = $_GET['UID'];
|
||||
|
||||
/*
|
||||
* Checks the type of Dynaform.
|
||||
* DYN_VERSION: 1 is classic Dynaform, 2 is Pmdynaform (responsive form).
|
||||
*/
|
||||
$a = new Criteria("workflow");
|
||||
$a->addSelectColumn(DynaformPeer::DYN_VERSION);
|
||||
$a->addSelectColumn(DynaformPeer::DYN_CONTENT);
|
||||
$a->add(DynaformPeer::DYN_UID, $_GET['UID'], Criteria::EQUAL);
|
||||
$ds = ProcessPeer::doSelectRS($a);
|
||||
$ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$ds->next();
|
||||
$row = $ds->getRow();
|
||||
if (isset($row) && $row["DYN_VERSION"] == 2) {
|
||||
//$oTemplatePower = new TemplatePower(PATH_TPL . 'cases/cases_Step_Pmdynaform.html');
|
||||
$oTemplatePower = new TemplatePower(PATH_HOME . 'public_html/lib/pmdynaform/build/cases_Step_Pmdynaform.html');
|
||||
$oTemplatePower->prepare();
|
||||
$oTemplatePower->assign("JSON_DATA", $row["DYN_CONTENT"]);
|
||||
$oTemplatePower->assign("CASE", $array["CASE"]);
|
||||
$oTemplatePower->assign("APP_NUMBER", $array["APP_NUMBER"]);
|
||||
$oTemplatePower->assign("TITLE", $array["TITLE"]);
|
||||
$oTemplatePower->assign("APP_TITLE", $array["APP_TITLE"]);
|
||||
$oTemplatePower->assign("PM_RUN_OUTSIDE_MAIN_APP", (!isset($_SESSION["PM_RUN_OUTSIDE_MAIN_APP"])) ? "true" : "false");
|
||||
$oTemplatePower->assign("DYN_UID", $_GET['UID']);
|
||||
} 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()) : ''));
|
||||
}
|
||||
|
||||
break;
|
||||
case 'INPUT_DOCUMENT':
|
||||
if ($noShowTitle == 0) {
|
||||
@@ -1018,6 +1044,13 @@ try {
|
||||
die();
|
||||
}
|
||||
|
||||
/*
|
||||
* Checks the type of Dynaform.
|
||||
* DYN_VERSION: 1 is classic Dynaform, 2 is Pmdynaform (responsive form).
|
||||
*/
|
||||
if (isset($row) && $row["DYN_VERSION"] == 2) {
|
||||
$oTemplatePower->printToScreen();
|
||||
} else {
|
||||
$oHeadPublisher = & headPublisher::getSingleton();
|
||||
$oHeadPublisher->addScriptFile( "/jscore/cases/core/cases_Step.js" );
|
||||
|
||||
@@ -1043,4 +1076,4 @@ if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
|
||||
showdebug();
|
||||
}' );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -672,6 +672,8 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$diagram["artifacts"] = $bwp->getArtifacts($configList);
|
||||
$diagram["laneset"] = $bwp->getLanesets($configList);
|
||||
$diagram["lanes"] = $bwp->getLanes($configList);
|
||||
$diagram["data"] = $bwp->getDataCollection($configList);
|
||||
$diagram["participants"] = $bwp->getParticipants($configList);
|
||||
$project["diagrams"][] = $diagram;
|
||||
}
|
||||
|
||||
@@ -862,6 +864,7 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
$bwp->removeGateway($gatewayData["GAT_UID"]);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Diagram's Events Handling
|
||||
*/
|
||||
@@ -914,6 +917,99 @@ class BpmnWorkflow extends Project\Bpmn
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Diagram's Data Handling
|
||||
*/
|
||||
$whiteList = array();
|
||||
foreach ($diagram["data"] as $i => $dataObjectData) {
|
||||
$dataObjectData = array_change_key_case($dataObjectData, CASE_UPPER);
|
||||
unset($dataObjectData["_EXTENDED"]);
|
||||
|
||||
$dataObject = $bwp->getData($dataObjectData["DAT_UID"]);
|
||||
|
||||
if ($forceInsert || is_null($dataObject)) {
|
||||
if ($generateUid) {
|
||||
//Event
|
||||
unset($dataObjectData["BOU_UID"]);
|
||||
|
||||
$uidOld = $dataObjectData["DAT_UID"];
|
||||
$dataObjectData["DAT_UID"] = Util\Common::generateUID();
|
||||
|
||||
$result[] = array(
|
||||
"object" => "data",
|
||||
"old_uid" => $uidOld,
|
||||
"new_uid" => $dataObjectData["DAT_UID"]
|
||||
);
|
||||
}
|
||||
|
||||
$bwp->addData($dataObjectData);
|
||||
} elseif (! $bwp->isEquals($dataObject, $dataObjectData)) {
|
||||
$bwp->updateData($dataObjectData["DAT_UID"], $dataObjectData);
|
||||
} else {
|
||||
Util\Logger::log("Update Data ({$dataObjectData["DAT_UID"]}) Skipped - No changes required");
|
||||
}
|
||||
|
||||
$diagram["data"][$i] = $dataObjectData;
|
||||
$whiteList[] = $dataObjectData["DAT_UID"];
|
||||
}
|
||||
|
||||
$dataCollection = $bwp->getDataCollection();
|
||||
|
||||
// looking for removed elements
|
||||
foreach ($dataCollection as $dataObjectData) {
|
||||
if (! in_array($dataObjectData["DAT_UID"], $whiteList)) {
|
||||
// If it is not in the white list, then remove them
|
||||
$bwp->removeData($dataObjectData["DAT_UID"]);
|
||||
}
|
||||
}
|
||||
|
||||
////
|
||||
/*
|
||||
* Diagram's Participant Handling
|
||||
*/
|
||||
$whiteList = array();
|
||||
foreach ($diagram["participants"] as $i => $participantData) {
|
||||
$participantData = array_change_key_case($participantData, CASE_UPPER);
|
||||
unset($participantData["_EXTENDED"]);
|
||||
|
||||
$dataObject = $bwp->getParticipant($participantData["PAR_UID"]);
|
||||
|
||||
if ($forceInsert || is_null($dataObject)) {
|
||||
if ($generateUid) {
|
||||
//Event
|
||||
unset($participantData["BOU_UID"]);
|
||||
|
||||
$uidOld = $participantData["PAR_UID"];
|
||||
$participantData["PAR_UID"] = Util\Common::generateUID();
|
||||
|
||||
$result[] = array(
|
||||
"object" => "participant",
|
||||
"old_uid" => $uidOld,
|
||||
"new_uid" => $participantData["PAR_UID"]
|
||||
);
|
||||
}
|
||||
|
||||
$bwp->addParticipant($participantData);
|
||||
} elseif (! $bwp->isEquals($dataObject, $participantData)) {
|
||||
$bwp->updateParticipant($participantData["PAR_UID"], $participantData);
|
||||
} else {
|
||||
Util\Logger::log("Update Participant ({$participantData["PAR_UID"]}) Skipped - No changes required");
|
||||
}
|
||||
|
||||
$diagram["participant"][$i] = $participantData;
|
||||
$whiteList[] = $participantData["PAR_UID"];
|
||||
}
|
||||
|
||||
$dataCollection = $bwp->getParticipants();
|
||||
|
||||
// looking for removed elements
|
||||
foreach ($dataCollection as $participantData) {
|
||||
if (! in_array($participantData["PAR_UID"], $whiteList)) {
|
||||
// If it is not in the white list, then remove them
|
||||
$bwp->removeParticipant($participantData["PAR_UID"]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Diagram's Flows Handling
|
||||
|
||||
@@ -24,6 +24,8 @@ use \BpmnEventPeer as EventPeer;
|
||||
use \BpmnGatewayPeer as GatewayPeer;
|
||||
use \BpmnFlowPeer as FlowPeer;
|
||||
use \BpmnArtifactPeer as ArtifactPeer;
|
||||
use \BpmnParticipant as Participant;
|
||||
use \BpmnParticipantPeer as ParticipantPeer;
|
||||
|
||||
use \BasePeer;
|
||||
|
||||
@@ -71,7 +73,9 @@ class Bpmn extends Handler
|
||||
"PRJ_UID", "PRO_UID", "BOU_ELEMENT", "BOU_ELEMENT_TYPE", "BOU_REL_POSITION",
|
||||
"BOU_SIZE_IDENTICAL", "DIA_UID", "BOU_UID", "ELEMENT_UID"
|
||||
),
|
||||
"flow" => array("PRJ_UID", "DIA_UID", "FLO_ELEMENT_DEST_PORT", "FLO_ELEMENT_ORIGIN_PORT")
|
||||
"flow" => array("PRJ_UID", "DIA_UID", "FLO_ELEMENT_DEST_PORT", "FLO_ELEMENT_ORIGIN_PORT"),
|
||||
"data" => array("PRJ_UID"),
|
||||
"participant" => array("PRJ_UID"),
|
||||
);
|
||||
|
||||
|
||||
@@ -788,6 +792,170 @@ class Bpmn extends Handler
|
||||
}
|
||||
}
|
||||
|
||||
//////1111
|
||||
public function addData($data)
|
||||
{
|
||||
// setting defaults
|
||||
$data['DATA_UID'] = array_key_exists('DAT_UID', $data) ? $data['DAT_UID'] : Common::generateUID();
|
||||
try {
|
||||
self::log("Add BpmnData with data: ", $data);
|
||||
$bpmnData = new \BpmnData();
|
||||
$bpmnData->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
$bpmnData->setPrjUid($this->getUid());
|
||||
$bpmnData->setProUid($this->getProcess("object")->getProUid());
|
||||
$bpmnData->save();
|
||||
self::log("Add BpmnData Success!");
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $bpmnData->getDatUid();
|
||||
}
|
||||
|
||||
public function updateData($datUid, $data)
|
||||
{
|
||||
try {
|
||||
self::log("Update BpmnData: $datUid", "With data: ", $data);
|
||||
|
||||
$bpmnData = ArtifactPeer::retrieveByPk($datUid);
|
||||
|
||||
$bpmnData->fromArray($data);
|
||||
$bpmnData->save();
|
||||
|
||||
self::log("Update BpmnData Success!");
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function getData($datUid, $retType = 'array')
|
||||
{
|
||||
$bpmnData = ArtifactPeer::retrieveByPK($datUid);
|
||||
|
||||
if ($retType != "object" && ! empty($bpmnData)) {
|
||||
$bpmnData = $bpmnData->toArray();
|
||||
$bpmnData = self::filterArrayKeys($bpmnData, self::$excludeFields["data"]);
|
||||
}
|
||||
|
||||
return $bpmnData;
|
||||
}
|
||||
|
||||
public function getDataCollection($start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER)
|
||||
{
|
||||
if (is_array($start)) {
|
||||
extract($start);
|
||||
}
|
||||
|
||||
$filter = $changeCaseTo != CASE_UPPER ? array_map("strtolower", self::$excludeFields["data"]) : self::$excludeFields["data"];
|
||||
|
||||
return self::filterCollectionArrayKeys(
|
||||
\BpmnData::getAll($this->getUid(), $start, $limit, $filter, $changeCaseTo),
|
||||
$filter
|
||||
);
|
||||
}
|
||||
|
||||
public function removeData($datUid)
|
||||
{
|
||||
try {
|
||||
self::log("Remove BpmnData: $datUid");
|
||||
|
||||
$bpmnData = \BpmnDataPeer::retrieveByPK($datUid);
|
||||
$bpmnData->delete();
|
||||
|
||||
// remove related object (flows)
|
||||
Flow::removeAllRelated($datUid);
|
||||
|
||||
self::log("Remove BpmnData Success!");
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
//////2222
|
||||
|
||||
public function addParticipant($data)
|
||||
{
|
||||
// setting defaults
|
||||
$data['PAR_UID'] = array_key_exists('PAR_UID', $data) ? $data['PAR_UID'] : Common::generateUID();
|
||||
try {
|
||||
self::log("Add Participant with data: ", $data);
|
||||
$participant = new Participant();
|
||||
$participant->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
$participant->setPrjUid($this->getUid());
|
||||
$participant->setProUid($this->getProcess("object")->getProUid());
|
||||
$participant->save();
|
||||
self::log("Add Participant Success!");
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $participant->getParUid();
|
||||
}
|
||||
|
||||
public function updateParticipant($parUid, $data)
|
||||
{
|
||||
try {
|
||||
self::log("Update Participant: $parUid", "With data: ", $data);
|
||||
|
||||
$participant = ParticipantPeer::retrieveByPk($parUid);
|
||||
|
||||
$participant->fromArray($data);
|
||||
$participant->save();
|
||||
|
||||
self::log("Update Participant Success!");
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function getParticipant($parUid, $retType = 'array')
|
||||
{
|
||||
$participant = ParticipantPeer::retrieveByPK($parUid);
|
||||
|
||||
if ($retType != "object" && ! empty($participant)) {
|
||||
$participant = $participant->toArray();
|
||||
$participant = self::filterArrayKeys($participant, self::$excludeFields["participant"]);
|
||||
}
|
||||
|
||||
return $participant;
|
||||
}
|
||||
|
||||
public function getParticipants($start = null, $limit = null, $filter = '', $changeCaseTo = CASE_UPPER)
|
||||
{
|
||||
if (is_array($start)) {
|
||||
extract($start);
|
||||
}
|
||||
|
||||
$filter = $changeCaseTo != CASE_UPPER ? array_map("strtolower", self::$excludeFields["participant"]) : self::$excludeFields["participant"];
|
||||
|
||||
return self::filterCollectionArrayKeys(
|
||||
Participant::getAll($this->getUid(), $start, $limit, $filter, $changeCaseTo),
|
||||
$filter
|
||||
);
|
||||
}
|
||||
|
||||
public function removeParticipant($parUid)
|
||||
{
|
||||
try {
|
||||
self::log("Remove Participant: $parUid");
|
||||
|
||||
$participant = ParticipantPeer::retrieveByPK($parUid);
|
||||
$participant->delete();
|
||||
|
||||
// remove related object (flows)
|
||||
Flow::removeAllRelated($parUid);
|
||||
|
||||
self::log("Remove Participant Success!");
|
||||
} catch (\Exception $e) {
|
||||
self::log("Exception: ", $e->getMessage(), "Trace: ", $e->getTraceAsString());
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function addLane($data)
|
||||
{
|
||||
// TODO: Implement update() method.
|
||||
|
||||
37
workflow/engine/templates/cases/cases_Step_Pmdynaform.html
Normal file
37
workflow/engine/templates/cases/cases_Step_Pmdynaform.html
Normal file
@@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>PMDynaform</title>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<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' type='text/css' href='/css/neoclassic-blank.css' />
|
||||
<link rel="stylesheet" href="/lib/pmdynaform/libs/bootstrap-3.1.1/css/bootstrap.min.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/jquery/jquery.inputmask.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/underscore/underscore-1.6.js"></script>
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/backbone/backbone-min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container"></div>
|
||||
###TEMPLATES###
|
||||
<script type="text/javascript" src="/lib/pmdynaform/build/js/PMDynaform.js"></script>
|
||||
<script type="text/javascript">
|
||||
var jsondata = '{JSON_DATA}';
|
||||
var pm_run_outside_main_app = '{PM_RUN_OUTSIDE_MAIN_APP}';
|
||||
var dyn_uid = '{DYN_UID}';
|
||||
</script>
|
||||
<script type="text/javascript" src="/jscore/cases/core/cases_Step.js"></script>
|
||||
<script type="text/javascript" src="/jscore/cases/core/cases_Step_Pmdynaform.js"></script>
|
||||
<table width="100%" align="center">
|
||||
<tr class="userGroupTitle">
|
||||
<td width="100%" align="center">{CASE} #: {APP_NUMBER} {TITLE}: {APP_TITLE}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<a style="float: left; margin: 10px 2px 2px 10px; cursor: pointer; opacity: 1;"><img src="/lib/img/pager-previous-icon.png" style="padding-right:5px;width:25px;height:20px;">Previous Step</a>
|
||||
<a style="float: right; margin: 10px 10px 2px 2px; cursor: pointer; opacity: 1;">Next step<img src="/lib/img/pager-next-icon.png" style="padding-left:5px;width:25px;height:20px;"></a>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>PMDynaform</title>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<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' type='text/css' href='/css/neoclassic-blank.css' />
|
||||
<link rel="stylesheet" href="/lib/pmdynaform/libs/bootstrap-3.1.1/css/bootstrap.min.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/jquery/jquery.inputmask.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/underscore/underscore-1.6.js"></script>
|
||||
<script type="text/javascript" src="/lib/pmdynaform/libs/backbone/backbone-min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container"></div>
|
||||
###TEMPLATES###
|
||||
<script type="text/javascript" src="/lib/pmdynaform/build/js/PMDynaform.js"></script>
|
||||
<a style="float: left; margin: 10px 2px 2px 10px; cursor: pointer; opacity: 1;"><img src="/lib/img/pager-previous-icon.png" style="padding-right:5px;width:25px;height:20px;">Previous Step</a>
|
||||
<a style="float: right; margin: 10px 10px 2px 2px; cursor: pointer; opacity: 1;">Next step<img src="/lib/img/pager-next-icon.png" style="padding-left:5px;width:25px;height:20px;"></a>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user