Implement 9CBS menu (database) with ASP + XML (database), can be managed

xiaoxiao2021-03-06  94

I am in the development of the company OA system. I want to find a 9CBS menu. But there is such code on the Internet. But I am not based on the database, I can't follow the right to manage. I wrote one. I have this. There is only one program file and one Database. There are few files, it is also easy to check. But the features are fully implemented!

Database structure:

Table: Menu ID Parentid, Int, 4 Menuname, Char, 20 Link, Char, 50

Table: Userlevel ID Userid, Int, 4 Menuid, Int, 4

------------------------------------- Serial source file: menulist.asp ------ ---------------------------------------------------------------------------------------------------------------------------------------

<% '------------------------------' 'source business planning company - OA system' module name: Menu for permission controls '-------------------------------'

SET CONN = Server.createObject ("AdoDb.Connection") Conn.Open ("Provider = Microsoft.jet.OleDb.4.0; Data Source =" Server.MAppath ("Tree.mdb") "; Persist Security Info = False ")%>

DSTREE </ TITLE> <style> body, td {font: 12px verdana} #treebox {background-color: #fffa;} # Treebox .ec {margin: 0 5 0 5;} #treebox .hasitems {font-weight: bold; height: 20px; padding: 3 6 0 6; Margin: 2px; Cursor: hand; color: # 555555; border: 1px solid #ffffa;} # Treebox .Items {Height: 20PX; Padding: 3 6 0 6; Margin: 1px; Cursor: Hand; Color: # 555555; border: 1px solid #ffffa;} </ stop></p> <p><script> // code by Star 20003-4-7VAR HC = "Color: # 990000; border: 1px solid #cccccc"; var sc = "background-color: #efefef; border: 1px solid #cccccc; color: # 000000; "; var IO = null; function initTree () {var rootn = document.all.menuXML.documentElement; var sd = 0; document.onselectstart = function () {return false;} document.all.treeBox.appendChild ( CreateTree (Rootn, SD));} Function CreateTree (THISN, SD) {var nodeobj = document.createElement ("span"); var Upobj = Document.createElement ("span"); with (Upobj) {style.marginleft = SD * 10; classname = thisn.haschildnodes ()? "Hasitems": "items"; innerhtml = "<img src = expand.gif class = EC>" THISN.GETATTRIBUTE ("text") ""; onMousedown = Function () {if (Event.Button! = 1) Return; IF (this.GetaTRibute ("cn")) {this.settribute ("open",! this.getattribute ("open")); this.cn. Style.display = this.getattribute ("open")? "inline": "none"; this.all.tags ("img") [0] .src = this.getattribute ("open")? "expand.gif ":" contract.gif ";} if (io) {oo {ootimestyle.css TEXT = ""; o.setttribute ("SELECTED", false;} IO = this; this.setttribute ("SELECTED", TRUE); this.RuntimeStyle.csstext = sc;} onmouseover = function ()} (this .getAttribute ( "selected")) return; this.runtimeStyle.cssText = HC;} onmouseout = function () {if (this.getAttribute ( "selected")) return; this.runtimeStyle.cssText = "";} oncontextmenu = ContextMenuHandle; OnClick = ClickHandle;}</p> <p>IF ("TREEID")! = null) {UPOBJ.SetAttribute ("TreeID", This.GetaTribute ("TreeID"));} if (thisn.getattribute ("href")! = null) {UPOBJ .SetaTRibute ("href", thisn.getattribute ("href"));} f ("Target")! = null) {UPOBJ.SetAttribute ("Target", thisn.getattribute ("Target")) } Nodeobj.Appendchild (Upobj); nodeobj.insertadjacenthtml ("BeforeEnd", "<br>")</p> <p>IF (thisn.haschildnodes ()) {var nodes = thisn.childNodes; var cn = document.createElement ("span"); UPOBJ.SetAttribute ("CN", CN); if (thisn.getattribute ("Open ")! = null) {UPOBJ.SetAttribute (" Open ", (" Open ") ==" True "); UPOBJ.GETATTRIBUTE (" CN "). style.display = updobj.getattribute (" ")")? "inline": "none"; if (! Upobj.getattribute ("open")) Upobj.all.tags ("img") [0] .src = "contract.gif";} for (i = 0; I <nodes.lend (cn.appendchild (CreateTree (Nodes [i ), SD 1))))); Nodeobj.Appendchild (CN);} else {updobj.all.tags ("img") [0] .SRC = "endnode.gif";} return nodeobj; }window.onload = inittree; </ script></p> <p><script> function clickHandle () {IF ((this.GetaTRibute ("href")! = null) && (this.getattribute ("httttribute (" http: // ")) {parent.maInframe.location. HREF = this.getattribute ("href");} // opens the connection at the mainframe window. }</p> <p>Function contextMenuHandle () {Event.ReturnValue = false; var Treeid = this.getattribute ("TreeID"); // Your code Here} </ script> </ head> <body> <xml id = menuxml> <? XML Version = "1.0" encoding = "gb2312"?> <Dstreeroot text = "System menu" open = "true" TreeId = "123"> <%</p> <p>SET RS = conn.execute ("SELECT (Select Count (*) from menu where menu.parentId = x.id and me.id in (select userlevel.Menuid from userlevel where userlevel.userid = 1)) as children, * from Menu as x where x.id in (Select Userlevel.Menuid from Userlevel WHERELEVEL.USERID = 1) ")") ") DO While Not Rs.EOF IF RS (" ParentID ") = 0 THEN Count = RS (" Children ")%> <Dstree text = "<% = rs (" content ")%>" href = "<% = rs (" link ")%>" open = "false" treid = "<% = rs (" id ")% > "> <% = 1 to count%> <dstree text = <% = rs (" content ")%>" href = "<% = RS (" link ")%>" Open = "False" Treeid = "<% = rs (" ID ")%>> </ dstree> <% rs.movenext next response.write (" </ dstree> ") loop</p> <p>rs.closeconn.closeset rs = nothingset conn = nothing%></p> <p></ Dstreeroot> </ xml> <table style = "Position: absolute; left: 0; Top: 0;> <TR> <TD ID = TreeBox Style =" Width: 400px; Height: 200px; Border: 1px Solid #cccccc; Padding: 5 3 3 5; "Valign = TOP> </ TD> </ tr> </ table> </ body> </ html></p></div><div class="text-center mt-3 text-grey"> 转载请注明原文地址:https://www.9cbs.com/read-122638.html</div><div class="plugin d-flex justify-content-center mt-3"></div><hr><div class="row"><div class="col-lg-12 text-muted mt-2"><i class="icon-tags mr-2"></i><span class="badge border border-secondary mr-2"><h2 class="h6 mb-0 small"><a class="text-secondary" href="tag-2.html">9cbs</a></h2></span></div></div></div></div><div class="card card-postlist border-white shadow"><div class="card-body"><div class="card-title"><div class="d-flex justify-content-between"><div><b>New Post</b>(<span class="posts">0</span>) </div><div></div></div></div><ul class="postlist list-unstyled"> </ul></div></div><div class="d-none threadlist"><input type="checkbox" name="modtid" value="122638" checked /></div></div></div></div></div><footer class="text-muted small bg-dark py-4 mt-3" id="footer"><div class="container"><div class="row"><div class="col">CopyRight © 2020 All Rights Reserved </div><div class="col text-right">Processed: <b>0.051</b>, SQL: <b>9</b></div></div></div></footer><script src="./lang/en-us/lang.js?2.2.0"></script><script src="view/js/jquery.min.js?2.2.0"></script><script src="view/js/popper.min.js?2.2.0"></script><script src="view/js/bootstrap.min.js?2.2.0"></script><script src="view/js/xiuno.js?2.2.0"></script><script src="view/js/bootstrap-plugin.js?2.2.0"></script><script src="view/js/async.min.js?2.2.0"></script><script src="view/js/form.js?2.2.0"></script><script> var debug = DEBUG = 0; var url_rewrite_on = 1; var url_path = './'; var forumarr = {"1":"Tech"}; var fid = 1; var uid = 0; var gid = 0; xn.options.water_image_url = 'view/img/water-small.png'; </script><script src="view/js/wellcms.js?2.2.0"></script><a class="scroll-to-top rounded" href="javascript:void(0);"><i class="icon-angle-up"></i></a><a class="scroll-to-bottom rounded" href="javascript:void(0);" style="display: inline;"><i class="icon-angle-down"></i></a></body></html><script> var forum_url = 'list-1.html'; var safe_token = 'N2lk8sw67LR9CYLGkwPjFierDCuXSqrRyKWZuwZ6L4mD_2BxKF_2Fiupf02OSje9hLBRuI2JS2UM_2FAQXGRgygA4hRA_3D_3D'; var body = $('body'); body.on('submit', '#form', function() { var jthis = $(this); var jsubmit = jthis.find('#submit'); jthis.reset(); jsubmit.button('loading'); var postdata = jthis.serializeObject(); $.xpost(jthis.attr('action'), postdata, function(code, message) { if(code == 0) { location.reload(); } else { $.alert(message); jsubmit.button('reset'); } }); return false; }); function resize_image() { var jmessagelist = $('div.message'); var first_width = jmessagelist.width(); jmessagelist.each(function() { var jdiv = $(this); var maxwidth = jdiv.attr('isfirst') ? first_width : jdiv.width(); var jmessage_width = Math.min(jdiv.width(), maxwidth); jdiv.find('img, embed, iframe, video').each(function() { var jimg = $(this); var img_width = this.org_width; var img_height = this.org_height; if(!img_width) { var img_width = jimg.attr('width'); var img_height = jimg.attr('height'); this.org_width = img_width; this.org_height = img_height; } if(img_width > jmessage_width) { if(this.tagName == 'IMG') { jimg.width(jmessage_width); jimg.css('height', 'auto'); jimg.css('cursor', 'pointer'); jimg.on('click', function() { }); } else { jimg.width(jmessage_width); var height = (img_height / img_width) * jimg.width(); jimg.height(height); } } }); }); } function resize_table() { $('div.message').each(function() { var jdiv = $(this); jdiv.find('table').addClass('table').wrap('<div class="table-responsive"></div>'); }); } $(function() { resize_image(); resize_table(); $(window).on('resize', resize_image); }); var jmessage = $('#message'); jmessage.on('focus', function() {if(jmessage.t) { clearTimeout(jmessage.t); jmessage.t = null; } jmessage.css('height', '6rem'); }); jmessage.on('blur', function() {jmessage.t = setTimeout(function() { jmessage.css('height', '2.5rem');}, 1000); }); $('#nav li[data-active="fid-1"]').addClass('active'); </script>