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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=utf-8" %>
  2. <%@ page import="java.util.*,
  3.  java.text.*,
  4.  cn.js.fan.util.*,
  5.  com.redmoon.oa.flow.*,
  6.  cn.js.fan.cache.jcs.*,
  7.  cn.js.fan.web.*,
  8.  com.redmoon.oa.pvg.*,
  9.  com.redmoon.oa.kernel.*,
  10.  com.cloudwebsoft.framework.base.*"
  11. %>
  12. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  13. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  14. <link href="default.css" rel="stylesheet" type="text/css">
  15. <script src="../inc/common.js"></script>
  16. <script>
  17. function findObj(theObj, theDoc)
  18. {
  19.   var p, i, foundObj;
  20.   
  21.   if(!theDoc) theDoc = document;
  22.   if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  23.   {
  24.     theDoc = parent.frames[theObj.substring(p+1)].document;
  25.     theObj = theObj.substring(0,p);
  26.   }
  27.   if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  28.   for (i=0; !foundObj && i < theDoc.forms.length; i++) 
  29.     foundObj = theDoc.forms[i][theObj];
  30.   for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
  31.     foundObj = findObj(theObj,theDoc.layers[i].document);
  32.   if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  33.   
  34.   return foundObj;
  35. }
  36. function SelectDateTime(objName) {
  37. var dt = showModalDialog("../util/calendar/time.htm", "" ,"dialogWidth:266px;dialogHeight:125px;status:no;help:no;");
  38. if (dt!=null)
  39. findObj(objName).value = dt;
  40. }
  41. function form1_onsubmit() {
  42. var t = form1.time.value;
  43. var ary = t.split(":");
  44. var weekDay = getCheckboxValue("weekDay");
  45. var dayOfMonth = form1.month_day.value;
  46. if (weekDay=="" && dayOfMonth=="") {
  47. alert("请填写每月几号或者星期几!");
  48. return false;
  49. }
  50. if (weekDay=="")
  51. weekDay = "?";
  52. if (ary[2].indexOf("0")==0 && ary[2].length>1)
  53. ary[2] = ary[2].substring(1, ary[2].length);
  54. if (ary[1].indexOf("0")==0 && ary[1].length>1)
  55. ary[1] = ary[1].substring(1, ary[1].length);
  56. if (ary[0].indexOf("0")==0 && ary[0].length>1)
  57. ary[0] = ary[0].substring(1, ary[0].length);
  58. if (dayOfMonth=="")
  59. dayOfMonth = "?";
  60. var cron = ary[2] + " " + ary[1] + " " + ary[0] + " " + dayOfMonth + " * " + weekDay;
  61. form1.cron.value = cron;
  62. if (form1.flowCode.value=="not") {
  63. alert("请选择流程!");
  64. return false;
  65. }
  66. form1.data_map.value = form1.flowCode.value;
  67. }
  68. function trimOptionText(strValue) 
  69. {
  70. // 注意option中有全角的空格,所以不直接用trim
  71. var r = strValue.replace(/^ *|s*|s*$/g,"");
  72. return r;
  73. }
  74. </script>
  75. <jsp:useBean id="privilege" scope="page" class="com.redmoon.oa.pvg.Privilege"/>
  76. <%
  77. String priv="admin";
  78. if (!privilege.isUserPrivValid(request,priv)) {
  79.     out.print(cn.js.fan.web.SkinUtil.makeErrMsg(request, cn.js.fan.web.SkinUtil.LoadString(request, "pvg_invalid")));
  80. return;
  81. }
  82. String op = ParamUtil.get(request, "op");
  83. int id = ParamUtil.getInt(request, "id");
  84. JobUnitDb ju = new JobUnitDb();
  85. ju = (JobUnitDb)ju.getQObjectDb(new Integer(id));
  86. if (op.equals("edit")) {
  87. QObjectMgr qom = new QObjectMgr();
  88. try {
  89. if (qom.save(request, ju, "scheduler_edit"))
  90. out.print(StrUtil.Alert_Redirect(SkinUtil.LoadString(request, "info_op_success"), "scheduler_edit.jsp?id=" + id));
  91. else
  92. out.print(StrUtil.Alert_Back(SkinUtil.LoadString(request, "info_op_fail")));
  93. }
  94. catch (ErrMsgException e) {
  95. out.print(StrUtil.Alert_Back(e.getMessage()));
  96. }
  97. }
  98. %>
  99. <table cellSpacing="0" cellPadding="0" width="100%">
  100.   <tbody>
  101.     <tr>
  102.       <td class="head"><a href="scheduler_list.jsp">调度中心</a>&nbsp;&nbsp;|&nbsp;&nbsp;编辑调度</td>
  103.     </tr>
  104.   </tbody>
  105. </table>
  106. <br>
  107. <TABLE 
  108. style="BORDER-RIGHT: #a6a398 1px solid; BORDER-TOP: #a6a398 1px solid; BORDER-LEFT: #a6a398 1px solid; BORDER-BOTTOM: #a6a398 1px solid" 
  109. cellSpacing=0 cellPadding=3 width="95%" align=center>
  110.   <TBODY>
  111.     <TR>
  112.       <TD class=thead style="PADDING-LEFT: 10px" noWrap width="70%"><strong>调度流程</strong></TD>
  113.     </TR>
  114.     <TR class=row style="BACKGROUND-COLOR: #fafafa">
  115.       <TD height="175" align="center" style="PADDING-LEFT: 10px">
  116. <br>
  117.         <table width="98%" border="0">
  118. <form name="form1" action="?op=edit" method="post" onsubmit="return form1_onsubmit()">
  119.           <tr>
  120.             <td align="left">&nbsp;</td>
  121.           </tr>
  122.           <tr>
  123.             <td align="left">选择流程:
  124.               <select name="flowCode" onchange="if(this.options[this.selectedIndex].value=='not'){alert(this.options[this.selectedIndex].text+' 不能被选择!'); return false;} form1.job_name.value=trimOptionText(this.options[this.selectedIndex].text) ">
  125.               <%
  126. Leaf lf = new Leaf();
  127. lf = lf.getLeaf("root");
  128. DirectoryView dv = new DirectoryView(lf);
  129. dv.ShowDirectoryAsOptions(request, out, lf, 1);
  130.   %>
  131.             </select>
  132. <script>
  133. form1.flowCode.value = "<%=ju.getString("data_map")%>";
  134. </script>
  135. <input name="job_class" type="hidden" value="com.redmoon.oa.job.WorkflowJob">
  136. <input name="id" type="hidden" value="<%=id%>">
  137. 名称:
  138. <input name="job_name" value="<%=ju.getString("job_name")%>">
  139. &nbsp;每月:
  140. <input name="month_day" size="2" value="<%=ju.getString("month_day")%>">
  141. <input name="user_name" value="<%=privilege.getUser(request)%>" type="hidden"></td>
  142.           </tr>
  143.           <tr>
  144.             <td align="left">
  145. 开始时间
  146. <%
  147. String cron = ju.getString("cron");
  148. String[] ary = cron.split(" ");
  149. if (ary[0].length()==1)
  150. ary[0] = "0" + ary[0];
  151. if (ary[1].length()==1)
  152. ary[1] = "0" + ary[1];
  153. if (ary[2].length()==1)
  154. ary[2] = "0" + ary[2];
  155. String t = ary[2] + ":" + ary[1] + ":" + ary[0];
  156. %>
  157. <input style="WIDTH: 50px" name="time" size="20" value="<%=t%>">
  158. &nbsp;<img style="CURSOR: hand" onclick="SelectDateTime('time')" src="../images/form/clock.gif" align="absMiddle" width="18" height="18"> 
  159. <input name="weekDay" type="checkbox" value="1">
  160. 星期日
  161. <input name="weekDay" type="checkbox" value="2">
  162. 星期一
  163. <input name="weekDay" type="checkbox" value="3">
  164. 星期二
  165. <input name="weekDay" type="checkbox" value="4">
  166. 星期三
  167. <input name="weekDay" type="checkbox" value="5">
  168. 星期四
  169. <input name="weekDay" type="checkbox" value="6">
  170. 星期五
  171. <input name="weekDay" type="checkbox" value="7">
  172. 星期六 
  173. <input type="submit" value="确定"><input name="cron" type="hidden">
  174. <input name="data_map" type="hidden">
  175. <%
  176. String[] w = ary[5].split(",");
  177. for (int i=0; i<w.length; i++) {
  178. %>
  179. <script>
  180. setCheckboxChecked("weekDay", "<%=w[i]%>");
  181. </script>
  182. <%
  183. }
  184. %>
  185. </td>
  186.           </tr></form>
  187.         </table>
  188.         <br>
  189.       <br></TD>
  190.     </TR>
  191.     <TR>
  192.       <TD class=tfoot align=right>&nbsp;</TD>
  193.     </TR>
  194.   </TBODY>
  195. </TABLE>