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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8"%>
  2. <%@ page import="cn.js.fan.util.*"%>
  3. <%@ page import="cn.js.fan.db.*"%>
  4. <%@ page import="java.util.*"%>
  5. <%@ page import="cn.js.fan.web.*"%>
  6. <%@ page import="com.redmoon.oa.task.*"%>
  7. <%@ page import="com.redmoon.oa.person.*"%>
  8. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  9. <HTML><HEAD><TITLE>显示任务</TITLE>
  10. <META http-equiv=Content-Type content=text/html; charset=utf-8 charset=utf-8>
  11. <LINK href="common.css" rel=stylesheet>
  12. <%@ include file="inc/nocache.jsp"%>
  13. <jsp:useBean id="fchar" scope="page" class="cn.js.fan.util.StrUtil"/>
  14. <%
  15. String querystring = fchar.getNullString(request.getQueryString());
  16. String privurl=request.getRequestURL()+"?"+java.net.URLEncoder.encode(querystring,"GBK");
  17. %>
  18. <SCRIPT language=JavaScript>
  19. <!--
  20. function checkclick(msg)
  21. {
  22. if(confirm(msg))
  23. {
  24. event.returnValue=true;
  25. }
  26. else
  27. {
  28. event.returnValue=false;
  29. }
  30. }
  31. function SymError()
  32. {
  33.   return true;
  34. }
  35. window.onerror = SymError;
  36. function openWin(url,width,height)
  37. {
  38.   var newwin=window.open(url,"_blank","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=50,left=120,width="+width+",height="+height);
  39. }
  40. function changefinish(obj,id,isfinish)
  41. {
  42. location.href="task_finish.jsp?isfinish="+isfinish+"&taskid="+id;
  43. }
  44. function OfficeOperate() {
  45. alert(redmoonoffice.ReturnMessage.substr(0, 4));
  46. }
  47. // 编辑文件
  48. function editdoc(id, attachId)
  49. {
  50. rmofficeTable.style.display = "";
  51. redmoonoffice.AddField("taskId", id);
  52. redmoonoffice.AddField("attachId", attachId);
  53. redmoonoffice.Open("<%=Global.getRootPath()%>/task_getfile.jsp?taskId=" + id + "&attachId=" + attachId);
  54. }
  55. //-->
  56. </SCRIPT>
  57. <SCRIPT language=JavaScript src="forum/images/nereidFade.js"></SCRIPT>
  58. <SCRIPT>
  59. function checkclick(msg){if(confirm(msg)){event.returnValue=true;}else{event.returnValue=false;}}
  60. function copyText(obj) {var rng = document.body.createTextRange();rng.moveToElementText(obj);rng.select();rng.execCommand('Copy');}
  61. var i=0;
  62. function formCheck(){i++;if (i>1) {document.form.submit1.disabled = true;}return true;}
  63. function presskey(eventobject){if(event.ctrlKey && window.event.keyCode==13){i++;if (i>1) {alert('帖子发送中,请耐心等待!');return false;}this.document.form.submit();}}
  64. </SCRIPT>
  65. <META content="MSHTML 6.00.2800.1126" name=GENERATOR></HEAD>
  66. <BODY text=#000000 bgColor=#ffffff leftMargin=0 topMargin=5 marginheight="0" marginwidth="0">
  67. <%@ include file="task_inc_menu_top.jsp"%>
  68. <br>
  69. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  70. <jsp:useBean id="userservice" scope="page" class="com.redmoon.oa.person.UserService"/>
  71. <%
  72. int rootid = ParamUtil.getInt(request, "rootid");
  73. String strshowid = ParamUtil.get(request, "showid");
  74. int showid = -1;
  75. if (!strshowid.equals(""))
  76. showid = Integer.parseInt(strshowid);
  77. String priv="read";
  78. if (!privilege.isUserPrivValid(request,priv))
  79. {
  80. out.println(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  81. return;
  82. }
  83. String myname = privilege.getUser(request);
  84. if (showid==-1)
  85. showid = rootid;
  86. int islocked = 0;
  87. TaskDb showTask = new TaskDb();
  88. showTask = showTask.getTaskDb(showid);
  89. if (showTask==null || !showTask.isLoaded()) {
  90. out.print(SkinUtil.makeErrMsg(request, "该任务已不存在!"));
  91. return;
  92. }
  93. String sql = "";
  94. String title="",mydate="",content="",initiator="",showtitle="",filename="",extname="",person="";
  95. int id;
  96. int orders = 1,type=0;
  97. int pagesize = 10;
  98. int isfinish = 0;
  99. int expression = 1;
  100. int thisrootid = -1;// 这个任务项的rootid
  101. id = showTask.getId();
  102. content = showTask.getContent();
  103. initiator = showTask.getInitiator();
  104. mydate = DateUtil.format(showTask.getMyDate(), "yyyy-MM-dd HH:mm:ss");
  105. title = showTask.getTitle();
  106. showtitle = title;
  107. orders = showTask.getOrders();
  108. type = showTask.getType();
  109. isfinish = showTask.getStatus();
  110. expression = showTask.getExpression();
  111. filename = showTask.getFileName();
  112. extname = showTask.getExt();
  113. person = showTask.getPerson();
  114. thisrootid = showTask.getRootId();
  115. %>
  116. <TABLE borderColor=#d3d3d3 cellSpacing=0 cellPadding=0 width="98%" align=center 
  117. border=0>
  118.   <TBODY>
  119.   <TR bgColor=#c4d4e5>
  120.     <TD bgColor=#C4DAFF height=25><TABLE width="100%" class="right-title">
  121.           <TBODY>
  122.             <TR> 
  123.               <TD> 
  124.                 <%if (expression!=0) { %>
  125.                 <img align="absmiddle" src="forum/images/emot/em<%=expression%>.gif" border=0> 
  126.                 <%}%>
  127.                 <b>标题:</b> <%=fchar.toHtml(title)%></TD>
  128.               <TD width="37%" align=left> 
  129.                 <%
  130.   boolean isinitiator = myname.equals(initiator)?true:false;//是否为发起人
  131.   boolean isperson = myname.equals(person)?true:false;//是否为承办人
  132.   boolean cannewtask = privilege.isUserPrivValid(request,"task");//是否能发起任务
  133.   %>
  134.               <%if (type==TaskDb.TYPE_TASK && isfinish!=TaskDb.STATUS_DISCARD) { %>
  135.                 <%if (isperson && showTask.getParentId()!=TaskDb.NOPARENT) {%>
  136. <img src=images/task/icon-result.gif align="absmiddle">&nbsp;<a href="task_add.jsp?op=addresult&person=<%=StrUtil.UrlEncode(person)%>&parentid=<%=id%>&privurl=<%=privurl%>" class="title_white">汇报办理结果</a> 
  137.                 <%}%>
  138.                 <%if (isinitiator && showTask.getParentId()!=TaskDb.NOPARENT) {%>
  139. <img src=images/task/icon-hurry.gif align="absmiddle">&nbsp;<a href="task_add.jsp?op=hurry&person=<%=StrUtil.UrlEncode(person)%>&parentid=<%=id%>&privurl=<%=privurl%>" class="title_white">催办</a> 
  140.                 <%}%>
  141. <%if (showTask.getParentId()!=TaskDb.NOPARENT) {%>
  142. <%if (isperson && cannewtask) {%>
  143. <img src=images/task/icon-subtask.gif align="absmiddle">&nbsp;<a href="task_add.jsp?op=newsubtask&parentid=<%=id%>&privurl=<%=privurl%>" class="title_white">分配子任务</a>
  144. <%}%>
  145. <%}else{%>
  146. <%if (isinitiator && showTask.getStatus()==TaskDb.STATUS_NOTFINISHED) {%>
  147. <img src=images/task/icon-subtask.gif align="absmiddle">&nbsp;<a href="task_add.jsp?op=newsubtask&parentid=<%=id%>&privurl=<%=privurl%>" class="title_white">分配任务</a>
  148. <%}%>
  149. <%}%>
  150.               <%}%>
  151.               <%if (type==TaskDb.TYPE_SUBTASK && isfinish!=TaskDb.STATUS_DISCARD) { %>
  152.   <%if (isperson) {%>
  153.   <img src=images/task/icon-result.gif align="absmiddle">&nbsp;<a href="task_add.jsp?op=addresult&person=<%=StrUtil.UrlEncode(person)%>&parentid=<%=id%>&privurl=<%=privurl%>" class="title_white">汇报办理结果</a> 
  154.   <%}%>
  155.   <%if (isinitiator) {%>
  156.   <img src=images/task/icon-hurry.gif align="absmiddle">&nbsp;<a href="task_add.jsp?op=hurry&person=<%=StrUtil.UrlEncode(person)%>&parentid=<%=id%>&privurl=<%=privurl%>" class="title_white">催办</a> 
  157.   <%}%>
  158.   <%if (isperson && cannewtask) {%>
  159.   <img src=images/task/icon-subtask.gif align="absmiddle">&nbsp;<a href="task_add.jsp?op=newsubtask&parentid=<%=id%>&privurl=<%=privurl%>" class="title_white">分配子任务</a> 
  160.   <%}%>
  161.               <%}%>
  162.               <%if (type==TaskDb.TYPE_HURRY && isfinish!=TaskDb.STATUS_DISCARD) { //催办%>
  163.   <%if (isperson) {%>
  164.   <img src=images/task/icon-result.gif align="absmiddle">&nbsp;<a href="task_add.jsp?op=addresult&person=<%=StrUtil.UrlEncode(person)%>&parentid=<%=id%>&privurl=<%=privurl%>" class="title_white">汇报办理结果</a> 
  165.   <%}%>
  166.               <%}%></TD>
  167.             </TR>
  168.           </TBODY>
  169.         </TABLE> </TD>
  170. </TR></TBODY></TABLE>
  171.   <table bordercolor=#d3d3d3 cellspacing=0 cellpadding=0 width="98%" align=center 
  172. border=0>
  173.   <tbody> 
  174.   <tr> 
  175.     <td valign=top align=left height=78> 
  176.       <table cellspacing=0 cellpadding=3 width="100%" border=0>
  177.           <tbody>
  178.             <tr bgcolor=#ffffff> 
  179.               <td valign=top align=left height=106> <table style="WORD-BREAK: break-all" 
  180.             height="100%" cellspacing=0 cellpadding=0 width="99%" border=0>
  181.                   <tbody>
  182.                     <tr height=20> 
  183.                       <td width="79%" colspan="3"> <a name=#content<%=id%>></a> 
  184.                         <img src="forum/images/posttime.gif" border=0> 发布时间:<span title="<%=mydate%>"><%=mydate%></span> &nbsp;<!--[<a href="#<%=id%>">任务树中位置</a>]-->
  185. <% if (isinitiator) {%> 
  186.                         &nbsp;&nbsp;[<a href="task_edit.jsp?privurl=<%=privurl%>&editid=<%=id%>">编辑</a>]
  187. &nbsp;
  188. [<a onClick="checkclick('您确定要删除吗?')" href="task_del.jsp?delid=<%=id%>&rootid=<%=rootid%>">
  189.                         删除</a>]<%}%>
  190. <%if (type==0 || type==1) {%>
  191. <input type="checkbox" name="isfinish" value="1"
  192. <%if(isfinish==TaskDb.STATUS_FINISHED){%>checked<%}%> onClick="changefinish(this,'<%=id%>','<%=TaskDb.STATUS_FINISHED%>')">
  193. 完成 
  194. <input type="checkbox" name="isfinish2" value="0"
  195. <%if(isfinish==TaskDb.STATUS_NOTFINISHED){%>checked<%}%> onClick="changefinish(this,'<%=id%>','<%=TaskDb.STATUS_NOTFINISHED%>')">
  196. 未完成 
  197. <input type="checkbox" name="isfinish3" value="2"
  198. <%if(isfinish==TaskDb.STATUS_DISCARD){%>checked<%}%> onClick="changefinish(this,'<%=id%>','<%=TaskDb.STATUS_DISCARD%>')">
  199. 作废
  200. <%}%> </td>
  201.                     </tr>
  202.                     <tr height=8> 
  203.                       <td colspan="3"> <hr width="100%" color=#777777 size=1>                      </td>
  204.                     </tr>
  205.                     <tr valign=top> 
  206.                       <td height="78" colspan="3"> <span id="topiccontent" name="topiccontent"> 
  207.                 <%
  208. if (thisrootid==-1 && !(initiator.equals(myname) || person.equals(myname)))//如果是根任务
  209. out.print("&nbsp;&nbsp;............");
  210. else {
  211. // content = fchar.toHtml(content);
  212. // out.println(fchar.ubb(content,true)); // 会使插入的表情出问题
  213. out.print(content);
  214. }
  215. %>
  216.                         </span> </td>
  217.                     </tr>
  218.                     <tr valign=top> 
  219.                       <td height="13" colspan="3"> 
  220.                         <hr width="100%" color=#777777 size=1>                      </td>
  221.                     </tr>
  222.                     <tr valign=top height=15>
  223.                       <td colspan="3">发起人:<%=initiator%> &nbsp;&nbsp;&nbsp;&nbsp;
  224.   <%if (showTask.getParentId()!=-1) {%>
  225.   承办人:<%=person%> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  226.   <%}else{%>
  227.   根任务
  228.   <%}%>
  229.   &nbsp;&nbsp;发起时间:<%=mydate%></td>
  230.                     </tr>
  231.                     <tr valign=top height=15>
  232.                       <td colspan="3">附件:
  233.                         <%
  234.   java.util.Iterator attir = showTask.getAttachments().iterator();
  235.   while (attir.hasNext()) {
  236.    Attachment att = (Attachment)attir.next();
  237. String ext = StrUtil.getFileExt(att.getDiskName());
  238.   %>
  239.                          <div style="height:30px"><img src="images/attach.gif" align="absmiddle"><a target="_blank" href="task_getfile.jsp?taskId=<%=showTask.getId()%>&attachId=<%=att.getId()%>"><%=att.getName()%></a>&nbsp;&nbsp;
  240.  <!--
  241.  <%if (ext.equals("doc") || ext.equals("xls")) {%>
  242. <a href="javascript:editdoc('<%=showTask.getId()%>', '<%=att.getId()%>')" title="编辑Office文件"><img src="netdisk/images/btn_edit_office.gif" width="16" height="16" border="0" align="absmiddle"></a>
  243.  <%}%>
  244.  -->
  245.  </div>
  246.                       <%}%>
  247.   <table id="rmofficeTable" name="rmofficeTable" style="display:none" width="29%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  248.             <tr>
  249.               <td height="22" align="center" bgcolor="#E3E3E3"><strong>&nbsp;编辑Office文件</strong></td>
  250.             </tr>
  251.             <tr>
  252.               <td align="center" bgcolor="#FFFFFF"><object id="redmoonoffice" classid="CLSID:D01B1EDF-E803-46FB-B4DC-90F585BC7EEE" 
  253. codebase="<%=request.getContextPath()%>/activex/rmoffice.cab#version=2,0,0,1" width="316" height="43" viewastext="viewastext">
  254.                   <param name="Encode" value="utf-8" />
  255.                   <param name="BackColor" value="0000ff00" />
  256.                   <param name="Server" value="<%=Global.server%>" />
  257.                   <param name="Port" value="<%=Global.port%>" />
  258.                   <!--设置是否自动上传-->
  259.                   <param name="isAutoUpload" value="1" />
  260.                   <!--设置文件大小不超过1M-->
  261.                   <param name="MaxSize" value="1024000" />
  262.                   <!--设置自动上传前出现提示对话框-->
  263.                   <param name="isConfirmUpload" value="1" />
  264.                   <!--设置IE状态栏是否显示信息-->
  265.                   <param name="isShowStatus" value="0" />
  266.                   <param name="PostScript" value="<%=Global.virtualPath%>/task_office_upload.jsp" />
  267.                 </object>
  268.                   <!--<input name="remsg" type="button" onclick='alert(redmoonoffice.ReturnMessage)' value="查看上传后的返回信息" />--></td>
  269.             </tr>
  270.           </table>   
  271.   </td>
  272.                     </tr>
  273.                   </tbody>
  274.                 </table></td>
  275.             </tr>
  276.           </tbody>
  277.         </table>
  278.     </td>
  279.   </tr>
  280.   </tbody>
  281. </table>
  282. <%
  283. sql = "select id from task where rootid="+rootid+" ORDER BY orders";
  284. ListResult lr = showTask.listResult(sql);
  285. int layer = 1;
  286. int i = 1;
  287. boolean isshow = false;
  288. int showlayer = 0;
  289. Iterator ir = lr.getResult().iterator();
  290. if (ir.hasNext()) {
  291. // 写根任务
  292. TaskDb td = (TaskDb)ir.next();
  293. id = td.getId();
  294. title = td.getTitle();
  295. type = td.getType();
  296. expression = td.getExpression();
  297. initiator = td.getInitiator();
  298. person = td.getPerson();
  299. layer = td.getLayer();
  300. isfinish = td.getStatus();
  301. if (initiator.equals(myname) || person.equals(myname))
  302. {
  303. isshow = true;
  304. showlayer = layer;
  305. }
  306. %>
  307. <table bordercolor=#edeced cellspacing=0 cellpadding=1 width="98%" align=center border=1>
  308.   <tbody> 
  309.   <tr> 
  310.     <td noWrap align=left bgcolor=#f8f8f8 height="21" width="3%"><img alt=在新窗口中浏览 src="forum/images/1.gif" 
  311. border=0> </td>
  312.       <td noWrap align=left bgcolor=#f8f8f8 height="21" width="97%"> <a name=#<%=id%>></a> 
  313.         <%if (isfinish==1) {%>
  314.         <img src="images/task/icon-yes.gif"> 
  315.         <%}else if (isfinish==0){%>
  316.         <img src="images/task/icon-notyet.gif"> 
  317.         <%}else {%>
  318.         <img src="images/task/icon-no.gif"> 
  319.         <%}%>
  320.         <%
  321.   if (isshow)
  322.   {
  323.   if (type==0)
  324. out.println("<img src=images/task/icon-task.gif>");
  325.   else if (type==1)
  326. out.println("<img src=images/task/icon-subtask.gif>");
  327.   else if (type==2)
  328. out.println("<img src=images/task/icon-result.gif>");
  329.   else if (type==3)
  330. out.println("<img src=images/task/icon-hurry.gif>");
  331.   else
  332. out.println("<img src=images/task/icon-task.gif>");
  333.   %>
  334.   <%if (expression!=0) { %>
  335.   <img align="absmiddle" src="forum/images/emot/em<%=expression%>.gif" border=0>
  336.   <%}%>
  337. <% if (id!=showid) { %>
  338. <a href="task_show.jsp?rootid=<%=rootid%>&showid=<%=id%>"><%=title%></a> 
  339. <% } else { %>
  340. <font color=red><%=title%></font>
  341. <% }
  342. }else {%> 
  343. ............
  344. <%}%>
  345.       </td>
  346.   </tr>
  347.   </tbody> 
  348. </table>
  349. <%
  350. }
  351. while (ir.hasNext())
  352. {
  353.   i++;
  354.   TaskDb td = (TaskDb)ir.next();
  355.   id = td.getId();
  356.   TaskDb parentTd = td.getTaskDb(td.getParentId());
  357.   layer = td.getLayer();
  358.   initiator = td.getInitiator();
  359.   mydate = DateUtil.format(td.getMyDate(), "yyyy-MM-dd");
  360.   title = td.getTitle();
  361.   type = td.getType();
  362.   isfinish = td.getStatus();
  363.   expression = td.getExpression();
  364.     person = td.getPerson();
  365.   if (isshow)
  366.   {
  367.    if (layer<=showlayer)
  368. isshow = false;
  369.   }
  370.   if (initiator.equals(myname) || person.equals(myname) || myname.equals(parentTd.getInitiator()))// 可以看到所属的分支
  371.   {
  372.      isshow = true;
  373.   showlayer = layer;
  374.   }
  375.   %>
  376. <table cellspacing=0 cellpadding=0 width="98%" align=center border=0 bgcolor=#f8f8f8 style="padding:0; margin:0">
  377.   <tbody> 
  378.   <tr> 
  379.     <td height="13" align=left noWrap bgcolor=#f8f8f8 style="padding:0; margin:0">  
  380.     <img src="" width=30 height=1>
  381. <%
  382. layer = layer-1;
  383. for (int k=1; k<=layer-1; k++)
  384. { %>
  385.       <img src="forum/images/bbs_dir/line.gif" width=18 height="22">
  386.       <% }%>
  387.         <img src="forum/images/bbs_dir/join.gif" width="18" height="22">
  388.         <%if (type==0 || type==1) {
  389. if (isfinish==1) {%>
  390.         <img src="images/task/icon-yes.gif"> 
  391.         <%}else if (isfinish==0){%>
  392.         <img src="images/task/icon-notyet.gif"> 
  393.         <%}else {%>
  394.         <img src="images/task/icon-no.gif"> 
  395.         <%}
  396. }%>
  397.         <%
  398.   if (isshow) 
  399.   {
  400.   if (type==0)
  401. out.println("<img src=images/task/icon-task.gif>");
  402.   else if (type==1)
  403. out.println("<img src=images/task/icon-subtask.gif>");
  404.   else if (type==2)
  405. out.println("<img src=images/task/icon-result.gif>");
  406.   else if (type==3)
  407. out.println("<img src=images/task/icon-hurry.gif>");
  408.   else
  409. out.println("<img src=images/task/icon-task.gif>");
  410.   %>
  411.   <%if (expression!=0) { %>
  412. <img align="absmiddle" src="forum/images/emot/em<%=expression%>.gif" border=0>
  413.       <%}%>
  414.       <%
  415.   if (id!=showid) { %>
  416.        <a href="task_show.jsp?rootid=<%=rootid%>&showid=<%=id%>"><%=title%></a> &nbsp;&nbsp;&nbsp;&nbsp;
  417.           <% } else { %>
  418.    <font color=red><%=title%></font><a name="#<%=showid%>"></a>&nbsp;&nbsp;<!--<a href="#content<%=showid%>">回到顶部</a>-->
  419.   <% }%>
  420.   <%if (type==0 || type==1 || type==3) {%>
  421.   [&nbsp;
  422.   <%
  423.   UserDb ud = new UserDb();
  424.   ud = ud.getUserDb(initiator);
  425.   out.print(ud.getRealName());
  426.   %>
  427.   →
  428.   <%
  429.   ud = ud.getUserDb(person);
  430.   out.print(ud.getRealName());
  431.   %>
  432.   <%=mydate%>&nbsp;]
  433.   <%}else if (type==2) {%>
  434.      [汇报人:<%
  435.   UserDb ud = new UserDb();
  436.   ud = ud.getUserDb(initiator);
  437.   out.print(ud.getRealName());
  438.   %>]
  439.   <%}%>  
  440.    <%
  441.    }
  442.    else
  443.     out.print("............");
  444.    %>      </td>
  445.     </tr>
  446.   </tbody> 
  447. </table>
  448. <% }%>
  449. </BODY>
  450. </HTML>