<!--#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,"s_System",0)

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

Select Case Types
	Case 1
		Call SiteSetBox() '站点信息设置表单
	Case 2
		Call SiteSetDo() '站点设置保存
	Case Else
		Call FKFun.ShowErr("未发现功能项！",1)
End Select

'==========================================
'函 数 名：SiteSetBox()
'作    用：站点信息设置表单
'==========================================
Sub SiteSetBox()
%>
<form id="SystemSet" name="SystemSet" method="post" action="SiteSet.asp?Type=2" target="ajax" boxClose="1" showStr="站点设置保存成功！" SiteSet="1">
<div id="title">站点设置</div>
<div id="box">
	<ul class="dialogNav">
    	<li class="check bnr" id="s1" onclick="bnav('1');">常规选项</li>
<%If Instr(Fk_Site_HideLink_Str,",hide_SiteSet_2,")=0 Then%>    	<li class="bnr" id="s2" onclick="bnav('2');">生成选项</li><%End If%>
<%If Instr(Fk_Site_HideLink_Str,",hide_SiteSet_3,")=0 Then%>    	<li class="bnr" id="s3" onclick="bnav('3');">上传格式选项</li><%End If%>
<%If Instr(Fk_Site_HideLink_Str,",hide_SiteSet_4,")=0 Then%>    	<li class="bnr" id="s4" onclick="bnav('4');">调试选项</li><%End If%>
		<div class="cal"></div>
    </ul>
	<div class="cal"></div>
    <!--常规选项-->
	<table width="95%" id="t1" class="t" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td width="18%" height="30" align="right">站点名称：</td>
			<td width="82%">&nbsp;<input name="Fk_Site_Name" type="text" class="input" id="Fk_Site_Name" value="<%=Fk_Site_Name%>" size="50" /><span class="help" title="<p>站点名称，显示在前台页面上，请输入1-50个字符（1个汉字为2个字符）。</p>"></span></td>
		</tr>
        <tr>
            <td height="30" align="right">站点地址：</td>
            <td>&nbsp;<input name="Fk_Site_Url" type="text" class="input" id="Fk_Site_Url" value="<%=Fk_Site_Url%>" size="50" /><span class="help" title="<p>站点链接地址，请输入正确的地址，请输入1-255个字符（两个字符为一个汉字）。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">站点关键字：</td>
            <td>&nbsp;<input name="Fk_Site_Keyword" type="text" class="input" id="Fk_Site_Keyword" value="<%=Fk_Site_Keyword%>" size="50" /><span class="help" title="<p>多个关键字用英文逗号隔开，用于前台首页meta的keywords，请输入1-255个字符（两个字符为一个汉字）。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">站点描述：</td>
            <td>&nbsp;<input name="Fk_Site_Description" type="text" class="input" id="Fk_Site_Description" value="<%=Fk_Site_Description%>" size="50" /><span class="help" title="<p>请输入站点的一段文字描述，用于前台首页meta的description，请输入1-255个字符（两个字符为一个汉字）。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">模板：</td>
            <td>&nbsp;<select name="Fk_Site_Template" class="input" id="Fk_Site_Template">
<%
	TempArr=Split(FKFun.GetFloderList("../skin/"),"||")
	For Each Temp In TempArr
%>
					<option value="<%=Temp%>"<%=FKFun.BeSelect(Fk_Site_Template,Temp)%>><%=Temp%></option>
<%
	Next
%>
				</select><span class="help" title="<p>选择站点的模板目录，如果选择的模板与当前模板不同，设置时会自动重载模板缓存。</p>"></span>
			</td>
        </tr>
        <tr>
            <td height="30" align="right">每页条数：</td>
            <td>&nbsp;<select name="Fk_Site_PageSize" class="input" id="Fk_Site_PageSize">
<%
	For i=1 To 50
%>
					<option value="<%=i%>"<%=FKFun.BeSelect(Fk_Site_PageSize,i)%>><%=i%>条</option>
<%
	Next
%>
				</select><span class="help" title="<p>默认的列表每页条数，用于全局，权重低于模块中的每页条数设置。</p>"></span>
			</td>
        </tr>
        <tr>
            <td height="30" align="right">站点开放：</td>
            <td>&nbsp;<input type="radio" name="Fk_Site_Open" class="input" id="Fk_Site_Open" value="0"<%=FKFun.BeCheck(Fk_Site_Open,0)%> />关闭
				<input type="radio" name="Fk_Site_Open" class="input" id="Fk_Site_Open" value="1"<%=FKFun.BeCheck(Fk_Site_Open,1)%> />开放<span class="help" title="<p>当站点开放选择“关闭”时，访问前台直接显示站点关闭提示，后台可正常操作，但本设置对纯静态生成无效。</p>"></span>
			</td>
        </tr>
        <tr>
            <td height="30" align="right">站点关闭提示：</td>
            <td>&nbsp;<textarea name="Fk_Site_CloseStr" cols="50" class="textarea" id="Fk_Site_CloseStr"><%=Fk_Site_CloseStr%></textarea><span class="help" title="<p>站点关闭时访问网站前台显示的提示。</p>"></span></td>
        </tr>
