⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 style.asp

📁 56770网络科技精心打造的超强版本已开始发售
💻 ASP
📖 第 1 页 / 共 3 页
字号:
<!--#include file = "Include/Startup.asp"-->
<!--#include file = "private.asp"-->

<%

Dim sStyleID, sStyleName, sStyleDir, sStyleCSS, sStyleUploadDir, sStyleWidth, sStyleHeight, sStyleMemo, nStyleIsSys, sStyleStateFlag, sStyleDetectFromWord, sStyleInitMode, sStyleBaseUrl, sStyleUploadObject, sStyleAutoDir, sStyleBaseHref, sStyleContentPath, sStyleAutoRemote, sStyleShowBorder
Dim sStyleFileExt, sStyleFlashExt, sStyleImageExt, sStyleMediaExt, sStyleRemoteExt, sStyleFileSize, sStyleFlashSize, sStyleImageSize, sStyleMediaSize, sStyleRemoteSize
Dim sToolBarID, sToolBarName, sToolBarOrder, sToolBarButton

sPosition = sPosition & "样式管理"

If sAction = "STYLEPREVIEW" Then
	' 样式预览
	Call InitStyle()
	Call ShowStylePreview()
	Response.End
End If


Call Header()
Call Content()
Call Footer()


Sub Content()
	Select Case sAction
	Case "COPY"
		' 拷贝一标准样式
		Call InitStyle()
		Call DoCopy()
		Call ShowStyleList()
	Case "STYLEADD"
		' 新增样式表单
		Call ShowStyleForm("ADD")
	Case "STYLESET"
		' 样式设置,修改或查看
		Call InitStyle()
		Call ShowStyleForm("SET")
	Case "STYLEADDSAVE"
		' 样式新增保存
		Call CheckStyleForm()
		Call DoStyleAddSave()
	Case "STYLESETSAVE"
		' 样式设置修改保存
		Call CheckStyleForm()
		Call DoStyleSetSave()
		Call RemoveApplication()
	Case "STYLEDEL"
		' 样式删除
		Call InitStyle()
		Call DoStyleDel()
		Call ShowStyleList()
		Call RemoveApplication()
	Case "CODE"
		' 显示引用代码
		Call InitStyle()
		Call ShowStyleCode()
	Case "TOOLBAR"
		' 显示工具栏表单
		Call InitStyle()
		Call ShowToolBarList()
	Case "TOOLBARADD"
		' 新增工具栏
		Call InitStyle()
		Call DoToolBarAdd()
		Call ShowToolBarList()
		Call RemoveApplication()
	Case "TOOLBARMODI"
		' 修改工具栏
		Call InitStyle()
		Call DoToolBarModi()
		Call ShowToolBarList()
		Call RemoveApplication()
	Case "TOOLBARDEL"
		' 删除工具栏
		Call InitStyle()
		Call DoToolBarDel()
		Call ShowToolBarList()
		Call RemoveApplication()
	Case "BUTTONSET"
		' 按钮设置
		Call InitStyle()
		Call InitToolBar()
		Call ShowButtonList()
	Case "BUTTONSAVE"
		' 按钮设置保存
		Call InitStyle()
		Call InitToolBar()
		Call DoButtonSave()
		Call RemoveApplication()
	Case Else
		' 当前所有样式列表
		Call ShowStyleList()
	End Select
End Sub


