sectree.js
资源名称:ioffice-e.rar [点击查看]
上传用户:kaisitong
上传日期:2022-01-01
资源大小:3672k
文件大小:36k
源码类别:
OA系统
开发平台:
ASP/ASPX
- function startMenu() {
- // 菜单参数
- imageDirectory = '../../../img'; ////图片目录
- menuTree = new obj_collection()
- defineMenuItems(menuTree)
- if (definitionsHaveErrors(menuTree) == false) {createAppearanceArray(menuTree,menuTree.itemWithID('root'));
- treeVariable = menuTree;
- expandNode('root');
- expandNode('ioffice')
- expandNode('sysset')
- }
- }
- // OBJ_NODE - 定义结点对象
- // ID = 每个结点的绝对标记
- // NAME = 菜单上显示的结点名称
- // PARENTID = 父结点的标记
- // TYPE = 可以是文档,文件夹或者根结点
- // URL = 结点对应的连接
- // ALTIMAGE = 16x16 GIF文件(不用于文件夹folders)
- // POSITION = 结点的位置
- // TARGET = 需要在Frame打开时,为空表示在当前页面打开。
- // _top 表示整页面打开。
- function obj_node(id,name,parentID,type,url,altImage,position,target) {
- this.id = id.toLowerCase();
- this.name = name;
- this.parentID = parentID.toLowerCase();
- this.type = type.toLowerCase();
- this.url = url;
- this.altImage = altImage;
- this.position = position;
- this.target = target;
- }
- // OBJ_COLLECTION function - defines a new collection
- function obj_collection() {
- this.addItem = addItem;
- this.itemWithID = itemWithID;
- this.itemIDExists = itemIDExists;
- this.extractExpandableNodes = extractExpandableNodes;
- this.posOfItemWithID = posOfItemWithID;
- this.length = 0;
- return this
- }
- // OBJ_ARRAY function - defines a fixed size array
- function obj_array(size) {
- this.length = size;
- this.itemWithID = itemWithID;
- this.itemIDExists = itemIDExists;
- this.posOfItemWithID = posOfItemWithID;
- return this
- }
- // OBJ_NODEAPPEARANCE - defines the appearance of a menu node (using images)
- function obj_appearanceNode(id,imageSequence,name,parentID,type,url,target,visable) {
- this.id = id;
- this.imageSequence = imageSequence;
- this.name = name;
- this.parentID = parentID;
- this.type = type;
- this.url = url;
- this.target = target;
- this.visable = visable;
- return this
- }
- // createAppearanceArray() function - this function looks at the menu node definitions,
- // works out how they all fit together, and determines the
- // image sequence needed to show their position on the menu
- // tree. This is then stored in the appearanceArray.
- function createAppearanceArray(treeVariable,startNode) {
- appearanceArray = new obj_array(treeVariable.length);
- appearancePos = 1;
- if (startNode.type == 'page') {alert("The createAppearanceArray() function can only be called on a root or folder node.")}
- else {createAppearanceBranch(treeVariable,startNode)}
- }
- function createAppearanceBranch(treeVariable,startNode) {
- if (startNode.type == 'root') {if (startNode.altImage == '') {var iconImage = 'img-globe.gif'}
- else {var iconImage = startNode.altImage}
- var newAppNode = new obj_appearanceNode(startNode.id,iconImage,startNode.name,'',startNode.type,startNode.url,startNode.target,true)
- appearanceArray[appearancePos] = newAppNode;
- appearancePos = appearancePos + 1}
- if (startNode.type == 'folder') {var newAppNode = new obj_appearanceNode(startNode.id,'',startNode.name,startNode.parentID,startNode.type,startNode.url,startNode.target,false);
- var appearanceStr = addStringToStart('','img-folder.gif');
- var lengthOfBranch = extractChildren(treeVariable,treeVariable.itemWithID(startNode.parentID)).length;
- if (startNode.position == lengthOfBranch) {appearanceStr = addStringToStart(appearanceStr,'img-plus-end.gif|')}
- else {appearanceStr = addStringToStart(appearanceStr,'img-plus-cont.gif|')}
- appearanceStr = addStringToStart(appearanceStr,createParentalStructure(treeVariable,startNode.id));
- newAppNode.imageSequence = appearanceStr;
- appearanceArray[appearancePos] = newAppNode;
- appearancePos = appearancePos + 1}
- if (startNode.type == 'page') {var newAppNode = new obj_appearanceNode(startNode.id,'',startNode.name,startNode.parentID,startNode.type,startNode.url,startNode.target,false);
- if (startNode.altImage == '') {var appearanceStr = 'img-page.gif'}
- else {var appearanceStr = startNode.altImage}
- var lengthOfBranch = extractChildren(treeVariable,treeVariable.itemWithID(startNode.parentID)).length;
- if (startNode.position == lengthOfBranch) {appearanceStr = addStringToStart(appearanceStr,'img-branch-end.gif|')}
- else {appearanceStr = addStringToStart(appearanceStr,'img-branch-cont.gif|')}
- appearanceStr = addStringToStart(appearanceStr,createParentalStructure(treeVariable,startNode.id));
- newAppNode.imageSequence = appearanceStr;
- appearanceArray[appearancePos] = newAppNode;
- appearancePos = appearancePos + 1
- }
- else {
- var nodeChildren = extractAndSortChildren(treeVariable,startNode);
- var lengthOfBranch = nodeChildren.length;
- var currentIndex = 1;
- while (currentIndex <= lengthOfBranch) {createAppearanceBranch(treeVariable,nodeChildren[currentIndex])
- currentIndex = currentIndex + 1}
- }
- }
- function collapseNode(nodeID) {
- var startingPos = appearanceArray.posOfItemWithID(nodeID) + 1;
- childCount = 0;
- countChildrenOf(treeVariable,nodeID);
- var endPos = (startingPos + childCount) - 1;
- if (endPos < startingPos) {endPos = startingPos + ((extractChildren(treeVariable,treeVariable.itemWithID(nodeID)).length) - 1) }
- currentIndex = startingPos
- while (currentIndex <= endPos) {
- if (appearanceArray[currentIndex].type == 'folder') {if ((appearanceArray[currentIndex].imageSequence).indexOf("img-folder-open.gif") != -1) {collapseAppearance(appearanceArray[currentIndex]); appearanceArray[currentIndex].visable = false}
- else {appearanceArray[currentIndex].visable = false}
- }
- else {appearanceArray[currentIndex].visable = false}
- currentIndex = currentIndex + 1
- }
- collapseAppearance(appearanceArray.itemWithID(nodeID))
- timeOutId = setTimeout("drawMenu(appearanceArray)",100);
- }
- function collapseAppearance(arrayNode) {
- var imageSequence = arrayNode.imageSequence;
- var newImage = "img-plus-cont.gif";
- var oldCont = "img-minus-cont.gif";
- var oldEnd = "img-minus-end.gif";
- var oldLength = oldCont.length;
- var plusPosition = imageSequence.indexOf(oldCont)
- if (plusPosition == -1) {plusPosition = imageSequence.indexOf(oldEnd); newImage = "img-plus-end.gif"; oldLength = oldEnd.length}
- var newAppearance = imageSequence.substring(0,plusPosition) + newImage + "|img-folder.gif"
- arrayNode.imageSequence = newAppearance;
- }
- // expandNode() function - expands and displays the given node
- function expandNode(nodeID) {
- var lengthOfArray = appearanceArray.length;
- var currentIndex = 1;
- while (currentIndex <= lengthOfArray) {
- if ((appearanceArray[currentIndex].id == nodeID) || (appearanceArray[currentIndex].parentID == nodeID)) {appearanceArray[currentIndex].visable = true;
- if (appearanceArray[currentIndex].id == nodeID) {var parentIndex = currentIndex}
- }
- currentIndex = currentIndex + 1;
- }
- if (appearanceArray[parentIndex].type != 'root') {
- expandAppearance(appearanceArray[parentIndex])}
- timeOutId = setTimeout("drawMenu(appearanceArray)",100);
- }
- function expandAppearance(arrayNode) {
- var imageSequence = arrayNode.imageSequence;
- var newImage = "img-minus-cont.gif";
- var oldCont = "img-plus-cont.gif";
- var oldEnd = "img-plus-end.gif";
- var oldLength = oldCont.length;
- var plusPosition = imageSequence.indexOf(oldCont)
- if (plusPosition == -1) {plusPosition = imageSequence.indexOf(oldEnd); newImage = "img-minus-end.gif"; oldLength = oldEnd.length}
- var newAppearance = imageSequence.substring(0,plusPosition) + newImage + "|img-folder-open.gif";
- arrayNode.imageSequence = newAppearance;
- }
- // drawMenu() 函数 - 生成explorer外观的菜单,使用document.write书写相关的页面,自己修改。
- function drawMenu(appearanceArray) {
- var lengthOfArray = appearanceArray.length;
- var currentIndex = 1;
- var uname;
- top.MenuFrame.document.open("text/html");
- top.MenuFrame.document.write("<HTML><head><link rel='stylesheet' href='../../../css/tree.css'></head><BODY>")
- while (currentIndex <= lengthOfArray) {
- if (appearanceArray[currentIndex].visable == true){drawNode(appearanceArray[currentIndex])}
- currentIndex = currentIndex + 1;
- }
- top.MenuFrame.document.close();
- window.status = '欢迎你使用 Hongfan iOffice.Net 2001!';
- }
- function getcookieval(offset)
- {
- var endstr=document.cookie.indexOf(";",offset)
- if (endstr==-1)
- endstr=document.cookie.length
- return unescape(document.cookie.substring(offset,endstr))
- }
- function getcookie(name)
- {
- var arg=name+"="
- var alen=arg.length
- var clen=document.cookie.length
- var i=0
- while (i<clen)
- {
- var j=i+alen
- if (document.cookie.substring(i,j)==arg)
- return getcookieval(j)
- i=document.cookie.indexOf(" ",i)+1
- if (i==0)
- break
- }
- return null
- }
- function drawNode(node) {
- var imageSequence = node.imageSequence;
- writeImageSequence(node,imageSequence);
- top.MenuFrame.document.write(" ")
- if (node.type == 'root')
- {
- nodeName = node.name
- }else {
- nodeName = node.name
- }
- if (node.target == '')
- {
- var nodeTarget = 'PageFrame'
- }else {
- nodeTarget = node.target
- }
- if (node.type!='folder')
- {
- top.MenuFrame.document.writeln("<A HREF='" + node.url + "' TARGET='" + nodeTarget + "'>" + nodeName + "</A><BR>")
- }else{
- nodeIdent = "'" + node.id + "'"
- switch (imgstyle)
- {
- case 'close':
- top.MenuFrame.document.writeln("<A HREF=javascript:top.expandNode(" + nodeIdent + ")>" + nodeName +"</A><BR>")
- break
- default:
- top.MenuFrame.document.writeln("<A HREF=javascript:top.collapseNode(" + nodeIdent + ")>" + nodeName +"</A><BR>")
- }
- }
- }
- function writeImageSequence(node,sequence) {
- var finished = false;
- var lengthOfString = sequence.length;
- var imageSeq = sequence;
- if (node.target == '')
- {
- var nodeTarget = 'PageFrame'
- }else {
- nodeTarget = node.target
- }
- while (finished == false)
- {
- if (imageSeq == '')
- {
- finished = true
- }else {
- imageString = stringUpToBar(imageSeq);
- if (imageString.length == imageSeq.length)
- {
- imageSeq = ''
- }else {
- imageSeq = imageSeq.substring(imageString.length + 1,imageSeq.length);
- }
- switch(imageString)
- {
- case 'img-plus-cont.gif':
- nodeIdent = "'" + node.id + "'"
- top.MenuFrame.document.write("<A HREF=javascript:top.expandNode(" + nodeIdent + ")><IMG SRC='" + imageDirectory + "/" + imageString + "' ALIGN=TEXTTOP BORDER=0></A>")
- break
- case 'img-plus-end.gif':
- nodeIdent = "'" + node.id + "'"
- top.MenuFrame.document.write("<A HREF=javascript:top.expandNode(" + nodeIdent + ")><IMG SRC='" + imageDirectory + "/" + imageString + "' ALIGN=TEXTTOP BORDER=0></A>")
- break
- case 'img-folder.gif':
- imgstyle="close"
- nodeIdent = "'" + node.id + "'"
- top.MenuFrame.document.write("<A HREF=javascript:top.expandNode(" + nodeIdent + ")><IMG SRC='" + imageDirectory + "/" + imageString + "' ALIGN=TEXTTOP BORDER=0></A>")
- break
- case 'img-minus-cont.gif':
- nodeIdent = "'" + node.id + "'"
- top.MenuFrame.document.write("<A HREF=javascript:top.collapseNode(" + nodeIdent + ")><IMG SRC='" + imageDirectory + "/" + imageString + "' ALIGN=TEXTTOP BORDER=0></A>")
- break
- case 'img-minus-end.gif':
- nodeIdent = "'" + node.id + "'"
- top.MenuFrame.document.write("<A HREF=javascript:top.collapseNode(" + nodeIdent + ")><IMG SRC='" + imageDirectory + "/" + imageString + "' ALIGN=TEXTTOP BORDER=0></A>")
- break
- case 'img-folder-open.gif':
- imgstyle="open"
- nodeIdent = "'" + node.id + "'"
- top.MenuFrame.document.write("<A HREF=javascript:top.collapseNode(" + nodeIdent + ")><IMG SRC='" + imageDirectory + "/" + imageString + "' ALIGN=TEXTTOP BORDER=0></A>")
- break
- case 'img-page.gif':
- nodeIdent = "'" + node.id + "'"
- top.MenuFrame.document.write("<A HREF='" + node.url + "' TARGET='" + nodeTarget + "'><IMG SRC='" + imageDirectory + "/" + imageString + "' ALIGN=TEXTTOP BORDER=0></A>")
- break
- default:
- top.MenuFrame.document.write("<IMG SRC='" + imageDirectory + "/" + imageString + "' ALIGN=TEXTTOP>")
- }
- }
- }
- }
- function stringUpToBar(string) {
- var lengthOfString = string.length;
- var currentIndex = 0;
- var newString = '';
- var finished = false;
- while (finished == false) {
- if (currentIndex == lengthOfString) {finished = true}
- else {
- if (string.charAt(currentIndex) == '|') {finished = true}
- else {newString = newString + string.charAt(currentIndex)}
- currentIndex = currentIndex + 1
- }
- if (currentIndex == lengthOfString) {finished = true}
- }
- return newString
- }
- // addStringToStart() function - adds the addition string to the front of the existing string
- function addStringToStart(existingString,addition) {
- newString = addition + existingString;
- return newString
- }
- // createParentalStructure() function - creates a string that shows the parental tree structure
- function createParentalStructure(treeVariable,nodeID) {
- var parentAppearance = '';
- var parentID = treeVariable.itemWithID(nodeID).parentID;
- var currentNode = treeVariable.itemWithID(parentID);
- while (parentID != 'root') {
- var nodePos = currentNode.position;
- parentID = currentNode.parentID;
- currentNode = treeVariable.itemWithID(parentID);
- var lengthOfBranch = extractChildren(treeVariable,currentNode).length;
- if (nodePos < lengthOfBranch) {parentAppearance = addStringToStart(parentAppearance,'img-vert-line.gif|')}
- else {parentAppearance = addStringToStart(parentAppearance,'img-blank.gif|')}
- }
- return parentAppearance
- }
- // extractExpandableNodes() - METHOD of obj_collection - extracts the root and all folder nodes
- // into a new collection
- function extractExpandableNodes() {
- var newCollection = new obj_collection();
- var collectionSize = this.length;
- var currentIndex = 1;
- var currentArray = this;
- while (currentIndex <= collectionSize) {
- if ((currentArray[currentIndex].type == 'folder') || (currentArray[currentIndex].type == 'root')) {
- newCollection = newCollection.addItem(currentArray[currentIndex])
- }
- currentIndex = currentIndex + 1
- }
- return newCollection
- }
- // ADDITEM function - METHOD of OBJ_COLLECTION - adds an object to the collection
- function addItem(object) {
- collectionSize = this.length;
- returnArray = this;
- idExists = returnArray.itemIDExists(object.id)
- if (idExists == false) {returnArray.length = collectionSize + 1;
- returnArray[returnArray.length] = object;
- return returnArray}
- else {alert("ERROR: Object with id: " + object.id + " already exists in this collection.")
- return returnArray}
- }
- function countChildrenOf(treeVariable,nodeID) {
- var node = treeVariable.itemWithID(nodeID);
- var nodeChildren = extractChildren(treeVariable,node);
- var currentIndex = 1;
- while (currentIndex <= nodeChildren.length) {
- if (nodeChildren[currentIndex].type != 'page') {countChildrenOf(treeVariable,nodeChildren[currentIndex].id)}
- childCount = childCount + 1;
- currentIndex = currentIndex + 1;
- }
- }
- function posOfItemWithID(id) {
- collectionSize = this.length;
- currentIndex = 1;
- returnIndex = 'undefined';
- while (currentIndex <= collectionSize) {
- if (this[currentIndex].id == id) {returnIndex = currentIndex}
- currentIndex = currentIndex + 1}
- if (returnObject == 'undefined') {alert("ERROR: Object with id: " + id + " not found in this collection.")}
- else {return returnIndex}
- }
- // ITEMWITHID function - METHOD of OBJ_COLLECTION and OBJ_ARRAY - returns an object with the given ID
- function itemWithID(id) {
- collectionSize = this.length;
- currentIndex = 1;
- returnObject = 'undefined';
- while (currentIndex <= collectionSize) {
- if (this[currentIndex].id == id) {returnObject = this[currentIndex]}
- currentIndex = currentIndex + 1}
- if (returnObject == 'undefined') {alert("ERROR: Object with id: " + id + " not found in this collection.")}
- else {return returnObject}
- }
- // ITEMIDEXISTS function - METHOD of OBJ_COLLECTION and OBJ_ARRAY - checks if an object with the given ID
- // already exists in the collection
- function itemIDExists(id) {
- collectionSize = this.length;
- currentIndex = 1;
- returnStatus = false;
- while (currentIndex <= collectionSize) {
- if ((this[currentIndex].id) == id) {returnStatus = true}
- currentIndex = currentIndex + 1}
- return returnStatus
- }
- // definitionsHaveErrors function - general function - checks the defined menu infrastructure
- // for errors.
- function definitionsHaveErrors(treeVariable) {
- hasErrors = false
- if (checkForMultipleRoots(treeVariable) == true) {hasErrors = true}
- if (checkNodeTypes(treeVariable) == true) {hasErrors = true}
- if (checkForOrphanNodes(treeVariable) == true) {hasErrors = true}
- if (checkForChildren(treeVariable) == true) {hasErrors = true}
- if (checkNodePositions(treeVariable) == true) {hasErrors = true}
- return hasErrors
- }
- // checkNodeTypes function - called from definitionsHaveErrors() function
- // - checks for nodes with unknown types
- function checkNodeTypes(treeVariable) {
- collectionSize = treeVariable.length;
- var currentIndex = 1;
- var returnStatus = false;
- while (currentIndex <= collectionSize) {
- if ((treeVariable[currentIndex].type != 'root') && (treeVariable[currentIndex].type != 'page') && (treeVariable[currentIndex].type != 'folder')) {
- alert("Node with ID: " + treeVariable[currentIndex].id + " is of an unknown type: " + treeVariable[currentIndex].type + " (not a page, folder or root).")
- }
- currentIndex = currentIndex + 1;
- }
- return returnStatus
- }
- // checkForMultipleRoots function - called from definitionsHaveErrors() function
- // - checks if the menu infrastructure has multiple root nodes
- function checkForMultipleRoots(treeVariable) {
- collectionSize = treeVariable.length;
- currentIndex = 1;
- rootCount = 0;
- while (currentIndex <= collectionSize) {
- if ((treeVariable[currentIndex].type) == 'root') {rootCount = rootCount + 1}
- currentIndex = currentIndex + 1}
- if (rootCount == 1) {return false}
- else {if (rootCount == 0) {alert("ERROR: You have not defined a root node.")}
- else {alert("ERROR: You have defined more than one root node.")}
- return true}
- }
- // checkForOrphanNodes() function - called from definitionsHaveErrors() function
- // - checks if the menu infrastructure contains any nodes without defined parents
- function checkForOrphanNodes(treeVariable) {
- collectionSize = treeVariable.length;
- var currentIndex = 1;
- var returnStatus = false;
- while (currentIndex <= collectionSize) {
- if ((treeVariable[currentIndex].type) != 'root') {if (((treeVariable.itemIDExists(treeVariable[currentIndex].parentID)) == false) && (treeVariable[currentIndex].parentID != '')) {returnStatus = true;
- alert("ERROR: The parent node: " + treeVariable[currentIndex].parentID + " does not exist for node: " + treeVariable[currentIndex].id + ".")}
- if (treeVariable[currentIndex].parentID == '') {returnStatus = true;
- alert("ERROR: Node with ID: " + treeVariable[currentIndex].id + " has no parent, and is not the root node.")}
- if (treeVariable.itemWithID(treeVariable[currentIndex].parentID).type == 'page') {returnStatus = true; alert("ERROR: Node with ID: " + treeVariable[currentIndex].id + " has a parent (" + treeVariable[currentIndex].parentID + "), but this parent is a page (should be a folder or the root).")}
- }
- currentIndex = currentIndex + 1}
- return returnStatus
- }
- // checkForChildren() function - called from definitionsHaveErrors() function
- // - checks that all nodes (except pages) in the menu infrastructure have at least one child
- function checkForChildren(treeVariable) {
- collectionSize = treeVariable.length;
- var currentIndex = 1;
- var returnStatus = false;
- while (currentIndex <= collectionSize) {
- if ((treeVariable[currentIndex].type) != 'page') {
- if (checkParentID(treeVariable,treeVariable[currentIndex].id) == false) {returnStatus = true; alert("ERROR: Node with ID: " + treeVariable[currentIndex].id + " is a root node or a folder node (or an node of unknown type) without any defined children. The root node and any folder nodes MUST have at least one child node.")}
- }
- currentIndex = currentIndex + 1
- }
- return returnStatus
- }
- // checkParentID() function - checks the given tree for nodes with the given parent ID
- function checkParentID(treeVariable,parentCode) {
- collectionSize = treeVariable.length;
- var currentIndex = 1;
- var returnStatus = false;
- while (currentIndex <= collectionSize) {
- if ((treeVariable[currentIndex].parentID) == parentCode) {returnStatus = true}
- currentIndex = currentIndex + 1
- }
- return returnStatus
- }
- // checkNodePositions() function - checks the tree infrastructure for node positioning errors
- function checkNodePositions(treeVariable) {
- // 1. Make a collection of all folders and the root node
- expandableNodes = treeVariable.extractExpandableNodes()
- // 2. For each node in this collection, make a collection of all the nodes that
- // are children of that node.
- var currentIndex = 1;
- var collectionSize = expandableNodes.length;
- var returnStatus = false;
- while (currentIndex <= collectionSize) {
- var scanCollection = extractChildren(treeVariable,expandableNodes[currentIndex]);
- if (scanPositionErrors(scanCollection,expandableNodes[currentIndex].id) == true) {returnStatus = true}
- currentIndex = currentIndex + 1
- }
- return returnStatus
- }
- // scanPositionErrors() function - scans the given collection of children for positioning errors
- function scanPositionErrors(scanCollection,idOfParent) {
- var returnStatus = false;
- var currentIndex = 1;
- var collectionSize = scanCollection.length;
- // Check for nodes with positions less than 1
- while (currentIndex <= collectionSize) {
- if (scanCollection[currentIndex].position < 1) {returnStatus = true;
- alert("ERROR: Node with ID: " + scanCollection[currentIndex].id + " with parent: " + scanCollection[currentIndex].parentID + " has a illegal position value (less than 1).")}
- currentIndex = currentIndex + 1
- }
- currentIndex = 1
- while (currentIndex <= collectionSize) {
- if (scanCollection[currentIndex].position > collectionSize) {returnStatus = true;
- alert("ERROR: Node with ID: " + scanCollection[currentIndex].id + " with parent: " + scanCollection[currentIndex].parentID + " has a illegal position value (greater than branch maximum of " + collectionSize + " positions).")}
- currentIndex = currentIndex + 1
- }
- var loopNo = 1;
- while (loopNo <= collectionSize) {
- var currentIndex = 1;
- var positionFound = false;
- while (currentIndex <= collectionSize) {
- if (scanCollection[currentIndex].position == loopNo) {positionFound = true}
- currentIndex = currentIndex + 1
- }
- if (positionFound == false) {returnStatus = true; alert("ERROR: There is no node at position " + loopNo + " in branch " + idOfParent + ". Two or more nodes may have the same position value.")}
- loopNo = loopNo + 1
- }
- currentIndex = 1
- return returnStatus
- }
- function extractChildren(treeVariable,node) {
- var newCollection = new obj_collection();
- var currentIndex = 1;
- var collectionSize = treeVariable.length;
- nodeID = node.id;
- while (currentIndex <= collectionSize) {
- if ((treeVariable[currentIndex].parentID) == nodeID) {
- newCollection = newCollection.addItem(treeVariable[currentIndex])
- }
- currentIndex = currentIndex + 1
- }
- return newCollection
- }
- function extractAndSortChildren(treeVariable,node) {
- var childCollection = extractChildren(treeVariable,node);
- var newCollection = new obj_collection();
- var lengthOfCollection = childCollection.length;
- var currentIndex = 1;
- while (currentIndex <= lengthOfCollection) {
- var newNode = extractNodeWithPosition(childCollection,currentIndex)
- newCollection = newCollection.addItem(newNode)
- currentIndex = currentIndex + 1
- }
- return newCollection
- }
- function extractNodeWithPosition(collection,position) {
- var currentIndex = 1;
- var lengthOfCollection = collection.length;
- while (currentIndex <= lengthOfCollection) {
- if (collection[currentIndex].position == position) {var node = collection[currentIndex]}
- currentIndex = currentIndex + 1
- }
- return node
- }
- // DEFINEMENUITEMS function - general function - called from start of script to create the menu
- // infrastructure.
- //
- // 以下内容需要你设置,即左侧menu的内容,格式如下: uniqueID,displayName,parentID,typeOfNode,URL,altImage,positionInTree,targetFrame
- function defineMenuItems(treeVariable) {
- //root
- treeVariable = treeVariable.addItem(new obj_node('root','iOffice.Net 安全策略','','root','start.htm','secpolicy.gif',0,''));
- //我的办公室
- treeVariable = treeVariable.addItem(new obj_node('ioffice','我的办公室','root','folder','','',1,''));
- //文件管理
- treeVariable = treeVariable.addItem(new obj_node('fm','文件管理','ioffice','folder','','',1,''));
- //文件管理扩展
- treeVariable = treeVariable.addItem(new obj_node('fm1','文件管理','fm','page','rightlist.aspx?v=fm1','fm.gif',1,''));
- treeVariable = treeVariable.addItem(new obj_node('fm2','文件搜索','fm','page','rightlist.aspx?v=fm2','find.gif',2,''));
- ///公文管理
- treeVariable = treeVariable.addItem(new obj_node('wm','公文管理','ioffice','folder','','',2,''));
- //公文模板
- treeVariable = treeVariable.addItem(new obj_node('wm10','公文模板','wm','page','rightlist.aspx?v=wm10','doctemp.gif',1,''));
- //客户关系管理
- treeVariable = treeVariable.addItem(new obj_node('crm','客户关系','root','folder','','',2,''));
- //基础信息
- treeVariable = treeVariable.addItem(new obj_node('bi','基础信息','crm','folder','','',1,''));
- //treeVariable = treeVariable.addItem(new obj_node('bi1','产品信息','bi','page','rightlist.aspx','',1,''));
- treeVariable = treeVariable.addItem(new obj_node('bi2','客户信息','bi','page','rightlist.aspx?v=crm1','',1,''));
- //treeVariable = treeVariable.addItem(new obj_node('bi3','合作伙伴','bi','page','rightlist.aspx','',3,''));
- //treeVariable = treeVariable.addItem(new obj_node('bi4','分配客户','bi','page','rightlist.aspx','',4,''));
- //treeVariable = treeVariable.addItem(new obj_node('bi5','目标客户','bi','page','rightlist.aspx','',5,''));
- //treeVariable = treeVariable.addItem(new obj_node('bi6','竞争对手','bi','page','rightlist.aspx','',6,''));
- //treeVariable = treeVariable.addItem(new obj_node('bi7','产品比较','bi','page','rightlist.aspx','',7,''));
- //treeVariable = treeVariable.addItem(new obj_node('bi8','员工自助','bi','page','rightlist.aspx','',8,''));
- //treeVariable = treeVariable.addItem(new obj_node('bi9','节日信息','bi','page','rightlist.aspx','',9,''));
- //treeVariable = treeVariable.addItem(new obj_node('bi10','历史交易','bi','page','rightlist.aspx','',10,''));
- //价格管理
- //treeVariable = treeVariable.addItem(new obj_node('pm','价格管理','crm','folder','','',2,''));
- //treeVariable = treeVariable.addItem(new obj_node('pm1','销量定价','pm','page','test.htm','',1,''));
- //treeVariable = treeVariable.addItem(new obj_node('pm2','客户定价','pm','page','test.htm','',2,''));
- //treeVariable = treeVariable.addItem(new obj_node('pm3','伙伴定价','pm','page','test.htm','',3,''));
- //treeVariable = treeVariable.addItem(new obj_node('pm4','现金折扣','pm','page','test.htm','',4,''));
- //treeVariable = treeVariable.addItem(new obj_node('pm5','促销价格','pm','page','test.htm','',5,''));
- //市场管理
- //treeVariable = treeVariable.addItem(new obj_node('mm','市场管理','crm','folder','','',3,''));
- //treeVariable = treeVariable.addItem(new obj_node('mm1','市场活动','mm','page','test.htm','',1,''));
- //treeVariable = treeVariable.addItem(new obj_node('mm2','伙伴定额','mm','page','test.htm','',2,''));
- //treeVariable = treeVariable.addItem(new obj_node('mm3','工作进程','mm','page','test.htm','',3,''));
- //treeVariable = treeVariable.addItem(new obj_node('mm4','任务管理','mm','page','test.htm','',4,''));
- //销售管理
- //treeVariable = treeVariable.addItem(new obj_node('sm','销售管理','crm','folder','','',4,''));
- //treeVariable = treeVariable.addItem(new obj_node('sm1','销售机会','sm','page','test.htm','',1,''));
- //treeVariable = treeVariable.addItem(new obj_node('sm2','报价管理','sm','page','test.htm','',2,''));
- //treeVariable = treeVariable.addItem(new obj_node('sm3','工作进程','sm','page','test.htm','',3,''));
- //treeVariable = treeVariable.addItem(new obj_node('sm4','任务管理','sm','page','test.htm','',4,''));
- //treeVariable = treeVariable.addItem(new obj_node('sm5','电子促销','sm','page','test.htm','',5,''));
- //treeVariable = treeVariable.addItem(new obj_node('sm6','客户挖掘','sm','page','test.htm','',6,''));
- //订单管理
- //treeVariable = treeVariable.addItem(new obj_node('om','订单管理','crm','folder','','',5,''));
- //treeVariable = treeVariable.addItem(new obj_node('om1','订单处理','om','page','test.htm','',1,''));
- //treeVariable = treeVariable.addItem(new obj_node('om2','退货处理','om','page','test.htm','',2,''));
- //treeVariable = treeVariable.addItem(new obj_node('om3','订单跟踪','om','page','test.htm','',3,''));
- //treeVariable = treeVariable.addItem(new obj_node('om4','电子催收','om','page','test.htm','',4,''));
- //客户服务
- //treeVariable = treeVariable.addItem(new obj_node('gs','客户服务','crm','folder','','',6,''));
- //treeVariable = treeVariable.addItem(new obj_node('gs1','反馈处理','gs','page','test.htm','',1,''));
- //treeVariable = treeVariable.addItem(new obj_node('gs2','工作进程','gs','page','test.htm','',2,''));
- //treeVariable = treeVariable.addItem(new obj_node('gs3','任务管理','gs','page','test.htm','',3,''));
- //客户关怀
- //treeVariable = treeVariable.addItem(new obj_node('gc','客户关怀','crm','folder','','',7,''));
- //treeVariable = treeVariable.addItem(new obj_node('gc1','建议生成','gc','page','test.htm','',1,''));
- //treeVariable = treeVariable.addItem(new obj_node('gc2','建议管理','gc','page','test.htm','',2,''));
- //treeVariable = treeVariable.addItem(new obj_node('gc3','特别关怀','gc','page','test.htm','',3,''));
- //treeVariable = treeVariable.addItem(new obj_node('gc4','工作进程','gc','page','test.htm','',4,''));
- //treeVariable = treeVariable.addItem(new obj_node('gc5','任务管理','gc','page','test.htm','',5,''));
- //分析决策
- //treeVariable = treeVariable.addItem(new obj_node('ac','分析决策','crm','folder','','',8,''));
- //treeVariable = treeVariable.addItem(new obj_node('ac1','销售分析','ac','page','test.htm','',1,''));
- //treeVariable = treeVariable.addItem(new obj_node('ac2','市场活动','ac','page','test.htm','',2,''));
- //treeVariable = treeVariable.addItem(new obj_node('ac3','服务分析','ac','page','test.htm','',3,''));
- //treeVariable = treeVariable.addItem(new obj_node('ac4','特征分析','ac','page','test.htm','',4,''));
- //treeVariable = treeVariable.addItem(new obj_node('ac5','费用分析','ac','page','test.htm','',5,''));
- //treeVariable = treeVariable.addItem(new obj_node('ac6','客户分析','ac','page','test.htm','',6,''));
- //treeVariable = treeVariable.addItem(new obj_node('ac7','合作伙伴','ac','page','test.htm','',7,''));
- //treeVariable = treeVariable.addItem(new obj_node('ac8','产品分析','ac','page','test.htm','',8,''));
- //treeVariable = treeVariable.addItem(new obj_node('ac9','员工分析','ac','page','test.htmm','',9,''));
- //文档管理
- //treeVariable = treeVariable.addItem(new obj_node('fold-002','文档管理','root','folder','','crm.gif',3,''));
- //treeVariable = treeVariable.addItem(new obj_node('page-010','页面一','fold-002','page','test.htm','',1,''));
- //treeVariable = treeVariable.addItem(new obj_node('page-011','页面二','fold-002','page','test.htm','',2,''));
- //treeVariable = treeVariable.addItem(new obj_node('page-012','页面三','fold-002','page','test.htm','',3,''));
- //事务处理
- //treeVariable = treeVariable.addItem(new obj_node('trand','事务处理','root','folder','','',4,''));
- //treeVariable = treeVariable.addItem(new obj_node('trand1','页面一','trand','page','test.htm','',1,''));
- //treeVariable = treeVariable.addItem(new obj_node('trand2','页面二','trand','page','test.htm','',2,''));
- //treeVariable = treeVariable.addItem(new obj_node('trand3','页面三','trand','page','test.htm','',3,''));
- //设备预约
- //treeVariable = treeVariable.addItem(new obj_node('euqord','设备预约','root','folder','','',5,''));
- //treeVariable = treeVariable.addItem(new obj_node('euqord1','页面一','euqord','page','test.htm','',1,''));
- //treeVariable = treeVariable.addItem(new obj_node('euqord2','页面二','euqord','page','test.htm','',2,''));
- //treeVariable = treeVariable.addItem(new obj_node('euqord3','页面三','euqord','page','test.htm','',3,''));
- //定制模块
- //treeVariable = treeVariable.addItem(new obj_node('model','定制模块','root','folder','','',6,''));
- //treeVariable = treeVariable.addItem(new obj_node('model1','页面一','model','page','test.htm','',1,''));
- //treeVariable = treeVariable.addItem(new obj_node('model2','页面二','model','page','test.htm','',2,''));
- //treeVariable = treeVariable.addItem(new obj_node('model3','页面三','model','page','test.htm','',3,''));
- //控制面板
- treeVariable = treeVariable.addItem(new obj_node('sysset','控制面板','root','folder','','',3,''));
- //基本设置
- treeVariable = treeVariable.addItem(new obj_node('bs','基本设置','sysset','folder','','',1,''));
- treeVariable = treeVariable.addItem(new obj_node('bs1','人力资源','bs','page','rightlist.aspx?v=bs1','mans.gif',1,''));
- treeVariable = treeVariable.addItem(new obj_node('bs2','邮件设置','bs','page','rightlist.aspx?v=bs2','inmail.gif',2,''));
- treeVariable = treeVariable.addItem(new obj_node('bs3','公文管理','bs','page','rightlist.aspx?v=bs3','fav.gif',3,''));
- treeVariable = treeVariable.addItem(new obj_node('bs4','信息互递','bs','page','rightlist.aspx?v=bs4','qybord.gif',4,''));
- treeVariable = treeVariable.addItem(new obj_node('bs5','日程任务','bs','page','rightlist.aspx?v=bs5','rw.gif',5,''));
- //treeVariable = treeVariable.addItem(new obj_node('bs5','任务状态','bs','page','default.htm','',5,''));
- //treeVariable = treeVariable.addItem(new obj_node('bs6','类型定义','bs','page','test.htm','',6,''));
- //treeVariable = treeVariable.addItem(new obj_node('bs7','执行动作','bs','page','test.htm','',7,''));
- //treeVariable = treeVariable.addItem(new obj_node('bs8','其他定义','bs','page','test.htm','',8,''));
- //属性定义
- //treeVariable = treeVariable.addItem(new obj_node('ps','属性定义','sysset','folder','','',2,''));
- //treeVariable = treeVariable.addItem(new obj_node('ps1','员工信息','ps','page','rightlist.aspx?v=ps1','',1,''));
- //treeVariable = treeVariable.addItem(new obj_node('ps2','产品属性','ps','page','test.htm','',2,''));
- //treeVariable = treeVariable.addItem(new obj_node('ps3','订单属性','ps','page','test.htm','',3,''));
- //treeVariable = treeVariable.addItem(new obj_node('ps4','客户属性','ps','page','test.htm','',4,''));
- //treeVariable = treeVariable.addItem(new obj_node('ps5','伙伴属性','ps','page','test.htm','',5,''));
- //系统设定扩展
- treeVariable = treeVariable.addItem(new obj_node('ss3','帐号维护','sysset','page','rightlist.aspx?v=ss3','man.gif',2,''));
- treeVariable = treeVariable.addItem(new obj_node('ss4','安全策略','sysset','page','rightlist.aspx?v=ss4','secpolicy.gif',3,''));
- treeVariable = treeVariable.addItem(new obj_node('ss5','登录日志','sysset','page','rightlist.aspx?v=ss5','loginlog.gif',4,''));
- treeVariable = treeVariable.addItem(new obj_node('ss6','操作日志','sysset','page','rightlist.aspx?v=ss6','log.gif',5,''));
- }