Templets_Edit_text.asp
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:7k
源码类别:

数据库编程

开发平台:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../FS_Inc/Const.asp" -->
  3. <!--#include file="../FS_InterFace/MF_Function.asp" -->
  4. <!--#include file="../FS_Inc/Function.asp" -->
  5. <%'Copyright (C)2006 Foosun Inc. Codey By simpwind.Xie
  6. Response.Buffer = True
  7. Response.Expires = -1
  8. Response.ExpiresAbsolute = Now() - 1
  9. Response.Expires = 0
  10. Response.CacheControl = "no-cache"
  11. Dim Conn
  12. MF_Default_Conn
  13. '得到session
  14. MF_Session_TF
  15. if not MF_Check_Pop_TF("MF_Templet") then Err_Show
  16. if not MF_Check_Pop_TF("MF006") then Err_Show
  17. if not MF_Check_Pop_TF("MF001") then Err_Show
  18. Dim FileName,EditFile,FileContent
  19. Dim NewsTempletpath,ParentPath,tmp_path
  20. Dim tempRootPath '模板根路径
  21. FileName = Request.QueryString("File")
  22. NewsTempletPath = Replace(Request.QueryString("Dir"),"..","")
  23. If Not IsSelfRefer Then response.write "非法提交数据":Response.end
  24. if Trim(NewsTempletPath)="" then Response.Write("错误参数"):response.end
  25. if Lcase(instr(Lcase(NewsTempletPath),Lcase(G_TEMPLETS_DIR)))=0 then Response.Write("非法请求"):response.end
  26. if G_VIRTUAL_ROOT_DIR = "" then:tempRootPath = Replace(Replace("/" &NewsTempletPath,"//","/"),"//","/"):else:tempRootPath =Replace(Replace( "/" & NewsTempletPath,"//","/"),"//","/"):end if
  27. If IsValidStr(tempRootPath,"(/){2,}|(\)+") Then:Response.write "路径错误":Response.end
  28. EditFile = Server.MapPath(Replace(Replace(tempRootPath&"/"&FileName,"//","/"),"//","/"))
  29. Dim FsoObj,FileObj,FileStreamObj,strShowErr
  30. Set FsoObj = Server.CreateObject(G_FS_FSO)
  31. If Request.Form("Action")="Save" Then
  32. On Error Resume Next
  33. set FileObj= FsoObj.openTextFile(EditFile,2,1)
  34. FileObj.write Request.Form("FileContent")
  35. FileObj.close
  36. set fileObj = nothing
  37. if Err.number<>0 then
  38. strShowErr = "<li>保存失败,可能是您没开启模板的写入权限.</li><li>可能是你服务器不支持FSO组件</li><li><a href=""javascript:history.back()"">继续编辑</a>&nbsp;&nbsp;</li>"
  39. Response.Redirect("Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=Templets_List.asp?ShowPath="&Request.QueryString("Dir")&"")
  40. Response.end
  41. else
  42. strShowErr = "<li>保存模板成功.</li><li><a href=""javascript:history.back()"">继续编辑</a>&nbsp;&nbsp;</li>"
  43. Response.Redirect("Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=Templets_List.asp?ShowPath="&Request.QueryString("Dir")&"")
  44. Response.end
  45. end if
  46. End IF
  47. Set FileObj = FsoObj.GetFile(EditFile)
  48. Set FileStreamObj = FileObj.OpenAsTextStream(1)
  49. if Not FileStreamObj.AtEndOfStream then:FileContent = FileStreamObj.ReadAll:else:FileContent = "":end If
  50. %>
  51. <html xmlns="http://www.w3.org/1999/xhtml">
  52. <HEAD>
  53. <TITLE>FoosunCMS</TITLE>
  54. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
  55. </HEAD>
  56. <script language="JavaScript" src="../FS_Inc/PublicJS.js" type="text/JavaScript"></script>
  57. <script language="JavaScript" src="../FS_Inc/Prototype.js"></script>
  58. <script language="JavaScript" type="text/javascript" src="../FS_Inc/Get_Domain.asp"></script>
  59. <script language="JavaScript" type="text/javascript" src="../word_edit/word_edit.js"></script>
  60. <link rel="Stylesheet" href="../word_edit/images/word_Templet.css" type="text/css" media="all" />
  61. <link href="images/skin/Css_<%=Session("Admin_Style_Num")%>/<%=Session("Admin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  62. <BODY  LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=yes>
  63. <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table" >
  64.   <form name="form1" method="post" action="">
  65.     <tr class="hback"> 
  66.       <td height="20" colspan="5"  class="xingmu"> <div align="left">文本编辑模板 <a href="../help?label=MF_Templet_Edit" target="_blank" style="cursor:help;'" class="sd"><img src="Images/_help.gif" width="50" height="17" border="0"></a>  <a href="Templets_List.asp" class="sd">模板管理首页</a>   文件名:<%=Request.QueryString("File")%> 
  67.              路径:<%if Trim(Request.QueryString("Dir")) = "" then:Response.Write("根目录"):else:Response.Write Trim(Request.QueryString("Dir")):end if%></div></td>
  68.     </tr>
  69.     <tr class="hback"> 
  70.       <td height="239" colspan="5" valign="top"> 
  71.         <table width="100%" border="0" cellspacing="0" cellpadding="2">
  72.           <tr class="hback">
  73.             <td width="28%" height="33"><label>
  74.               <select name="Lable_Name" id="Lable_Name">
  75.                 <option value="">==选择标签==</option>
  76.               <%
  77.   dim rs
  78.   set rs = Conn.execute("select LableName From FS_MF_Lable where isDel=0 order by id desc")
  79.   do while not rs.eof
  80.    response.Write "<option value="""&rs("LableName")&""">┄"&replace(replace(rs("LableName"),"{FS400_",""),"}","")&"</option>"
  81.   rs.movenext
  82.   loop
  83.   rs.close:set rs = nothing
  84.   %>
  85.               </select>
  86.               <input type="button" onClick="if(this.form.Lable_Name.options[this.form.Lable_Name.selectedIndex].value==''){return false;}else{insert(this.form.Lable_Name.options[this.form.Lable_Name.selectedIndex].value);}" value=" 插入标签 ">
  87.             </label></td>
  88.             <td width="72%" height="33"><label>
  89.               <input type="button" name="Submit3" value="选择标签" onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/Label_List.asp',400,350,'obj');">
  90.             </label></td>
  91.           </tr>
  92.         </table>
  93.         <textarea name="FileContent" rows="28" style="width:100%"><% = FileContent %></textarea>
  94.       </td>
  95.     </tr>
  96.     <tr class="hback"> 
  97.       <td colspan="5" height="39"> 
  98.         <div align="left">
  99.           <input type="submit" name="Submit" value="保存模板">
  100.           <input type="reset" name="Submit2" value="恢复模板">
  101.           <input name="Action" type="hidden" id="Action" value="Save">
  102.           <input name="CodeTF" type="checkbox" id="CodeTF" value="1" style="display:none">
  103.         </div></td>
  104.     </tr>
  105.   </form>
  106. </table>
  107. </body>
  108. </html>
  109. <script language="JavaScript" type="text/JavaScript">
  110. function Insertlabel_News(URL,widthe,heighte,obj)
  111. {
  112.   var obj=window.OpenWindowAndSetValue("../Fs_Inc/convert.htm?"+URL,widthe,heighte,'window',obj)
  113.   if (obj==undefined)return false;
  114.   if (obj!='')insert(obj);
  115.   }
  116. function insert(returnValue_lable)
  117. {
  118. obj=document.getElementById("FileContent");
  119. obj.focus();
  120. if(document.selection==null)
  121. {
  122. var iStart = obj.selectionStart
  123. var iEnd = obj.selectionEnd;
  124. obj.value = obj.value.substring(0, iEnd) +returnValue_lable+ obj.value.substring(iEnd, obj.value.length);
  125. }else
  126. {
  127. var range = document.selection.createRange();
  128. range.text=returnValue_lable;
  129. }
  130. }
  131. function opencat(cat)
  132. {
  133.   if(cat.style.display=="none"){
  134.      cat.style.display="";
  135.   } else {
  136.      cat.style.display="none"; 
  137.   }
  138. }
  139. </script>
  140. <%
  141. Set FsoObj = Nothing
  142. Set FileObj = Nothing
  143. Set FileStreamObj = Nothing
  144. %>