<!--#Include File="Include.asp"--><%
'--------------------------------------
'Power By 580Web @2010-2014 f02
'URL:http://www.580Web.Cn/
'EMail:wsok85@qq.com
'QQ:253819801
'版权所有 未经允许不得去除本版权信息
'--------------------------------------

Call CheckAdminType("0,1",UType)
Call CheckAdminLimit(ULimit,"o_Focus",0)

Dim Fk_Focus_Name,Fk_Focus_Content
Dim Focus_Title,Focus_Url,Focus_Pic

Types=Clng(Request.QueryString("Type"))

Select Case Types
	Case 1
		Call FocusList() '独立轮换列表
	Case 2
		Call FocusAddForm() '添加独立轮换表单
	Case 3
		Call FocusAddDo() '执行添加独立轮换
	Case 4
		Call FocusEditForm() '修改独立轮换表单
	Case 5
		Call FocusEditDo() '执行修改独立轮换
	Case 6
		Call FocusDelDo() '执行删除独立轮换
	Case 7
		Call FocusLabel() '获取轮换调用代码
	Case Else
		Call FKFun.ShowErr("未发现功能项！",1)
End Select

'==========================================
'函 数 名：FocusList()
'作    用：独立轮换列表
'==========================================
Sub FocusList()
%>
		<div id="rightNav">
			<ul>
				<li><a href="Focus.asp?Type=2" target="dialog" width="900">添加独立轮换</a></li>
			</ul>
		</div>
		<div id="searchLine" class="font_bold">
			独立轮换管理
		</div>
		<table width="100%" bordercolor="#CCCCCC" border="1" cellspacing="0" cellpadding="0">
			<tr>
				<th align="center">ID</th>
				<th align="center">名称</th>
				<th align="center">操作</th>
			</tr>
<%
	Sqlstr="Select Fk_Focus_Id,Fk_Focus_Name From [Fk_Focus] Order By Fk_Focus_Id Asc"
	Rs.Open Sqlstr,Conn,1,1
	If Not Rs.Eof Then
		i=1
		While Not Rs.Eof
%>
			<tr>
				<td height="20" align="center"><%=i%></td>
				<td>&nbsp;<%=Rs("Fk_Focus_Name")%></td>
				<td align="center"><a href="Focus.asp?Type=7&Id=<%=Rs("Fk_Focus_Id")%>" target="dialog" width="900">调用代码</a> <a href="Focus.asp?Type=4&Id=<%=Rs("Fk_Focus_Id")%>" target="dialog" width="900">修改</a> <a href="Focus.asp?Type=6&Id=<%=Rs("Fk_Focus_Id")%>" target="delete" confirmStr="您确认要删除“<%=Rs("Fk_Focus_Name")%>”？此操作不可逆！" refreshUrl="Focus.asp?Type=1" showStr="名称删除成功！">删除</a></td>
			</tr>
<%
			Rs.MoveNext
			i=i+1
		Wend
	Else
%>
			<tr>
				<td height="25" colspan="20" align="center">暂无记录</td>
			</tr>
<%
	End If
	Rs.Close
%>
			<tr>
				<td height="30" colspan="20">&nbsp;</td>
			</tr>
		</table>
		<div id="rightBottom">
		
		</div>
<%
End Sub

'==========================================
'函 数 名：FocusAddForm()
'作    用：添加独立轮换表单
'==========================================
Sub FocusAddForm()
%>
<form id="FocusAdd" name="FocusAdd" method="post" target="ajax" action="Focus.asp?Type=3" showStr="新独立轮换添加成功！" refreshUrl="Focus.asp?Type=1" boxClose="1">
<div id="title">添加新独立轮换</div>
<div id="box">
	<table width="90%" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td width="15%" height="30" align="right">名称：</td>
			<td width="85%">&nbsp;<input name="Fk_Focus_Name" type="text" class="input" id="Fk_Focus_Name" /><span class="help" title="<p>独立轮换名称，请输入1-50个字符（两个字符为一个汉字）。</p>"></span></td>
		</tr>
	</table>
	<p id="FocusList">&nbsp;</p>
	<table width="90%" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
	    <tr>
	        <td height="30" width="15%" align="right">标题：</td>
	        <td width="85%">&nbsp;<input name="Focus_Title" type="text" class="input" id="Focus_Title" size="20" /><span class="help" title="<p>标题，请输入1-50个字符（两个字符为一个汉字）。</p>"></span></td>
	    </tr>
        <tr>
            <td height="30" align="right">链接：</td>
            <td>&nbsp;<input name="Focus_Url" type="text" class="input" id="Focus_Url" size="40" /><span class="help" title="<p>链接，请输入字母或数字，请输入1-255个字符。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">图片：</td>
            <td>&nbsp;<input name="Focus_Pic" type="text" class="input" id="Focus_Pic" size="40" /> <input type="button" class="picList_btn btnUpload" name="btnFocusPic" id="btnFocusPic" value="上传轮换图片" callback="2" inputId="Focus_Pic" fileAction="Upload.asp?immediate=3" /><span class="help" title="<p>输入图片链接或上传图片。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">&nbsp;</td>
            <td>&nbsp;<input type="button" class="button" name="btn1" id="btn1" value="增加" onclick="AddFocus();" /></td>
        </tr>
	</table>
