主题:[讨论]php做类似windows资源管理器的web文件管理器
jaychen1986
[专家分:0] 发布于 2006-10-29 16:16:00
各位大虾:
帮帮小弟的忙啦,题目是:php做类似windows资源管理器的web文件管理器,那这个树形怎么弄啊,高分奉送哦!!!
回复列表 (共9个回复)
沙发
longlong16 [专家分:10670] 发布于 2006-10-30 09:30:00
如果纯粹是做树状目录一般是用js写的
板凳
jaychen1986 [专家分:0] 发布于 2006-11-01 14:06:00
不是纯粹的树状,就是类似的也可以。
3 楼
一个人住 [专家分:3290] 发布于 2006-11-14 22:34:00
把下面两个文件复制下来就可以看到效果了!
HTML 文件代码
inde.html
<SCRIPT language=javascript src="Menu.js"></SCRIPT>
<body class="left" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div style=width:100%;height:100%;OVERFLOW:auto>
<SCRIPT language=javascript>
var yuzimenu=new menutree('yuzimenu','main')
yuzimenu.addNode('测试','Default.asp')
yuzimenu.addFolder('我的工具箱')
yuzimenu.addFolder('控制面板','usercp.asp',false)
yuzimenu.addNode('资料修改','EditProfile.asp')
yuzimenu.addNode('密码修改','EditProfile.asp?menu=pass')
yuzimenu.addNode('个性设置','MySettings.asp')
yuzimenu.addNode('附件管理','MyAttachment.asp')
yuzimenu.addNode('短信服务','message.asp')
yuzimenu.addNode('好友列表','Friend.asp')
yuzimenu.endFolder()
yuzimenu.addFolder('个人服务')
yuzimenu.addNode('我的资料','Profile.asp?UserName=<%=CookieUserName%>')
yuzimenu.addNode('上传头像','upface.asp')
yuzimenu.addNode('上传照片','upphoto.asp')
yuzimenu.addNode('社区日志','calendar.asp')
yuzimenu.addNode('我的日志','blog.asp?UserName=<%=CookieUserName%>')
yuzimenu.addNode('更改用户','login.asp')
yuzimenu.endFolder()
yuzimenu.addFolder('收 藏 夹')
yuzimenu.addNode('帖子收藏夹','MyFavorites.asp?menu=Topic')
yuzimenu.addNode('论坛收藏夹','MyFavorites.asp?menu=Forum')
yuzimenu.addNode('网站收藏夹','MyFavorites.asp')
yuzimenu.endFolder()
yuzimenu.endFolder()
yuzimenu.addFolder('帖子状态')
yuzimenu.addNode('最新帖子','ShowBBS.asp')
yuzimenu.addNode('人气帖子','ShowBBS.asp?menu=1')
yuzimenu.addNode('热门帖子','ShowBBS.asp?menu=2')
yuzimenu.addNode('精华帖子','ShowBBS.asp?menu=3')
yuzimenu.addNode('投票帖子','ShowBBS.asp?menu=4')
yuzimenu.addNode('我的帖子','ShowBBS.asp?menu=5&UserName=<%=CookieUserName%>')
yuzimenu.endFolder()
yuzimenu.addFolder('论坛状态')
yuzimenu.addNode('在线情况','online.asp')
yuzimenu.addNode('在线图例','online.asp?menu=cutline')
yuzimenu.addNode('性别图例','online.asp?menu=UserSex')
yuzimenu.addNode('今日图例','online.asp?menu=TodayPage')
yuzimenu.addNode('主题图例','online.asp?menu=board')
yuzimenu.addNode('帖子图例','online.asp?menu=ForumPosts')
yuzimenu.addNode('会员列表','usertop.asp')
yuzimenu.addNode('管理团队','adminlist.asp')
yuzimenu.addNode('申请论坛','ApplyForum.asp')
yuzimenu.endFolder()
yuzimenu.addFolder('个人状态')
yuzimenu.addNode('在线','cookies.asp?menu=online')
yuzimenu.addNode('隐身','cookies.asp?menu=eremite')
yuzimenu.endFolder()
yuzimenu.init()
top.document.title=" - Powered By BBSXP";
</SCRIPT>
</div>
</body>
4 楼
一个人住 [专家分:3290] 发布于 2006-11-14 22:34:00
Menu.js
var icon=["images/expand.gif","images/collapse.gif","images/node.gif"]
for(i=0;i<icon.length;i++){
var tem=new Image()
tem.src=icon[i]
}
function menutree(obj,target,check){
this.obj=obj;
this.target=target
this.child=0
this.node=0
this.msg=[]
this.showCheck=check
this.html="<table id='deeptree' onselectstart='return false' cellspacing=0 cellpadding=0 border=0>"
}
menutree.prototype.addFolder=function(txt,link,show){
this.msg[this.node]=[txt,link?link:'']
this.html+="<tr><td class='node'><nobr> <img src='"+(show?icon[1]:icon[0])+"' id='img"+this.child+"' border=0 align='absmiddle' onclick='"+this.obj+".expand("+this.child+")'><input type='checkbox' name='treeFolder' onclick='"+this.obj+".checkAll(this,"+this.child+")' style='display:"+(this.showCheck?'':'none')+"'><span onmouseover='doOver(this)' onmouseout='doOut(this)' onmousedown='"+this.obj+".Light(this,"+this.node+");"+this.obj+".expand("+this.child+")' title='"+txt+"'>"+txt+"</span></nobr></td></tr><tr id='child"+this.child+"' style='display:"+(show?'':'none')+"'><td class='node'>"
this.html+="<table cellspacing=0 cellpadding=0 border=0 style='margin-left:18;'>"
this.child++
this.node++;
}
menutree.prototype.addNode=function(txt,link){
this.msg[this.node]=[txt,link?link:'']
this.html+="<tr><td class='node'><nobr> <img src='"+icon[2]+"' align='absmiddle' onclick='"+this.obj+".Light(this.nextSibling.nextSibling,"+this.node+")'><input type='checkbox' name='treeNode' onclick='"+this.obj+".parentCheck(this)' style='display:"+(this.showCheck?'':'none')+"'><span onmouseover='doOver(this)' onmouseout='doOut(this)' onmousedown='"+this.obj+".Light(this,"+this.node+")' title='"+txt+"'>"+txt+"</span></nobr></td></tr>"
this.node++;
}
menutree.prototype.endFolder=function(){
this.html+="</table></td></tr>"
}
menutree.prototype.expand=function(childNum,flag){
var isExpand=document.getElementById("child"+childNum).style.display
document.getElementById("img"+childNum).src=isExpand=='none'?icon[1]:icon[0]
document.getElementById("child"+childNum).style.display=isExpand=='none'?'':'none'
}
menutree.prototype.expandAll=function(flag){
if(this.child>0)
for(i=0;i<this.child;i++){
document.getElementById("img"+i).src=flag?icon[1]:icon[0]
document.getElementById("child"+i).style.display=flag?'':'none'
}
}
menutree.prototype.checkAll=function(obj,childNum){
obj.blur()
var child=document.getElementById("child"+childNum)
var node=child.getElementsByTagName("INPUT")
for(i=0;i<node.length;i++)node[i].checked=obj.checked
this.parentCheck(obj)
}
menutree.prototype.parentCheck=function(obj){
obj.blur()
for(i=this.child-1;i>=0;i--){
var checkParent=true
var c=document.getElementById("child"+i)
var node=c.getElementsByTagName("INPUT")
for(j=0;j<node.length;j++)if(!node[j].checked)checkParent=false
document.getElementById("img"+i).nextSibling.checked=checkParent
}
}
menutree.prototype.getCheckedValue=function(){
var value=[]
var node=document.getElementById('deeptree').getElementsByTagName("INPUT")
for(i=0;i<node.length;i++)if(node[i].checked&&node[i].name=="treeNode")value[value.length]=this.msg[i][0]
return value
}
menutree.prototype.init=function(){
this.html+=(this.node>0?"":"<tr><td>暂时没有数据</td></tr>")+"</table>"
document.write(this.html)
}
var tem=null
function doOver(o){
o.className='NodeOver'
}
function doOut(o){
o.className=(tem==o?'NodeFocus':'')
}
menutree.prototype.Light=function(o,nodeNum){
if(!tem)tem=o
tem.className=''
o.className='NodeFocus'
tem=o
if(this.msg[nodeNum][1])window.open(this.msg[nodeNum][1],this.target);
}
5 楼
jaychen1986 [专家分:0] 发布于 2006-11-15 15:28:00
谢谢,效果是有了,但是图片是一把叉
6 楼
一个人住 [专家分:3290] 发布于 2006-11-15 19:13:00
大哥,你要我怎么把图片上传???你只要把图片路径把一下就行了。
Menu.js
var icon=["images/expand.gif","images/collapse.gif","images/node.gif"]
上面就是这三个图片的文件名,你只要改一上,就可以换上自已喜欢的图片
7 楼
jaychen1986 [专家分:0] 发布于 2006-11-17 14:38:00
呵呵,对非php的东西不熟悉啊,谢谢啊,分数不能给你加了,我还有一个问题就是我想和数据库动态连接,你能帮帮我吗?
8 楼
wxtk [专家分:30] 发布于 2006-11-18 20:32:00
学习,学习!
9 楼
一个人住 [专家分:3290] 发布于 2006-11-18 21:05:00
大概是这样,我只写了出来,但没有调试,你试一试吧!
下面的文件名是left.php
<?
Mysql_connect("localhost","root","");
Mysql_select_db("left");
?>
<SCRIPT language=javascript src="Menu.js"></SCRIPT>
<body class="left" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div style=width:100%;height:100%;OVERFLOW:auto>
<SCRIPT language=javascript>
var jasonmenu=new menutree('jasonmenu','main')
<?php
$sql="select * from message where id1= 1 order by idx id";
$records=Mysql_query($sql);
While(list($subject,$mess,$idx)=Mysql_fetch_row($records))
{
echo "jasonmenu.addFolder('".$message1."','".$url1."')";
$sql="select * from message where id2= 2 order by idx id";
$records=Mysql_query($sql);
While(list($subject,$mess,$idx)=Mysql_fetch_row($records))
{
echo "jasonmenu.addFolder('".$message2."','".$url2."')";
$sql="select * from message where id3= 3 order by idx id";
$records=Mysql_query($sql);
While(list($subject,$mess,$idx)=Mysql_fetch_row($records))
{
echo "jasonmenu.addNode('".$message3."','".$url3."')";
}
echo "jasonmenu.endFolder()";
}
echo "jasonmenu.endFolder()";
}
echo "jasonmenu.endFolder()";
?>
jasonmenu.init()
</SCRIPT>
</div>
</body>
我来回复