diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTConditionalExpression.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/VTConditionalExpression.inc
deleted file mode 100644
index 9245c809..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTConditionalExpression.inc
+++ /dev/null
@@ -1,126 +0,0 @@
-expTree = $parser->parse();
- }
-
- public function evaluate($data){
- $this->env=$data;
- return $this->evalGate($this->expTree);
- }
-
- private function evalGate($tree){
- if(in_array($tree[0], array("and", "or"))){
- switch($tree[0]){
- case "and":
- return $this->evalGate($tree[1]) and $this->evalGate($tree[2]);
- case "or":
- return $this->evalGate($tree[1]) or $this->evalGate($tree[2]);
- }
- }else{
- return $this->evalCondition($tree);
- }
- }
-
- private function evalCondition($tree){
- switch($tree[0]){
- case "=":
- return (int)$this->getVal($tree[1]) == (int)$this->getVal($tree[2]);
- }
- }
-
- private function getVal($node){
- list($valueType, $value) = $node;
- switch($valueType){
- case "sym":
- return $this->env[$value];
- case "num":
- return $value;
- }
- }
- }
-
-class VTParseFailed extends Exception { }
-
-/**
- * This is a simple parser for conditional expressions used to trigger workflow actions.
- *
- */
-class VTConditionalParser{
-
-
- public function __construct($expr){
- $this->tokens = $this->getTokens($expr);
- $this->pos = 0;
- }
-
- private function getTokens($expression){
- preg_match_all('/and|or|\\d+|=|\\w+|\\(|\\)/',$expression, $matches, PREG_SET_ORDER);
- $tokens=array();
- foreach($matches as $arr){
- $tokenVal = $arr[0];
- if(in_array($tokenVal, array("and", "or", "=", "(", ")"))){
- $tokenType = "op";
- }else if(is_numeric($tokenVal)){
- $tokenType = "num";
- }else{
- $tokenType = "sym";
- }
- $tokens[]=array($tokenType, $tokenVal);
- }
- return $tokens;
- }
-
-
- public function parse(){
- $op = array(
- "and"=>array("op", "and"),
- "or"=>array("op", "or"),
- "="=>array("op", "="),
- "("=>array("op", "("),
- ")"=>array("op", ")"));
-
- if($this->peek()==$op['(']){
- $this->nextToken();
- $left = $this->parse();
- if($this->nextToken()!= $op[')']){
- throw new VTParseFailed();
- }
- }else{
- $left = $this->cond();
- }
- if(sizeof($this->tokens)>$this->pos and in_array($this->peek(), array($op["and"], $op["or"]))){
- $nt = $this->nextToken();
- return array($nt[1], $left, $this->parse());
- }else{
- return $left;
- }
- }
-
- private function cond(){
- $left = $this->nextToken();
- $operator = $this->nextToken();
- $right = $this->nextToken();
- return array($operator[1], $left, $right);
- }
-
- private function peek(){
- return $this->tokens[$this->pos];
- }
-
- private function nextToken(){
- $this->pos+=1;
- return $this->tokens[$this->pos - 1];
- }
-}
-
-?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTEmailRecipientsTemplate.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/VTEmailRecipientsTemplate.inc
deleted file mode 100644
index f3322175..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTEmailRecipientsTemplate.inc
+++ /dev/null
@@ -1,29 +0,0 @@
-
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTEntityCache.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/VTEntityCache.inc
deleted file mode 100644
index 98cd5e4f..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTEntityCache.inc
+++ /dev/null
@@ -1,89 +0,0 @@
-moduleName = null;
- $this->id = $id;
- $this->user = $user;
- $data = vtws_retrieve($id, $user);
- foreach($data as $key => $value){
- if(is_string($value)){
- $data[$key] = html_entity_decode($value, ENT_QUOTES, 'utf-8');
- }
- }
- $this->data = $data;
- }
- /**
- * Get the data from the entity object as an array.
- *
- * @return An array representation of the module data.
- */
- function getData(){
- return $this->data;
- }
-
- /**
- * Get the entity id.
- *
- * @return The entity id.
- */
- function getId(){
- return $this->data['id'];
- }
-
- /**
- * Get the name of the module represented by the entity data object.
- *
- * @return The module name.
- */
- function getModuleName(){
- if($this->moduleName==null){
- global $adb;
- $wsId = $this->data['id'];
- $parts = explode('x', $wsId);
- $result = $adb->pquery('select name from vtiger_ws_entity where id=?',
- array($parts[0]));
- $rowData = $adb->raw_query_result_rowdata($result, 0);
- $this->moduleName = $rowData['name'];
- }
- return $this->moduleName;
- }
-
- function get($fieldName){
- return $this->data[$fieldName];
- }
-
- function set($fieldName, $value){
-
- $this->data[$fieldName] = $value;
- }
-
- function save(){
- vtws_update($this->data,$this->user);
- }
-
-}
-
-class VTEntityCache{
- function __construct($user){
- $this->user = $user;
- $this->cache = array();
- }
-
- function forId($id){
- if($this->cache[$id]==null){
- $data = new VTWorkflowEntity($this->user, $id);
- $this->cache[$id] = $data;
- }
- return $this->cache[$id];
- }
-}
-?>
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTEntityMethodManager.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/VTEntityMethodManager.inc
deleted file mode 100644
index 9f1db19e..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTEntityMethodManager.inc
+++ /dev/null
@@ -1,62 +0,0 @@
-adb = $adb;
- }
-
-
- function addEntityMethod($moduleName, $methodName, $functionPath, $functionName){
- $adb = $this->adb;
- $id = $adb->getUniqueId("com_vtiger_workflowtasks_entitymethod");
- $adb->pquery("insert into com_vtiger_workflowtasks_entitymethod (workflowtasks_entitymethod_id, module_name, function_path, function_name, method_name) values (?,?,?,?,?)", array($id, $moduleName, $functionPath, $functionName, $methodName));
- }
-
-
-
- function executeMethod($entityData, $methodName){
- $adb = $this->adb;
- $moduleName = $entityData->getModuleName();
- $result = $adb->pquery("select function_path, function_name from com_vtiger_workflowtasks_entitymethod where module_name=? and method_name=?", array($moduleName, $methodName));
- if($adb->num_rows($result)!=0){
- $data = $adb->raw_query_result_rowdata($result, 0);
- $functionPath = $data['function_path'];
- $functionName = $data['function_name'];
- require_once($functionPath);
- $functionName($entityData);
- }
- }
-
- function methodsForModule($moduleName){
- $adb = $this->adb;
- $result = $adb->pquery("select method_name from com_vtiger_workflowtasks_entitymethod where module_name=?", array($moduleName));
- $it = new SqlResultIterator($adb, $result);
- $methodNames = array();
- foreach($it as $row){
- $methodNames[] = $row->method_name;
- }
- return $methodNames;
- }
- /*
- private function methodExists($object, $methodName){
- $className = get_class($object);
- $class = new ReflectionClass($className);
- $methods = $class->getMethods();
- foreach($methods as $method){
- if($method->getName()==$methodName){
- return true;
- }
- }
- return false;
- }*/
-}
-?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTEventHandler.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/VTEventHandler.inc
deleted file mode 100644
index a450ccfb..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTEventHandler.inc
+++ /dev/null
@@ -1,127 +0,0 @@
-adminUser();
- global $adb;
- $isNew = $entityData->isNew();
- $entityCache = new VTEntityCache($user);
- $wsModuleName = $util->toWSModuleName($entityData);
- $wsId = vtws_getWebserviceEntityId($wsModuleName,
- $entityData->getId());
- $entityData = $entityCache->forId($wsId);
- $data = $entityData->getData();
- $wfs = new VTWorkflowManager($adb);
- $workflows = $wfs->getWorkflowsForModule($entityData->getModuleName());
- $tm = new VTTaskManager($adb);
- $taskQueue = new VTTaskQueue($adb);
-
- foreach($workflows as $workflow){
- switch($workflow->executionCondition){
- case VTWorkflowManager::$ON_FIRST_SAVE:{
- if($isNew){
- $doEvaluate = true;
- }else{
- $doEvaluate = false;
- }
- break;
- }
- case VTWorkflowManager::$ONCE:{
- $entity_id = vtws_getIdComponents($entityData->getId());
- $entity_id = $entity_id[1];
- $result = $adb->pquery("SELECT * FROM com_vtiger_workflow_activatedonce
- WHERE entity_id=? and workflow_id=?", array($entity_id, $workflow->id));
-
- //Changes
- $result2=$adb->pquery("SELECT * FROM com_vtiger_workflowtasks
- INNER JOIN com_vtiger_workflowtask_queue
- ON com_vtiger_workflowtasks.task_id= com_vtiger_workflowtask_queue.task_id
- WHERE workflow_id=? AND entity_id=?",
- array($workflow->id,$entity_id));
-
- if($adb->num_rows($result)===0 && $adb->num_rows($result2)===0){
- $doEvaluate = true;
- }else{
- $doEvaluate = false;
- }
- break;
- }
- case VTWorkflowManager::$ON_EVERY_SAVE:{
- $doEvaluate = true;
- break;
- }
- case VTWorkflowManager::$ON_MODIFY:{
- $doEvaluate = !($isNew);
- break;
- }
- default:{
- throw new Exception("Should never come here! Execution Condition:".$workflow->executionCondition);
- }
-
- }
- if($doEvaluate && $workflow->evaluate($entityCache, $entityData->getId())){
- if(VTWorkflowManager::$ONCE == $workflow->executionCondition) {
- $entity_id = vtws_getIdComponents($entityData->getId());
- $entity_id = $entity_id[1];
- $adb->pquery("INSERT INTO com_vtiger_workflow_activatedonce (entity_id, workflow_id)
- VALUES (?,?)", array($entity_id, $workflow->id));
- }
-
- $tasks = $tm->getTasksForWorkflow($workflow->id);
- foreach($tasks as $task){
- if($task->active) {
- $trigger = $task->trigger;
- if($trigger != null){
- $delay = strtotime($data[$trigger['field']])+$trigger['days']*86400;
- }else{
- $delay = 0;
- }
- if($task->executeImmediately==true){
- $task->doTask($entityData);
- }else{
- $taskQueue->queueTask($task->id,$entityData->getId(), $delay);
- }
- }
- }
- }
- }
- $util->revertUser();
- }
- }
-?>
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTJsonCondition.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/VTJsonCondition.inc
deleted file mode 100644
index 9e2fcda6..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTJsonCondition.inc
+++ /dev/null
@@ -1,112 +0,0 @@
-forId($id)->getData();
-
- foreach($expr as $cond){
- preg_match('/(\w+) : \((\w+)\) (\w+)/', $cond['fieldname'], $matches);
- if(count($matches)==0){
- $result = $this->checkCondition($data, $cond);
- }else{
- list($full, $referenceField, $referenceModule, $fieldname) = $matches;
- $referenceFieldId = $data[$referenceField];
- if($referenceFieldId != 0){
- $entity = $entityCache->forId($data[$referenceField]);
- if($entity->getModuleName()==$referenceModule){
- $entityData = $entity->getData();
- $cond['fieldname'] = $fieldname;
- $result = $this->checkCondition($entityData, $cond);
- }else{
- $result = false;
- }
- }else{
- return false;
- }
- }
- if($result==false){
- return false;
- }
- }
- return true;
- }
- function startsWith($str, $subStr){
- $sl = strlen($str);
- $ssl = strlen($subStr);
- if($sl>=$ssl){
- return substr_compare($str,$subStr,0, $ssl)==0;
- }else{
- return FALSE;
- }
- }
-
- function endsWith($str, $subStr){
- $sl = strlen($str);
- $ssl = strlen($subStr);
- if($sl>=$ssl){
- return substr_compare($str,$subStr,$sl-$ssl, $ssl)==0;
- }else{
- return FALSE;
- }
- }
-
-
- function checkCondition($data, $cond){
- $condition = $cond['operation'];
- $fieldValue=$data[$cond['fieldname']];
- $value = html_entity_decode($cond['value']);
- switch($condition){
- case "equal to":
- return $fieldValue == $value;
- case "less than":
- return $fieldValue < $value;
- case "greater than":
- return $fieldValue > $value;
- case "does not equal":
- return $fieldValue != $value;
- case "less than or equal to":
- return $fieldValue <= $value;
- case "greater than or equal to":
- return $fieldValue >= $value;
- case "is":
- if(preg_match('/([^:]+):boolean$/', $value, $match)){
- $value = $match[1];
- if($value=='true'){
- return $fieldValue==='on' || $fieldValue===1 || $fieldValue==='1';
- }else{
- return $fieldValue==='off' || $fieldValue===0 || $fieldValue==='0' || $fieldValue==='';
- }
- }else{
- return $fieldValue == $value;
- }
- case "contains":
- return strpos($fieldValue, $value) !== FALSE;
- case "does not contain":
- return strpos($fieldValue, $value) === FALSE;
- case "starts with":
- return $this->startsWith($fieldValue,$value);
- case "ends with":
- return $this->endsWith($fieldValue, $value);
- case "matches":
- return preg_match($value, $fieldValue);
- default:
- //Unexpected condition
- throw new Exception("Found an unexpected condition: ".$condition);
- }
- }
- }
-?>
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTSimpleTemplate.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/VTSimpleTemplate.inc
deleted file mode 100644
index 7998d6f4..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTSimpleTemplate.inc
+++ /dev/null
@@ -1,96 +0,0 @@
-template = $templateString;
- }
-
- function render($entityCache, $entityId){
- $this->cache = $entityCache;
- $this->parent = $this->cache->forId($entityId);
- return $this->parseTemplate();
- }
-
- private function matchHandler($match){
- preg_match('/\((\w+) : \(([_\w]+)\) (\w+)\)/', $match[1], $matches);
- if(count($matches)==0){
- $fieldname = $match[1];
- $data = $this->parent->getData();
- if($this->useValue($data, $fieldname)){
- $result = $data[$fieldname];
- }else{
- $result ='';
- }
- }else{
- list($full, $referenceField, $referenceModule, $fieldname) = $matches;
- if($referenceModule === '__VtigerMeta__'){
- $result = $this->getMetaValue($fieldname);
- }else{
- $referenceId = $this->parent->get($referenceField);
- if($referenceId==null){
- $result="";
- }else{
- $entity = $this->cache->forId($referenceId);
- if($referenceModule==="Users" && $entity->getModuleName()=="Groups"){
- list($groupEntityId, $groupId) = vtws_getIdComponents($referenceId);
-
- require_once('include/utils/GetGroupUsers.php');
- $ggu = new GetGroupUsers();
- $ggu->getAllUsersInGroup($groupId);
-
- $users = $ggu->group_users;
- $parts = Array();
- foreach($users as $userId){
- $refId = vtws_getWebserviceEntityId("Users", $userId);
- $entity = $this->cache->forId($refId);
- $data = $entity->getData();
- if($this->useValue($data, $fieldname)){
- $parts[] = $data[$fieldname];
- }
- }
- $result = implode(",", $parts);
- }if($entity->getModuleName()===$referenceModule){
- $data = $entity->getData();
- if($this->useValue($data, $fieldname)){
- $result = $data[$fieldname];
- }else{
- $result = '';
- }
- }else{
- $result = '';
- }
- }
- }
- }
- if(!empty($result)){
- $result .= ',';
- }
- return $result;
-
- }
-
- protected function useValue($data, $fieldname) {
- return !empty($data[$fieldname]);
- }
-
- function parseTemplate(){
- return preg_replace_callback('/\\$(\w+|\((\w+) : \(([_\w]+)\) (\w+)\))\s*,?/', array($this,"matchHandler"), $this->template);
- }
-
- function getMetaValue($fieldname){
- switch($fieldname){
- case 'date': return getNewDisplayDate();
- case 'time': return date('h-i-s');
- default: '';
- }
- }
-}
-?>
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTTaskManager.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/VTTaskManager.inc
deleted file mode 100644
index 67532916..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTTaskManager.inc
+++ /dev/null
@@ -1,153 +0,0 @@
-adb = $adb;
- }
-
- /**
- * Save the task into the database.
- *
- * When a new task is saved for the first time a field is added to it called
- * id that stores the task id used in the database.
- *
- * @param $summary A summary of the task instance.
- * @param $task The task instance to save.
- * @return The id of the task
- */
- public function saveTask($task){
- $adb = $this->adb;
- if(is_numeric($task->id)){//How do I check whether a member exists in php?
- $taskId = $task->id;
- $adb->pquery("update com_vtiger_workflowtasks set summary=?, task=? where task_id=?",
- array($task->summary, serialize($task), $taskId));
- return $taskId;
- }else{
- $taskId = $adb->getUniqueID("com_vtiger_workflowtasks");
- $task->id = $taskId;
- $adb->pquery("insert into com_vtiger_workflowtasks
- (task_id, workflow_id, summary, task)
- values (?, ?, ?, ?)",
- array($taskId, $task->workflowId, $task->summary, serialize($task)));
- return $taskId;
- }
- }
-
- public function deleteTask($taskId){
- $adb = $this->adb;
- $adb->pquery("delete from com_vtiger_workflowtasks where task_id=?", array($taskId));
- }
-
-
- /**
- * Create a new class instance
- */
- public function createTask($taskType, $workflowId){
- $taskClass = $taskType;
- $this->requireTask($taskType);
- $task = new $taskClass();
- $task->workflowId=$workflowId;
- $task->summary = "";
- $task->active=true;
- return $task;
- }
-
-
- /**
- * Retrieve a task from the database
- *
- * @param $taskId The id of the task to retrieve.
- * @return The retrieved task.
- */
- public function retrieveTask($taskId){
- $adb = $this->adb;
- $result = $adb->pquery("select task from com_vtiger_workflowtasks where task_id=?", array($taskId));
- $data = $adb->raw_query_result_rowdata($result, 0);
- $task = $data["task"];
- return $this->unserializeTask($task);
- }
-
-
- /**
- *
- */
- public function getTasksForWorkflow($workflowId){
- $adb = $this->adb;
- $result = $adb->pquery("select task from com_vtiger_workflowtasks
- where workflow_id=?",
- array($workflowId));
- return $this->getTasksForResult($result);
- }
-
-
- /**
- *
- */
- public function unserializeTask($str){
- $this->requireTask(self::taskName($str));
- return unserialize($str);
-
- }
- /**
- *
- */
- function getTasks(){
- $adb = $this->adb;
- $result = $adb->query("select task from com_vtiger_workflowtasks");
- return $this->getTasksForResult($result);
- }
-
-
- function getTaskTypes(){
- $taskTypes = array("VTEmailTask", "VTEntityMethodTask", "VTCreateTodoTask","VTCreateEventTask");
- // Make SMSTask available if module is active
- // TODO Generic way of handling this could be helpful
- if(getTabid('SMSNotifier') && vtlib_isModuleActive('SMSNotifier')) {
- $taskTypes [] = 'VTSMSTask';
- }
- return $taskTypes;
- }
-
- private function getTasksForResult($result){
- $adb = $this->adb;
- $it = new SqlResultIterator($adb, $result);
- $tasks = array();
- foreach($it as $row){
- $text = $row->task;
-
- $this->requireTask(self::taskName($text));
- $tasks[] = unserialize($text);
- }
- return $tasks;
- }
-
- private function taskName($serializedTask){
- $matches = array();
- preg_match ('/"([^"]+)"/', $serializedTask, $matches);
- return $matches[1];
- }
-
- private function requireTask($taskType){
- require_once("tasks/".$taskType.".inc");
- }
-
- }
-
- abstract class VTTask{
- public abstract function doTask($data);
- public abstract function getFieldNames();
- }
-
- //require 'modules/Workflow/tasks/VTEmailTask.inc';
-?>
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTTaskQueue.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/VTTaskQueue.inc
deleted file mode 100644
index 0825c044..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTTaskQueue.inc
+++ /dev/null
@@ -1,65 +0,0 @@
-adb = $adb;
- }
-
- /**
- * Queue a task for execution.
- *
- * @param $taskId The id of the task to queue
- * @param $entityId The id of the crm entity the task is assiciated with.
- * @param $when The time after which the task should be executed. This is
- * an optional value with a default value of 0.
- */
- public function queueTask($taskId, $entityId, $when=0){
- $adb = $this->adb;
- $result = $adb->pquery("select * from com_vtiger_workflowtask_queue
- where task_id=? and entity_id=?", array($taskId, $entityId));
- if($adb->num_rows($result)==1){
- return false;
- }else{
- $adb->pquery("insert into com_vtiger_workflowtask_queue (task_id, entity_id, do_after)
- values (?,?,?)", array($taskId, $entityId, $when));
- return true;
- }
- }
-
-
- /**
- * Get a list of taskId/entityId pairs ready for execution.
- *
- * The method fetches task id/entity id where the when timestamp
- * is less than the current time when the method was called.
- *
- * @return A list of pairs of the form array(taskId, entityId)
- */
- public function getReadyTasks(){
- $adb = $this->adb;
- $time = time();
- $result = $adb->pquery("select task_id, entity_id from com_vtiger_workflowtask_queue where do_after", array($time));
- $it = new SqlResultIterator($adb, $result);
- $arr = array();
- foreach($it as $row){
- $arr[]=array($row->task_id, $row->entity_id);
- }
- $adb->pquery("delete from com_vtiger_workflowtask_queue where do_after", array($time));
- return $arr;
- }
-
- }
-?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTWorkflowApplication.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/VTWorkflowApplication.inc
deleted file mode 100644
index f254df21..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTWorkflowApplication.inc
+++ /dev/null
@@ -1,75 +0,0 @@
-request;
- $this->name = "com_vtiger_workflow";
- $this->label = "Workflow";
- $this->action = $action;
- $this->returnUrl = $_SERVER["REQUEST_URI"];
- }
-
- function currentUrl(){
- // $req = $this->request;
- // $url = "index.php?module={$this->name}&action={$this->action}";
- // if($this->action=='editworkflow'){
- // if(isset($req['workflow_id'])){
- // $url.="&workflow_id=".$req['workflow_id'];
- // }
- // }else if($this->action=='edittask'){
- // if(isset($req['task_id'])){
- // $url.="&task_id=".$req['task_id'];
- // }
- // }
- return $_SERVER["REQUEST_URI"];
- }
-
- function returnUrl(){
- return $this->returnUrl;
- }
-
- function listViewUrl(){
- return "index.php?module={$this->name}&action=workflowlist";
- }
-
- function editWorkflowUrl($id=null){
- if($id!=null){
- $idPart="&workflow_id=$id";
- }
- return "index.php?module={$this->name}&action=editworkflow$idPart&return_url=".urlencode($this->returnUrl());
- }
-
- function deleteWorkflowUrl($id){
- $idPart="&workflow_id=$id";
- return "index.php?module={$this->name}&action=deleteworkflow$idPart&return_url=".urlencode($this->returnUrl());
- }
-
- function editTaskUrl($id=null){
- if($id!=null){
- $idPart="&task_id=$id";
- }
- return "index.php?module={$this->name}&action=edittask$idPart&return_url=".urlencode($this->returnUrl());
- }
-
- function deleteTaskUrl($id){
- $idPart="&task_id=$id";
- return "index.php?module={$this->name}&action=deletetask$idPart&return_url=".urlencode($this->returnUrl());
- }
-
- function setReturnUrl($returnUrl){
- $this->returnUrl = $returnUrl;
- }
-
- function errorPageUrl($message){
- return "index.php?module={$this->name}&action=errormessage&message=".urlencode($message);
- }
-}
-?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTWorkflowManager.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/VTWorkflowManager.inc
deleted file mode 100644
index 10293821..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTWorkflowManager.inc
+++ /dev/null
@@ -1,210 +0,0 @@
-adb = $adb;
- }
-
- function save($workflow){
- $adb=$this->adb;
- if(isset($workflow->id)){
- $wf=$workflow;
- $adb->pquery("update com_vtiger_workflows set
- module_name=?, summary=?, test=?, execution_condition=?
- where workflow_id=?",
- array($wf->moduleName, $wf->description, $wf->test, $wf->executionCondition, $wf->id));
- }else{
- $workflowId = $adb->getUniqueID("com_vtiger_workflows");
- $workflow->id = $workflowId;
- $wf=$workflow;
- $adb->pquery("insert into com_vtiger_workflows
- (workflow_id, module_name, summary, test, execution_condition)
- values (?,?,?,?,?)",
- array($workflowId, $wf->moduleName, $wf->description, $wf->test, $wf->executionCondition));
- }
- }
-
-
- function getWorkflows(){
- $adb=$this->adb;
-
- $result=$adb->getColumnNames("com_vtiger_workflows");
- if(in_array("defaultworkflow",$result)){
- $result = $adb->query("select workflow_id, module_name, summary, test, execution_condition,defaultworkflow
- from com_vtiger_workflows ");
- }else{
-
- $result = $adb->query("select workflow_id, module_name, summary, test, execution_condition
- from com_vtiger_workflows");
- }
- return $this->getWorkflowsForResult($result);
-
- }
-
- function getWorkflowsForModule($moduleName){
- $adb=$this->adb;
-
-
- //my changes
- $result=$adb->getColumnNames("com_vtiger_workflows");
- if(in_array(defaultworkflow,$result)){
- $result = $adb->pquery("select workflow_id, module_name, summary, test, execution_condition,defaultworkflow
- from com_vtiger_workflows where module_name=?",array($moduleName));
- }
- else{
- $result = $adb->pquery("select workflow_id, module_name, summary, test, execution_condition
- from com_vtiger_workflows where module_name=?",array($moduleName));
- }
- return $this->getWorkflowsForResult($result);
- }
-
- private function getWorkflowsForResult($result){
- $adb=$this->adb;
- $it = new SqlResultIterator($adb, $result);
- $workflows=array();
- foreach($it as $row){
- $workflow=new Workflow();
- $workflow->id = $row->workflow_id;
- $workflow->moduleName = $row->module_name;
- $workflow->description = $row->summary;
- $workflow->test = $row->test;
- $workflow->executionCondition = $row->execution_condition;
-
- if($row->defaultworkflow){
- $workflow->defaultworkflow=$row->defaultworkflow;
- }
- $workflows[]=$workflow;
- }
- return $workflows;
- }
-
- /**
- * Retrieve a workflow from the database
- *
- * Returns null if the workflow doesn't exist.
- *
- * @param The id of the workflow
- * @return A workflow object.
- */
- function retrieve($id){
- $adb=$this->adb;
- $workflow=new Workflow();
- $result = $adb->pquery("select workflow_id, module_name, summary, test, execution_condition
- from com_vtiger_workflows where workflow_id=?",
- array($id));
- if($adb->num_rows($result)){
- $data = $adb->raw_query_result_rowdata($result, 0);
- $workflow->id = $data["workflow_id"];
- $workflow->moduleName = $data["module_name"];
- $workflow->description = $data["summary"];
- $workflow->test = $data["test"];
- $workflow->executionCondition = $data['execution_condition'];
- return $workflow;
- }else{
- return null;
- }
- }
-
- function delete($id){
- $adb=$this->adb;
- $adb->pquery("delete from com_vtiger_workflowtasks where workflow_id=?", array($id));
- $adb->pquery("delete from com_vtiger_workflows where workflow_id=?", array($id));
- }
-
- function newWorkflow($moduleName){
- $workflow=new Workflow();
- $workflow->moduleName = $moduleName;
- $workflow->executionCondition = self::$ON_EVERY_SAVE;
- return $workflow;
-
- }
-
-
- /**
- * Export a workflow as a json encoded string
- *
- * @param $workflow The workflow instance to export.
- */
- public function serializeWorkflow($workflow){
- $exp = array();
- $exp['moduleName'] = $workflow->moduleName;
- $exp['description'] = $workflow->description;
- $exp['test'] = $workflow->test;
- $exp['executionCondition'] = $workflow->executionCondition;
- $exp['tasks'] = array();
- $tm = new VTTaskManager($this->adb);
- $tasks = $tm->getTasksForWorkflow($workflow->id);
- foreach($tasks as $task){
- unset($task->id);
- unset($task->workflowId);
- $exp['tasks'][] = serialize($task);
- }
- return Zend_Json::encode($exp);
- }
-
- /**
- * Import a json encoded string as a workflow object
- *
- * @return The Workflow instance representing the imported workflow.
- */
- public function deserializeWorkflow($str){
- $data = Zend_Json::decode($str);
- $workflow = $this->newWorkflow($data['moduleName']);
- $workflow->description = $data['description'];
- $workflow->test = $data['test'];
- $workflow->executionCondition = $data['executionCondition'];
- $this->save($workflow);
- $tm = new VTTaskManager($this->adb);
- $tasks = $data['tasks'];
- foreach($tasks as $taskStr){
- $task = $tm->unserializeTask($taskStr);
- $task->workflowId = $workflow->id;
- $tm->saveTask($task);
- }
- return $workflow;
- }
-
- }
-
- class Workflow{
- function __construct(){
- $this->conditionStrategy = new VTJsonCondition();
- }
-
- function evaluate($entityCache, $id){
- if($this->test==""){
- return true;
- }else{
- $cs = $this->conditionStrategy;
- return $cs->evaluate($this->test,
- $entityCache, $id);
- }
- }
-
- function executionConditionAsLabel($label=null){
- if($label==null){
- $arr = array('ON_FIRST_SAVE', 'ONCE', 'ON_EVERY_SAVE','ON_MODIFY');
- return $arr[$this->executionCondition-1];
- }else{
- $arr = array('ON_FIRST_SAVE'=>1, 'ONCE'=>2, 'ON_EVERY_SAVE'=>3, 'ON_MODIFY'=>4);
- $this->executionCondition = $arr[$label];
- }
- }
- }
-?>
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTWorkflowTemplateManager.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/VTWorkflowTemplateManager.inc
deleted file mode 100644
index 8f0e1e11..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTWorkflowTemplateManager.inc
+++ /dev/null
@@ -1,197 +0,0 @@
-adb = $adb;
- }
-
- /**
- * Create anew template instance from a workflow
- *
- * This template instance will not be saved. The save
- * will have to be done explicitly.
- *
- * @param $title The title of the template
- * @param $workflow A workflow instance.
- */
- public function newTemplate($title, $workflow){
- $adb = $this->adb;
- $wms = new VTWorkflowManager($adb);
- $str = $wms->serializeWorkflow($workflow);
- $template = new VTWorkflowTemplate();
- $template->title = $title;
- $template->moduleName = $workflow->moduleName;
- $template->template = $str;
- return $template;
- }
-
- /**
- * Retrieve a template given it's id
- *
- * @param $templateId The id of the template
- * @return The template object
- */
- public function retrieveTemplate($templateId){
- $adb = $this->adb;
- $result = $adb->pquery('select * from com_vtiger_workflowtemplates where template_id=?', array($templateId));
- $it = new SqlResultIterator($adb, $result);
- $data = $it->current();
- $template = new VTWorkflowTemplate();
- $template->id = $templateId;
- $template->title = $data->title;
- $template->moduleName = $data->module_name;
- $template->template = $data->template;
- return $template;
- }
-
- /**
- * Create a workflow from a template
- *
- * The new workflow will also be added to the database.
- *
- * @param $template The template to use
- * @return A workflow object.
- */
- public function createWorkflow($template){
- $adb = $this->adb;
- $wfm = new VTWorkflowManager($adb);
- return $wfm->deserializeWorkflow($template->template);
- }
-
- /**
- * Get template objects for a particular module.
- *
- * @param $moduleName The name of the module
- * @return An array containing template objects
- */
- public function getTemplatesForModule($moduleName){
- $adb = $this->adb;
- $result = $adb->pquery("select * from com_vtiger_workflowtemplates where module_name=?", array($moduleName));
- return $this->getTemplatesForResult($result);
- }
-
- /**
- * Get all templates
- *
- * Get all the templates as an array
- *
- * @return An array containing template objects.
- */
- public function getTemplates(){
- $adb = $this->adb;
- $result = $adb->query("select * from com_vtiger_workflowtemplates");
- return $this->getTemplatesForResult($result);
- }
-
- /**
- * Save a template
- *
- * If the object is a newly created template it
- * will be added to the database and a field id containing
- * the new id will be added to the object.
- *
- * @param $template The template object to save.
- */
- public function saveTemplate($template){
- $adb = $this->adb;
- if(is_numeric($template->id)){//How do I check whether a member exists in php?
- $templateId = $template->id;
- $adb->pquery("update com_vtiger_workflowtemplates set title=?,"+
- " module_name=?, template=? where template_id=?",
- array($template->title, $template->moduleName,
- $template->template, $templateId));
- return $templateId;
- }else{
- $templateId = $adb->getUniqueID("com_vtiger_workflowtemplates");
- $template->id = $templateId;
- $adb->pquery("insert into com_vtiger_workflowtemplates
- (template_id, title, module_name, template)
- values (?, ?, ?, ?)",
- array($templateId, $template->title,
- $template->moduleName, $template->template));
- return $templateId;
- }
- }
-
- /**
- * Delete a template
- *
- * $templateId The id of the template to delete.
- */
- public function deleteTemplate($templateId){
- $adb = $this->adb;
- $adb->pquery('delete from com_vtiger_workflowtemplates where template_id=?',
- array($templateId));
- }
-
-
- /**
- * Dump all the templates in vtiger into a string
- *
- * This can be used for exporting templates from one
- * machine to another
- *
- * @return The string dump of the templates.
- */
- public function dumpAllTemplates(){
- $adb = $this->adb;
- $result = $adb->query("select * from com_vtiger_workflowtemplates");
- $it = new SqlResultIterator($adb, $result);
- $arr = array();
- foreach($it as $row){
- $el = array(
- 'moduleName'=>$row->module_name,
- 'title'=>$row->title,
- 'template'=>$row->template
- );
- $arr[] = $el;
- }
- return Zend_Json::encode($arr);
- }
-
- /**
- * Load templates form a dumped string
- *
- * @param $str The string dump generated from dumpAllTemplates
- */
- public function loadTemplates($str){
- $arr = Zend_Json::decode($str);
- foreach($arr as $el){
- $template = new VTWorkflowTemplate();
- $template->moduleName = $el['moduleName'];
- $template->title = $el['title'];
- $template->template = $el['template'];
- $this->save($template);
- $this->createWorkflow($template);
- }
- }
-
-
- private function getTemplatesForResult($result){
- $adb = $this->adb;
- $it = new SqlResultIterator($adb, $result);
- $templates = array();
- foreach($it as $row){
- $template = new VTWorkflowTemplate();
- $template->id = $row->template_id;
- $template->title = $row->title;
- $tempalte->moduleName = $row->module_name;
- $template->template = $row->template;
- $templates[] = $template;
- }
- return $templates;
- }
-}
-
-class VTWorkflowTemplate{
-
-}
-?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTWorkflowUtils.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/VTWorkflowUtils.php
deleted file mode 100644
index 789a2941..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/VTWorkflowUtils.php
+++ /dev/null
@@ -1,132 +0,0 @@
-userStack = array();
- }
- /**
- * Check whether the given identifier is valid.
- */
- function validIdentifier($identifier){
- if(is_string($identifier)){
- return preg_match("/^[a-zA-Z][a-zA-Z_0-9]+$/", $identifier);
- }else{
- return false;
- }
- }
-
-
- /**
- * Push the admin user on to the user stack
- * and make it the $current_user
- *
- */
- function adminUser(){
- $user = new Users();
- $user->retrieveCurrentUserInfoFromFile(1);
- global $current_user;
- array_push($this->userStack, $current_user);
- $current_user = $user;
- return $user;
- }
-
- /**
- * Revert to the previous use on the user stack
- */
- function revertUser(){
- global $current_user;
- if(count($this->userStack)!=0){
- $current_user = array_pop($this->userStack);
- }else{
- $current_user = null;
- }
- return $current_user;
- }
-
- /**
- * Get the current user
- */
- function currentUser(){
- return $current_user;
- }
-
- /**
- * The the webservice entity type of an EntityData object
- */
- function toWSModuleName($entityData){
- $moduleName = $entityData->getModuleName();
- if($moduleName == 'Activity'){
- $arr = array('Task' => 'Calendar', 'Emails' => 'Emails');
- $moduleName = $arr[getActivityType($entityData->getId())];
- if($moduleName == null){
- $moduleName = 'Events';
- }
- }
- return $moduleName;
- }
-
- /**
- * Insert redirection script
- */
- function redirectTo($to, $message){
- ?>
-
- =$message?>
- is_admin)==='on';
- }
-
-/* function to check if the module has workflow
- * @params :: $modulename - name of the module
- */
- function checkModuleWorkflow($modulename){
- global $adb;
- $tabid = getTabid($modulename);
- $modules_not_supported = array('Documents','Calendar','Emails','Faq','Events','PBXManager','Users');
- $query = "SELECT name FROM vtiger_tab WHERE name not in (".generateQuestionMarks($modules_not_supported).") AND isentitytype=1 AND presence = 0 AND tabid = ?";
- $result = $adb->pquery($query,array($modules_not_supported,$tabid));
- $rows = $adb->num_rows($result);
- if($rows > 0){
- return true;
- }else{
- return false;
- }
- }
-
- function vtGetModules($adb){
- $modules_not_supported = array('Documents','Calendar','Emails','Faq','Events','PBXManager','Users');
- $sql="select distinct vtiger_field.tabid, name
- from vtiger_field
- inner join vtiger_tab
- on vtiger_field.tabid=vtiger_tab.tabid
- where vtiger_tab.name not in(".generateQuestionMarks($modules_not_supported).") and vtiger_tab.isentitytype=1 and vtiger_tab.presence = 0 ";
- $it = new SqlResultIterator($adb, $adb->pquery($sql,array($modules_not_supported)));
- $modules = array();
- foreach($it as $row){
- $modules[] = $row->name;
- }
- return $modules;
- }
-
-}
-?>
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/com_vtiger_workflowAjax.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/com_vtiger_workflowAjax.php
deleted file mode 100644
index 067b69bf..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/com_vtiger_workflowAjax.php
+++ /dev/null
@@ -1,12 +0,0 @@
-
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/deletetask.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/deletetask.php
deleted file mode 100644
index f8f29ecc..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/deletetask.php
+++ /dev/null
@@ -1,45 +0,0 @@
-name);
-
- if(!$util->checkAdminAccess()){
- $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
- $util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
- return;
- }
-
- $wm = new VTTaskManager($adb);
- $wm->deleteTask($request['task_id']);
-
- if(isset($request["return_url"])){
- $returnUrl=$request["return_url"];
- }else{
- $returnUrl=$module->editWorkflowUrl($wf->id);
- }
-
- ?>
-
- Return
-
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/deleteworkflow.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/deleteworkflow.php
deleted file mode 100644
index 0e2770ef..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/deleteworkflow.php
+++ /dev/null
@@ -1,44 +0,0 @@
-name);
-
- if(!$util->checkAdminAccess()){
- $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
- $util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
- return;
- }
-
- $wm = new VTWorkflowManager($adb);
- $wm->delete($request['workflow_id']);
-
- if(isset($request["return_url"])){
- $returnUrl=$request["return_url"];
- }else{
- $returnUrl=$module->listViewUrl($wf->id);
- }
-
- ?>
-
- Return
-
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/edittask.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/edittask.php
deleted file mode 100644
index 8ccfb4ed..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/edittask.php
+++ /dev/null
@@ -1,119 +0,0 @@
-name);
-
- if(!$util->checkAdminAccess()){
- $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
- $util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
- return;
- }
-
- $smarty = new vtigerCRM_Smarty();
- $tm = new VTTaskManager($adb);
- $smarty->assign('edit',isset($request["task_id"]));
- if(isset($request["task_id"])){
- $task = $tm->retrieveTask($request["task_id"]);
- $workflowId=$task->workflowId;
- }else{
- $workflowId = $request["workflow_id"];
- $taskClass = $request["task_type"];
- $task = $tm->createTask($taskClass, $workflowId);
- }
-
- if($task==null){
- $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_TASK']);
- $util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_TASK']);
- return;
- }
-
- $wm = new VTWorkflowManager($adb);
- $workflow = $wm->retrieve($workflowId);
- if($workflow==null){
- $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_WORKFLOW']);
- $util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_WORKFLOW']);
- return;
- }
-
-
- $smarty->assign("workflow", $workflow);
- $smarty->assign("returnUrl", $request["return_url"]);
- $smarty->assign("task", $task);
- $smarty->assign("taskType", $taskClass);
- $smarty->assign("saveType", $request['save_type']);
- $taskClass = get_class($task);
- $smarty->assign("taskTemplate", "{$module->name}/taskforms/$taskClass.tpl");
- $et = VTWSEntityType::usingGlobalCurrentUser($workflow->moduleName);
- $smarty->assign("entityType", $et);
- $smarty->assign('entityName', $workflow->moduleName);
- $smarty->assign("fieldNames", $et->getFieldNames());
-
- $dateFields = array();
- $fieldTypes = $et->getFieldTypes();
- $fieldLabels = $et->getFieldLabels();
- foreach($fieldTypes as $name => $type){
- if($type->type=='Date' || $type->type=='DateTime'){
- $dateFields[$name] = $fieldLabels[$name];
- }
- }
-
- $smarty->assign('dateFields', $dateFields);
-
-
- if($task->trigger!=null){
- $trigger = $task->trigger;
- $days = $trigger['days'];
- if ($days < 0){
- $days*=-1;
- $direction = 'before';
- }else{
- $direction = 'after';
- }
- $smarty->assign('trigger', array('days'=>$days, 'direction'=>$direction,
- 'field'=>$trigger['field']));
- }
- $curr_date="(general : (__VtigerMeta__) date)";
- $curr_time='(general : (__VtigerMeta__) time)';
-
- $smarty->assign("DATE",$curr_date);
- $smarty->assign("TIME",$curr_time);
- $smarty->assign("MOD", array_merge(
- return_module_language($current_language,'Settings'),
- return_module_language($current_language, 'Calendar'),
- return_module_language($current_language, $module->name)));
- $smarty->assign("APP", $app_strings);
- $smarty->assign("dateFormat", parse_calendardate($app_strings['NTC_DATE_FORMAT']));
- $smarty->assign("IMAGE_PATH",$image_path);
- $smarty->assign("THEME", $theme);
- $smarty->assign("MODULE_NAME", $module->label);
- $smarty->assign("PAGE_NAME", $mod['LBL_EDIT_TASK']);
- $smarty->assign("PAGE_TITLE", $mod['LBL_EDIT_TASK_TITLE']);
-
- $smarty->assign("module", $module);
- $smarty->display("{$module->name}/EditTask.tpl");
- }
- vtTaskEdit($adb, $_REQUEST, $current_language, $app_strings);
-?>
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/editworkflow.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/editworkflow.php
deleted file mode 100644
index f4bf71de..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/editworkflow.php
+++ /dev/null
@@ -1,87 +0,0 @@
-name);
-
-
- if(!$util->checkAdminAccess()){
- $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
- $util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
- return;
- }
-
-
- $smarty = new vtigerCRM_Smarty();
- if($request['source']=='from_template'){
- $tm = new VTWorkflowTemplateManager($adb);
- $template = $tm->retrieveTemplate($request['template_id']);
- $workflow = $tm->createWorkflow($template);
- }else{
- $wfs = new VTWorkflowManager($adb);
- if(isset($request["workflow_id"])){
- $workflow = $wfs->retrieve($request["workflow_id"]);
- }else{
- $moduleName=$request["module_name"];
- $workflow = $wfs->newWorkflow($moduleName);
- }
- }
-
- if($workflow==null){
- $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NO_WORKFLOW']);
- $util->redirectTo($errorUrl, $mod['LBL_ERROR_NO_WORKFLOW']);
- return;
- }
- $workflow->test = addslashes($workflow->test);
- $tm = new VTTaskManager($adb);
- $tasks = $tm->getTasksForWorkflow($workflow->id);
- $smarty->assign("tasks", $tasks);
- $smarty->assign("taskTypes", $tm->getTaskTypes());
- $smarty->assign("newTaskReturnUrl", $requestUrl);
-
- $smarty->assign("returnUrl", $request["return_url"]);
- $smarty->assign("APP", $app_strings);
- $smarty->assign("MOD", array_merge(
- return_module_language($current_language,'Settings'),
- return_module_language($current_language, $module->name)));
- $smarty->assign("THEME", $theme);
- $smarty->assign("IMAGE_PATH", $image_path);
- $smarty->assign("MODULE_NAME", $module->label);
- $smarty->assign("PAGE_NAME", $mod['LBL_EDIT_WORKFLOW']);
- $smarty->assign("PAGE_TITLE", $mod['LBL_EDIT_WORKFLOW_TITLE']);
-
- $smarty->assign("workflow", $workflow);
- $smarty->assign("saveType", isset($workflow->id)?"edit":"new");
- $smarty->assign("module", $module);
-
- $smarty->display("{$module->name}/EditWorkflow.tpl");
-}
-vtWorkflowEdit($adb, $_REQUEST, $_SERVER["REQUEST_URI"], $current_language, $app_strings);
-?>
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/entitymethodjson.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/entitymethodjson.php
deleted file mode 100644
index 37f71729..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/entitymethodjson.php
+++ /dev/null
@@ -1,21 +0,0 @@
-methodsForModule($moduleName);
- echo Zend_Json::encode($methodNames);
-}
-
-vtEntityMethodJson($adb, $_REQUEST);
-?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/errormessage.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/errormessage.php
deleted file mode 100644
index 9459f0b3..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/errormessage.php
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
Error
-=htmlentities($_REQUEST['message'])?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/errorpage.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/errorpage.php
deleted file mode 100644
index 10d1b854..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/errorpage.php
+++ /dev/null
@@ -1,18 +0,0 @@
-
- Workflow engine error
- ="It appears that you have entered an invalid value."?>
-
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/include.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/include.inc
deleted file mode 100644
index 0c8ec5d2..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/include.inc
+++ /dev/null
@@ -1,15 +0,0 @@
-
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/include_webservices.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/include_webservices.php
deleted file mode 100644
index 78913350..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/include_webservices.php
+++ /dev/null
@@ -1,18 +0,0 @@
-
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/language/en_us.lang.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/language/en_us.lang.php
deleted file mode 100644
index 17afdde6..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/language/en_us.lang.php
+++ /dev/null
@@ -1,44 +0,0 @@
- 'Send Email',
-'VTEntityMethodTask' => 'Invoke Custom Function',
-'VTCreateTodoTask' => 'Create Todo',
-'VTCreateEventTask' => 'Create Event',
-'VTSMSTask' => 'SMS Task',
-'LBL_EDIT_TASK'=>'Edit Task',
-'LBL_EDIT_TASK_TITLE'=>'Edit an existing task or create a new one',
-'LBL_EDIT_WORKFLOW'=>'Edit Workflow',
-'LBL_EDIT_WORKFLOW_TITLE'=>'Edit an existing workflow or create a one',
-'LBL_FROM_TEMPLATE'=>'From Template',
-'LBL_NEW_WORKFLOW'=>'New Workflow',
-'LBL_NEW_TEMPLATE'=>'Save as Template',
-'LBL_CREATE_WORKFLOW_FOR'=>'Create a workflow for',
-'LBL_FOR_MODULE'=>'For Module',
-'LBL_CHOOSE_A_TEMPLATE'=>'Choose a template',
-'LBL_VALIDATION_MISSING_MANDATORY_FIELDS'=>'There are empty mandatory fields.',
-'LBL_VALIDATION_INVALID_DATE_RANGE'=>'Start date/time is greater than the end date/time',
-'LBL_ERROR_NO_WORKFLOW'=>'The workflow you requested does not exist',
-'LBL_ERROR_NO_TASK'=>'The task you requested does not exist',
-'LBL_ERROR_NOT_ADMIN'=>'You do not have access to this module as you are not an admin user',
-'LBL_CREATE_WORKFLOW'=>'Create workflow',
-'LBL_WORKFLOW_LIST'=>'Workflow List',
-'LBL_AVAILABLE_WORKLIST_LIST'=>'Available Workflows',
-'LBL_LOADING'=>'Loading...',
-'LBL_VALIDATION_ERROR'=>'Validation Error',
-'LBL_SELECT_OPTION_DOTDOTDOT'=>'Select Option...',
-'LBL_WORKFLOW_NOTE_CRON_CONFIG'=>'NOTE: You should have Workflow cron script configured.',
-'LBL_NO_TEMPLATES'=>'No Templates',
-'LBL_SELECT'=>'Select',
-'LBL_MESSAGE'=>'Message',
-);
-
-
-?>
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/language/zh_cn.lang.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/language/zh_cn.lang.php
deleted file mode 100644
index 5e91e4eb..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/language/zh_cn.lang.php
+++ /dev/null
@@ -1,55 +0,0 @@
- '发送邮件',
-'VTEntityMethodTask' => '自定义函数',
-'VTCreateTodoTask' => '创建待办事项',
-'VTCreateEventTask' => '创建活动',
-'LBL_EDIT_TASK'=>'编辑任务',
-'LBL_EDIT_TASK_TITLE'=>'编辑现有的任务或者创建新任务',
-'LBL_EDIT_WORKFLOW'=>'编辑工作流程',
-'LBL_EDIT_WORKFLOW_TITLE'=>'编辑现有的工作流程或者创建新流程',
-'LBL_FROM_TEMPLATE'=>'从模板',
-'LBL_NEW_WORKFLOW'=>'新流程',
-'LBL_NEW_TEMPLATE'=>'保存为模板',
-'LBL_CREATE_WORKFLOW_FOR'=>'新的工作流程',
-'LBL_FOR_MODULE'=>'的模块',
-'LBL_FROM_TEMPLATE'=>'从模板',
-'LBL_CHOOSE_A_TEMPLATE'=>'选择模板',
-'LBL_VALIDATION_MISSING_MANDATORY_FIELDS'=>'有空必填。',
-'LBL_VALIDATION_INVALID_DATE_RANGE'=>'开始的日期/时间大于结束日期/时间。',
-'LBL_ERROR_NO_WORKFLOW'=>'你请求的工作流程不存在。 ',
-'LBL_ERROR_NO_TASK'=>'你请求的任务不存在。',
-'LBL_ERROR_NOT_ADMIN'=>'您没有访问此模块的权限。',
-'LBL_CREATE_WORKFLOW'=>'创建工作流',
-'LBL_WORKFLOW_LIST'=>'工作流列表',
-'LBL_AVAILABLE_WORKLIST_LIST'=>'有效的工作流',
-'LBL_LOADING'=>'下载...',
-'LBL_VALIDATION_ERROR'=>'违例错误',
-'LBL_SELECT_OPTION_DOTDOTDOT'=>'选择项...',
-'LBL_WORKFLOW_NOTE_CRON_CONFIG'=>'注意:你必须配置工作流的核心脚本。',
-'LBL_NO_TEMPLATES'=>'没有模板',
-);
-
-
-?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/loadtemplates.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/loadtemplates.php
deleted file mode 100644
index 3f258573..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/loadtemplates.php
+++ /dev/null
@@ -1,26 +0,0 @@
-loadTemplates($str);
-}
-?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/modulefieldsjson.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/modulefieldsjson.php
deleted file mode 100644
index 4fdd057d..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/modulefieldsjson.php
+++ /dev/null
@@ -1,19 +0,0 @@
-getFieldLabels());
- }
- vtModuleTypeInfoJson($adb, $_REQUEST);
-?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/add.png b/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/add.png
deleted file mode 100644
index f13429ee..00000000
Binary files a/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/add.png and /dev/null differ
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/createeventtaskscript.js b/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/createeventtaskscript.js
deleted file mode 100644
index 4eee1088..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/createeventtaskscript.js
+++ /dev/null
@@ -1,106 +0,0 @@
-function VTCreateTodoTask($){
-
- var map = fn.map;
- var dict = fn.dict;
- var filter = fn.filter;
- var reduceR = fn.reduceR;
- var parallelExecuter = fn.parallelExecuter;
- var contains = fn.contains;
- var concat = fn.concat;
-
-
- function parse12HoursTime(timeStr){
- var hours;
-
- var match = timeStr.match(/(\d\d):(\d\d)(am|pm)/);
- if(match[3]=='am'){
- hours = parseInt(match[1], 10) % 12;
- }else{
- hours = parseInt(match[1], 10) % 12 + 12;
- }
- return hours*60+parseInt(match[2], 10);
- }
-
- function errorDialog(message){
- alert(message);
- }
-
- function index(arr, field){
- return dict(map(function(e){return [e[field], e];}, arr));
- }
-
- function handleError(fn){
- return function(status, result){
- if(status){
- fn(result);
- }else{
- errorDialog('Failure:'+result);
- }
- };
- }
-
- function fillPicklist(picklistId, fieldInfo, defaultValue){
- var values = fieldInfo['type']['picklistValues'];
- var select = $('#'+picklistId);
- $.each(values, function(i, v){
- select.append('');
- });
- select.attr('value', defaultValue);
- }
-
- var validateDateRange = {
- init: function(){
-
- },
- validator: function(){
- var result;
- var successResult = [true];
- var failureResult = [false, 'invalid_date_range_message', []];
- if(this.fieldValue('startDatefield') == this.fieldValue('endDatefield')){
- var startTime = this.fieldValue('startTime');
- var endTime = this.fieldValue('endTime');
- var startDays = parseInt(this.fieldValue('startDays'), 10);
- var endDays = parseInt(this.fieldValue('endDays'), 10);
- var startDirection = this.fieldValue('startDirection')=="After"?1:-1;
- var endDirection = this.fieldValue('endDirection')=="After"?1:-1;
- var dd = endDays*endDirection - startDays*startDirection;
- if(dd<0){
- result = failureResult;
- }else if(dd==0){
- if(parse12HoursTime(startTime)>=parse12HoursTime(startTime)){
- result = failureResult;
- }else{
- result = successResult;
- }
- }else{
- result = successResult;
- }
- }else{
- result = successResult;
- }
- return result;
- }
- };
-
- var vtinst = new VtigerWebservices("webservice.php");
- vtinst.extendSession(handleError(function(result){
- $(document).ready(function(){
- //Setup the validator
- validator.addValidator('validateDateRange', validateDateRange);
- validator.mandatoryFields.push('eventName');
-
- vtinst.describeObject('Events', handleError(function(result){
- var fields = result['fields'];
- var fieldsMap = index(fields, 'name');
- fillPicklist('event_status', fieldsMap['eventstatus'], eventStatus);
- $('#event_status_busyicon').hide();
- $('#event_status').show();
-
- fillPicklist('event_type', fieldsMap['activitytype'], eventType);
- $('#event_type_busyicon').hide();
- $('#event_type').show();
- }));
- });
- }));
-}
-VTCreateTodoTask(jQuery);
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/createtodotaskscript.js b/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/createtodotaskscript.js
deleted file mode 100644
index 5bd2af01..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/createtodotaskscript.js
+++ /dev/null
@@ -1,63 +0,0 @@
-function VTCreateTodoTask($){
-
- var map = fn.map;
- var dict = fn.dict;
- var filter = fn.filter;
- var reduceR = fn.reduceR;
- var parallelExecuter = fn.parallelExecuter;
- var contains = fn.contains;
- var concat = fn.concat;
-
- function errorDialog(message){
- alert(message);
- }
-
- function index(arr, field){
- return dict(map(function(e){return [e[field], e];}, arr));
- }
-
- function handleError(fn){
- return function(status, result){
- if(status){
- fn(result);
- }else{
- errorDialog('Failure:'+result);
- }
- }
- }
-
- var vtinst = new VtigerWebservices("webservice.php");
- vtinst.extendSession(handleError(function(result){
- $(document).ready(function(){
- //Setup the validator
- validator.mandatoryFields.push('todo');
-
- vtinst.describeObject('Calendar', handleError(function(result){
- var fields = result['fields'];
- var fieldsMap = index(fields, 'name');
- var eventStatusType = fieldsMap['taskstatus'];
- var eventStatusValues = eventStatusType['type']['picklistValues'];
-
- var taskPriorityType = fieldsMap['taskpriority'];
- var taskPriorityValues = taskPriorityType['type']['picklistValues'];
-
- var status = $('#task_status');
- $.each(eventStatusValues, function(i, v){
- status.append('');
- });
- status.attr('value', taskStatus);
- $('#task_status_busyicon').hide();
- $('#task_status').show();
-
- var priority = $('#task_priority');
- $.each(taskPriorityValues, function(i, v){
- priority.append('');
- });
- priority.attr('value', taskPriority);
- $('#task_priority_busyicon').hide();
- $('#task_priority').show();
- }));
- });
- }));
-}
-VTCreateTodoTask(jQuery);
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/edittaskscript.js b/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/edittaskscript.js
deleted file mode 100644
index 4a2e7016..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/edittaskscript.js
+++ /dev/null
@@ -1,51 +0,0 @@
-function edittaskscript($){
-
- function NumberBox(element){
- var elementId = element.attr("id");
- var boxId = '#'+elementId+'-number-box';
- var str = "";
- for(var i = 1; i <= 30; i++){
- str += ''+(i < 10? ("0"+i) : i)+' ';
- if(!(i % 5)){
- str+="
";
- }
- }
- element.after(''+str+'
');
- element.focus(function(){
- var pos = element.position();
- $(boxId).css('display', 'block');
- $(boxId).css({
- position: 'absolute',
- top: (pos.top+25)+'px'
- });
- });
-
- element.blur(function(){
- setTimeout(function(){$(boxId).css('display', 'none');},500);
- });
-
- $('.box_cel').click(function(){
- element.attr('value', parseInt($(this).text(), 10));
- });
- }
-
-
-
- $(document).ready(function(){
- validator = new VTFieldValidator($('#new_task_form'));
- validator.mandatoryFields = ['summary'];
- $('.time_field').timepicker();
- NumberBox($('#select_date_days'));
- //UI to set the date for executing the task.
- $('#check_select_date').click(function(){
- if($(this).attr('checked')){
- $('#select_date').css('display', 'block');
- }else{
- $('#select_date').css('display', 'none');
- }
- });
- $('#edittask_cancel_button').click(function(){
- window.location=returnUrl;
- });
- });
-}
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/editworkflowscript.js b/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/editworkflowscript.js
deleted file mode 100644
index 70b2e778..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/editworkflowscript.js
+++ /dev/null
@@ -1,499 +0,0 @@
-/*+********************************************************************************
- * The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is: vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
- ********************************************************************************/
-
-function editworkflowscript($, conditions){
- var vtinst = new VtigerWebservices("webservice.php");
- var fieldValidator;
- var desc = null;
-
- function id(v){
- return v;
- }
-
- function map(fn, list){
- var out = [];
- $.each(list, function(i, v){
- out[out.length]=fn(v);
- });
- return out;
- }
-
- function field(name){
- return function(object){
- if(typeof(object) != 'undefined') {
- return object[name];
- }
- };
- }
-
- function zip(){
- var out = [];
-
- var lengths = map(field('length'), arguments);
- var min = reduceR(function(a,b){return a'+e.label+'';},
- opType['picklistValues'])
- );
- value.replaceWith('');
- }
-
- function forInteger(opType, condno){
- var value = $(format("#save_condition_%s_value", condno));
- value.replaceWith(format('', condno));
- }
- var functions = {
- string:function(opType, condno){
- var value = $(format("#save_condition_%s_value", condno));
- value.replaceWith(format('', condno));
- },
- 'boolean': function(opType, condno){
- var value = $("#save_condition_"+condno+"_value");
- value.replaceWith(
- '');
- },
- integer: forInteger,
- picklist:forPicklist,
- multipicklist:forPicklist
- };
- var ret = functions[fieldType];
- if(ret==null){
- ret = functions['string'];
- }
- return ret;
- }
-
- var format = fn.format;
-
-
- function fillOptions(el,options){
- el.empty();
- $.each(options, function(k, v){
- el.append('');
- });
- }
-
- function resetFields(opType, condno){
- var ops = $("#save_condition_"+condno+"_operation");
- var selectedOperations = operations[opType.name];
- var l = dict(zip(selectedOperations, selectedOperations));
- fillOptions(ops, l);
- defaultValue(opType.name)(opType, condno);
- }
-
-
- function removeCondition(condno){
- $(format("#save_condition_%s", condno)).remove();
- }
-
- //Convert user type into reference for consistency in describe objects
- //This is done inplace
- function referencify(desc){
- var fields = desc['fields'];
- for(var i=0; i \
- \
- \
- \
- \
-
\
- '
- );
- var fe = $("#save_condition_"+condno+"_fieldname");
- var i = 1;
- fillOptions(fe, fieldLabels);
-
-
- var fullFieldName = fe.attr("value");
-
- resetFields(getFieldType(fullFieldName), condno);
-
- var re = $("#save_condition_"+condno+"_remove");
- re.bind("click", function(){
- removeCondition(condno);
- });
-
- fe.bind("change", function(){
- var select = $(this);
- var condNo = select.attr("id").match(/save_condition_(\d+)_fieldname/)[1];
- var fullFieldName = $(this).attr('value');
- resetFields(getFieldType(fullFieldName), condNo);
- });
- }
-
- var newTaskPopup = NewTaskPopup();
- $("#new_task").click(function(){
- newTaskPopup.show();
- });
-
- var newTemplatePopup = NewTemplatePopup();
- $("#new_template").click(function(){
- newTemplatePopup.show();
- });
-
- var condno=0;
- if(conditions){
- $.each(conditions, function(i, condition){
- var fieldname = condition["fieldname"];
- addCondition(condno);
- $(format("#save_condition_%s_fieldname", condno)).attr("value", fieldname);
- resetFields(getFieldType(fieldname), condno);
- $(format("#save_condition_%s_operation", condno)).attr("value", condition["operation"]);
- $('#dump').html(condition["value"]);
- var text = $('#dump').text();
- $(format("#save_condition_%s_value", condno)).attr("value", text);
- condno+=1;
- });
- }
-
- $("#save_conditions_add").bind("click", function(){
- addCondition(condno++);
- });
-
- $("#save_submit").bind("click", function(){
- var conditions = [];
- $("#save_conditions").children().each(function(i){
- var fieldname = $(this).children(".fieldname").attr("value");
- var operation = $(this).children(".operation").attr("value");
- var value = $(this).children(".value").attr("value");
- var condition = {fieldname:fieldname, operation:operation, value:value};
- conditions[i]=condition;
- });
- if(conditions.length==0){
- var out = "";
- }else{
- var out = JSON.stringify(conditions);
- }
- $("#save_conditions_json").attr("value", out);
- });
- pageLoadingPopup.close();
- $('#save_conditions_add').show();
- }));
- }));
- }));
- });
-
-}
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/emailtaskscript.js b/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/emailtaskscript.js
deleted file mode 100644
index 829f363c..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/resources/emailtaskscript.js
+++ /dev/null
@@ -1,280 +0,0 @@
-/*+********************************************************************************
- * The contents of this file are subject to the vtiger CRM Public License Version 1.0
- * ("License"); You may not use this file except in compliance with the License
- * The Original Code is: vtiger CRM Open Source
- * The Initial Developer of the Original Code is vtiger.
- * Portions created by vtiger are Copyright (C) vtiger.
- * All Rights Reserved.
- ********************************************************************************/
-
-function VTEmailTask($){
- var vtinst = new VtigerWebservices("webservice.php");
- var desc = null;
- var accessibleModulesInfo = null;
-
- var map = fn.map;
- var dict = fn.dict;
- var filter = fn.filter;
- var reduceR = fn.reduceR;
- var parallelExecuter = fn.parallelExecuter;
- var contains = fn.contains;
- var concat = fn.concat;
-
- function diff(reflist, list) {
- var out = [];
- $.each(list, function(i, v) {
- if(contains(reflist, v)) {
- out.push(v);
- }
- });
- return out;
- }
-
- //Display an error message.
- function errorDialog(message){
- alert(message);
- }
-
- //This is a wrapper to handle webservice errors.
- function handleError(fn){
- return function(status, result){
- if(status){
- fn(result);
- }else{
- errorDialog('Failure:'+result);
- }
- };
- }
-
- //Insert text at the cursor
- function insertAtCursor(element, value){
- //http://alexking.org/blog/2003/06/02/inserting-at-the-cursor-using-javascript
- if (document.selection) {
- element.focus();
- var sel = document.selection.createRange();
- sel.text = value;
- element.focus();
- }else if (element.selectionStart || element.selectionStart == '0') {
- var startPos = element.selectionStart;
- var endPos = element.selectionEnd;
- var scrollTop = element.scrollTop;
- element.value = element.value.substring(0, startPos)
- + value
- + element.value.substring(endPos,
- element.value.length);
- element.focus();
- element.selectionStart = startPos + value.length;
- element.selectionEnd = startPos + value.length;
- element.scrollTop = scrollTop;
- } else {
- element.value += value;
- element.focus();
- }
- }
-
- //Convert user type into reference for consistency in describe objects
- //This is done inplace
- function referencify(desc){
- var fields = desc['fields'];
- for(var i=0; i' + v + '');
- });
-
- }
-
- $(document).ready(function(){
- vtinst.extendSession(handleError(function(result){
- vtinst.listTypes(handleError(function(accessibleModules) {
- accessibleModulesInfo = accessibleModules;
-
- getDescribeObjects(accessibleModules, moduleName, handleError(function(modules){
- fillSelectBox('task-fieldnames', modules, moduleName);
- $('#task-fieldnames-busyicon').hide();
- $('#task-fieldnames').show();
- $('#task-fieldnames').change(function(){
- var textarea = CKEDITOR.instances.save_content;
- var value = '$'+jQuery(this).attr('value');
- textarea.insertHtml(value);
- });
-
- fillSelectBox('task-emailfields', modules, moduleName,
- function(e){return e['type']['name']=='email';});
- $('#task-emailfields-busyicon').hide();
- $('#task-emailfields').show();
- $('#task-emailfields').change(function(){
- var input = $($('#save_recepient').get());
- var value = '$'+$(this).attr('value');
- input.attr("value", input.attr("value")+','+value);
- });
- var selptype = document.getElementById('task-emailfields');
- var selecc = document.getElementById('task-emailfieldscc');
- for (ops=0;opsarguments.length){
- nparams = arguments.length;
- }
-
- var args = [];
- for(var i=0;i)[^>]*$|^#(\w+)$/,
-
-// Is it a simple selector
- isSimple = /^.[^:#\[\.]*$/,
-
-// Will speed up references to undefined, and allows munging its name.
- undefined;
-
-jQuery.fn = jQuery.prototype = {
- init: function( selector, context ) {
- // Make sure that a selection was provided
- selector = selector || document;
-
- // Handle $(DOMElement)
- if ( selector.nodeType ) {
- this[0] = selector;
- this.length = 1;
- return this;
- }
- // Handle HTML strings
- if ( typeof selector == "string" ) {
- // Are we dealing with HTML string or an ID?
- var match = quickExpr.exec( selector );
-
- // Verify a match, and that no context was specified for #id
- if ( match && (match[1] || !context) ) {
-
- // HANDLE: $(html) -> $(array)
- if ( match[1] )
- selector = jQuery.clean( [ match[1] ], context );
-
- // HANDLE: $("#id")
- else {
- var elem = document.getElementById( match[3] );
-
- // Make sure an element was located
- if ( elem ){
- // Handle the case where IE and Opera return items
- // by name instead of ID
- if ( elem.id != match[3] )
- return jQuery().find( selector );
-
- // Otherwise, we inject the element directly into the jQuery object
- return jQuery( elem );
- }
- selector = [];
- }
-
- // HANDLE: $(expr, [context])
- // (which is just equivalent to: $(content).find(expr)
- } else
- return jQuery( context ).find( selector );
-
- // HANDLE: $(function)
- // Shortcut for document ready
- } else if ( jQuery.isFunction( selector ) )
- return jQuery( document )[ jQuery.fn.ready ? "ready" : "load" ]( selector );
-
- return this.setArray(jQuery.makeArray(selector));
- },
-
- // The current version of jQuery being used
- jquery: "1.2.6",
-
- // The number of elements contained in the matched element set
- size: function() {
- return this.length;
- },
-
- // The number of elements contained in the matched element set
- length: 0,
-
- // Get the Nth element in the matched element set OR
- // Get the whole matched element set as a clean array
- get: function( num ) {
- return num == undefined ?
-
- // Return a 'clean' array
- jQuery.makeArray( this ) :
-
- // Return just the object
- this[ num ];
- },
-
- // Take an array of elements and push it onto the stack
- // (returning the new matched element set)
- pushStack: function( elems ) {
- // Build a new jQuery matched element set
- var ret = jQuery( elems );
-
- // Add the old object onto the stack (as a reference)
- ret.prevObject = this;
-
- // Return the newly-formed element set
- return ret;
- },
-
- // Force the current matched set of elements to become
- // the specified array of elements (destroying the stack in the process)
- // You should use pushStack() in order to do this, but maintain the stack
- setArray: function( elems ) {
- // Resetting the length to 0, then using the native Array push
- // is a super-fast way to populate an object with array-like properties
- this.length = 0;
- Array.prototype.push.apply( this, elems );
-
- return this;
- },
-
- // Execute a callback for every element in the matched set.
- // (You can seed the arguments with an array of args, but this is
- // only used internally.)
- each: function( callback, args ) {
- return jQuery.each( this, callback, args );
- },
-
- // Determine the position of an element within
- // the matched set of elements
- index: function( elem ) {
- var ret = -1;
-
- // Locate the position of the desired element
- return jQuery.inArray(
- // If it receives a jQuery object, the first element is used
- elem && elem.jquery ? elem[0] : elem
- , this );
- },
-
- attr: function( name, value, type ) {
- var options = name;
-
- // Look for the case where we're accessing a style value
- if ( name.constructor == String )
- if ( value === undefined )
- return this[0] && jQuery[ type || "attr" ]( this[0], name );
-
- else {
- options = {};
- options[ name ] = value;
- }
-
- // Check to see if we're setting style values
- return this.each(function(i){
- // Set all the styles
- for ( name in options )
- jQuery.attr(
- type ?
- this.style :
- this,
- name, jQuery.prop( this, options[ name ], type, i, name )
- );
- });
- },
-
- css: function( key, value ) {
- // ignore negative width and height values
- if ( (key == 'width' || key == 'height') && parseFloat(value) < 0 )
- value = undefined;
- return this.attr( key, value, "curCSS" );
- },
-
- text: function( text ) {
- if ( typeof text != "object" && text != null )
- return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
-
- var ret = "";
-
- jQuery.each( text || this, function(){
- jQuery.each( this.childNodes, function(){
- if ( this.nodeType != 8 )
- ret += this.nodeType != 1 ?
- this.nodeValue :
- jQuery.fn.text( [ this ] );
- });
- });
-
- return ret;
- },
-
- wrapAll: function( html ) {
- if ( this[0] )
- // The elements to wrap the target around
- jQuery( html, this[0].ownerDocument )
- .clone()
- .insertBefore( this[0] )
- .map(function(){
- var elem = this;
-
- while ( elem.firstChild )
- elem = elem.firstChild;
-
- return elem;
- })
- .append(this);
-
- return this;
- },
-
- wrapInner: function( html ) {
- return this.each(function(){
- jQuery( this ).contents().wrapAll( html );
- });
- },
-
- wrap: function( html ) {
- return this.each(function(){
- jQuery( this ).wrapAll( html );
- });
- },
-
- append: function() {
- return this.domManip(arguments, true, false, function(elem){
- if (this.nodeType == 1)
- this.appendChild( elem );
- });
- },
-
- prepend: function() {
- return this.domManip(arguments, true, true, function(elem){
- if (this.nodeType == 1)
- this.insertBefore( elem, this.firstChild );
- });
- },
-
- before: function() {
- return this.domManip(arguments, false, false, function(elem){
- this.parentNode.insertBefore( elem, this );
- });
- },
-
- after: function() {
- return this.domManip(arguments, false, true, function(elem){
- this.parentNode.insertBefore( elem, this.nextSibling );
- });
- },
-
- end: function() {
- return this.prevObject || jQuery( [] );
- },
-
- find: function( selector ) {
- var elems = jQuery.map(this, function(elem){
- return jQuery.find( selector, elem );
- });
-
- return this.pushStack( /[^+>] [^+>]/.test( selector ) || selector.indexOf("..") > -1 ?
- jQuery.unique( elems ) :
- elems );
- },
-
- clone: function( events ) {
- // Do the clone
- var ret = this.map(function(){
- if ( jQuery.browser.msie && !jQuery.isXMLDoc(this) ) {
- // IE copies events bound via attachEvent when
- // using cloneNode. Calling detachEvent on the
- // clone will also remove the events from the orignal
- // In order to get around this, we use innerHTML.
- // Unfortunately, this means some modifications to
- // attributes in IE that are actually only stored
- // as properties will not be copied (such as the
- // the name attribute on an input).
- var clone = this.cloneNode(true),
- container = document.createElement("div");
- container.appendChild(clone);
- return jQuery.clean([container.innerHTML])[0];
- } else
- return this.cloneNode(true);
- });
-
- // Need to set the expando to null on the cloned set if it exists
- // removeData doesn't work here, IE removes it from the original as well
- // this is primarily for IE but the data expando shouldn't be copied over in any browser
- var clone = ret.find("*").andSelf().each(function(){
- if ( this[ expando ] != undefined )
- this[ expando ] = null;
- });
-
- // Copy the events from the original to the clone
- if ( events === true )
- this.find("*").andSelf().each(function(i){
- if (this.nodeType == 3)
- return;
- var events = jQuery.data( this, "events" );
-
- for ( var type in events )
- for ( var handler in events[ type ] )
- jQuery.event.add( clone[ i ], type, events[ type ][ handler ], events[ type ][ handler ].data );
- });
-
- // Return the cloned set
- return ret;
- },
-
- filter: function( selector ) {
- return this.pushStack(
- jQuery.isFunction( selector ) &&
- jQuery.grep(this, function(elem, i){
- return selector.call( elem, i );
- }) ||
-
- jQuery.multiFilter( selector, this ) );
- },
-
- not: function( selector ) {
- if ( selector.constructor == String )
- // test special case where just one selector is passed in
- if ( isSimple.test( selector ) )
- return this.pushStack( jQuery.multiFilter( selector, this, true ) );
- else
- selector = jQuery.multiFilter( selector, this );
-
- var isArrayLike = selector.length && selector[selector.length - 1] !== undefined && !selector.nodeType;
- return this.filter(function() {
- return isArrayLike ? jQuery.inArray( this, selector ) < 0 : this != selector;
- });
- },
-
- add: function( selector ) {
- return this.pushStack( jQuery.unique( jQuery.merge(
- this.get(),
- typeof selector == 'string' ?
- jQuery( selector ) :
- jQuery.makeArray( selector )
- )));
- },
-
- is: function( selector ) {
- return !!selector && jQuery.multiFilter( selector, this ).length > 0;
- },
-
- hasClass: function( selector ) {
- return this.is( "." + selector );
- },
-
- val: function( value ) {
- if ( value == undefined ) {
-
- if ( this.length ) {
- var elem = this[0];
-
- // We need to handle select boxes special
- if ( jQuery.nodeName( elem, "select" ) ) {
- var index = elem.selectedIndex,
- values = [],
- options = elem.options,
- one = elem.type == "select-one";
-
- // Nothing was selected
- if ( index < 0 )
- return null;
-
- // Loop through all the selected options
- for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
- var option = options[ i ];
-
- if ( option.selected ) {
- // Get the specifc value for the option
- value = jQuery.browser.msie && !option.attributes.value.specified ? option.text : option.value;
-
- // We don't need an array for one selects
- if ( one )
- return value;
-
- // Multi-Selects return an array
- values.push( value );
- }
- }
-
- return values;
-
- // Everything else, we just grab the value
- } else
- return (this[0].value || "").replace(/\r/g, "");
-
- }
-
- return undefined;
- }
-
- if( value.constructor == Number )
- value += '';
-
- return this.each(function(){
- if ( this.nodeType != 1 )
- return;
-
- if ( value.constructor == Array && /radio|checkbox/.test( this.type ) )
- this.checked = (jQuery.inArray(this.value, value) >= 0 ||
- jQuery.inArray(this.name, value) >= 0);
-
- else if ( jQuery.nodeName( this, "select" ) ) {
- var values = jQuery.makeArray(value);
-
- jQuery( "option", this ).each(function(){
- this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
- jQuery.inArray( this.text, values ) >= 0);
- });
-
- if ( !values.length )
- this.selectedIndex = -1;
-
- } else
- this.value = value;
- });
- },
-
- html: function( value ) {
- return value == undefined ?
- (this[0] ?
- this[0].innerHTML :
- null) :
- this.empty().append( value );
- },
-
- replaceWith: function( value ) {
- return this.after( value ).remove();
- },
-
- eq: function( i ) {
- return this.slice( i, i + 1 );
- },
-
- slice: function() {
- return this.pushStack( Array.prototype.slice.apply( this, arguments ) );
- },
-
- map: function( callback ) {
- return this.pushStack( jQuery.map(this, function(elem, i){
- return callback.call( elem, i, elem );
- }));
- },
-
- andSelf: function() {
- return this.add( this.prevObject );
- },
-
- data: function( key, value ){
- var parts = key.split(".");
- parts[1] = parts[1] ? "." + parts[1] : "";
-
- if ( value === undefined ) {
- var data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
-
- if ( data === undefined && this.length )
- data = jQuery.data( this[0], key );
-
- return data === undefined && parts[1] ?
- this.data( parts[0] ) :
- data;
- } else
- return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function(){
- jQuery.data( this, key, value );
- });
- },
-
- removeData: function( key ){
- return this.each(function(){
- jQuery.removeData( this, key );
- });
- },
-
- domManip: function( args, table, reverse, callback ) {
- var clone = this.length > 1, elems;
-
- return this.each(function(){
- if ( !elems ) {
- elems = jQuery.clean( args, this.ownerDocument );
-
- if ( reverse )
- elems.reverse();
- }
-
- var obj = this;
-
- if ( table && jQuery.nodeName( this, "table" ) && jQuery.nodeName( elems[0], "tr" ) )
- obj = this.getElementsByTagName("tbody")[0] || this.appendChild( this.ownerDocument.createElement("tbody") );
-
- var scripts = jQuery( [] );
-
- jQuery.each(elems, function(){
- var elem = clone ?
- jQuery( this ).clone( true )[0] :
- this;
-
- // execute all scripts after the elements have been injected
- if ( jQuery.nodeName( elem, "script" ) )
- scripts = scripts.add( elem );
- else {
- // Remove any inner scripts for later evaluation
- if ( elem.nodeType == 1 )
- scripts = scripts.add( jQuery( "script", elem ).remove() );
-
- // Inject the elements into the document
- callback.call( obj, elem );
- }
- });
-
- scripts.each( evalScript );
- });
- }
-};
-
-// Give the init function the jQuery prototype for later instantiation
-jQuery.fn.init.prototype = jQuery.fn;
-
-function evalScript( i, elem ) {
- if ( elem.src )
- jQuery.ajax({
- url: elem.src,
- async: false,
- dataType: "script"
- });
-
- else
- jQuery.globalEval( elem.text || elem.textContent || elem.innerHTML || "" );
-
- if ( elem.parentNode )
- elem.parentNode.removeChild( elem );
-}
-
-function now(){
- return +new Date;
-}
-
-jQuery.extend = jQuery.fn.extend = function() {
- // copy reference to target object
- var target = arguments[0] || {}, i = 1, length = arguments.length, deep = false, options;
-
- // Handle a deep copy situation
- if ( target.constructor == Boolean ) {
- deep = target;
- target = arguments[1] || {};
- // skip the boolean and the target
- i = 2;
- }
-
- // Handle case when target is a string or something (possible in deep copy)
- if ( typeof target != "object" && typeof target != "function" )
- target = {};
-
- // extend jQuery itself if only one argument is passed
- if ( length == i ) {
- target = this;
- --i;
- }
-
- for ( ; i < length; i++ )
- // Only deal with non-null/undefined values
- if ( (options = arguments[ i ]) != null )
- // Extend the base object
- for ( var name in options ) {
- var src = target[ name ], copy = options[ name ];
-
- // Prevent never-ending loop
- if ( target === copy )
- continue;
-
- // Recurse if we're merging object values
- if ( deep && copy && typeof copy == "object" && !copy.nodeType )
- target[ name ] = jQuery.extend( deep,
- // Never move original objects, clone them
- src || ( copy.length != null ? [ ] : { } )
- , copy );
-
- // Don't bring in undefined values
- else if ( copy !== undefined )
- target[ name ] = copy;
-
- }
-
- // Return the modified object
- return target;
-};
-
-var expando = "jQuery" + now(), uuid = 0, windowData = {},
- // exclude the following css properties to add px
- exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i,
- // cache defaultView
- defaultView = document.defaultView || {};
-
-jQuery.extend({
- noConflict: function( deep ) {
- window.$ = _$;
-
- if ( deep )
- window.jQuery = _jQuery;
-
- return jQuery;
- },
-
- // See test/unit/core.js for details concerning this function.
- isFunction: function( fn ) {
- return !!fn && typeof fn != "string" && !fn.nodeName &&
- fn.constructor != Array && /^[\s[]?function/.test( fn + "" );
- },
-
- // check if an element is in a (or is an) XML document
- isXMLDoc: function( elem ) {
- return elem.documentElement && !elem.body ||
- elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
- },
-
- // Evalulates a script in a global context
- globalEval: function( data ) {
- data = jQuery.trim( data );
-
- if ( data ) {
- // Inspired by code by Andrea Giammarchi
- // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html
- var head = document.getElementsByTagName("head")[0] || document.documentElement,
- script = document.createElement("script");
-
- script.type = "text/javascript";
- if ( jQuery.browser.msie )
- script.text = data;
- else
- script.appendChild( document.createTextNode( data ) );
-
- // Use insertBefore instead of appendChild to circumvent an IE6 bug.
- // This arises when a base node is used (#2709).
- head.insertBefore( script, head.firstChild );
- head.removeChild( script );
- }
- },
-
- nodeName: function( elem, name ) {
- return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
- },
-
- cache: {},
-
- data: function( elem, name, data ) {
- elem = elem == window ?
- windowData :
- elem;
-
- var id = elem[ expando ];
-
- // Compute a unique ID for the element
- if ( !id )
- id = elem[ expando ] = ++uuid;
-
- // Only generate the data cache if we're
- // trying to access or manipulate it
- if ( name && !jQuery.cache[ id ] )
- jQuery.cache[ id ] = {};
-
- // Prevent overriding the named cache with undefined values
- if ( data !== undefined )
- jQuery.cache[ id ][ name ] = data;
-
- // Return the named cache data, or the ID for the element
- return name ?
- jQuery.cache[ id ][ name ] :
- id;
- },
-
- removeData: function( elem, name ) {
- elem = elem == window ?
- windowData :
- elem;
-
- var id = elem[ expando ];
-
- // If we want to remove a specific section of the element's data
- if ( name ) {
- if ( jQuery.cache[ id ] ) {
- // Remove the section of cache data
- delete jQuery.cache[ id ][ name ];
-
- // If we've removed all the data, remove the element's cache
- name = "";
-
- for ( name in jQuery.cache[ id ] )
- break;
-
- if ( !name )
- jQuery.removeData( elem );
- }
-
- // Otherwise, we want to remove all of the element's data
- } else {
- // Clean up the element expando
- try {
- delete elem[ expando ];
- } catch(e){
- // IE has trouble directly removing the expando
- // but it's ok with using removeAttribute
- if ( elem.removeAttribute )
- elem.removeAttribute( expando );
- }
-
- // Completely remove the data cache
- delete jQuery.cache[ id ];
- }
- },
-
- // args is for internal usage only
- each: function( object, callback, args ) {
- var name, i = 0, length = object.length;
-
- if ( args ) {
- if ( length == undefined ) {
- for ( name in object )
- if ( callback.apply( object[ name ], args ) === false )
- break;
- } else
- for ( ; i < length; )
- if ( callback.apply( object[ i++ ], args ) === false )
- break;
-
- // A special, fast, case for the most common use of each
- } else {
- if ( length == undefined ) {
- for ( name in object )
- if ( callback.call( object[ name ], name, object[ name ] ) === false )
- break;
- } else
- for ( var value = object[0];
- i < length && callback.call( value, i, value ) !== false; value = object[++i] ){}
- }
-
- return object;
- },
-
- prop: function( elem, value, type, i, name ) {
- // Handle executable functions
- if ( jQuery.isFunction( value ) )
- value = value.call( elem, i );
-
- // Handle passing in a number to a CSS property
- return value && value.constructor == Number && type == "curCSS" && !exclude.test( name ) ?
- value + "px" :
- value;
- },
-
- className: {
- // internal only, use addClass("class")
- add: function( elem, classNames ) {
- jQuery.each((classNames || "").split(/\s+/), function(i, className){
- if ( elem.nodeType == 1 && !jQuery.className.has( elem.className, className ) )
- elem.className += (elem.className ? " " : "") + className;
- });
- },
-
- // internal only, use removeClass("class")
- remove: function( elem, classNames ) {
- if (elem.nodeType == 1)
- elem.className = classNames != undefined ?
- jQuery.grep(elem.className.split(/\s+/), function(className){
- return !jQuery.className.has( classNames, className );
- }).join(" ") :
- "";
- },
-
- // internal only, use hasClass("class")
- has: function( elem, className ) {
- return jQuery.inArray( className, (elem.className || elem).toString().split(/\s+/) ) > -1;
- }
- },
-
- // A method for quickly swapping in/out CSS properties to get correct calculations
- swap: function( elem, options, callback ) {
- var old = {};
- // Remember the old values, and insert the new ones
- for ( var name in options ) {
- old[ name ] = elem.style[ name ];
- elem.style[ name ] = options[ name ];
- }
-
- callback.call( elem );
-
- // Revert the old values
- for ( var name in options )
- elem.style[ name ] = old[ name ];
- },
-
- css: function( elem, name, force ) {
- if ( name == "width" || name == "height" ) {
- var val, props = { position: "absolute", visibility: "hidden", display:"block" }, which = name == "width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ];
-
- function getWH() {
- val = name == "width" ? elem.offsetWidth : elem.offsetHeight;
- var padding = 0, border = 0;
- jQuery.each( which, function() {
- padding += parseFloat(jQuery.curCSS( elem, "padding" + this, true)) || 0;
- border += parseFloat(jQuery.curCSS( elem, "border" + this + "Width", true)) || 0;
- });
- val -= Math.round(padding + border);
- }
-
- if ( jQuery(elem).is(":visible") )
- getWH();
- else
- jQuery.swap( elem, props, getWH );
-
- return Math.max(0, val);
- }
-
- return jQuery.curCSS( elem, name, force );
- },
-
- curCSS: function( elem, name, force ) {
- var ret, style = elem.style;
-
- // A helper method for determining if an element's values are broken
- function color( elem ) {
- if ( !jQuery.browser.safari )
- return false;
-
- // defaultView is cached
- var ret = defaultView.getComputedStyle( elem, null );
- return !ret || ret.getPropertyValue("color") == "";
- }
-
- // We need to handle opacity special in IE
- if ( name == "opacity" && jQuery.browser.msie ) {
- ret = jQuery.attr( style, "opacity" );
-
- return ret == "" ?
- "1" :
- ret;
- }
- // Opera sometimes will give the wrong display answer, this fixes it, see #2037
- if ( jQuery.browser.opera && name == "display" ) {
- var save = style.outline;
- style.outline = "0 solid black";
- style.outline = save;
- }
-
- // Make sure we're using the right name for getting the float value
- if ( name.match( /float/i ) )
- name = styleFloat;
-
- if ( !force && style && style[ name ] )
- ret = style[ name ];
-
- else if ( defaultView.getComputedStyle ) {
-
- // Only "float" is needed here
- if ( name.match( /float/i ) )
- name = "float";
-
- name = name.replace( /([A-Z])/g, "-$1" ).toLowerCase();
-
- var computedStyle = defaultView.getComputedStyle( elem, null );
-
- if ( computedStyle && !color( elem ) )
- ret = computedStyle.getPropertyValue( name );
-
- // If the element isn't reporting its values properly in Safari
- // then some display: none elements are involved
- else {
- var swap = [], stack = [], a = elem, i = 0;
-
- // Locate all of the parent display: none elements
- for ( ; a && color(a); a = a.parentNode )
- stack.unshift(a);
-
- // Go through and make them visible, but in reverse
- // (It would be better if we knew the exact display type that they had)
- for ( ; i < stack.length; i++ )
- if ( color( stack[ i ] ) ) {
- swap[ i ] = stack[ i ].style.display;
- stack[ i ].style.display = "block";
- }
-
- // Since we flip the display style, we have to handle that
- // one special, otherwise get the value
- ret = name == "display" && swap[ stack.length - 1 ] != null ?
- "none" :
- ( computedStyle && computedStyle.getPropertyValue( name ) ) || "";
-
- // Finally, revert the display styles back
- for ( i = 0; i < swap.length; i++ )
- if ( swap[ i ] != null )
- stack[ i ].style.display = swap[ i ];
- }
-
- // We should always get a number back from opacity
- if ( name == "opacity" && ret == "" )
- ret = "1";
-
- } else if ( elem.currentStyle ) {
- var camelCase = name.replace(/\-(\w)/g, function(all, letter){
- return letter.toUpperCase();
- });
-
- ret = elem.currentStyle[ name ] || elem.currentStyle[ camelCase ];
-
- // From the awesome hack by Dean Edwards
- // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
-
- // If we're not dealing with a regular pixel number
- // but a number that has a weird ending, we need to convert it to pixels
- if ( !/^\d+(px)?$/i.test( ret ) && /^\d/.test( ret ) ) {
- // Remember the original values
- var left = style.left, rsLeft = elem.runtimeStyle.left;
-
- // Put in the new values to get a computed value out
- elem.runtimeStyle.left = elem.currentStyle.left;
- style.left = ret || 0;
- ret = style.pixelLeft + "px";
-
- // Revert the changed values
- style.left = left;
- elem.runtimeStyle.left = rsLeft;
- }
- }
-
- return ret;
- },
-
- clean: function( elems, context ) {
- var ret = [];
- context = context || document;
- // !context.createElement fails in IE with an error but returns typeof 'object'
- if (typeof context.createElement == 'undefined')
- context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
-
- jQuery.each(elems, function(i, elem){
- if ( !elem )
- return;
-
- if ( elem.constructor == Number )
- elem += '';
-
- // Convert html string into DOM nodes
- if ( typeof elem == "string" ) {
- // Fix "XHTML"-style tags in all browsers
- elem = elem.replace(/(<(\w+)[^>]*?)\/>/g, function(all, front, tag){
- return tag.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i) ?
- all :
- front + ">" + tag + ">";
- });
-
- // Trim whitespace, otherwise indexOf won't work as expected
- var tags = jQuery.trim( elem ).toLowerCase(), div = context.createElement("div");
-
- var wrap =
- // option or optgroup
- !tags.indexOf("", "" ] ||
-
- !tags.indexOf("", "" ] ||
-
- tags.match(/^<(thead|tbody|tfoot|colg|cap)/) &&
- [ 1, "" ] ||
-
- !tags.indexOf("
", "" ] ||
-
- // matched above
- (!tags.indexOf(" | ", "
" ] ||
-
- !tags.indexOf("", "" ] ||
-
- // IE can't serialize and
- Return
-
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/savetemplate.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/savetemplate.php
deleted file mode 100644
index 4b5c489c..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/savetemplate.php
+++ /dev/null
@@ -1,46 +0,0 @@
-name);
-
- if(!$util->checkAdminAccess()){
- $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
- $util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
- return;
- }
-
- $title = $request['title'];
- $workflowId = $request['workflow_id'];
- $wfs = new VTworkflowManager($adb);
- $workflow = $wfs->retrieve($workflowId);
- $tm = new VTWorkflowTemplateManager($adb);
- $tpl = $tm->newTemplate($title, $workflow);
- $tm->saveTemplate($tpl);
- $returnUrl = $request['return_url'];
- ?>
-
- Return
-
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/saveworkflow.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/saveworkflow.php
deleted file mode 100644
index a4d49b4c..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/saveworkflow.php
+++ /dev/null
@@ -1,68 +0,0 @@
-name);
-
- if(!$util->checkAdminAccess()){
- $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
- $util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
- return;
- }
-
- $description = $request["description"];
- $moduleName = $request["module_name"];
- $conditions = $request["conditions"];
- $taskId = $request["task_id"];
- $saveType=$request["save_type"];
- $executionCondition = $request['execution_condition'];
- $wm = new VTWorkflowManager($adb);
- if($saveType=='new'){
- $wf = $wm->newWorkflow($moduleName);
- $wf->description = $description;
- $wf->test = $conditions;
- $wf->taskId = $taskId;
- $wf->executionConditionAsLabel($executionCondition);
- $wm->save($wf);
- }else if($saveType=='edit'){
- $wf = $wm->retrieve($request["workflow_id"]);
- $wf->description = $description;
- $wf->test = $conditions;
- $wf->taskId = $taskId;
- $wf->executionConditionAsLabel($executionCondition);
- $wm->save($wf);
- }else{
- throw new Exception();
- }
- if(isset($request["return_url"])){
- $returnUrl=$request["return_url"];
- }else{
- $returnUrl=$module->editWorkflowUrl($wf->id);
- }
- ?>
-
- Return
-
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/sortfieldsjson.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/sortfieldsjson.php
deleted file mode 100644
index 55e83270..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/sortfieldsjson.php
+++ /dev/null
@@ -1,17 +0,0 @@
-sortby_fields);
- }
- vtSortFieldsJson($_REQUEST);
-?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/tasklist.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/tasklist.php
deleted file mode 100644
index de7ea0f2..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/tasklist.php
+++ /dev/null
@@ -1,51 +0,0 @@
-name);
-
- if(!$util->checkAdminAccess()){
- $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
- $util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
- return;
- }
-
- $smarty = new vtigerCRM_Smarty();
- $tm = new VTTaskManager($adb);
- $smarty->assign("tasks", $tm->getTasks());
- $smarty->assign("moduleNames", array("Contacts", "Applications"));
- $smarty->assign("taskTypes", array("VTEmailTask", "VTDummyTask"));
- $smarty->assign("returnUrl", $requestUrl);
-
- $smarty->assign("MOD", return_module_language($current_language,'Settings'));
- $smarty->assign("APP", $app_strings);
- $smarty->assign("THEME", $theme);
- $smarty->assign("IMAGE_PATH",$image_path);
- $smarty->assign("MODULE_NAME", $module->label);
- $smarty->assign("PAGE_NAME", 'Task List');
- $smarty->assign("PAGE_TITLE", 'List available tasks');
- $smarty->assign("moduleName", $moduleName);
- $smarty->display("{$module->name}/ListTasks.tpl");
- }
- vtDisplayTaskList($adb, $_SERVER["REQUEST_URI"], $current_language);
-?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTCreateEntityTask.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTCreateEntityTask.inc
deleted file mode 100644
index d12c03cc..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTCreateEntityTask.inc
+++ /dev/null
@@ -1,18 +0,0 @@
-
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTCreateEventTask.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTCreateEventTask.inc
deleted file mode 100644
index bc050993..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTCreateEventTask.inc
+++ /dev/null
@@ -1,146 +0,0 @@
-retrieveCurrentUserInfoFromFile(1);
- global $current_user;
- $this->originalUser = $current_user;
- $current_user = $user;
- return $user;
- }
-
- public function doTask($entityData){
- global $adb, $current_user;
- $userId = $entityData->get('assigned_user_id');
- if($userId===null){
- $userId = vtws_getWebserviceEntityId('Users', 1);;
- }
-
- $startDate = $this->calculateDate($entityData, $this->startDays,
- $this->startDirection, $this->startDatefield);
- $endDate = $this->calculateDate($entityData, $this->endDays,
- $this->endDirection, $this->endDatefield);
-
- $fields = array(
- 'activitytype'=>$this->eventType,
- 'description'=>$this->description,
- 'subject'=>$this->eventName,
- 'taskpriority'=>$this->priority,
- 'eventstatus'=>$this->status,
- 'assigned_user_id'=>$userId,
- 'time_start'=>self::conv12to24hour($this->startTime),
- 'date_start'=>$startDate,
- 'time_end'=>self::conv12to24hour($this->endTime),
- 'due_date'=>$endDate,
- 'visibility'=>'all',
- 'taskstatus'=>'',
- 'duration_hours'=>'0'
- );
-
- $_REQUEST['date_start'] = getDisplayDate($startDate);
- $_REQUEST['due_date'] = getDisplayDate($endDate);
- $_REQUEST['recurringcheck']=$this->recurringcheck;
- $_REQUEST['repeat_frequency']=$this->repeat_frequency;
- $_REQUEST['recurringtype']=$this->recurringtype;
- $_REQUEST['calendar_repeat_limit_date']=getDisplayDate($this->calendar_repeat_limit_date);
- $_REQUEST['mon_flag']=$this->mon_flag;
- $_REQUEST['tue_flag']=$this->tue_flag;
- $_REQUEST['wed_flag']=$this->wed_flag;
- $_REQUEST['thu_flag']=$this->thu_flag;
- $_REQUEST['fri_flag']=$this->fri_flag;
- $_REQUEST['sat_flag']=$this->sat_flag;
- $_REQUEST['sun_flag']=$this->sun_flag;
- $_REQUEST['repeatMonth']=$this->repeatMonth;
- $_REQUEST['repeatMonth_date']=$this->repeatMonth_date;
- $_REQUEST['repeatMonth_daytype']=$this->repeatMonth_daytype;
- $_REQUEST['repeatMonth_day']=$this->repeatMonth_day;
-
- $moduleName = $entityData->getModuleName();
- $adminUser = $this->getAdmin();
- $id = $entityData->getId();
- if($moduleName=='Contacts'){
- $fields['contact_id'] = $id;
- }else{
- $data = vtws_describe('Calendar', $adminUser);
- $fieldInfo = $data['fields'];
- foreach($fieldInfo as $field){
- if($field['name']=='parent_id'){
- $parentIdField = $field;
- }
- }
- $refersTo = $parentIdField['type']['refersTo'];
-
- if(in_array($moduleName, $refersTo)){
- $fields['parent_id'] = $id;
- }
- }
-
- $event = vtws_create('Events', $fields, $adminUser);
- list($typeId, $id) = vtws_getIdComponents($event['id']);
- $event = CRMEntity::getInstance('Events');
- $event->id = $id;
- $startDate = $entityData->get($this->startDatefield);
- if($this->recurringcheck && !empty($startDate) &&
- ($this->calendar_repeat_limit_date)) {
- include_once 'modules/Calendar/RepeatEvents.php';
- Calendar_RepeatEvents::repeat($event);
- }
- global $current_user;
- $current_user = $this->originalUser;
- }
-
- private function calculateDate($entityData, $days, $direction, $datefield){
- $baseDate = $entityData->get($datefield);
- preg_match('/\d\d\d\d-\d\d-\d\d/', $baseDate, $match);
- $baseDate = strtotime($match[0]);
- $date = strftime('%Y-%m-%d', $baseDate+$days*24*60*60*
- ($direction=='Before'?-1:1));
- return $date;
- }
-
- static function conv12to24hour($timeStr){
- $arr = array();
- preg_match('/(\d{1,2}):(\d{1,2})(am|pm)/', $timeStr, $arr);
- if($arr[3]=='am'){
- $hours = ((int)$arr[1]) % 12;
- }else{
- $hours = ((int)$arr[1]) % 12 + 12;
- }
- return str_pad($hours, 2, '0', STR_PAD_LEFT).':'.str_pad($arr[2], 2, '0', STR_PAD_LEFT);
- }
-}
-?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTCreateTodoTask.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTCreateTodoTask.inc
deleted file mode 100644
index 82c04e28..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTCreateTodoTask.inc
+++ /dev/null
@@ -1,103 +0,0 @@
-retrieveCurrentUserInfoFromFile(1);
- global $current_user;
- $this->originalUser = $current_user;
- $current_user = $user;
- return $user;
- }
-
- public function doTask($entityData){
- global $adb, $current_user;
- $userId = $entityData->get('assigned_user_id');
- if($userId===null){
- $userId = vtws_getWebserviceEntityId('Users', 1);;
- }
-
- $baseDate = $entityData->get($this->datefield);
- $time = explode(' ',$baseDate);
- if(count($time) < 2) {
- $time[] = date('H:i');
- }
- preg_match('/\d\d\d\d-\d\d-\d\d/', $baseDate, $match);
- $baseDate = strtotime($match[0]);
- $date = strftime('%Y-%m-%d', $baseDate+$this->days*24*60*60*($this->directions=='Before'?-1:1));
- $fields = array(
- 'activitytype'=>'Task',
- 'description'=>$this->description,
- 'subject'=>$this->todo,
- 'taskpriority'=>$this->priority,
- 'taskstatus'=>$this->status,
- 'assigned_user_id'=>$userId,
- 'time_start'=>$time[1],
- 'sendnotification'=>$this->sendNotification!=''?1:0,
- 'date_start'=>$date,
- 'due_date'=>$date,
- 'visibility'=>'all',
- 'eventstatus'=>''
- );
- $moduleName = $entityData->getModuleName();
- $adminUser = $this->getAdmin();
- $id = $entityData->getId();
- if($moduleName=='Contacts'){
- $fields['contact_id'] = $id;
- }else{
- $data = vtws_describe('Calendar', $adminUser);
- $fieldInfo = $data['fields'];
- foreach($fieldInfo as $field){
- if($field['name']=='parent_id'){
- $parentIdField = $field;
- }
- }
- $refersTo = $parentIdField['type']['refersTo'];
-
- if(in_array($moduleName, $refersTo)){
- $fields['parent_id'] = $id;
- }
- }
-
- vtws_create('Calendar', $fields, $adminUser);
- global $current_user;
- $current_user = $this->originalUser;
- }
-
- static function conv12to24hour($timeStr){
- $arr = array();
- preg_match('/(\d{1,2}):(\d{1,2})(am|pm)/', $timeStr, $arr);
- if($arr[3]=='am'){
- $hours = ((int)$arr[1]) % 12;
- }else{
- $hours = ((int)$arr[1]) % 12 + 12;
- }
- return str_pad($hours, 2, '0', STR_PAD_LEFT).':'.str_pad($arr[2], 2, '0', STR_PAD_LEFT);
- }
-}
-?>
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTDummyTask.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTDummyTask.inc
deleted file mode 100644
index b936cd74..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTDummyTask.inc
+++ /dev/null
@@ -1,19 +0,0 @@
-statement;
- echo "This is a dummy workflow task with $statement";
- }
-}
-?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTEmailTask.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTEmailTask.inc
deleted file mode 100644
index b675e48f..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTEmailTask.inc
+++ /dev/null
@@ -1,54 +0,0 @@
-query("select user_name, email1, email2 from vtiger_users where id=1");
- $from_email = $adb->query_result($result,0,'email1');
- $from_name = $adb->query_result($result,0,'user_name');
-
- $admin = $util->adminUser();
- $module = $entity->getModuleName();
-
- $entityCache = new VTEntityCache($admin);
-
- $et = new VTEmailRecipientsTemplate($this->recepient);
- $to_email = $et->render($entityCache, $entity->getId());
- $ecct = new VTEmailRecipientsTemplate($this->emailcc);
- $cc = $ecct->render($entityCache, $entity->getId());
- $ebcct = new VTEmailRecipientsTemplate($this->emailbcc);
- $bcc = $ebcct->render($entityCache, $entity->getId());
- if(strlen(trim($to_email, " \t\n,")) == 0 && strlen(trim($cc, " \t\n,")) == 0 &&
- strlen(trim($bcc, " \t\n,")) == 0) {
- return ;
- }
-
- $st = new VTSimpleTemplate($this->subject);
- $subject = $st->render($entityCache, $entity->getId());
- $ct = new VTSimpleTemplate($this->content);
- $content = $ct->render($entityCache, $entity->getId());
- send_mail($module,$to_email,$from_name,$from_email,$subject,$content, $cc, $bcc);
-
- $util->revertUser();
- }
-}
-?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTEntityMethodTask.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTEntityMethodTask.inc
deleted file mode 100644
index ad4d4fbd..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTEntityMethodTask.inc
+++ /dev/null
@@ -1,22 +0,0 @@
-executeMethod($entityData, $this->methodName);
- }
-}
-?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTSMSTask.inc b/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTSMSTask.inc
deleted file mode 100644
index d3bc0721..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/tasks/VTSMSTask.inc
+++ /dev/null
@@ -1,12 +0,0 @@
-
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/templatesformodulejson.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/templatesformodulejson.php
deleted file mode 100644
index 4bcbbf7d..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/templatesformodulejson.php
+++ /dev/null
@@ -1,23 +0,0 @@
-getTemplatesForModule($moduleName);
- $arr = array();
- foreach($templates as $template){
- $arr[] = array("title"=>$template->title, 'id'=>$template->id);
- }
- echo Zend_Json::encode($arr);
-}
-vtTemplatesForModuleJson($adb, $_REQUEST);
-?>
\ No newline at end of file
diff --git a/oss/vtiger/trunk/modules/com_vtiger_workflow/workflowlist.php b/oss/vtiger/trunk/modules/com_vtiger_workflow/workflowlist.php
deleted file mode 100644
index 275b0cee..00000000
--- a/oss/vtiger/trunk/modules/com_vtiger_workflow/workflowlist.php
+++ /dev/null
@@ -1,74 +0,0 @@
-pquery($sql,array($modules_not_supported)));
- $modules = array();
- foreach($it as $row){
- $modules[] = $row->name;
- }
- return $modules;
-}
-
-function vtDisplayWorkflowList($adb, $request, $requestUrl, $app_strings, $current_language){
- global $theme;
- $image_path = "themes/$theme/images/";
-
- $module = new VTWorkflowApplication("workflowlist");
- $util = new VTWorkflowUtils();
- $mod = return_module_language($current_language, $module->name);
-
- if(!$util->checkAdminAccess()){
- $errorUrl = $module->errorPageUrl($mod['LBL_ERROR_NOT_ADMIN']);
- $util->redirectTo($errorUrl, $mod['LBL_ERROR_NOT_ADMIN']);
- return;
- }
-
- $smarty = new vtigerCRM_Smarty();
- $wfs = new VTWorkflowManager($adb);
- $smarty->assign("moduleNames", $util->vtGetModules($adb));
- $smarty->assign("returnUrl", $requestUrl);
-
- $listModule =$request['list_module'];
- $smarty->assign("listModule", $listModule);
- if($listModule==null || strtolower($listModule)=="all"){
- $smarty->assign("workflows", $wfs->getWorkflows());
- }else{
- $smarty->assign("workflows", $wfs->getWorkflowsForModule($listModule));
- }
-
- $smarty->assign("MOD",array_merge(
- return_module_language($current_language,'Settings'),
- return_module_language($current_language, $module->name)));
- $smarty->assign("APP", $app_strings);
- $smarty->assign("THEME", $theme);
- $smarty->assign("IMAGE_PATH",$image_path);
- $smarty->assign("MODULE_NAME", $module->label);
- $smarty->assign("PAGE_NAME", $mod['LBL_WORKFLOW_LIST']);
- $smarty->assign("PAGE_TITLE", $mod['LBL_AVAILABLE_WORKLIST_LIST']);
- $smarty->assign("module", $module);
- $smarty->display("{$module->name}/ListWorkflows.tpl");
-}
-vtDisplayWorkflowList($adb, $_REQUEST, $_SERVER["REQUEST_URI"], $app_strings, $current_language);
-?>