<%
	Sqlstr="Select Fk_Field_Id,Fk_Field_Name,Fk_Field_Remark,Fk_Field_Label,Fk_Field_Help,Fk_Field_Type,Fk_Field_Option From [Fk_Field] Where Fk_Field_Use=1 Order By Fk_Field_Id Asc"
	Rs.Open Sqlstr,Conn,1,1
	While Not Rs.Eof
		Temp=FKFun.GetSub(Fk_Site_Field,Rs("Fk_Field_Label")&"_Field_Get:","|Get_Field_Line|","")
		Select Case Rs("Fk_Field_Type")
			Case 0
				Call FKFun.GetField_Input(Rs("Fk_Field_Name"),Rs("Fk_Field_Label"),Rs("Fk_Field_Help"),Temp)
			Case 1
				Call FKFun.GetField_Editor(Rs("Fk_Field_Name"),Rs("Fk_Field_Label"),Rs("Fk_Field_Help"),Temp)
			Case 2
				Call FKFun.GetField_Upload(Rs("Fk_Field_Name"),Rs("Fk_Field_Label"),Rs("Fk_Field_Help"),Temp)
			Case 3
				Call FKFun.GetField_Select(Rs("Fk_Field_Name"),Rs("Fk_Field_Label"),Rs("Fk_Field_Help"),Rs("Fk_Field_Option"),Temp)
		End Select
		Rs.MoveNext
	Wend
	Rs.Close
