initial checkin from subversion
40
WebThinkTC.html
Normal file
@@ -0,0 +1,40 @@
|
||||
<html>
|
||||
<head><title>webthink.net disclaimer</title></head>
|
||||
<body>
|
||||
<pre>
|
||||
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.
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
11
addJavaScriptHash.sh
Normal file
@@ -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
|
||||
8
config.php.example
Normal file
@@ -0,0 +1,8 @@
|
||||
<?
|
||||
$conf_basePath="/home/pope/public_html/webthink/";
|
||||
$conf_mapPath=$conf_basePath . "/maps/";
|
||||
$conf_dbname=$conf_basePath . "WebThink.db";
|
||||
$conf_appName="WebThink";
|
||||
$conf_appURL="http://localhost/~pope/webthink/";
|
||||
$conf_mailAddress="webmaster@webthink.net";
|
||||
?>
|
||||
BIN
consyntools.jar
Normal file
83
dataTools.js
Normal file
@@ -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_allPairs.length;i++){
|
||||
var theKey,theValue;
|
||||
theKey=m_allPairs[i].split("=")[0];
|
||||
theValue=m_allPairs[i].split("=")[1];
|
||||
if (key==theKey) {
|
||||
return(theValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// setCookie and getCookie copied from w3schools
|
||||
function setCookie(c_name,value,expiredays)
|
||||
{
|
||||
var exdate=new Date();
|
||||
exdate.setDate(exdate.getDate()+expiredays);
|
||||
document.cookie=c_name+ "=" +escape(value)+
|
||||
((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
|
||||
}
|
||||
|
||||
function getCookie(c_name)
|
||||
{
|
||||
if (document.cookie.length>0)
|
||||
{
|
||||
c_start=document.cookie.indexOf(c_name + "=");
|
||||
if (c_start!=-1)
|
||||
{
|
||||
c_start=c_start + c_name.length+1;
|
||||
c_end=document.cookie.indexOf(";",c_start);
|
||||
if (c_end==-1) c_end=document.cookie.length;
|
||||
return unescape(document.cookie.substring(c_start,c_end));
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function imageDom(imgFile,altText,titleText){
|
||||
var imgNode=document.createElement("img");
|
||||
imgNode.setAttribute("src",imgFile);
|
||||
imgNode.setAttribute("alt",altText);
|
||||
imgNode.setAttribute("title",titleText);
|
||||
return(imgNode);
|
||||
}
|
||||
}
|
||||
|
||||
// Subscription-service for Document-Click
|
||||
document.extends(new Publisher);
|
||||
document.onclick=onDocumentClick;
|
||||
|
||||
function onDocumentClick(event){
|
||||
if ("HTML"==event.target.nodeName) {
|
||||
document.notifySubscribers(document,"clicked",null)
|
||||
}
|
||||
}
|
||||
29
deploy/deploy.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
rm -rf build
|
||||
mkdir build
|
||||
cd build
|
||||
svn export svn+ssh://pope@100gw/home/pope/svn-repository/webthink/trunk/
|
||||
cd *
|
||||
./obfuscate.sh
|
||||
./addJavaScriptHash.sh mainPage.php
|
||||
./addJavaScriptHash.sh login.php
|
||||
|
||||
rm -rf deploy/
|
||||
rm -rf sql/
|
||||
rm obfuscate.sh consyntools.jar
|
||||
rm *.txt
|
||||
|
||||
ssh webthink@87.230.12.219 "mkdir -p /var/www/vhosts/www.webthink.net"
|
||||
ssh webthink@87.230.12.219 "cd /var/www/vhosts/;mv www.webthink.net/config.php ~/;tar cjf ~/backup_$(date +%Y%m%d_%H%M%S).tar.bz2 www.webthink.net && rm -rf /var/www/vhosts/www.webthink.net/*; cp ~/config.php www.webthink.net"
|
||||
rsync -v -r -e "ssh -l webthink" * "87.230.12.219:/var/www/vhosts/www.webthink.net"
|
||||
ssh webthink@87.230.12.219 "chgrp -R www-data /var/www/vhosts/www.webthink.net; cd /var/www/vhosts/www.webthink.net; chmod 770 *.js *.html *.php *.css"
|
||||
|
||||
|
||||
cat << EOF
|
||||
Next Steps:
|
||||
===========
|
||||
|
||||
Create initial DB-Structure
|
||||
fill in initial data
|
||||
give www-data access to all files and folders
|
||||
|
||||
EOF
|
||||
96
dragNDrop.js
Normal file
@@ -0,0 +1,96 @@
|
||||
// global instance is created here.
|
||||
var dragNDrop=new mmDragHandler();
|
||||
dragNDrop.extends(new Publisher());
|
||||
|
||||
function mmDragHandler(){
|
||||
var m_dragObject;
|
||||
var m_offsetX;
|
||||
var m_offsetY;
|
||||
var m_isDragging=false;
|
||||
var m_zIndexSave;
|
||||
var m_lastSeenNode=null;
|
||||
var m_origX=null; // Position the mouse was pushed down.
|
||||
var m_origY=null;
|
||||
|
||||
document.onmousemove = onMouseMoveHandler;
|
||||
document.onmouseup = onMouseUpHandler;
|
||||
|
||||
this.onMouseDownHandler=onMouseDownHandler;
|
||||
this.onMouseMoveHandler=onMouseMoveHandler;
|
||||
this.onMouseUpHandler=onMouseUpHandler;
|
||||
this.activateForObject=activateForObject;
|
||||
|
||||
function activateForObject(ele) {
|
||||
ele.ondrag=function(){return false;};
|
||||
ele.onselectstart=function(){return false;};
|
||||
ele.onmousedown=onMouseDownHandler;
|
||||
// if nothing else is mentioned in the object position it in the middle of the visible area.
|
||||
if (ele.style.left=="") {
|
||||
ele.style.left=((window.innerWidth/2) + window.scrollX) + "px";
|
||||
}
|
||||
if (ele.style.top=="") {
|
||||
ele.style.top=((window.innerHeight/2) + window.scrollY) + "px";
|
||||
}
|
||||
ele.style.display="inline";
|
||||
this.notifySubscribers(ele,"activateDragNDrop");
|
||||
}
|
||||
|
||||
function onMouseDownHandler(e) {
|
||||
if (window.event) e=window.event;
|
||||
m_dragObject = e.target;
|
||||
|
||||
var dragX = parseInt(m_dragObject.style.left);
|
||||
var dragY = parseInt(m_dragObject.style.top);
|
||||
|
||||
var mouseX = e.clientX;
|
||||
var mouseY = e.clientY;
|
||||
|
||||
m_origX=mouseX;
|
||||
m_origY=mouseY;
|
||||
|
||||
m_offsetX = mouseX - dragX;
|
||||
m_offsetY = mouseY - dragY;
|
||||
|
||||
m_zIndexSave=m_dragObject.style.zIndex;
|
||||
m_dragObject.style.zIndex=5;
|
||||
|
||||
m_dragObject.isDragging=true;
|
||||
m_isDragging = true;
|
||||
|
||||
return(false);
|
||||
}
|
||||
|
||||
function onMouseMoveHandler(e){
|
||||
if (!m_isDragging) return;
|
||||
if (window.event) e=window.event;
|
||||
|
||||
if (e.target.id.substring(0,6)=="mmNode") {
|
||||
m_lastSeenNode=e.target;
|
||||
}
|
||||
|
||||
if ((m_origX!=e.clientX)||(m_origY!=e.clientY)) {
|
||||
dragNDrop.notifySubscribers(m_dragObject,"moving");
|
||||
}
|
||||
|
||||
var newX = e.clientX - m_offsetX;
|
||||
var newY = e.clientY - m_offsetY;
|
||||
|
||||
m_dragObject.style.left = newX + "px";
|
||||
m_dragObject.style.top = newY + "px";
|
||||
|
||||
var addInfo=new Array();
|
||||
addInfo[0]=newX;
|
||||
addInfo[1]=newY;
|
||||
|
||||
return(false);
|
||||
}
|
||||
|
||||
function onMouseUpHandler(e){
|
||||
if (!m_isDragging) return;
|
||||
m_dragObject.style.zIndex=m_zIndexSave;
|
||||
m_dragObject.isDragging=false;
|
||||
m_isDragging = false;
|
||||
dragNDrop.notifySubscribers(m_dragObject,"endMoving",m_lastSeenNode);
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
81
drawLine.js
Normal file
@@ -0,0 +1,81 @@
|
||||
function drawLine(fromX,fromY,toX,toY,style,pointsContainer){
|
||||
var m_diffX;
|
||||
var m_diffY;
|
||||
var pX;
|
||||
var pY;
|
||||
var pointCnt=0; // count the points in current line
|
||||
|
||||
if (toX < fromX) {
|
||||
m_diffX=fromX-toX;
|
||||
} else {
|
||||
m_diffX=toX-fromX;
|
||||
}
|
||||
|
||||
if (toY < fromY) {
|
||||
m_diffY=fromY-toY;
|
||||
} else {
|
||||
m_diffY=toY-fromY;
|
||||
}
|
||||
|
||||
if (m_diffX > 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
90
fileSelectorControl.js
Normal file
@@ -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<allFiles.length;i++) {
|
||||
var theFile=allFiles[i];
|
||||
var singleFileEle=document.createElement("li");
|
||||
singleFileEle.setAttribute("class","unselected");
|
||||
singleFileEle.setAttribute("filepkey",theFile.getAttribute("pkey"));
|
||||
singleFileEle.appendChild(theFile.firstChild);
|
||||
singleFileEle.onclick=onClickFile;
|
||||
singleFileEle.select=select;
|
||||
singleFileEle.unselect=unselect;
|
||||
fileList.appendChild(singleFileEle);
|
||||
}
|
||||
if (!m_fileList) {
|
||||
m_fileList=fileList;
|
||||
m_displayDom.appendChild(m_fileList);
|
||||
} else {
|
||||
m_fileList.parentNode.replaceChild(fileList,m_fileList);
|
||||
m_fileList=fileList;
|
||||
}
|
||||
}
|
||||
function addActionButtons(){
|
||||
var btnContainer=document.createElement("div");
|
||||
btnContainer.setAttribute("class","btnContainer");
|
||||
|
||||
var menuItems=new Array();
|
||||
menuItems[menuItems.length]=new textMenuItem("Load",onLoadClick);
|
||||
menuItems[menuItems.length]=new textMenuItem("Delete",onDeleteClick,"contextMenuItemRed");
|
||||
|
||||
btnContainer.appendChild(new menuControl(menuItems,0));
|
||||
|
||||
m_displayDom.appendChild(btnContainer);
|
||||
}
|
||||
function onClickFile() {
|
||||
if (m_selectedFile != null) {
|
||||
m_selectedFile.unselect();
|
||||
}
|
||||
this.select();
|
||||
}
|
||||
function unselect() {
|
||||
this.selected=false;
|
||||
this.setAttribute("class","unselected");
|
||||
m_selectedFile=null;
|
||||
}
|
||||
function select() {
|
||||
this.selected=true;
|
||||
this.setAttribute("class","selected");
|
||||
m_selectedFile=this;
|
||||
}
|
||||
function onDeleteClick() {
|
||||
if (m_selectedFile) {
|
||||
deleteMap(m_selectedFile.getAttribute("filePKey"));
|
||||
update(getFileList());
|
||||
}
|
||||
}
|
||||
function onLoadClick() {
|
||||
if (m_selectedFile) {
|
||||
loadMap(m_selectedFile.getAttribute("filepkey"));
|
||||
m_displayDom.parentNode.setFileDescription(m_selectedFile.firstChild.nodeValue);
|
||||
}
|
||||
}
|
||||
function hide() {
|
||||
m_displayDom.isVisible=false;
|
||||
m_displayDom.style.display="none";
|
||||
}
|
||||
function show() {
|
||||
m_displayDom.isVisible=true;
|
||||
m_displayDom.style.display="block";
|
||||
}
|
||||
}
|
||||
57
iconControl.js
Normal file
@@ -0,0 +1,57 @@
|
||||
function iconControl(){
|
||||
var m_domElement=document.createElement("span");
|
||||
m_domElement.setAttribute("class","iconContainer");
|
||||
|
||||
return(construct());
|
||||
|
||||
function construct(){
|
||||
m_domElement.addIcon=addIcon;
|
||||
m_domElement.fromXML=fromXML;
|
||||
m_domElement.toXML=toXML;
|
||||
return(m_domElement);
|
||||
}
|
||||
|
||||
function addIcon(iconName){
|
||||
var theIconNode=document.createElement("span");
|
||||
var theImageNode=document.createElement("img");
|
||||
theImageNode.setAttribute("src",iconName);
|
||||
theIconNode.appendChild(theImageNode);
|
||||
var mi=new Array();
|
||||
mi[0]=new textMenuItem("Delete",function(){deleteNode(theIconNode);});
|
||||
theIconNode.contextMenu=new menuControl(mi,1);
|
||||
theIconNode.contextMenu.hide();
|
||||
theIconNode.onclick=function(event) {
|
||||
theIconNode.contextMenu.toggleVisible();
|
||||
theIconNode.contextMenu.style.position="absolute";
|
||||
theIconNode.contextMenu.style.left=(5+theIconNode.offsetLeft) + "px";
|
||||
theIconNode.contextMenu.style.top=(5+theIconNode.offsetTop) + "px";
|
||||
|
||||
event.stopPropagation();
|
||||
}
|
||||
theIconNode.appendChild(theIconNode.contextMenu);
|
||||
document.addSubscriber(theIconNode.contextMenu.hide,"clicked");
|
||||
m_domElement.appendChild(theIconNode);
|
||||
}
|
||||
function deleteNode(theIconNode){
|
||||
theIconNode.parentNode.removeChild(theIconNode);
|
||||
}
|
||||
function fromXML(inXML){
|
||||
for(var i=0;i<inXML.childNodes.length;i++){
|
||||
var theIcon=inXML.childNodes[i];
|
||||
addIcon(theIcon.getAttribute("filename"));
|
||||
}
|
||||
return(construct());
|
||||
}
|
||||
function toXML(){
|
||||
var xmlEle=document.createElement("ICONS");
|
||||
var imageNodes=m_domElement.getElementsByTagName("img");
|
||||
for (var i=0;i<imageNodes.length;i++){
|
||||
var theImageNode=imageNodes[i];
|
||||
var singleIcon=document.createElement("ICON");
|
||||
singleIcon.setAttribute("filename",theImageNode.getAttribute("src"));
|
||||
xmlEle.appendChild(singleIcon);
|
||||
}
|
||||
return(xmlEle);
|
||||
}
|
||||
|
||||
}
|
||||
BIN
icons/arrowDown.png
Normal file
|
After Width: | Height: | Size: 866 B |
BIN
icons/arrowDownExclam.png
Normal file
|
After Width: | Height: | Size: 956 B |
BIN
icons/arrowLeft.png
Normal file
|
After Width: | Height: | Size: 874 B |
BIN
icons/arrowRight.png
Normal file
|
After Width: | Height: | Size: 998 B |
BIN
icons/arrowUp.png
Normal file
|
After Width: | Height: | Size: 588 B |
BIN
icons/arrowUpExclam.png
Normal file
|
After Width: | Height: | Size: 716 B |
BIN
icons/bulb.png
Normal file
|
After Width: | Height: | Size: 536 B |
BIN
icons/clock.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
icons/cross.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
icons/exclamationMark.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
icons/heart.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
icons/phone.png
Normal file
|
After Width: | Height: | Size: 750 B |
BIN
icons/questionSign.png
Normal file
|
After Width: | Height: | Size: 885 B |
BIN
icons/rose.png
Normal file
|
After Width: | Height: | Size: 353 B |
BIN
icons/smileyBad.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
icons/smileyGood.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
icons/smileyOh.png
Normal file
|
After Width: | Height: | Size: 1.0 KiB |
BIN
icons/smileysBase.xcf
Normal file
BIN
icons/thumbDown.png
Normal file
|
After Width: | Height: | Size: 323 B |
BIN
icons/thumbUp.png
Normal file
|
After Width: | Height: | Size: 333 B |
BIN
icons/tick.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
16
impressum.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>
|
||||
IMPRESSUM
|
||||
</title>
|
||||
<body>
|
||||
<b>IMPRESSUM:</b><br/>
|
||||
Regina Tretter<br/>
|
||||
31 Cole Cres<br/>
|
||||
Liberty Grove<br/>
|
||||
NSW 2138<br/>
|
||||
Australia<br/>
|
||||
<br/>
|
||||
<img src='pix/ginamail.jpg' />
|
||||
</body>
|
||||
</html>
|
||||
11
login.css
Normal file
@@ -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;
|
||||
}
|
||||
146
login.js
Normal file
@@ -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';
|
||||
}
|
||||
}
|
||||
}
|
||||
117
login.php
Normal file
@@ -0,0 +1,117 @@
|
||||
<html>
|
||||
<head>
|
||||
<META HTTP-EQUIV="expires" CONTENT="0">
|
||||
<title>WebThink Login</title>
|
||||
|
||||
<script src="observerHandling.js"></script>
|
||||
<script src="webRequest.js"></script>
|
||||
<script src="dataTools.js"></script>
|
||||
<script src="login.js"></script>
|
||||
|
||||
<LINK REL=stylesheet HREF="miscMain.css" TYPE="text/css">
|
||||
<LINK REL=stylesheet HREF="login.css" TYPE="text/css">
|
||||
</head>
|
||||
<body onload='init();'>
|
||||
<div style='position:absolute;left:0;top:0'><img src='pix/WebthinkLogoMedium.png' /></div>
|
||||
<div style='font-size:16;color:#0F0000' align='center'>
|
||||
<div style='width:70%;font-size:50px;background:#ab934b;color:#60a3cc'> - L O G I N -</div>
|
||||
<br/>At this stage only Firefox version 2 and 3 is supported!
|
||||
<br />
|
||||
<br />
|
||||
<br />
|
||||
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.<br/><br/>
|
||||
ALL INFORMATION YOU CAPTURE MIGHT BE LOST FOREVER!!!<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
<span style='color:#60a3cc'> If you want to have a look around without registering then you can log in with Email demo and Password demo. </span>
|
||||
<hr />
|
||||
</div>
|
||||
<div id='defaultLogin' align='center' style='display:none'>
|
||||
<table border='0'><tr>
|
||||
<th> Login </th>
|
||||
<td rowspan='2'><div style='background:#000000;width:2px;height:200px'></div></td>
|
||||
<th> Register </th>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
<td>
|
||||
<table border='0'>
|
||||
<tr><td>Email</td><td><input id='mail' value=''></td> </tr>
|
||||
<tr><td>Password</td><td><input id='password' type='password' value=''></td></tr>
|
||||
<tr><td>Autologin</td><td><input checked id='isAutoLogin' type='checkbox' value='0'></td></tr>
|
||||
<tr><td colspan='2'> </td></tr>
|
||||
</table>
|
||||
<br />
|
||||
<button style='width:100px' onclick='onClickLogin();'>Login</button>
|
||||
<div style='display:none'><button id='btnChangePassword' onclick='onClickChangePassword();'>Change Password</button></div>
|
||||
</td>
|
||||
|
||||
<td align='right'>
|
||||
<table border='0'>
|
||||
<tr><td>Email</td><td align='right'><input id='RegisterMail' value=''></td> </tr>
|
||||
<tr><td>Password</td><td align='right'><input id='RegisterPassword' type='password' value=''></td></tr>
|
||||
<tr><td>Password (repeat)</td><td align='right'><input id='RegisterPasswordRepeat' type='password' value=''></td></tr>
|
||||
<tr><td colspan='2'><input type=checkbox id='TcAgree' value='0'> I agree to the <a href='WebThinkTC.html' target='_blank'>Terms and Conditons</a>.</input></td></tr>
|
||||
</table>
|
||||
<br />
|
||||
<div align='right'><button style='width:100px' onclick='onClickRegister();'>Register</button></div>
|
||||
<div style='display:none'><button id='btnChangePassword' onclick='onClickChangePassword();'>Change Password</button></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr />
|
||||
</div>
|
||||
<div id='overridePassword' align='center' style='display:none'>
|
||||
<span style='color:#FF0000;font-size:26px;'>Change Password</span><br>
|
||||
Please enter your new Passowrd: <input id='newPassword' type='password'> <button onclick='updatePassword()'>Change Password</button><br>
|
||||
<hr />
|
||||
</div>
|
||||
<div id='autoLoginProgress' align='center' style='display:none'>
|
||||
<span style='color:#0000FF;font-size:26px;'>Automatically logging in...</span><br>
|
||||
<hr />
|
||||
</div>
|
||||
<div id='confirmMailPassword' align='center' style='display:none'>
|
||||
<span style='color:#FF0000;font-size:26px;'>Password mailed.</span><br>
|
||||
A Link to a site where you can reset your password was sent to the e-mail address you entered above.<br>
|
||||
<hr />
|
||||
</div>
|
||||
<div id='confirmOptinSuccess' align='center' style='display:none'>
|
||||
<span style='color:#FF0000;font-size:26px;'>Email address confirmed.</span><br>
|
||||
Your e-mail address is confirmed. You con login with your credentials now.<br>
|
||||
<hr />
|
||||
</div>
|
||||
<div id='optinSuccess' align='center' style='display:none'>
|
||||
<span style='color:#FF0000;font-size:26px;'>Email address confirmation request sent.</span><br>
|
||||
A mail was sent to the mail address you entered. Please confirm receipt by clicking the link in the mail.<br>
|
||||
After confirmation of your e-mail address you can log in.<br>
|
||||
<hr />
|
||||
</div>
|
||||
<div id='loginFailed' align='center' style='display:none'>
|
||||
<span style='color:#FF0000;font-size:26px;'>Login Failed.</span><br>
|
||||
If you don't have an account yet then please fill out the Register form and push the "Register" button above.<br><br>
|
||||
If you require your password to be mailed to you please push the button below.<br>
|
||||
<button onclick='onClickMailPassword()'>Mail Password</button>
|
||||
<hr />
|
||||
</div>
|
||||
<div align='center' style='font-size:10px'>
|
||||
<a style='color:#aaaaaa' target='_blank' href='WebThinkTC.html'>[Terms & Conditions]</a>
|
||||
<a style='color:#aaaaaa' href='impressum.html'>[Impressum]</a>
|
||||
<a style='color:#aaaaaa' href='mailto:webmaster@webthink.net'>[WebMaster]</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
error_reporting(0);
|
||||
include("config.php");
|
||||
$db=$GLOBALS['conf_dbname'];
|
||||
|
||||
try {
|
||||
$dh=new PDO("sqlite:".$db);
|
||||
$query="insert into referer (date,userIp,refererURL) values (datetime('now'),". $dh->quote($_SERVER['REMOTE_ADDR']) . ", " . $dh->quote($_SERVER['HTTP_REFERER']) .")";
|
||||
$dh->exec($query);
|
||||
$dh->close();
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
?>
|
||||
67
mainPage.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
session_start();
|
||||
include("config.php");
|
||||
if (!isset($_SESSION['UserPKey'])) {
|
||||
header( 'Location: ' . $conf_appURL );
|
||||
return(0);
|
||||
}
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<META HTTP-EQUIV="expires" CONTENT="0">
|
||||
<title>WebThink.net</title>
|
||||
|
||||
<LINK REL=stylesheet HREF="menuBar.css" TYPE="text/css">
|
||||
<LINK REL=stylesheet HREF="menu.css" TYPE="text/css">
|
||||
<LINK REL=stylesheet HREF="miscMain.css" TYPE="text/css">
|
||||
<LINK REL=stylesheet HREF="node.css" TYPE="text/css">
|
||||
<LINK REL=stylesheet HREF="nodeRel.css" TYPE="text/css">
|
||||
</head>
|
||||
<body id='body'>
|
||||
<div id='logoContainer' class='logoContainer'>WebThink.net</div>
|
||||
<div id='generalControls'></div>
|
||||
<div id='nodes'></div>
|
||||
<div id='nodeRels'></div>
|
||||
<div id='rightBottom' style='position:absolute;left:100;top:100'>.</div> <!-- regulates the page size. -->
|
||||
</body>
|
||||
|
||||
<script src="uiTools.js"></script>
|
||||
<script src="observerHandling.js"></script>
|
||||
<script src="dataTools.js"></script>
|
||||
<script src="dragNDrop.js"></script>
|
||||
<script src="workspaceResize.js"></script>
|
||||
<script src="drawLine.js"></script>
|
||||
<script src="webRequest.js"></script>
|
||||
<script src="toolbar.js"></script>
|
||||
<script src="fileSelectorControl.js"></script>
|
||||
<script src="menuBarControl.js"></script>
|
||||
<script src="menuControl.js"></script>
|
||||
<script src="textControl.js"></script>
|
||||
<script src="iconControl.js"></script>
|
||||
<script src="node.js"></script>
|
||||
<script src="nodeRel.js"></script>
|
||||
|
||||
<script language='JavaScript'>
|
||||
// set debug mode
|
||||
if ("true"==dataTools.urlArgs.getValueByKey("debug")) {
|
||||
var g_debug=true;
|
||||
}
|
||||
|
||||
// load Icon information
|
||||
var g_iconList=getIconList();
|
||||
document.getElementById("generalControls").appendChild(g_iconList);
|
||||
|
||||
// show menubar
|
||||
document.getElementById("generalControls").appendChild(new menuBarControl());
|
||||
|
||||
// create rootnode
|
||||
var rootNode=new Array();
|
||||
rootNode[0]=new node(dataTools.getNewPKey(),"(enter text)");
|
||||
|
||||
// show the borders
|
||||
drawBorders();
|
||||
|
||||
unsetBusyWait();
|
||||
</script>
|
||||
|
||||
</html>
|
||||
115
menu.css
Normal file
@@ -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;
|
||||
}
|
||||
67
menuBar.css
Normal file
@@ -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;
|
||||
}
|
||||
100
menuBarControl.js
Normal file
@@ -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";
|
||||
}
|
||||
}
|
||||
75
menuControl.js
Normal file
@@ -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<m_menuItems.length;i++){
|
||||
if ((0!=m_colCount) && ((i%m_colCount)==0)) {
|
||||
var tblRow=document.createElement("tr");
|
||||
btnTbl.appendChild(tblRow);
|
||||
}
|
||||
var tblDta=document.createElement("td");
|
||||
tblDta.appendChild(addMenuItem(m_menuItems[i]));
|
||||
tblRow.appendChild(tblDta);
|
||||
}
|
||||
m_domElement.appendChild(btnTbl);
|
||||
|
||||
return(m_domElement);
|
||||
}
|
||||
function addMenuItem(menuItem) {
|
||||
var theItem=document.createElement("div");
|
||||
theItem.setAttribute("class",menuItem.styleClass?menuItem.styleClass:"contextMenuItem");
|
||||
theItem.onclick=menuItem.clickAction;
|
||||
theItem.appendChild(menuItem.node);
|
||||
return(theItem);
|
||||
}
|
||||
function toggleVisible() {
|
||||
if (m_domElement.isVisible) {
|
||||
hide();
|
||||
} else {
|
||||
show();
|
||||
}
|
||||
}
|
||||
function hide() {
|
||||
m_domElement.isVisible=false;
|
||||
m_domElement.style.display="none";
|
||||
}
|
||||
function show() {
|
||||
m_domElement.isVisible=true;
|
||||
m_domElement.style.display="block";
|
||||
}
|
||||
}
|
||||
function pictureMenuItem(image,title,clickAction,styleClass){
|
||||
this.node=document.createElement("span");
|
||||
var imgNode=document.createElement("img");
|
||||
imgNode.setAttribute("src",image);
|
||||
imgNode.setAttribute("title",title);
|
||||
this.node.appendChild(imgNode);
|
||||
this.clickAction=clickAction;
|
||||
this.styleClass=styleClass;
|
||||
}
|
||||
function textMenuItem(text,clickAction,styleClass){
|
||||
this.node=document.createElement("span");
|
||||
this.node.appendChild(document.createTextNode(text));
|
||||
this.clickAction=clickAction;
|
||||
this.styleClass=styleClass;
|
||||
}
|
||||
function menuItem(node,clickAction,styleClass){
|
||||
this.node=node;
|
||||
this.clickAction=clickAction;
|
||||
this.styleClass=styleClass;
|
||||
}
|
||||
51
miscMain.css
Normal file
@@ -0,0 +1,51 @@
|
||||
body {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
background: #ffffff;
|
||||
|
||||
}
|
||||
|
||||
input, select, button {
|
||||
border: 1px #000000 solid;
|
||||
background: #FFFFFF;
|
||||
color: #000000;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 11px;
|
||||
margin-top: 0px;
|
||||
margin-right: 0px;
|
||||
margin-bottom: 0px;
|
||||
margin-left: 0px;
|
||||
padding-top: 1px;
|
||||
padding-right: 0px;
|
||||
padding-bottom: 2px;
|
||||
padding-left: 2px;
|
||||
height: 18px
|
||||
}
|
||||
button:hover {
|
||||
background: #37add4;
|
||||
}
|
||||
|
||||
hr {
|
||||
width:60%;
|
||||
}
|
||||
div.horizTopBorder {
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
width:100%;
|
||||
background:#eeeeee;
|
||||
}
|
||||
div.vertLeftBorder {
|
||||
position:absolute;
|
||||
top:0;
|
||||
left:0;
|
||||
height:100%;
|
||||
background:#eeeeee;
|
||||
}
|
||||
span.link {
|
||||
color:#0000FF;
|
||||
text-decoration:underline;
|
||||
cursor:pointer;
|
||||
}
|
||||
th {
|
||||
text-align:left
|
||||
}
|
||||
54
node.css
Normal file
@@ -0,0 +1,54 @@
|
||||
span.collapsedNode {
|
||||
border: 2px #F7D56D solid;
|
||||
-moz-border-radius-bottomleft:10px;
|
||||
-moz-border-radius-bottomright:10px;
|
||||
-moz-border-radius-topleft:10px;
|
||||
-moz-border-radius-topright:10px;
|
||||
background:#a41e2a;
|
||||
font-size:13px;
|
||||
padding:10px;
|
||||
position:absolute;
|
||||
left:100px;
|
||||
top:100px;
|
||||
min-width:50px;
|
||||
display:block;
|
||||
z-index:50;
|
||||
cursor:move;
|
||||
}
|
||||
span.node {
|
||||
-moz-border-radius-bottomleft:10px;
|
||||
-moz-border-radius-bottomright:10px;
|
||||
-moz-border-radius-topleft:10px;
|
||||
-moz-border-radius-topright:10px;
|
||||
background:#a41e2a;
|
||||
font-size:13px;
|
||||
padding:10px;
|
||||
position:absolute;
|
||||
left:100px;
|
||||
top:100px;
|
||||
min-width:50px;
|
||||
display:block;
|
||||
z-index:50;
|
||||
cursor:move;
|
||||
}
|
||||
|
||||
span.boxToolbar {
|
||||
-moz-border-radius-topleft:5px;
|
||||
-moz-border-radius-topright:5px;
|
||||
background:#BEF76D;
|
||||
color:#000000;
|
||||
min-width:120;
|
||||
position:absolute;
|
||||
z-index:50;
|
||||
opacity:0.7;
|
||||
cursor:pointer;
|
||||
}
|
||||
|
||||
span.boxText {
|
||||
white-space:pre;
|
||||
width:100%;
|
||||
background:#eeeeee;
|
||||
}
|
||||
span.iconContainer {
|
||||
cursor:default;
|
||||
}
|
||||
348
node.js
Normal file
@@ -0,0 +1,348 @@
|
||||
function node(PKey,nodeText) {
|
||||
// private vars
|
||||
var m_PKey=PKey;
|
||||
var m_displayDom=document.createElement("span");
|
||||
var m_nodeRelations=new Array();
|
||||
var m_toolbar=null;
|
||||
var m_textControl=null;
|
||||
var m_iconControl=null;
|
||||
var m_contextMenu=null;
|
||||
var m_isCollapsed=false;
|
||||
|
||||
if (arguments.length >= 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<g_iconList.childNodes.length;i++) {
|
||||
var iconName=g_iconList.childNodes[i].getAttribute("filename");
|
||||
var iconTitle=g_iconList.childNodes[i].getAttribute("description");
|
||||
mi[mi.length]=new pictureMenuItem("icons/" + iconName ,iconTitle,onAddIconClick,"nodeIconMenuItem");
|
||||
}
|
||||
//mi[mi.length]=new textMenuItem("Close",contextMenu.hide,"nodeContextMenuItem");
|
||||
contextMenu=new menuControl(mi,5);
|
||||
contextMenu.setAttribute("class","nodeContextMenu");
|
||||
contextMenu.hide();
|
||||
document.addSubscriber(contextMenu.hide,"clicked");
|
||||
|
||||
m_displayDom.onmousedown=function(event) {contextMenuOpenAction(event);dragNDrop.onMouseDownHandler(event);}
|
||||
dragNDrop.addSubscriber(contextMenu.hide,"moving");
|
||||
function contextMenuOpenAction(event){
|
||||
if (event.target==m_displayDom) {
|
||||
contextMenu.toggleVisible();
|
||||
contextMenu.style.position="absolute";
|
||||
contextMenu.style.left=(event.clientX+window.scrollX-m_displayDom.style.left.split("px")[0]) + "px";
|
||||
contextMenu.style.top=(event.clientY+window.scrollY-m_displayDom.style.top.split("px")[0]) + "px";
|
||||
}
|
||||
}
|
||||
|
||||
function onAddIconClick(event){
|
||||
m_iconControl.addIcon(event.target.getAttribute("src"));
|
||||
}
|
||||
return(contextMenu);
|
||||
}
|
||||
|
||||
function exportFunctions(){
|
||||
m_displayDom.debugOut=debugOut;
|
||||
m_displayDom.addNodeRelation=addNodeRelation;
|
||||
m_displayDom.deleteNodeRelation=deleteNodeRelation;
|
||||
m_displayDom.getPKey=getPKey;
|
||||
m_displayDom.getNodeRelations=getNodeRelations;
|
||||
m_displayDom.redrawNodeRelations=redrawNodeRelations;
|
||||
m_displayDom.hide=hide;
|
||||
m_displayDom.show=show;
|
||||
m_displayDom.collapse=collapse;
|
||||
m_displayDom.expand=expand;
|
||||
m_displayDom.erase=erase;
|
||||
m_displayDom.isCollapsed=isCollapsed;
|
||||
m_displayDom.isLeafNode=isLeafNode;
|
||||
m_displayDom.getParentNode=getParentNode;
|
||||
m_displayDom.getParentNodeRelation=getParentNodeRelation;
|
||||
m_displayDom.isChildNodeOf=isChildNodeOf;
|
||||
m_displayDom.isRootNode=isRootNode;
|
||||
|
||||
m_displayDom.toXML=toXML;
|
||||
m_displayDom.fromXML=fromXML;
|
||||
}
|
||||
function notifyTextUpdate(publisher,eventType){
|
||||
redrawNodeRelations();
|
||||
}
|
||||
function mouseUpHandler(){
|
||||
redrawNodeRelations();
|
||||
}
|
||||
function mouseOverHandler(){
|
||||
m_displayDom.notifySubscribers(m_displayDom,"mouseOver");
|
||||
m_toolbar.show();
|
||||
}
|
||||
function mouseOutHandler(){
|
||||
m_displayDom.notifySubscribers(m_displayDom,"mouseOut");
|
||||
m_toolbar.hide();
|
||||
}
|
||||
function isCollapsed(){
|
||||
return(m_isCollapsed);
|
||||
}
|
||||
function getParentNodeRelation(){
|
||||
for (var i=0;i < m_nodeRelations.length;i++) {
|
||||
if ((m_nodeRelations[i].getChildNode()==m_displayDom) && (m_nodeRelations[i].isMain())){
|
||||
return(m_nodeRelations[i]);
|
||||
}
|
||||
}
|
||||
return(null);
|
||||
}
|
||||
function getParentNode(){
|
||||
var parentNode=getParentNodeRelation();
|
||||
if (parentNode) {
|
||||
return(parentNode.getParentNode());
|
||||
} else {
|
||||
return(null);
|
||||
}
|
||||
}
|
||||
function isChildNodeOf(testNode){
|
||||
var parentNode=getParentNode();
|
||||
if (parentNode){
|
||||
if (parentNode==testNode) {
|
||||
return(true);
|
||||
} else {
|
||||
return(parentNode.isChildNodeOf(testNode));
|
||||
}
|
||||
} else {
|
||||
// hit rootnode
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
function isLeafNode(){
|
||||
for (var i=0;i < m_nodeRelations.length;i++) {
|
||||
if (m_nodeRelations[i].getParentNode()==m_displayDom){
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
return(true);
|
||||
}
|
||||
function expand(isNonRecursive){
|
||||
m_isCollapsed=false;
|
||||
m_displayDom.setAttribute("class","node");
|
||||
for (var i=0;i < m_nodeRelations.length;i++) {
|
||||
if ((m_nodeRelations[i].isMain())
|
||||
&& (m_nodeRelations[i].getParentNode()==m_displayDom)){
|
||||
if (!isNonRecursive) { m_nodeRelations[i].getChildNode().expand(isNonRecursive); }
|
||||
m_nodeRelations[i].getChildNode().show();
|
||||
}
|
||||
}
|
||||
}
|
||||
function erase(){
|
||||
// first delete all free relations
|
||||
for (var i=m_nodeRelations.length-1;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<m_nodeRelations.length;i++) {
|
||||
if (m_nodeRelations[i]==nodeRel) {
|
||||
m_nodeRelations.splice(i,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
function hasNodeRelation(nodeRel) {
|
||||
for (var i=0;i<m_nodeRelations.length;i++) {
|
||||
if (m_nodeRelations[i]==nodeRel) {
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
function debugOut() {
|
||||
var output=("PKey: _"+ m_PKey + "_");
|
||||
output=output + "\nRootNode: " + isRootNode();
|
||||
output=output + "\nLeafNode: " + isLeafNode();
|
||||
output=output + "\nNodeText: " + m_textControl.getText();
|
||||
output=output + "\nisCollapsed: " + m_isCollapsed;
|
||||
output=output + "\nNodeRelations:";
|
||||
for (i=0;i < m_nodeRelations.length;i++) {
|
||||
output=output + m_nodeRelations[i].debugOut();
|
||||
}
|
||||
return(output);
|
||||
}
|
||||
|
||||
function redrawNodeRelations(){
|
||||
var rels=getNodeRelations();
|
||||
var i;
|
||||
for (i=0;i<rels.length;i++) {
|
||||
rels[i].redraw();
|
||||
}
|
||||
}
|
||||
|
||||
function toXML(){
|
||||
var xmlEle=document.createElement("NODE");
|
||||
xmlEle.setAttribute("pkey",m_PKey);
|
||||
xmlEle.setAttribute("offsetleft",m_displayDom.style.left.split("px")[0]);
|
||||
xmlEle.setAttribute("offsettop",m_displayDom.style.top.split("px")[0]);
|
||||
xmlEle.setAttribute("iscollapsed",m_displayDom.isCollapsed());
|
||||
xmlEle.appendChild(m_textControl.toXML());
|
||||
xmlEle.appendChild(m_iconControl.toXML());
|
||||
|
||||
var rels=getNodeRelations();
|
||||
|
||||
for (var i=0;i<rels.length;i++){
|
||||
if (rels[i].getParentNode()==m_displayDom){
|
||||
xmlEle.appendChild(rels[i].toXML());
|
||||
}
|
||||
}
|
||||
|
||||
return(xmlEle);
|
||||
}
|
||||
|
||||
function fromXML(inXML){
|
||||
if (inXML.nodeName=="NODE") {
|
||||
m_PKey=inXML.getAttribute("pkey");
|
||||
m_displayDom.style.left=inXML.getAttribute("offsetleft")+"px";
|
||||
m_displayDom.style.top=inXML.getAttribute("offsettop")+"px";
|
||||
m_isCollapsed=inXML.getAttribute("iscollapsed")=="true";
|
||||
var freeRelations = new Array();
|
||||
for (var i=0;i<inXML.childNodes.length;i++){
|
||||
var theChildNode=inXML.childNodes[i];
|
||||
switch(theChildNode.nodeName){
|
||||
case "ICONS":
|
||||
m_iconControl=new iconControl().fromXML(theChildNode);
|
||||
break;
|
||||
case "TEXTCONTROL":
|
||||
m_textControl=new textControl().fromXML(theChildNode);
|
||||
break;
|
||||
case "NODEREL":
|
||||
construct();
|
||||
// only main relations handled here
|
||||
if (theChildNode.getAttribute("relationtype") == "main") {
|
||||
var newNodeRel=new nodeRel().fromXML(theChildNode);
|
||||
addNodeRelation(newNodeRel);
|
||||
newNodeRel.redraw();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return(construct());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
14
nodeRel.css
Normal file
@@ -0,0 +1,14 @@
|
||||
div.defaultPoint {
|
||||
position:absolute;
|
||||
background:#F7D56D;
|
||||
width:3px;
|
||||
height:3px;
|
||||
z-index:0;
|
||||
}
|
||||
div.freePoint {
|
||||
position:absolute;
|
||||
background:#cccccc;
|
||||
width:2px;
|
||||
height:2px;
|
||||
z-index:0;
|
||||
}
|
||||
163
nodeRel.js
Normal file
@@ -0,0 +1,163 @@
|
||||
function nodeRel(PKey, parentNode, childNode, relationType) {
|
||||
// private vars
|
||||
var m_PKey=PKey;
|
||||
var m_parentNode=parentNode;
|
||||
var m_childNode=childNode;
|
||||
var m_displayDom=document.createElement("div");
|
||||
var m_pointsContainer=null; // this is required for deletion, to delete all points one after the other didn't work.
|
||||
var m_relationType=(relationType==null)?"main":relationType;
|
||||
var m_parentX=0;
|
||||
var m_parentY=0;
|
||||
var m_childX=0;
|
||||
var m_childY=0;
|
||||
var m_styleClass="defaultPoint";
|
||||
var m_contextMenu=null;
|
||||
|
||||
// properties
|
||||
function getPKey() { return(m_PKey); }
|
||||
function getParentNode() { return(m_parentNode); }
|
||||
function setParentNode(nodeObject) { m_parentNode=nodeObject; }
|
||||
function getChildNode() { return(m_childNode); }
|
||||
function setChildNode(nodeObject) { m_childNode=nodeObject; }
|
||||
function getRelationType() { return(m_relationType); }
|
||||
function isMain() { return(m_relationType=="main"); }
|
||||
|
||||
if (arguments.length >= 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());
|
||||
}
|
||||
}
|
||||
|
||||
5
obfuscate.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
set -e
|
||||
set -x
|
||||
ls *.js | while read i;
|
||||
do java -jar consyntools.jar Obfuscator "${i}" "${i}"
|
||||
done
|
||||
36
observerHandling.js
Normal file
@@ -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<m_subscribers.length;i++){
|
||||
if((m_subscribers[i][0]==subscriber)
|
||||
&&(m_subscribers[i][1]==eventType)){
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
var entryDetails=new Array();
|
||||
entryDetails[0]=subscriber;
|
||||
entryDetails[1]=eventType;
|
||||
m_subscribers[m_subscribers.length]=entryDetails;
|
||||
return(true);
|
||||
}
|
||||
function removeSubscriber(subscriber,eventType){
|
||||
for(var i=0;i<m_subscribers.length;i++){
|
||||
if((m_subscribers[i][0]==subscriber)
|
||||
&&(m_subscribers[i][1]==eventType)){
|
||||
m_subscribers.splice(i,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
function notifySubscribers(publisher,eventType,addInfo){
|
||||
for(var i=0;i<m_subscribers.length;i++){
|
||||
if(m_subscribers[i][1]==eventType){
|
||||
m_subscribers[i][0](publisher,eventType,addInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
pix/WebthinkLogo.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
pix/WebthinkLogoMedium.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
pix/ginamail.jpg
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
pix/icnArrowDown.png
Normal file
|
After Width: | Height: | Size: 866 B |
BIN
pix/icnArrowUp.png
Normal file
|
After Width: | Height: | Size: 588 B |
BIN
pix/icnBusyWait.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
pix/icnMoveBranch.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
pix/icnNewBranch.png
Normal file
|
After Width: | Height: | Size: 703 B |
BIN
pix/icnStar.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
pix/icnWaste.png
Normal file
|
After Width: | Height: | Size: 885 B |
53
profile.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<html>
|
||||
<head>
|
||||
<META HTTP-EQUIV="expires" CONTENT="0">
|
||||
<title>WebThink Edit UserProfile</title>
|
||||
|
||||
<script src="observerHandling.js"></script>
|
||||
<script src="webRequest.js"></script>
|
||||
<script src="dataTools.js"></script>
|
||||
|
||||
<LINK REL=stylesheet HREF="miscMain.css" TYPE="text/css">
|
||||
<LINK REL=stylesheet HREF="login.css" TYPE="text/css">
|
||||
</head>
|
||||
<body onload='init();'>
|
||||
<div align='center'>
|
||||
<!--div style='font-size:30px' align='center'> P <span style='color:#00FF00'>R</span> <span style='color:#0000FF'>O</span> <span style='color:#FF0000'>F</span> <span style='color:#00FFFF'>I</span> <span style='color:#aaaaaa'>L</span> <span style='color:#FFFF00'>E</span> </div-->
|
||||
<div style='width:70%;font-size:50px;background:#ab934b;color:#60a3cc'> - P R O F I L E -</div>
|
||||
<br />
|
||||
<table border='0'>
|
||||
<tr><th>Name</th><td><input id='name'></td><td><i>Display-name</i></td></tr>
|
||||
<tr><th>Mail-Address</th><td><input id='mail'></td><td><i>Mail-Address</i></td></tr>
|
||||
<tr><th>Password</th><td><input id='password' type='password' value=''></td><td rowspan='2'><i>Enter your new password twice.</i></td></tr>
|
||||
<tr><th>Repeat</th><td><input id='passwordconfirm' type='password' value=''></td></tr>
|
||||
<tr><td colspan='3'><br /></td></tr>
|
||||
<tr><td></td><td colspan='2' align='left'> <button onclick='onSubmitClick();'>Submit</button> <button onclick='onCancelClick();'>Cancel</button> </td></tr>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<script language='JavaScript'>
|
||||
function init(){
|
||||
document.getElementById("name").value=getUserInfo("name");
|
||||
document.getElementById("mail").value=getUserInfo("mail");
|
||||
}
|
||||
function onSubmitClick(){
|
||||
var name=document.getElementById("name").value;
|
||||
var mail=document.getElementById("mail").value;
|
||||
var password=document.getElementById("password").value;
|
||||
var passConfirm=document.getElementById("passwordconfirm").value;
|
||||
|
||||
if ((password != "") && (password != passConfirm)) {
|
||||
alert("The passwords don't match");
|
||||
} else {
|
||||
if (updateUserProfile(name,mail,password)) {
|
||||
window.opener.document.getElementById("userName").setText(name);
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
function onCancelClick(){
|
||||
window.close();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
493
requestTarget.php
Normal file
@@ -0,0 +1,493 @@
|
||||
<?
|
||||
error_reporting(0);
|
||||
#error_reporting('E_ALL');
|
||||
|
||||
session_start();
|
||||
header('Content-type: text/xml');
|
||||
|
||||
include("config.php");
|
||||
|
||||
$db=$GLOBALS['conf_dbname'];
|
||||
$basePath=$GLOBALS['conf_basePath'];
|
||||
$mapPath=$GLOBALS['conf_mapPath'];
|
||||
|
||||
function myMail($to,$subject,$message){
|
||||
$fromAddr=$GLOBALS['conf_mailAddress'];
|
||||
$headers = 'From: <' . $fromAddr . ">\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("<x success='true' />");
|
||||
}
|
||||
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 ("<x success='true' filepkey='" . $fileInfo["PKey"] . "'/>");
|
||||
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());
|
||||
}
|
||||
|
||||
?>
|
||||
11
sql/createDB.sql
Normal file
@@ -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);
|
||||
5
sql/exportSchema.sh
Normal file
@@ -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
|
||||
24
sql/prepareIcon.sql
Normal file
@@ -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;
|
||||
2
sql/preparePKey.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
insert into pkey values (10000);
|
||||
|
||||
288
textControl.js
Normal file
@@ -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());
|
||||
}
|
||||
}
|
||||
16
todoList.txt
Normal file
@@ -0,0 +1,16 @@
|
||||
Icons in Nodes (standard)
|
||||
Proper Error Handling (PHP/JAVASCRIPT) (Error message translations)
|
||||
Terms and Conditions
|
||||
(MSIE support)
|
||||
Documentation
|
||||
------------<P2>----------------------
|
||||
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
|
||||
178
toolbar.js
Normal file
@@ -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";
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
tutorial/exampleMap1.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
tutorial/freeRelation1.png
Normal file
|
After Width: | Height: | Size: 294 B |
BIN
tutorial/iconMenu1.png
Normal file
|
After Width: | Height: | Size: 9.9 KiB |
BIN
tutorial/iconMenu2.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
tutorial/icons1.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
27
tutorial/index.html
Normal file
@@ -0,0 +1,27 @@
|
||||
<html>
|
||||
<head><title>Webthink.net - Tutorial</title></head>
|
||||
<body>
|
||||
|
||||
<h1>Example</h1>
|
||||
<img src='exampleMap1.png'>
|
||||
<div class='explain'>With a mindmap you can structure information hierarchically. This is a good way to do capturel information during a brain-storming.</div>
|
||||
|
||||
<h1>Players</h1>
|
||||
<table border='1'>
|
||||
<tr><td><img src='node1.png'><img src='node2.png'></td><td>Node</td><td>Mindmaps consists of nodes which are joined by relations.</td></tr>
|
||||
<tr><td><img src='parentRelation1.png'></td><td>Parent-Relation</td><td>A node can have either one or no parent relations.</td></tr>
|
||||
<tr><td><img src='freeRelation1.png'></td><td>Free-Relation</td><td>There can be as many free relation between nodes as you like.</td></tr>
|
||||
<tr><td><img src='relationMenu1.png'></td><td>Relation-Menu</td><td>When clicking on relations a context menu is offered in order to delete the relation.</td></tr>
|
||||
<tr><td><img src='icons1.png'></td><td>Icons</td><td>Nodes can carry icons.</td></tr>
|
||||
<tr><td><img src='iconMenu1.png'></td><td>Icon-Menu</td><td>When clicking on a nodes Border then the Icon-selection pops up. Click the icons you want to add.</td></tr>
|
||||
<tr><td><img src='iconMenu2.png'></td><td>Icon-Context menu</td><td>When clicking on a icon in a node, a context menu offers to delete the clicked icon.</td></tr>
|
||||
<tr><td><img src='toolBar1.png'></td><td>Toolbar</td><td>When hovering a node with the mouse a toolbar menu becomes visible. From here operations that are related to the node are accessible.</td></tr>
|
||||
</table>
|
||||
|
||||
<h1>Basic operations</h1>
|
||||
|
||||
|
||||
<h1>Advanced operations</h1>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
BIN
tutorial/node1.png
Normal file
|
After Width: | Height: | Size: 716 B |
BIN
tutorial/node2.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
tutorial/parentRelation1.png
Normal file
|
After Width: | Height: | Size: 299 B |
BIN
tutorial/relationMenu1.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
tutorial/toolBar1.png
Normal file
|
After Width: | Height: | Size: 3.3 KiB |
20
uiTools.js
Normal file
@@ -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";
|
||||
}
|
||||
243
webRequest.js
Normal file
@@ -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;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);
|
||||
}
|
||||
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<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));
|
||||
}
|
||||
78
workspaceResize.js
Normal file
@@ -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 (posY<TOPBORDER){
|
||||
moveAllNodes("vert",TOPBORDER);
|
||||
}
|
||||
if (posX<LEFTBORDER){
|
||||
moveAllNodes("horiz",LEFTBORDER);
|
||||
}
|
||||
|
||||
if (((posX+RIGHTBORDER)>document.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<allNodes.length;i++){
|
||||
var theNode=allNodes[i];
|
||||
if (axis=="horiz"){
|
||||
theNode.style.left=(parseInt(theNode.style.left.split("px")[0])+pixels)+"px";
|
||||
} else {
|
||||
theNode.style.top=(parseInt(theNode.style.top.split("px")[0])+pixels)+"px";
|
||||
}
|
||||
theNode.redrawNodeRelations();
|
||||
}
|
||||
}
|
||||
|
||||
function resizeWorkspace(){
|
||||
var rightBottom=document.getElementById("rightBottom");
|
||||
rightBottom.style.left=document.maxX + "px";
|
||||
rightBottom.style.top=document.maxY + "px";
|
||||
}
|
||||
|
||||
function autoRepositionNodes(){
|
||||
var minLeft=99999;
|
||||
var minTop=99999;
|
||||
|
||||
var allNodes=document.getElementById("nodes").childNodes;
|
||||
for (var i=0;i<allNodes.length;i++){
|
||||
var theNode=allNodes[i];
|
||||
var currTop=parseInt(theNode.style.top.split("px")[0]);
|
||||
var currLeft=parseInt(theNode.style.left.split("px")[0]);
|
||||
|
||||
if (currTop < minTop) { minTop=currTop; }
|
||||
if (currLeft < minLeft) { minLeft=currLeft; }
|
||||
}
|
||||
|
||||
moveAllNodes("horiz",(minLeft*-1)+LEFTBORDER);
|
||||
moveAllNodes("vert",(minTop*-1)+TOPBORDER);
|
||||
}
|
||||
|
||||
function drawBorders(){
|
||||
var horizTopBorder=document.createElement("div");
|
||||
horizTopBorder.setAttribute("class","horizTopBorder");
|
||||
document.getElementById("generalControls").appendChild(horizTopBorder);
|
||||
horizTopBorder.style.height=TOPBORDER + "px";
|
||||
|
||||
var vertLeftBorder=document.createElement("div");
|
||||
vertLeftBorder.setAttribute("class","vertLeftBorder");
|
||||
document.getElementById("generalControls").appendChild(vertLeftBorder);
|
||||
vertLeftBorder.style.width=LEFTBORDER + "px";
|
||||
}
|
||||