' 当前所有样式列表
Sub ShowStyleList()
	Response.Write "<table border=0 cellpadding=0 cellspacing=0 width='100%' height=40><tr>" & _
		"<td class=highlight2><b>以下为当前所有样式列表:</b></td>" & _
		"<td align=right><a href='?action=styleadd'>新增样式</a></td></tr></table>"

	Response.Write "<table border=0 cellpadding=0 cellspacing=0 class=list1>" & _
		"<form action='?action=del' method=post name=myform>" & _
		"<tr align=center>" & _
			"<th width=80>样式名</th>" & _
			"<th width=60>最佳宽度</th>" & _
			"<th width=60>最佳高度</th>" & _
			"<th width=200>说明</th>" & _
			"<th width=180>管理</th>" & _
		"</tr>"

	Dim sManage
	sSql = "select * from ewebeditor_style"
	oRs.Open sSql, oConn, 0, 1
	Do While Not oRs.Eof
		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>"
		If oRs("S_IsSys") = 1 Then
			sManage = sManage & "|<a href='?action=copy&id=" & oRs("S_ID") & "'>拷贝</a>"
		Else
			sManage = sManage & "|<a href='?action=styledel&id=" & oRs("S_ID") & "'>删除</a>"
		End If
		Response.Write "<tr align=center>" & _
			"<td>" & outHTML(oRs("S_Name")) & "</td>" & _
			"<td>" & oRs("S_Width") & "</td>" & _
			"<td>" & oRs("S_Height") & "</td>" & _
			"<td align=left>" & outHTML(oRs("S_Memo")) & "</td>" & _
			"<td>" & sManage & "</td>" & _
			"</tr>"
		oRs.MoveNext
	Loop
	oRs.Close
	
	Response.Write "</table>"

	Response.Write "<p class=highlight1><b>说明:</b>系统自带样式不允许对设置进行修改删除,但允许查看设置!你可以先“拷贝一标准样式”然后对其设置进行修改以达到快速新建样式的目的。</p><br><br>"

End Sub

' 拷贝一标准样式
Sub DoCopy()
	' 只有系统样式才有拷贝功能
	If nStyleIsSys <> 1 Then
		Exit Sub
	End If
	' 自动取有效的样式名,从1......到...
	Dim i, b, sNewID, sNewName
	b = False
	i = 0
	Do While b = False
		i = i + 1
		sNewName = sStyleName & i
		sSql = "select s_id from ewebeditor_style where s_name='" & sNewName & "'"
		oRs.Open sSql, oConn, 0, 1
		If oRs.Eof And oRs.Bof Then
			b = True
		End If
		oRs.Close
	Loop
	' 插入一与标准样式相同的记录,名不同
	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
	oConn.Execute sSql
	' 取新样式的ID
	sSql = "select s_id from ewebeditor_style where s_name='" & sNewName & "'"
	oRs.Open sSql, oConn, 0, 1
	sNewID = oRs(0)
	oRs.Close
	' 拷贝工具栏
	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
	oConn.Execute sSql
End Sub

