diff --git a/workflow/engine/methods/bpmn/cases_Scheduler_Save.php b/workflow/engine/methods/bpmn/cases_Scheduler_Save.php new file mode 100755 index 000000000..af9e57266 --- /dev/null +++ b/workflow/engine/methods/bpmn/cases_Scheduler_Save.php @@ -0,0 +1,301 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + */ +try { +/* + global $RBAC; + switch ($RBAC->userCanAccess('PM_FACTORY')) + { + case -2: + G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels'); + G::header('location: ../login/login'); + die; + break; + case -1: + G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); + G::header('location: ../login/login'); + die; + break; + } + */ + + + require_once 'classes/model/CaseScheduler.php'; + $oCaseScheduler = new CaseScheduler(); + + if (empty($_POST)) { + die('The information sended is empty!'); + } + + if(empty($_POST['SCH_UID'])) + $aData['SCH_UID'] = G::generateUniqueID(); + else + $aData['SCH_UID'] = $_POST['SCH_UID']; + + $aData['SCH_NAME'] = $_POST['SCH_NAME']; + $aData['SCH_DEL_USER_NAME'] = $_POST['SCH_DEL_USER_NAME']; + $aData['SCH_DEL_USER_PASS'] = md5($_POST['SCH_USER_PASSWORD']); + $aData['SCH_DEL_USER_UID'] = $_POST['SCH_DEL_USER_UID']; + $aData['PRO_UID'] = $_POST['PRO_UID']; + $aData['TAS_UID'] = $_POST['TAS_UID']; + + $aData['SCH_STATE'] = 'ACTIVE'; + $aData['SCH_LAST_STATE'] = 'CREATED'; // 'ACTIVE'; + $aData['USR_UID'] = $_SESSION['USER_LOGGED']; + + $sOption = $_POST['SCH_OPTION']; + if($sOption == 'Daily') + { + $aData['SCH_OPTION'] = '1'; + $sOption = '1'; + } + else if($sOption == 'Weekly') + { + $aData['SCH_OPTION'] = '2'; + $sOption = '2'; + } + else if($sOption == 'Monthly') + { + $aData['SCH_OPTION'] = '3'; + $sOption = '3'; + } + else if($sOption == 'One time only') + { + $aData['SCH_OPTION'] = '4'; + $sOption = '4'; + } + + if ($_POST['SCH_START_DATE']!=''){ + $sDateTmp = $_POST['SCH_START_DATE']; + } else { + $sDateTmp = date('Y-m-d'); + } + $sTimeTmp = $_POST['SCH_START_TIME']; + $aData['SCH_START_TIME'] = date('Y-m-d', strtotime($sDateTmp)) . ' ' . date('H:i:s', strtotime($sTimeTmp)); + $aData['SCH_START_DATE'] = date('Y-m-d', strtotime($sDateTmp)) . ' ' . date('H:i:s', strtotime($sTimeTmp)); + + $nActualTime = $_POST['SCH_START_TIME']; // time(); + // $nActualDate = date("Y-m-d H:i:s", $nActualTime); + + $sValue = ''; + $sDaysPerformTask = ''; + $sWeeks = ''; + $sMonths = ''; + $sMonths = ''; + $sStartDay = ''; + $nSW = 0; + + switch($sOption){ + case '1' : // Option 1 + $sValue = $_POST['SCH_DAYS_PERFORM_TASK']; + switch($sValue){ + case '1' : $aData['SCH_DAYS_PERFORM_TASK'] = $_POST['SCH_DAYS_PERFORM_TASK'] . '|1'; + break; + case '2' : + $aData['SCH_OPTION'] = '2'; + $aData['SCH_EVERY_DAYS'] = '1'; + $aData['SCH_WEEK_DAYS'] = '1|2|3|4|5|'; + break; + case '3' : // Every [n] Days + $sDaysPerformTask = $_POST['SCH_DAYS_PERFORM_TASK_OPT_3']; + $aData['SCH_DAYS_PERFORM_TASK'] = $_POST['SCH_DAYS_PERFORM_TASK'] . '|' . $_POST['SCH_DAYS_PERFORM_TASK_OPT_3']; + break; + } + break; + + case '2' : // If the option is zero, set by default 1 + if(empty($_POST['SCH_EVERY_DAYS'])) + $nEveryDays = 1; + else + $nEveryDays = $_POST['SCH_EVERY_DAYS']; + $aData['SCH_EVERY_DAYS'] = $nEveryDays; + $sWeeks = ''; + if(!empty($_POST['SCH_WEEK_DAYS'])){ + $aWeekDays = explode(',',$_POST['SCH_WEEK_DAYS']); + foreach($aWeekDays as $value) { + $sWeeks = $sWeeks . $value . '|'; + } + } + /*if(!empty($_POST['SCH_WEEK_DAYS_2'])){ + $aWeekDays2 = $_POST['SCH_WEEK_DAYS_2']; + foreach($aWeekDays2 as $value) { + $sWeeks = $sWeeks . $value . '|'; + } + }*/ + $sStartTime = $_POST['SCH_START_TIME']; + $aData['SCH_WEEK_DAYS'] = $sWeeks; + + break; + case '3' : + $nStartDay = $_POST['SCH_START_DAY']; + if($nStartDay == 'Day of Month') + $nStartDay = 1; + else if($nStartDay == 'The Day') + $nStartDay = 2; + + $sStartDayOpt2Week = $_POST['SCH_START_DAY_OPT_2_WEEKS']; + switch($sStartDayOpt2Week){ + case 'First': + $sStartDayOpt2Week = 1; + break; + case 'Second': + $sStartDayOpt2Week = 2; + break; + case 'Third': + $sStartDayOpt2Week = 3; + break; + case 'Fourth': + $sStartDayOpt2Week = 4; + break; + case 'Last': + $sStartDayOpt2Week = 5; + break; + + } + + $sStartDayOpt2DayWeek = $_POST['SCH_START_DAY_OPT_2_DAYS_WEEK']; + + switch($sStartDayOpt2DayWeek){ + case 'Monday': + $sStartDayOpt2DayWeek = 1; + break; + case 'Tuesday': + $sStartDayOpt2DayWeek = 2; + break; + case 'Wednesday': + $sStartDayOpt2DayWeek = 3; + break; + case 'Thursday': + $sStartDayOpt2DayWeek = 4; + break; + case 'Friday': + $sStartDayOpt2DayWeek = 5; + break; + case 'Saturday': + $sStartDayOpt2DayWeek = 6; + break; + case 'Sunday': + $sStartDayOpt2DayWeek = 7; + break; + } + + if($nStartDay == 1){ + $aData['SCH_START_DAY'] = $nStartDay . '|' . $_POST['SCH_START_DAY_OPT_1']; + } else { + $aData['SCH_START_DAY'] = $nStartDay . '|' . $sStartDayOpt2Week . '|' . $sStartDayOpt2DayWeek; + } + + $sMonths = ''; + if(!empty($_POST['SCH_MONTHS'])){ + //$aMonths = $_POST['SCH_MONTHS']; + $aMonths = explode(',',$_POST['SCH_MONTHS']); + foreach($aMonths as $value) { + $sMonths = $sMonths . $value . '|' ; + } + } + /*if(!empty($_POST['SCH_MONTHS_2'])){ + $aMonths2 = $_POST['SCH_MONTHS_2']; + foreach($aMonths2 as $value) { + $sMonths = $sMonths . $value . '|' ; + } + } + if(!empty($_POST['SCH_MONTHS_3'])){ + $aMonths3 = $_POST['SCH_MONTHS_3']; + foreach($aMonths3 as $value) { + $sMonths = $sMonths . $value . '|' ; + } + } */ + $aData['SCH_MONTHS'] = $sMonths; + $sStartDay = $aData['SCH_START_DAY']; + $sValue = $nStartDay; + break; + + + } + if(($sOption!='1') && ($sOption!='4')) { + if ($sStartDay==''){ + $sStartDay = date('Y-m-d'); + } +// echo $sOption."*". $sValue."*". $nActualTime."*". $sDaysPerformTask."*". $sWeeks."*". $sStartDay ."*". $sMonths."
"; + $dCurrentDay = date("d"); + $dCurrentMonth = date("m"); + $aStartDay = explode( "|" , $aData['SCH_START_DAY'] ); + if($sOption=='3'&&$aStartDay[0]=='1'){ + $monthsArray = explode("|",$sMonths); + foreach ($monthsArray as $row){ + if ( $dCurrentMonth == $row && $dCurrentDay<$aStartDay[1] ){ + $startTime = $_POST['SCH_START_TIME'].":00"; + $aData['SCH_TIME_NEXT_RUN'] = date('Y') . '-' . $row . '-' . $aStartDay[1] . ' ' . $startTime; + break; + } else { + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun($sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp); + } + } + } else { + $aData['SCH_TIME_NEXT_RUN'] = $oCaseScheduler->updateNextRun($sOption, $sValue, $nActualTime, $sDaysPerformTask, $sWeeks, $sStartDay, $sMonths, $sDateTmp); + } +// print_r ($aData['SCH_TIME_NEXT_RUN']); +// die; + } else { + if ($sOption=='4'){ + $aData['SCH_END_DATE'] = $aData['SCH_START_TIME']; + } + $aData['SCH_TIME_NEXT_RUN'] = $aData['SCH_START_TIME']; + } + + if(trim($_POST['SCH_END_DATE'])!=''){ + $aData['SCH_END_DATE'] = $_POST['SCH_END_DATE']; + } + + if(!empty($_POST['SCH_REPEAT_TASK_CHK'])){ + $nOptEvery = $_POST['SCH_REPEAT_EVERY_OPT']; + if($nOptEvery ==2) + $aData['SCH_REPEAT_EVERY'] = $_POST['SCH_REPEAT_EVERY'] * 60; + else + $aData['SCH_REPEAT_EVERY'] = $_POST['SCH_REPEAT_EVERY']; + + + } + //$aData['SCH_END_DATE'] = "2020-12-30"; + if(empty($_POST['SCH_UID'])) + $oCaseScheduler->create($aData); + else + $oCaseScheduler->update($aData); + + //Save Scheduler_uid in the Event Table for Start Timer. + $oData['EVN_UID']= $_POST['EVN_UID']; + $oData['EVN_ACTION']= $aData['SCH_UID']; + require_once "classes/model/Event.php"; + $oEvent = new Event(); + $oEvent->update($oData); + echo "{success: true}"; + //G::header('location: cases_Scheduler_List'); + + +} +catch (Exception $oException) { + die($oException->getMessage()); +} + +?> \ No newline at end of file diff --git a/workflow/engine/methods/bpmn/eventsEditAction.php b/workflow/engine/methods/bpmn/eventsEditAction.php new file mode 100755 index 000000000..23589f4a4 --- /dev/null +++ b/workflow/engine/methods/bpmn/eventsEditAction.php @@ -0,0 +1,249 @@ +. + * + * For more information, contact Colosa Inc, 2566 Le Jeune Rd., + * Coral Gables, FL, 33134, USA, or email info@colosa.com. + * + */ +global $RBAC; +global $_DBArray; + +if ($RBAC->userCanAccess('PM_SETUP') != 1) { + G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); + G::header('location: ../login/login'); + die; +} +if ( isset ($_SESSION['EVN_UID']) ) { + $evnUid = $_SESSION['EVN_UID']; + unset ( $_SESSION['EVN_UID'] ); +} +else + $evnUid = $_GET['EVN_UID']; + +require_once 'classes/model/Event.php'; +require_once 'classes/model/Triggers.php'; +$oEvent = new Event(); +$oTrigger = new Triggers(); +$aFields = $oEvent->load( $evnUid ); +$parameters = unserialize ( $oEvent->getEvnActionParameters() ); +//g::pr($parameters); die; +$aTrigger = $oTrigger->load($aFields['TRI_UID']); + +$hash = md5 ( $oTrigger->getTriWebbot() ); +//var_dump($hash,$parameters->hash);die; +//if the hash is different, the script was edited , so we will show the trigger editor. +if ( ( isset($parameters->hash) && $hash <> $parameters->hash ) || $aFields['EVN_ACTION'] == 'EXECUTE_TRIGGER' || $aFields['EVN_ACTION'] == 'EXECUTE_CONDITIONAL_TRIGGER' ) { + $oTriggerParams = unserialize($aTrigger['TRI_PARAM']); + // check again a hash, this time to check the trigger itself integrity + if ($oTriggerParams['hash']!=$hash){ + // if has changed edit manually + G::LoadClass('xmlfield_InputPM'); + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'triggers/triggersNarrowEdit', '', $aTrigger, '../events/triggersSave'); + G::RenderPage('publish', 'raw'); + die; + } else { + // if not launch the wizard view. + $triUid = $aFields['TRI_UID']; + $_GET = $oTriggerParams['params']; + $_GET['TRI_UID'] = $triUid; + require_once(PATH_METHODS.'triggers/triggers_EditWizard.php'); + die; + } +} + +$aFields['EVN_MESSAGE_SUBJECT'] = (isset($parameters->SUBJECT) ? $parameters->SUBJECT : ''); + +if(isset($parameters->TO)){ + $paramTO[] = Array('id'=>'char', 'name'=>'char'); + + //echo '
';print_r($parameters->TO);
+	foreach($parameters->TO as $item){
+		$row = explode('|', $item);
+		switch($row[0]){
+			case 'usr':
+				require_once('classes/model/Users.php');
+				$user = new Users();
+				
+				if($row[1] == '-1'){
+					$value = '(Current Task User)'; 
+				} else {
+					$rec = $user->load($row[1]);
+					$value = $rec['USR_FIRSTNAME'].' '.$rec['USR_LASTNAME'];
+				}
+			break;
+			
+			case 'grp':
+				G::LoadClass('groups');
+				$group = new Groups();
+				$rec = $group->load($row[1]);
+				
+				$value = strip_tags($rec->getGrpTitle());
+			break;
+			
+			case 'ext':
+				$value = htmlentities($row[1]); 
+			break;
+			
+			case 'dyn':
+				$value = htmlentities('@#'.$row[1]); 
+			break;
+			
+			default:
+					echo '->'.$row[0];
+		}
+		$paramTO[] = Array('id'=>replaceQuotes($item), 'name'=>$value);
+	}
+} else {
+	$paramTO[] = Array('id'=>'char', 'name'=>'char');
+	$paramTO[] = Array('id'=>'usr|-1', 'name'=>'(Current Task User)');
+}
+$_DBArray['eventomsgto'] = $paramTO;
+
+if(isset($parameters->CC)){
+	$paramCC[] = Array('id'=>'char', 'name'=>'char');
+	foreach($parameters->CC as $item){
+		$row = explode('|', $item);
+		switch($row[0]){
+			case 'usr':
+				require_once('classes/model/Users.php');
+				$user = new Users();
+				
+				if($row[1] == '-1'){
+					$value = '(Current Task User)'; 
+				} else {
+					$rec = $user->load($row[1]);
+					$value = $rec['USR_FIRSTNAME'].' '.$rec['USR_LASTNAME'];
+				}
+			break;
+			
+			case 'grp':
+				G::LoadClass('groups');
+				$group = new Groups();
+				$rec = $group->load($row[1]);
+				
+				$value = strip_tags($rec->getGrpTitle());
+			break;
+			
+			case 'ext':
+				$value = htmlentities($row[1]); 
+			break;
+			
+			case 'dyn':
+				$value = htmlentities('@#'.$row[1]); 
+			break;
+		}
+		$paramCC[] = Array('id'=>replaceQuotes($item), 'name'=>$value);
+	}
+	
+	$_DBArray['eventomsgcc'] = $paramCC;
+	
+} else {
+	$_DBArray['eventomsgcc'] = Array();
+}
+
+if(isset($parameters->BCC)){
+	$paramBCC[] = Array('id'=>'char', 'name'=>'char');
+	foreach($parameters->BCC as $item){
+		$row = explode('|', $item);
+		switch($row[0]){
+			case 'usr':
+				require_once('classes/model/Users.php');
+				$user = new Users();
+				
+				if($row[1] == '-1'){
+					$value = '(Current Task User)'; 
+				} else {
+					$rec = $user->load($row[1]);
+					$value = $rec['USR_FIRSTNAME'].' '.$rec['USR_LASTNAME'];
+				}
+			break;
+			
+			case 'grp':
+				G::LoadClass('groups');
+				$group = new Groups();
+				$rec = $group->load($row[1]);
+				
+				$value = strip_tags($rec->getGrpTitle());
+			break;
+			
+			case 'ext':
+				$value = htmlentities($row[1]); 
+			break;
+			
+			case 'dyn':
+				$value = htmlentities('@#'.$row[1]); 
+			break;
+		}
+		$paramBCC[] = Array('id'=>replaceQuotes($item), 'name'=>$value);
+	}
+	
+	$_DBArray['eventomsgbcc'] = $paramBCC;
+	
+} else {
+	$_DBArray['eventomsgbcc'] = Array();
+}
+$aFields['EVN_MESSAGE_TO_TO']    = $paramTO;
+$aFields['EVN_MESSAGE_TO_CC']    = (isset($parameters->CC) ? $paramCC : '');
+$aFields['EVN_MESSAGE_TO_BCC']   = (isset($parameters->BCC) ? $paramBCC : '');
+$aFields['EVN_MESSAGE_TEMPLATE'] = (isset($parameters->TEMPLATE) ? $parameters->TEMPLATE : '');
+
+
+$aTemplates   = array();
+$aTemplates[] = array('TEMPLATE1' => 'char',
+      	              'TEMPLATE2' => 'char');
+$sDirectory = PATH_DATA_MAILTEMPLATES . $aFields['PRO_UID'] . PATH_SEP;
+G::verifyPath($sDirectory, true);
+if (!file_exists($sDirectory . 'alert_message.html')) {
+  @copy(PATH_TPL . 'mails' . PATH_SEP . 'alert_message.html', $sDirectory . 'alert_message.html');
+}
+$oDirectory   = dir($sDirectory);
+while ($sObject = $oDirectory->read()) {
+  if (($sObject !== '.') && ($sObject !== '..') && ($sObject !== 'alert_message.html')) {
+    $aTemplates[] = array('TEMPLATE1' => $sObject,
+      	                  'TEMPLATE2' => $sObject);
+  }
+}
+$_DBArray['templates'] = $aTemplates;
+
+$aTriggers[] = array('TRI_UID'   => 'char',
+      	             'TRI_TITLE' => 'char');
+G::LoadClass('processMap');
+$oProcessMap = new ProcessMap();
+$oDataset = TriggersPeer::doSelectRS($oProcessMap->getTriggersCriteria($aFields['PRO_UID']));
+$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
+$oDataset->next();
+while ($aRow = $oDataset->getRow()) {
+  $aTriggers[] = array('TRI_UID'   => $aRow['TRI_UID'],
+      	               'TRI_TITLE' => $aRow['TRI_TITLE']);
+  $oDataset->next();
+}
+$_DBArray['triggers'] = $aTriggers;
+
+$_SESSION['_DBArray'] = $_DBArray;
+
+$G_PUBLISH = new Publisher();
+$G_PUBLISH->AddContent('xmlform', 'xmlform', 'events/eventsEditAction', '', $aFields, '../events/eventsSave');
+//$G_PUBLISH->AddContent('xmlform', 'xmlform', 'events/eventsEditAction', '', $aFields, '../events/eventsSave');
+G::RenderPage('publish', 'raw');
+
+function replaceQuotes($aData){
+	return str_replace('"', '"e;', $aData);
+}
diff --git a/workflow/engine/methods/bpmn/eventsSave.php b/workflow/engine/methods/bpmn/eventsSave.php
new file mode 100755
index 000000000..62d1611c6
--- /dev/null
+++ b/workflow/engine/methods/bpmn/eventsSave.php
@@ -0,0 +1,56 @@
+.
+ *
+ * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
+ * Coral Gables, FL, 33134, USA, or email info@colosa.com.
+ *
+ */
+try {
+  $oJSON   = new Services_JSON();
+  if ( isset ($_POST['sData']) ) {
+	  $oData  = $oJSON->decode($_POST['sData']);
+  }
+
+  //Convert Object into Array
+  foreach($oData as $key=>$value)
+  {
+      $aData[$key] = $value;
+  }
+  
+  require_once 'classes/model/Event.php';
+
+  $oEvent = new Event();
+  if (!isset($aData['EVN_UID']) && $aData['EVN_UID'] == '' ) {
+     $sEventUid = $oEvent->create($aData);
+  }
+  else
+      $sEventUid = $oEvent->update($aData);
+
+
+
+  $_SESSION['EVN_UID'] = $sEventUid;
+  echo "{success: true,data:'.$sEventUid.'}";
+	//G::header('location: cases_Scheduler_List');
+}
+catch (Exception $oException) {
+	die($oException->getMessage());
+}
+
+?>
\ No newline at end of file
diff --git a/workflow/engine/methods/bpmn/get-tree.php b/workflow/engine/methods/bpmn/get-tree.php
new file mode 100755
index 000000000..37552e86e
--- /dev/null
+++ b/workflow/engine/methods/bpmn/get-tree.php
@@ -0,0 +1,170 @@
+getExtStepsCriteria($_GET['tid']);         //Getting all assigned steps on a task
+       array_shift($rows);
+   }
+
+ }
+  catch ( Exception $e ) {
+  	print json_encode ( $e->getMessage() );
+  }
+
+  $steps = array();
+
+  //@@stepsChildren is an array that stores before and after triggers tree data for a step
+  $stepsChildren = array();
+  $assignChildren = array();
+
+  //@@assignTaskChildren is an array that stores Before Assignment,Before Derivation and After Derivation triggers tree data for assigned task
+  $assignTaskChildren = array();
+
+  
+
+  //Creating steps array for populating tree depending on count of assigned steps to a task
+  for($i=0;$igetStepTriggersCriteria($rows[$i]['STEP_UID'], $_GET['tid'], 'BEFORE');
+       $beforeTriggersCount = StepTriggerPeer::doCount($beforeTriggers);
+
+       //Getting afterTriggersCount for a step
+       $afterTriggers  = $oProcessMap->getStepTriggersCriteria($rows[$i]['STEP_UID'], $_GET['tid'], 'AFTER');
+       $afterTriggersCount = StepTriggerPeer::doCount($afterTriggers);
+
+       $iTotal = $beforeTriggersCount + $afterTriggersCount;
+
+       //Tree level 3 nodes i.e. final nodes (Leaf Nodes)
+       $beforeTriggerChildren[0] = array(
+            'text'      => 'Assign / Show Before Triggers',
+            'id'        => $rows[$i]['STEP_UID'].'|BEFORE',
+            'leaf'      => true,
+          );
+       $afterTriggerChildren[0] = array(
+            'text'      => 'Assign / Show  After Triggers',
+            'id'        => $rows[$i]['STEP_UID'].'|AFTER',
+            'leaf'      => true,
+          );
+
+       //Tree level 2 nodes i.e. Before and After Triggers for level 1 nodes
+       $stepsChildren[0] = array(
+                'text'      => 'Before - Triggers ('.$beforeTriggersCount.')',
+                //'id'        => $rows[$i]['STEP_UID'].'-BEFORE',
+                'children'  => $beforeTriggerChildren
+              );
+       $stepsChildren[1] = array(
+                'text'      => 'After - Triggers ('.$afterTriggersCount.')',
+                //'id'        => $rows[$i]['STEP_UID'].'-AFTER',
+                'children'  => $afterTriggerChildren
+              );
+
+       //Tree level 1 nodes (Main steps)
+       $steps[] = array(
+                'text'      => $rows[$i]['STEP_TITLE'].' - Triggers ('.$iTotal.')',
+                //'id'        => 'ssaas',
+                'children'  => $stepsChildren
+              );
+  }
+
+  //Creating tree for Assign Task Step 
+  $beforeAssignmentChildren[] = array(
+            'text'      => 'Assign / Show Triggers',
+            'id'        => '-1|BEFORE',
+            'leaf'      => true,
+          );
+  $beforeDerivationChildren[] = array(
+            'text'      => 'Assign / Show Triggers',
+            'id'        => '-2|BEFORE',
+            'leaf'      => true,
+          );
+  $afterDerivationChildren[] = array(
+            'text'      => 'Assign / Show Triggers',
+            'id'        => '-2|AFTER',
+            'leaf'      => true,
+          );
+
+  //Getting counts for Before Assignment,Before Derivation and After Derivation triggers for a step
+  $beforeAssignmentTriggers      = $oProcessMap->getStepTriggersCriteria('-1', $_GET['tid'], 'BEFORE');
+  $beforeAssignmentTriggersCount = StepTriggerPeer::doCount($beforeAssignmentTriggers);
+
+  $beforeDerivationTriggers      = $oProcessMap->getStepTriggersCriteria('-2', $_GET['tid'], 'BEFORE');
+  $beforeDerivationTriggersCount = StepTriggerPeer::doCount($beforeDerivationTriggers);
+
+  $afterDerivationTriggers  = $oProcessMap->getStepTriggersCriteria('-2', $_GET['tid'], 'AFTER');
+  $afterDerivationTriggersCount = StepTriggerPeer::doCount($afterDerivationTriggers);
+
+  $iTotal = $beforeAssignmentTriggersCount + $beforeDerivationTriggersCount + $afterDerivationTriggersCount;
+  $assignTaskChildren[] = array(
+                'text'      => 'Before Assignment - Triggers ('.$beforeAssignmentTriggersCount.')',
+                'children'  => $beforeAssignmentChildren
+      );
+  $assignTaskChildren[] = array(
+                'text'      => 'Before Derivation - Triggers ('.$beforeDerivationTriggersCount.')',
+                'children'  => $beforeDerivationChildren
+  );
+  $assignTaskChildren[] = array(
+                'text'      => 'After Derivation - Triggers ('.$afterDerivationTriggersCount.')',
+                'children'  => $afterDerivationChildren
+  );
+
+  //Adding last value in an array for "Assign Task" 
+  $steps[] = array(
+                'text' => '[ Assign Task ] - Triggers ('.$iTotal.')',
+                //'id'   => $rows[$i]['STEP_UID'],
+                'children' => $assignTaskChildren
+  );
+
+/* $nodes = "[{
+    text: 'Step 1 - Triggers (0)',
+    cls:  'blank',
+    iconCls:  'blank',
+    children: [{
+        text: 'Before - Triggers (0)',
+        cls:  'blank',
+        iconCls:  'blank',
+        children: [{
+            text: 'Assign Before Trigger',
+            leaf: true,
+        }]
+    },{
+        text: 'After - Triggers (0)',
+        leaf: true,
+        cls:  'blank',
+        iconCls:  'blank',
+    }]
+},{
+    text: 'Step 2 - Triggers (0)',
+    
+    children: [{
+        text: 'Before - Triggers (0)',
+        leaf: true,
+        
+    },{
+        text: 'After - Triggers (0)',
+        leaf: true,
+        
+    }]
+},{
+    text: 'Assign Task - Triggers(0)',
+    
+    children: [{
+        text: 'Before Assigment - Triggers(0)',
+        leaf: true,
+        
+    },{
+        text: 'Before Derivation - Triggers(0)',
+        leaf: true,
+        
+    },{
+        text: 'After Derivation - Triggers(0)',
+        leaf: true,
+        
+    }]
+}]";*/
+//echo $nodes;
+echo json_encode($steps);
\ No newline at end of file
diff --git a/workflow/engine/methods/bpmn/openProcess.php b/workflow/engine/methods/bpmn/openProcess.php
new file mode 100755
index 000000000..f3e45c3a4
--- /dev/null
+++ b/workflow/engine/methods/bpmn/openProcess.php
@@ -0,0 +1,108 @@
+.
+ *
+ * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
+ * Coral Gables, FL, 33134, USA, or email info@colosa.com.
+ *
+ */
+ 
+  G::LoadClass('xpdl');
+  $processUID     = $_REQUEST['PRO_UID'];
+  $oProcess       = new Xpdl();
+  $fields         = $oProcess->serializeProcess($processUID);
+  $oData          = unserialize($fields);
+  $arrayTasks     = array();
+  $countTasks     = 0;
+  $countSubProcess= 0;
+  $arrayEvents    = array();
+  $arraySubProcess= array();
+  $count          = 0;
+  $countRoutes    = 0;
+  $arrayRoutes    = array();
+  $process        = array();
+  $process        = $oProcess->createProcessPM($oData->process);
+  foreach($oData->tasks as $id => $value)
+   {
+     if($value['TAS_TYPE'] == 'SUBPROCESS')
+     {
+       $arraySubProcess[$countSubProcess]['0'] = $value['TAS_UID'];
+       $arraySubProcess[$countSubProcess]['1'] = $value['TAS_TITLE'];
+       $arraySubProcess[$countSubProcess]['2'] = $value['TAS_POSX'];
+       $arraySubProcess[$countSubProcess]['3'] = $value['TAS_POSY'];
+       $countSubProcess = $countSubProcess + 1;
+     }
+     else
+     {
+       $arrayTasks[$countTasks]['0'] = $value['TAS_UID'];
+       $arrayTasks[$countTasks]['1'] = $value['TAS_TITLE'];
+       $arrayTasks[$countTasks]['2'] = $value['TAS_POSX'];
+       $arrayTasks[$countTasks]['3'] = $value['TAS_POSY'];
+       $arrayTasks[$countTasks]['4'] = $value['TAS_WIDTH'];
+       $arrayTasks[$countTasks]['5'] = $value['TAS_HEIGHT'];
+       $arrayTasks[$countTasks]['6'] = $value['TAS_BOUNDARY'];
+       if($value['TAS_START'] == 'TRUE'){
+         $arrayEvents[$count]['0']      = G::generateUniqueID();
+         if($value['TAS_EVN_UID'] == '')
+           {
+             $arrayEvents[$count]['1']      = 'bpmnEventEmptyStart';
+           }
+         else
+         {
+             foreach($oData->event as $eventid => $val){
+                 if($val['EVN_UID'] == $value['TAS_EVN_UID'])
+                 {
+                     $arrayEvents[$count]['0'] = $val['EVN_UID'];
+                     $arrayEvents[$count]['1'] = $val['EVN_TYPE'];
+                     break;
+                 }
+             }
+        }
+         $arrayEvents[$count]['2']      = $value['TAS_POSX']+68;
+         $arrayEvents[$count]['3']      = $value['TAS_POSY']-50;
+         $arrayRoutes[$countRoutes]['0']= G::generateUniqueID();
+         $arrayRoutes[$countRoutes]['1']= $arrayEvents[$count]['0'];
+         $arrayRoutes[$countRoutes]['2']= $value['TAS_UID'];
+         $arrayRoutes[$countRoutes]['3']= '1';
+         $arrayRoutes[$countRoutes]['4']= '2';
+         $count                         = $count+ 1;
+         $countRoutes                   = $countRoutes+ 1;
+     }
+     $countTasks = $countTasks + 1;
+    }
+   }
+   $lanes              = $oProcess->createLanesNewPM($oData->lanes);
+   $fields             = $oProcess->createTransitionsPM($oData->tasks,$oData->routes,$arrayEvents,$count,$arrayRoutes,$countRoutes);
+   //$subProcess         = $oProcess->createSubProcessesPM($oData->subProcess);
+   $arrayEvents        = $fields['EVENTS'];
+   $arrayGateways      = $fields['GATEWAYS'];
+   $arrayRoutes        = $fields['TRANSITION'];
+   $result['TASKS']    = $arrayTasks;
+   $result['ROUTES']   = $arrayRoutes;
+   $result['EVENTS']   = $arrayEvents;
+   $result['GATEWAYS'] = $arrayGateways;
+   $aTasks      = json_encode($arrayTasks);
+   $aSubProcess = json_encode($arraySubProcess);
+   $aRoutes     = json_encode($arrayRoutes);
+   $aEvents     = json_encode($arrayEvents);
+   $aGateways   = json_encode($arrayGateways);
+   $aProcess    = json_encode($process);
+   $aLanes      = json_encode($lanes);
+   echo "tasks:$aTasks|gateways:$aGateways|events:$aEvents|annotations:$aLanes|process:$aProcess|subprocess:$aSubProcess|routes:$aRoutes";
+?>
\ No newline at end of file
diff --git a/workflow/engine/methods/bpmn/patterns_Ajax.php b/workflow/engine/methods/bpmn/patterns_Ajax.php
new file mode 100755
index 000000000..84669c7d4
--- /dev/null
+++ b/workflow/engine/methods/bpmn/patterns_Ajax.php
@@ -0,0 +1,182 @@
+.
+ * 
+ * For more information, contact Colosa Inc, 2566 Le Jeune Rd., 
+ * Coral Gables, FL, 33134, USA, or email info@colosa.com.
+ * 
+ */
+G::LoadInclude('ajax');
+$oJSON   = new Services_JSON();
+if(isset($_POST['mode']) && $_POST['mode'] != '')
+{
+    $aData   = $_POST;
+    $aData['TASK']  = $oJSON->decode($_POST['TASK']);
+    $aData['ROU_NEXT_TASK']  = $oJSON->decode($_POST['ROU_NEXT_TASK']);
+}
+
+
+G::LoadClass('tasks');
+$oTasks = new Tasks();
+$rou_id = 0;
+switch ($aData['action']) {
+	case 'savePattern':
+	  //if ($aData['ROU_TYPE'] != $aData['ROU_TYPE_OLD'])
+	  //{
+             foreach ($aData['TASK'] as $iKey => $aRow)
+	  	  {
+                        $oTasks->deleteAllRoutesOfTask($aData['PROCESS'], $aRow);
+                  }
+	  //}
+	  require_once 'classes/model/Route.php';
+	  $oRoute = new Route();
+	  switch ($aData['ROU_TYPE']) {
+	  	case 'SEQUENTIAL':
+                case 'SEC-JOIN':
+        /*if ($aData['ROU_UID'] != '')
+        {
+	  	    $aFields['ROU_UID'] = $aData['ROU_UID'];
+	  	  }*/
+	  	  $aFields['PRO_UID']          = $aData['PROCESS'];
+	  	  $aFields['TAS_UID']          = $aData['TASK'][0];
+	  	  $aFields['ROU_NEXT_TASK']    = $aData['ROU_NEXT_TASK'][0];
+	  	  $aFields['ROU_TYPE']         = $aData['ROU_TYPE'];
+                  if(isset($aData['ROU_EVN_UID']))
+                    $aFields['ROU_EVN_UID']    = $aData['ROU_EVN_UID'];
+                  if(isset($aData['PORT_NUMBER_IP']))
+                    $aFields['ROU_TO_PORT']    = $aData['PORT_NUMBER_IP'];
+                  if(isset($aData['PORT_NUMBER_OP']))
+                    $aFields['ROU_FROM_PORT']  = $aData['PORT_NUMBER_OP'];
+	  	  //$aFields['ROU_TO_LAST_USER'] = $aData['ROU_TO_LAST_USER'];
+	  	  $rou_id = $oRoute->create($aFields);
+	  	break;
+	  	case 'SELECT':
+	  	  foreach ($aData['GRID_SELECT_TYPE'] as $iKey => $aRow)
+	  	  {
+	  	  	/*if ($aRow['ROU_UID'] != '')
+          {
+	  	      $aFields['ROU_UID'] = $aRow['ROU_UID'];
+	  	    }*/
+	  	    $aFields['PRO_UID']          = $aData['PROCESS'];
+	  	    $aFields['TAS_UID']          = $aData['TASK'];
+	  	    $aFields['ROU_NEXT_TASK']    = $aRow;
+	  	    $aFields['ROU_CASE']         = $iKey;
+	  	    $aFields['ROU_TYPE']         = $aData['ROU_TYPE'];
+                    if(isset($aData['PORT_NUMBER_IP']))
+                      $aFields['ROU_TO_PORT']      = $aData['PORT_NUMBER_IP'];
+                    if(isset($aData['PORT_NUMBER_OP']))
+                      $aFields['ROU_FROM_PORT']    = $aData['PORT_NUMBER_OP'];
+	  	  //  $aFields['ROU_CONDITION']    = $aRow['ROU_CONDITION'];
+	  	    //$aFields['ROU_TO_LAST_USER'] = $aRow['ROU_TO_LAST_USER'];
+	  	    $rou_id = $oRoute->create($aFields);
+	  	    unset($aFields);
+	  	  }
+	  	break;
+	  	case 'EVALUATE':
+	  	  foreach ($aData['ROU_NEXT_TASK'] as $iKey => $aRow)
+	  	  {
+	  	    $aFields['PRO_UID']          = $aData['PROCESS'];
+	  	    $aFields['TAS_UID']          = $aData['TASK'];
+	  	    $aFields['ROU_NEXT_TASK']    = $aRow;
+	  	    $aFields['ROU_CASE']         = $iKey;
+	  	    $aFields['ROU_TYPE']         = $aData['ROU_TYPE'];
+	  	    $aFields['ROU_CONDITION']    = $aRow['ROU_CONDITION'];
+                    if(isset($aData['PORT_NUMBER_IP']))
+                      $aFields['ROU_TO_PORT']    = $aData['PORT_NUMBER_IP'];
+                    if(isset($aData['PORT_NUMBER_OP']))
+                      $aFields['ROU_FROM_PORT']  = $aData['PORT_NUMBER_OP'];
+	  	    //$aFields['ROU_TO_LAST_USER'] = $aRow['ROU_TO_LAST_USER'];
+	  	    $rou_id = $oRoute->create($aFields);
+	  	    unset($aFields);
+	  	  }
+	  	break;
+	  	case 'PARALLEL':
+	  	  foreach ($aData['ROU_NEXT_TASK'] as $iKey => $aRow)
+	  	  {
+	  	  	/*if ($aRow['ROU_UID'] != '')
+          {
+	  	      $aFields['ROU_UID'] = $aRow['ROU_UID'];
+	  	    }*/
+	  	    $aFields['PRO_UID']       = $aData['PROCESS'];
+	  	    $aFields['TAS_UID']       = $aData['TASK'][0];
+	  	    $aFields['ROU_NEXT_TASK'] = $aRow;
+	  	    $aFields['ROU_CASE']      = $iKey;
+	  	    $aFields['ROU_TYPE']      = $aData['ROU_TYPE'];
+                    if(isset($aData['PORT_NUMBER_IP']))
+                      $aFields['ROU_TO_PORT'] = $aData['PORT_NUMBER_IP'];
+                    if(isset($aData['PORT_NUMBER_OP']))
+                      $aFields['ROU_FROM_PORT']= $aData['PORT_NUMBER_OP'];
+
+	  	    $rou_id = $oRoute->create($aFields);
+	  	    unset($aFields);
+	  	  }
+	  	break;
+	  	case 'PARALLEL-BY-EVALUATION':
+	  	  foreach ($aData['ROU_NEXT_TASK'] as $iKey => $aRow)
+	  	  {
+	  	  	/*if ($aRow['ROU_UID'] != '')
+          {
+	  	      $aFields['ROU_UID'] = $aRow['ROU_UID'];
+	  	    }*/
+
+	  	    $aFields['PRO_UID']       = $aData['PROCESS'];
+	  	    $aFields['TAS_UID']       = $aData['TASK'][0];
+	  	    $aFields['ROU_NEXT_TASK'] = $aRow;
+	  	    $aFields['ROU_CASE']      = $iKey;
+	  	    $aFields['ROU_TYPE']      = $aData['ROU_TYPE'];
+                    if(isset($aData['PORT_NUMBER_IP']))
+                      $aFields['ROU_TO_PORT']  = $aData['PORT_NUMBER_IP'];
+                    if(isset($aData['PORT_NUMBER_OP']))
+                      $aFields['ROU_FROM_PORT']= $aData['PORT_NUMBER_OP'];
+	  	 //   $aFields['ROU_CONDITION'] = $aRow['ROU_CONDITION'];
+                  //  $aFields['ROU_OPTIONAL'] =  $aRow['ROU_OPTIONAL'];
+                    $rou_id = $oRoute->create($aFields);
+	  	    unset($aFields);
+	  	  }
+	  	break;
+                case 'DISCRIMINATOR':  //Girish ->Added to save changes, while editing the route
+                  foreach ($aData['TASK'] as $iKey => $aRow)
+	  	  {
+	  	    $aFields['PRO_UID']       = $aData['PROCESS'];
+	  	    $aFields['TAS_UID']       = $aRow;
+	  	    $aFields['ROU_NEXT_TASK'] = $aData['ROU_NEXT_TASK'][0];
+	  	    $aFields['ROU_CASE']      = $iKey;
+	  	    $aFields['ROU_TYPE']      = $aData['ROU_TYPE'];
+                    if(isset($aData['PORT_NUMBER_IP']))
+                      $aFields['ROU_TO_PORT'] = $aData['PORT_NUMBER_IP'];
+                    if(isset($aData['PORT_NUMBER_OP']))
+                      $aFields['ROU_FROM_PORT'] = $aData['PORT_NUMBER_OP'];
+	  	   // $aFields['ROU_CONDITION'] = $aRow['ROU_CONDITION'];
+	  	   // $aFields['ROU_OPTIONAL'] =  $aRow['ROU_OPTIONAL'];
+                    $routeData = $oTasks->getRouteByType($aData['PROCESS'], $aData['ROU_NEXT_TASK'][0], $aData['ROU_TYPE']);
+                    foreach($routeData as $route)
+                    {
+                        $sFields['ROU_UID'] = $route['ROU_UID'];
+                      //  $sFields['ROU_CONDITION'] = $aRow['ROU_CONDITION'];
+                     //   $sFields['ROU_OPTIONAL'] =  $aRow['ROU_OPTIONAL'];
+                        $rou_id = $oRoute->update($sFields);
+                    }
+	  	    $rou_id =$oRoute->create($aFields);
+	  	    unset($aFields);
+	  	  }
+                  break;
+	  }
+          echo $rou_id;
+}
+?>
\ No newline at end of file
diff --git a/workflow/engine/methods/bpmn/processes_Ajax.php b/workflow/engine/methods/bpmn/processes_Ajax.php
new file mode 100755
index 000000000..c06d8cadd
--- /dev/null
+++ b/workflow/engine/methods/bpmn/processes_Ajax.php
@@ -0,0 +1,314 @@
+.
+ *
+ * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
+ * Coral Gables, FL, 33134, USA, or email info@colosa.com.
+ *
+ */
+G::LoadInclude('ajax');
+$oJSON   = new Services_JSON();
+  if ( isset ($_REQUEST['data']) ) {
+	  $oData   = $oJSON->decode(stripslashes($_REQUEST['data']));
+	  $sOutput = '';
+  }
+  else {
+  	if (!isset($_POST['form'])) {
+  	  $aData = urldecode_values($_POST);
+    }
+    else {
+    	$aData = urldecode_values($_POST['form']);
+    }
+  }
+  G::LoadClass('processMap');
+  $oProcessMap = new processMap(new DBConnection);
+  require_once 'classes/model/Task.php';
+  require_once 'classes/model/Event.php';
+  $oEvent = new Event();
+  $oTask = new Task();
+if ( isset ($_REQUEST['action']) ) {
+  switch($_REQUEST['action'])
+  {
+      case 'load':
+          $sOutput = $oProcessMap->load($oData->uid);
+          echo $sOutput;
+          break;
+      case 'addTask':
+  	  $sOutput = $oProcessMap->addTask($oData->uid, $oData->position->x, $oData->position->y);
+          echo $sOutput;
+          break;
+      case 'saveTaskPosition':
+  	  $sOutput = $oProcessMap->saveTaskPosition($oData->uid, $oData->position->x, $oData->position->y);
+          echo $sOutput;
+  	break;
+      case 'saveTaskCordinates':
+  	  $sOutput = $oProcessMap->saveTaskCordinates($oData->uid, $oData->position->x, $oData->position->y);
+          echo $sOutput;
+  	break;
+      case 'saveAnnotationCordinates':
+  	  $sOutput = $oProcessMap->saveAnnotationCordinates($oData->uid, $oData->position->x, $oData->position->y);
+          echo $sOutput;
+  	break;
+      case 'deleteTask':
+  	  $sOutput = $oProcessMap->deleteTask($oData->tas_uid);
+          echo $sOutput;
+  	break;
+      case 'updateTaskName':
+          $aTask['TAS_UID'] = $oData->uid;
+          $aTask['TAS_TITLE'] = $oData->label;
+          $oTask->update($aTask);
+       break;
+      case 'updateTask':
+          $aTask['TAS_UID'] = $oData->uid;
+          $aTask['TAS_BOUNDARY'] = $oData->boundary;
+          $oTask->update($aTask);
+          $sOutput = $oJSON->encode($oData);
+          echo $sOutput;
+       break;
+       case 'addSubProcess':
+  	  $sOutput = $oProcessMap->addSubProcess($oData->uid, $oData->position->x, $oData->position->y);
+          echo $sOutput;
+  	break;
+       case 'deleteSubProcess':
+  	  $sOutput = $oProcessMap->deleteSubProcess($oData->pro_uid, $oData->tas_uid);
+  	break;
+        case 'addText':
+  	  $sOutput = $oProcessMap->addText($oData->uid, $oData->label, $oData->position->x, $oData->position->y);
+          //echo $sOutput;
+  	break;
+        case 'updateText':
+          $sOutput = $oProcessMap->updateText($oData->uid, $oData->label);
+        echo $sOutput;
+        break;
+        case 'saveTextPosition':
+          $sOutput = $oProcessMap->saveTextPosition($oData->uid, $oData->position->x, $oData->position->y);
+        break;
+        case 'deleteText':
+          $sOutput = $oProcessMap->deleteText($oData->uid);
+          echo $sOutput;
+        break;
+      case 'getProcesses':
+  	  $sOutput = $oProcessMap->getAllProcesses();
+          echo $sOutput;
+          break;
+      case 'dynaforms':
+  	  $sOutput = $oProcessMap->getDynaformList($oData->uid);
+          $sOutput = $oJSON->encode($sOutput);
+          echo $sOutput;
+          break;
+      case 'webEntry_validate':
+  	  include(PATH_METHODS . 'processes/processes_webEntryValidate.php');
+  	  break;
+    case 'webEntry_generate':
+  	  include(PATH_METHODS . 'processes/processes_webEntryGenerate.php');
+          break;
+    case 'webEntry':
+  	  $sOutput = $oProcessMap->listNewWebEntry($oData->uid,$oData->evn_uid);
+          echo $sOutput;
+  	break;
+    case 'loadTask':
+  	  $oOutput = $oTask->load($oData->uid);
+          $sOutput = $oJSON->encode($oOutput);
+          echo $sOutput;
+          break;
+
+   case 'saveInterMessageEvent':
+          $aData['TAS_UID'] = $oData->uid;
+          $aData['TAS_SEND_LAST_EMAIL'] = strtoupper($oData->tas_send);
+          $aData['TAS_DEF_MESSAGE'] = $oData->data;
+          if(isset($aData['TAS_SEND_LAST_EMAIL']) && $aData['TAS_SEND_LAST_EMAIL'] == 'FALSE')
+          {
+             $aData['TAS_DEF_MESSAGE'] = '';
+          }
+          else
+          {
+             $aData['TAS_DEF_MESSAGE'] = str_replace('@amp@', '&', $aData['TAS_DEF_MESSAGE']);
+          }
+  	  $sOutput = $oTask->update($aData);
+          echo $sOutput;
+          break;
+      case 'triggersList':
+  	  $sOutput = $oProcessMap->getTriggers($oData->pro_uid);
+          $sOutput = $oJSON->encode($sOutput);
+          echo $sOutput;
+          break;
+      case 'process_Edit':
+  	  $sOutput = $oProcessMap->editProcessNew($oData->pro_uid);
+          $sOutput = $oJSON->encode($sOutput);
+          echo $sOutput;
+          break;
+      case 'loadCategory':
+  	  $sOutput = $oProcessMap->loadProcessCategory();
+          $sOutput = $oJSON->encode($sOutput);
+          echo $sOutput;
+          break;
+      case 'saveProcess':
+          $aData['PRO_UID']  = $oData->PRO_UID;
+          $aData['PRO_CALENDAR']  = $oData->PRO_CALENDAR;
+          $aData['PRO_CATEGORY']  = $oData->PRO_CATEGORY;
+          $aData['PRO_DEBUG']  = $oData->PRO_DEBUG;
+          $aData['PRO_DESCRIPTION']  = $oData->PRO_DESCRIPTION;
+          $aData['PRO_TITLE']  = $oData->PRO_TITLE;
+          $sOutput = $oProcessMap->updateProcess($aData);
+          echo $sOutput;
+          break;
+      case 'saveStartEvent':
+          $aData['TAS_UID']  = $oData->tas_uid;
+          $aData['TAS_START']  = $oData->tas_start;
+          $aData['TAS_EVN_UID']  = '';
+          $oTask->update($aData);
+          break;
+      case 'updateEvent':
+          $aData['EVN_UID']  = $oData->evn_uid;
+          $aData['EVN_TYPE']  = $oData->evn_type;
+          $oEvent = EventPeer::retrieveByPK($aData['EVN_UID']);
+          if (!is_null($oEvent))
+              $oEvent->update($aData);
+          break;
+      case 'addEvent':
+          $aData['PRO_UID']  = $oData->uid;
+          $aData['EVN_TYPE']  = $oData->tas_type;
+          $aData['EVN_STATUS'] = 'ACTIVE';
+          $aData['EVN_WHEN'] = '1';
+          $aData['EVN_ACTION'] = '';
+
+          if(preg_match("/Inter/", $oData->tas_type))
+          {
+            $aData['EVN_RELATED_TO'] = 'MULTIPLE';
+            $aData['EVN_TAS_UID_FROM'] = $oData->tas_from;
+            $aData['EVN_TAS_UID_TO'] = $oData->tas_to;
+            $sOutput =  $oEvent->create($aData);
+            echo $sOutput;
+          }
+          //Code for Start Events only
+          if(preg_match("/Start/", $oData->tas_type))
+          {
+               $aData['EVN_RELATED_TO'] = 'SINGLE';
+               $aTask['TAS_UID'] = $oData->tas_uid;
+               $oTaskData = $oTask->load($aTask['TAS_UID']);
+              if($oTaskData['TAS_EVN_UID'] == '')
+              {
+                 $sOutput =  $oEvent->create($aData);
+              }
+              else
+              {
+                   $aData['EVN_UID'] = $oTaskData['TAS_EVN_UID'];
+                   $oEvn_uid = $aData['EVN_UID'];
+                   $oEvent->update($aData);
+              }
+
+              $aTask['TAS_UID'] = $oData->tas_uid;
+              $aTask['TAS_EVN_UID'] = $oEvn_uid;
+              $aTask['TAS_START'] = 'TRUE';
+              $oTask->update($aTask);
+          }
+
+          break;
+          case 'deleteRoute':
+              require_once 'classes/model/Route.php';
+              $oRoute = new Route();
+              $sOutput = $oRoute->remove($oData->uid);
+              echo $sOutput;
+              break;
+          case 'deleteEvent':
+             
+              $sOutput = $oEvent->remove($oData->uid);
+              echo $sOutput;
+              break;
+          case 'assign':
+  	  G::LoadClass('tasks');
+  	  $oTasks = new Tasks();
+  	  switch ($oData->TU_RELATION) {
+  	  	case 1:
+  	  	  echo $oTasks->assignUser($oData->TAS_UID, $oData->USR_UID, $oData->TU_TYPE);
+  	  	break;
+  	  	case 2:
+  	  	  echo $oTasks->assignGroup($oData->TAS_UID, $oData->USR_UID, $oData->TU_TYPE);
+  	  	break;
+  	  }
+          break;
+          case 'ofToAssign':
+          G::LoadClass('tasks');
+  	  $oTasks = new Tasks();
+  	  switch ($oData->TU_RELATION) {
+  	  	case 1:
+  	  	  echo $oTasks->ofToAssignUser($oData->TAS_UID, $oData->USR_UID, $oData->TU_TYPE);
+  	  	break;
+  	  	case 2:
+  	  	  echo $oTasks->ofToAssignGroup($oData->TAS_UID, $oData->USR_UID, $oData->TU_TYPE);
+  	  	break;
+  	  }
+  	break;
+
+        case 'saveSubProcessDetails':
+            //$aTask=$oTask->load($_POST['form']['TASKS']);
+            //$aTask=$oTask->load($_POST['form']['PRO_UID']);
+            if($_POST['VAR_OUT1'] != '')
+            {
+               $out = array();
+               $out[$_POST['VAR_OUT1']] = $_POST['VAR_OUT2'];
+            }
+
+            if($_POST['VAR_IN1'] != '')
+            {
+               $in = array();
+               $in[$_POST['VAR_IN1']]   =  $_POST['VAR_IN2'];
+            }
+            
+            $aTask=($_POST['TASKS']!=0)?$oTask->load($_POST['TASKS']):0;
+            //$aTask['PRO_UID']=0;
+
+            if ( isset ( $_POST['SP_SYNCHRONOUS']) && $_POST['SP_SYNCHRONOUS'] == '' ) {
+                    $_POST['SP_SYNCHRONOUS'] = '0';
+            }
+
+            if ( !isset ( $_POST['form']['SP_SYNCHRONOUS']) ) {
+                    $_POST['SP_SYNCHRONOUS'] = '0';
+            }
+
+            require_once 'classes/model/SubProcess.php';
+            $oOP = new SubProcess();
+            $aData = array('SP_UID'          	 => $_POST['SP_UID'],//G::generateUniqueID(),
+                           'PRO_UID'         	 => $aTask['PRO_UID'],
+                           'TAS_UID'         	 => $_POST['TASKS'],
+                           'PRO_PARENT'      	 => $_POST['PRO_PARENT'],
+                           'TAS_PARENT'		 => $_POST['TAS_PARENT'],
+                           'SP_TYPE'   		 => 'SIMPLE',
+                           'SP_SYNCHRONOUS'   	 => $_POST['SP_SYNCHRONOUS'],
+                           'SP_SYNCHRONOUS_TYPE' => 'ALL',
+                           'SP_SYNCHRONOUS_WAIT' => 0,
+                           'SP_VARIABLES_OUT'    => serialize($out),
+                           'SP_VARIABLES_IN'     => serialize($in),
+                           'SP_GRID_IN'          => '');
+
+
+            $oOP->update($aData);
+            break;
+
+            case 'subprocessProperties':
+                require_once 'classes/model/Content.php';
+                $lang = defined ( 'SYS_LANG') ? SYS_LANG : 'en';
+                //$cont = Content::addContent( 'SP_TITLE', '', $_POST['form']['SP_UID'], $lang, $_POST['form']['SPROCESS_NAME'] );
+                $cont = Content::addContent( 'TAS_TITLE', '', $_POST['TAS_PARENT'], $lang, $_POST['SPROCESS_NAME'] );
+            break;
+
+      }
+}
+
+?>
diff --git a/workflow/engine/methods/bpmn/processes_doUpload.php b/workflow/engine/methods/bpmn/processes_doUpload.php
new file mode 100755
index 000000000..4874c9642
--- /dev/null
+++ b/workflow/engine/methods/bpmn/processes_doUpload.php
@@ -0,0 +1,179 @@
+ $multiplier*(int)$POST_MAX_SIZE && $POST_MAX_SIZE) {
+		//header("HTTP/1.1 500 Internal Server Error"); // This will trigger an uploadError event in SWFUpload
+		//echo "POST exceeded maximum allowed size.";
+		HandleError('POST exceeded maximum allowed size.');
+	}
+
+// Other variables
+	$file_name = '';
+	$file_extension = '';
+	$uploadErrors = array(
+        0=>'There is no error, the file uploaded with success',
+        1=>'The uploaded file exceeds the upload_max_filesize directive in php.ini',
+        2=>'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form',
+        3=>'The uploaded file was only partially uploaded',
+        4=>'No file was uploaded',
+        6=>'Missing a temporary folder'
+	);
+
+// Validate the upload
+	if (!isset($_FILES[$upload_name])) {
+		HandleError('No upload found in \$_FILES for ' . $upload_name);
+	} else if (isset($_FILES[$upload_name]["error"]) && $_FILES[$upload_name]["error"] != 0) {
+		HandleError($uploadErrors[$_FILES[$upload_name]["error"]]);
+	} else if (!isset($_FILES[$upload_name]["tmp_name"]) || !@is_uploaded_file($_FILES[$upload_name]["tmp_name"])) {
+		HandleError('Upload failed is_uploaded_file test.');
+	} else if (!isset($_FILES[$upload_name]['name'])) {
+		HandleError('File has no name.');
+	}
+
+// Validate the file size (Warning: the largest files supported by this code is 2GB)
+	$file_size = @filesize($_FILES[$upload_name]["tmp_name"]);
+	if (!$file_size || $file_size > $max_file_size_in_bytes) {
+		HandleError('File exceeds the maximum allowed size');
+	}
+
+	if ($file_size <= 0) {
+		HandleError('File size outside allowed lower bound');
+	}
+
+// Validate file name (for our purposes we'll just remove invalid characters)
+	$file_name = preg_replace('/[^'.$valid_chars_regex.']|\.+$/i', "", basename($_FILES[$upload_name]['name']));
+	if (strlen($file_name) == 0 || strlen($file_name) > $MAX_FILENAME_LENGTH) {
+		HandleError('Invalid file name');
+	}
+
+// Validate that we won't over-write an existing file
+	if (file_exists($save_path . $file_name)) {
+		HandleError('A file with this name already exists');
+	}
+
+/*
+// Validate file extension
+	$path_info = pathinfo($_FILES[$upload_name]['name']);
+	$file_extension = $path_info["extension"];
+	$is_valid_extension = false;
+	foreach ($extension_whitelist as $extension) {
+		if (strcasecmp($file_extension, $extension) == 0) {
+			$is_valid_extension = true;
+			break;
+		}
+	}
+	if (!$is_valid_extension) {
+		HandleError("Invalid file extension");
+		exit(0);
+	}
+*/
+// Validate file contents (extension and mime-type can't be trusted)
+	/*
+		Validating the file contents is OS and web server configuration dependant.  Also, it may not be reliable.
+		See the comments on this page: http://us2.php.net/fileinfo
+
+		Also see http://72.14.253.104/search?q=cache:3YGZfcnKDrYJ:www.scanit.be/uploads/php-file-upload.pdf+php+file+command&hl=en&ct=clnk&cd=8&gl=us&client=firefox-a
+		 which describes how a PHP script can be embedded within a GIF image file.
+
+		Therefore, no sample code will be provided here.  Research the issue, decide how much security is
+		 needed, and implement a solution that meets the needs.
+	*/
+
+
+// Process the file
+	/*
+		At this point we are ready to process the valid file. This sample code shows how to save the file. Other tasks
+		 could be done such as creating an entry in a database or generating a thumbnail.
+
+		Depending on your server OS and needs you may need to set the Security Permissions on the file after it has
+		been saved.
+	*/
+	if (!@move_uploaded_file($_FILES[$upload_name]["tmp_name"], $save_path.$file_name)) {
+		HandleError("File could not be saved.");
+	}
+
+	die('{"success":true}');
+
+/* Handles the error output. This error message will be sent to the uploadSuccess event handler.  The event handler
+will have to check for any error messages and react as needed. */
+function HandleError($message) {
+	die('{success:false,error:'.json_encode($message).'}');
+}
+?>
\ No newline at end of file
diff --git a/workflow/engine/methods/bpmn/processmap.php b/workflow/engine/methods/bpmn/processmap.php
new file mode 100755
index 000000000..4881b2883
--- /dev/null
+++ b/workflow/engine/methods/bpmn/processmap.php
@@ -0,0 +1,67 @@
+setExtSkin( 'xtheme-gray');
+  $oHeadPublisher->usingExtJs('ux/RowEditor');
+  $oHeadPublisher->addExtJsScript('bpmn/bpmnZoom',true);
+  $oHeadPublisher->addExtJsScript('bpmn/MyWorkflow',true );    //adding a javascript file .js
+  $oHeadPublisher->addExtJsScript('bpmn/pmosExt', true );    //adding a javascript file .js
+  $oHeadPublisher->addExtJsScript('bpmn/TaskContext', true );    //adding a javascript file .js
+  $oHeadPublisher->addExtJsScript('bpmn/ProcessMapContext', true );    //adding a javascript file .js
+  $oHeadPublisher->addExtJsScript('bpmn/processmap', true );    //adding a javascript file .js
+  $oHeadPublisher->addExtJsScript('bpmn/Annotation' );
+  $oHeadPublisher->addExtJsScript('bpmn/FlowConnector');
+  $oHeadPublisher->addExtJsScript('bpmn/GroupFigure');
+  $oHeadPublisher->addExtJsScript('bpmn/bpmnShapes', true); //
+  $oHeadPublisher->addExtJsScript('bpmn/LoopingSubProcess'); //
+  $oHeadPublisher->addExtJsScript('bpmn/LoopingTask'); //
+  $oHeadPublisher->addExtJsScript('bpmn/Dataobject'); //
+  $oHeadPublisher->addExtJsScript('bpmn/Pool',true);
+  $oHeadPublisher->addExtJsScript('bpmn/Lane');
+    
+  $oHeadPublisher->addExtJsScript('bpmn/EventEmptyStart');
+  $oHeadPublisher->addExtJsScript('bpmn/EventMessageStart');
+  $oHeadPublisher->addExtJsScript('bpmn/EventRuleStart');
+  $oHeadPublisher->addExtJsScript('bpmn/EventTimerStart');
+  $oHeadPublisher->addExtJsScript('bpmn/EventSignalStart');
+  $oHeadPublisher->addExtJsScript('bpmn/EventMulStart');
+  $oHeadPublisher->addExtJsScript('bpmn/EventLinkStart');
+  $oHeadPublisher->addExtJsScript('bpmn/EventEmptyInter');
+  $oHeadPublisher->addExtJsScript('bpmn/EventMessageRecInter');
+  $oHeadPublisher->addExtJsScript('bpmn/EventMessageSendInter');
+  $oHeadPublisher->addExtJsScript('bpmn/EventTimerInter');
+  $oHeadPublisher->addExtJsScript('bpmn/EventBoundaryTimerInter');
+  $oHeadPublisher->addExtJsScript('bpmn/EventErrorInter');
+  $oHeadPublisher->addExtJsScript('bpmn/EventCompInter');
+  $oHeadPublisher->addExtJsScript('bpmn/EventRuleInter');
+  $oHeadPublisher->addExtJsScript('bpmn/EventCancelInter');
+  $oHeadPublisher->addExtJsScript('bpmn/EventInterSignal');
+  $oHeadPublisher->addExtJsScript('bpmn/EventMultipleInter');
+  $oHeadPublisher->addExtJsScript('bpmn/EventLinkInter');
+  $oHeadPublisher->addExtJsScript('bpmn/EventEmptyEnd');
+  $oHeadPublisher->addExtJsScript('bpmn/EventMessageEnd');
+  $oHeadPublisher->addExtJsScript('bpmn/EventErrorEnd');
+  $oHeadPublisher->addExtJsScript('bpmn/EventCompEnd');
+  $oHeadPublisher->addExtJsScript('bpmn/EventTerminateEnd');
+  $oHeadPublisher->addExtJsScript('bpmn/EventEndSignal');
+  $oHeadPublisher->addExtJsScript('bpmn/EventMultipleEnd');
+  $oHeadPublisher->addExtJsScript('bpmn/EventCancelEnd');
+  $oHeadPublisher->addExtJsScript('bpmn/EventLinkEnd');
+
+  $oHeadPublisher->addExtJsScript('bpmn/GatewayInclusive' );
+  $oHeadPublisher->addExtJsScript('bpmn/GatewayExclusiveData' );
+  $oHeadPublisher->addExtJsScript('bpmn/GatewayExclusiveEvent' );
+  $oHeadPublisher->addExtJsScript('bpmn/GatewayParallel' );
+  $oHeadPublisher->addExtJsScript('bpmn/GatewayComplex' );
+  $oHeadPublisher->addExtJsScript('bpmn/GridPanel');
+  $oHeadPublisher->addExtJsScript('bpmn/SubProcess' );
+  $oHeadPublisher->addExtJsScript('bpmn/AwesomeUploader' );
+  $oHeadPublisher->addExtJsScript('bpmn/Ext.ux.form.FileUploadField' );
+  $oHeadPublisher->addExtJsScript('bpmn/Ext.ux.XHRUpload' );
+  $oHeadPublisher->addExtJsScript('bpmn/swfupload' );
+  $oHeadPublisher->addExtJsScript('bpmn/swfupload.swfobject' );
+  $oHeadPublisher->addExtJsScript('bpmn/ProcessOptions',true);
+
+  $oHeadPublisher->addContent( 'bpmn/processmap'); //adding a html file  .html.
+  G::RenderPage('publish', 'extJs');
+ 
diff --git a/workflow/engine/methods/bpmn/proxyCaseSchLoad.php b/workflow/engine/methods/bpmn/proxyCaseSchLoad.php
new file mode 100755
index 000000000..6d74ec047
--- /dev/null
+++ b/workflow/engine/methods/bpmn/proxyCaseSchLoad.php
@@ -0,0 +1,67 @@
+load($_GET['eid']);
+       $sch_uid = $oData['EVN_ACTION'];
+
+       if($sch_uid != '')
+       {
+           $rows   = $oProcessMap->caseNewSchedulerList($sch_uid);
+           if($rows['SCH_OPTION'] == '3')
+           {
+               $sch_start_day = explode('|',$rows['SCH_START_DAY']);
+               $count = count($sch_start_day);
+               switch($count){
+                   case 1:
+                       $rows['SCH_START_DAY'] = $sch_start_day[0];
+                   break;
+                   case 2:
+                       $rows['SCH_START_DAY'] = $sch_start_day[0];
+                       $rows['SCH_START_DAY_OPT_2_WEEKS'] = $sch_start_day[1];
+                   break;
+                   case 3:
+                       $rows['SCH_START_DAY'] = $sch_start_day[0];
+                       $rows['SCH_START_DAY_OPT_2_WEEKS'] = $sch_start_day[1];
+                       $rows['SCH_START_DAY_OPT_2_DAYS_WEEK'] = $sch_start_day[2];
+                       break;
+               }
+
+           }
+
+           if($rows['SCH_START_DATE'] != '')
+           {
+               $sch_str_dt = explode(' ',$rows['SCH_START_DATE']);
+               $rows['SCH_START_DATE'] = $sch_str_dt[0];
+           }
+           if($rows['SCH_END_DATE'] != '')
+           {
+               $sch_str_dt = explode(' ',$rows['SCH_END_DATE']);
+               $rows['SCH_END_DATE'] = $sch_str_dt[0];
+           }
+
+
+           $result = json_encode( $rows ) ;
+           $result = str_replace("\\/","/",'{success:true,data:'.$result.'}'); // unescape the slashes
+       }
+       else
+       {
+           $result = '{failure:true}'; // unescape the slashes
+       }
+       echo $result;
+   }
+   
+   //print json_encode( $result ) ;
+
+ }
+  catch ( Exception $e ) {
+  	print json_encode ( $e->getMessage() );
+  }
+
+?>
diff --git a/workflow/engine/methods/bpmn/proxyDynaform.php b/workflow/engine/methods/bpmn/proxyDynaform.php
new file mode 100755
index 000000000..dada574b0
--- /dev/null
+++ b/workflow/engine/methods/bpmn/proxyDynaform.php
@@ -0,0 +1,39 @@
+getExtDynaformsList($_GET['pid']);
+       array_shift($rows);
+   }
+   else if(isset($_GET['tabId'])){
+      $oAdditionalTables = new AdditionalTables();
+      $aData = $oAdditionalTables->load($_GET['tabId'], true);
+      $addTabName = $aData['ADD_TAB_NAME'];
+
+      foreach ($aData['FIELDS'] as $iRow => $aRow) {
+            if ($aRow['FLD_KEY'] == 1) {
+                $rows[] = $aRow;
+            }
+        }
+     //echo json_encode( $rows ) ;
+     //die;
+   }
+   //Getting Additional PM tables list created by user for combobox
+   else
+   {
+       //Getting Dynaform List
+       $rows        = $oProcessMap->getExtAdditionalTablesList();
+   }
+  
+   $result['totalCount'] = count($rows);
+   $result['data'] = $rows;
+   print json_encode( $result ) ;
+ 
+ }
+  catch ( Exception $e ) {
+  	print json_encode ( $e->getMessage() );
+  }
diff --git a/workflow/engine/methods/bpmn/proxyEventsLoad.php b/workflow/engine/methods/bpmn/proxyEventsLoad.php
new file mode 100755
index 000000000..beb4a065c
--- /dev/null
+++ b/workflow/engine/methods/bpmn/proxyEventsLoad.php
@@ -0,0 +1,27 @@
+load($_GET['startInterId']);
+     //$sch_uid = $oData['EVN_ACTION'];
+     $result = json_encode( $aRows );
+     $result = str_replace("\\/","/",'{success:true,data:'.$result.'}'); // unescape the slashes
+     /*else
+     {
+           $result = '{failure:true}'; // unescape the slashes
+     }*/
+     echo $result;
+   }
+   //print json_encode( $result ) ;
+ }
+  catch ( Exception $e ) {
+  	print json_encode ( $e->getMessage() );
+  }
+
+?>
diff --git a/workflow/engine/methods/bpmn/proxyProcesses_Export.php b/workflow/engine/methods/bpmn/proxyProcesses_Export.php
new file mode 100755
index 000000000..3f5ff07b3
--- /dev/null
+++ b/workflow/engine/methods/bpmn/proxyProcesses_Export.php
@@ -0,0 +1,64 @@
+.
+ *
+ * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
+ * Coral Gables, FL, 33134, USA, or email info@colosa.com.
+ *
+ */
+
+G::LoadThirdParty('pear/json','class.json');
+
+try {
+
+  if ( isset($_GET['pro_uid']))
+    $sProUid = $_GET['pro_uid'];
+  else
+    throw ( new Exception ( 'the process uid is not defined!.' ) );
+
+/* Includes */
+G::LoadClass('processes');
+G::LoadClass('xpdl');
+$oProcess  = new Processes();
+$oXpdl     = new Xpdl();
+$proFields = $oProcess->serializeProcess( $sProUid );
+$Fields = $oProcess->saveSerializedProcess ( $proFields );
+$xpdlFields = $oXpdl->xmdlProcess($sProUid);
+$Fields['FILENAMEXPDL'] = $xpdlFields['FILENAMEXPDL'];
+$Fields['FILENAME_LINKXPDL'] = $xpdlFields['FILENAME_LINKXPDL'];
+
+ if (G::is_https ())
+    $http = 'https://';
+  else
+    $http = 'http://';
+
+$Fields['FILENAME_LINK']     = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/processes/' . $Fields['FILENAME_LINK'];
+$Fields['FILENAME_LINKXPDL'] = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/processes/' . $Fields['FILENAME_LINKXPDL'];
+
+$result = json_encode( $Fields );
+$result = str_replace("\\/","/",'{success:true,data:'.$result.'}'); // unescape the slashes
+echo $result;
+
+}
+catch ( Exception $e ){
+  $G_PUBLISH = new Publisher;
+	$aMessage['MESSAGE'] = $e->getMessage();
+  $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
+  G::RenderPage('publish', 'raw' );
+}
diff --git a/workflow/engine/methods/bpmn/proxyStepTriggers.php b/workflow/engine/methods/bpmn/proxyStepTriggers.php
new file mode 100755
index 000000000..2fe1ddca4
--- /dev/null
+++ b/workflow/engine/methods/bpmn/proxyStepTriggers.php
@@ -0,0 +1,40 @@
+getExtAvailableStepTriggersCriteria($_GET['pid'], $sStep, $_GET['tid'], $sType);
+   }
+   else
+   {
+       //Getting all Steps Criteria that have been selected for a particular task
+       $rows        = $oProcessMap->getExtStepTriggersCriteria($sStep, $_GET['tid'], $sType);
+   }
+
+   $result['totalCount'] = count($rows);
+   $result['data'] = $rows;
+   print json_encode( $result ) ;
+
+ }
+ catch ( Exception $e ) {
+  	print json_encode ( $e->getMessage() );
+  }
+
+?>
diff --git a/workflow/engine/methods/bpmn/proxySubProcessProperties.php b/workflow/engine/methods/bpmn/proxySubProcessProperties.php
new file mode 100755
index 000000000..95ba956f1
--- /dev/null
+++ b/workflow/engine/methods/bpmn/proxySubProcessProperties.php
@@ -0,0 +1,31 @@
+subProcessExtProperties($_GET['pid'], $_GET['tid'],'','0');
+       $tmpData = json_encode( $rows ) ;
+       $tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
+
+       $result = $tmpData;
+       print $result;
+   }
+   else
+   {
+       $rows        = $oProcessMap->subProcessExtProperties($_GET['pid'], $_GET['tid'],'',$_GET['type']);
+       $result['totalCount'] = count($rows);
+       $result['data'] = $rows;
+       print json_encode( $result ) ;
+   }
+
+ }
+  catch ( Exception $e ) {
+  	print json_encode ( $e->getMessage() );
+  }
+
+?>
diff --git a/workflow/engine/methods/bpmn/proxyTaskPropertiesDetails.php b/workflow/engine/methods/bpmn/proxyTaskPropertiesDetails.php
new file mode 100755
index 000000000..936067246
--- /dev/null
+++ b/workflow/engine/methods/bpmn/proxyTaskPropertiesDetails.php
@@ -0,0 +1,64 @@
+load($_GET['tid']);
+
+    while (list($key, $value) = each($rows)) {
+        
+        if ($value == 'TRUE')
+            $rows[$key] = true;
+        else if($value == 'FALSE')
+            $rows[$key] = false;
+        
+        if($key == 'TAS_TYPE_DAY' && $value == '1')
+            $rows[$key] = 'Work Days';
+        else if($key == 'TAS_TYPE_DAY' && $value == '2')
+            $rows[$key] = 'Calendar Days';
+
+        if($key == 'TAS_ASSIGN_TYPE')
+        {
+            switch($value)
+            {
+                case 'SELF_SERVICE':
+                   $rows[$value] = 'true';
+                break;
+                case 'REPORT_TO':
+                   $rows[$value] = 'true';
+                break;
+                case 'BALANCED':
+                    $rows[$value] = 'true';
+                break;
+                case 'MANUAL':
+                    $rows[$value] = 'true';
+                break;
+                case 'EVALUATE':
+                    $rows[$value] = 'true';
+                    $rows['hideEvaluateField']    = 'false';
+                break;
+                case 'STATIC_MI':
+                    $rows[$value] = 'true';
+                    $rows['hidePartialJoinField'] = 'false';
+                break;
+                case 'CANCEL_MI':
+                    $rows[$value] = 'true';
+                    $rows['hidePartialJoinField'] = 'false';
+                break;
+            }
+        }    
+    }
+
+    $tmpData = json_encode( $rows ) ;
+    $tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes
+
+    $result = $tmpData;
+    echo $result;
+
+ }
+
+catch ( Exception $e ) {
+  	print json_encode ( $e->getMessage() );
+  }
+
+?>
diff --git a/workflow/engine/methods/bpmn/proxyTaskSteps.php b/workflow/engine/methods/bpmn/proxyTaskSteps.php
new file mode 100755
index 000000000..52708757f
--- /dev/null
+++ b/workflow/engine/methods/bpmn/proxyTaskSteps.php
@@ -0,0 +1,28 @@
+getExtAvailableBBCriteria($_GET['pid'], $_GET['tid']);
+       array_shift($rows);
+   }
+   else
+   {
+       //Getting all Steps Criteria that have been selected for a particular task
+       $rows        = $oProcessMap->getExtStepsCriteria($_GET['tid']);
+       array_shift($rows);
+   }
+
+   $result['totalCount'] = count($rows);
+    $result['data'] = $rows;
+    print json_encode( $result ) ;
+
+ }
+  catch ( Exception $e ) {
+  	print json_encode ( $e->getMessage() );
+  }
+
+?>
diff --git a/workflow/engine/methods/bpmn/proxyUsersList.php b/workflow/engine/methods/bpmn/proxyUsersList.php
new file mode 100755
index 000000000..c5946aa06
--- /dev/null
+++ b/workflow/engine/methods/bpmn/proxyUsersList.php
@@ -0,0 +1,52 @@
+usersExtList($_GET['pid'], $_GET['tid']);
+       array_shift($rows);
+   }
+   else
+   {
+       $rows        = $oProcessMap->getAvailableExtUsersCriteria($_GET['tid']);
+   }
+  /*else
+   {
+    require_once 'classes/model/Users.php';
+    $oCriteria = new Criteria('workflow');
+    $oCriteria->addSelectColumn(UsersPeer::USR_UID);
+
+    $sDataBase = 'database_' . strtolower(DB_ADAPTER);
+    if(G::LoadSystemExist($sDataBase)){
+      G::LoadSystem($sDataBase);
+      $oDataBase = new database();
+      $oCriteria->addAsColumn('USR_COMPLETENAME', $oDataBase->concatString("USR_LASTNAME", "' '", "USR_FIRSTNAME"));
+    }
+
+    $oCriteria->addSelectColumn(UsersPeer::USR_USERNAME);
+
+    $oDataset = UsersPeer::doSelectRS($oCriteria);
+    $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
+    $oDataset->next();
+
+    $result = array();
+    $rows = array();
+    $index =  isset($start) ? $start : 0;
+    while($aRow = $oDataset->getRow()){
+      $aRow['index'] = ++$index;
+      $rows[] = $aRow;
+
+      $oDataset->next();
+    }
+   }
+   */
+    $result['totalCount'] = count($rows);
+    $result['data'] = $rows;
+    print json_encode( $result ) ;
+ 
+ }
+  catch ( Exception $e ) {
+  	print json_encode ( $e->getMessage() );
+  }
diff --git a/workflow/engine/methods/bpmn/saveProcess.php b/workflow/engine/methods/bpmn/saveProcess.php
new file mode 100755
index 000000000..a640bd868
--- /dev/null
+++ b/workflow/engine/methods/bpmn/saveProcess.php
@@ -0,0 +1,129 @@
+.
+ *
+ * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
+ * Coral Gables, FL, 33134, USA, or email info@colosa.com.
+ *
+ */
+ 
+try{
+  G::LoadClass('xpdl');
+  G::LoadClass('processMap');
+  G::LoadClass('tasks');
+  $oProcessMap = new processMap(new DBConnection);
+  $oProcess = new Xpdl();
+  $oTask    = new Task();
+  if(isset($_POST['PRO_UID'])){
+    $idProcess = $_POST['PRO_UID'];
+      if($oProcess->processExists ($idProcess)){
+        $process['ID'] = $idProcess;
+      }
+      else{
+        $result = array(); 
+        $result['status_code'] = $idProcess;
+        $result['message']     = "the process don't exists";
+        $result['timestamp']   = date('Y-m-d H:i:s');
+        echo json_encode($result);
+        die;
+      }
+  }
+  else{
+    $result = array(); 
+    $result['status_code'] = 1;
+    $result['message']     = "you don't send the process uid";
+    $result['timestamp']   = date('Y-m-d H:i:s');
+    echo json_encode($result);
+    die;
+  }
+  $aTasks                 = json_decode ( $_POST['tasks'] );
+  $aRoutes                = json_decode ( $_POST['routes'] );
+  $aEvents                = json_decode ( $_POST['events'] );
+  $aGateways              = json_decode ( $_POST['gateways'] );
+  $aAnnotations           = json_decode ( $_POST['annotations'] );
+  $aSubprocess            = json_decode ( $_POST['subprocess'] );
+  $fields                 = $oProcess->serializeProcess($idProcess);
+//$oData                  = unserialize($fields);
+  $aRoutes                = $oProcess->super_unique($aRoutes);
+  $sOutput                = '';
+  $subProcesses           = array();
+  foreach($aTasks as $endBase => $valueEnd){
+    $tasks['ID_TASK'] = $valueEnd['0'];
+    $tasks['START']   = '';
+    foreach($aEvents as $id => $value){
+      if($value['1'] == 'bpmnEventEmptyStart' or $value['1'] == 'bpmnEventMessageStart' or $value['1'] == 'bpmnEventTimerStart' ){
+        foreach($aRoutes as $endR => $valueR){
+          if($tasks['ID_TASK'] == $valueR['2'] and $valueR['1'] == $value['0'] ){
+            $tasks['START'] = 'TRUE';
+            unset($aEvents[$id]);
+            unset($aRoutes[$endR]);
+          }
+        }
+      }
+    }
+    if( $tasks['START'] == ''){
+      $tasks['START'] = 'FALSE';
+    }   
+    $tasks['TAS_TITLE']  = $valueEnd['1'];
+    $tasks['X']          = $valueEnd['2'];
+    $tasks['Y']          = $valueEnd['3'];
+    $tasks['TAS_TYPE']   = $valueEnd['6'];
+    $tasks['ID_PROCESS'] = $idProcess;
+    //$tasks['TASK_TYPE']  = 'NORMAL';
+    $tasks['DESCRIPTION']= '';
+        $oData->tasks[]= $oProcess->createDataTask($tasks);
+  }
+  $endArray = array();
+  $endArray           = $oProcess->convertArrayEnd($aEvents,$idProcess);
+  $oData->lanes       = $oProcess->createLanesPM($aAnnotations,$idProcess);
+  $transitions        = $oProcess->createArrayRoutes($oData->tasks,$aRoutes,$aEvents,$aGateways,$aEvents,$idProcess);
+  $oData->routes      = $transitions['ROUTES'];
+  $routeTransitions   = $transitions['TRANSITIONS'];
+  $numberRoutes       = $transitions['NUMBER'];
+  $oData->tasks       = $transitions['TASKS'];
+  $taskHidden         = $transitions['HIDDEN'];
+  foreach($aSubprocess as $key => $value){
+    //print_R($value['0']);
+    //$sOutput = $oTask->remove($value['0']);
+    $sOutput = $oProcessMap->addSubProcess($idProcess,$value['2'],$value['3']);
+    /*$subProcess[$key]['ID_PROCESS']  = $idProcess;
+    $subProcess[$key]['TAS_TITLE']   = $idProcess;
+    $subProcess[$key]['ID_TASK']     = $value['0'];
+    $subProcess[$key]['TAS_UID']     = $value['0'];
+    $subProcess[$key]['TASK_PARENT'] = '';
+    $subProcess[$key]['PROCESS_PARENT'] = '';
+    $subProcess[$key]['TASK_TYPE']   = 'SUBPROCESS';
+    $subProcess[$key]['DESCRIPTION'] = '';
+    $subProcess[$key]['X']           = $value['2'];
+    $subProcess[$key]['Y']           = $value['3'];    
+    
+    print_R($subProcess[$key]);
+    $subProcesses[] = $oProcess->createSubProcess($subProcess);
+    $oData->tasks[] = $oProcess->createTask($subProcess[$key]);*/
+  }
+  $numberTransitions  = sizeof($routeTransitions);
+  if($numberTransitions > 0){
+    $routesArray   = $oProcess->createGateways($routeTransitions,$endArray,$oData->routes,$numberRoutes,$idProcess,$taskHidden);
+    $oData->routes = $routesArray;
+  }
+  $oProcess->updateProcessFromDataXpdl($oData,$oData->tasks);
+  }
+catch (Exception $oException) {
+ die($oException->getMessage());
+}
\ No newline at end of file
diff --git a/workflow/engine/templates/bpmn/Annotation.js b/workflow/engine/templates/bpmn/Annotation.js
new file mode 100755
index 000000000..f7ff2cee0
--- /dev/null
+++ b/workflow/engine/templates/bpmn/Annotation.js
@@ -0,0 +1,195 @@
+bpmnAnnotation = function (_30ab) {
+    VectorFigure.call(this);
+    if(typeof _30ab.anno_width != 'undefined' && typeof _30ab.anno_height != 'undefined')
+        this.setDimension(_30ab.anno_width, _30ab.anno_height);
+    else
+    this.setDimension(110, 60);
+    this.setAnnotationName(_30ab.annotationName); //It will set the Default Task Name with appropriate count While dragging a task on the canvas
+};
+
+bpmnAnnotation.prototype = new VectorFigure;
+bpmnAnnotation.prototype.type = "bpmnAnnotation";
+bpmnAnnotation.prototype.setAnnotationName = function (name) {
+    if(typeof name != 'undefined')
+        this.annotationName = name;
+    else
+        this.annotationName = 'Annotation';
+};
+
+bpmnAnnotation.prototype.coord_converter = function (bound_width, bound_height, text_length) {
+    //bound_width = this.workflow.currentSelection.width;
+    //bound_height = this.workflow.currentSelection.height;
+    input_width = text_length * 6
+    input_height = 10
+
+    temp_width = bound_width - input_width;
+    temp_width /= 2;
+    temp_x = temp_width;
+
+    temp_height = bound_height - 10;
+    temp_height /= 2;
+    temp_y = temp_height;
+
+    var temp_coord = new Object();
+    temp_coord.temp_x = temp_x;
+    temp_coord.temp_y = temp_y;
+    return temp_coord;
+};
+
+
+
+bpmnAnnotation.prototype.paint = function () {
+    VectorFigure.prototype.paint.call(this);
+
+     //Set the Task Limitation
+    if(this.getWidth() > 200 || this.getHeight() > 100)
+    {
+        this.setDimension(200, 100);
+    }
+    if(this.getWidth() < 110 || this.getHeight() < 60)
+    {
+        this.setDimension(110, 60);
+    }
+    this.graphics.setColor("#ffffff");
+    this.graphics.fillRect(0,0, this.getWidth(), this.getHeight());
+    this.graphics.setColor("#000000");
+    this.graphics.drawLine(this.getWidth()/4,0,0,0);
+    this.graphics.drawLine(0,0,0,this.getHeight());
+    this.graphics.drawLine(0,this.getHeight(),this.getWidth()/4,this.getHeight());
+    this.graphics.paint();
+    /*var x = new Array(6, this.getWidth() - 3, this.getWidth(), this.getWidth(), this.getWidth() - 3, 6, 3, 3, 6);
+    var y = new Array(3, 3, 6, this.getHeight() - 3, this.getHeight(), this.getHeight(), this.getHeight() - 3, 6, 3);
+    this.graphics.setStroke(this.stroke);
+    this.graphics.setColor("#c0c0c0");
+    this.graphics.fillPolygon(x, y);
+
+    for (var i = 0; i < x.length; i++) {
+        x[i] = x[i] - 3;
+        y[i] = y[i] - 3;
+    }
+    this.graphics.setColor("#ffffff");
+    this.graphics.fillPolygon(x, y);
+    this.graphics.setColor("#ff0f0f");
+    this.graphics.drawPolygon(x, y);
+    this.graphics.paint();
+    this.x_text = this.workflow.getAbsoluteX(); //Get x co-ordinate from figure
+    this.y_text = this.workflow.getAbsoluteY(); //Get x co-ordinate from figure
+    */
+ /* New object is created to implement changing of Text functionality
+ */
+    var bpmnText = new jsGraphics(this.id);
+    var padleft = 0.10*this.getWidth();
+    var padtop = 0.18*this.getHeight();
+    var rectwidth = this.getWidth() - padleft;
+    var rectheight = this.getHeight() - 2*padtop;
+    bpmnText.drawStringRect(this.annotationName,0,padtop,rectwidth,rectheight,'center');
+    //bpmnText.drawStringRect(this.taskName,this.getWidth()/2-20,this.getHeight()/2-11,200,'left');
+    //tempcoord = this.coord_converter(this.getWidth(), this.getHeight(), this.taskName.length);
+    //bpmnText.drawTextString(this.taskName, this.getWidth(), this.getHeight(), tempcoord.temp_x, tempcoord.temp_y);
+    bpmnText.paint();
+    this.bpmnNewText = bpmnText;
+
+    if(this.input1!=null){
+    this.input1.setPosition(0,this.height/2);
+    }
+
+};
+
+   jsGraphics.prototype.drawTextString = function (txt, x, y, dx, dy) {
+    this.htm += '
' + txt + '<\/div>'; +}; + + + +bpmnAnnotation.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ +this.input1=new InputPort(); +this.input1.setWorkflow(_40c5); +this.input1.setName('input1'); +this.input1.setZOrder(-1); +this.input1.setBackgroundColor(new Color(255, 255, 255)); +this.input1.setColor(new Color(255, 255, 255)); +this.addPort(this.input1,0,this.height/2); +}; +}; + +bpmnAnnotationDialog = function (_2e5e) { + this.figure = _2e5e; + var title = 'Annotation'; + Dialog.call(this, title); + this.setDimension(400, 150); //Set the width and height of the Dialog box +} + +bpmnAnnotationDialog.prototype = new Dialog(); +bpmnAnnotationDialog.prototype.createHTMLElement = function () { + var item = Dialog.prototype.createHTMLElement.call(this); + var inputDiv = document.createElement("form"); + inputDiv.style.position = "absolute"; + inputDiv.style.left = "10px"; + inputDiv.style.top = "30px"; + inputDiv.style.width = "375px"; + inputDiv.style.font = "normal 10px verdana"; + item.appendChild(inputDiv); + this.label = document.createTextNode("Annotation Name"); + inputDiv.appendChild(this.label); + this.input = document.createElement("textarea"); + this.input.style.border = "1px solid gray"; + this.input.style.font = "normal 10px verdana"; + //this.input.type = "text"; + this.input.maxLength = "500"; + this.input.cols = "50"; + this.input.rows = "3"; + var value = bpmnTask.prototype.trim(this.figure.workflow.currentSelection.annotationName); + if (value) this.input.value = value; + else this.input.value = ""; + this.input.style.width = "100%"; + inputDiv.appendChild(this.input); + this.input.focus(); + return item; +}; + +/*Double Click Event for opening the dialog Box*/ +bpmnAnnotation.prototype.onDoubleClick = function () { + var _409d = new bpmnAnnotationDialog(this); + this.workflow.showDialog(_409d, this.workflow.currentSelection.x, this.workflow.currentSelection.y); +}; + + +/** + * This method will be called if the user pressed the OK button in buttonbar of the dialog.
+ * The string is first cleared and new string is painted.

+ **/ + bpmnAnnotationDialog.prototype.onOk = function () { + this.figure.bpmnNewText.clear(); + + len = Math.ceil(this.input.value.length/16); + if(this.input.value.length < 19) + { + len = 1.5; + if(this.input.value.length > 9) + this.figure.rectWidth = this.input.value.length*8; + else + this.figure.rectWidth = 48; + } + else + this.figure.rectWidth = 150; + //tempcoord = this.workflow.currentSelection.coord_converter(this.workflow.currentSelection.width, this.workflow.currentSelection.height, this.input.value.length) + this.figure.bpmnNewText.drawStringRect(this.input.value,20,20,this.figure.rectWidth,'left'); + // this.figure.bpmnNewText.drawTextString(this.input.value, this.workflow.currentSelection.width, this.workflow.currentSelection.height, tempcoord.temp_x, tempcoord.temp_y); + this.figure.bpmnNewText.paint(); + this.figure.annotationName = this.input.value; //Set Updated Text value + + //Updating Annotation Text Async into the DB + this.figure.actiontype = 'updateText'; + this.workflow.saveShape(this.figure); + + if(this.figure.rectWidth<80) + tempW = 110; + else + tempW = this.figure.rectWidth+35; + this.workflow.currentSelection.setDimension(tempW, len*13+40); + + this.workflow.removeFigure(this); +}; + diff --git a/workflow/engine/templates/bpmn/AwesomeUploader.js b/workflow/engine/templates/bpmn/AwesomeUploader.js new file mode 100755 index 000000000..cefd31efe --- /dev/null +++ b/workflow/engine/templates/bpmn/AwesomeUploader.js @@ -0,0 +1,540 @@ + +/* +Awesome Uploader +AwesomeUploader JavaScript Class + +Copyright (c) 2010, Andrew Rymarczyk +All rights reserved. + +Redistribution and use in source and minified, compiled or otherwise obfuscated +form, with or without modification, are permitted provided that the following +conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in minified, compiled or otherwise obfuscated form must + reproduce the above copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other materials + provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/* +if(SWFUpload !== undefined){ + SWFUpload.UPLOAD_ERROR_DESC = { + '-200': 'HTTP ERROR' + ,'-210': 'MISSING UPLOAD URL' + ,'-220': 'IO ERROR' + ,'-230': 'SECURITY ERROR' + ,'-240': 'UPLOAD LIMIT EXCEEDED' + ,'-250': 'UPLOAD FAILED' + ,'-260': 'SPECIFIED FILE ID NOT FOUND' + ,'-270': 'FILE VALIDATION FAILED' + ,'-280': 'FILE CANCELLED' + ,'-290': 'UPLOAD STOPPED' + }; + SWFUpload.QUEUE_ERROR_DESC = { + '-100': 'QUEUE LIMIT EXCEEDED' + ,'-110': 'FILE EXCEEDS SIZE LIMIT' + ,'-120': 'ZERO BYTE FILE' + ,'-130': 'INVALID FILETYPE' + }; +} +*/ + +AwesomeUploader = Ext.extend(Ext.Panel, { + jsonUrl:'/test/router/fileMan/' + ,jsonUrlUpload:'processes_doUpload' + ,swfUploadItems:[] + ,doLayout:function(){ + AwesomeUploader.superclass.doLayout.apply(this, arguments); + this.fileGrid.getView().refresh(); + } + ,initComponent:function(){ + + this.addEvents( + 'fileupload' + // fireEvent('fileupload', Obj thisUploader, Bool uploadSuccessful, Obj serverResponse); + //server response object will at minimum have a property "error" describing the error. + ,'fileselectionerror' + // fireEvent('fileselectionerror', String message) + //fired by drag and drop and swfuploader if a file that is too large is selected. + //Swfupload also fires this even if a 0-byte file is selected or the file type does not match the "flashSwfUploadFileTypes" mask + ); + + var fields = ['id', 'name', 'size', 'status', 'progress']; + this.fileRecord = Ext.data.Record.create(fields); + + this.initialConfig = this.initialConfig || {}; + this.initialConfig.awesomeUploaderRoot = this.initialConfig.awesomeUploaderRoot || '/skins/ext/images/gray/shapes/'; + + Ext.apply(this, this.initialConfig, { + flashButtonSprite:this.initialConfig.awesomeUploaderRoot+ 'swfupload_browse_button_trans_56x22.PNG' + ,flashButtonWidth:'56' + ,flashButtonHeight:'22' + ,flashUploadFilePostName:'Filedata' + ,disableFlash:false + ,flashSwfUploadPath:this.initialConfig.awesomeUploaderRoot+'swfupload.swf' + //,flashSwfUploadFileSizeLimit:'3 MB' //deprecated + ,flashSwfUploadFileTypes:'*.*' + ,flashSwfUploadFileTypesDescription:'All Files' + ,flashUploadUrl:'processes_doUpload.php' + ,xhrUploadUrl:'xhrupload.php' + ,xhrFileNameHeader:'X-File-Name' + ,xhrExtraPostDataPrefix:'extraPostData_' + ,xhrFilePostName:'Filedata' + ,xhrSendMultiPartFormData:false + ,maxFileSizeBytes: 3145728 // 3 * 1024 * 1024 = 3 MiB + ,standardUploadFilePostName:'Filedata' + ,standardUploadUrl:'processes_doUpload.php' + ,iconStatusPending:this.initialConfig.awesomeUploaderRoot+'hourglass.png' + ,iconStatusSending:this.initialConfig.awesomeUploaderRoot+'loading.gif' + ,iconStatusAborted:this.initialConfig.awesomeUploaderRoot+'cross.png' + ,iconStatusError:this.initialConfig.awesomeUploaderRoot+'cross.png' + ,iconStatusDone:this.initialConfig.awesomeUploaderRoot+'tick.png' + ,supressPopups:false + ,extraPostData:{} + ,width:440 + ,height:250 + ,autoScroll: true + ,border:true + ,frame:true + ,layout:'absolute' + ,fileId:0 + ,items:[ + { + //swfupload and upload button container + },{ + xtype:'grid' + ,x:0 + ,y:30 + ,width:this.initialConfig.gridWidth || 420 + ,height:this.initialConfig.gridHeight || 200 + ,enableHdMenu:false + ,store:new Ext.data.ArrayStore({ + fields: fields + ,reader: new Ext.data.ArrayReader({idIndex: 0}, this.fileRecord) + }) + ,columns:[ + {header:'File Name',dataIndex:'name', width:150} + ,{header:'Size',dataIndex:'size', width:60, renderer:Ext.util.Format.fileSize} + ,{header:' ',dataIndex:'status', width:30, scope:this, renderer:this.statusIconRenderer} + ,{header:'Status',dataIndex:'status', width:60} + ,{header:'Progress',dataIndex:'progress',scope:this, renderer:this.progressBarColumnRenderer} + ] + ,listeners:{ + render:{ + scope:this + ,fn:function(){ + this.fileGrid = this.items.items[1]; + this.initFlashUploader(); + this.initDnDUploader(); + } + } + } + }] + }); + + AwesomeUploader.superclass.initComponent.apply(this, arguments); + } + ,fileAlert:function(text){ + if(this.supressPopups){ + return true; + } + if(this.fileAlertMsg === undefined || !this.fileAlertMsg.isVisible()){ + this.fileAlertMsgText = 'Error uploading:
'+text; + this.fileAlertMsg = Ext.MessageBox.show({ + title:'Upload Error', + msg: this.fileAlertMsgText, + buttons: Ext.Msg.OK, + modal:false, + icon: Ext.MessageBox.ERROR + }); + }else{ + this.fileAlertMsgText += text; + this.fileAlertMsg.updateText(this.fileAlertMsgText); + this.fileAlertMsg.getDialog().focus(); + } + + } + ,statusIconRenderer:function(value){ + switch(value){ + default: + return value; + case 'Pending': + return ''; + case 'Sending': + return ''; + case 'Aborted': + return ''; + case 'Error': + return ''; + case 'Done': + return ''; + } + } + ,progressBarColumnTemplate: new Ext.XTemplate( + '
', + '
{value} %
', + '
', + '
', + '
{value} %
', + '
' + ) + ,progressBarColumnRenderer:function(value, meta, record, rowIndex, colIndex, store){ + meta.css += ' x-grid3-td-progress-cell'; + return this.progressBarColumnTemplate.apply({ + value: value + }); + } + ,addFile:function(file){ + + var fileRec = new this.fileRecord( + Ext.apply(file,{ + id: ++this.fileId + ,status: 'Pending' + ,progress: '0' + ,complete: '0' + }) + ); + this.fileGrid.store.add(fileRec); + + return fileRec; + } + ,updateFile:function(fileRec, key, value){ + fileRec.set(key, value); + fileRec.commit(); + } + ,initStdUpload:function(param){ + if(this.uploader){ + this.uploader.fileInput = null; //remove reference to file field. necessary to prevent destroying file field during upload. + Ext.destroy(this.uploader); + }else{ + Ext.destroy(this.items.items[0]); + } + this.uploader = new Ext.ux.form.FileUploadField({ + renderTo:this.body + ,buttonText:'Browse...' + ,x:0 + ,y:0 + ,style:'position:absolute;' + ,buttonOnly:true + ,name:this.standardUploadFilePostName + ,listeners:{ + scope:this + ,fileselected:this.stdUploadFileSelected + } + }); + + } + ,initFlashUploader:function(){ + + if(this.disableFlash){ + this.initStdUpload(); + return true; + } + + var settings = { + flash_url: this.flashSwfUploadPath + ,upload_url: this.flashUploadUrl + ,file_size_limit: this.maxFileSizeBytes + ' B' + ,file_types: this.flashSwfUploadFileTypes + ,file_types_description: this.flashSwfUploadFileTypesDescription + ,file_upload_limit: 100 + ,file_queue_limit: 0 + ,debug: false + ,post_params: this.extraPostData + ,button_image_url: this.flashButtonSprite + ,button_width: this.flashButtonWidth + ,button_height: this.flashButtonHeight + ,button_window_mode: 'opaque' + ,file_post_name: this.flashUploadFilePostName + ,button_placeholder: this.items.items[0].body.dom + ,file_queued_handler: this.swfUploadfileQueued.createDelegate(this) + ,file_dialog_complete_handler: this.swfUploadFileDialogComplete.createDelegate(this) + ,upload_start_handler: this.swfUploadUploadStart.createDelegate(this) + ,upload_error_handler: this.swfUploadUploadError.createDelegate(this) + ,upload_progress_handler: this.swfUploadUploadProgress.createDelegate(this) + ,upload_success_handler: this.swfUploadSuccess.createDelegate(this) + ,upload_complete_handler: this.swfUploadComplete.createDelegate(this) + ,file_queue_error_handler: this.swfUploadFileQueError.createDelegate(this) + ,minimum_flash_version: '9.0.28' + ,swfupload_load_failed_handler: this.initStdUpload.createDelegate(this) + }; + this.swfUploader = new SWFUpload(settings); + } + ,initDnDUploader:function(){ + + //================== + // Attach drag and drop listeners to document body + // this prevents incorrect drops, reloading the page with the dropped item + // This may or may not be helpful + if(!document.body.BodyDragSinker){ + document.body.BodyDragSinker = true; + + var body = Ext.fly(document.body); + body.on({ + dragenter:function(event){ + return true; + } + ,dragleave:function(event){ + return true; + } + ,dragover:function(event){ + event.stopEvent(); + return true; + } + ,drop:function(event){ + event.stopEvent(); + return true; + } + }); + } + // end body events + //================== + + this.el.on({ + dragenter:function(event){ + event.browserEvent.dataTransfer.dropEffect = 'move'; + return true; + } + ,dragover:function(event){ + event.browserEvent.dataTransfer.dropEffect = 'move'; + event.stopEvent(); + return true; + } + ,drop:{ + scope:this + ,fn:function(event){ + event.stopEvent(); + var files = event.browserEvent.dataTransfer.files; + + if(files === undefined){ + return true; + } + var len = files.length; + while(--len >= 0){ + this.processDnDFileUpload(files[len]); + } + } + } + }); + + } + ,processDnDFileUpload:function(file){ + + var fileRec = this.addFile({ + name: file.name + ,size: file.size + }); + + if(file.size > this.maxFileSizeBytes){ + this.updateFile(fileRec, 'status', 'Error'); + this.fileAlert('
'+file.name+'
File size exceeds allowed limit.
'); + this.fireEvent('fileselectionerror', 'File size exceeds allowed limit.'); + return true; + } + + var upload = new Ext.ux.XHRUpload({ + url:this.xhrUploadUrl + ,filePostName:this.xhrFilePostName + ,fileNameHeader:this.xhrFileNameHeader + ,extraPostData:this.extraPostData + ,sendMultiPartFormData:this.xhrSendMultiPartFormData + ,file:file + ,listeners:{ + scope:this + ,uploadloadstart:function(event){ + this.updateFile(fileRec, 'status', 'Sending'); + } + ,uploadprogress:function(event){ + this.updateFile(fileRec, 'progress', Math.round((event.loaded / event.total)*100)); + } + // XHR Events + ,loadstart:function(event){ + this.updateFile(fileRec, 'status', 'Sending'); + } + ,progress:function(event){ + fileRec.set('progress', Math.round((event.loaded / event.total)*100) ); + fileRec.commit(); + } + ,abort:function(event){ + this.updateFile(fileRec, 'status', 'Aborted'); + this.fireEvent('fileupload', this, false, {error:'XHR upload aborted'}); + } + ,error:function(event){ + this.updateFile(fileRec, 'status', 'Error'); + this.fireEvent('fileupload', this, false, {error:'XHR upload error'}); + } + ,load:function(event){ + + try{ + var result = Ext.util.JSON.decode(upload.xhr.responseText);//throws a SyntaxError. + }catch(e){ + Ext.MessageBox.show({ + buttons: Ext.MessageBox.OK + ,icon: Ext.MessageBox.ERROR + ,modal:false + ,title:'Upload Error!' + ,msg:'Invalid JSON Data Returned!

Please refresh the page to try again.' + }); + this.updateFile(fileRec, 'status', 'Error'); + this.fireEvent('fileupload', this, false, {error:'Invalid JSON returned'}); + return true; + } + if( result.success ){ + fileRec.set('progress', 100 ); + fileRec.set('status', 'Done'); + fileRec.commit(); + this.fireEvent('fileupload', this, true, result); + }else{ + this.fileAlert('
'+file.name+'
'+result.error+'
'); + this.updateFile(fileRec, 'status', 'Error'); + this.fireEvent('fileupload', this, false, result); + } + } + } + }); + upload.send(); + } + ,swfUploadUploadProgress:function(file, bytesComplete, bytesTotal){ + this.updateFile(this.swfUploadItems[file.index], 'progress', Math.round((bytesComplete / bytesTotal)*100)); + } + ,swfUploadFileDialogComplete:function(){ + this.swfUploader.startUpload(); + } + ,swfUploadUploadStart:function(file){ + this.swfUploader.setPostParams(this.extraPostData); //sync post data with flash + this.updateFile(this.swfUploadItems[file.index], 'status', 'Sending'); + } + ,swfUploadComplete:function(file){ //called if the file is errored out or on success + this.swfUploader.startUpload(); //as per the swfupload docs, start the next upload! + } + ,swfUploadUploadError:function(file, errorCode, message){ + this.fileAlert('
'+file.name+'
'+message+'
');//SWFUpload.UPLOAD_ERROR_DESC[errorCode.toString()] + + this.updateFile(this.swfUploadItems[file.index], 'status', 'Error'); + this.fireEvent('fileupload', this, false, {error:message}); + } + ,swfUploadSuccess:function(file, serverData){ //called when the file is done + try{ + var result = Ext.util.JSON.decode(serverData);//throws a SyntaxError. + }catch(e){ + Ext.MessageBox.show({ + buttons: Ext.MessageBox.OK + ,icon: Ext.MessageBox.ERROR + ,modal:false + ,title:'Upload Error!' + ,msg:'Invalid JSON Data Returned!

Please refresh the page to try again.' + }); + this.updateFile(this.swfUploadItems[file.index], 'status', 'Error'); + this.fireEvent('fileupload', this, false, {error:'Invalid JSON returned'}); + return true; + } + if( result.success ){ + this.swfUploadItems[file.index].set('progress',100); + this.swfUploadItems[file.index].set('status', 'Done'); + this.swfUploadItems[file.index].commit(); + this.fireEvent('fileupload', this, true, result); + }else{ + this.fileAlert('
'+file.name+'
'+result.error+'
'); + this.updateFile(this.swfUploadItems[file.index], 'status', 'Error'); + this.fireEvent('fileupload', this, false, result); + } + } + ,swfUploadfileQueued:function(file){ + this.swfUploadItems[file.index] = this.addFile({ + name: file.name + ,size: file.size + }); + return true; + } + ,swfUploadFileQueError:function(file, error, message){ + this.swfUploadItems[file.index] = this.addFile({ + name: file.name + ,size: file.size + }); + this.updateFile(this.swfUploadItems[file.index], 'status', 'Error'); + this.fileAlert('
'+file.name+'
'+message+'
'); + this.fireEvent('fileselectionerror', message); + } + ,stdUploadSuccess:function(form, action){ + form.el.fileRec.set('progress',100); + form.el.fileRec.set('status', 'Done'); + form.el.fileRec.commit(); + this.fireEvent('fileupload', this, true, action.result); + } + ,stdUploadFail:function(form, action){ + this.updateFile(form.el.fileRec, 'status', 'Error'); + this.fireEvent('fileupload', this, false, action.result); + this.fileAlert('
'+form.el.fileRec.get('name')+'
'+action.result.error+'
'); + } + ,stdUploadFileSelected:function(fileBrowser, fileName){ + + var lastSlash = fileName.lastIndexOf('/'); //check for *nix full file path + if( lastSlash < 0 ){ + lastSlash = fileName.lastIndexOf('\\'); //check for win full file path + } + if(lastSlash > 0){ + fileName = fileName.substr(lastSlash+1); + } + var file = { + name:fileName + ,size:'0' + }; + + if(Ext.isDefined(fileBrowser.fileInput.dom.files) ){ + file.size = fileBrowser.fileInput.dom.files[0].size; + }; + + var fileRec = this.addFile(file); + + if( file.size > this.maxFileSizeBytes){ + this.updateFile(fileRec, 'status', 'Error'); + this.fileAlert('
'+file.name+'
File size exceeds allowed limit.
'); + this.fireEvent('fileselectionerror', 'File size exceeds allowed limit.'); + return true; + } + + var formEl = document.createElement('form'), + extraPost; + for( attr in this.extraPostData){ + extraPost = document.createElement('input'), + extraPost.type = 'hidden'; + extraPost.name = attr; + extraPost.value = this.extraPostData[attr]; + formEl.appendChild(extraPost); + } + formEl = this.el.appendChild(formEl); + formEl.fileRec = fileRec; + fileBrowser.fileInput.addClass('au-hidden'); + formEl.appendChild(fileBrowser.fileInput); + formEl.addClass('au-hidden'); + var formSubmit = new Ext.form.BasicForm(formEl,{ + method:'POST' + ,fileUpload:true + }); + + formSubmit.submit({ + url:this.standardUploadUrl + ,scope:this + ,success:this.stdUploadSuccess + ,failure:this.stdUploadFail + }); + this.updateFile(fileRec, 'status', 'Sending'); + this.initStdUpload(); //re-init uploader for multiple simultaneous uploads + } + +}); + +Ext.reg('awesomeuploader', AwesomeUploader); diff --git a/workflow/engine/templates/bpmn/Dataobject.js b/workflow/engine/templates/bpmn/Dataobject.js new file mode 100755 index 000000000..375e499d5 --- /dev/null +++ b/workflow/engine/templates/bpmn/Dataobject.js @@ -0,0 +1,33 @@ +bpmnDataobject = function (_30ab) { + VectorFigure.call(this); + this.setDimension(50, 80); + this.setTaskName(_30ab.taskNo); //It will set the Default Task Name with appropriate count While dragging a task on the canvas +}; + +bpmnDataobject.prototype = new VectorFigure; +bpmnDataobject.prototype.type = "bpmnDataobject"; +bpmnDataobject.prototype.setTaskName = function (name) { + this.taskName = 'Data Object ' + name; +}; + +bpmnDataobject.prototype.paint = function () { + VectorFigure.prototype.paint.call(this); + var x = new Array(0, this.getWidth()-10, this.getWidth(), this.getWidth()-10, this.getWidth()-10, this.getWidth(), this.getWidth(), 0); + var y = new Array(0, 0, 10, 10, 0, 10, this.getHeight(), this.getHeight()); + + this.graphics.setStroke(this.stroke); + this.graphics.setColor("#c0c0c0"); + this.graphics.fillPolygon(x, y); + + for (var i = 0; i < x.length; i++) { + x[i] = x[i] - 3; + y[i] = y[i] - 3; + } + this.graphics.setColor("#ffffff"); + this.graphics.fillPolygon(x, y); + this.graphics.setColor("#ff0f0f"); + this.graphics.drawPolygon(x, y); + this.graphics.paint(); + this.x_text = this.workflow.getAbsoluteX(); //Get x co-ordinate from figure + this.y_text = this.workflow.getAbsoluteY(); //Get x co-ordinate from figure +} diff --git a/workflow/engine/templates/bpmn/EventBoundaryTimerInter.js b/workflow/engine/templates/bpmn/EventBoundaryTimerInter.js new file mode 100755 index 000000000..e630994da --- /dev/null +++ b/workflow/engine/templates/bpmn/EventBoundaryTimerInter.js @@ -0,0 +1,97 @@ +bpmnEventBoundaryTimerInter=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke = 2; +}; +bpmnEventBoundaryTimerInter.prototype=new VectorFigure; +bpmnEventBoundaryTimerInter.prototype.type="bpmnEventBoundaryTimerInter"; +bpmnEventBoundaryTimerInter.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +var x_cir1=0; +var y_cir1=0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir1+3,y_cir1+3,this.getWidth(),this.getHeight()); + +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#f9faf2" ); +this.graphics.fillEllipse(x_cir1,y_cir1,this.getWidth(),this.getHeight()); +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir1,y_cir1,this.getWidth(),this.getHeight()); +var x_cir2=3; +var y_cir2=3; +this.graphics.setColor( "#f9faf2" ); +this.graphics.fillEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); + +/* +//drawing clock's minutes lines +this.graphics.setColor("#adae5e"); +//this.graphics.drawEllipse(x_cir3,y_cir3,this.getWidth()-20,this.getHeight()-20); +this.graphics.drawLine(this.getWidth()/2,this.getHeight()/2,this.getWidth()/1.3,this.getHeight()/2); +this.graphics.drawLine(this.getWidth()/2,this.getHeight()/2,this.getWidth()/2,this.getHeight()/4.5); +*/ + + +//var x_cir3=10; +//var y_cir3=10; +//this.graphics.setColor( "#f9faf2" ); +//this.graphics.fillEllipse(x_cir3,y_cir3,this.getWidth()-20,this.getHeight()-20); +this.graphics.setColor("#adae5e"); +//this.graphics.drawEllipse(x_cir3,y_cir3,this.getWidth()-20,this.getHeight()-20); +this.graphics.drawLine(this.getWidth()/2.2,this.getHeight()/2,this.getWidth()/1.6,this.getHeight()/2); //horizontal line +this.graphics.drawLine(this.getWidth()/2.2,this.getHeight()/2,this.getWidth()/2.2,this.getHeight()/3.7); //vertical line + +this.graphics.drawLine(24,8,20,11); //10th min line +this.graphics.drawLine(22,15,25,15); //15th min line +this.graphics.drawLine(24,22,19,20); //25th min line +this.graphics.drawLine(15,22,15,25); //30th min line +this.graphics.drawLine(8,22,12,19); //40th min line +this.graphics.drawLine(5,15,8,15); //45th min line +this.graphics.drawLine(8,8,11,11); //50th min line +this.graphics.drawLine(15,5,15,8); //60th min line + +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventBoundaryTimerInter.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['input2','output2']; + var eventPortType = ['InputPort','OutputPort']; + var eventPositionX= [this.width/2,this.width/2]; + var eventPositionY= [0,this.height]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventBoundaryTimerInter.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventCancelEnd.js b/workflow/engine/templates/bpmn/EventCancelEnd.js new file mode 100755 index 000000000..42bc306d8 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventCancelEnd.js @@ -0,0 +1,76 @@ +bpmnEventCancelEnd=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=3; +}; +bpmnEventCancelEnd.prototype=new VectorFigure; +bpmnEventCancelEnd.prototype.type="bpmnEventCancelEnd"; +bpmnEventCancelEnd.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); + //Set the Task Limitation + if (this.getWidth() < 30 || this.getHeight() < 30) { + this.setDimension(30, 30); + } + +this.graphics.setStroke(this.stroke); +var x_cir = 0; +var y_cir = 0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir+5,y_cir+5,this.getWidth(),this.getHeight()); +this.graphics.setColor("#f7f1e5"); +this.graphics.fillEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +this.graphics.setColor("#c46508"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +this.graphics.setStroke(2); +//var x=new Array(16,23,31,36,29,37,32,23,16,11,18,11); +//var y=new Array(35,27,33,29,22,14,9,16,9,14,22,29); +var x=new Array(this.getWidth()/2.8,this.getWidth()/1.95,this.getWidth()/1.45,this.getWidth()/1.25,this.getWidth()/1.55,this.getWidth()/1.21,this.getWidth()/1.4,this.getWidth()/1.95,this.getWidth()/2.8,this.getWidth()/4.1,this.getWidth()/2.5,this.getWidth()/4.1); +var y=new Array(this.getHeight()/1.28,this.getHeight()/1.66,this.getHeight()/1.36,this.getHeight()/1.55,this.getHeight()/2.04,this.getHeight()/3.21,this.getHeight()/5.6,this.getHeight()/2.81,this.getHeight()/5.6,this.getHeight()/3.21,this.getHeight()/2.04,this.getHeight()/1.55); +this.graphics.setColor("#c46508"); +this.graphics.fillPolygon(x,y); +this.graphics.setColor("#c46508"); +//this.graphics.drawPolygon(x,y); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventCancelEnd.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['input1','input2']; + var eventPortType = ['InputPort','InputPort']; + var eventPositionX= [this.width/2,0]; + var eventPositionY= [0,this.height/2]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventCancelEnd.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventCancelInter.js b/workflow/engine/templates/bpmn/EventCancelInter.js new file mode 100755 index 000000000..099f658c8 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventCancelInter.js @@ -0,0 +1,30 @@ +bpmnEventCancelInter=function(){ +VectorFigure.call(this); +this.setDimension(45,45); +this.stroke=2; +}; +bpmnEventCancelInter.prototype=new VectorFigure; +bpmnEventCancelInter.prototype.type="bpmnEventCancelInter"; +bpmnEventCancelInter.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +this.graphics.setStroke(this.stroke); +var x_cir = 0; +var y_cir = 0; +this.graphics.setColor("#000000"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +var x_cir2=5; +var y_cir2=5; +this.graphics.setColor("#000000"); +this.graphics.drawEllipse(x_cir2,y_cir2,this.getWidth()-10,this.getHeight()-10); +//var x=new Array(16,23,31,36,29,37,32,23,16,11,18,11); +//var y=new Array(35,27,33,29,22,14,9,16,9,14,22,29); +var x=new Array(this.getWidth()/2.8,this.getWidth()/1.95,this.getWidth()/1.45,this.getWidth()/1.25,this.getWidth()/1.55,this.getWidth()/1.21,this.getWidth()/1.4,this.getWidth()/1.95,this.getWidth()/2.8,this.getWidth()/4.1,this.getWidth()/2.5,this.getWidth()/4.1); +var y=new Array(this.getHeight()/1.28,this.getHeight()/1.66,this.getHeight()/1.36,this.getHeight()/1.55,this.getHeight()/2.04,this.getHeight()/3.21,this.getHeight()/5.6,this.getHeight()/2.81,this.getHeight()/5.6,this.getHeight()/3.21,this.getHeight()/2.04,this.getHeight()/1.55); +this.graphics.setColor("#ffffff"); +this.graphics.fillPolygon(x,y); +this.graphics.setColor("#000000"); +this.graphics.drawPolygon(x,y); +this.graphics.paint(); +}; + + diff --git a/workflow/engine/templates/bpmn/EventCompEnd.js b/workflow/engine/templates/bpmn/EventCompEnd.js new file mode 100755 index 000000000..9f514ac84 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventCompEnd.js @@ -0,0 +1,70 @@ +bpmnEventCompEnd=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=3 +}; +bpmnEventCompEnd.prototype=new VectorFigure; +bpmnEventCompEnd.prototype.type="bpmnEventCompEnd"; +bpmnEventCompEnd.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +this.graphics.setStroke(this.stroke); +var x_cir = 0; +var y_cir = 0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir+5,y_cir+5,this.getWidth(),this.getHeight()); +this.graphics.setColor("#f7f1e5"); +this.graphics.fillEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +this.graphics.setColor("#c46508"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +//var x_arrow=new Array(6,19,19,32,32,19,19); +//var y_arrow=new Array(22,33,22,33,11,22,11); +var x_arrow=new Array(this.getWidth()/7,this.getWidth()/2.36,this.getWidth()/2.36,this.getWidth()/1.4,this.getWidth()/1.42,this.getWidth()/2.36,this.getWidth()/2.36); +var y_arrow=new Array(this.getHeight()/2,this.getHeight()/1.36,this.getHeight()/2,this.getHeight()/1.36,this.getHeight()/4,this.getHeight()/2,this.getHeight()/4); +this.graphics.setColor( "#c46508" ); +this.graphics.fillPolygon(x_arrow,y_arrow); +this.graphics.setColor("#c46508"); +//this.graphics.drawPolygon(x_arrow,y_arrow); +this.graphics.paint();/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventCompEnd.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['input1','input2']; + var eventPortType = ['InputPort','InputPort']; + var eventPositionX= [this.width/2,0]; + var eventPositionY= [0,this.height/2]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + + + +bpmnEventCompEnd.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventCompInter.js b/workflow/engine/templates/bpmn/EventCompInter.js new file mode 100755 index 000000000..9b511313f --- /dev/null +++ b/workflow/engine/templates/bpmn/EventCompInter.js @@ -0,0 +1,102 @@ +bpmnEventCompInter=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=2 +}; +bpmnEventCompInter.prototype=new VectorFigure; +bpmnEventCompInter.prototype.type="bpmnEventCompInter"; +bpmnEventCompInter.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +this.graphics.setStroke(this.stroke); +var x_cir =0; +var y_cir =0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir+3,y_cir+3,this.getWidth(),this.getHeight()); + +this.graphics.setColor("#f9faf2") +this.graphics.fillEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()) +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); + +var x_cir2=3; +var y_cir2=3; +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); +//var x_arrow=new Array(6,19,19,32,32,19,19); +//var y_arrow=new Array(22,33,22,33,11,22,11); +var x_arrow=new Array(this.getWidth()/7.5,this.getWidth()/2.36,this.getWidth()/2.36,this.getWidth()/1.4,this.getWidth()/1.42,this.getWidth()/2.36,this.getWidth()/2.36); +var y_arrow=new Array(this.getHeight()/2,this.getHeight()/1.36,this.getHeight()/2,this.getHeight()/1.36,this.getHeight()/4,this.getHeight()/2,this.getHeight()/4); +this.graphics.setColor( "#adae5e" ); +this.graphics.fillPolygon(x_arrow,y_arrow); +this.graphics.setColor("#adae5e"); +this.graphics.drawPolygon(x_arrow,y_arrow); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventCompInter.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + + var eventPortName = ['input1','input2','output1','output2']; + var eventPortType = ['InputPort','InputPort','OutputPort','OutputPort']; + var eventPositionX= [0,this.width/2,this.width,this.width/2]; + var eventPositionY= [this.height/2,0,this.height/2,this.height]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +/* +this.output1=new OutputPort(); +this.output1.setWorkflow(_40c5); +this.output1.setName("output1"); +this.output1.setBackgroundColor(new Color(115, 115, 245)); +this.addPort(this.output1,this.width/2,this.height); + +this.output2=new OutputPort(); +this.output2.setWorkflow(_40c5); +this.output2.setName("output2"); +this.output2.setBackgroundColor(new Color(115, 115, 245)); +this.addPort(this.output2,this.width,this.height/2); + +this.input1=new InputPort(); +this.input1.setWorkflow(_40c5); +this.input1.setName("input1"); +this.input1.setBackgroundColor(new Color(245,115,115)); +this.addPort(this.input1,0,this.height/2); + +this.input2=new InputPort(); +this.input2.setWorkflow(_40c5); +this.input2.setName("input2"); +this.input2.setBackgroundColor(new Color(245,115,115)); +this.addPort(this.input2,this.width/2,0);*/ +} +}; + +bpmnEventCompInter.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; + diff --git a/workflow/engine/templates/bpmn/EventEmptyEnd.js b/workflow/engine/templates/bpmn/EventEmptyEnd.js new file mode 100755 index 000000000..3c5483852 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventEmptyEnd.js @@ -0,0 +1,78 @@ +bpmnEventEmptyEnd=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=3; +}; +bpmnEventEmptyEnd.prototype=new VectorFigure; +bpmnEventEmptyEnd.prototype.type="bpmnEventEmptyEnd"; +bpmnEventEmptyEnd.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +if (this.getWidth() < 30 || this.getHeight() < 30) { + this.setDimension(30, 30); + } +var x=0; +var y=0; +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x+5,y+5,this.getWidth(),this.getHeight()); +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#f7f1e5" ); +this.graphics.fillEllipse(x,y,this.getWidth(),this.getHeight()); +this.graphics.setColor("#c46508"); +this.graphics.drawEllipse(x,y,this.getWidth(),this.getHeight()); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventEmptyEnd.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + + var eventPortName = ['input1','input2']; + var eventPortType = ['InputPort','InputPort']; + var eventPositionX= [this.width/2,0]; + var eventPositionY= [0,this.height/2]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } + /* +this.input1=new InputPort(); +this.input1.setWorkflow(_40c5); +this.input1.setName("input1"); +this.input1.setBackgroundColor(new Color(245,115,115)); +this.addPort(this.input1,this.width/2,0); + +this.input2=new InputPort(); +this.input2.setWorkflow(_40c5); +this.input2.setName("input2"); +this.input2.setBackgroundColor(new Color(245,115,115)); +this.addPort(this.input2,0,this.height/2);*/ +} +}; + + +bpmnEventEmptyEnd.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventEmptyInter.js b/workflow/engine/templates/bpmn/EventEmptyInter.js new file mode 100755 index 000000000..c6db38e72 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventEmptyInter.js @@ -0,0 +1,78 @@ +bpmnEventEmptyInter=function(width,_30ab){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=2; +}; +bpmnEventEmptyInter.prototype=new VectorFigure; +bpmnEventEmptyInter.prototype.type="bpmnEventEmptyInter"; +bpmnEventEmptyInter.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +if (this.getWidth() < 30 || this.getHeight() < 30) { + this.setDimension(30, 30); + } +this.graphics.setStroke(this.stroke); +var x_cir1 = 0; +var y_cir1 = 0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir1+3,y_cir1+3,this.getWidth(),this.getHeight()); + +this.graphics.setColor( "#f9faf2" ); +this.graphics.fillEllipse(x_cir1,y_cir1,this.getWidth(),this.getHeight()); + +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir1,y_cir1,this.getWidth(),this.getHeight()); + +var x_cir2=3; +var y_cir2=3; + +this.graphics.setColor( "#f9faf2" ); +this.graphics.fillEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); + +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); + +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventEmptyInter.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['input1','input2','output1','output2']; + var eventPortType = ['InputPort','InputPort','OutputPort','OutputPort']; + var eventPositionX= [0,this.width/2,this.width,this.width/2]; + var eventPositionY= [this.height/2,0,this.height/2,this.height]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventEmptyInter.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; + diff --git a/workflow/engine/templates/bpmn/EventEmptyStart.js b/workflow/engine/templates/bpmn/EventEmptyStart.js new file mode 100755 index 000000000..62de3fd11 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventEmptyStart.js @@ -0,0 +1,70 @@ +bpmnEventEmptyStart=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=2; +}; +bpmnEventEmptyStart.prototype=new VectorFigure; +bpmnEventEmptyStart.prototype.type="bpmnEventEmptyStart"; +bpmnEventEmptyStart.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +if (this.getWidth() < 30 || this.getHeight() < 30) { + this.setDimension(30, 30); + } + +var x_cir = 0; +var y_cir = 0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir+4,y_cir+4,this.getWidth(),this.getHeight()); +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#e4f7df" ); +this.graphics.fillEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +this.graphics.setColor("#4aa533"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +this.graphics.paint(); + + + + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventEmptyStart.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['output1','output2']; + var eventPortType = ['OutputPort','OutputPort']; + var eventPositionX= [this.width/2,this.width]; + var eventPositionY= [this.height,this.height/2]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventEmptyStart.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; + diff --git a/workflow/engine/templates/bpmn/EventEndSignal.js b/workflow/engine/templates/bpmn/EventEndSignal.js new file mode 100755 index 000000000..ca8022a81 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventEndSignal.js @@ -0,0 +1,70 @@ +bpmnEventEndSignal=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=2; +}; +bpmnEventEndSignal.prototype=new VectorFigure; +bpmnEventEndSignal.prototype.type="bpmnEventEndSignal"; +bpmnEventEndSignal.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +var x=0; +var y=0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x+5,y+5,this.getWidth(),this.getHeight()); +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#f7f1e5" ); +this.graphics.fillEllipse(x,y,this.getWidth(),this.getHeight()); +this.graphics.setColor("#c46508"); +this.graphics.drawEllipse(x,y,this.getWidth(),this.getHeight()); +//var x=new Array(5,41,23); +//var y=new Array(35,35,0); +var x=new Array(5,this.getWidth()-4,this.getWidth()/2); +var y=new Array(this.getHeight()-10,this.getHeight()-10,2); +this.graphics.setColor("#c46508"); +this.graphics.fillPolygon(x,y); +this.graphics.setColor("#000000"); +//this.graphics.drawPolygon(x,y); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventEndSignal.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['input1','input2']; + var eventPortType = ['InputPort','InputPort']; + var eventPositionX= [this.width/2,0]; + var eventPositionY= [0,this.height/2]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventEndSignal.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventEndSignal_old.js b/workflow/engine/templates/bpmn/EventEndSignal_old.js new file mode 100755 index 000000000..b262b6822 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventEndSignal_old.js @@ -0,0 +1,33 @@ +bpmnEventEndSignal=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=3; +}; +bpmnEventEndSignal.prototype=new VectorFigure; +bpmnEventEndSignal.prototype.type="bpmnEventEndSignal"; +bpmnEventEndSignal.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +var x=0; +var y=0; +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#ffffff" ); +this.graphics.fillEllipse(x,y,this.getWidth(),this.getHeight()); +this.graphics.setColor("#000000"); +this.graphics.drawEllipse(x,y,this.getWidth(),this.getHeight()); +//var x=new Array(8,38,22); +//var y=new Array(30,30,4); +var x=new Array(this.getWidth()/5.62,this.getWidth()/1.18,this.getWidth()/2.04); +var y=new Array(this.getHeight()/1.5,this.getHeight()/1.5,this.getHeight()/11.25); +this.graphics.setColor("#000000"); +this.graphics.fillPolygon(x,y); +this.graphics.setColor("#000000"); +this.graphics.drawPolygon(x,y); +this.graphics.paint(); +}; + + +bpmnEventEndSignal.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.AddEventContextMenu(this.id); +} +}; diff --git a/workflow/engine/templates/bpmn/EventErrorEnd.js b/workflow/engine/templates/bpmn/EventErrorEnd.js new file mode 100755 index 000000000..96195a509 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventErrorEnd.js @@ -0,0 +1,73 @@ +bpmnEventErrorEnd=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=4; +}; +bpmnEventErrorEnd.prototype=new VectorFigure; +bpmnEventErrorEnd.prototype.type="bpmnEventErrorEnd"; +bpmnEventErrorEnd.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +this.graphics.setStroke(this.stroke); +var x_cir = 0; +var y_cir = 0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir+5,y_cir+5,this.getWidth(),this.getHeight()); + +this.graphics.setColor("#f7f1e5"); +this.graphics.fillEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +this.graphics.setColor("#c46508"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +//var x=new Array(7,17,24,34,24,17); +//var y=new Array(33,23,33,13,26,16); +var x=new Array(this.getWidth()/6.4,this.getWidth()/2.6,this.getWidth()/1.87,this.getWidth()/1.32,this.getWidth()/1.87,this.getWidth()/2.6); +var y=new Array(this.getHeight()/1.36,this.getHeight()/1.95,this.getHeight()/1.36,this.getHeight()/3.46,this.getHeight()/1.73,this.getHeight()/2.8); +this.graphics.setStroke(2); +this.graphics.setColor("#c46508"); +this.graphics.fillPolygon(x,y); +this.graphics.setColor("#c46508"); +this.graphics.drawPolygon(x,y); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventErrorEnd.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['input1','input2']; + var eventPortType = ['InputPort','InputPort']; + var eventPositionX= [this.width/2,0]; + var eventPositionY= [0,this.height/2]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventErrorEnd.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; + diff --git a/workflow/engine/templates/bpmn/EventErrorInter.js b/workflow/engine/templates/bpmn/EventErrorInter.js new file mode 100755 index 000000000..4e0d368dd --- /dev/null +++ b/workflow/engine/templates/bpmn/EventErrorInter.js @@ -0,0 +1,30 @@ +bpmnEventErrorInter=function(){ +VectorFigure.call(this); +this.setDimension(45,45); +this.stroke=2; +}; +bpmnEventErrorInter.prototype=new VectorFigure; +bpmnEventErrorInter.prototype.type="bpmnEventErrorInter"; +bpmnEventErrorInter.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +this.graphics.setStroke(this.stroke); +var x_cir = 0; +var y_cir = 0; +this.graphics.setColor("#000000"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +var x_cir2=5; +var y_cir2=5; +this.graphics.setColor("#000000"); +this.graphics.drawEllipse(x_cir2,y_cir2,this.getWidth()-10,this.getHeight()-10); +//var x=new Array(7,17,24,34,24,17); +//var y=new Array(33,23,33,13,26,16); +var x=new Array(this.getWidth()/6.4,this.getWidth()/2.6,this.getWidth()/1.87,this.getWidth()/1.32,this.getWidth()/1.87,this.getWidth()/2.6); +var y=new Array(this.getHeight()/1.36,this.getHeight()/1.95,this.getHeight()/1.36,this.getHeight()/3.46,this.getHeight()/1.73,this.getHeight()/2.8); +this.graphics.setColor("#ffffff"); +this.graphics.fillPolygon(x,y); +this.graphics.setColor("#000000"); +this.graphics.drawPolygon(x,y); +this.graphics.paint(); +}; + + diff --git a/workflow/engine/templates/bpmn/EventInterSignal.js b/workflow/engine/templates/bpmn/EventInterSignal.js new file mode 100755 index 000000000..877906e6b --- /dev/null +++ b/workflow/engine/templates/bpmn/EventInterSignal.js @@ -0,0 +1,78 @@ +bpmnEventInterSignal=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=2; +}; +bpmnEventInterSignal.prototype=new VectorFigure; +bpmnEventInterSignal.prototype.type="bpmnEventInterSignal"; +bpmnEventInterSignal.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +this.graphics.setStroke(this.stroke); +var x_cir = 0; +var y_cir = 0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir+3,y_cir+3,this.getWidth(),this.getHeight()); + +this.graphics.setColor("#f9faf2"); +this.graphics.fillEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); + +var x_cir2=5; +var y_cir2=5; +this.graphics.setColor("#f9faf2"); +this.graphics.fillEllipse(x_cir2,y_cir2,this.getWidth()-10,this.getHeight()-10); +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir2,y_cir2,this.getWidth()-10,this.getHeight()-10); +//var x=new Array(12,32,22); +//var y=new Array(32,32,9); +var x=new Array(this.getWidth()/3.75,this.getWidth()/1.4,this.getWidth()/2.04); +var y=new Array(this.getHeight()/1.4,this.getHeight()/1.4,this.getHeight()/5); +this.graphics.setColor("#adae5e"); +this.graphics.fillPolygon(x,y); +this.graphics.setColor("#adae5e"); +this.graphics.drawPolygon(x,y); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventInterSignal.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['input1','input2','output1','output2']; + var eventPortType = ['InputPort','InputPort','OutputPort','OutputPort']; + var eventPositionX= [0,this.width/2,this.width,this.width/2]; + var eventPositionY= [this.height/2,0,this.height/2,this.height]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventInterSignal.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventLinkEnd.js b/workflow/engine/templates/bpmn/EventLinkEnd.js new file mode 100755 index 000000000..f354ccca1 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventLinkEnd.js @@ -0,0 +1,26 @@ +bpmnEventLinkEnd=function(){ +VectorFigure.call(this); +this.setDimension(45,45); +this.stroke=3; +}; +bpmnEventLinkEnd.prototype=new VectorFigure; +bpmnEventLinkEnd.prototype.type="bpmnEventLinkEnd"; +bpmnEventLinkEnd.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +var x_cir = -4; +var y_cir = -4; +this.graphics.setStroke(this.stroke); +this.graphics.setColor("#000000"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +//var x_arrow=new Array(4,4,22,22,37,22,22); //Arrow working +//var y_arrow=new Array(11,26,26,31,18.5,6,11); +var x_arrow=new Array(4,4,this.getWidth()/2,this.getWidth()/2,this.getWidth()/1.2,this.getWidth()/2,this.getWidth()/2); +var y_arrow=new Array(this.getHeight()/4,this.getHeight()/1.7,this.getHeight()/1.7,this.getHeight()/1.5,this.getHeight()/2.5,this.getHeight()/7,this.getHeight()/4); +this.graphics.setColor( "#000000" ); +this.graphics.fillPolygon(x_arrow,y_arrow); +this.graphics.setColor("#000000"); +this.graphics.drawPolygon(x_arrow,y_arrow); +this.graphics.paint(); +}; + + diff --git a/workflow/engine/templates/bpmn/EventLinkInter.js b/workflow/engine/templates/bpmn/EventLinkInter.js new file mode 100755 index 000000000..a40863b56 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventLinkInter.js @@ -0,0 +1,74 @@ +bpmnEventLinkInter=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=2; +}; +bpmnEventLinkInter.prototype=new VectorFigure; +bpmnEventLinkInter.prototype.type="bpmnEventLinkInter"; +bpmnEventLinkInter.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +var x_cir = -4; +var y_cir = -4; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir+3,y_cir+3,this.getWidth(),this.getHeight()); +this.graphics.setColor("#f9faf2"); +this.graphics.fillEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +this.graphics.setStroke(this.stroke); +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +var x_cir2=-1; +var y_cir2=-1; +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); +//var x_arrow=new Array(4,4,22,22,37,22,22); //Arrow working +//var y_arrow=new Array(11,26,26,31,18.5,6,11); +var x_arrow=new Array(4,4,this.getWidth()/2,this.getWidth()/2,this.getWidth()/1.2,this.getWidth()/2,this.getWidth()/2); +var y_arrow=new Array(this.getHeight()/4,this.getHeight()/1.7,this.getHeight()/1.7,this.getHeight()/1.5,this.getHeight()/2.5,this.getHeight()/7,this.getHeight()/4); +this.graphics.setColor( "#adae5e" ); +this.graphics.fillPolygon(x_arrow,y_arrow); +this.graphics.setColor("#adae5e"); +this.graphics.drawPolygon(x_arrow,y_arrow); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventLinkInter.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ +var eventPortName = ['input1','input2','output1','output2']; + var eventPortType = ['InputPort','InputPort','OutputPort','OutputPort']; + var eventPositionX= [0,this.width/2,this.width,this.width/2]; + var eventPositionY= [this.height/2,0,this.height/2,this.height]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventLinkInter.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventLinkStart.js b/workflow/engine/templates/bpmn/EventLinkStart.js new file mode 100755 index 000000000..ce6cf664e --- /dev/null +++ b/workflow/engine/templates/bpmn/EventLinkStart.js @@ -0,0 +1,32 @@ +bpmnEventLinkStart=function(){ +VectorFigure.call(this); +this.setDimension(45,45); +this.stroke=2 +}; +bpmnEventLinkStart.prototype=new VectorFigure; +bpmnEventLinkStart.prototype.type="bpmnEventLinkStart"; +bpmnEventLinkStart.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); + +var x_cir = -4; +var y_cir = -4; + +this.graphics.setStroke(this.stroke); + +this.graphics.setColor("#000000"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); + +//var x_arrow=new Array(4,4,22,22,37,22,22); //Arrow working +//var y_arrow=new Array(11,26,26,31,18.5,6,11); +var x_arrow=new Array(4,4,this.getWidth()/2,this.getWidth()/2,this.getWidth()/1.2,this.getWidth()/2,this.getWidth()/2); +var y_arrow=new Array(this.getHeight()/4,this.getHeight()/1.7,this.getHeight()/1.7,this.getHeight()/1.5,this.getHeight()/2.5,this.getHeight()/7,this.getHeight()/4); +this.graphics.setColor( "#ffffff" ); +this.graphics.fillPolygon(x_arrow,y_arrow); + +this.graphics.setColor("#000000"); +this.graphics.drawPolygon(x_arrow,y_arrow); + +this.graphics.paint(); +}; + + diff --git a/workflow/engine/templates/bpmn/EventMessageEnd.js b/workflow/engine/templates/bpmn/EventMessageEnd.js new file mode 100755 index 000000000..25acaa2d3 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventMessageEnd.js @@ -0,0 +1,83 @@ +bpmnEventMessageEnd=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke = 3; +}; +bpmnEventMessageEnd.prototype=new VectorFigure; +bpmnEventMessageEnd.prototype.type="bpmnEventMessageEnd"; +bpmnEventMessageEnd.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +if (this.getWidth() < 30 || this.getHeight() < 30) { + this.setDimension(30, 30); + } +var x_cir = 0; +var y_cir = 0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir+5,y_cir+5,this.getWidth(),this.getHeight()); + +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#f7f1e5"); +this.graphics.fillEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +this.graphics.setColor("#c46508"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +this.graphics.setStroke(2); +//var x=new Array(12,12,35,35,23.5,12); +//var y=new Array(16,33,33,17,26,17); +var x=new Array(this.getWidth()/3.75,this.getWidth()/3.75,this.getWidth()/1.28,this.getWidth()/1.28,this.getWidth()/2,this.getWidth()/3.75,this.getWidth()/3.75); +var y=new Array(this.getHeight()/3.21,this.getHeight()/1.36,this.getHeight()/1.36,this.getHeight()/2.64,this.getHeight()/1.73,this.getHeight()/2.64); +this.graphics.setColor( "#c46508" ); +this.graphics.fillPolygon(x,y); +this.graphics.setColor("#c46508"); +//this.graphics.drawPolygon(x,y); +//var x_tri=new Array(12,23.5,35); +//var y_tri=new Array(13,22,13); +var x_tri=new Array(this.getWidth()/3.75,this.getWidth()/1.91,this.getWidth()/1.28); +var y_tri=new Array(this.getHeight()/3.46,this.getHeight()/2.04,this.getHeight()/3.46); +this.graphics.setColor( "#c46508" ); +this.graphics.fillPolygon(x_tri,y_tri); +this.graphics.setColor("#c46508"); +//this.graphics.drawPolygon(x_tri,y_tri); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventMessageEnd.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['input1','input2']; + var eventPortType = ['InputPort','InputPort']; + var eventPositionX= [this.width/2,0]; + var eventPositionY= [0,this.height/2]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventMessageEnd.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventMessageInter.js b/workflow/engine/templates/bpmn/EventMessageInter.js new file mode 100755 index 000000000..a8282240b --- /dev/null +++ b/workflow/engine/templates/bpmn/EventMessageInter.js @@ -0,0 +1,55 @@ +bpmnEventMessageInter=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=2; +}; +bpmnEventMessageInter.prototype=new VectorFigure; +bpmnEventMessageInter.prototype.type="bpmnEventMessageInter"; +bpmnEventMessageInter.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); + +var x_cir = 0; +var y_cir = 0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir+3,y_cir+3,this.getWidth(),this.getHeight()); +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#f9faf2"); +this.graphics.fillEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); + +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); + +var x_cir2=3; +var y_cir2=3; + +this.graphics.setColor( "#f9faf2" ); +this.graphics.fillEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); + +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); +//var x=new Array(12,12,32,32,22,12,32); +//var y=new Array(14,31,31,14,23,14,14); +var x=new Array(this.getWidth()/3.75,this.getWidth()/3.75,this.getWidth()/1.28,this.getWidth()/1.28,this.getWidth()/2,this.getWidth()/3.75,this.getWidth()/3.75); +var y=new Array(this.getHeight()/3.21,this.getHeight()/1.36,this.getHeight()/1.36,this.getHeight()/2.64,this.getHeight()/1.73,this.getHeight()/2.64); +this.graphics.setStroke(1); +this.graphics.setColor( "#adae5e" ); +//this.graphics.fillPolygon(x,y); +this.graphics.setColor("#adae5e"); +this.graphics.drawPolygon(x,y); +//var x_tri=new Array(12,23.5,35); +//var y_tri=new Array(13,22,13); +var x_tri=new Array(this.getWidth()/3.75,this.getWidth()/1.91,this.getWidth()/1.28); +var y_tri=new Array(this.getHeight()/3.46,this.getHeight()/2.04,this.getHeight()/3.46); +this.graphics.setColor( "#adae5e" ); +//this.graphics.fillPolygon(x_tri,y_tri); +this.graphics.setColor("#adae5e"); +this.graphics.drawPolygon(x_tri,y_tri); +this.graphics.paint(); +}; + +bpmnEventMessageInter.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventMessageRecInter.js b/workflow/engine/templates/bpmn/EventMessageRecInter.js new file mode 100755 index 000000000..5dac553be --- /dev/null +++ b/workflow/engine/templates/bpmn/EventMessageRecInter.js @@ -0,0 +1,90 @@ +bpmnEventMessageRecInter=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=2; +}; +bpmnEventMessageRecInter.prototype=new VectorFigure; +bpmnEventMessageRecInter.prototype.type="bpmnEventMessageRecInter"; +bpmnEventMessageRecInter.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); + +var x_cir = 0; +var y_cir = 0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir+3,y_cir+3,this.getWidth(),this.getHeight()); +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#f9faf2"); +this.graphics.fillEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); + +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); + +var x_cir2=3; +var y_cir2=3; + +this.graphics.setColor( "#f9faf2" ); +this.graphics.fillEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); + +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); +//var x=new Array(12,12,32,32,22,12,32); +//var y=new Array(14,31,31,14,23,14,14); +var x=new Array(this.getWidth()/3.75,this.getWidth()/3.75,this.getWidth()/1.28,this.getWidth()/1.28,this.getWidth()/1.95,this.getWidth()/3.75); +var y=new Array(this.getHeight()/2.64,this.getHeight()/1.36,this.getHeight()/1.36,this.getHeight()/2.64,this.getHeight()/1.73,this.getHeight()/2.64); +this.graphics.setStroke(1); +this.graphics.setColor( "#adae5e" ); +//this.graphics.fillPolygon(x,y); +this.graphics.setColor("#adae5e"); +this.graphics.drawPolygon(x,y); +//var x_tri=new Array(12,23.5,35); +//var y_tri=new Array(13,22,13); +var x_tri=new Array(this.getWidth()/3.75,this.getWidth()/1.91,this.getWidth()/1.28); +var y_tri=new Array(this.getHeight()/3.46,this.getHeight()/2.04,this.getHeight()/3.46); +this.graphics.setColor( "#adae5e" ); +//this.graphics.fillPolygon(x_tri,y_tri); +this.graphics.setColor("#adae5e"); +this.graphics.drawPolygon(x_tri,y_tri); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventMessageRecInter.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['input1','input2','output1','output2']; + var eventPortType = ['InputPort','InputPort','OutputPort','OutputPort']; + var eventPositionX= [0,this.width/2,this.width,this.width/2]; + var eventPositionY= [this.height/2,0,this.height/2,this.height]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventMessageRecInter.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventMessageSendInter.js b/workflow/engine/templates/bpmn/EventMessageSendInter.js new file mode 100755 index 000000000..69b4213b1 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventMessageSendInter.js @@ -0,0 +1,91 @@ +bpmnEventMessageSendInter=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=2; +}; +bpmnEventMessageSendInter.prototype=new VectorFigure; +bpmnEventMessageSendInter.prototype.type="bpmnEventMessageSendInter"; +bpmnEventMessageSendInter.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); + +var x_cir = 0; +var y_cir = 0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir+3,y_cir+3,this.getWidth(),this.getHeight()); +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#f9faf2"); +this.graphics.fillEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); + +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); + +var x_cir2=3; +var y_cir2=3; + +this.graphics.setColor( "#f9faf2" ); +this.graphics.fillEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); + +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); +//var x=new Array(12,12,32,32,22,12,32); +//var y=new Array(14,31,31,14,23,14,14); +var x=new Array(this.getWidth()/3.75,this.getWidth()/3.75,this.getWidth()/1.28,this.getWidth()/1.28,this.getWidth()/1.95,this.getWidth()/3.75); +var y=new Array(this.getHeight()/2.64,this.getHeight()/1.36,this.getHeight()/1.36,this.getHeight()/2.64,this.getHeight()/1.73,this.getHeight()/2.64); +this.graphics.setStroke(1); +this.graphics.setColor( "#adae5e" ); +this.graphics.fillPolygon(x,y); +this.graphics.setColor("#adae5e"); +//this.graphics.drawPolygon(x,y); +//var x_tri=new Array(12,23.5,35); +//var y_tri=new Array(13,22,13); +var x_tri=new Array(this.getWidth()/3.75,this.getWidth()/1.91,this.getWidth()/1.28); +var y_tri=new Array(this.getHeight()/3.46,this.getHeight()/2.04,this.getHeight()/3.46); +this.graphics.setColor( "#adae5e" ); +this.graphics.fillPolygon(x_tri,y_tri); +this.graphics.setColor("#adae5e"); +//this.graphics.drawPolygon(x_tri,y_tri); +this.graphics.paint(); + + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventMessageSendInter.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['input1','input2','output1','output2']; + var eventPortType = ['InputPort','InputPort','OutputPort','OutputPort']; + var eventPositionX= [0,this.width/2,this.width,this.width/2]; + var eventPositionY= [this.height/2,0,this.height/2,this.height]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventMessageSendInter.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventMessageStart.js b/workflow/engine/templates/bpmn/EventMessageStart.js new file mode 100755 index 000000000..6cb1fa7de --- /dev/null +++ b/workflow/engine/templates/bpmn/EventMessageStart.js @@ -0,0 +1,84 @@ +bpmnEventMessageStart=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke = 3; +}; +bpmnEventMessageStart.prototype=new VectorFigure; +bpmnEventMessageStart.prototype.type="bpmnEventMessageStart"; +bpmnEventMessageStart.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +if (this.getWidth() < 30 || this.getHeight() < 30) { + this.setDimension(30, 30); + } +var x_cir = 0; +var y_cir = 0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir+5,y_cir+5,this.getWidth(),this.getHeight()); + +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#e4f7df"); +this.graphics.fillEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +this.graphics.setColor("#4aa533"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +this.graphics.setStroke(0); +//var x=new Array(12,12,35,35,23.5,12); +//var y=new Array(16,33,33,17,26,17); +var x=new Array(this.getWidth()/3.75,this.getWidth()/3.75,this.getWidth()/1.28,this.getWidth()/1.28,this.getWidth()/1.91,this.getWidth()/3.75); +var y=new Array(this.getHeight()/2.64,this.getHeight()/1.36,this.getHeight()/1.36,this.getHeight()/2.8,this.getHeight()/1.7,this.getHeight()/2.8); +this.graphics.setColor( "#4aa533" ); +//this.graphics.fillPolygon(x,y); +this.graphics.setColor("#4aa533"); +this.graphics.drawPolygon(x,y); +//var x_tri=new Array(12,23.5,35); +//var y_tri=new Array(13,22,13); +var x_tri=new Array(this.getWidth()/3.75,this.getWidth()/1.91,this.getWidth()/1.28); +var y_tri=new Array(this.getHeight()/3.46,this.getHeight()/2.04,this.getHeight()/3.46); +this.graphics.setColor( "#e4f7df" ); +//this.graphics.fillPolygon(x_tri,y_tri); +this.graphics.setColor("#4aa533"); +this.graphics.drawPolygon(x_tri,y_tri); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventMessageStart.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['output1','output2']; + var eventPortType = ['OutputPort','OutputPort']; + var eventPositionX= [this.width/2,this.width]; + var eventPositionY= [this.height,this.height/2]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventMessageStart.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; + diff --git a/workflow/engine/templates/bpmn/EventMulStart.js b/workflow/engine/templates/bpmn/EventMulStart.js new file mode 100755 index 000000000..d6ac1d6c4 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventMulStart.js @@ -0,0 +1,70 @@ +bpmnEventMulStart=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke= 2; +}; +bpmnEventMulStart.prototype=new VectorFigure; +bpmnEventMulStart.prototype.type="bpmnEventMulStart"; +bpmnEventMulStart.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +var x=0; +var y=0; +this.graphics.setStroke(this.stroke); +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x+3,y+3,this.getWidth(),this.getHeight()); +this.graphics.setColor( "#e4f7df" ); +this.graphics.fillEllipse(x,y,this.getWidth(),this.getHeight()); +this.graphics.setColor("#4aa533"); +this.graphics.drawEllipse(x,y,this.getWidth(),this.getHeight()); +//var x_penta=new Array(13,28,36,22,8);(8.5,18.5,24,14.5,5 +//var y_penta=new Array(33,33,18,8,18);(22,22,12,5,12 +var x_penta=new Array(this.getWidth()/3.5,this.getWidth()/1.6,this.getWidth()/1.25,this.getWidth()/2,this.getWidth()/5.6); +var y_penta=new Array(this.getHeight()/1.36,this.getHeight()/1.36,this.getHeight()/2.5,this.getHeight()/5.6,this.getHeight()/2.5); +//this.graphics.setStroke(1); +this.graphics.setColor( "#4aa533" ); +this.graphics.fillPolygon(x_penta,y_penta); +this.graphics.setColor("#4aa533"); +this.graphics.drawPolygon(x_penta,y_penta); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventMulStart.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['output1','output2']; + var eventPortType = ['OutputPort','OutputPort']; + var eventPositionX= [this.width/2,this.width]; + var eventPositionY= [this.height,this.height/2]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventMulStart.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventMultipleEnd.js b/workflow/engine/templates/bpmn/EventMultipleEnd.js new file mode 100755 index 000000000..52dee62a9 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventMultipleEnd.js @@ -0,0 +1,72 @@ +bpmnEventMultipleEnd=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=2; +}; +bpmnEventMultipleEnd.prototype=new VectorFigure; +bpmnEventMultipleEnd.prototype.type="bpmnEventMultipleEnd"; +bpmnEventMultipleEnd.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +VectorFigure.prototype.paint.call(this); +this.graphics.setStroke(this.stroke); +var x_cir = 0; +var y_cir = 0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir+5,y_cir+5,this.getWidth(),this.getHeight()); +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#f7f1e5" ); +this.graphics.fillEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +this.graphics.setColor("#c46508"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +//var x_penta=new Array(12.5,27.5,35.5,21.5,8); +//var y_penta=new Array(33,33,18,8,18); +var x_penta=new Array(this.getWidth()/3.6,this.getWidth()/1.63,this.getWidth()/1.26,this.getWidth()/2.14,this.getWidth()/5.6); +var y_penta=new Array(this.getHeight()/1.36,this.getHeight()/1.36,this.getHeight()/2.5,this.getHeight()/5.6,this.getHeight()/2.5); +this.graphics.setColor( "#c46508" ); +this.graphics.fillPolygon(x_penta,y_penta); +this.graphics.setColor("#c46508"); +//this.graphics.drawPolygon(x_penta,y_penta); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventMultipleEnd.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['input1','input2']; + var eventPortType = ['InputPort','InputPort']; + var eventPositionX= [this.width/2,0]; + var eventPositionY= [0,this.height/2]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventMultipleEnd.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventMultipleInter.js b/workflow/engine/templates/bpmn/EventMultipleInter.js new file mode 100755 index 000000000..12ca447c5 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventMultipleInter.js @@ -0,0 +1,77 @@ +bpmnEventMultipleInter=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=2 +}; +bpmnEventMultipleInter.prototype=new VectorFigure; +bpmnEventMultipleInter.prototype.type="bpmnEventMultipleInter"; +bpmnEventMultipleInter.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +this.graphics.setStroke(this.stroke); +var x_cir = 0; +var y_cir = 0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir+3,y_cir+3,this.getWidth(),this.getHeight()); + +this.graphics.setColor("#f9faf2"); +this.graphics.fillEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +var x_cir2=3; +var y_cir2=3; +this.graphics.setColor("#f9faf2"); +this.graphics.fillEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); +//var x_penta=new Array(13.5,28.5,37.5,23.1,9); +//var y_penta=new Array(33,33,18,8,18); +var x_penta=new Array(this.getWidth()/3.46,this.getWidth()/1.57,this.getWidth()/1.2,this.getWidth()/1.95,this.getWidth()/5); +var y_penta=new Array(this.getHeight()/1.36,this.getHeight()/1.36,this.getHeight()/2.5,this.getHeight()/5,this.getHeight()/2.5); +this.graphics.setColor( "#adae5e" ); +this.graphics.fillPolygon(x_penta,y_penta); +this.graphics.setColor("#adae5e"); +this.graphics.drawPolygon(x_penta,y_penta); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventMultipleInter.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['input1','input2','output1','output2']; + var eventPortType = ['InputPort','InputPort','OutputPort','OutputPort']; + var eventPositionX= [0,this.width/2,this.width,this.width/2]; + var eventPositionY= [this.height/2,0,this.height/2,this.height]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventMultipleInter.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventRuleInter.js b/workflow/engine/templates/bpmn/EventRuleInter.js new file mode 100755 index 000000000..55319f2e7 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventRuleInter.js @@ -0,0 +1,79 @@ +bpmnEventRuleInter=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke = 2; +}; +bpmnEventRuleInter.prototype=new VectorFigure; +bpmnEventRuleInter.prototype.type="bpmnEventRuleInter"; +bpmnEventRuleInter.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +var x_cir1=0; +var y_cir1=0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir1+3,y_cir1+3,this.getWidth(),this.getHeight()); + +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#f9faf2" ); +this.graphics.fillEllipse(x_cir1,y_cir1,this.getWidth(),this.getHeight()); +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir1,y_cir1,this.getWidth(),this.getHeight()); +var x_cir2=3; +var y_cir2=3; +this.graphics.setColor( "#f9faf2" ); +this.graphics.fillEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); +var x=new Array(12,12,this.getWidth()-10,this.getWidth()-10); +var y=new Array(10,this.getHeight()-10,this.getHeight()-10,10); +//this.graphics.setColor("#adae5e"); +//this.graphics.fillPolygon(x,y); +this.graphics.setColor("#adae5e"); +this.graphics.drawPolygon(x,y); +this.graphics.drawLine(14,this.getHeight()/1.5,this.getWidth()-10,this.getHeight()/1.5); +this.graphics.drawLine(14,this.getHeight()/2,this.getWidth()-10,this.getHeight()/2); +this.graphics.drawLine(14,this.getHeight()/3,this.getWidth()-10,this.getHeight()/3); +this.graphics.drawLine(14,this.getHeight()/4,this.getWidth()-10,this.getHeight()/4); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventRuleInter.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['input1','input2','output1','output2']; + var eventPortType = ['InputPort','InputPort','OutputPort','OutputPort']; + var eventPositionX= [0,this.width/2,this.width,this.width/2]; + var eventPositionY= [this.height/2,0,this.height/2,this.height]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventRuleInter.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventRuleStart.js b/workflow/engine/templates/bpmn/EventRuleStart.js new file mode 100755 index 000000000..80e55083d --- /dev/null +++ b/workflow/engine/templates/bpmn/EventRuleStart.js @@ -0,0 +1,73 @@ +bpmnEventRuleStart=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke = 2; +}; +bpmnEventRuleStart.prototype=new VectorFigure; +bpmnEventRuleStart.prototype.type="bpmnEventRuleStart"; +bpmnEventRuleStart.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +var x_cir = 0; +var y_cir = 0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir+5,y_cir+5,this.getWidth(),this.getHeight()); +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#e4f7df"); +this.graphics.fillEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +this.graphics.setColor("#4aa533"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +this.graphics.setStroke(1); +var x=new Array(12,12,this.getWidth()-10,this.getWidth()-10); +var y=new Array(10,this.getHeight()-10,this.getHeight()-10,10); +//this.graphics.setColor("#adae5e"); +//this.graphics.fillPolygon(x,y); +this.graphics.setColor("#4aa533"); +this.graphics.drawPolygon(x,y); +this.graphics.drawLine(14,this.getHeight()/1.5,this.getWidth()-10,this.getHeight()/1.5); +this.graphics.drawLine(14,this.getHeight()/2,this.getWidth()-10,this.getHeight()/2); +this.graphics.drawLine(14,this.getHeight()/3,this.getWidth()-10,this.getHeight()/3); +this.graphics.drawLine(14,this.getHeight()/4,this.getWidth()-10,this.getHeight()/4); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventRuleStart.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['output1','output2']; + var eventPortType = ['OutputPort','OutputPort']; + var eventPositionX= [this.width/2,this.width]; + var eventPositionY= [this.height,this.height/2]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventRuleStart.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventSignalStart.js b/workflow/engine/templates/bpmn/EventSignalStart.js new file mode 100755 index 000000000..0be3ec93a --- /dev/null +++ b/workflow/engine/templates/bpmn/EventSignalStart.js @@ -0,0 +1,70 @@ +bpmnEventSignalStart=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=2; +}; +bpmnEventSignalStart.prototype=new VectorFigure; +bpmnEventSignalStart.prototype.type="bpmnEventSignalStart"; +bpmnEventSignalStart.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +var x=0; +var y=0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x+5,y+5,this.getWidth(),this.getHeight()); +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#e4f7df" ); +this.graphics.fillEllipse(x,y,this.getWidth(),this.getHeight()); +this.graphics.setColor("#4aa533"); +this.graphics.drawEllipse(x,y,this.getWidth(),this.getHeight()); +//var x=new Array(5,41,23); +//var y=new Array(35,35,0); +var x=new Array(5,this.getWidth()-4,this.getWidth()/2); +var y=new Array(this.getHeight()-10,this.getHeight()-10,2); +this.graphics.setColor("#4aa533"); +//this.graphics.fillPolygon(x,y); +this.graphics.setColor("#4aa533"); +this.graphics.drawPolygon(x,y); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventSignalStart.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['output1','output2']; + var eventPortType = ['OutputPort','OutputPort']; + var eventPositionX= [this.width/2,this.width]; + var eventPositionY= [this.height,this.height/2]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventSignalStart.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventTerminateEnd.js b/workflow/engine/templates/bpmn/EventTerminateEnd.js new file mode 100755 index 000000000..5a62a4350 --- /dev/null +++ b/workflow/engine/templates/bpmn/EventTerminateEnd.js @@ -0,0 +1,70 @@ +bpmnEventTerminate=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke=2; +}; +bpmnEventTerminate.prototype=new VectorFigure; +bpmnEventTerminate.prototype.type="bpmnEventTerminateEnd"; +bpmnEventTerminate.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +VectorFigure.prototype.paint.call(this); +this.graphics.setStroke(this.stroke); +var x_cir = 0; +var y_cir = 0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir+5,y_cir+5,this.getWidth(),this.getHeight()); +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#f7f1e5" ); +this.graphics.fillEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +this.graphics.setColor("#c46508"); +this.graphics.drawEllipse(x_cir,y_cir,this.getWidth(),this.getHeight()); +var x_cir2=5; +var y_cir2=5; +this.graphics.setColor("#c46508"); +this.graphics.fillEllipse(x_cir2,y_cir2,this.getWidth()-10,this.getHeight()-10); +this.graphics.setColor("#c46508"); +this.graphics.drawEllipse(x_cir2,y_cir2,this.getWidth()-10,this.getHeight()-10); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventTerminate.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['input1','input2']; + var eventPortType = ['InputPort','InputPort']; + var eventPositionX= [this.width/2,0]; + var eventPositionY= [0,this.height/2]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } + } +}; + +bpmnEventTerminate.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventTimerInter.js b/workflow/engine/templates/bpmn/EventTimerInter.js new file mode 100755 index 000000000..168c6f54d --- /dev/null +++ b/workflow/engine/templates/bpmn/EventTimerInter.js @@ -0,0 +1,77 @@ +bpmnEventTimerInter=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke = 2; +}; +bpmnEventTimerInter.prototype=new VectorFigure; +bpmnEventTimerInter.prototype.type="bpmnEventTimerInter"; +bpmnEventTimerInter.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +var x_cir1=0; +var y_cir1=0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir1+3,y_cir1+3,this.getWidth(),this.getHeight()); + +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#f9faf2" ); +this.graphics.fillEllipse(x_cir1,y_cir1,this.getWidth(),this.getHeight()); +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir1,y_cir1,this.getWidth(),this.getHeight()); +var x_cir2=3; +var y_cir2=3; +this.graphics.setColor( "#f9faf2" ); +this.graphics.fillEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); +this.graphics.setColor("#adae5e"); +this.graphics.drawEllipse(x_cir2,y_cir2,this.getWidth()-6,this.getHeight()-6); +//var x_cir3=10; +//var y_cir3=10; +//this.graphics.setColor( "#f9faf2" ); +//this.graphics.fillEllipse(x_cir3,y_cir3,this.getWidth()-20,this.getHeight()-20); +this.graphics.setColor("#adae5e"); +//this.graphics.drawEllipse(x_cir3,y_cir3,this.getWidth()-20,this.getHeight()-20); +this.graphics.drawLine(this.getWidth()/2,this.getHeight()/2,this.getWidth()/1.3,this.getHeight()/2); +this.graphics.drawLine(this.getWidth()/2,this.getHeight()/2,this.getWidth()/2,this.getHeight()/4.5); +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventTimerInter.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['input1','input2','output1','output2']; + var eventPortType = ['InputPort','InputPort','OutputPort','OutputPort']; + var eventPositionX= [0,this.width/2,this.width,this.width/2]; + var eventPositionY= [this.height/2,0,this.height/2,this.height]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventTimerInter.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/EventTimerStart.js b/workflow/engine/templates/bpmn/EventTimerStart.js new file mode 100755 index 000000000..d036d9e4f --- /dev/null +++ b/workflow/engine/templates/bpmn/EventTimerStart.js @@ -0,0 +1,70 @@ +bpmnEventTimerStart=function(){ +VectorFigure.call(this); +this.setDimension(30,30); +this.stroke = 2; +}; +bpmnEventTimerStart.prototype=new VectorFigure; +bpmnEventTimerStart.prototype.type="bpmnEventTimerStart"; +bpmnEventTimerStart.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +var x_cir1=0; +var y_cir1=0; + +this.graphics.setColor("#c0c0c0"); +this.graphics.fillEllipse(x_cir1+5,y_cir1+5,this.getWidth(),this.getHeight()); +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#e4f7df" ); +this.graphics.fillEllipse(x_cir1,y_cir1,this.getWidth(),this.getHeight()); +this.graphics.setColor("#4aa533"); +this.graphics.drawEllipse(x_cir1,y_cir1,this.getWidth(),this.getHeight()); +var x_cir2=5; +var y_cir2=5; +this.graphics.setColor( "#e4f7df" ); +this.graphics.fillEllipse(x_cir2,y_cir2,this.getWidth()-10,this.getHeight()-10); +this.graphics.setColor("#4aa533"); +this.graphics.drawEllipse(x_cir2,y_cir2,this.getWidth()-10,this.getHeight()-10); +this.graphics.drawLine(this.getWidth()/2,this.getHeight()/2,this.getWidth()/1.3,this.getHeight()/2); //horizontal line +this.graphics.drawLine(this.getWidth()/2,this.getHeight()/2,this.getWidth()/2,this.getHeight()/4.5); //vertical line +this.graphics.paint(); + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ +if(this.input1!=null){ +this.input1.setPosition(0,this.height/2); +} +if(this.output1!=null){ +this.output1.setPosition(this.width/2,this.height); +} +if(this.input2!=null){ +this.input2.setPosition(this.width/2,0); +} +if(this.output2!=null){ +this.output2.setPosition(this.width,this.height/2); +} +}; + +bpmnEventTimerStart.prototype.setWorkflow=function(_40c5){ +VectorFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null){ + var eventPortName = ['output1','output2']; + var eventPortType = ['OutputPort','OutputPort']; + var eventPositionX= [this.width/2,this.width]; + var eventPositionY= [this.height,this.height/2]; + + for(var i=0; i< eventPortName.length ; i++){ + eval('this.'+eventPortName[i]+' = new '+eventPortType[i]+'()'); //Create New Port + eval('this.'+eventPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+eventPortName[i]+'.setName("'+eventPortName[i]+'")'); //Set PortName + eval('this.'+eventPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+eventPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+eventPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+eventPortName[i]+','+eventPositionX[i]+', '+eventPositionY[i]+')'); //Setting Position of the port + } +} +}; + +bpmnEventTimerStart.prototype.getContextMenu=function(){ +if(this.id != null){ + this.workflow.handleContextMenu(this); +} +}; diff --git a/workflow/engine/templates/bpmn/Ext.ux.XHRUpload.js b/workflow/engine/templates/bpmn/Ext.ux.XHRUpload.js new file mode 100755 index 000000000..2713897ac --- /dev/null +++ b/workflow/engine/templates/bpmn/Ext.ux.XHRUpload.js @@ -0,0 +1,138 @@ + +/* +Awesome Uploader +Ext.ux.XHRUpload JavaScript Class + +Copyright (c) 2010, Andrew Rymarczyk +All rights reserved. + +Redistribution and use in source and minified, compiled or otherwise obfuscated +form, with or without modification, are permitted provided that the following +conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in minified, compiled or otherwise obfuscated form must + reproduce the above copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other materials + provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +// API Specs: +// http://www.w3.org/TR/XMLHttpRequest/ +// http://www.w3.org/TR/XMLHttpRequest2/ +// http://www.w3.org/TR/progress-events/ + +// Browser Implementation Details: +// FROM: https://developer.mozilla.org/en/DOM/File +// https://developer.mozilla.org/en/Using_files_from_web_applications +// https://developer.mozilla.org/En/DragDrop/DataTransfer +// https://developer.mozilla.org/en/DOM/FileList +// "NOTE: The File object as implemented by Gecko offers several non-standard methods for reading the contents of the file. These should not be used, as they will prevent your web application from being used in other browsers, as well as in future versions of Gecko, which will likely remove these methods." +// NOTE: fileObj.getAsBinary() is deprecated according to the mozilla docs! + +// Can optionally follow RFC2388 +// RFC2388 - Returning Values from Forms: multipart/form-data +// http://www.faqs.org/rfcs/rfc2388.html +// This allows additional POST params to be sent with file upload, and also simplifies the backend upload handler becuase a single script can be used for drag and drop, flash, and standard uploads +// NOTE: This is currently only supported by Firefox 1.6, Chrome 6 should be released soon and will also be supported. + +Ext.ns('Ext.ux'); + +Ext.ux.XHRUpload = function(config){ + Ext.apply(this, config, { + method: 'POST' + ,fileNameHeader: 'X-File-Name' + ,filePostName:'fileName' + ,contentTypeHeader: 'text/plain; charset=x-user-defined-binary' + ,extraPostData:{} + ,xhrExtraPostDataPrefix:'extraPostData_' + ,sendMultiPartFormData:false + }); + this.addEvents( //extend the xhr's progress events to here + 'loadstart', + 'progress', + 'abort', + 'error', + 'load', + 'loadend' + ); + Ext.ux.XHRUpload.superclass.constructor.call(this); +}; + +Ext.extend(Ext.ux.XHRUpload, Ext.util.Observable,{ + send:function(config){ + Ext.apply(this, config); + + this.xhr = new XMLHttpRequest(); + this.xhr.addEventListener('loadstart', this.relayXHREvent.createDelegate(this), false); + this.xhr.addEventListener('progress', this.relayXHREvent.createDelegate(this), false); + this.xhr.addEventListener('progressabort', this.relayXHREvent.createDelegate(this), false); + this.xhr.addEventListener('error', this.relayXHREvent.createDelegate(this), false); + this.xhr.addEventListener('load', this.relayXHREvent.createDelegate(this), false); + this.xhr.addEventListener('loadend', this.relayXHREvent.createDelegate(this), false); + + this.xhr.upload.addEventListener('loadstart', this.relayUploadEvent.createDelegate(this), false); + this.xhr.upload.addEventListener('progress', this.relayUploadEvent.createDelegate(this), false); + this.xhr.upload.addEventListener('progressabort', this.relayUploadEvent.createDelegate(this), false); + this.xhr.upload.addEventListener('error', this.relayUploadEvent.createDelegate(this), false); + this.xhr.upload.addEventListener('load', this.relayUploadEvent.createDelegate(this), false); + this.xhr.upload.addEventListener('loadend', this.relayUploadEvent.createDelegate(this), false); + + this.xhr.open(this.method, this.url, true); + + if(typeof(FileReader) !== 'undefined' && this.sendMultiPartFormData ){ + //currently this is firefox only, chrome 6 will support this in the future + this.reader = new FileReader(); + this.reader.addEventListener('load', this.sendFileUpload.createDelegate(this), false); + this.reader.readAsBinaryString(this.file); + return true; + } + //This will work in both Firefox 1.6 and Chrome 5 + this.xhr.overrideMimeType(this.contentTypeHeader); + this.xhr.setRequestHeader(this.fileNameHeader, this.file.name); + for(attr in this.extraPostData){ + this.xhr.setRequestHeader(this.xhrExtraPostDataPrefix + attr, this.extraPostData[attr]); + } + //xhr.setRequestHeader('X-File-Size', files.size); //this may be useful + this.xhr.send(this.file); + return true; + + } + ,sendFileUpload:function(){ + + var boundary = (1000000000000+Math.floor(Math.random()*8999999999998)).toString(), + data = ''; + + for(attr in this.extraPostData){ + data += '--'+boundary + '\r\nContent-Disposition: form-data; name="' + attr + '"\r\ncontent-type: text/plain;\r\n\r\n'+this.extraPostData[attr]+'\r\n'; + } + + //window.btoa(binaryData) + //Creates a base-64 encoded ASCII string from a string of binary data. + //https://developer.mozilla.org/en/DOM/window.btoa + //Firefox and Chrome only!! + + data += '--'+boundary + '\r\nContent-Disposition: form-data; name="' + this.filePostName + '"; filename="' + this.file.name + '"\r\nContent-Type: '+this.file.type+'\r\nContent-Transfer-Encoding: base64\r\n\r\n' + window.btoa(this.reader.result) + '\r\n'+'--'+boundary+'--\r\n\r\n'; + + this.xhr.setRequestHeader('Content-Type', 'multipart/form-data; boundary='+boundary); + this.xhr.send(data); + } + ,relayUploadEvent:function(event){ + this.fireEvent('upload'+event.type, event); + } + ,relayXHREvent:function(event){ + this.fireEvent(event.type, event); + } +}); diff --git a/workflow/engine/templates/bpmn/Ext.ux.form.FileUploadField.js b/workflow/engine/templates/bpmn/Ext.ux.form.FileUploadField.js new file mode 100755 index 000000000..7ee9c1b44 --- /dev/null +++ b/workflow/engine/templates/bpmn/Ext.ux.form.FileUploadField.js @@ -0,0 +1,182 @@ +/*! + * Ext JS Library 3.2.1 + * Copyright(c) 2006-2010 Ext JS, Inc. + * licensing@extjs.com + * http://www.extjs.com/license + */ +Ext.ns('Ext.ux.form'); + +/** + * @class Ext.ux.form.FileUploadField + * @extends Ext.form.TextField + * Creates a file upload field. + * @xtype fileuploadfield + */ +Ext.ux.form.FileUploadField = Ext.extend(Ext.form.TextField, { + /** + * @cfg {String} buttonText The button text to display on the upload button (defaults to + * 'Browse...'). Note that if you supply a value for {@link #buttonCfg}, the buttonCfg.text + * value will be used instead if available. + */ + buttonText: 'Browse...', + /** + * @cfg {Boolean} buttonOnly True to display the file upload field as a button with no visible + * text field (defaults to false). If true, all inherited TextField members will still be available. + */ + buttonOnly: false, + /** + * @cfg {Number} buttonOffset The number of pixels of space reserved between the button and the text field + * (defaults to 3). Note that this only applies if {@link #buttonOnly} = false. + */ + buttonOffset: 3, + /** + * @cfg {Object} buttonCfg A standard {@link Ext.Button} config object. + */ + + // private + readOnly: true, + + /** + * @hide + * @method autoSize + */ + autoSize: Ext.emptyFn, + + // private + initComponent: function(){ + Ext.ux.form.FileUploadField.superclass.initComponent.call(this); + + this.addEvents( + /** + * @event fileselected + * Fires when the underlying file input field's value has changed from the user + * selecting a new file from the system file selection dialog. + * @param {Ext.ux.form.FileUploadField} this + * @param {String} value The file value returned by the underlying file input field + */ + 'fileselected' + ); + }, + + // private + onRender : function(ct, position){ + Ext.ux.form.FileUploadField.superclass.onRender.call(this, ct, position); + + this.wrap = this.el.wrap({cls:'x-form-field-wrap x-form-file-wrap'}); + this.el.addClass('x-form-file-text'); + this.el.dom.removeAttribute('name'); + this.createFileInput(); + + var btnCfg = Ext.applyIf(this.buttonCfg || {}, { + text: this.buttonText + }); + this.button = new Ext.Button(Ext.apply(btnCfg, { + renderTo: this.wrap, + cls: 'x-form-file-btn' + (btnCfg.iconCls ? ' x-btn-icon' : '') + })); + + if(this.buttonOnly){ + this.el.hide(); + this.wrap.setWidth(this.button.getEl().getWidth()); + } + + this.bindListeners(); + this.resizeEl = this.positionEl = this.wrap; + }, + + bindListeners: function(){ + this.fileInput.on({ + scope: this, + mouseenter: function() { + this.button.addClass(['x-btn-over','x-btn-focus']) + }, + mouseleave: function(){ + this.button.removeClass(['x-btn-over','x-btn-focus','x-btn-click']) + }, + mousedown: function(){ + this.button.addClass('x-btn-click') + }, + mouseup: function(){ + this.button.removeClass(['x-btn-over','x-btn-focus','x-btn-click']) + }, + change: function(){ + var v = this.fileInput.dom.value; + this.setValue(v); + this.fireEvent('fileselected', this, v); + } + }); + }, + + createFileInput : function() { + this.fileInput = this.wrap.createChild({ + id: this.getFileInputId(), + name: this.name||this.getId(), + cls: 'x-form-file', + tag: 'input', + type: 'file', + size: 1 + }); + }, + + reset : function(){ + this.fileInput.remove(); + this.createFileInput(); + this.bindListeners(); + Ext.ux.form.FileUploadField.superclass.reset.call(this); + }, + + // private + getFileInputId: function(){ + return this.id + '-file'; + }, + + // private + onResize : function(w, h){ + Ext.ux.form.FileUploadField.superclass.onResize.call(this, w, h); + + this.wrap.setWidth(w); + + if(!this.buttonOnly){ + var w = this.wrap.getWidth() - this.button.getEl().getWidth() - this.buttonOffset; + this.el.setWidth(w); + } + }, + + // private + onDestroy: function(){ + Ext.ux.form.FileUploadField.superclass.onDestroy.call(this); + Ext.destroy(this.fileInput, this.button, this.wrap); + }, + + onDisable: function(){ + Ext.ux.form.FileUploadField.superclass.onDisable.call(this); + this.doDisable(true); + }, + + onEnable: function(){ + Ext.ux.form.FileUploadField.superclass.onEnable.call(this); + this.doDisable(false); + + }, + + // private + doDisable: function(disabled){ + this.fileInput.dom.disabled = disabled; + this.button.setDisabled(disabled); + }, + + + // private + preFocus : Ext.emptyFn, + + // private + alignErrorIcon : function(){ + this.errorIcon.alignTo(this.wrap, 'tl-tr', [2, 0]); + } + +}); + +Ext.reg('fileuploadfield', Ext.ux.form.FileUploadField); + +// backwards compat +Ext.form.FileUploadField = Ext.ux.form.FileUploadField; diff --git a/workflow/engine/templates/bpmn/FlowConnector.js b/workflow/engine/templates/bpmn/FlowConnector.js new file mode 100755 index 000000000..785728e33 --- /dev/null +++ b/workflow/engine/templates/bpmn/FlowConnector.js @@ -0,0 +1,30 @@ +bpmnFlowConnector=function(){ +Line.call(this); +}; + +bpmnFlowConnector.prototype = new Line; +bpmnFlowConnector.prototype.type = 'bpmnFlowConnector'; +bpmnFlowConnector.prototype.paint=function(){ +if(this.graphics==null){ +this.graphics=new jsGraphics(this.id); +}else{ +this.graphics.clear(); +} +this.graphics.setStroke(this.stroke); +this.graphics.setColor(this.lineColor.getHTMLStyle()); +var endY=this.getLength(); +var _3541=[0,0,endY-this.arrowLength,endY-this.arrowLength,endY,endY-this.arrowLength,endY-this.arrowLength,0]; +var _3542=[-this.lineWidth,+this.lineWidth,+this.lineWidth,this.lineWidth+this.arrowWidth/2,0,-(this.lineWidth+this.arrowWidth/2),-this.lineWidth,-this.lineWidth]; +var _3543=this.getAngle()*Math.PI/180; +var rotX=new Array(); +var rotY=new Array(); +for(var i=0;i<_3541.length;i++){ +rotX[i]=this.startX+_3541[i]*Math.cos(_3543)-_3542[i]*Math.sin(_3543); +rotY[i]=this.startY+_3541[i]*Math.sin(_3543)+_3542[i]*Math.cos(_3543); +} +this.graphics.drawPolyLine(rotX,rotY); +this.graphics.paint(); +}; + + + diff --git a/workflow/engine/templates/bpmn/GatewayComplex.js b/workflow/engine/templates/bpmn/GatewayComplex.js new file mode 100755 index 000000000..09344db12 --- /dev/null +++ b/workflow/engine/templates/bpmn/GatewayComplex.js @@ -0,0 +1,69 @@ +bpmnGatewayComplex=function(width,_30ab){ +VectorFigure.call(this); +this.setDimension(40,40); +this.stroke=2; +}; +bpmnGatewayComplex.prototype=new VectorFigure; +bpmnGatewayComplex.prototype.type="bpmnGatewayComplex"; +bpmnGatewayComplex.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +var x=new Array(0,this.width/2,this.width,this.width/2); +var y=new Array(this.height/2,this.height,this.height/2,0); + +var x2 = new Array(); +var y2 = new Array(); + +for(var i=0;iThis class represents the primary interface of a component based grid control to represent data + * in a tabular format of rows and columns. The GridPanel is composed of the following:

+ *
    + *
  • {@link Ext.data.Store Store} : The Model holding the data records (rows) + *
  • + *
  • {@link Ext.grid.ColumnModel Column model} : Column makeup + *
  • + *
  • {@link Ext.grid.GridView View} : Encapsulates the user interface + *
  • + *
  • {@link Ext.grid.AbstractSelectionModel selection model} : Selection behavior + *
  • + *
+ *

Example usage:

+ *

+var grid = new Ext.grid.GridPanel({
+    {@link #store}: new {@link Ext.data.Store}({
+        {@link Ext.data.Store#autoDestroy autoDestroy}: true,
+        {@link Ext.data.Store#reader reader}: reader,
+        {@link Ext.data.Store#data data}: xg.dummyData
+    }),
+    {@link #colModel}: new {@link Ext.grid.ColumnModel}({
+        {@link Ext.grid.ColumnModel#defaults defaults}: {
+            width: 120,
+            sortable: true
+        },
+        {@link Ext.grid.ColumnModel#columns columns}: [
+            {id: 'company', header: 'Company', width: 200, sortable: true, dataIndex: 'company'},
+            {header: 'Price', renderer: Ext.util.Format.usMoney, dataIndex: 'price'},
+            {header: 'Change', dataIndex: 'change'},
+            {header: '% Change', dataIndex: 'pctChange'},
+            // instead of specifying renderer: Ext.util.Format.dateRenderer('m/d/Y') use xtype
+            {
+                header: 'Last Updated', width: 135, dataIndex: 'lastChange',
+                xtype: 'datecolumn', format: 'M d, Y'
+            }
+        ],
+    }),
+    {@link #viewConfig}: {
+        {@link Ext.grid.GridView#forceFit forceFit}: true,
+
+//      Return CSS class to apply to rows depending upon data values
+        {@link Ext.grid.GridView#getRowClass getRowClass}: function(record, index) {
+            var c = record.{@link Ext.data.Record#get get}('change');
+            if (c < 0) {
+                return 'price-fall';
+            } else if (c > 0) {
+                return 'price-rise';
+            }
+        }
+    },
+    {@link #sm}: new Ext.grid.RowSelectionModel({singleSelect:true}),
+    width: 600,
+    height: 300,
+    frame: true,
+    title: 'Framed with Row Selection and Horizontal Scrolling',
+    iconCls: 'icon-grid'
+});
+ * 
+ *

Notes:

+ *
    + *
  • Although this class inherits many configuration options from base classes, some of them + * (such as autoScroll, autoWidth, layout, items, etc) are not used by this class, and will + * have no effect.
  • + *
  • A grid requires a width in which to scroll its columns, and a height in which to + * scroll its rows. These dimensions can either be set explicitly through the + * {@link Ext.BoxComponent#height height} and {@link Ext.BoxComponent#width width} + * configuration options or implicitly set by using the grid as a child item of a + * {@link Ext.Container Container} which will have a {@link Ext.Container#layout layout manager} + * provide the sizing of its child items (for example the Container of the Grid may specify + * {@link Ext.Container#layout layout}:'fit').
  • + *
  • To access the data in a Grid, it is necessary to use the data model encapsulated + * by the {@link #store Store}. See the {@link #cellclick} event for more details.
  • + *
+ * @constructor + * @param {Object} config The config object + * @xtype grid + */ +Ext.grid.GridPanel = Ext.extend(Ext.Panel, { + /** + * @cfg {String} autoExpandColumn + *

The {@link Ext.grid.Column#id id} of a {@link Ext.grid.Column column} in + * this grid that should expand to fill unused space. This value specified here can not + * be 0.

+ *

Note: If the Grid's {@link Ext.grid.GridView view} is configured with + * {@link Ext.grid.GridView#forceFit forceFit}=true the autoExpandColumn + * is ignored. See {@link Ext.grid.Column}.{@link Ext.grid.Column#width width} + * for additional details.

+ *

See {@link #autoExpandMax} and {@link #autoExpandMin} also.

+ */ + autoExpandColumn : false, + /** + * @cfg {Number} autoExpandMax The maximum width the {@link #autoExpandColumn} + * can have (if enabled). Defaults to 1000. + */ + autoExpandMax : 1000, + /** + * @cfg {Number} autoExpandMin The minimum width the {@link #autoExpandColumn} + * can have (if enabled). Defaults to 50. + */ + autoExpandMin : 50, + /** + * @cfg {Boolean} columnLines true to add css for column separation lines. + * Default is false. + */ + columnLines : false, + /** + * @cfg {Object} cm Shorthand for {@link #colModel}. + */ + /** + * @cfg {Object} colModel The {@link Ext.grid.ColumnModel} to use when rendering the grid (required). + */ + /** + * @cfg {Array} columns An array of {@link Ext.grid.Column columns} to auto create a + * {@link Ext.grid.ColumnModel}. The ColumnModel may be explicitly created via the + * {@link #colModel} configuration property. + */ + /** + * @cfg {String} ddGroup The DD group this GridPanel belongs to. Defaults to 'GridDD' if not specified. + */ + /** + * @cfg {String} ddText + * Configures the text in the drag proxy. Defaults to: + *

+     * ddText : '{0} selected row{1}'
+     * 
+ * {0} is replaced with the number of selected rows. + */ + ddText : '{0} selected row{1}', + /** + * @cfg {Boolean} deferRowRender

Defaults to true to enable deferred row rendering.

+ *

This allows the GridPanel to be initially rendered empty, with the expensive update of the row + * structure deferred so that layouts with GridPanels appear more quickly.

+ */ + deferRowRender : true, + /** + * @cfg {Boolean} disableSelection

true to disable selections in the grid. Defaults to false.

+ *

Ignored if a {@link #selModel SelectionModel} is specified.

+ */ + /** + * @cfg {Boolean} enableColumnResize false to turn off column resizing for the whole grid. Defaults to true. + */ + /** + * @cfg {Boolean} enableColumnHide + * Defaults to true to enable {@link Ext.grid.Column#hidden hiding of columns} + * with the {@link #enableHdMenu header menu}. + */ + enableColumnHide : true, + /** + * @cfg {Boolean} enableColumnMove Defaults to true to enable drag and drop reorder of columns. false + * to turn off column reordering via drag drop. + */ + enableColumnMove : true, + /** + * @cfg {Boolean} enableDragDrop

Enables dragging of the selected rows of the GridPanel. Defaults to false.

+ *

Setting this to true causes this GridPanel's {@link #getView GridView} to + * create an instance of {@link Ext.grid.GridDragZone}. Note: this is available only after + * the Grid has been rendered as the GridView's {@link Ext.grid.GridView#dragZone dragZone} + * property.

+ *

A cooperating {@link Ext.dd.DropZone DropZone} must be created who's implementations of + * {@link Ext.dd.DropZone#onNodeEnter onNodeEnter}, {@link Ext.dd.DropZone#onNodeOver onNodeOver}, + * {@link Ext.dd.DropZone#onNodeOut onNodeOut} and {@link Ext.dd.DropZone#onNodeDrop onNodeDrop} are able + * to process the {@link Ext.grid.GridDragZone#getDragData data} which is provided.

+ */ + enableDragDrop : false, + /** + * @cfg {Boolean} enableHdMenu Defaults to true to enable the drop down button for menu in the headers. + */ + enableHdMenu : true, + /** + * @cfg {Boolean} hideHeaders True to hide the grid's header. Defaults to false. + */ + /** + * @cfg {Object} loadMask An {@link Ext.LoadMask} config or true to mask the grid while + * loading. Defaults to false. + */ + loadMask : false, + /** + * @cfg {Number} maxHeight Sets the maximum height of the grid - ignored if autoHeight is not on. + */ + /** + * @cfg {Number} minColumnWidth The minimum width a column can be resized to. Defaults to 25. + */ + minColumnWidth : 25, + /** + * @cfg {Object} sm Shorthand for {@link #selModel}. + */ + /** + * @cfg {Object} selModel Any subclass of {@link Ext.grid.AbstractSelectionModel} that will provide + * the selection model for the grid (defaults to {@link Ext.grid.RowSelectionModel} if not specified). + */ + /** + * @cfg {Ext.data.Store} store The {@link Ext.data.Store} the grid should use as its data source (required). + */ + /** + * @cfg {Boolean} stripeRows true to stripe the rows. Default is false. + *

This causes the CSS class x-grid3-row-alt to be added to alternate rows of + * the grid. A default CSS rule is provided which sets a background colour, but you can override this + * with a rule which either overrides the background-color style using the '!important' + * modifier, or which uses a CSS selector of higher specificity.

+ */ + stripeRows : false, + /** + * @cfg {Boolean} trackMouseOver True to highlight rows when the mouse is over. Default is true + * for GridPanel, but false for EditorGridPanel. + */ + trackMouseOver : true, + /** + * @cfg {Array} stateEvents + * An array of events that, when fired, should trigger this component to save its state. + * Defaults to:

+     * stateEvents: ['columnmove', 'columnresize', 'sortchange', 'groupchange']
+     * 
+ *

These can be any types of events supported by this component, including browser or + * custom events (e.g., ['click', 'customerchange']).

+ *

See {@link Ext.Component#stateful} for an explanation of saving and restoring + * Component state.

+ */ + stateEvents : ['columnmove', 'columnresize', 'sortchange', 'groupchange'], + /** + * @cfg {Object} view The {@link Ext.grid.GridView} used by the grid. This can be set + * before a call to {@link Ext.Component#render render()}. + */ + view : null, + + /** + * @cfg {Array} bubbleEvents + *

An array of events that, when fired, should be bubbled to any parent container. + * See {@link Ext.util.Observable#enableBubble}. + * Defaults to []. + */ + bubbleEvents: [], + + /** + * @cfg {Object} viewConfig A config object that will be applied to the grid's UI view. Any of + * the config options available for {@link Ext.grid.GridView} can be specified here. This option + * is ignored if {@link #view} is specified. + */ + + // private + rendered : false, + // private + viewReady : false, + + // private + initComponent : function(){ + Ext.grid.GridPanel.superclass.initComponent.call(this); + + if(this.columnLines){ + this.cls = (this.cls || '') + ' x-grid-with-col-lines'; + } + // override any provided value since it isn't valid + // and is causing too many bug reports ;) + this.autoScroll = false; + this.autoWidth = false; + + if(Ext.isArray(this.columns)){ + this.colModel = new Ext.grid.ColumnModel(this.columns); + delete this.columns; + } + + // check and correct shorthanded configs + if(this.ds){ + this.store = this.ds; + delete this.ds; + } + if(this.cm){ + this.colModel = this.cm; + delete this.cm; + } + if(this.sm){ + this.selModel = this.sm; + delete this.sm; + } + this.store = Ext.StoreMgr.lookup(this.store); + + this.addEvents( + // raw events + /** + * @event click + * The raw click event for the entire grid. + * @param {Ext.EventObject} e + */ + 'click', + /** + * @event dblclick + * The raw dblclick event for the entire grid. + * @param {Ext.EventObject} e + */ + 'dblclick', + /** + * @event contextmenu + * The raw contextmenu event for the entire grid. + * @param {Ext.EventObject} e + */ + 'contextmenu', + /** + * @event mousedown + * The raw mousedown event for the entire grid. + * @param {Ext.EventObject} e + */ + 'mousedown', + /** + * @event mouseup + * The raw mouseup event for the entire grid. + * @param {Ext.EventObject} e + */ + 'mouseup', + /** + * @event mouseover + * The raw mouseover event for the entire grid. + * @param {Ext.EventObject} e + */ + 'mouseover', + /** + * @event mouseout + * The raw mouseout event for the entire grid. + * @param {Ext.EventObject} e + */ + 'mouseout', + /** + * @event keypress + * The raw keypress event for the entire grid. + * @param {Ext.EventObject} e + */ + 'keypress', + /** + * @event keydown + * The raw keydown event for the entire grid. + * @param {Ext.EventObject} e + */ + 'keydown', + + // custom events + /** + * @event cellmousedown + * Fires before a cell is clicked + * @param {Grid} this + * @param {Number} rowIndex + * @param {Number} columnIndex + * @param {Ext.EventObject} e + */ + 'cellmousedown', + /** + * @event rowmousedown + * Fires before a row is clicked + * @param {Grid} this + * @param {Number} rowIndex + * @param {Ext.EventObject} e + */ + 'rowmousedown', + /** + * @event headermousedown + * Fires before a header is clicked + * @param {Grid} this + * @param {Number} columnIndex + * @param {Ext.EventObject} e + */ + 'headermousedown', + + /** + * @event groupmousedown + * Fires before a group header is clicked. Only applies for grids with a {@link Ext.grid.GroupingView GroupingView}. + * @param {Grid} this + * @param {String} groupField + * @param {String} groupValue + * @param {Ext.EventObject} e + */ + 'groupmousedown', + + /** + * @event rowbodymousedown + * Fires before the row body is clicked. Only applies for grids with {@link Ext.grid.GridView#enableRowBody enableRowBody} configured. + * @param {Grid} this + * @param {Number} rowIndex + * @param {Ext.EventObject} e + */ + 'rowbodymousedown', + + /** + * @event containermousedown + * Fires before the container is clicked. The container consists of any part of the grid body that is not covered by a row. + * @param {Grid} this + * @param {Ext.EventObject} e + */ + 'containermousedown', + + /** + * @event cellclick + * Fires when a cell is clicked. + * The data for the cell is drawn from the {@link Ext.data.Record Record} + * for this row. To access the data in the listener function use the + * following technique: + *


+function(grid, rowIndex, columnIndex, e) {
+    var record = grid.getStore().getAt(rowIndex);  // Get the Record
+    var fieldName = grid.getColumnModel().getDataIndex(columnIndex); // Get field name
+    var data = record.get(fieldName);
+}
+
+ * @param {Grid} this + * @param {Number} rowIndex + * @param {Number} columnIndex + * @param {Ext.EventObject} e + */ + 'cellclick', + /** + * @event celldblclick + * Fires when a cell is double clicked + * @param {Grid} this + * @param {Number} rowIndex + * @param {Number} columnIndex + * @param {Ext.EventObject} e + */ + 'celldblclick', + /** + * @event rowclick + * Fires when a row is clicked + * @param {Grid} this + * @param {Number} rowIndex + * @param {Ext.EventObject} e + */ + 'rowclick', + /** + * @event rowdblclick + * Fires when a row is double clicked + * @param {Grid} this + * @param {Number} rowIndex + * @param {Ext.EventObject} e + */ + 'rowdblclick', + /** + * @event headerclick + * Fires when a header is clicked + * @param {Grid} this + * @param {Number} columnIndex + * @param {Ext.EventObject} e + */ + 'headerclick', + /** + * @event headerdblclick + * Fires when a header cell is double clicked + * @param {Grid} this + * @param {Number} columnIndex + * @param {Ext.EventObject} e + */ + 'headerdblclick', + /** + * @event groupclick + * Fires when group header is clicked. Only applies for grids with a {@link Ext.grid.GroupingView GroupingView}. + * @param {Grid} this + * @param {String} groupField + * @param {String} groupValue + * @param {Ext.EventObject} e + */ + 'groupclick', + /** + * @event groupdblclick + * Fires when group header is double clicked. Only applies for grids with a {@link Ext.grid.GroupingView GroupingView}. + * @param {Grid} this + * @param {String} groupField + * @param {String} groupValue + * @param {Ext.EventObject} e + */ + 'groupdblclick', + /** + * @event containerclick + * Fires when the container is clicked. The container consists of any part of the grid body that is not covered by a row. + * @param {Grid} this + * @param {Ext.EventObject} e + */ + 'containerclick', + /** + * @event containerdblclick + * Fires when the container is double clicked. The container consists of any part of the grid body that is not covered by a row. + * @param {Grid} this + * @param {Ext.EventObject} e + */ + 'containerdblclick', + + /** + * @event rowbodyclick + * Fires when the row body is clicked. Only applies for grids with {@link Ext.grid.GridView#enableRowBody enableRowBody} configured. + * @param {Grid} this + * @param {Number} rowIndex + * @param {Ext.EventObject} e + */ + 'rowbodyclick', + /** + * @event rowbodydblclick + * Fires when the row body is double clicked. Only applies for grids with {@link Ext.grid.GridView#enableRowBody enableRowBody} configured. + * @param {Grid} this + * @param {Number} rowIndex + * @param {Ext.EventObject} e + */ + 'rowbodydblclick', + + /** + * @event rowcontextmenu + * Fires when a row is right clicked + * @param {Grid} this + * @param {Number} rowIndex + * @param {Ext.EventObject} e + */ + 'rowcontextmenu', + /** + * @event cellcontextmenu + * Fires when a cell is right clicked + * @param {Grid} this + * @param {Number} rowIndex + * @param {Number} cellIndex + * @param {Ext.EventObject} e + */ + 'cellcontextmenu', + /** + * @event headercontextmenu + * Fires when a header is right clicked + * @param {Grid} this + * @param {Number} columnIndex + * @param {Ext.EventObject} e + */ + 'headercontextmenu', + /** + * @event groupcontextmenu + * Fires when group header is right clicked. Only applies for grids with a {@link Ext.grid.GroupingView GroupingView}. + * @param {Grid} this + * @param {String} groupField + * @param {String} groupValue + * @param {Ext.EventObject} e + */ + 'groupcontextmenu', + /** + * @event containercontextmenu + * Fires when the container is right clicked. The container consists of any part of the grid body that is not covered by a row. + * @param {Grid} this + * @param {Ext.EventObject} e + */ + 'containercontextmenu', + /** + * @event rowbodycontextmenu + * Fires when the row body is right clicked. Only applies for grids with {@link Ext.grid.GridView#enableRowBody enableRowBody} configured. + * @param {Grid} this + * @param {Number} rowIndex + * @param {Ext.EventObject} e + */ + 'rowbodycontextmenu', + /** + * @event bodyscroll + * Fires when the body element is scrolled + * @param {Number} scrollLeft + * @param {Number} scrollTop + */ + 'bodyscroll', + /** + * @event columnresize + * Fires when the user resizes a column + * @param {Number} columnIndex + * @param {Number} newSize + */ + 'columnresize', + /** + * @event columnmove + * Fires when the user moves a column + * @param {Number} oldIndex + * @param {Number} newIndex + */ + 'columnmove', + /** + * @event sortchange + * Fires when the grid's store sort changes + * @param {Grid} this + * @param {Object} sortInfo An object with the keys field and direction + */ + 'sortchange', + /** + * @event groupchange + * Fires when the grid's grouping changes (only applies for grids with a {@link Ext.grid.GroupingView GroupingView}) + * @param {Grid} this + * @param {String} groupField A string with the grouping field, null if the store is not grouped. + */ + 'groupchange', + /** + * @event reconfigure + * Fires when the grid is reconfigured with a new store and/or column model. + * @param {Grid} this + * @param {Ext.data.Store} store The new store + * @param {Ext.grid.ColumnModel} colModel The new column model + */ + 'reconfigure', + /** + * @event viewready + * Fires when the grid view is available (use this for selecting a default row). + * @param {Grid} this + */ + 'viewready' + ); + }, + + // private + onRender : function(ct, position){ + Ext.grid.GridPanel.superclass.onRender.apply(this, arguments); + + var c = this.getGridEl(); + + this.el.addClass('x-grid-panel'); + + this.mon(c, { + scope: this, + mousedown: this.onMouseDown, + click: this.onClick, + dblclick: this.onDblClick, + contextmenu: this.onContextMenu + }); + + this.relayEvents(c, ['mousedown','mouseup','mouseover','mouseout','keypress', 'keydown']); + + var view = this.getView(); + view.init(this); + view.render(); + this.getSelectionModel().init(this); + }, + + // private + initEvents : function(){ + Ext.grid.GridPanel.superclass.initEvents.call(this); + + if(this.loadMask){ + this.loadMask = new Ext.LoadMask(this.bwrap, + Ext.apply({store:this.store}, this.loadMask)); + } + }, + + initStateEvents : function(){ + Ext.grid.GridPanel.superclass.initStateEvents.call(this); + this.mon(this.colModel, 'hiddenchange', this.saveState, this, {delay: 100}); + }, + + applyState : function(state){ + var cm = this.colModel, + cs = state.columns, + store = this.store, + s, + c, + oldIndex; + + if(cs){ + for(var i = 0, len = cs.length; i < len; i++){ + s = cs[i]; + c = cm.getColumnById(s.id); + if(c){ + c.hidden = s.hidden; + c.width = s.width; + oldIndex = cm.getIndexById(s.id); + if(oldIndex != i){ + cm.moveColumn(oldIndex, i); + } + } + } + } + if(store){ + s = state.sort; + if(s){ + store[store.remoteSort ? 'setDefaultSort' : 'sort'](s.field, s.direction); + } + s = state.group; + if(store.groupBy){ + if(s){ + store.groupBy(s); + }else{ + store.clearGrouping(); + } + } + + } + var o = Ext.apply({}, state); + delete o.columns; + delete o.sort; + Ext.grid.GridPanel.superclass.applyState.call(this, o); + }, + + getState : function(){ + var o = {columns: []}, + store = this.store, + ss, + gs; + + for(var i = 0, c; (c = this.colModel.config[i]); i++){ + o.columns[i] = { + id: c.id, + width: c.width + }; + if(c.hidden){ + o.columns[i].hidden = true; + } + } + if(store){ + ss = store.getSortState(); + if(ss){ + o.sort = ss; + } + if(store.getGroupState){ + gs = store.getGroupState(); + if(gs){ + o.group = gs; + } + } + } + return o; + }, + + // private + afterRender : function(){ + Ext.grid.GridPanel.superclass.afterRender.call(this); + var v = this.view; + this.on('bodyresize', v.layout, v); + v.layout(); + if(this.deferRowRender){ + if (!this.deferRowRenderTask){ + this.deferRowRenderTask = new Ext.util.DelayedTask(v.afterRender, this.view); + } + this.deferRowRenderTask.delay(10); + }else{ + v.afterRender(); + } + this.viewReady = true; + }, + + /** + *

Reconfigures the grid to use a different Store and Column Model + * and fires the 'reconfigure' event. The View will be bound to the new + * objects and refreshed.

+ *

Be aware that upon reconfiguring a GridPanel, certain existing settings may become + * invalidated. For example the configured {@link #autoExpandColumn} may no longer exist in the + * new ColumnModel. Also, an existing {@link Ext.PagingToolbar PagingToolbar} will still be bound + * to the old Store, and will need rebinding. Any {@link #plugins} might also need reconfiguring + * with the new data.

+ * @param {Ext.data.Store} store The new {@link Ext.data.Store} object + * @param {Ext.grid.ColumnModel} colModel The new {@link Ext.grid.ColumnModel} object + */ + reconfigure : function(store, colModel){ + var rendered = this.rendered; + if(rendered){ + if(this.loadMask){ + this.loadMask.destroy(); + this.loadMask = new Ext.LoadMask(this.bwrap, + Ext.apply({}, {store:store}, this.initialConfig.loadMask)); + } + } + if(this.view){ + this.view.initData(store, colModel); + } + this.store = store; + this.colModel = colModel; + if(rendered){ + this.view.refresh(true); + } + this.fireEvent('reconfigure', this, store, colModel); + }, + + // private + onDestroy : function(){ + if (this.deferRowRenderTask && this.deferRowRenderTask.cancel){ + this.deferRowRenderTask.cancel(); + } + if(this.rendered){ + Ext.destroy(this.view, this.loadMask); + }else if(this.store && this.store.autoDestroy){ + this.store.destroy(); + } + Ext.destroy(this.colModel, this.selModel); + this.store = this.selModel = this.colModel = this.view = this.loadMask = null; + Ext.grid.GridPanel.superclass.onDestroy.call(this); + }, + + // private + processEvent : function(name, e){ + this.view.processEvent(name, e); + }, + + // private + onClick : function(e){ + this.processEvent('click', e); + }, + + // private + onMouseDown : function(e){ + this.processEvent('mousedown', e); + }, + + // private + onContextMenu : function(e, t){ + this.processEvent('contextmenu', e); + }, + + // private + onDblClick : function(e){ + this.processEvent('dblclick', e); + }, + + // private + walkCells : function(row, col, step, fn, scope){ + var cm = this.colModel, + clen = cm.getColumnCount(), + ds = this.store, + rlen = ds.getCount(), + first = true; + + if(step < 0){ + if(col < 0){ + row--; + first = false; + } + while(row >= 0){ + if(!first){ + col = clen-1; + } + first = false; + while(col >= 0){ + if(fn.call(scope || this, row, col, cm) === true){ + return [row, col]; + } + col--; + } + row--; + } + } else { + if(col >= clen){ + row++; + first = false; + } + while(row < rlen){ + if(!first){ + col = 0; + } + first = false; + while(col < clen){ + if(fn.call(scope || this, row, col, cm) === true){ + return [row, col]; + } + col++; + } + row++; + } + } + return null; + }, + + /** + * Returns the grid's underlying element. + * @return {Element} The element + */ + getGridEl : function(){ + return this.body; + }, + + // private for compatibility, overridden by editor grid + stopEditing : Ext.emptyFn, + + /** + * Returns the grid's selection model configured by the {@link #selModel} + * configuration option. If no selection model was configured, this will create + * and return a {@link Ext.grid.RowSelectionModel RowSelectionModel}. + * @return {SelectionModel} + */ + getSelectionModel : function(){ + if(!this.selModel){ + this.selModel = new Ext.grid.RowSelectionModel( + this.disableSelection ? {selectRow: Ext.emptyFn} : null); + } + return this.selModel; + }, + + /** + * Returns the grid's data store. + * @return {Ext.data.Store} The store + */ + getStore : function(){ + return this.store; + }, + + /** + * Returns the grid's ColumnModel. + * @return {Ext.grid.ColumnModel} The column model + */ + getColumnModel : function(){ + return this.colModel; + }, + + /** + * Returns the grid's GridView object. + * @return {Ext.grid.GridView} The grid view + */ + getView : function(){ + if(!this.view){ + this.view = new Ext.grid.GridView(this.viewConfig); + } + return this.view; + }, + /** + * Called to get grid's drag proxy text, by default returns this.ddText. + * @return {String} The text + */ + getDragDropText : function(){ + var count = this.selModel.getCount(); + return String.format(this.ddText, count, count == 1 ? '' : 's'); + } + + /** + * @cfg {String/Number} activeItem + * @hide + */ + /** + * @cfg {Boolean} autoDestroy + * @hide + */ + /** + * @cfg {Object/String/Function} autoLoad + * @hide + */ + /** + * @cfg {Boolean} autoWidth + * @hide + */ + /** + * @cfg {Boolean/Number} bufferResize + * @hide + */ + /** + * @cfg {String} defaultType + * @hide + */ + /** + * @cfg {Object} defaults + * @hide + */ + /** + * @cfg {Boolean} hideBorders + * @hide + */ + /** + * @cfg {Mixed} items + * @hide + */ + /** + * @cfg {String} layout + * @hide + */ + /** + * @cfg {Object} layoutConfig + * @hide + */ + /** + * @cfg {Boolean} monitorResize + * @hide + */ + /** + * @property items + * @hide + */ + /** + * @method add + * @hide + */ + /** + * @method cascade + * @hide + */ + /** + * @method doLayout + * @hide + */ + /** + * @method find + * @hide + */ + /** + * @method findBy + * @hide + */ + /** + * @method findById + * @hide + */ + /** + * @method findByType + * @hide + */ + /** + * @method getComponent + * @hide + */ + /** + * @method getLayout + * @hide + */ + /** + * @method getUpdater + * @hide + */ + /** + * @method insert + * @hide + */ + /** + * @method load + * @hide + */ + /** + * @method remove + * @hide + */ + /** + * @event add + * @hide + */ + /** + * @event afterlayout + * @hide + */ + /** + * @event beforeadd + * @hide + */ + /** + * @event beforeremove + * @hide + */ + /** + * @event remove + * @hide + */ + + + + /** + * @cfg {String} allowDomMove @hide + */ + /** + * @cfg {String} autoEl @hide + */ + /** + * @cfg {String} applyTo @hide + */ + /** + * @cfg {String} autoScroll @hide + */ + /** + * @cfg {String} bodyBorder @hide + */ + /** + * @cfg {String} bodyStyle @hide + */ + /** + * @cfg {String} contentEl @hide + */ + /** + * @cfg {String} disabledClass @hide + */ + /** + * @cfg {String} elements @hide + */ + /** + * @cfg {String} html @hide + */ + /** + * @cfg {Boolean} preventBodyReset + * @hide + */ + /** + * @property disabled + * @hide + */ + /** + * @method applyToMarkup + * @hide + */ + /** + * @method enable + * @hide + */ + /** + * @method disable + * @hide + */ + /** + * @method setDisabled + * @hide + */ +}); +Ext.reg('grid', Ext.grid.GridPanel); \ No newline at end of file diff --git a/workflow/engine/templates/bpmn/GroupFigure.js b/workflow/engine/templates/bpmn/GroupFigure.js new file mode 100755 index 000000000..3b97b9460 --- /dev/null +++ b/workflow/engine/templates/bpmn/GroupFigure.js @@ -0,0 +1,76 @@ +bpmnGroup=function(){ +this.titlebar=null; +this.defaultBackgroundColor=new Color(230,230,250); +this.highlightBackgroundColor=new Color(250,250,200); +CompartmentFigure.call(this); +this.setDimension(800,300); +this.setBackgroundColor(this.defaultBackgroundColor); +}; +bpmnGroup.prototype=new CompartmentFigure; +bpmnGroup.prototype.type='bpmnGroup'; +bpmnGroup.prototype.title='Group'; +bpmnGroup.prototype.createHTMLElement=function(){ +var item=CompartmentFigure.prototype.createHTMLElement.call(this); +item.style.margin="0px"; +item.style.padding="0px"; +item.style.border="1px solid black"; +item.style.cursor=null; +this.titlebar=document.createElement("div"); +this.titlebar.style.position="absolute"; +this.titlebar.style.left="0px"; +this.titlebar.style.top="0px"; +this.titlebar.style.width=(this.getWidth()-5)+"px"; +this.titlebar.style.height="15px"; +this.titlebar.style.margin="0px"; +this.titlebar.style.padding="0px"; +this.titlebar.style.font="normal 10px verdana"; +this.titlebar.style.backgroundColor="gray"; +this.titlebar.style.borderBottom="1px solid gray"; +this.titlebar.style.borderLeft="5px solid transparent"; +this.titlebar.style.whiteSpace="nowrap"; +this.titlebar.style.textAlign="left"; +this.titlebar.style.backgroundImage="url(/skins/ext/images/gray/panel/light-hd.gif)"; +this.textNode=document.createTextNode(this.title); +this.titlebar.appendChild(this.textNode); +item.appendChild(this.titlebar); +return item; +}; + +bpmnGroup.prototype.onFigureEnter=function(_3570){ +if(this.children[_3570.id]==null){ +this.setBackgroundColor(this.highlightBackgroundColor); +} +CompartmentFigure.prototype.onFigureEnter.call(this,_3570); +}; +bpmnGroup.prototype.onFigureLeave=function(_3571){ +CompartmentFigure.prototype.onFigureLeave.call(this,_3571); +this.setBackgroundColor(this.defaultBackgroundColor); +}; +bpmnGroup.prototype.onFigureDrop=function(_3572){ +CompartmentFigure.prototype.onFigureDrop.call(this,_3572); +this.setBackgroundColor(this.defaultBackgroundColor); +}; + +bpmnGroup.prototype.setDimension=function(w,h){ +CompartmentFigure.prototype.setDimension.call(this,w,h); +if(this.titlebar!=null){ +this.titlebar.style.width=(this.getWidth()-5)+"px"; +} +}; +bpmnGroup.prototype.setTitle=function(title){ +this.title=title; +}; +bpmnGroup.prototype.getMinWidth=function(){ +return 50; +}; +bpmnGroup.prototype.getMinHeight=function(){ +return 50; +}; +bpmnGroup.prototype.setBackgroundColor=function(color){ +this.bgColor=color; +if(this.bgColor!=null){ +this.html.style.backgroundColor=this.bgColor.getHTMLStyle(); +}else{ +this.html.style.backgroundColor="transparent"; +} +}; diff --git a/workflow/engine/templates/bpmn/Lane.js b/workflow/engine/templates/bpmn/Lane.js new file mode 100755 index 000000000..2c718eb92 --- /dev/null +++ b/workflow/engine/templates/bpmn/Lane.js @@ -0,0 +1,36 @@ +bpmnLane = function (_30ab) { + VectorFigure.call(this); + this.setDimension(500, 300); + this.setTaskName(_30ab.taskNo); //It will set the Default Task Name with appropriate count While dragging a task on the canvas +}; + +bpmnLane.prototype = new VectorFigure; +bpmnLane.prototype.type = "bpmnLane"; +bpmnLane.prototype.setTaskName = function (name) { + this.taskName = 'Data Object ' + name; +}; + +bpmnLane.prototype.paint = function () { + VectorFigure.prototype.paint.call(this); + var x = new Array(0, this.getWidth(), this.getWidth(), 0); + var y = new Array(0, 0, this.getHeight(), this.getHeight()); + + this.graphics.setStroke(this.stroke); + this.graphics.setColor("#c0c0c0"); + this.graphics.fillPolygon(x, y); + + for (var i = 0; i < x.length; i++) { + x[i] = x[i] - 3; + y[i] = y[i] - 3; + } + this.graphics.setColor("#ffffff"); + this.graphics.fillPolygon(x, y); + this.graphics.setColor("#ff0f0f"); + this.graphics.drawPolygon(x, y); + this.graphics.drawLine(45, 0-3, 45, this.getHeight()-3); + this.graphics.drawLine(90, 0-3, 90, this.getHeight()-3); + this.graphics.drawLine(45, 150-3, this.getWidth()-3, 150-3); + this.graphics.paint(); + this.x_text = this.workflow.getAbsoluteX(); //Get x co-ordinate from figure + this.y_text = this.workflow.getAbsoluteY(); //Get x co-ordinate from figure +} diff --git a/workflow/engine/templates/bpmn/LoopingSubProcess.js b/workflow/engine/templates/bpmn/LoopingSubProcess.js new file mode 100755 index 000000000..af7cae056 --- /dev/null +++ b/workflow/engine/templates/bpmn/LoopingSubProcess.js @@ -0,0 +1,105 @@ +bpmnLoopingSubProcess=function(_30ab){ +VectorFigure.call(this); +this.setDimension(110,60); +this.setTaskName(_30ab); //It will set the Default Task Name with appropriate count While dragging a task on the canvas +}; + +bpmnLoopingSubProcess.prototype=new VectorFigure; +bpmnLoopingSubProcess.prototype.type="bpmnLoopingSubProcess"; +bpmnLoopingSubProcess.prototype.setTaskName=function(name){ +this.taskName = 'Task '+name; +}; +bpmnLoopingSubProcess.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); +var x=new Array(6, this.getWidth()-3, this.getWidth(), this.getWidth(), this.getWidth()-3, 6, 3, 3, 6); +var y=new Array(3, 3, 6, this.getHeight()-3, this.getHeight(), this.getHeight(), this.getHeight()-3, 6, 3); +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#c0c0c0" ); +this.graphics.fillPolygon(x,y); + +for(var i=0;i + * The string is first cleared and new string is painted.

+**/ +bpmnLoopingSubProcess.prototype.onOk=function(){ + this.figure.bpmnNewText.clear(); + //this.figure.bpmnNewText.drawStringRect(this.input.value,this.workflow.currentSelection.width/2-30,this.workflow.currentSelection.height/2-10,200,'left'); + this.figure.bpmnNewText.drawString(this.input.value,this.workflow.currentSelection.width/2.5,this.workflow.currentSelection.height/2.5); + this.figure.bpmnNewText.paint(); + this.figure.taskName = this.input.value; //Set Updated Text value + this.workflow.removeFigure(this); +}; \ No newline at end of file diff --git a/workflow/engine/templates/bpmn/LoopingTask.js b/workflow/engine/templates/bpmn/LoopingTask.js new file mode 100755 index 000000000..b7271081c --- /dev/null +++ b/workflow/engine/templates/bpmn/LoopingTask.js @@ -0,0 +1,46 @@ +bpmnLoopingTask=function(_30ab){ +VectorFigure.call(this); +this.setDimension(110,60); +this.setTaskName(_30ab); //It will set the Default Task Name with appropriate count While dragging a task on the canvas +}; + +bpmnLoopingTask.prototype=new VectorFigure; +bpmnLoopingTask.prototype.type="bpmnLoopingTask"; +bpmnLoopingTask.prototype.setTaskName=function(name){ +this.taskName = 'Task '+name; +}; + +bpmnLoopingTask.prototype.paint=function(){ +VectorFigure.prototype.paint.call(this); + +var x_subtask=new Array(6, this.getWidth()-3, this.getWidth(), this.getWidth(), this.getWidth()-3, 6, 3, 3, 6); +var y_subtask=new Array(3, 3, 6, this.getHeight()-3, this.getHeight(), this.getHeight(), this.getHeight()-3, 6, 3); +var x_subtask=new Array(6,125,128,128,125,6,3,3,6); +var y_subtask=new Array(3,3,6,87,90,90,87,6,3); +this.graphics.setStroke(this.stroke); +this.graphics.setColor( "#c0c0c0" ); +this.graphics.fillPolygon(x_subtask,y_subtask); +for(var i=0;i 1300 - oShape.width) { + workflow.main.setWidth(oShape.x+150); + } + //Top Border + if (oShape.y < 55) { + oShape.y = 71; + } + //Bottom Border + if (oShape.y > 1000 - oShape.height) { + workflow.main.setHeight(oShape.y+75); + } +} + + +MyWorkflow.prototype.AddTaskContextMenu= function(_4092) +{ + //var pmosExtObj = new pmosExt(); + var taskExtObj = new TaskContext(); + if (_4092.id != null) { + this.canvasTask = Ext.get(_4092.id); + this.contextTaskmenu = new Ext.menu.Menu({ + items: [{ + text: 'Steps', + handler: taskExtObj.editTaskSteps, + scope: _4092 + }, + { + text: 'Users & Users Group', + handler: taskExtObj.editUsers, + scope: _4092 + }, + { + text: 'Users & Users Groups (ad-hoc)', + scope: _4092 + }, + { + text: 'Routing Rule', + handler: taskExtObj.editRoutingRule, + scope: _4092 + }, + { + text: 'Deleting Routing Rule', + scope: _4092 + }, + { + text: 'Delete Task', + scope: _4092 + }, + { + text: 'Transform To', + menu: { // <-- submenu by nested config object + items: [ + // stick any markup in a menu + { + text: 'Sub Process', + type:'bpmnSubProcess', + scope:_4092, + handler: MyWorkflow.prototype.toggleShapes + } + ] + }, + scope: this + }, + { + text: 'Attach Event', + menu: { // <-- submenu by nested config object + items: [ + // stick any markup in a menu + { + text: 'Timer Boundary Event', + type:'bpmnEventBoundaryTimerInter', + scope:_4092, + handler: MyWorkflow.prototype.toggleShapes + } + ] + }, + scope: this + }, + { + text: 'Properties', + handler: taskExtObj.editTaskProperties, + scope: _4092 + }] + }); + } + + this.canvasTask.on('contextmenu', function (e) { + e.stopEvent(); + this.contextTaskmenu.showAt(e.getXY()); + }, this); + +} + + +MyWorkflow.prototype.treeGrid = function(){ + + var tree = new Ext.ux.tree.TreeGrid({ + title: 'Core Team Projects', + width: 500, + height: 300, + renderTo: Ext.getBody(), + enableDD: true, + + columns:[{ + header: 'Task', + dataIndex: 'task', + width: 230 + },{ + header: 'Duration', + width: 100, + dataIndex: 'duration', + align: 'center', + sortType: 'asFloat', + tpl: new Ext.XTemplate('{duration:this.formatHours}', { + formatHours: function(v) { + if(v < 1) { + return Math.round(v * 60) + ' mins'; + } else if (Math.floor(v) !== v) { + var min = v - Math.floor(v); + return Math.floor(v) + 'h ' + Math.round(min * 60) + 'm'; + } else { + return v + ' hour' + (v === 1 ? '' : 's'); + } + } + }) + },{ + header: 'Assigned To', + width: 150, + dataIndex: 'user' + }], + + dataUrl: 'treegrid-data.json' + }); + + var window = new Ext.Window({ + title: 'Task Properties', + collapsible: false, + maximizable: false, + width: 650, + height: 400, + minWidth: 300, + minHeight: 200, + layout: 'fit', + plain: true, + bodyStyle: 'padding:5px;', + buttonAlign: 'center', + items: tree, + buttons: [{ + text: 'Save' + },{ + text: 'Cancel' + }] + }); + window.show(); +} + +MyWorkflow.prototype.connectionContextMenu=function(_4092) +{ + this.canvasEvent = Ext.get(_4092.id); + this.contextEventmenu = new Ext.menu.Menu({ + items: [{ + text: 'NULL Router', + scope: this, + handler: MyWorkflow.prototype.toggleConnection + }, { + text: 'Manhatten Router', + scope: this, + handler: MyWorkflow.prototype.toggleConnection + }, { + text: 'Bezier Router', + scope: this, + handler: MyWorkflow.prototype.toggleConnection + }, { + text: 'Fan Router', + scope: this, + handler: MyWorkflow.prototype.toggleConnection + }, { + text: 'Delete Router', + scope: this, + handler:function() + { + MyWorkflow.prototype.deleteRoute(_4092.workflow.currentSelection,0) + } + }] + }); + +this.canvasEvent.on('contextmenu', function(e) { + e.stopEvent(); + this.contextEventmenu.showAt(e.getXY()); +}, this); +} + + +MyWorkflow.prototype.toggleConnection=function(_4092) +{ + this.currentSelection.workflow.contextClicked = false; + switch (_4092.text) { + case 'NULL Router': + this.currentSelection.setRouter(null); + break; + case 'Manhatten Router': + this.currentSelection.setRouter(new ManhattanConnectionRouter()); + break; + case 'Bezier Router': + this.currentSelection.setRouter(new BezierConnectionRouter()); + break; + case 'Fan Router': + this.currentSelection.setRouter(new FanConnectionRouter()); + break; + case 'Delete Router': + this.currentSelection.workflow.getCommandStack().execute(new CommandDelete(this.currentSelection.workflow.getCurrentSelection())); + ToolGeneric.prototype.execute.call(this); + break; + } +} + +MyWorkflow.prototype.AddGatewayPorts = function(_40c5) +{ + var TaskPortName = ['inputPort1','inputPort2','outputPort1','outputPort2']; + var TaskPortType = ['InputPort','InputPort','OutputPort','OutputPort']; + var TaskPositionX= [0,_40c5.width/2,_40c5.width,_40c5.width/2]; + var TaskPositionY= [_40c5.height/2,0,_40c5.height/2,_40c5.height]; + + for(var i=0; i< TaskPortName.length ; i++){ + eval('_40c5.'+TaskPortName[i]+' = new '+TaskPortType[i]+'()'); //Create New Port + eval('_40c5.'+TaskPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('_40c5.'+TaskPortName[i]+'.setName("'+TaskPortName[i]+'")'); //Set PortName + eval('_40c5.'+TaskPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('_40c5.'+TaskPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('_40c5.'+TaskPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + this.workflow = _40c5.workflow; + this.workflow.currentSelection =_40c5; + eval('_40c5.addPort(_40c5.'+TaskPortName[i]+','+TaskPositionX[i]+', '+TaskPositionY[i]+')'); //Setting Position of the port + } +} + +MyWorkflow.prototype.AddGatewayContextMenu=function(_4092) +{ + this.canvasGateway = Ext.get(_4092.id); + this.contextGatewaymenu = new Ext.menu.Menu({ + items: [{ + text: 'Gateway Type', + menu: { // <-- submenu by nested config object + items: [ + // stick any markup in a menu + { + text: 'Exclusive Gateway', + type:'bpmnGatewayExclusiveData', + scope:_4092, + handler: MyWorkflow.prototype.toggleShapes + }, { + text: 'Inclusive Gateway', + type:'bpmnGatewayInclusive', + scope:_4092, + handler: MyWorkflow.prototype.toggleShapes + }, { + text: 'Parallel Gateway', + type:'bpmnGatewayParallel', + scope:_4092, + handler: MyWorkflow.prototype.toggleShapes + }, { + text: 'Complex Gateway', + type:'bpmnGatewayComplex', + scope:_4092, + handler: MyWorkflow.prototype.toggleShapes + }, { + text: 'Event Based Gateway', + type:'bpmnGatewayExclusiveEvent', + scope:_4092, + handler: MyWorkflow.prototype.toggleShapes + } + ] + }, + scope: this + },{ + text: 'Properties', + handler: this.editGatewayProperties, + scope: this + }] + }); + +this.canvasGateway.on('contextmenu', function(e) { + e.stopEvent(); + this.contextGatewaymenu.showAt(e.getXY()); +}, this); +} + + +MyWorkflow.prototype.AddSubProcessContextMenu=function(_4092) +{ + this.canvasSubProcess = Ext.get(_4092.id); + // var currentSelection = _4092.scope.currentSelection; + //var pmosExtObj = new pmosExt(); + this.contextSubProcessmenu = new Ext.menu.Menu({ + items: [ + { + text: 'Transform To', + menu: { // <-- submenu by nested config object + items: [ + // stick any markup in a menu + { + text: 'Task', + type:'bpmnTask', + scope:_4092, + handler: MyWorkflow.prototype.toggleShapes + } + ] + }, + scope: this + }, + { + text: 'Properties', + handler: this.editSubProcessProperties, + scope: this + }] + }); + +this.canvasSubProcess.on('contextmenu', function(e) { + e.stopEvent(); + this.contextSubProcessmenu.showAt(e.getXY()); +}, this); +} + + +MyWorkflow.prototype.editSubProcessProperties= function(_3525) +{ + var pro_uid = workflow.getUrlVars(); + var taskId = workflow.currentSelection.id; + //Variables Out Grid + var subProcessFields = Ext.data.Record.create([ + {name: 'SP_UID',type: 'string'}, + {name: 'TAS_UID',type: 'string'}, + {name: 'PRO_PARENT',type: 'string'}, + {name: 'TAS_PARENT',type: 'string'}, + {name: 'SP_SYNCHRONOUS',type: 'string'}, + {name: 'SPROCESS_NAME',type: 'string'}, + {name: 'TASKS',type: 'string'}, + {name: 'TAS_TITLE',type: 'string'}, + {name: 'CON_VALUE',type: 'string'}, + {name: 'VAR_OUT1',type: 'string'}, + {name: 'VAR_OUT2',type: 'string'}, + {name: 'VAR_IN1',type: 'string'}, + {name: 'VAR_IN2',type: 'string'} + ]); + + var editorOut = new Ext.ux.grid.RowEditor({ + saveText: 'Update' + }); + var editorIn = new Ext.ux.grid.RowEditor({ + saveText: 'Update' + }); + + //Variable out grid configuration starts here + var btnAddOut = new Ext.Button({ + id: 'btnAddOut', + text: 'Assign Variables Out', + iconCls: 'application_add', + handler: function(){ + //var User = grid.getStore(); + var e = new subProcessFields({ + //STEP_TITLE: User.data.items[0].data.STEP_TITLE, + SP_UID : '', + PRO_PARENT : '', + SP_SYNCHRONOUS : '', + TAS_PARENT : '', + VAR_OUT1 : '', + VAR_OUT2 : '' + }); + + editorOut.stopEditing(); + variablesOutStore.insert(0, e); + variableOutGrid.getView().refresh(); + //grid.getSelectionModel().selectRow(0); + editorOut.startEditing(0, 0); + } + }); + + var btnRemoveOut = new Ext.Button({ + id: 'btnRemoveOut', + text: 'Remove Variables Out', + iconCls: 'application_delete', + handler: function (s) { + editorOut.stopEditing(); + var s = variableOutGrid.getSelectionModel().getSelections(); + for(var i = 0, r; r = s[i]; i++){ + + //First Deleting step from Database using Ajax + /*var stepUID = r.data.STEP_UID; + var stepPosition = r.data.STEP_POSITION; + + //if STEP_UID is properly defined (i.e. set to valid value) then only delete the row + //else its a BLANK ROW for which Ajax should not be called. + if(r.data.STEP_UID != "") + { + Ext.Ajax.request({ + url : '../steps/steps_Delete.php', + method: 'POST', + params: { + TASK : taskId, + STEP_UID : stepUID, + STEP_POSITION : stepPosition + }, + success: function(response) { + Ext.MessageBox.alert ('Status','Step has been removed successfully.'); + } + }); + }*/ + + //Secondly deleting from Grid + variablesOutStore.remove(r); + } + } + }); + + var tbOut = new Ext.Toolbar({ + items: [btnAddOut, btnRemoveOut] + }); + + + //Variable out grid configuration starts here + var btnAddIn = new Ext.Button({ + id: 'btnAddIn', + text: 'Assign Variables In', + iconCls: 'application_add', + handler: function(){ + //var User = grid.getStore(); + var e = new subProcessFields({ + //STEP_TITLE: User.data.items[0].data.STEP_TITLE, + SP_UID : '', + PRO_PARENT : '', + SP_SYNCHRONOUS : '', + TAS_PARENT : '', + VAR_IN1 : '', + VAR_IN2 : '' + }); + + editorIn.stopEditing(); + variablesInStore.insert(0, e); + variableInGrid.getView().refresh(); + //grid.getSelectionModel().selectRow(0); + editorIn.startEditing(0, 0); + } + }); + + var btnRemoveIn = new Ext.Button({ + id: 'btnRemoveIn', + text: 'Remove Variables In', + iconCls: 'application_delete', + handler: function (s) { + editorIn.stopEditing(); + var s = variableInGrid.getSelectionModel().getSelections(); + for(var i = 0, r; r = s[i]; i++){ + + + //Secondly deleting from Grid + variablesInStore.remove(r); + } + } + }); + + var tbIn = new Ext.Toolbar({ + items: [btnAddIn, btnRemoveIn] + }); + + // create the Data Store of all Variables Out + var variablesOutStore = new Ext.data.JsonStore({ + root : 'data', + totalProperty: 'totalCount', + idProperty : 'gridIndex', + remoteSort : true, + fields : subProcessFields, + proxy : new Ext.data.HttpProxy({ + url : 'proxySubProcessProperties?pid='+pro_uid+'&tid='+taskId+'&type=0' //type=0 specifies Variables Out (Asynchronous) + }) + }); + //taskUsers.setDefaultSort('LABEL', 'asc'); + variablesOutStore.load(); + + // create the Data Store of all Variables In + var variablesInStore = new Ext.data.JsonStore({ + root : 'data', + totalProperty: 'totalCount', + idProperty : 'gridIndex', + remoteSort : true, + fields : subProcessFields, + proxy : new Ext.data.HttpProxy({ + url : 'proxySubProcessProperties?pid='+pro_uid+'&tid='+taskId+'&type=1' //type=1 specifies Variables In (Synchronous) + }) + }); + //taskUsers.setDefaultSort('LABEL', 'asc'); + variablesInStore.load(); + + var variableOutGrid = new Ext.grid.GridPanel({ + store : variablesOutStore, + id : 'mygrid', + loadMask : true, + loadingText : 'Loading...', + renderTo : 'cases-grid', + frame : true, + autoHeight : true, + autoScroll : true, + clicksToEdit: 1, + layout : 'form', + plugins : [editorOut], + columns : [{ + id : 'VAR_OUT1', + header : 'Origin', + dataIndex: 'VAR_OUT1', + width : 200, + sortable : true, + editor : new Ext.form.TextField({ + allowBlank: true + }) + }, + { + sortable: false, + renderer: function() + { + return ''; + } + }, + { + id : 'VAR_OUT2', + header : 'Target', + dataIndex : 'VAR_OUT2', + width : 200, + sortable : true, + editor : new Ext.form.TextField({ + allowBlank: true + }) + }, + { + sortable: false, + renderer: function() + { + return ''; + } + } + ], + viewConfig: {forceFit: true}, + stripeRows: true, + tbar: tbOut + }); + + var variableInGrid = new Ext.grid.GridPanel({ + store : variablesInStore, + id : 'mygrid1', + loadMask : true, + loadingText : 'Loading...', + renderTo : 'cases-grid', + frame : true, + autoHeight : true, + autoScroll : true, + //enableDragDrop : true, + //ddGroup : 'firstGridDDGroup', + clicksToEdit: 1, + layout : 'form', + plugins : [editorIn], + columns : [{ + id : 'VAR_IN1', + header : 'Origin', + dataIndex: 'VAR_IN1', + width : 200, + sortable : true, + editor : new Ext.form.TextField({ + allowBlank: true + }) + }, + { + sortable: false, + renderer: function() + { + return ''; + } + }, + { + id : 'VAR_IN2', + header : 'Target', + dataIndex : 'VAR_IN2', + width : 200, + sortable : true, + editor : new Ext.form.TextField({ + allowBlank: true + }) + }, + { + sortable: false, + renderer: function() + { + return ''; + } + } + ], + viewConfig: {forceFit: true}, + stripeRows: true, + tbar: tbIn + }); + + + + editorOut.on({ + scope: this, + afteredit: function(roweditor, changes, record, rowIndex) { + + + var sTasks = record.data.TASKS; + var sSync = record.data.SP_SYNCHRONOUS; + var sSP_UID = record.data.SP_UID; + var sProcess_Parent = record.data.PRO_PARENT; + var sTask_Parent = record.data.TAS_PARENT; + var sVar_Out1 = record.data.VAR_OUT1; + var sVar_Out2 = record.data.VAR_OUT2; + + Ext.Ajax.request({ + url : 'processes_Ajax.php', + method: 'POST', + params: { + action : 'saveSubProcessDetails', + TASKS : sTasks, + SP_SYNCHRONOUS : sSync, + SP_UID : sSP_UID, + PRO_PARENT : sProcess_Parent, + TAS_PARENT : sTask_Parent, + VAR_OUT1 : sVar_Out1, + VAR_OUT2 : sVar_Out2 + }, + success: function(response) { + Ext.MessageBox.alert ('Status','Variable Out has been saved successfully.'); + } + }); + + } + }); + + editorIn.on({ + scope: this, + afteredit: function(roweditor, changes, record, rowIndex) { + + + var sTasks = record.data.TASKS; + var sSync = record.data.SP_SYNCHRONOUS; + var sSP_UID = record.data.SP_UID; + var sProcess_Parent = record.data.PRO_PARENT; + var sTask_Parent = record.data.TAS_PARENT; + var sVar_In1 = record.data.VAR_IN1; + var sVar_In2 = record.data.VAR_IN2; + + Ext.Ajax.request({ + url : 'processes_Ajax.php', + method: 'POST', + params: { + action : 'saveSubProcessDetails', + TASKS : sTasks, + SP_SYNCHRONOUS : sSync, + SP_UID : sSP_UID, + PRO_PARENT : sProcess_Parent, + TAS_PARENT : sTask_Parent, + VAR_IN1 : sVar_In1, + VAR_IN2 : sVar_In2 + }, + success: function(response) { + Ext.MessageBox.alert ('Status','Variable In has been saved successfully.'); + } + }); + + } + }); + + var subProcessProperties = new Ext.FormPanel({ + labelWidth : 110, // label settings here cascade unless overridden + //frame:true, + bodyStyle:'padding:5px 5px 0', + scope: _3525, + items: [ + { + xtype:'fieldset', + title: 'Sub-Process', + collapsible: false, + autoHeight:true, + //width: 600, + defaultType: 'textfield', + items:[ + { + id: 'subProcessName', + xtype: 'textfield', + width: 350, + fieldLabel: 'SubProcess name', + name : 'SPROCESS_NAME', + allowBlank: false + }, + { + width: 300, + xtype: 'combo', + mode: 'local', + triggerAction: 'all', + forceSelection: true, + editable: false, + fieldLabel: 'Process', + name: 'process', + emptyText : 'Select Process', + //hiddenName: 'SPROCESS_NAME', + displayField: 'PROCESSES', + valueField: 'PROCESSES', + //value: 'Select a process', + store: variablesOutStore + }, + { + width: 150, + id : 'spType', + xtype: 'combo', + mode: 'local', + triggerAction: 'all', + forceSelection: true, + editable: false, + fieldLabel: 'Type', + name: 'SP_SYNCHRONOUS', + hiddenName: 'SP_SYNCHRONOUS', + displayField: 'name', + valueField: 'value', + emptyText : 'Select Type', + //value: 'Asynchronous', + store: new Ext.data.JsonStore({ + fields : ['name', 'value'], + data : [ + {name : 'Asynchronous', value: 'Asynchronous'}, + {name : 'Synchronous', value: 'Synchronous'}, + ] + }), + onSelect: function(record, index){ + if(record.data.name == 'Synchronous') + Ext.getCmp("variablein").show(); + else + Ext.getCmp("variablein").hide(); + + this.setValue(record.data[this.valueField || this.displayField]); + this.collapse(); + } + }] + }, + { + id :'variableout', + xtype:'fieldset', + title: 'Variables Out', + collapsible: false, + labelAlign: 'top', + //autoHeight:true, + //width: 600, + //defaultType: 'textfield', + items:[variableOutGrid] + }, + { + id :'variablein', + xtype:'fieldset', + title: 'Variables In', + //hidden: true, + collapsible: false, + labelAlign: 'top', + items:[variableInGrid] + }] + }); + + //Loading Task Details into the form + subProcessProperties.form.load({ + url:'proxySubProcessProperties?pid='+pro_uid+'&tid='+taskId+'&type=2', + method:'GET', + //waitMsg:'Loading', + success:function(form, action) { + Ext.getCmp("subProcessName").setValue(action.result.data[0].TAS_TITLE); + if(action.result.data[0].SP_SYNCHRONOUS == 0) + { + Ext.getCmp("variablein").hide(); + Ext.getCmp("spType").setValue("Asynchronous"); + } + else + { + Ext.getCmp("variablein").show(); + Ext.getCmp("spType").setValue("Synchronous"); + } + workflow.subProcessProperties = action.result.data[0]; + + //Ext.MessageBox.alert('Message', 'Loaded OK'); + // setTaskAssignType(form); + }, + failure:function(form, action) { + Ext.MessageBox.alert('Message', 'Load failed'); + } + }); + + subProcessProperties.render(document.body); + // workflow.subProcessProperties = subProcessProperties; + + var window = new Ext.Window({ + title: 'Task: ', + collapsible: false, + maximizable: false, + width: 800, + height: 500, + minWidth: 300, + minHeight: 150, + layout: 'fit', + plain: true, + bodyStyle: 'padding:5px;', + buttonAlign: 'center', + items: subProcessProperties, + buttons: [{ + text: 'Save', + handler: function(){ + var getForm = subProcessProperties.getForm().getValues(); + var sTask_Parent = workflow.subProcessProperties.TAS_PARENT; + var sSPNAME = getForm.SPROCESS_NAME; + Ext.Ajax.request({ + url : 'processes_Ajax.php', + method: 'POST', + params: { + action : 'subprocessProperties', + TAS_PARENT : sTask_Parent, + SPROCESS_NAME : sSPNAME + }, + success: function(response) { + Ext.MessageBox.alert ('Status','Sub Process Properties has been saved successfully.'); + } + }); + + workflow.currentSelection.bpmnNewText.clear(); + workflow.currentSelection.bpmnNewText.drawStringRect(sSPNAME,20,20,100,'left'); + workflow.currentSelection.bpmnNewText.paint(); + workflow.currentSelection.subProcessName = sSPNAME; + //var getstore = taskPropertiesTabs.getStore(); + //var getData = getstore.data.items; + //taskExtObj.saveTaskProperties(_5625); + } + },{ + text: 'Cancel', + handler: function(){ + // when this button clicked, + window.close(); + } + }] + }); + window.show(); + +} + +//Window pop up function when user clicks on Gateways properties + +MyWorkflow.prototype.editGatewayProperties= function() +{ + var myData = { + records : [ + { name : "Rec 0", column1 : "0", column2 : "0" }, + { name : "Rec 1", column1 : "1", column2 : "1" }, + { name : "Rec 2", column1 : "2", column2 : "2" }, + { name : "Rec 3", column1 : "3", column2 : "3" }, + { name : "Rec 4", column1 : "4", column2 : "4" }, + { name : "Rec 5", column1 : "5", column2 : "5" }, + { name : "Rec 6", column1 : "6", column2 : "6" }, + { name : "Rec 7", column1 : "7", column2 : "7" }, + { name : "Rec 8", column1 : "8", column2 : "8" }, + { name : "Rec 9", column1 : "9", column2 : "9" } + ] + }; + + + // Generic fields array to use in both store defs. + var fields = [ + {name: 'name', mapping : 'name'}, + {name: 'column1', mapping : 'column1'}, + {name: 'column2', mapping : 'column2'} + ]; + + // create the data store + var firstGridStore = new Ext.data.JsonStore({ + fields : fields, + data : myData, + root : 'records' + }); + + + // Column Model shortcut array + var cols = [ + { id : 'name', header: "Record Name", width: 160, sortable: true, dataIndex: 'name'}, + {header: "column1", width: 50, sortable: true, dataIndex: 'column1'}, + {header: "column2", width: 50, sortable: true, dataIndex: 'column2'} + ]; + + // declare the source Grid + var firstGrid = new Ext.grid.GridPanel({ + ddGroup : 'secondGridDDGroup', + getView : function(){ + if(!this.view){ + this.view = new Ext.grid.GridView(this.viewConfig); + } + return this.view; + }, + store : firstGridStore, + columns : cols, + enableDragDrop : true, + stripeRows : true, + autoExpandColumn : 'name', + title : 'First Grid' + }); + + var secondGridStore = new Ext.data.JsonStore({ + fields : fields, + root : 'records' + }); + + // create the destination Grid + var secondGrid = new Ext.grid.GridPanel({ + ddGroup : 'firstGridDDGroup', + getView : function(){ + if(!this.view){ + this.view = new Ext.grid.GridView(this.viewConfig); + } + return this.view; + }, + store : secondGridStore, + columns : cols, + enableDragDrop : true, + stripeRows : true, + autoExpandColumn : 'name', + title : 'Second Grid' + }); + + //Simple 'border layout' panel to house both grids + var displayPanel = new Ext.Panel({ + width : 650, + height : 300, + layout : 'hbox', + //renderTo : 'panel', + defaults : { flex : 1 }, //auto stretch + layoutConfig : { align : 'stretch' }, + items : [ + firstGrid, + secondGrid + ], + bbar : [ + '->', // Fill + { + text : 'Reset both grids', + handler : function() { + //refresh source grid + firstGridStore.loadData(myData); + + //purge destination grid + secondGridStore.removeAll(); + } + } + ] + }); + + // used to add records to the destination stores + var blankRecord = Ext.data.Record.create(fields); + + /**** + * Setup Drop Targets + ***/ + // This will make sure we only drop to the view scroller element + // var view = new Ext.grid.GridView(this.viewConfig); + var firstGridDropTargetEl = firstGrid.getView().scroller.dom; + var firstGridDropTarget = new Ext.dd.DropTarget(firstGridDropTargetEl, { + ddGroup : 'firstGridDDGroup', + notifyDrop : function(ddSource, e, data){ + var records = ddSource.dragData.selections; + Ext.each(records, ddSource.grid.store.remove, ddSource.grid.store); + firstGrid.store.add(records); + firstGrid.store.sort('name', 'ASC'); + return true + } + }); + + + // This will make sure we only drop to the view scroller element + var secondGridDropTargetEl = secondGrid.getView().scroller.dom; + var secondGridDropTarget = new Ext.dd.DropTarget(secondGridDropTargetEl, { + ddGroup : 'secondGridDDGroup', + notifyDrop : function(ddSource, e, data){ + var records = ddSource.dragData.selections; + Ext.each(records, ddSource.grid.store.remove, ddSource.grid.store); + secondGrid.store.add(records); + secondGrid.store.sort('name', 'ASC'); + return true + } + }); + + firstGrid.render(document.body); + secondGrid.render(document.body); + + var window = new Ext.Window({ + title: 'Gateways Properties', + collapsible: false, + maximizable: false, + width: 500, + height: 400, + minWidth: 300, + minHeight: 200, + layout: 'fit', + plain: true, + bodyStyle: 'padding:5px;', + buttonAlign: 'center', + items: displayPanel, + buttons: [{ + text: 'Save' + },{ + text: 'Cancel' + }] + }); + window.show(); + +} + + +MyWorkflow.prototype.toggleShapes=function(item) +{ + + //Set the context Clicked Flag to false because context click action is performed + if(item.scope.workflow != null){ + item.scope.workflow.contextClicked = false; + if(item.scope.workflow.currentSelection != null){ + + //Get all the ports of the shapes + var ports = item.scope.workflow.currentSelection.getPorts(); + var len =ports.data.length; + + //Get all the connection of the shape + var conn = new Array(); + for(var i=0; i<=len; i++){ + if(typeof ports.data[i] === 'object') + conn[i] = ports.data[i].getConnections(); + } + + //Initializing Arrays and variables + var connLength = conn.length; + var sourceNode = new Array(); + var targetNode= new Array(); + var countConn = 0; + var sourcePortName= new Array(); + var targetPortName= new Array(); + var sourcePortId= new Array(); + var targetPortId= new Array(); + + //Get the pre-selected id into new variable to compare in future code + var shapeId = this.workflow.currentSelection.id; + + //Get the current pre-selected figure object in the new object, because not accessible after adding new shapes + var oldWorkflow = this.workflow.currentSelection; + + //Get the source and Target object of all the connections in an array + for(i = 0; i< connLength ; i++) + { + for(var j = 0; j < conn[i].data.length ; j++) + { + if(typeof conn[i].data[j] != 'undefined') + { + sourceNode[countConn] = conn[i].data[j].sourcePort.parentNode; + targetNode[countConn] = conn[i].data[j].targetPort.parentNode; + sourcePortName[countConn] = conn[i].data[j].sourcePort.properties.name; + targetPortName[countConn] = conn[i].data[j].targetPort.properties.name; + sourcePortId[countConn] = conn[i].data[j].sourcePort.parentNode.id; + targetPortId[countConn] = conn[i].data[j].targetPort.parentNode.id; + countConn++; + } + } + } + + //Add new selected Figure + var x =item.scope.workflow.currentSelection.getX(); //Get x co-ordinate from figure + var y =item.scope.workflow.currentSelection.getY(); //Get y co-ordinate from figure + + if(item.type == 'bpmnEventBoundaryTimerInter') + { + workflow.boundaryEvent = true; + workflow.taskName = oldWorkflow.taskName; + var newShape = eval("new bpmnTask(workflow)"); + //workflow.boundaryEvent = false; + + } + else if(item.type == 'bpmnSubProcess') + { + workflow.subProcessName = 'Sub Process'; + newShape = eval("new "+item.type+"(this.workflow)"); + } + else + newShape = eval("new "+item.type+"(this.workflow)"); + + this.workflow.addFigure(newShape,x,y); //Add New Selected Gateway First + + //Delete Old Shape + item.scope.workflow.getCommandStack().execute(new CommandDelete(oldWorkflow)); + ToolGeneric.prototype.execute.call(item.scope); + + //to create all the new connections again + var connObj; + for(i=0 ; i < countConn ; i++) + { + if(sourcePortId[i] == shapeId) //If shapeId is equal to sourceId the , replace the oldShape object by new shape Object + sourceNode[i] = newShape; + else + targetNode[i] = newShape; + + connObj = new DecoratedConnection(); + connObj.setTarget(eval('targetNode[i].getPort(targetPortName[i])')); + connObj.setSource(eval('sourceNode[i].getPort(sourcePortName[i])')); + newShape.workflow.addFigure(connObj); + } + + //Saving Asynchronously deleted shape and new created shape into DB + if(item.type.match(/Boundary/)) + { + newShape.id = oldWorkflow.id; + newShape.html.id = oldWorkflow.id; + newShape.actiontype = 'updateTask'; + workflow.saveShape(newShape); + } + if(newShape.type.match(/Event/) && newShape.type.match(/Inter/) && !item.type.match(/Boundary/)) + { + newShape.actiontype = 'updateEvent'; + //Set the Old Id to the Newly created Event + newShape.html.id = oldWorkflow.id; + newShape.id = oldWorkflow.id; + newShape.workflow.saveShape(newShape); + } + if(newShape.type == 'bpmnEventMessageStart' || newShape.type == 'bpmnEventTimerStart') + { + newShape.workflow.currentSelection = newShape; + var task_details = workflow.getStartEventConn(newShape,'targetPort','OutputPort'); + if(task_details.length > 0 ) + { + var task_uid = task_details[0].value; + newShape.task_uid = task_uid; + newShape.actiontype = 'addEvent'; + newShape.workflow.saveShape(newShape); + } + } + else if(newShape.type == 'bpmnEventEmptyStart') + { + workflow.deleteEvent(oldWorkflow); + newShape.workflow.currentSelection = newShape; + var task_details = workflow.getStartEventConn(newShape,'targetPort','OutputPort'); + if(task_details.length > 0 ) + { + var task_uid = task_details[0].value; + newShape.task_uid = task_uid; + newShape.actiontype = 'saveStartEvent'; + newShape.workflow.saveShape(newShape); + } + } + else if(newShape.type.match(/Gateway/)) + { + var shape = new Array(); + shape.type = ''; + newShape.workflow.saveRoute(newShape,shape); + } + + //Swapping from Task to subprocess and vice -versa + if((newShape.type == 'bpmnSubProcess' || newShape.type == 'bpmnTask') && !item.type.match(/Boundary/)) + { + newShape.actiontype = 'addSubProcess'; + if(newShape.type == 'bpmnTask') + newShape.actiontype = 'addTask'; + newShape.workflow.saveShape(newShape); + } + if((this.type == 'bpmnTask' || this.type == 'bpmnSubProcess') && !item.type.match(/Boundary/) ) + { + this.actiontype = 'deleteTask'; + this.noAlert = true; + if(this.type == 'bpmnSubProcess') + this.actiontype = 'deleteSubProcess'; + newShape.workflow.deleteSilently(this); + } + + } + } +} + +MyWorkflow.prototype.swapTaskSubprocess=function(itemObj) +{ + if(itemObj.type == 'bpmnSubProcess') + { + workflow.subProcessName = 'Sub Process'; + var newShape = eval("new "+itemObj.type+"(this.workflow)"); + } + else + newShape = eval("new "+itemObj.type+"(this.workflow)"); + + //Swapping from Task to subprocess and vice -versa + if((newShape.type == 'bpmnSubProcess' || newShape.type == 'bpmnTask') && !itemObj.type.match(/Boundary/)) + { + newShape.actiontype = 'addSubProcess'; + if(newShape.type == 'bpmnTask') + newShape.actiontype = 'addTask'; + newShape.workflow.saveShape(newShape); + } + if((this.type == 'bpmnTask' || this.type == 'bpmnSubProcess') && !itemObj.type.match(/Boundary/) ) + { + this.actiontype = 'deleteTask'; + this.noAlert = true; + if(this.type == 'bpmnSubProcess') + this.actiontype = 'deleteSubProcess'; + newShape.workflow.deleteShape(this); + } +} + +MyWorkflow.prototype.checkConnectionsExist=function(port,portType,portTypeName) +{ + //Get all the ports of the shapes + var ports = port.workflow.currentSelection.getPorts(); + var len =ports.data.length; + + //Get all the connection of the shape + var conn = new Array(); + for(var i=0; i<=len; i++){ + if(typeof ports.data[i] === 'object') + if(ports.data[i].type == portTypeName) + conn[i] = ports.data[i].getConnections(); + } + //Initializing Arrays and variables + var countConn = 0; + var portParentId= new Array(); + var portName = new Array(); + + //Get ALL the connections for the specified PORT + for(i = 0; i< conn.length ; i++) + { + if(typeof conn[i] != 'undefined') + for(var j = 0; j < conn[i].data.length ; j++) + { + if(typeof conn[i].data[j] != 'undefined') + { + portParentId[countConn] = eval('conn[i].data[j].'+portType+'.parentNode.id'); + portName[countConn] = eval('conn[i].data[j].'+portType+'.properties.name'); + countConn++; + } + } + } + var conx = 0; + var parentid; + for(i=0 ; i < countConn ; i++) + { + if(portParentId[i] == port.parentNode.id) + conx++; + } + return conx; + +} + +MyWorkflow.prototype.AddEventStartContextMenu=function(_4093) +{ + this.canvasEvent = Ext.get(_4093.id); + this.contextEventmenu = new Ext.menu.Menu({ + items: [{ + text: 'Event Type', + menu: { // <-- submenu by nested config object + items: [ + // stick any markup in a menu + { + text: 'Empty', + type:'bpmnEventEmptyStart', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }, + { + text: 'Message', + type:'bpmnEventMessageStart', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }, { + text: 'Timer', + type:'bpmnEventTimerStart', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }/*, { + text: 'Conditional', + type:'bpmnEventRuleStart', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }, { + text: 'Signal', + type:'bpmnEventSignalStart', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }, { + text: 'Multiple', + type:'bpmnEventMulStart', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }*/ + ] + }, + scope: this + },{ + text: 'Properties', + scope: this, + handler: MyWorkflow.prototype.editEventProperties + }] + }); + +this.canvasEvent.on('contextmenu', function(e) { + e.stopEvent(); + this.contextEventmenu.showAt(e.getXY()); +}, this); +} + +MyWorkflow.prototype.AddEventInterContextMenu=function(_4093) +{ + this.canvasEvent = Ext.get(_4093.id); + this.contextEventmenu = new Ext.menu.Menu({ + items: [{ + text: 'Event Type', + menu: { // <-- submenu by nested config object + items: [ + // stick any markup in a menu + /*{ + text: 'Empty', + type:'bpmnEventEmptyInter', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + },*/ + { + text: 'Message : Send', + type:'bpmnEventMessageSendInter', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }, + { + text: 'Message : Receive', + type:'bpmnEventMessageRecInter', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }, + { + text: 'Timer', + type:'bpmnEventTimerInter', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }, + { + text: 'Intermediate Boundary Timer', + type:'bpmnEventBoundaryTimerInter', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + } + /*, { + text: 'Compensate', + type:'bpmnEventCompInter', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }, { + text: 'Conditional', + type:'bpmnEventRuleInter', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }, { + text: 'Link', + type:'bpmnEventLinkInter', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }, { + text: 'Signal', + type:'bpmnEventInterSignal', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }, { + text: 'Multiple', + type:'bpmnEventMultipleInter', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }*/ + ] + }, + scope: this + },{ + text: 'Properties', + handler: MyWorkflow.prototype.editEventProperties, + scope: this + }] + }); + +this.canvasEvent.on('contextmenu', function(e) { + e.stopEvent(); + this.contextEventmenu.showAt(e.getXY()); +}, this); +} + +MyWorkflow.prototype.AddEventEndContextMenu=function(_4093) +{ + this.canvasEvent = Ext.get(_4093.id); + this.contextEventmenu = new Ext.menu.Menu({ + items: [{ + text: 'Event Type', + menu: { // <-- submenu by nested config object + items: [ + // stick any markup in a menu + { + text: 'Empty', + type:'bpmnEventEmptyEnd', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }, + { + text: 'Message', + type:'bpmnEventMessageEnd', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }/*, + { + text: 'Error', + type:'bpmnEventErrorEnd', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }, { + text: 'Cancel', + type:'bpmnEventCancelEnd', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }, { + text: 'Compensate', + type:'bpmnEventCompEnd', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }, { + text: 'Signal', + type:'bpmnEventEndSignal', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }, { + text: 'Multiple', + type:'bpmnEventMultipleEnd', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }, { + text: 'Terminate', + type:'bpmnEventTerminate', + scope:_4093, + handler: MyWorkflow.prototype.toggleShapes + }*/ + ] + }, + scope: this + },{ + text: 'Properties', + handler: MyWorkflow.prototype.editEventProperties, + scope: this + }] + }); + +this.canvasEvent.on('contextmenu', function(e) { + e.stopEvent(); + this.contextEventmenu.showAt(e.getXY()); +}, this); +} + +MyWorkflow.prototype.disablePorts=function(_4985) +{ + if(_4985.type != ''){ + var ports =''; + if(_4985.type.match(/Task/) || _4985.type.match(/Gateway/) || _4985.type.match(/Inter/) || _4985.type.match(/SubProcess/)){ + ports = ['output1','input1','output2','input2']; + } + else if(_4985.type.match(/End/)){ + ports = ['input1','input2']; + } + else if(_4985.type.match(/Start/)){ + ports = ['output1','output2']; + } + else if(_4985.type.match(/Annotation/)){ + ports = ['input1']; + } + for(var i=0; i< ports.length ; i++){ + eval('_4985.'+ports[i]+'.setZOrder(-1)'); + eval('_4985.'+ports[i]+'.setBackgroundColor(new Color(255, 255, 255))'); + eval('_4985.'+ports[i]+'.setColor(new Color(255, 255, 255))'); + } + } +} + +MyWorkflow.prototype.enablePorts=function(_39fd,port) +{ + /*Setting Background ,border and Z-order of the flow menu back to original when clicked + *on the shape + **/ + for(var i=0; i< port.length ; i++){ + if(port[i].match(/input/)) + eval('_39fd.workflow.currentSelection.'+port[i]+'.setBackgroundColor(new Color(245, 115, 115))'); + else + eval('_39fd.workflow.currentSelection.'+port[i]+'.setBackgroundColor(new Color(115, 115, 245))'); + + eval('_39fd.workflow.currentSelection.'+port[i]+'.setColor(new Color(90, 150, 90))'); + eval('_39fd.workflow.currentSelection.'+port[i]+'.setZOrder(50000)'); + } +} + +MyWorkflow.prototype.disableFlowMenu =function(_39fd,port) +{ + /*Setting Background ,border and Z-order of the flow menu back to original when clicked + *on the shape + **/ + for(var i=0; i< port.length ; i++){ + if(port[i].match(/input/)) + eval('_39fd.workflow.currentSelection.'+port[i]+'.setBackgroundColor(new Color(245, 115, 115))'); + else + eval('_39fd.workflow.currentSelection.'+port[i]+'.setBackgroundColor(new Color(115, 115, 245))'); + eval('_39fd.workflow.currentSelection.'+port[i]+'.setColor(new Color(90, 150, 90))'); + eval('_39fd.workflow.currentSelection.'+port[i]+'.setZOrder(50000)'); + } +} + +MyWorkflow.prototype.handleContextMenu=function(_39fd) +{ + workflow.hideResizeHandles(); + //Enable the contextClicked Flag + workflow.contextClicked = true; + + //Set the current Selection to the selected Figure + workflow.setCurrentSelection(_39fd); + + //Disable Resize of all the figures + //_39fd.workflow.hideResizeHandles(); +// _39fd.setSelectable(false); +// _39fd.setResizeable(false); + //Handle the Right click menu + var pmosExtObj = new pmosExt(); + //Load all the process Data + pmosExtObj.loadProcess(_39fd); + + //Load Dynaform List + // pmosExtObj.loadDynaforms(_39fd); + + if(_39fd.type != ''){ + if(_39fd.type.match(/Task/)){ + _39fd.workflow.taskid = new Array(); + _39fd.workflow.taskid.value = _39fd.id; + pmosExtObj.loadTask(_39fd); + _39fd.workflow.AddTaskContextMenu(_39fd); + } + else if(_39fd.type.match(/Start/)){ + _39fd.workflow.taskUid = _39fd.workflow.getStartEventConn(_39fd,'targetPort','OutputPort'); + pmosExtObj.loadDynaforms(_39fd); + if(_39fd.type.match(/Message/)) + pmosExtObj.loadWebEntry(_39fd); + _39fd.workflow.AddEventStartContextMenu(_39fd); + } + else if(_39fd.type.match(/Inter/)){ + _39fd.workflow.taskUidFrom = _39fd.workflow.getStartEventConn(_39fd,'sourcePort','InputPort'); + //_39fd.workflow.taskid = _39fd.workflow.taskUid[0]; + _39fd.workflow.taskUidTo = _39fd.workflow.getStartEventConn(_39fd,'targetPort','OutputPort'); + _39fd.workflow.taskid = _39fd.workflow.taskUidFrom[0]; + pmosExtObj.loadTask(_39fd); + pmosExtObj.getTriggerList(_39fd); + _39fd.workflow.AddEventInterContextMenu(_39fd); + } + else if(_39fd.type.match(/End/)){ + _39fd.workflow.taskUid = _39fd.workflow.getStartEventConn(_39fd,'sourcePort','InputPort'); + _39fd.workflow.AddEventEndContextMenu(_39fd); + } + else if(_39fd.type.match(/Gateway/)){ + _39fd.workflow.AddGatewayContextMenu(_39fd); + } + else if(_39fd.type.match(/SubProcess/)){ + _39fd.workflow.AddSubProcessContextMenu(_39fd); + } + } + //this.workflow.AddEventStartContextMenu(_39fd); + + +} + + +MyWorkflow.prototype.getCommonConnections = function(_4356) +{ + var routes = new Array(); + var counter = 0 + for(var p=0; p < _4356.workflow.commonPorts.data.length; p++) + { + if(typeof _4356.workflow.commonPorts.data[p] === "object" && _4356.workflow.commonPorts.data[p] != null) + { + counter++; + } + } + for(var j=0; j< counter; j++) + { + //var temp1 = eval("this.workflow.commonPorts.data["+i+"].parentNode.output"+count+".getConnections()"); + var tester = _4356.workflow.commonPorts.data; + var temp1 = eval("_4356.workflow.commonPorts.data["+j+"].getConnections()"); + if(temp1.data[0]){ + if(routes[j]) + { + if(routes[j][1] != temp1.data[0].sourcePort.parentNode.id) + { + routes[j] = new Array(3); + + routes[j][0] = temp1.data[0].id; + routes[j][1] = temp1.data[0].sourcePort.parentNode.id; + routes[j][2] = temp1.data[0].targetPort.parentNode.id; + routes[j][3] = temp1.data[0].targetPort.properties.name; + routes[j][4] = temp1.data[0].sourcePort.properties.name; + } + } + else + { + routes[j] = new Array(3); + routes[j][0] = temp1.data[0].id; + routes[j][1] = temp1.data[0].sourcePort.parentNode.id; + routes[j][2] = temp1.data[0].targetPort.parentNode.id; + routes[j][3] = temp1.data[0].targetPort.properties.name; + routes[j][4] = temp1.data[0].sourcePort.properties.name; + } + } + //j++; +// while(routes[j]) +// { +// j++ +// }; +// j--; + } + var j = 0; + var serial = new Array(); + for(key in routes) + { + if(typeof routes[key] === 'object'){ + serial[j] = routes[key]; + j++; + } + } + var routes = serial.getUniqueValues(); + for(var i=0;i< routes.length ; i++) + { + routes[i] = routes[i].split(','); + } + + return routes; +} + +Array.prototype.getUniqueValues = function () { +var hash = new Object(); +for (j = 0; j < this.length; j++) {hash[this[j]] = true} +var array = new Array(); +for (value in hash) {array.push(value)}; +return array; +} + +MyWorkflow.prototype.getUrlVars = function() +{ + var vars = [], hash; + var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); + + for(var i = 0; i < hashes.length; i++) + { + hash = hashes[i].split('='); + vars.push(hash[0]); + vars[hash[0]] = hash[1]; + } + var pro_uid = vars["PRO_UID"]; + return pro_uid; +} + +MyWorkflow.prototype.saveShape= function(newShapeObj) +{ + //Initializing variables + + var pro_uid = this.getUrlVars(); + var shapeId = newShapeObj.id; + var actiontype = newShapeObj.actiontype; + var xpos = newShapeObj.x; + var ypos = newShapeObj.y; + var pos = '{"x":'+xpos+',"y":'+ypos+'}'; + + var width = newShapeObj.width; + var height = newShapeObj.height; + var cordinates = '{"x":'+width+',"y":'+height+'}'; + + if(newShapeObj.type == 'bpmnTask'){ + var newlabel = newShapeObj.taskName; + } + if(newShapeObj.type == 'bpmnAnnotation'){ + newlabel = newShapeObj.annotationName; + } + + //var urlparams = "action=addTask&data={"uid":"4708462724ca1d281210739068208635","position":{"x":707,"y":247}}"; + var urlparams; + switch(actiontype) + { + case 'addTask': + urlparams = '?action='+actiontype+'&data={"uid":"'+ pro_uid +'","position":'+pos+'}'; + break; + case 'updateTask': + urlparams = '?action='+actiontype+'&data={"uid":"'+ shapeId +'","boundary":"TIMER"}'; + break; + case 'saveTaskPosition': + urlparams = '?action='+actiontype+'&data={"uid":"'+ shapeId +'","position":'+pos+'}'; + break; + case 'saveTaskCordinates': + urlparams = '?action='+actiontype+'&data={"uid":"'+ shapeId +'","position":'+cordinates+'}'; + break; + case 'saveAnnotationCordinates': + urlparams = '?action='+actiontype+'&data={"uid":"'+ shapeId +'","position":'+cordinates+'}'; + break; + case 'updateTaskName': + urlparams = '?action='+actiontype+'&data={"uid":"'+ shapeId +'","label":"'+newlabel+'"}'; + break; + case 'addSubProcess': + urlparams = '?action='+actiontype+'&data={"uid":"'+ pro_uid +'","position":'+pos+'}'; + break; + case 'addText': + urlparams = '?action='+actiontype+'&data={"uid":"'+ pro_uid +'","label":"'+newlabel+'","position":'+pos+'}'; + break; + case 'updateText': + urlparams = '?action='+actiontype+'&data={"uid":"'+ shapeId +'","label":"'+newlabel+'"}'; + break; + case 'saveTextPosition': + urlparams = '?action='+actiontype+'&data={"uid":"'+ shapeId +'","position":'+pos+'}'; + break; + case 'saveStartEvent': + //If we change Event to start from Message/Timer then Delete the record from Events Table + this.deleteEvent(newShapeObj); + var tas_start = 'TRUE'; + var tas_uid = newShapeObj.task_uid; + urlparams = '?action='+actiontype+'&data={"tas_uid":"'+tas_uid+'","tas_start":"'+tas_start+'"}'; + break; + case 'addEvent': + var tas_uid = newShapeObj.workflow.taskUid[0].value; + var tas_type = newShapeObj.type; + urlparams = '?action='+actiontype+'&data={"uid":"'+ pro_uid +'","tas_uid":"'+tas_uid+'","tas_type":"'+tas_type+'"}'; + break; + case 'updateEvent': + var evn_uid = newShapeObj.id + var evn_type = newShapeObj.type; + urlparams = '?action='+actiontype+'&data={"evn_uid":"'+evn_uid +'","evn_type":"'+evn_type+'"}'; + break; + } + //var urlparams = '?action='+actiontype+'&data={"uid":"'+ pro_uid +'","position":'+pos+'}'; + + + Ext.Ajax.request({ + url: "processes_Ajax.php"+ urlparams, + success: function(response) { + //Ext.Msg.alert (response.responseText); + if(response.responseText != 1 && response.responseText != "") + { + this.workflow.newTaskInfo = Ext.util.JSON.decode(response.responseText); + newShapeObj.html.id = this.workflow.newTaskInfo.uid; + newShapeObj.id = this.workflow.newTaskInfo.uid; + if(newShapeObj.type == 'bpmnTask'){ + newShapeObj.taskName = this.workflow.newTaskInfo.label; + //After Figure is added, Update Start Event connected to Task + if(typeof this.workflow.preSelectedObj != 'undefined' ) + { + var preSelectedFigure = this.workflow.preSelectedObj; + if(preSelectedFigure.type.match(/Start/) && preSelectedFigure.type.match(/Event/)) + this.workflow.saveEvents(preSelectedFigure,newShapeObj); + + if(preSelectedFigure.type.match(/Task/)) + this.workflow.saveRoute(preSelectedFigure,newShapeObj); + + if (preSelectedFigure.type.match(/Gateway/)) { + //preSelectedFigure.rou_type = 'SEQUENTIAL'; + this.workflow.saveRoute(preSelectedFigure,newShapeObj); + } + } + else if(newShapeObj.type == 'bpmnSubProcess'){ + newShapeObj.subProcessName = this.workflow.newTaskInfo.label; + } + } + } + }, + failure: function(){ + //Ext.Msg.alert ('Failure'); + } + }); +} + +//Deleting shapes silently on swapping task to sub process and vice-versa +MyWorkflow.prototype.deleteSilently= function(shapeObj) +{ + //Initializing variables + + var pro_uid = this.getUrlVars(); + var shapeId = shapeObj.id; + var actiontype = shapeObj.actiontype; + //var shapeName = ''; + + switch(actiontype) + { + case 'deleteTask': + var urlparams = '?action='+actiontype+'&data={"pro_uid":"'+ pro_uid +'","tas_uid":"'+shapeId+'"}'; + this.urlparameter = urlparams; + //shapeName = 'Task :'+ shapeObj.taskName; + break; + case 'deleteSubProcess': + urlparams = '?action='+actiontype+'&data={"pro_uid":"'+ pro_uid +'","tas_uid":"'+shapeId+'"}'; + this.urlparameter = urlparams; + //shapeName = shapeObj.subProcessName; + break; + } + + Ext.Ajax.request({ + url: "processes_Ajax.php"+ urlparams, + success: function(response) { + //Ext.Msg.alert (response.responseText); + }, + failure: function(){ + Ext.Msg.alert ('Failure'); + } + }); + //workflow.getCommandStack().execute(new CommandDelete(workflow.getCurrentSelection())); + +} + +MyWorkflow.prototype.deleteShape= function(shapeObj) +{ + //Initializing variables + + var pro_uid = this.getUrlVars(); + var shapeId = shapeObj.id; + var actiontype = shapeObj.actiontype; + var shapeName = ''; + + switch(actiontype) + { + case 'deleteTask': + var urlparams = '?action='+actiontype+'&data={"pro_uid":"'+ pro_uid +'","tas_uid":"'+shapeId+'"}'; + this.urlparameter = urlparams; + shapeName = 'Task :'+ shapeObj.taskName; + break; + case 'deleteSubProcess': + urlparams = '?action='+actiontype+'&data={"pro_uid":"'+ pro_uid +'","tas_uid":"'+shapeId+'"}'; + this.urlparameter = urlparams; + shapeName = shapeObj.subProcessName; + break; + case 'deleteText': + urlparams = '?action='+actiontype+'&data={"uid":"'+shapeId+'"}'; + this.urlparameter = urlparams; + shapeName = 'Annotation'; + break; + case 'saveStartEvent': + var task_detail = this.getStartEventConn(this.currentSelection,'targetPort','OutputPort'); + if(task_detail.length > 0){ + var tas_uid = task_detail[0].value; + var tas_start = 'FALSE'; + urlparams = '?action=saveStartEvent&data={"tas_uid":"'+tas_uid+'","tas_start":"'+tas_start+'"}'; + this.urlparameter = urlparams; + shapeName = 'Start Event'; + } + break; + case 'deleteEndEvent': + shapeName = 'End Event'; + shapeObj.workflow.getCommandStack().execute(new CommandDelete(shapeObj.workflow.getCurrentSelection())); + break; + } + + //Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete the '+ shapeName,this.showResult); + +if(shapeObj.noAlert == null) + Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete the '+ shapeName,this.showResult); +else + workflow.showResult('yes'); +} + + + +MyWorkflow.prototype.showResult = function(btn){ + //this.workflow.confirm = btn; + if(typeof workflow.urlparameter != 'undefined') + { + var url = workflow.urlparameter; + if(btn == 'yes') + { + Ext.Ajax.request({ + url: "processes_Ajax.php"+ url, + success: function(response) { + //Ext.Msg.alert (response.responseText); + }, + failure: function(){ + Ext.Msg.alert ('Failure'); + } + }); + workflow.getCommandStack().execute(new CommandDelete(workflow.getCurrentSelection())); + } + } + //Ext.example.msg('Button Click', 'You clicked the {0} button', btn); + }; + + +MyWorkflow.prototype.editEventProperties = function(_6752) +{ + var currentSelection = _6752.scope.currentSelection; + var pmosExtObj = new pmosExt(); + + switch (currentSelection.type){ + case 'bpmnEventMessageStart': + pmosExtObj.popWebEntry(currentSelection); + break; + case 'bpmnEventTimerStart': + pmosExtObj.popCaseSchedular(currentSelection); + break; + case 'bpmnEventMessageSendInter': + pmosExtObj.popTaskNotification(currentSelection); + break; + case 'bpmnEventTimerInter': + pmosExtObj.popMultipleEvent(currentSelection); + break; + case 'bpmnEventMessageEnd': + pmosExtObj.popMessageEvent(currentSelection); + break; + } +} + + /* + * Get the Source /Target shape + * param object _9854 + * param string port + * return array + */ + +MyWorkflow.prototype.getStartEventConn = function(_9854,port,portType) +{ + //Get all the ports of the shapes + var ports = _9854.workflow.currentSelection.getPorts(); + var len =ports.data.length; + + //Get all the connection of the shape + var conn = new Array(); + for(var i=0; i<=len; i++){ + if(typeof ports.data[i] === 'object') + if(ports.data[i].type == portType) + conn[i] = ports.data[i].getConnections(); + } + //Initializing Arrays and variables + var countConn = 0; + var startTask= new Array(); + var type; + //Get ALL the connections for the specified PORT + for(i = 0; i< conn.length ; i++) + { + if(typeof conn[i] != 'undefined') + for(var j = 0; j < conn[i].data.length ; j++) + { + if(typeof conn[i].data[j] != 'undefined') + { + type = eval('conn[i].data[j].'+port+'.parentNode.type') + if(type == 'bpmnTask') + { + startTask[countConn] = new Array(); + startTask[countConn].value = eval('conn[i].data[j].'+port+'.parentNode.id'); + startTask[countConn].name = eval('conn[i].data[j].'+port+'.parentNode.taskName'); + countConn++; + } + } + } + } + return startTask; +} + +MyWorkflow.prototype.saveEvents = function(event,tas_uid) +{ + var pro_uid = this.getUrlVars(); + if(event.type.match(/Start/) && event.type.match(/Empty/)) + { + var tas_start = 'TRUE'; + var urlparams = '?action=saveStartEvent&data={"tas_uid":"'+tas_uid+'","tas_start":"'+tas_start+'"}'; + } + else if(event.type.match(/Start/) && (event.type.match(/Message/) || event.type.match(/Timer/)) ) + { + urlparams = '?action=addEvent&data={"uid":"'+ pro_uid +'","tas_uid":"'+tas_uid+'","tas_type":"'+event.type+'"}'; + } + else if(event.type.match(/Inter/)) + { + urlparams = '?action=addEvent&data={"uid":"'+ pro_uid +'","tas_from":"'+tas_uid.taskFrom+'","tas_to":"'+tas_uid.taskTo+'","tas_type":"'+event.type+'"}'; + } + + if(urlparams != ''){ + Ext.Ajax.request({ + url: "processes_Ajax.php"+ urlparams, + success: function(response) { + if(response.responseText != '') + { + //Save Route + if(workflow.currentSelection.type == 'bpmnEventTimerInter'){ + workflow.currentSelection.id = response.responseText; + var newObj = workflow.currentSelection; + var preObj = new Array(); + preObj.type = 'bpmnTask'; + preObj.id = tas_uid.taskFrom; + newObj.evn_uid = workflow.currentSelection.id; + newObj.task_to = tas_uid.taskTo; + this.workflow.saveRoute(preObj,newObj); + } + } + }, + failure: function(){ + Ext.Msg.alert ('Failure'); + } + }); + } + +} + +MyWorkflow.prototype.saveRoute = function(preObj,newObj) +{ + var pro_uid = this.getUrlVars(); + + var task_uid = new Array(); + var next_task_uid = new Array(); + var rou_type =''; + var rou_evn_uid = ''; + var port_numberIP = ''; + var port_numberOP = ''; + + if(typeof newObj.sPortType != 'undefined') + { + sPortTypeIP = newObj.sPortType; + sPortTypeOP = preObj.sPortType; + var sPortType_lenIP = sPortTypeIP.length; + var sPortType_lenOP = sPortTypeOP.length; + var port_numberIP = sPortTypeIP.charAt(sPortType_lenIP-1); + var port_numberOP = sPortTypeOP.charAt(sPortType_lenOP-1); + } + + if(preObj.type.match(/Task/) && newObj.type.match(/Event/) && newObj.type.match(/Inter/)) + { + task_uid[0] = preObj.id; + next_task_uid[0] = newObj.task_to; + rou_type = 'SEQUENTIAL'; + rou_evn_uid = newObj.evn_uid; + } + //If both the Object are Task + else if(preObj.type.match(/Task/) && newObj.type.match(/Task/)) + { + task_uid[0] = preObj.id; + next_task_uid[0] = newObj.id; + rou_type = 'SEQUENTIAL'; + } + else if(preObj.type.match(/Task/) && newObj.type.match(/End/) && newObj.type.match(/Event/)) + { + this.deleteRoute(newObj.conn,1); + task_uid[0] = preObj.id; + next_task_uid[0] = '-1'; + rou_type = 'SEQUENTIAL'; + } + else if(preObj.type.match(/Gateway/)) + { +// var task_uid = new Array(); +// var next_task_uid = new Array(); + switch(preObj.type){ + case 'bpmnGatewayParallel': + rou_type ='PARALLEL'; + break; + case 'bpmnGatewayExclusiveData': + rou_type = 'EVALUATE'; + break; + case 'bpmnGatewayInclusive': + rou_type = 'PARALLEL-BY-EVALUATION'; + break; + case 'bpmnGatewayComplex': + rou_type = 'DISCRIMINATOR'; + break; + } + var ports = preObj.getPorts(); + var len =ports.data.length; + + //Get all the connection of the shape + var conn = new Array(); + var count1 = 0; + var count2 = 0; + for(var i=0; i<=len; i++){ + if(typeof ports.data[i] === 'object') + conn[i] = ports.data[i].getConnections(); + } + + //Get ALL the connections for the specified PORT + for(i = 0; i< conn.length ; i++) + { + if(typeof conn[i] != 'undefined') + for(var j = 0; j < conn[i].data.length ; j++) + { + if(typeof conn[i].data[j] != 'undefined') + { + if(conn[i].data[j].sourcePort.parentNode.type != preObj.type){ + // task_uid[count1] = new Array(); + task_uid[count1] = conn[i].data[j].sourcePort.parentNode.id; + count1++; + } + if(conn[i].data[j].targetPort.parentNode.type != preObj.type){ + // task_uid[count2] = new Array(); + next_task_uid[count2] = conn[i].data[j].targetPort.parentNode.id; + count2++; + } + + } + } + } + } + + var staskUid = Ext.util.JSON.encode(task_uid); + var sNextTaskUid = Ext.util.JSON.encode(next_task_uid); + if(staskUid != '') + { + Ext.Ajax.request({ + url: "patterns_Ajax.php", + success: function(response) { + if(response.responseText != 0){ + if(typeof newObj.conn != 'undefined'){ + newObj.conn.html.id = response.responseText; + newObj.conn.id = response.responseText; + } + } + }, + failure: function(){ + Ext.Msg.alert ('Failure'); + }, + params: { + action:'savePattern', + PROCESS: pro_uid, + TASK:staskUid, + ROU_NEXT_TASK:sNextTaskUid, + ROU_TYPE:rou_type, + ROU_EVN_UID:rou_evn_uid, + PORT_NUMBER_IP:port_numberIP, + PORT_NUMBER_OP:port_numberOP, + mode:'Ext' + } + }); + } +} + +MyWorkflow.prototype.deleteRoute = function(conn,val){ +//var confirm = confirm('Are you sure you want to delete the route'); +//if(confirm){ + var rou_uid = conn.id; + if(rou_uid != '') + { + var urlparams = '?action=deleteRoute&data={"uid":"'+ rou_uid +'"}'; + Ext.Ajax.request({ + url: "processes_Ajax.php"+ urlparams, + success: function(response) { + if(val == 0) + conn.workflow.getCommandStack().execute(new CommandDelete(conn)); + }, + failure: function(){ + Ext.Msg.alert ('Failure'); + } + }); + } + // } +} + +MyWorkflow.prototype.deleteEvent = function(eventObj){ + + var event_uid = eventObj.id; + if(event_uid != '') + { + var urlparams = '?action=deleteEvent&data={"uid":"'+ event_uid +'"}'; + Ext.Ajax.request({ + url: "processes_Ajax.php"+ urlparams, + success: function(response) { + }, + failure: function(){ + Ext.Msg.alert ('Failure'); + } + }); + } +} + +MyWorkflow.prototype.getDeleteCriteria = function() +{ + var shape = workflow.currentSelection.type; + switch (shape) { + case 'bpmnTask': + workflow.currentSelection.actiontype = 'deleteTask'; + workflow.taskNo--; + break; + case 'bpmnSubProcess': + workflow.currentSelection.actiontype = 'deleteSubProcess'; + break; + case 'bpmnAnnotation': + workflow.currentSelection.actiontype = 'deleteText'; + break; + case 'bpmnEventEmptyStart': + workflow.currentSelection.actiontype = 'saveStartEvent'; + break; + case 'bpmnEventEmptyEnd': + workflow.currentSelection.actiontype = 'deleteEndEvent'; + var currentObj = workflow.currentSelection; + var ports = currentObj.getPorts(); + var len =ports.data.length; + + //Get all the connection of the shape + var conn = new Array(); + for(var i=0; i<=len; i++){ + if(typeof ports.data[i] === 'object') + conn[i] = ports.data[i].getConnections(); + } + //Get ALL the connections for the specified PORT + for(i = 0; i< conn.length ; i++) + { + if(typeof conn[i] != 'undefined') + for(var j = 0; j < conn[i].data.length ; j++) + { + if(typeof conn[i].data[j] != 'undefined') + { + if(conn[i].data[j].targetPort.parentNode.id == currentObj.id){ + route = conn[i].data[j]; + break; + } + } + } + } + workflow.deleteRoute(route,1); + break; +} + workflow.deleteShape(workflow.currentSelection); +} diff --git a/workflow/engine/templates/bpmn/Pool.js b/workflow/engine/templates/bpmn/Pool.js new file mode 100755 index 000000000..6c3946973 --- /dev/null +++ b/workflow/engine/templates/bpmn/Pool.js @@ -0,0 +1,53 @@ +bpmnPool = function (workflow) { + VectorFigure.call(this); + this.setDimension(800, 600); + var figures = workflow.getFigures(); + for(var i=0;iLink<\/a>', + width :100 + },{ + sortable: false, + renderer: function() + { + return String.format("x<\/a>"); + } + } + ] + }] + + }); + + exportProcessForm.render(document.body); + var pro_uid = workflow.getUrlVars(); + workflow.exportProcessForm = exportProcessForm; + exportProcessForm.form.load({ + url:'proxyProcesses_Export?pro_uid='+pro_uid, + method:'GET', + waitMsg:'Loading', + success:function(form, action) { + var aData = action.result.data; + var fieldSet = workflow.exportProcessForm.items.items[0]; + var fields = fieldSet.items.items; + + var link = new Ext.form.TextField({ + xtype : 'button', + name : 'FILENAME_LINK', + html : 'Link<\/a>', + width :100 + }); + workflow.exportProcessForm.add(link); + //this.add(form); + //this.doLayout(); + + fields[5].render = 'x<\/a>'; + workflow.FILENAME_LINK = aData.FILENAME_LINK; + //workflow.FILENAME_LINKXPDL = aData.FILENAME_LINKXPDL; + }, + failure:function(form, action) { + // Ext.MessageBox.alert('Message', 'Load failed'); + } + }); + var exportProcesswindow = new Ext.Window({ + title : 'Export Process', + collapsible: false, + maximizable: false, + width : 450, + height : 450, + minWidth : 300, + minHeight : 200, + layout : 'fit', + plain : true, + bodyStyle : 'padding:5px;', + buttonAlign: 'center', + items : exportProcessForm + }); + workflow.exportProcesswindow = exportProcesswindow; + exportProcesswindow.show(); +} + +ProcessMapContext.prototype.addTask= function() +{ + Ext.MessageBox.alert('Status','Add Task'); +} + +ProcessMapContext.prototype.horiLine= function() +{ + Ext.MessageBox.alert('Status','Horizontal Line'); +} + +ProcessMapContext.prototype.vertiLine= function() +{ + Ext.MessageBox.alert('Status','Vertical Line'); +} + +ProcessMapContext.prototype.delLines= function() +{ + Ext.MessageBox.alert('Status','Delete All Lines'); +} + +ProcessMapContext.prototype.processPermission= function() +{ + Ext.MessageBox.alert('Status','Process Permission'); +} + +ProcessMapContext.prototype.caseTracker= function() +{ + Ext.MessageBox.alert('Status','Case Tracker'); +} +ProcessMapContext.prototype.processFileManager= function() +{ + var AwesomeUploaderInstance = new AwesomeUploader({ + title:'Ext JS Super Uploader' + ,renderTo:'paintarea' + ,frame:true + ,width:500 + ,height:300 + }); + + var window = new Ext.Window({ + title: 'Edit Process', + collapsible: false, + maximizable: false, + width: 500, + height: 400, + minWidth: 300, + minHeight: 200, + layout: 'fit', + plain: true, + bodyStyle: 'padding:5px;', + buttonAlign: 'center', + items: AwesomeUploaderInstance, + buttons: [{ + text: 'Save', + handler: function(){ + //waitMsg: 'Saving...', // Wait Message + var fields = editProcess.items.items; + var pro_title = fields[0].items.items[0].getValue(); + var pro_description = fields[0].items.items[1].getValue(); + var pro_calendar = fields[0].items.items[2].getValue(); + var pro_category = fields[0].items.items[3].getValue(); + var pro_debug = fields[0].items.items[4].getValue(); + if(pro_debug == true) + pro_debug = '1'; + else + pro_debug = '0'; + + var pro_uid = _5678.scope.workflow.getUrlVars(); + + var urlparams = '?action=saveProcess&data={"PRO_UID":"'+ pro_uid +'","PRO_CALENDAR":"'+ pro_calendar +'","PRO_CATEGORY":"'+ pro_category +'","PRO_DEBUG":"'+ pro_debug +'","PRO_DESCRIPTION":"'+ pro_description +'","PRO_TITLE":"'+ pro_title +'",}'; + Ext.Ajax.request({ + url: "processes_Ajax.php"+ urlparams, + success: function(response) { + window.close(); + }, + failure: function(){ + Ext.Msg.alert ('Failure'); + } + }); + } + },{ + text: 'Cancel', + handler: function(){ + // when this button clicked, + window.close(); + } + }] + }); + window.show(); +} \ No newline at end of file diff --git a/workflow/engine/templates/bpmn/ProcessOptions.js b/workflow/engine/templates/bpmn/ProcessOptions.js new file mode 100755 index 000000000..2cec6dedc --- /dev/null +++ b/workflow/engine/templates/bpmn/ProcessOptions.js @@ -0,0 +1,430 @@ +ProcessOptions=function(id){ +Workflow.call(this,id); +}; +ProcessOptions.prototype=new Workflow; +ProcessOptions.prototype.type="ProcessOptions"; + + +/** + * 'addDynaform' function that will allow adding new dynaforms and showing list of + * dynaforms available +*/ +ProcessOptions.prototype.addDynaform= function(_5625) +{ + var pro_uid = workflow.getUrlVars(); + //var taskId = workflow.currentSelection.id; + + var dynaFields = Ext.data.Record.create([ + { name: 'DYN_UID', type: 'string'}, + { name: 'DYN_TYPE', type: 'string'}, + { name: 'DYN_TITLE', type: 'string'}, + { name: 'DYN_DISCRIPTION',type: 'string'} + ]); + + var editor = new Ext.ux.grid.RowEditor({ + saveText: 'Update' + }); + var btnAdd = new Ext.Button({ + id: 'btnAdd', + text: 'New Dynaform', + iconCls: 'application_add', + handler: function () { + + } + }); + + var btnRemove = new Ext.Button({ + id: 'btnRemove', + text: 'Delete Dynaform', + iconCls: 'application_delete', + handler: function (s) { + editor.stopEditing(); + var s = dynaformGrid.getSelectionModel().getSelections(); + for(var i = 0, r; r = s[i]; i++){ + + //First Deleting dynaform from Database using Ajax + var dynUID = r.data.DYN_UID; + + //if STEP_UID is properly defined (i.e. set to valid value) then only delete the row + //else its a BLANK ROW for which Ajax should not be called. + if(r.data.DYN_UID != "") + { + Ext.Ajax.request({ + url : '../dynaforms/dynaforms_Delete.php', + method: 'POST', + params: { + DYN_UID : dynUID + }, + success: function(response) { + Ext.MessageBox.alert ('Status','Dynaform has been removed successfully.'); + } + }); + } + + //Secondly deleting from Grid + taskDynaform.remove(r); + } + } + }); + + var tb = new Ext.Toolbar({ + items: [btnAdd, btnRemove] + }); + + var taskDynaform = new Ext.data.JsonStore({ + root : 'data', + totalProperty: 'totalCount', + idProperty : 'gridIndex', + remoteSort : true, + fields : dynaFields, + proxy: new Ext.data.HttpProxy({ + url: 'proxyDynaform?pid='+pro_uid + }) + }); + taskDynaform.load(); + + //Creating store for getting list of additional PM tables + var additionalTablesFields = Ext.data.Record.create([ + { name: 'ADD_TAB_UID', type: 'string'}, + { name: 'ADD_TAB_NAME', type: 'string'}, + { name: 'ADD_TAB_DESCRIPTION',type: 'string'} + ]); + + var additionalTables = new Ext.data.JsonStore({ + root : 'data', + totalProperty: 'totalCount', + idProperty : 'gridIndex', + remoteSort : true, + fields : additionalTablesFields, + proxy: new Ext.data.HttpProxy({ + url: 'proxyDynaform' + }) + }); + additionalTables.load(); + + //Creating store for getting list of Fields of additional PM tables + var TablesFields = Ext.data.Record.create([ + { name: 'FLD_UID',type: 'string'}, + { name: 'FLD_NAME',type: 'string'}, + { name: 'FLD_DESCRIPTION',type: 'string'}, + { name: 'FLD_TYPE',type: 'string'} + ]); + + var tablesFieldsStore = new Ext.data.JsonStore({ + root : 'data', + totalProperty: 'totalCount', + idProperty : 'gridIndex', + remoteSort : true, + fields : TablesFields, + proxy: new Ext.data.HttpProxy({ + url: 'proxyDynaform' + }) + }); + //tablesFieldsStore.load(); + + var dynaformColumns = new Ext.grid.ColumnModel({ + columns: [ + new Ext.grid.RowNumberer(), + { + id: 'DYN_TITLE', + header: 'Title', + dataIndex: 'DYN_TITLE', + width: 280, + editable: false, + editor: new Ext.form.TextField({ + //allowBlank: false + }) + }, + { + sortable: false, + renderer: function(val, meta, record) + { + return String.format("Edit",pro_uid,record.data.DYN_UID); + } + } + ] + }); + + var addTableColumns = new Ext.grid.ColumnModel({ + columns: [ + new Ext.grid.RowNumberer(), + { + id: 'FLD_NAME', + header: 'Primary Key', + dataIndex: 'FLD_NAME', + width: 200, + editable: false, + sortable: true, + editor: { + xtype: 'textfield', + allowBlank: false, + name : 'FLD_NAME' + } + },{ + id: 'PRO_VARIABLE', + header: 'Variables', + dataIndex: 'PRO_VARIABLE', + width: 200, + sortable: true, + editor: { + xtype: 'textfield', + allowBlank: false, + name : 'PRO_VARIABLE' + } + },{ + sortable: false, + renderer: function(val){return '';} + } + ] + }); + + /*var dynaformGrid = new Ext.grid.GridPanel({ + store: taskDynaform, + id : 'mygrid', + loadMask: true, + loadingText: 'Loading...', + renderTo: 'cases-grid', + frame: false, + autoHeight:false, + clicksToEdit: 1, + minHeight:400, + height :400, + layout: 'fit', + cm: dynaformColumns, + stripeRows: true, + tbar: tb, + viewConfig: {forceFit: true} + });*/ + + var dynaformDetails = new Ext.FormPanel({ + labelWidth: 100, + bodyStyle :'padding:5px 5px 0', + width : 550, + items: + [{ + xtype: 'fieldset', + layout: 'fit', + border:true, + title: 'Please select the Dynaform Type', + width: 550, + collapsible: false, + labelAlign: 'top', + items:[{ + xtype: 'radiogroup', + id: 'dynaformType', + layout: 'fit', + fieldLabel: 'Type', + itemCls: 'x-check-group-alt', + columns: 1, + items: [ + { + boxLabel: 'Blank Dynaform', + name: 'DYN_SOURCE', + inputValue: 'blankDyna', + checked: true + }, + + { + boxLabel: 'PM Table Dynaform', + name: 'DYN_SOURCE', + inputValue: 'pmTableDyna' + }], + listeners: { + change: function(radiogroup, radio) { + if(radio.inputValue == 'blankDyna') + { + Ext.getCmp("blankDynaform").show(); + Ext.getCmp("pmTableDynaform").hide(); + } + else + { + Ext.getCmp("blankDynaform").hide(); + Ext.getCmp("pmTableDynaform").show(); + } + } + } + }] + }, + { + xtype: 'fieldset', + id: 'blankDynaform', + border:true, + hidden: false, + title: 'Dynaform Information', + width: 550, + items:[{ + xtype : 'textfield', + fieldLabel: 'Title', + name : 'DYN_TITLE', + allowBlank: false + },{ + width: 150, + xtype: 'combo', + mode: 'local', + editable: false, + fieldLabel: 'Type', + triggerAction: 'all', + forceSelection: true, + name: 'ACTION', + displayField: 'name', + valueField: 'value', + value : 'Normal', + store: new Ext.data.JsonStore({ + fields : ['name', 'value'], + data : [ + {name : 'Normal', value: 'Normal'}, + {name : 'Grid', value: 'Grid'}, + ] + }) + },{ + xtype : 'textarea', + fieldLabel: 'Description', + name : 'DYN_DESCRIPTION', + height : 120, + width : 350 + } + ] + },{ + xtype: 'fieldset', + id: 'pmTableDynaform', + border:true, + hidden: true, + title: 'Dynaform Information', + width: 550, + items:[{ + width: 150, + xtype: 'combo', + mode: 'local', + editable: false, + triggerAction: 'all', + forceSelection: true, + fieldLabel: 'Create from a PM Table', + name: 'ADD_TABLE', + displayField: 'ADD_TAB_NAME', + valueField: 'ADD_TAB_UID', + value : '---------------------------', + store : additionalTables, + onSelect: function(record, index){ + var link = 'proxyDynaform?tabId='+record.data.ADD_TAB_UID; + tablesFieldsStore.proxy.setUrl(link, true); + tablesFieldsStore.load(); + /*Ext.Ajax.request({ + url : 'proxyDynaform?tabId='+record.data.ADD_TAB_UID, + method: 'GET', + success: function(response) { + var fields = Ext.util.JSON.decode(response.responseText); + Ext.getCmp("FLD_NAME").setValue(fields[0].FLD_NAME); + } + });*/ + Ext.getCmp("fieldsGrid").show(); + + this.setValue(record.data[this.valueField || this.displayField]); + this.collapse(); + } + },{ + xtype : 'textfield', + fieldLabel: 'Title', + name : 'DYN_TITLE', + allowBlank: false + },{ + xtype : 'textarea', + fieldLabel: 'Description', + name : 'DYN_DESCRIPTION', + height : 120, + width : 350 + }, + { + xtype: 'grid', + id:'fieldsGrid', + hidden: true, + ds: tablesFieldsStore, + cm: addTableColumns, + width: 550, + height: 300, + //autoHeight: true, + plugins: [editor], + //loadMask : true, + loadingText : 'Loading...', + border: true, + renderTo : Ext.getBody() + } + ] + } + ] + + }); + + var gridWindow = new Ext.Window({ + title: 'Dynaform', + collapsible: false, + maximizable: true, + width: 600, + //autoHeight: true, + height: 500, + layout: 'fit', + plain: true, + bodyStyle: 'padding:5px;', + buttonAlign: 'center', + items: dynaformDetails, + buttons: [{ + text: 'Save', + handler: function(){ + var getForm = dynaformDetails.getForm().getValues(); + //var sDynaType = getForm.DYN_SOURCE; + if(getForm.DYN_SOURCE == 'blankDyna') + { + var sAction = getForm.ACTION; + var sTitle = getForm.DYN_TITLE[0]; + var sDesc = getForm.DYN_DESCRIPTION[0]; + } + else + { + //sAction = getForm.ADD_TABLE; + var aFields = new Array(); + var aStoreFields = tablesFieldsStore.data.items; + var aData = ''; + for(var i=0;i' + txt + '<\/div>'; +}; + +bpmnSubProcess.prototype.setWorkflow = function (_40c5) { + VectorFigure.prototype.setWorkflow.call(this, _40c5); + if (_40c5 != null) { + /*Adding Port to the Task After dragging Task on the Canvas + *Ports will be invisibe After Drag and Drop, But It will be created + */ + var TaskPortName = ['output1','output2','input1','input2']; + var TaskPortType = ['OutputPort','OutputPort','InputPort','InputPort']; + var TaskPositionX= [this.width/2,this.width,0,this.width/2]; + var TaskPositionY= [this.height,this.height/2,this.height/2,0]; + + for(var i=0; i< TaskPortName.length ; i++){ + eval('this.'+TaskPortName[i]+' = new '+TaskPortType[i]+'()'); //Create New Port + eval('this.'+TaskPortName[i]+'.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.'+TaskPortName[i]+'.setName("'+TaskPortName[i]+'")'); //Set PortName + eval('this.'+TaskPortName[i]+'.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.'+TaskPortName[i]+'.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.'+TaskPortName[i]+'.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.'+TaskPortName[i]+','+TaskPositionX[i]+', '+TaskPositionY[i]+')'); //Setting Position of the port + } + } +}; + +bpmnSubProcessDialog = function (_2e5e) { + this.figure = _2e5e; + var title = 'Sub Process'; + Dialog.call(this, title); + this.setDimension(400, 150); //Set the width and height of the Dialog box +} + +bpmnSubProcessDialog.prototype = new Dialog(); +bpmnSubProcessDialog.prototype.createHTMLElement = function () { + var item = Dialog.prototype.createHTMLElement.call(this); + var inputDiv = document.createElement("form"); + inputDiv.style.position = "absolute"; + inputDiv.style.left = "10px"; + inputDiv.style.top = "30px"; + inputDiv.style.width = "375px"; + inputDiv.style.font = "normal 10px verdana"; + item.appendChild(inputDiv); + this.label = document.createTextNode("Sub Process Name"); + inputDiv.appendChild(this.label); + this.input = document.createElement("textarea"); + this.input.style.border = "1px solid gray"; + this.input.style.font = "normal 10px verdana"; + //this.input.type = "text"; + this.input.maxLength = "500"; + this.input.cols = "50"; + this.input.rows = "3"; + var value = bpmnTask.prototype.trim(this.figure.workflow.currentSelection.subProcessName); + if (value) this.input.value = value; + else this.input.value = ""; + this.input.style.width = "100%"; + inputDiv.appendChild(this.input); + this.input.focus(); + return item; +}; + +/*Double Click Event for opening the dialog Box*/ +bpmnSubProcess.prototype.onDoubleClick = function () { + var _409d = new bpmnSubProcessDialog(this); + this.workflow.showDialog(_409d, this.workflow.currentSelection.x, this.workflow.currentSelection.y); +}; + + +/** + * This method will be called if the user pressed the OK button in buttonbar of the dialog.
+ * The string is first cleared and new string is painted.

+ **/ + bpmnSubProcessDialog.prototype.onOk = function () { + this.figure.bpmnNewText.clear(); + + len = Math.ceil(this.input.value.length/16); + if(this.input.value.length < 19) + { + len = 1.5; + if(this.input.value.length > 9) + this.figure.rectWidth = this.input.value.length*8; + else + this.figure.rectWidth = 48; + } + else + this.figure.rectWidth = 150; + //tempcoord = this.workflow.currentSelection.coord_converter(this.workflow.currentSelection.width, this.workflow.currentSelection.height, this.input.value.length) + this.figure.bpmnNewText.drawStringRect(this.input.value,20,20,this.figure.rectWidth,'left'); + // this.figure.bpmnNewText.drawTextString(this.input.value, this.workflow.currentSelection.width, this.workflow.currentSelection.height, tempcoord.temp_x, tempcoord.temp_y); + this.figure.bpmnNewText.paint(); + this.figure.subProcessName = this.input.value; //Set Updated Text value + + if(this.figure.rectWidth<80) + tempW = 110; + else + tempW = this.figure.rectWidth+35; + this.workflow.currentSelection.setDimension(tempW, len*13+40); + + this.workflow.removeFigure(this); +}; + +bpmnSubProcess.prototype.getContextMenu = function () { + this.workflow.handleContextMenu(this); +}; \ No newline at end of file diff --git a/workflow/engine/templates/bpmn/Task.js b/workflow/engine/templates/bpmn/Task.js new file mode 100755 index 000000000..5c6b9c35a --- /dev/null +++ b/workflow/engine/templates/bpmn/Task.js @@ -0,0 +1,33 @@ +Task=function(){ +ImageFigure.call(this,'/skins/ext/images/gray/shapes/Task.png'); +this.outputPort=null; +this.setDimension(94,66); +return this; +}; +Task.prototype=new ImageFigure; +Task.prototype.type="Task"; +Task.prototype.setWorkflow=function(_40c5){ +ImageFigure.prototype.setWorkflow.call(this,_40c5); +if(_40c5!=null&&this.outputPort==null){ +this.outputPort=new MyOutputPort(); +this.outputPort.setWorkflow(_40c5); +this.outputPort.setMaxFanOut(4); +this.outputPort.setBackgroundColor(new Color(245,115,115)); +this.addPort(this.outputPort,this.width,this.height/2); +this.outputPort1=new MyOutputPort(); +this.outputPort1.setWorkflow(_40c5); +this.outputPort1.setMaxFanOut(4); +this.outputPort1.setBackgroundColor(new Color(245,115,115)); +this.addPort(this.outputPort1,this.width/2,0); +this.outputPort2=new MyOutputPort(); +this.outputPort2.setWorkflow(_40c5); +this.outputPort2.setMaxFanOut(4); +this.outputPort2.setBackgroundColor(new Color(245,115,115)); +this.addPort(this.outputPort2,this.width/2,this.height); +this.outputPort3=new MyOutputPort(); +this.outputPort3.setWorkflow(_40c5); +this.outputPort3.setMaxFanOut(4); +this.outputPort3.setBackgroundColor(new Color(245,115,115)); +this.addPort(this.outputPort3,0,this.height/2); +} +}; diff --git a/workflow/engine/templates/bpmn/Task2.js b/workflow/engine/templates/bpmn/Task2.js new file mode 100755 index 000000000..4c2b80caa --- /dev/null +++ b/workflow/engine/templates/bpmn/Task2.js @@ -0,0 +1,281 @@ +Task2=function(){ +this.cornerWidth=15; +this.cornerHeight=15; +Node.call(this); +this.setDimension(100,100); +this.originalHeight=-1; +}; + +Task2.prototype=new Node; +Task2.prototype.type="Task2"; +Task2.prototype.createHTMLElement=function(){ +var item=document.createElement("div"); +item.id=this.id; +item.style.position="absolute"; +item.style.left=this.x+"px"; +item.style.top=this.y+"px"; +item.style.height=this.width+"px"; +item.style.width=this.height+"px"; +item.style.margin="0px"; +item.style.padding="0px"; +item.style.outline="none"; +item.style.zIndex=""+Figure.ZOrderBaseIndex; +this.top_left=document.createElement("div"); +this.top_left.style.background="url(/skins/ext/images/gray/shapes/circle.png) no-repeat top left"; +this.top_left.style.position="absolute"; +this.top_left.style.width=this.cornerWidth+"px"; +this.top_left.style.height=this.cornerHeight+"px"; +this.top_left.style.left="0px"; +this.top_left.style.top="0px"; +this.top_left.style.fontSize="2px"; +this.top_right=document.createElement("div"); +this.top_right.style.background="url(/skins/ext/images/gray/shapes/circle.png) no-repeat top right"; +this.top_right.style.position="absolute"; +this.top_right.style.width=this.cornerWidth+"px"; +this.top_right.style.height=this.cornerHeight+"px"; +this.top_right.style.left="0px"; +this.top_right.style.top="0px"; +this.top_right.style.fontSize="2px"; +this.bottom_left=document.createElement("div"); +this.bottom_left.style.background="url(/skins/ext/images/gray/shapes/circle.png) no-repeat bottom left"; +this.bottom_left.style.position="absolute"; +this.bottom_left.style.width=this.cornerWidth+"px"; +this.bottom_left.style.height=this.cornerHeight+"px"; +this.bottom_left.style.left="0px"; +this.bottom_left.style.top="0px"; +this.bottom_left.style.fontSize="2px"; +this.bottom_right=document.createElement("div"); +this.bottom_right.style.background="url(/skins/ext/images/gray/shapes/circle.png) no-repeat bottom right"; +this.bottom_right.style.position="absolute"; +this.bottom_right.style.width=this.cornerWidth+"px"; +this.bottom_right.style.height=this.cornerHeight+"px"; +this.bottom_right.style.left="0px"; +this.bottom_right.style.top="0px"; +this.bottom_right.style.fontSize="2px"; +this.header=document.createElement("div"); +this.header.style.position="absolute"; +this.header.style.left=this.cornerWidth+"px"; +this.header.style.top="0px"; +this.header.style.height=(this.cornerHeight)+"px"; +this.header.style.backgroundColor="#1e1b57"; +this.header.style.borderTop="3px solid #1e1b57"; +this.header.style.fontSize="9px"; +this.header.style.color="white"; +this.header.style.textAlign="center"; +this.textarea=document.createElement("div"); +this.textarea.style.position="absolute"; +this.textarea.style.left="0px"; +this.textarea.style.top=this.cornerHeight+"px"; +this.textarea.style.background="url(/skins/ext/images/gray/shapes/bg.png)"; +this.textarea.style.borderTop="2px solid #d98e3e"; +this.textarea.style.borderBottom="2px solid white"; +this.textarea.style.borderLeft="1px solid #1e1b57"; +this.textarea.style.borderRight="1px solid #1e1b57"; +this.textarea.style.overflow="auto"; +this.textarea.style.fontSize="9pt"; +this.textarea.style.color="white"; +this.disableTextSelection(this.textarea); +this.footer=document.createElement("div"); +this.footer.style.position="absolute"; +this.footer.style.left=this.cornerWidth+"px"; +this.footer.style.top="0px"; +this.footer.style.height=(this.cornerHeight-1)+"px"; +this.footer.style.backgroundColor="#1e1b57"; +this.footer.style.borderBottom="1px solid #1e1b57"; +this.footer.style.fontSize="2px"; +item.appendChild(this.top_left); +item.appendChild(this.header); +item.appendChild(this.top_right); +item.appendChild(this.textarea); +item.appendChild(this.bottom_left); +item.appendChild(this.footer); +item.appendChild(this.bottom_right); +this.setTitle("Task 1"); +this.setContent("Task Description"); +return item; +}; + + +Task2.prototype.setDimension=function(w,h){ +Node.prototype.setDimension.call(this,w,h); +if(this.top_left!=null){ +this.top_right.style.left=(this.width-this.cornerWidth)+"px"; +this.bottom_right.style.left=(this.width-this.cornerWidth)+"px"; +this.bottom_right.style.top=(this.height-this.cornerHeight)+"px"; +this.bottom_left.style.top=(this.height-this.cornerHeight)+"px"; +this.textarea.style.width=(this.width-2)+"px"; +this.textarea.style.height=(this.height-this.cornerHeight*2)+"px"; +this.header.style.width=(this.width-this.cornerWidth*2)+"px"; +this.footer.style.width=(this.width-this.cornerWidth*2)+"px"; +this.footer.style.top=(this.height-this.cornerHeight)+"px"; +} +if(this.outputPort!=null){ +this.outputPort.setPosition(this.width+5,this.height/2); +} +if(this.inputPort!=null){ +this.inputPort.setPosition(-5,this.height/2); +} +}; + +Task2.prototype.setTitle=function(title){ +this.header.innerHTML=title; +}; +Task2.prototype.setContent=function(_3595){ +this.textarea.innerHTML=_3595; +}; +Task2.prototype.getTitle=function(){ +return this.figure.header.innerHTML; +}; +Task2.prototype.getContent=function(){ + return this.figure.textarea.innerHTML; +}; +Task2.prototype.onDragstart=function(x,y){ +var _3598=Node.prototype.onDragstart.call(this,x,y); +if(this.header==null){ +return false; +} +if(y(this.width-this.cornerWidth)){ +this.toggle(); +return false; +} +if(this.originalHeight==-1){ +if(this.canDrag==true&&x';} + } + ] + }); + + + + var grid = new Ext.grid.GridPanel({ + store : taskSteps, + id : 'mygrid', + loadMask : true, + loadingText : 'Loading...', + renderTo : 'cases-grid', + frame : false, + autoHeight : false, + enableDragDrop : true, + ddGroup : 'firstGridDDGroup', + clicksToEdit: 1, + minHeight :400, + height :400, + layout : 'form', + plugins : [editor], + columns : [{ + id: 'STEP_TITLE', + header: 'Title', + dataIndex: 'STEP_TITLE', + width: 200, + sortable: true, + editor: new Ext.form.ComboBox({ + xtype : 'combo', + fieldLabel : 'Users_groups', + //hiddenName : 'number', + store : availableSteps, + displayField : 'STEP_TITLE' , + valueField : 'STEP_TITLE', + //name : 'STEP_TITLE', + scope : this, + triggerAction: 'all', + emptyText : 'Select Step', + allowBlank : false, + onSelect: function(record, index){ + var User = grid.getStore(); + + if(typeof _3252.scope.workflow.currentrowIndex == 'undefined') + var selectedrowIndex = '0'; + else + selectedrowIndex = _3252.scope.workflow.currentrowIndex; //getting Index of the row that has been edited + + //User.data.items[0].data.STEP_TITLE= record.data.STEP_TITLE; + User.data.items[selectedrowIndex].data.STEP_UID= record.data.STEP_UID; + User.data.items[selectedrowIndex].data.STEP_TYPE_OBJ=record.data.STEP_TYPE_OBJ; + User.data.items[selectedrowIndex].data.STEP_CONDITION=record.data.STEP_CONDITION; + User.data.items[selectedrowIndex].data.STEP_POSITION=record.data.STEP_POSITION; + User.data.items[selectedrowIndex].data.STEP_UID_OBJ=record.data.STEP_UID_OBJ; + User.data.items[selectedrowIndex].data.STEP_MODE=record.data.STEP_MODE; + + this.setValue(record.data[this.valueField || this.displayField]); + this.collapse(); + } + }) + }, + { + id: 'STEP_MODE', + header: 'Mode', + dataIndex: 'STEP_MODE', + width: 100, + sortable: true, + editor: new Ext.form.ComboBox ({ + editable : false, + triggerAction: 'all', + lazyRender:true, + allowBlank : false, + emptyText : 'Select Mode', + mode: 'local', + scope: this, + store: new Ext.data.ArrayStore({ + id: 0, + fields: [ + 'STEP_MODE', + 'STEP_MODE' + ], + data: [['EDIT', 'Edit'], ['VIEW', 'View']] + }), + valueField: 'STEP_MODE', + defaultValue: 'EDIT', + displayField: 'STEP_MODE', + onSelect: function(record, index){ + var User = grid.getStore(); + User.data.items[0].data.STEP_MODE=record.data.STEP_MODE; + this.setValue(record.data[this.valueField || this.displayField]); + this.collapse(); + } + }) + }, + { + sortable: false, + renderer: function() + { + return String.format("Edit",pro_uid,taskId); + } + } + ], + sm: new Ext.grid.RowSelectionModel({ + singleSelect: true, + listeners: { + rowselect: function(smObj, rowIndex, record) { + _3252.scope.workflow.currentrowIndex = rowIndex; + } + } + }), + stripeRows: true, + viewConfig: {forceFit: true}, + tbar: tb + }); + + editor.on({ + scope: this, + afteredit: function(roweditor, changes, record, rowIndex) { + + + var stepUIDObj = record.data.STEP_UID_OBJ; + var stepTypeObj = record.data.STEP_TYPE_OBJ; + var stepMode = record.data.STEP_MODE; + + Ext.Ajax.request({ + url : '../steps/steps_Save.php', + method: 'POST', + params: { + sProcess : pro_uid, + sTask : taskId, + sType : stepTypeObj, + sUID : stepUIDObj, + sMode : stepMode + }, + success: function(response) { + Ext.MessageBox.alert ('Status','Step has been assigned successfully.'); + } + }); + + //Deleting previously assigned step on updating/replacing with new step. + if(changes != '' && typeof record.json != 'undefined') + { + var stepUID = record.json.STEP_UID; + var stepPosition = record.json.STEP_POSITION; + + Ext.Ajax.request({ + url : '../steps/steps_Delete.php', + method: 'POST', + params: { + TASK : taskId, + STEP_UID : stepUID, + STEP_POSITION : stepPosition + }, + success: function(response) { + //Ext.MessageBox.alert ('Status','Step has been updated successfully.'); + } + }); + } + } + }); + + // Setup Drop Targets + // This will make sure we only drop to the view scroller element + var firstGridDropTargetEl = grid.getView().scroller.dom; + var firstGridDropTarget = new Ext.dd.DropTarget(firstGridDropTargetEl, { + ddGroup : 'firstGridDDGroup', + notifyDrop : function(ddSource, e, data){ + var records = ddSource.dragData.selections; + Ext.each(records, ddSource.grid.store.remove, ddSource.grid.store); + grid.store.add(records); + grid.store.commitChanges(); + //firstGrid.store.sort('gridIndex', 'ASC'); + return true + } + }); + firstGridDropTarget.addToGroup('firstGridDDGroup'); + + //Getting triggers data using stepTriggers function + var treeGrid = taskExtObj.stepTriggers(_3252); + treeGrid.render(document.body); + + var taskStepsTabs = new Ext.FormPanel({ + labelWidth: 100, + bodyStyle :'padding:5px 5px 0', + width : 850, + height : 500, + items: + { + xtype:'tabpanel', + activeTab: 0, + defaults:{ + autoHeight:true, + bodyStyle:'padding:10px' + }, + items:[{ + title:'Steps', + layout:'fit', + defaults: { + width: 400 + }, + items:[grid] + },{ + title:'Condition', + layout:'fit', + defaults: { + width: 400 + }, + items:[{ + xtype: 'grid', + ds: taskSteps, + cm: conditionsColumns, + height: 350, + loadMask : true, + loadingText : 'Loading...', + border: false + }] + },{ + title:'Triggers', + layout:'form', + defaults: { + width: 400 + }, + items:[treeGrid] + }] + } + }); + + taskStepsTabs.render(document.body); + _3252.scope.workflow.taskStepsTabs = taskStepsTabs; + + var window = new Ext.Window({ + title: 'Steps Of', + collapsible: false, + maximizable: false, + width: 800, + height: 500, + minWidth: 200, + minHeight: 150, + layout: 'fit', + plain: true, + bodyStyle: 'padding:5px;', + buttonAlign: 'center', + items: taskStepsTabs + /*buttons: [{ + text: 'Save', + handler: function(){ + //var getstore = grid.getStore(); + //var getData = getstore.data.items; + //taskExtObj.saveTaskSteps(getData); + } + },{ + text: 'Cancel', + handler: function(){ + // when this button clicked, + window.close(); + } + }]*/ + }); + window.show(); + +} + + +TaskContext.prototype.editUsers= function(_5625) +{ + var taskExtObj = new TaskContext(); + var pro_uid = _5625.scope.workflow.getUrlVars(); + var taskId = _5625.scope.workflow.currentSelection.id; + + var userFields = Ext.data.Record.create([ + { + name: 'LABEL', + type: 'string' + }, + { + name: 'TU_TYPE', + type: 'string' + }, + { + name: 'TU_RELATION', + type: 'string' + }, + { + name: 'TAS_UID', + type: 'string' + }, + { + name: 'USR_UID', + type: 'string' + } + ]); + var editor = new Ext.ux.grid.RowEditor({ + saveText: 'Update' + }); + + + var btnAdd = new Ext.Button({ + id: 'btnAdd', + text: 'Assign User', + iconCls: 'application_add', + handler: function(){ + var User = grid.getStore(); + var e = new userFields({ + //LABEL: 'Select User or Group', + //LABEL: User.data.items[0].data.LABEL, + TAS_UID: '', + TU_TYPE: '', + USR_UID: '', + TU_RELATION: '' + }); + + + if(storeUsers.data.items.length == 0) + Ext.MessageBox.alert ('Status','No users are available. All users have been already assigned.'); + else + { + editor.stopEditing(); + taskUsers.insert(0, e); + grid.getView().refresh(); + //grid.getSelectionModel().selectRow(0); + editor.startEditing(0, 0); + } + } + }); + + var btnRemove = new Ext.Button({ + id: 'btnRemove', + text: 'Remove User', + iconCls: 'application_delete', + handler: function (s) { + editor.stopEditing(); + var s = grid.getSelectionModel().getSelections(); + for(var i = 0, r; r = s[i]; i++){ + + //First Deleting assigned users from Database + var user_TURel = r.data.TU_RELATION; + var userUID = r.data.USR_UID; + var user_TUtype = r.data.TU_TYPE; + var urlparams = '?action=ofToAssign&data={"TAS_UID":"'+taskId+'","TU_RELATION":"'+user_TURel+'","USR_UID":"'+userUID+'","TU_TYPE":"'+user_TUtype+'"}'; + + //if USR_UID is properly defined (i.e. set to valid value) then only delete the row + //else its a BLANK ROW for which Ajax should not be called. + if(r.data.USR_UID != "") + { + Ext.Ajax.request({ + url : 'processes_Ajax.php' +urlparams , + /*method: 'POST', + params: { + functions : 'ofToAssign', + TAS_UID : taskId, + TU_RELATION : user_TURel, + USR_UID : userUID, + TU_TYPE : user_TUtype + + },*/ + success: function(response) { + Ext.MessageBox.alert ('Status','User has been removed successfully.'); + } + }); + } + //Secondly deleting from Grid + taskUsers.remove(r); + } + } + }); + + var tb = new Ext.Toolbar({ + items: [btnAdd, btnRemove] + }); + + // create the Data Store of users that are already assigned to a task + var taskUsers = new Ext.data.JsonStore({ + root : 'data', + totalProperty: 'totalCount', + idProperty : 'gridIndex', + remoteSort : true, + fields : userFields, + proxy: new Ext.data.HttpProxy({ + url: 'proxyUsersList?pid='+pro_uid+'&tid='+taskId + }) + }); + //taskUsers.setDefaultSort('LABEL', 'asc'); + taskUsers.load(); + + // create the Data Store of users that are not assigned to a task + var storeUsers = new Ext.data.JsonStore({ + root : 'data', + url : 'proxyUsersList?tid='+taskId, + totalProperty : 'totalCount', + idProperty : 'gridIndex', + remoteSort : false, //true, + autoLoad : true, + fields : userFields + }); + + var grid = new Ext.grid.GridPanel({ + store: taskUsers, + id : 'mygrid', + //cm: cm, + loadMask: true, + loadingText: 'Loading...', + renderTo: 'cases-grid', + frame: false, + autoHeight:false, + clicksToEdit: 1, + minHeight:400, + height :400, + layout: 'fit', + plugins: [editor], + columns: [ + new Ext.grid.RowNumberer(), + { + id: 'LABEL', + header: 'Group or User', + dataIndex: 'LABEL', + width: 100, + sortable: true, + editor: new Ext.form.ComboBox({ + xtype: 'combo', + fieldLabel: 'Users_groups', + hiddenName: 'number', + store : storeUsers, + displayField : 'LABEL' , + valueField : 'LABEL', + name : 'LABEL', + scope : _5625, + triggerAction: 'all', + emptyText: 'Select User or Group', + allowBlank: false, + onSelect: function(record, index){ + var User = grid.getStore(); + + if(typeof _5625.scope.workflow.currentrowIndex == 'undefined') + var selectedrowIndex = '0'; + else + selectedrowIndex = _5625.scope.workflow.currentrowIndex; //getting Index of the row that has been edited + + //User.data.items[0].data.LABEL= record.data.LABEL; + User.data.items[selectedrowIndex].data.TAS_UID = record.data.TAS_UID; + User.data.items[selectedrowIndex].data.TU_TYPE = record.data.TU_TYPE; + User.data.items[selectedrowIndex].data.USR_UID = record.data.USR_UID; + User.data.items[selectedrowIndex].data.TU_RELATION = record.data.TU_RELATION; + + this.setValue(record.data[this.valueField || this.displayField]); + this.collapse(); + } + }) + } + ], + sm: new Ext.grid.RowSelectionModel({ + singleSelect: true, + listeners: { + rowselect: function(smObj, rowIndex, record) { + _5625.scope.workflow.currentrowIndex = rowIndex; + } + } + }), + stripeRows: true, + viewConfig: {forceFit: true}, + tbar: tb + }); + + storeUsers.load(); + + editor.on({ + scope: this, + afteredit: function(roweditor, changes, record, rowIndex) { + + var taskId = record.data.TAS_UID; + var userId = record.data.USR_UID; + var tu_Type = record.data.TU_TYPE; + var tu_Relation = record.data.TU_RELATION; + var urlparams = '?action=assign&data={"TAS_UID":"'+taskId+'","USR_UID":"'+userId+'","TU_TYPE":"'+tu_Type+'","TU_RELATION":"'+tu_Relation+'"}'; + + Ext.Ajax.request({ + url: 'processes_Ajax.php' +urlparams , + success: function (response) { // When saving data success + Ext.MessageBox.alert ('Status','User has been successfully assigned'); + }, + failure: function () { // when saving data failed + Ext.MessageBox.alert ('Status','Failed saving User Assigned to Task'); + } + }); + + //Updating the user incase if already assigned user has been replaced by other user + if(changes != '' && typeof record.json != 'undefined') + { + var user_TURel = record.json.TU_RELATION; + var userUID = record.json.USR_UID; + var user_TUtype = record.json.TU_TYPE; + urlparams = '?action=ofToAssign&data={"TAS_UID":"'+taskId+'","TU_RELATION":"'+user_TURel+'","USR_UID":"'+userUID+'","TU_TYPE":"'+user_TUtype+'"}'; + Ext.Ajax.request({ + url : 'processes_Ajax.php' +urlparams , + success: function(response) { + //Ext.MessageBox.alert ('Status','User has been updated successfully.'); + } + }); + } + } + }); + + var panel = new Ext.Panel({ + id: 'panel', + renderTo: Ext.getBody(), + items: [grid] + }); + + var window = new Ext.Window({ + title: 'Assign User', + collapsible: false, + maximizable: false, + width: 400, + height: 350, + minWidth: 200, + minHeight: 150, + layout: 'fit', + plain: true, + bodyStyle: 'padding:5px;', + buttonAlign: 'center', + items: panel + /*buttons: [{ + text: 'Save', + handler: function(){ + Ext.MessageBox.alert ("User has been successfully assigned"); + //var getstore = grid.getStore(); + //var getData = getstore.data.items; + //taskExtObj.saveTaskUsers(getData); + + } + },{ + text: 'Cancel', + handler: function(){ + // when this button clicked, + window.close(); + } + }]*/ + }); + window.show(); +} + + +TaskContext.prototype.editTaskProperties= function(_5625) +{ + + var taskExtObj = new TaskContext(); + var taskId = _5625.scope.workflow.currentSelection.id; + + /*function setTaskAssignType(formData){ + for(var i=0;i Value Based fieldset + //fields[2] => Static / Cancelling Partial Join for Multiple Instance fieldset1 + //fields[3] => Static / Cancelling Partial Join for Multiple Instance fieldset2 + + if(radio.inputValue == 'EVALUATE'){ + fields[1].show(); + fields[2].hide(); + fields[3].hide(); + } + + else if(radio.inputValue == 'STATIC_MI' || radio.inputValue == 'CANCEL_MI'){ + fields[2].show(); + fields[3].show(); + fields[1].hide(); + } + else { + fields[1].hide(); + fields[2].hide(); + fields[3].hide(); + } + + } + } + },{ + xtype: 'fieldset', + layout:'column', + border:false, + width: 550, + //title: 'valueBased', + hidden: 'hideEvaluateField', + id: 'evaluate', + items:[{ + columnWidth:.5, + layout: 'form', + border:false, + items: [{ + xtype: 'textfield', + fieldLabel: 'Variable for Value Based Assignment', + name: 'TAS_ASSIGN_VARIABLE' + //value: _5625.scope.workflow.taskDetails.TAS_ASSIGN_VARIABLE + //anchor:'65%' + }] + },{ + columnWidth:.3, + layout: 'form', + border:false, + items: [{ + xtype:'button', + title: ' ', + text: '@@', + name: 'selectorigin' + //anchor:'35%' + }] + }] + },{ + xtype: 'fieldset', + layout:'column', + border:false, + width: 550, + //title: 'MI', + hidden: 'hidePartialJoinField', + id: 'staticMI', + items:[{ + columnWidth:.5, + layout: 'form', + border:false, + items: [{ + xtype: 'textfield', + fieldLabel: 'Variable for No of Instances', + name: 'TAS_MI_INSTANCE_VARIABLE' + //value: _5625.scope.workflow.taskDetails.TAS_MI_INSTANCE_VARIABLE + //anchor:'65%' + }] + },{ + columnWidth:.3, + layout: 'form', + border:false, + items: [{ + xtype:'button', + title: ' ', + text: '@@', + name: 'selectorigin' + //anchor:'35%' + }] + }] + },{ + xtype: 'fieldset', + layout:'column', + border:false, + width: 550, + //title: 'MI2', + hidden: 'hidePartialJoinField', + id: 'cancelMI', + items:[{ + columnWidth:.5, + layout: 'form', + border:false, + items: [{ + xtype: 'textfield', + fieldLabel: 'Variable for No of Instances to complete', + name: 'TAS_MI_COMPLETE_VARIABLE' + //value: _5625.scope.workflow.taskDetails.TAS_MI_COMPLETE_VARIABLE + //anchor:'65%' + }] + },{ + columnWidth:.3, + layout: 'form', + border:false, + items: [{ + xtype:'button', + title: ' ', + text: '@@', + name: 'selectorigin' + //anchor:'35%' + }] + }] + } + + ] + },{ + title:'Timing Control Rules', + layout:'form', + defaults: { + width: 260 + }, + bodyStyle:'padding:5px 5px 0 30px', + defaultType: 'textfield', + items: [{ + xtype: 'checkbox', + boxLabel: 'Allow user defined timing control', + name: 'TAS_TRANSFER_FLY', + checked: 'TAS_TRANSFER_FLY', + labelWidth: 100, + listeners: { + /**Listeners for hiding all the fields + * under "Timing Control Rules" tabs + * when user clicks on 'Allow user defined timing control' checkbox + **/ + check : function(a,checked,c) { + if(checked == true) + Ext.getCmp("userDefinedTiming").hide(); + else + Ext.getCmp("userDefinedTiming").show(); + } + } + + }, + + { + xtype: 'fieldset', + layout:'form', + border:false, + width: 550, + //title: 'MI', + hidden: false, + id: 'userDefinedTiming', + + items:[{ + xtype: 'textfield', + fieldLabel: 'Task Duration', + name: 'TAS_DURATION', + //value: _5625.scope.workflow.taskDetails.TAS_DURATION, + width : 100, + allowBlank:false + }, + { + width: 100, + xtype: 'combo', + mode: 'local', + triggerAction: 'all', + forceSelection: true, + editable: false, + fieldLabel: 'Time Unit', + name: 'TAS_TIMEUNIT', + hiddenName: 'TAS_TIMEUNIT', + displayField: 'name', + //value: _5625.scope.workflow.taskDetails.TAS_TIMEUNIT, + valueField: 'value', + store: new Ext.data.JsonStore({ + fields : ['name', 'value'], + data : [ + { + name : 'Days', + value: 'Days' + }, + + { + name : 'Hours', + value: 'Hours' + }, + ] + }) + }, + { + width: 120, + xtype: 'combo', + mode: 'local', + //value: '- None -', + triggerAction: 'all', + forceSelection: true, + editable: false, + fieldLabel: 'Count Days by', + name: 'TAS_TYPE_DAY', + hiddenName: 'TAS_TYPE_DAY', + displayField: 'name', + //value: 'TAS_TYPE_DAY', + valueField: 'value', + store: new Ext.data.JsonStore({ + fields : ['name', 'value'], + data : [ + { + name : 'Work Days', + value: 'Work Days' + }, + + { + name : 'Calendar Days', + value: 'Calendar Days' + }, + ] + }) + }, + { + width: 100, + xtype: 'combo', + mode: 'local', + value: 'Default', + forceSelection: true, + triggerAction: 'all', + editable: false, + fieldLabel: 'Calendar', + name: 'TAS_CALENDAR', + hiddenName: 'TAS_CALENDAR', + displayField: 'name', + //value: _5625.scope.workflow.taskDetails.TAS_CALENDAR, + valueField: 'value', + store: new Ext.data.JsonStore({ + fields : ['name', 'value'], + data : [ + { + name : '- None-', + value: '- None-' + }, + + { + name : 'Default', + value: 'Default' + }, + ] + }) + }] + + }] + }, + { + title:'Permission', + layout:'form', + defaults: { + width: 260 + }, + defaultType: 'textfield', + labelWidth: 170, + items: [{ + xtype: 'checkbox', + fieldLabel: 'Allow arbitary transfer (Ad hoc)', + checked: 'TAS_TYPE', + name: 'TAS_TYPE' + }] + }, + + { + title:'Case Labels', + layout:'form', + defaults: { + width: 800 + }, + defaultType: 'textfield', + labelWidth: 70, + items: [{ + xtype: 'fieldset', + layout:'column', + border:false, + width: 700, + items:[{ + columnWidth:.5, + layout: 'form', + border:false, + items: [{ + xtype: 'textarea', + fieldLabel: 'Case Title', + name: 'TAS_DEF_TITLE', + height : 100, + //value: _5625.scope.workflow.taskDetails.TAS_ASSIGN_VARIABLE + anchor:'100%' + }] + },{ + columnWidth:.3, + layout: 'form', + border:false, + bodyStyle: 'padding:35px;', + items: [{ + xtype:'button', + title: ' ', + text: '@#', + name: 'selectCaseTitle' + //anchor:'10%' + }] + }] + }, + { + xtype: 'fieldset', + layout:'column', + border:false, + width: 700, + items:[{ + columnWidth:.5, + layout: 'form', + border:false, + items: [{ + xtype: 'textarea', + fieldLabel: 'Case Description', + name: 'TAS_DEF_DESCRIPTION', + height : 100, + anchor:'100%' + }] + },{ + columnWidth:.3, + layout: 'form', + border:false, + bodyStyle: 'padding:35px;', + items: [{ + xtype:'button', + title: ' ', + text: '@#', + name: 'selectCaseDesc' + //anchor:'10%' + }] + }] + }] + }, + { + title:'Notification', + layout:'form', + defaultType: 'textfield', + labelWidth: 170, + items: [{ + xtype: 'checkbox', + boxLabel: 'After routing notify the next assigned user(s).', + labelWidth: 100, + name: 'TAS_DEF_MESSAGE_CHECKBOX', + checked: 'TAS_DEF_MESSAGE_CHECKBOX', + listeners: { + /**Listeners for showing "TAS_DEF_MESSAGE" textarea field + * under "Notification" tab + * when user clicks on 'After routing notify the next assigned user(s).' checkbox + **/ + check : function(a,checked,c) { + if(checked == true) + Ext.getCmp("notifyUser").show(); + else + Ext.getCmp("notifyUser").hide(); + } + } + + },{ + xtype: 'fieldset', + id: 'notifyUser', + border: false, + defaults: { + width: 400 + }, + labelWidth: 50, + hidden: true, + items :[{ + xtype: 'textarea', + name: 'TAS_DEF_MESSAGE', + //value: _5625.scope.workflow.taskDetails.TAS_DEF_MESSAGE, + width: 400, + height : 180 + }] + }] + + } + ] + } + }); + + //Loading Task Details into the form + taskPropertiesTabs.form.load({ + url:'proxyTaskPropertiesDetails.php?tid=' +taskId, + method:'GET', + waitMsg:'Loading', + success:function(form, action) { + Ext.MessageBox.alert('Message', 'Loaded OK'); + // setTaskAssignType(form); + }, + failure:function(form, action) { + Ext.MessageBox.alert('Message', 'Load failed'); + } + }); + + + + taskPropertiesTabs.render(document.body); + _5625.scope.workflow.taskPropertiesTabs = taskPropertiesTabs; + + + var window = new Ext.Window({ + title: 'Task: ', + collapsible: false, + maximizable: false, + width: 620, + height: 500, + minWidth: 300, + minHeight: 150, + layout: 'fit', + plain: true, + bodyStyle: 'padding:5px;', + buttonAlign: 'center', + items: taskPropertiesTabs, + buttons: [{ + text: 'Save', + handler: function(){ + //var getstore = taskPropertiesTabs.getStore(); + //var getData = getstore.data.items; + taskExtObj.saveTaskProperties(_5625); + } + },{ + text: 'Cancel', + handler: function(){ + // when this button clicked, + window.close(); + } + }] + }); + window.show(); + +} + +TaskContext.prototype.saveTaskProperties= function(_5625) +{ + var saveTaskform = _5625.scope.workflow.taskPropertiesTabs.getForm().getValues(); + var taskId = _5625.scope.workflow.currentSelection.id; + var newTaskValues = new Array(); + var oData = null; + for (var key in saveTaskform ) + { + newTaskValues[key] = new Array(); + + if(saveTaskform[key] == 'on') + { + if(key == 'TAS_TYPE') + saveTaskform[key] = 'ADHOC'; + else + saveTaskform[key] = 'TRUE'; + } + else if(saveTaskform[key] == 'off') + saveTaskform[key] = 'FALSE'; + + newTaskValues[key] = saveTaskform[key]; //Creating an array on all updated fields by user + + if(key != 'TAS_CALENDAR' && key != 'TAS_DEF_MESSAGE_CHECKBOX') + { + if(oData != null) + oData = oData + '"'+key+'":"'+saveTaskform[key]+'"'+','; + else + oData = '"'+key+'":"'+saveTaskform[key]+'",' + '"TAS_UID":"'+taskId+'",'; + } + } + oData = '{'+oData.slice(0,oData.length-1)+'}'; + + Ext.Ajax.request({ + url: '../tasks/tasks_Ajax.php' , + success: function (response) { // When saving data success + Ext.MessageBox.alert ('Status','Task properties has been saved successfully'); + }, + failure: function () { // when saving data failed + Ext.MessageBox.alert ('Status','Error in saving Task Properties'); + }, + params: { + functions:'saveTaskData', + oData:oData + } + }); +} + +TaskContext.prototype.stepTriggers = function(_5625) +{ + var pro_uid = _5625.scope.workflow.getUrlVars(); + var taskId = _5625.scope.workflow.currentSelection.id; + + var triggersFields = Ext.data.Record.create([ + { + name: 'CON_VALUE', + type: 'string' + }, + { + name: 'ST_TYPE', + type: 'string' + }, + { + name: 'STEP_UID', + type: 'string' + }, + { + name: 'TRI_UID', + type: 'string' + }, + { + name: 'ST_POSITION', + type: 'string' + }, + { + name: 'TRI_TITLE', + type: 'string' + }, + { + name: 'ST_CONDITION', + type: 'string' + } + ]); + + var triggerEditor = new Ext.ux.grid.RowEditor({ + saveText: 'Update' + }); + + + var tree = new Ext.tree.TreePanel({ + //renderTo : 'cases-grid', + dataUrl : 'get-tree.php?tid='+taskId, + border : false, + rootVisible : false, + height : 320, + width : 200, + useArrows : false, + autoScroll : true, + animate : true, + root : new Ext.tree.AsyncTreeNode({text: 'treeRoot',id:'0'}) + }); + + //tree.render('tree'); + tree.on('click', function (node){ + if(node.isLeaf()){ + var sStepUID = node.attributes.id; + workflow.selectedStepUID = sStepUID; + +// var stepsTriggers = new Ext.data.JsonStore({ +// root : 'data', +// url : 'proxyStepTriggers?tid='+taskId+'&stepid='+sStepUID, +// totalProperty : 'totalCount', +// idProperty : 'gridIndex', +// remoteSort : true, +// fields : triggersFields +// }); + + /*var newUrl = 'proxyStepTriggers?pid='+pro_uid+'&tid='+taskId+'&stepid='+sStepUID; + var availableTriggers = new Ext.data.JsonStore({ + root : 'data', + url : 'proxyStepTriggers?pid='+pro_uid+'&tid='+taskId+'&stepid='+sStepUID, + totalProperty : 'totalCount', + idProperty : 'gridIndex', + remoteSort : false, //true, + autoLoad : true, + fields : triggersFields + });*/ + //var columns = triggerGrid.getColumnModel(); + //triggerGrid.reconfigure(stepsTriggers,triggerGrid.getColumnModel()); + + stepsTriggers.on({ + beforeload: { + fn: function (store, options) { + // use {@link Ext.data.HttpProxy#setUrl setUrl} to change the URL for *just* this request. + var link = 'proxyStepTriggers?tid='+taskId+'&stepid='+sStepUID; + store.proxy.setUrl(link, true); + } + } + }); + + availableTriggers.on({ + beforeload: { + fn: function (store, options) { + // use {@link Ext.data.HttpProxy#setUrl setUrl} to change the URL for *just* this request. + var link = 'proxyStepTriggers?pid='+pro_uid+'&tid='+taskId+'&stepid='+sStepUID; + store.proxy.setUrl(link, true); + } + } + }); + + triggerGrid.store.load(); + availableTriggers.load(); + //availableTriggers.reload(); + triggerGrid.show(); + } + else + triggerGrid.hide(); + }); + + + var addBtn = new Ext.Button({ + id: 'addBtn', + text: 'Add Triggers', + handler: function(){ + //var User = triggerGrid.getStore(); + var e1 = new triggersFields({ + //STEP_TITLE: User.data.items[0].data.STEP_TITLE, + CON_VALUE : '', + ST_TYPE : '', + STEP_UID : '', + TRI_UID : '', + ST_POSITION : '', + ST_CONDITION : '', + TRI_TITLE : '' + }); + + if(availableTriggers.data.items.length == 0) + Ext.MessageBox.alert ('Status','No triggers are available. All triggers have been already assigned.'); + else + { + triggerEditor.stopEditing(); + stepsTriggers.insert(0, e1); + triggerGrid.getView().refresh(); + //triggerGrid.getSelectionModel().selectRow(0); + triggerEditor.startEditing(0, 0); + } + + } + }); + + var removeBtn = new Ext.Button({ + id: 'removeBtn', + text: 'Remove Triggers', + handler: function (s) { + triggerEditor.stopEditing(); + var s = triggerGrid.getSelectionModel().getSelections(); + for(var i = 0, r; r = s[i]; i++){ + + //First Deleting step from Database using Ajax + var stepUID = r.data.STEP_UID; + var sTrigger = r.data.TRI_UID; + var sType = r.data.ST_TYPE; + var iPosition = r.data.ST_POSITION; + var urlparams = '?action=ofToAssignTrigger&sStep=' + stepUID + '&sTrigger=' + sTrigger + '&sType=' + sType + '&iPosition=' + iPosition + + //if STEP_UID is properly defined (i.e. set to valid value) then only delete the row + //else its a BLANK ROW for which Ajax should not be called. + if(r.data.STEP_UID != "") + { + Ext.Ajax.request({ + url : '../steps/steps_Ajax.php' + urlparams, + success: function(response) { + Ext.MessageBox.alert ('Status','Trigger has been removed successfully.'); + } + }); + } + + //Secondly deleting from Grid + stepsTriggers.remove(r); + } + } + }); + + var toolBar = new Ext.Toolbar({ + items: [addBtn, removeBtn] + }); + + + // create the Data Store of users that are already assigned to a task + var stepsTriggers = new Ext.data.JsonStore({ + root : 'data', + url : 'proxyStepTriggers?tid='+taskId,//+'&stepid='+workflow.selectedStepUID, + totalProperty : 'totalCount', + idProperty : 'gridIndex', + remoteSort : true, + fields : triggersFields + }); + //taskUsers.setDefaultSort('LABEL', 'asc'); + //stepsTriggers.load(); + + var availableTriggers = new Ext.data.JsonStore({ + root : 'data', + url : 'proxyStepTriggers?pid='+pro_uid+'&tid='+taskId,//+'&stepid='+workflow.selectedStepUID, + totalProperty : 'totalCount', + idProperty : 'gridIndex', + remoteSort : false, //true, + autoLoad : true, + fields : triggersFields + }); + + //availableTriggers.load(); + + var triggerGrid = new Ext.grid.GridPanel({ + store: stepsTriggers, + id : 'triggerGrid', + //cm: cm, + loadMask: true, + loadingText: 'Loading...', + renderTo: 'cases-grid', + frame: false, + autoHeight:false, + hidden :true, + clicksToEdit: 1, + width : 450, + minHeight:400, + height :400, + layout: 'fit', + plugins: [triggerEditor], + columns: [ + new Ext.grid.RowNumberer(), + { + id: 'CON_VALUE', + header: 'Triggers', + dataIndex: 'CON_VALUE', + //width: 200, + sortable: true, + editor: new Ext.form.ComboBox({ + id : 'available', + xtype : 'combo', + fieldLabel : 'Users_groups', + hiddenName : 'number', + store : availableTriggers, + displayField : 'CON_VALUE', + valueField : 'CON_VALUE', + name : 'CON_VALUE', + scope : this, + triggerAction: 'all', + emptyText : 'Select Triggers', + allowBlank : false, + onSelect: function(record, index){ + var triggerStore = triggerGrid.getStore(); + + if(typeof _5625.scope.workflow.currentRowTrigger == 'undefined') + var selectedrowIndex = '0'; + else + selectedrowIndex = _5625.scope.workflow.currentRowTrigger; //getting Index of the row that has been edited + + //User.data.items[0].data.CON_VALUE = record.data.CON_VALUE; + triggerStore.data.items[selectedrowIndex].data.ST_TYPE = record.data.ST_TYPE; + triggerStore.data.items[selectedrowIndex].data.STEP_UID = record.data.STEP_UID; + triggerStore.data.items[selectedrowIndex].data.TRI_UID = record.data.TRI_UID; + triggerStore.data.items[selectedrowIndex].data.ST_POSITION = record.data.ST_POSITION; + triggerStore.data.items[selectedrowIndex].data.TRI_TITLE = record.data.TRI_TITLE; + + workflow.currentrowIndex = '0'; + this.setValue(record.data[this.valueField || this.displayField]); + this.collapse(); + } + }) + }, + { + //id: 'STEP_TITLE', + header: 'Condition', + dataIndex: 'ST_CONDITION', + //width: 200, + editable: true, + editor: new Ext.form.TextField({ + allowBlank: true + }) + }, + { + header: 'Assign Condition', + //width: 50, + renderer: function(val){return '';} + } + ], + sm: new Ext.grid.RowSelectionModel({ + singleSelect: true, + listeners: { + rowselect: function(smObj, rowIndex, record) { + _5625.scope.workflow.currentRowTrigger = rowIndex; + } + } + }), + stripeRows: true, + viewConfig: {forceFit: true}, + tbar: toolBar + }); + + triggerEditor.on({ + scope: this, + afteredit: function(roweditor, changes, record, rowIndex) { + + var stepUID = record.data.STEP_UID; + var triUID = record.data.TRI_UID; + var sType = record.data.ST_TYPE; + var sCondition = record.data.ST_CONDITION; + //var urlparams = '?action=assignTrigger&data={"STEP_UID":"'+stepUID+'","TRI_UID":"'+triUID+'","ST_TYPE":"'+sType+'","ST_CONDITION":""}'; + Ext.Ajax.request({ + url : '../steps/steps_Ajax.php', + method: 'POST', + params:{ + action : 'assignTrigger', + STEP_UID : stepUID, + TRI_UID : triUID, + ST_TYPE : sType, + ST_CONDITION : sCondition + }, + success: function(response) { + Ext.MessageBox.alert ('Status','Triggers has been assigned successfully.'); + } + }); + + //Deleting previously assigned trigger on updating/replacing with new trigger. + if(changes != '' && typeof record.json != 'undefined' ) + { + stepUID = record.json.STEP_UID; + var sTrigger = record.json.TRI_UID; + sType = record.json.ST_TYPE; + var iPosition = record.json.ST_POSITION; + var urlparams = '?action=ofToAssignTrigger&sStep=' + stepUID + '&sTrigger=' + sTrigger + '&sType=' + sType + '&iPosition=' + iPosition + + Ext.Ajax.request({ + url : '../steps/steps_Ajax.php' + urlparams, + success: function(response) { + //Ext.MessageBox.alert ('Status','Trigger has been updated successfully.'); + } + }); + } + } + }); + + var treeGrid = new Ext.FormPanel({ + frame: true, + labelAlign: 'left', + bodyStyle:'padding:5px', + width: 750, + height: 500, + layout: 'column', + items: [{ + columnWidth: 0.4, + layout: 'fit', + items: [tree] + },{ + columnWidth: 0.6, + xtype: 'fieldset', + //labelWidth: 120, + title:'Assign Triggers', + defaults: {width: 140, border:false}, + autoHeight: true, + bodyStyle: Ext.isIE ? 'padding:0 0 5px 15px;' : 'padding:10px 15px;', + border: false, + items: [triggerGrid] + }] + }); + + return treeGrid; + /*var window = new Ext.Window({ + title: 'Steps Of', + collapsible: false, + maximizable: false, + width: 700, + height: 500, + //minWidth: 200, + //autoHeight: true, + minHeight : 150, + layout : 'fit', + plain: true, + bodyStyle: 'padding:5px;', + buttonAlign: 'center', + items: [treeGrid], + buttons: [{ + text: 'Save', + handler: function(){ + + } + },{ + text: 'Cancel', + handler: function(){ + // when this button clicked, + window.close(); + } + }] + }); + window.show();*/ +} \ No newline at end of file diff --git a/workflow/engine/templates/bpmn/bpmnShapes.js b/workflow/engine/templates/bpmn/bpmnShapes.js new file mode 100755 index 000000000..37e49d433 --- /dev/null +++ b/workflow/engine/templates/bpmn/bpmnShapes.js @@ -0,0 +1,971 @@ +bpmnTask = function (_30ab) { + VectorFigure.call(this); + + if(typeof _30ab.boundaryEvent != 'undefined' && _30ab.boundaryEvent == true) + { + this.boundaryEvent = _30ab.boundaryEvent; + } + if(typeof _30ab.task_width != 'undefined' && typeof _30ab.task_height != 'undefined') + this.setDimension(_30ab.task_width, _30ab.task_height); + else + this.setDimension(165, 40); + + this.taskName = _30ab.taskName; //It will set the Default Task Name with appropriate count While dragging a task on the canvas +}; + +bpmnTask.prototype = new VectorFigure; +bpmnTask.prototype.type = "bpmnTask" + + +bpmnTask.prototype.coord_converter = function (bound_width, bound_height, text_length) { + //bound_width = this.workflow.currentSelection.width; + //bound_height = this.workflow.currentSelection.height; + input_width = text_length * 6 + input_height = 10 + + temp_width = bound_width - input_width; + temp_width /= 2; + temp_x = temp_width; + + temp_height = bound_height - 10; + temp_height /= 2; + temp_y = temp_height; + + var temp_coord = new Object(); + temp_coord.temp_x = temp_x; + temp_coord.temp_y = temp_y; + return temp_coord; +}; + +//curWidth = this.getWidth(); +bpmnTask.prototype.paint = function () { + VectorFigure.prototype.paint.call(this); + + //Set the Task Limitation + if (this.getWidth() > 200 || this.getHeight() > 100) { + this.setDimension(200, 100); + } + else if (this.getWidth() < 165 || this.getHeight() < 40) { + this.setDimension(165, 40); + } + + var x = new Array(6, this.getWidth() - 3, this.getWidth(), this.getWidth(), this.getWidth() - 3, 6, 3, 3, 6); + var y = new Array(3, 3, 6, this.getHeight() - 3, this.getHeight(), this.getHeight(), this.getHeight() - 3, 6, 3); + this.stroke = 2; + this.graphics.setStroke(this.stroke); + this.graphics.setColor("#c0c0c0"); + this.graphics.fillPolygon(x, y); + for (var i = 0; i < x.length; i++) { + x[i] = x[i] - 3; + y[i] = y[i] - 3; + } + this.graphics.setColor("#DBDFF6"); + this.graphics.fillPolygon(x, y); + + this.graphics.setColor("#5164b5"); //Blue Color + this.graphics.drawPolygon(x, y); + this.graphics.paint(); + this.x_text = this.workflow.getAbsoluteX(); //Get x co-ordinate from figure + this.y_text = this.workflow.getAbsoluteY(); //Get x co-ordinate from figure +/* Created New Object of jsGraphics to draw String. + * New object is created to implement changing of Text functionality + */ + bpmnText = new jsGraphics(this.id); + +/*if(this.taskName.length <= 17) + { + var padleft = 0.025*this.getWidth(); + var padtop = 0.36*this.getHeight(); + var rectwidth = this.getWidth() - padleft; + var rectheight = 0.54*this.getHeight(); + } + else + { + padleft = 0.1*this.getWidth(); + padtop = 0.15*this.getHeight(); + rectwidth = this.getWidth() - padleft; + rectheight = 0.75*this.getHeight(); + } +*/ + var len = this.getWidth() / 18; + if (len >= 6) { + //len = 1.5; + var padleft = 0.12 * this.getWidth(); + var padtop = 0.32 * this.getHeight() -3; + this.rectWidth = this.getWidth() - 2 * padleft; + } + else { + padleft = 0.1 * this.getWidth(); + padtop = 0.09 * this.getHeight() -3; + this.rectWidth = this.getWidth() - 2 * padleft; + } + + var rectheight = this.getHeight() - padtop -7; + + bpmnText.drawStringRect(this.taskName, padleft, padtop, this.rectWidth, rectheight, 'center'); + // tempcoord = this.coord_converter(this.getWidth(), this.getHeight(), this.taskName.length); + // bpmnText.drawTextString(this.taskName, this.getWidth(), this.getHeight(), tempcoord.temp_x, tempcoord.temp_y); + + /**************************** Drawing Timer Boundary event starts here *******************************/ + + var boundaryTimer = new jsGraphics(this.id); + + var x_cir1=5; + var y_cir1=45; + boundaryTimer.setColor("#c0c0c0"); + boundaryTimer.fillEllipse(x[3]-x[3]/1.08,y[4]-12,30,30); + + boundaryTimer.setStroke(this.stroke); + boundaryTimer.setColor( "#f9faf2" ); + boundaryTimer.fillEllipse(x[3]-x[3]/1.08,y[5]-12,30,30); + boundaryTimer.setColor("#adae5e"); + boundaryTimer.drawEllipse(x[3]-x[3]/1.08,y[5]-12,30,30); + var x_cir2=8; + var y_cir2=48; + boundaryTimer.setColor( "#f9faf2" ); + boundaryTimer.fillEllipse(x[3]-x[3]/1.08+3,y[5]-9,30-6,30-6); + boundaryTimer.setColor("#adae5e"); + boundaryTimer.drawEllipse(x[3]-x[3]/1.08+3,y[5]-9,30-6,30-6); + + /* + //drawing clock's minutes lines + this.graphics.setColor("#adae5e"); + //this.graphics.drawEllipse(x_cir3,y_cir3,30-20,30-20); + this.graphics.drawLine(30/2,30/2,30/1.3,30/2); + this.graphics.drawLine(30/2,30/2,30/2,30/4.5); + */ + + + //var x_cir3=10; + //var y_cir3=10; + //this.graphics.setColor( "#f9faf2" ); + //this.graphics.fillEllipse(x_cir3,y_cir3,30-20,30-20); + boundaryTimer.setColor("#adae5e"); + //this.graphics.drawEllipse(x_cir3,y_cir3,30-20,30-20); + boundaryTimer.drawLine(30/2.2+x[3]-x[3]/1.08,30/2+y[5]-10,30/1.6+x[3]-x[3]/1.08,30/2+y[5]-10); //horizontal line + boundaryTimer.drawLine(30/2.2+x[3]-x[3]/1.08,30/2+y[5]-10,30/2.2+x[3]-x[3]/1.08,30/3.7+y[5]-10); //vertical line + + boundaryTimer.drawLine(x[3]-x[3]/1.08+24,y[5]-3,x[3]-x[3]/1.08+20,y[5]); //10th min line 24,8,20,11 + boundaryTimer.drawLine(x[3]-x[3]/1.08+21,y[5]+4,x[3]-x[3]/1.08+25,y[5]+4); //15th min line + boundaryTimer.drawLine(x[3]-x[3]/1.08+24,y[5]+11,x[3]-x[3]/1.08+19,y[5]+9); //25th min line + boundaryTimer.drawLine(x[3]-x[3]/1.08+15,y[5]+11,x[3]-x[3]/1.08+15,y[5]+14); //30th min line + boundaryTimer.drawLine(x[3]-x[3]/1.08+8,y[5]+11,x[3]-x[3]/1.08+12,y[5]+8); //40th min line + boundaryTimer.drawLine(x[3]-x[3]/1.08+5,y[5]+4,x[3]-x[3]/1.08+8,y[5]+4); //45th min line + boundaryTimer.drawLine(x[3]-x[3]/1.08+8,y[5]-4,x[3]-x[3]/1.08+11,y[5]-1); //50th min line + boundaryTimer.drawLine(x[3]-x[3]/1.08+15,y[5]-7,x[3]-x[3]/1.08+15,y[5]-4); //60th min line + + if(this.boundaryEvent == true) + boundaryTimer.paint(); + /**************************** Drawing Timer Boundary event ends here *******************************/ + + bpmnText.paint(); + this.bpmnNewText = bpmnText; + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ + if (this.input1 != null) { + this.input1.setPosition(0, this.height / 2); + } + if (this.output1 != null) { + this.output1.setPosition(this.width / 2, this.height); + } + if (this.input2 != null) { + this.input2.setPosition(this.width / 2, 0); + } + if (this.output2 != null) { + this.output2.setPosition(this.width, this.height / 2); + } + + +}; + +jsGraphics.prototype.drawTextString = function (txt, x, y, dx, dy) { + this.htm += '
' + txt + '<\/div>'; +}; + +/*Workflow.prototype.onMouseUp=function(x,y){ + //Saving Task/Annotations position on Async Ajax call + +this.dragging=false; +this.draggingLine=null; +};*/ + +Figure.prototype.onDragend=function(){ + +if(typeof workflow.currentSelection != 'undefined' && workflow.currentSelection != null) + { + var currObj =workflow.currentSelection; + switch (currObj.type) { + case 'bpmnTask': + case 'bpmnSubProcess': + currObj.actiontype = 'saveTaskPosition'; + currObj.workflow.saveShape(currObj); + break; + case 'bpmnAnnotation': + currObj.actiontype = 'saveTextPosition'; + currObj.workflow.saveShape(currObj); + break; + } + workflow.setBoundary(currObj); + } + +if(this.getWorkflow().getEnableSmoothFigureHandling()==true){ +var _3dfe=this; +var _3dff=function(){ +if(_3dfe.alpha<1){ +_3dfe.setAlpha(Math.min(1,_3dfe.alpha+0.05)); +}else{ +window.clearInterval(_3dfe.timer); +_3dfe.timer=-1; +} +}; +if(_3dfe.timer>0){ +window.clearInterval(_3dfe.timer); +} +_3dfe.timer=window.setInterval(_3dff,20); +}else{ +this.setAlpha(1); +} +this.command.setPosition(this.x,this.y); +this.workflow.commandStack.execute(this.command); +this.command=null; +this.isMoving=false; +this.workflow.hideSnapToHelperLines(); +this.fireMoveEvent(); +}; + +Figure.prototype.onKeyDown=function(_3e0e,ctrl){ +if(_3e0e==46&&this.isDeleteable()==true){ +workflow.getDeleteCriteria(); +//this.workflow.commandStack.execute(new CommandDelete(this)); +} +if(ctrl){ +this.workflow.onKeyDown(_3e0e,ctrl); +} +}; + +bpmnTask.prototype.setWorkflow = function (_40c5) { + VectorFigure.prototype.setWorkflow.call(this, _40c5); + if (_40c5 != null) { +/*Adding Port to the Task After dragging Task on the Canvas + *Ports will be invisibe After Drag and Drop, But It will be created + */ + var TaskPortName = ['output1', 'output2', 'input1', 'input2']; + var TaskPortType = ['OutputPort', 'OutputPort', 'InputPort', 'InputPort']; + var TaskPositionX = [this.width / 2, this.width, 0, this.width / 2]; + var TaskPositionY = [this.height, this.height / 2, this.height / 2, 0]; + + for (var i = 0; i < TaskPortName.length; i++) { + eval('this.' + TaskPortName[i] + ' = new ' + TaskPortType[i] + '()'); //Create New Port + eval('this.' + TaskPortName[i] + '.setWorkflow(_40c5)'); //Add port to the workflow + eval('this.' + TaskPortName[i] + '.setName("' + TaskPortName[i] + '")'); //Set PortName + eval('this.' + TaskPortName[i] + '.setZOrder(-1)'); //Set Z-Order of the port to -1. It will be below all the figure + eval('this.' + TaskPortName[i] + '.setBackgroundColor(new Color(255, 255, 255))'); //Setting Background of the port to white + eval('this.' + TaskPortName[i] + '.setColor(new Color(255, 255, 255))'); //Setting Border of the port to white + eval('this.addPort(this.' + TaskPortName[i] + ',' + TaskPositionX[i] + ', ' + TaskPositionY[i] + ')'); //Setting Position of the port + } + } +}; + +InputPort.prototype.onDrop = function (port) { + if (port.getMaxFanOut && port.getMaxFanOut() <= port.getFanOut()) { + return; + } + if (this.parentNode.id == port.parentNode.id) {} else { + var newObj = new Array(); + newObj = this.workflow.currentSelection; + var preObj = port.parentNode; + newObj.sPortType =port.properties.name; + preObj.sPortType =this.properties.name; + this.workflow.saveRoute(preObj,newObj); + + var _3f02 = new CommandConnect(this.parentNode.workflow, port, this); + if (_3f02.source.type == _3f02.target.type) { + return; + } + _3f02.setConnection(new DecoratedConnection()); + this.parentNode.workflow.getCommandStack().execute(_3f02); + } +}; + +OutputPort.prototype.onDrop = function (port) { + if (this.getMaxFanOut() <= this.getFanOut()) { + return; + } + + var connect = true; + var conn = this.workflow.checkConnectionsExist(port, 'targetPort', 'OutputPort'); + if (conn == 0) //If no connection Exist then Allow connect + connect = true; + else if (conn < 2) //If One connection exist then Do not Allow to connect + connect = false; + + + if (this.parentNode.id == port.parentNode.id || connect == false) { + + } else { + var _4070 = new CommandConnect(this.parentNode.workflow, this, port); + if (_4070.source.type == _4070.target.type) { + return; + } + _4070.setConnection(new DecoratedConnection()); + this.parentNode.workflow.getCommandStack().execute(_4070); + + //Saving Start Event + var preObj = new Array(); + var bpmnType = this.workflow.currentSelection.type; + if(bpmnType.match(/Event/) && bpmnType.match(/Start/) && port.parentNode.type.match(/Task/)) + { + var tas_uid = port.parentNode.id; + this.workflow.saveEvents(this.workflow.currentSelection,tas_uid); + } + else if(bpmnType.match(/Task/) && port.parentNode.type.match(/End/) && port.parentNode.type.match(/Event/)) + { + preObj = this.workflow.currentSelection; + var newObj = port.parentNode; + newObj.conn = _4070.connection; + this.workflow.saveRoute(preObj,newObj); + } + else if(port.parentNode.type.match(/Task/) && bpmnType.match(/Inter/) && bpmnType.match(/Event/)) + { + var taskFrom = workflow.getStartEventConn(this,'sourcePort','InputPort'); + var taskTo = workflow.getStartEventConn(this,'targetPort','OutputPort'); + + if(typeof taskFrom[0] != 'undefined' || typeof taskTo[0] != 'undefined') + { + preObj.type = 'Task'; + preObj.taskFrom = taskFrom[0].value; + preObj.taskTo = taskTo[0].value; + + //save Event First + var tas_uid = port.parentNode.id; + this.workflow.saveEvents(workflow.currentSelection,preObj); + } + } + else if(bpmnType.match(/Task/) && port.parentNode.type.match(/Task/)) + { + + var preObj = this.workflow.currentSelection; + var newObj = port.parentNode; + newObj.conn = _4070.connection; + newObj.sPortType =port.properties.name; + preObj.sPortType =this.properties.name; + this.workflow.saveRoute(preObj,newObj); + } + else if(bpmnType.match(/Gateway/) && port.parentNode.type.match(/Task/)) + { + var shape = new Array(); + shape.type = ''; + var preObj = this.workflow.currentSelection; + this.workflow.saveRoute(preObj,shape); + } + + } +}; + + +LineEndResizeHandle.prototype.onDrop=function(_3f3e){ +var line=this.workflow.currentSelection; +line.isMoving=false; +if(line instanceof Connection){ +this.command.setNewPorts(line.getSource(),_3f3e); + +//If Input Port /Output Port is connected to respective ports, then should not connected +if(this.command.newSourcePort.type == this.command.newTargetPort.type) + return; +else + { + this.command.newTargetPort.parentNode.conn = this.command.con; + this.command.newTargetPort.parentNode.sPortType = this.command.newTargetPort.properties.name; + this.command.newSourcePort.parentNode.sPortType = this.command.newSourcePort.properties.name; + this.workflow.saveRoute(this.command.newSourcePort.parentNode,this.command.newTargetPort.parentNode); + this.getWorkflow().getCommandStack().execute(this.command); + } +} +this.command=null; +}; + +LineStartResizeHandle.prototype.onDrop=function(_410d){ +var line=this.workflow.currentSelection; +line.isMoving=false; +if(line instanceof Connection){ +this.command.setNewPorts(_410d,line.getTarget()); + +//If Input Port /Output Port is connected to respective ports, then should not connected +if(this.command.newSourcePort.type == this.command.newTargetPort.type) + return; +else + { + this.command.newTargetPort.parentNode.conn = this.command.con; + this.command.newTargetPort.parentNode.sPortType = this.command.newTargetPort.properties.name; + this.command.newSourcePort.parentNode.sPortType = this.command.newSourcePort.properties.name; + this.command.newTargetPort.parentNode.conn = this.command.con; + this.workflow.saveRoute(this.command.newSourcePort.parentNode,this.command.newTargetPort.parentNode); + this.getWorkflow().getCommandStack().execute(this.command); + } +} +this.command=null; +}; + +ResizeHandle.prototype.onDragend=function(){ +if(this.commandMove==null){ +return; +} +var currentSelection = workflow.currentSelection; +if(currentSelection.type.match(/Task/)) +{ + currentSelection.actiontype = 'saveTaskCordinates'; + workflow.saveShape(currentSelection); +} +else if(currentSelection.type.match(/Annotation/)) +{ + currentSelection.actiontype = 'saveAnnotationCordinates'; + workflow.saveShape(currentSelection); +} +} +VectorFigure.prototype.addChild=function(_4078){ + _4078.setParent(this); +//_4078.setZOrder(this.getZOrder()+1); +//_4078.setParent(this); +//_4078.parent.addChild(_4078); +//this.children[_4078.id]=_4078; +//this.scrollarea.appendChild(_4078.getHTMLElement()); +}; + +////// Decorators to add an arrow to the flow line. To show the direction of flow ////////////// +DecoratedConnection = function () { + Connection.call(this); + this.setTargetDecorator(new ArrowConnectionDecorator()); + this.setRouter(new ManhattanConnectionRouter()); +}; +DecoratedConnection.prototype = new Connection(); +DecoratedConnection.prototype.type = "DecoratedConnection"; +DecoratedConnection.prototype.getContextMenu = function () { + if (this.id != null) { + this.workflow.contextClicked = true; + this.workflow.connectionContextMenu(this); + } +}; + +////////--------------------------------------------------------------------------------------------/////// +FlowMenu = function (_39f9) { + this.actionAdd = new ButtonAdd(this); + this.actionTask = new ButtonTask(this); + this.actionInterEvent = new ButtonInterEvent(this); + this.actionEndEvent = new ButtonEndEvent(this); + this.actionGateway = new ButtonGateway(this); + this.actionFront = new ButtonMoveFront(this); + this.actionBack = new ButtonMoveBack(this); + this.actionDelete = new ButtonDelete(this); + this.actionAnnotation = new ButtonAnnotation(this); + ToolPalette.call(this); + this.setDimension(20, 80); + this.setBackgroundColor(new Color(220, 255, 255)); + this.currentFigure = null; + this.myworkflow = _39f9; + this.added = false; + this.setDeleteable(false); + this.setCanDrag(false); + this.setResizeable(false); + this.setSelectable(false); + var zOrder = this.getZOrder(); + this.setZOrder(4000); + this.setBackgroundColor(null); + this.setColor(null); + this.scrollarea.style.borderBottom = "0px"; + this.actionAdd.setPosition(0, 0); + this.actionInterEvent.setPosition(20, 0); + this.actionGateway.setPosition(20, 20); + this.actionFront.setPosition(0, 18); + this.actionBack.setPosition(0, 36); + this.actionDelete.setPosition(0, 54); +}; + +ToolPalette.prototype.removechild = function (_4079) { + if (_4079 != null) { + var parentNode = this.html; + if (parentNode != null) { + if (typeof parentNode.children != 'undefined') { + var len = parentNode.children[0].children.length; + for (var i = 0; i < len; i++) { + var childNode = parentNode.children[0].children[i]; + if (childNode == _4079.html) { + parentNode.children[0].removeChild(childNode); + } + } + } + } + } +}; +FlowMenu.prototype = new ToolPalette; +FlowMenu.prototype.setAlpha = function (_39fa) { + Figure.prototype.setAlpha.call(this, _39fa); +}; +FlowMenu.prototype.hasTitleBar = function () { + return false; +}; +FlowMenu.prototype.setFigure = function (_3087) { + +} +FlowMenu.prototype.onSelectionChanged = function (_39fb) { + + var newWorkflow = ''; + //If Right Clicked on the figure, Disabling Flow menu + if (_39fb != null) { + newWorkflow = _39fb.workflow; + } + else if (this.workflow != null) { + newWorkflow = this.workflow; + } + else { + newWorkflow = this.myworkflow; + } + + var contextClicked = newWorkflow.contextClicked; +/*Check wheather the figure selected is same as previous figure. + *If figure is different ,then remove the port from the previous selected figure. + **/ + if (newWorkflow.currentSelection != null && typeof newWorkflow.preSelectedFigure != 'undefined') { + if (newWorkflow.currentSelection.id != newWorkflow.preSelectedFigure.id) { + newWorkflow.disablePorts(newWorkflow.preSelectedFigure); + } + } + + if (_39fb == this.currentFigure && contextClicked == true) { + return; + } + if (this.added == true) { + this.myworkflow.removeFigure(this); + this.added = false; + } + + + if (_39fb != null && this.added == false) { + if (this.myworkflow.getEnableSmoothFigureHandling() == true) { + this.setAlpha(0.01); + } + this.myworkflow.addFigure(this, 100, 100); + this.added = true; + } + if (this.currentFigure != null) { + this.currentFigure.detachMoveListener(this); + } + this.currentFigure = _39fb; + if (this.currentFigure != null) { + this.currentFigure.attachMoveListener(this); + this.onOtherFigureMoved(this.currentFigure); + + } + +}; +FlowMenu.prototype.setWorkflow = function (_39fc) { + Figure.prototype.setWorkflow.call(this, _39fc); +}; + + +FlowMenu.prototype.onOtherFigureMoved = function (_39fd) { + if (_39fd != null) { + //Get the workflow object of the selected Figure object, so that we can compare with the new selected figure to remove ports + _39fd.workflow.preSelectedFigure = _39fd.workflow.currentSelection; + workflow.setBoundary(workflow.currentSelection); + //Preventing Task from drawing outside canvas Code Starts here + //@params - max X pos(canvas Width) = 918 + //@params - max Y pos(canvas Height) = 837 + /////////////////////////////////////////// + + + //Preventing Task from drawing outside canvas Code Ends here + if (_39fd.type == 'DecoratedConnection' || _39fd.workflow.contextClicked == true) { + this.removechild(this.actionAdd); + this.removechild(this.actionInterEvent); + this.removechild(this.actionGateway); + this.removechild(this.actionAnnotation); + this.removechild(this.actionTask); + this.removechild(this.actionEndEvent); + this.removechild(this.actionBack); + this.removechild(this.actionDelete); + this.removechild(this.actionFront); + _39fd.workflow.hideResizeHandles(); + } + else { + var pos = _39fd.getPosition(); + this.setPosition(pos.x + _39fd.getWidth() + 7, pos.y - 16); + if (_39fd.workflow != null) { + var bpmnShape = _39fd.workflow.currentSelection.type; + this.addChild(this.actionFront); + this.addChild(this.actionBack); + this.addChild(this.actionDelete); + var ports = ''; + //Disable Resize for All Events and Gateway + if (bpmnShape.match(/Event/) || bpmnShape.match(/Gateway/) || bpmnShape.match(/bpmnDataobject/) || bpmnShape.match(/bpmnSubProcess/)) { + _39fd.workflow.hideResizeHandles(); + } + if (bpmnShape.match(/Task/) || bpmnShape.match(/SubProcess/)) { + this.addChild(this.actionAdd); + this.addChild(this.actionInterEvent); + this.addChild(this.actionEndEvent); + this.addChild(this.actionGateway); + this.addChild(this.actionAnnotation); + this.actionAnnotation.setPosition(20, 60); + this.actionEndEvent.setPosition(20, 40) + this.removechild(this.actionTask); + ports = ['output1', 'input1', 'output2', 'input2']; + //ports = ['output1', 'output2']; + _39fd.workflow.enablePorts(_39fd, ports); + } + else if (bpmnShape.match(/Start/)) { + this.addChild(this.actionAdd); + this.addChild(this.actionAnnotation); + this.actionAnnotation.setPosition(20, 40); + this.addChild(this.actionInterEvent); + this.actionInterEvent.setPosition(20, 20) + this.addChild(this.actionGateway); + this.actionGateway.setPosition(20, 0) + this.removechild(this.actionEndEvent); + ports = ['output1', 'output2']; + _39fd.workflow.enablePorts(_39fd, ports); + } + else if (bpmnShape.match(/Inter/)) { + this.addChild(this.actionAdd); + this.addChild(this.actionAnnotation); + this.actionAnnotation.setPosition(20, 60); + this.addChild(this.actionInterEvent); + this.actionInterEvent.setPosition(20, 20) + this.addChild(this.actionGateway); + this.actionGateway.setPosition(20, 0); + this.addChild(this.actionEndEvent); + this.actionEndEvent.setPosition(20, 40); + ports = ['output1', 'input1', 'output2', 'input2']; + _39fd.workflow.enablePorts(_39fd, ports); + } + else if (bpmnShape.match(/End/)) { + this.addChild(this.actionAnnotation); + this.actionAnnotation.setPosition(0, 0); + this.removechild(this.actionInterEvent); + this.removechild(this.actionEndEvent); + this.removechild(this.actionTask); + this.removechild(this.actionGateway); + this.removechild(this.actionAdd); + ports = ['input1', 'input2']; + _39fd.workflow.enablePorts(_39fd, ports); + } + else if (bpmnShape.match(/Gateway/)) { + this.addChild(this.actionAdd); + this.addChild(this.actionAnnotation); + this.actionAnnotation.setPosition(20, 60); + this.addChild(this.actionInterEvent); + this.actionInterEvent.setPosition(20, 20) + this.addChild(this.actionGateway); + this.actionGateway.setPosition(20, 0); + this.addChild(this.actionEndEvent); + this.actionEndEvent.setPosition(20, 40); + ports = ['output1', 'input1', 'output2', 'input2']; + _39fd.workflow.enablePorts(_39fd, ports); + } + else if (bpmnShape.match(/Annotation/) || bpmnShape.match(/Dataobject/)) { + this.removechild(this.actionAdd); + this.removechild(this.actionInterEvent); + this.removechild(this.actionGateway); + this.removechild(this.actionEndEvent); + this.removechild(this.actionAnnotation); + this.removechild(this.actionEndEvent); + if (bpmnShape.match(/Annotation/)) { + ports = ['input1']; + _39fd.workflow.enablePorts(_39fd, ports); + } + } + else if (bpmnShape.match(/Pool/)) { + this.removechild(this.actionAdd); + this.removechild(this.actionInterEvent); + this.removechild(this.actionGateway); + this.removechild(this.actionEndEvent); + this.removechild(this.actionAnnotation); + this.removechild(this.actionEndEvent); + this.removechild(this.actionFront); + this.removechild(this.actionBack); + this.removechild(this.actionDelete); + } + } + } + } +}; + +bpmnTask.prototype.addShapes = function (_3896) { + var xOffset = _3896.workflow.currentSelection.getX(); //Get x co-ordinate from figure + var y = _3896.workflow.currentSelection.getY(); //Get y co-ordinate from figure + //var xOffset = parseFloat(x + _3896.workflow.currentSelection.width); //Get x-offset co-ordinate from figure + var yOffset = parseFloat(y + _3896.workflow.currentSelection.height + 25); //Get y-offset co-ordinate from figure + var count; + var shape = _3896.workflow.currentSelection.type; + + + if (_3896.newShapeName == 'bpmnTask' && shape.match(/Event/)) { + xOffset = _3896.workflow.currentSelection.getX() - 40; //Setting new offset value when currentselection is not Task i.e deriving task from events + } + + if (_3896.newShapeName == 'bpmnTask' && shape.match(/Gateway/)) { + xOffset = _3896.workflow.currentSelection.getX() - 35; //Setting new offset value when currentselection is not Task i.e deriving task from gateways + } + + if (_3896.newShapeName.match(/Event/)) { + xOffset = _3896.workflow.currentSelection.getX() + 40; //Setting new offset value when newShape is not Task i.e aligning events + } + + if (_3896.newShapeName.match(/Gateway/)) { + xOffset = _3896.workflow.currentSelection.getX() + 35; //Setting new offset value when newShape is not Task i.e aligning gateways + } + + /* Incrementing Task No and assigning it to a local variable + * taskNo Globally Declared in processmap.js + * taskNo will have Last Task count + * */ + if (_3896.newShapeName == 'bpmnTask') { + count = ++_3896.workflow.taskNo; + _3896.workflow.taskName = 'Task ' + count; + } + + workflow.subProcessName = 'Sub Process'; + var newShape = eval("new " + _3896.newShapeName + "(_3896.workflow)"); + + _3896.workflow.addFigure(newShape, xOffset, yOffset); + + //Assigning values to newShape Object for Saving Task automatically (Async Ajax Call) + newShape.x = xOffset; + newShape.y = yOffset; + + + + + var conn = new DecoratedConnection(); + if (newShape.type.match(/Gateway/)) { + conn.setTarget(newShape.getPort("input2")); + conn.setSource(_3896.workflow.currentSelection.getPort("output1")); + _3896.workflow.addFigure(conn); + } + if (newShape.type.match(/Start/)) { + conn.setTarget(newShape.getPort("output1")); + conn.setSource(_3896.workflow.currentSelection.getPort("input2")); + _3896.workflow.addFigure(conn); + } + if (newShape.type.match(/Event/)) { + conn.setTarget(newShape.getPort("input2")); + conn.setSource(_3896.workflow.currentSelection.getPort("output1")); + _3896.workflow.addFigure(conn); + } + if (newShape.type.match(/Task/)) { + conn.setTarget(newShape.getPort("input2")); + conn.setSource(_3896.workflow.currentSelection.getPort("output1")); + _3896.workflow.addFigure(conn); + } + + + if (_3896.newShapeName.match(/Event/) && _3896.newShapeName.match(/End/)) { + newShape.conn = conn; + _3896.workflow.saveRoute(_3896.workflow.currentSelection,newShape); + } + else if (_3896.newShapeName == 'bpmnTask') { + newShape.actiontype = 'addTask'; + newShape.conn = conn; + _3896.workflow.saveShape(newShape); //Saving Task automatically (Async Ajax Call) + } + +} + +ButtonInterEvent = function (_30a8) { + Button.call(this, _30a8, 16, 16); +}; +ButtonInterEvent.prototype = new Button; +ButtonInterEvent.prototype.type = "/skins/ext/images/gray/shapes/interevent"; +ButtonInterEvent.prototype.execute = function () { + var count = 0; + this.palette.newShapeName = 'bpmnEventEmptyInter'; + bpmnTask.prototype.addShapes(this.palette); +}; + +ButtonEndEvent = function (_30a8) { + Button.call(this, _30a8, 16, 16); +}; +ButtonEndEvent.prototype = new Button; +ButtonEndEvent.prototype.type = "/skins/ext/images/gray/shapes/endevent"; +ButtonEndEvent.prototype.execute = function () { + var count = 0; + this.palette.newShapeName = 'bpmnEventEmptyEnd'; + bpmnTask.prototype.addShapes(this.palette); +}; + + +ButtonGateway = function (_30a8) { + Button.call(this, _30a8, 16, 16); +}; +ButtonGateway.prototype = new Button; +ButtonGateway.prototype.type = "/skins/ext/images/gray/shapes/gateway-small"; +ButtonGateway.prototype.execute = function () { + this.palette.newShapeName = 'bpmnGatewayExclusiveData'; + bpmnTask.prototype.addShapes(this.palette); +}; + +ButtonAnnotation = function (_30a8) { + Button.call(this, _30a8, 16, 16); +}; +ButtonAnnotation.prototype = new Button; +ButtonAnnotation.prototype.type = "/skins/ext/images/gray/shapes/annotation"; +ButtonAnnotation.prototype.execute = function () { + var count = 0; + this.palette.newShapeName = 'bpmnAnnotation'; + bpmnTask.prototype.addShapes(this.palette); +}; + +ButtonTask = function (_30a8) { + Button.call(this, _30a8, 16, 16); +}; +ButtonTask.prototype = new Button; +ButtonTask.prototype.type = "/skins/ext/images/gray/shapes/Task"; +ButtonTask.prototype.execute = function () { + this.palette.newShapeName = 'bpmnTask'; + bpmnTask.prototype.addShapes(this.palette); +}; + + +ButtonAdd = function (_30a8) { + Button.call(this, _30a8, 16, 16); +}; +ButtonAdd.prototype = new Button; +ButtonAdd.prototype.type = "/skins/ext/images/gray/shapes/btn-add"; +ButtonAdd.prototype.execute = function () { + this.palette.newShapeName = 'bpmnTask'; + this.palette.workflow.preSelectedObj = this.palette.workflow.currentSelection; + bpmnTask.prototype.addShapes(this.palette); +}; + +ButtonDelete = function (_30a9) { + Button.call(this, _30a9, 16, 16); +}; +ButtonDelete.prototype = new Button; +ButtonDelete.prototype.type = "/skins/ext/images/gray/shapes/btn-del"; +ButtonDelete.prototype.execute = function () { + workflow.hideResizeHandles(); + workflow.getDeleteCriteria(); +}; +ButtonMoveFront = function (_3e22) { + Button.call(this, _3e22, 16, 16); +}; +ButtonMoveFront.prototype = new Button; +ButtonMoveFront.prototype.type = "/skins/ext/images/gray/shapes/btn-movefrnt"; +ButtonMoveFront.prototype.execute = function () { + this.palette.workflow.moveFront(this.palette.workflow.getCurrentSelection()); + ToolGeneric.prototype.execute.call(this); +}; +ButtonMoveBack = function (_4091) { + Button.call(this, _4091, 16, 16); +}; +ButtonMoveBack.prototype = new Button; +ButtonMoveBack.prototype.type = "/skins/ext/images/gray/shapes/btn-movebk"; +ButtonMoveBack.prototype.execute = function () { + this.palette.workflow.moveBack(this.palette.workflow.getCurrentSelection()); + ToolGeneric.prototype.execute.call(this); +}; + +bpmnTaskDialog = function (_2e5e) { + this.figure = _2e5e; + var title = 'Task Detail'; + Dialog.call(this, title); + this.setDimension(400, 150); //Set the width and height of the Dialog box +} + +bpmnTaskDialog.prototype = new Dialog(this); +bpmnTaskDialog.prototype.createHTMLElement = function () { + var item = Dialog.prototype.createHTMLElement.call(this); + var inputDiv = document.createElement("form"); + inputDiv.style.position = "absolute"; + inputDiv.style.left = "10px"; + inputDiv.style.top = "30px"; + inputDiv.style.width = "375px"; + inputDiv.style.font = "normal 10px verdana"; + item.appendChild(inputDiv); + this.label = document.createTextNode("Task Name"); + inputDiv.appendChild(this.label); + this.input = document.createElement("textarea"); + this.input.size = '1'; + this.input.style.border = "1px solid gray"; + this.input.style.font = "normal 10px verdana"; + //this.input.type = "text"; + this.input.cols = "50"; + this.input.rows = "3"; + this.input.maxLength = "100"; + var value = bpmnTask.prototype.trim(workflow.currentSelection.taskName); + if (value) this.input.value = value; + else this.input.value = ""; + this.input.style.width = "100%"; + inputDiv.appendChild(this.input); + this.input.focus(); + return item; +}; + +/*Double Click Event for opening the dialog Box*/ +bpmnTask.prototype.onDoubleClick = function () { + var _409d = new bpmnTaskDialog(this); + this.workflow.showDialog(_409d, this.workflow.currentSelection.x, this.workflow.currentSelection.y); +}; + +bpmnTask.prototype.trim = function (str) { + if (str != null) return str.replace(/^\s+|\s+$/g, ''); + else return null; +}; + +/** + * This method will be called if the user pressed the OK button in buttonbar of the dialog.
+ * The string is first cleared and new string is painted.

+ **/ +bpmnTaskDialog.prototype.onOk = function () { + this.figure.bpmnNewText.clear(); + //len = Math.ceil(this.input.value.length/16); + var len = this.workflow.currentSelection.width / 18; + if (len >= 6) { + // len = 1.5; + var padleft = 0.12 * this.workflow.currentSelection.width; + var padtop = 0.32 * this.workflow.currentSelection.height - 3; + this.figure.rectWidth = this.workflow.currentSelection.width - 2 * padleft; + } + else { + padleft = 0.1 * this.workflow.currentSelection.width; + padtop = 0.09 * this.workflow.currentSelection.height - 3; + this.figure.rectWidth = this.workflow.currentSelection.width - 2 * padleft; + } + + var rectheight = this.workflow.currentSelection.height - 2*padtop; + //Aligning text more precisely onOK +/* if(this.input.value.length <= 17) + { + var padleft = 0.025*this.workflow.currentSelection.width; + var padtop = 0.30*this.workflow.currentSelection.height; + var rectwidth = this.workflow.currentSelection.width - 2*padleft; + } + else + { + padleft = 0.1*this.workflow.currentSelection.width; + padtop = 0.09*this.workflow.currentSelection.height; + rectwidth = this.workflow.currentSelection.width - 2*padleft; + var rectheight = this.workflow.currentSelection.height - 10; + + }*/ + + + + //tempcoord = this.workflow.currentSelection.coord_converter(this.workflow.currentSelection.width, this.workflow.currentSelection.height, this.input.value.length) + this.figure.bpmnNewText.drawStringRect(this.input.value, padleft, padtop, this.figure.rectWidth, rectheight, 'center'); + // this.figure.bpmnNewText.drawTextString(this.input.value, this.workflow.currentSelection.width, this.workflow.currentSelection.height, tempcoord.temp_x, tempcoord.temp_y); + this.figure.bpmnNewText.paint(); + this.workflow.currentSelection.taskName = this.input.value; //Set Updated Text value + //Saving task name (whenever updated) onAsynch AJAX call + this.figure.actiontype = 'updateTaskName'; + this.workflow.saveShape(this.figure); + if (this.figure.rectWidth < 80) tempW = 110; + else tempW = this.figure.rectWidth + 35; + + this.workflow.removeFigure(this); + +}; + +bpmnTask.prototype.getContextMenu = function () { + this.workflow.handleContextMenu(this); +}; diff --git a/workflow/engine/templates/bpmn/bpmnShapes1.js b/workflow/engine/templates/bpmn/bpmnShapes1.js new file mode 100755 index 000000000..abe272db4 --- /dev/null +++ b/workflow/engine/templates/bpmn/bpmnShapes1.js @@ -0,0 +1,559 @@ +bpmnTask = function (_30ab) { + VectorFigure.call(this); + this.setDimension(110, 60); + this.setTaskName(_30ab.taskNo); //It will set the Default Task Name with appropriate count While dragging a task on the canvas +}; + +bpmnTask.prototype = new VectorFigure; +bpmnTask.prototype.type = "bpmnTask"; +bpmnTask.prototype.setTaskName = function (name) { + this.taskName = 'Task ' + name; +}; + +bpmnTask.prototype.coord_converter = function (bound_width, bound_height, text_length) { + //bound_width = this.workflow.currentSelection.width; + //bound_height = this.workflow.currentSelection.height; + input_width = text_length * 6 + input_height = 10 + + temp_width = bound_width - input_width; + temp_width /= 2; + temp_x = temp_width; + + temp_height = bound_height - 10; + temp_height /= 2; + temp_y = temp_height; + + var temp_coord = new Object(); + temp_coord.temp_x = temp_x; + temp_coord.temp_y = temp_y; + return temp_coord; +}; + + + +bpmnTask.prototype.paint = function () { + VectorFigure.prototype.paint.call(this); + var x = new Array(6, this.getWidth() - 3, this.getWidth(), this.getWidth(), this.getWidth() - 3, 6, 3, 3, 6); + var y = new Array(3, 3, 6, this.getHeight() - 3, this.getHeight(), this.getHeight(), this.getHeight() - 3, 6, 3); + this.graphics.setStroke(this.stroke); + this.graphics.setColor("#c0c0c0"); + this.graphics.fillPolygon(x, y); + + for (var i = 0; i < x.length; i++) { + x[i] = x[i] - 3; + y[i] = y[i] - 3; + } + this.graphics.setColor("#ffffff"); + this.graphics.fillPolygon(x, y); + this.graphics.setColor("#5164b5"); //Blue Color + this.graphics.drawPolygon(x, y); + this.graphics.paint(); + this.x_text = this.workflow.getAbsoluteX(); //Get x co-ordinate from figure + this.y_text = this.workflow.getAbsoluteY(); //Get x co-ordinate from figure +/* Created New Object of jsGraphics to draw String. + * New object is created to implement changing of Text functionality + */ + var bpmnText = new jsGraphics(this.id); + //bpmnText.drawStringRect(this.taskName,this.getWidth()/2-20,this.getHeight()/2-11,200,'left'); + tempcoord = this.coord_converter(this.getWidth(), this.getHeight(), this.taskName.length); + bpmnText.drawTextString(this.taskName, this.getWidth(), this.getHeight(), tempcoord.temp_x, tempcoord.temp_y); + bpmnText.paint(); + this.bpmnNewText = bpmnText; + +/*Code Added to Dynamically shift Ports on resizing of shapes + **/ + if (this.input1 != null) { + this.input1.setPosition(0, this.height / 2); + } + if (this.output1 != null) { + this.output1.setPosition(this.width / 2, this.height); + } + if (this.input2 != null) { + this.input2.setPosition(this.width / 2, 0); + } + if (this.output2 != null) { + this.output2.setPosition(this.width, this.height / 2); + } + + +}; + +jsGraphics.prototype.drawTextString = function (txt, x, y, dx, dy) { + this.htm += '
' + txt + '<\/div>'; +}; + +bpmnTask.prototype.setWorkflow = function (_40c5) { + VectorFigure.prototype.setWorkflow.call(this, _40c5); + if (_40c5 != null) { + this.output1 = new OutputPort(); + this.output1.setWorkflow(_40c5); + this.output1.setName("output1"); + this.output1.setBackgroundColor(new Color(115, 115, 245)); + this.addPort(this.output1, this.width / 2, this.height); + + this.output2 = new OutputPort(); + this.output2.setWorkflow(_40c5); + this.output2.setName("output2"); + this.output2.setBackgroundColor(new Color(115, 115, 245)); + this.addPort(this.output2, this.width, this.height / 2); + + this.input1 = new InputPort(); + this.input1.setWorkflow(_40c5); + this.input1.setName("input1"); + this.input1.setBackgroundColor(new Color(245, 115, 115)); + this.addPort(this.input1, 0, this.height / 2); + + this.input2 = new InputPort(); + this.input2.setWorkflow(_40c5); + this.input2.setName("input2"); + this.input2.setBackgroundColor(new Color(245, 115, 115)); + this.addPort(this.input2, this.width / 2, 0); + } +}; + +InputPort.prototype.onDrop=function(port){ +if(port.getMaxFanOut&&port.getMaxFanOut()<=port.getFanOut()){ +return; +} +if(this.parentNode.id==port.parentNode.id){ +}else{ +var _3f02=new CommandConnect(this.parentNode.workflow,port,this); +if(_3f02.source.type == _3f02.target.type){ + return; +} +_3f02.setConnection(new DecoratedConnection()); +this.parentNode.workflow.getCommandStack().execute(_3f02); +} +}; + +OutputPort.prototype.onDrop=function(port){ +if(this.getMaxFanOut()<=this.getFanOut()){ +return; +} +if(this.parentNode.id==port.parentNode.id){ +}else{ +var _4070=new CommandConnect(this.parentNode.workflow,this,port); +if(_4070.source.type == _4070.target.type){ + return; +} +_4070.setConnection(new DecoratedConnection()); +this.parentNode.workflow.getCommandStack().execute(_4070); +} +}; + +////// Decorators to add an arrow to the flow line. To show the direction of flow ////////////// + + DecoratedConnection=function(){ + Connection.call(this); + this.setTargetDecorator(new ArrowConnectionDecorator()); + this.setRouter(new ManhattanConnectionRouter()); + }; + DecoratedConnection.prototype=new Connection(); + DecoratedConnection.prototype.type="DecoratedConnection"; + +////////--------------------------------------------------------------------------------------------/////// + +FlowMenu = function (_39f9) { + this.actionAdd = new ButtonAdd(this); + this.actionTask = new ButtonTask(this); + this.actionInterEvent = new ButtonInterEvent(this); + this.actionEndEvent = new ButtonEndEvent(this); + this.actionGateway = new ButtonGateway(this); + this.actionFront = new ButtonMoveFront(this); + this.actionBack = new ButtonMoveBack(this); + this.actionDelete = new ButtonDelete(this); + this.actionAnnotation = new ButtonAnnotation(this); + ToolPalette.call(this); + this.setDimension(20, 80); + this.setBackgroundColor(new Color(220, 255, 255)); + this.currentFigure = null; + this.myworkflow = _39f9; + this.added = false; + this.setDeleteable(false); + this.setCanDrag(false); + this.setResizeable(false); + this.setSelectable(false); + this.setBackgroundColor(null); + this.setColor(null); + this.scrollarea.style.borderBottom = "0px"; + this.actionAdd.setPosition(0, 0); + this.actionInterEvent.setPosition(20, 0); + this.actionGateway.setPosition(20, 20); + this.actionFront.setPosition(0, 18); + this.actionBack.setPosition(0, 36); + this.actionDelete.setPosition(0, 54); + this.addChild(this.actionFront); + this.addChild(this.actionBack); + this.addChild(this.actionDelete); +}; + +ToolPalette.prototype.removechild = function (_4079) { + if (_4079 != null) { + var parentNode = this.html; + if (parentNode != null) { + var len = parentNode.children[0].children.length; + for (var i = 0; i < len; i++) { + var childNode = parentNode.children[0].children[i]; + if (childNode == _4079.html) { + parentNode.children[0].removeChild(childNode); + } + } + } + } +}; +FlowMenu.prototype = new ToolPalette; +FlowMenu.prototype.setAlpha = function (_39fa) { + Figure.prototype.setAlpha.call(this, _39fa); +}; +FlowMenu.prototype.hasTitleBar = function () { + return false; +}; +FlowMenu.prototype.setFigure = function (_3087) { + +} +FlowMenu.prototype.onSelectionChanged = function (_39fb) { + if (_39fb == this.currentFigure) { + return; + } + if (this.added == true) { + this.myworkflow.removeFigure(this); + this.added = false; + } + if (_39fb != null && this.added == false) { + if (this.myworkflow.getEnableSmoothFigureHandling() == true) { + this.setAlpha(0.01); + } + this.myworkflow.addFigure(this, 100, 100); + this.added = true; + } + if (this.currentFigure != null) { + this.currentFigure.detachMoveListener(this); + } + this.currentFigure = _39fb; + if (this.currentFigure != null) { + this.currentFigure.attachMoveListener(this); + this.onOtherFigureMoved(this.currentFigure); + } +}; +FlowMenu.prototype.setWorkflow = function (_39fc) { + Figure.prototype.setWorkflow.call(this, _39fc); +}; +FlowMenu.prototype.onOtherFigureMoved = function (_39fd) { + var pos = _39fd.getPosition(); + this.setPosition(pos.x + _39fd.getWidth() + 7, pos.y - 16); + if (_39fd.workflow != null) { + var bpmnShape = _39fd.workflow.currentSelection.type; + switch (bpmnShape) { + case 'bpmnTask': + this.addChild(this.actionAdd); + this.addChild(this.actionInterEvent); + this.addChild(this.actionEndEvent); + this.addChild(this.actionGateway); + this.addChild(this.actionAnnotation); + this.actionAnnotation.setPosition(20,60); + this.actionEndEvent.setPosition(20,40) + this.removechild(this.actionTask); + break; + case 'bpmnEventEmptyEnd': + case 'bpmnEventMessageEnd': + case 'bpmnEventErrorEnd': + case 'bpmnEventCancelEnd': + case 'bpmnEventCompEnd': + case 'bpmnEventMultipleEnd': + case 'bpmnEventEndSignal': + case 'bpmnEventTerminate': + this.addChild(this.actionAnnotation); + this.actionAnnotation.setPosition(0,0); + this.removechild(this.actionInterEvent); + this.removechild(this.actionEndEvent); + this.removechild(this.actionTask); + this.removechild(this.actionGateway); + this.removechild(this.actionAdd); + break; + case 'bpmnEventEmptyStart': + case 'bpmnEventMessageStart': + case 'bpmnEventTimerStart': + case 'bpmnEventRuleStart': + case 'bpmnEventSignalStart': + case 'bpmnEventMulStart': + this.addChild(this.actionAdd); + this.addChild(this.actionAnnotation); + this.actionAnnotation.setPosition(20,40); + this.addChild(this.actionInterEvent); + this.actionInterEvent.setPosition(20,20) + this.addChild(this.actionGateway); + this.actionGateway.setPosition(20,0) + break; + case 'bpmnEventEmptyInter': + case 'bpmnEventMessageSendInter': + case 'bpmnEventMessageRecInter': + case 'bpmnEventTimerInter': + case 'bpmnEventCompInter': + case 'bpmnEventRuleInter': + case 'bpmnEventLinkInter': + case 'bpmnEventInterSignal': + case 'bpmnEventMultipleInter': + this.addChild(this.actionAdd); + this.addChild(this.actionAnnotation); + this.actionAnnotation.setPosition(20,60); + this.addChild(this.actionInterEvent); + this.actionInterEvent.setPosition(20,20) + this.addChild(this.actionGateway); + this.actionGateway.setPosition(20,0); + this.addChild(this.actionEndEvent); + this.actionEndEvent.setPosition(20,40); + break; + case 'bpmnGatewayInclusive': + case 'bpmnGatewayExclusiveData': + case 'bpmnGatewayExclusiveEvent': + case 'bpmnGatewayComplex': + case 'bpmnGatewayParallel': + this.addChild(this.actionAdd); + this.addChild(this.actionAnnotation); + this.actionAnnotation.setPosition(20,60); + this.addChild(this.actionInterEvent); + this.actionInterEvent.setPosition(20,20) + this.addChild(this.actionGateway); + this.actionGateway.setPosition(20,0); + this.addChild(this.actionEndEvent); + this.actionEndEvent.setPosition(20,40); + break; + default: + this.addChild(this.actionAdd); + this.removechild(this.actionTask); + this.removechild(this.actionInterEvent); + this.removechild(this.actionGateway); + break; + } + } +}; + +bpmnTask.prototype.addShapes = function (_3896) { + var x = _3896.workflow.currentSelection.getX(); //Get x co-ordinate from figure + var y = _3896.workflow.currentSelection.getY(); //Get y co-ordinate from figure + var xOffset = parseFloat(x + _3896.workflow.currentSelection.width); //Get x-offset co-ordinate from figure + var yOffset = parseFloat(y + _3896.workflow.currentSelection.height); //Get y-offset co-ordinate from figure + var count; + var shape = _3896.workflow.currentSelection.type; + +/* Incrementing Task No and assigning it to a local variable + * taskNo Globally Declared in processmap.js + * taskNo will have Last Task count + * */ + if (_3896.newShapeName == 'bpmnTask') count = ++_3896.workflow.taskNo; + + NewShape = eval("new " + _3896.newShapeName + "(_3896.workflow)"); + _3896.workflow.addFigure(NewShape, xOffset, yOffset); + var conn = new DecoratedConnection(); + if(NewShape.getPort("input1") != null){ + conn.setTarget(NewShape.getPort("input1")); + conn.setSource(_3896.workflow.currentSelection.getPort("output1")); + _3896.workflow.addFigure(conn); + } + else + { + conn.setTarget(NewShape.getPort("output1")); + conn.setSource(_3896.workflow.currentSelection.getPort("input1")); + _3896.workflow.addFigure(conn); + } +} + +ButtonInterEvent = function (_30a8) { + Button.call(this, _30a8, 16, 16); +}; +ButtonInterEvent.prototype = new Button; +ButtonInterEvent.prototype.type = "/skins/ext/images/gray/shapes/interevent"; +ButtonInterEvent.prototype.execute = function () { + var count = 0; + this.palette.newShapeName = 'bpmnEventEmptyInter'; + bpmnTask.prototype.addShapes(this.palette); +}; + +ButtonEndEvent = function (_30a8) { + Button.call(this, _30a8, 16, 16); +}; +ButtonEndEvent.prototype = new Button; +ButtonEndEvent.prototype.type = "/skins/ext/images/gray/shapes/endevent"; +ButtonEndEvent.prototype.execute = function () { + var count = 0; + this.palette.newShapeName = 'bpmnEventEmptyEnd'; + bpmnTask.prototype.addShapes(this.palette); +}; + + +ButtonGateway = function (_30a8) { + Button.call(this, _30a8, 16, 16); +}; +ButtonGateway.prototype = new Button; +ButtonGateway.prototype.type = "/skins/ext/images/gray/shapes/gateway-small"; +ButtonGateway.prototype.execute = function () { + this.palette.newShapeName = 'bpmnGatewayExclusiveData'; + bpmnTask.prototype.addShapes(this.palette); +}; + +ButtonAnnotation = function (_30a8) { + Button.call(this, _30a8, 16, 16); +}; +ButtonAnnotation.prototype = new Button; +ButtonAnnotation.prototype.type = "/skins/ext/images/gray/shapes/annotation"; +ButtonAnnotation.prototype.execute = function () { + var count = 0; + this.palette.newShapeName = 'bpmnAnnotation'; + bpmnTask.prototype.addShapes(this.palette); +}; + +ButtonTask = function (_30a8) { + Button.call(this, _30a8, 16, 16); +}; +ButtonTask.prototype = new Button; +ButtonTask.prototype.type = "/skins/ext/images/gray/shapes/Task"; +ButtonTask.prototype.execute = function () { + this.palette.newShapeName = 'bpmnTask'; + bpmnTask.prototype.addShapes(this.palette); +}; + + +ButtonAdd = function (_30a8) { + Button.call(this, _30a8, 16, 16); +}; +ButtonAdd.prototype = new Button; +ButtonAdd.prototype.type = "/skins/ext/images/gray/shapes/btn-add"; +ButtonAdd.prototype.execute = function () { + this.palette.newShapeName = 'bpmnTask'; + bpmnTask.prototype.addShapes(this.palette); +}; + +ButtonDelete = function (_30a9) { + Button.call(this, _30a9, 16, 16); +}; +ButtonDelete.prototype = new Button; +ButtonDelete.prototype.type = "/skins/ext/images/gray/shapes/btn-del"; +ButtonDelete.prototype.execute = function () { + var shape = this.palette.workflow.currentSelection.type; +/* Decrementing Task No and assigning it to a local variable + * taskNo Globally Declared in processmap.js + * taskNo will have Last Task count + * */ + if (shape == 'bpmnTask') { + --this.palette.workflow.taskNo; + } + this.palette.workflow.getCommandStack().execute(new CommandDelete(this.palette.workflow.getCurrentSelection())); + ToolGeneric.prototype.execute.call(this); +}; +ButtonMoveFront = function (_3e22) { + Button.call(this, _3e22, 16, 16); +}; +ButtonMoveFront.prototype = new Button; +ButtonMoveFront.prototype.type = "/skins/ext/images/gray/shapes/btn-movefrnt"; +ButtonMoveFront.prototype.execute = function () { + this.palette.workflow.moveFront(this.palette.workflow.getCurrentSelection()); + ToolGeneric.prototype.execute.call(this); +}; +ButtonMoveBack = function (_4091) { + Button.call(this, _4091, 16, 16); +}; +ButtonMoveBack.prototype = new Button; +ButtonMoveBack.prototype.type = "/skins/ext/images/gray/shapes/btn-movebk"; +ButtonMoveBack.prototype.execute = function () { + this.palette.workflow.moveBack(this.palette.workflow.getCurrentSelection()); + ToolGeneric.prototype.execute.call(this); +}; + +bpmnTaskDialog = function (_2e5e) { + this.figure = _2e5e; + var title = 'Task Detail'; + Dialog.call(this, title); + this.setDimension(400, 100); //Set the width and height of the Dialog box +} + +bpmnTaskDialog.prototype = new Dialog(); +bpmnTaskDialog.prototype.createHTMLElement = function () { + var item = Dialog.prototype.createHTMLElement.call(this); + var inputDiv = document.createElement("form"); + inputDiv.style.position = "absolute"; + inputDiv.style.left = "10px"; + inputDiv.style.top = "30px"; + inputDiv.style.width = "375px"; + inputDiv.style.font = "normal 10px verdana"; + item.appendChild(inputDiv); + this.label = document.createTextNode("Task Name"); + inputDiv.appendChild(this.label); + this.input = document.createElement("input"); + this.input.style.border = "1px solid gray"; + this.input.style.font = "normal 10px verdana"; + this.input.type = "text"; + var value = bpmnTaskDialog.prototype.trim(this.figure.html.textContent); + if (value) this.input.value = value; + else this.input.value = ""; + this.input.style.width = "100%"; + inputDiv.appendChild(this.input); + this.input.focus(); + return item; +}; + +/*Double Click Event for opening the dialog Box*/ +bpmnTask.prototype.onDoubleClick = function () { + var _409d = new bpmnTaskDialog(this); + this.workflow.showDialog(_409d, this.workflow.currentSelection.x, this.workflow.currentSelection.y); +}; + + +/** + * This method will be called if the user pressed the OK button in buttonbar of the dialog.
+ * The string is first cleared and new string is painted.

+ **/ +bpmnTaskDialog.prototype.onOk = function () { + this.figure.bpmnNewText.clear(); + tempcoord = this.workflow.currentSelection.coord_converter(this.workflow.currentSelection.width, this.workflow.currentSelection.height, this.input.value.length) + //this.figure.bpmnNewText.drawStringRect(this.input.value,this.workflow.currentSelection.width/2-30,this.workflow.currentSelection.height/2-10,200,'left'); + this.figure.bpmnNewText.drawTextString(this.input.value, this.workflow.currentSelection.width, this.workflow.currentSelection.height, tempcoord.temp_x, tempcoord.temp_y); + this.figure.bpmnNewText.paint(); + this.figure.taskName = this.input.value; //Set Updated Text value + //alert(this.input.value.length); + //this.workflow.currentSelection.width = this.input.value.length; + //VectorFigure.prototype.paint.call(this.figure); + this.workflow.removeFigure(this); +}; + +bpmnTask.prototype.getContextMenu = function () { + if (this.id != null) { + this.canvasTask = Ext.get(this.id); + this.contextTaskmenu = new Ext.menu.Menu({ + items: [{ + text: 'Steps', + scope: this + }, + { + text: 'Users & Users Group', + scope: this + }, + { + text: 'Users & Users Groups (ad-hoc)', + scope: this + }, + { + text: 'Routing Rule', + scope: this + }, + { + text: 'Deleting Routing Rule', + scope: this + }, + { + text: 'Delete Task', + scope: this + }, + { + text: 'Properties', + scope: this + }] + }); + } + + this.canvasTask.on('contextmenu', function (e) { + e.stopEvent(); + this.contextTaskmenu.showAt(e.getXY()); + }, this); + +}; \ No newline at end of file diff --git a/workflow/engine/templates/bpmn/bpmnZoom.js b/workflow/engine/templates/bpmn/bpmnZoom.js new file mode 100755 index 000000000..4e627974b --- /dev/null +++ b/workflow/engine/templates/bpmn/bpmnZoom.js @@ -0,0 +1,380 @@ +// -------------------------------------------------------------------- +// Javascript Magnifier v 0.97 +// Written by Dino Termini - termini@email.it - May 9, 2003 +// This script is freeware (GPL) but if you use it, please let me know! +// +// Portions of code by zoomIN, zoomOUT +// Author: Nguyen Duong Minh (Obie) - obie4web@yahoo.com +// WWW: http://ObieWebsite.SourceForge.net +// License: GNU (GPL) +// +// Portions of code by Webreference Javascript Cookie Functions +// Jupirmedia Corporation +// http://www.internet.com + + +bpmnZoom=function(){ +// Configuration parameters +// ------------------------ +// Measure unit in pixel (px) or points (pt) +// measureUnit = "pt" +measureUnit = "px" + +// Minimum size allowed for SIZE attribute (like in ) +minSize = 1; + +// Minimum size allowed for STYLE attribute (like in ) +minStyleSize = 10; + +// Maximum size allowed for SIZE attribute +maxSize = 6; + +// Maximum size allowed for STYLE attribute +maxStyleSize = 30; + +// Start size for tags with no SIZE attribute defined +startSize = 1; + +// Start size for tags with no font-size STYLE or CLASS attribute defined +startStyleSize = 10; + +// Increasing and decreasing step +stepSize = 1; + +// Increasing step for STYLE definition (measure previously declared will be used) +stepStyleSize = 2; + +// To set your own hotkeys, use key generator tool page included +// Keys to zooming in (with and without CAPS lock). Default: "+" +var keyin = 61; +var keyinCAPS = 43; + +// Keys to zooming out (with and without CAPS lock). Default: "-" +var keyout = 45; +var keyoutCAPS = 95; + +// Keys for "hard" zooming in (with and without CAPS lock). Default: ">" +var keyinIe = 46; +var keyinIeCAPS = 62; + +// Keys for "hard" zooming out (with and without CAPS lock). Default: "<" +var keyoutIe = 44; +var keyoutIeCAPS = 60; + +// "Hard" zoom factor +var zoomFactor = 1.1; + +// Max zoom allowed +var maxZoom = 4.096; + +// Min zoom allowed +var minZoom = 0.625; + +// Initial decrease zoom +var startDecZoom = 0.7; + +// Initial increase zoom +var startIncZoom = 1.3; + +// Cookie expiry (default one year, actually 365 days) +// 365 days in a year +// 24 hours in a day +// 60 minutes in an hour +// 60 seconds in a minute +// 1000 milliseconds in a second +userExpiry = 365 * 24 * 60 * 60 * 1000; + +// Enable or disable alert messages +alertEnabled = false; + +// Allow input fields resize (text, buttons, and so on) +allowInputResize = false; + +// End of configuration parameters. Please do not edit below this line +// -------------------------------------------------------------------------------- +} + +// Input values: +// name - name of the cookie +// value - value of the cookie +// [expires] - expiration date of the cookie (defaults to end of current session) +// [path] - path for which the cookie is valid (defaults to path of calling document) +// [domain] - domain for which the cookie is valid (defaults to domain of calling document) +// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission +// * an argument defaults when it is assigned null as a placeholder +// * a null placeholder is not required for trailing omitted arguments +bpmnZoom.prototype.setCookie = function(name, value, expires, path, domain, secure) { + // Check whether cookies enabled + document.cookie = "Enabled=true"; + var cookieValid = document.cookie; + + // if retrieving the VALUE we just set actually works + // then we know cookies enabled + if (cookieValid.indexOf("Enabled=true") != -1) { + var curCookie = name + "=" + escape(value) + + ((expires) ? "; expires=" + expires.toGMTString() : "") + + ((path) ? "; path=" + path : "") + + ((domain) ? "; domain=" + domain : "") + + ((secure) ? "; secure" : ""); + + document.cookie = curCookie; + return(true); + } + else { + return(false); + } +} + +// Input value: +// name - name of the desired cookie +// * return string containing value of specified cookie or null if cookie does not exist +bpmnZoom.prototype.getCookie = function(name) { + var dc = document.cookie; + var prefix = name + "="; + var begin = dc.indexOf("; " + prefix); + if (begin == -1) { + begin = dc.indexOf(prefix); + if (begin != 0) return null; + } else + begin += 2; + var end = document.cookie.indexOf(";", begin); + if (end == -1) + end = dc.length; + return unescape(dc.substring(begin + prefix.length, end)); +} + +// Input values: +// name - name of the cookie +// [path] - path of the cookie (must be same as path used to create cookie) +// [domain] - domain of the cookie (must be same as domain used to create cookie) +// * path and domain default if assigned null or omitted if no explicit argument proceeds +bpmnZoom.prototype.deleteCookie = function(name, path, domain) { + if (this.getCookie(name)) { + document.cookie = name + "=" + + ((path) ? "; path=" + path : "") + + ((domain) ? "; domain=" + domain : "") + + "; expires=Thu, 01-Jan-70 00:00:01 GMT"; + } +} + +// Input value: +// date - any instance of the Date object +// * hand all instances of the Date object to this function for "repairs" +bpmnZoom.prototype.fixDate = function(date) { + var base = new Date(0); + var skew = base.getTime(); + if (skew > 0) + date.setTime(date.getTime() - skew); +} + +bpmnZoom.prototype.searchTags = function(childTree, level) { + var retArray = new Array(); + var tmpArray = new Array(); + var j = 0; + var childName = ""; + for (var i=0; i maxSize)) + size = startSize; + + if (isNaN(styleSize) || (styleSize < minStyleSize) || (styleSize > maxStyleSize)) + styleSize = startStyleSize; + + if ( ((size > minSize) && (size < maxSize)) || + ((size == minSize) && (stepSize > 0)) || + ((size == maxSize) && (stepSize < 0)) || useCookie) { + myObj[i].setAttribute("size", size+myStepSize); + } + + if ( ((styleSize > minStyleSize) && (styleSize < maxStyleSize)) || + ((styleSize == minStyleSize) && (stepStyleSize > 0)) || + ((styleSize == maxStyleSize) && (stepStyleSize < 0)) || useCookie) { + newStyleSize = styleSize+myStepStyleSize; + myObj[i].style.fontSize = newStyleSize+measureUnit; + } + } // End if condition ("only some tags") + } // End main for cycle + + // Set the cookies + if (!useCookie) { + cookieIsSet = this.setCookie("incrSize", myStepSize+myCookieSize, now); + cookieIsSet = this.setCookie("incrStyleSize", myStepStyleSize+myCookieStyleSize, now); + if (alertEnabled && !cookieIsSet) { + alert("Per mantenere in memoria la dimensione scelta, abilita i cookie nel browser"); + } + } + + } // End if condition ("document.body exists") +} // End function declaration + +bpmnZoom.prototype.increaseFontSize = function() { + if (document.body) { + this.changeFontSize(stepSize, stepStyleSize, false); + } + else { + if (alertEnabled) { + alert("Spiacente, il tuo browser non supporta questa funzione"); + } + } +} + +bpmnZoom.prototype.decreaseFontSize = function() { + if (document.body) { + myStepSize = -stepSize; + myStepStyleSize = -stepStyleSize; + this.changeFontSize(myStepSize, myStepStyleSize, false); + } + else { + if (alertEnabled) { + alert("Spiacente, il tuo browser non supporta questa funzione"); + } + } +} + +bpmnZoom.prototype.zoomin = function() { + if (window.parent.document.body.style.zoom < maxZoom) { + if (window.parent.document.body.style.zoom > 0) { + window.parent.document.body.style.zoom *= zoomFactor; + } + else { + window.parent.document.body.style.zoom = startIncZoom; + } + } + else { + if (alertEnabled) { + alert("Warning: Max size reached"); + } + } +} + +bpmnZoom.prototype.zoomout = function() { + if ( (window.parent.document.body.style.zoom > minZoom) || + (window.parent.document.body.style.zoom == 0) ) { + if (window.parent.document.body.style.zoom > 0) { + window.parent.document.body.style.zoom /= zoomFactor; + } + else { + window.parent.document.body.style.zoom = startDecZoom; + } + } + else { + if (alertEnabled) { + alert("Warning: Min size reached"); + } + } +} + +bpmnZoom.prototype.checkzoom = function(e) { + + if (document.all) { + myEvent = event.keyCode; + } + else { + myEvent = e.which; + } + + switch(myEvent) { + case keyinIe: + case keyinIeCAPS: + this.zoomin(); + break; + + case keyoutIe: + case keyoutIeCAPS: + this.zoomout(); + break; + + case keyin: + case keyinCAPS: + this.increaseFontSize(); + break; + + case keyout: + case keyoutCAPS: + this.decreaseFontSize(); + break; + + default: + break; + } +} + +if (document.layers) { + document.captureEvents(Event.KEYPRESS); +} + +document.onkeypress = this.checkzoom; + diff --git a/workflow/engine/templates/bpmn/pmosExt.js b/workflow/engine/templates/bpmn/pmosExt.js new file mode 100755 index 000000000..6ba23ce77 --- /dev/null +++ b/workflow/engine/templates/bpmn/pmosExt.js @@ -0,0 +1,1703 @@ +pmosExt=function(id){ +Workflow.call(this,id); +}; +pmosExt.prototype=new Workflow; +pmosExt.prototype.type="pmosExt"; + +pmosExt.prototype.addExtJsWindow = function(items,width,height,title) +{ + var window = new Ext.Window({ + title: title, + collapsible: false, + maximizable: false, + width: width, + height: height, + minWidth: 300, + minHeight: 200, + layout: 'fit', + plain: true, + bodyStyle: 'padding:5px;', + buttonAlign: 'center', + items: items, + buttons: [{ + text: 'Save', + handler: function(){ + // when this button clicked, sumbit this form + items.getForm().submit({ + //waitMsg: 'Saving...', // Wait Message + success: function () { // When saving data success + //Ext.MessageBox.alert (response.responseText); + // clear the form + //simpleForm.getForm().reset(); + }, + failure: function () { // when saving data failed + Ext.MessageBox.alert ('Message','Authentication Failed'); + } + }); +// var test = webForm.getForm().submit({url:'../cases/cases_SchedulerValidateUser.php', submitEmptyText: false}); + } + },{ + text: 'Cancel', + handler: function(){ + // when this button clicked, + window.close(); + } + }] + }); + window.show(); +} + +pmosExt.prototype.popWebEntry= function(_5678) +{ + var oTask = _5678.workflow.taskUid; + var oDyna = _5678.workflow.dynaList; + var webEntryDetails = _5678.workflow.webEntryList; + var webEntry = ''; + if(typeof webEntryDetails != 'undefined'){ //Web Entry Present + if(webEntryDetails.length > 0 && webEntryDetails[0].W_LINK != '') //Web Entry Present + webEntry = webEntryDetails[0].W_LINK; + } + var webForm = new Ext.FormPanel({ + labelWidth: 120, // label settings here cascade unless overridden + //url:'save-form.php', + frame:true, + title: '', + scope:_5678, + bodyStyle:'padding:5px 5px 0', + width: 500, + height: 400, + defaultType: 'textfield', + buttonAlign : 'center', + items: [ + { + xtype:'fieldset', + title: 'WebEntry Link', + collapsible: false, + autoHeight:true, + buttonAlign : 'center', + defaults: {width: 210}, + //defaultType: 'textfield', + items: [ + { + html: webEntry, + xtype: "panel", + width:400 + },{ + xtype: 'fieldset', + layout:'column', + border:false, + align:'center', + //width: 700, + items:[{ + columnWidth:.3, + layout: 'form', + border:false, + items: [{ + xtype: 'button', + id: 'edit', + text: 'Edit', + bodyStyle: 'padding-left:35px;', + // width:50, + handler: function(){ + var properties = _5678.workflow.webForm.items.items[1]; + var credential = _5678.workflow.webForm.items.items[2]; + properties.show(); + credential.show(); + _5678.workflow.webEntrywindow.buttons[0].enable(); + _5678.workflow.webEntrywindow.setHeight(450); + } + }] + },{ + columnWidth:.3, + layout: 'form', + border:false, + //bodyStyle: 'padding:35px;', + items: [{ + xtype: 'button', + id: 'cancel', + //width:50, + text: 'Cancel', + handler: function(){ + var properties = _5678.workflow.webForm.items.items[1]; + var credential = _5678.workflow.webForm.items.items[2]; + properties.hide(); + credential.hide(); + _5678.workflow.webEntrywindow.buttons[0].disable(); + _5678.workflow.webEntrywindow.setHeight(200); + } + }] + }] + } + /*{ + xtype: 'button', + id: 'edit', + text: 'Edit', + width:50, + handler: function(){ + var properties = _5678.workflow.webForm.items.items[1]; + var credential = _5678.workflow.webForm.items.items[2]; + properties.show(); + credential.show(); + _5678.workflow.webEntrywindow.buttons[0].enable(); + _5678.workflow.webEntrywindow.setHeight(450); + } + },{ + xtype: 'button', + id: 'cancel', + width:50, + text: 'Cancel', + handler: function(){ + var properties = _5678.workflow.webForm.items.items[1]; + var credential = _5678.workflow.webForm.items.items[2]; + properties.hide(); + credential.hide(); + _5678.workflow.webEntrywindow.buttons[0].disable(); + _5678.workflow.webEntrywindow.setHeight(200); + }*/ + // } + ] + }, + { + xtype:'fieldset', + title: 'Properties', + collapsible: false, + autoHeight:true, + defaults: {width: 210}, + defaultType: 'textfield', + items: [{ + width: 200, + xtype: 'combo', + mode: 'local', + forceSelection: true, + allowBlank:false, + triggerAction: 'all', + editable: false, + fieldLabel: 'Initial Task', + name: 'initTask', + hiddenName: 'initTask', + displayField: 'name', + valueField: 'value', + store: new Ext.data.JsonStore({ + fields : ['name', 'value'], + data :oTask + }) + },{ + width: 200, + xtype: 'combo', + mode: 'local', + forceSelection: true, + allowBlank:false, + triggerAction: 'all', + editable: false, + fieldLabel: 'Initial Dynaform', + name: 'initDyna', + hiddenName: 'initDyna', + displayField: 'name', + valueField: 'value', + store: new Ext.data.JsonStore({ + fields : ['name', 'value'], + data :oDyna + }) + },{ + width: 200, + xtype: 'combo', + mode: 'local', + forceSelection: true, + allowBlank:false, + triggerAction: 'all', + editable: false, + fieldLabel: 'Methods', + name: 'methods', + hiddenName: 'methods', + displayField: 'name', + valueField: 'value', + scope:_5678, + store: new Ext.data.JsonStore({ + fields : ['name', 'value'], + data : [ + {name : 'PHP Pages with Web Services', value: 'WS'}, + {name : 'Single HTML', value: 'SINGLE'}, + ] + }), + onSelect: function(record, index){ + var fields = this.scope.workflow.webForm.items.items; + + if(index == 1) + { //Select + fields[2].collapse(); + _5678.workflow.webEntrywindow.buttons[0].disable(); + _5678.workflow.webEntrywindow.buttons[1].enable(); + } + else + { + fields[2].expand(); + _5678.workflow.webEntrywindow.buttons[0].enable(); + _5678.workflow.webEntrywindow.buttons[1].disable(); + } + this.setValue(record.data[this.valueField || this.displayField]); + this.collapse(); + } + }, { + width: 200, + xtype: 'combo', + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + allowBlank:false, + fieldLabel: 'Input Document Access', + name: 'inputDocAccess', + hiddenName: 'inputDocAccess', + displayField: 'name', + valueField: 'value', + store: new Ext.data.JsonStore({ + fields : ['name', 'value'], + data : [ + {name : 'No Restriction', value: '1'}, + {name : 'Restricted to Process Permission', value: '2'}, + ] + }) + }] + },{ + xtype:'fieldset', + title: 'PHP & Web Service options', + collapsible: false, + autoHeight:true, + defaults: {width: 210}, + defaultType: 'textfield', + items: [{ + fieldLabel: 'Web Service User', + name: 'webserviceUser', + allowBlank:true + },{ + fieldLabel: 'Web Service Password', + name: 'webservicePassword', + allowBlank:true, + inputType:'password' + }] + }] + + }); + + webForm.render(document.body); + _5678.workflow.webForm = webForm; + var fields = webForm.items.items; + var oPmosExt = new pmosExt(); + //oPmosExt.addExtJsWindow(webForm,600,500,'Add New webentry'); + + var webEntrywindow = new Ext.Window({ + title: 'Start Message Event(Web Entry)', + collapsible: false, + maximizable: false, + width: 450, + height: 450, + minWidth: 300, + minHeight: 200, + layout: 'fit', + plain: true, + bodyStyle: 'padding:5px;', + buttonAlign: 'center', + items: webForm, + scope:_5678, + buttons: [{ + text: 'Test Configuration', + handler: function(){ + var propertiesfields = _5678.workflow.webForm.items.items[1].items.items; + var credentialFields = _5678.workflow.webForm.items.items[2].items.items; + var task_uid = propertiesfields[0].getValue(); + var dyna_uid = propertiesfields[1].getValue(); + var we_type = propertiesfields[2].getValue(); + var we_usr = propertiesfields[3].getValue(); + var tasName = 'test'; + var username = credentialFields[0].getValue(); + var password = credentialFields[1].getValue(); + var pro_uid = _5678.workflow.getUrlVars(); + var args = '?action=webEntry_validate&data={"PRO_UID":"'+pro_uid +'", "TASKS":"'+task_uid+'", "DYNAFORM":"'+dyna_uid+'", "WE_TYPE":"'+we_type+'", "WS_USER":"'+username+'", "WS_PASS":"'+password+'", "WS_ROUNDROBIN":"", "WE_USR":"'+we_usr+'", "TASKS_NAME":"'+tasName+'"}'; + Ext.Ajax.request({ + url: 'processes_Ajax.php'+ args, + success: function(response) { + if(response.responseText == "1") + this.workflow.webEntrywindow.buttons[1].enable(); + else + { + Ext.Msg.alert (response.responseText); + this.workflow.webEntrywindow.buttons[1].disable(); + } + }, + failure: function(){ + Ext.Msg.alert ('Failure'); + } + }); + } + },{ + text: 'Generate Web Entry Page', + disabled:true, + handler: function(){ + var webEntryLink = _5678.workflow.webForm.items.items[0].items.items; + var propertiesfields = _5678.workflow.webForm.items.items[1].items.items; + var credentialFields = _5678.workflow.webForm.items.items[2].items.items; + var task_uid = propertiesfields[0].getValue(); + var dyna_uid = propertiesfields[1].getValue(); + var we_type = propertiesfields[2].getValue(); + var we_usr = propertiesfields[3].getValue(); + var tasName = 'test'; + var username = credentialFields[0].getValue(); + var password = credentialFields[1].getValue(); + var pro_uid = _5678.workflow.getUrlVars(); + var args = '?action=webEntry_generate&data={"PRO_UID":"'+pro_uid +'", "TASKS":"'+task_uid+'", "DYNAFORM":"'+dyna_uid+'", "WE_TYPE":"'+we_type+'", "WS_USER":"'+username+'", "WS_PASS":"'+password+'", "WS_ROUNDROBIN":"", "WE_USR":"'+we_usr+'"}'; + Ext.Ajax.request({ + url: 'processes_Ajax.php'+ args, + success: function(response) { + webEntryLink[0].initialConfig.html = response.responseText; + // webEntryLink[0].setValue(response.responseText); + _5678.workflow.webForm.items.items[0].show(); + _5678.workflow.webForm.items.items[1].hide(); + _5678.workflow.webForm.items.items[2].hide(); + this.workflow.webEntrywindow.buttons[1].disable(); + Ext.Msg.alert(response.responseText); + }, + failure: function(){ + Ext.Msg.alert ('Failure'); + } + }); + } + }] + }); + _5678.workflow.webEntrywindow = webEntrywindow; + webEntrywindow.show(); + var webEntryDetails = _5678.workflow.webEntryList; + var webEntryLink = _5678.workflow.webForm.items.items[0]; + var propertiesfields = _5678.workflow.webForm.items.items[1]; + var credentialFields = _5678.workflow.webForm.items.items[2]; + if(typeof webEntryDetails != 'undefined') + if(webEntryDetails.length > 0 && webEntryDetails[0].W_LINK != ''){ //Web Entry Present + // webEntryLink.items.items[0].setValue(webEntryDetails[0].W_LINK); + _5678.workflow.webEntrywindow.setHeight(200); + webEntryLink.show(); + propertiesfields.hide(); + credentialFields.hide(); + } + else + { + propertiesfields.show(); + credentialFields.show(); + webEntryLink.hide(); + } +} + +pmosExt.prototype.popCaseSchedular= function(_5678){ + Ext.QuickTips.init(); + var oPmosExt = new pmosExt(); + //Get the Task Data + var oTask = _5678.workflow.taskUid; + if(typeof oTask != 'undefined') + { + taskName = oTask[0].name; + task_uid = oTask[0].value; + } + var caseSchedularForm = new Ext.FormPanel({ + labelWidth: 120, // label settings here cascade unless overridden + url:'cases_Scheduler_Save.php', + frame:true, + title: 'General Information', + bodyStyle:'padding:5px 5px 0', + width: 500, + height: 400, + buttonAlign : 'center', + defaultType: 'textfield', + items: [{ + xtype:'fieldset', + title: 'Please insert a valid processmaker user name and password, in order to assign the case
to their respective owner', + collapsible: false, + autoHeight:true, + buttonAlign : 'center', + defaults: {width: 210}, + defaultType: 'textfield', + items: [ + { + fieldLabel: 'Username', + name: 'SCH_DEL_USER_NAME', + allowBlank:false, + blankText:'Enter username' + },{ + fieldLabel: 'Password', + inputType:'password', + name: 'SCH_USER_PASSWORD', + allowBlank:false, + blankText:'Enter Password' + },{ + xtype: 'button', + id: 'testUser', + width:75, + text: 'Test User', + arrowAlign: 'center', + scope:_5678, + align:'center', + margins:'5 5 5 5', + handler: function(){ + var credentialFieldset = _5678.workflow.caseSchedularForm.items.items[0]; + var propertiesFieldset = _5678.workflow.caseSchedularForm.items.items[1]; + var timeFieldset = _5678.workflow.caseSchedularForm.items.items[2]; + var username = credentialFieldset.items.items[0].getValue(); + var password = credentialFieldset.items.items[1].getValue(); + if(username == '' || password == ''){ + Ext.Msg.alert('Please enter valid credentials'); + } + else + { + Ext.Ajax.request({ + url: '../cases/cases_SchedulerValidateUser.php?USERNAME=' + username+'&PASSWORD='+password, + success: function(response) { + var result = Ext.util.JSON.decode(response.responseText); + if(result.status == 0) + { + credentialFieldset.items.items[4].setValue(response.responseText); + propertiesFieldset.show(); + timeFieldset.show(); + timeFieldset.collapse(); + credentialFieldset.items.items[2].hide(); //Hide Test User + credentialFieldset.items.items[3].show(); //Show Edit User + } + Ext.Msg.alert(result.message); + }, + failure: function(){ + Ext.Msg.alert ('Failure'); + } + }); + } + } + },{ + xtype: 'button', + id: 'editUser', + width:75, + text: 'Edit User', + arrowAlign: 'center', + scope:_5678, + align:'center', + hidden:true, + margins:'5 5 5 5', + handler: function(){ + var credentialFieldset = _5678.workflow.caseSchedularForm.items.items[0]; + var propertiesFieldset = _5678.workflow.caseSchedularForm.items.items[1]; + var timeFieldset = _5678.workflow.caseSchedularForm.items.items[2]; + propertiesFieldset.hide(); + timeFieldset.hide(); + credentialFieldset.items.items[3].hide(); //Hide Edit User + credentialFieldset.items.items[2].show(); //Show Test User + } + },{ + fieldLabel: 'Usr_uid', + name: 'SCH_DEL_USER_UID', + hidden:true + },{ + fieldLabel: 'pro_uid', + name: 'PRO_UID', + hidden:true + },{ + fieldLabel: 'SCH_DAYS_PERFORM_TASK', + name: 'SCH_DAYS_PERFORM_TASK', + hidden:true, + value:1 + },{ + fieldLabel: 'TAS_UID', + name: 'TAS_UID', + hidden:true, + value:1 + },{ + fieldLabel: 'SCH_WEEK_DAYS', + name: 'SCH_WEEK_DAYS', + hidden:true + },{ + fieldLabel: 'SCH_MONTHS', + name: 'SCH_MONTHS', + hidden:true + },{ + fieldLabel: 'EVN_UID', + name: 'EVN_UID', + hidden:true + },{ + fieldLabel: 'SCH_UID', + name: 'SCH_UID', + hidden:true + }] + },{ + xtype:'fieldset', + title: 'Properties', + collapsible: false, + autoHeight:true, + buttonAlign : 'center', + defaults: {width: 210}, + defaultType: 'textfield', + items: [ + { + fieldLabel: 'TASK', + name: 'TAS_NAME', + value: taskName, + readOnly:true, + allowBlank:false + } + /*{ + width: 160, + xtype: 'combo', + mode: 'local', + forceSelection: true, + triggerAction: 'all', + editable: false, + allowBlank:false, + fieldLabel: 'Task', + name: 'TAS_UID', + hiddenName: 'task', + displayField: 'name', + valueField: 'value', + store: new Ext.data.JsonStore({ + fields : ['name', 'value'], + data :oTask + }) + }*/,{ + fieldLabel: 'Description', + allowBlank:false, + name: 'SCH_NAME' + //allowBlank:false + },{ + width: 120, + xtype: 'combo', + mode: 'local', + triggerAction: 'all', + forceSelection: true, + allowBlank:false, + value: '--select--', + editable: false, + fieldLabel: 'Perform this Task', + name: 'SCH_OPTION', + displayField: 'name', + valueField: 'value', + scope:_5678, + store: new Ext.data.JsonStore({ + fields : ['name', 'value'], + data :[ + {name : '--select--', value: '0',selected: true}, + {name : 'Daily', value: '1'}, + {name : 'Weekly', value: '2'}, + {name : 'Monthly', value: '3'}, + {name : 'One time only', value: '4'} + ] + }), + onSelect: function(record, index){ + oPmosExt.hideSchOptions(caseSchedularForm,index); + this.setValue(record.data[this.valueField || this.displayField]); + this.collapse(); + } + } + ]},{ + xtype:'fieldset', + title: 'Select the time and day you want this task to start.', + collapsible: false, + autoHeight:true, + buttonAlign : 'center', + defaults: {width: 210}, + defaultType: 'textfield', + items: [ + { + xtype: 'datefield', + name:'SCH_START_DATE', + format: 'Y-m-d', + fieldLabel: 'Start Date' + },{ + xtype: 'datefield', + name:'SCH_END_DATE', + format: 'Y-m-d', + fieldLabel: 'End Date' + },{ + fieldLabel: 'Execution Time', + name: 'SCH_START_TIME' + //allowBlank:false + },{ + xtype: 'checkboxgroup', + fieldLabel: 'Select the day(s) of the week below', + name:'SCH_WEEK_DAY', + hidden: true, + // Put all controls in a single column with width 100% + columns: 2, + items: [ + {boxLabel: 'Monday', name: '1', checked: true}, + {boxLabel: 'Tuesday', name: '2'}, + {boxLabel: 'Wednesday', name: '3'}, + {boxLabel: 'Thursday', name: '4'}, + {boxLabel: 'Friday', name: '5'}, + {boxLabel: 'Saturday', name: '6'}, + {boxLabel: 'Sunday', name: '7'} + ] + },{ + width: 100, + labelWidth: 0, + xtype: 'combo', + mode: 'local', + triggerAction: 'all', + forceSelection: true, + hidden: true, + editable: false, + scope:_5678, + name: 'SCH_START_DAY', + displayField: 'name', + valueField: 'value', + store: new Ext.data.JsonStore({ + fields : ['name', 'value'], + data : [ + {name : 'Day of Month', value: '1'}, + {name : 'The Day', value: '2'}, + ] + }), + onSelect: function(record, index){ + var timefieldset = this.scope.workflow.caseSchedularForm.items.items[2]; + var fields = timefieldset.items.items; + var fieldsToToggle = new Array(); + if(index == 0){ //Select + fieldsToToggle = [fields[5],fields[6]]; + oPmosExt.toggleFields(fieldsToToggle,false); + + fieldsToToggle = [fields[7]]; + oPmosExt.toggleFields(fieldsToToggle,true); + } + else + { + fieldsToToggle = [fields[5],fields[6]]; + oPmosExt.toggleFields(fieldsToToggle,true); + + fieldsToToggle = [fields[7]]; + oPmosExt.toggleFields(fieldsToToggle,false); + } + this.setValue(record.data[this.valueField || this.displayField]); + this.collapse(); + } + },{ + width: 100, + labelWidth: 0, + xtype: 'combo', + mode: 'local', + triggerAction: 'all', + forceSelection: true, + hidden: true, + editable: false, + name: 'SCH_START_DAY_OPT_2_WEEKS', + displayField: 'name', + valueField: 'value', + store: new Ext.data.JsonStore({ + fields : ['name', 'value'], + data : [ + {name : 'First', value: '1'}, + {name : 'Second', value: '2'}, + {name : 'Third', value: '3'}, + {name : 'Fourth', value: '4'}, + {name : 'Last', value: '5'}, + ] + }) + },{ + width: 100, + labelWidth: 0, + xtype: 'combo', + mode: 'local', + triggerAction: 'all', + forceSelection: true, + hidden: true, + editable: false, + name: 'SCH_START_DAY_OPT_2_DAYS_WEEK', + displayField: 'name', + valueField: 'value', + store: new Ext.data.JsonStore({ + fields : ['name', 'value'], + data : [ + {name : 'Monday', value: '1'}, + {name : 'Tuesday', value: '2'}, + {name : 'Wednesday', value: '3'}, + {name : 'Thursday', value: '4'}, + {name : 'Friday', value: '5'}, + {name : 'Saturday', value: '6'}, + {name : 'Sunday', value: '7'}, + ] + }) + },{ + name: 'SCH_START_DAY_OPT_1', + hidden: true, + value:1 + },{ + xtype: 'checkboxgroup', + fieldLabel: 'of the month(s)', + name:'SCH_MONTH', + hidden:true, + // Put all controls in a single column with width 100% + columns: 3, + items: [ + {boxLabel : 'Jan', name: '1'}, + {boxLabel : 'Feb', name: '2'}, + {boxLabel : 'Mar', name: '3'}, + {boxLabel : 'Apr', name: '4'}, + {boxLabel : 'May', name: '5'}, + {boxLabel : 'Jun', name: '6'}, + {boxLabel : 'Jul', name: '7'}, + {boxLabel : 'Aug', name: '8'}, + {boxLabel : 'Sep', name: '9'}, + {boxLabel : 'Oct', name: '10'}, + {boxLabel : 'Nov', name: '11'}, + {boxLabel : 'Dec', name: '12'}, + ] + }]} + ] + + }); + caseSchedularForm.render(document.body); + + var credentialFieldset = caseSchedularForm.items.items[0]; + var propertiesFieldset = caseSchedularForm.items.items[1]; + var timeFieldset = caseSchedularForm.items.items[2]; + + var evn_uid = _5678.workflow.currentSelection.id; + //Loading Details into the form + caseSchedularForm.form.load({ + url:'proxyCaseSchLoad?eid='+evn_uid, + method:'GET', + waitMsg:'Loading', + success:function(form,action) { + propertiesFieldset.show(); + timeFieldset.show(); + timeFieldset.collapse(); + credentialFieldset.items.items[2].hide(); //Hide Test User + credentialFieldset.items.items[3].show(); //Show Edit User + + var index = propertiesFieldset.items.items[2].value; + timeFieldset.expand(); + var sch_month = credentialFieldset.items.items[9].getValue(); + var aSchMonth = new Array(); + var sSchMonth = ''; + aSchMonth = sch_month.substr(0,sch_month.length-1).split("|"); + for(var i=0;i
+
+
+
+
+
+
+
+
+
diff --git a/workflow/engine/templates/bpmn/processmap.js b/workflow/engine/templates/bpmn/processmap.js new file mode 100755 index 000000000..b2ab87c89 --- /dev/null +++ b/workflow/engine/templates/bpmn/processmap.js @@ -0,0 +1,804 @@ +Ext.onReady ( function() { + + workflow = new MyWorkflow("paintarea"); + workflow.setEnableSmoothFigureHandling(true); + workflow.scrollArea.width = 2000; + //For Undo and Redo Options + // workflow.getCommandStack().addCommandStackEventListener(new commandListener()); + //Getting process id from the URL using getUrlvars function + var pro_uid = getUrlVars(); + + if(typeof pro_uid != 'undefined') + { + Ext.Ajax.request({ + url: 'openProcess.php?PRO_UID=' + pro_uid, + success: function(response) { + var shapesData = createShapes(response.responseText,this); + createConnection(shapesData); + }, + failure: function(){ + Ext.Msg.alert ('Failure'); + } + }); + + //load all the Information related to the process +// var urlparams = '?action=load&data={"uid":"'+ pro_uid +'"}'; +// Ext.Ajax.request({ +// url: "processes_Ajax.php"+ urlparams, +// success: function(response) { +// this.workflow.processInfo = Ext.util.JSON.decode(response.responseText); +// }, +// failure: function(){ +// Ext.Msg.alert ('Failure'); +// } +// }); + + //Get All the processes + // var urlparams = '?action=getProcesses'; + // Ext.Ajax.request({ + // url: "processes_Ajax.php"+ urlparams, + // success: function(response) { + // this.workflow.processName = Ext.util.JSON.decode(response.responseText); + // }, + // failure: function(){ + // Ext.Msg.alert ('Failure'); + // } + // }); + } + + + /********************************************************************************** + * + * Do the Ext (Yahoo UI) Stuff + * + **********************************************************************************/ + + + + var west= { + xtype :"panel", + title: 'Palette', + region: 'west', + split: false, + width: 75, + collapsible: false, + margins:'3 0 3 3', + cmargins:'3 3 3 3', + items:{ + html:'

\n\ +

\n\ +

\n\ +

\n\ +

\n\ +

\n\ +

\n\ +

\n\ +

\n\ +

\n\ +

\n\ +
' + } + }; + + var north= { + xtype : "panel", + initialSize: 60, + split:false, + titlebar: false, + collapsible: false, + animate: false, + region : "north" + + }; + var south= { + xtype : "panel", + initialSize: 120, + height: 100, + split:true, + titlebar: false, + collapsible: true, + autoScroll:true, + animate: true, + region : "south", + items: { + region: 'center', + xtype: 'tabpanel', + items: [{ + title: 'Properties', + html: 'Properties' + }, + { + title: 'Debug Console', + html: 'Debug Console' + }] + } + }; + + var center= { + width:100, + height:200, + xtype : "panel", + titlebar: true, + title : 'BPMN Processmap', + autoScroll:true, + fitToFrame:true, + region : "center" + + }; + + var processObj = new ProcessOptions(); + + var main = new Ext.Panel({ + tbar: [ + { + text: 'Save', + cls: 'x-btn-text-icon', + handler: function() { + saveProcess(); + } + }, + { + text:'Save as' + }, + + { + text:'Undo', + handler: function() { + workflow.getCommandStack().undo(); + } + + }, + + { + text:'Redo', + handler: function() { + workflow.getCommandStack().redo(); + } + }, + + { + xtype: 'tbsplit', + text: 'Process', + menu: new Ext.menu.Menu({ + items: [{ + text : 'Dynaform', + handler : function() { + processObj.addDynaform(); + } + }, + {text: 'Input Document'},{text: 'Output Document'},{text: 'Trigger'},{text: 'Report Table'},{text: 'Database Connection'},{text: 'Cases Scheduler'}] + }) + + }, + { + text:'Zoom In', + handler: function() { + var figures = workflow.getDocument().getFigures(); + for(f = 0;f'center region' + var centerRegionId = main.items.items[2].body.id; + canvas = Ext.get(centerRegionId); + + //Context Menu of ProcessMap + ProcessMapObj = new ProcessMapContext(); + contextCanvasMenu = new Ext.menu.Menu({ + items: [{ + text: 'Edit Process', + handler: ProcessMapObj.editProcess, + icon: '/skins/ext/images/gray/shapes/more.gif', + scope: this + }, { + text: 'Export Process', + handler: ProcessMapObj.exportProcess, + scope: this + }, { + text: 'Add Task', + handler: ProcessMapObj.addTask, + scope: this + }, { + text: 'Add Subprocess', + handler: workflow.subProcess, + scope: this + },/* { + text: 'Horizontal Line', + handler: ProcessMapObj.horiLine, + scope: this + }, { + text: 'Vertical Line', + handler: ProcessMapObj.vertiLine, + scope: this + }, { + text: 'Delete All Lines', + handler: ProcessMapObj.delLines, + scope: this + }, */{ + text: 'Process Permission', + handler: ProcessMapObj.processPermission, + scope: this + },{ + text: 'Case Tracker', + handler: ProcessMapObj.caseTracker, + scope: this + }, { + text: 'Process File Manager', + menu: { // <-- submenu by nested config object + items: [ + // stick any markup in a menu + { + text: 'mailTemplates', + handler: ProcessMapObj.processFileManager + }, + { + text: 'public', + handler: ProcessMapObj.processFileManager + } + ] + } + }] + }); + + canvas.on('contextmenu', function(e) { + e.stopEvent(); + this.workflow.contextX = e.xy[0]; + this.workflow.contextY = e.xy[1]; + var pmosExtObj = new pmosExt(); + //Load all the process Data + pmosExtObj.loadEditProcess(this); + pmosExtObj.loadProcessCategory(this); + this.contextCanvasMenu.showAt(e.getXY()); + }, this); + + canvas.on('click', function(e) { + e.stopEvent(); + this.workflow.contextClicked = false; + if(this.workflow.currentSelection != null) + this.workflow.disablePorts(this.workflow.currentSelection); + //Removes Flow menu + this.workflow.setCurrentSelection(null); + }, this); + + var simpleToolbar = new Ext.Toolbar('toolbar'); + simpleToolbar.addButton({ + text: 'Save', + cls: 'x-btn-text-icon scroll-bottom' + }); + simpleToolbar.addButton({ + text: 'Save As', + cls: 'x-btn-text-icon scroll-bottom' + }); + simpleToolbar.addButton({ + text: 'Undo', + cls: 'x-btn-text-icon' + }); + simpleToolbar.addButton({ + text: 'Redo', + cls: 'x-btn-text-icon' + }); + + var menu = new FlowMenu(workflow); + workflow.addSelectionListener(menu); + workflow.scrollArea = document.getElementById(centerRegionId).parentNode; + + var dragsource=new Ext.dd.DragSource("x-shapes-task", { + ddGroup:'TreeDD', + dragData:{ + name: "bpmnTask" + } + }); + var dragsource=new Ext.dd.DragSource("x-shapes-startEvent", { + ddGroup:'TreeDD', + dragData:{ + name: "bpmnEventEmptyStart" + } + }); + var dragsource=new Ext.dd.DragSource("x-shapes-interEvent", { + ddGroup:'TreeDD', + dragData:{ + name: "bpmnEventEmptyInter" + } + }); + var dragsource=new Ext.dd.DragSource("x-shapes-endEvent", { + ddGroup:'TreeDD', + dragData:{ + name: "bpmnEventEmptyEnd" + } + }); + var dragsource=new Ext.dd.DragSource("x-shapes-gateways", { + ddGroup:'TreeDD', + dragData:{ + name: "bpmnGatewayExclusiveData" + } + }); + var dragsource=new Ext.dd.DragSource("x-shapes-dataobject", { + ddGroup:'TreeDD', + dragData:{ + name: "bpmnDataobject" + } + }); + var dragsource=new Ext.dd.DragSource("x-shapes-pool", { + ddGroup:'TreeDD', + dragData:{ + name: "bpmnPool" + } + }); + var dragsource=new Ext.dd.DragSource("x-shapes-annotation", { + ddGroup:'TreeDD', + dragData:{ + name: "bpmnAnnotation" + } + }); + + + var droptarget=new Ext.dd.DropTarget(centerRegionId,{ + ddGroup:'TreeDD' + }); + + //Creating Pool + var oPool = new bpmnPool(workflow); + //workflow.addFigure(oPool,100,70); + workflow.taskNo= 0; //Initializing Count for the bpmnTask + var count = 0; + this.taskName=''; + droptarget.notifyDrop=function(dd, e, data) + { + if(data.name) + { + var xOffset = workflow.getAbsoluteX(); + var yOffset = workflow.getAbsoluteY(); + if(data.name == 'bpmnTask') + { + count = ++workflow.taskNo; //Incrementing Task No and assigning it to a local variable + workflow.boundaryEvent = false; + workflow.taskName = 'Task '+count; + } + + + NewShape = eval("new "+data.name+"(workflow)"); + NewShape.x = e.xy[0]; + NewShape.y = e.xy[1]; + NewShape.actiontype = 'addTask'; + + if(data.name == 'bpmnAnnotation') + { + NewShape.actiontype = 'addText'; + workflow.saveShape(NewShape); //Saving task when user drags and drops it + } + if(data.name == 'bpmnTask') + { + NewShape.actiontype = 'addTask'; + workflow.saveShape(NewShape); //Saving Annotations when user drags and drops it + NewShape.taskName = workflow.taskName; + } + + + + + var scrollLeft = workflow.getScrollLeft(); + var scrollTop = workflow.getScrollTop(); + workflow.addFigure(NewShape,e.xy[0]-xOffset+scrollLeft,e.xy[1]-yOffset+scrollTop); + return true; + } + } + + + function createConnection(shapes) + { + //var totaltask = shapes[0].length; //shapes[0] is an array for all the tasks + //var totalgateways = shapes[1].length; //shapes[1] is an array for all the gateways + //var totalevents = shapes[2].length; //shapes[2] is an array for all the events + var totalroutes = shapes.routes.length; //shapes[3] is an array for all the routes + + for(var i=0;i<=totalroutes-1;i++) + { + var sourceid = shapes.routes[i][1]; //getting source id for connection from Routes array + var targetid = shapes.routes[i][2]; //getting target id for connection from Routes array + + //After creating all the shapes, check one by one shape id + for(var conn =0; conn < this.workflow.figures.data.length ; conn++) + { + if(typeof this.workflow.figures.data[conn] === 'object') + { + if(sourceid == this.workflow.figures.data[conn].id){ + sourceObj = this.workflow.figures.data[conn]; + } + } + } + + for(var conn =0; conn < this.workflow.figures.data.length ; conn++) + { + if(typeof this.workflow.figures.data[conn] === 'object') + { + if(targetid == '-1') + { + targetObj = eval("new bpmnEventEmptyEnd (this.workflow)"); + this.workflow.addFigure(targetObj,sourceObj.x+67,sourceObj.y+60); + break; + } + else if(targetid == this.workflow.figures.data[conn].id ){ + targetObj = this.workflow.figures.data[conn]; + } + } + } + + + //Making Connections + var connObj = new DecoratedConnection(); + connObj.setSource(sourceObj.output1); + connObj.setTarget(targetObj.input2); + connObj.id = shapes.routes[i][0]; + this.workflow.addFigure(connObj); + + } + } + + + + + function getUrlVars() + { + var vars = [], hash; + var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); + + for(var i = 0; i < hashes.length; i++) + { + hash = hashes[i].split('='); + vars.push(hash[0]); + vars[hash[0]] = hash[1]; + + } + var pro_uid = vars["PRO_UID"]; + return pro_uid; + } + + function createShapes(stringData,_4562) + { + + var responsearray = stringData.split("|"); + var jsonstring = new Array(); + var shapes = new Array(); + //var param = new Array(); + var shapeType = new Array(); + + for(var i=0; i<=responsearray.length-1;i++) + { + jsonstring[i] = responsearray[i].split(":"); + var param = jsonstring[i][0].replace(" ",""); + shapeType[i] = param; + switch(param) + { + case 'tasks': + shapes[param] = new Array(); + shapes[param] = Ext.util.JSON.decode(jsonstring[i][1]); + break; + case 'gateways': + shapes[param] = new Array(); + shapes[param] = Ext.util.JSON.decode(jsonstring[i][1]); + break; + case 'events': + shapes[param] = new Array(); + shapes[param] = Ext.util.JSON.decode(jsonstring[i][1]); + break; + case 'annotations': + shapes[param] = new Array(); + shapes[param] = Ext.util.JSON.decode(jsonstring[i][1]); + break; + case 'process': + shapes[param] = new Array(); + shapes[param] = Ext.util.JSON.decode(jsonstring[i][1]); + break; + case 'subprocess': + shapes[param] = new Array(); + shapes[param] = Ext.util.JSON.decode(jsonstring[i][1]); + break; + case 'routes': + shapes[param] = new Array(); + shapes[param] = Ext.util.JSON.decode(jsonstring[i][1]); + break; + } + } + + //Create all shapes + for(var j=0;j< shapeType.length;j++) + { + // _4562.workflow.taskNo=0; + + switch(shapeType[j]) + { + case 'tasks': + for(var k=0;k"+msg; + } + + function saveProcess() + { + // console.dir(this.workflow); + + var tasks = new Array(); + var events = new Array(); + var gateways = new Array(); + var annotations = new Array(); + var subprocess = new Array(); + var l=0; + var m=0; + var n=0; + var p=0; + var r=0; + + for(var c = 0; cText Annotation
Task
Looping Task
Flow Connector
Message Connection
Association
Pool
Sub-ProcessMap
Looping Sub-Process
Lane
Group
Data Object
', + html:'
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
', + cls:'empty' + }, + { + title: 'Events', + // html: ' Empty Start
Message Start
Rule Start
Timer Start
Signal start event
Multiple start event
Link start
Empty Intermediate
Message Intermediate
Timer Intermediate
Error Intermediate
Compensation Intermediate
Rule Intermediate
Cancel Intermediate
Intermediate signal event
Multiple Intermediate event
Link Intermediate event
Empty End
Message End
Error End
Compensation End
Terminate
End signal event
Multiple end event
Cancel end
Link end
', + html:'
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
', + cls:'empty' + }, + { + title: 'Gateway', + //html: 'Exclusive Data-Based
Exclusive Event-Based
Inclusive Data-Based
Parallel
Complex
', + html:'
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
', + cls:'empty' + }] + } + }; +var north= {xtype : "panel", + initialSize: 60, + split:false, + titlebar: false, + collapsible: false, + animate: false, + region : "north", + + }; +var south= {xtype : "panel", + initialSize: 120, + height: 100, + split:true, + titlebar: false, + collapsible: true, + autoScroll:true, + animate: true, + region : "south", + items: { + region: 'center', + xtype: 'tabpanel', + items: [{ + title: 'Properties', + html: 'Properties' + }, + { + title: 'Debug Console', + html: 'Debug Console' + }] + } + }; +var center= {width:100, + height:200, + xtype : "panel", + titlebar: true, + title : "center region" , + autoScroll:true, + fitToFrame:true, + region : "center" + + }; + + + var main = new Ext.Panel({ + tbar: [ + {text:'Save'}, + {text:'Save as'}, + {text:'Undo'}, + {text:'Redo'} + + ], + renderTo : "center1", + layout : "border", + height : 1000, + width :1000, + items : [west,north,south,center] + }); + +var canvas = Ext.get('ext-gen68'); + + contextCanvasMenu = new Ext.menu.Menu({ + items: [{ + text: 'Edit Process', + handler: workflow.editProcess, + scope: this + }, { + text: 'Export Process', + handler: workflow.exportProcess, + scope: this + }, { + text: 'Add Task', + handler: workflow.addTask, + scope: this + }, { + text: 'Add Subprocess', + handler: workflow.subProcess, + scope: this + }, { + text: 'Horizontal Line', + handler: workflow.horiLine, + scope: this + }, { + text: 'Vertical Line', + handler: workflow.vertiLine, + scope: this + }, { + text: 'Delete All Lines', + handler: workflow.delLines, + scope: this + }, { + text: 'Process Permission', + handler: workflow.processPermission, + scope: this + }, { + text: 'Web Entry', + handler: workflow.webEntry, + scope: this + }, { + text: 'Case Tracker', + handler: workflow.caseTracker, + scope: this + }, { + text: 'Process File Manager', + handler: workflow.processFileManager, + scope: this + }, { + text: 'Events', + handler: workflow.events, + scope: this + }] + }); + +canvas.on('contextmenu', function(e) { + e.stopEvent(); + this.contextCanvasMenu.showAt(e.getXY()); +}, this); + +var simpleToolbar = new Ext.Toolbar('toolbar'); + simpleToolbar.addButton({ text: 'Save', cls: 'x-btn-text-icon scroll-bottom'}); + simpleToolbar.addButton({ text: 'Save As', cls: 'x-btn-text-icon scroll-bottom'}); + simpleToolbar.addButton({ text: 'Undo', cls: 'x-btn-text-icon'}); + simpleToolbar.addButton({ text: 'Redo', cls: 'x-btn-text-icon'}); + + var menu = new FlowMenu(workflow); + workflow.addSelectionListener(menu); + workflow.scrollArea = document.getElementById("ext-gen68").parentNode; + + var dragsource=new Ext.dd.DragSource("x-shapes-text", {ddGroup:'TreeDD',dragData:{name: "bpmnAnnotation"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-task", {ddGroup:'TreeDD',dragData:{name: "bpmnTask"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-loop", {ddGroup:'TreeDD',dragData:{name: "bpmnLoopingTask"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-flow", {ddGroup:'TreeDD',dragData:{name: "bpmnFlowConnector"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-group", {ddGroup:'TreeDD',dragData:{name: "bpmnGroup"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-loopsub", {ddGroup:'TreeDD',dragData:{name: "bpmnLoopingSubProcess"}}); + + var dragsource=new Ext.dd.DragSource("x-shapes-event-empty", {ddGroup:'TreeDD',dragData:{name: "bpmnEventEmptyStart"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-msgstart", {ddGroup:'TreeDD',dragData:{name: "bpmnEventMessageStart"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-rule", {ddGroup:'TreeDD',dragData:{name: "bpmnEventRuleStart"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-timerstart", {ddGroup:'TreeDD',dragData:{name: "bpmnEventTimerStart"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-sigstart", {ddGroup:'TreeDD',dragData:{name: "bpmnEventSignalStart"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-mulstart", {ddGroup:'TreeDD',dragData:{name: "bpmnEventMulStart"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-linkstart", {ddGroup:'TreeDD',dragData:{name: "bpmnEventLinkStart"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-emptyinter", {ddGroup:'TreeDD',dragData:{name: "bpmnEventEmptyInter"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-msgconn", {ddGroup:'TreeDD',dragData:{name: "bpmnEventMessageInter"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-timerinter", {ddGroup:'TreeDD',dragData:{name: "bpmnEventTimerInter"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-errorinter", {ddGroup:'TreeDD',dragData:{name: "bpmnEventErrorInter"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-compinter", {ddGroup:'TreeDD',dragData:{name: "bpmnEventCompInter"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-ruleinter", {ddGroup:'TreeDD',dragData:{name: "bpmnEventRuleInter"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-caninter", {ddGroup:'TreeDD',dragData:{name: "bpmnEventCancelInter"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-intersig", {ddGroup:'TreeDD',dragData:{name: "bpmnEventInterSignal"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-mulinter", {ddGroup:'TreeDD',dragData:{name: "bpmnEventMultipleInter"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-linkinter", {ddGroup:'TreeDD',dragData:{name: "bpmnEventLinkInter"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-emptyend", {ddGroup:'TreeDD',dragData:{name: "bpmnEventEmptyEnd"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-messageend", {ddGroup:'TreeDD',dragData:{name: "bpmnEventMessageEnd"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-errorend", {ddGroup:'TreeDD',dragData:{name: "bpmnEventErrorEnd"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-compend", {ddGroup:'TreeDD',dragData:{name: "bpmnEventCompEnd"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-terminate", {ddGroup:'TreeDD',dragData:{name: "bpmnEventTerminate"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-endsignal", {ddGroup:'TreeDD',dragData:{name: "bpmnEventEndSignal"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-multipleend", {ddGroup:'TreeDD',dragData:{name: "bpmnEventMultipleEnd"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-cancelend", {ddGroup:'TreeDD',dragData:{name: "bpmnEventCancelEnd"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-event-linkend", {ddGroup:'TreeDD',dragData:{name: "bpmnEventLinkEnd"}}); + + var dragsource=new Ext.dd.DragSource("x-shapes-gateways-exc-data", {ddGroup:'TreeDD',dragData:{name: "bpmnExclusiveData"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-gateways-exc-event", {ddGroup:'TreeDD',dragData:{name: "bpmnExclusiveEvent"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-gateways-inc-data", {ddGroup:'TreeDD',dragData:{name: "bpmnInclusiveData"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-gateways-parallel", {ddGroup:'TreeDD',dragData:{name: "bpmnEventParallel"}}); + var dragsource=new Ext.dd.DragSource("x-shapes-gateways-complex", {ddGroup:'TreeDD',dragData:{name: "bpmnEventComplex"}}); + var droptarget=new Ext.dd.DropTarget("ext-gen68",{ddGroup:'TreeDD'}); + + workflow.taskNo= 0; //Initializing Count for the bpmnTask + var count = 0; + this.taskName=''; + droptarget.notifyDrop=function(dd, e, data) + { + if(data.name) + { + if(data.name == 'bpmnTask') + { + count = ++workflow.taskNo; //Incrementing Task No and assigning it to a local variable + } + var xOffset = workflow.getAbsoluteX(); + var yOffset = workflow.getAbsoluteY(); + var scrollLeft = workflow.getScrollLeft(); + var scrollTop = workflow.getScrollTop(); + workflow.addFigure(eval("new "+data.name+"("+count+")"),e.xy[0]-xOffset+scrollLeft,e.xy[1]-yOffset+scrollTop); + return true; + } + } + +}); + + +/* +End=function(){ +ImageFigure.call(this,this.type+".png"); +this.inputPort=null; +this.setDimension(50,50); +}; +End.prototype=new ImageFigure; +End.prototype.type="End"; +End.prototype.setWorkflow=function(_4087){ +ImageFigure.prototype.setWorkflow.call(this,_4087); +if(_4087!=null&&this.inputPort==null){ +this.inputPort=new MyInputPort(); +this.inputPort.setWorkflow(_4087); +this.inputPort.setBackgroundColor(new Color(115,115,245)); +this.inputPort.setColor(null); +this.addPort(this.inputPort,0,this.height/2); +this.inputPort2=new MyInputPort(); +this.inputPort2.setWorkflow(_4087); +this.inputPort2.setBackgroundColor(new Color(115,115,245)); +this.inputPort2.setColor(null); +this.addPort(this.inputPort2,this.width/2,0); +this.inputPort3=new MyInputPort(); +this.inputPort3.setWorkflow(_4087); +this.inputPort3.setBackgroundColor(new Color(115,115,245)); +this.inputPort3.setColor(null); +this.addPort(this.inputPort3,this.width,this.height/2); +this.inputPort4=new MyInputPort(); +this.inputPort4.setWorkflow(_4087); +this.inputPort4.setBackgroundColor(new Color(115,115,245)); +this.inputPort4.setColor(null); +this.addPort(this.inputPort4,this.width/2,this.height); +} +};*/ +/* +MyOutputPort=function(_32c8){ +OutputPort.call(this,_32c8); +}; +MyOutputPort.prototype=new OutputPort; +MyOutputPort.prototype.type="MyOutputPort"; +MyOutputPort.prototype.onDrop=function(port){ +if(this.getMaxFanOut()<=this.getFanOut()){ +return; +} +if(this.parentNode.id==port.parentNode.id){ +}else{ +var _32ca=new CommandConnect(this.parentNode.workflow,this,port); +_32ca.setConnection(new ContextmenuConnection()); +this.parentNode.workflow.getCommandStack().execute(_32ca); +} +}; + +MyInputPort=function(_3e4f){ +InputPort.call(this,_3e4f); +}; +MyInputPort.prototype=new InputPort; +MyInputPort.prototype.type="MyInputPort"; +MyInputPort.prototype.onDrop=function(port){ +if(port.getMaxFanOut&&port.getMaxFanOut()<=port.getFanOut()){ +return; +} +if(this.parentNode.id==port.parentNode.id){ +}else{ +var _3e51=new CommandConnect(this.parentNode.workflow,port,this); +_3e51.setConnection(new ContextmenuConnection()); +this.parentNode.workflow.getCommandStack().execute(_3e51); +} +}; +*/ +/* +ResizeImage=function(url){ +this.url=url; +Node.call(this); +this.outputPort1=null; +this.outputPort2=null; +this.setDimension(100,100); +this.setColor(null); +}; +ResizeImage.prototype=new Node; +ResizeImage.prototype.type="ResizeImage"; +ResizeImage.prototype.createHTMLElement=function(){ +var item=Node.prototype.createHTMLElement.call(this); +if(navigator.appName.toUpperCase()=="MICROSOFT INTERNET EXPLORER"){ +this.d=document.createElement("div"); +this.d.style.position="absolute"; +this.d.style.left="0px"; +this.d.style.top="0px"; +this.d.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader (src='"+this.url+"', sizingMethod='scale')"; +item.appendChild(this.d); +}else{ +this.img=document.createElement("img"); +this.img.style.position="absolute"; +this.img.style.left="0px"; +this.img.style.top="0px"; +this.img.src=this.url; +item.appendChild(this.img); +this.d=document.createElement("div"); +this.d.style.position="absolute"; +this.d.style.left="0px"; +this.d.style.top="0px"; +item.appendChild(this.d); +} +item.style.left=this.x+"px"; +item.style.top=this.y+"px"; +return item; +}; +ResizeImage.prototype.setDimension=function(w,h){ +Node.prototype.setDimension.call(this,w,h); +if(this.d!=null){ +this.d.style.width=this.width+"px"; +this.d.style.height=this.height+"px"; +} +if(this.img!=null){ +this.img.width=this.width; +this.img.height=this.height; +} +if(this.outputPort1!=null){ +this.outputPort1.setPosition(this.width+3,this.height/3); +this.outputPort2.setPosition(this.width+3,this.height/3*2); +} +}; +ResizeImage.prototype.setWorkflow=function(_309d){ +Node.prototype.setWorkflow.call(this,_309d); +if(_309d!=null){ +this.outputPort1=new OutputPort(); +this.outputPort1.setMaxFanOut(1); +this.outputPort1.setWorkflow(_309d); +this.outputPort1.setBackgroundColor(new Color(245,115,115)); +this.addPort(this.outputPort1,this.width+3,this.height/3); +this.outputPort2=new OutputPort(); +this.outputPort2.setMaxFanOut(1); +this.outputPort2.setWorkflow(_309d); +this.outputPort2.setBackgroundColor(new Color(245,115,115)); +this.addPort(this.outputPort2,this.width+3,this.height/3*2); +} +}; +*/ +ContextmenuConnection=function(){ +Connection.call(this); +this.sourcePort=null; +this.targetPort=null; +this.lineSegments=new Array(); +this.setColor(new Color(128,128,255)); +this.setLineWidth(1); +}; +ContextmenuConnection.prototype=new Connection(); +ContextmenuConnection.prototype.getContextMenu=function(){ +var menu=new Menu(); +var oThis=this; +menu.appendMenuItem(new MenuItem("NULL Router",null,function(){ +oThis.setRouter(null); +})); +menu.appendMenuItem(new MenuItem("Manhatten Router",null,function(){ +oThis.setRouter(new ManhattanConnectionRouter()); +})); +menu.appendMenuItem(new MenuItem("Bezier Router",null,function(){ +oThis.setRouter(new BezierConnectionRouter()); +})); +menu.appendMenuItem(new MenuItem("Fan Router",null,function(){ +oThis.setRouter(new FanConnectionRouter()); +})); +return menu; +}; + +function debug(msg) +{ + var console = document.getElementById("debug"); + console.innerHTML=console.innerHTML+"
"+msg; +} diff --git a/workflow/engine/templates/bpmn/processmap_2.js b/workflow/engine/templates/bpmn/processmap_2.js new file mode 100755 index 000000000..5de0f785d --- /dev/null +++ b/workflow/engine/templates/bpmn/processmap_2.js @@ -0,0 +1,304 @@ +Ext.onReady(function () { + + + + /********************************************************************************** + * + * Do the Ext (Yahoo UI) Stuff + * + **********************************************************************************/ + + + var west = { + xtype: "panel", + title: 'Palette', + region: 'west', + split: true, + width: 75, + collapsible: true, + margins: '3 0 3 3', + cmargins: '3 3 3 3', + items: { + html: '
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
  • \n\ +
  •  
' + } + }; + + var north = { + xtype: "panel", + initialSize: 60, + split: false, + titlebar: false, + collapsible: false, + animate: false, + region: "north" + + }; + var south = { + xtype: "panel", + initialSize: 120, + height: 100, + split: true, + titlebar: false, + collapsible: true, + autoScroll: true, + animate: true, + region: "south", + items: { + region: 'center', + xtype: 'tabpanel', + items: [{ + title: 'Properties', + html: 'Properties' + }, + { + title: 'Debug Console', + html: 'Debug Console' + }] + } + }; + var center = { + width: 100, + height: 200, + xtype: "panel", + titlebar: true, + title: "center region", + autoScroll: true, + fitToFrame: true, + region: "center" + + }; + + main = function () { + var layout; + return { + init: function () { + layout = new Ext.Panel({ + tbar: [{ + text: 'Save' + }, + { + text: 'Save as' + }, + { + text: 'Undo' + }, + { + text: 'Redo' + } + + ], + renderTo: "center1", + layout: "border", + height: 1000, + width: 1000, + scope: menu, + items: [west, north, south, center] + }); + + + workflow = new MyWorkflow("paintarea"); + workflow.setEnableSmoothFigureHandling(true); + workflow.scrollArea.width = 2000; + + var simpleToolbar = new Ext.Toolbar('toolbar'); + simpleToolbar.addButton({ + text: 'Save', + cls: 'x-btn-text-icon scroll-bottom' + }); + simpleToolbar.addButton({ + text: 'Save As', + cls: 'x-btn-text-icon scroll-bottom' + }); + simpleToolbar.addButton({ + text: 'Undo', + cls: 'x-btn-text-icon' + }); + simpleToolbar.addButton({ + text: 'Redo', + cls: 'x-btn-text-icon' + }); + + var dragsource = new Ext.dd.DragSource("x-shapes-task", { + ddGroup: 'TreeDD', + dragData: { + name: "bpmnTask" + } + }); + var dragsource = new Ext.dd.DragSource("x-shapes-startEvent", { + ddGroup: 'TreeDD', + dragData: { + name: "bpmnEventEmptyStart" + } + }); + var dragsource = new Ext.dd.DragSource("x-shapes-interEvent", { + ddGroup: 'TreeDD', + dragData: { + name: "bpmnEventEmptyInter" + } + }); + var dragsource = new Ext.dd.DragSource("x-shapes-endEvent", { + ddGroup: 'TreeDD', + dragData: { + name: "bpmnEventEndSignal" + } + }); + var dragsource = new Ext.dd.DragSource("x-shapes-gateways", { + ddGroup: 'TreeDD', + dragData: { + name: "bpmnGatewayExclusiveData" + } + }); + + var droptarget = new Ext.dd.DropTarget("ext-gen51", { + ddGroup: 'TreeDD' + }); + workflow.taskNo = 0; //Initializing Count for the bpmnTask + var count = 0; + this.taskName = ''; + droptarget.notifyDrop = function (dd, e, data) { + + + + if (data.name) { + if (data.name == 'bpmnTask') { + count = ++workflow.taskNo; //Incrementing Task No and assigning it to a local variable + } + var xOffset = workflow.getAbsoluteX(); + var yOffset = workflow.getAbsoluteY(); + var scrollLeft = workflow.getScrollLeft(); + var scrollTop = workflow.getScrollTop(); + workflow.addFigure(eval("new " + data.name + "(workflow)"), e.xy[0] - xOffset + scrollLeft, e.xy[1] - yOffset + scrollTop); + return true; + } + } + + } + } + }(); + + Ext.EventManager.onDocumentReady(main.init, main, true); + + var menu = new FlowMenu(workflow); + workflow.addSelectionListener(menu); + workflow.flow = menu; + + canvas = Ext.get('ext-gen51'); + + contextCanvasMenu = new Ext.menu.Menu({ + items: [{ + text: 'Edit Process', + handler: workflow.editProcess, + icon: '/skins/ext/images/gray/shapes/more.gif', + scope: this + }, + { + text: 'Export Process', + handler: workflow.exportProcess, + scope: this + }, + { + text: 'Add Task', + handler: workflow.addTask, + scope: this + }, + { + text: 'Add Subprocess', + handler: workflow.subProcess, + scope: this + }, + { + text: 'Horizontal Line', + handler: workflow.horiLine, + scope: this + }, + { + text: 'Vertical Line', + handler: workflow.vertiLine, + scope: this + }, + { + text: 'Delete All Lines', + handler: workflow.delLines, + scope: this + }, + { + text: 'Process Permission', + handler: workflow.processPermission, + scope: this + }, + { + text: 'Web Entry', + handler: workflow.webEntry, + scope: this + }, + { + text: 'Case Tracker', + handler: workflow.caseTracker, + scope: this + }, + { + text: 'Process File Manager', + handler: workflow.processFileManager, + scope: this + }, + { + text: 'Events', + handler: workflow.events, + scope: this + }] + }); + + canvas.on('contextmenu', function (e) { + e.stopEvent(); + this.contextCanvasMenu.showAt(e.getXY()); + }, this); + + canvas.on('click', function (e) { + e.stopEvent(); + if (this.workflow.flow != null) { +/*this.currentFigure = this.workflow.currentSelection; + this.workflow.flow.myworkflow.removeFigure(this.workflow.flow); + this.added=false; + // this.currentFigure.detachMoveListener(this.workflow.flow);*/ + } + + }, this); + +}); + + +ContextmenuConnection = function () { + Connection.call(this); + this.sourcePort = null; + this.targetPort = null; + this.lineSegments = new Array(); + this.setColor(new Color(128, 128, 255)); + this.setLineWidth(1); +}; +ContextmenuConnection.prototype = new Connection(); +ContextmenuConnection.prototype.getContextMenu = function () { + var menu = new Menu(); + var oThis = this; + menu.appendMenuItem(new MenuItem("NULL Router", null, function () { + oThis.setRouter(null); + })); + menu.appendMenuItem(new MenuItem("Manhatten Router", null, function () { + oThis.setRouter(new ManhattanConnectionRouter()); + })); + menu.appendMenuItem(new MenuItem("Bezier Router", null, function () { + oThis.setRouter(new BezierConnectionRouter()); + })); + menu.appendMenuItem(new MenuItem("Fan Router", null, function () { + oThis.setRouter(new FanConnectionRouter()); + })); + return menu; +}; + +function debug(msg) { + var console = document.getElementById("debug"); + console.innerHTML = console.innerHTML + "
" + msg; +} \ No newline at end of file diff --git a/workflow/engine/templates/bpmn/swfupload.js b/workflow/engine/templates/bpmn/swfupload.js new file mode 100755 index 000000000..d9f4a5acd --- /dev/null +++ b/workflow/engine/templates/bpmn/swfupload.js @@ -0,0 +1,982 @@ +/** + * SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com + * + * mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/, http://www.vinterwebb.se/ + * + * SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilzén and Mammon Media and is released under the MIT License: + * http://www.opensource.org/licenses/mit-license.php + * + * SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License: + * http://www.opensource.org/licenses/mit-license.php + * + */ + + +/* ******************* */ +/* Constructor & Init */ +/* ******************* */ +var SWFUpload; + +if (SWFUpload == undefined) { + SWFUpload = function (settings) { + this.initSWFUpload(settings); + }; +} + +SWFUpload.prototype.initSWFUpload = function (settings) { + try { + this.customSettings = {}; // A container where developers can place their own settings associated with this instance. + this.settings = settings; + this.eventQueue = []; + this.movieName = "SWFUpload_" + SWFUpload.movieCount++; + this.movieElement = null; + + + // Setup global control tracking + SWFUpload.instances[this.movieName] = this; + + // Load the settings. Load the Flash movie. + this.initSettings(); + this.loadFlash(); + this.displayDebugInfo(); + } catch (ex) { +// console.log('Exception!!'); + delete SWFUpload.instances[this.movieName]; + throw ex; + } +}; + +/* *************** */ +/* Static Members */ +/* *************** */ +SWFUpload.instances = {}; +SWFUpload.movieCount = 0; +SWFUpload.version = "2.2.0 2009-03-25"; +SWFUpload.QUEUE_ERROR = { + QUEUE_LIMIT_EXCEEDED : -100, + FILE_EXCEEDS_SIZE_LIMIT : -110, + ZERO_BYTE_FILE : -120, + INVALID_FILETYPE : -130 +}; +SWFUpload.UPLOAD_ERROR = { + HTTP_ERROR : -200, + MISSING_UPLOAD_URL : -210, + IO_ERROR : -220, + SECURITY_ERROR : -230, + UPLOAD_LIMIT_EXCEEDED : -240, + UPLOAD_FAILED : -250, + SPECIFIED_FILE_ID_NOT_FOUND : -260, + FILE_VALIDATION_FAILED : -270, + FILE_CANCELLED : -280, + UPLOAD_STOPPED : -290 +}; +SWFUpload.FILE_STATUS = { + QUEUED : -1, + IN_PROGRESS : -2, + ERROR : -3, + COMPLETE : -4, + CANCELLED : -5 +}; +SWFUpload.BUTTON_ACTION = { + SELECT_FILE : -100, + SELECT_FILES : -110, + START_UPLOAD : -120 +}; +SWFUpload.CURSOR = { + ARROW : -1, + HAND : -2 +}; +SWFUpload.WINDOW_MODE = { + WINDOW : "window", + TRANSPARENT : "transparent", + OPAQUE : "opaque" +}; + +// Private: takes a URL, determines if it is relative and converts to an absolute URL +// using the current site. Only processes the URL if it can, otherwise returns the URL untouched +SWFUpload.completeURL = function(url) { + if (typeof(url) !== "string" || url.match(/^https?:\/\//i) || url.match(/^\//)) { + return url; + } + + var currentURL = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ":" + window.location.port : ""); + + var indexSlash = window.location.pathname.lastIndexOf("/"); + if (indexSlash <= 0) { + path = "/"; + } else { + path = window.location.pathname.substr(0, indexSlash) + "/"; + } + + return /*currentURL +*/ path + url; + +}; + + +/* ******************** */ +/* Instance Members */ +/* ******************** */ + +// Private: initSettings ensures that all the +// settings are set, getting a default value if one was not assigned. +SWFUpload.prototype.initSettings = function () { + this.ensureDefault = function (settingName, defaultValue) { + this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName]; + }; + + // Upload backend settings + this.ensureDefault("upload_url", ""); + this.ensureDefault("preserve_relative_urls", false); + this.ensureDefault("file_post_name", "Filedata"); + this.ensureDefault("post_params", {}); + this.ensureDefault("use_query_string", false); + this.ensureDefault("requeue_on_error", false); + this.ensureDefault("http_success", []); + this.ensureDefault("assume_success_timeout", 0); + + // File Settings + this.ensureDefault("file_types", "*.*"); + this.ensureDefault("file_types_description", "All Files"); + this.ensureDefault("file_size_limit", 0); // Default zero means "unlimited" + this.ensureDefault("file_upload_limit", 0); + this.ensureDefault("file_queue_limit", 0); + + // Flash Settings + this.ensureDefault("flash_url", "swfupload.swf"); + this.ensureDefault("prevent_swf_caching", true); + + // Button Settings + this.ensureDefault("button_image_url", ""); + this.ensureDefault("button_width", 1); + this.ensureDefault("button_height", 1); + this.ensureDefault("button_text", ""); + this.ensureDefault("button_text_style", "color: #000000; font-size: 16pt;"); + this.ensureDefault("button_text_top_padding", 0); + this.ensureDefault("button_text_left_padding", 0); + this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES); + this.ensureDefault("button_disabled", false); + this.ensureDefault("button_placeholder_id", ""); + this.ensureDefault("button_placeholder", null); + this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW); + this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW); + + // Debug Settings + this.ensureDefault("debug", false); + this.settings.debug_enabled = this.settings.debug; // Here to maintain v2 API + + // Event Handlers + this.settings.return_upload_start_handler = this.returnUploadStart; + this.ensureDefault("swfupload_loaded_handler", null); + this.ensureDefault("file_dialog_start_handler", null); + this.ensureDefault("file_queued_handler", null); + this.ensureDefault("file_queue_error_handler", null); + this.ensureDefault("file_dialog_complete_handler", null); + + this.ensureDefault("upload_start_handler", null); + this.ensureDefault("upload_progress_handler", null); + this.ensureDefault("upload_error_handler", null); + this.ensureDefault("upload_success_handler", null); + this.ensureDefault("upload_complete_handler", null); + + this.ensureDefault("debug_handler", this.debugMessage); + + this.ensureDefault("custom_settings", {}); + + // Other settings + this.customSettings = this.settings.custom_settings; + + // Update the flash url if needed + if (!!this.settings.prevent_swf_caching) { + this.settings.flash_url = this.settings.flash_url + (this.settings.flash_url.indexOf("?") < 0 ? "?" : "&") + "preventswfcaching=" + new Date().getTime(); + } + + if (!this.settings.preserve_relative_urls) { + //this.settings.flash_url = SWFUpload.completeURL(this.settings.flash_url); // Don't need to do this one since flash doesn't look at it + this.settings.upload_url = SWFUpload.completeURL(this.settings.upload_url); + this.settings.button_image_url = SWFUpload.completeURL(this.settings.button_image_url); + } + + delete this.ensureDefault; +}; + +// Private: loadFlash replaces the button_placeholder element with the flash movie. +SWFUpload.prototype.loadFlash = function () { + var targetElement, tempParent; + + // Make sure an element with the ID we are going to use doesn't already exist + if (document.getElementById(this.movieName) !== null) { + throw "ID " + this.movieName + " is already in use. The Flash Object could not be added"; + } + + // Get the element where we will be placing the flash movie + targetElement = document.getElementById(this.settings.button_placeholder_id) || this.settings.button_placeholder; + + if (targetElement == undefined) { + throw "Could not find the placeholder element: " + this.settings.button_placeholder_id; + } + + // Append the container and load the flash + tempParent = document.createElement("div"); +// console.log('Adding flash HTML'); + tempParent.innerHTML = this.getFlashHTML(); // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers) + targetElement.parentNode.replaceChild(tempParent.firstChild, targetElement); + + // Fix IE Flash/Form bug + if (window[this.movieName] == undefined) { + window[this.movieName] = this.getMovieElement(); + } + +}; + +// Private: getFlashHTML generates the object tag needed to embed the flash in to the document +SWFUpload.prototype.getFlashHTML = function () { + // Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay + return ['', + '', + '', + '', + '', + '', + '', + ''].join(""); +}; + +// Private: getFlashVars builds the parameter string that will be passed +// to flash in the flashvars param. +SWFUpload.prototype.getFlashVars = function () { + // Build a string from the post param object + var paramString = this.buildParamString(); + var httpSuccessString = this.settings.http_success.join(","); + + // Build the parameter string + return ["movieName=", encodeURIComponent(this.movieName), + "&uploadURL=", encodeURIComponent(this.settings.upload_url), + "&useQueryString=", encodeURIComponent(this.settings.use_query_string), + "&requeueOnError=", encodeURIComponent(this.settings.requeue_on_error), + "&httpSuccess=", encodeURIComponent(httpSuccessString), + "&assumeSuccessTimeout=", encodeURIComponent(this.settings.assume_success_timeout), + "&params=", encodeURIComponent(paramString), + "&filePostName=", encodeURIComponent(this.settings.file_post_name), + "&fileTypes=", encodeURIComponent(this.settings.file_types), + "&fileTypesDescription=", encodeURIComponent(this.settings.file_types_description), + "&fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit), + "&fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit), + "&fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit), + "&debugEnabled=", encodeURIComponent(this.settings.debug_enabled), + "&buttonImageURL=", encodeURIComponent(this.settings.button_image_url), + "&buttonWidth=", encodeURIComponent(this.settings.button_width), + "&buttonHeight=", encodeURIComponent(this.settings.button_height), + "&buttonText=", encodeURIComponent(this.settings.button_text), + "&buttonTextTopPadding=", encodeURIComponent(this.settings.button_text_top_padding), + "&buttonTextLeftPadding=", encodeURIComponent(this.settings.button_text_left_padding), + "&buttonTextStyle=", encodeURIComponent(this.settings.button_text_style), + "&buttonAction=", encodeURIComponent(this.settings.button_action), + "&buttonDisabled=", encodeURIComponent(this.settings.button_disabled), + "&buttonCursor=", encodeURIComponent(this.settings.button_cursor) + ].join(""); +}; + +// Public: getMovieElement retrieves the DOM reference to the Flash element added by SWFUpload +// The element is cached after the first lookup +SWFUpload.prototype.getMovieElement = function () { + if (this.movieElement == undefined) { + this.movieElement = document.getElementById(this.movieName); + } + + if (this.movieElement === null) { + throw "Could not find Flash element"; + } + + return this.movieElement; +}; + +// Private: buildParamString takes the name/value pairs in the post_params setting object +// and joins them up in to a string formatted "name=value&name=value" +SWFUpload.prototype.buildParamString = function () { + var postParams = this.settings.post_params; + var paramStringPairs = []; + + if (typeof(postParams) === "object") { + for (var name in postParams) { + if (postParams.hasOwnProperty(name)) { + paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString())); + } + } + } + + return paramStringPairs.join("&"); +}; + +// Public: Used to remove a SWFUpload instance from the page. This method strives to remove +// all references to the SWF, and other objects so memory is properly freed. +// Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state. +// Credits: Major improvements provided by steffen +SWFUpload.prototype.destroy = function () { + try { + // Make sure Flash is done before we try to remove it + this.cancelUpload(null, false); + + + // Remove the SWFUpload DOM nodes + var movieElement = null; + movieElement = this.getMovieElement(); + + if (movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE + // Loop through all the movie's properties and remove all function references (DOM/JS IE 6/7 memory leak workaround) + for (var i in movieElement) { + try { + if (typeof(movieElement[i]) === "function") { + movieElement[i] = null; + } + } catch (ex1) {} + } + + // Remove the Movie Element from the page + try { + movieElement.parentNode.removeChild(movieElement); + } catch (ex) {} + } + + // Remove IE form fix reference + window[this.movieName] = null; + + // Destroy other references + SWFUpload.instances[this.movieName] = null; + delete SWFUpload.instances[this.movieName]; + + this.movieElement = null; + this.settings = null; + this.customSettings = null; + this.eventQueue = null; + this.movieName = null; + + + return true; + } catch (ex2) { + return false; + } +}; + + +// Public: displayDebugInfo prints out settings and configuration +// information about this SWFUpload instance. +// This function (and any references to it) can be deleted when placing +// SWFUpload in production. +SWFUpload.prototype.displayDebugInfo = function () { + this.debug( + [ + "---SWFUpload Instance Info---\n", + "Version: ", SWFUpload.version, "\n", + "Movie Name: ", this.movieName, "\n", + "Settings:\n", + "\t", "upload_url: ", this.settings.upload_url, "\n", + "\t", "flash_url: ", this.settings.flash_url, "\n", + "\t", "use_query_string: ", this.settings.use_query_string.toString(), "\n", + "\t", "requeue_on_error: ", this.settings.requeue_on_error.toString(), "\n", + "\t", "http_success: ", this.settings.http_success.join(", "), "\n", + "\t", "assume_success_timeout: ", this.settings.assume_success_timeout, "\n", + "\t", "file_post_name: ", this.settings.file_post_name, "\n", + "\t", "post_params: ", this.settings.post_params.toString(), "\n", + "\t", "file_types: ", this.settings.file_types, "\n", + "\t", "file_types_description: ", this.settings.file_types_description, "\n", + "\t", "file_size_limit: ", this.settings.file_size_limit, "\n", + "\t", "file_upload_limit: ", this.settings.file_upload_limit, "\n", + "\t", "file_queue_limit: ", this.settings.file_queue_limit, "\n", + "\t", "debug: ", this.settings.debug.toString(), "\n", + + "\t", "prevent_swf_caching: ", this.settings.prevent_swf_caching.toString(), "\n", + + "\t", "button_placeholder_id: ", this.settings.button_placeholder_id.toString(), "\n", + "\t", "button_placeholder: ", (this.settings.button_placeholder ? "Set" : "Not Set"), "\n", + "\t", "button_image_url: ", this.settings.button_image_url.toString(), "\n", + "\t", "button_width: ", this.settings.button_width.toString(), "\n", + "\t", "button_height: ", this.settings.button_height.toString(), "\n", + "\t", "button_text: ", this.settings.button_text.toString(), "\n", + "\t", "button_text_style: ", this.settings.button_text_style.toString(), "\n", + "\t", "button_text_top_padding: ", this.settings.button_text_top_padding.toString(), "\n", + "\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n", + "\t", "button_action: ", this.settings.button_action.toString(), "\n", + "\t", "button_disabled: ", this.settings.button_disabled.toString(), "\n", + + "\t", "custom_settings: ", this.settings.custom_settings.toString(), "\n", + "Event Handlers:\n", + "\t", "swfupload_loaded_handler assigned: ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n", + "\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n", + "\t", "file_queued_handler assigned: ", (typeof this.settings.file_queued_handler === "function").toString(), "\n", + "\t", "file_queue_error_handler assigned: ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n", + "\t", "upload_start_handler assigned: ", (typeof this.settings.upload_start_handler === "function").toString(), "\n", + "\t", "upload_progress_handler assigned: ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n", + "\t", "upload_error_handler assigned: ", (typeof this.settings.upload_error_handler === "function").toString(), "\n", + "\t", "upload_success_handler assigned: ", (typeof this.settings.upload_success_handler === "function").toString(), "\n", + "\t", "upload_complete_handler assigned: ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n", + "\t", "debug_handler assigned: ", (typeof this.settings.debug_handler === "function").toString(), "\n" + ].join("") + ); +}; + +/* Note: addSetting and getSetting are no longer used by SWFUpload but are included + the maintain v2 API compatibility +*/ +// Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used. +SWFUpload.prototype.addSetting = function (name, value, default_value) { + if (value == undefined) { + return (this.settings[name] = default_value); + } else { + return (this.settings[name] = value); + } +}; + +// Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found. +SWFUpload.prototype.getSetting = function (name) { + if (this.settings[name] != undefined) { + return this.settings[name]; + } + + return ""; +}; + + + +// Private: callFlash handles function calls made to the Flash element. +// Calls are made with a setTimeout for some functions to work around +// bugs in the ExternalInterface library. +SWFUpload.prototype.callFlash = function (functionName, argumentArray) { + argumentArray = argumentArray || []; + + var movieElement = this.getMovieElement(); + var returnValue, returnString; + + // Flash's method if calling ExternalInterface methods (code adapted from MooTools). + try { + returnString = movieElement.CallFunction('' + __flash__argumentsToXML(argumentArray, 0) + ''); + returnValue = eval(returnString); + } catch (ex) { + throw "Call to " + functionName + " failed"; + } + + // Unescape file post param values + if (returnValue != undefined && typeof returnValue.post === "object") { + returnValue = this.unescapeFilePostParams(returnValue); + } + + return returnValue; +}; + +/* ***************************** + -- Flash control methods -- + Your UI should use these + to operate SWFUpload + ***************************** */ + +// WARNING: this function does not work in Flash Player 10 +// Public: selectFile causes a File Selection Dialog window to appear. This +// dialog only allows 1 file to be selected. +SWFUpload.prototype.selectFile = function () { + this.callFlash("SelectFile"); +}; + +// WARNING: this function does not work in Flash Player 10 +// Public: selectFiles causes a File Selection Dialog window to appear/ This +// dialog allows the user to select any number of files +// Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names. +// If the selection name length is too long the dialog will fail in an unpredictable manner. There is no work-around +// for this bug. +SWFUpload.prototype.selectFiles = function () { + this.callFlash("SelectFiles"); +}; + + +// Public: startUpload starts uploading the first file in the queue unless +// the optional parameter 'fileID' specifies the ID +SWFUpload.prototype.startUpload = function (fileID) { + this.callFlash("StartUpload", [fileID]); +}; + +// Public: cancelUpload cancels any queued file. The fileID parameter may be the file ID or index. +// If you do not specify a fileID the current uploading file or first file in the queue is cancelled. +// If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter. +SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) { + if (triggerErrorEvent !== false) { + triggerErrorEvent = true; + } + this.callFlash("CancelUpload", [fileID, triggerErrorEvent]); +}; + +// Public: stopUpload stops the current upload and requeues the file at the beginning of the queue. +// If nothing is currently uploading then nothing happens. +SWFUpload.prototype.stopUpload = function () { + this.callFlash("StopUpload"); +}; + +/* ************************ + * Settings methods + * These methods change the SWFUpload settings. + * SWFUpload settings should not be changed directly on the settings object + * since many of the settings need to be passed to Flash in order to take + * effect. + * *********************** */ + +// Public: getStats gets the file statistics object. +SWFUpload.prototype.getStats = function () { + return this.callFlash("GetStats"); +}; + +// Public: setStats changes the SWFUpload statistics. You shouldn't need to +// change the statistics but you can. Changing the statistics does not +// affect SWFUpload accept for the successful_uploads count which is used +// by the upload_limit setting to determine how many files the user may upload. +SWFUpload.prototype.setStats = function (statsObject) { + this.callFlash("SetStats", [statsObject]); +}; + +// Public: getFile retrieves a File object by ID or Index. If the file is +// not found then 'null' is returned. +SWFUpload.prototype.getFile = function (fileID) { + if (typeof(fileID) === "number") { + return this.callFlash("GetFileByIndex", [fileID]); + } else { + return this.callFlash("GetFile", [fileID]); + } +}; + +// Public: addFileParam sets a name/value pair that will be posted with the +// file specified by the Files ID. If the name already exists then the +// exiting value will be overwritten. +SWFUpload.prototype.addFileParam = function (fileID, name, value) { + return this.callFlash("AddFileParam", [fileID, name, value]); +}; + +// Public: removeFileParam removes a previously set (by addFileParam) name/value +// pair from the specified file. +SWFUpload.prototype.removeFileParam = function (fileID, name) { + this.callFlash("RemoveFileParam", [fileID, name]); +}; + +// Public: setUploadUrl changes the upload_url setting. +SWFUpload.prototype.setUploadURL = function (url) { + this.settings.upload_url = url.toString(); + this.callFlash("SetUploadURL", [url]); +}; + +// Public: setPostParams changes the post_params setting +SWFUpload.prototype.setPostParams = function (paramsObject) { + this.settings.post_params = paramsObject; + this.callFlash("SetPostParams", [paramsObject]); +}; + +// Public: addPostParam adds post name/value pair. Each name can have only one value. +SWFUpload.prototype.addPostParam = function (name, value) { + this.settings.post_params[name] = value; + this.callFlash("SetPostParams", [this.settings.post_params]); +}; + +// Public: removePostParam deletes post name/value pair. +SWFUpload.prototype.removePostParam = function (name) { + delete this.settings.post_params[name]; + this.callFlash("SetPostParams", [this.settings.post_params]); +}; + +// Public: setFileTypes changes the file_types setting and the file_types_description setting +SWFUpload.prototype.setFileTypes = function (types, description) { + this.settings.file_types = types; + this.settings.file_types_description = description; + this.callFlash("SetFileTypes", [types, description]); +}; + +// Public: setFileSizeLimit changes the file_size_limit setting +SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) { + this.settings.file_size_limit = fileSizeLimit; + this.callFlash("SetFileSizeLimit", [fileSizeLimit]); +}; + +// Public: setFileUploadLimit changes the file_upload_limit setting +SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) { + this.settings.file_upload_limit = fileUploadLimit; + this.callFlash("SetFileUploadLimit", [fileUploadLimit]); +}; + +// Public: setFileQueueLimit changes the file_queue_limit setting +SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) { + this.settings.file_queue_limit = fileQueueLimit; + this.callFlash("SetFileQueueLimit", [fileQueueLimit]); +}; + +// Public: setFilePostName changes the file_post_name setting +SWFUpload.prototype.setFilePostName = function (filePostName) { + this.settings.file_post_name = filePostName; + this.callFlash("SetFilePostName", [filePostName]); +}; + +// Public: setUseQueryString changes the use_query_string setting +SWFUpload.prototype.setUseQueryString = function (useQueryString) { + this.settings.use_query_string = useQueryString; + this.callFlash("SetUseQueryString", [useQueryString]); +}; + +// Public: setRequeueOnError changes the requeue_on_error setting +SWFUpload.prototype.setRequeueOnError = function (requeueOnError) { + this.settings.requeue_on_error = requeueOnError; + this.callFlash("SetRequeueOnError", [requeueOnError]); +}; + +// Public: setHTTPSuccess changes the http_success setting +SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) { + if (typeof http_status_codes === "string") { + http_status_codes = http_status_codes.replace(" ", "").split(","); + } + + this.settings.http_success = http_status_codes; + this.callFlash("SetHTTPSuccess", [http_status_codes]); +}; + +// Public: setHTTPSuccess changes the http_success setting +SWFUpload.prototype.setAssumeSuccessTimeout = function (timeout_seconds) { + this.settings.assume_success_timeout = timeout_seconds; + this.callFlash("SetAssumeSuccessTimeout", [timeout_seconds]); +}; + +// Public: setDebugEnabled changes the debug_enabled setting +SWFUpload.prototype.setDebugEnabled = function (debugEnabled) { + this.settings.debug_enabled = debugEnabled; + this.callFlash("SetDebugEnabled", [debugEnabled]); +}; + +// Public: setButtonImageURL loads a button image sprite +SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) { + if (buttonImageURL == undefined) { + buttonImageURL = ""; + } + + this.settings.button_image_url = buttonImageURL; + this.callFlash("SetButtonImageURL", [buttonImageURL]); +}; + +// Public: setButtonDimensions resizes the Flash Movie and button +SWFUpload.prototype.setButtonDimensions = function (width, height) { + this.settings.button_width = width; + this.settings.button_height = height; + + var movie = this.getMovieElement(); + if (movie != undefined) { + movie.style.width = width + "px"; + movie.style.height = height + "px"; + } + + this.callFlash("SetButtonDimensions", [width, height]); +}; +// Public: setButtonText Changes the text overlaid on the button +SWFUpload.prototype.setButtonText = function (html) { + this.settings.button_text = html; + this.callFlash("SetButtonText", [html]); +}; +// Public: setButtonTextPadding changes the top and left padding of the text overlay +SWFUpload.prototype.setButtonTextPadding = function (left, top) { + this.settings.button_text_top_padding = top; + this.settings.button_text_left_padding = left; + this.callFlash("SetButtonTextPadding", [left, top]); +}; + +// Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button +SWFUpload.prototype.setButtonTextStyle = function (css) { + this.settings.button_text_style = css; + this.callFlash("SetButtonTextStyle", [css]); +}; +// Public: setButtonDisabled disables/enables the button +SWFUpload.prototype.setButtonDisabled = function (isDisabled) { + this.settings.button_disabled = isDisabled; + this.callFlash("SetButtonDisabled", [isDisabled]); +}; +// Public: setButtonAction sets the action that occurs when the button is clicked +SWFUpload.prototype.setButtonAction = function (buttonAction) { + this.settings.button_action = buttonAction; + this.callFlash("SetButtonAction", [buttonAction]); +}; + +// Public: setButtonCursor changes the mouse cursor displayed when hovering over the button +SWFUpload.prototype.setButtonCursor = function (cursor) { + this.settings.button_cursor = cursor; + this.callFlash("SetButtonCursor", [cursor]); +}; + +/* ******************************* + Flash Event Interfaces + These functions are used by Flash to trigger the various + events. + + All these functions a Private. + + Because the ExternalInterface library is buggy the event calls + are added to a queue and the queue then executed by a setTimeout. + This ensures that events are executed in a determinate order and that + the ExternalInterface bugs are avoided. +******************************* */ + +SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) { + // Warning: Don't call this.debug inside here or you'll create an infinite loop + + if (argumentArray == undefined) { + argumentArray = []; + } else if (!(argumentArray instanceof Array)) { + argumentArray = [argumentArray]; + } + + var self = this; + if (typeof this.settings[handlerName] === "function") { + // Queue the event + this.eventQueue.push(function () { + this.settings[handlerName].apply(this, argumentArray); + }); + + // Execute the next queued event + setTimeout(function () { + self.executeNextEvent(); + }, 0); + + } else if (this.settings[handlerName] !== null) { + throw "Event handler " + handlerName + " is unknown or is not a function"; + } +}; + +// Private: Causes the next event in the queue to be executed. Since events are queued using a setTimeout +// we must queue them in order to garentee that they are executed in order. +SWFUpload.prototype.executeNextEvent = function () { + // Warning: Don't call this.debug inside here or you'll create an infinite loop + + var f = this.eventQueue ? this.eventQueue.shift() : null; + if (typeof(f) === "function") { + f.apply(this); + } +}; + +// Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have +// properties that contain characters that are not valid for JavaScript identifiers. To work around this +// the Flash Component escapes the parameter names and we must unescape again before passing them along. +SWFUpload.prototype.unescapeFilePostParams = function (file) { + var reg = /[$]([0-9a-f]{4})/i; + var unescapedPost = {}; + var uk; + + if (file != undefined) { + for (var k in file.post) { + if (file.post.hasOwnProperty(k)) { + uk = k; + var match; + while ((match = reg.exec(uk)) !== null) { + uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16))); + } + unescapedPost[uk] = file.post[k]; + } + } + + file.post = unescapedPost; + } + + return file; +}; + +// Private: Called by Flash to see if JS can call in to Flash (test if External Interface is working) +SWFUpload.prototype.testExternalInterface = function () { + try { + return this.callFlash("TestExternalInterface"); + } catch (ex) { + return false; + } +}; + +// Private: This event is called by Flash when it has finished loading. Don't modify this. +// Use the swfupload_loaded_handler event setting to execute custom code when SWFUpload has loaded. +SWFUpload.prototype.flashReady = function () { + // Check that the movie element is loaded correctly with its ExternalInterface methods defined + var movieElement = this.getMovieElement(); + + if (!movieElement) { + this.debug("Flash called back ready but the flash movie can't be found."); + return; + } + + this.cleanUp(movieElement); + + this.queueEvent("swfupload_loaded_handler"); +}; + +// Private: removes Flash added fuctions to the DOM node to prevent memory leaks in IE. +// This function is called by Flash each time the ExternalInterface functions are created. +SWFUpload.prototype.cleanUp = function (movieElement) { + // Pro-actively unhook all the Flash functions + try { + if (this.movieElement && typeof(movieElement.CallFunction) === "unknown") { // We only want to do this in IE + this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)"); + for (var key in movieElement) { + try { + if (typeof(movieElement[key]) === "function") { + movieElement[key] = null; + } + } catch (ex) { + } + } + } + } catch (ex1) { + + } + + // Fix Flashes own cleanup code so if the SWFMovie was removed from the page + // it doesn't display errors. + window["__flash__removeCallback"] = function (instance, name) { + try { + if (instance) { + instance[name] = null; + } + } catch (flashEx) { + + } + }; + +}; + + +/* This is a chance to do something before the browse window opens */ +SWFUpload.prototype.fileDialogStart = function () { + this.queueEvent("file_dialog_start_handler"); +}; + + +/* Called when a file is successfully added to the queue. */ +SWFUpload.prototype.fileQueued = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("file_queued_handler", file); +}; + + +/* Handle errors that occur when an attempt to queue a file fails. */ +SWFUpload.prototype.fileQueueError = function (file, errorCode, message) { + file = this.unescapeFilePostParams(file); + this.queueEvent("file_queue_error_handler", [file, errorCode, message]); +}; + +/* Called after the file dialog has closed and the selected files have been queued. + You could call startUpload here if you want the queued files to begin uploading immediately. */ +SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued, numFilesInQueue) { + this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued, numFilesInQueue]); +}; + +SWFUpload.prototype.uploadStart = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("return_upload_start_handler", file); +}; + +SWFUpload.prototype.returnUploadStart = function (file) { + var returnValue; + if (typeof this.settings.upload_start_handler === "function") { + file = this.unescapeFilePostParams(file); + returnValue = this.settings.upload_start_handler.call(this, file); + } else if (this.settings.upload_start_handler != undefined) { + throw "upload_start_handler must be a function"; + } + + // Convert undefined to true so if nothing is returned from the upload_start_handler it is + // interpretted as 'true'. + if (returnValue === undefined) { + returnValue = true; + } + + returnValue = !!returnValue; + + this.callFlash("ReturnUploadStart", [returnValue]); +}; + + + +SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]); +}; + +SWFUpload.prototype.uploadError = function (file, errorCode, message) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_error_handler", [file, errorCode, message]); +}; + +SWFUpload.prototype.uploadSuccess = function (file, serverData, responseReceived) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_success_handler", [file, serverData, responseReceived]); +}; + +SWFUpload.prototype.uploadComplete = function (file) { + file = this.unescapeFilePostParams(file); + this.queueEvent("upload_complete_handler", file); +}; + +/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the + internal debug console. You can override this event and have messages written where you want. */ +SWFUpload.prototype.debug = function (message) { + this.queueEvent("debug_handler", message); +}; + + +/* ********************************** + Debug Console + The debug console is a self contained, in page location + for debug message to be sent. The Debug Console adds + itself to the body if necessary. + + The console is automatically scrolled as messages appear. + + If you are using your own debug handler or when you deploy to production and + have debug disabled you can remove these functions to reduce the file size + and complexity. +********************************** */ + +// Private: debugMessage is the default debug_handler. If you want to print debug messages +// call the debug() function. When overriding the function your own function should +// check to see if the debug setting is true before outputting debug information. +SWFUpload.prototype.debugMessage = function (message) { + if (this.settings.debug) { + var exceptionMessage, exceptionValues = []; + + // Check for an exception object and print it nicely + if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") { + for (var key in message) { + if (message.hasOwnProperty(key)) { + exceptionValues.push(key + ": " + message[key]); + } + } + exceptionMessage = exceptionValues.join("\n") || ""; + exceptionValues = exceptionMessage.split("\n"); + exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: "); + SWFUpload.Console.writeLine(exceptionMessage); + } else { + SWFUpload.Console.writeLine(message); + } + } +}; + +SWFUpload.Console = {}; +SWFUpload.Console.writeLine = function (message) { + var console, documentForm; + + try { + console = document.getElementById("SWFUpload_Console"); + + if (!console) { + documentForm = document.createElement("form"); + document.getElementsByTagName("body")[0].appendChild(documentForm); + + console = document.createElement("textarea"); + console.id = "SWFUpload_Console"; + console.style.fontFamily = "monospace"; + console.setAttribute("wrap", "off"); + console.wrap = "off"; + console.style.overflow = "auto"; + console.style.width = "700px"; + console.style.height = "350px"; + console.style.margin = "5px"; + documentForm.appendChild(console); + } + + console.value += message + "\n"; + + console.scrollTop = console.scrollHeight - console.clientHeight; + } catch (ex) { + alert("Exception: " + ex.name + " Message: " + ex.message); + } +}; diff --git a/workflow/engine/templates/bpmn/swfupload.swfobject.js b/workflow/engine/templates/bpmn/swfupload.swfobject.js new file mode 100755 index 000000000..a75adbf4c --- /dev/null +++ b/workflow/engine/templates/bpmn/swfupload.swfobject.js @@ -0,0 +1,111 @@ +/* + SWFUpload.SWFObject Plugin + + Summary: + This plugin uses SWFObject to embed SWFUpload dynamically in the page. SWFObject provides accurate Flash Player detection and DOM Ready loading. + This plugin replaces the Graceful Degradation plugin. + + Features: + * swfupload_load_failed_hander event + * swfupload_pre_load_handler event + * minimum_flash_version setting (default: "9.0.28") + * SWFUpload.onload event for early loading + + Usage: + Provide handlers and settings as needed. When using the SWFUpload.SWFObject plugin you should initialize SWFUploading + in SWFUpload.onload rather than in window.onload. When initialized this way SWFUpload can load earlier preventing the UI flicker + that was seen using the Graceful Degradation plugin. + + + + Notes: + You must provide set minimum_flash_version setting to "8" if you are using SWFUpload for Flash Player 8. + The swfuploadLoadFailed event is only fired if the minimum version of Flash Player is not met. Other issues such as missing SWF files, browser bugs + or corrupt Flash Player installations will not trigger this event. + The swfuploadPreLoad event is fired as soon as the minimum version of Flash Player is found. It does not wait for SWFUpload to load and can + be used to prepare the SWFUploadUI and hide alternate content. + swfobject's onDomReady event is cross-browser safe but will default to the window.onload event when DOMReady is not supported by the browser. + Early DOM Loading is supported in major modern browsers but cannot be guaranteed for every browser ever made. +*/ + + +/* SWFObject v2.1 + Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis + This software is released under the MIT License +*/ +var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("