欢迎光临
我们一直在努力

一个类msn space的case manage system-ASP教程,ASP应用

建站超值云服务器,限时71元/月

数据结构和add页面 就不写了看select救出来了

<vbscript”>%@language=”vbscript” codepage=”936″%>
<!–#include file=”connections/conn.asp” –>
<%
dim recordset1
dim recordset1_numrows

set recordset1 = server.createobject(“adodb.recordset”)
recordset1.activeconnection = mm_conn_string
recordset1.source = “select userid, username from dbo.[user]”
recordset1.cursortype = 0
recordset1.cursorlocation = 2
recordset1.locktype = 1
recordset1.open()

recordset1_numrows = 0
%>
<%
dim recordset2
dim recordset2_numrows

set recordset2 = server.createobject(“adodb.recordset”)
recordset2.activeconnection = mm_conn_string
recordset2.source = “select projectid, projectname from dbo.projectid”
recordset2.cursortype = 0
recordset2.cursorlocation = 2
recordset2.locktype = 1
recordset2.open()

recordset2_numrows = 0
%>
<%
set conninner = server.createobject(“adodb.connection”)
conninner.open mm_conn_string

function haschild(cid)
dim haschildid,sql,rs
haschildid=cint(cid)
sql=”select * from takelist where fid=”& haschildid
set rs=server.createobject(“adodb.recordset”)
rs.open sql,conninner,3,3
if not rs.eof then
haschild=true
else
haschild=false
end if
set rs=nothing
end function

function menunub(maid)
dim sql,rs,mnub
sql=”select fid from takelist where takelistid=”& maid
rs=conninner.execute(sql)
mnub=0
if not rs.eof then
mnub=menunub(rs(“fid”))+1
else
exit function
end if
set rs=nothing
menunub=cint(mnub)
end function

function get_style(level)
 if cint(level)=0 then
  get_style=””
 else
  get_style=”style=””display:none”””
 end if
end function

function get_pid(id)
dim rs,sql
sql=”select fid from takelist where takelistid=”&id
set rs=conninner.execute(sql)
if not rs.eof and not rs.bof then
get_pid=rs(“fid”)
else
get_pid=0
end if
set rs=nothing
end function

function get_level(id)
 dim rs,sql
 sql=”select fid from takelist where takelistid=”&id
 set rs=conninner.execute(sql)
 if not rs.eof and not rs.bof then
  level=get_level(rs(“fid”))+1
 else
  exit function
 end if
 set rs=nothing
 get_level=cint(level)
end function

function chk_next(id,level)
 dim rs,sql
 dim tempid
 tempid=id
 aid=id
 curlevel=get_level(tempid)

 for i=curlevel to level step -1
  tempid=get_pid(tempid)
 next
 for i=curlevel to level+1 step -1
  aid=get_pid(aid)
 next
 
 set rs=server.createobject(“adodb.recordset”)
 sql=”select * from takelist where fid=”&tempid&””
 rs.open sql,conninner,3,3
 wida=0
 if rs.recordcount>1 then
  
  rs.movelast
  if aid=rs(“takelistid”) then
   chk_next=false
  else
   chk_next=true
  end if
 else
  chk_next=false
 end if
 rs.close()
 set rs=nothing
end function