</div>
<div id="bottom">
	<input type="submit" class="button" name="Enter" id="Enter" value="添 加" />
	<input type="button" onclick="dialogClose();" class="button" name="button" id="button" value="关 闭" />
</div>
</form>
<%
End Sub

'==============================
'函 数 名：FocusAddDo
'作    用：执行添加独立轮换
'==============================
Sub FocusAddDo()
	Fk_Focus_Name=FKFun.HTMLEncode(Trim(Request.Form("Fk_Focus_Name")))
	Fk_Focus_Content=FKFun.HTMLEncode(Trim(Replace(Request.Form("Fk_Focus_Content"),", ","")))
	Call FKFun.JsonString(Fk_Focus_Name,1,50,0,"请输入名称！","名称不能大于50个字符！")
	Call FKFun.JsonString(Fk_Focus_Content,1,50,1,"请增加轮换项！","内容不能大于50个字符！")
	Sqlstr="Select Fk_Focus_Id,Fk_Focus_Name,Fk_Focus_Content From [Fk_Focus] Where Fk_Focus_Name='"&Fk_Focus_Name&"'"
	Rs.Open Sqlstr,Conn,1,3
	If Rs.Eof Then
		Application.Lock()
		Rs.AddNew()
		Rs("Fk_Focus_Name")=Fk_Focus_Name
		Rs("Fk_Focus_Content")=Fk_Focus_Content
		Rs.Update()
		Application.UnLock()
		Call FKFun.JsonSuccess()
	Else
		Rs.Close
		Call FKFun.JsonError("该独立轮换名称已经被占用！")
	End If
	Rs.Close
End Sub

'==========================================
'函 数 名：FocusEditForm()
'作    用：修改独立轮换表单
'==========================================
Sub FocusEditForm()
	Id=Clng(Request.QueryString("Id"))
	Sqlstr="Select Fk_Focus_Name,Fk_Focus_Content From [Fk_Focus] Where Fk_Focus_Id=" & Id
	Rs.Open Sqlstr,Conn,1,1
	If Not Rs.Eof Then
		Fk_Focus_Name=Rs("Fk_Focus_Name")
		Fk_Focus_Content=Rs("Fk_Focus_Content")
	Else
		Rs.Close
		Call FKFun.ShowErr("独立轮换不存在！",1)
	End If
	Rs.Close
%>
<form id="FocusEdit" name="FocusEdit" method="post" target="ajax" action="Focus.asp?Type=5" showStr="独立轮换修改成功！" refreshUrl="Focus.asp?Type=1" boxClose="1">
<div id="title">修改独立轮换</div>
<div id="box">
	<table width="90%" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td width="15%" height="30" align="right">名称：</td>
			<td width="85%">&nbsp;<input name="Fk_Focus_Name" type="text" class="input" id="Fk_Focus_Name" value="<%=Fk_Focus_Name%>" /><span class="help" title="<p>独立轮换名称，请输入1-50个字符（两个字符为一个汉字）。</p>"></span></td>
		</tr>
	</table>
<%
	TempArr=Split(Fk_Focus_Content,"|FocusList|")
	Response.Write("<script type=""text/javascript"">")
	For Each Temp In TempArr
		If Temp<>"" Then
			Focus_Title=FKFun.GetSub(Temp,"Focus_Title:","|;|","")
			Focus_Url=FKFun.GetSub(Temp,"Focus_Url:","|;|","")
			Focus_Pic=FKFun.GetSub(Temp,"Focus_Pic:","|;|","")
			Response.Write("AddFocus_Show('"&Focus_Title&"','"&Focus_Url&"','"&Focus_Pic&"');"&vbCrLf)
		End IF
	Next
	Response.Write("</script>")
%>
	<p id="FocusList">&nbsp;</p>
	<table width="90%" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
	    <tr>
	        <td height="30" width="15%" align="right">标题：</td>
	        <td width="85%">&nbsp;<input name="Focus_Title" type="text" class="input" id="Focus_Title" size="20" /><span class="help" title="<p>标题，请输入1-50个字符（两个字符为一个汉字）。</p>"></span></td>
	    </tr>
        <tr>
            <td height="30" align="right">链接：</td>
            <td>&nbsp;<input name="Focus_Url" type="text" class="input" id="Focus_Url" size="40" /><span class="help" title="<p>链接，请输入字母或数字，请输入1-255个字符。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">图片：</td>
            <td>&nbsp;<input name="Focus_Pic" type="text" class="input" id="Focus_Pic" size="40" /> <input type="button" class="picList_btn btnUpload" name="btnFocusPic" id="btnFocusPic" value="上传轮换图片" callback="2" inputId="Focus_Pic" fileAction="Upload.asp?immediate=3" /><span class="help" title="<p>输入图片链接或上传图片。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">&nbsp;</td>
            <td>&nbsp;<input type="button" class="button" name="btn1" id="btn1" value="增加" onclick="AddFocus();" /></td>
        </tr>
	</table>
