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

Call CheckAdminType("0,1",UType)

Dim Fk_View_Title,Fk_View_Color,Fk_View_Keyword,Fk_View_Description,Fk_View_Content,Fk_View_Url,Fk_View_PicList,Fk_View_Pic,Fk_View_PicBig,Fk_View_FixedUrl,Fk_View_FileName,Fk_View_Recommend,Fk_View_Subject,Fk_View_Field,Fk_View_Template,Fk_View_Show,Fk_View_Link,Fk_View_Stick,Fk_View_Order,Fk_View_Time
Dim FieldArr_Input,FieldArr_Editor,FieldArr_Upload,FieldArr_Select
Dim Field_Content,Field_Name,Field_Remark,Field_Label,Field_Help,Field_Type,Field_Option,Field_TypeName
Dim TemplateSelect

MenuId=Clng(Request.QueryString("Menu"))
ModuleId=Clng(Request.QueryString("Module"))
Types=Clng(Request.QueryString("Type"))

If UShowModule="all" Then
	ULimit="all"
End If
Call CheckAdminLimit(ULimit,"v_"&ModuleId,0)

Sqlstr="Select Fk_Module_Name,Fk_Module_LevelList,Fk_Module_FixedUrl,Fk_Module_Model,Fk_Module_Url From [Fk_Module] Where Fk_Module_Id=" & ModuleId
Rs.Open Sqlstr,Conn,1,1
If Not Rs.Eof Then
	ModuleName=Rs("Fk_Module_Name")
	If Rs("Fk_Module_FixedUrl")<>"" Then
		ModuleUrl=Rs("Fk_Module_FixedUrl")
	Else
		ModuleUrl=Rs("Fk_Module_Url")
	End If
	ModuleLevelList=Rs("Fk_Module_LevelList")

	ModelId=Rs("Fk_Module_Model")
Else
	Rs.Close
	Call FKFun.ShowErr("菜单项不存在！",1)
End If
Rs.Close

Sqlstr="Select Fk_Model_ViewName,Fk_Model_Default,Fk_Model_Field From [Fk_Model] Where Fk_Model_Id=" & ModelId
Rs.Open Sqlstr,Conn,1,1
If Not Rs.Eof Then
	ModelName=Rs("Fk_Model_ViewName")
	ModelDefault=Rs("Fk_Model_Default")
	ModelField=Rs("Fk_Model_Field")
Else
	Rs.Close
	Call FKFun.ShowErr("模型不存在！",1)
End If
Rs.Close

Select Case Types
	Case 1
		Call ViewList() '内容列表
	Case 2
		Call ViewAddForm() '添加内容表单
	Case 3
		Call ViewAddDo() '执行添加内容
	Case 4
		Call ViewEditForm() '修改内容表单
	Case 5
		Call ViewEditDo() '执行修改内容
	Case 6
		Call ViewDelDo() '执行删除内容
	Case 7
		Call ViewBatchDelDo() '执行批量删除内容
	Case 8
		Call ViewBatchMoveDo() '执行批量移动内容
	Case Else
		Call FKFun.ShowErr("未发现功能项！",1)
End Select

'==========================================
'函 数 名：ViewList()
'作    用：内容列表
'==========================================
Sub ViewList()
	Dim vUrl,vOption,vColor,vTemp
	Dim Rs2
	Set Rs2=Server.Createobject("Adodb.RecordSet")
	
	SearchStr=FKFun.HTMLEncode(Trim(Request.QueryString("SearchStr")))
	PageNow=Request.QueryString("Page")
	If PageNow<>"" Then
		PageNow=Clng(PageNow)
	Else
		PageNow=1
	End If
	
	Set FKTemplate=New Cls_Template
	
	
	Response.Cookies("url_f02")=FKFun.GetNowUrl()
%>
		<div id="rightNav">
			<ul>
				<li><a href="View.asp?Type=2&Menu=<%=MenuId%>&Module=<%=ModuleId%>" target="dialog" width="970">添加内容</a></li>
			</ul>
		</div>
		<div id="searchLine" class="font_bold">
			“<%=ModuleName%>”<%=ModelName%>管理
			&nbsp;&nbsp;<input name="SearchStr" type="text" class="input" id="SearchStr" value="<%=SearchStr%>" />
			&nbsp;<input type="button" class="button" onclick="ajax_get('mainRight','View.asp?Type=1&Menu=<%=MenuId%>&Module=<%=ModuleId%>&SearchStr='+escape($('#SearchStr').val()));" name="s" Id="s" value="  查询  " />
		</div>
		<form id="TryBatch" name="TryBatch" method="post" target="ajax" action="" showStr="" refreshUrl="<%=Request.Cookies("url_f02")%>" confirmStr="">
		<table width="100%" bordercolor="#CCCCCC" border="1" cellspacing="0" cellpadding="0">
			<tr>
				<th align="center">序号</th>
				<th align="center">选</th>
				<th align="center">标题</th>
				<th align="center">访问量</th>
				<th align="center">添加时间</th>
				<th align="center">操作</th>
			</tr>
<%
	Sqlstr="Select Fk_View_Id,Fk_View_Title,Fk_View_Color,Fk_View_FixedUrl,Fk_View_Url,Fk_View_Pic,Fk_View_Recommend,Fk_View_Subject,Fk_View_Template,Fk_View_Link,Fk_View_Stick,Fk_View_Click,Fk_View_Time,Fk_Module_Url From [Fk_ViewList] Where Fk_View_Module="&ModuleId&""
	If SearchStr<>"" Then
		Sqlstr=Sqlstr&" And Fk_View_Title Like '%%"&SearchStr&"%%'"
	End If
	Sqlstr=Sqlstr&" Order By Fk_View_Id Desc"
	Rs.Open Sqlstr,Conn,1,1
	If Not Rs.Eof Then
		i=1+(PageNow-1)*PageSizes
		Rs.PageSize=PageSizes
		If PageNow>Rs.PageCount Or PageNow<=0 Then
			PageNow=1
		End If
		PageCounts=Rs.PageCount
		Rs.AbsolutePage=PageNow
		PageRecordCount=Rs.RecordCount
		j=1
		While (Not Rs.Eof) And j<PageSizes+1
			vOption=""
			If Rs("Fk_View_Color")<>"" Then
				vOption="&nbsp;&nbsp;<span title='标题颜色"&Rs("Fk_View_Color")&"' style='color:"&Rs("Fk_View_Color")&"'>■</span>"
			End If
			If Rs("Fk_View_Link")<>"" Then
				vUrl="#"
				vOption=vOption&"&nbsp;&nbsp;<span title='转向-"&Rs("Fk_View_Link")&"' style='color:#FF3300'>[转向]</span>"
			Else
				vUrl=FKTemplate.GetUrl(FullSiteDir,"",Rs("Fk_Module_Url"),Rs("Fk_View_Url"),FullHtmlSuffix,2,Rs("Fk_View_Id"),Rs("Fk_View_FixedUrl"))
			End If
			If Rs("Fk_View_Template")<>"" Then
				vOption=vOption&"&nbsp;&nbsp;<span title='自定义模板-"&Rs("Fk_View_Template")&"' style='color:#6633FF'>[自定义模板]</span>"
			End If
			If Rs("Fk_View_Pic")<>"" Then
				vOption=vOption&"&nbsp;&nbsp;<span title='此内容有题图' style='color:#6600CC'>[题图]</span>"
			End If
			If Rs("Fk_View_Stick")=1 Then
				vOption=vOption&"&nbsp;&nbsp;<span title='此内容有置顶' style='color:#3366FF'>[置顶]</span>"
			End If
			If Rs("Fk_View_Recommend")<>",," Then
				vTemp=""
				Sqlstr="Select Fk_Recommend_Name From [Fk_Recommend] Where Fk_Recommend_Id In (0"&Rs("Fk_View_Recommend")&"0)"
				Rs2.Open Sqlstr,Conn,1,1
				While Not Rs2.Eof
					vTemp=vTemp&Rs2("Fk_Recommend_Name")&"；"
					Rs2.MoveNext
				Wend
				Rs2.Close
				vOption=vOption&"&nbsp;&nbsp;<span title='"&vTemp&"' style='color:#FF6633'>[推荐]</span>"
			End If
			If Rs("Fk_View_Subject")<>",," Then
				vTemp=""
				Sqlstr="Select Fk_Subject_Name From [Fk_Subject] Where Fk_Subject_Id In (0"&Rs("Fk_View_Subject")&"0)"
				Rs2.Open Sqlstr,Conn,1,1
				While Not Rs2.Eof
					vTemp=vTemp&Rs2("Fk_Subject_Name")&"；"
					Rs2.MoveNext
				Wend
				Rs2.Close
				vOption=vOption&"&nbsp;&nbsp;<span title='"&vTemp&"' style='color:#0099CC'>[专题]</span>"
			End If
%>
			<tr>
				<td height="24" align="center"><%=i%></td>
				<td align="center"><input type="checkbox" name="ListId" class="input" value="<%=Rs("Fk_View_Id")%>" id="List<%=Rs("Fk_View_Id")%>" /></td>
				<td class="cur">&nbsp;&nbsp;<a href="<%=vUrl%>" target="_blank"><%=Rs("Fk_View_Title")%></a><%=vOption%></td>
				<td align="center"><%=Rs("Fk_View_Click")%>次</td>
				<td align="center"><%=Rs("Fk_View_Time")%></td>
				<td align="center"><a href="View.asp?Type=4&Menu=<%=MenuId%>&Module=<%=ModuleId%>&Id=<%=Rs("Fk_View_Id")%>" target="dialog" width="970">修改</a> <a href="View.asp?Type=6&Menu=<%=MenuId%>&Module=<%=ModuleId%>&Id=<%=Rs("Fk_View_Id")%>" target="delete" confirmStr="您确认要删除“<%=Rs("Fk_View_Title")%>”？此操作不可逆！" refreshUrl="<%=Request.Cookies("url_f02")%>" showStr="<%=ModelName%>删除成功！">删除</a></td>
			</tr>
<%
			Rs.MoveNext
			i=i+1
			j=j+1
		Wend
	Else
%>
			<tr>
				<td height="25" colspan="20" align="center">暂无记录</td>
			</tr>
<%
	End If
	Rs.Close
%>
			<tr>
				<td height="30" colspan="20">
					&nbsp;&nbsp;<input type="checkbox" name="chkall" class="input" id="chkall" value="select" onclick="CheckAll(this.form)"> 全选
					&nbsp;&nbsp;<input type="submit" value="删 除" class="button" onclick="batchDel();">
					&nbsp;&nbsp;<select name="BatchMoveTo" class="input" id="BatchMoveTo" onchange="batchMove($(this).val());">
						  <option value="">转移到</option>
<%
	Call GetModuleList(MenuId,0,"")
%>
					</select>
					&nbsp;&nbsp;<%Call FKFun.ShowPageCode("View.asp?Type=1&Menu="&MenuId&"&Module="&ModuleId&"&SearchStr="&Server.URLEncode(SearchStr)&"&Page=",PageNow,PageRecordCount,PageSizes,PageCounts)%>
				</td>
			</tr>
		</table>
		</form>
		<div id="rightBottom">
		
		</div>
<script type="text/javascript">
function batchDel(){
	$('#TryBatch').attr('confirmStr','此操作无法恢复！！！请慎重！！！\n\n确定要删除选中的记录吗？');
	$('#TryBatch').attr('showStr','批量删除成功！');
	$('#TryBatch').attr('action','View.asp?Type=7&Menu=<%=MenuId%>&Module=<%=ModuleId%>');
}
function batchMove(moduleId){
	if(moduleId==''){
		alert('请选择可以移动到的栏目！');
		return false;
	}
	$('#TryBatch').attr('confirmStr','确定要移动选中的记录吗？');
	$('#TryBatch').attr('showStr','批量移动成功！');
	$('#TryBatch').attr('action','View.asp?Type=8&Menu=<%=MenuId%>&Module=<%=ModuleId%>');
	$('#TryBatch').submit();
}
</script>
<%
End Sub

'==========================================
'函 数 名：GetModuleList()
'作    用：菜单项列表
'==========================================
Function GetModuleList(gMenu,gModule,gTitle)
	Dim Rst,tryTitle,cMoveTo,cMoveToId
	Set Rst=Server.Createobject("Adodb.RecordSet")
	If gTitle="" Then
		tryTitle="&nbsp;&nbsp;&nbsp;├"
	Else
		tryTitle="&nbsp;&nbsp;&nbsp;"&gTitle
	End If
	Sqlstr="Select Fk_Module_Id,Fk_Module_Name,Fk_Module_Model From [Fk_Module] Where Fk_Module_Menu="&gMenu&" And Fk_Module_Level="&gModule&" Order By Fk_Module_Order Asc,Fk_Module_Id Asc"
	Rst.Open Sqlstr,Conn,1,1
	If Not Rst.Eof Then
		i=1
		While Not Rst.Eof
			If ModelId=Rst("Fk_Module_Model") Then
				cMoveTo="[√]"
				cMoveToId=Rst("Fk_Module_Id")
			Else
				cMoveTo=""
				cMoveToId=""
			End If
%>
						  <option value="<%=cMoveToId%>"><%=gTitle&Rst("Fk_Module_Name")%><%=cMoveTo%></option>
<%
			Call GetModuleList(gMenu,Rst("Fk_Module_Id"),tryTitle)
			Rst.MoveNext
			i=i+1
		Wend
	End If
	Rst.Close
End Function

'==========================================
'函 数 名：ViewAddForm()
'作    用：添加内容表单
'==========================================
Sub ViewAddForm()
	TempArr=Split(ModelField,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Type=FKFun.GetSub(Temp,"Field_Type:","|;|","")
			Select Case Field_Type
				Case "0"
					If FieldArr_Input="" Then
						FieldArr_Input=Temp
					Else
						FieldArr_Input=FieldArr_Input&"|FieldList|"&Temp
					End If
				Case "1"
					If FieldArr_Editor="" Then
						FieldArr_Editor=Temp
					Else
						FieldArr_Editor=FieldArr_Editor&"|FieldList|"&Temp
					End If
				Case "2"
					If FieldArr_Upload="" Then
						FieldArr_Upload=Temp
					Else
						FieldArr_Upload=FieldArr_Upload&"|FieldList|"&Temp
					End If
				Case "3"
					If FieldArr_Select="" Then
						FieldArr_Select=Temp
					Else
						FieldArr_Select=FieldArr_Select&"|FieldList|"&Temp
					End If
			End Select
		End If
	Next

	Sqlstr="Select Fk_Template_Name From [Fk_Template] Where Not (Fk_Template_Name Like 'm_%%' Or Fk_Template_Name Like '%%/m_%%') Order By Fk_Template_Id Asc"
	Rs.Open Sqlstr,Conn,1,1
	While Not Rs.Eof
		If Instr(Rs("Fk_Template_Name"),"/")>0 Then
			TempArr=Split(Rs("Fk_Template_Name"),"/")
			Temp=","&TempArr(UBound(TempArr))&","
		Else
			Temp=","&Rs("Fk_Template_Name")&","
		End If
		If Instr(DisTemplate,Temp)=0 Then
			If TemplateSelect="" Then
				TemplateSelect=Rs("Fk_Template_Name")
			Else
				TemplateSelect=TemplateSelect&",,"&Rs("Fk_Template_Name")
			End If
		End If
		Rs.MoveNext
	Wend
	Rs.Close
%>
<form id="ViewAdd" name="ViewAdd" method="post" target="ajax" action="View.asp?Type=3&Menu=<%=MenuId%>&Module=<%=ModuleId%>" showStr="新<%=ModelName%>添加成功！" refreshUrl="View.asp?Type=1&Menu=<%=MenuId%>&Module=<%=ModuleId%>" boxClose="1">
<div id="title">添加新<%=ModelName%></div>
<div id="box">
	<ul class="dialogNav">
    	<li class="check bnr" id="s1" onclick="bnav('1');">常规</li>
    	<li class="bnr" id="s2" onclick="bnav('2');">其他</li>
		<div class="cal"></div>
    </ul>
	<div class="cal"></div>
    <!--常规-->
	<table width="90%" id="t1" class="t" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td width="12%" height="30" align="right">标题：</td>
			<td width="88%"><div class="fleft">&nbsp;<input name="Fk_View_Title" type="text" class="input" id="Fk_View_Title" size="50" />&nbsp;&nbsp;</div><div class="fleft"><div id="colorSelector"><div style="background-color:"></div><input type="hidden" name="Fk_View_Color" id="Fk_View_Color" /></div></div><span class="help" title="<p><%=ModelName%>标题，请输入1-255个字符（两个字符为一个汉字）。选取颜色请在选色板上左键点击拖动。</p>"></span><div class="cal"></div></td>
		</tr>
        <tr>
            <td height="30" align="right">关键字：</td>
            <td>&nbsp;<input name="Fk_View_Keyword" type="text" class="input" id="Fk_View_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_View_Description" type="text" class="input" id="Fk_View_Description" size="50" /><span class="help" title="<p>请输入<%=ModelName%>的一段文字描述，用于页面meta的description，请输入1-255个字符（两个字符为一个汉字）。</p>"></span></td>
        </tr>
        <tr<%If Instr(ModelDefault,",1,")=0 Then%> class="dis"<%End If%>>
            <td height="30" align="right">题图：</td>
            <td class="picList_td">
                <div id="viewPicList" class="cal"></div>
                <input type="hidden" name="Fk_View_Pic" id="Fk_View_Pic" />
                <input type="hidden" name="Fk_View_PicBig" id="Fk_View_PicBig" />
                <input type="button" class="picList_btn btnUpload" name="btnPic" id="btnPic" value="上传图片" callback="1" /></td>
            </td>
        </tr>
        <tr<%If Instr(ModelDefault,",2,")=0 Then%> class="dis"<%End If%>>
            <td height="30" align="right">绝对路径：</td>
            <td>&nbsp;<input name="Fk_View_FixedUrl" type="text" class="input" id="Fk_View_FixedUrl" size="30" /> *设定后无法修改<span class="help" title="<p>绝对路径，请输入1-255个字符，设定后将忽略文件名设置，必须带文件类型后缀。</p>"></span></td>
        </tr>
        <tr<%If Instr(ModelDefault,",2,")=0 Then%> class="dis"<%End If%>>
            <td height="30" align="right">文件名：</td>
            <td>&nbsp;<input name="Fk_View_FileName" type="text" class="input" id="Fk_View_FileName" size="30" /> *设定后不可修改<span class="help" title="<p>文件名，请输入1-50个字符，必须是字母或数字。</p>"></span></td>
        </tr>
<%
	TempArr=Split(FieldArr_Input,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Name=FKFun.GetSub(Temp,"Field_Name:","|;|","")
			Field_Label=FKFun.GetSub(Temp,"Field_Label:","|;|","")
			Field_Help=FKFun.GetSub(Temp,"Field_Help:","|;|","")
			Call FKFun.GetField_Input(Field_Name,Field_Label,Field_Help,"")
		End If
	Next

	TempArr=Split(FieldArr_Select,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Name=FKFun.GetSub(Temp,"Field_Name:","|;|","")
			Field_Label=FKFun.GetSub(Temp,"Field_Label:","|;|","")
			Field_Help=FKFun.GetSub(Temp,"Field_Help:","|;|","")
			Field_Option=FKFun.GetSub(Temp,"Field_Option:","|;|","")
			Call FKFun.GetField_Select(Field_Name,Field_Label,Field_Help,Field_Option,"")
		End If
	Next

	TempArr=Split(FieldArr_Upload,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Name=FKFun.GetSub(Temp,"Field_Name:","|;|","")
			Field_Label=FKFun.GetSub(Temp,"Field_Label:","|;|","")
			Field_Help=FKFun.GetSub(Temp,"Field_Help:","|;|","")
			Call FKFun.GetField_Upload(Field_Name,Field_Label,Field_Help,"")
		End If
	Next
%>
		<tr>
			<td height="30" align="right">是否显示：</td>
            <td>&nbsp;<input type="radio" name="Fk_View_Show" class="input" id="Fk_View_Show" value="0" />不显示
				<input type="radio" name="Fk_View_Show" class="input" id="Fk_View_Show" value="1" checked="checked" />显示<span class="help" title="<p>配置该<%=ModelName%>是否在前台显示。</p>"></span>
			</td>
		</tr>
		<tr>
			<td height="30" align="right">显示模板：</td>
            <td>&nbsp;<select class="input" name="Fk_View_Template" id="Fk_View_Template">
					<option value="">默认模板</option>
<%
	TempArr=Split(TemplateSelect,",,")
	For Each Temp In TempArr
%>
					<option value="<%=Temp%>"><%=Temp%></option>
<%
	Next
%>
				</select><span class="help" title="<p>选择显示模板。</p>"></span>
			</td>
		</tr>
		<tr>
			<td height="30" align="right">内容：</td>
            <td>
<%
	If Fk_Site_Editor=0 Then
%>
				<textarea name="Fk_View_Content" id="Fk_View_Content" class="xheditor" rows="20" style="width:100%;"></textarea>
<%
	ElseIf Fk_Site_Editor=1 Then
%>
				<textarea name="Fk_View_Content" id="Fk_View_Content" class="ueditor" style="width:740px;height:300px;"></textarea>
				<script type="text/javascript">  
					UE.getEditor('Fk_View_Content');
				</script>
<%
	End If
%>
			</td>
		</tr>
<%
	TempArr=Split(FieldArr_Editor,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Name=FKFun.GetSub(Temp,"Field_Name:","|;|","")
			Field_Label=FKFun.GetSub(Temp,"Field_Label:","|;|","")
			Field_Help=FKFun.GetSub(Temp,"Field_Help:","|;|","")
			Call FKFun.GetField_Editor(Field_Name,Field_Label,Field_Help,"")
		End If
	Next
%>
	</table>
    <!--其他-->
	<table width="95%" id="t2" class="t dis" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td width="12%" height="30" align="right">推荐：</td>
			<td width="44%">&nbsp;<select name="Fk_View_Recommend" class="textarea" size="10" multiple="multiple" id="Fk_View_Recommend">
					<option value="">无推荐</option>
<%
	Sqlstr="Select Fk_Recommend_Id,Fk_Recommend_Name From [Fk_Recommend] Order By Fk_Recommend_Id Desc"
	Rs.Open Sqlstr,Conn,1,1
	While Not Rs.Eof
%>
					<option value="<%=Rs("Fk_Recommend_Id")%>"><%=Rs("Fk_Recommend_Name")%></option>
<%
		Rs.MoveNext
	Wend
	Rs.Close
%>
				</select><span class="help" title="<p>选择所属推荐，可按住CTRL键用鼠标左键多选。</p>"></span>
			</td>
			<td width="12%" align="right">专题：</td>
			<td width="44%">&nbsp;<select name="Fk_View_Subject" class="textarea" size="10" multiple="multiple" id="Fk_View_Subject">
					<option value="">无专题</option>
<%
	Sqlstr="Select Fk_Subject_Id,Fk_Subject_Name From [Fk_Subject] Order By Fk_Subject_Id Desc"
	Rs.Open Sqlstr,Conn,1,1
	While Not Rs.Eof
%>
					<option value="<%=Rs("Fk_Subject_Id")%>"><%=Rs("Fk_Subject_Name")%></option>
<%
		Rs.MoveNext
	Wend
	Rs.Close
%>
				</select><span class="help" title="<p>选择所属专题，可按住CTRL键用鼠标左键多选。</p>"></span>
			</td>
        </tr>
		<tr>
			<td height="30" align="right">是否置顶：</td>
            <td>&nbsp;<input type="radio" name="Fk_View_Stick" class="input" id="Fk_View_Stick" value="0" checked="checked" />不置顶
				<input type="radio" name="Fk_View_Stick" class="input" id="Fk_View_Stick" value="1" />置顶<span class="help" title="<p>配置该<%=ModelName%>是否置顶。</p>"></span>
			</td>
		</tr>
        <tr>
            <td height="30" align="right">添加时间：</td>
			<td width="88%" colspan="3">&nbsp;<input name="Fk_View_Time" type="text" class="input" id="Fk_View_Time" value="<%=Now()%>" /><span class="help" title="<p>添加时间，请按结构填写。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">转向链接：</td>
			<td width="88%" colspan="3">&nbsp;<input name="Fk_View_Link" type="text" class="input" id="Fk_View_Link" size="50" /><span class="help" title="<p>转向链接。</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(){
	$('#colorSelector').ColorPicker({
		color: '',
		onShow: function (colpkr) {
			$(colpkr).fadeIn(500);
			return false;
		},
		onHide: function (colpkr) {
			$(colpkr).fadeOut(500);
			return false;
		},
		onChange: function (hsb, hex, rgb) {
			$('#colorSelector div').css('backgroundColor', '#'+hex);
			if(hex=='000000'){
				$('#Fk_View_Color').val('');
			}else{
				$('#Fk_View_Color').val('#'+hex);
			}
		}
	});
});
</script>
<%
End Sub

'==============================
'函 数 名：ViewAddDo
'作    用：执行添加名称
'==============================
Sub ViewAddDo()
	Fk_View_Title=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_Title")))
	Fk_View_Color=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_Color")))
	Fk_View_Keyword=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_Keyword")))
	Fk_View_Description=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_Description")))
	Fk_View_PicList=FKFun.HTMLEncode(Trim(Replace(Request.Form("Fk_View_PicList"),", ","")))
	Fk_View_Pic=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_Pic")))
	Fk_View_PicBig=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_PicBig")))
	Fk_View_FixedUrl=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_FixedUrl")))
	Fk_View_FileName=Server.URLEncode(FKFun.HTMLEncode(Trim(Request.Form("Fk_View_FileName"))))
	Fk_View_Template=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_Template")))
	Fk_View_Link=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_Link")))
	Fk_View_Content=FKFun.EditorImgTry(Request.Form("Fk_View_Content"))
	Fk_View_Recommend=FKFun.HTMLEncode(Trim(Replace(Request.Form("Fk_View_Recommend")," ","")))
	Fk_View_Subject=FKFun.HTMLEncode(Trim(Replace(Request.Form("Fk_View_Subject")," ","")))
	Fk_View_Time=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_Time")))
	Fk_View_Show=Trim(Request.Form("Fk_View_Show"))
	Fk_View_Stick=Trim(Request.Form("Fk_View_Stick"))
	TempArr=Split(ModelField,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Type=FKFun.GetSub(Temp,"Field_Type:","|;|","")
			Field_Label=FKFun.GetSub(Temp,"Field_Label:","|;|","")
			If Field_Type="1" Then
				Field_Content=FKFun.EditorImgTry(Trim(Request.Form("Fk_Field_"&Field_Label&"")))
				Field_Content=Replace(Field_Content,"'","&#39;")
			Else
				Field_Content=FKFun.HTMLEncode(Trim(Request.Form("Fk_Field_"&Field_Label&"")))
			End If
			Field_Content=Replace(Field_Content,"_Field_Get:","&nbsp;_Field_Get")
			Field_Content=Replace(Field_Content,"Get_Field_Line:","&nbsp;Get_Field_Line")
			Fk_View_Field=Fk_View_Field&Field_Label&"_Field_Get:"&Field_Content&"|Get_Field_Line|"
		End If
	Next
	If IsNumeric(Fk_View_FileName) Then
		Call FKFun.JsonError("文件名不能为纯数字！")
	End If
	If Fk_View_Time="" Then
		Fk_View_Time=Now()
	Else
		If Not IsDate(Fk_View_Time) Then
			Call FKFun.JsonError("添加时间格式有误！")
		End If
	End If
	Call FKFun.JsonString(Fk_View_Title,1,50,0,"请输入标题！","标题不能大于50个字符！")
	Call FKFun.JsonString(Fk_View_Color,1,50,2,"请输入标题颜色！","标题颜色不能大于50个字符！")
	Call FKFun.JsonString(Fk_View_Keyword,1,255,2,"请输入关键字！","关键字不能大于255个字符！")
	Call FKFun.JsonString(Fk_View_Description,1,255,2,"请输入描述！","描述不能大于255个字符！")
	Call FKFun.JsonString(Fk_View_FixedUrl,1,255,2,"请输入绝对路径！","绝对路径不能大于255个字符！")
	Call FKFun.JsonString(Fk_View_FileName,1,50,2,"请输入文件名！","文件名不能大于50个字符！")
	Call FKFun.JsonString(Fk_View_Link,1,255,2,"请输入转向链接！","转向链接不能大于255个字符！")
	Call FKFun.JsonString(Fk_View_Content,1,50,1,"请输入内容！","内容不能大于50个字符！")
	Call FKFun.JsonNum(Fk_View_Show,"请选择是否显示！")
	Call FKFun.JsonNum(Fk_View_Stick,"请选择是否置顶！")
	
	'绝对路径格式判断
	If Fk_View_FixedUrl<>"" Then
		If Instr(Fk_View_FixedUrl,".")=0 Then '判断后缀是否存在
			Call FKFun.JsonError("绝对路径必须带文件类型后缀！")
		Else
			'文件名安全判别
			If (Len(Fk_View_FixedUrl)-Len(Replace(Fk_View_FixedUrl,".","")))>1 Then
				Call FKFun.JsonError("绝对路径只能有一个“.”符号！")
			End If
			If Instr(",.html,",","&Right(Fk_View_FixedUrl,5)&",")=0 And Instr(",.xml,.htm,",","&Right(Fk_View_FixedUrl,4)&",")=0 And Instr(",.shtml,",","&Right(Fk_View_FixedUrl,6)&",")=0 Then
				Call FKFun.JsonError("后缀只能是.html/.htm/.xml/.shtml中的一种！")
			End If
		End If
	End If
	
	If Fk_View_FileName<>"" Then
		Fk_View_Url=Fk_View_FileName
	End If
	Fk_View_Recommend=","&Fk_View_Recommend&","
	Fk_View_Subject=","&Fk_View_Subject&","
	Sqlstr="Select Fk_View_Id,Fk_View_Title,Fk_View_Color,Fk_View_Keyword,Fk_View_Description,Fk_View_Content,Fk_View_Url,Fk_View_PicList,Fk_View_Pic,Fk_View_PicBig,Fk_View_Menu,Fk_View_Module,Fk_View_Click,Fk_View_FixedUrl,Fk_View_FileName,Fk_View_Recommend,Fk_View_Subject,Fk_View_Field,Fk_View_Template,Fk_View_Show,Fk_View_Link,Fk_View_Stick,Fk_View_Order,Fk_View_ToHtml,Fk_View_Admin,Fk_View_Ip,Fk_View_Time From [Fk_View] Where (Fk_View_Title='"&Fk_View_Title&"' And Fk_View_Module="&ModuleId&")"
	If Fk_View_FileName<>"" Then
		Sqlstr=Sqlstr&" Or (Fk_View_FileName='"&Fk_View_FileName&"' And Fk_View_Module="&ModuleId&")"
	End If
	Rs.Open Sqlstr,Conn,1,3
	If Rs.Eof Then
		Application.Lock()
		Rs.AddNew()
		Rs("Fk_View_Title")=Fk_View_Title
		Rs("Fk_View_Color")=Fk_View_Color
		Rs("Fk_View_Keyword")=Fk_View_Keyword
		Rs("Fk_View_Description")=Fk_View_Description
		Rs("Fk_View_Content")=Fk_View_Content
		Rs("Fk_View_Url")=Fk_View_Url
		Rs("Fk_View_PicList")=Fk_View_PicList
		Rs("Fk_View_Pic")=Fk_View_Pic
		Rs("Fk_View_PicBig")=Fk_View_PicBig
		Rs("Fk_View_Menu")=MenuId
		Rs("Fk_View_Module")=ModuleId
		Rs("Fk_View_Click")=0
		Rs("Fk_View_FixedUrl")=Fk_View_FixedUrl
		Rs("Fk_View_FileName")=Fk_View_FileName
		Rs("Fk_View_Recommend")=Fk_View_Recommend
		Rs("Fk_View_Subject")=Fk_View_Subject
		Rs("Fk_View_Field")=Fk_View_Field
		Rs("Fk_View_Template")=Fk_View_Template
		Rs("Fk_View_Show")=Fk_View_Show
		Rs("Fk_View_Link")=Fk_View_Link
		Rs("Fk_View_Stick")=Fk_View_Stick
		Rs("Fk_View_Order")=0
		Rs("Fk_View_ToHtml")=1
		Rs("Fk_View_Admin")=UId
		Rs("Fk_View_Ip")=Request.ServerVariables("REMOTE_ADDR")
		Rs("Fk_View_Time")=Fk_View_Time
		Rs.Update()
		If Fk_View_Url="" Then
			Rs.Close
			Sqlstr="Select Fk_View_Id,Fk_View_Url From [Fk_View] Where Fk_View_Title='"&Fk_View_Title&"' And Fk_View_Module="&ModuleId&""
			Rs.Open Sqlstr,Conn,1,3
			If Not Rs.Eof Then
				Fk_View_Url=Rs("Fk_View_Id")
				Rs("Fk_View_Url")=Fk_View_Url
				Rs.Update()
			End If
		End If
		If Fk_Site_Html=2 Then
			Sqlstr="Update [Fk_Module] Set Fk_Module_ToHtml=1 Where Fk_Module_Id In (0"&ModuleLevelList&ModuleId&")"
			Conn.Execute(Sqlstr)
			If Fk_View_Subject<>",," Then
				Sqlstr="Update [Fk_Subject] Set Fk_Subject_ToHtml=1 Where Fk_Subject_Id In (0"&Fk_View_Subject&"0)"
				Conn.Execute(Sqlstr)
			End If
		End If
		Application.UnLock()
		Call FKFun.JsonSuccess()
	Else
		Rs.Close
		Call FKFun.JsonError("该"&ModelName&"标题已经被占用！")
	End If
	Rs.Close
End Sub

'==========================================
'函 数 名：ViewEditForm()
'作    用：修改内容表单
'==========================================
Sub ViewEditForm()
	Dim TempArr2
	Id=Clng(Request.QueryString("Id"))
	Sqlstr="Select Fk_View_Title,Fk_View_Color,Fk_View_Keyword,Fk_View_Description,Fk_View_Content,Fk_View_PicList,Fk_View_Pic,Fk_View_PicBig,Fk_View_FixedUrl,Fk_View_FileName,Fk_View_Recommend,Fk_View_Subject,Fk_View_Field,Fk_View_Template,Fk_View_Show,Fk_View_Link,Fk_View_Stick,Fk_View_Time From [Fk_View] Where Fk_View_Module="&ModuleId&" And Fk_View_Id=" & Id
	Rs.Open Sqlstr,Conn,1,1
	If Not Rs.Eof Then
		Fk_View_Title=Rs("Fk_View_Title")
		Fk_View_Color=Rs("Fk_View_Color")
		Fk_View_Keyword=Rs("Fk_View_Keyword")
		Fk_View_Description=Rs("Fk_View_Description")
		Fk_View_Content=Rs("Fk_View_Content")
		Fk_View_PicList=Rs("Fk_View_PicList")
		Fk_View_Pic=Rs("Fk_View_Pic")
		Fk_View_PicBig=Rs("Fk_View_PicBig")
		Fk_View_FixedUrl=Rs("Fk_View_FixedUrl")
		Fk_View_FileName=Rs("Fk_View_FileName")
		Fk_View_Recommend=Rs("Fk_View_Recommend")
		Fk_View_Subject=Rs("Fk_View_Subject")
		Fk_View_Field=Rs("Fk_View_Field")
		Fk_View_Template=Rs("Fk_View_Template")
		Fk_View_Show=Rs("Fk_View_Show")
		Fk_View_Link=Rs("Fk_View_Link")
		Fk_View_Stick=Rs("Fk_View_Stick")
		Fk_View_Time=Rs("Fk_View_Time")
	Else
		Rs.Close
		Call FKFun.ShowErr(ModelName&"不存在！",1)
	End If
	Rs.Close
	TempArr=Split(ModelField,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Type=FKFun.GetSub(Temp,"Field_Type:","|;|","")
			Select Case Field_Type
				Case "0"
					If FieldArr_Input="" Then
						FieldArr_Input=Temp
					Else
						FieldArr_Input=FieldArr_Input&"|FieldList|"&Temp
					End If
				Case "1"
					If FieldArr_Editor="" Then
						FieldArr_Editor=Temp
					Else
						FieldArr_Editor=FieldArr_Editor&"|FieldList|"&Temp
					End If
				Case "2"
					If FieldArr_Upload="" Then
						FieldArr_Upload=Temp
					Else
						FieldArr_Upload=FieldArr_Upload&"|FieldList|"&Temp
					End If
				Case "3"
					If FieldArr_Select="" Then
						FieldArr_Select=Temp
					Else
						FieldArr_Select=FieldArr_Select&"|FieldList|"&Temp
					End If
			End Select
		End If
	Next

	Sqlstr="Select Fk_Template_Name From [Fk_Template] Where Not (Fk_Template_Name Like 'm_%%' Or Fk_Template_Name Like '%%/m_%%') Order By Fk_Template_Id Asc"
	Rs.Open Sqlstr,Conn,1,1
	While Not Rs.Eof
		If Instr(Rs("Fk_Template_Name"),"/")>0 Then
			TempArr=Split(Rs("Fk_Template_Name"),"/")
			Temp=","&TempArr(UBound(TempArr))&","
		Else
			Temp=","&Rs("Fk_Template_Name")&","
		End If
		If Instr(DisTemplate,Temp)=0 Then
			If TemplateSelect="" Then
				TemplateSelect=Rs("Fk_Template_Name")
			Else
				TemplateSelect=TemplateSelect&",,"&Rs("Fk_Template_Name")
			End If
		End If
		Rs.MoveNext
	Wend
	Rs.Close
%>
<form id="ViewEdit" name="ViewEdit" method="post" target="ajax" action="View.asp?Type=5&Menu=<%=MenuId%>&Module=<%=ModuleId%>" showStr="<%=ModelName%>修改成功！" refreshUrl="<%=Request.Cookies("url_f02")%>" boxClose="1">
<div id="title">修改<%=ModelName%></div>
<div id="box">
	<ul class="dialogNav">
    	<li class="check bnr" id="s1" onclick="bnav('1');">常规</li>
    	<li class="bnr" id="s2" onclick="bnav('2');">其他</li>
		<div class="cal"></div>
    </ul>
	<div class="cal"></div>
    <!--常规-->
	<table width="90%" id="t1" class="t" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td width="12%" height="30" align="right">标题：</td>
			<td width="88%"><div class="fleft">&nbsp;<input name="Fk_View_Title" type="text" class="input" id="Fk_View_Title" value="<%=Fk_View_Title%>" size="50" />&nbsp;&nbsp;</div><div class="fleft"><div id="colorSelector"><div style="background-color:<%=Fk_View_Color%>"></div><input type="hidden" name="Fk_View_Color" id="Fk_View_Color" /></div></div><span class="help" title="<p><%=ModelName%>标题，请输入1-255个字符（两个字符为一个汉字）。选取颜色请在选色板上左键点击拖动。</p>"></span><div class="cal"></div></td>
		</tr>
        <tr>
            <td height="30" align="right">关键字：</td>
            <td>&nbsp;<input name="Fk_View_Keyword" type="text" class="input" id="Fk_View_Keyword" value="<%=Fk_View_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_View_Description" type="text" class="input" id="Fk_View_Description" value="<%=Fk_View_Description%>" size="50" /><span class="help" title="<p>请输入菜单项的一段文字描述，用于页面meta的description，请输入1-255个字符（两个字符为一个汉字）。</p>"></span></td>
        </tr>
        <tr<%If Instr(ModelDefault,",1,")=0 Then%> class="dis"<%End If%>>
            <td height="30" align="right">题图：</td>
            <td class="picList_td">
<%
	If Fk_View_PicList<>"" Then
		TempArr=Split(Fk_View_PicList,"|-_-|")
		Response.Write("<script type=""text/javascript"">")
		For Each Temp In TempArr
			If Temp<>"" Then
				TempArr2=Split(Temp,"||")
				If Fk_View_Pic=TempArr2(0) Then
					i=1
				Else
					i=0
				End If
				Response.Write("uploadPicList_Show('"&TempArr2(0)&"||"&TempArr2(1)&"','"&TempArr2(2)&"',"&i&");"&vbCrLf)
			End If
		Next
		Response.Write("</script>")
	End If
%>
                <div id="viewPicList" class="cal"></div>
                <input type="hidden" name="Fk_View_Pic" id="Fk_View_Pic" value="<%=Fk_View_Pic%>" />
                <input type="hidden" name="Fk_View_PicBig" id="Fk_View_PicBig" value="<%=Fk_View_PicBig%>" />
                <input type="button" class="picList_btn btnUpload" name="btnPic" id="btnPic" value="上传图片" callback="1" /></td>
            </td>
        </tr>
        <tr<%If Instr(ModelDefault,",2,")=0 Then%> class="dis"<%End If%>>
            <td height="30" align="right">绝对路径：</td>
            <td>&nbsp;<input name="Fk_View_FixedUrl" type="text" class="input" id="Fk_View_FixedUrl" value="<%=Fk_View_FixedUrl%>" size="30"<%If Fk_View_FixedUrl<>"" Then%> readonly="readonly"<%End If%> /> *设定后无法修改<span class="help" title="<p>绝对路径，请输入1-255个字符，设定后将忽略文件名设置，必须带文件类型后缀。</p>"></span></td>
        </tr>
        <tr<%If Instr(ModelDefault,",2,")=0 Then%> class="dis"<%End If%>>
            <td height="30" align="right">文件名：</td>
            <td>&nbsp;<input name="Fk_View_FileName" type="text" class="input" id="Fk_View_FileName" value="<%=Fk_View_FileName%>" size="30"<%If Fk_View_FileName<>"" Then%> readonly="readonly"<%End If%> /> *设定后不可修改<span class="help" title="<p>文件名，请输入1-50个字符，必须是字母或数字。</p>"></span></td>
        </tr>
<%
	TempArr=Split(FieldArr_Input,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Name=FKFun.GetSub(Temp,"Field_Name:","|;|","")
			Field_Label=FKFun.GetSub(Temp,"Field_Label:","|;|","")
			Field_Help=FKFun.GetSub(Temp,"Field_Help:","|;|","")
			Field_Content=FKFun.GetSub(Fk_View_Field,Field_Label&"_Field_Get:","|Get_Field_Line|","")
			Call FKFun.GetField_Input(Field_Name,Field_Label,Field_Help,Field_Content)
		End If
	Next
	TempArr=Split(FieldArr_Select,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Name=FKFun.GetSub(Temp,"Field_Name:","|;|","")
			Field_Label=FKFun.GetSub(Temp,"Field_Label:","|;|","")
			Field_Help=FKFun.GetSub(Temp,"Field_Help:","|;|","")
			Field_Option=FKFun.GetSub(Temp,"Field_Option:","|;|","")
			Field_Content=FKFun.GetSub(Fk_View_Field,Field_Label&"_Field_Get:","|Get_Field_Line|","")
			Call FKFun.GetField_Select(Field_Name,Field_Label,Field_Help,Field_Option,Field_Content)
		End If
	Next

	TempArr=Split(FieldArr_Upload,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Name=FKFun.GetSub(Temp,"Field_Name:","|;|","")
			Field_Label=FKFun.GetSub(Temp,"Field_Label:","|;|","")
			Field_Help=FKFun.GetSub(Temp,"Field_Help:","|;|","")
			Field_Content=FKFun.GetSub(Fk_View_Field,Field_Label&"_Field_Get:","|Get_Field_Line|","")
			Call FKFun.GetField_Upload(Field_Name,Field_Label,Field_Help,Field_Content)
		End If
	Next
%>
		<tr>
			<td height="30" align="right">是否显示：</td>
            <td>&nbsp;<input type="radio" name="Fk_View_Show" class="input" id="Fk_View_Show" value="0"<%=FKFun.BeCheck(Fk_View_Show,0)%> />不显示
				<input type="radio" name="Fk_View_Show" class="input" id="Fk_View_Show" value="1"<%=FKFun.BeCheck(Fk_View_Show,1)%> />显示<span class="help" title="<p>配置该<%=ModelName%>是否在前台显示。</p>"></span>
			</td>
		</tr>
		<tr>
			<td height="30" align="right">显示模板：</td>
            <td>&nbsp;<select class="input" name="Fk_View_Template" id="Fk_View_Template">
					<option value="">默认模板</option>
<%
	TempArr=Split(TemplateSelect,",,")
	For Each Temp In TempArr
%>
					<option value="<%=Temp%>"<%=FKFun.BeSelect(Fk_View_Template,Temp)%>><%=Temp%></option>
<%
	Next
%>
				</select><span class="help" title="<p>选择显示模板。</p>"></span>
			</td>
		</tr>
		<tr>
			<td height="30" align="right">内容：</td>
            <td>
<%
	If Fk_Site_Editor=0 Then
%>
				<textarea name="Fk_View_Content" id="Fk_View_Content" class="xheditor" rows="20" style="width:100%;"><%=Fk_View_Content%></textarea>
<%
	ElseIf Fk_Site_Editor=1 Then
%>
				<textarea name="Fk_View_Content" id="Fk_View_Content" class="ueditor" style="width:740px;height:300px;"><%=Fk_View_Content%></textarea>
				<script type="text/javascript">  
					UE.getEditor('Fk_View_Content');
				</script>
<%
	End If
%>
			</td>
		</tr>
<%
	TempArr=Split(FieldArr_Editor,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Name=FKFun.GetSub(Temp,"Field_Name:","|;|","")
			Field_Label=FKFun.GetSub(Temp,"Field_Label:","|;|","")
			Field_Help=FKFun.GetSub(Temp,"Field_Help:","|;|","")
			Field_Content=FKFun.GetSub(Fk_View_Field,Field_Label&"_Field_Get:","|Get_Field_Line|","")
			Call FKFun.GetField_Editor(Field_Name,Field_Label,Field_Help,Field_Content)
		End If
	Next
%>
	</table>
    <!--其他-->
	<table width="95%" id="t2" class="t dis" border="1" bordercolor="#CCCCCC" align="center" cellpadding="0" cellspacing="0">
        <tr>
            <td width="12%" height="30" align="right">推荐：</td>
			<td width="44%">&nbsp;<select name="Fk_View_Recommend" class="textarea" size="10" multiple="multiple" id="Fk_View_Recommend">
					<option value="">无推荐</option>
<%
	Sqlstr="Select Fk_Recommend_Id,Fk_Recommend_Name From [Fk_Recommend] Order By Fk_Recommend_Id Desc"
	Rs.Open Sqlstr,Conn,1,1
	While Not Rs.Eof
%>
					<option value="<%=Rs("Fk_Recommend_Id")%>"<%If Instr(Fk_View_Recommend,","&Rs("Fk_Recommend_Id")&",")>0 Then%> selected="selected"<%End If%>><%=Rs("Fk_Recommend_Name")%></option>
<%
		Rs.MoveNext
	Wend
	Rs.Close
%>
				</select><span class="help" title="<p>选择所属推荐，可按住CTRL键用鼠标左键多选。</p>"></span>
			</td>
			<td width="12%" align="right">专题：</td>
			<td width="44%">&nbsp;<select name="Fk_View_Subject" class="textarea" size="10" multiple="multiple" id="Fk_View_Subject">
					<option value="">无专题</option>
<%
	Sqlstr="Select Fk_Subject_Id,Fk_Subject_Name From [Fk_Subject] Order By Fk_Subject_Id Desc"
	Rs.Open Sqlstr,Conn,1,1
	While Not Rs.Eof
%>
					<option value="<%=Rs("Fk_Subject_Id")%>"<%If Instr(Fk_View_Subject,","&Rs("Fk_Subject_Id")&",")>0 Then%> selected="selected"<%End If%>><%=Rs("Fk_Subject_Name")%></option>
<%
		Rs.MoveNext
	Wend
	Rs.Close
%>
				</select><span class="help" title="<p>选择所属专题，可按住CTRL键用鼠标左键多选。</p>"></span>
			</td>
        </tr>
		<tr>
			<td height="30" align="right">是否置顶：</td>
            <td>&nbsp;<input type="radio" name="Fk_View_Stick" class="input" id="Fk_View_Stick" value="0"<%=FKFun.BeCheck(Fk_View_Stick,0)%> />不置顶
				<input type="radio" name="Fk_View_Stick" class="input" id="Fk_View_Stick" value="1"<%=FKFun.BeCheck(Fk_View_Stick,1)%> />置顶<span class="help" title="<p>配置该<%=ModelName%>是否置顶。</p>"></span>
			</td>
		</tr>
        <tr>
            <td height="30" align="right">添加时间：</td>
			<td width="88%" colspan="3">&nbsp;<input name="Fk_View_Time" type="text" class="input" id="Fk_View_Time" value="<%=Fk_View_Time%>" /><span class="help" title="<p>添加时间，请按结构填写。</p>"></span></td>
        </tr>
        <tr>
            <td height="30" align="right">转向链接：</td>
			<td width="88%" colspan="3">&nbsp;<input name="Fk_View_Link" type="text" class="input" id="Fk_View_Link" value="<%=Fk_View_Link%>" size="50" /><span class="help" title="<p>转向链接。</p>"></span></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>
<script type="text/javascript">
$(document).ready(function(){
	$('#colorSelector').ColorPicker({
		color: '<%=Fk_View_Color%>',
		onShow: function (colpkr) {
			$(colpkr).fadeIn(500);
			return false;
		},
		onHide: function (colpkr) {
			$(colpkr).fadeOut(500);
			return false;
		},
		onChange: function (hsb, hex, rgb) {
			$('#colorSelector div').css('backgroundColor', '#'+hex);
			if(hex=='000000'){
				$('#Fk_View_Color').val('');
			}else{
				$('#Fk_View_Color').val('#'+hex);
			}
		}
	});
});
</script>
<%
End Sub

'==============================
'函 数 名：ViewEditDo
'作    用：执行修改内容
'==============================
Sub ViewEditDo()
	Fk_View_Title=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_Title")))
	Fk_View_Color=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_Color")))
	Fk_View_Keyword=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_Keyword")))
	Fk_View_Description=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_Description")))
	Fk_View_PicList=FKFun.HTMLEncode(Trim(Replace(Request.Form("Fk_View_PicList"),", ","")))
	Fk_View_Pic=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_Pic")))
	Fk_View_PicBig=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_PicBig")))
	Fk_View_FixedUrl=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_FixedUrl")))
	Fk_View_FileName=Server.URLEncode(FKFun.HTMLEncode(Trim(Request.Form("Fk_View_FileName"))))
	Fk_View_Template=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_Template")))
	Fk_View_Link=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_Link")))
	Fk_View_Content=FKFun.EditorImgTry(Request.Form("Fk_View_Content"))
	Fk_View_Recommend=FKFun.HTMLEncode(Trim(Replace(Request.Form("Fk_View_Recommend")," ","")))
	Fk_View_Subject=FKFun.HTMLEncode(Trim(Replace(Request.Form("Fk_View_Subject")," ","")))
	Fk_View_Time=FKFun.HTMLEncode(Trim(Request.Form("Fk_View_Time")))
	Fk_View_Show=Trim(Request.Form("Fk_View_Show"))
	Fk_View_Stick=Trim(Request.Form("Fk_View_Stick"))
	Id=Trim(Request.Form("Id"))
	TempArr=Split(ModelField,"|FieldList|")
	For Each Temp In TempArr
		If Temp<>"" Then
			Field_Type=FKFun.GetSub(Temp,"Field_Type:","|;|","")
			Field_Label=FKFun.GetSub(Temp,"Field_Label:","|;|","")
			If Field_Type="1" Then
				Field_Content=FKFun.EditorImgTry(Trim(Request.Form("Fk_Field_"&Field_Label&"")))
				Field_Content=Replace(Field_Content,"'","&#39;")
			Else
				Field_Content=FKFun.HTMLEncode(Trim(Request.Form("Fk_Field_"&Field_Label&"")))
			End If
			Field_Content=Replace(Field_Content,"_Field_Get:","&nbsp;_Field_Get")
			Field_Content=Replace(Field_Content,"Get_Field_Line:","&nbsp;Get_Field_Line")
			Fk_View_Field=Fk_View_Field&Field_Label&"_Field_Get:"&Field_Content&"|Get_Field_Line|"
		End If
	Next
	If IsNumeric(Fk_View_FileName) Then
		Call FKFun.JsonError("文件名不能为纯数字！")
	End If
	If Fk_View_Time="" Then
		Fk_View_Time=Now()
	Else
		If Not IsDate(Fk_View_Time) Then
			Call FKFun.JsonError("添加时间格式有误！")
		End If
	End If
	Call FKFun.JsonString(Fk_View_Title,1,50,0,"请输入名称！","名称不能大于50个字符！")
	Call FKFun.JsonString(Fk_View_Color,1,50,2,"请输入标题颜色！","标题颜色不能大于50个字符！")
	Call FKFun.JsonString(Fk_View_Keyword,1,255,2,"请输入关键字！","关键字不能大于255个字符！")
	Call FKFun.JsonString(Fk_View_Description,1,255,2,"请输入描述！","描述不能大于255个字符！")
	Call FKFun.JsonString(Fk_View_FixedUrl,1,255,2,"请输入绝对路径！","绝对路径不能大于255个字符！")
	Call FKFun.JsonString(Fk_View_FileName,1,50,2,"请输入文件名！","文件名不能大于50个字符！")
	Call FKFun.JsonString(Fk_View_Link,1,255,2,"请输入转向链接！","转向链接不能大于255个字符！")
	Call FKFun.JsonString(Fk_View_Content,1,50,1,"请输入内容！","内容不能大于50个字符！")
	Call FKFun.JsonNum(Fk_View_Show,"请选择是否显示！")
	Call FKFun.JsonNum(Fk_View_Stick,"请选择是否置顶！")
	Call FKFun.JsonNum(Id,"系统参数错误，请刷新页面！")
		
	'绝对路径格式判断
	If Fk_View_FixedUrl<>"" Then
		If Instr(Fk_View_FixedUrl,".")=0 Then '判断后缀是否存在
			Call FKFun.JsonError("绝对路径必须带文件类型后缀！")
		Else
			'文件名安全判别
			If (Len(Fk_View_FixedUrl)-Len(Replace(Fk_View_FixedUrl,".","")))>1 Then
				Call FKFun.JsonError("绝对路径只能有一个“.”符号！")
			End If
			If Instr(",.html,",","&Right(Fk_View_FixedUrl,5)&",")=0 And Instr(",.xml,.htm,",","&Right(Fk_View_FixedUrl,4)&",")=0 And Instr(",.shtml,",","&Right(Fk_View_FixedUrl,6)&",")=0 Then
				Call FKFun.JsonError("后缀只能是.html/.htm/.xml/.shtml中的一种！")
			End If
		End If
	End If
	
	If Fk_View_FileName="" Then
		Fk_View_Url=Id
	Else
		Fk_View_Url=Fk_View_FileName
	End If
	Fk_View_Recommend=","&Fk_View_Recommend&","
	Fk_View_Subject=","&Fk_View_Subject&","
	Sqlstr="Select Fk_View_Id,Fk_View_Title,Fk_View_Color,Fk_View_Keyword,Fk_View_Description,Fk_View_Content,Fk_View_Url,Fk_View_PicList,Fk_View_Pic,Fk_View_PicBig,Fk_View_FixedUrl,Fk_View_FileName,Fk_View_Recommend,Fk_View_Subject,Fk_View_Field,Fk_View_Template,Fk_View_Show,Fk_View_Link,Fk_View_Stick,Fk_View_ToHtml,Fk_View_Time From [Fk_View] Where Fk_View_Module="&ModuleId&" And Fk_View_Id=" & Id
	Rs.Open Sqlstr,Conn,1,3
	If Not Rs.Eof Then
		Application.Lock()
		Rs("Fk_View_Title")=Fk_View_Title
		Rs("Fk_View_Color")=Fk_View_Color
		Rs("Fk_View_Keyword")=Fk_View_Keyword
		Rs("Fk_View_Description")=Fk_View_Description
		Rs("Fk_View_Content")=Fk_View_Content
		Rs("Fk_View_Url")=Fk_View_Url
		Rs("Fk_View_PicList")=Fk_View_PicList
		Rs("Fk_View_Pic")=Fk_View_Pic
		Rs("Fk_View_PicBig")=Fk_View_PicBig
		Rs("Fk_View_FixedUrl")=Fk_View_FixedUrl
		Rs("Fk_View_FileName")=Fk_View_FileName
		Rs("Fk_View_Recommend")=Fk_View_Recommend
		Rs("Fk_View_Subject")=Fk_View_Subject
		Rs("Fk_View_Field")=Fk_View_Field
		Rs("Fk_View_Template")=Fk_View_Template
		Rs("Fk_View_Show")=Fk_View_Show
		Rs("Fk_View_Link")=Fk_View_Link
		Rs("Fk_View_Stick")=Fk_View_Stick
		Rs("Fk_View_ToHtml")=1
		Rs("Fk_View_Time")=Fk_View_Time
		Rs.Update()
		If Fk_Site_Html=2 Then
			Sqlstr="Update [Fk_Module] Set Fk_Module_ToHtml=1 Where Fk_Module_Id In (0"&ModuleLevelList&ModuleId&")"
			Conn.Execute(Sqlstr)
			If Fk_View_Subject<>",," Then
				Sqlstr="Update [Fk_Subject] Set Fk_Subject_ToHtml=1 Where Fk_Subject_Id In (0"&Fk_View_Subject&"0)"
				Conn.Execute(Sqlstr)
			End If
		End If
		Application.UnLock()
		Call FKFun.JsonSuccess()
	Else
		Rs.Close
		Call FKFun.JsonError("要修改的"&ModelName&"不存在！")
	End If
	Rs.Close
End Sub

'==============================
'函 数 名：ViewDelDo
'作    用：执行删除内容
'==============================
Sub ViewDelDo()
	Id=Trim(Request.QueryString("Id"))
	Call FKFun.ShowNum(Id,"系统参数错误，请刷新页面！")
	Sqlstr="Select Fk_View_Id From [Fk_View] Where Fk_View_Module="&ModuleId&" And Fk_View_Id=" & Id
	Rs.Open Sqlstr,Conn,1,3
	If Not Rs.Eof Then
		Application.Lock()
		Rs.Delete()
		If Fk_Site_Html=2 Then
			Sqlstr="Update [Fk_Module] Set Fk_Module_ToHtml=1 Where Fk_Module_Id In (0"&ModuleLevelList&ModuleId&")"
			Conn.Execute(Sqlstr)
		End If
		Application.UnLock()
		Response.Write("ok")
	Else
		Response.Write("要删除的"&ModelName&"不存在！")
	End If
	Rs.Close
End Sub

'==============================
'函 数 名：ViewBatchDelDo
'作    用：执行批量删除内容
'==============================
Sub ViewBatchDelDo()
	Id=Replace(Trim(Request.Form("ListId"))," ","")
	If Id="" Then
		Call FKFun.JsonError("请选择要删除的内容！")
	End If

	Sqlstr="Delete From [Fk_View] Where Fk_View_Module="&ModuleId&" And Fk_View_Id In ("&Id&")"
	Application.Lock()
	Conn.Execute(Sqlstr)
	If Fk_Site_Html=2 Then
		Sqlstr="Update [Fk_Module] Set Fk_Module_ToHtml=1 Where Fk_Module_Id In (0"&ModuleLevelList&ModuleId&")"
		Conn.Execute(Sqlstr)
	End If
	Application.UnLock()
	Call FKFun.JsonSuccess()
End Sub

'==============================
'函 数 名：ViewBatchMoveDo
'作    用：执行批量移动内容
'==============================
Sub ViewBatchMoveDo()
	Dim MoveToId
	Id=Replace(Trim(Request.Form("ListId"))," ","")
	MoveToId=Trim(Request.Form("BatchMoveTo"))
	Call FKFun.JsonNum(MoveToId,"请选择移动到的栏目！")
	If Id="" Then
		Call FKFun.JsonError("请选择要删除的内容！")
	End If

	Sqlstr="Select Fk_Module_LevelList From [Fk_Module] Where Fk_Module_Id=" & MoveToId
	Rs.Open Sqlstr,Conn,1,1
	If Not Rs.Eof Then
		ModuleLevelList=ModuleLevelList&ModuleId&Rs("Fk_Module_LevelList")&MoveToId
	Else
		Rs.Close
		Call FKFun.ShowErr("菜单项不存在！",1)
	End If
	Rs.Close

	Sqlstr="Update [Fk_View] Set Fk_View_Module="&MoveToId&",Fk_View_ToHtml=1 Where Fk_View_Module="&ModuleId&" And Fk_View_Id In ("&Id&")"
	Application.Lock()
	Conn.Execute(Sqlstr)
	If Fk_Site_Html=2 Then
		Sqlstr="Update [Fk_Module] Set Fk_Module_ToHtml=1 Where Fk_Module_Id In (0"&ModuleLevelList&")"
		Conn.Execute(Sqlstr)
	End If
	Application.UnLock()
	Call FKFun.JsonSuccess()
End Sub

Call FKFun.PageEnd()
%>