%>
<html>
<head>
<meta http-equiv=”content-type” content=”text/html; charset=gb2312″>
<title>takelist manage</title>
<script language=”javascript” type=”text/javascript”>
 function expandit(objdiv,objimg)
 {
  if (document.all.divs[objdiv].style.display==”none”)
   {document.all.divs[objdiv].style.display=””;
   objimg.src=”images/sub.gif”;
   }
  else{
   document.all.divs[objdiv].style.display=”none”;
   objimg.src=”images/plus.gif”;
   }
 }
 var hid=0
 function expandall(a,ba)
 {
  if(hid==0)
  {
  for(var i=0; i<document.all.divs.length;i++)
  {
   if(document.all.divs[i].fid==ba)
   {
    document.all.divs[i].style.display=”block”;    
    for(var j=0;j<document.all.divs.length;j++)
    {
     if(document.all.divs[j].md==document.all.divs[i].fid)
     {
     expandall(j,document.all.divs[j].fid)
     }
    }   
   } 
   
  } 
  hid=1
  }
  else
  {
  for(var i=0; i<document.all.divs.length;i++)
  {
   if(document.all.divs[i].fid==ba)
   {    
    document.all.divs[i].style.display=”none”;    
    for(var j=0;j<document.all.divs.length;j++)
    {
     if(document.all.divs[j].md==document.all.divs[i].fid)
     {
     expandall(j,document.all.divs[j].fid)
     }
    }   
   } 
   
  } 
  hid=0
  }
 }
 function closeall()
 {
 for(var i=0; i<document.all.divs.length;i++)
  {
  document.all.divs[i].style.display=”none”
  } 
 }
 function expandalla()
 {
 for(var i=0; i<document.all.divs.length;i++)
  {
  document.all.divs[i].style.display=”block”
  } 
 }
 function takesubmit()
 { 
  var url=”take_add.asp”;
  var f=document.createelement(“form”);
  f.action = url;
  f.method = “post”;
  f.id= “dosubmit”;
  f.style.display = “none”;
  var ct=document.createelement(“textarea”)
  ct.name=”cttime”
  ct.value=document.all.createtime.value
  f.appendchild(ct);
  var st=document.createelement(“textarea”)
  st.name=”sttime”
  st.value=document.all.starttime.value
  f.appendchild(st);
  var ft=document.createelement(“textarea”)
  ft.name=”fttime”
  ft.value=document.all.finishtime.value
  f.appendchild(ft);
  var tde=document.createelement(“textarea”)
  tde.name=”tdesc”
  tde.value=document.all.takedesc.value
  f.appendchild(tde);
  var ud=document.createelement(“textarea”)
  ud.name=”uid”
  ud.value=document.all.userid[0].value
  f.appendchild(ud);
  var tud=document.createelement(“textarea”)
  tud.name=”tuid”
  tud.value=document.all.userid[1].value
  f.appendchild(tud);
  var pd=document.createelement(“textarea”)
  pd.name=”projid”
  pd.value=document.all.projectid.value
  f.appendchild(pd);
  var fd=document.createelement(“textarea”)
  fd.name=”fid”
  fd.value=fidval;
  f.appendchild(fd);  
  var elf = document.body.appendchild(f);  
  elf.submit()
 } 
 var fidval
 function addtake(tid,pid)
 { 
  fidval=tid;
  if(tid==0)
  {
    for(var i=1;i<=loopnub;i++)
    {
    eval(” var hdin=innercontain”+innerc[i]+”; var inputhd=input”+innerc[i]+”;”)
    hdin.innerhtml=””;
    inputhd.style.display=”none”;    
    }
  input0.style.display=”block”;
  innercontain0.innerhtml=tempstr;
  projectinner.innerhtml=projstr;
  projecthd.style.display=”block”;
  canceldiv.innerhtml=”<input type=\”button\” onclick=\”innercontain0.innerhtml=\” value=\”取消\”>”
  alert(canceldiv.innerhtml)
  }
  else
  { 
   input0.style.display=”none”;
   innercontain0.innerhtml=””;
   if(pid!=0)
   {
   for(var i=1;i<=loopnub;i++)
    {
    eval(” var hdin=innercontain”+innerc[i]+”; var inputhd=input”+innerc[i]+”;”)
    hdin.innerhtml=””;
    inputhd.style.display=”none”;    
    }
    eval(“var inputer=input”+tid+”;var innercontainer=innercontain”+tid)
    inputer.style.display=”block”
    innercontainer.innerhtml=tempstr
    projectinner.innerhtml=”<input type=\”text\” name=\”projectid\” value=”+pid+”>”
    projecthd.style.display=”none”  
    canceldiv.innerhtml=”<input type=\”button\” onclick=\”innercontain”+tid+”.innerhtml=\” value=\”取消\”>”
    //alert(canceldiv.innerhtml) 
   }
   else
   {
    for(var i=1;i<=loopnub;i++)
    {
    eval(” var hdin=innercontain”+innerc[i]+”; var inputhd=input”+innerc[i]+”;”)
    hdin.innerhtml=””;
    inputhd.style.display=”none”;    
    }
    eval(“var inputer=input”+tid+”;var innercontainer=innercontain”+tid)
    inputer.style.display=”block”
    innercontainer.innerhtml=tempstr
    //fid.value=tid;
    projectinner.innerhtml=projstr
    projecthd.style.display=”block”
    canceldiv.innerhtml=”<input type=\”button\” onclick=\”innercontain”+tid+”.innerhtml=\” value=\”取消\”>”
    //alert(canceldiv.innerhtml)
   }     

  }
  
 }  