%>
	</table>
    <!--生成选项-->
	<table width="95%" id="t2" class="t dis" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td width="18%" height="30" align="right">系统模式：</td>
            <td width="82%">&nbsp;<input type="radio" name="Fk_Site_Html" class="input" id="Fk_Site_Html" value="0"<%=FKFun.BeCheck(Fk_Site_Html,0)%> onclick="$('#urlIndex').show();" />仿静态模式（动态）
							<input type="radio" name="Fk_Site_Html" class="input" id="Fk_Site_Html" value="1"<%=FKFun.BeCheck(Fk_Site_Html,1)%> onclick="$('#urlIndex').show();" />ID模式（动态）
							<input type="radio" name="Fk_Site_Html" class="input" id="Fk_Site_Html" value="2"<%=FKFun.BeCheck(Fk_Site_Html,2)%> onclick="$('#urlIndex').hide();" />纯静态模式
							<input type="radio" name="Fk_Site_Html" class="input" id="Fk_Site_Html" value="3"<%=FKFun.BeCheck(Fk_Site_Html,3)%> onclick="$('#urlIndex').hide();" />伪静态模式（动态）<span class="help" title="<p>动态模式直接通过ASP进行访问，纯静态模式在更新内容后需要手工进行生成操作。</p>"></span>
			</td>
        </tr>
        <tr id="urlIndex">
            <td width="18%" height="30" align="right">地址带Index.asp：</td>
            <td width="82%">&nbsp;<input type="radio" name="Fk_Site_IndexInUrl" class="input" id="Fk_Site_IndexInUrl" value="0"<%=FKFun.BeCheck(Fk_Site_IndexInUrl,"")%> />关闭
							<input type="radio" name="Fk_Site_IndexInUrl" class="input" id="Fk_Site_IndexInUrl" value="1"<%=FKFun.BeCheck(Fk_Site_IndexInUrl,"Index.asp")%> />开启<span class="help" title="<p>设置链接是否带Index.asp。</p>"></span>
			</td>
        </tr>
        <tr>
            <td height="30" align="right">静态后缀：</td>
            <td>&nbsp;<select name="Fk_Site_HtmlSuffix" class="input" id="Fk_Site_HtmlSuffix">
					<option value="0"<%=FKFun.BeSelect(Fk_Site_HtmlSuffix,0)%>>.html</option>
					<option value="1"<%=FKFun.BeSelect(Fk_Site_HtmlSuffix,1)%>>.htm</option>
					<option value="2"<%=FKFun.BeSelect(Fk_Site_HtmlSuffix,2)%>>.shtml</option>
					<option value="3"<%=FKFun.BeSelect(Fk_Site_HtmlSuffix,3)%>>.xml</option>
                </select><span class="help" title="<p>设置生成文件的后缀，在动态或者伪静态模式下，也带有生成后缀。</p>"></span>
			</td>
        </tr>
	</table>
    <!--生成选项-->
	<table width="95%" id="t3" class="t dis" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td width="18%" height="30" align="right">附件上传类型：</td>
			<td width="82%">&nbsp;<input name="Fk_Site_LinkExt" type="text" class="input" id="Fk_Site_LinkExt" value="<%=Fk_Site_LinkExt%>" size="50" /><span class="help" title="<p>多种格式请用英文逗号隔开，请输入1-255个字符。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">图片上传类型：</td>
			<td width="82%">&nbsp;<input name="Fk_Site_PicExt" type="text" class="input" id="Fk_Site_PicExt" value="<%=Fk_Site_PicExt%>" size="50" /><span class="help" title="<p>多种格式请用英文逗号隔开，请输入1-255个字符。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">FLASH上传类型：</td>
			<td width="82%">&nbsp;<input name="Fk_Site_FlashExt" type="text" class="input" id="Fk_Site_FlashExt" value="<%=Fk_Site_FlashExt%>" size="50" /><span class="help" title="<p>多种格式请用英文逗号隔开，请输入1-255个字符。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">流媒体上传类型：</td>
			<td width="82%">&nbsp;<input name="Fk_Site_MediaExt" type="text" class="input" id="Fk_Site_MediaExt" value="<%=Fk_Site_MediaExt%>" size="50" /><span class="help" title="<p>多种格式请用英文逗号隔开，请输入1-255个字符。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">文件上传大小限制：</td>
			<td width="82%">&nbsp;<input name="Fk_Site_UploadSize" type="text" class="input" id="Fk_Site_UploadSize" value="<%=Fk_Site_UploadSize%>" size="5" /> M<span class="help" title="<p>文件上传大小限制，必须为数字。</p>"></span></td>
        </tr>
        <tr>
            <td height="30"colspan="2" align="center" style="color:#F00;">修改上传类型后需要刷新页面生效</td>
        </tr>
	</table>
    <!--调试选项-->
	<table width="95%" id="t4" class="t dis" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td width="18%" height="30" align="right">模板调试模式：</td>
            <td width="82%">&nbsp;<input type="radio" name="Fk_Site_TemplateDebug" class="input" id="Fk_Site_TemplateDebug" value="0"<%=FKFun.BeCheck(Fk_Site_TemplateDebug,0)%> />关闭
							<input type="radio" name="Fk_Site_TemplateDebug" class="input" id="Fk_Site_TemplateDebug" value="1"<%=FKFun.BeCheck(Fk_Site_TemplateDebug,1)%> />开启<span class="help" title="<p>选择是否开启模板调试模式，开启后模板内容将直接读取文件，正式使用时请关闭本选项。</p>"></span>
			</td>
        </tr>
        <tr>
            <td width="18%" height="30" align="right">系统调试模式：</td>
            <td width="82%">&nbsp;<input type="radio" name="Fk_Site_Debug" class="input" id="Fk_Site_Debug" value="0"<%=FKFun.BeCheck(Fk_Site_Debug,0)%> />关闭
							<input type="radio" name="Fk_Site_Debug" class="input" id="Fk_Site_Debug" value="1"<%=FKFun.BeCheck(Fk_Site_Debug,1)%> />开启<span class="help" title="<p>选择是否开启系统调试模式，开启后当后台操作出现程序报错时，将弹出实际错误提示。</p>"></span>
			</td>
        </tr>
        <tr>
            <td height="30" align="right">编辑器：</td>
            <td>&nbsp;<select name="Fk_Site_Editor" class="input" id="Fk_Site_Editor">
					<option value="0"<%=FKFun.BeSelect(Fk_Site_Editor,0)%>>xhEditor</option>
					<option value="1"<%=FKFun.BeSelect(Fk_Site_Editor,1)%>>UEditor</option>
                </select><span class="help" title="<p>选择编辑器，请注意Editor目录下要有相应编辑器文件。</p>"></span>
			</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>
<script type="text/javascript">
$(document).ready(function(){
<%If Fk_Site_Html=2 Or Fk_Site_Html=3 Then%>
$('#urlIndex').hide();
<%End If%>
});
</script>
<%
End Sub

