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

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html; charset=utf-8" %>
  2. <%@ page import="cn.js.fan.security.*"%>
  3. <%@ page import="cn.js.fan.util.*"%>
  4. <%@ page import="java.util.*"%>
  5. <%@ page import="cn.js.fan.web.*"%>
  6. <%@ page import="cn.js.fan.module.cms.*"%>
  7. <%@ page import="com.redmoon.oa.pvg.*"%>
  8. <%@ page import="java.util.Calendar" %>
  9. <%@ page import="cn.js.fan.db.Paginator"%>
  10. <%@ page import="cn.js.fan.module.cms.plugin.*"%>
  11. <%@ page import="cn.js.fan.module.cms.plugin.base.*"%>
  12. <html><head>
  13. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  14. <link href="common.css" rel="stylesheet" type="text/css">
  15. <link href="cms/default.css" rel="stylesheet" type="text/css">
  16. <%@ include file="inc/nocache.jsp"%>
  17. <jsp:useBean id="strutil" scope="page" class="cn.js.fan.util.StrUtil"/>
  18. <jsp:useBean id="docmanager" scope="page" class="cn.js.fan.module.cms.DocumentMgr"/>
  19. <jsp:useBean id="dir" scope="page" class="cn.js.fan.module.cms.Directory"/>
  20. <%
  21. Privilege privilege = new Privilege();
  22. String correct_result = "操作成功!";
  23. int id = ParamUtil.getInt(request, "doc_id");
  24. Document doc = docmanager.getDocument(request, id, privilege);
  25. String dir_code = doc.getDirCode();
  26. String dir_name;
  27. Document template = null;
  28. Leaf leaf = dir.getLeaf(dir_code);
  29. dir_name = leaf.getName();
  30. int templateId = leaf.getTemplateId();
  31. if (doc!=null) {
  32. int templateId1 = doc.getTemplateId();
  33. dir_code = doc.getDirCode();
  34. if (templateId1!=-1)
  35. templateId = templateId1;
  36. }
  37. String op = ParamUtil.get(request, "op");
  38. String action = ParamUtil.get(request, "action");
  39. int afterpage=-1;
  40. if (action.equals("insertafter"))
  41. afterpage = ParamUtil.getInt(request, "afterpage");
  42. int pageNum = 1;
  43. if (op.equals("edit")) {
  44. pageNum = ParamUtil.getInt(request, "CPages");
  45. if (action.equals("changeAttachOrders")) {
  46. int attachId = ParamUtil.getInt(request, "attachId");
  47. String direction = ParamUtil.get(request, "direction");
  48. // 取得第一页的内容
  49. DocContent dc = new DocContent();
  50. dc = dc.getDocContent(id, pageNum);
  51. dc.moveAttachment(attachId, direction);
  52. }
  53. }
  54. if (templateId!=-1) {
  55. template = doc.getDocument(templateId);
  56. }
  57. if (doc!=null)
  58. id = doc.getID();
  59. %>
  60. <title></title>
  61. <style type="text/css">
  62. <!--
  63. td {  font-family: "Arial", "Helvetica", "sans-serif"; font-size: 14px; font-style: normal; line-height: 150%; font-weight: normal}
  64. -->
  65. </style>
  66. <script language=JavaScript src='scripts/language/schi/editor_lang.js'></script>
  67. <%
  68. if (request.getHeader("User-Agent").indexOf("MSIE")!=-1){
  69. out.println("<script language=JavaScript src='scripts/editor.js'></script>");
  70. }
  71. else{
  72. out.println("<script language=JavaScript src='scripts/moz/editor.js'></script>");
  73. }
  74. %>
  75. <script language="JavaScript">
  76. <!--
  77. <%
  78. if (doc!=null) {
  79. out.println("var id=" + doc.getID() + ";");
  80. }
  81. %>
  82. var op = "<%=op%>";
  83. function SubmitWithFileDdxc() {
  84. var htmlcode = oEdit1.getHTMLBody();
  85. if (htmlcode=="")
  86. htmlcode = " ";
  87. if (op=="edit") {
  88. addform.webedit.Clear();
  89. addform.webedit.AddField("id", id);
  90. addform.webedit.AddField("op", "<%=op%>");
  91. addform.webedit.AddField("dir_code", "<%=dir_code%>");
  92. addform.webedit.AddField("pageNum", <%=pageNum%>);
  93. addform.webedit.SetHtmlCode(htmlcode);
  94. }
  95. if (op=="add") {
  96. addform.webedit.Clear();
  97. addform.webedit.AddField("id", id);
  98. addform.webedit.AddField("op", "<%=op%>");
  99. addform.webedit.AddField("dir_code", "<%=dir_code%>");
  100. addform.webedit.AddField("action", "<%=action%>");
  101. addform.webedit.AddField("afterpage", "<%=afterpage%>");
  102. addform.webedit.SetHtmlCode(htmlcode);
  103. }
  104. addform.webedit.MTUpload();
  105. // 因为Upload()中启用了线程的,所以函数在执行后,会立即反回,使得下句中得不到ReturnMessage的值
  106. // 原因是此时服务器的返回信息还没收到
  107. // alert("ReturnMessage=" + addform.webedit.ReturnMessage);
  108. }
  109. function SubmitWithFileThread() {
  110. var htmlcode = oEdit1.getHTMLBody();
  111. if (htmlcode=="")
  112. htmlcode = " ";
  113. if (op=="edit") {
  114. addform.webedit.Clear();
  115. addform.webedit.AddField("id", id);
  116. addform.webedit.AddField("op", "<%=op%>");
  117. addform.webedit.AddField("dir_code", "<%=dir_code%>");
  118. addform.webedit.AddField("pageNum", <%=pageNum%>);
  119. addform.webedit.SetHtmlCode(htmlcode);
  120. }
  121. if (op=="add") {
  122. addform.webedit.Clear();
  123. addform.webedit.AddField("id", id);
  124. addform.webedit.AddField("op", "<%=op%>");
  125. addform.webedit.AddField("dir_code", "<%=dir_code%>");
  126. addform.webedit.AddField("action", "<%=action%>");
  127. addform.webedit.AddField("afterpage", "<%=afterpage%>");
  128. addform.webedit.SetHtmlCode(htmlcode);
  129. }
  130. addform.webedit.Upload();
  131. // 因为Upload()中启用了线程的,所以函数在执行后,会立即反回,使得下句中得不到ReturnMessage的值
  132. // 原因是此时服务器的返回信息还没收到
  133. // alert("ReturnMessage=" + addform.webedit.ReturnMessage);
  134. }
  135. function SubmitWithFile(){
  136. var htmlcode = oEdit1.getHTMLBody();
  137. if (htmlcode=="")
  138. htmlcode = " ";
  139. if (op=="edit") {
  140. addform.webedit.Clear();
  141. addform.webedit.AddField("id", id);
  142. addform.webedit.AddField("op", "<%=op%>");
  143. addform.webedit.AddField("dir_code", "<%=dir_code%>");
  144. addform.webedit.AddField("pageNum", <%=pageNum%>);
  145. addform.webedit.SetHtmlCode(htmlcode);
  146. }
  147. if (op=="add") {
  148. addform.webedit.Clear();
  149. addform.webedit.AddField("id", id);
  150. addform.webedit.AddField("op", "<%=op%>");
  151. addform.webedit.AddField("dir_code", "<%=dir_code%>");
  152. addform.webedit.AddField("action", "<%=action%>");
  153. addform.webedit.AddField("afterpage", "<%=afterpage%>");
  154. addform.webedit.SetHtmlCode(htmlcode);
  155. }
  156. addform.webedit.UploadArticle();
  157. if (addform.webedit.ReturnMessage == "<%=correct_result%>")
  158. doAfter(true);
  159. else
  160. doAfter(false);
  161. }
  162. function SubmitWithoutFile() {
  163. var htmlcode = oEdit1.getHTMLBody();
  164. if (htmlcode=="")
  165. htmlcode = " ";
  166. addform.webedit.Clear();
  167. addform.webedit.UploadMode = 0;
  168. if (op=="edit") {
  169. addform.webedit.AddField("isuploadfile", "false");
  170. addform.webedit.AddField("id", id);
  171. addform.webedit.AddField("dir_code", "<%=dir_code%>");
  172. addform.webedit.AddField("pageNum", <%=pageNum%>);
  173. addform.webedit.AddField("op", "<%=op%>");
  174. addform.webedit.SetHtmlCode(htmlcode);
  175. }
  176. if (op=="add") {
  177. addform.webedit.AddField("isuploadfile", "false");
  178. addform.webedit.AddField("op", "<%=op%>");
  179. addform.webedit.AddField("dir_code", "<%=dir_code%>");
  180. addform.webedit.AddField("id", id);
  181. addform.webedit.AddField("action", "<%=action%>");
  182. addform.webedit.AddField("afterpage", "<%=afterpage%>");
  183. addform.webedit.SetHtmlCode(htmlcode);
  184. }
  185. addform.webedit.UploadArticle();
  186. if (addform.webedit.ReturnMessage == "<%=correct_result%>")
  187. doAfter(true);
  188. else
  189. doAfter(false);
  190. }
  191. function ClearAll(){
  192. document.addform.title.value=""
  193. oEdit1.putHTML(' ');
  194. }
  195. function doAfter(isSucceed) {
  196. if (isSucceed) {
  197. if (op=="edit")
  198. {
  199. if (confirm("<%=correct_result%> 请点击确定按钮刷新页面rn(如果您确定文件是来自其它服务器,可以不刷新!)。"))
  200. // 此处一定要reload,否则会导致再点击上传(连同文件)时,因为images已被更改,而content中路径未变,从而下载不到,导到最终会丢失
  201. // 以前未注意到此问题,可能是因为再点击上传时,获取的图片在服务器端虽然已丢失,但是缓存中可能还有的原因
  202. // 也可能是因为在编辑文件时,编辑完了并未重新刷新页面,content中的图片还是来源的位置(来源自别的服务器),所以依然能够上传,但是只要此时再一刷新,再连续上传两次,问题就会出现
  203. window.location.reload(true); 
  204. }
  205. else {
  206. alert("<%=correct_result%>");
  207.     }
  208. }
  209. else {
  210. alert(addform.webedit.ReturnMessage);
  211. }
  212. }
  213. function showvote(isshow)
  214. {
  215. if (addform.isvote.checked)
  216. {
  217. addform.vote.style.display = "";
  218. }
  219. else
  220. {
  221. addform.vote.style.display = "none";
  222. }
  223. }
  224. function window_onload() {
  225. //如果是新建文档
  226. <%if (templateId!=-1 && op.equals("add")) {%>
  227. oEdit1.putHTML(divTemplate.innerHTML);
  228. <%}else if (op.equals("edit")){%>
  229. oEdit1.putHTML(addform.content.value);
  230. <%}%>
  231. }
  232. function selTemplate(id)
  233. {
  234. if (addform.templateId.value!=id) {
  235. addform.templateId.value = id;
  236. <%if (doc!=null) {%>
  237. window.location.href="fwebedit.jsp?op=edit&action=selTemplate&id=<%=id%>&dir_code=<%=StrUtil.UrlEncode(dir_code)%>&dir_name=<%=StrUtil.UrlEncode(dir_name)%>&templateId=" + id;
  238. <%}else{%>
  239. if (id!=-1)
  240. window.location.href="fwebedit.jsp?op=add&action=selTemplate&dir_code=<%=StrUtil.UrlEncode(dir_code)%>&dir_name=<%=StrUtil.UrlEncode(dir_name)%>&templateId=" + id;
  241. <%}%>
  242. }
  243. }
  244. //-->
  245. </script>
  246. </head>
  247. <body bgcolor="#FFFFFF" text="#000000" onLoad="window_onload()">
  248. <TABLE width="98%" BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0>
  249.   <TR valign="top" bgcolor="#FFFFFF">
  250.     <TD height="430" colspan="2" style="background-attachment: fixed; background-image: url(/admin/images/bg_bottom.jpg); background-repeat: no-repeat">
  251.           <TABLE cellSpacing=0 cellPadding=0 width="100%">
  252.             <TBODY>
  253.               <TR>
  254.                 <TD class=head>
  255. <%
  256. if (op.equals("add")) {%>
  257. 添加内容&nbsp;--&nbsp;<a href="fwebedit.jsp?op=edit&dir_code=<%=doc.getDirCode()%>&id=<%=doc.getID()%>"><%=doc.getTitle()%>(回到第一页)</a>
  258. 新的页码为&nbsp;[
  259. <%if (action.equals("insertafter")) {
  260. out.print(afterpage + 1);
  261. }else{
  262. out.print(doc.getPageCount() + 1);
  263. }%>
  264. ]
  265.     <%}else{%>
  266. 修改内容&nbsp;--&nbsp;<a href="fwebedit.jsp?op=edit&dir_code=<%=doc.getDirCode()%>&id=<%=doc.getID()%>"><%=doc.getTitle()%></a>
  267. <%}%>
  268. </TD>
  269.               </TR>
  270.             </TBODY>
  271.           </TABLE>
  272. <form name="addform" action="/fwebedit_do.jsp" method="post">
  273.           <table border="0" cellspacing="1" width="100%" cellpadding="0" align="center">
  274.             <tr align="center" bgcolor="#F2F2F2">
  275.               <td height="20" colspan=2 align=center><b><%=doc!=null?doc.getTitle():""%></b>&nbsp;<input type="hidden" name=isuploadfile value="false">
  276.   <input type="hidden" name=id value="<%=doc!=null?doc.getID():""%>">
  277. <%=doc!=null?"(id:"+doc.getID()+")":""%>   </td>
  278.             </tr>
  279. <%if (doc!=null && doc.getTemplateId()!=-1) {%>
  280.             <tr align="left" bgcolor="#F2F2F2">
  281.               <td colspan="2" valign="middle" class="unnamed2">
  282.   &nbsp;模板ID&nbsp;
  283.   <%
  284.   if (doc!=null)
  285.    templateId = doc.getTemplateId();
  286.   %>
  287.                 <input name="templateId" class="singleboarder" value="<%=templateId%>" size=3 readonly>
  288. &nbsp; <span id=templateInfo>
  289. <a target=_blank href="/admin/doc_template_show.jsp?id=<%=doc.getTemplateId()%>">预览模板</a>
  290. <a href="javascript:oEdit1.putHTML(divTemplate.innerHTML)">重新应用模板</a>
  291. </span>
  292. </td>
  293.             </tr>
  294. <%}%>
  295.             <tr align="center">
  296.               <td colspan="2" valign="top" bgcolor="#F2F2F2" class="unnamed2">
  297.   <textarea id="content" name="content" style="display:none">
  298.   <%if (op.equals("edit")) {
  299.   String str = doc.getContent(pageNum);
  300.   if (str!=null)
  301.    out.print(str.replaceAll(""","'"));
  302.   }%>
  303.   </textarea>   
  304. <pre id="idTemporary" name="idTemporary" style="display:none">
  305. <%
  306. if (op.equals("edit")) {
  307. %>
  308. <%=strutil.HTMLEncode(strutil.getNullString(doc.getContent(pageNum)))%>
  309. <%}%>
  310. </pre>
  311.  <script>
  312. var oEdit1 = new InnovaEditor("oEdit1");
  313. oEdit1.width="100%";
  314. oEdit1.height="500";
  315. oEdit1.features=["FullScreen","Preview","Print","Search","SpellCheck",
  316. "Cut","Copy","Paste","PasteWord","PasteText","|","Undo","Redo","|",
  317. "ForeColor","BackColor","|","Bookmark","Hyperlink",
  318. "HTMLFullSource","HTMLSource","XHTMLFullSource",
  319. "XHTMLSource","BRK","Numbering","Bullets","|","Indent","Outdent","LTR","RTL","|","Image","Flash","Media","|","InternalLink","CustomObject","|",
  320. "Table","Guidelines","Absolute","|","Characters","Line",
  321. "Form","Clean","ClearAll","BRK",
  322. "StyleAndFormatting","TextFormatting","ListFormatting","BoxFormatting",
  323. "ParagraphFormatting","CssText","Styles","|",
  324. "Paragraph","FontName","FontSize","|",
  325. "Bold","Italic",
  326. "Underline","Strikethrough","|","Superscript","Subscript","|",
  327. "JustifyLeft","JustifyCenter","JustifyRight","JustifyFull"];
  328. oEdit1.RENDER(document.getElementById("idTemporary").innerHTML);
  329. </script>
  330.               </td>
  331.             </tr>
  332.             <tr>
  333.               <td width="11%" align="right" bgcolor="#FFFFFF">提示:</td>
  334.               <td width="89%" bgcolor="#FFFFFF">
  335.   回车可用Shift+Enter   </td>
  336.             </tr>
  337.             <tr>
  338.               <td height="25" colspan=2 align="center" bgcolor="#FFFFFF">
  339.   <%
  340.   if (op.equals("edit") && doc!=null) {
  341.   Vector attachments = doc.getAttachments(pageNum);
  342.   Iterator ir = attachments.iterator();
  343.   while (ir.hasNext()) {
  344.    Attachment am = (Attachment) ir.next(); %>
  345. <table width="98%"  border="0" cellspacing="0" cellpadding="0">
  346.                       <tr>
  347.                         <td width="7%" align="center"><img src=images/attach.gif></td>
  348.                         <td width="93%">&nbsp;
  349.                           <input name="attach_name<%=am.getId()%>" value="<%=am.getName()%>" size="30">
  350. &nbsp;<a href="javascript:changeAttachName('<%=am.getId()%>', '<%=doc.getID()%>', '<%="attach_name"+am.getId()%>')">更改</a>                        &nbsp;<a href="javascript:delAttach('<%=am.getId()%>', '<%=doc.getID()%>')">删除</a>&nbsp;&nbsp;<a target=_blank href="<%=am.getVisualPath() + "/" + am.getDiskName()%>">查看</a>&nbsp;
  351. <a href="?op=edit&doc_id=<%=doc.getID()%>&CPages=<%=pageNum%>&action=changeAttachOrders&direction=up&attachId=<%=am.getId()%>"><img src="images/arrow_up.gif" alt="往上" width="16" height="20" border="0" align="absmiddle"></a>&nbsp;
  352. <a href="?op=edit&doc_id=<%=doc.getID()%>&CPages=<%=pageNum%>&action=changeAttachOrders&direction=down&attachId=<%=am.getId()%>"><img src="images/arrow_down.gif" alt="往下" width="16" height="20" border="0" align="absmiddle"></a></td>
  353.                       </tr>
  354.                     </table>
  355. <%}
  356.   }
  357.   %>
  358.   </td>
  359.             </tr>
  360.             <tr>
  361.               <td height="153" colspan=2 align=center bgcolor="#FFFFFF">
  362.   <table  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  363.                 <tr>
  364.                   <td bgcolor="#FFFFFF"><%
  365. Calendar cal = Calendar.getInstance();
  366. String year = "" + (cal.get(cal.YEAR));
  367. String month = "" + (cal.get(cal.MONTH) + 1);
  368. String filepath = "upfile/webeditimg/" + year + "/" + month;
  369. %><object classid="CLSID:DE757F80-F499-48D5-BF39-90BC8BA54D8C" codebase="<%=request.getContextPath()%>/activex/webedit.cab#version=4,0,1,1" width=400 height=173 align="middle" id="webedit">
  370.                       <param name="Encode" value="utf-8">
  371.   <param name="MaxSize" value="<%=Global.MaxSize%>"> <!--上传字节-->
  372.                       <param name="ForeColor" value="(0,255,0)">
  373.                       <param name="BgColor" value="(0,0,0)">
  374.                       <param name="ForeColorBar" value="(255,255,255)">
  375.                       <param name="BgColorBar" value="(0,0,255)">
  376.                       <param name="ForeColorBarPre" value="(0,0,0)">
  377.                       <param name="BgColorBarPre" value="(200,200,200)">
  378.                       <param name="FilePath" value="<%=filepath%>">
  379.                       <!--上传后的文件需放在服务器上的路径-->
  380.                       <param name="Server" value="<%=request.getServerName()%>">
  381.                       <param name="Port" value="<%=request.getServerPort()%>">
  382.                       <param name="VirtualPath" value="<%=Global.virtualPath%>">
  383.                       <param name="PostScript" value="<%=Global.virtualPath%>/doc_editpage_do.jsp">
  384.                       <param name="PostScriptDdxc" value="<%=Global.virtualPath%>/ddxc.jsp">
  385.                       <param name="SegmentLen" value="20480">
  386.                     </object></td>
  387.                 </tr>
  388.               </table>
  389.               </td>
  390.             </tr>
  391.             <tr>
  392.               <td height="30" colspan=2 align=center bgcolor="#FFFFFF">
  393.   <%
  394.   String actiondo = "";
  395.   if (op.equals("add"))
  396.    actiondo = "添 加";
  397.   else
  398.    actiondo = "修 改";
  399.   %>
  400.   <%/*if (templateId==-1) {%>
  401.               <input name="cmdok2" type="button" class="singleboarder" value="<%//=actiondo%>(断点续传)" onClick="return SubmitWithFileDdxc()">
  402.               <%}
  403.   if (templateId==-1) {%>
  404.               <input name="cmdok3" type="button" class="singleboarder" value="<%=actiondo%>(单线程)" onClick="return SubmitWithFileThread()">
  405.               <%}*/
  406.   if (templateId==-1) {%>
  407.               <input name="cmdok" type="button" class="singleboarder" value=" <%=actiondo%> " onClick="return SubmitWithFile()">
  408.   <%}%>
  409. &nbsp;
  410. <!--
  411. <input name="notuploadfile" type="button" class="singleboarder" value="<%=actiondo%>(不上传文件)" onClick="return SubmitWithoutFile()">
  412. -->
  413. &nbsp;
  414.       <input name="cmdcancel" type="button" class="singleboarder" onClick="ClearAll()" value=" 清 空 ">
  415. &nbsp;
  416.       <%if (op.equals("edit")) {%>
  417.   <input name="editbtn" type="button" class="singleboarder" onClick="location.href='doc_abstract.jsp?id=<%=doc.getID()%>'" value=" 摘要 ">
  418.   <%
  419.    String viewPage = "doc_show.jsp";
  420. PluginMgr pm = new PluginMgr();
  421. PluginUnit pu = pm.getPluginUnitOfDir(dir_code);
  422. if (pu!=null) {
  423. IPluginUI ipu = pu.getUI(request);
  424. viewPage = ipu.getViewPage();
  425. }
  426.   %>
  427. &nbsp;
  428. <input name="remsg" type="button" class="singleboarder" onClick='window.open("<%=viewPage%>?id=<%=id%>")' value="预览">
  429.   <%}%>
  430. &nbsp;
  431. <!--
  432. <input name="remsg" type="button" class="singleboarder" onClick='alert(webedit.ReturnMessage)' value="返回信息">
  433. -->
  434. &nbsp; 
  435. <%if (pageNum!=1) {%>
  436. <input name="remsg" type="button" class="singleboarder" onClick="window.location.href='doc_editpage_do.jsp?op=del&docId=<%=id%>&pageNum=<%=pageNum%>'" value="删除">
  437. <%}%>
  438. </td>
  439.             </tr>
  440.           </table>
  441.         </form>
  442. <table width="100%"  border="0">
  443.           <tr>
  444.             <td align="center">
  445. <a href="fwebedit.jsp?op=editarticle&dir_code=<%=StrUtil.UrlEncode(dir_code)%>&id=<%=id%>">文章信息</a>
  446.  文章共<%=doc.getPageCount()%>页&nbsp;&nbsp;页码
  447. <%
  448. int pagesize = 1;
  449. int total = DocContent.getContentCount(doc.getID());
  450. int curpage,totalpages;
  451. Paginator paginator = new Paginator(request, total, pagesize);
  452. // 设置当前页数和总页数
  453. totalpages = paginator.getTotalPages();
  454. curpage = paginator.getCurrentPage();
  455. if (totalpages==0)
  456. {
  457. curpage = 1;
  458. totalpages = 1;
  459. }
  460. String querystr = "op=edit&doc_id=" + id;
  461. out.print(paginator.getCurPageBlock("doc_editpage.jsp?"+querystr));
  462. %>
  463. <%if (op.equals("edit")) {
  464. if (doc.getPageCount()!=pageNum) {
  465. %>
  466. &nbsp;<a href="doc_editpage.jsp?op=add&action=insertafter&doc_id=<%=doc.getID()%>&afterpage=<%=pageNum%>">当前页之后插入一页</a>
  467. <% }
  468. }%>
  469. &nbsp;<a href="doc_editpage.jsp?op=add&doc_id=<%=doc.getID()%>">增加一页</a>
  470. </td>
  471.           </tr>
  472.         </table>
  473. <br></TD>
  474.   </TR>
  475. </TABLE>
  476. <div id=divTemplate style="display:none">
  477. <%if (template!=null) {%>
  478. <%=template.getContent(1)%>
  479. <%}%>
  480. </div>
  481. <iframe id="hideframe" name="hideframe" src="fwebedit_do.jsp" width=0 height=0></iframe>
  482. </body>
  483. <script>
  484. function findObj(theObj, theDoc)
  485. {
  486.   var p, i, foundObj;
  487.   
  488.   if(!theDoc) theDoc = document;
  489.   if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  490.   {
  491.     theDoc = parent.frames[theObj.substring(p+1)].document;
  492.     theObj = theObj.substring(0,p);
  493.   }
  494.   if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  495.   for (i=0; !foundObj && i < theDoc.forms.length; i++) 
  496.     foundObj = theDoc.forms[i][theObj];
  497.   for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
  498.     foundObj = findObj(theObj,theDoc.layers[i].document);
  499.   if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  500.   
  501.   return foundObj;
  502. }
  503. function changeAttachName(attach_id, doc_id, nm) {
  504. var obj = findObj(nm);
  505. document.frames.hideframe.location.href = "fwebedit_do.jsp?op=changeattachname&page_num=<%=pageNum%>&doc_id=" + doc_id + "&attach_id=" + attach_id + "&newname=" + obj.value
  506. }
  507. function delAttach(attach_id, doc_id) {
  508. if (!window.confirm("您确定要删除吗?")) {
  509. return;
  510. }
  511. document.frames.hideframe.location.href = "fwebedit_do.jsp?op=delAttach&page_num=<%=pageNum%>&doc_id=" + doc_id + "&attach_id=" + attach_id
  512. }
  513. </script>
  514. </html>