commit e8fa4b7ae6a9e743c42e07f2905320098797c4b3 Author: Tretter Date: Tue Feb 7 20:13:14 2017 +0000 initial checkin from subversion diff --git a/WebThinkTC.html b/WebThinkTC.html new file mode 100644 index 0000000..ffe6af3 --- /dev/null +++ b/WebThinkTC.html @@ -0,0 +1,40 @@ + +webthink.net disclaimer + +
+Version 0.1 - Last Update 2008-04-07
+
+Terms and Conditions for the use of www.webthink.net 
+====================================================
+
+Terminology:
+============
+service  - refers to content and functionality available at www.webthink.net
+provider - refers to the service provider who is running the www.webthink.net website
+User     - refers to a consumer of the service.
+
+Terms and Condition:
+====================
+- By using webthink.net you accept these terms and conditions
+
+- All Material, including code, pictures, design is the property of the provider. Copying, modification or deletion without the written permission of the provider is not allowed
+
+- At no time can the provider be held reliable for any damage caused by the service or the unavailablity of it - Use at your own risk!
+
+- The provider might change any part of the service at anytime without prior notice
+
+- The provider doesn't guarantee any data being secure, available or well-performing at any point in time
+
+- The provider doesn't guarantee the service being error-free or usable
+
+- The provider reserves the right to shut the service down, change any aspect of the service or to stop providing the service without any notice given to the user
+
+- The user accepts to receive e-mails from the service provider in case information are sent including but not limited to
+	- Notifications about changes in the Terms and conditions
+	- Notifications of planned outages
+	- Informations on updates to the service
+
+- These terms and conditions can be changed at anytime without notice, it is up to the user to check for changes.
+
+ + diff --git a/addJavaScriptHash.sh b/addJavaScriptHash.sh new file mode 100644 index 0000000..dc62bd7 --- /dev/null +++ b/addJavaScriptHash.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Script adds a MD5-Hash as a get-parameter to all javascript-sourced-files in order to get around +# delivery of old content from caches. + +md5sum *.js | while read l; +do md5=$(echo $l|cut -d " " -f 1) + filename=$(echo $l|cut -d " " -f 2) + sed -e "s/src=\"${filename}\"/src=\"${filename}?md5=${md5}\"/g" $1 > tmp.$$ + mv tmp.$$ $1 +done diff --git a/config.php.example b/config.php.example new file mode 100644 index 0000000..e829f46 --- /dev/null +++ b/config.php.example @@ -0,0 +1,8 @@ + diff --git a/consyntools.jar b/consyntools.jar new file mode 100644 index 0000000..130f118 Binary files /dev/null and b/consyntools.jar differ diff --git a/dataTools.js b/dataTools.js new file mode 100644 index 0000000..7fe8f7d --- /dev/null +++ b/dataTools.js @@ -0,0 +1,83 @@ +var dataTools=new dataTools(); + +// Add an extends - function to the objects +// so that we have proper inheritance +Object.prototype.extends = function (oSuper) { + for (sProperty in oSuper) { + this[sProperty] = oSuper[sProperty]; + } +} + +function dataTools(){ + var m_pkey=0; + this.getNewPKey=getNewPKey; + this.setPKey=setPKey; + this.urlArgs=new urlArgs(); + this.getCookie=getCookie; + this.setCookie=setCookie; + this.imageDom=imageDom; + function getNewPKey(){ + return(m_pkey++); + } + function setPKey(inPKey){ + m_pkey=inPKey; + } + + function urlArgs(){ + var m_allPairs=window.location.search.substring(1).split("&"); + this.getValueByKey=getValueByKey; + function getValueByKey(key){ + for (var i=0;i m_diffY) { + drawHorizontalLine(); + } else { + drawVerticalLine(); + } + + function drawHorizontalLine(){ + var i; + for (i=toX;i<=fromX;i++){ + pX=i; + if (toY < fromY) { + pY=toY+((i-toX)*(m_diffY/m_diffX)); + } else { + pY=toY-((i-toX)*(m_diffY/m_diffX)); + } + drawPoint(pX,pY,style); + } + for (i=fromX;i<=toX;i++){ + pX=i; + if (toY < fromY) { + pY=fromY-((i-fromX)*(m_diffY/m_diffX)); + } else { + pY=fromY+((i-fromX)*(m_diffY/m_diffX)); + } + drawPoint(pX,pY,style); + } + } + + function drawVerticalLine(){ + var i; + + for (i=toY;i<=fromY;i++){ + pY=i; + if (toX < fromX) { + pX=toX+((i-toY)*(m_diffX/m_diffY)); + } else { + pX=toX-((i-toY)*(m_diffX/m_diffY)); + } + drawPoint(pX,pY,style); + } + for (i=fromY;i<=toY;i++){ + pY=i; + if (toX < fromX) { + pX=fromX-((i-fromY)*(m_diffX/m_diffY)); + } else { + pX=fromX+((i-fromY)*(m_diffX/m_diffY)); + } + drawPoint(pX,pY,style); + } + } + function drawPoint(x,y,style){ + if ((pointCnt++%3)==0) { // performance, don't draw all points. + var point=document.createElement("div"); + point.setAttribute("class",style); + point.style.left=x+"px"; + point.style.top=y+"px"; + + pointsContainer.appendChild(point); + } + } +} + diff --git a/fileSelectorControl.js b/fileSelectorControl.js new file mode 100644 index 0000000..1d28293 --- /dev/null +++ b/fileSelectorControl.js @@ -0,0 +1,90 @@ +function fileSelectorControl(fileData) { + var m_displayDom=document.createElement("div"); + m_displayDom.setAttribute("class","fileSelector"); + var m_selectedFile=null ; + var m_fileList=null; + + return(construct()); + + function construct() { + update(fileData); + addActionButtons(); + m_displayDom.isVisible; + m_displayDom.show=show; + m_displayDom.hide=hide; + m_displayDom.update=update; + + return(m_displayDom); + } + function update(fileData){ + var fileList=document.createElement("ul"); + fileList.setAttribute("class","fileList"); + var allFiles=fileData.childNodes; + for (var i=0;i + + + IMPRESSUM + + +IMPRESSUM:
+Regina Tretter
+31 Cole Cres
+Liberty Grove
+NSW 2138
+Australia
+
+ + + diff --git a/login.css b/login.css new file mode 100644 index 0000000..37cd7dc --- /dev/null +++ b/login.css @@ -0,0 +1,11 @@ +div#signUpAdvice { + width:200px; + font-weight:bold; + font-size:12px; + background:#eeeeee; + border:1px solid #000000; +} +th { + text-align:center; + background:#cccccc; +} diff --git a/login.js b/login.js new file mode 100644 index 0000000..ebbe8dc --- /dev/null +++ b/login.js @@ -0,0 +1,146 @@ +function onClickLogin(){ + var mail=document.getElementById('mail').value; + var password=document.getElementById('password').value; + var isAutoLogin=document.getElementById('isAutoLogin').checked; + var isLoggedIn=loginUser(mail,password,isAutoLogin); + if (isLoggedIn) { + dataTools.setCookie("mailaddress",mail); + document.location="mainPage.php"; + } else { + hideAllPanes(); + document.getElementById("defaultLogin").style.display='block'; + document.getElementById("loginFailed").style.display='block'; + } +} + +function onClickRegister(){ + document.getElementById("loginFailed").style.display='none'; + + var mail=document.getElementById('RegisterMail').value; + var password=document.getElementById('RegisterPassword').value; + var repeatPassword=document.getElementById('RegisterPasswordRepeat').value; + var tcAgree=document.getElementById('TcAgree').checked; + + if (!tcAgree) { + alert("You have to agree to the Terms and Conditions!"); + return(1); + } + + if (password != repeatPassword) { + alert("The Passwords don't match!"); + return(2); + } + + if (optinUser(mail,password)) { + hideAllPanes(); + document.getElementById("optinSuccess").style.display='block'; + document.getElementById("defaultLogin").style.display='block'; + dataTools.setCookie("mailaddress",mail); + } +} +function onClickChangePassword(){ + hideAllPanes(); + document.getElementById("btnChangePassword").style.display='none'; + document.getElementById("defaultLogin").style.display='block'; + document.getElementById("overridePassword").style.display='block'; +} +function onClickMailPassword(){ + var mail=document.getElementById('mail').value; + + if (result=mailPassword(mail)) { + document.getElementById("loginFailed").style.display='none'; + document.getElementById("confirmMailPassword").style.display='block'; + } + +} +function OptinConfirm(){ + if ("confirmOptin"==dataTools.urlArgs.getValueByKey("action")) { + var token=dataTools.urlArgs.getValueByKey("token"); + if (token.length != 32) { + alert("Your URL is incomplete!\nPlease paste in the complete URL to confirm your mail-address."); + } else { + if (confirmOptin(token)) { + return(true); + } + } + } + return(false); +} +function PasswordOverride(){ + if ("overridePassword"==dataTools.urlArgs.getValueByKey("action")) { + var token=dataTools.urlArgs.getValueByKey("token"); + if (token.length != 32) { + alert("Your URL is incomplete!\nPlease make sure you copied the full URL!"); + } else { + document.getElementById('mail').value=""; + return(true); + } + } + return(false); +} +function updatePassword(){ + var newPass=document.getElementById('newPassword').value; + var mail=document.getElementById('mail').value; + var oldPass=document.getElementById('password').value; + var token=dataTools.urlArgs.getValueByKey("token"); + + if (changePassword(mail,newPass,oldPass,token)){ + hideAllPanes(); + document.getElementById("defaultLogin").style.display='block'; + } + +} +function hideAllPanes(){ + document.getElementById("defaultLogin").style.display='none'; + document.getElementById("autoLoginProgress").style.display='none'; + document.getElementById("overridePassword").style.display='none'; + document.getElementById("optinSuccess").style.display='none'; + document.getElementById("confirmMailPassword").style.display='none'; + document.getElementById("confirmOptinSuccess").style.display='none'; + document.getElementById("loginFailed").style.display='none'; + document.getElementById("btnChangePassword").style.display='inline'; +} + +function fireOnEnter(evt, frm ) { + var keyCode = null; + + if( evt.which ) { + keyCode = evt.which; + } else if( evt.keyCode ) { + keyCode = evt.keyCode; + } + if( 13 == keyCode ) { + onClickLogin(); + return(false); + } + return(true); +} + +function init(){ + hideAllPanes(); + if (OptinConfirm()) { + document.getElementById("confirmOptinSuccess").style.display='block'; + } + if (dataTools.getCookie("autoLoginMail")) { + hideAllPanes(); + document.getElementById("autoLoginProgress").style.display='block'; + if (tokenLoginUser()){ + document.location="mainPage.php"; + } else { + hideAllPanes(); + document.getElementById("defaultLogin").style.display='block'; + document.getElementById("loginFailed").style.display='block'; + dataTools.setCookie("autoLoginMail","",-1); + dataTools.setCookie("autoLoginToken","",-1); + } + } else { + document.getElementById('mail').value=dataTools.getCookie("mailaddress"); + document.getElementById('mail').focus(); + document.getElementById('password').onkeydown=fireOnEnter; + if (PasswordOverride()) { + document.getElementById("overridePassword").style.display='block'; + } else { + document.getElementById("defaultLogin").style.display='block'; + } + } +} diff --git a/login.php b/login.php new file mode 100644 index 0000000..9c24be5 --- /dev/null +++ b/login.php @@ -0,0 +1,117 @@ + + + + WebThink Login + + + + + + + + + + +
+
+
- L O G I N -
+
At this stage only Firefox version 2 and 3 is supported! +
+
+
+THIS SITE IS CURRENTLY IN AN EARLY ALPHA STADIUM + YOU MIGHT SIGN UP AND PLAY AROUND HERE HOWEVER DATA-SECURITY + CANNOT BE GAURANTEED AT THIS TIME.

+ ALL INFORMATION YOU CAPTURE MIGHT BE LOST FOREVER!!!
+
+
+ If you want to have a look around without registering then you can log in with Email demo and Password demo. +
+
+ + + + + + + +
+ [Terms & Conditions] + [Impressum] + [WebMaster] +
+ + +quote($_SERVER['REMOTE_ADDR']) . ", " . $dh->quote($_SERVER['HTTP_REFERER']) .")"; + $dh->exec($query); + $dh->close(); +} catch (Exception $e) { +} +?> diff --git a/mainPage.php b/mainPage.php new file mode 100644 index 0000000..bc42c4c --- /dev/null +++ b/mainPage.php @@ -0,0 +1,67 @@ + + + + + WebThink.net + + + + + + + + +
WebThink.net
+
+
+
+
.
+ + + + + + + + + + + + + + + + + + + + + diff --git a/menu.css b/menu.css new file mode 100644 index 0000000..4905b52 --- /dev/null +++ b/menu.css @@ -0,0 +1,115 @@ +div.menuBarMenu { + position:absolute; + background:#AB934B; + border:1px #000000 solid; + z-index:100; +} +div.contextMenu { + position:absolute; + background:#FFFFFF; + border:1px #000000 solid; + z-index:100; + cursor:default; +} +div.contextMenuItem { + font-weight:bold; + border:1px #000000 solid; + font-size:14px; + font-family: Arial, Helvetica, sans-serif; + position:inherit; + text-align:left; + white-space:nowrap; + width:100%; + height:100%; + background:#eeeeee; + color:#000000; + cursor:pointer; +} +div.ContextMenuItem:hover { + background: #37add4; +} +div.nodeIconMenuItem { + font-weight:bold; + font-size:14px; + font-family: Arial, Helvetica, sans-serif; + position:inherit; + text-align:left; + white-space:nowrap; + width:100%; + height:100%; + background:#eeeeee; + color:#000000; + cursor:pointer; +} +div.nodeIconMenuItem:hover { + background: #37add4; +} +div.nodeContextMenu { + border:1px #000000 solid; + position:absolute; + background:#FFFFFF; + border:1px #000000 solid; + z-index:100; + cursor:default; +} +div.nodeContextMenuItem { + font-weight:bold; + font-size:14px; + font-family: Arial, Helvetica, sans-serif; + border:1px #000000 solid; + position:inherit; + text-align:left; + white-space:nowrap; + width:54px; + background:#eeeeee; + color:#000000; + cursor:pointer; +} +div.nodeContextMenuItem:hover { + background: #37add4; +} +div.menuBarRootItem { + font-weight:bold; + font-size:14px; + font-family: Arial, Helvetica, sans-serif; + border:1px #000000 solid; + position:inherit; + text-align:left; + white-space:nowrap; + width:55px; + background:#eeeeee; + color:#000000; + cursor:pointer; +} +div.menuBarRootItem:hover { + background: #37add4; +} +div.menuBarSubItem { + font-weight:bold; + font-size:14px; + font-family: Arial, Helvetica, sans-serif; + border:1px #000000 solid; + position:inherit; + text-align:left; + white-space:nowrap; + width:150px; + background:#eeeeee; + color:#000000; + cursor:pointer; +} +div.menuBarSubItem:hover { + background: #37add4; +} +div.contextMenuItemRed { + font-weight:bold; + font-size:14px; + font-family: Arial, Helvetica, sans-serif; + border:1px #000000 solid; + position:inherit; + background:#FF0000; + color:#000000; + cursor:pointer; +} +div.contextMenuItemRed:hover { + background: #37add4; +} diff --git a/menuBar.css b/menuBar.css new file mode 100644 index 0000000..a451aaf --- /dev/null +++ b/menuBar.css @@ -0,0 +1,67 @@ +div.menuBar { + -moz-border-radius-bottomright:20px; + position:fixed; + top:0px; + left:150px; + width:280px; + height:50px; + background:#AB934B; + z-index:100; +} +div.logoContainer { + position:fixed; + top:0; + left:0; + height:50px; + width:150; + background:#AB934B; + color:#60A3CC; + z-index:100; + font-style:italic; + font-family:arial; + font-weight:bold; + font-size:22px; + text-align:left; +} +img#icnBusyWait { + position:absolute; + left:30; + top:28; + z-index:101; +} +span.userName { + position:fixed; + top:0; + left:450; +} + +/* File-Selector Control */ +div.fileSelector{ + position:fixed; + top:50px; + left:0px; + background:#AB934B; +} +div.btnContainer { + background:#AB934B; + z-index:100; +} +ul.fileList { + background:#AB934B; + color:#cccccc; + z-index:100; + max-height:300px; + min-width:100px; + overflow:auto; + cursor:pointer; +} +li.selected { + color:#080808; + background:#F7D56D; +} +li.unselected { + color:#F7F7F7; +} +li:hover { + color:#0000FF; +} diff --git a/menuBarControl.js b/menuBarControl.js new file mode 100644 index 0000000..ff6e58a --- /dev/null +++ b/menuBarControl.js @@ -0,0 +1,100 @@ +function menuBarControl() { + var m_displayDom=document.createElement("div"); + m_displayDom.setAttribute("class","menuBar"); + m_displayDom.setAttribute("id","menuBar"); + var m_fsControl=new fileSelectorControl(getFileList()); + var m_fileName=new textControl("FILENAME",true); + var m_userName=new textControl("USER",true,true); + + return(construct()); + + function construct() { + m_fileName.setDisplayMode(); + m_displayDom.appendChild(m_fileName); + m_userName.setDisplayMode(); + m_userName.setAttribute('id','userName'); + m_userName.setAttribute('class','userName'); + m_userName.setText(getUserInfo("name")); + var profileLink=document.createElement("span"); + profileLink.setAttribute("class","link"); + profileLink.appendChild(document.createTextNode("[Profile]")); + profileLink.onclick=function(){ window.open("profile.html"); } + m_userName.appendChild(document.createTextNode(" ")); + m_userName.appendChild(profileLink); + m_displayDom.appendChild(m_userName); + + var menuItems = new Array(); + menuItems[menuItems.length]=new textMenuItem("Files",onFilesClick,"menuBarRootItem"); + menuItems[menuItems.length]=new textMenuItem("Save",onSaveClick,"menuBarRootItem"); + menuItems[menuItems.length]=new textMenuItem("More",onMoreClick,"menuBarRootItem"); + menuItems[menuItems.length]=new textMenuItem("Log Out",logOutUser,"menuBarRootItem"); + + m_displayDom.menu=new menuControl(menuItems,0); + m_displayDom.menu.setAttribute("class","menuBarMenu"); + + m_displayDom.appendChild(m_displayDom.menu); + + m_fsControl.hide(); + m_displayDom.appendChild(m_fsControl); + document.addSubscriber(m_fsControl.hide,"clicked"); + + m_displayDom.setFileDescription=setFileDescription; + m_displayDom.show=show; + m_displayDom.hide=hide; + + return(m_displayDom); + function onMoreClick(){ + if (!this.menu){ + var menuItems = new Array(); + menuItems[menuItems.length]=new textMenuItem("New Map/Clear",onNewClick,"menuBarSubItem"); + menuItems[menuItems.length]=new textMenuItem("Save Copy As",onSaveAsClick,"menuBarSubItem"); + menuItems[menuItems.length]=new textMenuItem("Add Rootnode",onNewRootNodeClick,"menuBarSubItem"); + menuItems[menuItems.length]=new textMenuItem("Reposition Nodes",autoRepositionNodes,"menuBarSubItem"); + + this.menu= new menuControl(menuItems,1); + this.menu.setAttribute("class","menuBarMenu"); + this.appendChild(this.menu); + document.addSubscriber(this.menu.hide,"clicked"); + } else { + this.menu.toggleVisible(); + } + } + } + + function onNewRootNodeClick(){ + rootNode[rootNode.length]=new node(dataTools.getNewPKey(),"(enter text)"); + } + + function onNewClick() { + g_filePKey=null; + setFileDescription("FILENAME"); + + deleteAllRootNodes(); + rootNode[0]=new node(dataTools.getNewPKey(),"(enter text)"); + } + function onSaveClick() { + saveMap(m_fileName.getText()); + m_fsControl.update(getFileList()); + } + function onSaveAsClick() { + g_filePKey=null; + saveMap(m_fileName.getText()); + m_fsControl.update(getFileList()); + } + function onFilesClick() { + if (m_fsControl.isVisible) { + m_fsControl.hide(); + } else { + m_fsControl.show(); + } + } + function setFileDescription(description) { + m_fileName.setText(description); + } + function hide() { + this.style.display="none"; + } + function show() { + this.style.display="block"; + } +} diff --git a/menuControl.js b/menuControl.js new file mode 100644 index 0000000..a8eea28 --- /dev/null +++ b/menuControl.js @@ -0,0 +1,75 @@ +function menuControl(menuItems,colCount) { + var m_domElement=document.createElement("div"); + m_domElement.setAttribute("class","contextMenu"); + var m_menuItems=menuItems; + var m_colCount=colCount?colCount:0; + + return(construct()); + + function construct() { + m_domElement.isVisible=true; + m_domElement.show=show; + m_domElement.hide=hide; + m_domElement.toggleVisible=toggleVisible; + + var btnTbl=document.createElement("table"); + if (0==m_colCount) { + var tblRow=document.createElement("tr"); + btnTbl.appendChild(tblRow); + } + for(var i=0;i= 1) { + return(construct()); + } else { + this.fromXML=fromXML; + return(this); + } + + // properties + function getPKey() { return(m_PKey); } + function getNodeRelations() { return(m_nodeRelations); } + + // methods + function construct() { + // the basic node + m_displayDom.setAttribute("id","mmNode_" + m_PKey); + m_displayDom.setAttribute("class","node"); + m_displayDom.extends(new Publisher()); + dragNDrop.activateForObject(m_displayDom); + + m_contextMenu=addContextMenu(); + m_displayDom.appendChild(m_contextMenu); + + exportFunctions(); + + // add a toolbar + if (!m_toolbar) { + m_toolbar=new toolbar(m_displayDom); + m_displayDom.appendChild(m_toolbar); + m_toolbar.hide(); + } + + if (!m_textControl){ m_textControl=new textControl(nodeText); } + m_displayDom.appendChild(m_textControl); + m_textControl.addSubscriber(notifyTextUpdate,"changeMode"); + + if (!m_iconControl) { + m_iconControl=new iconControl(); + } + //m_displayDom.appendChild(document.createElement("br")); + m_displayDom.appendChild(m_iconControl); + + if (m_isCollapsed) {collapse();} + + m_displayDom.onmouseup=mouseUpHandler; + m_displayDom.onmouseover=mouseOverHandler; + m_displayDom.onmouseout=mouseOutHandler; + + document.getElementById('nodes').appendChild(m_displayDom); + + m_textControl.focus(); + return(m_displayDom); + } + function addContextMenu(){ + var contextMenu; + var mi=new Array(); + for (var i=0;i=0;i--) { + if (!m_nodeRelations[i].isMain()) { + var nodeRel=m_nodeRelations[i]; + deleteNodeRelation(nodeRel); + nodeRel.erase(); + } + } + for (var i=m_nodeRelations.length-1;i>=0;i--) { + // recursively delete childs following the Main-Links + if (m_nodeRelations[i].getParentNode()==m_displayDom) { + m_nodeRelations[i].getChildNode().erase(); + + } + } + // delete the relation to the parent + for (var i=0;i < m_nodeRelations.length;i++) { + if (m_nodeRelations[i].getChildNode()==m_displayDom){ + m_nodeRelations[i].erase(); + } + } + removeFromRootNodes(); + destroy(); + } + function isRootNode(){ + for (var i=0;i < rootNode.length;i++) { + if (m_displayDom==rootNode[i]) { + return(true); + } + } + return(false); + } + function removeFromRootNodes(){ + // remove current node from the rootnodes + for (var i=0;i < rootNode.length;i++) { + if (m_displayDom==rootNode[i]) { + rootNode.splice(i,1); + } + } + } + function destroy(){ + m_displayDom.parentNode.removeChild(m_displayDom); + } + + function collapse(){ + m_isCollapsed=true; + if (!isLeafNode()) { m_displayDom.setAttribute("class","collapsedNode"); } + for (var i=0;i < m_nodeRelations.length;i++) { + if ((m_nodeRelations[i].isMain()) + && (m_nodeRelations[i].getParentNode()==m_displayDom)){ + m_nodeRelations[i].getChildNode().collapse(); + m_nodeRelations[i].getChildNode().hide(); + } + } + } + + function hide(){ + m_displayDom.style.display="none"; + for (var i=0;i < m_nodeRelations.length;i++) { + m_nodeRelations[i].hide(); + } + } + + function show(){ + m_displayDom.style.display="block"; + for (var i=0;i < m_nodeRelations.length;i++) { + m_nodeRelations[i].show(); + } + redrawNodeRelations(); + } + + function addNodeRelation(newNodeRel) { + if (!hasNodeRelation(newNodeRel)) { + m_nodeRelations[m_nodeRelations.length]=newNodeRel; + if ((newNodeRel.getChildNode) && (newNodeRel.getChildNode()==m_displayDom) && (newNodeRel.isMain())) { + removeFromRootNodes(); + } + } + } + function deleteNodeRelation(nodeRel) { + for (var i=0;i= 1) { + return(construct()); + } else { + this.fromXML=fromXML; + return(this); + } + + function construct() { + m_displayDom.setAttribute("id","mmNodeRel_" + m_PKey); + m_displayDom.appendChild(createPointsContainer()); + m_styleClass=(m_relationType=="main")?"defaultPoint":"freePoint"; + + // exported functions + m_displayDom.debugOut=debugOut; + m_displayDom.getPKey=getPKey; + m_displayDom.getParentNode=getParentNode; + m_displayDom.setParentNode=setParentNode; + m_displayDom.getChildNode=getChildNode; + m_displayDom.setChildNode=setChildNode; + m_displayDom.redraw=redraw; + m_displayDom.erase=erase; + m_displayDom.show=show; + m_displayDom.hide=hide; + m_displayDom.isMain=isMain; + + m_displayDom.toXML=toXML; + m_displayDom.fromXML=fromXML; + + document.getElementById("nodeRels").appendChild(m_displayDom); + + return(m_displayDom); + } + function show(){ + m_displayDom.style.display="block"; + } + function hide(){ + m_displayDom.style.display="none"; + } + function createPointsContainer(){ + m_pointsContainer=document.createElement("div"); + m_pointsContainer.setAttribute("id","mmPointsContainer_" + m_PKey); + m_pointsContainer.onclick=onPointsContainerClick; + // m_pointsContainer.oncontextmenu=onPointsContainerRightClick; + return(m_pointsContainer); + } + function onPointsContainerClick(event){ + if (m_contextMenu==null) { + var menuItems = new Array(); + menuItems[0]=new menuItem(document.createTextNode("Delete Relation"),erase); + m_contextMenu=new menuControl(menuItems,1); + m_pointsContainer.appendChild(m_contextMenu); + document.addSubscriber(m_contextMenu.hide,"clicked"); + + } else { + m_contextMenu.toggleVisible(); + } + m_contextMenu.style.top=(event.clientY + window.scrollY) + "px"; + m_contextMenu.style.left=(event.clientX + window.scrollX) + "px"; + return(false); + } + function debugOut() { + var output=("\nPKey: _"+ m_PKey + "_\np/c PKeys:_" + m_parentNode.getPKey() + "/"+ m_childNode.getPKey() +"_ (" + m_relationType + ")" ); + return(output); + } + function redraw() { + var parentEle=getParentNode(); + var childEle=getChildNode(); + + var parentX=parentEle.offsetLeft + (parentEle.offsetWidth/2); + var parentY=parentEle.offsetTop + (parentEle.offsetHeight/2); + + var childX=childEle.offsetLeft + (childEle.offsetWidth/2); + var childY=childEle.offsetTop + (childEle.offsetHeight/2); + + // performance: only redraw the line if the corrdinates changed. and both nodes are visible + if ( ((m_parentX!=parentX) || (m_parentY!=parentY) || (m_childX!=childX) || (m_childY!=childY)) + && (childEle.style.display != "none") && (parentEle.style.display != "none")) { + + eraseLine(); + drawLine(parentX,parentY,childX,childY,m_styleClass,m_pointsContainer); + m_parentX=parentX; + m_parentY=parentY; + m_childX=childX; + m_childY=childY; + } + } + function eraseLine() { + m_displayDom.removeChild(m_pointsContainer); + m_pointsContainer=createPointsContainer(); + m_displayDom.appendChild(m_pointsContainer); + } + function erase() { + if (isMain()) { + // new rootnode by deleting main relation. + rootNode[rootNode.length]=getChildNode(); + } + + getChildNode().deleteNodeRelation(m_displayDom); + getParentNode().deleteNodeRelation(m_displayDom); + + m_displayDom.parentNode.removeChild(m_displayDom); + } + function toXML(){ + var xmlEle=document.createElement('NODEREL'); + xmlEle.setAttribute("pkey",m_PKey); + xmlEle.setAttribute("parentnodepkey",m_parentNode.getPKey()); + xmlEle.setAttribute("childnodepkey",m_childNode.getPKey()); + xmlEle.setAttribute("relationtype",m_relationType); + // including child nodes if this is the main relation + if (isMain()) { + xmlEle.appendChild(m_childNode.toXML()); + } + return(xmlEle); + } + function fromXML(inXML){ + m_PKey=inXML.getAttribute("pkey"); + m_relationType=inXML.getAttribute("relationtype"); + if (m_relationType == "") { m_relationType="main"; } + m_displayDom.setAttribute("id","mmNodeRel_" + m_PKey); + + var parentNodePKey=inXML.getAttribute("parentnodepkey"); + var childNodePKey=inXML.getAttribute("childnodepkey"); + m_parentNode=document.getElementById("mmNode_" + parentNodePKey); + + if (inXML.childNodes.length > 0){ + // Main-Relation + m_childNode=new node().fromXML(inXML.firstChild); + } else { + // free links don't create nodes + m_childNode=document.getElementById("mmNode_" + childNodePKey); + if (m_childNode==null) { alert("Error: Assertion failed,\ncan't backlink NodePKey _ " + childNodePKey + "_"); } + } + m_childNode.addNodeRelation(m_displayDom); + m_parentNode.addNodeRelation(m_displayDom); + + return(construct()); + } +} + diff --git a/obfuscate.sh b/obfuscate.sh new file mode 100644 index 0000000..66c6d76 --- /dev/null +++ b/obfuscate.sh @@ -0,0 +1,5 @@ +set -e +set -x +ls *.js | while read i; +do java -jar consyntools.jar Obfuscator "${i}" "${i}" +done diff --git a/observerHandling.js b/observerHandling.js new file mode 100644 index 0000000..8b41b3c --- /dev/null +++ b/observerHandling.js @@ -0,0 +1,36 @@ +function Publisher() { + var m_subscribers=new Array(); + + this.addSubscriber=addSubscriber; + this.removeSubscriber=removeSubscriber; + this.notifySubscribers=notifySubscribers; + + function addSubscriber(subscriber,eventType){ + for(var i=0;i + + + WebThink Edit UserProfile + + + + + + + + + +
+ +
- P R O F I L E -
+
+ + + + + + + +
NameDisplay-name
Mail-AddressMail-Address
PasswordEnter your new password twice.
Repeat

+ +
+ + + diff --git a/requestTarget.php b/requestTarget.php new file mode 100644 index 0000000..1ea6383 --- /dev/null +++ b/requestTarget.php @@ -0,0 +1,493 @@ +\r\n" . + 'Reply-To: <' . $fromAddr . ">\r\n" . + 'X-Mailer: PHP/' . phpversion() . "\r\n\r\n"; + mail($to,$subject,$message,$headers); +} + +function getRequest(){ + $putdata=fopen("php://input", "rb"); + $myData=""; + while(!feof($putdata)){ + $myData=$myData. fread($putdata, 4096); + } + fclose($putdata); + return($myData); +} + +function writeToFile($filename,$text){ + // create directory if not already present + $cmd="mkdir -p \"$(dirname \"" . $filename . "\")\""; + system($cmd); + + $fp=fopen($filename,'w') or die("Can't open file"); + fwrite($fp,$text); + fclose($fp); +} + +function readFromFile($filename){ + $fp=fopen($filename,'r') or die("Can't open file"); + $text = fread($fp, filesize($filename)); + fclose($fp); + return($text); +} +function isFileOwner($dh,$filePKey,$userPKey){ + $query="Select count(*) \"count\",max(pkey) from fileUserRel where filePKey=" . $dh->quote($filePKey) . " and userPKey=" . $dh->quote($userPKey) ; + $result=$dh->query($query) ; + $row=$result->fetch(); + if ($row['count']==1) { + return(true); + } else { + return(false); + } +} +function deleteFile($dh,$mapPath,$fileInfo){ + if (isFileOwner($dh,$fileInfo["PKey"],$_SESSION['UserPKey'])) { + //$query="delete from file where pkey = " . $fileInfo["PKey"] . ""; + $query="update file set deleteDate=datetime('now') where pkey = " . $dh->quote($fileInfo["PKey"]) ; + $dh->exec($query) ; + //unlink($mapPath . "/" . $fileInfo['Name']); + } + return(""); +} +function getNewPKey($dh){ +// $dh->beginTransaction(); + $query="Select nextFree from pkey"; + $result=$dh->query($query) ; + $row=$result->fetch(); + $newPKey=$row['nextFree']; + + $query="update pkey set nextFree=nextFree+1"; + $dh->exec($query) ; +// $dh->commit(); + return($newPKey); +} + + +function getUserInfo($dh){ + $xmlDoc= new DomDocument(); + $rootNode=$xmlDoc->createElement("response"); + $xmlDoc->appendChild($rootNode); + + $query="Select name,mail from user where pkey=" . $dh->quote($_SESSION['UserPKey']); + writeToFile("/tmp/rrr",$query); + $result=$dh->query($query) ; + $row=$result->fetch(); + if (!$row) { + $success="false"; + $rootNode->setAttribute("name","Unknown"); + $rootNode->setAttribute("mail","Unknown"); + $error="UserNotFoundError"; + } else { + $success="true"; + $rootNode->setAttribute("name",$row['name']); + $rootNode->setAttribute("mail",$row['mail']); + $dh->exec($query) ; + } + + $rootNode->setAttribute("success",$success); + if ($success=="false") { + $rootNode->setAttribute("error",$error); + } + return($xmlDoc); + +} + +// Inserts new files into the DB, updates the description. +// returns the filename. +// filePKey must be null for new records +function getFileNameAndPKey($dh,$filePKey,$description){ + if ($filePKey=="") { + $isNew=true; + $filePKey=getNewPKey($dh); + $fileName=$_SESSION["UserPKey"] . "/" . $filePKey; // TODO - should include the user + $query="insert into file (pkey,filename,description) values (" . $dh->quote($filePKey) . "," . $dh->quote($fileName) . "," . $dh->quote($description) . ")"; + $dh->exec($query) ; + $query="insert into fileUserRel (pkey,filePKey,userPKey,isOwner) values (" . $dh->quote(getNewPKey($dh)) . "," . $dh->quote($filePKey) . "," . $dh->quote($_SESSION['UserPKey']) . ",1)"; + $dh->exec($query) ; + } else { + $isNew=false; + $query="Select file.filename \"fileName\", file.description \"fileDescription\" from file,fileUserRel where file.pkey=" . $dh->quote($filePKey) . " and fileUserRel.filePKey=file.pkey and fileUserRel.userPKey=" . $dh->quote($_SESSION['UserPKey']) ; + $result=$dh->query($query) ; + $row=$result->fetch(); + $fileName=$row['fileName']; + $currDescription=$row['fileDescription']; + if (($description!=null) and ($currDescription != $description)) { + $query="update file set description=" . $dh->quote($description) . " where pkey=" . $dh->quote($filePKey) ; + $dh->exec($query) ; + } + } + $ret=array("Name"=>$fileName, + "PKey"=>$filePKey, + "isNew"=>$isNew); + return($ret); +} +function getIconList($dh){ + $xmlDoc= new DomDocument(); + $rootNode=$xmlDoc->createElement("icons"); + $rootNode->setAttribute("success","true"); + $xmlDoc->appendChild($rootNode); + + $query="Select icon.pkey \"iconPKey\", icon.filename \"filename\" ,icon.description \"description\" from icon order by sort"; + $result=$dh->query($query) ; + while ($row=$result->fetch()) { + $recordNode=$xmlDoc->createElement("icon"); + $recordNode->setAttribute("pkey",$row['iconPKey']); + $recordNode->setAttribute("filename",$row['filename']); + $recordNode->setAttribute("description",$row['description']); + $rootNode->appendChild($recordNode); + } + return($xmlDoc); +} +function listFiles($dh){ + $xmlDoc= new DomDocument(); + $rootNode=$xmlDoc->createElement("div"); + $rootNode->setAttribute("class","fileList"); + $rootNode->setAttribute("success","true"); + $xmlDoc->appendChild($rootNode); + + $query="Select file.pkey \"filePKey\", file.description \"fileDescription\" from file,fileUserRel where file.pkey=fileUserRel.filePKey and fileUserRel.userPKey=" . $dh->quote($_SESSION['UserPKey']) . " and file.deleteDate is null order by description"; + $result=$dh->query($query) ; + while ($row=$result->fetch()) { + $fileNode=$xmlDoc->createElement("div"); + $fileNode->setAttribute("class","singleFile"); + $fileNode->setAttribute("pkey",$row['filePKey']); + $fileNode->appendChild($xmlDoc->createTextNode($row['fileDescription'])); + $rootNode->appendChild($fileNode); + } + return($xmlDoc); +} +function confirmOptin($dh,$token){ + $xmlDoc= new DomDocument(); + $rootNode=$xmlDoc->createElement("response"); + $xmlDoc->appendChild($rootNode); + + $query="Select count(*) \"count\",max(pkey) \"userOptinPKey\" from userOptin where confirmed != '1' and token=" . $dh->quote($token); + $result=$dh->query($query) ; + $row=$result->fetch(); + if ($row['count']!=1) { + $success="false"; + $error="TokenNotFoundError"; + } else { + $success="true"; + $query="update userOptin set confirmed='1' where pkey ='" . $row['userOptinPKey'] . "'"; + $dh->exec($query) ; + } + + $rootNode->setAttribute("success",$success); + if ($success=="false") { + $rootNode->setAttribute("error",$error); + } + return($xmlDoc); +} +function checkMailAddress($mail){ + if ((strlen($mail) < 6) || (false === strpos($mail,"@"))) { + return("Invalid E-Mail Address!"); + } + + $result=""; + try { + $fp=popen($GLOBALS['conf_basePath'] . "checkMail.sh " . $mail,"r"); + while (!feof($fp)) { + $result=$result . fgets($fp, 4096); + } + pclose($fp); + } catch (Exception $e) { + $result="Can't execute check-script."; + } + return($result); +} +function optinUser($dh,$mail,$password){ + $xmlDoc= new DomDocument(); + $rootNode=$xmlDoc->createElement("response"); + $xmlDoc->appendChild($rootNode); + + $mailCheckErr=checkMailAddress($mail); + if ("" != $mailCheckErr) { + $rootNode->setAttribute("success","false"); + $rootNode->setAttribute("error","MailAddressNotValidError"); + $rootNode->setAttribute("description",$mailCheckErr); + + return($xmlDoc); + } + + $query="Select count(*) \"count\",max(pkey) \"userPKey\" from user where mail=" . $dh->quote($mail); + $result=$dh->query($query) ; + $row=$result->fetch(); + if ($row['count']!=0) { + $rootNode->setAttribute("success","false"); + $rootNode->setAttribute("error","MailAlreadyRegisteredValidation"); + } else { + $rootNode->setAttribute("success","true"); + $userPKey=getNewPKey($dh); + $query="Insert into user (pkey,name,mail,password) values (" . $dh->quote($userPKey) . "," . $dh->quote($mail) . "," . $dh->quote($mail) . "," . $dh->quote($password) . ")"; + $dh->exec($query) ; + $token=getToken(); + $query="Insert into userOptin (pkey, userPKey, pendingSince, ip, confirmed, token) values (" . $dh->quote(getNewPKey($dh)) . "," . $dh->quote($userPKey) . ",datetime('now')," . $dh->quote($_SERVER["REMOTE_ADDR"]) . ",'0'," . $dh->quote($token) . ")"; + $dh->exec($query) ; + myMail($mail, $GLOBALS["conf_appName"] . "Sign up Confirmation","Thanks for signing up!\nplease follow this link to confirm your mail-address:\n<" . $GLOBALS["conf_appURL"] . "login.php?action=confirmOptin&token=" . $token . ">"); + } + + return($xmlDoc); +} +function getToken(){ + $salt=microtime() . "_" . $_SERVER["REMOTE_ADDR"] . "_" . rand(1,32768); + return(md5($salt)); +} +function setupAutoLogin($dh){ + $token=getToken(); + $query="insert into userAutologin (pkey, userPKey, token,setupDate) values (" . $dh->quote(getNewPKey($dh)) . "," . $dh->quote($_SESSION["UserPKey"]) . "," . $dh->quote($token) . ",datetime('now'))"; + $dh->exec($query); + return($token); +} +function logOutUser($dh,$loginToken){ + $query="delete from userAutoLogin where userPKey=" . $dh->quote($_SESSION['userPKey']) . " and token=" . $dh->quote($loginToken); + $dh->exec($query) ; + unset($_SESSION['UserPKey']); + $xmlDoc= new DomDocument(); + $rootNode=$xmlDoc->createElement("response"); + $rootNode->setAttribute("success","true"); + $xmlDoc->appendChild($rootNode); + + return($xmlDoc); +} + +function logInUser($dh,$mail,$password,$isSetupAutoLogin,$loginToken){ + if ($loginToken) { + $query="Select count(*) \"count\",max(user.pkey) \"userPKey\" from user, userOptin, userAutologin where userAutoLogin.userPKey=user.pkey and userAutoLogin.token=" . $dh->quote($loginToken) . " and userOptin.userPKey=user.PKey and userOptin.confirmed='1' and user.mail=" . $dh->quote($mail); + } else { + $query="Select count(*) \"count\",max(user.pkey) \"userPKey\" from user, userOptin where userOptin.userPKey=user.PKey and userOptin.confirmed='1' and user.mail=" . $dh->quote($mail) . " and user.password=" . $dh->quote($password); + } + + $result=$dh->query($query) ; + $row=$result->fetch(); + if ($row['count']==1) { + $success="true"; + $_SESSION['UserPKey']=$row['userPKey']; + $query="insert into userLogin (pkey, userpkey, loginDate, loginIp) values (" . $dh->quote(getNewPKey($dh)) . "," . $dh->quote($_SESSION["UserPKey"]) . ",datetime('now')," . $dh->quote($_SERVER["REMOTE_ADDR"]) . ")"; + $dh->exec($query) ; + if ($isSetupAutoLogin) { + $autoLoginToken=setupAutoLogin($dh); + } + } else { + $success="false"; + $errorclass="AppError"; + $_SESSION['UserPKey']=null; + } + + $xmlDoc= new DomDocument(); + $rootNode=$xmlDoc->createElement("response"); + $rootNode->setAttribute("success",$success); + $rootNode->setAttribute("autologintoken",$autoLoginToken); + $rootNode->setAttribute("errorclass",$errorclass); + $xmlDoc->appendChild($rootNode); + + return($xmlDoc); +} +function mailPassword($dh,$mail){ + $xmlDoc= new DomDocument(); + $rootNode=$xmlDoc->createElement("response"); + $xmlDoc->appendChild($rootNode); + + $query="Select count(*) \"count\",max(user.pkey) \"userPKey\",min(userOptin.confirmed) \"optinConfirmed\",min(userOptin.token) \"optinToken\" from user, userOptin where userOptin.userPKey=user.PKey and userOptin.confirmed='1' and user.mail=" . $dh->quote($mail); + $result=$dh->query($query) ; + $row=$result->fetch(); + if ($row['count']!=1) { + $success="false"; + $error="MailAddressNotRegisteredValidation"; + } else { + $success="true"; + if ($row['optinConfirmed']!="1") { + $token=$row['optinToken']; + myMail($mail, $GLOBALS["conf_appName"] . " Password-Request/Sign up Confirmation","During your password request we found that your mail-address was not confirmend yet.\nYou can only sign in if your address is confirmed.\nplease follow this link to confirm your mail-address:\n<" . $GLOBALS["conf_appURL"] . "login.php?action=confirmOptin&token=" . $token . ">"); + } else { + $token=getToken(); + $query="Insert into userPassReq (pkey, userPKey, token, requestDate) values (" . $dh->quote(getNewPKey($dh)) . ",'" . $row['userPKey'] . "'," . $dh->quote($token) . ",datetime('now'))"; + $dh->exec($query) ; + myMail($mail, $GLOBALS["conf_appName"] . " Password override request","To override your password please follow this link:\n<" . $GLOBALS["conf_appURL"] . "login.php?action=overridePassword&token=" . $token . ">"); + } + } + + + $rootNode->setAttribute("success",$success); + if ($success=="false") { + $rootNode->setAttribute("error",$error); + } + return($xmlDoc); +} + +function setUserPassword($dh,$UserPKey,$newPass){ + $query="update user set password=" . $dh->quote($newPass) . " where mail<>'demo' and pkey = " . $dh->quote($UserPKey); + $dh->exec($query) ; +} + +function updateUserProfile($dh,$mail,$password,$name){ + $xmlDoc= new DomDocument(); + $rootNode=$xmlDoc->createElement("response"); + $xmlDoc->appendChild($rootNode); + + // check the mail-address if it was changed + if (getUserInfo($dh)->firstChild->getAttribute("mail") != $mail) { + $mailCheckErr=checkMailAddress($mail); + if ("" != $mailCheckErr) { + $rootNode->setAttribute("success","false"); + $rootNode->setAttribute("error","MailAddressNotValidError"); + $rootNode->setAttribute("description",$mailCheckErr); + + return($xmlDoc); + } + } + + if ($password) { + setUserPassword($dh,$_SESSION["UserPKey"],$password); + } + $query="update user set name=" . $dh->quote($name) . ", mail=" . $dh->quote($mail) . " where mail<>'demo' and pkey = " . $dh->quote($_SESSION["UserPKey"]); + $dh->exec($query) ; + + $rootNode->setAttribute("success","true"); + return($xmlDoc); +} + +function changePassword($dh,$mail,$newPass,$oldPass,$token){ + $xmlDoc= new DomDocument(); + $rootNode=$xmlDoc->createElement("response"); + $xmlDoc->appendChild($rootNode); + + if (strlen($mail)>1) { // change password with mail and old password + $query="select count(*) \"count\", max(user.pkey) \"userPKey\" from user,userOptin where user.pkey=userOptin.userPKey and userOptin.confirmed='1' and user.password=" . $dh->quote($oldPass) . " and user.mail=" . $dh->quote($mail); + + $result=$dh->query($query) ; + $row=$result->fetch(); + if ($row['count']!=1) { + $success="false"; + $error="MailNotExistentOrPasswordWrongValidation"; + } else { + setUserPassword($dh,$row['userPKey'],$newPass); + $success="true"; + } + } else { // change password via token + $query="select count(*) \"count\", max(userPassReq.userPKey) \"userPKey\", max(userPassReq.pkey) \"userPassReqPKey\" from userPassReq where token is not null and token=" . $dh->quote($token) ; + $result=$dh->query($query) ; + $row=$result->fetch(); + if ($row['count']!=1) { + $success="false"; + $error="TokenExpiredValidation"; + } else { + setUserPassword($dh,$row['userPKey'],$newPass); + $success="true"; + $query="update userPassReq set token=null where pkey = " . $row['userPassReqPKey'] ; + $result=$dh->query($query) ; + } + } + + $rootNode->setAttribute("success",$success); + if ($success=="false") { + $rootNode->setAttribute("error",$error); + } + return($xmlDoc); +} + +try { + $dh=new PDO("sqlite:".$db); + + $reqXML=new DomDocument(); + $reqXML->loadXML(getRequest()); + $theFunction=$reqXML->documentElement->getAttribute("function"); + + writeToFile("/tmp/reqtgt.log",$reqXML->saveXML()); + + switch ($theFunction) { + case "SAVEFILE": + $description=$reqXML->documentElement->getAttribute("description"); + $filePKeyReq=$reqXML->documentElement->getAttribute("filepkey"); + $fileInfo=getFileNameAndPKey($dh,$filePKeyReq,$description); + if ($fileInfo["isNew"]) { $reqXML->documentElement->setAttribute("filepkey",$fileInfo["PKey"]); } + writeToFile($mapPath . $fileInfo["Name"],$reqXML->saveXML()); + echo (""); + break; + case "OPENFILE": + $filePKey=$reqXML->documentElement->getAttribute("filepkey"); + $fileInfo=getFileNameAndPKey($dh,$filePKey,null); + echo(readFromFile($mapPath . $fileInfo["Name"])); + break; + case "DELETEFILE": + $filePKey=$reqXML->documentElement->getAttribute("filepkey"); + $fileInfo=getFileNameAndPKey($dh,$filePKey,null); + echo(deleteFile($dh,$mapPath ,$fileInfo)); + break; + case "LISTFILES": + echo(listFiles($dh)->saveXML()); + break; + case "LOGIN": + $mail=$reqXML->documentElement->getAttribute("mail"); + $password=$reqXML->documentElement->getAttribute("password"); + $isSetupAutoLogin=($reqXML->documentElement->getAttribute("isautologin")=="1"); + echo(logInUser($dh,$mail,$password,$isSetupAutoLogin,null)->saveXML()); + break; + case "LOGOUT": + $loginToken=$reqXML->documentElement->getAttribute("token"); + echo(logOutUser($dh,$loginToken)->saveXML()); + break; + case "TOKENLOGIN": + $mail=$reqXML->documentElement->getAttribute("mail"); + $loginToken=$reqXML->documentElement->getAttribute("token"); + echo(logInUser($dh,$mail,null,false,$loginToken)->saveXML()); + break; + case "OPTINUSER": + $mail=$reqXML->documentElement->getAttribute("mail"); + $password=$reqXML->documentElement->getAttribute("password"); + echo(optinUser($dh,$mail,$password)->saveXML()); + break; + case "MAILPASSWORD": + $mail=$reqXML->documentElement->getAttribute("mail"); + echo(mailPassword($dh,$mail)->saveXML()); + break; + case "CONFIRMOPTIN": + $token=$reqXML->documentElement->getAttribute("token"); + echo(confirmOptin($dh,$token)->saveXML()); + break; + case "CHANGEPASSWORD": + $mail=$reqXML->documentElement->getAttribute("mail"); + $newPass=$reqXML->documentElement->getAttribute("newpass"); + $oldPass=$reqXML->documentElement->getAttribute("oldpass"); + $token=$reqXML->documentElement->getAttribute("token"); + echo(changePassword($dh,$mail,$newPass,$oldPass,$token)->saveXML()); + break; + case "UPDATEUSERPROFILE": + $mail=$reqXML->documentElement->getAttribute("mail"); + $password=$reqXML->documentElement->getAttribute("password"); + $name=$reqXML->documentElement->getAttribute("name"); + echo(updateUserProfile($dh,$mail,$password,$name)->saveXML()); + break; + case "GETICONLIST": + echo(getIconList($dh)->saveXML()); + break; + case "GETUSERINFO": + echo(getUserInfo($dh)->saveXML()); + break; + } +} catch (PDOException $exception) { + $xmlDoc= new DomDocument(); + $rootNode=$xmlDoc->createElement("response"); + $xmlDoc->appendChild($rootNode); + $rootNode->setAttribute("success","false"); + $rootNode->setAttribute("error","DB-Error"); + $rootNode->setAttribute("message",$exception->getMessage()); + die($xmlDoc->saveXML()); +} + +?> diff --git a/sql/createDB.sql b/sql/createDB.sql new file mode 100644 index 0000000..73d928c --- /dev/null +++ b/sql/createDB.sql @@ -0,0 +1,11 @@ +CREATE TABLE file(pkey int, filename varchar, description varchar, deleteDate dateTime); +CREATE TABLE fileUserRel(pkey int, filePKey int, userPKey int, isOwner boolean); +CREATE TABLE icon (pkey int, filename varchar, description varchar, sort int); +CREATE TABLE pkey(nextFree int); +CREATE TABLE referer (date dateTime,userIp varchar,refererURL varchar); +CREATE TABLE tmp (pkey int); +CREATE TABLE user(pkey int, name varchar,mail varchar,password varchar, autologintoken varchar); +CREATE TABLE userAutologin (pkey int, userPKey int, token varchar, setupDate dateTime); +CREATE TABLE userLogin(pkey int, userPKey int, loginDate datetime, loginIp varchar); +CREATE TABLE userOptin(pkey int, userPKey int, pendingSince datetime, ip varchar, confirmed boolean, token varchar); +CREATE TABLE userPassReq(pkey int,userPKey int, token varchar,requestDate dateTime); diff --git a/sql/exportSchema.sh b/sql/exportSchema.sh new file mode 100644 index 0000000..ef5f112 --- /dev/null +++ b/sql/exportSchema.sh @@ -0,0 +1,5 @@ +#!/bin/bash +echo ".schema" | sqlite3 ../WebThink.db > createDB.sql + +echo "drop table icon;" > prepareIcon.sql +echo ".dump icon" | sqlite3 ../WebThink.db >> prepareIcon.sql diff --git a/sql/prepareIcon.sql b/sql/prepareIcon.sql new file mode 100644 index 0000000..8d92389 --- /dev/null +++ b/sql/prepareIcon.sql @@ -0,0 +1,24 @@ +drop table icon; +BEGIN TRANSACTION; +CREATE TABLE icon (pkey int, filename varchar, description varchar, sort int); +INSERT INTO "icon" VALUES(1,'exclamationMark.png','Exclamation Mark',1); +INSERT INTO "icon" VALUES(2,'questionSign.png','Question Sign',2); +INSERT INTO "icon" VALUES(3,'smileyGood.png','Smiley Good',3); +INSERT INTO "icon" VALUES(4,'smileyBad.png','Smiley Bad',4); +INSERT INTO "icon" VALUES(5,'smileyOh.png','Smiley Oh',5); +INSERT INTO "icon" VALUES(6,'tick.png','Tick',6); +INSERT INTO "icon" VALUES(7,'bulb.png','Idea',7); +INSERT INTO "icon" VALUES(8,'thumbUp.png','Good',8); +INSERT INTO "icon" VALUES(9,'thumbDown.png','Bad',9); +INSERT INTO "icon" VALUES(10,'clock.png','Time',10); +INSERT INTO "icon" VALUES(11,'heart.png','Heart',11); +INSERT INTO "icon" VALUES(12,'phone.png','Phone',12); +INSERT INTO "icon" VALUES(13,'arrowLeft.png','Left',13); +INSERT INTO "icon" VALUES(14,'arrowRight.png','Right',14); +INSERT INTO "icon" VALUES(15,'arrowUp.png','Up',15); +INSERT INTO "icon" VALUES(16,'arrowDown.png','Down',16); +INSERT INTO "icon" VALUES(17,'arrowUpExclam.png','Up!',17); +INSERT INTO "icon" VALUES(18,'arrowDownExclam.png','Down!',18); +INSERT INTO "icon" VALUES(19,'rose.png','Rose',19); +INSERT INTO "icon" VALUES(20,'cross.png','Not Ok!',6); +COMMIT; diff --git a/sql/preparePKey.sql b/sql/preparePKey.sql new file mode 100644 index 0000000..e5d1e4c --- /dev/null +++ b/sql/preparePKey.sql @@ -0,0 +1,2 @@ +insert into pkey values (10000); + diff --git a/textControl.js b/textControl.js new file mode 100644 index 0000000..dcaa2c2 --- /dev/null +++ b/textControl.js @@ -0,0 +1,288 @@ +// Modes: +// - display +// - singleLine Entry +// - MultiLine Entry + +function textControl(initialText,isMultiLineDisabled,isDisabled) { + var m_text=initialText; + var m_isMultiline=false; + + var m_mode=isDisabled?"display":"slEntry"; // Initial Mode + + var m_slEntryControl; + var m_mlEntryControl; + var m_displayControl; + + var m_displayDom=document.createElement("span"); + + // call the constructor only if the argument is given. + if (arguments.length>=1) { + return(construct()); + } else { + // if no argument is given then we can only loadXML + this.fromXML=fromXML; + return(this); + } + + function construct() { + m_slEntryControl=createSingleLineEntryControl(); + m_displayControl=createDisplayControl(); + m_mlEntryControl=createMultiLineEntryControl(); + + m_displayDom.appendChild(m_slEntryControl); + m_displayDom.appendChild(m_mlEntryControl); + m_displayDom.appendChild(m_displayControl); + + m_displayDom.focus=focus; + m_displayDom.setDisplayMode=setDisplayMode; + m_displayDom.setText=setText; + m_displayDom.getText=getText; + + m_displayDom.toXML=toXML; + m_displayDom.fromXML=fromXML; + + m_displayDom.extends(new Publisher()); + + changeMode(m_mode); + + return (m_displayDom); + } + + function focus(){ + changeMode(m_mode); + } + + function getText() { return(m_text); } + function setText(text) { + // stop user form entering empty text. + if (text.length>0) { + m_text=text; + changeMode(m_mode); + return(true); + } else { + return(false); + } + } + + function setDisplayMode() { changeMode("display"); } + + function setSlEntryMode() { + if ((m_isMultiline) && (!isMultiLineDisabled)) { + changeMode("mlEntry"); + } else { + changeMode("slEntry"); + } + } + function setMlEntryMode() { changeMode("mlEntry"); } + + function changeMode(newMode){ + m_mode=newMode; + // hide all + m_slEntryControl.hide(); + m_displayControl.hide(); + m_mlEntryControl.hide(); + + // and show the selected one + switch(newMode) { + case "slEntry": + m_slEntryControl.update(); + m_slEntryControl.show(); + m_slEntryControl.focus(); + break; + case "mlEntry": + m_mlEntryControl.update(); + m_mlEntryControl.show(); + m_mlEntryControl.focus(); + break; + case "display": + m_displayControl.update(); + m_displayControl.show(); + m_displayControl.focus(); + break; + } + m_displayDom.notifySubscribers(m_displayDom,"changeMode"); + } + + function createMultiLineEntryControl() { + var txtara=document.createElement("textarea"); + txtara.appendChild(document.createTextNode(m_text)); + txtara.onclick=onClickTextArea; + txtara.onkeyup=updateText; + + var submit=document.createElement("input"); + submit.type="submit"; + submit.value="OK"; + submit.onclick=onClickOk; + + var container=document.createElement("span"); + container.appendChild(txtara); + container.appendChild(submit); + + container.update=update; + container.focus=focus; + container.show=show; + container.hide=hide; + + return(container); + + function onClickTextArea(event) { + txtara.focus(); + event.stopPropagation(); + } + function onClickOk(event) { + endEdit(); + event.stopPropagation(); + } + function update(){ + txtara.value=m_text; + } + function show(){ + container.style.display="inline"; + txtara.focus(); + } + function hide(){ + container.style.display="none"; + } + function focus(){ + } + function updateText() { + m_text = txtara.value; + } + function endEdit(){ + if (txtara.value.indexOf("\n")!=-1) { + m_isMultiline=true; + } else { + m_isMultiline=false; + } + if (setText(txtara.value)) { + setDisplayMode(); + } + } + } + + function createSingleLineEntryControl() { + var container=document.createElement("span"); + container.style.whiteSpace="nowrap"; + + var entry=document.createElement("input"); + entry.value=m_text; + entry.onkeyup=updateText; + entry.onkeydown=fireOnEnter; + entry.onchange=endEdit; + entry.onclick=onClickSingleLineEntry; + + var btnML=document.createElement("input"); + btnML.type="button"; + btnML.value="ML"; + btnML.onclick=onClickSwitchMultiline; + + container.appendChild(entry); + if (!isMultiLineDisabled) { + container.appendChild(btnML); + } + container.entry=entry; + + container.update=update; + container.focus=focus; + container.show=show; + container.hide=hide; + + return(container); + function onClickSingleLineEntry(event){ + entry.focus(); + event.stopPropagation(); + } + function onClickSwitchMultiline(event){ + switchMultiLine(); + event.stopPropagation(); + } + function hide() { + container.style.display="none"; + } + + function show() { + container.style.display="inline"; + } + + function update() { + entry.value=m_text; + } + + function focus() { + entry.focus(); + entry.select(); + } + function updateText() { + m_text = entry.value; + } + function fireOnEnter(evt, frm ) { + var keyCode = null; + + if( evt.which ) { + keyCode = evt.which; + } else if( evt.keyCode ) { + keyCode = evt.keyCode; + } + if( 13 == keyCode ) { + endEdit(); + return(false); + } + return(true); + } + + function endEdit(){ + if (setText(entry.value)) { + setDisplayMode(); + } + } + + function switchMultiLine(){ + endEdit(); + changeMode("mlEntry"); + } + } + + function createDisplayControl() { + var container=document.createElement("span"); + container.setAttribute("class","boxText"); + container.onclick=onClickDisplayControl; + container.appendChild(document.createTextNode(m_text)); + + container.update=update; + container.show=show; + container.hide=hide; + container.focus=focus; + return(container); + function onClickDisplayControl(event){ + if (!isDisabled) { + setSlEntryMode(); + } + event.stopPropagation(); + } + function hide() { + container.style.display="none"; + } + function show() { + container.style.display="block"; + } + function update(){ + container.firstChild.data=m_text; + } + function focus(){ + return(true); + } + } + function toXML(){ + var xmlEle=document.createElement('TEXTCONTROL'); + xmlEle.setAttribute("ismultiline",(m_isMultiline)?"true":"false"); + xmlEle.setAttribute("mode",m_mode); + xmlEle.appendChild(document.createTextNode(m_text)); + return(xmlEle); + } + function fromXML(inXML){ + m_isMultiline=("true"==inXML.getAttribute("ismultiline")); + m_text=inXML.firstChild.nodeValue; + m_mode=inXML.getAttribute("mode"); + return(construct()); + } +} diff --git a/todoList.txt b/todoList.txt new file mode 100644 index 0000000..f0daca9 --- /dev/null +++ b/todoList.txt @@ -0,0 +1,16 @@ +Icons in Nodes (standard) +Proper Error Handling (PHP/JAVASCRIPT) (Error message translations) +Terms and Conditions +(MSIE support) +Documentation +---------------------------------- +Changable stylesheets +Change colors of Nodes +Changing font +Change colors of Relations +Change relation design (Bezier) +Import foreign file formats +User uploadable icons +sharing files +collaboration online +printing diff --git a/toolbar.js b/toolbar.js new file mode 100644 index 0000000..acd3846 --- /dev/null +++ b/toolbar.js @@ -0,0 +1,178 @@ +function toolbar(nodeClass) { + var m_displayDom=document.createElement("span"); + m_displayDom.setAttribute("id","mmToolbar_" + nodeClass.getPKey()); + m_displayDom.setAttribute("class","boxToolbar"); + + var m_addNode=new dataTools.imageDom('pix/icnStar.png',"+","Add node"); + m_addNode.onclick=addNodeClick; + m_displayDom.appendChild(m_addNode); + + var m_collapseNode=new dataTools.imageDom("pix/icnArrowUp.png","_","Collapse node"); + m_collapseNode.onclick=collapseNodeClick; + m_collapseNode.hide=function(){m_collapseNode.style.display="none";} + m_collapseNode.show=function(){m_collapseNode.style.display="inline";} + m_collapseNode.hide(); + m_displayDom.appendChild(m_collapseNode); + + var m_expandNode=new dataTools.imageDom("pix/icnArrowDown.png","-","Expand node"); + m_expandNode.onclick=expandNodeClick; + m_expandNode.hide=function(){m_expandNode.style.display="none";} + m_expandNode.show=function(){m_expandNode.style.display="inline";} + m_expandNode.hide(); + m_displayDom.appendChild(m_expandNode); + + var m_eraseNode=new dataTools.imageDom("pix/icnWaste.png","E","Erase Node and subnodes"); + m_eraseNode.onclick=eraseNodeClick; + m_displayDom.appendChild(m_eraseNode); + + var m_addFreeLink=new dataTools.imageDom("pix/icnNewBranch.png","F","Add Free relation"); + m_addFreeLink.style.position="absolute"; + m_addFreeLink.isDragging=false; + m_displayDom.appendChild(m_addFreeLink); + dragNDrop.activateForObject(m_addFreeLink); + dragNDrop.addSubscriber(freeLinkEventNotify,"endMoving"); + + var m_changeParentNode=new dataTools.imageDom("pix/icnMoveBranch.png","P","Change Parent relation"); + m_changeParentNode.style.position="absolute"; + m_changeParentNode.isDragging=false; + m_displayDom.appendChild(m_changeParentNode); + dragNDrop.activateForObject(m_changeParentNode); + dragNDrop.addSubscriber(changeParentNodeEventNotify,"endMoving"); + + var m_debugNode=document.createElement("span"); + if (g_debug) { + m_debugNode.appendChild(document.createTextNode("d")); + m_debugNode.style.position="absolute"; + m_debugNode.onclick=debugNodeClick; + m_displayDom.appendChild(m_debugNode); + } + + m_displayDom.mmClass=nodeClass; + m_displayDom.hide=hide; + m_displayDom.show=show; + + return(m_displayDom); + + + function freeLinkEventNotify(publisher,eventType,addInfo){ + if (("endMoving"==eventType) && (publisher==m_addFreeLink) && (addInfo != null)) { + var parentNode=nodeClass; + var childNode=addInfo; + if ( parentNode!=childNode) { + var newNodeRel=new nodeRel(dataTools.getNewPKey(),parentNode,childNode,"free"); + parentNode.addNodeRelation(newNodeRel); + childNode.addNodeRelation(newNodeRel); + childNode.redrawNodeRelations(); + } + hide(); + } + } + + function changeParentNodeEventNotify(publisher,eventType,addInfo){ + if (("endMoving"==eventType) && (publisher==m_changeParentNode) && (addInfo!=null)) { + var childNode=nodeClass; + var newParentNode=addInfo; + var mainNodeRel=childNode.getParentNodeRelation(); + if ( (newParentNode!=childNode) + && (!newParentNode.isChildNodeOf(childNode)) + && (newParentNode!=childNode.getParentNode()) ) { + if (mainNodeRel != null) { + var oldParentNode=mainNodeRel.getParentNode(); + oldParentNode.deleteNodeRelation(mainNodeRel); + childNode.deleteNodeRelation(mainNodeRel); + mainNodeRel.erase(); + } + var newNodeRel=new nodeRel(dataTools.getNewPKey(),newParentNode,childNode); + newParentNode.addNodeRelation(newNodeRel); + childNode.addNodeRelation(newNodeRel); + newNodeRel.redraw(); + } + hide(); + } + } + + function addNodeClick(event){ + event.stopPropagation(); + nodeClass.expand(true); + var child=new node(dataTools.getNewPKey(),"(enter text)"); + var originX=parseInt(nodeClass.style.top.split("px")[0]); + var originY=parseInt(nodeClass.style.left.split("px")[0]); + + child.style.top=(originX+50)+"px"; + child.style.left=(originY+50)+"px"; + + var parent=nodeClass; + + var newNodeRel=new nodeRel(dataTools.getNewPKey(),parent,child); + + parent.addNodeRelation(newNodeRel); + child.addNodeRelation(newNodeRel); + + child.redrawNodeRelations(); + } + + function eraseNodeClick(event){ + event.stopPropagation(); + nodeClass.erase(); + } + + function expandNodeClick(event){ + event.stopPropagation(); + nodeClass.expand(); + m_expandNode.hide(); + m_collapseNode.show(); + } + + function collapseNodeClick(event){ + event.stopPropagation(); + nodeClass.collapse(); + m_collapseNode.hide(); + m_expandNode.show(); + } + + function debugNodeClick(event){ + event.stopPropagation(); + alert( nodeClass.debugOut()); + } + + function handleCollapseExpand(){ + // Collapse + if ((!m_displayDom.parentNode.isLeafNode()) + && (!m_displayDom.parentNode.isCollapsed())) { + m_collapseNode.show(); + } else { + m_collapseNode.hide(); + } + // Expand + if ((!m_displayDom.parentNode.isLeafNode()) + && (m_displayDom.parentNode.isCollapsed())) { + m_expandNode.show(); + } else { + m_expandNode.hide(); + } + } + function show(){ + handleCollapseExpand(); + m_displayDom.style.display="block"; + m_displayDom.style.top=-1*(m_displayDom.offsetHeight) + "px"; + // -20 is for the round corners (takes 10 px each side) + m_displayDom.style.width=(nodeClass.offsetWidth-20) + "px"; + + //repaint FreeLink Control + m_addFreeLink.style.left=66; + m_addFreeLink.style.top=0; + + //reposition changeParent Control + m_changeParentNode.style.left=88; + m_changeParentNode.style.top=0; + + //reposition debug Control + m_debugNode.style.left=0; + m_debugNode.style.top=15; + } + function hide(){ + if ((!m_addFreeLink.isDragging) && (!m_changeParentNode.isDragging)) { + m_displayDom.style.display="none"; + } + } +} diff --git a/tutorial/exampleMap1.png b/tutorial/exampleMap1.png new file mode 100644 index 0000000..b5d25ab Binary files /dev/null and b/tutorial/exampleMap1.png differ diff --git a/tutorial/freeRelation1.png b/tutorial/freeRelation1.png new file mode 100644 index 0000000..c6b714c Binary files /dev/null and b/tutorial/freeRelation1.png differ diff --git a/tutorial/iconMenu1.png b/tutorial/iconMenu1.png new file mode 100644 index 0000000..de00b1c Binary files /dev/null and b/tutorial/iconMenu1.png differ diff --git a/tutorial/iconMenu2.png b/tutorial/iconMenu2.png new file mode 100644 index 0000000..6383f7b Binary files /dev/null and b/tutorial/iconMenu2.png differ diff --git a/tutorial/icons1.png b/tutorial/icons1.png new file mode 100644 index 0000000..cfdcbdf Binary files /dev/null and b/tutorial/icons1.png differ diff --git a/tutorial/index.html b/tutorial/index.html new file mode 100644 index 0000000..09c00d8 --- /dev/null +++ b/tutorial/index.html @@ -0,0 +1,27 @@ + +Webthink.net - Tutorial + + +

Example

+ +
With a mindmap you can structure information hierarchically. This is a good way to do capturel information during a brain-storming.
+ +

Players

+ + + + + + + + + +
NodeMindmaps consists of nodes which are joined by relations.
Parent-RelationA node can have either one or no parent relations.
Free-RelationThere can be as many free relation between nodes as you like.
Relation-MenuWhen clicking on relations a context menu is offered in order to delete the relation.
IconsNodes can carry icons.
Icon-MenuWhen clicking on a nodes Border then the Icon-selection pops up. Click the icons you want to add.
Icon-Context menuWhen clicking on a icon in a node, a context menu offers to delete the clicked icon.
ToolbarWhen hovering a node with the mouse a toolbar menu becomes visible. From here operations that are related to the node are accessible.
+ +

Basic operations

+ + +

Advanced operations

+ + + diff --git a/tutorial/node1.png b/tutorial/node1.png new file mode 100644 index 0000000..9416f77 Binary files /dev/null and b/tutorial/node1.png differ diff --git a/tutorial/node2.png b/tutorial/node2.png new file mode 100644 index 0000000..1bd6b26 Binary files /dev/null and b/tutorial/node2.png differ diff --git a/tutorial/parentRelation1.png b/tutorial/parentRelation1.png new file mode 100644 index 0000000..ce198bc Binary files /dev/null and b/tutorial/parentRelation1.png differ diff --git a/tutorial/relationMenu1.png b/tutorial/relationMenu1.png new file mode 100644 index 0000000..5bd2dc6 Binary files /dev/null and b/tutorial/relationMenu1.png differ diff --git a/tutorial/toolBar1.png b/tutorial/toolBar1.png new file mode 100644 index 0000000..1a04b16 Binary files /dev/null and b/tutorial/toolBar1.png differ diff --git a/uiTools.js b/uiTools.js new file mode 100644 index 0000000..96a9cb4 --- /dev/null +++ b/uiTools.js @@ -0,0 +1,20 @@ +document.getElementById("generalControls").appendChild(createWaitIcon()); +setBusyWait(); + +function createWaitIcon(){ + var imgNode=document.createElement("img"); + imgNode.setAttribute("src","pix/icnBusyWait.png"); + imgNode.id="icnBusyWait"; + imgNode.style.display="none"; + return(imgNode); +} + +function setBusyWait(){ + document.body.style.cursor="wait"; + document.getElementById("icnBusyWait").style.display="block"; +} + +function unsetBusyWait(){ + document.body.style.cursor=""; + document.getElementById("icnBusyWait").style.display="none"; +} diff --git a/webRequest.js b/webRequest.js new file mode 100644 index 0000000..4349146 --- /dev/null +++ b/webRequest.js @@ -0,0 +1,243 @@ +var g_filePKey=null; + +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;i0){ + createFreeRelations(theChild); + } + if (theChild.nodeName=="NODEREL"){ + 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=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)); +} diff --git a/workspaceResize.js b/workspaceResize.js new file mode 100644 index 0000000..957ca9d --- /dev/null +++ b/workspaceResize.js @@ -0,0 +1,78 @@ +const BOTTOMBORDER=100; +const RIGHTBORDER=300; +const LEFTBORDER=50; +const TOPBORDER=50; + +document.maxX=0; +document.maxY=0; +dragNDrop.addSubscriber(notifyObjectMove,"endMoving"); + + +function notifyObjectMove(publisher,eventType,addInfo){ + if (("endMoving"==eventType) && (addInfo != null)){ + var posX=parseInt(addInfo.style.left.split("px")[0]); + var posY=parseInt(addInfo.style.top.split("px")[0]); + + if (posYdocument.maxX) || ((posY+BOTTOMBORDER)>document.maxY)) { + document.maxX=posX+RIGHTBORDER; + document.maxY=posY+BOTTOMBORDER; + resizeWorkspace(); + } + } +} + +function moveAllNodes(axis,pixels){ + var allNodes=document.getElementById("nodes").childNodes; + for (var i=0;i