'==========================================
'函 数 名：SiteSetDo()
'作    用：站点设置保存
'==========================================
Sub SiteSetDo()
	'常规选项
	Fk_Site_Name=FKFun.HTMLEncode(Trim(Request.Form("Fk_Site_Name")))
	Fk_Site_Url=LCase(FKFun.HTMLEncode(Trim(Request.Form("Fk_Site_Url"))))
	Fk_Site_Keyword=FKFun.HTMLEncode(Trim(Request.Form("Fk_Site_Keyword")))
	Fk_Site_Description=FKFun.HTMLEncode(Trim(Request.Form("Fk_Site_Description")))
	Fk_Site_Template=FKFun.HTMLEncode(Trim(Request.Form("Fk_Site_Template")))
	Fk_Site_PageSize=Trim(Request.Form("Fk_Site_PageSize"))
	Fk_Site_Open=Trim(Request.Form("Fk_Site_Open"))
	Fk_Site_CloseStr=FKFun.HTMLEncode(Trim(Request.Form("Fk_Site_CloseStr")))
	'生成选项
	Fk_Site_Html=Trim(Request.Form("Fk_Site_Html"))
	Fk_Site_IndexInUrl=Trim(Request.Form("Fk_Site_IndexInUrl"))
	Fk_Site_HtmlSuffix=Trim(Request.Form("Fk_Site_HtmlSuffix"))
	'上传类型
	Fk_Site_LinkExt=LCase(FKFun.HTMLEncode(Trim(Request.Form("Fk_Site_LinkExt"))))
	Fk_Site_PicExt=LCase(FKFun.HTMLEncode(Trim(Request.Form("Fk_Site_PicExt"))))
	Fk_Site_FlashExt=LCase(FKFun.HTMLEncode(Trim(Request.Form("Fk_Site_FlashExt"))))
	Fk_Site_MediaExt=LCase(FKFun.HTMLEncode(Trim(Request.Form("Fk_Site_MediaExt"))))
	Fk_Site_UploadSize=Trim(Request.Form("Fk_Site_UploadSize"))
	'调试选项
	Fk_Site_TemplateDebug=Trim(Request.Form("Fk_Site_TemplateDebug"))
	Fk_Site_Debug=Trim(Request.Form("Fk_Site_Debug"))
	Fk_Site_Editor=Trim(Request.Form("Fk_Site_Editor"))
	'========================================================================
	'常规选项
	Call FKFun.JsonString(Fk_Site_Name,1,50,0,"请输入站点名称！","站点名称不能大于50个字符！")
	Call FKFun.JsonString(Fk_Site_Url,1,255,0,"请输入站点地址！","站点地址不能大于255个字符！")
	Call FKFun.JsonString(Fk_Site_Keyword,1,255,2,"请输入站点关键字！","站点关键字不能大于255个字符！")
	Call FKFun.JsonString(Fk_Site_Description,1,255,2,"请输入站点介绍！","站点介绍不能大于255个字符！")
	Call FKFun.JsonString(Fk_Site_Template,1,50,0,"兄弟啊，你怎么能把模板删完啊！","模板文件夹名称不能大于50个字符！")
	Call FKFun.JsonNum(Fk_Site_PageSize,"请选择每页条数！")
	Call FKFun.JsonNum(Fk_Site_Open,"请选择站点是否开放！")
	Call FKFun.JsonString(Fk_Site_CloseStr,1,1000,0,"请输入站点关闭提示！","请输入站点关闭提示不能大于1000个字符！")
	If Right(Fk_Site_Url,1)<>"/" Then
		Call FKFun.JsonError("站点地址请用“/”结束！")
	End If
	If Left(Fk_Site_Url,7)<>"http://" Then
		Call FKFun.JsonError("站点地址请用“http://”开头！")
	End If
	'生成选项
	Call FKFun.JsonNum(Fk_Site_Html,"请选择系统模式！")
	Call FKFun.JsonNum(Fk_Site_IndexInUrl,"请选择链接是否带Index.asp！")
	Call FKFun.JsonNum(Fk_Site_HtmlSuffix,"请选择生成文件名后缀！")
	If Fk_Site_Html=2 Or Fk_Site_Html=3 Then
		Fk_Site_IndexInUrl=0
	End If
	'上传类型
	Call FKFun.JsonString(Fk_Site_LinkExt,1,255,0,"请输入附件上传类型！","附件上传类型不能大于255个字符！")
	Call FKFun.JsonString(Fk_Site_PicExt,1,255,0,"请输入图片上传类型！","图片上传类型不能大于255个字符！")
	Call FKFun.JsonString(Fk_Site_FlashExt,1,255,0,"请输入FLASH上传类型！","FLASH上传类型不能大于255个字符！")
	Call FKFun.JsonString(Fk_Site_MediaExt,1,255,0,"请输入流媒体上传类型！","流媒体上传类型不能大于255个字符！")
	Temp=FKFun.CheckAllowExt(Fk_Site_LinkExt)
	If Temp<>"" Then
		Call FKFun.JsonError("附件上传类型中的"&Temp&"为不允许上传类型！")
	End If
	Temp=FKFun.CheckAllowExt(Fk_Site_PicExt)
	If Temp<>"" Then
		Call FKFun.JsonError("图片上传类型中的"&Temp&"为不允许上传类型！")
	End If
	Temp=FKFun.CheckAllowExt(Fk_Site_FlashExt)
	If Temp<>"" Then
		Call FKFun.JsonError("FLASH上传类型中的"&Temp&"为不允许上传类型！")
	End If
	Temp=FKFun.CheckAllowExt(Fk_Site_MediaExt)
	If Temp<>"" Then
		Call FKFun.JsonError("流媒体上传类型中的"&Temp&"为不允许上传类型！")
	End If
	Call FKFun.JsonNum(Fk_Site_UploadSize,"上传文件大小限制必须是数字！")
	'调试选项
	Call FKFun.JsonNum(Fk_Site_TemplateDebug,"请选择模板调试选项是否开启！")
	Call FKFun.JsonNum(Fk_Site_Debug,"请选择系统调试选项是否开启！")
	Call FKFun.JsonNum(Fk_Site_Editor,"请选择编辑器！")
	'========================================================================
	'自定义字段
	Fk_Site_Field=""
	Sqlstr="Select Fk_Field_Label,Fk_Field_Type From [Fk_Field] Where Fk_Field_Use=1 Order By Fk_Field_Id Asc"
	Rs.Open Sqlstr,Conn,1,1
	While Not Rs.Eof
		If Rs("Fk_Field_Type")="1" Then
			Temp=FKFun.EditorImgTry(Trim(Request.Form("Fk_Field_"&Rs("Fk_Field_Label")&"")))
			Temp=Replace(Temp,"'","&#39;")
		Else
			Temp=FKFun.HTMLEncode(Trim(Request.Form("Fk_Field_"&Rs("Fk_Field_Label")&"")))
		End If
		Temp=Replace(Temp,"_Field_Get:","&nbsp;_Field_Get")
		Temp=Replace(Temp,"Get_Field_Line:","&nbsp;Get_Field_Line")
		Fk_Site_Field=Fk_Site_Field&Rs("Fk_Field_Label")&"_Field_Get:"&Temp&"|Get_Field_Line|"
		Rs.MoveNext
	Wend
	Rs.Close
	'========================================================================
	
	Sqlstr="Select Top 1 * From [Fk_Site]"
	Rs.Open Sqlstr,Conn,1,3
	Application.Lock()
	If Not Rs.Eof Then
		'常规选项
		Rs("Fk_Site_Name")=Fk_Site_Name
		Rs("Fk_Site_Url")=Fk_Site_Url
		Rs("Fk_Site_Keyword")=Fk_Site_Keyword
		Rs("Fk_Site_Description")=Fk_Site_Description
		Rs("Fk_Site_Template")=Fk_Site_Template
		Rs("Fk_Site_PageSize")=Fk_Site_PageSize
		Rs("Fk_Site_Open")=Fk_Site_Open
		Rs("Fk_Site_CloseStr")=Fk_Site_CloseStr
		'生成选项
		Rs("Fk_Site_Html")=Fk_Site_Html
		Rs("Fk_Site_IndexInUrl")=Fk_Site_IndexInUrl
		Rs("Fk_Site_HtmlSuffix")=Fk_Site_HtmlSuffix
		'上传类型
		Rs("Fk_Site_LinkExt")=Fk_Site_LinkExt
		Rs("Fk_Site_PicExt")=Fk_Site_PicExt
		Rs("Fk_Site_FlashExt")=Fk_Site_FlashExt
		Rs("Fk_Site_MediaExt")=Fk_Site_MediaExt
		Rs("Fk_Site_UploadSize")=Fk_Site_UploadSize
		'调试选项
		Rs("Fk_Site_TemplateDebug")=Fk_Site_TemplateDebug
		Rs("Fk_Site_Debug")=Fk_Site_Debug
		Rs("Fk_Site_Editor")=Fk_Site_Editor
		'其他
		Rs("Fk_Site_Field")=Fk_Site_Field
		Rs.Update()
	End If
	Application.UnLock()
	Rs.Close
	Call FKFun.JsonSuccess()
End Sub

Call FKFun.PageEnd()
%>
