Count Lines in Pages

Contents of Page: demoDynamicLeftFrame.asp Number of Lines: 156 Last Modified: 8/22/2018 1:32:39 PM
0001: <%@ Language=VBScript %>
0002: <% 
0003: option explicit 
0004: Response.Expires=-1
0005: %>
0006: <!-- The Response.Expires=-1 will make sure the page is not cached.
0007:      If the page is cached and the database changes, the new tree will not be shown -->
0008: 
0009: <!--
0010:      (Please keep all copyright notices.)
0011:      This page document includes the Treeview script.
0012:      Script found at: http://www.treeview.net
0013:      Author: Marcelino Alves Martins
0014: -->
0015: 
0016: <%
0017: 
0018: Dim databaseDir, Conn
0019: 
0020: 'Change this to a path (c:\...) if the database is not in the same dir of the 
0021: 'current file
0022: ' databaseDir = Server.MapPath("demoDynamic.mdb")
0023: ' Set Conn = Server.CreateObject("ADODB.Connection")
0024: ' Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & databaseDir)
0025: 
0026:    Set Conn = Server.CreateObject("ADODB.Recordset")
0027: 
0028: ' This is a recursive function; it will find the children directly under a node
0029: ' and then call itself for each of those children in order to find the grand-children.
0030: ' For each entry in the DB that this function finds, it sends a snippet of 
0031: ' JavaScript to the browser with the Treeview commands necessary for the 
0032: ' construction of a node (folder or "doc")
0033: ' 
0034: '   conn: is an ADODB.Connection opened on a database with a NodesTable table
0035: '   parentId: is the value of the ParentID field for a record in the database
0036: '   parentObject: is the name of the JavaScript variable used to define the parent
0037: 
0038: sub outputJavascript(Conn, parentId, parentObject)
0039:     dim rsHits, queryString, gFldStr, gLnkStr
0040: 
0041: '    queryString = "SELECT NodeID, NodeName, IsFolder, ParentID, Link FROM NodesTable WHERE ((ParentID=" & parentId & ") AND (IsFolder=True)) ORDER BY NodeName"
0042: queryString = "SELECT * FROM NodesTable WHERE ((ParentID=" & parentId & ") AND (IsFolder=True)) "
0043:     Set rsHits = Server.CreateObject("ADODB.Recordset")
0044:     rsHits.Open queryString, Conn
0045: 
0046:     ' Repeate for eahc record with ParentID field equal to the ID of the parent
0047:     ' The same is to say, repeat for each Treeview node under the parent Folder
0048:     do while not rsHits.EOF
0049:         gFldStr = "gFld('"&rsHits("NodeName")&"', 'javascript:parent.op();')"
0050:         if parentId = -1 then
0051:             response.write "foldersTree = " & gFldStr & VbCrLf
0052:             response.write "f = foldersTree" & VbCrLf
0053:             response.write "f.xID = " & rsHits("NodeID") & VbCrLf
0054:             outputJavascript Conn, rsHits("NodeID"), "f"
0055:         else
0056:             response.write parentObject & "Sub" & " = insFld(" & parentObject & ","&gFldStr&")" & VbCrLf
0057:             response.write parentObject & "Sub.xID = " & rsHits("NodeID") & VbCrLf
0058:             outputJavascript Conn, rsHits("NodeID"), parentObject & "Sub" 
0059:         end if
0060:         rsHits.MoveNext
0061: 
0062:     loop
0063:     rsHits.close
0064: 
0065:     queryString = "SELECT NodeID, NodeName, Link FROM NodesTable WHERE ((ParentID=" & parentId & ") AND (IsFolder=False)) ORDER BY NodeName"
0066:     Set rsHits = Server.CreateObject("ADODB.Recordset")
0067:     rsHits.Open queryString, Conn
0068:     do while not rsHits.EOF
0069:         gLnkStr = "gLnk('R', '" & rsHits("NodeName") & "', '" & rsHits("Link") &"')"
0070:         response.write "aux = insDoc(" & parentObject & ","&gLnkStr&")" & VbCrLf
0071:         response.write "aux.xID = " & rsHits("NodeID") & VbCrLf
0072:         rsHits.MoveNext
0073:     loop
0074:     rsHits.close
0075: end sub
0076: 
0077: %>
0078: 
0079: <html>
0080: <head>
0081: 
0082: <title>Tree from database</title>
0083: 
0084: <style>
0085:    BODY {background-color: white}
0086:    TD {font-size: 10pt; 
0087:        font-family: verdana,helvetica; 
0088: 	   text-decoration: none;
0089: 	   white-space:nowrap;}
0090:    A  {text-decoration: none;
0091:        color: black}
0092: </style>
0093: 
0094: <!-- As in a client-side built tree, all the tree infrastructure is put in place
0095:      within the HEAD block, but the actual tree rendering is trigered within the
0096:      BODY -->
0097: 
0098: <!-- Code for browser detection -->
0099: <script src="ua.js"></script>
0100: 
0101: <!-- Infrastructure code for the tree -->
0102: <script src="ftiens4.js"></script>
0103: 
0104: <!-- Execution of the code that actually builds the specific tree.
0105:      The variable foldersTree creates its structure with calls to
0106: 	 gFld, insFld, and insDoc -->
0107: <script>
0108: USETEXTLINKS = 1
0109: STARTALLOPEN = 0
0110: PERSERVESTATE = 1
0111: ICONPATH = '' 
0112: <% 
0113: outputJavascript Conn, -1, "" 
0114: %>
0115: 
0116: 
0117: // Load a page as if a node on the tree was clicked (synchronize frames)
0118: // (Highlights selection if highlight is available.)
0119: function loadSynchPage(xID) 
0120: {
0121: 	var folderObj;
0122: 	docObj = parent.treeframe.findObj(xID);
0123: 	docObj.forceOpeningOfAncestorFolders();
0124: 	parent.treeframe.clickOnLink(xID,docObj.link,'basefrm'); 
0125: 
0126:     //Scroll the tree window to show the selected node
0127:     //Other code in these functions needs to be changed to work with
0128:     //frameless pages, but this code should, I think, simply be removed
0129:     if (typeof parent.treeframe.document.body != "undefined") //scroll doesn work with NS4, for example
0130:         parent.treeframe.document.body.scrollTop=docObj.navObj.offsetTop
0131: } 
0132: </script>
0133: </head>
0134: 
0135: <body topmargin=16 marginheight=16>
0136: 
0137: <!-- By removing the follwoing code you are violating your user agreement.
0138:      Corporate users or any others that want to remove the link should check 
0139: 	 the online FAQ for instructions on how to obtain a version without the link -->
0140: <!-- Removing this link will make the script stop from working -->
0141: <div style="position:absolute; top:0; left:0; "><table border=0><tr><td><font size=-2><a style="font-size:7pt;text-decoration:none;color:silver" href="http://www.treemenu.net/" target=_blank>JavaScript Tree Menu</a></font></td></tr></table></div>
0142: 
0143: <!-- Build the browser's objects and display default view of the 
0144:      tree. -->
0145: <script>
0146: initializeDocument()
0147: //Click the Parakeet link
0148: loadSynchPage(506027036)
0149: </script>
0150: <noscript>
0151: A tree for site navigation will open here if you enable JavaScript in your browser.
0152: </noscript>
0153: 
0154: </body>
0155: 
0156: </html>