Admin_Style.asp
资源名称:1.rar [点击查看]
上传用户:yrf020
上传日期:2007-07-24
资源大小:1287k
文件大小:40k
源码类别:

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

开发平台:

HTML/CSS

  1. <!--#include file = "Include/Startup.asp"-->
  2. <!--#include file = "admin_private.asp"-->
  3. <link rel='stylesheet' type='text/css' href='../admin/Images/CssAdmin.css'>
  4. <% response.charset="utf-8" %>
  5. <%Session.CodePage=65001%>
  6. <%
  7. if Instr(session("AdminPurview"),"|122,")=0 then 
  8.   response.write ("<font color='red')>你不具有该管理模块的操作权限,请返回!</font>")
  9.   response.end
  10. end if
  11. Dim sStyleID, sStyleName, sStyleDir, sStyleCSS, sStyleUploadDir, sStyleWidth, sStyleHeight, sStyleMemo, nStyleIsSys, sStyleStateFlag, sStyleDetectFromWord, sStyleInitMode, sStyleBaseUrl, sStyleUploadObject, sStyleAutoDir, sStyleBaseHref, sStyleContentPath, sStyleAutoRemote, sStyleShowBorder
  12. Dim sStyleFileExt, sStyleFlashExt, sStyleImageExt, sStyleMediaExt, sStyleRemoteExt, sStyleFileSize, sStyleFlashSize, sStyleImageSize, sStyleMediaSize, sStyleRemoteSize
  13. Dim sToolBarID, sToolBarName, sToolBarOrder, sToolBarButton
  14. sPosition = sPosition & "样式管理"
  15. If sAction = "STYLEPREVIEW" Then
  16. ' 样式预览
  17. Call InitStyle()
  18. Call ShowStylePreview()
  19. Response.End
  20. End If
  21. Call Header()
  22. Call Content()
  23. Sub Content()
  24. Select Case sAction
  25. Case "COPY"
  26. ' 拷贝一标准样式
  27. Call InitStyle()
  28. Call DoCopy()
  29. Call ShowStyleList()
  30. Case "STYLEADD"
  31. ' 新增样式表单
  32. Call ShowStyleForm("ADD")
  33. Case "STYLESET"
  34. ' 样式设置,修改或查看
  35. Call InitStyle()
  36. Call ShowStyleForm("SET")
  37. Case "STYLEADDSAVE"
  38. ' 样式新增保存
  39. Call CheckStyleForm()
  40. Call DoStyleAddSave()
  41. Case "STYLESETSAVE"
  42. ' 样式设置修改保存
  43. Call CheckStyleForm()
  44. Call DoStyleSetSave()
  45. Call RemoveApplication()
  46. Case "STYLEDEL"
  47. ' 样式删除
  48. Call InitStyle()
  49. Call DoStyleDel()
  50. Call ShowStyleList()
  51. Call RemoveApplication()
  52. Case "CODE"
  53. ' 显示引用代码
  54. Call InitStyle()
  55. Call ShowStyleCode()
  56. Case "TOOLBAR"
  57. ' 显示工具栏表单
  58. Call InitStyle()
  59. Call ShowToolBarList()
  60. Case "TOOLBARADD"
  61. ' 新增工具栏
  62. Call InitStyle()
  63. Call DoToolBarAdd()
  64. Call ShowToolBarList()
  65. Call RemoveApplication()
  66. Case "TOOLBARMODI"
  67. ' 修改工具栏
  68. Call InitStyle()
  69. Call DoToolBarModi()
  70. Call ShowToolBarList()
  71. Call RemoveApplication()
  72. Case "TOOLBARDEL"
  73. ' 删除工具栏
  74. Call InitStyle()
  75. Call DoToolBarDel()
  76. Call ShowToolBarList()
  77. Call RemoveApplication()
  78. Case "BUTTONSET"
  79. ' 按钮设置
  80. Call InitStyle()
  81. Call InitToolBar()
  82. Call ShowButtonList()
  83. Case "BUTTONSAVE"
  84. ' 按钮设置保存
  85. Call InitStyle()
  86. Call InitToolBar()
  87. Call DoButtonSave()
  88. Call RemoveApplication()
  89. Case Else
  90. ' 当前所有样式列表
  91. Call ShowStyleList()
  92. End Select
  93. End Sub
  94. ' 当前所有样式列表
  95. Sub ShowStyleList()
  96. Response.Write "<table align='center'width='100%' border='0' cellpadding='3' cellspacing='1' bgcolor='#6ab6b6'>" & _
  97. "<form action='?action=del' method=post name=myform>" & _
  98. "<tr align=center>" & _
  99. "<td width=80>样式名</td>" & _
  100. "<td width=60>最佳宽度</td>" & _
  101. "<td width=60>最佳高度</td>" & _
  102. "<td width=200>说明</td>" & _
  103. "<td width=180>管理&nbsp;&nbsp;&nbsp;&nbsp;<a href='?action=styleadd'><font COLOR=#ffffff>新增样式</font></a></td>" & _
  104. "</tr>"
  105. Dim sManage
  106. sSql = "select * from ewebeditor_style"
  107. oRs.Open sSql, oConn, 0, 1
  108. Do While Not oRs.Eof
  109. sManage = "<a href='?action=stylepreview&id=" & oRs("S_ID") & "' target='_blank'>预览</a>|<a href='?action=code&id=" & oRs("S_ID") & "'>代码</a>|<a href='?action=styleset&id=" & oRs("S_ID") & "'>设置</a>|<a href='?action=toolbar&id=" & oRs("S_ID") & "'>工具栏</a>"
  110. If oRs("S_IsSys") = 1 Then
  111. sManage = sManage & "|<a href='?action=copy&id=" & oRs("S_ID") & "'>拷贝</a>"
  112. Else
  113. sManage = sManage & "|<a href='?action=styledel&id=" & oRs("S_ID") & "'>删除</a>"
  114. End If
  115. Response.Write "<tr align=center>" & _
  116. "<td bgcolor='#eafefe'>" & outHTML(oRs("S_Name")) & "</td>" & _
  117. "<td bgcolor='#eafefe'>" & oRs("S_Width") & "</td>" & _
  118. "<td bgcolor='#eafefe'>" & oRs("S_Height") & "</td>" & _
  119. "<td bgcolor='#eafefe'>" & outHTML(oRs("S_Memo")) & "</td>" & _
  120. "<td bgcolor='#eafefe'>" & sManage & "</td>" & _
  121. "</tr>"
  122. oRs.MoveNext
  123. Loop
  124. oRs.Close
  125. Response.Write "</table>"
  126. Response.Write "<p><b><div align='center'>说明:</b>系统自带样式不允许对设置进行修改删除,但允许查看设置!你可以先“拷贝一标准样式”然后对其设置进行修改以达到快速新建样式的目的。</div></p><br><br>"
  127. End Sub
  128. ' 拷贝一标准样式
  129. Sub DoCopy()
  130. ' 只有系统样式才有拷贝功能
  131. If nStyleIsSys <> 1 Then
  132. Exit Sub
  133. End If
  134. ' 自动取有效的样式名,从1......到...
  135. Dim i, b, sNewID, sNewName
  136. b = False
  137. i = 0
  138. Do While b = False
  139. i = i + 1
  140. sNewName = sStyleName & i
  141. sSql = "select s_id from ewebeditor_style where s_name='" & sNewName & "'"
  142. oRs.Open sSql, oConn, 0, 1
  143. If oRs.Eof And oRs.Bof Then
  144. b = True
  145. End If
  146. oRs.Close
  147. Loop
  148. ' 插入一与标准样式相同的记录,名不同
  149. sSql = "insert into ewebeditor_style(s_name,s_dir,s_css,s_uploaddir,s_width,s_height,s_memo,s_issys,s_fileext,s_flashext,s_imageext,s_mediaext, s_remoteext,s_filesize,s_flashsize,s_imagesize,s_mediasize,s_remotesize,s_stateflag,s_detectfromword,s_initmode,s_baseurl,s_uploadobject,s_basehref,s_contentpath) select '" & sNewName & "',s_dir,s_css,s_uploaddir,s_width,s_height,s_memo,0,s_fileext,s_flashext,s_imageext,s_mediaext,s_remoteext,s_filesize,s_flashsize,s_imagesize,s_mediasize,s_remotesize,s_stateflag,s_detectfromword,s_initmode,s_baseurl,s_uploadobject,s_basehref,s_contentpath from ewebeditor_style where s_id=" & sStyleID
  150. oConn.Execute sSql
  151. ' 取新样式的ID
  152. sSql = "select s_id from ewebeditor_style where s_name='" & sNewName & "'"
  153. oRs.Open sSql, oConn, 0, 1
  154. sNewID = oRs(0)
  155. oRs.Close
  156. ' 拷贝工具栏
  157. sSql = "insert into ewebeditor_toolbar(s_id,t_name,t_order,t_button) select " & sNewID & ",t_name,t_order,t_button from ewebeditor_toolbar where s_id=" & sStyleID
  158. oConn.Execute sSql
  159. End Sub
  160. ' 样式表单
  161. Sub ShowStyleForm(sFlag)
  162. Dim s_Title, s_Button, s_Action
  163. Dim s_FormStateFlag, s_FormDetectFromWord, s_FormInitMode, s_FormBaseUrl, s_FormUploadObject, s_FormAutoDir, s_FormAutoRemote, s_FormShowBorder
  164. If sFlag = "ADD" Then
  165. sStyleID = ""
  166. sStyleName = ""
  167. sStyleDir = "standard"
  168. sStyleCSS = "office"
  169. sStyleUploadDir = "UploadFile/"
  170. sStyleBaseHref = "http://Localhost/eWeb../Editor/"
  171. sStyleContentPath = "UploadFile/"
  172. sStyleWidth = "600"
  173. sStyleHeight = "400"
  174. sStyleMemo = ""
  175. nStyleIsSys = 0
  176. s_Title = "新增样式"
  177. s_Action = "StyleAddSave"
  178. sStyleFileExt = "rar|zip|exe|doc|xls|chm|hlp"
  179. sStyleFlashExt = "swf"
  180. sStyleImageExt = "gif|jpg|jpeg|bmp"
  181. sStyleMediaExt = "rm|mp3|wav|mid|midi|ra|avi|mpg|mpeg|asf|asx|wma|mov"
  182. sStyleRemoteExt = "gif|jpg|bmp"
  183. sStyleFileSize = "500"
  184. sStyleFlashSize = "100"
  185. sStyleImageSize = "100"
  186. sStyleMediaSize = "100"
  187. sStyleRemoteSize = "100"
  188. sStyleStateFlag = "1"
  189. sStyleAutoRemote = "1"
  190. sStyleShowBorder = "0"
  191. sStyleUploadObject = "0"
  192. sStyleAutoDir = "0"
  193. sStyleDetectFromWord = "true"
  194. sStyleInitMode = "EDIT"
  195. sStyleBaseUrl = "0"
  196. Else
  197. sStyleName = inHTML(sStyleName)
  198. sStyleDir = inHTML(sStyleDir)
  199. sStyleCSS = inHTML(sStyleCSS)
  200. sStyleUploadDir = inHTML(sStyleUploadDir)
  201. sStyleBaseHref = inHTML(sStyleBaseHref)
  202. sStyleContentPath = inHTML(sStyleContentPath)
  203. sStyleMemo = inHTML(sStyleMemo)
  204. s_Title = "设置样式"
  205. s_Action = "StyleSetSave"
  206. End If
  207. s_FormStateFlag = InitSelect("d_stateflag", Split("显示|不显示", "|"), Split("1|0", "|"), sStyleStateFlag, "", "")
  208. s_FormAutoRemote = InitSelect("d_autoremote", Split("自动上传|不自动上传", "|"), Split("1|0", "|"), sStyleAutoRemote, "", "")
  209. s_FormShowBorder = InitSelect("d_showborder", Split("默认显示|默认不显示", "|"), Split("1|0", "|"), sStyleShowBorder, "", "")
  210. s_FormUploadObject = InitSelect("d_uploadobject", Split("无惧无组件上传类|ASPUpload上传组件|SA-FileUp上传组件|LyfUpload上传组件", "|"), Split("0|1|2|3", "|"), sStyleUploadObject, "", "")
  211. s_FormAutoDir = InitSelect("d_autodir", Split("不使用|年目录|年月目录|年月日目录", "|"), Split("0|1|2|3", "|"), sStyleAutoDir, "", "")
  212. s_FormDetectFromWord = InitSelect("d_detectfromword", Split("自动检测有提示|不自动检测", "|"), Split("true|false", "|"), sStyleDetectFromWord, "", "")
  213. s_FormInitMode = InitSelect("d_initmode", Split("代码模式|编辑模式|文本模式|预览模式", "|"), Split("CODE|EDIT|TEXT|VIEW", "|"), sStyleInitMode, "", "")
  214. s_FormBaseUrl = InitSelect("d_baseurl", Split("相对路径|绝对根路径|绝对全路径", "|"), Split("0|1|2", "|"), sStyleBaseUrl, "", "")
  215. If nStyleIsSys = 0 Then
  216. s_Button = "<tr><td  align=center colspan=4><input type=image border=0 src='admin/submit.gif' align=absmiddle>&nbsp;<a href='javascript:document.myform.reset()'><img border=0 src='admin/reset.gif' align=absmiddle></a>&nbsp;&nbsp;&nbsp;<a href='javascript:history.back()'>返回</a></td></tr>"
  217. Else
  218. s_Button = ""
  219. End If
  220. Response.Write "<table align='center'width='100%' border='0' cellpadding='3' cellspacing='1' bgcolor='#6ab6b6'>" & _
  221. "<form action='?action=" & s_Action & "&id=" & sStyleID & "' method=post name=myform>" & _
  222. "<tr><td colspan=4>&nbsp;&nbsp;" & s_Title & "(鼠标移到输入框可看说明,带*号为必填项)</td></tr>" & _
  223. "<tr><td  bgcolor='#eafefe' width='15%' align=right>样式名称:</td><td bgcolor='#eafefe'  width='35%'><input type=text class=input size=20 name=d_name title='引用此样式的名字,不要加特殊符号,最大50个字符长度' value=""" & sStyleName & """> <span class=highlight2>*</span></td><td  bgcolor='#eafefe' width='15%' align=right>初始模式:</td><td bgcolor='#eafefe'  width='35%'>" & s_FormInitMode & " <span class=highlight2>*</span></td></tr>" & _
  224. "<tr><td  bgcolor='#eafefe' width='15%' align=right>上传组件:</td><td bgcolor='#eafefe'  width='35%'>" & s_FormUploadObject & " <span class=highlight2>*</span></td><td  bgcolor='#eafefe' width='15%' align=right>自动目录:</td><td bgcolor='#eafefe'  width='35%'>" & s_FormAutoDir & " <span class=highlight2>*</span></td></tr>" & _
  225. "<tr><td  bgcolor='#eafefe' width='15%' align=right>图片目录:</td><td bgcolor='#eafefe'  width='35%'><input type=text class=input size=20 name=d_dir title='存放此样式图片文件的目录名,必须在ButtonImage下,最大50个字符长度' value=""" & sStyleDir & """> <span class=highlight2>*</span></td><td  bgcolor='#eafefe' width='15%' align=right>样式目录:</td><td bgcolor='#eafefe'  width='35%'><input type=text class=input size=20 name=d_css title='存放此样式css文件的目录名,必须在CSS下,最大50个字符长度' value=""" & sStyleCSS & """> <span class=highlight2>*</span></td></tr>" & _
  226. "<tr><td  bgcolor='#eafefe' width='15%' align=right>最佳宽度:</td><td bgcolor='#eafefe'  width='35%'><input type=text class=input name=d_width size=20 title='最佳引用效果的宽度,数字型' value='" & sStyleWidth & "'> <span class=highlight2>*</span></td><td  bgcolor='#eafefe' width='15%' align=right>最佳高度:</td><td bgcolor='#eafefe'  width='35%'><input type=text class=input name=d_height size=20 title='最佳引用效果的高度,数字型' value='" & sStyleHeight & "'> <span class=highlight2>*</span></td></tr>" & _
  227. "<tr><td  bgcolor='#eafefe' width='15%' align=right>状 态 栏:</td><td bgcolor='#eafefe'  width='35%'>" & s_FormStateFlag & " <span class=highlight2>*</span></td><td  bgcolor='#eafefe' width='15%' align=right>Word粘贴:</td><td bgcolor='#eafefe'  width='35%'>" & s_FormDetectFromWord & " <span class=highlight2>*</span></td></tr>" & _
  228. "<tr><td  bgcolor='#eafefe' width='15%' align=right>远程文件:</td><td bgcolor='#eafefe'  width='35%'>" & s_FormAutoRemote & " <span class=highlight2>*</span></td><td  bgcolor='#eafefe' width='15%' align=right>指导方针:</td><td bgcolor='#eafefe'  width='35%'>" & s_FormShowBorder & " <span class=highlight2>*</span></td></tr>" & _
  229. "<tr><td bgcolor='#eafefe' colspan=4><span class=highlight2>&nbsp;&nbsp;&nbsp;上传文件及系统文件路径相关设置(只有在使用相对路径模式时,才要设置显示路径和内容路径):</span></td></tr>" & _
  230. "<tr><td  bgcolor='#eafefe' width='15%' align=right>路径模式:</td><td bgcolor='#eafefe'  width='35%'>" & s_FormBaseUrl & " <span class=highlight2>*</span> <a href='#baseurl'>说明</a></td><td  bgcolor='#eafefe' width='15%' align=right>上传路径:</td><td bgcolor='#eafefe'  width='35%'><input type=text class=input size=20 name=d_uploaddir title='上传文件所存放路径,相对eWebEditor根目录文件的路径,最大50个字符长度' value=""" & sStyleUploadDir & """> <span class=highlight2>*</span></td></tr>" & _
  231. "<tr><td  bgcolor='#eafefe' width='15%' align=right>显示路径:</td><td bgcolor='#eafefe'  width='35%'><input type=text class=input size=20 name=d_basehref title='显示内容页所存放路径,必须以&quot;/&quot;开头,最大50个字符长度' value=""" & sStyleBaseHref & """></td><td  bgcolor='#eafefe' width='15%' align=right>内容路径:</td><td bgcolor='#eafefe'  width='35%'><input type=text class=input size=20 name=d_contentpath title='实际保存在内容中的路径,相对显示路径的路径,不能以&quot;/&quot;开头,最大50个字符长度' value=""" & sStyleContentPath & """></td></tr>" & _
  232. "<tr><td bgcolor='#eafefe' colspan=4><span class=highlight2>&nbsp;&nbsp;&nbsp;允许上传文件类型及文件大小设置(文件大小单位为KB,0表示没有限制):</span></td></tr>" & _
  233. "<tr><td bgcolor='#eafefe' width='15%' align=right>图片类型:</td><td bgcolor='#eafefe' width='35%'><input type=text class=input name=d_imageext size=20 title='用于图片相关的上传,最大250个字符长度' value='" & sStyleImageExt & "'></td><td bgcolor='#eafefe' width='15%' align=right>图片限制:</td><td bgcolor='#eafefe' width='35%'><input type=text class=input name=d_imagesize size=20 title='数字型,单位KB' value='" & sStyleImageSize & "'></td></tr>" & _
  234. "<tr><td bgcolor='#eafefe' width='15%' align=right>Flash类型:</td><td bgcolor='#eafefe' width='35%'><input type=text class=input name=d_flashext size=20 title='用于插入Flash动画,最大250个字符长度' value='" & sStyleFlashExt & "'></td><td bgcolor='#eafefe' width='15%' align=right>Flash限制:</td><td bgcolor='#eafefe' width='35%'><input type=text class=input name=d_flashsize size=20 title='数字型,单位KB' value='" & sStyleFlashSize & "'></td></tr>" & _
  235. "<tr><td bgcolor='#eafefe' width='15%' align=right>媒体类型:</td><td bgcolor='#eafefe' width='35%'><input type=text class=input name=d_mediaext size=20 title='用于插入媒体文件,最大250个字符长度' value='" & sStyleMediaExt & "'></td><td bgcolor='#eafefe' width='15%' align=right>媒体限制:</td><td bgcolor='#eafefe' width='35%'><input type=text class=input name=d_mediasize size=20 title='数字型,单位KB' value='" & sStyleMediaSize & "'></td></tr>" & _
  236. "<tr><td bgcolor='#eafefe' width='15%' align=right>其它类型:</td><td bgcolor='#eafefe' width='35%'><input type=text class=input name=d_fileext size=20 title='用于插入其它文件,最大250个字符长度' value='" & sStyleFileExt & "'></td><td bgcolor='#eafefe' width='15%' align=right>其它限制:</td><td bgcolor='#eafefe' width='35%'><input type=text class=input name=d_filesize size=20 title='数字型,单位KB' value='" & sStyleFileSize & "'></td></tr>" & _
  237. "<tr><td bgcolor='#eafefe' width='15%' align=right>远程类型:</td><td bgcolor='#eafefe' width='35%'><input type=text class=input name=d_remoteext size=20 title='用于自动上传远程文件,最大250个字符长度' value='" & sStyleRemoteExt & "'></td><td bgcolor='#eafefe' width='15%' align=right>远程限制:</td><td bgcolor='#eafefe' width='35%'><input type=text class=input name=d_remotesize size=20 title='数字型,单位KB' value='" & sStyleRemoteSize & "'></td></tr>" & _
  238. "<tr><td bgcolor='#eafefe' align=right>备注说明:</td><td bgcolor='#eafefe' colspan=3><textarea class=textarea rows=7 cols=65 name=d_memo title='此样式的说明,更有利于调用'>" & sStyleMemo & "</textarea></td></tr>" & s_Button & _
  239. "</form>" & _
  240. "</table>"
  241. Response.Write "<br><table align='center'width='100%' border='0' cellpadding='3' cellspacing='1' bgcolor='#6ab6b6'><tr><td bgcolor='#eafefe'><a name=baseurl></a><p><span class=highlight2><b>路径模式设置说明:</b></span><br>" & _
  242. "<b>相对路径:</b>指所有的相关上传或自动插入文件路径,编辑后都以""UploadFile/...""或""../UploadFile/...""形式呈现,当使用此模式时,显示路径和内容路径必填,显示路径必须以""/""开头和结尾,内容路径设置中不能以""/""开头。<br>" & _
  243. "<b>绝对根路径:</b>指所有的相关上传或自动插入文件路径,编辑后都以""/eWeb../Editor/UploadFile/...""这种形式呈现,当使用此模式时,显示路径和内容路径不必填。<br>" & _
  244. "<b>绝对全路径:</b>指所有的相关上传或自动插入文件路径,编辑后都以""http://xxx.xxx.xxx/eWeb../Editor/UploadFile/...""这种形式呈现,当使用此模式时,显示路径和内容路径不必填。</p><br><br></td></tr></table>"
  245. End Sub
  246. ' 初始化样式表数据
  247. Sub InitStyle()
  248. Dim b
  249. b = False
  250. sStyleID = Trim(Request("id"))
  251. If IsNumeric(sStyleID) = True Then
  252. sSql = "select * from ewebeditor_style where s_id=" & sStyleID
  253. oRs.Open sSql, oConn, 0, 1
  254. If Not oRs.Eof Then
  255. sStyleName = oRs("S_Name")
  256. sStyleDir = oRs("S_Dir")
  257. sStyleCSS = oRs("S_CSS")
  258. sStyleUploadDir = oRs("S_UploadDir")
  259. sStyleBaseHref = oRs("S_BaseHref")
  260. sStyleContentPath = oRs("S_ContentPath")
  261. sStyleWidth = CStr(oRs("S_Width"))
  262. sStyleHeight = CStr(oRs("S_Height"))
  263. sStyleMemo = oRs("S_Memo")
  264. nStyleIsSys = oRs("S_IsSys")
  265. sStyleFileExt = oRs("S_FileExt")
  266. sStyleFlashExt = oRs("S_FlashExt")
  267. sStyleImageExt = oRs("S_ImageExt")
  268. sStyleMediaExt = oRs("S_MediaExt")
  269. sStyleRemoteExt = oRs("S_RemoteExt")
  270. sStyleFileSize = oRs("S_FileSize")
  271. sStyleFlashSize = oRs("S_FlashSize")
  272. sStyleImageSize = oRs("S_ImageSize")
  273. sStyleMediaSize = oRs("S_MediaSize")
  274. sStyleRemoteSize = oRs("S_RemoteSize")
  275. sStyleStateFlag = CStr(oRs("S_StateFlag"))
  276. sStyleAutoRemote = CStr(oRs("S_AutoRemote"))
  277. sStyleShowBorder = CStr(oRs("S_ShowBorder"))
  278. sStyleUploadObject = CStr(oRs("S_UploadObject"))
  279. sStyleAutoDir = CStr(oRs("S_AutoDir"))
  280. sStyleDetectFromWord = oRs("S_DetectFromWord")
  281. sStyleInitMode = oRs("S_InitMode")
  282. sStyleBaseUrl = oRs("S_BaseUrl")
  283. b = True
  284. End If
  285. oRs.Close
  286. End If
  287. If b = False Then
  288. Go_Error "无效的样式ID号,请通过页面上的链接进行操作!"
  289. End If
  290. End Sub
  291. ' 检测样式表单提交的有效性
  292. Sub CheckStyleForm()
  293. sStyleName = Trim(Request("d_name"))
  294. sStyleDir = Trim(Request("d_dir"))
  295. sStyleCSS = Trim(Request("d_css"))
  296. sStyleUploadDir = Trim(Request("d_uploaddir"))
  297. sStyleBaseHref = Trim(Request("d_basehref"))
  298. sStyleContentPath = Trim(Request("d_contentpath"))
  299. sStyleWidth = Trim(Request("d_width"))
  300. sStyleHeight = Trim(Request("d_height"))
  301. sStyleMemo = Request("d_memo")
  302. sStyleImageExt = Request("d_imageext")
  303. sStyleFlashExt = Request("d_flashext")
  304. sStyleMediaExt = Request("d_mediaext")
  305. sStyleRemoteExt = Request("d_remoteext")
  306. sStyleFileExt = Request("d_fileext")
  307. sStyleImageSize = Request("d_imagesize")
  308. sStyleFlashSize = Request("d_flashsize")
  309. sStyleMediaSize = Request("d_mediasize")
  310. sStyleRemoteSize = Request("d_remotesize")
  311. sStyleFileSize = Request("d_filesize")
  312. sStyleStateFlag = Request("d_stateflag")
  313. sStyleAutoRemote = Request("d_autoremote")
  314. sStyleShowBorder = Request("d_showborder")
  315. sStyleUploadObject = Request("d_uploadobject")
  316. sStyleAutoDir = Request("d_autodir")
  317. sStyleDetectFromWord = Request("d_detectfromword")
  318. sStyleInitMode = Request("d_initmode")
  319. sStyleBaseUrl = Request("d_baseurl")
  320. sStyleUploadDir = Replace(sStyleUploadDir, "", "/")
  321. sStyleBaseHref = Replace(sStyleBaseHref, "", "/")
  322. sStyleContentPath = Replace(sStyleContentPath, "", "/")
  323. If Right(sStyleUploadDir, 1) <> "/" Then sStyleUploadDir = sStyleUploadDir & "/"
  324. If Right(sStyleBaseHref, 1) <> "/" Then sStyleBaseHref = sStyleBaseHref & "/"
  325. If Right(sStyleContentPath, 1) <> "/" Then sStyleContentPath = sStyleContentPath & "/"
  326. If sStyleName = "" Or Get_TrueLen(sStyleName) > 50 Then
  327. Go_Error "样式名不能为空,且不大于50个字符长度!"
  328. End If
  329. If IsSafeStr(sStyleName) = False Then
  330. Go_Error "样式名请勿包含特殊字符!"
  331. End If
  332. If sStyleDir = "" Or Get_TrueLen(sStyleDir) > 50 Then
  333. Go_Error "按钮图片目录名不能为空,且不大于50个字符长度!"
  334. End If
  335. If IsSafeStr(sStyleDir) = False Then
  336. Go_Error "按钮图片目录名请勿包含特殊字符!"
  337. End If
  338. If sStyleCSS = "" Or Get_TrueLen(sStyleCSS) > 50 Then
  339. Go_Error "样式CSS目录名不能为空,且不大于50个字符长度!"
  340. End If
  341. If IsSafeStr(sStyleCSS) = False Then
  342. Go_Error "样式CSS目录名请勿包含特殊字符!"
  343. End If
  344. If sStyleUploadDir = "" Or Get_TrueLen(sStyleUploadDir) > 50 Then
  345. Go_Error "上传路径不能为空,且不大于50个字符长度!"
  346. End If
  347. If IsSafeStr(sStyleUploadDir) = False Then
  348. Go_Error "上传路径请勿包含特殊字符!"
  349. End If
  350. Select Case sStyleBaseUrl
  351. Case "0"
  352. If sStyleBaseHref = "" Or Get_TrueLen(sStyleBaseHref) > 50 Then
  353. Go_Error "当使用相对路径模式时,显示路径不能为空,且不大于50个字符长度!"
  354. End If
  355. If IsSafeStr(sStyleBaseHref) = False Then
  356. Go_Error "当使用相对路径模式时,显示路径请勿包含特殊字符!"
  357. End If
  358. If Left(sStyleBaseHref, 1) <> "/" Then
  359. Go_Error "当使用相对路径模式时,显示路径必须以&quot;/&quot;开头!"
  360. End If
  361. If sStyleContentPath = "" Or Get_TrueLen(sStyleContentPath) > 50 Then
  362. Go_Error "当使用相对路径模式时,内容路径不能为空,且不大于50个字符长度!"
  363. End If
  364. If IsSafeStr(sStyleContentPath) = False Then
  365. Go_Error "当使用相对路径模式时,内容路径请勿包含特殊字符!"
  366. End If
  367. If Left(sStyleContentPath, 1) = "/" Then
  368. Go_Error "当使用相对路径模式时,内容路径不能以&quot;/&quot;开头!"
  369. End If
  370. Case "1", "2"
  371. sStyleBaseHref = ""
  372. sStyleContentPath = ""
  373. End Select
  374. If IsNumeric(sStyleWidth) = False Then
  375. Go_Error "请填写有效的最佳引用宽度!"
  376. End If
  377. If IsNumeric(sStyleHeight) = False Then
  378. Go_Error "请填写有效的最佳引用高度!"
  379. End If
  380. If Get_TrueLen(sStyleImageExt) > 250 Then
  381. Go_Error "图片文件类型不能大于250个字符长度!"
  382. End If
  383. If Get_TrueLen(sStyleFlashExt) > 250 Then
  384. Go_Error "Flash文件类型不能大于250个字符长度!"
  385. End If
  386. If Get_TrueLen(sStyleMediaExt) > 250 Then
  387. Go_Error "媒体文件类型不能大于250个字符长度!"
  388. End If
  389. If Get_TrueLen(sStyleFileExt) > 250 Then
  390. Go_Error "其它文件类型不能大于250个字符长度!"
  391. End If
  392. If Get_TrueLen(sStyleRemoteExt) > 250 Then
  393. Go_Error "远程文件类型不能大于250个字符长度!"
  394. End If
  395. If IsNumeric(sStyleImageSize) = False Then
  396. Go_Error "请填写有效的图片限制大小!"
  397. End If
  398. If IsNumeric(sStyleFlashSize) = False Then
  399. Go_Error "请填写有效的Flash限制大小!"
  400. End If
  401. If IsNumeric(sStyleMediaSize) = False Then
  402. Go_Error "请填写有效的媒体文件限制大小!"
  403. End If
  404. If IsNumeric(sStyleFileSize) = False Then
  405. Go_Error "请填写有效的其它文件限制大小!"
  406. End If
  407. If IsNumeric(sStyleRemoteSize) = False Then
  408. Go_Error "请填写有效的远程文件限制大小!"
  409. End If
  410. End Sub
  411. ' 样式新增保存
  412. Sub DoStyleAddSave()
  413. sSql = "select * from ewebeditor_style where s_name='" & sStyleName & "'"
  414. oRs.Open sSql, oConn, 0, 1
  415. If Not oRs.Eof Then
  416. Go_Error "此样式名已经存在,请用另一个样式名!"
  417. End If
  418. oRs.Close
  419. sSql = "select * from ewebeditor_style where s_id=0"
  420. oRs.Open sSql, oConn, 1, 3
  421. oRs.AddNew
  422. oRs("S_Name") = sStyleName
  423. oRs("S_Dir") = sStyleDir
  424. oRs("S_CSS") = sStyleCSS
  425. oRs("S_UploadDir") = sStyleUploadDir
  426. oRs("S_BaseHref") = sStyleBaseHref
  427. oRs("S_ContentPath") = sStyleContentPath
  428. oRs("S_Width") = sStyleWidth
  429. oRs("S_Height") = sStyleHeight
  430. oRs("S_Memo") = sStyleMemo
  431. oRs("S_ImageExt") = sStyleImageExt
  432. oRs("S_FlashExt") = sStyleFlashExt
  433. oRs("S_MediaExt") = sStyleMediaExt
  434. oRs("S_FileExt") = sStyleFileExt
  435. oRs("S_RemoteExt") = sStyleRemoteExt
  436. oRs("S_ImageSize") = sStyleImageSize
  437. oRs("S_FlashSize") = sStyleFlashSize
  438. oRs("S_MediaSize") = sStyleMediaSize
  439. oRs("S_FileSize") = sStyleFileSize
  440. oRs("S_RemoteSize") = sStyleRemoteSize
  441. oRs("S_StateFlag") = sStyleStateFlag
  442. oRs("S_AutoRemote") = sStyleAutoRemote
  443. oRs("S_ShowBorder") = sStyleShowBorder
  444. oRs("S_UploadObject") = sStyleUploadObject
  445. oRs("S_AutoDir") = sStyleAutoDir
  446. oRs("S_DetectFromWord") = sStyleDetectFromWord
  447. oRs("S_InitMode") = sStyleInitMode
  448. oRs("S_BaseUrl") = sStyleBaseUrl
  449. oRs.Update
  450. sStyleID = oRs("S_ID")
  451. oRs.Close
  452. Response.Write "<br><table border=0 cellspacing=20 align=center>" & _
  453. "<tr valign=top><td bgcolor='#eafefe'><img src='admin/do_ok.gif' border=0></td><td bgcolor='#eafefe'><b><span class=highlight2>样式增加成功!</span></b><br><br><ul>我现在<br><br><li><a href='?'>返回样式管理</a><li><a href='?action=toolbar&id=" & sStyleID & "'>设置此样式下的工具栏</a></ul></td></tr>" & _
  454. "</table><br><br>"
  455. End Sub
  456. ' 样式修改保存
  457. Sub DoStyleSetSave()
  458. sStyleID = Trim(Request("id"))
  459. If IsNumeric(sStyleID) = True Then
  460. ' 是否存在同名
  461. sSql = "select * from ewebeditor_style where s_name='" & sStyleName & "' and s_id<>" & sStyleID
  462. oRs.Open sSql, oConn, 0, 1
  463. If Not oRs.Eof Then
  464. Go_Error "此样式名已经存在,请用另一个样式名!"
  465. End If
  466. oRs.Close
  467. sSql = "select * from ewebeditor_style where s_id=" & sStyleID
  468. oRs.Open sSql, oConn, 1, 3
  469. If Not oRs.Eof Then
  470. If oRs("S_IsSys") = 1 Then
  471. Go_Error "系统样式,不允许修改!"
  472. End If
  473. Else
  474. Go_Error "无效的样式ID号,请通过页面上的链接进行操作!"
  475. End If
  476. oRs("S_Name") = sStyleName
  477. oRs("S_Dir") = sStyleDir
  478. oRs("S_CSS") = sStyleCSS
  479. oRs("S_UploadDir") = sStyleUploadDir
  480. oRs("S_BaseHref") = sStyleBaseHref
  481. oRs("S_ContentPath") = sStyleContentPath
  482. oRs("S_Width") = sStyleWidth
  483. oRs("S_Height") = sStyleHeight
  484. oRs("S_Memo") = sStyleMemo
  485. oRs("S_ImageExt") = sStyleImageExt
  486. oRs("S_FlashExt") = sStyleFlashExt
  487. oRs("S_MediaExt") = sStyleMediaExt
  488. oRs("S_FileExt") = sStyleFileExt
  489. oRs("S_RemoteExt") = sStyleRemoteExt
  490. oRs("S_ImageSize") = sStyleImageSize
  491. oRs("S_FlashSize") = sStyleFlashSize
  492. oRs("S_MediaSize") = sStyleMediaSize
  493. oRs("S_RemoteSize") = sStyleRemoteSize
  494. oRs("S_FileSize") = sStyleFileSize
  495. oRs("S_StateFlag") = sStyleStateFlag
  496. oRs("S_AutoRemote") = sStyleAutoRemote
  497. oRs("S_ShowBorder") = sStyleShowBorder
  498. oRs("S_UploadObject") = sStyleUploadObject
  499. oRs("S_AutoDir") = sStyleAutoDir
  500. oRs("S_DetectFromWord") = sStyleDetectFromWord
  501. oRs("S_InitMode") = sStyleInitMode
  502. oRs("S_BaseUrl") = sStyleBaseUrl
  503. oRs.Update
  504. oRs.Close
  505. Else
  506. Go_Error "无效的样式ID号,请通过页面上的链接进行操作!"
  507. End If
  508. Response.Write "<br><table align='center'width='100%' border='0' cellpadding='3' cellspacing='1' bgcolor='#6ab6b6'>" & _
  509. "<tr><td bgcolor='#eafefe'><b>样式修改成功!</b><br><br><ul><br><li><a href='?'>返回样式管理</a><li><a href='?action=toolbar&id=" & sStyleID & "'>设置此样式下的工具栏</a></ul></td></tr>" & _
  510. "</table><br><br>"
  511. End Sub
  512. ' 样式删除
  513. Sub DoStyleDel()
  514. If nStyleIsSys = 0 Then
  515. sSql = "delete from ewebeditor_style where s_id=" & sStyleID
  516. oConn.Execute sSql
  517. sSql = "delete from ewebeditor_toolbar where s_id=" & sStyleID
  518. oConn.Execute sSql
  519. End If
  520. End Sub
  521. ' 样式预览
  522. Sub ShowStylePreview()
  523. Response.Write "<html><head>" & _
  524. "<title>样式预览</title>" & _
  525. "<meta http-equiv='Content-Type' content='text/html; charset=gb2312'>" & _
  526. "</head><body>" & _
  527. "<input type=hidden name=content1  value=''>" & _
  528. "<iframe ID='eWebEditor1' src='ewebeditor.asp?id=content1&style=" & sStyleName & "' frameborder=0 scrolling=no width='" & sStyleWidth & "' HEIGHT='" & sStyleHeight & "'></iframe>" & _
  529. "</body></html>"
  530. End Sub
  531. ' 显示引用代码
  532. Sub ShowStyleCode()
  533. Response.Write "<table align='center'width='100%' border='0' cellpadding='3' cellspacing='1' bgcolor='#6ab6b6'><tr><td bgcolor='#eafefe'><p class=highlight2>样式(<b>" & outHTML(sStyleName) & "</b>)的最佳调用代码如下(其中XXX按实际关联的表单项进行修改):</p>"
  534. Response.Write "<textarea rows=5 cols=65 style='width:100%'><IFRAME ID=""eWebEditor1"" SRC=""ewebeditor.asp?id=XXX&style=" & sStyleName & """ FRAMEBORDER=""0"" SCROLLING=""no"" WIDTH=""" & sStyleWidth & """ HEIGHT=""" & sStyleHeight & """></IFRAME></textarea><br><br></td></tr></table>"
  535. Response.Write "<br><table align='center'width='100%' border='0' cellpadding='3' cellspacing='1' bgcolor='#6ab6b6'><tr><td bgcolor='#eafefe' align='center'><a href='javascript:history.back()'>返回</a></td></tr></table>"
  536. End Sub
  537. ' 显示工具栏表单列表
  538. Sub ShowToolBarList()
  539. Response.Write "<table align='center'width='100%' border='0' cellpadding='3' cellspacing='1' bgcolor='#6ab6b6'><tr>" & _
  540. "<td bgcolor='#eafefe' class=highlight2><b>样式(" & outHTML(sStyleName) & ")下的工具栏管理:</b></td>" & _
  541. "<td bgcolor='#eafefe' align=right><a href='?'>返回样式管理</a></td></tr></table>"
  542. Dim s_AddForm, s_ModiForm
  543. ' 增加表单
  544. If nStyleIsSys = 1 Then
  545. s_AddForm = ""
  546. Else
  547. ' 取当前最大排序号
  548. Dim nMaxOrder
  549. sSql = "select max(T_order) from ewebeditor_toolbar where s_id=" & sStyleID
  550. oRs.Open sSql, oConn, 0, 1
  551. If IsNull(oRs(0)) Then
  552. nMaxOrder = 1
  553. Else
  554. nMaxOrder = oRs(0) + 1
  555. End If
  556. oRs.Close
  557. s_AddForm = "<br><table align='center'width='100%' border='0' cellpadding='3' cellspacing='1' bgcolor='#6ab6b6'>" & _
  558. "<form action='?id=" & sStyleID & "&action=toolbaradd' name='addform' method=post>" & _
  559. "<tr><td bgcolor='#eafefe'>工具栏名:<input type=text name=d_name size=20 class=input value='工具栏" & nMaxOrder & "'> 排序号:<input type=text name=d_order size=5 value='" & nMaxOrder & "' class=input> <input type=submit name=b1 value='新增工具栏'></td></tr>" & _
  560. "</form></table>"
  561. End If
  562. ' 修改表单
  563. Dim s_Manage, s_SubmitButton
  564. s_ModiForm = "<form action='?id=" & sStyleID & "&action=toolbarmodi' name=modiform method=post>" & _
  565. "<table align='center'width='100%' border='0' cellpadding='3' cellspacing='1' bgcolor='#6ab6b6'>" & _
  566. "<tr align=center><td>ID</td><td>工具栏名</td><td>排序号</td><td>操作</td></tr>"
  567. sSql = "select * from ewebeditor_toolbar where s_id=" & sStyleID & " order by t_order asc"
  568. oRs.Open sSql, oConn, 0, 1
  569. Do While Not oRs.Eof
  570. s_Manage = "<a href='?id=" & sStyleID & "&action=buttonset&toolbarid=" & oRs("t_id") & "'>按钮设置</a>"
  571. If nStyleIsSys <> 1 Then
  572. s_Manage = s_Manage & "|<a href='?id=" & sStyleID & "&action=toolbardel&delid=" & oRs("t_id") & "'>删除</a>"
  573. End If
  574. s_ModiForm = s_ModiForm & "<tr align=center>" & _
  575. "<td bgcolor='#eafefe'>" & oRs("t_id") & "</td>" & _
  576. "<td bgcolor='#eafefe'><input type=text name='d_name" & oRs("t_id") & "' value=""" & inHTML(oRs("t_name")) & """ size=30 class=input></td>" & _
  577. "<td bgcolor='#eafefe'><input type=text name='d_order" & oRs("t_id") & "' value='" & oRs("t_order") & "' size=5 class=input></td>" & _
  578. "<td bgcolor='#eafefe'>" & s_Manage & "</td>" & _
  579. "</tr>"
  580. oRs.MoveNext
  581. Loop
  582. oRs.Close
  583. If nStyleIsSys = 1 Then
  584. s_SubmitButton = ""
  585. Else
  586. s_SubmitButton = "<p align=center><input type=submit name=b1 value=' 修改 '></p>"
  587. End If
  588. s_ModiForm = s_ModiForm & "</table>" & s_SubmitButton & "</form><br><br>"
  589. ' 输出表单
  590. Response.Write s_AddForm & s_ModiForm
  591. End Sub
  592. ' 新增工具栏
  593. Sub DoToolBarAdd()
  594. Dim s_Name, s_Order
  595. s_Name = Trim(Request("d_name"))
  596. s_Order = Trim(Request("d_order"))
  597. If s_Name = "" Or Get_TrueLen(s_Name) > 50 Then
  598. Go_Error "工具栏名不能为空,且长度不能大于50个字符长度!"
  599. End If
  600. If IsNumeric(s_Order) = False Then
  601. Go_Error "无效的工具栏排序号,排序号必须为数字!"
  602. End If
  603. If nStyleIsSys = 1 Then
  604. Go_Error "系统自带样式下的工具栏,不允许新增!"
  605. End If
  606. sSql = "select * from ewebeditor_toolbar where 1=0"
  607. oRs.Open sSql, oConn, 1, 3
  608. oRs.AddNew
  609. oRs("s_id") = sStyleID
  610. oRs("t_name") = s_Name
  611. oRs("t_order") = s_Order
  612. oRs("t_button") = ""
  613. oRs.Update
  614. oRs.Close
  615. Response.Write "<script language=javascript>alert(""工具栏(" & outHTML(s_Name) & ")增加操作成功!"");</script>"
  616. End Sub
  617. ' 修改工具栏
  618. Sub DoToolBarModi()
  619. Dim s_Name, s_Order
  620. If nStyleIsSys = 1 Then
  621. Go_Error "系统自带样式下的工具栏,不允许修改!"
  622. End If
  623. sSql = "select * from ewebeditor_toolbar where s_id=" & sStyleID
  624. oRs.Open sSql, oConn, 1, 3
  625. Do While Not oRs.Eof
  626. s_Name = Trim(Request("d_name" & oRs("t_id")))
  627. s_Order = Trim(Request("d_order" & oRs("t_id")))
  628. If s_Name <> "" And IsNumeric(s_Order) = True Then
  629. If s_Name <> oRs("t_name") Or s_Order <> CStr(oRs("t_Order")) Then
  630. oRs("t_name") = s_Name
  631. oRs("t_order") = s_Order
  632. oRs.Update
  633. End If
  634. End If
  635. oRs.MoveNext
  636. Loop
  637. oRs.Close
  638. Response.Write "<script language=javascript>alert('工具栏修改操作成功!');</script>"
  639. End Sub
  640. ' 删除工具栏
  641. Sub DoToolBarDel()
  642. Dim s_DelID
  643. s_DelID = Trim(Request("delid"))
  644. If nStyleIsSys = 1 Then
  645. Go_Error "系统自带样式下的工具栏,不允许删除!"
  646. End If
  647. If IsNumeric(s_DelID) = True Then
  648. sSql = "delete from ewebeditor_toolbar where s_id=" & sStyleID & " and t_id=" & s_DelID
  649. oConn.Execute sSql
  650. Response.Write "<script language=javascript>alert('工具栏(ID:" & s_DelID & ")删除操作成功!');</script>"
  651. End If
  652. End Sub
  653. ' 初始化工具栏
  654. Sub InitToolBar()
  655. Dim b
  656. b = False
  657. sToolBarID = Trim(Request("toolbarid"))
  658. If IsNumeric(sToolBarID) = True Then
  659. sSql = "select * from ewebeditor_toolbar where s_id=" & sStyleID & " and t_id=" & sToolBarID
  660. oRs.Open sSql, oConn, 0, 1
  661. If Not oRs.Eof Then
  662. sToolBarName = oRs("T_Name")
  663. sToolBarOrder = oRs("T_Order")
  664. sToolBarButton = oRs("T_Button")
  665. b = True
  666. End If
  667. oRs.Close
  668. End If
  669. If b = False Then
  670. Go_Error "无效的工具栏ID号,请通过页面上的链接进行操作!"
  671. End If
  672. End Sub
  673. ' 按钮设置
  674. Sub ShowButtonList()
  675. Dim i, n
  676. ' 导航
  677. Response.Write "<table align='center'width='100%' border='0' cellpadding='3' cellspacing='1' bgcolor='#6ab6b6'><tr>" & _
  678. "<td bgcolor='#eafefe'><b>当前样式:<span class=highlight2>" & outHTML(sStyleName) & "</span>&nbsp;&nbsp;当前工具栏:<span class=highlight2>" & outHTML(sToolBarName) & "</span></b></td>" & _
  679. "<td bgcolor='#eafefe' align=right><a href='?action=toolbar&id=" & sStyleID & "'>返回工具栏管理</a> | <a href='?'>返回样式管理</a></td>" & _
  680. "</tr></table>"
  681. ' 取所有按钮
  682. Dim aButtonCode(), aButtonTitle(), aButtonImage()
  683. sSql = "select * from ewebeditor_button where b_allowselect=1 order by b_order asc"
  684. oRs.Open sSql, oConn, 0, 1
  685. i = 0
  686. Do While Not oRs.Eof
  687. i = i + 1
  688. Redim Preserve aButtonCode(i)
  689. Redim Preserve aButtonTitle(i)
  690. Redim Preserve aButtonImage(i)
  691. aButtonCode(i) = oRs("B_Code")
  692. aButtonTitle(i) = oRs("B_Title")
  693. aButtonImage(i) = oRs("B_Image")
  694. oRs.MoveNext
  695. Loop
  696. oRs.Close
  697. ' 取可选列表
  698. Dim s_Option1
  699. s_Option1 = ""
  700. For i = 1 To UBound(aButtonCode)
  701. s_Option1 = s_Option1 & "<option value='" & aButtonCode(i) & "'>" & aButtonTitle(i) & "</option>"
  702. Next
  703. ' 取已选列表
  704. Dim aButton, s_Option2, s_Temp
  705. aButton = Split(sToolBarButton, "|")
  706. s_Option2 = ""
  707. For i = 0 To UBound(aButton)
  708. s_Temp = Code2Title(aButton(i), aButtonCode, aButtonTitle)
  709. If s_Temp <> "" Then
  710. s_Option2 = s_Option2 & "<option value='" & aButton(i) & "'>" & s_Temp & "</option>"
  711. End If
  712. Next
  713. '以下为客户端操作选择脚本
  714. '''''''''''''''''''''''''''''''''''
  715. %>
  716. <script language=javascript>
  717. // 加入已选
  718. function Add() {
  719. var sel1=document.myform.d_b1;
  720. var sel2=document.myform.d_b2;
  721. if (sel1.selectedIndex<0) {
  722. alert("请选择一个待选按钮!");
  723. return;
  724. }
  725. sel2.options[sel2.length]=new Option(sel1.options[sel1.selectedIndex].innerHTML,sel1.options[sel1.selectedIndex].value);
  726. }
  727. // 从已选中删除
  728. function Del() {
  729. var sel=document.myform.d_b2;
  730. var nIndex = sel.selectedIndex;
  731. var nLen = sel.length;
  732. if (nLen<1) return;
  733. if (nIndex<0) {
  734. alert("请选择一个已选按钮!");
  735. return;
  736. }
  737. for (var i=nIndex;i<nLen-1;i++) {
  738. sel.options[i].value=sel.options[i+1].value;
  739. sel.options[i].innerHTML=sel.options[i+1].innerHTML;
  740. }
  741. sel.length=nLen-1;
  742. }
  743. // 排序:向上移动
  744. function Up() {
  745. var sel=document.myform.d_b2;
  746. var nIndex = sel.selectedIndex;
  747. var nLen = sel.length;
  748. if ((nLen<1)||(nIndex==0)) return;
  749. if (nIndex<0) {
  750. alert("请选择一个要移动的已选按钮!");
  751. return;
  752. }
  753. var sValue=sel.options[nIndex].value;
  754. var sHTML=sel.options[nIndex].innerHTML;
  755. sel.options[nIndex].value=sel.options[nIndex-1].value;
  756. sel.options[nIndex].innerHTML=sel.options[nIndex-1].innerHTML;
  757. sel.options[nIndex-1].value=sValue;
  758. sel.options[nIndex-1].innerHTML=sHTML;
  759. sel.selectedIndex=nIndex-1;
  760. }
  761. // 排序:向下移动
  762. function Down() {
  763. var sel=document.myform.d_b2;
  764. var nIndex = sel.selectedIndex;
  765. var nLen = sel.length;
  766. if ((nLen<1)||(nIndex==nLen-1)) return;
  767. if (nIndex<0) {
  768. alert("请选择一个要移动的已选按钮!");
  769. return;
  770. }
  771. var sValue=sel.options[nIndex].value;
  772. var sHTML=sel.options[nIndex].innerHTML;
  773. sel.options[nIndex].value=sel.options[nIndex+1].value;
  774. sel.options[nIndex].innerHTML=sel.options[nIndex+1].innerHTML;
  775. sel.options[nIndex+1].value=sValue;
  776. sel.options[nIndex+1].innerHTML=sHTML;
  777. sel.selectedIndex=nIndex+1;
  778. }
  779. // 提交处理
  780. function checkform() {
  781. var sel=document.myform.d_b2;
  782. var nLen = sel.length;
  783. var str="";
  784. for (var i=0;i<nLen;i++) {
  785. if (i>0) str+="|";
  786. str+=sel.options[i].value;
  787. }
  788. document.myform.d_button.value=str;
  789. return true;
  790. }
  791. </script>
  792. <%
  793. '''''''''''''''''''''''''''''''''''
  794. ' 选择设置表单
  795. Dim s_SubmitButton
  796. If nStyleIsSys = 1 Then
  797. s_SubmitButton = ""
  798. Else
  799. s_SubmitButton = "<input type=submit name=b value=' 保存设置 '>"
  800. End If
  801. Response.Write "<table align='center'width='100%' border='0' cellpadding='3' cellspacing='1' bgcolor='#6ab6b6'>" & _
  802. "<form action='?action=buttonsave&id=" & sStyleID & "&toolbarid=" & sToolBarID & "' method=post name=myform onsubmit='return checkform()'>" & _
  803. "<tr align=center><td>可选按钮</td><td></td><td>已选按钮</td><td></td></tr>" & _
  804. "<tr align=center>" & _
  805. "<td bgcolor='#eafefe'><select name='d_b1' size=20 style='width:200px' ondblclick='Add()'>" & s_Option1 & "</select></td>" & _
  806. "<td bgcolor='#eafefe'><input type=button name=b1 value=' → ' onclick='Add()'><br><br><input type=button name=b1 value=' ← ' onclick='Del()'></td>" & _
  807. "<td bgcolor='#eafefe'><select name='d_b2' size=20 style='width:200px' ondblclick='Del()'>" & s_Option2 & "</select></td>" & _
  808. "<td bgcolor='#eafefe'><input type=button name=b3 value='↑' onclick='Up()'><br><br><br><input type=button name=b4 value='↓' onclick='Down()'></td>" & _
  809. "</tr>" & _
  810. "<input type=hidden name='d_button' value=''>" & _
  811. "<tr><td bgcolor='#eafefe' colspan=4 align=right>" & s_SubmitButton & "</td></tr>" & _
  812. "</form></table>"
  813. ' 显示图片对照表
  814. Response.Write "<p class=highlight1><b>以下是按钮图片对照表(部分下拉框或特殊按钮可能没图):</b></p>"
  815. Response.Write "<table align='center'width='100%' border='0' cellpadding='3' cellspacing='1' bgcolor='#6ab6b6'>"
  816. n = 0
  817. For i = 1 To UBound(aButtonCode)
  818. n = i Mod 5
  819. If n = 1 Then
  820. Response.Write "<tr>"
  821. End If
  822. Response.Write "<td bgcolor='#eafefe'>"
  823. If aButtonImage(i) <> "" Then
  824. Response.Write "<img border=0 align=absmiddle src='ButtonImage/standard/" & aButtonImage(i) & "'>"
  825. End If
  826. Response.Write aButtonTitle(i)
  827. Response.Write "</td>"
  828. If n = 0 Then
  829. Response.Write "</tr>"
  830. End If
  831. Next
  832. If n > 0 Then
  833. For i = 1 To 5 - n
  834. Response.Write "<td bgcolor='#eafefe'>&nbsp;</td>"
  835. Next
  836. Response.Write "</tr>"
  837. End if
  838. Response.Write "</table><br><br>"
  839. End Sub
  840. ' 由按钮代码得到按钮标题
  841. Function Code2Title(s_Code, a_ButtonCode, a_ButtonTitle)
  842. Dim i
  843. Code2Title = ""
  844. For i = 1 To UBound(a_ButtonCode)
  845. If UCase(a_ButtonCode(i)) = UCase(s_Code) Then
  846. Code2Title = a_ButtonTitle(i)
  847. Exit Function
  848. End If
  849. Next
  850. End Function
  851. ' 按钮设置保存
  852. Sub DoButtonSave()
  853. Dim s_Button
  854. s_Button = Trim(Request("d_button"))
  855. If nStyleIsSys = 1 Then
  856. Go_Error "系统自带样式,不允许对按钮进行修改!"
  857. End If
  858. sSql = "select * from ewebeditor_toolbar where t_id=" & sToolBarID
  859. oRs.Open sSql, oConn, 1, 3
  860. If Not oRs.Eof Then
  861. oRs("T_Button") = s_Button
  862. oRs.Update
  863. End If
  864. oRs.Close
  865. Response.Write "<br><table align='center'width='100%' border='0' cellpadding='3' cellspacing='1' bgcolor='#6ab6b6'>" & _
  866. "<tr valign=top><td bgcolor='#eafefe'><b><span class=highlight2>工具栏按钮设置保存成功!</span></b><br><br><ul>我现在<br><br><li><a href='?'>返回样式管理</a><li><a href='?action=toolbar&id=" & sStyleID & "'>返回工具栏管理</a><li><a href='?action=buttonset&id=" & sStyleID & "&toolbarid=" & sToolBarID & "'>重新设置此工具栏下的按钮</a></ul></td></tr>" & _
  867. "</table><br><br>"
  868. End Sub
  869. Sub RemoveApplication()
  870. Dim aApplicationName, i
  871. aApplicationName = Application("eWebEditor_ApplicationName")
  872. If IsArray(aApplicationName) = True Then
  873. For i = 1 To UBound(aApplicationName)
  874. Application.Contents.Remove(aApplicationName(i))
  875. Next
  876. Application.Contents.Remove("eWebEditor_ApplicationName")
  877. Application.Contents.Remove("eWebEditor_ApplicationUrl")
  878. End If
  879. End Sub
  880. %>