eWebEditor.asp
上传用户:btntkt
上传日期:2021-04-16
资源大小:5296k
文件大小:12k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

DOS

  1. <!--#include file = "Include/Startup.asp"-->
  2. <%
  3. ' 初始输入参数
  4. Dim sContentID, sStyleID, sFullScreen
  5. Dim sStyleName, sStyleDir, sStyleCSS, sStyleUploadDir, nStateFlag, sDetectFromWord, sInitMode, sBaseUrl, sBaseHref, sAutoRemote, sShowBorder
  6. Dim sVersion, sReleaseDate, sLicense
  7. Dim aButtonCode(), aButtonHTML()
  8. Dim sToolBar, sToolBarNormal, sToolBarFullScreen
  9. ' 初始化
  10. Call Init()
  11. %>
  12. <html>
  13. <head>
  14. <title>eWebEditor - eWebSoft在线编辑器</title>
  15. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  16. <link href="css/<%=sStyleCSS%>/Editor.css" type="text/css" rel="stylesheet">
  17. <Script Language=Javascript>
  18. var sPath = document.location.pathname;
  19. sPath = sPath.substr(0, sPath.length-14);
  20. var sLinkFieldName = "<%=sContentID%>" ;
  21. var sLinkOriginalFileName = "<%=Request.QueryString("originalfilename")%>" ;
  22. var sLinkSaveFileName = "<%=Request.QueryString("savefilename")%>" ;
  23. var sLinkSavePathFileName = "<%=Request.QueryString("savepathfilename")%>" ;
  24. // 全局设置对象
  25. var config = new Object() ;
  26. config.Version = "<%=sVersion%>" ;
  27. config.ReleaseDate = "<%=sReleaseDate%>" ;
  28. config.License = "<%=sLicense%>" ;
  29. config.StyleName = "<%=sStyleName%>";
  30. config.StyleMenuHeader = "<head><link href=""+sPath+"css/<%=sStyleCSS%>/MenuArea.css" type="text/css" rel="stylesheet"></head><body scroll="no" onConTextMenu="event.returnValue=false;">";
  31. config.StyleDir = "<%=sStyleDir%>";
  32. config.StyleUploadDir = "<%=sStyleUploadDir%>";
  33. config.InitMode = "<%=sInitMode%>";
  34. config.AutoDetectPasteFromWord = <%=sDetectFromWord%>;
  35. config.BaseUrl = "<%=sBaseUrl%>";
  36. config.BaseHref = "<%=sBaseHref%>";
  37. config.AutoRemote = "<%=sAutoRemote%>";
  38. config.ShowBorder = "<%=sShowBorder%>";
  39. var sBaseHref = "";
  40. if(config.BaseHref!=""){
  41. sBaseHref = "<base href="" + document.location.protocol + "//" + document.location.host + config.BaseHref + "">";
  42. }
  43. config.StyleEditorHeader = "<head><link href="" + sPath + "css/<%=sStyleCSS%>/EditorArea.css" type="text/css" rel="stylesheet">" + sBaseHref + "</head><body MONOSPACE>" ;
  44. </Script>
  45. <Script Language=Javascript src="include/editor.js"></Script>
  46. <Script Language=Javascript src="include/table.js"></Script>
  47. <Script Language=Javascript src="include/menu.js"></Script>
  48. <script language="javascript" event="onerror(msg, url, line)" for="window">
  49. return true ;  // 隐藏错误
  50. </script>
  51. </head>
  52. <body SCROLLING=no onConTextMenu="event.returnValue=false;">
  53. <table border=0 cellpadding=0 cellspacing=0 width='100%' height='100%'>
  54. <tr><td>
  55. <%=sToolBar%>
  56. </td></tr>
  57. <tr><td height='100%'>
  58. <table border=0 cellpadding=0 cellspacing=0 width='100%' height='100%'>
  59. <tr><td height='100%'>
  60. <input type="hidden" ID="ContentEdit" value="">
  61. <input type="hidden" ID="ModeEdit" value="">
  62. <input type="hidden" ID="ContentLoad" value="">
  63. <input type="hidden" ID="ContentFlag" value="0">
  64. <iframe class="Composition" ID="eWebEditor" MARGINHEIGHT="1" MARGINWIDTH="1" width="100%" height="100%" scrolling="yes"> 
  65. </iframe>
  66. </td></tr>
  67. </table>
  68. </td></tr>
  69. <% If nStateFlag = 1 Then %>
  70. <tr><td height=25>
  71. <TABLE border="0" cellPadding="0" cellSpacing="0" width="100%" class=StatusBar height=25>
  72. <TR valign=middle>
  73. <td>
  74. <table border=0 cellpadding=0 cellspacing=0 height=20>
  75. <tr>
  76. <td width=10></td>
  77. <td class=StatusBarBtnOff id=eWebEditor_CODE onclick="setMode('CODE')"><img border=0 src="buttonimage/<%=sStyleDir%>/modecode.gif" width=50 height=15 align=absmiddle></td>
  78. <td width=5></td>
  79. <td class=StatusBarBtnOff id=eWebEditor_EDIT onclick="setMode('EDIT')"><img border=0 src="buttonimage/<%=sStyleDir%>/modeedit.gif" width=50 height=15 align=absmiddle></td>
  80. <td width=5></td>
  81. <td class=StatusBarBtnOff id=eWebEditor_TEXT onclick="setMode('TEXT')"><img border=0 src="buttonimage/<%=sStyleDir%>/modetext.gif" width=50 height=15 align=absmiddle></td>
  82. <td width=5></td>
  83. <td class=StatusBarBtnOff id=eWebEditor_VIEW onclick="setMode('VIEW')"><img border=0 src="buttonimage/<%=sStyleDir%>/modepreview.gif" width=50 height=15 align=absmiddle></td>
  84. </tr>
  85. </table>
  86. </td>
  87. <td align=center id=eWebEditor_License style="font-size:9pt"></td>
  88. <td align=right>
  89. <table border=0 cellpadding=0 cellspacing=0 height=20>
  90. <tr>
  91. <td style="cursor:pointer;" onclick="sizeChange(300)"><img border=0 SRC="buttonimage/<%=sStyleDir%>/sizeplus.gif" width=20 height=20 alt="增高编辑区"></td>
  92. <td width=5></td>
  93. <td style="cursor:pointer;" onclick="sizeChange(-300)"><img border=0 SRC="buttonimage/<%=sStyleDir%>/sizeminus.gif" width=20 height=20 alt="减小编辑区"></td>
  94. <td width=40></td>
  95. </tr>
  96. </table>
  97. </td>
  98. </TR>
  99. </Table>
  100. </td></tr>
  101. <% End If %>
  102. </table>
  103. <div id="eWebEditor_Temp_HTML" style="VISIBILITY: hidden; OVERFLOW: hidden; POSITION: absolute; WIDTH: 1px; HEIGHT: 1px"></div>
  104. <form id="eWebEditor_UploadForm" action="upload.asp?action=remote&type=remote&style=<%=sStyleName%>" method="post" target="eWebEditor_UploadTarget">
  105. <input type="hidden" name="eWebEditor_UploadText">
  106. </form>
  107. <iframe name="eWebEditor_UploadTarget" width=0 height=0></iframe>
  108. <div id=divProcessing style="width:200px;height:30px;position:absolute;display:none">
  109. <table border=0 cellpadding=0 cellspacing=1 bgcolor="#000000" width="100%" height="100%"><tr><td bgcolor=#3A6EA5><marquee align="middle" behavior="alternate" scrollamount="5" style="font-size:9pt"><font color=#FFFFFF>...远程文件收集中...请等待...</font></marquee></td></tr></table>
  110. </div>
  111. </body>
  112. </html>
  113. <%
  114. ' 显示调用错误提示
  115. Sub ShowErr(str)
  116. Call DBConnEnd()
  117. Response.Write "调用错误:" & str
  118. Response.End
  119. End Sub
  120. ' 初始化
  121. Sub Init()
  122. ' 取全屏标志
  123. sFullScreen = Trim(Request.QueryString("fullscreen"))
  124. ' 取对应的内容ID
  125. sContentID = Trim(Request.QueryString("id"))
  126. If sContentID = "" Then ShowErr "请传入调用参数ID,即隐藏的内容表单项ID!"
  127. ' 取样式初始值
  128. sStyleName = Get_SafeStr(Trim(Request.QueryString("style")))
  129. If sStyleName = "" Then sStyleName = "standard"
  130. Dim s_SelfUrl, s_ApplicationName, n_Application, i
  131. s_SelfUrl = UCase(Request.ServerVariables("SERVER_NAME") & ":" & Request.ServerVariables("SERVER_PORT") & Request.ServerVariables("SCRIPT_NAME") & "?style=" & sStyleName)
  132. n_Application = 0
  133. Dim aApplicationName, aApplicationUrl, aApplicationValue
  134. aApplicationName = Application("eWebEditor_ApplicationName")
  135. aApplicationUrl = Application("eWebEditor_ApplicationUrl")
  136. If IsArray(aApplicationName) = True Then
  137. n_Application = UBound(aApplicationName)
  138. ' 是否在内存中
  139. For i = 1 To n_Application
  140. If aApplicationUrl(i) = s_SelfUrl Then
  141. s_ApplicationName = aApplicationName(i)
  142. aApplicationValue = Application(s_ApplicationName)
  143. sStyleID  = aApplicationValue(0)
  144. sStyleName  = aApplicationValue(1)
  145. sStyleDir  = aApplicationValue(2)
  146. sStyleCSS  = aApplicationValue(3)
  147. sStyleUploadDir  = aApplicationValue(4)
  148. nStateFlag  = aApplicationValue(5)
  149. sDetectFromWord  = aApplicationValue(6)
  150. sInitMode  = aApplicationValue(7)
  151. sBaseUrl  = aApplicationValue(8)
  152. sVersion  = aApplicationValue(9)
  153. sReleaseDate  = aApplicationValue(10)
  154. sLicense  = aApplicationValue(11)
  155. sToolBarNormal  = aApplicationValue(12)
  156. sToolBarFullScreen  = aApplicationValue(13)
  157. sBaseHref  = aApplicationValue(14)
  158. sAutoRemote  = aApplicationValue(15)
  159. sShowBorder  = aApplicationValue(16)
  160. If sFullScreen = "1" Then
  161. sToolBar = sToolBarFullScreen
  162. Else
  163. sToolBar = sToolBarNormal
  164. End If
  165. Exit Sub
  166. End If
  167. Next
  168. End If
  169. ' 初始化数据库连接
  170. Call DBConnBegin()
  171. sSql = "select * from ewebeditor_style where s_name='" & sStyleName & "'"
  172. oRs.Open sSql, oConn, 0, 1
  173. If Not oRs.Eof Then
  174. sStyleID = oRs("S_ID")
  175. sStyleName = oRs("S_Name")
  176. sStyleDir = oRs("S_Dir")
  177. sStyleCSS = oRs("S_CSS")
  178. sStyleUploadDir = oRs("S_UploadDir")
  179. nStateFlag = oRs("S_StateFlag")
  180. sAutoRemote = CStr(oRs("S_AutoRemote"))
  181. sShowBorder = CStr(oRs("S_ShowBorder"))
  182. sDetectFromWord = oRs("S_DetectFromWord")
  183. sInitMode = oRs("S_InitMode")
  184. sBaseUrl = oRs("S_BaseUrl")
  185. sBaseHref = oRs("S_BaseHref")
  186. Else
  187. ShowErr "无效的样式Style参数传入,如果要使用默认值,请留空!"
  188. End If
  189. oRs.Close
  190. ' 取版本号及发布日期
  191. sSql = "select sys_version,sys_releasedate,sys_license from ewebeditor_system"
  192. oRs.Open sSql, oConn, 0, 1
  193. sVersion = oRs(0)
  194. sReleaseDate = oRs(1)
  195. sLicense = oRs(2)
  196. oRs.Close
  197. ' 取所有按钮
  198. Call InitButtonArray()
  199. ' 取样式下的工具栏及按钮
  200. Call InitToolBar()
  201. ' 断开数据库连接
  202. Call DBConnEnd()
  203. If sFullScreen = "1" Then
  204. sToolBar = sToolBarFullScreen
  205. Else
  206. sToolBar = sToolBarNormal
  207. End If
  208. n_Application = n_Application + 1
  209. If n_Application = 1 Then
  210. Redim aApplicationName(1)
  211. Redim aApplicationUrl(1)
  212. Else
  213. Redim Preserve aApplicationName(n_Application)
  214. Redim Preserve aApplicationUrl(n_Application)
  215. End If
  216. Redim aApplicationValue(16)
  217. s_ApplicationName = "eWebEditor" & n_Application
  218. aApplicationName(n_Application) = s_ApplicationName
  219. aApplicationUrl(n_Application) = s_SelfUrl
  220. aApplicationValue(0)  = sStyleID
  221. aApplicationValue(1)  = sStyleName
  222. aApplicationValue(2)  = sStyleDir
  223. aApplicationValue(3)  = sStyleCSS
  224. aApplicationValue(4)  = sStyleUploadDir
  225. aApplicationValue(5)  = nStateFlag
  226. aApplicationValue(6)  = sDetectFromWord
  227. aApplicationValue(7)  = sInitMode
  228. aApplicationValue(8)  = sBaseUrl
  229. aApplicationValue(9)  = sVersion
  230. aApplicationValue(10)  = sReleaseDate
  231. aApplicationValue(11)  = sLicense
  232. aApplicationValue(12)  = sToolBarNormal
  233. aApplicationValue(13)  = sToolBarFullScreen
  234. aApplicationValue(14)  = sBaseHref
  235. aApplicationValue(15)  = sAutoRemote
  236. aApplicationValue(16)  = sShowBorder
  237. Application.Lock
  238. Application("eWebEditor_ApplicationName") = aApplicationName
  239. Application("eWebEditor_ApplicationUrl") = aApplicationUrl
  240. Application(s_ApplicationName) = aApplicationValue
  241. Application.Unlock
  242. End Sub
  243. ' 初始化按钮数组
  244. Sub InitButtonArray()
  245. Dim i
  246. sSql = "select * from ewebeditor_button order by b_order asc"
  247. oRs.Open sSql, oConn, 0, 1
  248. i = 0
  249. Do While Not oRs.Eof
  250. i = i + 1
  251. Redim Preserve aButtonCode(i)
  252. Redim Preserve aButtonHTML(i)
  253. aButtonCode(i) = oRs("B_Code")
  254. Select Case oRs("B_Type")
  255. Case 0
  256. aButtonHTML(i) = "<DIV CLASS=""" & oRs("B_Class") & """ TITLE=""" & oRs("B_Title") & """ onclick=""" & oRs("B_Event") & """><IMG CLASS=""Ico"" SRC=""buttonimage/" & sStyleDir & "/" & oRs("B_Image") & """></DIV>"
  257. Case 1
  258. aButtonHTML(i) = "<SELECT CLASS=""" & oRs("B_Class") & """ onchange=""" & oRs("B_Event") & """>" & oRs("B_HTML") & "</SELECT>"
  259. Case 2
  260. aButtonHTML(i) = "<DIV CLASS=""" & oRs("B_Class") & """>" & oRs("B_HTML") & "</DIV>"
  261. End Select
  262. oRs.MoveNext
  263. Loop
  264. oRs.Close
  265. End Sub
  266. ' 由按钮代码得到按钮的最终输出
  267. Function Code2HTML(s_Code)
  268. Dim i
  269. Code2HTML = ""
  270. For i = 1 To UBound(aButtonCode)
  271. If UCase(aButtonCode(i)) = UCase(s_Code) Then
  272. Code2HTML = aButtonHTML(i)
  273. Exit Function
  274. End If
  275. Next
  276. End Function
  277. ' 初始化工具栏
  278. Sub InitToolBar()
  279. Dim aButton, n
  280. sSql = "select t_button from ewebeditor_toolbar where s_id=" & sStyleID & " order by t_order asc"
  281. oRs.Open sSql, oConn, 0, 1
  282. If Not oRs.Eof Then
  283. sToolBarNormal = "<table border=0 cellpadding=0 cellspacing=0 width='100%' class='Toolbar' id='eWebEditor_Toolbar'>"
  284. sToolBarFullScreen = "<table border=0 cellpadding=0 cellspacing=0 width='100%' class='Toolbar' id='eWebEditor_Toolbar'>"
  285. Do While Not oRs.Eof
  286. sToolBarNormal = sToolBarNormal & "<tr><td><div class=yToolbar>"
  287. sToolBarFullScreen = sToolBarFullScreen & "<tr><td><div class=yToolbar>"
  288. aButton = Split(oRs("T_Button"), "|")
  289. For n = 0 To UBound(aButton)
  290. sToolBarNormal = sToolBarNormal & Code2HTML(aButton(n))
  291. If UCase(aButton(n)) = "MAXIMIZE" Then
  292. aButton(n) = "Minimize"
  293. End If
  294. sToolBarFullScreen = sToolBarFullScreen & Code2HTML(aButton(n))
  295. Next
  296. sToolBarNormal = sToolBarNormal & "</div></td></tr>"
  297. sToolBarFullScreen = sToolBarFullScreen & "</div></td></tr>"
  298. oRs.MoveNext
  299. Loop
  300. sToolBarNormal = sToolBarNormal & "</table>"
  301. sToolBarFullScreen = sToolBarFullScreen & "</table>"
  302. Else
  303. ShowErr "对应样式没有设置工具栏!"
  304. End If
  305. oRs.Close
  306. End Sub
  307. %>