left.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:9k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%@ page import="org.jdom.*"%>
  3. <%@ page import="org.jdom.output.*"%>
  4. <%@ page import="org.jdom.input.*"%>
  5. <%@ page import="java.io.*"%>
  6. <%@ page import="java.net.URLEncoder"%>
  7. <html>
  8. <head>
  9. <title>菜单</title>
  10. <%@ include file="inc/nocache.jsp"%>
  11. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  12. <link rel="stylesheet" href="../common.css" type="text/css">
  13. <script language="javascript">
  14. <!--
  15. function openWin(url,width,height)
  16. {
  17.   var newwin = window.open(url,"_blank","toolbar=no,location=no,directories=no,status=no,menubar=no,top=50,left=120,width="+width+",height="+height);
  18. }
  19. // Example: obj = findObj("image1");
  20. function findObj(theObj, theDoc)
  21. {
  22.   var p, i, foundObj;
  23.   
  24.   if(!theDoc) theDoc = document;
  25.   if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  26.   {
  27.     theDoc = parent.frames[theObj.substring(p+1)].document;
  28.     theObj = theObj.substring(0,p);
  29.   }
  30.   if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  31.   for (i=0; !foundObj && i < theDoc.forms.length; i++) 
  32.     foundObj = theDoc.forms[i][theObj];
  33.   for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
  34.     foundObj = findObj(theObj,theDoc.layers[i].document);
  35.   if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  36.   
  37.   return foundObj;
  38. }
  39. function show(name)
  40. {
  41. var tableobj = findObj("boardof"+name);
  42. var imgobj = findObj("imgclass"+name);
  43. var eggobj = findObj("egg"+name);
  44. if (!tableobj || !imgobj)
  45. return;
  46. if (tableobj.style.display=="none")
  47. {
  48. tableobj.style.display = "";
  49. imgobj.src = "images/lefttree/open.gif";
  50. if (eggobj!=null)
  51. eggobj.src = "images/join.gif";
  52. }
  53. else
  54. {
  55. tableobj.style.display = "none";
  56. imgobj.src = "images/lefttree/fold.gif";
  57. if (eggobj!=null)
  58. eggobj.src = "images/folder.gif";
  59. }
  60. }
  61. //-->
  62. </script>
  63. <style type="text/css">
  64. <!--
  65. body {
  66. background-color: #016DAC;
  67. }
  68. -->
  69. </style></head>
  70. <body text="#000000" leftmargin="0"  rightmargin="0" topmargin="0">
  71. <IMG src="images/title_2.gif"> 
  72. <%@ include file="inc/inc.jsp"%>
  73. <jsp:useBean id="StrUtil" scope="page" class="cn.js.fan.util.StrUtil"/>
  74. <jsp:useBean id="privilege" scope="page" class="com.redmoon.forum.Privilege"/>
  75. <jsp:useBean id="struct" scope="page" class="com.redmoon.forum.Struct"/>
  76. <%
  77. String nick = privilege.getUser(request);
  78. if (nick.equals("")) {
  79. nick = "*"+System.currentTimeMillis();
  80. }
  81. %>
  82. <table id="mydir" name="mydir" style="cursor:hand" width="100%" border="0" cellspacing="0" cellpadding="0" onClick="show('mydir')">
  83.   <tr>
  84.     <td height="20"><img src="images/lefttree/fold.gif" width="18" height="16" align="absmiddle" id="imgclassmydir"><img src="images/lefttree/faverate.gif" width="16" height="16" align="absmiddle" >&nbsp;<font color="#FFFFFF">我的目录</font></td>
  85.   </tr>
  86. </table>
  87. <table id="boardofmydir" name="boardofmydir" style="display:none" width="100%" border="0" cellspacing="0" cellpadding="0">
  88.   <tr> 
  89.     <td width="25" style="padding-bottom:0; padding-top:0">&nbsp; </td>
  90.     <td height="18" style="padding-bottom:0; padding-top:0"><IMG src="images/line.gif" height=18 
  91.       border=0 align="absmiddle">&nbsp;<a href="myfavoriate.jsp" target="main" class="left">收&nbsp;&nbsp;藏&nbsp;&nbsp;夹</a> 
  92.     </td>
  93.   </tr>
  94.   <tr> 
  95.     <td width="25" style="padding-bottom:0; padding-top:0">&nbsp; </td>
  96.     <td height="18" style="padding-bottom:0; padding-top:0"><IMG src="images/line.gif" height=18 
  97.       border=0 align="absmiddle">&nbsp;<a href="myfriend.jsp" target="main" class="left">我的好友</a> </td>
  98.   </tr>
  99.   <tr> 
  100.     <td width="25" style="padding-bottom:0; padding-top:0">&nbsp;</td>
  101.     <td height="18" style="padding-bottom:0; padding-top:0"> <IMG src="images/line.gif" height=18 
  102.       border=0 align="absmiddle">&nbsp;<a href="mytopic.jsp?action=mytopic" target="main" class="left">发的贴子</a> 
  103.     </td>
  104.   </tr>
  105.   <tr> 
  106.     <td width="25" style="padding-bottom:0; padding-top:0">&nbsp; </td>
  107.     <td height="18" style="padding-bottom:0; padding-top:0"><IMG src="images/line.gif" height=18 
  108.       border=0 align="absmiddle">&nbsp;<a href="mytopic.jsp?action=myreply" target="main" class="left">参与贴子</a></td>
  109.   </tr>
  110.   <tr> 
  111.     <td width="25" style="padding-bottom:0; padding-top:0">&nbsp;</td>
  112.     <td height="18" style="padding-bottom:0; padding-top:0"> <IMG src="images/line.gif" height=18 
  113.       border=0 align="absmiddle">&nbsp;<a href="javascript:openWin('../message/message.jsp',320,260)" class="left">我的短信</a></td>
  114.   </tr>
  115. </table>
  116. <%
  117. Element root = struct.getRootElement(); //得到根元素
  118. java.util.List classlist = root.getChild("struct").getChildren();
  119. Iterator ir = classlist.iterator();
  120. String code = "", boardcode="", name="",description="",sort="",expire="";
  121. while (ir.hasNext())
  122. {
  123. Element myclass = (Element)ir.next(); //得到第i个field元素
  124. code = myclass.getAttribute("code").getValue();
  125. name = myclass.getAttribute("name").getValue();
  126. description = myclass.getAttribute("description").getValue();
  127. sort = myclass.getAttribute("sort").getValue();
  128. %>
  129. <table id="<%=code%>" style="cursor:hand;" name="<%=code%>" width="100%" border="0" cellpadding="0" cellspacing="0" onClick="show('<%=code%>')">
  130.   <tr>
  131.     <td height="18"> <img src="images/lefttree/fold.gif" width="18" height="16" align="absmiddle" id="imgclass<%=code%>"><IMG src="images/folder.gif" width="16" height="16" align="absmiddle" id="egg<%=code%>">&nbsp;<font color="#FFFFFF"><%=name%></font></td>
  132.   </tr>
  133. </table>
  134. <table id="boardof<%=code%>" style="display:none" name="boardof<%=code%>" width="100%" border="0" cellspacing="0" cellpadding="0">
  135.   <%if (code.equals("chat")) {%>
  136.   <tr> 
  137.     <td width="25" style="padding-bottom:0; padding-top:0">&nbsp;</td>
  138.     <td height="18" style="padding-bottom:0; padding-top:0"> <IMG src="images/line.gif" height=18 
  139.       border=0 align="absmiddle">&nbsp;<a href="../../rmforum/chat/chatservlet?mode=listroom&user=<%=nick%>" target="main" class="left"><font color="#FF9900">聊天广场</font></a></td>
  140.   </tr>
  141.   <%}%>
  142.   <%
  143. java.util.List boardlist = myclass.getChildren();
  144. Iterator ir1 = boardlist.iterator();
  145. int size = boardlist.size();
  146. int k = 0;
  147. while (ir1.hasNext())
  148. {
  149. Element board = (Element)ir1.next();
  150. k++;
  151. boardcode = board.getChild("code").getText();
  152. name = board.getChild("name").getText();
  153. description = board.getChild("description").getText();
  154. expire = board.getChild("expire").getText();
  155. %>
  156.   <tr> 
  157.     <td width=25 height="18" style="paddingTop:0;paddingBottom:0">&nbsp; </td>
  158.     <td height="18" style="paddingTop:0;paddingBottom:0"> 
  159. <% if (k!=size) { %> 
  160. <IMG src="images/line.gif" height=18 
  161.       border=0 align="absmiddle"> <% } else { %>
  162.    <IMG src="images/line.gif" height=18 
  163.       border=0 align="absmiddle">    <% } %> 
  164. <a href="listtopic.jsp?boardcode=<%=boardcode%>&boardname=<%=StrUtil.UrlEncode(name,"utf-8")%>" target="main" class="left"><%=name%></a> </td>
  165.   </tr>
  166.   <% } %>
  167.   <%if (code.equals("manage")) {%>
  168.   <tr> 
  169.     <td width="25" style="padding-bottom:0; padding-top:0">&nbsp;</td>
  170.     <td height="18" style="padding-bottom:0; padding-top:0"> <IMG src="images/line.gif" height=18 
  171.       border=0 align="absmiddle">&nbsp;<a href="../prison.jsp" target="main" class="left"><font color="#66CC33">社区监狱</font></a></td>
  172.   </tr>
  173.   <%}%></table>
  174.   
  175. <% } %>
  176. <script language="JavaScript1.2">
  177. <!--
  178. /**
  179. * Get cookie routine by Shelley Powers 
  180. * (shelley.powers@ne-dev.com)
  181. */
  182. function get_cookie(Name) {
  183. var search = Name + "="
  184. var returnvalue = "";
  185. if (document.cookie.length > 0) {
  186. offset = document.cookie.indexOf(search)
  187. // if cookie exists
  188. if (offset != -1) { 
  189. offset += search.length
  190. // set index of beginning of value
  191. end = document.cookie.indexOf(";", offset);
  192. // set index of end of cookie value
  193. if (end == -1) end = document.cookie.length;
  194. returnvalue=unescape(document.cookie.substring(offset, end))
  195. }
  196. }
  197. return returnvalue;
  198. }
  199. if (get_cookie(window.location.pathname) != ''){
  200. var openresults=get_cookie(window.location.pathname).split(" ")
  201. for (i=0 ; i < openresults.length ; i++){
  202. var obj = findObj(openresults[i]);
  203. if (!obj)
  204. continue;
  205. obj.style.display = "";
  206. var classcode = obj.id.substr(7,obj.id.length-7);
  207. var imgobj = findObj("imgclass"+classcode);
  208. var eggobj = findObj("egg"+classcode);
  209. if (imgobj) {
  210. imgobj.src = "images/lefttree/open.gif";
  211. if (eggobj)
  212. eggobj.src = "images/join.gif";
  213. }
  214. }
  215. }
  216. function check(){
  217. var ids ="",openones = "";
  218. var tables = document.all.tags("table");
  219. if (tables!=null)
  220. {
  221.     for (i=0; i<tables.length; i++) 
  222. {
  223. var tbl = tables[i];
  224. var tblid = tbl.id;
  225. var first6 = tblid.substr(0,7)
  226. var classcode = tblid.substr(7,tbl.id.length-7);
  227. if (first6=="boardof" && classcode!="")
  228. {
  229. if (tbl.style.display!="none")
  230. openones=openones + " " + tblid//利用cookie记录下呈打开状foldinglist的编号
  231. }
  232. }
  233. }
  234. else
  235. return;
  236. var expdate = new Date();
  237. var expday = 60
  238. expdate.setTime(expdate.getTime() +  (24 * 60 * 60 * 1000 * expday));
  239. document.cookie=window.location.pathname+"="+openones+" ;expires="+expdate.toGMTString();
  240. }
  241. if (document.all)
  242. document.body.onunload=check
  243. //-->
  244. </script>
  245. </body>
  246. </html>