-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up of dependent resources for floria and jslib which are not loading properly when just linked. Additional cleanups
- Loading branch information
1 parent
dd0a294
commit 9ddba87
Showing
79 changed files
with
11,086 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
"use strict"; | ||
|
||
// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
// Date extensions | ||
// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
define(["floria/textutil", "floria/superdom", "jslibs/popper", "floria/collections"], function(FloriaText, SuperDOM, Popper, FloriaCollections) | ||
{ | ||
|
||
var dojoSimple = require(CapsicoDojoSimpleLibJS) | ||
|
||
var x = {}; | ||
|
||
|
||
function doTooltip(tourItem) | ||
{ | ||
var node = document.createElement("SPAN"); | ||
node.id = "TOUR_"+tourItem.tour; | ||
node.classList.add("activeTourItem"); | ||
node.innerHTML = `<B>Step ${tourItem.seq}</B><BR> | ||
${tourItem.txt}<BR> | ||
<BR> | ||
`; | ||
|
||
SuperDOM.insertAfter(tourItem.element, node); | ||
} | ||
|
||
|
||
x.run = function(name) | ||
{ | ||
var elements = document.querySelectorAll('[data-tour]'); | ||
var tourItems = []; | ||
elements.forEach(function(e) { | ||
var val = e.dataset.tour; | ||
val = val.split("`"); | ||
if (val.length == 3 && val[0] == name) | ||
tourItems.push({element: e, tour:val[0], seq:val[1], text:val[2]}); | ||
else | ||
console.log("Element "+e.id+" defined a data-tour attribute '"+e.dataset.tour+"' which is not well formed."); | ||
}); | ||
|
||
tourItems.sort(function(a, b) { return SuperDOM.compareValues(a.seq, b.seq); }); | ||
|
||
doTooltip(tourItems[0]); | ||
} | ||
|
||
x.isPageTourEnabled = function() | ||
{ | ||
|
||
} | ||
|
||
|
||
function start(data) | ||
{ | ||
|
||
} | ||
|
||
x.startTour = function(tourName, jsonUrl) | ||
{ | ||
dojoSimple.ajaxUrl(jsonUrl, "GET", null, | ||
function(data) { | ||
start(data); | ||
}, | ||
function() { | ||
alert("The tour '"+tourName+"' is not available for this page.") | ||
} | ||
); | ||
|
||
} | ||
|
||
x.endTour = function() | ||
{ | ||
|
||
} | ||
|
||
return x; | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
'use strict'; | ||
|
||
import { FloriaDOM } from "./module-dom.js"; | ||
import { DojoSimple } from "./module-dojosimple.js"; | ||
|
||
export var FloriaAjax = { | ||
|
||
ajaxUrl: function(url, method, errorMsg, successFunc, errorFunc, postContents, timeout, handleAs) | ||
{ | ||
if (postContents != null) | ||
{ | ||
if (method != 'POST') | ||
return FloriaDOM.alertThrow("Error: you cannot post data in a non POST ajax request"); | ||
url = url + "?" + (FloriaDOM.isObject(postContents) == true ? FloriaDOM.makeUrlParams(postContents) : postContents); | ||
} | ||
|
||
|
||
if (handleAs == null) | ||
handleAs = 'json'; | ||
|
||
// Is this used at all anymore????? | ||
if (handleAs != 'json') | ||
{ | ||
alert("AjaxRequest.ajaxUrl called with handleAs: '"+handleAs+"'. Check consle logs for stack trace.\n\nThis was deprecated!"); | ||
console.trace(); | ||
return; | ||
} | ||
|
||
let xhr = new XMLHttpRequest(); | ||
xhr.open(method, url); | ||
xhr.timeout = timeout | ||
xhr.setRequestHeader("Content-type", "application/"+(handleAs||'json')+"; charset=utf-8"); | ||
if (handleAs==null||handleAs=='json') | ||
xhr.responseType = 'json'; | ||
xhr.onload = function() { | ||
try | ||
{ | ||
if (xhr.getResponseHeader("x-wanda-canceler") == "1") | ||
alert("FYI THAT YOU CANCELED ANOTHER REQUEST!\n\nYou (or another user on the same account) was running a request you interrupted."); | ||
|
||
let data = xhr.response; | ||
if (data?.code != 200 || xhr.status != 200) | ||
return xhr.onerror({code: data?.code||xhr.status, message : data?.msg||xhr.statusText, errors: data?.errors, type: data?.type }); | ||
if (data == null) | ||
throw ("An error occurred: no data for " + FloriaDOM.truncateUrl(url)); | ||
if (data.code == undefined) | ||
throw ("An error occurred: invalid JSON data for " + FloriaDOM.truncateUrl(url)); | ||
|
||
if (data.perfMessage != null) | ||
setTimeout(function(){ alert(data.perfMessage); }, 10); | ||
if (successFunc != null) | ||
successFunc(data.data); | ||
} | ||
catch (e) | ||
{ | ||
FloriaDOM.alertException(e, "Caught exception in AjaxRequest.ajaxUrl.onload()\nUrl:"+url+"\nFrom: "+successFunc+"\nError: ", true); | ||
} | ||
}; | ||
xhr.onerror = function(error) { // only triggers if the request couldn't be made at all | ||
console.error("ajaxUrl error: ", error); | ||
try | ||
{ | ||
if (error != null && error.status||error.code == 401 && DojoSimple.PopupLogin.isAuthPassthrough(url) == false) | ||
{ | ||
// return alert("NO ACL!"); | ||
return DojoSimple.PopupLogin.show(true, function() { FloriaAjax.ajaxUrl(url, method, errorMsg, successFunc, errorFunc, postContents, timeout, handleAs) }); | ||
} | ||
else | ||
{ | ||
if (error.type == 'CANCELED') | ||
alert("YOUR REQUEST WAS CANCELED!\n\nYou (or another person using the same account) have just invoked the same data from another browser window."); | ||
else if (error.type == 'DEADLOCKED') | ||
alert("YOUR REQUEST DEADLOCKED!\nA database issue has occurred that caused your request to deadlock with another request."); | ||
|
||
var msg = error == null ? null : error.message != null ? error.message : error.msg; | ||
if (errorMsg != null) | ||
{ | ||
var Str = errorMsg; | ||
if (msg != null) | ||
Str+="\n"+msg; | ||
if (error.errors != null && error.errors.length != 0) | ||
for (var i = 0; i < error.errors.length; ++i) | ||
Str+="\n - "+error.errors[i].p+': '+error.errors[i].m; | ||
alert(Str); | ||
} | ||
if (errorFunc != null) | ||
errorFunc(error.code||error.status, msg, error.errors, error.type); | ||
} | ||
} | ||
catch (e) | ||
{ | ||
FloriaDOM.alertException(e, "Caught exception in ajaxUrl.error()\nUrl:"+url+"\nFrom: "+errorFunc+"\nError: ", true); | ||
} | ||
}; | ||
xhr.ontimeout = function() { | ||
alert("TIMEOUT!"); | ||
}; | ||
xhr.send(); | ||
} | ||
}; |
Oops, something went wrong.