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

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="cn.js.fan.module.cms.plugin.*"%>
  8. <%@ page import="cn.js.fan.module.cms.plugin.base.*"%>
  9. <%@ page import="com.redmoon.oa.pvg.*"%>
  10. <%@ page import="java.util.Calendar" %>
  11. <%@ page import="cn.js.fan.db.Paginator"%>
  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. String dir_code = ParamUtil.get(request, "dir_code");
  22. String dir_name = ParamUtil.get(request, "dir_name");
  23. int id = 0;
  24. Privilege privilege = new Privilege();
  25. String correct_result = "操作成功!";
  26. Document doc = null;
  27. Document template = null;
  28. Leaf leaf = dir.getLeaf(dir_code);
  29. String strtemplateId = ParamUtil.get(request, "templateId");
  30. int templateId = Document.NOTEMPLATE;
  31. if (!strtemplateId.trim().equals("")) {
  32. if (StrUtil.isNumeric(strtemplateId))
  33. templateId = Integer.parseInt(strtemplateId);
  34. }
  35. if (templateId==Document.NOTEMPLATE) {
  36. templateId = leaf.getTemplateId();
  37. }
  38. if (templateId!=Document.NOTEMPLATE) {
  39. template = docmanager.getDocument(templateId);
  40. }
  41. String op = ParamUtil.get(request, "op");
  42. if (op.equals("add")) {
  43. LeafPriv lp = new LeafPriv();
  44. lp.setDirCode(dir_code);
  45. if (!lp.canUserAppend(privilege.getUser(request))) {
  46. out.print(StrUtil.Alert(privilege.MSG_INVALID));
  47. return;
  48. }
  49. String action = ParamUtil.get(request, "action");
  50. if (action.equals("selTemplate")){
  51. int tid = ParamUtil.getInt(request, "templateId");
  52. template = docmanager.getDocument(tid);
  53. }
  54. }
  55. if (op.equals("edit")) {
  56. String action = ParamUtil.get(request, "action");
  57. try {
  58. id = ParamUtil.getInt(request, "id");
  59. doc = docmanager.getDocument(id);
  60. dir_code = doc.getDirCode();
  61. LeafPriv lp = new LeafPriv(doc.getDirCode());
  62. if (!lp.canUserModify(privilege.getUser(request))) {
  63. out.print(StrUtil.makeErrMsg(privilege.MSG_INVALID));
  64. return;
  65. }
  66. if (action.equals("selTemplate")) {
  67. int tid = ParamUtil.getInt(request, "templateId");
  68. doc.setTemplateId(tid);
  69. doc.updateTemplateId();
  70. }
  71. if (doc!=null) {
  72. template = doc.getTemplate();
  73. }
  74. } catch (ErrMsgException e) {
  75. out.print(strutil.makeErrMsg(e.getMessage(),"red", "green"));
  76. return;
  77. }
  78. if (action.equals("changeAttachOrders")) {
  79. int attachId = ParamUtil.getInt(request, "attachId");
  80. String direction = ParamUtil.get(request, "direction");
  81. // 取得第一页的内容
  82. DocContent dc = new DocContent();
  83. dc = dc.getDocContent(id, 1);
  84. dc.moveAttachment(attachId, direction);
  85. }
  86. }
  87. if (op.equals("editarticle")) {
  88. op = "edit";
  89. try {
  90. doc = docmanager.getDocumentByCode(request, dir_code, privilege);
  91. dir_code = doc.getDirCode();
  92. LeafPriv lp = new LeafPriv();
  93. lp.setDirCode(doc.getDirCode());
  94. if (!lp.canUserModify(privilege.getUser(request))) {
  95. out.print(StrUtil.makeErrMsg(privilege.MSG_INVALID));
  96. return;
  97. }
  98. } catch (ErrMsgException e) {
  99. out.print(strutil.makeErrMsg(e.getMessage(),"red", "green"));
  100. return;
  101. }
  102. }
  103. if (doc!=null) {
  104. id = doc.getID();
  105. Leaf lfn = new Leaf();
  106. lfn = lfn.getLeaf(doc.getDirCode());
  107. dir_name = lfn.getName();
  108. }
  109. %>
  110. <title><%=doc!=null?doc.getTitle():""%></title>
  111. <style type="text/css">
  112. <!--
  113. td {  font-family: "Arial", "Helvetica", "sans-serif"; font-size: 14px; font-style: normal; line-height: 150%; font-weight: normal}
  114. .style2 {color: #FF3300}
  115. -->
  116. </style>
  117. <script language=JavaScript src='scripts/formpost.js'></script>
  118. <script language="JavaScript">
  119. <!--
  120. <%
  121. if (doc!=null) {
  122. out.println("var id=" + doc.getID() + ";");
  123. }
  124. %>
  125. var op = "<%=op%>";
  126. function SubmitWithFileDdxc() {
  127. addform.webedit.isDdxc = 1;
  128. if (document.addform.title.value.length == 0) {
  129. alert("请输入文章标题.");
  130. document.addform.title.focus();
  131. return false;
  132. }
  133. loadDataToWebeditCtrl(addform, addform.webedit);
  134. addform.webedit.MTUpload();
  135. // 因为Upload()中启用了线程的,所以函数在执行后,会立即反回,使得下句中得不到ReturnMessage的值
  136. // 原因是此时服务器的返回信息还没收到
  137. // alert("ReturnMessage=" + addform.webedit.ReturnMessage);
  138. }
  139. function SubmitWithFileThread() {
  140. if (document.addform.title.value.length == 0) {
  141. alert("请输入文章标题.");
  142. document.addform.title.focus();
  143. return false;
  144. }
  145. loadDataToWebeditCtrl(addform, addform.webedit);
  146. addform.webedit.Upload();
  147. // 因为Upload()中启用了线程的,所以函数在执行后,会立即反回,使得下句中得不到ReturnMessage的值
  148. // 原因是此时服务器的返回信息还没收到
  149. // alert("ReturnMessage=" + addform.webedit.ReturnMessage);
  150. }
  151. function SubmitWithFile(){
  152. if (document.addform.title.value.length == 0) {
  153. alert("请输入文章标题.");
  154. document.addform.title.focus();
  155. return false;
  156. }
  157. loadDataToWebeditCtrl(addform, addform.webedit);
  158. addform.webedit.UploadArticle();
  159. if (addform.webedit.ReturnMessage == "<%=correct_result%>")
  160. doAfter(true);
  161. else
  162. doAfter(false);
  163. }
  164. function SubmitWithoutFile() {
  165. if (document.addform.title.value.length == 0) {
  166. alert("请输入文章标题.");
  167. document.addform.title.focus();
  168. return false;
  169. }
  170. addform.isuploadfile.value = "false";
  171. loadDataToWebeditCtrl(addform, addform.webedit);
  172. addform.webedit.UploadMode = 0;
  173. addform.webedit.UploadArticle();
  174. addform.isuploadfile.value = "true";
  175. if (addform.webedit.ReturnMessage == "<%=correct_result%>")
  176. doAfter(true);
  177. else
  178. doAfter(false);
  179. }
  180. function ClearAll() {
  181. document.addform.title.value=""
  182. oEdit1.putHTML(" ");
  183. }
  184. function doAfter(isSucceed) {
  185. if (isSucceed) {
  186. if (op=="edit")
  187. {
  188. if (confirm("<%=correct_result%> 请点击确定按钮刷新页面rn(如果您确定文件是来自其它服务器,可以不刷新!)。"))
  189. // 此处一定要reload,否则会导致再点击上传(连同文件)时,因为images已被更改,而content中路径未变,从而下载不到,导到最终会丢失
  190. // 以前未注意到此问题,可能是因为再点击上传时,获取的图片在服务器端虽然已丢失,但是缓存中可能还有的原因
  191. // 也可能是因为在编辑文件时,编辑完了并未重新刷新页面,content中的图片还是来源的位置(来源自别的服务器),所以依然能够上传,但是只要此时再一刷新,再连续上传两次,问题就会出现
  192. window.location.reload(true); 
  193. }
  194. else {
  195. alert("<%=correct_result%>");
  196.     }
  197. }
  198. else {
  199. alert(addform.webedit.ReturnMessage);
  200. }
  201. }
  202. function showvote(isshow)
  203. {
  204. if (addform.isvote.checked)
  205. {
  206. addform.vote.style.display = "";
  207. }
  208. else
  209. {
  210. addform.vote.style.display = "none";
  211. }
  212. }
  213. function selTemplate(id)
  214. {
  215. if (addform.templateId.value!=id) {
  216. addform.templateId.value = id;
  217. // 此处注意当模式对话框的路径在admin下时,退出后本页路径好象被改为admin了
  218. <%if (doc!=null) {%>
  219. 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;
  220. <%}else{%>
  221. if (id!=-1)
  222. window.location.href="../fwebedit.jsp?op=add&action=selTemplate&dir_code=<%=StrUtil.UrlEncode(dir_code)%>&dir_name=<%=StrUtil.UrlEncode(dir_name)%>&templateId=" + id;
  223. <%}%>
  224. }
  225. }
  226. var recordFilePath = "";
  227. function Operate() {
  228. recordFilePath = addform.Recorder.FilePath;
  229. addform.webedit.InsertFileToList(recordFilePath);
  230. }
  231. //-->
  232. </script>
  233. <script language=JavaScript src='scripts/language/schi/editor_lang.js'></script>
  234. <%
  235. if (request.getHeader("User-Agent").indexOf("MSIE")!=-1){
  236. out.println("<script language=JavaScript src='scripts/editor.js'></script>");
  237. }
  238. else{
  239. out.println("<script language=JavaScript src='scripts/moz/editor.js'></script>");
  240. }
  241. %>
  242. </head>
  243. <body bgcolor="#FFFFFF" text="#000000">
  244. <TABLE width="98%" BORDER=0 align="center" CELLPADDING=0 CELLSPACING=0>
  245.   <TR valign="top" bgcolor="#FFFFFF">
  246.     <TD width="" height="430" colspan="2" style="background-attachment: fixed; background-image: url(images/bg_bottom.jpg); background-repeat: no-repeat">
  247.           <TABLE cellSpacing=0 cellPadding=0 width="100%">
  248.             <TBODY>
  249.               <TR>
  250.                 <TD class=head>
  251. <%
  252. if (op.equals("add")) {%>
  253. 添加内容至--<a href="cms/document_list_m.jsp?dir_code=<%=StrUtil.UrlEncode(dir_code)%>&dir_name=<%=StrUtil.UrlEncode(dir_name)%>"><%=dir_name%></a>
  254. <%}else{%>
  255. 修改--
  256. <%
  257. Leaf dlf = new Leaf();
  258. if (doc!=null) {
  259. dlf = dlf.getLeaf(doc.getDirCode());
  260. }
  261. if (doc!=null && dlf.getType()==2) {%>
  262. <a href="cms/document_list_m.jsp?dir_code=<%=StrUtil.UrlEncode(dir_code)%>&dir_name=<%=StrUtil.UrlEncode(dir_name)%>"><%=dlf.getName()%></a>
  263. <%}else{%>
  264. <%=dir_name%>
  265. <%}%>
  266. (<%=doc.getDirCode()%>)
  267. <%}%>
  268. </TD>
  269.               </TR>
  270.             </TBODY>
  271.           </TABLE>
  272. <form name="addform" action="/admin/fwebedit_do.jsp" method="post">
  273.           <table border="0" cellspacing="1" width="100%" cellpadding="2" 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="true">
  276.   <input type="hidden" name=id value="<%=doc!=null?""+doc.getID():""%>">
  277. <%=doc!=null?"(id:"+doc.getID()+")":""%> <%if (doc!=null) {%>
  278. <!--( <a href="cms/comment_m.jsp?doc_id=<%=doc.getID()%>">管理评论</a> )-->
  279. <%}%></td>
  280.             </tr>
  281.             <tr>
  282.               <td colspan="2" align="left" valign="middle" bgcolor="#FFFFFF" class="unnamed2">
  283. <%
  284. // 如果是加入新文章
  285. if (doc==null) {   
  286. PluginMgr pm = new PluginMgr();
  287. PluginUnit pu = pm.getPluginUnitOfDir(dir_code);
  288. if (pu!=null) {
  289. IPluginUI ipu = pu.getUI(request);
  290. IPluginViewAddDocument pv = ipu.getViewAddDocument(dir_code);
  291. out.print(pu.getName(request) + ":&nbsp;" + pv.render(UIAddDocument.POS_TITLE) + "<BR>");
  292. out.print(pv.render(UIAddDocument.POS_FORM_ELEMENT) + "<BR>");
  293. }
  294. }
  295. else {
  296. PluginMgr pm = new PluginMgr();
  297. PluginUnit pu = pm.getPluginUnitOfDir(dir_code);
  298. if (pu!=null) {
  299. IPluginUI ipu = pu.getUI(request);
  300. IPluginViewEditDocument pv = ipu.getViewEditDocument(doc);
  301. out.print(pu.getName(request) + ":&nbsp;" + pv.render(UIAddDocument.POS_TITLE) + "<BR>");
  302. out.print(pv.render(UIAddDocument.POS_FORM_ELEMENT) + "<BR>");
  303. }
  304. }
  305. %>   </td>
  306.             </tr>
  307.             <tr>
  308.               <td align="left" class="unnamed2" valign="middle">作&nbsp;&nbsp;&nbsp;&nbsp;者:</td>
  309.               <td bgcolor="#F2F2F2"><input name="author" id="author" type="TEXT" size=30 maxlength=100 style="background-color:ffffff;color:000000;border: 1 double" value="<%=doc!=null?doc.getAuthor():privilege.getUser(request)%>">
  310.   <input type="hidden" name="op" value="<%=op%>"></td>
  311.             </tr>
  312.             <tr>
  313.               <td align="left" class="unnamed2" valign="middle">标&nbsp;&nbsp;&nbsp;&nbsp;题:</td>
  314.               <td width="92%" bgcolor="#FFFFFF">
  315.                   <input name="title" id=me type="TEXT" size=50 maxlength=100 style="background-color:ffffff;color:000000;border: 1 double" value="<%=doc!=null?doc.getTitle():""%>">                  
  316.                   <span class="unnamed2"><font color="#FF0000">*</font></span>   </td>
  317.             </tr>
  318.             <tr bgcolor="#F2F2F2">
  319.               <td align="left" class="unnamed2" valign="middle">关键字:</td>
  320.               <td bgcolor="#F2F2F2"><input name="keywords" id=keywords type="TEXT" size=30 maxlength=100 style="background-color:ffffff;color:000000;border: 1 double" value="<%=StrUtil.getNullStr(doc==null?dir_code:doc.getKeywords())%>">
  321.               ( 请用&quot;,&quot;号分隔)
  322. <input type="hidden" name="isRelateShow" value="1">
  323.   </td>
  324.             </tr>
  325.             <tr align="left">
  326.               <td align="left" valign="middle" class="unnamed2">&nbsp;评&nbsp;&nbsp;&nbsp;&nbsp;论:</td>
  327.             <td valign="middle" class="unnamed2"><%
  328. String strChecked = "";
  329. if (doc!=null) {
  330. if (doc.getCanComment())
  331. strChecked = "checked";
  332. }
  333. else
  334. strChecked = "checked";
  335. %>
  336.               <input type="checkbox" name="canComment" value="1" <%=strChecked%>>
  337. 允许
  338. <%if (doc!=null) {%>
  339. [<a href="cms/comment_m.jsp?doc_id=<%=doc.getID()%>">管理评论</a>]
  340. <%}%>
  341. &nbsp;
  342. <%if (doc!=null) {%>
  343. <input type="checkbox" name="isHome" value="<%=doc.getIsHome()?"false":"true"%>" <%=doc.getIsHome()?"checked":""%>>
  344. <%}else{%>
  345. <input type="checkbox" name="isHome" value="true" checked>
  346. <%}%>
  347. 置于首页
  348. <%
  349. LeafPriv lp = new LeafPriv(dir_code);
  350. if (lp.canUserExamine(privilege.getUser(request))) {
  351. %>
  352. &nbsp;&nbsp;&nbsp;&nbsp;
  353. <span class="style2">审核</span>
  354. <select name="examine">
  355.   <option value="<%=Document.EXAMINE_NOT%>">未审核</option>
  356.   <option value="<%=Document.EXAMINE_NOTPASS%>">未通过</option>
  357.   <option value="<%=Document.EXAMINE_PASS%>">已通过</option>
  358. </select>
  359. <%if (doc!=null) {%>
  360. <script>
  361. addform.examine.value = "<%=doc.getExamine()%>";
  362. </script>
  363. <%}%>
  364. <%}else{%>
  365. <input type="hidden" name="examine" value="<%=(doc!=null)?""+doc.getExamine():"0"%>">
  366. <%}%>
  367. <%
  368. String checknew = "";
  369. if (doc!=null && doc.getIsNew()==1)
  370. checknew = "checked";
  371. %>
  372. <input type="checkbox" name="isNew" value="1" <%=checknew%>>
  373. <img src="images/i_new.gif" width="18" height="7"></td>
  374.             </tr>
  375.             <tr align="left" bgcolor="#F2F2F2">
  376.               <td colspan="2" valign="middle" class="unnamed2">
  377.   <%if (doc!=null) {%>
  378.   <script>
  379.   var bcode = "<%=doc.getDirCode()%>";
  380.   </script>
  381.   &nbsp;分&nbsp;&nbsp;&nbsp;&nbsp;类:
  382. <select name="dir_code" onChange="if(this.options[this.selectedIndex].value=='not'){alert(this.options[this.selectedIndex].text+' 不能被选择!'); this.value=bcode; return false;}">
  383.   <option value="not" selected>请选择类别</option>
  384. <%
  385. Leaf lf = dir.getLeaf("root");
  386. DirectoryView dv = new DirectoryView(lf);
  387. dv.ShowDirectoryAsOptions(out, lf, lf.getLayer());
  388. %>
  389. </select>
  390. <script>
  391. addform.dir_code.value = "<%=doc.getDirCode()%>";
  392. </script>
  393. &nbsp;( <span class="style3">蓝色</span>表示可选 )   
  394. <%}else{%>
  395. <input type=hidden name="dir_code" value="<%=dir_code%>">
  396. <%}%>   </td>
  397.             </tr>
  398.             <tr align="left" bgcolor="#F2F2F2">
  399.               <td colspan="2" valign="middle" class="unnamed2">&nbsp;模板ID&nbsp;
  400.   <%
  401.   if (doc!=null)
  402.    templateId = doc.getTemplateId();
  403.   %>
  404.                 <input name="templateId" class="singleboarder" value="<%=templateId%>" size=3 readonly>
  405. &nbsp;<a href="javascript:showModalDialog('cms/doc_template_select_frame.jsp',window.self,'dialogWidth:640px;dialogHeight:480px;status:no;help:no;')">选模板</a> <span id=templateInfo>
  406. <%if (doc!=null && doc.getTemplateId()!=doc.NOTEMPLATE) {%>
  407. <a target=_blank href="cms/doc_template_show.jsp?id=<%=doc.getTemplateId()%>">预览模板</a>
  408. <a href="javascript:oEdit1.putHTML(divTemplate.innerHTML)">重新应用模板</a>
  409. <a href="javascript:window.location.href='fwebedit.jsp?op=edit&action=selTemplate&id=<%=id%>&dir_code=<%=StrUtil.UrlEncode(dir_code)%>&dir_name=<%=StrUtil.UrlEncode(dir_name)%>&templateId=-1'">取消模板</a>
  410. <%}else{%> 
  411. <a href="#" onClick="if (addform.templateId.value!=-1) window.open('cms/doc_template_show.jsp?id=' + addform.templateId.value); else alert('当前未选择模板')">预览模板</a>
  412. &nbsp;<a href="#" onClick="addform.templateId.value='-1';oEdit1.putHTML(' ')">取消模板</a>
  413. <%}%>
  414. </span></td>
  415.             </tr>
  416.             <tr bgcolor="#F2F2F2">
  417.               <td align="right" class="unnamed2" valign="middle">
  418.   <script>
  419.   var vp = "";
  420.   </script>
  421. <%
  422. String display="none",ischecked="false", isreadonly = "";
  423. if (doc!=null) {
  424. if (doc.getType()==1) {
  425. display = "";
  426. ischecked = "checked disabled";
  427. isreadonly = "readonly";
  428. %>
  429. <script>
  430. var voteoption = "<%=doc.getVoteOption()%>";
  431. var votes = voteoption.split("|");
  432. var len = votes.length;
  433. for (var i=0; i<len; i++) {
  434. if (vp=="")
  435. vp = votes[i];
  436. else
  437. vp += "rn" + votes[i];
  438. }
  439. </script>
  440. <%}
  441. }%>
  442.   <input type="checkbox" name="isvote" value="1" onClick="showvote()" <%=ischecked%>>
  443.               投票</td>
  444.               <td valign="middle"><textarea <%=isreadonly%> style="display:<%=display%>" cols="60" name="vote" rows="8" wrap="VIRTUAL" title="输入投票选项">
  445.   </textarea>
  446.   <script>
  447.    addform.vote.value = vp;
  448.   </script>
  449. 每行代表一个选项</td>
  450.             </tr>
  451.             <tr align="center">
  452.               <td colspan="2" valign="top" bgcolor="#F2F2F2" class="unnamed2">
  453. <pre id="idTemporary" name="idTemporary" style="display:none">
  454. <%
  455. if (!op.equals("add")) {
  456. %>
  457. <%=strutil.HTMLEncode(strutil.getNullString(doc.getContent(1)))%>
  458. <%}%>
  459. </pre>
  460. <pre id="divTemplate" name="divTemplate" style="display:none">
  461. <%if (template!=null) {%>
  462. <%=template.getContent(1)%>
  463. <%}%>
  464. </pre>
  465.  <script>
  466. var oEdit1 = new InnovaEditor("oEdit1");
  467. oEdit1.width="100%";
  468. oEdit1.height="500";
  469. oEdit1.features=["FullScreen","Preview","Print","Search","SpellCheck",
  470. "Cut","Copy","Paste","PasteWord","PasteText","|","Undo","Redo","|",
  471. "ForeColor","BackColor","|","Bookmark","Hyperlink",
  472. "HTMLFullSource","HTMLSource","XHTMLFullSource",
  473. "XHTMLSource","BRK","Numbering","Bullets","|","Indent","Outdent","LTR","RTL","|","Image","Flash","Media","|","InternalLink","CustomObject","|",
  474. "Table","Guidelines","Absolute","|","Characters","Line",
  475. "Form","Clean","ClearAll","BRK",
  476. "StyleAndFormatting","TextFormatting","ListFormatting","BoxFormatting",
  477. "ParagraphFormatting","CssText","Styles","|",
  478. "Paragraph","FontName","FontSize","|",
  479. "Bold","Italic",
  480. "Underline","Strikethrough","|","Superscript","Subscript","|",
  481. "JustifyLeft","JustifyCenter","JustifyRight","JustifyFull"]; 
  482. <%if (templateId!=-1 && doc==null) {%>
  483. oEdit1.RENDER(document.getElementById("divTemplate").innerHTML);
  484. <%}else{%>
  485. oEdit1.RENDER(document.getElementById("idTemporary").innerHTML);
  486. <%}%>
  487. </script>             </td>
  488.             </tr>
  489.             <tr>
  490.               <td width="8%" align="right" bgcolor="#FFFFFF">提示:</td>
  491.               <td bgcolor="#FFFFFF">
  492.   回车可用Shift+Enter   </td>
  493.             </tr>
  494.             <tr>
  495.               <td height="25" colspan=2 align="center" bgcolor="#FFFFFF">
  496.   <%
  497.   if (doc!=null) {
  498.   Vector attachments = doc.getAttachments(1);
  499.   Iterator ir = attachments.iterator();
  500.   while (ir.hasNext()) {
  501.    Attachment am = (Attachment) ir.next(); %>
  502. <table width="98%"  border="0" cellspacing="0" cellpadding="0">
  503.                       <tr>
  504.                         <td width="7%" align="center"><img src=images/attach.gif width="17" height="17"></td>
  505.                         <td width="93%">&nbsp;
  506.                           <input name="attach_name<%=am.getId()%>" value="<%=am.getName()%>" size="30">
  507. &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="<%=Global.getRootPath()%>/<%=am.getVisualPath() + am.getDiskName()%>">查看</a>&nbsp;<a href="?op=edit&id=<%=doc.getID()%>&action=changeAttachOrders&direction=up&attachId=<%=am.getId()%>"><img src="images/arrow_up.gif" alt="往上" width="16" height="20" border="0" align="absmiddle"></a>&nbsp;<a href="?op=edit&id=<%=doc.getID()%>&action=changeAttachOrders&direction=down&attachId=<%=am.getId()%>"><img src="images/arrow_down.gif" alt="往下" width="16" height="20" border="0" align="absmiddle"></a></td>
  508.                       </tr>
  509.                     </table>
  510. <%}
  511.   }
  512.   %>   </td>
  513.             </tr>
  514.             <tr>
  515.               <td height="153" colspan=2 align=center bgcolor="#FFFFFF">
  516.   <table  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
  517.                 <tr>
  518.                   <td bgcolor="#FFFFFF"><%
  519. Calendar cal = Calendar.getInstance();
  520. String year = "" + (cal.get(cal.YEAR));
  521. String month = "" + (cal.get(cal.MONTH) + 1);
  522. com.redmoon.oa.Config cfg = new com.redmoon.oa.Config();
  523. String filepath = cfg.get("file_folder") + "/" + year + "/" + month;
  524. %><object classid="CLSID:DE757F80-F499-48D5-BF39-90BC8BA54D8C" codebase="<%=request.getContextPath()%>/activex/webedit.cab#version=4,0,1,1" width=400 height=280 align="middle" id="webedit">
  525.                       <param name="Encode" value="utf-8">
  526.   <param name="MaxSize" value="<%=Global.MaxSize%>"> <!--上传字节-->
  527.                       <param name="ForeColor" value="(0,255,0)">
  528.                       <param name="BgColor" value="(0,0,0)">
  529.                       <param name="ForeColorBar" value="(255,255,255)">
  530.                       <param name="BgColorBar" value="(0,0,255)">
  531.                       <param name="ForeColorBarPre" value="(0,0,0)">
  532.                       <param name="BgColorBarPre" value="(200,200,200)">
  533.                       <param name="FilePath" value="<%=filepath%>">
  534.                       <param name="Relative" value="1">
  535.                       <!--上传后的文件需放在服务器上的路径-->
  536.                       <param name="Server" value="<%=request.getServerName()%>">
  537.                       <param name="Port" value="<%=request.getServerPort()%>">
  538.                       <param name="VirtualPath" value="<%=Global.virtualPath%>">
  539.                       <param name="PostScript" value="<%=Global.virtualPath%>/fwebedit_do.jsp">
  540.                       <param name="PostScriptDdxc" value="<%=Global.virtualPath%>/ddxc.jsp">
  541.                       <param name="SegmentLen" value="204800">
  542.                     </object>
  543. </td>
  544.                 </tr>
  545.               </table>              </td>
  546.             </tr>
  547.             <tr>
  548.               <td height="" colspan=2 align=center bgcolor="#FFFFFF">
  549.   <div id=recorderDiv style="display:none"><OBJECT ID="Recorder" CLASSID="CLSID:E4A3D135-E189-48AF-B348-EF5DFFD99A67"></OBJECT></div></td>
  550.             </tr>
  551.             <tr>
  552.               <td height="30" colspan=2 align=center bgcolor="#FFFFFF">
  553.   <%
  554.   String action = "";
  555.   if (op.equals("add"))
  556.    action = "添 加";
  557.   else
  558.    action = "修 改";
  559.   %>
  560.   <%if (templateId==-1) {%>
  561.               <input name="cmdok2" type="button" class="singleboarder" value="<%=action%>(断点续传)" onClick="return SubmitWithFileDdxc()">
  562.               <%}
  563.   if (templateId==-1) {%>
  564.               <input name="cmdok3" type="button" class="singleboarder" value="<%=action%>(单线程)" onClick="return SubmitWithFileThread()">
  565.               <%}
  566.   if (templateId==-1) {%>
  567.   <input name="cmdok" type="button" class="singleboarder" value=" <%=action%> " onClick="return SubmitWithFile()">
  568.   <%}%>
  569. &nbsp;
  570. <input name="notuploadfile" type="button" class="singleboarder" value="<%=action%>(不上传文件)" onClick="return SubmitWithoutFile()">
  571. &nbsp;
  572.       <input name="cmdcancel" type="button" class="singleboarder" onClick="ClearAll()" value=" 清 空 ">
  573.       <br>
  574. &nbsp;<br>
  575.       <%if (op.equals("edit")) {%>
  576.   <input name="editbtn" type="button" class="singleboarder" onClick="location.href='doc_abstract.jsp?id=<%=doc.getID()%>'" value=" 摘要 ">
  577.   <%}%>
  578. &nbsp;
  579. <input name="remsg" type="button" class="singleboarder" onClick='alert(webedit.ReturnMessage)' value="返回信息">
  580. &nbsp;
  581.       <%if (op.equals("edit")) {
  582.    String viewPage = "doc_show.jsp";
  583. PluginMgr pm = new PluginMgr();
  584. PluginUnit pu = pm.getPluginUnitOfDir(dir_code);
  585. if (pu!=null) {
  586. IPluginUI ipu = pu.getUI(request);
  587. viewPage = ipu.getViewPage();
  588. }
  589.   %>
  590. <input name="remsg" type="button" class="singleboarder" onClick='window.open("<%=viewPage%>?id=<%=id%>")' value="预览">
  591. &nbsp;&nbsp; <input name="remsg2" type="button" class="singleboarder" onClick="recorderDiv.style.display=''" value="录制语音"></td>
  592.   <%}%>
  593.             </tr>
  594.         </table>
  595.     </form>
  596. <table width="100%"  border="0">
  597.           <tr>
  598.             <td align="center">
  599. <%if (doc!=null) {
  600. int pageNum = 1;
  601. %>
  602. 文章共<%=doc.getPageCount()%>页&nbsp;&nbsp;页码
  603.             <%
  604. int pagesize = 1;
  605. int total = DocContent.getContentCount(doc.getID());
  606. int curpage,totalpages;
  607. Paginator paginator = new Paginator(request, total, pagesize);
  608. // 设置当前页数和总页数
  609. totalpages = paginator.getTotalPages();
  610. curpage = paginator.getCurrentPage();
  611. if (totalpages==0)
  612. {
  613. curpage = 1;
  614. totalpages = 1;
  615. }
  616. String querystr = "op=edit&doc_id=" + id;
  617. out.print(paginator.getCurPageBlock("doc_editpage.jsp?"+querystr));
  618. %>
  619.             <%if (op.equals("edit")) {
  620. if (doc.getPageCount()!=pageNum) {
  621. %>
  622. &nbsp;<a href="doc_editpage.jsp?op=add&action=insertafter&doc_id=<%=doc.getID()%>&afterpage=<%=pageNum%>">当前页之后插入一页</a>
  623. <% }
  624. }%>
  625. &nbsp;<a href="doc_editpage.jsp?op=add&doc_id=<%=doc.getID()%>">增加一页</a>
  626. <%}%>
  627. </td>
  628.           </tr>
  629.           <tr>
  630.             <form name="form3" action="?" method="post"><td align="center">
  631. <input name="newname" type="hidden">
  632. </td></form>
  633.           </tr>
  634.         </table>
  635. </TD>
  636.   </TR>
  637. </TABLE>
  638. <iframe id="hideframe" name="hideframe" src="fwebedit_do.jsp" width=0 height=0></iframe>
  639. </body>
  640. <script>
  641. function findObj(theObj, theDoc)
  642. {
  643.   var p, i, foundObj;
  644.   
  645.   if(!theDoc) theDoc = document;
  646.   if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  647.   {
  648.     theDoc = parent.frames[theObj.substring(p+1)].document;
  649.     theObj = theObj.substring(0,p);
  650.   }
  651.   if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  652.   for (i=0; !foundObj && i < theDoc.forms.length; i++) 
  653.     foundObj = theDoc.forms[i][theObj];
  654.   for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
  655.     foundObj = findObj(theObj,theDoc.layers[i].document);
  656.   if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  657.   
  658.   return foundObj;
  659. }
  660. function changeAttachName(attach_id, doc_id, nm) {
  661. var obj = findObj(nm);
  662. // document.frames.hideframe.location.href = "fwebedit_do.jsp?op=changeattachname&page_num=1&doc_id=" + doc_id + "&attach_id=" + attach_id + "&newname=" + obj.value
  663. form3.action = "fwebedit_do.jsp?op=changeattachname&page_num=1&doc_id=" + doc_id + "&attach_id=" + attach_id;
  664. form3.newname.value = obj.value;
  665. form3.submit();
  666. }
  667. function delAttach(attach_id, doc_id) {
  668. if (!window.confirm("您确定要删除吗?")) {
  669. return;
  670. }
  671. document.frames.hideframe.location.href = "fwebedit_do.jsp?op=delAttach&page_num=1&doc_id=" + doc_id + "&attach_id=" + attach_id
  672. }
  673. </script>
  674. </html>