Fixes WE2
This commit is contained in:
davidcallizaya
2017-06-05 15:35:29 -04:00
parent 8ecbb89662
commit b82557b086
3 changed files with 131 additions and 110 deletions

View File

@@ -23,6 +23,8 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
<head>
<link rel="stylesheet" href="/lib/pmdynaform/libs/bootstrap-3.1.1/css/bootstrap.min.css">
<title><?php echo htmlentities($webEntryModel->getWeCustomTitle()); ?></title>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<?php
$oHeadPublisher = & headPublisher::getSingleton();
echo $oHeadPublisher->getExtJsStylesheets(SYS_SKIN);
@@ -119,6 +121,8 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
<div class="boxBottom"><div class="a">&nbsp;</div><div class="b">&nbsp;</div><div class="c">&nbsp;</div></div>
</div>
</form>
<div id="mylog">
</div>
<script src="/lib/js/jquery-1.10.2.min.js"></script>
<script>
var weData = {};
@@ -162,10 +166,13 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
return this.$element.errorMessage.textContent;
}
};
function logout(reload) {
function logout(reload, callback) {
$.ajax({
url: '../login/login',
success: function () {
if (typeof callback==='function') {
callback();
}
if (reload) {
resetLocalData();
location.reload();
@@ -238,7 +245,9 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
iframe.style.opacity = 1;
onLoadIframe = function () {};
}
iframe.src = url;
//This code is to prevent error at back history
//in Firefox
setTimeout(function(){iframe.src = url;}, 0);
window.fullfill = function () {
resolve.apply(this, arguments);
};
@@ -352,6 +361,9 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
data.TAS_UID = tasUid;
localStorage.weData = JSON.stringify(data);
resolve(data);
},
error: function () {
reject();
}
});
} else {
@@ -370,7 +382,7 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
function (event, resolve, reject) {
var contentDocument = getContentDocument(event.target);
var stepTitle = contentDocument.getElementsByTagName("title");
if (!stepTitle || stepTitle[0].textContent === 'Runtime Exception.') {
if (!stepTitle || !stepTitle.length || stepTitle[0].textContent === 'Runtime Exception.') {
if (contentDocument.location.search.match(/&POSITION=10000&/)) {
//Catch error if webentry was deleted.
reject();
@@ -398,14 +410,25 @@ $webEntryModel = \WebEntryPeer::retrieveByPK($weUid);
log("closeWebEntry");
resetLocalData();
if (closeSession) {
logout(false);
}
//This code is to prevent error at back history
//in Firefox
$("#iframe").hide();
$("#iframe").attr("src", "../login/login");
logout(false, function() {
resolve(callbackUrl);
});
} else {
//This code is to prevent error at back history
//in Firefox
open("../webentry/logged", function() {
resolve(callbackUrl);
});
}
});
};
var redirectCallback = function (callbackUrl) {
return new Promise(function (resolve, reject) {
log("redirect");
log("redirect: "+callbackUrl);
location.href = callbackUrl;
resolve();
});

View File

@@ -596,9 +596,7 @@ class WebEntry
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
unset($arrayData["WE_UID"]);
if (isset($arrayData['WE_LINK_GENERATION']) && $arrayData['WE_LINK_GENERATION']==='DEFAULT') {
unset($arrayData["WE_DATA"]);
}
//Verify data
$process->throwExceptionIfNotExistsProcess($processUid, $this->arrayFieldNameForException["processUid"]);

View File

@@ -280,6 +280,7 @@ class WebEntryEvent
$this->arrayFieldDefinition['WE_LINK_SKIN']['empty'] = false;
$this->arrayFieldDefinition['WE_LINK_LANGUAGE']['empty'] = false;
$this->arrayFieldDefinition['WE_LINK_DOMAIN']['empty'] = false;
}
$modelSkins = new \ProcessMaker\BusinessModel\Skins();
$skins = [];
foreach ($modelSkins->getSkins() as $mSkin) {
@@ -292,7 +293,6 @@ class WebEntryEvent
$languages[] = $mLang['LANG_ID'];
}
$this->arrayFieldDefinition['WE_LINK_LANGUAGE']['defaultValues'] = $languages;
}
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, $flagInsert);
@@ -677,8 +677,8 @@ class WebEntryEvent
if ($arrayWebEntryEventData["WEE_WE_UID"] != "") {
$task = new \Tasks();
//Task - Step
if (isset($arrayData["DYN_UID"]) && $arrayData["DYN_UID"] != $arrayWebEntryEventData["DYN_UID"]) {
//Task - Step for WE_TYPE=SINGLE
if (isset($arrayData["DYN_UID"]) && $arrayData["DYN_UID"] != $arrayWebEntryEventData["DYN_UID"] && $arrayData["WE_TYPE"]==='SINGLE') {
//Delete
$step = new \Step();
@@ -703,7 +703,7 @@ class WebEntryEvent
}
//Task - User
if (isset($arrayData["USR_UID"]) && $arrayData["USR_UID"] != $arrayWebEntryEventData["USR_UID"]) {
if (!empty($arrayData["USR_UID"]) && $arrayData["USR_UID"] != $arrayWebEntryEventData["USR_UID"]) {
//Unassign
$taskUser = new \TaskUser();
@@ -1165,7 +1165,7 @@ class WebEntryEvent
"/sys".SYS_SYS."/".
$weLinkLanguage."/".
$weLinkSkin."/".$prj_uid;
return $url."/".$weUid.'.php';
return $url."/".$weData;
} else {
$url = $http.$_SERVER["HTTP_HOST"]."/sys".SYS_SYS."/".SYS_LANG."/".SYS_SKIN."/".$prj_uid;
return $url."/".$weData;