Removing unnecessary files from the Actions By Email feature (code cleanup).
This commit is contained in:
@@ -35,7 +35,7 @@ class ActionsByEmailService
|
||||
if ($params['type'] != 'activity'
|
||||
|| !\PMLicensedFeatures
|
||||
::getSingleton()
|
||||
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0='))
|
||||
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0='))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
<?php
|
||||
$G_PUBLISH = new Publisher();
|
||||
|
||||
try {
|
||||
// Validations
|
||||
if (!isset($_REQUEST['APP_UID'])) {
|
||||
$_REQUEST['APP_UID'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['DEL_INDEX'])) {
|
||||
$_REQUEST['DEL_INDEX'] = '';
|
||||
}
|
||||
|
||||
if ($_REQUEST['APP_UID'] == '') {
|
||||
throw new Exception('The parameter APP_UID is empty.');
|
||||
}
|
||||
|
||||
if ($_REQUEST['DEL_INDEX'] == '') {
|
||||
throw new Exception('The parameter DEL_INDEX is empty.');
|
||||
}
|
||||
|
||||
$_REQUEST['APP_UID'] = G::decrypt(urldecode(utf8_encode($_REQUEST['APP_UID'])), URL_KEY);
|
||||
$_REQUEST['DEL_INDEX'] = G::decrypt(urldecode(utf8_encode($_REQUEST['DEL_INDEX'])), URL_KEY);
|
||||
$_REQUEST['FIELD'] = G::decrypt(urldecode(utf8_encode($_REQUEST['FIELD'])), URL_KEY);
|
||||
$_REQUEST['VALUE'] = G::decrypt(urldecode(utf8_encode($_REQUEST['VALUE'])), URL_KEY);
|
||||
$_REQUEST['ABER'] = G::decrypt(urldecode(utf8_encode($_REQUEST['ABER'])), URL_KEY);
|
||||
|
||||
G::LoadClass('case');
|
||||
|
||||
$cases = new Cases();
|
||||
$caseFieldsABE = $cases->loadCase($_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX']);
|
||||
|
||||
if (is_null($caseFieldsABE['DEL_FINISH_DATE'])) {
|
||||
$dataField = array();
|
||||
$dataField[$_REQUEST['FIELD']] = $_REQUEST['VALUE'];
|
||||
$caseFieldsABE ['APP_DATA'] = array_merge ( $caseFieldsABE ['APP_DATA'], $dataField );
|
||||
|
||||
$dataResponses = array();
|
||||
$dataResponses['ABE_REQ_UID'] = $_REQUEST['ABER'];
|
||||
$dataResponses['ABE_RES_CLIENT_IP'] = $_SERVER['REMOTE_ADDR'];
|
||||
$dataResponses['ABE_RES_DATA'] = serialize($_REQUEST['VALUE']);
|
||||
$dataResponses['ABE_RES_STATUS'] = 'PENDING';
|
||||
$dataResponses['ABE_RES_MESSAGE'] = '';
|
||||
|
||||
try {
|
||||
set_include_path(PATH_PLUGINS . 'actionsByEmail' . PATH_SEPARATOR . get_include_path());
|
||||
require_once 'classes/model/AbeResponses.php';
|
||||
$abeAbeResponsesInstance = new AbeResponses();
|
||||
$dataResponses['ABE_RES_UID'] = $abeAbeResponsesInstance->createOrUpdate($dataResponses);
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
|
||||
$cases->updateCase($_REQUEST['APP_UID'], $caseFieldsABE);
|
||||
|
||||
G::LoadClass('wsBase');
|
||||
|
||||
$ws = new wsBase();
|
||||
|
||||
$result = $ws->derivateCase($caseFieldsABE['CURRENT_USER_UID'], $_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX'], true);
|
||||
$code = (is_array($result) ? $result['status_code'] : $result->status_code);
|
||||
|
||||
if ($code != 0 ) {
|
||||
throw new Exception('An error occurred while the application was being processed.<br /><br />
|
||||
Error code: '.$result->status_code.'<br />
|
||||
Error message: '.$result->message.'<br /><br />');
|
||||
}
|
||||
|
||||
// Update
|
||||
$dataResponses['ABE_RES_STATUS'] = ($code == 0 ? 'SENT' : 'ERROR');
|
||||
$dataResponses['ABE_RES_MESSAGE'] = ($code == 0 ? '-' : $result->message);
|
||||
|
||||
try {
|
||||
$abeAbeResponsesInstance = new AbeResponses();
|
||||
$abeAbeResponsesInstance->createOrUpdate($dataResponses);
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
|
||||
$message = '<strong>The answer has been submited. Thank you</strong>';
|
||||
|
||||
//Save Cases Notes
|
||||
include_once 'utils.php';
|
||||
|
||||
$dataAbeRequests = loadAbeRequest($_REQUEST['ABER']);
|
||||
$dataAbeConfiguration = loadAbeConfiguration($dataAbeRequests['ABE_UID']);
|
||||
|
||||
if ($dataAbeConfiguration['ABE_CASE_NOTE_IN_RESPONSE'] == 1) {
|
||||
$response = new stdclass();
|
||||
$response->usrUid = $caseFieldsABE['APP_DATA']['USER_LOGGED'];
|
||||
$response->appUid = $_REQUEST['APP_UID'];
|
||||
$response->noteText = "Check the information that was sent for the receiver: " . $dataAbeRequests['ABE_REQ_SENT_TO'];
|
||||
|
||||
postNote($response);
|
||||
}
|
||||
|
||||
$dataAbeRequests['ABE_REQ_ANSWERED'] = 1;
|
||||
$code == 0 ? uploadAbeRequest($dataAbeRequests) : '';
|
||||
} else {
|
||||
$message = '<strong>The response has already been sent.</strong>';
|
||||
}
|
||||
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', array('MESSAGE' => $message));
|
||||
} catch (Exception $error) {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => $error->getMessage() . 'Please contact to your system administrator.'));
|
||||
}
|
||||
|
||||
G::RenderPage('publish', 'blank');
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
global $G_PUBLISH;
|
||||
$G_PUBLISH = new Publisher();
|
||||
|
||||
try {
|
||||
// Validations
|
||||
if (!isset($_REQUEST['APP_UID'])) {
|
||||
$_REQUEST['APP_UID'] = '';
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['DEL_INDEX'])) {
|
||||
$_REQUEST['DEL_INDEX'] = '';
|
||||
}
|
||||
|
||||
if ($_REQUEST['APP_UID'] == '') {
|
||||
throw new Exception('The parameter APP_UID is empty.');
|
||||
}
|
||||
|
||||
if ($_REQUEST['DEL_INDEX'] == '') {
|
||||
throw new Exception('The parameter DEL_INDEX is empty.');
|
||||
}
|
||||
|
||||
G::LoadClass('case');
|
||||
|
||||
$cases = new Cases();
|
||||
$caseFields = $cases->loadCase(G::decrypt($_REQUEST['APP_UID'], URL_KEY),G::decrypt($_REQUEST['DEL_INDEX'], URL_KEY));
|
||||
|
||||
if (is_null($caseFields['DEL_FINISH_DATE'])) {
|
||||
$action = 'dataFormPost.php?APP_UID=' . $_REQUEST['APP_UID'] . '&DEL_INDEX=' . $_REQUEST['DEL_INDEX'] . '&ABER=' . $_REQUEST['ABER'];
|
||||
$G_PUBLISH->AddContent('dynaform', 'xmlform', $caseFields['PRO_UID'] . PATH_SEP . G::decrypt($_REQUEST['DYN_UID'], URL_KEY), '', $caseFields['APP_DATA'], $action, '../../gulliver/defaultAjaxDynaform');
|
||||
} else {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', array('MESSAGE' => '<strong>The form has already been filled and sent.</strong>'));
|
||||
}
|
||||
} catch (Exception $error) {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', array('MESSAGE' => $error->getMessage()));
|
||||
}
|
||||
|
||||
G::RenderPage('publish', 'blank');
|
||||
|
||||
@@ -1,202 +0,0 @@
|
||||
<?php
|
||||
$G_PUBLISH = new Publisher();
|
||||
|
||||
try {
|
||||
if ($_REQUEST['APP_UID'] == '') {
|
||||
throw new Exception('The parameter APP_UID is empty.');
|
||||
}
|
||||
|
||||
if ($_REQUEST['DEL_INDEX'] == '') {
|
||||
throw new Exception('The parameter DEL_INDEX is empty.');
|
||||
}
|
||||
|
||||
if ($_REQUEST['ABER'] == '') {
|
||||
throw new Exception('The parameter ABER is empty.');
|
||||
}
|
||||
|
||||
if (!isset($_REQUEST['form'])) {
|
||||
$_REQUEST['form'] = array();
|
||||
}
|
||||
|
||||
$_REQUEST['APP_UID'] = G::decrypt($_REQUEST['APP_UID'], URL_KEY);
|
||||
$_REQUEST['DEL_INDEX'] = G::decrypt($_REQUEST['DEL_INDEX'], URL_KEY);
|
||||
$_REQUEST['ABER'] = G::decrypt($_REQUEST['ABER'], URL_KEY);
|
||||
|
||||
G::LoadClass('case');
|
||||
|
||||
$case = new Cases();
|
||||
$casesFields = $case->loadCase($_REQUEST['APP_UID'], $_REQUEST['DEL_INDEX']);
|
||||
|
||||
$casesFields['APP_DATA'] = array_merge($casesFields['APP_DATA'], $_REQUEST['form']);
|
||||
|
||||
//Get user info
|
||||
$current_user_uid = null;
|
||||
$currentUsrName = null;
|
||||
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(AppDelegationPeer::USR_UID);
|
||||
$criteria->add(AppDelegationPeer::APP_UID, $_REQUEST["APP_UID"]);
|
||||
$criteria->add(AppDelegationPeer::DEL_INDEX, $_REQUEST["DEL_INDEX"]);
|
||||
|
||||
$rsSQL = AppDelegationPeer::doSelectRS($criteria);
|
||||
$rsSQL->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($rsSQL->next()) {
|
||||
$row = $rsSQL->getRow();
|
||||
|
||||
$current_user_uid = $row["USR_UID"];
|
||||
}
|
||||
|
||||
if ($current_user_uid != null) {
|
||||
$criteria = new Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(UsersPeer::USR_USERNAME);
|
||||
$criteria->add(UsersPeer::USR_UID, $current_user_uid);
|
||||
|
||||
$rsSQL = UsersPeer::doSelectRS($criteria);
|
||||
$rsSQL->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
$rsSQL->next();
|
||||
|
||||
$row = $rsSQL->getRow();
|
||||
$currentUsrName = $row["USR_USERNAME"];
|
||||
|
||||
$casesFields["APP_DATA"]["USER_LOGGED"] = $current_user_uid;
|
||||
$casesFields["APP_DATA"]["USR_USERNAME"] = $currentUsrName;
|
||||
}
|
||||
|
||||
foreach ($casesFields["APP_DATA"] as $index => $value) {
|
||||
$_SESSION[$index] = $value;
|
||||
}
|
||||
|
||||
//Update case info
|
||||
$case->updateCase($_REQUEST['APP_UID'], $casesFields);
|
||||
|
||||
G::LoadClass('wsBase');
|
||||
|
||||
$wsBaseInstance = new wsBase();
|
||||
$result = $wsBaseInstance->derivateCase($casesFields['CURRENT_USER_UID'], $_REQUEST['APP_UID'], $_REQUEST ['DEL_INDEX'], true);
|
||||
$code = (is_array($result) ? $result['status_code'] : $result->status_code);
|
||||
|
||||
$dataResponses = array();
|
||||
$dataResponses['ABE_REQ_UID'] = $_REQUEST['ABER'];
|
||||
$dataResponses['ABE_RES_CLIENT_IP'] = $_SERVER['REMOTE_ADDR'];
|
||||
$dataResponses['ABE_RES_DATA'] = serialize($_REQUEST['form']);
|
||||
$dataResponses['ABE_RES_STATUS'] = 'PENDING';
|
||||
$dataResponses['ABE_RES_MESSAGE'] = '';
|
||||
|
||||
try {
|
||||
set_include_path(PATH_PLUGINS . 'actionsByEmail' . PATH_SEPARATOR . get_include_path());
|
||||
require_once 'classes/model/AbeResponses.php';
|
||||
|
||||
$abeAbeResponsesInstance = new AbeResponses();
|
||||
$dataResponses['ABE_RES_UID'] = $abeAbeResponsesInstance->createOrUpdate($dataResponses);
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
|
||||
if ($code == 0) {
|
||||
//Save Cases Notes
|
||||
include_once 'utils.php';
|
||||
|
||||
$dataAbeRequests = loadAbeRequest($_REQUEST['ABER']);
|
||||
$dataAbeConfiguration = loadAbeConfiguration($dataAbeRequests['ABE_UID']);
|
||||
|
||||
if ($dataAbeConfiguration['ABE_CASE_NOTE_IN_RESPONSE'] == 1) {
|
||||
$response = new stdclass();
|
||||
$response->usrUid = $casesFields['APP_DATA']['USER_LOGGED'];
|
||||
$response->appUid = $_REQUEST['APP_UID'];
|
||||
$response->noteText = "Check the information that was sent for the receiver: " . $dataAbeRequests['ABE_REQ_SENT_TO'];
|
||||
|
||||
postNote($response);
|
||||
}
|
||||
|
||||
$dataAbeRequests['ABE_REQ_ANSWERED'] = 1;
|
||||
$code == 0 ? uploadAbeRequest($dataAbeRequests) : '';
|
||||
|
||||
if (isset ( $_FILES ['form'] )) {
|
||||
foreach ($_FILES ['form'] ['name'] as $fieldName => $value) {
|
||||
if ($_FILES ['form'] ['error'] [$fieldName] == 0) {
|
||||
$appDocument = new AppDocument ( );
|
||||
|
||||
if ( isset ( $_REQUEST['INPUTS'] [$fieldName] ) && $_REQUEST['INPUTS'] [$fieldName] != '' ) {
|
||||
require_once 'classes/model/AppFolder.php';
|
||||
require_once 'classes/model/InputDocument.php';
|
||||
|
||||
$inputDocument = new InputDocument();
|
||||
$id = $inputDocument->load($_REQUEST['INPUTS'] [$fieldName]);
|
||||
|
||||
//Get the Custom Folder ID (create if necessary)
|
||||
$oFolder=new AppFolder();
|
||||
$folderId=$oFolder->createFromPath($id['INP_DOC_DESTINATION_PATH']);
|
||||
|
||||
//Tags
|
||||
$fileTags=$oFolder->parseTags($id['INP_DOC_TAGS']);
|
||||
|
||||
$fields = array (
|
||||
'APP_UID' => $_REQUEST['APP_UID'],
|
||||
'DEL_INDEX' => $_REQUEST ['DEL_INDEX'],
|
||||
'USR_UID' => $casesFields['APP_DATA']['USER_LOGGED'],
|
||||
'DOC_UID' => $_REQUEST['INPUTS'] [$fieldName],
|
||||
'APP_DOC_TYPE' => 'INPUT',
|
||||
'APP_DOC_CREATE_DATE' => date ( 'Y-m-d H:i:s' ),
|
||||
'APP_DOC_COMMENT' => '',
|
||||
'APP_DOC_TITLE' => '',
|
||||
'APP_DOC_FILENAME' => $_FILES ['form'] ['name'] [$fieldName],
|
||||
'FOLDER_UID' => $folderId,
|
||||
'APP_DOC_TAGS' => $fileTags
|
||||
);
|
||||
} else {
|
||||
$fields = array (
|
||||
'APP_UID' => $_REQUEST['APP_UID'],
|
||||
'DEL_INDEX' => $_REQUEST ['DEL_INDEX'],
|
||||
'USR_UID' => $casesFields['APP_DATA']['USER_LOGGED'],
|
||||
'DOC_UID' => - 1,
|
||||
'APP_DOC_TYPE' => 'ATTACHED',
|
||||
'APP_DOC_CREATE_DATE' => date ( 'Y-m-d H:i:s' ),
|
||||
'APP_DOC_COMMENT' => '',
|
||||
'APP_DOC_TITLE' => '',
|
||||
'APP_DOC_FILENAME' => $_FILES ['form'] ['name'] [$fieldName]
|
||||
);
|
||||
}
|
||||
|
||||
$appDocument->create($fields);
|
||||
$docVersion = $appDocument->getDocVersion();
|
||||
$appDocUid = $appDocument->getAppDocUid ();
|
||||
$info = pathinfo ( $appDocument->getAppDocFilename () );
|
||||
$extension = (isset ( $info ['extension'] ) ? $info ['extension'] : '');
|
||||
$pathName = PATH_DOCUMENT . $_REQUEST['APP_UID'] . PATH_SEP;
|
||||
$fileName = $appDocUid . '_'.$docVersion.'.' . $extension;
|
||||
|
||||
G::uploadFile ( $_FILES ['form'] ['tmp_name'] [$fieldName], $pathName, $fileName );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$assign = $result['message'];
|
||||
$aMessage['MESSAGE'] = '<strong>The information was submitted. Thank you.</strong>';
|
||||
} else {
|
||||
throw new Exception('An error occurred while the application was being processed.<br /><br />
|
||||
Error code: '.$result->status_code.'<br />
|
||||
Error message: '.$result->message.'<br /><br />');
|
||||
}
|
||||
|
||||
// Update
|
||||
$dataResponses['ABE_RES_STATUS'] = ($code == 0 ? 'SENT' : 'ERROR');
|
||||
$dataResponses['ABE_RES_MESSAGE'] = ($code == 0 ? '-' : $result->message);
|
||||
|
||||
try {
|
||||
$abeAbeResponsesInstance = new AbeResponses();
|
||||
$abeAbeResponsesInstance->createOrUpdate($dataResponses);
|
||||
} catch (Exception $error) {
|
||||
throw $error;
|
||||
}
|
||||
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showInfo', '', $aMessage);
|
||||
} catch (Exception $error) {
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', array('MESSAGE' => $error->getMessage().'Please contact to your system administrator.'));
|
||||
}
|
||||
|
||||
G::RenderPage('publish', 'blank');
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<dynaForm name="actionByEmail Setup Form" type="xmlform" width="550">
|
||||
<TITLE type="title" group="1">
|
||||
<en>Action By Email Plugin</en>
|
||||
<pt-BR><![CDATA[Ação por Email Plugin]]></pt-BR>
|
||||
</TITLE>
|
||||
<HelpText type="subtitle" maxlength="100" size="60">
|
||||
<en>There is no further configuration needed.</en>
|
||||
<pt-BR><![CDATA[Não há nenhuma configuração adicional necessária.]]></pt-BR>
|
||||
</HelpText>
|
||||
</dynaForm>
|
||||
@@ -1,514 +0,0 @@
|
||||
<?php
|
||||
set_include_path(PATH_PLUGINS . 'actionsByEmail' . PATH_SEPARATOR . get_include_path());
|
||||
require_once 'classes/model/AbeConfiguration.php';
|
||||
require_once 'classes/model/AbeRequests.php';
|
||||
require_once 'classes/model/AbeResponses.php';
|
||||
require_once 'classes/model/AppDelegation.php';
|
||||
require_once 'classes/model/Application.php';
|
||||
require_once 'classes/model/Users.php';
|
||||
|
||||
function addTitlle($Category, $Id, $Lang)
|
||||
{
|
||||
require_once 'classes/model/Content.php';
|
||||
$content = new Content();
|
||||
$value = $content->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 = '<b>Type: </b>'.$field->type . '<br>';
|
||||
|
||||
switch ($field->type) {
|
||||
case 'dropdown':
|
||||
case 'radiogroup':
|
||||
$message .=$field->label .' - ';
|
||||
$message .= $field->options[$value];
|
||||
break;
|
||||
case 'yesno':
|
||||
$message .= '<b>'.$field->label. ' </b>- ';
|
||||
$message .= ($value == 1)? 'Yes' : 'No';
|
||||
break;
|
||||
case 'checkbox':
|
||||
$message .= '<b>'. $field->label. '</b> - ';
|
||||
$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));
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
<form id="{$form_id}" name="{$form_name}" action="{$form_action}" class="{$form_className}" method="post" encType="multipart/form-data" style="margin:0px;" onsubmit='return validateForm("{$form_objectRequiredFields}".parseJSON());'> <div class="borderForm" style="width:{$form_width}; padding-left:0; padding-right:0; border-width:{$form_border};">
|
||||
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>
|
||||
<div class="content" style="height:{$form_height};" >
|
||||
<table width="99%">
|
||||
<tr>
|
||||
<td valign='top'>
|
||||
<input type="hidden" name="__notValidateThisFields__" id="__notValidateThisFields__" value="" />
|
||||
<input type="hidden" name="DynaformRequiredFields" id="DynaformRequiredFields" value='{$form_objectRequiredFields}' />
|
||||
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
||||
<tr style="display: none">
|
||||
<td colspan="2">{$form.TEMPLATE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='FormTitle' colspan="2" align="">{$form.THETITLE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='FormFieldContent' colspan="2">{$form.CONTENT}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='FormButton' colspan="2" align="center">{$form.ACCEPT} {$form.CANCEL}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="boxBottom"><div class="a"></div><div class="b"></div><div class="c"></div></div>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
{$form.JS}
|
||||
try {literal}{{/literal} dynaformSetFocus();}catch(e){literal}{{/literal}}
|
||||
</script>
|
||||
@@ -1,40 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<dynaForm name="actionsByEmail_FileEdit" type="xmlform" width="100%" enableTemplate="1">
|
||||
<TEMPLATE type="hidden" defaultValue=""/>
|
||||
<THETITLE type="title" enableHTML="1">
|
||||
<en><![CDATA[<div align="center">Edit @#TEMPLATE email template</div>]]></en>
|
||||
<pt-BR><![CDATA[<div align="center">Editar @#TEMPLATE de e-mail template</div>]]></pt-BR>
|
||||
</THETITLE>
|
||||
<CONTENT type="html" height="420" width="100%" defaultValue="">
|
||||
<en/>
|
||||
<pt-BR/>
|
||||
</CONTENT>
|
||||
<ACCEPT type="button" onclick="saveFile();">
|
||||
<en>Save</en>
|
||||
<pt-BR><![CDATA[Salvar]]></pt-BR>
|
||||
</ACCEPT>
|
||||
<CANCEL type="button" onclick="cancel();">
|
||||
<en>Cancel</en>
|
||||
<pt-BR><![CDATA[Cancelar]]></pt-BR>
|
||||
</CANCEL>
|
||||
<JS type="javascript" replacetags="1"><![CDATA[
|
||||
var cancel = function () {
|
||||
oPanel.remove();
|
||||
};
|
||||
|
||||
var saveFile = function() {
|
||||
var fc64 = base64_encode(getField('CONTENT').value);
|
||||
fc64 = fc64.replace(/&/g, '@amp@');
|
||||
fc64 = fc64.replace(/\+/g, '%2B');
|
||||
var oRPC = new leimnud.module.rpc.xmlhttp({
|
||||
url: '../actionsByEmail/actionsByEmailAjax',
|
||||
args: 'action=updateTemplate&PRO_UID=' + Pm.options.uid + '&TEMPLATE=' + getField('TEMPLATE').value + '&CONTENT=' + fc64
|
||||
});
|
||||
oPanel.loader.show();
|
||||
oRPC.callback = function(rpc) {
|
||||
oPanel.remove();
|
||||
}.extend(this);
|
||||
oRPC.make();
|
||||
};
|
||||
]]></JS>
|
||||
</dynaForm>
|
||||
@@ -1,52 +0,0 @@
|
||||
<form id="{$form_id}" name="" action="{$form_action}" class="{$form_className}" method="post" encType="multipart/form-data" style="margin:0px;" onsubmit="return validateForm('{$form_objectRequiredFields}');"> <div class="borderForm" style="width:{$form_width}; padding-left:0; padding-right:0; border-width:{$form_border};">
|
||||
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>
|
||||
<div class="content" style="height:{$form_height};" >
|
||||
<table width="99%">
|
||||
<tr>
|
||||
<td valign='top'>
|
||||
<input type="hidden" class="notValidateThisFields" name="__notValidateThisFields__" id="__notValidateThisFields__" value="{$form_objectRequiredFields}" />
|
||||
<input type="hidden" name="DynaformRequiredFields" id="DynaformRequiredFields" value="{$form_objectRequiredFields}" />
|
||||
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
||||
<tr style="display: none">
|
||||
<td colspan="2">{$form.IFORM}{$form.INDEX}{$form.ABE_UID}{$form.PRO_UID}{$form.TAS_UID}{$form.SYS_LANG}{$form.ABE_EMAIL_FIELD_VALUE}{$form.ABE_ACTION_FIELD_VALUE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='FormLabel' width="{$form_labelWidth}">{$ABE_TYPE}</td>
|
||||
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.ABE_TYPE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='FormLabel' width="{$form_labelWidth}"><font color="red">* </font>{$ABE_TEMPLATE}</td>
|
||||
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.ABE_TEMPLATE} {$form.EDIT}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='FormLabel' width="{$form_labelWidth}"><font color="red">* </font>{$DYN_UID}</td>
|
||||
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.DYN_UID}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='FormLabel' width="{$form_labelWidth}">{$ABE_EMAIL_FIELD}</td>
|
||||
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.ABE_EMAIL_FIELD}</td>
|
||||
</tr>
|
||||
<tr style="display: none;">
|
||||
<td class='FormLabel' width="{$form_labelWidth}"><font color="red">* </font>{$ABE_ACTION_FIELD}</td>
|
||||
<td class='FormFieldContent' width='{$form_fieldContentWidth}' >{$form.ABE_ACTION_FIELD}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='FormLabel' width="{$form_labelWidth}"></td>
|
||||
<td>{$form.ABE_CASE_NOTE_IN_RESPONSE}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='FormButton' colspan="2" align="center">{$form.APPLY_CHANGES}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div class="FormRequiredTextMessage"><font color="red">* </font> {$REQUIRED_LABEL}</div> </div>
|
||||
<div class="boxBottom"><div class="a"></div><div class="b"></div><div class="c"></div></div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
{$form.JS}
|
||||
</script>
|
||||
</form>
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
<?php
|
||||
set_include_path(PATH_PLUGINS . 'actionsByEmail' . PATH_SEPARATOR . get_include_path());
|
||||
require_once 'classes/model/AbeConfiguration.php';
|
||||
|
||||
// Get the configuration for the current task
|
||||
if (isset($_REQUEST['data'])) {
|
||||
$data = G::json_decode(stripslashes($_REQUEST['data']));
|
||||
} else {
|
||||
// ToDo: Trigger a error
|
||||
}
|
||||
|
||||
$task = new Task();
|
||||
$taskFields = $task->load($data->uid);
|
||||
|
||||
$criteria = new Criteria();
|
||||
$criteria->add(AbeConfigurationPeer::PRO_UID, $taskFields['PRO_UID']);
|
||||
$criteria->add(AbeConfigurationPeer::TAS_UID, $data->uid);
|
||||
$result = AbeConfigurationPeer::doSelectRS($criteria);
|
||||
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$result->next();
|
||||
|
||||
if ($configuration = $result->getRow()) {
|
||||
$configuration['ABE_EMAIL_FIELD_VALUE'] = $configuration['ABE_EMAIL_FIELD'];
|
||||
$configuration['ABE_ACTION_FIELD_VALUE'] = $configuration['ABE_ACTION_FIELD'];
|
||||
} else {
|
||||
$configuration = array();
|
||||
}
|
||||
|
||||
$configuration['PRO_UID'] = $taskFields['PRO_UID'];
|
||||
$configuration['TAS_UID'] = $taskFields['TAS_UID'];
|
||||
$configuration['SYS_LANG'] = SYS_LANG;
|
||||
$configuration['IFORM'] = $data->iForm;
|
||||
$configuration['INDEX'] = $data->index;
|
||||
|
||||
$templates = array();
|
||||
$templates[] = 'dummy';
|
||||
$path = PATH_DATA_MAILTEMPLATES . $taskFields['PRO_UID'] . PATH_SEP;
|
||||
|
||||
G::verifyPath($path, true);
|
||||
|
||||
if (defined('PARTNER_FLAG')) {
|
||||
if (!file_exists($path . 'actionsByEmailPartner.html')) {
|
||||
@copy(PATH_PLUGINS . 'actionsByEmail' . PATH_SEP . 'data' . PATH_SEP . 'actionsByEmailPartner.html', $path . 'actionsByEmail.html');
|
||||
}
|
||||
} else {
|
||||
if (!file_exists($path . 'actionsByEmail.html')) {
|
||||
@copy(PATH_PLUGINS . 'actionsByEmail' . PATH_SEP . 'data' . PATH_SEP . 'actionsByEmail.html', $path . 'actionsByEmail.html');
|
||||
}
|
||||
}
|
||||
|
||||
$directory = dir($path);
|
||||
|
||||
while ($object = $directory->read()) {
|
||||
if (($object !== '.') && ($object !== '..') && ($object !== 'alert_message.html')) {
|
||||
$templates[] = array('FILE' => $object, 'NAME' => $object);
|
||||
}
|
||||
}
|
||||
|
||||
global $_DBArray;
|
||||
|
||||
$_DBArray['ABE_TEMPLATES'] = $templates;
|
||||
$_SESSION['_DBArray'] = $_DBArray;
|
||||
|
||||
// Render the form
|
||||
global $G_PUBLISH;
|
||||
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'actionsByEmail/configActionsByEmail', null, $configuration);
|
||||
|
||||
@@ -1,215 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<dynaForm type="xmlform" name="" width="550" height="300" enabletemplate="1" mode="edit" labelWidth="150">
|
||||
<IFORM type="hidden"/>
|
||||
<INDEX type="hidden"/>
|
||||
<ABE_UID type="hidden"/>
|
||||
<PRO_UID type="hidden"/>
|
||||
<TAS_UID type="hidden"/>
|
||||
<SYS_LANG type="hidden"/>
|
||||
<ABE_EMAIL_FIELD_VALUE type="hidden"/>
|
||||
<ABE_ACTION_FIELD_VALUE type="hidden"/>
|
||||
<ABE_TYPE type="dropdown" required="0" defaultValue="text">
|
||||
<en>Type
|
||||
<option name="">- None -</option>
|
||||
<option name="LINK">Link to fill a form</option>
|
||||
<option name="FIELD">Use a field to generate actions links</option>
|
||||
</en>
|
||||
<pt-BR><![CDATA[Tipo]]><option name=""><![CDATA[- Nenhum -]]></option><option name="LINK"><![CDATA[Link para preencher um formulário]]></option><option name="FIELD"><![CDATA[Usar um campo para gerar links ações]]></option></pt-BR>
|
||||
</ABE_TYPE>
|
||||
<ABE_TEMPLATE type="dropdown" required="1" sqlconnection="dbarray" colWidth="30" titleAlign="left">
|
||||
SELECT FILE, NAME FROM ABE_TEMPLATES
|
||||
<en>Template
|
||||
<option name=""> - Selec a Template - </option>
|
||||
</en>
|
||||
<pt-BR><![CDATA[Modelo]]><option name=""><![CDATA[- Escolha um modelo -]]></option></pt-BR></ABE_TEMPLATE>
|
||||
<EDIT type="link" colWidth="40" value="@G::LoadTranslation(ID_EDIT)" link="#" onclick="editTemplateABE();"/>
|
||||
<DYN_UID type="dropdown" required="1" readonly="0" mode="edit" btn_cancel="Cancel"><![CDATA[SELECT DYN_UID, C.CON_VALUE AS DYN_TITLE FROM DYNAFORM LEFT JOIN CONTENT AS C ON (DYN_UID = C.CON_ID AND C.CON_CATEGORY='DYN_TITLE' AND C.CON_LANG = '@#SYS_LANG') WHERE PRO_UID = '@#PRO_UID' AND DYN_TYPE = 'xmlform' ORDER BY DYN_TITLE ASC]]><en>Dynaform
|
||||
<option name="">- Select a Dynaform -</option>
|
||||
</en><pt-BR><![CDATA[Formulário Dinâmico]]><option name=""><![CDATA[- Escolha um Formulário Dinâmico -]]></option></pt-BR></DYN_UID>
|
||||
<ABE_EMAIL_FIELD type="dropdown" required="0">
|
||||
<en>Field with the email
|
||||
<option name="">- Send to the email of the assigned user to the task -</option>
|
||||
</en>
|
||||
<pt-BR><![CDATA[Campo com o e-mail]]><option name=""><![CDATA[- Enviar para o e-mail do usuário atribuído à tarefa -]]></option></pt-BR>
|
||||
</ABE_EMAIL_FIELD>
|
||||
<ABE_ACTION_FIELD type="dropdown" required="0">
|
||||
<en>Field to Send in the Email
|
||||
<option name=""> - Select a Field - </option>
|
||||
</en>
|
||||
<pt-BR><![CDATA[Campo de enviar o e-mail]]><option name=""><![CDATA[- Escolha um campo -]]></option></pt-BR>
|
||||
</ABE_ACTION_FIELD>
|
||||
<ABE_CASE_NOTE_IN_RESPONSE type="checkbox" value="1" falsevalue="0" defaultvalue="0" readonly="0" labelonright="1" enablehtml="0" btn_cancel="Cancel" hint="" required="0" savelabel="0">
|
||||
<en>Register a Case Note when the recipient submits the Response</en>
|
||||
<pt-BR><![CDATA[Registrar um caso de nota quando o destinatário envia a resposta]]></pt-BR>
|
||||
</ABE_CASE_NOTE_IN_RESPONSE>
|
||||
<APPLY_CHANGES type="button" onclick="saveConfigurationABE();">
|
||||
<en>Apply Changes</en>
|
||||
<pt-BR><![CDATA[Aplicar alterações]]></pt-BR>
|
||||
</APPLY_CHANGES>
|
||||
<REQUIRED_LABEL type="text">
|
||||
<pt-BR><![CDATA[Campo obrigatório]]></pt-BR>
|
||||
<en><![CDATA[Required Field]]></en>
|
||||
</REQUIRED_LABEL>
|
||||
<JS type="javascript"><![CDATA[
|
||||
var loadFieldsABE = function() {
|
||||
var rpc = new leimnud.module.rpc.xmlhttp({
|
||||
url: '../actionsByEmail/actionsByEmailAjax',
|
||||
args: 'action=loadFields&PRO_UID=' + Pm.options.uid + '&DYN_UID=' + getField('DYN_UID').value
|
||||
});
|
||||
rpc.callback = function(rpc) {
|
||||
var response = rpc.xmlhttp.responseText.parseJSON();
|
||||
var ABE_EMAIL_FIELD = getField('ABE_EMAIL_FIELD');
|
||||
ABE_EMAIL_FIELD.options.length = 0;
|
||||
ABE_EMAIL_FIELD.options.add(new Option('- Send to the email of the assigned user to the task -', ''));
|
||||
ABE_EMAIL_FIELD.selectedIndex = 0;
|
||||
for (i = 0; i < response.emailFields.length; i++) {
|
||||
ABE_EMAIL_FIELD.options.add(new Option(response.emailFields[i].label, response.emailFields[i].value));
|
||||
}
|
||||
ABE_EMAIL_FIELD.value = getField('ABE_EMAIL_FIELD_VALUE').value;
|
||||
var ABE_ACTION_FIELD = getField('ABE_ACTION_FIELD');
|
||||
ABE_ACTION_FIELD.options.length = 0;
|
||||
ABE_ACTION_FIELD.options.add(new Option('- Select a Field -', ''));
|
||||
ABE_ACTION_FIELD.selectedIndex = 0;
|
||||
for (i = 0; i < response.actionFields.length; i++) {
|
||||
ABE_ACTION_FIELD.options.add(new Option(response.actionFields[i].label, response.actionFields[i].value));
|
||||
}
|
||||
ABE_ACTION_FIELD.value = getField('ABE_ACTION_FIELD_VALUE').value;
|
||||
};
|
||||
rpc.make();
|
||||
};
|
||||
|
||||
var editTemplateABE = function() {
|
||||
if(getField('ABE_TEMPLATE').value == '') {
|
||||
setFocus(getField('ABE_TEMPLATE'));
|
||||
alert('Select a Template');
|
||||
return false;
|
||||
}
|
||||
|
||||
oPanel = new leimnud.module.panel;
|
||||
oPanel.options = {
|
||||
limit : true,
|
||||
size : {w: 800, h: 600},
|
||||
position: {x: 50, y: 50, center: true},
|
||||
title : '',
|
||||
control : {close: true, resize: false},
|
||||
fx : {shadow: true, modal: true}
|
||||
};
|
||||
oPanel.make();
|
||||
var oRPC = new leimnud.module.rpc.xmlhttp({
|
||||
url: '../actionsByEmail/actionsByEmailAjax',
|
||||
args: 'action=editTemplate&PRO_UID=' + Pm.options.uid + '&TEMPLATE=' + getField('ABE_TEMPLATE').value
|
||||
});
|
||||
oPanel.loader.show();
|
||||
oRPC.callback = function (rpc) {
|
||||
oPanel.loader.hide();
|
||||
oPanel.addContent(rpc.xmlhttp.responseText);
|
||||
var scs = rpc.xmlhttp.responseText.extractScript();scs.evalScript();
|
||||
}.extend(this);
|
||||
oRPC.make();
|
||||
};
|
||||
|
||||
var saveConfigurationABE = function() {
|
||||
if(getField('ABE_TYPE').value != '') {
|
||||
if(getField('ABE_TEMPLATE').value == '') {
|
||||
setFocus(getField('ABE_TEMPLATE'));
|
||||
alert('Select a Template');
|
||||
return false;
|
||||
}
|
||||
if(getField('DYN_UID').value == '') {
|
||||
setFocus(getField('DYN_UID'));
|
||||
alert('Select a DynaForm');
|
||||
return false;
|
||||
}
|
||||
if(getField('ABE_TYPE').value == 'FIELD') {
|
||||
if(getField('ABE_ACTION_FIELD').value == '') {
|
||||
setFocus(getField('ABE_ACTION_FIELD'));
|
||||
alert('Select the field to Send in the Email');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
var rpc = new leimnud.module.rpc.xmlhttp({
|
||||
url: '../actionsByEmail/actionsByEmailAjax',
|
||||
args: 'action=saveConfiguration' +
|
||||
'&ABE_UID=' + getField('ABE_UID').value +
|
||||
'&PRO_UID=' + Pm.options.uid +
|
||||
'&TAS_UID=' + getField('TAS_UID').value +
|
||||
'&ABE_TYPE=' + getField('ABE_TYPE').value +
|
||||
'&ABE_TEMPLATE=' + getField('ABE_TEMPLATE').value +
|
||||
'&DYN_UID=' + getField('DYN_UID').value +
|
||||
'&ABE_EMAIL_FIELD=' + getField('ABE_EMAIL_FIELD').value +
|
||||
'&ABE_ACTION_FIELD=' + getField('ABE_ACTION_FIELD').value +
|
||||
'&ABE_CASE_NOTE_IN_RESPONSE=' + (getField('ABE_CASE_NOTE_IN_RESPONSE').checked ? 1 : 0)
|
||||
});
|
||||
rpc.callback = function(rpc) {
|
||||
var response = rpc.xmlhttp.responseText.parseJSON();
|
||||
if (response.status == 'OK') {
|
||||
getField('ABE_UID').value = response.ABE_UID;
|
||||
alert('Changes saved.');
|
||||
}
|
||||
else {
|
||||
alert(response.message);
|
||||
}
|
||||
};
|
||||
rpc.make();
|
||||
};
|
||||
|
||||
leimnud.event.add(getField('ABE_TYPE'), 'change', function() {
|
||||
switch (getField('ABE_TYPE').value) {
|
||||
case '':
|
||||
hideRowById('ABE_TEMPLATE');
|
||||
hideRowById('DYN_UID');
|
||||
hideRowById('ABE_EMAIL_FIELD');
|
||||
hideRowById('ABE_ACTION_FIELD');
|
||||
hideRowById('ABE_CASE_NOTE_IN_RESPONSE');
|
||||
break;
|
||||
case 'LINK':
|
||||
showRowById('ABE_TEMPLATE');
|
||||
showRowById('DYN_UID');
|
||||
showRowById('ABE_EMAIL_FIELD');
|
||||
hideRowById('ABE_ACTION_FIELD');
|
||||
showRowById('ABE_CASE_NOTE_IN_RESPONSE');
|
||||
break;
|
||||
case 'FIELD':
|
||||
showRowById('ABE_TEMPLATE');
|
||||
showRowById('DYN_UID');
|
||||
showRowById('ABE_EMAIL_FIELD');
|
||||
showRowById('ABE_ACTION_FIELD');
|
||||
showRowById('ABE_CASE_NOTE_IN_RESPONSE');
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
leimnud.event.add(getField('DYN_UID'), 'change', function() {
|
||||
loadFieldsABE();
|
||||
});
|
||||
|
||||
switch (getField('ABE_TYPE').value) {
|
||||
case '':
|
||||
hideRowById('ABE_TEMPLATE');
|
||||
hideRowById('DYN_UID');
|
||||
hideRowById('ABE_EMAIL_FIELD');
|
||||
hideRowById('ABE_ACTION_FIELD');
|
||||
hideRowById('ABE_CASE_NOTE_IN_RESPONSE');
|
||||
break;
|
||||
case 'LINK':
|
||||
showRowById('ABE_TEMPLATE');
|
||||
showRowById('DYN_UID');
|
||||
showRowById('ABE_EMAIL_FIELD');
|
||||
hideRowById('ABE_ACTION_FIELD');
|
||||
showRowById('ABE_CASE_NOTE_IN_RESPONSE');
|
||||
break;
|
||||
case 'FIELD':
|
||||
showRowById('ABE_TEMPLATE');
|
||||
showRowById('DYN_UID');
|
||||
showRowById('ABE_EMAIL_FIELD');
|
||||
showRowById('ABE_ACTION_FIELD');
|
||||
showRowById('ABE_CASE_NOTE_IN_RESPONSE');
|
||||
break;
|
||||
}
|
||||
|
||||
if (getField('DYN_UID').value != '') {
|
||||
loadFieldsABE();
|
||||
}
|
||||
]]></JS>
|
||||
</dynaForm>
|
||||
@@ -1,3 +0,0 @@
|
||||
<?php
|
||||
// ToDo: Render the tracking form, for the next release
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
[actionsByEmail]
|
||||
name = "Actions by Email"
|
||||
description = "It allows to perform actions on cases from an email sent to an user, in this first version it allows to fill out a form or select a value from one field to derivate the case later."
|
||||
pluginFolder = "actionsByEmail"
|
||||
setupPage = "actionsByEmail"
|
||||
version = ""
|
||||
pmVersion = ""
|
||||
dependencies = ""
|
||||
workspaces = ""
|
||||
@@ -1,231 +0,0 @@
|
||||
var actionsByEmailGrid;
|
||||
var store;
|
||||
var win ;
|
||||
|
||||
new Ext.KeyMap(document, {
|
||||
key: Ext.EventObject.F5,
|
||||
fn: function(keycode, e) {
|
||||
if (! e.ctrlKey) {
|
||||
if (Ext.isIE) {
|
||||
e.browserEvent.keyCode = 8;
|
||||
}
|
||||
e.stopEvent();
|
||||
document.location = document.location;
|
||||
} else {
|
||||
Ext.Msg.alert(_('ID_REFRESH_LABEL'), _('ID_REFRESH_MESSAGE'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Ext.onReady(function(){
|
||||
Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
|
||||
Ext.QuickTips.init();
|
||||
|
||||
store = new Ext.data.GroupingStore( {
|
||||
proxy : new Ext.data.HttpProxy({
|
||||
url: '../actionsByEmail/actionsByEmailAjax',
|
||||
method: 'POST'
|
||||
}),
|
||||
|
||||
reader : new Ext.data.JsonReader( {
|
||||
totalProperty: 'totalCount',
|
||||
root: 'data',
|
||||
fields : [
|
||||
{name : 'ABE_UID'},
|
||||
{name : 'ABE_REQ_UID'},
|
||||
{name : 'APP_UID'},
|
||||
{name : 'TAS_UID'},
|
||||
{name : 'ABE_REQ_DATE'},
|
||||
{name : 'ABE_REQ_SUBJECT'},
|
||||
{name : 'APP_NUMBER'},
|
||||
{name : 'USER'},
|
||||
{name : 'ABE_REQ_SENT_TO'},
|
||||
{name : 'ABE_REQ_STATUS'},
|
||||
{name : 'ABE_REQ_ANSWERED'},
|
||||
{name : 'ABE_RES_MESSAGE'}
|
||||
]
|
||||
})
|
||||
});
|
||||
store.setBaseParam( 'action', 'loadActionByEmail' );
|
||||
|
||||
actionsByEmailGrid = new Ext.grid.GridPanel( {
|
||||
region: 'center',
|
||||
layout: 'fit',
|
||||
id: 'actionsByEmailGrid',
|
||||
//width:800,
|
||||
title : '',
|
||||
stateful : true,
|
||||
stateId : 'grid',
|
||||
enableColumnResize: true,
|
||||
enableHdMenu: true,
|
||||
frame:false,
|
||||
columnLines: true,
|
||||
|
||||
cm: new Ext.grid.ColumnModel({
|
||||
defaults: {
|
||||
sortable: true
|
||||
},
|
||||
columns: [
|
||||
{id: 'ABE_UID', dataIndex: 'ABE_UID', hidden:true, hideable:false},
|
||||
{header: _('ID_DATE').toUpperCase(), width: 100, dataIndex: 'ABE_REQ_DATE', sortable: true },
|
||||
{header: "Case Number".toUpperCase(), width: 70, dataIndex: 'APP_NUMBER', sortable: true },
|
||||
{header: _('ID_SUBJECT').toUpperCase(), width: 150, dataIndex: 'ABE_REQ_SUBJECT', sortable: true },
|
||||
{header: _('ID_FROM').toUpperCase(), width: 110, dataIndex: 'USER', sortable: true },
|
||||
{header: _('ID_TO').toUpperCase(), width: 110, dataIndex: 'ABE_REQ_SENT_TO', sortable: true },
|
||||
{header: _('ID_STATUS').toUpperCase(), width: 40, dataIndex: 'ABE_REQ_STATUS', sortable: true },
|
||||
{header: "Answered".toUpperCase(), width: 60, dataIndex: 'ABE_REQ_ANSWERED' },
|
||||
{header: "View Response".toUpperCase(), width: 80, sortable: false, align: 'center', renderer: function(val){ return '<img src="/images/ext/default/s.gif" class="x-tree-node-icon ss_layout_header" unselectable="off" id="extdd-17" onclick="openForm()" '; }, dataIndex: 'somefieldofyourstore'},
|
||||
{header: "Error message".toUpperCase(), width: 130, dataIndex: 'ABE_RES_MESSAGE',sortable: false }
|
||||
]
|
||||
}),
|
||||
store: store,
|
||||
tbar:[
|
||||
{
|
||||
text: "Resend Email",
|
||||
iconCls: 'button_menu_ext ss_sprite ss_world',
|
||||
handler:ForwardEmail
|
||||
}
|
||||
],
|
||||
// paging bar on the bottom
|
||||
bbar: new Ext.PagingToolbar({
|
||||
pageSize: 25,
|
||||
store: store,
|
||||
displayInfo: true,
|
||||
displayMsg: _('ID_DISPLATING_ACTIONSBYEMAIL') + ' {0} - {1} ' + _('ID_DISPLAY_OF') + ' {2}'//,
|
||||
}),
|
||||
viewConfig: {
|
||||
forceFit: true
|
||||
},
|
||||
listeners: {
|
||||
render: function(){
|
||||
this.loadMask = new Ext.LoadMask(this.body, {msg:_('ID_LOADING_GRID')});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
store.load({params:{ start : 0 , limit : 25 }});
|
||||
actionsByEmailGrid.addListener('rowcontextmenu', onMessageContextMenu,this);
|
||||
actionsByEmailGrid.on('rowcontextmenu', function (grid, rowIndex, evt) {
|
||||
var sm = grid.getSelectionModel();
|
||||
sm.selectRow(rowIndex, sm.isSelected(rowIndex));
|
||||
|
||||
var rowSelected = Ext.getCmp('actionsByEmailGrid').getSelectionModel().getSelected();
|
||||
|
||||
}, this);
|
||||
actionsByEmailGrid.on('contextmenu', function (evt) {
|
||||
evt.preventDefault();
|
||||
}, this);
|
||||
|
||||
function onMessageContextMenu(grid, rowIndex, e) {
|
||||
e.stopEvent();
|
||||
var coords = e.getXY();
|
||||
messageContextMenu.showAt([coords[0], coords[1]]);
|
||||
}
|
||||
|
||||
var viewport = new Ext.Viewport({
|
||||
layout: 'border',
|
||||
autoScroll: true,
|
||||
items: [
|
||||
actionsByEmailGrid
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
function openForm(){
|
||||
var rows = actionsByEmailGrid.getSelectionModel().getSelections();
|
||||
var REQ_UID = '';
|
||||
var ids = '';
|
||||
for (i=0; i<rows.length; i++) {
|
||||
if (i != 0 ) {
|
||||
ids += ',';
|
||||
}
|
||||
ids += rows[i].get('APP_NUMBER') + ', ';
|
||||
ids += rows[i].get('ABE_REQ_SUBJECT');
|
||||
REQ_UID += rows[i].get('ABE_REQ_UID');
|
||||
}
|
||||
if ( REQ_UID != '' ) {
|
||||
win = new Ext.Window({
|
||||
id: 'win',
|
||||
title: ids,
|
||||
pageX: 100 ,
|
||||
pageY: 100 ,
|
||||
width: 500,
|
||||
floatable: true,
|
||||
autoHeight:true,
|
||||
modal: true,
|
||||
layout: 'fit',
|
||||
autoLoad : {
|
||||
url : '../actionsByEmail/actionsByEmailAjax',
|
||||
params : { action:'viewForm',REQ_UID : REQ_UID },
|
||||
scripts: true
|
||||
},
|
||||
plain: true,
|
||||
buttons: [{
|
||||
id: 'btn',
|
||||
text: _('ID_CLOSE'),
|
||||
handler: function() {
|
||||
//var index = this.id.replace('btn', '');
|
||||
win.hide();
|
||||
}
|
||||
}]}).show();
|
||||
} else {
|
||||
Ext.Msg.show({
|
||||
title:'',
|
||||
msg: TRANSLATIONS.ID_NO_SELECTION_WARNING,
|
||||
buttons: Ext.Msg.INFO,
|
||||
fn: function(){},
|
||||
animEl: 'elId',
|
||||
icon: Ext.MessageBox.INFO,
|
||||
buttons: Ext.MessageBox.OK
|
||||
});
|
||||
}
|
||||
}
|
||||
function ForwardEmail(){
|
||||
var rows = actionsByEmailGrid.getSelectionModel().getSelections();
|
||||
var REQ_UID = '';
|
||||
var ids = '';
|
||||
for (i=0; i<rows.length; i++) {
|
||||
if (i != 0 ) {
|
||||
ids += ',';
|
||||
}
|
||||
REQ_UID += rows[i].get('ABE_REQ_UID');
|
||||
ids += rows[i].get('APP_NUMBER') + ', ';
|
||||
ids += rows[i].get('ABE_REQ_SUBJECT');
|
||||
}
|
||||
if ( REQ_UID != '' ) {
|
||||
win = new Ext.Window({
|
||||
id: 'win',
|
||||
title: ids,
|
||||
pageX: 100 ,
|
||||
pageY: 100 ,
|
||||
width: 500,
|
||||
floatable: true,
|
||||
autoHeight:true,
|
||||
modal: true,
|
||||
layout: 'fit',
|
||||
autoLoad : {
|
||||
url : '../actionsByEmail/actionsByEmailAjax',
|
||||
params : { action:'forwardMail',REQ_UID :REQ_UID},
|
||||
scripts: true
|
||||
},
|
||||
plain: true,
|
||||
buttons: [{
|
||||
id: 'btn',
|
||||
text: _('ID_CLOSE'),
|
||||
handler: function() {
|
||||
win.hide();
|
||||
}
|
||||
}]}).show();
|
||||
} else {
|
||||
Ext.Msg.show({
|
||||
title:'',
|
||||
msg: "Select an item from the list",
|
||||
buttons: Ext.Msg.INFO,
|
||||
fn: function(){},
|
||||
animEl: 'elId',
|
||||
icon: Ext.MessageBox.INFO,
|
||||
buttons: Ext.MessageBox.OK
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,218 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Description of ActivityViews
|
||||
*
|
||||
*/
|
||||
class ActivityConfigurationView
|
||||
{
|
||||
public function retrieveView()
|
||||
{
|
||||
$view = array(
|
||||
'type' => 'form',
|
||||
'language' => 'en',
|
||||
'title' => 'Actions by Email',
|
||||
'layouts' => array(),
|
||||
'fields' => array(
|
||||
// array(
|
||||
// 'name' => 'IFORM',
|
||||
// 'type' => 'hidden'
|
||||
// ),
|
||||
// array(
|
||||
// 'name' => 'INDEX',
|
||||
// 'type' => 'hidden'
|
||||
// ),
|
||||
// array(
|
||||
// 'name' => 'ABE_UID',
|
||||
// 'type' => 'hidden'
|
||||
// ),
|
||||
// array(
|
||||
// 'name' => 'PRO_UID',
|
||||
// 'type' => 'hidden'
|
||||
// ),
|
||||
// array(
|
||||
// 'name' => 'PRJ_UID',
|
||||
// 'type' => 'hidden'
|
||||
// ),
|
||||
// array(
|
||||
// 'name' => 'TAS_UID',
|
||||
// 'type' => 'hidden'
|
||||
// ),
|
||||
// array(
|
||||
// 'name' => 'SYS_LANG',
|
||||
// 'type' => 'hidden'
|
||||
// ),
|
||||
// array(
|
||||
// 'name' => 'ABE_EMAIL_FIELD_VALUE',
|
||||
// 'type' => 'hidden'
|
||||
// ),
|
||||
// array(
|
||||
// 'name' => 'ABE_ACTION_FIELD_VALUE',
|
||||
// 'type' => 'hidden'
|
||||
// ),
|
||||
array(
|
||||
'name' => 'ABE_TYPE',
|
||||
'label' => 'Type',
|
||||
'type' => 'dropdown',
|
||||
'options' => array(
|
||||
array(
|
||||
'label' => '- None -',
|
||||
'value' => '',
|
||||
'type' => 'default'
|
||||
),
|
||||
array(
|
||||
'label' => 'Link to fill a form',
|
||||
'value' => 'LINK',
|
||||
),
|
||||
array(
|
||||
'label' => 'Use a field to generate actions links',
|
||||
'value' => 'FIELD',
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'name' => 'ABE_TEMPLATE',
|
||||
'label' => 'Template',
|
||||
'type' => 'dropdown',
|
||||
'data_source' => array(
|
||||
'type' => 'REST',
|
||||
'method' => 'GET',
|
||||
'end_point' => '/ActionsByEmail/Templates',
|
||||
'parameters' => array()
|
||||
),
|
||||
'options' => array(
|
||||
array(
|
||||
'value' => '',
|
||||
'label' => '- Select a Template -',
|
||||
'type' => 'default'
|
||||
)
|
||||
)
|
||||
),
|
||||
// array(
|
||||
// 'name' => 'EDIT',
|
||||
// 'type' => 'link',
|
||||
// 'value' => 'Edit',
|
||||
// 'action' => array(
|
||||
// 'type' => 'view-render',
|
||||
// 'data_source' => array(
|
||||
// 'type' => 'REST',
|
||||
// 'method' => 'GET',
|
||||
// 'end_point' => '/ActionsByEmail/Templates/editTemplate',
|
||||
// 'parameters' => array('ABE_TEMPLATE')
|
||||
// )
|
||||
// )
|
||||
// ),
|
||||
array(
|
||||
'name' => 'DYN_UID',
|
||||
'label' => 'Dynaform',
|
||||
'value' => 'DYN_UID',
|
||||
'type' => 'dropdown',
|
||||
'data_source' => array(
|
||||
'type' => 'REST',
|
||||
'method' => 'GET',
|
||||
'end_point' => '/project/{prj_uid}/dynaforms',
|
||||
'parameters' => array()
|
||||
),
|
||||
'options' => array(
|
||||
array(
|
||||
'value' => '',
|
||||
'label' => '- Select a Dynaform -',
|
||||
'type' => 'default'
|
||||
)
|
||||
),
|
||||
'events' => array(
|
||||
'change' => array(
|
||||
'listeners' => array('email-field', 'action-field')
|
||||
)
|
||||
),
|
||||
),
|
||||
array(
|
||||
'name' => 'ABE_EMAIL_FIELD',
|
||||
'value' => 'ABE_EMAIL_FIELD',
|
||||
'label' => 'Field with the email',
|
||||
'type' => 'dropdown',
|
||||
'options' => array(
|
||||
array(
|
||||
'value' => '',
|
||||
'label' => '- Send to the email of the assigned user to the task -',
|
||||
'type' => 'default'
|
||||
)
|
||||
),
|
||||
'listeners' => array(
|
||||
array(
|
||||
'name' => 'email-field',
|
||||
'action' => array(
|
||||
'type' => 'field-render',
|
||||
'data_source' => array(
|
||||
'type' => 'REST',
|
||||
'method' => 'GET',
|
||||
'end_point' => '/project/{prj_uid}/dynaform/{dyn_uid}/fields',
|
||||
'parameters' => array()
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'name' => 'ABE_ACTION_FIELD',
|
||||
'value' => 'ABE_ACTION_FIELD',
|
||||
'label' => 'Field to Send in the Email',
|
||||
'type' => 'dropdown',
|
||||
'options' => array(
|
||||
array(
|
||||
'value' => '',
|
||||
'label' => '- Select a Field -',
|
||||
'type' => 'default'
|
||||
)
|
||||
),
|
||||
'listeners' => array(
|
||||
'name' => 'action-field',
|
||||
'action' => array(
|
||||
'type' => 'field-render',
|
||||
'data_source' => array(
|
||||
'type' => 'REST',
|
||||
'method' => 'GET',
|
||||
'end_point' => '/project/:prj_uid/dynaform/:dyn_uid/fields',
|
||||
'parameters' => array()
|
||||
)
|
||||
)
|
||||
)
|
||||
),
|
||||
array(
|
||||
'name' => 'ABE_CASE_NOTE_IN_RESPONSE',
|
||||
'type' => 'checkbox',
|
||||
'labelVisible' => false,
|
||||
'options' => array(
|
||||
array(
|
||||
'id' => 'formTimingControlOption',
|
||||
'label' => 'Register a Case Note when the recipient submits the Response',
|
||||
'value' => '1'
|
||||
)
|
||||
)
|
||||
),
|
||||
// array(
|
||||
// 'name' => 'APPLY_CHANGES',
|
||||
// 'type' => 'button',
|
||||
// 'label' => 'Apply Changes',
|
||||
// 'value' => 'APPLY_CHANGES',
|
||||
// 'action' => array(
|
||||
// 'type' => 'view-close',
|
||||
// 'data_source' => array(
|
||||
// 'type' => 'REST',
|
||||
// 'method' => 'POST',
|
||||
// 'end_point' => '/ActionsByEmail/saveConfiguration',
|
||||
// 'parameters' => array('_ALL')
|
||||
// )
|
||||
// )
|
||||
// ),
|
||||
// array(
|
||||
// 'name' => 'REQUIRED_LABEL',
|
||||
// 'type' => 'label',
|
||||
// 'label' => 'Required Field',
|
||||
// 'value' => 'REQUIRED_LABEL'
|
||||
// )
|
||||
)
|
||||
);
|
||||
return $view;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -74,15 +74,22 @@ class Activity extends Api
|
||||
*/
|
||||
public function doGetProjectActivityFeatureConfiguration($pro_uid, $tas_uid, $filter = '')
|
||||
{
|
||||
|
||||
try {
|
||||
$featureHandler = new \Features\FeaturesHandler();
|
||||
$configuration = $featureHandler->loadConfiguration(array(
|
||||
'type' => 'activity',
|
||||
'form' => 'configuration',
|
||||
'PRO_UID' => $pro_uid,
|
||||
'TAS_UID' => $tas_uid
|
||||
));
|
||||
return $configuration;
|
||||
$configurations = array();
|
||||
if (PMLicensedFeatures
|
||||
::getSingleton()
|
||||
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
|
||||
$params = array(
|
||||
'type' => 'activity',
|
||||
'form' => 'configuration',
|
||||
'PRO_UID' => $pro_uid,
|
||||
'TAS_UID' => $tas_uid
|
||||
);
|
||||
$actionsByEmailService = new \Features\ActionsByEmail\ActionsByEmailService();
|
||||
$configurations[] = $actionsByEmailService->loadConfiguration($params);
|
||||
}
|
||||
return $configurations;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
@@ -110,8 +117,12 @@ class Activity extends Api
|
||||
$properties = $task->updateProperties($prj_uid, $act_uid, $request_data);
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$featureHandler = new \Features\FeaturesHandler();
|
||||
$featureHandler->saveConfiguration($request_data['properties']['_features']);
|
||||
if (PMLicensedFeatures
|
||||
::getSingleton()
|
||||
->verifyfeature('zLhSk5TeEQrNFI2RXFEVktyUGpnczV1WEJNWVp6cjYxbTU3R29mVXVZNWhZQT0=')) {
|
||||
$actionsByEmailService = new \Features\ActionsByEmail\ActionsByEmailService();
|
||||
$actionsByEmailService->saveConfiguration($request_data['properties']['_features']);
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
|
||||
Reference in New Issue
Block a user