Templets_Edit_.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,str_CurrPath,sRootDir
  21. if G_VIRTUAL_ROOT_DIR<>"" then sRootDir="/"+G_VIRTUAL_ROOT_DIR else sRootDir=""
  22. if Session("Admin_Is_Super") = 1 then
  23. str_CurrPath = sRootDir &"/"&G_UP_FILES_DIR
  24. Else
  25. str_CurrPath = Replace(sRootDir &"/"&G_UP_FILES_DIR&"/adminfiles/"&Session("Admin_Name"),"//","/")
  26. End if
  27. FileName = Request.QueryString("File")
  28. NewsTempletPath = Replace(Request.QueryString("Dir"),"..","")
  29. If Not IsSelfRefer Then response.write "非法提交数据":Response.end
  30. if Trim(NewsTempletPath)="" then Response.Write("错误参数"):response.end
  31. if Lcase(instr(Lcase(NewsTempletPath),Lcase(G_TEMPLETS_DIR)))=0 then Response.Write("非法请求"):response.end
  32. if G_VIRTUAL_ROOT_DIR = "" then:tempRootPath = Replace(Replace("/" &NewsTempletPath,"//","/"),"//","/"):else:tempRootPath =Replace(Replace( "/" & NewsTempletPath,"//","/"),"//","/"):end if
  33. If IsValidStr(tempRootPath,"(/){2,}|(\)+") Then:Response.write "路径错误":Response.end
  34. EditFile = Server.MapPath(Replace(Replace(tempRootPath&"/"&FileName,"//","/"),"//","/"))
  35. Dim FsoObj,FileObj,FileStreamObj,strShowErr
  36. Set FsoObj = Server.CreateObject(G_FS_FSO)
  37. If Request.Form("Action")="Save" Then
  38. On Error Resume Next
  39. set FileObj= FsoObj.openTextFile(EditFile,2,1)
  40. FileObj.write Request.Form("FileContent")
  41. FileObj.close
  42. set fileObj = nothing
  43. if Err.number<>0 then
  44. strShowErr = "<li>保存失败,可能是您没开启模板的写入权限.</li><li>可能是你服务器不支持FSO组件</li><li><a href=""javascript:history.back()"">继续编辑</a>&nbsp;&nbsp;</li>"
  45. Response.Redirect("Error.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=Templets_List.asp?ShowPath="&Request.QueryString("Dir")&"")
  46. Response.end
  47. else
  48. strShowErr = "<li>保存模板成功.</li><li><a href=""javascript:history.back()"">继续编辑</a>&nbsp;&nbsp;</li>"
  49. Response.Redirect("Success.asp?ErrCodes="&Server.URLEncode(strShowErr)&"&ErrorUrl=Templets_List.asp?ShowPath="&Request.QueryString("Dir")&"")
  50. Response.end
  51. end if
  52. End IF
  53. Set FileObj = FsoObj.GetFile(EditFile)
  54. Set FileStreamObj = FileObj.OpenAsTextStream(1)
  55. if Not FileStreamObj.AtEndOfStream then:FileContent = FileStreamObj.ReadAll:else:FileContent = "":end If
  56. %>
  57. <html xmlns="http://www.w3.org/1999/xhtml">
  58. <HEAD>
  59. <TITLE>FoosunCMS</TITLE>
  60. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
  61. </HEAD>
  62. <script language="JavaScript" src="../FS_Inc/PublicJS.js" type="text/JavaScript"></script>
  63. <script language="JavaScript" src="../FS_Inc/Prototype.js"></script>
  64. <script language="JavaScript" type="text/javascript" src="../FS_Inc/Get_Domain.asp"></script>
  65. <script language="JavaScript" type="text/javascript" src="../Editor/FS_scripts/editor.js"></script>
  66. <link href="images/skin/Css_<%=Session("Admin_Style_Num")%>/<%=Session("Admin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  67. <BODY  LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=yes>
  68. <table width="98%" border="0" align="center" cellpadding="5" cellspacing="1" class="table" >
  69. <form name="form1" method="post" action="">
  70. <tr class="hback">
  71. <td height="20" colspan="5"  class="xingmu">
  72. <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")%>    路径:
  73. <%if Trim(Request.QueryString("Dir")) = "" then:Response.Write("根目录"):else:Response.Write Trim(Request.QueryString("Dir")):end if%>
  74. </div>
  75. </td>
  76. </tr>
  77. <tr class="hback">
  78. <td colspan="5" valign="top">
  79. <table width="100%" border="0" cellspacing="0" cellpadding="2">
  80. <tr class="hback">
  81. <td height="33">
  82. <label>
  83. <select name="Lable_Name" id="Lable_Name">
  84. <option value="">==选择标签==</option>
  85. <%
  86.   dim rs
  87.   set rs = Conn.execute("select LableName From FS_MF_Lable where isDel=0 order by id desc")
  88.   do while not rs.eof
  89.    response.Write "<option value="""&rs("LableName")&""">┄"&replace(replace(rs("LableName"),"{FS400_",""),"}","")&"</option>"
  90.   rs.movenext
  91.   loop
  92.   rs.close:set rs = nothing
  93.   %>
  94. </select>
  95. <input type="button" onClick="Insertlabel_Sel($('Lable_Name'));" value=" 插入标签 ">
  96. <input type="button" name="Button" value="选择标签" onClick="Insertlabel_News('../<%=G_ADMIN_DIR%>/label/Label_List.asp',400,350,'obj');">
  97. </label>
  98. </td>
  99. </tr>
  100. </table>
  101. <!--编辑器开始-->
  102. <pre id="idTemporary" name="idTemporary" style="display:none"><%=Server.HTMLEncode(FileContent)%></pre>
  103. <script language="JavaScript">
  104. <!--
  105. var FS_Edit1 = new InnovaEditor("FS_Edit1");
  106. FS_Edit1.cmdAssetManager="modalDialogShow('../../<% = G_ADMIN_DIR %>/CommPages/SelectManageDir/SelectPic.asp?CurrPath=<% = str_CurrPath %>',670,450)";
  107. FS_Edit1.width="100%";
  108. FS_Edit1.height="446";
  109. FS_Edit1.btnFlash=true;
  110. FS_Edit1.btnMedia=true;        
  111. FS_Edit1.btnXHTMLFullSource=true;
  112. FS_Edit1.btnXHTMLSource=false;
  113. FS_Edit1.RENDER($("idTemporary").innerHTML);
  114. //-->
  115. </script>
  116. <textarea name="FileContent" style="display:none" ></textarea>
  117. <!--编辑器结束-->
  118. </td>
  119. </tr>
  120. <tr class="hback">
  121. <td colspan="5" height="39">
  122. <div align="left">
  123. <input type="button" name="Submit" onClick="CheckForm(this.form);" value="保存模板">
  124. <input type="reset" name="Submit" value="恢复模板">
  125. <input name="Action" type="hidden" id="Action" value="Save">
  126. <input name="CodeTF" type="checkbox" id="CodeTF" value="1" style="display:none">
  127. </div>
  128. </td>
  129. </tr>
  130. </form>
  131. </table>
  132. </body>
  133. </html>
  134. <script language="JavaScript" type="text/JavaScript">
  135. function CheckForm(FormObj)
  136. {
  137. FormObj.FileContent.value = FS_Edit1.getXHTML();
  138. FormObj.submit();
  139. }
  140. function Insertlabel_News(URL,widthe,heighte,obj)
  141. {
  142.   var obj=window.OpenWindowAndSetValue("../Fs_Inc/convert.htm?"+URL,widthe,heighte,'window',obj);
  143.   if (obj==undefined)return false;
  144.   if (obj!='')InsertEditor(obj);
  145. }
  146. function Insertlabel_Sel(Lable_obj)
  147. {
  148. if(Lable_obj.options[Lable_obj.selectedIndex].value==''){
  149. return false;
  150. }else{
  151. InsertEditor(Lable_obj.options[Lable_obj.selectedIndex].value);
  152. }
  153. }
  154. function InsertEditor(InsertValue)
  155. {
  156. FS_Edit1.insertHTML(InsertValue);
  157. }
  158. function opencat(cat)
  159. {
  160.   if(cat.style.display=="none"){
  161.      cat.style.display="";
  162.   } else {
  163.      cat.style.display="none"; 
  164.   }
  165. }
  166. </script>
  167. <%
  168. Set FsoObj = Nothing
  169. Set FileObj = Nothing
  170. Set FileStreamObj = Nothing
  171. %>