2017-02-07 20:13:14 +00:00
|
|
|
var g_filePKey=null;
|
2020-04-27 16:39:42 -05:00
|
|
|
|
2017-02-07 20:13:14 +00:00
|
|
|
function makeRequest(tgtPage,requesttext){
|
|
|
|
|
// Mozilla
|
|
|
|
|
if (window.XMLHttpRequest) {
|
|
|
|
|
var oXML=new XMLHttpRequest();
|
|
|
|
|
} else {
|
|
|
|
|
// IE
|
|
|
|
|
var oXML=new ActiveXObject("Microsoft.XMLHTTP");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oXML.open("POST",tgtPage,false);
|
|
|
|
|
// alert("req" + requesttext);
|
|
|
|
|
oXML.send(requesttext);
|
|
|
|
|
|
|
|
|
|
var theResponse = oXML.responseText;
|
|
|
|
|
// alert("resp" + theResponse);
|
|
|
|
|
|
|
|
|
|
// Generic Webservice Error handling...
|
|
|
|
|
var parser=new DOMParser();
|
|
|
|
|
var doc=parser.parseFromString(theResponse,"text/xml");
|
|
|
|
|
if ((doc.documentElement.getAttribute("success")!="true")
|
|
|
|
|
&& (doc.documentElement.getAttribute("fileformat")==null)
|
|
|
|
|
&& (doc.documentElement.getAttribute("errorclass")!="AppError")) {
|
|
|
|
|
alert("Problem: (" + doc.documentElement.getAttribute("success") + ")\n" + theResponse);
|
|
|
|
|
}
|
|
|
|
|
return(theResponse);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function loadMap(filePKey) {
|
|
|
|
|
setBusyWait();
|
|
|
|
|
window.scrollTo(0,0);
|
|
|
|
|
var xmlDoc=document.implementation.createDocument('','X',null);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("function","OPENFILE");
|
|
|
|
|
xmlDoc.documentElement.setAttribute("filepkey",filePKey);
|
|
|
|
|
var txtResp=makeRequest('requestTarget.php',xmlDoc);
|
|
|
|
|
var parser=new DOMParser();
|
|
|
|
|
var doc=parser.parseFromString(txtResp,"text/xml");
|
|
|
|
|
g_filePKey=filePKey;
|
|
|
|
|
dataTools.setPKey(doc.documentElement.getAttribute("nextpkey"));
|
|
|
|
|
deleteAllRootNodes();
|
|
|
|
|
for (var i=0;i<doc.documentElement.firstChild.childNodes.length;i++){
|
|
|
|
|
rootNode[i]=new node().fromXML(doc.documentElement.firstChild.childNodes[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Freelinks need to be loaded when it's guaranteed that all nodes are loaded.
|
|
|
|
|
// otherwise they have nothing to link to...
|
|
|
|
|
createFreeRelations(doc.documentElement);
|
|
|
|
|
|
|
|
|
|
unsetBusyWait();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Traverse the tree and draw freeRelations
|
|
|
|
|
function createFreeRelations(docEle){
|
|
|
|
|
var allChilds=docEle.childNodes;
|
|
|
|
|
for (var i=0;i<allChilds.length;i++){
|
|
|
|
|
var theChild=allChilds[i];
|
|
|
|
|
if (theChild.childNodes.length>0){
|
|
|
|
|
createFreeRelations(theChild);
|
|
|
|
|
}
|
2020-04-27 20:26:34 -05:00
|
|
|
if (theChild.nodeName.toUpperCase()=="NODEREL"){
|
2017-02-07 20:13:14 +00:00
|
|
|
if (theChild.getAttribute("relationtype")!="main"){
|
|
|
|
|
var newNodeRel=new nodeRel().fromXML(theChild);
|
|
|
|
|
newNodeRel.redraw();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function saveMap(description) {
|
|
|
|
|
setBusyWait();
|
|
|
|
|
var xmlDoc=document.implementation.createDocument('','ALL',null);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("fileformat","1");
|
|
|
|
|
xmlDoc.documentElement.setAttribute("nextpkey",dataTools.getNewPKey());
|
|
|
|
|
xmlDoc.documentElement.setAttribute("function","SAVEFILE");
|
|
|
|
|
xmlDoc.documentElement.setAttribute("filepkey",g_filePKey);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("description",description);
|
|
|
|
|
var nodeSets=xmlDoc.createElement("NODESET");
|
|
|
|
|
for (var i=0;i<rootNode.length;i++){
|
|
|
|
|
nodeSets.appendChild(xmlDoc.importNode(rootNode[i].toXML(),true));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xmlDoc.documentElement.appendChild(nodeSets);
|
|
|
|
|
|
|
|
|
|
var txtResp=makeRequest("requestTarget.php",xmlDoc);
|
|
|
|
|
var parser=new DOMParser();
|
|
|
|
|
var doc=parser.parseFromString(txtResp,"text/xml");
|
|
|
|
|
g_filePKey=doc.documentElement.getAttribute("filepkey");
|
|
|
|
|
unsetBusyWait();
|
|
|
|
|
return(xmlDoc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function deleteMap(filePKey){
|
|
|
|
|
var xmlDoc=document.implementation.createDocument('','X',null);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("function","DELETEFILE");
|
|
|
|
|
xmlDoc.documentElement.setAttribute("filepkey",filePKey);
|
|
|
|
|
var txtResp=makeRequest("requestTarget.php",xmlDoc);
|
|
|
|
|
var parser=new DOMParser();
|
|
|
|
|
var doc=parser.parseFromString(txtResp,"text/xml");
|
|
|
|
|
return(xmlDoc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getIconList() {
|
|
|
|
|
var xmlDoc=document.implementation.createDocument('','X',null);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("function","GETICONLIST");
|
|
|
|
|
var txtResp=makeRequest('requestTarget.php',xmlDoc);
|
|
|
|
|
var parser=new DOMParser();
|
|
|
|
|
var doc=parser.parseFromString(txtResp,"text/xml");
|
|
|
|
|
return(document.importNode(doc.firstChild,true));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getFileList() {
|
|
|
|
|
var xmlDoc=document.implementation.createDocument('','X',null);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("function","LISTFILES");
|
|
|
|
|
var txtResp=makeRequest('requestTarget.php',xmlDoc);
|
|
|
|
|
var parser=new DOMParser();
|
|
|
|
|
var doc=parser.parseFromString(txtResp,"text/xml");
|
|
|
|
|
return(document.importNode(doc.firstChild,true));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function openFileSelector() {
|
|
|
|
|
var fsControl=new fileSelectorControl(getFileList());
|
|
|
|
|
document.getElementById("body").appendChild(fsControl);
|
|
|
|
|
fsControl.style.position="absolute";
|
|
|
|
|
fsControl.style.top="100px";
|
|
|
|
|
dragNDrop.activateForObject(fsControl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function tokenLoginUser(){
|
|
|
|
|
var mail=dataTools.getCookie("autoLoginMail");
|
|
|
|
|
var loginToken=dataTools.getCookie("autoLoginToken");
|
|
|
|
|
|
|
|
|
|
var xmlDoc=document.implementation.createDocument('','X',null);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("function","TOKENLOGIN");
|
|
|
|
|
xmlDoc.documentElement.setAttribute("mail",mail);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("token",loginToken);
|
|
|
|
|
var txtResp=makeRequest('requestTarget.php',xmlDoc);
|
|
|
|
|
var parser=new DOMParser();
|
|
|
|
|
var doc=parser.parseFromString(txtResp,"text/xml");
|
|
|
|
|
return(doc.documentElement.getAttribute("success")=="true");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function loginUser(mail,password,isAutoLogin) {
|
|
|
|
|
var xmlDoc=document.implementation.createDocument('','X',null);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("function","LOGIN");
|
|
|
|
|
xmlDoc.documentElement.setAttribute("mail",mail);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("password",password);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("isautologin",(isAutoLogin)?"1":"0");
|
|
|
|
|
var txtResp=makeRequest('requestTarget.php',xmlDoc);
|
|
|
|
|
var parser=new DOMParser();
|
|
|
|
|
var doc=parser.parseFromString(txtResp,"text/xml");
|
|
|
|
|
if (isAutoLogin) {
|
|
|
|
|
var loginToken=doc.documentElement.getAttribute("autologintoken");
|
|
|
|
|
dataTools.setCookie("autoLoginToken",loginToken,10000);
|
|
|
|
|
dataTools.setCookie("autoLoginMail",mail,10000);
|
|
|
|
|
}
|
|
|
|
|
return(doc.documentElement.getAttribute("success")=="true");
|
|
|
|
|
}
|
|
|
|
|
function logOutUser(){
|
|
|
|
|
var xmlDoc=document.implementation.createDocument('','X',null);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("function","LOGOUT");
|
|
|
|
|
xmlDoc.documentElement.setAttribute("autologintoken",dataTools.getCookie("autoLoginToken"));
|
|
|
|
|
dataTools.setCookie("autoLoginToken","",-1);
|
|
|
|
|
dataTools.setCookie("autoLoginMail","",-1);
|
|
|
|
|
var txtResp=makeRequest('requestTarget.php',xmlDoc);
|
|
|
|
|
var parser=new DOMParser();
|
|
|
|
|
var doc=parser.parseFromString(txtResp,"text/xml");
|
|
|
|
|
window.location='login.php';
|
|
|
|
|
return(doc.documentElement.getAttribute("success")=="true");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function optinUser(mail,password) {
|
|
|
|
|
var xmlDoc=document.implementation.createDocument('','X',null);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("function","OPTINUSER");
|
|
|
|
|
xmlDoc.documentElement.setAttribute("mail",mail);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("password",password);
|
|
|
|
|
var txtResp=makeRequest('requestTarget.php',xmlDoc);
|
|
|
|
|
var parser=new DOMParser();
|
|
|
|
|
var doc=parser.parseFromString(txtResp,"text/xml");
|
|
|
|
|
return(doc.documentElement.getAttribute("success")=="true");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function mailPassword(mail) {
|
|
|
|
|
var xmlDoc=document.implementation.createDocument('','X',null);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("function","MAILPASSWORD");
|
|
|
|
|
xmlDoc.documentElement.setAttribute("mail",mail);
|
|
|
|
|
var txtResp=makeRequest('requestTarget.php',xmlDoc);
|
|
|
|
|
var parser=new DOMParser();
|
|
|
|
|
var doc=parser.parseFromString(txtResp,"text/xml");
|
|
|
|
|
return(doc.documentElement.getAttribute("success")=="true");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function confirmOptin(token) {
|
|
|
|
|
var xmlDoc=document.implementation.createDocument('','X',null);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("function","CONFIRMOPTIN");
|
|
|
|
|
xmlDoc.documentElement.setAttribute("token",token);
|
|
|
|
|
var txtResp=makeRequest('requestTarget.php',xmlDoc);
|
|
|
|
|
var parser=new DOMParser();
|
|
|
|
|
var doc=parser.parseFromString(txtResp,"text/xml");
|
|
|
|
|
return(doc.documentElement.getAttribute("success")=="true");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function changePassword(mail,newPass,oldPass,token) {
|
|
|
|
|
var xmlDoc=document.implementation.createDocument('','X',null);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("function","CHANGEPASSWORD");
|
|
|
|
|
xmlDoc.documentElement.setAttribute("mail",mail);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("newpass",newPass);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("oldpass",oldPass);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("token",token);
|
|
|
|
|
var txtResp=makeRequest('requestTarget.php',xmlDoc);
|
|
|
|
|
var parser=new DOMParser();
|
|
|
|
|
var doc=parser.parseFromString(txtResp,"text/xml");
|
|
|
|
|
return(doc.documentElement.getAttribute("success")=="true");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function updateUserProfile(name,mail,password) {
|
|
|
|
|
var xmlDoc=document.implementation.createDocument('','X',null);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("function","UPDATEUSERPROFILE");
|
|
|
|
|
xmlDoc.documentElement.setAttribute("mail",mail);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("password",password);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("name",name);
|
|
|
|
|
var txtResp=makeRequest('requestTarget.php',xmlDoc);
|
|
|
|
|
var parser=new DOMParser();
|
|
|
|
|
var doc=parser.parseFromString(txtResp,"text/xml");
|
|
|
|
|
return(doc.documentElement.getAttribute("success")=="true");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function deleteAllRootNodes() {
|
|
|
|
|
for (var i=rootNode.length-1;i>=0;i--){
|
|
|
|
|
rootNode[i].erase();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getUserInfo(attribute) {
|
|
|
|
|
var xmlDoc=document.implementation.createDocument('','X',null);
|
|
|
|
|
xmlDoc.documentElement.setAttribute("function","GETUSERINFO");
|
|
|
|
|
var txtResp=makeRequest('requestTarget.php',xmlDoc);
|
|
|
|
|
var parser=new DOMParser();
|
|
|
|
|
var doc=parser.parseFromString(txtResp,"text/xml");
|
|
|
|
|
return(doc.documentElement.getAttribute(attribute));
|
2020-04-27 20:26:34 -05:00
|
|
|
}
|