</script>
<style>
a
{
color:#000000;
text-decoration:none;
}

</style>
</head>

<body>
<table id=table border=”1″ cellspacing=”0″ cellpadding=”0″ style=”font-size:12px ” bordercolordark=”#0066cc”>
<tr><td width=”500″ onclick=”expandall()”>&nbsp;</td><td width=”50″ onclick=”closeall()”>完成与否</td><td width=”80″>创立时间</td><td width=”80″>下放时间</td><td width=”120″ onclick=”addtake(0,0)”>添加new takes</td></tr>
 <tr id=”input0″ style=”display:none”><td id=”innercontain0″ colspan=”6″></td></tr>
</table>
<%
  response.write(“<script language=javascript> var innerc=new array();”&vbcrlf&”</script>”)
innercn=0
divid=0
 call writecatalog(0,null) %>
<%

sub writecatalog(id,allcount)
  dim sql
  dim rs
  level=cint(get_level(id))

  set rs=server.createobject(“adodb.recordset”)
  sql=”select * from takelist where fid =”&id&” order by takelistid”
  rs.open sql,conninner,1,1
  do while not rs.eof
    loopid=0
 loopid=loopid+1 %>
<table id=table border=”1″ cellspacing=”0″ cellpadding=”0″ style=”font-size:12px; border-top-color:#ffffff” bordercolordark=”#0066cc”>
  <tr><%for i=1 to level %>
    <% if chk_next(rs(“takelistid”),i) then %>
    <td nowrap width=28>&nbsp;</td>
 <% else %>
 <td nowrap width=28>&nbsp;</td>
 <% end if %>
    <% next %>
 <% if loopid<>rs.recordcount then %>
 <td width=”28″>
 <% else %>
 <td width=28>
 <% end if %>
 <% if haschild(cint(rs(“takelistid”))) then %><a href=”#” onclick=”expandall(<%=get_pid(rs(“takelistid”))%>,<%=cint(rs(“takelistid”))%>)”>展</a><img id=img<%= rs(“takelistid”) %> src=”images/sub.gif” width=”16″ height=”16″ border=”0″ align=”absmiddle” style=”cursor:hand” onclick=”expandit(<%=divid%>,img<%= rs(“takelistid”) %>)”>
 <%
 loopid=loopid+1
  else %><img name=”” src=”images/sub.gif” width=”16″ height=”16″ alt=””><% end if %></td>
 <td width=”<%=500-30*get_level(cint(rs(“takelistid”)))%>”><a href=”#”><%=rs(“takedesc”)%></a></td>
 <td width=”50″><%
 if rs(“isfinished”)=0 then
 response.write(“未”)
 else
 response.write(“已”)
 end if
 %></a></td>
 <td width=”80″><%=rs(“createtime”)%></td>
 <td width=”80″><%=rs(“starttime”)%></td>
 <td width=”120″><a href=”#” onclick=”addtake(<%=rs(“takelistid”)%>,<%=rs(“fk_projectid”)%>)”>添加该类别下takes</a></td>
  </tr>
  <tr id=”input<%=rs(“takelistid”)%>” style=”display:none”><td id=”innercontain<%=rs(“takelistid”)%>”  colspan=”<%=6+get_level(rs(“takelistid”))%>”>
  <%
  innercn=innercn+1
  response.write(“<script language=javascript>”&vbcrlf&”innerc[“&innercn&”]=”&rs(“takelistid”)&”;”&vbcrlf&”</script>”)
  %>
  </td></tr>
</table>
<%
  if haschild(rs(“takelistid”)) then
  divid=divid+1
%>
<div id=divs md=<%=get_pid(rs(“takelistid”))%> fid=<%=rs(“takelistid”)%> style=”display:none”>
<%  call writecatalog(rs(“takelistid”),rs.recordcount) %>
</div>
<%  else
%>
<%  call writecatalog(rs(“takelistid”),rs.recordcount) %>
<%  end if %>
<%
   rs.movenext
 loop
 rs.close
 set rs=nothing
 end sub
