📄 admin_style.asp
字号:
Sub DoToolBarAdd()
Dim s_Name, s_Order
s_Name = Trim(Request("d_name"))
s_Order = Trim(Request("d_order"))
If s_Name = "" Or Get_TrueLen(s_Name) > 50 Then
Go_Error "工具栏名不能为空,且长度不能大于50个字符长度!"
End If
If IsNumeric(s_Order) = False Then
Go_Error "无效的工具栏排序号,排序号必须为数字!"
End If
If nStyleIsSys = 1 Then
Go_Error "系统自带样式下的工具栏,不允许新增!"
End If
sSql = "select * from ewebeditor_toolbar where 1=0"
oRs.Open sSql, oConn, 1, 3
oRs.AddNew
oRs("s_id") = sStyleID
oRs("t_name") = s_Name
oRs("t_order") = s_Order
oRs("t_button") = ""
oRs.Update
oRs.Close
Response.Write "<script language=javascript>alert(""工具栏(" & outHTML(s_Name) & ")增加操作成功!"");</script>"
End Sub
' 修改工具栏
Sub DoToolBarModi()
Dim s_Name, s_Order
If nStyleIsSys = 1 Then
Go_Error "系统自带样式下的工具栏,不允许修改!"
End If
sSql = "select * from ewebeditor_toolbar where s_id=" & sStyleID
oRs.Open sSql, oConn, 1, 3
Do While Not oRs.Eof
s_Name = Trim(Request("d_name" & oRs("t_id")))
s_Order = Trim(Request("d_order" & oRs("t_id")))
If s_Name <> "" And IsNumeric(s_Order) = True Then
If s_Name <> oRs("t_name") Or s_Order <> CStr(oRs("t_Order")) Then
oRs("t_name") = s_Name
oRs("t_order") = s_Order
oRs.Update
End If
End If
oRs.MoveNext
Loop
oRs.Close
Response.Write "<script language=javascript>alert('工具栏修改操作成功!');</script>"
End Sub
' 删除工具栏
Sub DoToolBarDel()
Dim s_DelID
s_DelID = Trim(Request("delid"))
If nStyleIsSys = 1 Then
Go_Error "系统自带样式下的工具栏,不允许删除!"
End If
If IsNumeric(s_DelID) = True Then
sSql = "delete from ewebeditor_toolbar where s_id=" & sStyleID & " and t_id=" & s_DelID
oConn.Execute sSql
Response.Write "<script language=javascript>alert('工具栏(ID:" & s_DelID & ")删除操作成功!');</script>"
End If
End Sub
' 初始化工具栏
Sub InitToolBar()
Dim b
b = False
sToolBarID = Trim(Request("toolbarid"))
If IsNumeric(sToolBarID) = True Then
sSql = "select * from ewebeditor_toolbar where s_id=" & sStyleID & " and t_id=" & sToolBarID
oRs.Open sSql, oConn, 0, 1
If Not oRs.Eof Then
sToolBarName = oRs("T_Name")
sToolBarOrder = oRs("T_Order")
sToolBarButton = oRs("T_Button")
b = True
End If
oRs.Close
End If
If b = False Then
Go_Error "无效的工具栏ID号,请通过页面上的链接进行操作!"
End If
End Sub
' 按钮设置
Sub ShowButtonList()
Dim i, n
' 导航
Response.Write "<table border=0 cellpadding=5 cellspacing=0 height=30 width='100%'><tr>" & _
"<td><b>当前样式:<span class=highlight2>" & outHTML(sStyleName) & "</span> 当前工具栏:<span class=highlight2>" & outHTML(sToolBarName) & "</span></b></td>" & _
"<td align=right><a href='?action=toolbar&id=" & sStyleID & "'>返回工具栏管理</a> | <a href='?'>返回样式管理</a></td>" & _
"</tr></table>"
' 取所有按钮
Dim aButtonCode(), aButtonTitle(), aButtonImage()
sSql = "select * from ewebeditor_button where b_allowselect=1 order by b_order asc"
oRs.Open sSql, oConn, 0, 1
i = 0
Do While Not oRs.Eof
i = i + 1
Redim Preserve aButtonCode(i)
Redim Preserve aButtonTitle(i)
Redim Preserve aButtonImage(i)
aButtonCode(i) = oRs("B_Code")
aButtonTitle(i) = oRs("B_Title")
aButtonImage(i) = oRs("B_Image")
oRs.MoveNext
Loop
oRs.Close
' 取可选列表
Dim s_Option1
s_Option1 = ""
For i = 1 To UBound(aButtonCode)
s_Option1 = s_Option1 & "<option value='" & aButtonCode(i) & "'>" & aButtonTitle(i) & "</option>"
Next
' 取已选列表
Dim aButton, s_Option2, s_Temp
aButton = Split(sToolBarButton, "|")
s_Option2 = ""
For i = 0 To UBound(aButton)
s_Temp = Code2Title(aButton(i), aButtonCode, aButtonTitle)
If s_Temp <> "" Then
s_Option2 = s_Option2 & "<option value='" & aButton(i) & "'>" & s_Temp & "</option>"
End If
Next
'以下为客户端操作选择脚本
'''''''''''''''''''''''''''''''''''
%>
<script language=javascript>
// 加入已选
function Add() {
var sel1=document.myform.d_b1;
var sel2=document.myform.d_b2;
if (sel1.selectedIndex<0) {
alert("请选择一个待选按钮!");
return;
}
sel2.options[sel2.length]=new Option(sel1.options[sel1.selectedIndex].innerHTML,sel1.options[sel1.selectedIndex].value);
}
// 从已选中删除
function Del() {
var sel=document.myform.d_b2;
var nIndex = sel.selectedIndex;
var nLen = sel.length;
if (nLen<1) return;
if (nIndex<0) {
alert("请选择一个已选按钮!");
return;
}
for (var i=nIndex;i<nLen-1;i++) {
sel.options[i].value=sel.options[i+1].value;
sel.options[i].innerHTML=sel.options[i+1].innerHTML;
}
sel.length=nLen-1;
}
// 排序:向上移动
function Up() {
var sel=document.myform.d_b2;
var nIndex = sel.selectedIndex;
var nLen = sel.length;
if ((nLen<1)||(nIndex==0)) return;
if (nIndex<0) {
alert("请选择一个要移动的已选按钮!");
return;
}
var sValue=sel.options[nIndex].value;
var sHTML=sel.options[nIndex].innerHTML;
sel.options[nIndex].value=sel.options[nIndex-1].value;
sel.options[nIndex].innerHTML=sel.options[nIndex-1].innerHTML;
sel.options[nIndex-1].value=sValue;
sel.options[nIndex-1].innerHTML=sHTML;
sel.selectedIndex=nIndex-1;
}
// 排序:向下移动
function Down() {
var sel=document.myform.d_b2;
var nIndex = sel.selectedIndex;
var nLen = sel.length;
if ((nLen<1)||(nIndex==nLen-1)) return;
if (nIndex<0) {
alert("请选择一个要移动的已选按钮!");
return;
}
var sValue=sel.options[nIndex].value;
var sHTML=sel.options[nIndex].innerHTML;
sel.options[nIndex].value=sel.options[nIndex+1].value;
sel.options[nIndex].innerHTML=sel.options[nIndex+1].innerHTML;
sel.options[nIndex+1].value=sValue;
sel.options[nIndex+1].innerHTML=sHTML;
sel.selectedIndex=nIndex+1;
}
// 提交处理
function checkform() {
var sel=document.myform.d_b2;
var nLen = sel.length;
var str="";
for (var i=0;i<nLen;i++) {
if (i>0) str+="|";
str+=sel.options[i].value;
}
document.myform.d_button.value=str;
return true;
}
</script>
<%
'''''''''''''''''''''''''''''''''''
' 选择设置表单
Dim s_SubmitButton
If nStyleIsSys = 1 Then
s_SubmitButton = ""
Else
s_SubmitButton = "<input type=submit name=b value=' 保存设置 '>"
End If
Response.Write "<table border=0 cellpadding=5 cellspacing=0 align=center>" & _
"<form action='?action=buttonsave&id=" & sStyleID & "&toolbarid=" & sToolBarID & "' method=post name=myform onsubmit='return checkform()'>" & _
"<tr align=center><td>可选按钮</td><td></td><td>已选按钮</td><td></td></tr>" & _
"<tr align=center>" & _
"<td><select name='d_b1' size=20 style='width:200px' ondblclick='Add()'>" & s_Option1 & "</select></td>" & _
"<td><input type=button name=b1 value=' → ' onclick='Add()'><br><br><input type=button name=b1 value=' ← ' onclick='Del()'></td>" & _
"<td><select name='d_b2' size=20 style='width:200px' ondblclick='Del()'>" & s_Option2 & "</select></td>" & _
"<td><input type=button name=b3 value='↑' onclick='Up()'><br><br><br><input type=button name=b4 value='↓' onclick='Down()'></td>" & _
"</tr>" & _
"<input type=hidden name='d_button' value=''>" & _
"<tr><td colspan=4 align=right>" & s_SubmitButton & "</td></tr>" & _
"</form></table>"
' 显示图片对照表
Response.Write "<p class=highlight1><b>以下是按钮图片对照表(部分下拉框或特殊按钮可能没图):</b></p>"
Response.Write "<table border=1 cellpadding=3 cellspacing=0 width='100%'>"
n = 0
For i = 1 To UBound(aButtonCode)
n = i Mod 4
If n = 1 Then
Response.Write "<tr>"
End If
Response.Write "<td>"
If aButtonImage(i) <> "" Then
Response.Write "<img border=0 align=absmiddle src='ButtonImage/standard/" & aButtonImage(i) & "'>"
End If
Response.Write aButtonTitle(i)
Response.Write "</td>"
If n = 0 Then
Response.Write "</tr>"
End If
Next
If n > 0 Then
For i = 1 To 4 - n
Response.Write "<td> </td>"
Next
Response.Write "</tr>"
End if
Response.Write "</table><br><br>"
End Sub
' 由按钮代码得到按钮标题
Function Code2Title(s_Code, a_ButtonCode, a_ButtonTitle)
Dim i
Code2Title = ""
For i = 1 To UBound(a_ButtonCode)
If UCase(a_ButtonCode(i)) = UCase(s_Code) Then
Code2Title = a_ButtonTitle(i)
Exit Function
End If
Next
End Function
' 按钮设置保存
Sub DoButtonSave()
Dim s_Button
s_Button = Trim(Request("d_button"))
If nStyleIsSys = 1 Then
Go_Error "系统自带样式,不允许对按钮进行修改!"
End If
sSql = "select * from ewebeditor_toolbar where t_id=" & sToolBarID
oRs.Open sSql, oConn, 1, 3
If Not oRs.Eof Then
oRs("T_Button") = s_Button
oRs.Update
End If
oRs.Close
Response.Write "<br><table border=0 cellspacing=20 align=center>" & _
"<tr valign=top><td><img src='admin/do_ok.gif' border=0></td><td><b><span class=highlight2>工具栏按钮设置保存成功!</span></b><br><br><ul>我现在<br><br><li><a href='admin_default.asp'>返回后台管理首页</a><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>" & _
"</table><br><br>"
End Sub
Sub RemoveApplication()
Dim aApplicationName, i
aApplicationName = Application("eWebEditor_ApplicationName")
If IsArray(aApplicationName) = True Then
For i = 1 To UBound(aApplicationName)
Application.Contents.Remove(aApplicationName(i))
Next
Application.Contents.Remove("eWebEditor_ApplicationName")
Application.Contents.Remove("eWebEditor_ApplicationUrl")
End If
End Sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -