From 550e7bcc062b33e992f28d80a2d92f263534c3d7 Mon Sep 17 00:00:00 2001 From: Gustavo Cruz Date: Fri, 13 Feb 2015 16:19:01 -0400 Subject: [PATCH] Adding the features ui adhoc --- .gitignore | 1 + gulliver/js/codemirror/addon/hint/php-hint.js | 534 ++++---- .../classes/features/ConfigurationHandler.php | 10 + .../classes/features/EnterpriseFeature.php | 20 + .../classes/features/ExtensionManager.php | 20 + .../classes/features/FeatureHandler.php | 10 + .../features/ViewContainers/TaskContainer.php | 10 + .../ViewContainers/TriggerContainer.php | 10 + .../features/ViewContainers/ViewContainer.php | 25 + .../features/actionsByEmail/ActionByEmail.php | 6 + .../actionsByEmail/ActionsByEmailFeature.php | 30 + .../actionsByEmail/actionsByEmail.php | 117 ++ .../actionsByEmail/actionsByEmail.xml | 11 + .../actionsByEmail/actionsByEmailAjax.php | 514 +++++++ .../actionsByEmail_FileEdit.html | 33 + .../actionsByEmail_FileEdit.xml | 40 + .../actionsByEmail/class.actionsByEmail.php | 230 ++++ .../classes/model/AbeConfiguration.php | 97 ++ .../classes/model/AbeConfigurationPeer.php | 25 + .../classes/model/AbeRequests.php | 87 ++ .../classes/model/AbeRequestsPeer.php | 24 + .../classes/model/AbeResponses.php | 88 ++ .../classes/model/AbeResponsesPeer.php | 25 + .../model/map/AbeConfigurationMapBuilder.php | 93 ++ .../model/map/AbeRequestsMapBuilder.php | 89 ++ .../model/map/AbeResponsesMapBuilder.php | 83 ++ .../classes/model/om/BaseAbeConfiguration.php | 1196 +++++++++++++++++ .../model/om/BaseAbeConfigurationPeer.php | 632 +++++++++ .../classes/model/om/BaseAbeRequests.php | 1060 +++++++++++++++ .../classes/model/om/BaseAbeRequestsPeer.php | 615 +++++++++ .../classes/model/om/BaseAbeResponses.php | 886 ++++++++++++ .../classes/model/om/BaseAbeResponsesPeer.php | 610 +++++++++ .../features/actionsByEmail/config/propel.ini | 44 + .../actionsByEmail/config/propel.mysql.ini | 44 + .../config/schema-transformed.xml | 2 + .../features/actionsByEmail/config/schema.xml | 328 +++++ .../actionsByEmail/configActionsByEmail.html | 52 + .../actionsByEmail/configActionsByEmail.php | 67 + .../actionsByEmail/configActionsByEmail.xml | 215 +++ .../actionsByEmail/data/actionsByEmail.html | 18 + .../data/actionsByEmailPartner.html | 18 + .../features/actionsByEmail/data/schema.sql | 58 + .../features/actionsByEmail/data/sqldb.map | 2 + .../documentation/CaseActionsByEmail.png | Bin 0 -> 12527 bytes .../documentation/CaseNoteTask1.png | Bin 0 -> 31660 bytes .../documentation/ConfigurationTask1.png | Bin 0 -> 17324 bytes .../documentation/ConfigurationTask2.png | Bin 0 -> 19666 bytes .../documentation/FormTask1.png | Bin 0 -> 43451 bytes .../actionsByEmail/documentation/Process1.png | Bin 0 -> 7536 bytes .../documentation/ProcessActions.png | Bin 0 -> 17361 bytes .../documentation/ProcessActions1.png | Bin 0 -> 27156 bytes .../documentation/ProcessActions2.png | Bin 0 -> 35279 bytes .../documentation/ProcessFrm1.png | Bin 0 -> 6954 bytes .../documentation/ResponseTask1.png | Bin 0 -> 42241 bytes .../documentation/ResponseTask2.png | Bin 0 -> 27026 bytes .../documentation/VerifyTask1.png | Bin 0 -> 37787 bytes .../documentation/VerifyTask2.png | Bin 0 -> 32583 bytes .../documentation/emailTask1.png | Bin 0 -> 95507 bytes .../documentation/emailTask2.png | Bin 0 -> 216180 bytes .../actionsByEmail/documentation/overview.php | 176 +++ .../features/actionsByEmail/externalStep.php | 3 + .../features/actionsByEmail/menusetup.php | 5 + .../features/actionsByEmail/pluginConfig.ini | 9 + .../classes/features/actionsByEmail/report.js | 231 ++++ .../actionsByEmail/services/dataField.php | 109 ++ .../actionsByEmail/services/dataForm.php | 39 + .../actionsByEmail/services/dataFormPost.php | 202 +++ .../actionsByEmail/services/utils.php | 84 ++ .../features/actionsByEmail/xmlform.html | 173 +++ .../src/ProcessMaker/Services/Api/Process.php | 45 + .../Services/Api/Project/Activity.php | 20 + 71 files changed, 8908 insertions(+), 267 deletions(-) create mode 100644 workflow/engine/classes/features/ConfigurationHandler.php create mode 100644 workflow/engine/classes/features/EnterpriseFeature.php create mode 100644 workflow/engine/classes/features/ExtensionManager.php create mode 100644 workflow/engine/classes/features/FeatureHandler.php create mode 100644 workflow/engine/classes/features/ViewContainers/TaskContainer.php create mode 100644 workflow/engine/classes/features/ViewContainers/TriggerContainer.php create mode 100644 workflow/engine/classes/features/ViewContainers/ViewContainer.php create mode 100644 workflow/engine/classes/features/actionsByEmail/ActionByEmail.php create mode 100644 workflow/engine/classes/features/actionsByEmail/ActionsByEmailFeature.php create mode 100644 workflow/engine/classes/features/actionsByEmail/actionsByEmail.php create mode 100644 workflow/engine/classes/features/actionsByEmail/actionsByEmail.xml create mode 100644 workflow/engine/classes/features/actionsByEmail/actionsByEmailAjax.php create mode 100644 workflow/engine/classes/features/actionsByEmail/actionsByEmail_FileEdit.html create mode 100644 workflow/engine/classes/features/actionsByEmail/actionsByEmail_FileEdit.xml create mode 100644 workflow/engine/classes/features/actionsByEmail/class.actionsByEmail.php create mode 100644 workflow/engine/classes/features/actionsByEmail/classes/model/AbeConfiguration.php create mode 100644 workflow/engine/classes/features/actionsByEmail/classes/model/AbeConfigurationPeer.php create mode 100644 workflow/engine/classes/features/actionsByEmail/classes/model/AbeRequests.php create mode 100644 workflow/engine/classes/features/actionsByEmail/classes/model/AbeRequestsPeer.php create mode 100644 workflow/engine/classes/features/actionsByEmail/classes/model/AbeResponses.php create mode 100644 workflow/engine/classes/features/actionsByEmail/classes/model/AbeResponsesPeer.php create mode 100644 workflow/engine/classes/features/actionsByEmail/classes/model/map/AbeConfigurationMapBuilder.php create mode 100644 workflow/engine/classes/features/actionsByEmail/classes/model/map/AbeRequestsMapBuilder.php create mode 100644 workflow/engine/classes/features/actionsByEmail/classes/model/map/AbeResponsesMapBuilder.php create mode 100644 workflow/engine/classes/features/actionsByEmail/classes/model/om/BaseAbeConfiguration.php create mode 100644 workflow/engine/classes/features/actionsByEmail/classes/model/om/BaseAbeConfigurationPeer.php create mode 100644 workflow/engine/classes/features/actionsByEmail/classes/model/om/BaseAbeRequests.php create mode 100644 workflow/engine/classes/features/actionsByEmail/classes/model/om/BaseAbeRequestsPeer.php create mode 100644 workflow/engine/classes/features/actionsByEmail/classes/model/om/BaseAbeResponses.php create mode 100644 workflow/engine/classes/features/actionsByEmail/classes/model/om/BaseAbeResponsesPeer.php create mode 100644 workflow/engine/classes/features/actionsByEmail/config/propel.ini create mode 100644 workflow/engine/classes/features/actionsByEmail/config/propel.mysql.ini create mode 100644 workflow/engine/classes/features/actionsByEmail/config/schema-transformed.xml create mode 100644 workflow/engine/classes/features/actionsByEmail/config/schema.xml create mode 100644 workflow/engine/classes/features/actionsByEmail/configActionsByEmail.html create mode 100644 workflow/engine/classes/features/actionsByEmail/configActionsByEmail.php create mode 100644 workflow/engine/classes/features/actionsByEmail/configActionsByEmail.xml create mode 100644 workflow/engine/classes/features/actionsByEmail/data/actionsByEmail.html create mode 100644 workflow/engine/classes/features/actionsByEmail/data/actionsByEmailPartner.html create mode 100644 workflow/engine/classes/features/actionsByEmail/data/schema.sql create mode 100644 workflow/engine/classes/features/actionsByEmail/data/sqldb.map create mode 100644 workflow/engine/classes/features/actionsByEmail/documentation/CaseActionsByEmail.png create mode 100644 workflow/engine/classes/features/actionsByEmail/documentation/CaseNoteTask1.png create mode 100644 workflow/engine/classes/features/actionsByEmail/documentation/ConfigurationTask1.png create mode 100644 workflow/engine/classes/features/actionsByEmail/documentation/ConfigurationTask2.png create mode 100644 workflow/engine/classes/features/actionsByEmail/documentation/FormTask1.png create mode 100644 workflow/engine/classes/features/actionsByEmail/documentation/Process1.png create mode 100644 workflow/engine/classes/features/actionsByEmail/documentation/ProcessActions.png create mode 100644 workflow/engine/classes/features/actionsByEmail/documentation/ProcessActions1.png create mode 100644 workflow/engine/classes/features/actionsByEmail/documentation/ProcessActions2.png create mode 100644 workflow/engine/classes/features/actionsByEmail/documentation/ProcessFrm1.png create mode 100644 workflow/engine/classes/features/actionsByEmail/documentation/ResponseTask1.png create mode 100644 workflow/engine/classes/features/actionsByEmail/documentation/ResponseTask2.png create mode 100644 workflow/engine/classes/features/actionsByEmail/documentation/VerifyTask1.png create mode 100644 workflow/engine/classes/features/actionsByEmail/documentation/VerifyTask2.png create mode 100644 workflow/engine/classes/features/actionsByEmail/documentation/emailTask1.png create mode 100644 workflow/engine/classes/features/actionsByEmail/documentation/emailTask2.png create mode 100644 workflow/engine/classes/features/actionsByEmail/documentation/overview.php create mode 100644 workflow/engine/classes/features/actionsByEmail/externalStep.php create mode 100644 workflow/engine/classes/features/actionsByEmail/menusetup.php create mode 100644 workflow/engine/classes/features/actionsByEmail/pluginConfig.ini create mode 100644 workflow/engine/classes/features/actionsByEmail/report.js create mode 100644 workflow/engine/classes/features/actionsByEmail/services/dataField.php create mode 100644 workflow/engine/classes/features/actionsByEmail/services/dataForm.php create mode 100644 workflow/engine/classes/features/actionsByEmail/services/dataFormPost.php create mode 100644 workflow/engine/classes/features/actionsByEmail/services/utils.php create mode 100644 workflow/engine/classes/features/actionsByEmail/xmlform.html diff --git a/.gitignore b/.gitignore index b951fad8a..30362bf99 100755 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ workflow/engine/gulliver workflow/public_html/index.html .DS_Store .idea +nbproject/ composer.phar composer.lock vendor/ diff --git a/gulliver/js/codemirror/addon/hint/php-hint.js b/gulliver/js/codemirror/addon/hint/php-hint.js index d882dbe47..9723cb250 100644 --- a/gulliver/js/codemirror/addon/hint/php-hint.js +++ b/gulliver/js/codemirror/addon/hint/php-hint.js @@ -1,267 +1,267 @@ -(function () { - var Pos = CodeMirror.Pos; - - function forEach(arr, f) { - for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); - } - - function arrayContains(arr, item) { - if (!Array.prototype.indexOf) { - var i = arr.length; - while (i--) { - if (arr[i] === item) { - return true; - } - } - return false; - } - return arr.indexOf(item) != -1; - } - - function scriptHint(editor, keywords, getToken, options) { - // Find the token at the cursor - var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token; - var sToken = token.string.trim(); - - if ( sToken == "(") { - token = tprop = getToken(editor, Pos(cur.line, tprop.start)); - return {list: getCompletions(token.string, keywords, options), - from: Pos(cur.line, token.start), - to: Pos(cur.line, token.end + 1)}; - } - if ( sToken == "=") { - return {list: getCompletions(token.string, keywords, options), - from: Pos(cur.line, token.start + 1), - to: Pos(cur.line, token.end)}; - } - return {list: getCompletions(token.string, keywords, options), - from: Pos(cur.line, token.start), - to: Pos(cur.line, token.end)}; - } - - CodeMirror.phpHint = function(editor, options) { - return scriptHint(editor, phpPMFunctions, function (e, cur) {return e.getTokenAt(cur);}, options); - }; - - var SPACE = " "; - var arrayFunctions = []; - - var formatDate = "formatDate"; - var formatDateFunction = [formatDate+"($date,$format,$language);",formatDate+"($date,$format);"]; - arrayFunctions[formatDate] = formatDateFunction; - - var getCurrentDate = "getCurrentDate"; - var getCurrentDateFunction = [getCurrentDate+"()"]; - arrayFunctions[getCurrentDate] = getCurrentDateFunction; - - var getCurrentTime = "getCurrentTime"; - var getCurrentTimeFunction = [getCurrentTime+"()"]; - arrayFunctions[getCurrentTime] = getCurrentTimeFunction; - - var literalDate = "literalDate"; - var literalDateFunction = [literalDate+"($date,$Language)",literalDate+"($date)"]; - arrayFunctions[literalDate] = literalDateFunction; - - var capitalize = "capitalize"; - var capitalizeFunction = [capitalize+"($textToConvert)"]; - arrayFunctions[capitalize] = capitalizeFunction; - - var lowerCase = "lowerCase"; - var lowerCaseFunction = [lowerCase+"($textToConvert)"]; - arrayFunctions[lowerCase] = lowerCaseFunction; - - var upperCase = "upperCase"; - var upperCaseFunction = [upperCase+"($textToConvert)"]; - arrayFunctions[upperCase] = upperCaseFunction; - - var userInfo = "userInfo"; - var userInfoFunction = [userInfo+"($USER_ID)"]; - arrayFunctions[userInfo] = userInfoFunction; - - var executeQuery = "executeQuery"; - var executeQueryFunction = [executeQuery+"($sqlStatement,$DBConnectionUID)",executeQuery+"($sqlStatement)"]; - arrayFunctions[executeQuery] = executeQueryFunction; - - var orderGrid = "orderGrid"; - var orderGridFunction = ("orderGrid($gridName,$field,$criteria) orderGrid($gridName,$field)").split(SPACE); - arrayFunctions[orderGrid] = orderGridFunction; - - var evaluateFunction = "evaluateFunction"; - var evaluateFunctionFunction = [evaluateFunction+"($gridName,$Expression)"]; - arrayFunctions[evaluateFunction] = evaluateFunctionFunction; - - var PMFTaskCase = "PMFTaskCase"; - var PMFTaskCaseFunction = [PMFTaskCase+"($caseId)"]; - arrayFunctions[PMFTaskCase] = PMFTaskCaseFunction; - - var PMFTaskList = "PMFTaskList"; - var PMFTaskListFunction = [PMFTaskList+"($userId)"]; - arrayFunctions[PMFTaskList] = PMFTaskListFunction; - - var PMFUserList = "PMFUserList"; - var PMFUserListFunction = [PMFUserList+"()"]; - arrayFunctions[PMFUserList] = PMFUserListFunction; - - var PMFGroupList = "PMFGroupList"; - var PMFGroupListFunction = [PMFGroupList+"()"]; - arrayFunctions[PMFGroupList] = PMFGroupListFunction; - - var PMFRoleList = "PMFRoleList"; - var PMFRoleListFunction = [PMFRoleList+"()"]; - arrayFunctions[PMFRoleList] = PMFRoleListFunction; - - var PMFCaseList = "PMFCaseList"; - var PMFCaseListFunction = [PMFCaseList+"($userId)",PMFCaseList+"()"]; - arrayFunctions[PMFCaseList] = PMFCaseListFunction; - - var PMFProcessList = "PMFProcessList"; - var PMFProcessListFunction = [PMFProcessList+"()"]; - arrayFunctions[PMFProcessList] = PMFProcessListFunction; - - var PMFSendVariables = "PMFSendVariables"; - var PMFSendVariablesFunction = [PMFSendVariables+"($caseId,$variables)"]; - arrayFunctions[PMFSendVariables] = PMFSendVariablesFunction; - - var PMFDerivateCase = "PMFDerivateCase"; - var PMFDerivateCaseFunction = [PMFDerivateCase+"($caseId,$delegation,$executeTriggersBeforeAssigment)",PMFDerivateCase+"($caseId,$delegation)"]; - arrayFunctions[PMFDerivateCase] = PMFDerivateCaseFunction; - - var PMFNewCaseImpersonate = "PMFNewCaseImpersonate"; - var PMFNewCaseImpersonateFunction = [PMFNewCaseImpersonate+"($processId,$userId,$variables)"]; - arrayFunctions[PMFNewCaseImpersonate] = PMFNewCaseImpersonateFunction; - - var PMFNewCase = "PMFNewCase"; - var PMFNewCaseFunction = [PMFNewCase+"($processId,$userId,$taskId,$variables)"]; - arrayFunctions[PMFNewCase] = PMFNewCaseFunction; - - var PMFPauseCase = "PMFPauseCase"; - var PMFPauseCaseFunction = [PMFPauseCase+"($caseUid,$delIndex,$userUid,$unpauseDate)",PMFPauseCase+"($caseUid,$delIndex,$userUid)"]; - arrayFunctions[PMFPauseCase] = PMFPauseCaseFunction; - - var PMFAssignUserToGroup = "PMFAssignUserToGroup"; - var PMFAssignUserToGroupFunction = [PMFAssignUserToGroup+"($userId,$groupId)"]; - arrayFunctions[PMFAssignUserToGroup] = PMFAssignUserToGroupFunction; - - var PMFCreateUser = "PMFCreateUser"; - var PMFCreateUserFunction = [PMFCreateUser+"($userId,$password,$firstname,$lastname,$email,$role)"]; - arrayFunctions[PMFCreateUser] = PMFCreateUserFunction; - - var PMFUpdateUser = "PMFUpdateUser"; - var PMFUpdateUserFunction = [PMFUpdateUser+"($userUid,$userName,$firstName,$lastName,$email,$dueDate,$status,$role,$password)"]; - arrayFunctions[PMFUpdateUser] = PMFUpdateUserFunction; - - var PMFInformationUser = "PMFInformationUser"; - var PMFInformationUserFunction = [PMFInformationUser+"($userUid)"]; - arrayFunctions[PMFInformationUser] = PMFInformationUserFunction; - - var generateCode = "generateCode"; - var generateCodeFunction = [generateCode+"($size,$type)"]; - arrayFunctions[generateCode] = generateCodeFunction; - - var setCaseTrackerCode = "setCaseTrackerCode"; - var setCaseTrackerCodeFunction = [setCaseTrackerCode+"($caseId,$code,$pin)"]; - arrayFunctions[setCaseTrackerCode] = setCaseTrackerCodeFunction; - - var jumping = "jumping"; - var jumpingFunction = [jumping+"($caseId,$delegation)"]; - arrayFunctions[jumping] = jumpingFunction; - - var PMFRedirectToStep = "PMFRedirectToStep"; - var PMFRedirectToStepFunction = [PMFRedirectToStep+"($caseId,$delegation,$stepType,$stepId)"]; - arrayFunctions[PMFRedirectToStep] = PMFRedirectToStepFunction; - - var pauseCase = "pauseCase"; - var pauseCaseFunction = [pauseCase+"($caseId,$delegation,$userId,$unpauseDate)",pauseCase+"($caseId,$delegation,$userId)"]; - arrayFunctions[pauseCase] = pauseCaseFunction; - - var PMFUnpauseCase = "PMFUnpauseCase"; - var PMFUnpauseCaseFunction = [PMFUnpauseCase+"($caseId,$delegation,$userId,$unpauseDate)",PMFUnpauseCase+"($caseId,$delegation,$userId)"]; - arrayFunctions[PMFUnpauseCase] = PMFUnpauseCaseFunction; - - var PMFSendMessage = "PMFSendMessage"; - var PMFSendMessageFunction = [PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template,$fields,$attachments)",PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template,$fields)",PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template)"]; - arrayFunctions[PMFSendMessage] = PMFSendMessageFunction; - - var PMFgetLabelOption = "PMFgetLabelOption"; - var PMFgetLabelOptionFunction = [PMFgetLabelOption+"($processId,$dynaformId,$fieldName,$optionId)"]; - arrayFunctions[PMFgetLabelOption] = PMFgetLabelOptionFunction; - - var PMFGenerateOutputDocument = "PMFGenerateOutputDocument"; - var PMFGenerateOutputDocumentFunction = [PMFGenerateOutputDocument+"($outputID)"]; - arrayFunctions[PMFGenerateOutputDocument] = PMFGenerateOutputDocumentFunction; - - var PMFGetUserEmailAddress = "PMFGetUserEmailAddress"; - var PMFGetUserEmailAddressFunction = [PMFGetUserEmailAddress+"($id,$APP_UID,$prefix)",PMFGetUserEmailAddress+"($id,$APP_UID)",PMFGetUserEmailAddress+"($id)"]; - arrayFunctions[PMFGetUserEmailAddress] = PMFGetUserEmailAddressFunction; - - var PMFGetNextAssignedUser = "PMFGetNextAssignedUser"; - var PMFGetNextAssignedUserFunction = (PMFGetNextAssignedUser+"($application,$task)").split(SPACE); - arrayFunctions[PMFGetNextAssignedUser] = PMFGetNextAssignedUserFunction; - - var PMFDeleteCase = "PMFDeleteCase"; - var PMFDeleteCaseFunction = ("PMFDeleteCase($caseId)").split(SPACE); - arrayFunctions[PMFDeleteCase] = PMFDeleteCaseFunction; - - var PMFCancelCase = "PMFCancelCase"; - var PMFCancelCaseFunction = [PMFCancelCase+"($caseUid,$delIndex,$userUid)"]; - arrayFunctions[PMFCancelCase] = PMFCancelCaseFunction; - - var PMFAddInputDocument = "PMFAddInputDocument"; - var PMFAddInputDocumentFunction = [PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid,$option,$file)",PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid,$option)",PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid)"]; - arrayFunctions[PMFAddInputDocument] = PMFAddInputDocumentFunction; - - var PMFAddCaseNote = "PMFAddCaseNote"; - var PMFAddCaseNoteFunction = [PMFAddCaseNote+"($caseUid,$processUid,$taskUid,$userUid,$note,$sendMail)"]; - arrayFunctions[PMFAddCaseNote] = PMFAddCaseNoteFunction; - - var PMFGetCaseNotes = "PMFGetCaseNotes"; - var PMFGetCaseNotesFunction = [PMFGetCaseNotes+"($applicationID,$type,$userUid);",PMFGetCaseNotes+"($applicationID,$type)",PMFGetCaseNotes+"($applicationID)"]; - arrayFunctions[PMFGetCaseNotes] = PMFGetCaseNotesFunction; - - var phpPMFunctions = [formatDate,getCurrentDate,getCurrentTime,literalDate,capitalize,lowerCase,upperCase,userInfo,executeQuery,orderGrid, - evaluateFunction,PMFTaskCase,PMFTaskList,PMFUserList,PMFGroupList,PMFRoleList,PMFCaseList,PMFProcessList,PMFSendVariables,PMFDerivateCase, - PMFNewCaseImpersonate,PMFNewCase,PMFPauseCase,PMFUnpauseCase,PMFAssignUserToGroup,PMFCreateUser,PMFUpdateUser,PMFInformationUser, - generateCode,setCaseTrackerCode,jumping,PMFRedirectToStep,pauseCase,PMFSendMessage,PMFgetLabelOption,PMFGenerateOutputDocument, - PMFGetUserEmailAddress,PMFGetNextAssignedUser,PMFDeleteCase,PMFCancelCase,PMFAddInputDocument,PMFAddCaseNote,PMFGetCaseNotes]; - - var phpKeywords = ("break case catch continue default do else false for function " + - "if new return switch throw true try var while").split(SPACE); - - function getCompletions(functionName, keywords, options) { - - var found = []; - - function maybeAdd(str) {// for keywords ? - if ( str.indexOf(functionName) == 0 && !arrayContains(found, str)) { - found.push(str); - } - } - - function yesAdd(str) { - if ( !arrayContains(found, str)) { - found.push(str); - } - } - - arrayFunction = arrayFunctions[functionName]; - - if (arrayFunction != undefined) { - forEach( arrayFunction, yesAdd); - } else { - if (functionName.trim() == "") { - forEach (phpKeywords, yesAdd); - forEach (keywords, yesAdd); - } else if (functionName == "=") { - forEach (phpPMFunctions, yesAdd); - } else { - for (index = 0; index < phpKeywords.length; index++) { - if ( phpKeywords[index].indexOf(functionName) == 0 ) { - found.push(phpKeywords[index]); - } - } - forEach(keywords, maybeAdd); - } - } - return found; - } -})(); +(function () { + var Pos = CodeMirror.Pos; + + function forEach(arr, f) { + for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]); + } + + function arrayContains(arr, item) { + if (!Array.prototype.indexOf) { + var i = arr.length; + while (i--) { + if (arr[i] === item) { + return true; + } + } + return false; + } + return arr.indexOf(item) != -1; + } + + function scriptHint(editor, keywords, getToken, options) { + // Find the token at the cursor + var cur = editor.getCursor(), token = getToken(editor, cur), tprop = token; + var sToken = token.string.trim(); + + if ( sToken == "(") { + token = tprop = getToken(editor, Pos(cur.line, tprop.start)); + return {list: getCompletions(token.string, keywords, options), + from: Pos(cur.line, token.start), + to: Pos(cur.line, token.end + 1)}; + } + if ( sToken == "=") { + return {list: getCompletions(token.string, keywords, options), + from: Pos(cur.line, token.start + 1), + to: Pos(cur.line, token.end)}; + } + return {list: getCompletions(token.string, keywords, options), + from: Pos(cur.line, token.start), + to: Pos(cur.line, token.end)}; + } + + CodeMirror.phpHint = function(editor, options) { + return scriptHint(editor, phpPMFunctions, function (e, cur) {return e.getTokenAt(cur);}, options); + }; + + var SPACE = " "; + var arrayFunctions = []; + + var formatDate = "formatDate"; + var formatDateFunction = [formatDate+"($date,$format,$language);",formatDate+"($date,$format);"]; + arrayFunctions[formatDate] = formatDateFunction; + + var getCurrentDate = "getCurrentDate"; + var getCurrentDateFunction = [getCurrentDate+"()"]; + arrayFunctions[getCurrentDate] = getCurrentDateFunction; + + var getCurrentTime = "getCurrentTime"; + var getCurrentTimeFunction = [getCurrentTime+"()"]; + arrayFunctions[getCurrentTime] = getCurrentTimeFunction; + + var literalDate = "literalDate"; + var literalDateFunction = [literalDate+"($date,$Language)",literalDate+"($date)"]; + arrayFunctions[literalDate] = literalDateFunction; + + var capitalize = "capitalize"; + var capitalizeFunction = [capitalize+"($textToConvert)"]; + arrayFunctions[capitalize] = capitalizeFunction; + + var lowerCase = "lowerCase"; + var lowerCaseFunction = [lowerCase+"($textToConvert)"]; + arrayFunctions[lowerCase] = lowerCaseFunction; + + var upperCase = "upperCase"; + var upperCaseFunction = [upperCase+"($textToConvert)"]; + arrayFunctions[upperCase] = upperCaseFunction; + + var userInfo = "userInfo"; + var userInfoFunction = [userInfo+"($USER_ID)"]; + arrayFunctions[userInfo] = userInfoFunction; + + var executeQuery = "executeQuery"; + var executeQueryFunction = [executeQuery+"($sqlStatement,$DBConnectionUID)",executeQuery+"($sqlStatement)"]; + arrayFunctions[executeQuery] = executeQueryFunction; + + var orderGrid = "orderGrid"; + var orderGridFunction = ("orderGrid($gridName,$field,$criteria) orderGrid($gridName,$field)").split(SPACE); + arrayFunctions[orderGrid] = orderGridFunction; + + var evaluateFunction = "evaluateFunction"; + var evaluateFunctionFunction = [evaluateFunction+"($gridName,$Expression)"]; + arrayFunctions[evaluateFunction] = evaluateFunctionFunction; + + var PMFTaskCase = "PMFTaskCase"; + var PMFTaskCaseFunction = [PMFTaskCase+"($caseId)"]; + arrayFunctions[PMFTaskCase] = PMFTaskCaseFunction; + + var PMFTaskList = "PMFTaskList"; + var PMFTaskListFunction = [PMFTaskList+"($userId)"]; + arrayFunctions[PMFTaskList] = PMFTaskListFunction; + + var PMFUserList = "PMFUserList"; + var PMFUserListFunction = [PMFUserList+"()"]; + arrayFunctions[PMFUserList] = PMFUserListFunction; + + var PMFGroupList = "PMFGroupList"; + var PMFGroupListFunction = [PMFGroupList+"()"]; + arrayFunctions[PMFGroupList] = PMFGroupListFunction; + + var PMFRoleList = "PMFRoleList"; + var PMFRoleListFunction = [PMFRoleList+"()"]; + arrayFunctions[PMFRoleList] = PMFRoleListFunction; + + var PMFCaseList = "PMFCaseList"; + var PMFCaseListFunction = [PMFCaseList+"($userId)",PMFCaseList+"()"]; + arrayFunctions[PMFCaseList] = PMFCaseListFunction; + + var PMFProcessList = "PMFProcessList"; + var PMFProcessListFunction = [PMFProcessList+"()"]; + arrayFunctions[PMFProcessList] = PMFProcessListFunction; + + var PMFSendVariables = "PMFSendVariables"; + var PMFSendVariablesFunction = [PMFSendVariables+"($caseId,$variables)"]; + arrayFunctions[PMFSendVariables] = PMFSendVariablesFunction; + + var PMFDerivateCase = "PMFDerivateCase"; + var PMFDerivateCaseFunction = [PMFDerivateCase+"($caseId,$delegation,$executeTriggersBeforeAssigment)",PMFDerivateCase+"($caseId,$delegation)"]; + arrayFunctions[PMFDerivateCase] = PMFDerivateCaseFunction; + + var PMFNewCaseImpersonate = "PMFNewCaseImpersonate"; + var PMFNewCaseImpersonateFunction = [PMFNewCaseImpersonate+"($processId,$userId,$variables)"]; + arrayFunctions[PMFNewCaseImpersonate] = PMFNewCaseImpersonateFunction; + + var PMFNewCase = "PMFNewCase"; + var PMFNewCaseFunction = [PMFNewCase+"($processId,$userId,$taskId,$variables)"]; + arrayFunctions[PMFNewCase] = PMFNewCaseFunction; + + var PMFPauseCase = "PMFPauseCase"; + var PMFPauseCaseFunction = [PMFPauseCase+"($caseUid,$delIndex,$userUid,$unpauseDate)",PMFPauseCase+"($caseUid,$delIndex,$userUid)"]; + arrayFunctions[PMFPauseCase] = PMFPauseCaseFunction; + + var PMFAssignUserToGroup = "PMFAssignUserToGroup"; + var PMFAssignUserToGroupFunction = [PMFAssignUserToGroup+"($userId,$groupId)"]; + arrayFunctions[PMFAssignUserToGroup] = PMFAssignUserToGroupFunction; + + var PMFCreateUser = "PMFCreateUser"; + var PMFCreateUserFunction = [PMFCreateUser+"($userId,$password,$firstname,$lastname,$email,$role)"]; + arrayFunctions[PMFCreateUser] = PMFCreateUserFunction; + + var PMFUpdateUser = "PMFUpdateUser"; + var PMFUpdateUserFunction = [PMFUpdateUser+"($userUid,$userName,$firstName,$lastName,$email,$dueDate,$status,$role,$password)"]; + arrayFunctions[PMFUpdateUser] = PMFUpdateUserFunction; + + var PMFInformationUser = "PMFInformationUser"; + var PMFInformationUserFunction = [PMFInformationUser+"($userUid)"]; + arrayFunctions[PMFInformationUser] = PMFInformationUserFunction; + + var generateCode = "generateCode"; + var generateCodeFunction = [generateCode+"($size,$type)"]; + arrayFunctions[generateCode] = generateCodeFunction; + + var setCaseTrackerCode = "setCaseTrackerCode"; + var setCaseTrackerCodeFunction = [setCaseTrackerCode+"($caseId,$code,$pin)"]; + arrayFunctions[setCaseTrackerCode] = setCaseTrackerCodeFunction; + + var jumping = "jumping"; + var jumpingFunction = [jumping+"($caseId,$delegation)"]; + arrayFunctions[jumping] = jumpingFunction; + + var PMFRedirectToStep = "PMFRedirectToStep"; + var PMFRedirectToStepFunction = [PMFRedirectToStep+"($caseId,$delegation,$stepType,$stepId)"]; + arrayFunctions[PMFRedirectToStep] = PMFRedirectToStepFunction; + + var pauseCase = "pauseCase"; + var pauseCaseFunction = [pauseCase+"($caseId,$delegation,$userId,$unpauseDate)",pauseCase+"($caseId,$delegation,$userId)"]; + arrayFunctions[pauseCase] = pauseCaseFunction; + + var PMFUnpauseCase = "PMFUnpauseCase"; + var PMFUnpauseCaseFunction = [PMFUnpauseCase+"($caseId,$delegation,$userId,$unpauseDate)",PMFUnpauseCase+"($caseId,$delegation,$userId)"]; + arrayFunctions[PMFUnpauseCase] = PMFUnpauseCaseFunction; + + var PMFSendMessage = "PMFSendMessage"; + var PMFSendMessageFunction = [PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template,$fields,$attachments)",PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template,$fields)",PMFSendMessage+"($caseId,$from,$to,$cc,$bcc,$subject,$template)"]; + arrayFunctions[PMFSendMessage] = PMFSendMessageFunction; + + var PMFgetLabelOption = "PMFgetLabelOption"; + var PMFgetLabelOptionFunction = [PMFgetLabelOption+"($processId,$dynaformId,$fieldName,$optionId)"]; + arrayFunctions[PMFgetLabelOption] = PMFgetLabelOptionFunction; + + var PMFGenerateOutputDocument = "PMFGenerateOutputDocument"; + var PMFGenerateOutputDocumentFunction = [PMFGenerateOutputDocument+"($outputID)"]; + arrayFunctions[PMFGenerateOutputDocument] = PMFGenerateOutputDocumentFunction; + + var PMFGetUserEmailAddress = "PMFGetUserEmailAddress"; + var PMFGetUserEmailAddressFunction = [PMFGetUserEmailAddress+"($id,$APP_UID,$prefix)",PMFGetUserEmailAddress+"($id,$APP_UID)",PMFGetUserEmailAddress+"($id)"]; + arrayFunctions[PMFGetUserEmailAddress] = PMFGetUserEmailAddressFunction; + + var PMFGetNextAssignedUser = "PMFGetNextAssignedUser"; + var PMFGetNextAssignedUserFunction = (PMFGetNextAssignedUser+"($application,$task)").split(SPACE); + arrayFunctions[PMFGetNextAssignedUser] = PMFGetNextAssignedUserFunction; + + var PMFDeleteCase = "PMFDeleteCase"; + var PMFDeleteCaseFunction = ("PMFDeleteCase($caseId)").split(SPACE); + arrayFunctions[PMFDeleteCase] = PMFDeleteCaseFunction; + + var PMFCancelCase = "PMFCancelCase"; + var PMFCancelCaseFunction = [PMFCancelCase+"($caseUid,$delIndex,$userUid)"]; + arrayFunctions[PMFCancelCase] = PMFCancelCaseFunction; + + var PMFAddInputDocument = "PMFAddInputDocument"; + var PMFAddInputDocumentFunction = [PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid,$option,$file)",PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid,$option)",PMFAddInputDocument+"($inputDocumentUid,$appDocUid,$docVersion,$appDocType,$appDocComment,$inputDocumentAction,$caseUid,$delIndex,$taskUid,$userUid)"]; + arrayFunctions[PMFAddInputDocument] = PMFAddInputDocumentFunction; + + var PMFAddCaseNote = "PMFAddCaseNote"; + var PMFAddCaseNoteFunction = [PMFAddCaseNote+"($caseUid,$processUid,$taskUid,$userUid,$note,$sendMail)"]; + arrayFunctions[PMFAddCaseNote] = PMFAddCaseNoteFunction; + + var PMFGetCaseNotes = "PMFGetCaseNotes"; + var PMFGetCaseNotesFunction = [PMFGetCaseNotes+"($applicationID,$type,$userUid);",PMFGetCaseNotes+"($applicationID,$type)",PMFGetCaseNotes+"($applicationID)"]; + arrayFunctions[PMFGetCaseNotes] = PMFGetCaseNotesFunction; + + var phpPMFunctions = [formatDate,getCurrentDate,getCurrentTime,literalDate,capitalize,lowerCase,upperCase,userInfo,executeQuery,orderGrid, + evaluateFunction,PMFTaskCase,PMFTaskList,PMFUserList,PMFGroupList,PMFRoleList,PMFCaseList,PMFProcessList,PMFSendVariables,PMFDerivateCase, + PMFNewCaseImpersonate,PMFNewCase,PMFPauseCase,PMFUnpauseCase,PMFAssignUserToGroup,PMFCreateUser,PMFUpdateUser,PMFInformationUser, + generateCode,setCaseTrackerCode,jumping,PMFRedirectToStep,pauseCase,PMFSendMessage,PMFgetLabelOption,PMFGenerateOutputDocument, + PMFGetUserEmailAddress,PMFGetNextAssignedUser,PMFDeleteCase,PMFCancelCase,PMFAddInputDocument,PMFAddCaseNote,PMFGetCaseNotes]; + + var phpKeywords = ("break case catch continue default do else false for function " + + "if new return switch throw true try var while").split(SPACE); + + function getCompletions(functionName, keywords, options) { + + var found = []; + + function maybeAdd(str) {// for keywords ? + if ( str.indexOf(functionName) == 0 && !arrayContains(found, str)) { + found.push(str); + } + } + + function yesAdd(str) { + if ( !arrayContains(found, str)) { + found.push(str); + } + } + + arrayFunction = arrayFunctions[functionName]; + + if (arrayFunction != undefined) { + forEach( arrayFunction, yesAdd); + } else { + if (functionName.trim() == "") { + forEach (phpKeywords, yesAdd); + forEach (keywords, yesAdd); + } else if (functionName == "=") { + forEach (phpPMFunctions, yesAdd); + } else { + for (index = 0; index < phpKeywords.length; index++) { + if ( phpKeywords[index].indexOf(functionName) == 0 ) { + found.push(phpKeywords[index]); + } + } + forEach(keywords, maybeAdd); + } + } + return found; + } +})(); diff --git a/workflow/engine/classes/features/ConfigurationHandler.php b/workflow/engine/classes/features/ConfigurationHandler.php new file mode 100644 index 000000000..9c3c4fe9e --- /dev/null +++ b/workflow/engine/classes/features/ConfigurationHandler.php @@ -0,0 +1,10 @@ +prepareView($view); + $container->register($view); + } + + public function prepareView($view) + { + return $view; + } + +} diff --git a/workflow/engine/classes/features/FeatureHandler.php b/workflow/engine/classes/features/FeatureHandler.php new file mode 100644 index 000000000..a64046dda --- /dev/null +++ b/workflow/engine/classes/features/FeatureHandler.php @@ -0,0 +1,10 @@ +viewList[] = $view; + } + + public function getView($id) + { + return $this->viewList[$id]; + } + + public function getAllViews() + { + return $this->viewList; + } +} diff --git a/workflow/engine/classes/features/actionsByEmail/ActionByEmail.php b/workflow/engine/classes/features/actionsByEmail/ActionByEmail.php new file mode 100644 index 000000000..54df45d7d --- /dev/null +++ b/workflow/engine/classes/features/actionsByEmail/ActionByEmail.php @@ -0,0 +1,6 @@ +addExtJsScript('actionsByEmail/report', false); //adding a javascript file .js +//$oHeadPublisher->addContent('cases/casesListExtJs'); //adding a html file .html. + +G::RenderPage('publish', 'extJs'); + diff --git a/workflow/engine/classes/features/actionsByEmail/ActionsByEmailFeature.php b/workflow/engine/classes/features/actionsByEmail/ActionsByEmailFeature.php new file mode 100644 index 000000000..7d753dfad --- /dev/null +++ b/workflow/engine/classes/features/actionsByEmail/ActionsByEmailFeature.php @@ -0,0 +1,30 @@ + + * @author Marco Antonio Nina + * @package plugins.actionsByEmail + * @copyright Copyright (C) 2004 - 2012 Colosa Inc. + */ + +// Verify that the plugin "enterprisePlugin" is installed +if (!class_exists('enterprisePlugin')) { + return; +} + +// Load dependences +G::LoadClass('plugin'); + +class actionsByEmailPlugin extends enterprisePlugin +{ + public function __construct($namespace, $filename = null) + { + $result = parent::PMPlugin($namespace, $filename); + $config = parse_ini_file(PATH_PLUGINS . 'actionsByEmail' . PATH_SEP . 'pluginConfig.ini'); + $this->sFriendlyName = $config['name']; + $this->sDescription = $config['description']; + $this->sPluginFolder = $config['pluginFolder']; + $this->sSetupPage = $config['setupPage']; + $this->iVersion = self::getPluginVersion($namespace); + $this->aWorkspaces = null; + $this->aDependences = array(array('sClassName' => 'enterprise'), array('sClassName' => 'pmLicenseManager')); + $this->bPrivate = parent::registerEE($this->sPluginFolder, $this->iVersion); + + return $result; + } + + public function setup() + { + try { + // Register the extended tab for the task properties + $this->registerTaskExtendedProperty('actionsByEmail/configActionsByEmail', "Actions by Email"); + //$this->registerTaskExtendedProperty('actionsByEmail/configActionsByEmail', 'Actions by Email'); + $this->registerMenu('setup', 'menusetup.php'); + + // Register the trigger for the hook PM_CREATE_NEW_DELEGATION + if (!defined('PM_CREATE_NEW_DELEGATION')) { + throw new Exception('It might be using a version of ProcessMaker which is not totally compatible with this plugin, the minimun required version is 2.0.37'); + } + + $this->registerTrigger(PM_CREATE_NEW_DELEGATION, 'sendActionsByEmail'); + + // Register the external step for the tracking form + //$this->registerStep('4939290144f0745f5ddb1d1019823738', 'externalStep', 'Actions by Email - Tracking Form'); // ToDo: For the next release + } catch (Exception $error) { + //G::SendMessageText($error->getMessage(), 'WARNING'); + } + } + + public function install() + { + $this->checkTables(); + } + + public function enable() + { + $this->checkTables(); + } + + public function disable() + { + // Nothing to do for now + } + + /** + * This method get the version of this plugin, when the plugin is packaged in the tar.gz + * the file "version" in the plugin folder has this information for development purposes, + * we calculate the version using git commands, because the repository is in GIT + * + * @param String $namespace The namespace of the plugin + * @return String $version + */ + private static function getPluginVersion($namespace) + { + return "2.0.20"; + } + + public function checkTables() + { + $con = Propel::getConnection('workflow'); + $stmt = $con->createStatement(); + // setting the path of the sql schema files + $filenameSql = PATH_PLUGINS . 'actionsByEmail/data/schema.sql'; + + // checking the existence of the schema file + if (!file_exists($filenameSql)) { + throw new Exception("File data/schema.sql doesn't exists"); + } + + // exploding the sql query in an array + $sql = explode(';', file_get_contents($filenameSql)); + + $stmt->executeQuery('SET FOREIGN_KEY_CHECKS = 0;'); + + // executing each query stored in the array + foreach ($sql as $sentence) { + if (trim($sentence) != '') { + $stmt->executeQuery($sentence); + } + } + } +} + +$oPluginRegistry = &PMPluginRegistry::getSingleton(); +$oPluginRegistry->registerPlugin('actionsByEmail', __FILE__); + diff --git a/workflow/engine/classes/features/actionsByEmail/actionsByEmail.xml b/workflow/engine/classes/features/actionsByEmail/actionsByEmail.xml new file mode 100644 index 000000000..abe67e37a --- /dev/null +++ b/workflow/engine/classes/features/actionsByEmail/actionsByEmail.xml @@ -0,0 +1,11 @@ + + + + <en>Action By Email Plugin</en> + <pt-BR><![CDATA[Ação por Email Plugin]]></pt-BR> + + + There is no further configuration needed. + + + diff --git a/workflow/engine/classes/features/actionsByEmail/actionsByEmailAjax.php b/workflow/engine/classes/features/actionsByEmail/actionsByEmailAjax.php new file mode 100644 index 000000000..b7a2f51de --- /dev/null +++ b/workflow/engine/classes/features/actionsByEmail/actionsByEmailAjax.php @@ -0,0 +1,514 @@ +load($Category,'', $Id, $Lang); + + return $value; +} + +// General Validations +if (!isset($_REQUEST['action'])) { + $_REQUEST['action'] = ''; +} + +if (!isset($_REQUEST['limit'])) { + $_REQUEST['limit'] = ''; +} + +if (!isset($_REQUEST['start'])) { + $_REQUEST['start'] = ''; +} + +// Initialize response object +$response = new stdclass(); +$response->status = 'OK'; + +// Main switch +try { + switch ($_REQUEST['action']) { + case 'editTemplate': + // Action Validations + if (!isset($_REQUEST['TEMPLATE'])) { + $_REQUEST['TEMPLATE'] = ''; + } + + if ($_REQUEST['TEMPLATE'] == '') { + throw new Exception('The TEMPLATE parameter is empty.'); + } + + $data = array( + 'CONTENT' => file_get_contents(PATH_DATA_MAILTEMPLATES . $_REQUEST['PRO_UID'] . PATH_SEP . $_REQUEST['TEMPLATE']), + 'TEMPLATE' => $_REQUEST['TEMPLATE'], + ); + + global $G_PUBLISH; + + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent('xmlform', 'xmlform', 'actionsByEmail/actionsByEmail_FileEdit', '', $data); + + G::RenderPage('publish', 'raw'); + die(); + break; + case 'updateTemplate': + // Action Validations + if (!isset($_REQUEST['TEMPLATE'])) { + $_REQUEST['TEMPLATE'] = ''; + } + + if (!isset($_REQUEST['CONTENT'])) { + $_REQUEST['CONTENT'] = ''; + } + + if ($_REQUEST['TEMPLATE'] == '') { + throw new Exception('The TEMPLATE parameter is empty.'); + } + + $templateFile = fopen(PATH_DATA_MAILTEMPLATES . $_REQUEST['PRO_UID'] . PATH_SEP . $_REQUEST['TEMPLATE'], 'w'); + $content = stripslashes($_REQUEST['CONTENT']); + $content = str_replace('@amp@', '&', $content); + $content = base64_decode($content); + + fwrite($templateFile, $content); + fclose($templateFile); + break; + // comment + case 'loadFields': + if (!isset($_REQUEST['DYN_UID'])) { + $_REQUEST['DYN_UID'] = ''; + } + + if (!isset($_REQUEST['PRO_UID'])) { + $_REQUEST['PRO_UID'] = ''; + } + + $response->emailFields = array(); + $response->actionFields = array(); + + if ($_REQUEST['PRO_UID'] != '' && $_REQUEST['DYN_UID']) { + $dynaform = new Form($_REQUEST['PRO_UID'] . PATH_SEP . $_REQUEST['DYN_UID'], PATH_DYNAFORM, SYS_LANG, false); + + foreach ($dynaform->fields as $fieldName => $data) { + switch($data->type) { + case 'text': + case 'suggest': + case 'hidden': + case 'textarea': + $response->emailFields[] = array('value' => $data->name, 'label' => $data->label . ' (@@' . $data->name . ')'); + break; + case 'dropdown': + case 'radiogroup': + case 'yesno': + case 'checkbox': + $response->actionFields[] = array('value' => $data->name, 'label' => $data->label . ' (@@' . $data->name . ')'); + break; + } + } + } + break; + case 'saveConfiguration': + // Action Validations + if (!isset($_REQUEST['ABE_UID'])) { + $_REQUEST['ABE_UID'] = ''; + } + + if (!isset($_REQUEST['PRO_UID'])) { + $_REQUEST['PRO_UID'] = ''; + } + + if (!isset($_REQUEST['TAS_UID'])) { + $_REQUEST['TAS_UID'] = ''; + } + + if (!isset($_REQUEST['ABE_TYPE'])) { + $_REQUEST['ABE_TYPE'] = ''; + } + + if (!isset($_REQUEST['ABE_TEMPLATE'])) { + $_REQUEST['ABE_TEMPLATE'] = ''; + } + + if (!isset($_REQUEST['DYN_UID'])) { + $_REQUEST['DYN_UID'] = ''; + } + + if (!isset($_REQUEST['ABE_EMAIL_FIELD'])) { + $_REQUEST['ABE_EMAIL_FIELD'] = ''; + } + + if (!isset($_REQUEST['ABE_ACTION_FIELD'])) { + $_REQUEST['ABE_ACTION_FIELD'] = ''; + } + + if (!isset($_REQUEST['ABE_CASE_NOTE_IN_RESPONSE'])) { + $_REQUEST['ABE_CASE_NOTE_IN_RESPONSE'] = 0; + } + + if ($_REQUEST['PRO_UID'] == '') { + throw new Exception('The PRO_UID parameter is empty.'); + } + + if ($_REQUEST['TAS_UID'] == '') { + throw new Exception('The TAS_UID parameter is empty.'); + } + + require_once 'classes/model/AbeConfiguration.php'; + + $abeConfigurationInstance = new AbeConfiguration(); + + if ($_REQUEST['ABE_TYPE'] != '') { + if ($_REQUEST['DYN_UID'] == '') { + throw new Exception('The DYN_UID parameter is empty.'); + } + + try { + $response->ABE_UID = $abeConfigurationInstance->createOrUpdate($_REQUEST); + } catch (Exception $error) { + throw $error; + } + } else { + try { + $abeConfigurationInstance->deleteByTasUid($_REQUEST['TAS_UID']); + $response->ABE_UID = ''; + } catch (Exception $error) { + throw $error; + } + } + break; + case 'loadActionByEmail': + $criteria = new Criteria(); + $criteria->addSelectColumn( 'COUNT(*)'); + + $criteria->addJoin(AbeConfigurationPeer::ABE_UID,AbeRequestsPeer::ABE_UID); + $criteria->addJoin(AppDelegationPeer::APP_UID,AbeRequestsPeer::APP_UID); + $criteria->addJoin(AppDelegationPeer::DEL_INDEX,AbeRequestsPeer::DEL_INDEX); + $result = AbeConfigurationPeer::doSelectRS($criteria); + $result->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $result->next(); + $totalCount = $result->getRow(); + $totalCount = $totalCount['COUNT(*)']; + + $criteria = new Criteria(); + $criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID); + $criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID); + $criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID); + $criteria->addSelectColumn(AbeConfigurationPeer::ABE_UPDATE_DATE); + $criteria->addSelectColumn(AbeConfigurationPeer::ABE_TEMPLATE); + $criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD); + $criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID); + + $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID); + $criteria->addSelectColumn(AbeRequestsPeer::APP_UID); + $criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX); + $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SENT_TO); + $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_STATUS); + $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SUBJECT); + $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_ANSWERED); + $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_BODY); + $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_DATE); + + $criteria->addSelectColumn(ApplicationPeer::APP_NUMBER); + + $criteria->addSelectColumn(AppDelegationPeer::DEL_PREVIOUS); + + $criteria->addJoin(AbeConfigurationPeer::ABE_UID,AbeRequestsPeer::ABE_UID); + $criteria->addJoin(ApplicationPeer::APP_UID,AbeRequestsPeer::APP_UID); + + $criteria->addJoin(AppDelegationPeer::APP_UID,AbeRequestsPeer::APP_UID); + $criteria->addJoin(AppDelegationPeer::DEL_INDEX,AbeRequestsPeer::DEL_INDEX); + $criteria->addDescendingOrderByColumn(AbeRequestsPeer::ABE_REQ_DATE); + $criteria->setLimit( $_REQUEST['limit'] ); + $criteria->setOffset( $_REQUEST['start'] ); + $result = AbeConfigurationPeer::doSelectRS($criteria); + $result->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $data = Array(); + $arrayPro = Array(); + $arrayTAS = Array(); + $index = 0; + + while ($result->next()) { + $data[] = $result->getRow(); + $criteriaRes = new Criteria(); + + $criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_UID); + $criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_CLIENT_IP); + $criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_DATA); + $criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_STATUS); + $criteriaRes->addSelectColumn(AbeResponsesPeer::ABE_RES_MESSAGE); + + $criteriaRes->add(AbeResponsesPeer::ABE_REQ_UID, $data[$index]['ABE_REQ_UID']); + + $resultRes = AbeResponsesPeer::doSelectRS($criteriaRes); + $resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $resultRes->next(); + $dataRes = Array(); + + if ($dataRes = $resultRes->getRow()) { + $data[$index]['ABE_RES_UID'] = $dataRes['ABE_RES_UID']; + $data[$index]['ABE_RES_CLIENT_IP'] = $dataRes['ABE_RES_CLIENT_IP']; + $data[$index]['ABE_RES_DATA'] = $dataRes['ABE_RES_DATA']; + $data[$index]['ABE_RES_STATUS'] = $dataRes['ABE_RES_STATUS']; + $data[$index]['ABE_RES_MESSAGE'] = $dataRes['ABE_RES_MESSAGE']; + } else { + $data[$index]['ABE_RES_UID'] = ''; + $data[$index]['ABE_RES_CLIENT_IP'] = ''; + $data[$index]['ABE_RES_DATA'] = ''; + $data[$index]['ABE_RES_STATUS'] = ''; + $data[$index]['ABE_RES_MESSAGE'] = ''; + } + + $criteriaRes = new Criteria(); + + $criteriaRes->addSelectColumn(AppDelegationPeer::USR_UID); + $criteriaRes->addSelectColumn(UsersPeer::USR_FIRSTNAME); + $criteriaRes->addSelectColumn(UsersPeer::USR_LASTNAME); + + $criteria->addJoin(AppDelegationPeer::APP_UID,$data[$index]['APP_UID']); + $criteria->addJoin(AppDelegationPeer::DEL_INDEX,$data[$index]['DEL_PREVIOUS']); + $criteria->addJoin(AppDelegationPeer::USR_UID,UsersPeer::USR_UID); + $resultRes = AppDelegationPeer::doSelectRS($criteriaRes); + $resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $resultRes->next(); + + if ($dataRes = $resultRes->getRow()) { + $data[$index]['USER'] = $dataRes['USR_FIRSTNAME']. ' '.$dataRes['USR_LASTNAME']; + } else { + $data[$index]['USER'] = ''; + } + + $data[$index]['ABE_REQ_ANSWERED'] = ($data[$index]['ABE_REQ_ANSWERED'] == 1)? 'YES' : 'NO'; + /* + $swPRO = false; + foreach($arrayPro as $k => $field){ + if($arrayPro[$k]['PRO_UID'] == $data[$index]['PRO_UID'] && $arrayPro[$k]['LANG'] == SYS_LANG){ + $data[$index]['PRO_TITLE'] = $arrayPro[$k]['PRO_TITLE']; + $swPRO = true; + } + } + if(!$swPRO){ + $data[$index]['PRO_TITLE'] = addTitlle('PRO_TITLE', $data[$index]['PRO_UID'], SYS_LANG); + $arrayPRO[] = Array('PRO_UID'=>$data[$index]['PRO_UID'] , 'PRO_TITLE'=>$data[$index]['PRO_TITLE'],'LANG' => SYS_LANG); + } + $swTAS = false; + foreach($arrayTAS as $k => $field){ + if($arrayTAS[$k]['TAS_UID'] == $data[$index]['TAS_UID'] && $arrayTAS[$k]['LANG'] == SYS_LANG){ + $data[$index]['TAS_TITLE'] = $arrayTAS[$k]['TAS_TITLE']; + $swTAS = true; + } + } + if(!$swTAS){ + $data[$index]['TAS_TITLE'] = addTitlle('TAS_TITLE', $data[$index]['TAS_UID'], SYS_LANG); + $arrayTAS[] = Array('TAS_UID'=>$data[$index]['TAS_UID'] , 'TAS_TITLE'=>$data[$index]['TAS_TITLE'],'LANG' => SYS_LANG); + }*/ + $index++; + } + + $response = array(); + $response['totalCount'] = $totalCount; + $response['data'] = $data; + break; + case 'forwardMail': + if (!isset($_REQUEST['REQ_UID'])) { + $_REQUEST['REQ_UID'] = ''; + } + + $criteria = new Criteria(); + $criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID); + $criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID); + $criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID); + + $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID); + $criteria->addSelectColumn(AbeRequestsPeer::APP_UID); + $criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX); + $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SENT_TO); + $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SUBJECT); + $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_BODY); + $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_ANSWERED); + $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_STATUS); + + $criteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE); + + $criteria->add(AbeRequestsPeer::ABE_REQ_UID,$_REQUEST['REQ_UID']); + $criteria->addJoin(AbeRequestsPeer::ABE_UID,AbeConfigurationPeer::ABE_UID); + $criteria->addJoin(AppDelegationPeer::APP_UID,AbeRequestsPeer::APP_UID); + $criteria->addJoin(AppDelegationPeer::DEL_INDEX,AbeRequestsPeer::DEL_INDEX); + $resultRes = AbeRequestsPeer::doSelectRS($criteria); + $resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + $resultRes->next(); + $dataRes = Array(); + + if ($dataRes = $resultRes->getRow()) { + if (is_null($dataRes['DEL_FINISH_DATE'])) { + require_once 'classes/model/Configuration.php'; + G::LoadClass('spool'); + + $configuration = new Configuration(); + $sDelimiter = DBAdapter::getStringDelimiter(); + $criteria = new Criteria('workflow'); + $criteria->add(ConfigurationPeer::CFG_UID, 'Emails'); + $criteria->add(ConfigurationPeer::OBJ_UID, ''); + $criteria->add(ConfigurationPeer::PRO_UID, ''); + $criteria->add(ConfigurationPeer::USR_UID, ''); + $criteria->add(ConfigurationPeer::APP_UID, ''); + + if (ConfigurationPeer::doCount($criteria) == 0) { + $configuration->create(array('CFG_UID'=>'Emails', 'OBJ_UID'=>'', 'CFG_VALUE'=>'', 'PRO_UID'=>'', 'USR_UID'=>'', 'APP_UID'=>'')); + $newConfiguration = array(); + } else { + $newConfiguration = $configuration->load('Emails', '', '', '', ''); + + if ($newConfiguration['CFG_VALUE'] != '') { + $newConfiguration = unserialize($newConfiguration['CFG_VALUE']); + } else { + $newConfiguration = array(); + } + } + + $spool = new spoolRun(); + $spool->setConfig(array( + 'MESS_ENGINE' => $newConfiguration['MESS_ENGINE'], + 'MESS_SERVER' => $newConfiguration['MESS_SERVER'], + 'MESS_PORT' => $newConfiguration['MESS_PORT'], + 'MESS_ACCOUNT' => $newConfiguration['MESS_ACCOUNT'], + 'MESS_PASSWORD' => $newConfiguration['MESS_PASSWORD'], + 'SMTPAuth' => $newConfiguration['MESS_RAUTH'] + )); + + $spool->create(array( + 'msg_uid' => '', + 'app_uid' => $dataRes['APP_UID'], + 'del_index' => $dataRes['DEL_INDEX'], + 'app_msg_type' => 'TEST', + 'app_msg_subject' => $dataRes['ABE_REQ_SUBJECT'], + 'app_msg_from' => $newConfiguration['MESS_ACCOUNT'], + 'app_msg_to' => $dataRes['ABE_REQ_SENT_TO'], + 'app_msg_body' => $dataRes['ABE_REQ_BODY'], + 'app_msg_cc' => '', + 'app_msg_bcc' => '', + 'app_msg_attach' => '', + 'app_msg_template'=> '', + 'app_msg_status' => 'pending' + )); + + if ($spool->sendMail()) { + $dataRes['ABE_REQ_STATUS'] = 'SENT'; + + $message = 'The email was resend to: '. $dataRes['ABE_REQ_SENT_TO']; + } else { + $dataRes['ABE_REQ_STATUS'] = 'ERROR'; + $message = 'There was a problem sending the email to: '. $dataRes['ABE_REQ_SENT_TO'] .', please try later.'; + } + + try { + $abeRequestsInstance = new AbeRequests(); + $abeRequestsInstance->createOrUpdate($dataRes); + } catch (Exception $error) { + throw $error; + } + } else { + $message = 'Unable to send email, the task is closed.'; + } + } else { + $message = 'An unexpected error occurred please try again later.'; + } + + print_r($message); + die; + break; + case 'viewForm': + //coment + if (!isset($_REQUEST['REQ_UID'])) { + $_REQUEST['REQ_UID'] = ''; + } + + $criteria = new Criteria(); + $criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID); + $criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID); + $criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID); + $criteria->addSelectColumn(AbeConfigurationPeer::DYN_UID); + $criteria->addSelectColumn(AbeConfigurationPeer::ABE_ACTION_FIELD); + + $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID); + $criteria->addSelectColumn(AbeRequestsPeer::APP_UID); + $criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX); + + $criteria->addSelectColumn(AbeResponsesPeer::ABE_RES_UID); + $criteria->addSelectColumn(AbeResponsesPeer::ABE_RES_DATA); + + + $criteria->add(AbeRequestsPeer::ABE_REQ_UID,$_REQUEST['REQ_UID']); + $criteria->addJoin(AbeRequestsPeer::ABE_UID,AbeConfigurationPeer::ABE_UID); + $criteria->addJoin(AbeResponsesPeer::ABE_REQ_UID,AbeRequestsPeer::ABE_REQ_UID); + $resultRes = AbeRequestsPeer::doSelectRS($criteria); + $resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + $resultRes->next(); + $dataRes = Array(); + $message = 'The user has not responded to this request.'; + + if ($dataRes = $resultRes->getRow()) { + $_SESSION['CURRENT_DYN_UID'] = trim($dataRes['DYN_UID']); + $dynaform = new Form($dataRes['PRO_UID'] . PATH_SEP . trim($dataRes['DYN_UID']), PATH_DYNAFORM, SYS_LANG, false); + $dynaform->mode = 'view'; + + if ($dataRes['ABE_RES_DATA'] != '') { + $value = unserialize( $dataRes['ABE_RES_DATA'] ); + + if (is_array($value)) { + $dynaform->values = $value; + + foreach ($dynaform->fields as $fieldName => $field) { + if ($field->type == 'submit') { + unset($dynaform->fields[$fieldName]); + } + } + + $message = $dynaform->render(PATH_CORE . 'templates/xmlform.html', $scriptCode); + } else { + $response = $dynaform->render(PATH_CORE . 'templates/xmlform.html', $scriptCode); + $field = $dynaform->fields[$dataRes['ABE_ACTION_FIELD']]; + $message = 'Type: '.$field->type . '
'; + + switch ($field->type) { + case 'dropdown': + case 'radiogroup': + $message .=$field->label .' - '; + $message .= $field->options[$value]; + break; + case 'yesno': + $message .= ''.$field->label. ' - '; + $message .= ($value == 1)? 'Yes' : 'No'; + break; + case 'checkbox': + $message .= ''. $field->label. ' - '; + $message .= ($value == 'On')? 'Check' : 'Uncheck'; + break; + } + } + } + } + + print_r($message); + die; + break; + } +} catch (Exception $error) { + $response = new stdclass(); + $response->status = 'ERROR'; + $response->message = $error->getMessage(); +} + +header('Content-Type: application/json;'); + +die(G::json_encode($response)); + diff --git a/workflow/engine/classes/features/actionsByEmail/actionsByEmail_FileEdit.html b/workflow/engine/classes/features/actionsByEmail/actionsByEmail_FileEdit.html new file mode 100644 index 000000000..11281afa4 --- /dev/null +++ b/workflow/engine/classes/features/actionsByEmail/actionsByEmail_FileEdit.html @@ -0,0 +1,33 @@ +
+
+
+ + + + +
+ + + + + + + + + + + + + + + +
{$form.TEMPLATE}
{$form.THETITLE}
{$form.CONTENT}
{$form.ACCEPT}   {$form.CANCEL}
+
+
+
+
+
+ \ No newline at end of file diff --git a/workflow/engine/classes/features/actionsByEmail/actionsByEmail_FileEdit.xml b/workflow/engine/classes/features/actionsByEmail/actionsByEmail_FileEdit.xml new file mode 100644 index 000000000..3aab89fb6 --- /dev/null +++ b/workflow/engine/classes/features/actionsByEmail/actionsByEmail_FileEdit.xml @@ -0,0 +1,40 @@ + + +