' 样式表单
Sub ShowStyleForm(sFlag)
	Dim s_Title, s_Button, s_Action
	Dim s_FormStateFlag, s_FormDetectFromWord, s_FormInitMode, s_FormBaseUrl, s_FormUploadObject, s_FormAutoDir, s_FormAutoRemote, s_FormShowBorder
	
	If sFlag = "ADD" Then
		sStyleID = ""
		sStyleName = ""
		sStyleDir = "standard"
		sStyleCSS = "office"
		sStyleUploadDir = "UploadFile/"
		sStyleBaseHref = "http://Localhost/eWebEditor/"
		sStyleContentPath = "UploadFile/"
		sStyleWidth = "600"
		sStyleHeight = "400"
		sStyleMemo = ""
		nStyleIsSys = 0
		s_Title = "新增样式"
		s_Action = "StyleAddSave"
		sStyleFileExt = "rar|zip|exe|doc|xls|chm|hlp"
		sStyleFlashExt = "swf"
		sStyleImageExt = "gif|jpg|jpeg|bmp"
		sStyleMediaExt = "rm|mp3|wav|mid|midi|ra|avi|mpg|mpeg|asf|asx|wma|mov"
		sStyleRemoteExt = "gif|jpg|bmp"
		sStyleFileSize = "500"
		sStyleFlashSize = "100"
		sStyleImageSize = "100"
		sStyleMediaSize = "100"
		sStyleRemoteSize = "100"
		sStyleStateFlag = "1"
		sStyleAutoRemote = "1"
		sStyleShowBorder = "0"
		sStyleUploadObject = "0"
		sStyleAutoDir = "0"
		sStyleDetectFromWord = "true"
		sStyleInitMode = "EDIT"
		sStyleBaseUrl = "0"
	Else
		sStyleName = inHTML(sStyleName)
		sStyleDir = inHTML(sStyleDir)
		sStyleCSS = inHTML(sStyleCSS)
		sStyleUploadDir = inHTML(sStyleUploadDir)
		sStyleBaseHref = inHTML(sStyleBaseHref)
		sStyleContentPath = inHTML(sStyleContentPath)
		sStyleMemo = inHTML(sStyleMemo)
		s_Title = "设置样式"
		s_Action = "StyleSetSave"
	End If

	s_FormStateFlag = InitSelect("d_stateflag", Split("显示|不显示", "|"), Split("1|0", "|"), sStyleStateFlag, "", "")
	s_FormAutoRemote = InitSelect("d_autoremote", Split("自动上传|不自动上传", "|"), Split("1|0", "|"), sStyleAutoRemote, "", "")
	s_FormShowBorder = InitSelect("d_showborder", Split("默认显示|默认不显示", "|"), Split("1|0", "|"), sStyleShowBorder, "", "")
	s_FormUploadObject = InitSelect("d_uploadobject", Split("无惧无组件上传类|ASPUpload上传组件|SA-FileUp上传组件|LyfUpload上传组件", "|"), Split("0|1|2|3", "|"), sStyleUploadObject, "", "")
	s_FormAutoDir = InitSelect("d_autodir", Split("不使用|年目录|年月目录|年月日目录", "|"), Split("0|1|2|3", "|"), sStyleAutoDir, "", "")
	s_FormDetectFromWord = InitSelect("d_detectfromword", Split("自动检测有提示|不自动检测", "|"), Split("true|false", "|"), sStyleDetectFromWord, "", "")
	s_FormInitMode = InitSelect("d_initmode", Split("代码模式|编辑模式|文本模式|预览模式", "|"), Split("CODE|EDIT|TEXT|VIEW", "|"), sStyleInitMode, "", "")
	s_FormBaseUrl = InitSelect("d_baseurl", Split("相对路径|绝对根路径|绝对全路径", "|"), Split("0|1|2", "|"), sStyleBaseUrl, "", "")

	If nStyleIsSys = 0 Then
		s_Button = "<tr><td align=center colspan=4><input type=image border=0 src='Images/submit.gif' align=absmiddle>&nbsp;<a href='javascript:document.myform.reset()'><img border=0 src='Images/reset.gif' align=absmiddle></a></td></tr>"
	Else
		s_Button = ""
	End If
	
	Response.Write "<table border=0 cellpadding=5 cellspacing=0 height=20 width='100%'><tr><td align=right><a href='javascript:history.back()'>返回</a></td></tr></table>"

	Response.Write "<table border=0 cellpadding=0 cellspacing=0 align=center class=form1>" & _
			"<form action='?action=" & s_Action & "&id=" & sStyleID & "' method=post name=myform>" & _
			"<tr><th colspan=4>&nbsp;&nbsp;" & s_Title & "(鼠标移到输入框可看说明,带*号为必填项)</th></tr>" & _
			"<tr><td width='15%' align=right>样式名称:</td><td width='35%'><input type=text class=input size=20 name=d_name title='引用此样式的名字,不要加特殊符号,最大50个字符长度' value=""" & sStyleName & """> <span class=highlight2>*</span></td><td width='15%' align=right>初始模式:</td><td width='35%'>" & s_FormInitMode & " <span class=highlight2>*</span></td></tr>" & _
			"<tr><td width='15%' align=right>上传组件:</td><td width='35%'>" & s_FormUploadObject & " <span class=highlight2>*</span></td><td width='15%' align=right>自动目录:</td><td width='35%'>" & s_FormAutoDir & " <span class=highlight2>*</span></td></tr>" & _
			"<tr><td width='15%' align=right>图片目录:</td><td width='35%'><input type=text class=input size=20 name=d_dir title='存放此样式图片文件的目录名,必须在ButtonImage下,最大50个字符长度' value=""" & sStyleDir & """> <span class=highlight2>*</span></td><td width='15%' align=right>样式目录:</td><td width='35%'><input type=text class=input size=20 name=d_css title='存放此样式css文件的目录名,必须在CSS下,最大50个字符长度' value=""" & sStyleCSS & """> <span class=highlight2>*</span></td></tr>" & _
			"<tr><td width='15%' align=right>最佳宽度:</td><td width='35%'><input type=text class=input name=d_width size=20 title='最佳引用效果的宽度,数字型' value='" & sStyleWidth & "'> <span class=highlight2>*</span></td><td width='15%' align=right>最佳高度:</td><td width='35%'><input type=text class=input name=d_height size=20 title='最佳引用效果的高度,数字型' value='" & sStyleHeight & "'> <span class=highlight2>*</span></td></tr>" & _
			"<tr><td width='15%' align=right>状 态 栏:</td><td width='35%'>" & s_FormStateFlag & " <span class=highlight2>*</span></td><td width='15%' align=right>Word粘贴:</td><td width='35%'>" & s_FormDetectFromWord & " <span class=highlight2>*</span></td></tr>" & _
			"<tr><td width='15%' align=right>远程文件:</td><td width='35%'>" & s_FormAutoRemote & " <span class=highlight2>*</span></td><td width='15%' align=right>指导方针:</td><td width='35%'>" & s_FormShowBorder & " <span class=highlight2>*</span></td></tr>" & _
			"<tr><td colspan=4><span class=highlight2>&nbsp;&nbsp;&nbsp;上传文件及系统文件路径相关设置(只有在使用相对路径模式时,才要设置显示路径和内容路径):</span></td></tr>" & _
			"<tr><td width='15%' align=right>路径模式:</td><td width='35%'>" & s_FormBaseUrl & " <span class=highlight2>*</span> <a href='#baseurl'>说明</a></td><td width='15%' align=right>上传路径:</td><td width='35%'><input type=text class=input size=20 name=d_uploaddir title='上传文件所存放路径,相对eWebEditor根目录文件的路径,最大50个字符长度' value=""" & sStyleUploadDir & """> <span class=highlight2>*</span></td></tr>" & _
			"<tr><td width='15%' align=right>显示路径:</td><td width='35%'><input type=text class=input size=20 name=d_basehref title='显示内容页所存放路径,必须以&quot;/&quot;开头,最大50个字符长度' value=""" & sStyleBaseHref & """></td><td width='15%' align=right>内容路径:</td><td width='35%'><input type=text class=input size=20 name=d_contentpath title='实际保存在内容中的路径,相对显示路径的路径,不能以&quot;/&quot;开头,最大50个字符长度' value=""" & sStyleContentPath & """></td></tr>" & _
			"<tr><td colspan=4><span class=highlight2>&nbsp;&nbsp;&nbsp;允许上传文件类型及文件大小设置(文件大小单位为KB,0表示没有限制):</span></td></tr>" & _
			"<tr><td width='15%' align=right>图片类型:</td><td width='35%'><input type=text class=input name=d_imageext size=20 title='用于图片相关的上传,最大250个字符长度' value='" & sStyleImageExt & "'></td><td width='15%' align=right>图片限制:</td><td width='35%'><input type=text class=input name=d_imagesize size=20 title='数字型,单位KB' value='" & sStyleImageSize & "'></td></tr>" & _
			"<tr><td width='15%' align=right>Flash类型:</td><td width='35%'><input type=text class=input name=d_flashext size=20 title='用于插入Flash动画,最大250个字符长度' value='" & sStyleFlashExt & "'></td><td width='15%' align=right>Flash限制:</td><td width='35%'><input type=text class=input name=d_flashsize size=20 title='数字型,单位KB' value='" & sStyleFlashSize & "'></td></tr>" & _
			"<tr><td width='15%' align=right>媒体类型:</td><td width='35%'><input type=text class=input name=d_mediaext size=20 title='用于插入媒体文件,最大250个字符长度' value='" & sStyleMediaExt & "'></td><td width='15%' align=right>媒体限制:</td><td width='35%'><input type=text class=input name=d_mediasize size=20 title='数字型,单位KB' value='" & sStyleMediaSize & "'></td></tr>" & _
			"<tr><td width='15%' align=right>其它类型:</td><td width='35%'><input type=text class=input name=d_fileext size=20 title='用于插入其它文件,最大250个字符长度' value='" & sStyleFileExt & "'></td><td width='15%' align=right>其它限制:</td><td width='35%'><input type=text class=input name=d_filesize size=20 title='数字型,单位KB' value='" & sStyleFileSize & "'></td></tr>" & _
			"<tr><td width='15%' align=right>远程类型:</td><td width='35%'><input type=text class=input name=d_remoteext size=20 title='用于自动上传远程文件,最大250个字符长度' value='" & sStyleRemoteExt & "'></td><td width='15%' align=right>远程限制:</td><td width='35%'><input type=text class=input name=d_remotesize size=20 title='数字型,单位KB' value='" & sStyleRemoteSize & "'></td></tr>" & _
			"<tr><td align=right>备注说明:</td><td colspan=3><textarea class=textarea rows=7 cols=65 name=d_memo title='此样式的说明,更有利于调用'>" & sStyleMemo & "</textarea></td></tr>" & s_Button & _
			"</form>" & _
			"</table>"

	Response.Write "<a name=baseurl></a><p><span class=highlight2><b>路径模式设置说明:</b></span><br>" & _
		"<b>相对路径:</b>指所有的相关上传或自动插入文件路径,编辑后都以""UploadFile/...""或""../UploadFile/...""形式呈现,当使用此模式时,显示路径和内容路径必填,显示路径必须以""/""开头和结尾,内容路径设置中不能以""/""开头。<br>" & _
		"<b>绝对根路径:</b>指所有的相关上传或自动插入文件路径,编辑后都以""/eWebEditor/UploadFile/...""这种形式呈现,当使用此模式时,显示路径和内容路径不必填。<br>" & _
		"<b>绝对全路径:</b>指所有的相关上传或自动插入文件路径,编辑后都以""http://xxx.xxx.xxx/eWebEditor/UploadFile/...""这种形式呈现,当使用此模式时,显示路径和内容路径不必填。</p><br><br>"

End Sub

' 初始化样式表数据
Sub InitStyle()
	Dim b
	b = False
	sStyleID = Trim(Request("id"))
	If IsNumeric(sStyleID) = True Then
		sSql = "select * from ewebeditor_style where s_id=" & sStyleID
		oRs.Open sSql, oConn, 0, 1
		If Not oRs.Eof Then
			sStyleName = oRs("S_Name")
			sStyleDir = oRs("S_Dir")
			sStyleCSS = oRs("S_CSS")
			sStyleUploadDir = oRs("S_UploadDir")
			sStyleBaseHref = oRs("S_BaseHref")
			sStyleContentPath = oRs("S_ContentPath")
			sStyleWidth = CStr(oRs("S_Width"))
			sStyleHeight = CStr(oRs("S_Height"))
			sStyleMemo = oRs("S_Memo")
			nStyleIsSys = oRs("S_IsSys")
			sStyleFileExt = oRs("S_FileExt")
			sStyleFlashExt = oRs("S_FlashExt")
			sStyleImageExt = oRs("S_ImageExt")
			sStyleMediaExt = oRs("S_MediaExt")
			sStyleRemoteExt = oRs("S_RemoteExt")
			sStyleFileSize = oRs("S_FileSize")
			sStyleFlashSize = oRs("S_FlashSize")
			sStyleImageSize = oRs("S_ImageSize")
			sStyleMediaSize = oRs("S_MediaSize")
			sStyleRemoteSize = oRs("S_RemoteSize")
			sStyleStateFlag = CStr(oRs("S_StateFlag"))
			sStyleAutoRemote = CStr(oRs("S_AutoRemote"))
			sStyleShowBorder = CStr(oRs("S_ShowBorder"))
			sStyleUploadObject = CStr(oRs("S_UploadObject"))
			sStyleAutoDir = CStr(oRs("S_AutoDir"))
			sStyleDetectFromWord = oRs("S_DetectFromWord")
			sStyleInitMode = oRs("S_InitMode")
			sStyleBaseUrl = oRs("S_BaseUrl")
			b = True
		End If
		oRs.Close
	End If
	If b = False Then
		Go_Error "无效的样式ID号,请通过页面上的链接进行操作!"
	End If
End Sub

' 检测样式表单提交的有效性
Sub CheckStyleForm()
	sStyleName = Trim(Request("d_name"))
	sStyleDir = Trim(Request("d_dir"))
	sStyleCSS = Trim(Request("d_css"))
	sStyleUploadDir = Trim(Request("d_uploaddir"))
	sStyleBaseHref = Trim(Request("d_basehref"))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -