<!-- #include file=../../inc/BBSsetup.asp -->
<!-- #include file=../../inc/Board_popfun.asp -->
<!-- #include file=../inc/bbsmanage_Fun.asp -->
<%
DEF_BBS_HomeUrl = "../../"
Const MaxLinkNum = 100
Dim GBL_ID
initDatabase
GBL_CHK_TempStr = ""
GBL_ID = checkSupervisorPass

Dim StyleID,ScreenWidth,DisplayTopicLength,SiteHeadString,SiteBottomString,DefineImage,TableHeadString,TableBottomString,ShowBottomSure,TempletID


SiteHead(DEF_SiteNameString & " - 管理员")
UserTopicTopInfo
DisplayUserNavigate("论坛参数设置")
If GBL_CHK_Flag=1 Then
	GetDefaultValue
	If GBL_CHK_TempStr <> "" Then
		Response.Write "<br><br>" & GBL_CHK_TempStr
	Else
		SiteLink
	End If
Else%>
	<table width=96%>
	<tr>
	<td>
	<%
	If Request("submitflag")="" Then
		Response.Write "<br><b>请先登录</b>"
	Else
		Response.Write "<br><p align=left><font color=ff0000 class=RedFont><b>" & GBL_CHK_TempStr & "</b></font>"
	End If
	DisplayLoginForm
	Response.Write "</p>"%>
	</td>
	</tr>
	</table>
<%End If
UserTopicBottomInfo
closeDataBase
SiteBottom
If GBL_ShowBottomSure = 1 Then Response.Write GBL_SiteBottomString

Function SiteLink

	%>
	<form name="pollform3sdx" method="post" action="DefineStyleParameter.asp">
	<input type="hidden" name="SubmitFlag" value=yes>
	<p>
		<b>
			论坛风格更多参数自定义 - <%=DEF_BoardStyleString(StyleID)%></b>
			<br><br><font color=8888888 class=GrayFont>
			大输入框请使用html语法，具体风格请在本地调试好后再具体设定<br>
			如果你的首页采用了JS加速，表格头及尾部内容不能使用JS代码</font>
	</p>
	<%If Request("SubmitFlag") <> "" Then
		CheckLinkValue
	End If%>
	<b><font color=ff0000 class=RedFont><%=GBL_CHK_TempStr%></font></b>
	<p>
	<%
	If Request("SubmitFlag") <> "" Then
		If GBL_CHK_TempStr <> "" Then
			DisplayDatabaseLink
		Else
			SaveStyleDefine
			Response.Write "<br><b>成功完成设置！</b>"
			Exit Function
		End If
	Else
		DisplayDatabaseLink
	End If
	%>
	<br>
	<input type=submit name=提交 value=提交 class=fmbtn>
	<input type=reset name=取消 value=取消 class=fmbtn>
	</form>
	<%

End Function

Function CheckLinkValue

	GetFormValue

End Function

Function DisplayDatabaseLink

	%>
		<table border=0 cellpadding=5 cellspacing=1 width="100%" bgcolor="<%=DEF_BBS_LightColor%>" class=TBBG1>
		<tr bgcolor=<%=DEF_BBS_LightestColor%> class=TBBG9>
			<td width=50>风格编号</td>
			<td><b><%=StyleID%></b> (<%=DEF_BoardStyleString(StyleID)%>)<input name=StyleID value=<%=StyleID%> type=hidden></td>
		</tr>
		<tr bgcolor=<%=DEF_BBS_LightestColor%> class=TBBG9>
			<td width=50>论坛宽度</td>
			<td><input class=fminpt type="text" name="ScreenWidth" maxlength="50" size="30" value="<%=htmlencode(ScreenWidth)%>"><font color=gray>(支持使用百分比和绝对宽度)</font></td>
		</tr>
		<tr bgcolor=<%=DEF_BBS_LightestColor%> class=TBBG9>
			<td>主题长度</td>
			<td><input class=fminpt type="text" name="DisplayTopicLength" maxlength="3" size="10" value="<%=htmlencode(DisplayTopicLength)%>"><font color=gray>(主题显示最大长度，避免因产生换行而使排版混乱，750宽=54，770宽=56)</font></td>
		</tr>
		<tr bgcolor=<%=DEF_BBS_LightestColor%> class=TBBG9>
			<td>自定图片</td>
			<td><table border=0 cellpadding=0 cellspacing=0><tr>
				<td><input class=fmchkbox type=radio name=DefineImage value=0<%If DefineImage = 0 Then%> checked<%End If%>></td><td>无</td>
          		<td><input class=fmchkbox type=radio name=DefineImage value=1<%If DefineImage = 1 Then%> checked<%End If%>></td><td>有</td><td><font color=gray>&nbsp; (是否自带新风格图片，存放于images/skin/<%=StyleID%>/，不指定则使用默认图片)</font></td></tr></table></td>
		</tr>
		<tr bgcolor=<%=DEF_BBS_LightestColor%> class=TBBG9>
			<td>网站首部<br>内容自定<br>使用HTML</td>
			<td><textarea name=SiteHeadString rows=5 cols=60 class=fmtxtra><%If SiteHeadString <> "" Then Response.Write VbCrLf & Server.htmlEncode(SiteHeadString)%></textarea></td>
		</tr>
		<tr bgcolor=<%=DEF_BBS_LightestColor%> class=TBBG9>
			<td>网站尾部<br>内容自定<br>使用HTML</td>
			<td><textarea name=SiteBottomString rows=5 cols=60 class=fmtxtra><%If SiteBottomString <> "" Then Response.Write VbCrLf & Server.htmlEncode(SiteBottomString)%></textarea></td>
		</tr>
		<tr bgcolor=<%=DEF_BBS_LightestColor%> class=TBBG9>
			<td>表格头部<br>内容自定<br>使用HTML</td>
			<td><textarea name=TableHeadString rows=5 cols=60 class=fmtxtra><%If TableHeadString <> "" Then Response.Write VbCrLf & Server.htmlEncode(TableHeadString)%></textarea></td>
		</tr>
		<tr bgcolor=<%=DEF_BBS_LightestColor%> class=TBBG9>
			<td>表格尾部<br>内容自定<br>使用HTML</td>
			<td><textarea name=TableBottomString rows=5 cols=60 class=fmtxtra><%If TableBottomString <> "" Then Response.Write VbCrLf & Server.htmlEncode(TableBottomString)%></textarea></td>
		</tr>
		<tr bgcolor=<%=DEF_BBS_LightestColor%> class=TBBG9>
			<td>尾部内容<br>必须显示</td>
			<td><table border=0 cellpadding=0 cellspacing=0><tr>
				<td><input class=fmchkbox type=radio name=ShowBottomSure value=0<%If ShowBottomSure = 0 Then%> checked<%End If%>></td><td>有选择显示</td>
          		<td><input class=fmchkbox type=radio name=ShowBottomSure value=1<%If ShowBottomSure = 1 Then%> checked<%End If%>></td><td>肯定显示</td><td><font color=gray>&nbsp; (为了美观，某些页面底部自定义内容不想显示，请选择＂有选择＂，否则选择后者)</font></td></tr></table></td>
		</tr>
		<tr bgcolor=<%=DEF_BBS_LightestColor%> class=TBBG9>
			<td>使用模板</td>
			<td><%DisplayTempletList(TempletID)%></td>
		</tr>
		</table>
	<%

End Function

Function GetDefaultValue

	StyleID = Left(Request("StyleID"),14)
	If isNumeric(StyleID) = 0 Then StyleID = 0
	StyleID = Fix(cCur(StyleID))
	If StyleID < 0 or StyleID > DEF_BoardStyleStringNum Then StyleID = 0
	
	Dim Rs
	Set Rs = Server.CreateObject("ADODB.RecordSet")
	Rs.Open "Select top 1 * from LeadBBS_Skin Where StyleID=" & StyleID,con,1,1
	GBL_DBNum = GBL_DBNum + 1
	If Not Rs.Eof Then
		ScreenWidth = Rs("ScreenWidth")
		DisplayTopicLength = Rs("DisplayTopicLength")
		SiteHeadString = Rs("SiteHeadString")
		SiteBottomString = Rs("SiteBottomString")
		DefineImage = Rs("DefineImage")
		TableHeadString = Rs("TableHeadString")
		TableBottomString = Rs("TableBottomString")
		ShowBottomSure = Rs("ShowBottomSure")
		If DefineImage = 1 or DefineImage = True Then
			DefineImage = 1
		Else
			DefineImage = 0
		End If
		If ShowBottomSure >= 1 Then
			ShowBottomSure = 1
		Else
			ShowBottomSure = 0
		End If
		TempletID = cCur(Rs("TempletID"))
		If isNull(TempletID) Then TempletID = 0
	Else
		ScreenWidth = "770"
		DisplayTopicLength = 56
		SiteHeadString = ""
		SiteBottomString = ""
		DefineImage = 0
		TableHeadString = ""
		TableBottomString = ""
		ShowBottomSure = 0
		TempletID = 0
	End If
	Rs.Close
	Set Rs = Nothing

End Function

Function GetFormValue

	ScreenWidth = Request("ScreenWidth")
	DisplayTopicLength = Left(Request("DisplayTopicLength"),4)
	If isNumeric(DisplayTopicLength) = 0 Then DisplayTopicLength = 56
	DisplayTopicLength = Fix(cCur(DisplayTopicLength))
	DefineImage = Request.Form("DefineImage")
	If DefineImage = "1" Then
		DefineImage = 1
	Else
		DefineImage = 0
	End If
	If DisplayTopicLength < 10 or DisplayTopicLength > 255 Then DisplayTopicLength = 56
	SiteHeadString = Left(Request.Form("SiteHeadString"),DEF_MaxTextLength)
	SiteBottomString = Left(Request.Form("SiteBottomString"),DEF_MaxTextLength)
	TableHeadString = Left(Request.Form("TableHeadString"),DEF_MaxTextLength)
	TableBottomString = Left(Request.Form("TableBottomString"),DEF_MaxTextLength)
	ShowBottomSure = Left(Request.Form("ShowBottomSure"),4)
	TempletID = Left(Request.Form("TempletID"),4)
	
	If ShowBottomSure = "1" Then
		ShowBottomSure = 1
	Else
		ShowBottomSure = 0
	End If

	If isNumeric(TempletID) = 0 Then TempletID = 0

End Function

Function SaveStyleDefine

	Dim Rs
	Set Rs = Server.CreateObject("ADODB.RecordSet")
	Rs.Open "Select top 1 * from LeadBBS_Skin Where StyleID=" & StyleID,con,2,2
	GBL_DBNum = GBL_DBNum + 1
	If Not Rs.Eof Then
		Rs("ScreenWidth") = ScreenWidth
		Rs("DisplayTopicLength") = DisplayTopicLength
		Rs("SiteHeadString") = SiteHeadString
		Rs("SiteBottomString") = SiteBottomString
		Rs("DefineImage") = DefineImage
		Rs("TableHeadString") = TableHeadString
		Rs("TableBottomString") = TableBottomString
		Rs("ShowBottomSure") = ShowBottomSure
		Rs("TempletID") = TempletID
		Rs.Update
	Else
		Rs.AddNew
		Rs("StyleID") = StyleID
		Rs("ScreenWidth") = ScreenWidth
		Rs("DisplayTopicLength") = DisplayTopicLength
		Rs("SiteHeadString") = SiteHeadString
		Rs("SiteBottomString") = SiteBottomString
		Rs("DefineImage") = DefineImage
		Rs("TableHeadString") = TableHeadString
		Rs("TableBottomString") = TableBottomString
		Rs("ShowBottomSure") = ShowBottomSure
		Rs("TempletID") = TempletID
		Rs.Update
	End If
	Rs.Close
	Set Rs = Nothing
	ReloadBoardStyleInfo(StyleID)

End Function

Sub DisplayTempletList(TempletID)

	%>
	<script language=javascript>
	var TempletID = <%=TempletID%>;
	function s(ID,TempletName)
	{
		if(ID=="")return;
		if(TempletID == parseInt(ID)){document.write("<option value=" + ID + " selected>" + TempletName);}
		else{document.write("<option value=" + ID + ">" + TempletName);}
	}
	</script>
	<select name=TempletID>
	<%
	Dim Rs,SQL
	SQL = "select ID,TempletName from LeadBBS_Templet"

	Set Rs = Con.ExeCute(SQL)
	GBL_DBNum = GBL_DBNum + 1
	Dim Num
	If Not rs.Eof Then
		Response.Write "<script language=javascript>" & VbCrLf & "s("""
		Response.Write Rs.GetString(,,""",""",""");" & VbCrLf & "s(""","")
		%>","","","");
		</script>
		</select>
		<%
	Else
		Num = -1
	End If
	Rs.close
	Set Rs = Nothing

End Sub
%>