</div>
<div id="bottom">
	<input type="hidden" name="Id" value="<%=Id%>" />
	<input type="submit" class="button" name="Enter" id="Enter" value="修 改" />
	<input type="button" onclick="dialogClose();" class="button" name="button" id="button" value="关 闭" />
</div>
</form>
<%
End Sub

'==============================
'函 数 名：FocusEditDo
'作    用：执行修改独立轮换
'==============================
Sub FocusEditDo()
	Fk_Focus_Name=FKFun.HTMLEncode(Trim(Request.Form("Fk_Focus_Name")))
	Fk_Focus_Content=FKFun.HTMLEncode(Trim(Replace(Request.Form("Fk_Focus_Content"),", ","")))
	Id=Trim(Request.Form("Id"))
	Call FKFun.JsonString(Fk_Focus_Name,1,50,0,"请输入名称！","名称不能大于50个字符！")
	Call FKFun.JsonString(Fk_Focus_Content,1,50,1,"请增加轮换项！","内容不能大于50个字符！")
	Call FKFun.JsonNum(Id,"系统参数错误，请刷新页面！")
	Sqlstr="Select Fk_Focus_Id,Fk_Focus_Name,Fk_Focus_Content From [Fk_Focus] Where Fk_Focus_Id=" & Id
	Rs.Open Sqlstr,Conn,1,3
	If Not Rs.Eof Then
		Application.Lock()
		Rs("Fk_Focus_Name")=Fk_Focus_Name
		Rs("Fk_Focus_Content")=Fk_Focus_Content
		Rs.Update()
		Application.UnLock()
		Call FKFun.JsonSuccess()
	Else
		Rs.Close
		Call FKFun.JsonError("要修改的独立轮换不存在！")
	End If
	Rs.Close
End Sub

'==============================
'函 数 名：FocusDelDo
'作    用：执行删除独立轮换
'==============================
Sub FocusDelDo()
	Id=Trim(Request.QueryString("Id"))
	Call FKFun.ShowNum(Id,"系统参数错误，请刷新页面！")
	Sqlstr="Select Fk_Focus_Id From [Fk_Focus] Where Fk_Focus_Id=" & Id
	Rs.Open Sqlstr,Conn,1,3
	If Not Rs.Eof Then
		Application.Lock()
		Rs.Delete()
		Application.UnLock()
		Response.Write("ok")
	Else
		Response.Write("要删除的独立轮换不存在！")
	End If
	Rs.Close
End Sub

'==============================
'函 数 名：FocusLabel
'作    用：获取轮换调用代码
'==============================
Sub FocusLabel()
	Dim GetFocusSelect
	Id=Trim(Request.QueryString("Id"))
	'轮换方案列表
	TempArr=Split(FKFun.GetFloderList("../Plugin/FlashFocus/"),"||")
	For Each Temp In TempArr
		GetFocusSelect=GetFocusSelect&"<option value='"&Temp&"'>"&Temp&"</option>"
	Next
%>
<div id="title">获取调用代码</div>
<div id="box">
	<table width="95%" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td width="15%" height="30" align="right">轮换调用：</td>
            <td width="85%">
				&nbsp;&nbsp;<select name="Focus" class="input" id="Focus">
					<%=GetFocusSelect%>
				</select>
				&nbsp;&nbsp;宽度：<input type="text" name="Width" class="input" id="Width" size="5" />
				&nbsp;&nbsp;高度：<input type="text" name="Height" class="input" id="Height" size="5" />
				&nbsp;&nbsp;<input type="button" class="button" name="button1" id="button1" value="生 成" onclick="GetFocusLabel(<%=Id%>,$('#Focus').val(),$('#Width').val(),$('#Height').val());" />
			</td>
        </tr>
	</table>	
	<p>&nbsp;</p>
	<table width="95%" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
        <tr>
        	<td height="30" align="center">标签生成结果</td>
       	</tr>
        <tr>
            <td height="30" id="BuildResult">&nbsp;&nbsp;等待生成……</td>
        </tr>
	</table>
</div>
<div id="bottom">
	<input type="button" onclick="dialogClose();" class="button" name="button" id="button" value="关 闭" />
</div>
<%
End Sub

Call FKFun.PageEnd()
%>
