📄 freelable_edit.asp
字号:
<% Option Explicit %>
<!--#include file="../../../Inc/Cls_DB.asp" -->
<!--#include file="../../../Inc/Const.asp" -->
<!--#include file="../../../Inc/Function.asp" -->
<!--#include file="../../../Inc/CheckPopedom.asp" -->
<%
Dim DBC,Conn,TempClassListStr,TempListStr
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
'==============================================================================
'软件名称:风讯网站信息管理系统
'当前版本:Foosun Content Manager System(FoosunCMS V3.2SP1)
'最新更新:2006.50
'==============================================================================
'Copyright (C) 2002-2004 Foosun.Net All rights reserved.
'商业注册联系:028-85098980-601,项目开发:028-85098980-606、609,客户支持:608
'产品咨询QQ:394226379,159410,125114015
'技术支持QQ:315485710,66252421
'项目开发QQ:415637671,655071
'程序开发:四川风讯科技发展有限公司(Foosun Inc.)
'Email:service@Foosun.cn
'MSN:skoolls@hotmail.com
'论坛支持:风讯在线论坛(http://bbs.foosun.net)
'官方网站:www.Foosun.cn 演示站点:test.cooin.com
'网站通系列(智能快速建站系列):www.ewebs.cn
'==============================================================================
'免费版本请在程序首页保留版权信息,并做上本站LOGO友情连接
'风讯公司保留此程序的法律追究权利
'============================================================================================================
%>
<!--#include file="../../../Inc/Session.asp" -->
<%
if Not JudgePopedomTF(Session("Name"),"P031300") then Call ReturnError1()
'权限判断
Dim SqlStr,Rs
Dim Action,IFreeLableID,ISql,IName,IFieldsCName,IStyleContent,IStartFlag,IEndFlag,IDescription
IFreeLableID = Replace(Request("FreeLableID"),"'","")
Action = Request("Action")
If Action <> "Submit" Then '判断是用户已确定还是新打开页面
If IFreeLableID <> "" Then '判断是新建还是编辑自由标签
if Not JudgePopedomTF(Session("Name"),"P031302") then Call ReturnError1()
SqlStr = "Select * from FS_FreeLable where FreeLableID = '"&IFreeLableID&"'"
Set Rs = conn.Execute(SqlStr)
If not Rs.eof Then
ISql = Replace(Rs("Sql"),"*|*","'")
IName = Rs("Name")
IFieldsCName = Rs("FieldsCName")
IStyleContent = Replace(Rs("StyleContent"),"*|*","'")
IStartFlag = Rs("StartFlag")
IEndFlag = Rs("EndFlag")
IDescription = Rs("Description")
else
Response.Write("<script>alert('无效的自由标签编号')</script>")
Response.End
End if
Else
if Not JudgePopedomTF(Session("Name"),"P031301") then Call ReturnError1()
IStartFlag = "<!--标签开始-->"
IEndFlag = "<!--标签结束-->"
End if
Else
IFreeLableID = Request.Form("FreeLableID")
ISql = Request.Form("SqlPreview")
IName = NoCSSHackAdmin(Request.Form("Name"),"标签名称")
IFieldsCName = Request.Form("FieldsCName")
IStyleContent = Request.Form("StyleContent")
IStartFlag = Request.Form("StartFlag")
IEndFlag = Request.Form("EndFlag")
IDescription = Request.Form("Description")
End if
'解析出用户选择的数据表,最终形成(FS_News,FS_NewsClass)或者(FS_Download,FS_NewsClass)的组合
Dim EndIndexOfLastSearch,TablesStr,TableArray,TempArray
If ISql <> "" Then
SqlStr = ISql
If InStr(SqlStr," from") <> 0 Then
EndIndexOfLastSearch = InStr(ISql," from ") + 6
SqlStr = Mid(SqlStr,EndIndexOfLastSearch)
Else
Response.Write("<script>alert('无效的Sql语句')</script>")
Response.End
End if
if InStr(SqlStr," where ") <> 0 Then
EndIndexOfLastSearch = InStr(SqlStr," where ")
TablesStr = Mid(SqlStr,1,EndIndexOfLastSearch-1)
else
if InStr(SqlStr," Order by") <> 0 Then
EndIndexOfLastSearch = InStr(SqlStr," Order by ")
TablesStr = Mid(SqlStr,1,EndIndexOfLastSearch-1)
else
TablesStr = SqlStr
End if
End if
If TablesStr <> "" Then
TempArray = split(TablesStr,",")
If UBound(TempArray) = 0 Then
if TempArray(0) = "FS_NewsClass" Then
TableArray = Array("FS_News","FS_NewsClass")
else
TableArray = Array(TempArray(0),"FS_NewsClass")
End if
else
TableArray = Array(TempArray(0),TempArray(1))
End if
Else
Response.Write("<script>alert('无效的Sqddl语句')</script>")
Response.End
End if
Else
TableArray = Array("FS_News","FS_NewsClass")
End if
'解析数据表结束
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript" src="../../SysJs/PublicJS.js"></script>
<title>定义标签</title>
<link href="../../../CSS/FS_css.css" rel="stylesheet">
</head>
<%
'如果是编辑标签,则调用初始化函数解析SQL语句,设置好运行环境
If Action = "Submit" Or IFreeLableID <> "" Then
%>
<body leftmargin="2" topmargin="2" onload="InitialForm()">
<% Else %>
<body leftmargin="2" topmargin="2">
<% End if %>
<form action="" method="post" name="FreeLableForm">
<table width="791" border="0" cellpadding="1" cellspacing="1" bgcolor="#999999">
<tr bgcolor="#EEEEEE">
<td width="787" height="26" colspan="5" valign="middle">
<table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width=44 id="PreiorStepButton" style="display:none"align="center" alt="上一步" onClick="PreiorStep();" onMouseMove="BtnMouseOver(this);" onMouseOut="BtnMouseOver(this);" class="BtnMouseOut">上一步</td>
<td width=6 id="PreiorStepButtonX" style="display:none" class="Gray">|</td>
<td width=44 id="NextStepButton" align="center" alt="下一步" onClick="NextStep();" onMouseMove="BtnMouseOver(this);" onMouseOut="BtnMouseOver(this);" class="BtnMouseOut">下一步</td>
<td width=6 id="NextStepButtonX" class="Gray">|</td>
<td width=34 id="SaveButton" style="display:none" align="center" alt="保存" onClick="DoSubmit();" onMouseMove="BtnMouseOver(this);" onMouseOut="BtnMouseOver(this);" class="BtnMouseOut">保存</td>
<td width=6 id="SaveButtonX" style="display:none" class="Gray">|</td>
<td width=34 align="center" alt="后退" onClick="top.GetEkMainObject().history.back();" onMouseMove="BtnMouseOver(this);" onMouseOut="BtnMouseOver(this);" class="BtnMouseOut">后退</td>
<td width="612">
<input name="Action" value="Submit" type="hidden">
<input name="FieldsCName" type="hidden">
<input name="FreeLableID" type="hidden" value="<%=IFreeLableID%>">
</td>
</tr>
</table>
</td>
</tr>
</table>
<div id="Step_CreateSql">
<table width="791" border="0" cellpadding="0" cellspacing="1" class="tabbgcolor">
<tr bgcolor="#ffffff">
<td height="46">
<div align="center">
新闻表(FS_News)字段 </div></td>
<td> </td>
<td><div align="center">栏目表(FS_NewsClass)字段</div></td>
</tr>
<tr bgcolor="#FFFFFF" valign="bottom">
<td height="20"><table width=96% height=100% border="0" cellpadding="0" cellspacing="0">
<tr align=center>
<td width="33%" class="ButtonListLeft">字段名称</td>
<td width="10%" class="ButtonList">类型</td>
<td width="19%" class="ButtonList">排序</td>
<td width="15%" class="ButtonList" id="FieldsList_0_AddExpContainer">操作</td>
<td width="23%" class="ButtonList">条件值</td>
</tr>
</table></td>
<td> </td>
<td><table width=96% height=100% border="0" cellpadding="0" cellspacing="0">
<tr align=center>
<td width="33%" class="ButtonListLeft">字段名称</td>
<td width="10%" class="ButtonList">类型</td>
<td width="19%" class="ButtonList">排序</td>
<td width="15%" class="ButtonList" id="FieldsList_1_AddExpContainer">操作</td>
<td width="23%" class="ButtonList">条件值</td>
</tr>
</table></td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="355" height="280"> <iframe scrolling="auto" src="FreeLable_FieldsList.asp?TableName=<%=TableArray(0)%>" style="width:100%;height:100%" name="FieldsListFrame_0"></iframe>
</td>
<td width="81"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" align="center">
<input name="Submitddd" type="button" onClick="CleanSelectedOfTable(1);" class="Anbut1" id="Submitddd" value="消除新闻表">
</td>
</tr>
<tr>
<td height="30" align="center">
<input name="Submit4" onClick="CleanSelectedOfTable(2);" type="button" class="Anbut1" value="消除栏目表">
</td>
</tr>
<tr>
<td height="30" align=center><input name="Submit4" onClick="document.FieldsListFrame_0.ClickTab(-1);document.FieldsListFrame_1.ClickTab(-1);" type="button" class="Anbut1" value="生成"></td>
</tr>
<tr>
<td height="30"> </td>
</tr>
<tr>
<td height="30" align="center"> <input name="Submit6" onClick="SetSearchArraySequence();" type="button" class="Anbut1" value="次序与数量">
</td>
</tr>
</table></td>
<td width="351"> <iframe scrolling="auto" src="FreeLable_FieldsList.asp?TableName=<%=TableArray(1)%>" style="width:100%;height:100%" name="FieldsListFrame_1"></iframe>
</td>
</tr>
<tr id="SaveBuildInfoDescription">
<td colspan="3" bgcolor="#FFFFFF" align="center">SQL预览</td>
</tr>
<tr id="SaveBuildInfoDescription">
<td colspan="3" bgcolor="#FFFFFF"><textarea name="SqlPreview" rows="5" style="width:790" readonly><%=ISql%></textarea></td>
</tr>
<tr bgcolor="#FF0000" id="SaveBuildInfoClue">
<td height="29" colspan="3" bgcolor="#FFFFFF">
<font color="#FF0000">注:判断性字段,是否标题新闻、删除标记等的值为1(真)或0(假),如PicNewsTF=1表示是图片新闻</font>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" onClick="if(document.all.ClassList.style.display==''){document.all.ClassList.style.display = 'none';this.innerHTML='<font size=+2 color=#FF0000>[查看栏目对照表]</font>';}else{document.all.ClassList.style.display = '';this.innerHTML='<font color=blue><b>[隐藏栏目对照表]</b></font>'}" style="cursor:hand;"><font color="blue"><b>[查看栏目对照表]</b></font></td>
</tr>
<tr id="ClassList" style="display:none">
<td><iframe scrolling="auto" src="FreeLable_ClassList.asp" style="width:98%;height:100%"></iframe></td>
</tr>
</table>
</div>
<div id="Step_SetStyle" style="display:none">
<table width="790" border="0" cellpadding="4" cellspacing="1" class="tabbgcolor">
<tr bgcolor="#ffffff">
<td height=36 colspan=3>标签名称:
<% If IFreeLableID <> "" Then %> <input type="text" name="Name" value="<%=IName%>" readonly>
<% Else %> <input type="text" name="Name" value="<%=IName%>">
<% End if %> 描述:
<input type="text" name="Description" value="<%=IDescription%>" style="width:40%">
<input name="button" type="button" onClick="SelectStyle();" value="选择样式">
<input name="button" type="button" onClick="Refresh();" value="刷新">
<input name="button" type="button" onClick="PreView();" value="预览"></td>
</tr>
<tr bgcolor="#ffffff">
<td height=36 colspan="3">
<!--标签开始标志: -->
<input type="hidden" name="StartFlag" value="<%=IStartFlag%>">
<!--标签结束标志: -->
<input type="hidden" name="EndFlag" value="<%=IEndFlag%>">
有效字段:
<select name="ValidFields" style="width:15%">
</select> <input name="button2" type="button" onClick="InsertStr(document.all.ValidFields.value)" value="插入">
预定义:
<select id="PreDefine" style="width:12%">
<option value="[#Url#]">[#新闻路径#]</option>
<option value="[#ClassUrl#]">[#栏目路径#]</option>
<option value="[#PicUrl#]">[#图片路径#]</option>
</select> <input type="button" id = "PreDefineButton" onClick="InsertStr(document.all.PreDefine.value)" value="插入">
日期样式(须日期字段):
<select id="DateStyle" style="width:12%">
<option value="($yyyy-mm-dd$)">yyyy-mm-dd</option>
<option value="($yyyy.mm.dd$)">yyyy.mm.dd</option>
<option value="($yyyy/mm/dd$)">yyyy/mm/dd</option>
<option value="($mm/dd/yyyy$)">mm/dd/yyyy</option>
<option value="($dd/mm/yyyy$)">dd/mm/yyyy</option>
<option value="($mm-dd-yyyy$)">mm-dd-yyyy</option>
<option value="($mm.dd.yyyy$)">mm.dd.yyyy</option>
<option value="($mm-dd$)">mm-dd</option>
<option value="($mm/dd$)">mm/dd</option>
<option value="($mm.dd$)">mm.dd</option>
<option value="($mm月dd日$)">mm月dd日</option>
<option value="($dd日hh时$)">dd日hh时</option>
<option value="($dd日hh点$)">dd日hh点</option>
<option value="($hh时mm分$)">hh时mm分</option>
<option value="($hh:mm$)">hh:mm</option>
<option value="($yyyy年mm月dd日$)">yyyy年mm月dd日</option>
</select> <input type="button" id = "DateStyleButton" onClick="InsertStr(document.all.DateStyle.value)" value="插入">
</td>
</tr>
<tr bgcolor="#ffffff">
<iframe id="StyleContainer" style="display:none"></iframe>
<td width="46%" height="373" valign="top"><iframe id="Editer_HTML" style="width:100%;height:100%"></iframe></td>
<td valign="top" colspan="2"><iframe id="Editer_Code" style="width:100%;height:100%" onfocus = "Target='Editer_Code';"></iframe></td>
<input type="hidden" name="StyleContent" value="<%=Replace(Replace(Replace(IStyleContent,"<","%3C"),">","%3E"),"""","%22")%>">
</tr>
<tr bgcolor="#ffffff">
<td colspan="3"> <font color="#FF0000">注:循环内容{#...#}、不循环内容{*n...*}(n>0)代表记录序号、字段[*...*]、函数(#...#)如(#Left([*News.Title*],20)#)、日期样式($...$)、系统预定义[#...#],预定义中[#新闻URL#]需新闻ID、[#栏目URL#]需栏目ID、[#图片URL#]需图片路径</font></td>
</tr>
<tr bgcolor="#ffffff">
<td colspan="3"> </td>
</tr>
</table>
</div>
</form>
<form action="FreeLable_PreView.asp" method="post" name="PreviewForm" target="_blank">
<input name="SqlStr" type="hidden">
<input name="StyleContent" type="hidden">
</form>
</body>
</html>
<script language="JavaScript">
var SysRootDir = "<%=SysRootDir%>";
var StyleFiles = "<%=StyleFiles%>";
var TableFieldArray=new Array();
var TableFieldsCNameArray=new Array();
var ExpressionArray=new Array();
var OrderSearchArray=new Array();
var TablesArray = new Array("<%=TableArray(0)%>","<%=TableArray(1)%>");
var QueryNum = "10";
var Target="Editer_Code";
Editer_Code.document.designMode="on";
Editer_HTML.document.designMode="off";
<%
If Action = "Submit" Or IFreeLableID <> "" Then
%>
//解析SQL语句,初始化运行环境
function InitialForm()
{
var SqlStr = FreeLableForm.SqlPreview.value;
var TableFieldNameStr = "<%=IFieldsCName%>";
var TableFieldStr = "";
var ExpressionStr = "";
var OrderSearchStr = "";
var TablesStr = "",TempTablesArray;
var EndIndexOfLastSearch = -1;
var FirstIndexOfThisSearch = 0
var i,j,StyleContent;
if(SqlStr.indexOf(" Order by ") != -1)
{
OrderSearchStr = SqlStr.substr(SqlStr.indexOf(" Order by ")+10);
SqlStr = SqlStr.substr(0,SqlStr.indexOf(" Order by "));
}
if(SqlStr.indexOf(" where ") != -1)
{
ExpressionStr = SqlStr.substr(SqlStr.indexOf(" where ")+7);
SqlStr = SqlStr.substr(0,SqlStr.indexOf(" where "));
}
if(SqlStr.indexOf(" from ") != -1)
{
TablesStr = SqlStr.substr(SqlStr.indexOf(" from ")+6);
SqlStr = SqlStr.substr(0,SqlStr.indexOf(" from "));
}
else
return;
SqlStr = SqlStr.substr(7);
if(SqlStr.indexOf("Top ") != -1)
{
SqlStr = SqlStr.substr(4);
QueryNum = SqlStr.substr(0,SqlStr.indexOf(" "));
TableFieldStr = SqlStr.substr(SqlStr.indexOf(" ")+1);
}
else
{
QueryNum = "";
TableFieldStr = SqlStr;
}
TempTablesArray = TablesStr.split(",");
TableFieldArray = TableFieldStr.replace(/\ /g,"").split(",");
if(ExpressionStr != "")
ExpressionArray = ExpressionStr.split(" and ");
if(OrderSearchStr != "")
OrderSearchArray = OrderSearchStr.split(",");
TableFieldsCNameArray = TableFieldNameStr.split(",");
if(TempTablesArray.length == 1)
{
for(i=0;i<TableFieldArray.length;i++)
{
TableFieldArray[i] = TempTablesArray[0]+"."+TableFieldArray[i];
}
for(i=0;i<ExpressionArray.length;i++)
{
ExpressionArray[i] = TempTablesArray[0]+"."+ExpressionArray[i];
}
for(i=0;i<OrderSearchArray.length;i++)
OrderSearchArray[i] = TempTablesArray[0]+"."+OrderSearchArray[i];
}
for(i=0;i<ExpressionArray.length;i++)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -