From ef68436ac04da078ffdcacd7e1f785473a303d45 Mon Sep 17 00:00:00 2001 From: Giulio Cesare Solaroli Date: Sun, 02 Oct 2011 23:56:18 +0000 Subject: First version of the newly restructured repository --- (limited to 'backend/php/src/setup/setup_library/xPandMenu.js') diff --git a/backend/php/src/setup/setup_library/xPandMenu.js b/backend/php/src/setup/setup_library/xPandMenu.js new file mode 100644 index 0000000..7f9a632 --- a/dev/null +++ b/backend/php/src/setup/setup_library/xPandMenu.js @@ -0,0 +1,273 @@ +/******************************** +* xPandMenu MULTI-LEVEL class +********************************* +* Javascript file +********************************* +* Patrick Brosset +* patrickbrosset@gmail.com +********************************* +* 02/2005 +*********************************/ + + +// Show / hide a sub-menu +function xMenuShowHide(obj) +{ + + if(obj.style.display == 'none'){ + obj.style.display = 'block'; + }else{ + obj.style.display = 'none'; + } + +} + + +// Toggle expanded / collapsed versions of items' images +function xSwapImg(imgDiv,srcImg,srcAltImg){ + + /* Update by Christian Vallee + ==> No need to specify absolute URL for images anymore, this feature will find it on its own */ + + // looking for the images' root URL based on the current image + var str = imgDiv.src; + var pos = str.search(srcImg); + // if the URL root wasn't found using the first image, try with the alternative one + if ( pos == -1 ) { pos = str.search(srcAltImg); } + // extracting the URL root + var root = str.substring(0,pos); + // adding the root the image path supplied + srcImg = root.concat(srcImg); + srcAltImg = root.concat(srcAltImg); + + /* End Update */ + + if(imgDiv.src == srcImg){ + imgDiv.src = srcAltImg; + }else{ + imgDiv.src = srcImg; + } + +} + + +// Restore the menu state when the page loads +function xRestoreState() +{ + //restore list state + var name = "xMenuState"; + var start = document.cookie.indexOf(name+"="); + if(start != -1) + { + var len = start+name.length+1; + if ((!start) && (name != document.cookie.substring(0,name.length))) return null; + if (start == -1) return null; + var end = document.cookie.indexOf(";",len); + if (end == -1) end = document.cookie.length; + var value = unescape(document.cookie.substring(len,end)); + var values = value.split("|"); + for(i=0;i>"); + var imgs = couple[1].split(","); + for(var il in imgs) + { + document.getElementById(imgs[il]).src = couple[0]; + } + } + } +} + +//Get the ids of all open nodes +function getOpenNodes() +{ + value = new Array(); + var myLists = document.getElementsByTagName("UL"); + for(i=0;i>" + value[imgPath] + "[]"; + } + var cook = str.substring(0,str.length-2); + document.cookie = "xMenuStateImg=" + escape(cook) + ";"; +} + +function createRequestObject() +{ + var ro; + if (window.XMLHttpRequest) + { + ro = new XMLHttpRequest(); + } + else + { + ro = new ActiveXObject('MSXML2.XMLHTTP.3.0'); + } + return ro; +} + +var http = createRequestObject(); + +function refTree(offset, limit, objectName) +{ + http = createRequestObject(); + var req = './rpc.php?action=Refresh&offset='+offset+'&limit='+limit+'&objectname='+objectName; + http.open('get', req); + http.onreadystatechange = handleResponse; + http.send(null); +} + +function sndReq(action, openNodes, objectName, objectId, currentNode, attributes, anchor) +{ + + + http = createRequestObject(); + var req = './rpc.php?action='+action+'&opennodes='+openNodes+'&objectname='+objectName+'&objectid='+objectId+'¤tnode='+currentNode+'&anchor='+anchor; + if (action == "Add") + { + for (i=0; i