Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- @Abdelmoughite Eljoaydi
- Vulnerable tree node @params (unsanitized) :
- TreeNode() :
- ------------
- * The definition of a tree node. Used as a class object
- * @param nodeName : The name of the node
- * @param nodeUrl : The target url when the node is clicked (Optional)
- * @param altText : Text which will be shown as a popup when the mouse hovers on the folder
- function TreeNode(nodeId, parent, nodeName, nodeUrl, iconSrcOpen, iconSrcClosed, popupId, altText, isOpen, hasChildren)
- {
- this.nodeId = nodeId;
- this.parent = parent;
- this.nodeName = nodeName; /** unsanitized User-Controlled data.
- this.nodeUrl = nodeUrl; /**
- this.nId = escapeQuotes(nodeId); // escape the quotes out of the nodeId string.
- this.children = new Array();
- this.hasChildren = hasChildren;
- }
- CreateTree(startNode) :
- ------------------------
- /**
- * Create the tree
- *
- * @param startNode : The node which represents the start point of the tree. If not specified
- * The tree will start with the first node in the list.
- * addNode(parentNode, recursedNodes): function to add a new node in the tree.
- *
- */
- function createTree(startNode)
- {
- preloadIcons();
- var node = null;
- var sId = null;
- if (startNode != null)
- {
- node = startNode
- } else {
- // get the first node
- if(nodes.length > 0)
- node = nodes[0];
- }
- if(node == null)
- return; // nothing can be displayed in the tree.
- // if setLocal=true (Note : setLocal it's a variable which decides if the tree is going to expand locally or, if it needs to ask the //server to get the data), load all the openNodes from cookie.
- if (!isLocal)
- retrieveOpenNodesFromCookie();
- else
- retrieveOpenNodesFromServer();
- highlightNode = false;
- if(highlightedNodes != null && highlightedNodes[node.nodeId] != null)
- {
- highlightNode = true;
- }
- /**
- *main @param node : The TreeNode object to be written.
- *Write a unique node out using document.write. This method is called in case of using treenodes other than a Tree (ie in a list).
- **/
- writeNode(node, node.iconSrcOpen, highlightNode, null, node.nodeName);
- document.write('<br />');
- var recursedNodes = new Array();
- addNode(node, recursedNodes);
- setTimeout(scrollToElement, 300);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement