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

📄 admin_template.asp

📁 依蓝旅游网站管理系统Elan2008.SP2
💻 ASP
📖 第 1 页 / 共 3 页
字号:
<%
Option Explicit
Response.Buffer = True
Response.Expires = -1
Response.ExpiresAbsolute = Now() - 1
%>
<!--#Include File="../Conn.asp"-->
<!--#Include File="Admin_CheckPurview.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<link href='Admin_Style.css' type='text/css' rel='stylesheet'>
<title>网站模板管理</title>
<script language="javascript" src="../js/Common.js"></script>
<script language="javascript" src="../js/InstallDir.js"></script>
</head>
<body>
<%
If EL_Admin.Purview <> 1 Then
   If EL_Admin.CheckAdminPurview(7, 3) = False Then
      EL_Admin.ShowPurviewError("对不起!您没有足够的管理权限")
   End If
End If

On Error Resume Next
Dim arrTemplate(100), Templates, TemplateType, TempType

TemplateType = EL_Common.ELRequest("TemplateType", 2)
TempType = EL_Common.ELRequest("TempType", 2)

arrTemplate(100) = "@"
arrTemplate(0) = "-1$网站首页"
arrTemplate(1) = "1$频道首页"
arrTemplate(2) = "2$栏目页"
arrTemplate(3) = "3$内容页"
arrTemplate(4) = "4$推荐列表页"
arrTemplate(5) = "5$搜索页"
arrTemplate(6) = "6$评论页"
arrTemplate(7) = "7$打印页"
arrTemplate(8) = "8$订单确认页"
arrTemplate(9) = "9$企业会员预定页"
arrTemplate(10) = "10$友情链接页"
arrTemplate(11) = "11$会员注册许可协议页"
arrTemplate(12) = "12$会员注册填写信息页"
arrTemplate(13) = "13$会员注册成功页"
arrTemplate(14) = "14$会员信息页"
arrTemplate(15) = "15$会员预订登陆页"
arrTemplate(16) = "16$地区列表页"
arrTemplate(17) = "17$"
arrTemplate(18) = "18$"
arrTemplate(19) = "19$网站公告页"
arrTemplate(20) = "20$"
arrTemplate(21) = "21$告诉好友页"
arrTemplate(22) = "22$论坛首页"
arrTemplate(23) = "23$帖子列表页"
arrTemplate(24) = "24$浏览帖子页"
arrTemplate(25) = "25$编辑帖子页"
arrTemplate(26) = "26$保存帖子成功页"
arrTemplate(27) = "27$航空公司介绍页"
arrTemplate(28) = "28$飞机机型介绍页"
arrTemplate(29) = "29$退改签规定说明页"
arrTemplate(30) = "30$帖子操作页"
arrTemplate(31) = "31$预订成功页"
arrTemplate(32) = "32$"
arrTemplate(33) = "33$乘客信息填写表单"
arrTemplate(34) = "34$"
arrTemplate(35) = "35$友情链接申请页"
arrTemplate(36) = "36$"
arrTemplate(37) = "37$网站调查页"
arrTemplate(38) = "4$特价列表页"

Templates = ""

Select Case EL_Channel.ChannelModule
  Case 0: '特殊模板
     Select Case TempType
	   Case 0: '网站通用
	      If TemplateType = 0 Then TemplateType = -1
          Templates = arrTemplate(0) &"|"& arrTemplate(10) &"|"& arrTemplate(35) &"|"& arrTemplate(19) &"|"& arrTemplate(37)
	   Case -2: '会员
	      If TemplateType = 0 Then TemplateType = 11
          Templates = arrTemplate(11) &"|"& arrTemplate(12) &"|"& arrTemplate(13) &"|"& arrTemplate(14) &"|"& arrTemplate(15)
	 End Select
  Case 1: '文章     
	 If TemplateType = 0 Then TemplateType = 1
	 Templates = arrTemplate(1) &"|"& arrTemplate(2) &"|"& arrTemplate(3) &"|"& arrTemplate(4) &"|"& arrTemplate(5)
	 Templates = Templates &"|"& arrTemplate(6) &"|"& arrTemplate(7) &"|"& arrTemplate(21)
  Case 2: '酒店
     If TemplateType = 0 Then TemplateType = 1
	 Templates = arrTemplate(1) &"|"& arrTemplate(16) &"|"& arrTemplate(3) &"|"& arrTemplate(4) &"|"& arrTemplate(5)
	 Templates = Templates &"|"& arrTemplate(6) &"|"& arrTemplate(7) &"|"& arrTemplate(21)
	 Templates = Templates &"|"& arrTemplate(8) &"|"& arrTemplate(31)
  Case 3: '度假
     If TemplateType = 0 Then TemplateType = 1
	 Templates = arrTemplate(1) &"|"& arrTemplate(2) &"|"& arrTemplate(3) &"|"& arrTemplate(4) &"|"& arrTemplate(5)
	 Templates = Templates &"|"& arrTemplate(6) &"|"& arrTemplate(7) &"|"& arrTemplate(21) &"|"& arrTemplate(8) &"|"& arrTemplate(31)
  Case 4: '机票
     If TemplateType = 0 Then TemplateType = 1
	 Templates = arrTemplate(1) &"|"& arrTemplate(3) &"|"& arrTemplate(38) &"|"& arrTemplate(5) &"|"& arrTemplate(8) &"|"& arrTemplate(33) &"|"& arrTemplate(31)
	 Templates = Templates &"|"& arrTemplate(100) &"|"& arrTemplate(27) &"|"& arrTemplate(28) &"|"& arrTemplate(29) 
  Case 5: '景点
     If TemplateType = 0 Then TemplateType = 1
	 Templates = arrTemplate(1) &"|"& arrTemplate(16) &"|"& arrTemplate(3) &"|"& arrTemplate(4) &"|"& arrTemplate(5)
	 Templates = Templates &"|"& arrTemplate(6) &"|"& arrTemplate(7) &"|"& arrTemplate(21) &"|"& arrTemplate(8) &"|"& arrTemplate(31)
  Case 6: '图片
     If TemplateType = 0 Then TemplateType = 1
	 Templates = arrTemplate(1) &"|"& arrTemplate(2) &"|"& arrTemplate(3) &"|"& arrTemplate(4) &"|"& arrTemplate(5)
	 Templates = Templates &"|"& arrTemplate(6) &"|"& arrTemplate(21)
  Case 7: '商城
     If TemplateType = 0 Then TemplateType = 1
	 Templates = arrTemplate(1) &"|"& arrTemplate(2) &"|"& arrTemplate(3) &"|"& arrTemplate(4) &"|"& arrTemplate(5)
	 Templates = Templates &"|"& arrTemplate(6) &"|"& arrTemplate(21) &"|"& arrTemplate(8) &"|"& arrTemplate(31)
  Case 8: '租车
     If TemplateType = 0 Then TemplateType = 1
	 Templates = arrTemplate(1) &"|"& arrTemplate(2) &"|"& arrTemplate(3) &"|"& arrTemplate(4) &"|"& arrTemplate(5)
	 Templates = Templates &"|"& arrTemplate(6) &"|"& arrTemplate(7) &"|"& arrTemplate(21) &"|"& arrTemplate(8) &"|"& arrTemplate(31)
  Case 9: '论坛
     If TemplateType = 0 Then TemplateType = 22
	 Templates = arrTemplate(22) &"|"& arrTemplate(23) &"|"& arrTemplate(24) &"|"& arrTemplate(25) &"|"& arrTemplate(26) &"|"& arrTemplate(30) &"|"& arrTemplate(5)
  Case Else: EL_Common.ShowErrorMsg("频道参数错误") : ApplicationTerminate()
End Select

%>
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="Border">
  <tr>
    <td align="center" class="top_25"><strong>网站模板管理</strong></td>
  </tr>
  <tr>
    <td class="td_50">管理导航:
	<a href="Admin_Template.asp?ChannelID=<%=EL_Channel.ChannelID%>&TempType=<%=TempType%>">模板管理首页</a> | 
	<a href="Admin_Template.asp?ChannelID=<%=EL_Channel.ChannelID%>&TemplateType=<%=TemplateType%>&TempType=<%=TempType%>&Action=Add">添加模板</a> | 
	<a href="Admin_Template.asp?ChannelID=<%=EL_Channel.ChannelID%>&TemplateType=<%=TemplateType%>&TempType=<%=TempType%>&Action=Import">模板导入</a> | 
	<a href="Admin_Template.asp?ChannelID=<%=EL_Channel.ChannelID%>&TemplateType=<%=TemplateType%>&TempType=<%=TempType%>&Action=Export">模板导出</a> | 
	<a href="Admin_Template.asp?ChannelID=<%=EL_Channel.ChannelID%>&TemplateType=<%=TemplateType%>&TempType=<%=TempType%>&Action=Clone">模板克隆</a>
	</td>
  </tr>
</table>
<br>
<%
Select Case Action
  Case "": Call ManageTemplate()
  Case "Add": Call AddTemplate()
  Case "SaveNewTemplate": Call SaveTemplate(0)
  Case "Modify": Call ModifyTemplate()
  Case "SaveModify": Call SaveTemplate(1)
  Case "SetDefaulted": Call SaveTemplate(2)
  Case "Delete": Call SaveTemplate(3)
  Case "Import": Call ImportTemplate()
  Case "Export": Call ExportTemplate()
  Case "Clone": Call CloneTemplate()
End Select
Call EL_Common.Bottom()
Call ApplicationTerminate()


Sub SaveTemplate(UpdateType)
   Dim TemplateCmd, TempChannelID
   Dim TemplateID, TemplateName, TemplateType, Content, Defaulted
   
   TemplateID = EL_Common.ELRequest("TemplateID", 2)
   TemplateName = EL_Common.ELRequest("TemplateName", 1)
   TemplateType = EL_Common.ELRequest("TemplateType", 2)
   Content = EL_Common.ELRequest("Content", 1)
   Defaulted = EL_Common.ELRequest("Defaulted", 2)
   
   If TemplateType = 2 Then
      Content = Replace(Content, "{$$$Template$$$}", "") &"{$$$Template$$$}"& Replace(EL_Common.ELRequest("Content_Small", 1), "{$$$Template$$$}", "")
   End If
   
   If TempType = -2 Then
      TempChannelID = -2
   Else
      TempChannelID = EL_Channel.ChannelID	  
   End If
   
   Call EL_Common.InitCommand(TemplateCmd, "EL_SP_Template")   
   With TemplateCmd
      .Parameters.Append .CreateParameter("RETURN", 2, 4)
	  .Parameters.Append .CreateParameter("@UpdateType", 3, 1, 4, UpdateType)
	  .Parameters.Append .CreateParameter("@TemplateID", 3, 1, 4, TemplateID)
	  .Parameters.Append .CreateParameter("@ChannelID", 3, 1, 4, TempChannelID)
	  .Parameters.Append .CreateParameter("@TemplateName", 200, 1, 50, TemplateName)
	  .Parameters.Append .CreateParameter("@TemplateType", 3, 1, 4, TemplateType)
	  .Parameters.Append .CreateParameter("@Content", 203, 1, EL_Common.LenParameter(Content), Content)
	  .Parameters.Append .CreateParameter("@Defaulted", 11, 1, 1, Defaulted)
	  .Execute()
   End With
   If TemplateCmd(0) = 40 Then
      EL_Common.ShowErrorMsg("指定模板不存在")
	  Set TemplateCmd = Nothing
	  Exit Sub
   End If
   Select Case UpdateType
      Case 0: EL_Common.ShowSuccessMsg("成功添加模板:"& TemplateName)
	  Case 1: EL_Common.ShowSuccessMsg("成功修改模板:"& TemplateName)
	  Case 2, 3: Response.Redirect ComeURL
   End Select
   Set TemplateCmd = Nothing
   If TempType <> -2 Then
      '更新缓存
	  If TemplateType = -1 Then
	     If Cache_Template_Index = 1 And Cstr(Defaulted) = EL_True Then
		    Call EL_Cache.SetCache("Template.Index", Content, -1)			
		 End If
	  Else
	     If EL_Common.FoundInArray(Split(Eval("Cache_Template_"& TempChannelID), ","), Cstr(TemplateType)) And Cstr(Defaulted) = EL_True Then
		    Call EL_Cache.SetCache("Template."& TempChannelID &"."& TemplateType, Content, -1)
		 End If
	  End If
   End If
   EL_Common.ShowScriptError()
End Sub

Sub CloneTemplate()
On Error Resume Next
Dim TemplateCmd, rsTemplate, RowCount, i
Dim ChannelCmd, rsChannel, ChannelRowCount, ChannelModule
Dim CloneChannelID, TargetChannelID, CloneStep, TemplateID

CloneChannelID = EL_Common.ELRequest("CloneChannelID", 2)
TargetChannelID = EL_Common.ELRequest("TargetChannelID", 2)
CloneStep = EL_Common.ELRequest("CloneStep", 2)

If CloneStep = 0 Then
%>
<script language="javascript">
function Check(frm){
  if(frm.TemplateID.value.trim() == "" || frm.TemplateID.selectedIndex == -1){
     alert("请选择需要克隆的模板");
	 frm.TemplateID.focus();
	 return false;
  }
  if(frm.TargetChannelID.value.trim() == "" || frm.TargetChannelID.selectedIndex == -1){
     alert("请选择目标频道");
	 frm.TargetChannelID.focus();
	 return false;
  }
  SubmitOnce(frm);
  return;
}
</script>
<form name="myform" action="Admin_Template.asp" method="post" onSubmit="return Check(this)">
<table width="100%" border="0" cellpadding="0" cellspacing="1" class="Border">
  <tr>
    <td colspan="3" class="top_25"><strong>模板克隆</strong></td>
  </tr>
  <tr>
    <td width="45%" align="center" class="td_ItemName"><strong>请选择要克隆的模板</strong>
    <select name="CloneChannelID" id="CloneChannelID" onChange="getObject('CloneStep').value=0;getObject('myform').submit()">
    <%
	  Call EL_Common.InitCommonCmd(ChannelCmd, rsChannel, "EL_Channel", "ChannelID, ChannelName, ChannelModule", "ChannelType=0")
	  rsChannel.Close()
	  ChannelRowCount = ChannelCmd(0)
	  rsChannel.Open()
	  If CloneChannelID = 0 Then CloneChannelID = rsChannel(0)
	  For i = 1 To ChannelRowCount
	     If CloneChannelID = rsChannel(0) Then
		    Response.Write "<option value='"& rsChannel(0) &"' selected>"& rsChannel(1) &"</option>"
			ChannelModule = rsChannel(2)
		 Else
		    Response.Write "<option value='"& rsChannel(0) &"'>"& rsChannel(1) &"</option>"
		 End If
		 If i < ChannelRowCount Then rsChannel.MoveNext()
	  Next
	  rsChannel.Close()
	%>
    </select>    </td>
    <td width="10%" align="center" class="td_25">&nbsp;</td>
    <td width="45%" align="center" class="td_ItemName"><strong>目标频道</strong></td>
  </tr>
  <tr>
    <td align="center" class="td_ItemName"><select name="select" size="10" multiple id="select" style="height:250px; width:250px;">
      <%
	  Call EL_Common.InitCommonCmd(TemplateCmd, rsTemplate, "EL_Template", "TemplateID, TemplateName", "ChannelID="& CloneChannelID)
	  rsTemplate.Close()
	  RowCount = TemplateCmd(0)
	  If RowCount = 0 Then
	     Response.Write "<option value=''>没有可以克隆的模板</option>"
	  Else
	     rsTemplate.Open()
		 For i=1 To RowCount
		    Response.Write "<option value='"& rsTemplate(0) &"'>"& rsTemplate(1) &"</option>"
			If i<RowCount Then rsTemplate.MoveNext
		 Next
		 rsTemplate.Close()
	  End If
	  Set rsTemplate = Nothing
	  Set TemplateCmd = Nothing
	%>
    </select></td>
    <td align="center" class="td_25">克隆到 &gt;&gt; </td>
    <td align="center" class="td_ItemName">
    <select name="TargetChannelID" size="10" multiple id="TargetChannelID" style="height:250px; width:250px;">
    <%
	  rsChannel.Open()
	  Dim TempK
	  TempK =0
	  For i = 1 To ChannelRowCount
	     If CloneChannelID <> rsChannel(0) And ChannelModule = rsChannel(2) Then
		    Response.Write "<option value='"& rsChannel(0) &"'>"& rsChannel(1) &"</option>"
			TempK = TempK + 1
		 End If
		 If i < ChannelRowCount Then rsChannel.MoveNext()
	  Next
	  If TempK = 0 Then
	     Response.Write "<option value=''>没有同类的频道模块</option>"
	  End If
	  rsChannel.Close()
	  Set rsChannel = Nothing
	  Set ChannelCmd = Nothing
	%>	
    </select>	</td>
  </tr>
  <tr>
    <td colspan="3" align="center" class="td_50"><input type="submit" name="Submit6" value=" 克 隆 ">
      <input name="ChannelID" type="hidden" id="ChannelID" value="<%=EL_Channel.ChannelID%>">
      <input name="TempType" type="hidden" id="TempType" value="<%=TempType%>">
      <input name="TemplateType" type="hidden" id="TemplateType" value="<%=TemplateType%>">
      <input name="Action" type="hidden" id="Action" value="Clone">
      <input name="CloneStep" type="hidden" id="CloneStep" value="2"></td>
    </tr>
</table>
</form>
<%

ElseIf CloneStep = 2 Then

TemplateID = EL_Common.ELRequest("TemplateID", 1)
TargetChannelID = EL_Common.ELRequest("TargetChannelID", 1)

Dim CloneCmd
Call EL_Common.InitCommand(CloneCmd, "EL_SP_CloneTemplate")
With CloneCmd
  .Parameters.Append .CreateParameter("@TemplateID", 200, 1, 4000, TemplateID)
  .Parameters.Append .CreateParameter("@TargetChannelID", 200, 1, 4000, TargetChannelID)
  .Execute()
End With
Set CloneCmd = Nothing
EL_Common.ShowScriptError()
Response.Redirect "Admin_Template.asp?ChannelID="& EL_Channel.ChannelID &"&TempType="& TempType &"&TemplateType="& TemplateType &"&Action=Clone&CloneStep=3"

ElseIf CloneStep = 3 Then
   EL_Common.ShowSuccessMsg("模板克隆成功")
End If

EL_Common.ShowScriptError()
End Sub


Sub ExportTemplate()
On Error Resume Next
Dim TemplateCmd, rsTemplate, RowCount, i, SqlCondition, FieldName, TableName
Dim Disabled, ChannelModule, ExportStep

ChannelModule = EL_Common.ELRequest("ChannelModule", 1)
ExportStep = EL_Common.ELRequest("ExportStep", 2)

⌨️ 快捷键说明

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