HOR-3214
Fixed the code reviews.
This commit is contained in:
@@ -27785,6 +27785,18 @@ msgstr "View Response"
|
|||||||
msgid "Error Message"
|
msgid "Error Message"
|
||||||
msgstr "Error Message"
|
msgstr "Error Message"
|
||||||
|
|
||||||
|
# TRANSLATION
|
||||||
|
# LABEL/ID_CASE_CREATED
|
||||||
|
#: LABEL/ID_CASE_CREATED
|
||||||
|
msgid "Case created"
|
||||||
|
msgstr "Case created"
|
||||||
|
|
||||||
|
# TRANSLATION
|
||||||
|
# LABEL/ID_CASE_ROUTED_TO
|
||||||
|
#: LABEL/ID_CASE_ROUTED_TO
|
||||||
|
msgid "Case routed to"
|
||||||
|
msgstr "Case routed to"
|
||||||
|
|
||||||
# additionalTables/additionalTablesData.xml?ADD_TAB_NAME
|
# additionalTables/additionalTablesData.xml?ADD_TAB_NAME
|
||||||
# additionalTables/additionalTablesData.xml
|
# additionalTables/additionalTablesData.xml
|
||||||
#: text - ADD_TAB_NAME
|
#: text - ADD_TAB_NAME
|
||||||
|
|||||||
@@ -6171,7 +6171,9 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
|||||||
( 'LABEL','ID_CASE_NUMBER_CAPITALIZED','en','Case Number','2017-02-22') ,
|
( 'LABEL','ID_CASE_NUMBER_CAPITALIZED','en','Case Number','2017-02-22') ,
|
||||||
( 'LABEL','ID_ANSWERED','en','Answered','2017-02-22') ,
|
( 'LABEL','ID_ANSWERED','en','Answered','2017-02-22') ,
|
||||||
( 'LABEL','ID_VIEW_RESPONSE','en','View Response','2017-02-22') ,
|
( 'LABEL','ID_VIEW_RESPONSE','en','View Response','2017-02-22') ,
|
||||||
( 'LABEL','ID_ERROR_MESSAGE','en','Error Message','2017-02-22') ;
|
( 'LABEL','ID_ERROR_MESSAGE','en','Error Message','2017-02-22') ,
|
||||||
|
( 'LABEL','ID_CASE_CREATED','en','Case created','2017-06-02') ,
|
||||||
|
( 'LABEL','ID_CASE_ROUTED_TO','en','Case routed to','2017-06-02');
|
||||||
|
|
||||||
INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES
|
INSERT INTO ISO_LOCATION (IC_UID,IL_UID,IL_NAME,IL_NORMAL_NAME,IS_UID) VALUES
|
||||||
('AD','','',' ','') ,
|
('AD','','',' ','') ,
|
||||||
|
|||||||
@@ -1109,11 +1109,10 @@ try {
|
|||||||
$aFields["TASK"][$sKey]["NEXT_TASK"]["TAS_TITLE"] = G::LoadTranslation("ID_ROUTE_TO_TASK_INTERMEDIATE_CATCH_MESSAGE_EVENT");
|
$aFields["TASK"][$sKey]["NEXT_TASK"]["TAS_TITLE"] = G::LoadTranslation("ID_ROUTE_TO_TASK_INTERMEDIATE_CATCH_MESSAGE_EVENT");
|
||||||
}
|
}
|
||||||
|
|
||||||
//SKIP ASSIGN SCRREN
|
//SKIP ASSIGN SCREEN
|
||||||
if (!empty($aFields['TASK'][1])) {
|
if (!empty($aFields['TASK'][1])) {
|
||||||
$currentTask = $aFields['TASK'][1];
|
$currentTask = $aFields['TASK'][1];
|
||||||
$isWebEntry = $bmWebEntry->isTaskAWebEntry($currentTask['TAS_UID']);
|
$isWebEntry = $bmWebEntry->isTaskAWebEntry($currentTask['TAS_UID']);
|
||||||
$skipRoutingScreen = $isWebEntry;
|
|
||||||
if ($isWebEntry) {
|
if ($isWebEntry) {
|
||||||
$tplFile = 'webentry/cases_ScreenDerivation';
|
$tplFile = 'webentry/cases_ScreenDerivation';
|
||||||
$caseId = $currentTask['APP_UID'];
|
$caseId = $currentTask['APP_UID'];
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<link rel="stylesheet" href="/lib/pmdynaform/libs/bootstrap-3.1.1/css/bootstrap.min.css">
|
<link rel="stylesheet" href="/lib/pmdynaform/libs/bootstrap-3.1.1/css/bootstrap.min.css">
|
||||||
<title><?= htmlentities($webEntryModel->getWeCustomTitle()) ?></title>
|
<title><?php echo htmlentities($webEntryModel->getWeCustomTitle()); ?></title>
|
||||||
<?php
|
<?php
|
||||||
$oHeadPublisher = & headPublisher::getSingleton();
|
$oHeadPublisher = & headPublisher::getSingleton();
|
||||||
echo $oHeadPublisher->getExtJsStylesheets(SYS_SKIN);
|
echo $oHeadPublisher->getExtJsStylesheets(SYS_SKIN);
|
||||||
@@ -89,11 +89,11 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
<div class="header">
|
<div class="header">
|
||||||
<img id="avatar">
|
<img id="avatar">
|
||||||
<span class="logout"><a href="javascript:void(1)" id="userInformation"></a></span>
|
<span class="logout"><a href="javascript:void(1)" id="userInformation"></a></span>
|
||||||
<span class="logout"><a href="javascript:logout(1)" id="logout"><?=G::LoadTranslation('ID_LOGOUT')?></a></span>
|
<span class="logout"><a href="javascript:logout(1)" id="logout"><?php echo G::LoadTranslation('ID_LOGOUT'); ?></a></span>
|
||||||
</div>
|
</div>
|
||||||
<iframe id="iframe" ></iframe>
|
<iframe id="iframe" ></iframe>
|
||||||
<form id="messageBox" class="formDefault formWE" method="post" style="display: none;">
|
<form id="messageBox" class="formDefault formWE" method="post" style="display: none;">
|
||||||
<div class="borderForm" style="width:520px; padding-left:0; padding-right:0; border-width:1;">
|
<div class="borderForm" style="width:520px; padding-left:0; padding-right:0; border-width:1px;">
|
||||||
<div class="boxTop"><div class="a"> </div><div class="b"> </div><div class="c"> </div></div>
|
<div class="boxTop"><div class="a"> </div><div class="b"> </div><div class="c"> </div></div>
|
||||||
<div class="content" style="height:100%;">
|
<div class="content" style="height:100%;">
|
||||||
<table width="99%">
|
<table width="99%">
|
||||||
@@ -101,7 +101,7 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
<td valign="top">
|
<td valign="top">
|
||||||
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
<table cellspacing="0" cellpadding="0" border="0" width="100%">
|
||||||
<tbody><tr>
|
<tbody><tr>
|
||||||
<td class="FormTitle" colspan="2" align=""><span id="form[TITLE]" name="form[TITLE]" pmfieldtype="title"><?=G::LoadTranslation('ID_ERROR')?></span></td>
|
<td class="FormTitle" colspan="2" align=""><span id="form[TITLE]" name="form[TITLE]" pmfieldtype="title"><?php echo G::LoadTranslation('ID_ERROR'); ?></span></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="FormLabel" width="0"><label for="form[MESSAGE]"></label></td>
|
<td class="FormLabel" width="0"><label for="form[MESSAGE]"></label></td>
|
||||||
@@ -109,7 +109,7 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
</tr>
|
</tr>
|
||||||
<tr id="messageBoxReset" style="display:none;">
|
<tr id="messageBoxReset" style="display:none;">
|
||||||
<td class="FormLabel" width="0"></td>
|
<td class="FormLabel" width="0"></td>
|
||||||
<td class="FormFieldContent" width="520" style="text-align: right;"><button type="button" onclick="resetLocalData(true)"><?=G::LoadTranslation('ID_RESET')?></button></td>
|
<td class="FormFieldContent" width="520" style="text-align: right;"><button type="button" onclick="resetLocalData(true)"><?php echo G::LoadTranslation('ID_RESET'); ?></button></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody></table>
|
</tbody></table>
|
||||||
</td>
|
</td>
|
||||||
@@ -128,12 +128,12 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
if (reload) {
|
if (reload) {
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
var app = {
|
var app = {
|
||||||
$element:{
|
$element:{
|
||||||
avatar: document.getElementById("avatar"),
|
avatar: $("#avatar").get(0),
|
||||||
userInformation: document.getElementById("userInformation"),
|
userInformation: $("#userInformation").get(0),
|
||||||
errorMessage: document.getElementById("errorMessage")
|
errorMessage: $("#errorMessage").get(0)
|
||||||
},
|
},
|
||||||
setAvatar:function(src){
|
setAvatar:function(src){
|
||||||
this.$element.avatar.src=src;
|
this.$element.avatar.src=src;
|
||||||
@@ -148,7 +148,7 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
return this.$element.userInformation.textContent;
|
return this.$element.userInformation.textContent;
|
||||||
},
|
},
|
||||||
loadUserInformation:function(userInformation) {
|
loadUserInformation:function(userInformation) {
|
||||||
var format = <?= G::json_encode($userInformationFormat) ?>;
|
var format = <?php echo G::json_encode($userInformationFormat); ?>;
|
||||||
this.setAvatar(userInformation.image);
|
this.setAvatar(userInformation.image);
|
||||||
for(var key in userInformation) {
|
for(var key in userInformation) {
|
||||||
format = format.replace("@"+key, userInformation[key]);
|
format = format.replace("@"+key, userInformation[key]);
|
||||||
@@ -176,14 +176,14 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
!function () {
|
!function () {
|
||||||
var DEBUG_ENABLED = true;
|
var DEBUG_ENABLED = false;
|
||||||
var processUid = <?= G::json_encode($webEntryModel->getProUid()) ?>;
|
var processUid = <?php echo G::json_encode($webEntryModel->getProUid()); ?>;
|
||||||
var tasUid = <?= G::json_encode($webEntryModel->getTasUid()) ?>;
|
var tasUid = <?php echo G::json_encode($webEntryModel->getTasUid()); ?>;
|
||||||
var weUid = <?= G::json_encode($webEntryModel->getWeUid()) ?>;
|
var weUid = <?php echo G::json_encode($webEntryModel->getWeUid()); ?>;
|
||||||
var forceLogin = <?= G::json_encode($webEntryModel->getWeAuthentication()==='LOGIN_REQUIRED') ?>;
|
var forceLogin = <?php echo G::json_encode($webEntryModel->getWeAuthentication()==='LOGIN_REQUIRED'); ?>;
|
||||||
var isLogged = <?= G::json_encode(!empty($_SESSION['USER_LOGGED'])) ?>;
|
var isLogged = <?php echo G::json_encode(!empty($_SESSION['USER_LOGGED'])); ?>;
|
||||||
var closeSession = <?= G::json_encode($webEntryModel->getWeCallback()==='CUSTOM_CLEAR') ?>;
|
var closeSession = <?php echo G::json_encode($webEntryModel->getWeCallback()==='CUSTOM_CLEAR'); ?>;
|
||||||
var hideInformationBar = <?= G::json_encode(!!$webEntryModel->getWeHideInformationBar()) ?>;
|
var hideInformationBar = <?php echo G::json_encode(!!$webEntryModel->getWeHideInformationBar()); ?>;
|
||||||
if (!forceLogin) {
|
if (!forceLogin) {
|
||||||
$("#logout").hide();
|
$("#logout").hide();
|
||||||
}
|
}
|
||||||
@@ -196,16 +196,16 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
$('#messageBoxReset').hide();
|
$('#messageBoxReset').hide();
|
||||||
}
|
}
|
||||||
$('#messageBox').show();
|
$('#messageBox').show();
|
||||||
}
|
};
|
||||||
var log = function() {
|
var log = function() {
|
||||||
if (DEBUG_ENABLED) {
|
if (DEBUG_ENABLED) {
|
||||||
console.log.apply(console, arguments);
|
console.log.apply(console, arguments);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
if (localStorage.weData) {
|
if (localStorage.weData) {
|
||||||
try {
|
try {
|
||||||
weData = JSON.parse(localStorage.weData);
|
weData = JSON.parse(localStorage.weData);
|
||||||
if (weData.TAS_UID!=tasUid) {
|
if (weData.TAS_UID!==tasUid) {
|
||||||
//TAS_UID is different, reset.
|
//TAS_UID is different, reset.
|
||||||
resetLocalData();
|
resetLocalData();
|
||||||
}
|
}
|
||||||
@@ -221,7 +221,7 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
return (iframe.contentDocument) ?
|
return (iframe.contentDocument) ?
|
||||||
iframe.contentDocument :
|
iframe.contentDocument :
|
||||||
iframe.contentWindow.document;
|
iframe.contentWindow.document;
|
||||||
}
|
};
|
||||||
var open = function (url, callback) {
|
var open = function (url, callback) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
var iframe = document.getElementById("iframe");
|
var iframe = document.getElementById("iframe");
|
||||||
@@ -232,7 +232,7 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
if (callback(event, resolve, reject)) {
|
if (callback(event, resolve, reject)) {
|
||||||
iframe.style.opacity = 1;
|
iframe.style.opacity = 1;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
})();
|
})();
|
||||||
} else {
|
} else {
|
||||||
iframe.style.opacity = 1;
|
iframe.style.opacity = 1;
|
||||||
@@ -246,14 +246,14 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
reject(this, arguments);
|
reject(this, arguments);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
var verifyLogin = function () {
|
var verifyLogin = function () {
|
||||||
if (forceLogin) {
|
if (forceLogin) {
|
||||||
return login();
|
return login();
|
||||||
} else {
|
} else {
|
||||||
return anonymousLogin();
|
return anonymousLogin();
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
var login = function () {
|
var login = function () {
|
||||||
return new Promise(function (logged, failure) {
|
return new Promise(function (logged, failure) {
|
||||||
if (!isLogged) {
|
if (!isLogged) {
|
||||||
@@ -276,16 +276,16 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
var anonymousLogin = function () {
|
var anonymousLogin = function () {
|
||||||
return new Promise(function (resolve, failure) {
|
return new Promise(function (resolve, failure) {
|
||||||
log("anonymousLogin");
|
log("anonymousLogin");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '../services/webentry/anonymous_login',
|
url: '../services/webentry/anonymousLogin',
|
||||||
method: 'get',
|
method: 'get',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: {
|
data: {
|
||||||
we_uid: weUid,
|
we_uid: weUid
|
||||||
},
|
},
|
||||||
success: function (userInformation) {
|
success: function (userInformation) {
|
||||||
resolve(userInformation);
|
resolve(userInformation);
|
||||||
@@ -295,20 +295,20 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
var loadUserInformation = function (userInformation) {
|
var loadUserInformation = function (userInformation) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
log("userInformation:", userInformation);
|
log("userInformation:", userInformation);
|
||||||
app.loadUserInformation(userInformation);
|
app.loadUserInformation(userInformation);
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
var checkWebEntryCase = function (userInformation) {
|
var checkWebEntryCase = function (userInformation) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
if (localStorage.weData) {
|
if (localStorage.weData) {
|
||||||
log("checkWebEntryCase");
|
log("checkWebEntryCase");
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '../services/webentry/check_case',
|
url: '../services/webentry/checkCase',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
data: {
|
data: {
|
||||||
@@ -331,7 +331,7 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
var initCase = function () {
|
var initCase = function () {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
if (!hideInformationBar) {
|
if (!hideInformationBar) {
|
||||||
@@ -346,7 +346,7 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
data: {
|
data: {
|
||||||
action: 'startCase',
|
action: 'startCase',
|
||||||
processId: processUid,
|
processId: processUid,
|
||||||
taskId: tasUid,
|
taskId: tasUid
|
||||||
},
|
},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
data.TAS_UID = tasUid;
|
data.TAS_UID = tasUid;
|
||||||
@@ -359,7 +359,7 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
resolve(weData);
|
resolve(weData);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
var casesStep = function (data) {
|
var casesStep = function (data) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
log("casesStep");
|
log("casesStep");
|
||||||
@@ -386,13 +386,13 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
reject();
|
reject();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
var routeWebEntry = function (callbackUrl) {
|
var routeWebEntry = function (callbackUrl) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
log("routeWebEntry", callbackUrl);
|
log("routeWebEntry", callbackUrl);
|
||||||
resolve(callbackUrl);
|
resolve(callbackUrl);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
var closeWebEntry = function (callbackUrl) {
|
var closeWebEntry = function (callbackUrl) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
log("closeWebEntry");
|
log("closeWebEntry");
|
||||||
@@ -402,70 +402,69 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|||||||
}
|
}
|
||||||
resolve(callbackUrl);
|
resolve(callbackUrl);
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
var redirectCallback = function (callbackUrl) {
|
var redirectCallback = function (callbackUrl) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
log("redirect");
|
log("redirect");
|
||||||
location.href = callbackUrl;
|
location.href = callbackUrl;
|
||||||
//open(callbackUrl);
|
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
//Errors
|
//Errors
|
||||||
var errorLogin = function () {
|
var errorLogin = function () {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
log("errorLogin");
|
log("errorLogin");
|
||||||
var msg = <?=G::json_encode(G::LoadTranslation('ID_EXCEPTION_LOG_INTERFAZ'))?>;
|
var msg = <?php echo G::json_encode(G::LoadTranslation('ID_EXCEPTION_LOG_INTERFAZ')); ?>;
|
||||||
msg = msg.replace("{0}", "LOGIN");
|
msg = msg.replace("{0}", "LOGIN");
|
||||||
error(msg);
|
error(msg);
|
||||||
resetLocalData();
|
resetLocalData();
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
var errorLoadUserInfo = function () {
|
var errorLoadUserInfo = function () {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
log("errorLoadUserInfo");
|
log("errorLoadUserInfo");
|
||||||
var msg = <?=G::json_encode(G::LoadTranslation('ID_EXCEPTION_LOG_INTERFAZ'))?>;
|
var msg = <?php echo G::json_encode(G::LoadTranslation('ID_EXCEPTION_LOG_INTERFAZ')); ?>;
|
||||||
msg = msg.replace("{0}", "USR001");
|
msg = msg.replace("{0}", "USR001");
|
||||||
error(msg);
|
error(msg);
|
||||||
resetLocalData();
|
resetLocalData();
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
var errorCheckWebEntry = function () {
|
var errorCheckWebEntry = function () {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
log("errorCheckWebEntry");
|
log("errorCheckWebEntry");
|
||||||
var msg = <?=G::json_encode(G::LoadTranslation('ID_EXCEPTION_LOG_INTERFAZ'))?>;
|
var msg = <?php echo G::json_encode(G::LoadTranslation('ID_EXCEPTION_LOG_INTERFAZ')); ?>;
|
||||||
msg = msg.replace("{0}", "WEE001");
|
msg = msg.replace("{0}", "WEE001");
|
||||||
error(msg);
|
error(msg);
|
||||||
resetLocalData();
|
resetLocalData();
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
var errorInitCase = function () {
|
var errorInitCase = function () {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
log("error Init case");
|
log("error Init case");
|
||||||
var msg = <?=G::json_encode(G::LoadTranslation('ID_EXCEPTION_LOG_INTERFAZ'))?>;
|
var msg = <?php echo G::json_encode(G::LoadTranslation('ID_EXCEPTION_LOG_INTERFAZ')); ?>;
|
||||||
msg = msg.replace("{0}", "INIT001");
|
msg = msg.replace("{0}", "INIT001");
|
||||||
error(msg);
|
error(msg);
|
||||||
resetLocalData();
|
resetLocalData();
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
var errorStep = function () {
|
var errorStep = function () {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
log("Step Error");
|
log("Step Error");
|
||||||
var msg = <?=G::json_encode(G::LoadTranslation('ID_EXCEPTION_LOG_INTERFAZ'))?>;
|
var msg = <?php echo G::json_encode(G::LoadTranslation('ID_EXCEPTION_LOG_INTERFAZ')); ?>;
|
||||||
msg = msg.replace("{0}", "STEP001");
|
msg = msg.replace("{0}", "STEP001");
|
||||||
error(msg);
|
error(msg);
|
||||||
resetLocalData();
|
resetLocalData();
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
var errorRouting = function () {
|
var errorRouting = function () {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
log("errorRouting");
|
log("errorRouting");
|
||||||
var msg = <?=G::json_encode(G::LoadTranslation('ID_EXCEPTION_LOG_INTERFAZ'))?>;
|
var msg = <?php echo G::json_encode(G::LoadTranslation('ID_EXCEPTION_LOG_INTERFAZ')); ?>;
|
||||||
msg = msg.replace("{0}", "ROU001");
|
msg = msg.replace("{0}", "ROU001");
|
||||||
error(msg);
|
error(msg);
|
||||||
resetLocalData();
|
resetLocalData();
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
//Execute WebEntry Flow
|
//Execute WebEntry Flow
|
||||||
verifyLogin().catch(errorLogin)
|
verifyLogin().catch(errorLogin)
|
||||||
.then(loadUserInformation).catch(errorLoadUserInfo)
|
.then(loadUserInformation).catch(errorLoadUserInfo)
|
||||||
|
|||||||
@@ -402,8 +402,7 @@ class WebEntry
|
|||||||
$fileContent .= '$webEntry = new ' . WebEntry::class . ";\n";
|
$fileContent .= '$webEntry = new ' . WebEntry::class . ";\n";
|
||||||
$fileContent .= "\$processUid = \"" . $processUid . "\";\n";
|
$fileContent .= "\$processUid = \"" . $processUid . "\";\n";
|
||||||
$fileContent .= "\$weUid = \"" . $arrayWebEntryData['WE_UID'] . "\";\n";
|
$fileContent .= "\$weUid = \"" . $arrayWebEntryData['WE_UID'] . "\";\n";
|
||||||
$fileContent .= "\$tasUid = \"" . $arrayWebEntryData['TAS_UID'] . "\";\n";
|
$fileContent .= 'if (!$webEntry->isWebEntryOne($weUid)) {'."\n";
|
||||||
$fileContent .= 'if (!$webEntry->isWebEntryOne($processUid, $weUid)) {'."\n";
|
|
||||||
$fileContent .= " return require(PATH_METHODS . 'webentry/access.php');\n";
|
$fileContent .= " return require(PATH_METHODS . 'webentry/access.php');\n";
|
||||||
$fileContent .= "}\n";
|
$fileContent .= "}\n";
|
||||||
$fileContent .= "if (!isset(\$_DBArray)) {\n";
|
$fileContent .= "if (!isset(\$_DBArray)) {\n";
|
||||||
@@ -1079,7 +1078,7 @@ class WebEntry
|
|||||||
* @param type $weUid
|
* @param type $weUid
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function isWebEntryOne($processUid, $weUid)
|
public function isWebEntryOne($weUid)
|
||||||
{
|
{
|
||||||
$webEntry = \WebEntryPeer::retrieveByPK($weUid);
|
$webEntry = \WebEntryPeer::retrieveByPK($weUid);
|
||||||
return $webEntry->getWeType()==='SINGLE' && $webEntry->getWeAuthentication()==='ANONYMOUS';
|
return $webEntry->getWeType()==='SINGLE' && $webEntry->getWeAuthentication()==='ANONYMOUS';
|
||||||
@@ -1089,7 +1088,7 @@ class WebEntry
|
|||||||
* Verify if a Task is and Web Entry auxiliar task.
|
* Verify if a Task is and Web Entry auxiliar task.
|
||||||
*
|
*
|
||||||
* @param type $tasUid
|
* @param type $tasUid
|
||||||
* @return type
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function isTaskAWebEntry($tasUid)
|
public function isTaskAWebEntry($tasUid)
|
||||||
{
|
{
|
||||||
@@ -1112,11 +1111,11 @@ class WebEntry
|
|||||||
{
|
{
|
||||||
$appNumber = $data['APP_NUMBER'];
|
$appNumber = $data['APP_NUMBER'];
|
||||||
$appUid = $data['APPLICATION'];
|
$appUid = $data['APPLICATION'];
|
||||||
$message = "\nCase created in ProcessMaker".
|
$message = "\n".\G::LoadTranslation('ID_CASE_CREATED').
|
||||||
"\nCase Number: $appNumber".
|
"\n".\G::LoadTranslation('ID_CASE_NUMBER').": $appNumber".
|
||||||
"\nCase Id: $appUid";
|
"\n".\G::LoadTranslation('ID_CASESLIST_APP_UID').": $appUid";
|
||||||
foreach($data['_DELEGATION_DATA'] as $task) {
|
foreach($data['_DELEGATION_DATA'] as $task) {
|
||||||
$message.="\nCase routed to: ".
|
$message.="\n".\G::LoadTranslation('ID_CASE_ROUTED_TO').": ".
|
||||||
$task['NEXT_TASK']['TAS_TITLE'].
|
$task['NEXT_TASK']['TAS_TITLE'].
|
||||||
"(".htmlentities($task['NEXT_TASK']['USER_ASSIGNED']['USR_USERNAME']).")";
|
"(".htmlentities($task['NEXT_TASK']['USER_ASSIGNED']['USR_USERNAME']).")";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,322 +0,0 @@
|
|||||||
<html>
|
|
||||||
<head>
|
|
||||||
<?php
|
|
||||||
$oHeadPublisher = & headPublisher::getSingleton();
|
|
||||||
echo htmlentities($oHeadPublisher->getExtJsStylesheets(SYS_SKIN));
|
|
||||||
?>
|
|
||||||
<style>
|
|
||||||
html, body, iframe {
|
|
||||||
border:none;
|
|
||||||
width: 100%;
|
|
||||||
top:0px;
|
|
||||||
height:100%;
|
|
||||||
margin: 0px;
|
|
||||||
padding: 0px;
|
|
||||||
}
|
|
||||||
iframe {
|
|
||||||
position: absolute;
|
|
||||||
border:none;
|
|
||||||
width: 100%;
|
|
||||||
top:60px;
|
|
||||||
bottom:0px;
|
|
||||||
margin: 0px;
|
|
||||||
padding: 0px;
|
|
||||||
}
|
|
||||||
.header {
|
|
||||||
height: 60px;
|
|
||||||
}
|
|
||||||
#avatar {
|
|
||||||
background-color: buttonface;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border-radius: 50%;
|
|
||||||
border: 1px solid black;
|
|
||||||
margin-left: 8px;
|
|
||||||
margin-top: 4px;
|
|
||||||
display: inline-block;
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
#userInformation {
|
|
||||||
display: inline-block;
|
|
||||||
margin-top: 20px;
|
|
||||||
position: absolute;
|
|
||||||
margin-left: 64px;
|
|
||||||
}
|
|
||||||
#logout {
|
|
||||||
margin-top: 20px;
|
|
||||||
position: absolute;
|
|
||||||
margin-left: 64px;
|
|
||||||
right: 8px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<?php
|
|
||||||
$conf = new Configurations();
|
|
||||||
$configuration = $conf->getConfiguration("ENVIRONMENT_SETTINGS", "", "", "", "", $outResult);
|
|
||||||
?>
|
|
||||||
<div class="header">
|
|
||||||
<img id="avatar">
|
|
||||||
<span id="userInformation"></span>
|
|
||||||
<a href="javascript:logout(1)" id="logout"><?=G::LoadTranslation('ID_LOGOUT')?></a>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
var app = {
|
|
||||||
$element:{
|
|
||||||
avatar: document.getElementById("avatar"),
|
|
||||||
userInformation: document.getElementById("userInformation")
|
|
||||||
},
|
|
||||||
setAvatar:function(src){
|
|
||||||
this.$element.avatar.src=src;
|
|
||||||
},
|
|
||||||
getAvatar:function(){
|
|
||||||
return this.$avatar.src;
|
|
||||||
},
|
|
||||||
setUserInformation:function(textContent){
|
|
||||||
this.$element.userInformation.textContent=textContent;
|
|
||||||
},
|
|
||||||
getUserInformation:function(){
|
|
||||||
return this.$element.userInformation.textContent;
|
|
||||||
},
|
|
||||||
loadUserInformation:function(userInformation) {
|
|
||||||
var format = <?= G::json_encode($configuration['format']) ?>;
|
|
||||||
this.setAvatar(userInformation.image);
|
|
||||||
for(var key in userInformation) {
|
|
||||||
format = format.replace("@"+key, userInformation[key]);
|
|
||||||
};
|
|
||||||
this.setUserInformation(format);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
function logout(reload) {
|
|
||||||
$.ajax({
|
|
||||||
url: '../login/login',
|
|
||||||
success: function () {
|
|
||||||
if (reload) {
|
|
||||||
localStorage.removeItem('weData');
|
|
||||||
location.reload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<iframe id="iframe" ></iframe>
|
|
||||||
<script src="/lib/js/jquery-1.10.2.min.js"></script>
|
|
||||||
<script>
|
|
||||||
!function () {
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
|
|
||||||
?>
|
|
||||||
var processUid = <?= G::json_encode($webEntryModel->getProUid()) ?>;
|
|
||||||
var tasUid = <?= G::json_encode($webEntryModel->getTasUid()) ?>;
|
|
||||||
var weUid = <?= G::json_encode($webEntryModel->getWeUid()) ?>;
|
|
||||||
var forceLogin = <?= G::json_encode($webEntryModel->getWeAuthentication()==='LOGIN_REQUIRED') ?>;
|
|
||||||
var isLogged = <?= G::json_encode(!empty($_SESSION['USER_LOGGED'])) ?>;
|
|
||||||
var closeSession = <?= G::json_encode($webEntryModel->getWeCallback()==='CUSTOM_CLEAR') ?>;
|
|
||||||
var onLoadIframe = function () {};
|
|
||||||
var initialWeData = localStorage.weData;
|
|
||||||
var weData = {};
|
|
||||||
if (localStorage.weData) {
|
|
||||||
try {
|
|
||||||
weData = JSON.parse(localStorage.weData);
|
|
||||||
if (weData.TAS_UID!=tasUid) {
|
|
||||||
//TAS_UID is different, reset.
|
|
||||||
localStorage.removeItem('weData');
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
//corrupt weData, reset.
|
|
||||||
localStorage.removeItem('weData');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$("#iframe").load(function (event) {
|
|
||||||
onLoadIframe(event);
|
|
||||||
});
|
|
||||||
var getContentDocument = function (iframe) {
|
|
||||||
return (iframe.contentDocument) ?
|
|
||||||
iframe.contentDocument :
|
|
||||||
iframe.contentWindow.document;
|
|
||||||
}
|
|
||||||
var open = function (url, callback) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
var iframe = document.getElementById("iframe");
|
|
||||||
if (typeof callback === 'function') {
|
|
||||||
iframe.style.opacity = 0;
|
|
||||||
onLoadIframe = (function () {
|
|
||||||
return function (event) {
|
|
||||||
if (callback(event, resolve, reject)) {
|
|
||||||
iframe.style.opacity = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
} else {
|
|
||||||
iframe.style.opacity = 1;
|
|
||||||
onLoadIframe = function () {};
|
|
||||||
}
|
|
||||||
iframe.src = url;
|
|
||||||
window.fullfill = function () {
|
|
||||||
resolve.apply(this, arguments);
|
|
||||||
};
|
|
||||||
window.reject = function () {
|
|
||||||
reject(this, arguments);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var verifyLogin = function () {
|
|
||||||
if (forceLogin) {
|
|
||||||
return login();
|
|
||||||
} else {
|
|
||||||
return anonymousLogin();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var login = function () {
|
|
||||||
return new Promise(function (logged, failure) {
|
|
||||||
if (!isLogged) {
|
|
||||||
console.log("login");
|
|
||||||
open('../login/login?u=' + encodeURIComponent(location.pathname + '/../../webentry/logged'))
|
|
||||||
.then(function (userInformation) {
|
|
||||||
logged(userInformation);
|
|
||||||
})
|
|
||||||
.catch(function () {
|
|
||||||
failure();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
logged();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var anonymousLogin = function () {
|
|
||||||
return new Promise(function (resolve, failure) {
|
|
||||||
console.log("anonymousLogin");
|
|
||||||
$.ajax({
|
|
||||||
url: '../services/webentry/anonymous_login',
|
|
||||||
method: 'get',
|
|
||||||
dataType: 'json',
|
|
||||||
data: {
|
|
||||||
we_uid: weUid,
|
|
||||||
},
|
|
||||||
success: function (userInformation) {
|
|
||||||
resolve(userInformation);
|
|
||||||
},
|
|
||||||
error: function (data) {
|
|
||||||
failure(data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var initCase = function (userInformation) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
console.log("userInformation:", userInformation);
|
|
||||||
app.loadUserInformation(userInformation);
|
|
||||||
if (!localStorage.weData) {
|
|
||||||
console.log("initCase");
|
|
||||||
$.ajax({
|
|
||||||
url: '../cases/casesStartPage_Ajax',
|
|
||||||
method: 'post',
|
|
||||||
dataType: 'json',
|
|
||||||
data: {
|
|
||||||
action: 'startCase',
|
|
||||||
processId: processUid,
|
|
||||||
taskId: tasUid,
|
|
||||||
},
|
|
||||||
success: function (data) {
|
|
||||||
data.TAS_UID = tasUid;
|
|
||||||
localStorage.weData = JSON.stringify(data);
|
|
||||||
resolve(data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.log("openCase");
|
|
||||||
resolve(JSON.parse(localStorage.weData));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var casesStep = function (data) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
console.log("casesStep");
|
|
||||||
open(
|
|
||||||
'../cases/cases_Open?APP_UID=' + encodeURIComponent(data.APPLICATION) +
|
|
||||||
'&DEL_INDEX=' + encodeURIComponent(data.INDEX) +
|
|
||||||
'&action=draft',
|
|
||||||
function (event, resolve, reject) {
|
|
||||||
var contentDocument = getContentDocument(event.target);
|
|
||||||
var stepTitle = contentDocument.getElementsByTagName("title");
|
|
||||||
if (!stepTitle || stepTitle[0].textContent === 'Runtime Exception.') {
|
|
||||||
if (contentDocument.location.search.match(/&POSITION=10000&/)) {
|
|
||||||
//Catch error if webentry was deleted.
|
|
||||||
reject();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
).then(function (callbackUrl) {
|
|
||||||
resolve(callbackUrl);
|
|
||||||
})
|
|
||||||
.catch(function () {
|
|
||||||
reject();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var routeWebEntry = function (callbackUrl) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
console.log("routeWebEntry", callbackUrl);
|
|
||||||
resolve(callbackUrl);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var closeWebEntry = function (callbackUrl) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
console.log("closeWebEntry");
|
|
||||||
localStorage.removeItem("weData");
|
|
||||||
if (closeSession) {
|
|
||||||
logout(false);
|
|
||||||
}
|
|
||||||
resolve(callbackUrl);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var redirectCallback = function (callbackUrl) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
console.log("redirect");
|
|
||||||
//location.href = callbackUrl;
|
|
||||||
open(callbackUrl);
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//Errors
|
|
||||||
var errorLogin = function () {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
console.log("error0");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var errorInitCase = function () {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
console.log("error");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var errorStep = function () {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
console.log("Step Error");
|
|
||||||
if (initialWeData !== undefined) {
|
|
||||||
//Try to reset the localStorage WebEntry data and restart flow
|
|
||||||
localStorage.removeItem("weData");
|
|
||||||
location.reload();
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var errorRouting = function () {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
console.log("error");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//Execute WebEntry Flow
|
|
||||||
verifyLogin().catch(errorLogin)
|
|
||||||
.then(initCase).catch(errorInitCase)
|
|
||||||
.then(casesStep).catch(errorStep)
|
|
||||||
.then(routeWebEntry).catch(errorRouting)
|
|
||||||
.then(closeWebEntry)
|
|
||||||
.then(redirectCallback);
|
|
||||||
}();
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
Reference in New Issue
Block a user