Saving stand alone Events on drag and drop

This commit is contained in:
girish
2011-02-12 10:07:41 +00:00
parent f4fb5522c8
commit bd85baa03f
8 changed files with 100 additions and 25 deletions

View File

@@ -4342,6 +4342,28 @@ class processMap {
}
}
/*
* Save the Event Position
* @param string $sSwimLaneUID
* @param integer $iX
* @param integer $iY
* @return integer
*/
function saveEventPosition($sEventUID = '', $iX = 110, $iY = 60)
{
try {
$oEvents = new Event( );
$aFields = $oEvents->load ( $sEventUID );
$aFields ['EVN_UID'] = $sEventUID;
$aFields ['EVN_POSX'] = $iX;
$aFields ['EVN_POSY'] = $iY;
return $oEvents->update ( $aFields );
} catch ( Exception $oError ) {
throw ($oError);
}
}
/** get all the Active process
*
* SELECT PROCESS.PRO_UID AS UID, CONTENT.CON_VALUE AS VALUE FROM PROCESS, CONTENT
@@ -6284,11 +6306,14 @@ function saveExtddEvents($oData)
{
$oTask = new Task();
$oEvent = new Event();
$oEvn_uid = '';
$sEvn_uid = '';
$aData = array();
$aData['PRO_UID'] = $oData->uid;
$aData['EVN_TYPE'] = $oData->tas_type;
$aData['EVN_TYPE'] = $oData->evn_type;
$aData['EVN_POSX'] = $oData->position->x;
$aData['EVN_POSY'] = $oData->position->y;
$mode = $oData->mode;
$aData['EVN_STATUS'] = 'ACTIVE';
$aData['EVN_WHEN'] = '1';
$aData['EVN_ACTION'] = '';
@@ -6299,27 +6324,34 @@ function saveExtddEvents($oData)
if(preg_match("/Start/", $aData['EVN_TYPE']) || preg_match("/Inter/", $aData['EVN_TYPE'])){
$aData['EVN_RELATED_TO'] = 'SINGLE';
}
if(isset($oData->tas_uid) && $oData->tas_uid != ''){
if($mode == 'updateTask'){
$aData['TAS_UID'] = $oData->tas_uid;
$oTaskData = $oTask->load($aData['TAS_UID']);
if($oTaskData['TAS_EVN_UID'] == ''){
$oEvn_uid = $oEvent->create($aData);
$sEvn_uid = $oEvent->create($aData);
}else{
$aData['EVN_UID'] = $oTaskData['TAS_EVN_UID'];
$oEvn_uid = $aData['EVN_UID'];
$sEvn_uid = $aData['EVN_UID'];
$oEvent->update($aData);
}
$aTask['TAS_UID'] = $oData->tas_uid;
$aTask['TAS_EVN_UID'] = $oEvn_uid;
$aTask['TAS_EVN_UID'] = $sEvn_uid;
$aTask['TAS_START'] = 'TRUE';
$oTask->update($aTask);
}else{
$oEvn_uid = $oEvent->create($aData);
}
$oNewTask->uid = $oEvn_uid;
else if($mode == 'ddEvent'){
$sEvn_uid = $oData->evn_uid;
$oEventData = EventPeer::retrieveByPK($sEvn_uid);
if (is_null($oEventData)) {
$sEvn_uid = $oEvent->create($aData);
}else{
$aData['EVN_UID'] = $sEvn_uid;
$oEvent->update($aData);
}
}
$oNewTask->uid = $sEvn_uid;
$oJSON = new Services_JSON ( );
return $oJSON->encode($oNewTask);
}

View File

@@ -3711,6 +3711,7 @@ class Xpdl extends processes
if($idVal['TAS_UID']==$idTask){
$coordinateX=$idVal['TAS_POSX'];
$coordinateY=$idVal['TAS_POSY'];
$tas_uid =$idVal['TAS_UID'];
}
}
$positionX = $coordinateX+65;
@@ -3730,6 +3731,7 @@ class Xpdl extends processes
if($idVal['TAS_UID']==$idTask){
$coordinateX=$idVal['TAS_POSX'];
$coordinateY=$idVal['TAS_POSY'];
$tas_uid =$idVal['TAS_UID'];
}
}
$positionX = $coordinateX + 120;
@@ -3747,6 +3749,7 @@ class Xpdl extends processes
$events[$countEvents]['1'] = 'bpmnEventEmptyEnd';
$events[$countEvents]['2'] = $positionX-25;
$events[$countEvents]['3'] = $positionY+35;
$events[$countEvents]['4'] = $tas_uid;
$countEvents = $countEvents + 1;
$end = 0;
$endEvent = 0;

View File

@@ -214,7 +214,8 @@ class Event extends BaseEvent {
{
$oEvent->setEvnRelatedTo( $aData['EVN_RELATED_TO'] );
if ( $aData['EVN_RELATED_TO'] == 'SINGLE' ) {
$oEvent->setTasUid( $aData['TAS_UID'] );
if(isset($aData['TAS_UID']) && $aData['TAS_UID'] != '')
$oEvent->setTasUid( $aData['TAS_UID'] );
$oEvent->setEvnTasUidTo( '');
$oEvent->setEvnTasUidFrom( '' );
}
@@ -225,6 +226,11 @@ class Event extends BaseEvent {
}
}
if(isset($aData['EVN_POSX']))
$oEvent->setEvnPosx($aData['EVN_POSX']);
if(isset($aData['EVN_POSY']))
$oEvent->setEvnPosy($aData['EVN_POSY']);
if(isset($aData['EVN_TAS_ESTIMATED_DURATION']))
$oEvent->setEvnTasEstimatedDuration( $aData['EVN_TAS_ESTIMATED_DURATION'] );
if(isset($aData['EVN_WHEN_OCCURS']))
@@ -249,7 +255,7 @@ class Event extends BaseEvent {
$oEvent->setEvnAction( $aData['EVN_ACTION'] );
//if ( isset ($aData['ENV_MAX_ATTEMPTS'] )) $oEvent->setEvnMaxAttempts( 3 );
if (isset($aData['EVN_ACTION_PARAMETERS'])) {
if (isset($aData['EVN_ACTION_PARAMETERS']) && $aData['EVN_ACTION_PARAMETERS'] != 0) {
$oTP = new TemplatePower(PATH_TPL . 'events' . PATH_SEP . 'sendMessage.tpl');
$oTP->prepare();