%>

<div id=”addtk” align=”center” title=”takes add” lang=”zh” style=”position:absolute;left:350;top:290; width: 400px; height: 89px; display:none”>
<table border=”0″ width=”100%” cellspacing=”0″ cellpadding=”0″ height=”200″ bgcolor=”#999999″><tr> <td bgcolor=”#cccccc” style=”padding:4px” colspan=”2″ align=”center”>
<table width=”400″  border=”0″ cellpadding=”2″ cellspacing=”2″ bgcolor=”#cccccc”>
   <tr id=”projecthd” style=”display:block;”>
    <td align=”left”>&nbsp;</td>
    <td align=”left”>project</td>
    <td id=”projectinner” align=”left”>&nbsp;</td>
    <td align=”left”>&nbsp;</td>
  </tr>
  <tr>
    <td align=”left”>&nbsp;</td>
    <td align=”left”>create user</td>
    <td id=”createuserinner” align=”left”>&nbsp;</td>
    <td align=”left”>&nbsp;</td>
  </tr>
  <tr>
    <td align=”left”>&nbsp;</td>
    <td align=”left”>take user</td>
    <td id=”takeuserinner” align=”left”>&nbsp;</td>
    <td align=”left”>&nbsp;</td>
  </tr>
  <tr>
    <td align=”left”>&nbsp;</td>
    <td align=”left”>create time</td>
    <td align=”left”><input type=”text” size=”12″ name=”createtime” value=””><input type=”hidden” name=”fid” value=””></td>
    <td align=”left”>&nbsp;</td>
  </tr>
  <tr>
    <td align=”left”>&nbsp;</td>
    <td align=”left”>start time</td>
    <td align=”left”><input type=”text” size=”12″ name=”starttime”  value=””></td>
    <td align=”left”>&nbsp;</td>
  </tr>
  <tr>
    <td align=”left”>&nbsp;</td>
    <td align=”left”>finish time</td>
    <td align=”left”><input type=”text” size=”12″ name=”finishtime”  value=””></td>
    <td align=”left”>&nbsp;</td>
  </tr>
    <tr>
      <td align=”left” width=”68″>&nbsp;</td>
    <td align=”left” width=”121″>take description</td>
    <td align=”left”><textarea name=”takedesc” rows=”6″ cols=”28″ style=”border:0; “></textarea></td>
    <td align=”left”>&nbsp;</td>
    </tr>
     <tr>
      <td align=”left” width=”68″>&nbsp;</td>
    <td align=”left” width=”121″><input type=”button” onclick=”takesubmit()” value=”提交”></td>
    <td align=”left” id=”canceldiv”></td>
    <td align=”left”>&nbsp;</td>
    </tr>
</table></td>
          </tr></table></div>
<div id=projlist style=”display:none;”>
<%
response.write(“<select name=””projectid””>”)
do while not recordset2.eof
response.write(“<option value=”&recordset2(“projectid”)&”>”&recordset2(“projectname”)&”</option>”)
recordset2.movenext
loop
response.write(“</select>”)
%>
</div>
<div id=userlist style=”display:none”>
<%
response.write(“<select name=””userid””>”)
do while not recordset1.eof
response.write(“<option value=”&recordset1(“userid”)&”>”&recordset1(“username”)&”</option>”)
recordset1.movenext
loop
response.write(“</select>”)
%>
</div>
<%
  response.write(“<script language=javascript> var loopnub=”&innercn&”</script>”)
%>
<script>
  document.getelementbyid(“createuserinner”).innerhtml=document.getelementbyid(“userlist”).innerhtml
  document.getelementbyid(“takeuserinner”).innerhtml=document.getelementbyid(“userlist”).innerhtml
  var tempstr=document.getelementbyid(“addtk”).innerhtml
  document.getelementbyid(“addtk”).innerhtml=””
  var projstr=document.getelementbyid(“projlist”).innerhtml
  document.getelementbyid(“projlist”).innerhtml=””
</script>
</body>
</html>

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 一个类msn space的case manage system-ASP教程,ASP应用
分享到: 更多 (0)