<!--#include file="../Include/Head.asp"-->

<%call getValidform("wzSet",1,0,1)%>
<%call getValidform("newsform",1,0,1)%>
<%Call Kindeditor("editor","Content","Article",1)%>
<%Call KindeditorPic("editorPic","Article",1,"upload","Pic")%>

	<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="../Main/Right.asp">首页</a></li>
    <li><a href="#">添加文章</a></li>
    </ul>
    </div>
	
    
    <div class="toola" style="border-bottom:1px solid #ddd;">
	<a href="javascript:;" onClick="ShowMore('wzSet','symbol')"><font id="symbol">+</font> <font color="red">自定义字段</font></a>
    <ul id="wzSet" style="display:none; padding:8px; line-height:24px;">
    <form class="wzSet" method="post" action="?Action=WzSet">
    <input type="checkbox" name="WzField" id="WzField" value="WZ01" checked disabled > 标题 
    <input type="checkbox" name="WzField" id="WzField" value="WZ02" <%If IsWzField("WZ02") Then%>checked<%End If%>> 分类 
    <input type="checkbox" name="WzField" id="WzField" value="WZ03" <%If IsWzField("WZ03") Then%>checked<%End If%>> 略缩图 
    <input type="checkbox" name="WzField" id="WzField" value="WZ04" checked disabled > 内容 
    <input type="checkbox" name="WzField" id="WzField" value="WZ05" <%If IsWzField("WZ05") Then%>checked<%End If%>> 副标题 
    <input type="checkbox" name="WzField" id="WzField" value="WZ06" <%If IsWzField("WZ06") Then%>checked<%End If%>> 页面名 
    <input type="checkbox" name="WzField" id="WzField" value="WZ07" <%If IsWzField("WZ07") Then%>checked<%End If%>> 关键词 
    <input type="checkbox" name="WzField" id="WzField" value="WZ08" <%If IsWzField("WZ08") Then%>checked<%End If%>> 描述 
    <input type="checkbox" name="WzField" id="WzField" value="WZ09" <%If IsWzField("WZ09") Then%>checked<%End If%>> 作者 
    <input type="checkbox" name="WzField" id="WzField" value="WZ10" <%If IsWzField("WZ10") Then%>checked<%End If%>> 来源 
    <input type="checkbox" name="WzField" id="WzField" value="WZ11" <%If IsWzField("WZ11") Then%>checked<%End If%>> 外链 
    <input type="checkbox" name="WzField" id="WzField" value="WZ12" <%If IsWzField("WZ12") Then%>checked<%End If%>> 备注信息
    <input type="submit" value="保存" style="padding:3px 12px;" >
    </form>
    </ul>
    </div>
    
    
    
  	<div id="tab1" class="tabson">
    <%
	sysID=replace(trim(Request.QueryString("id")) ,"'","")
	Action=replace(trim(Request.QueryString("Action")) ,"'","")
	If action="edit" then
		Set Rs=server.createobject("adodb.recordSet")
		Sql="select * from Jin_Article where sysID="&sysID
		Rs.Open Sql,Conn,1,1
		sysID=Rs("sysID")
		Pid=Rs("Pid")
		Lang=Rs("Lang")				'文章语言
		TitleColor=Rs("TitleColor")		'标题颜色
		TitleBold=Rs("TitleBold")
		Title=Rs("Title")
		Top=Rs("Top")
		Recommend=Rs("Recommend")
		Verify=Rs("Verify")
		Author=Rs("Author")
		From=Rs("From")
		PageName=Rs("PageName")
		Pic=Rs("Pic")
		Link=Rs("Link")
		Keywords=Rs("Keywords")
		Descriptions=Rs("Descriptions")
		Content=Rs("Content")
		Rs.close
		Set Rs=nothing
	End If
	%>
    <ul class="forminfo">
    <%If action="edit" then%>
    <form name="form1" class="newsform" action="?Action=editgo&id=<%=sysID%>" method="post" onsubmit="checkSubmit()">
    <%else%>
    <form name="form1" class="newsform" action="?Action=add" method="post">
    <%end if%>
        
        <li><label>标题<b>*</b></label><input name="Title" type="text" class="newinput450" value="<%=Title%>" datatype="*" nullmsg="文章标题不能为空！" />
        <i class="Validform_checktip"></i>
        </li>  
          
        <li <%If not IsWzField("WZ02") Then%>class="hidden"<%End If%>>
        <label class="left">分类<b>*</b></label>  
        <div class="vocation">
		<%call getclass(Web_ModuleID,"Pid",Pid,"Article","s152")%>
        </div>
        </li>
    
        <li <%If not IsWzField("WZ03") Then%>class="hidden"<%End If%>>
        <label>略缩图<b></b></label><input name="Pic" id="Pic" type="text" class="newinput450" readonly="readonly" value="<%=Pic%>" />
        <i><a href="javascript:;" id="upload">上传</a></i>  
        </li>
        
        <li <%If not IsWzField("WZ06") Then%>class="hidden"<%End If%>>
        <label>页面名<b></b></label><input name="PageName" type="text" class="newinput450" value="<%=PageName%>" />
        </li>
        
        <li <%If not IsWzField("WZ07") Then%>class="hidden"<%End If%>>
        <label>关键词<b></b></label><input name="Keywords" type="text" class="newinput450" value="<%=Keywords%>" />
        </li>
        
        <li <%If not IsWzField("WZ09") Then%>class="hidden"<%End If%>>
        <label>作者<b></b></label><input name="Author" type="text" class="newinput450" value="<%=Author%>" />
        </li>
        
        <li <%If not IsWzField("WZ10") Then%>class="hidden"<%End If%>>
        <label>来源<b></b></label><input name="From" type="text" class="newinput450" value="<%=From%>" />
        </li>
        
        <li <%If not IsWzField("WZ11") Then%>class="hidden"<%End If%>>
        <label>外链<b></b></label><input name="Link" type="text" class="newinput450" value="<%=Link%>" />
        </li>
        
        <li <%If not IsWzField("WZ08") Then%>class="hidden"<%End If%>>
        <label class="left">描述<b></b></label><textarea name="Descriptions" id="Descriptions" cols="" rows="" class="textinput" style="width:550px;height:60px; float:none"><%=Descriptions%></textarea>
        </li>
        
        <li><label class="left">内容<b>*</b></label><textarea name="Content" id="Content" cols="" rows="" class="left" style="width:700px;height:320px;"  ><%=Content%></textarea>
        <span class="Validform_checktip" style="float:left; margin-left:86px; margin-bottom:10px;"></span>
        </li>
        
        <li <%If not IsWzField("WZ12") Then%>class="hidden"<%End If%>>
        <label class="left">备注<b></b></label><textarea name="Remark" id="Remark" cols="" rows="" class="textinput" style="width:550px;height:60px; float:none;"><%=Remark%></textarea></li>
        
        <li><label>&nbsp;</label><input name="submit" type="submit" class="btn" id="send" value="<%If action="edit" then%>提交修改<%else%>确认添加<%end if%>"/>
        <input name="submit" type="button" class="btn" onClick="location.href='<%=session("ArticlePage")%>'"  value="返回列表"/>
        <span id="msgdemo" style="margin-left:30px;"></span>

        </li>
        
    </form>
    </ul>
    </div> 
    </div> 
	<style>
	.s152{z-index:1000 !important;}
    #Content{z-index:1 !important;}
    </style>
	

<%
'添加文章
If Action="add" then
	Pic = sub_str(Trim(request_Form("Pic")),"Upload")
	Set Rs=server.createobject("adodb.recordSet")
	Sql="select * from Jin_Article where PageName='"&request_Form("PageName")&"'"
	Rs.open Sql,conn,1,3
	If rs.eof then
	Rs.Addnew
	Rs("lang")=Web_NowLang
	Rs("Pid")=request_Form("Pid")
	Rs("PageName")=request_Form("PageName")
	Rs("Title")=request_Form("Title")
	Rs("Title_a")=request_Form("Title_a")
	Rs("Keywords")=replace(replace(request_Form("Keywords"),"，",",")," ",",")
	Rs("Descriptions")=request_Form("Descriptions")
	Rs("Author")=request_Form("Author")
	Rs("From")=request_Form("From")
	Rs("Pic")=Pic
	Rs("Content")=request_Form("Content")
	Rs("Link")=request_Form("Link")
	Rs("Remark")=request_Form("Remark")
	Rs("Addtime")=getDate(Now(),"Y-M-D H:M:S")
	Rs("Edittime")=getDate(Now(),"Y-M-D H:M:S")
	Rs.Update
		'---------静态化
		Set Rsa=server.createobject("adodb.recordSet")
		Sqla="select top 1 * from Jin_Article order by sysID desc"
		Rsa.open Sqla,conn,1,1
		If not Rsa.eof Then
		If Web_HtmlType=1 Then htmlLink="Article/"&Rsa("sysID")&".Html"
		If Web_HtmlType=2 Then htmlLink="Article/"&getDate(Rsa("Addtime"),"YMDHMS")&".html"
		If Web_HtmlType=3 Then htmlLink="Article/"&Rsa("Title")&".html"
		call getHtml( "Article.asp?ID="&Rsa("sysID") , htmlLink ) 
		End If 
		Rsa.Close
		Set Rsa=nothing
		'---------
	Else 
		Call ShowMsg("该页面名已存在，不可重复！",1)
	End If
	Rs.close
	Set Rs=nothing
	response.Redirect session("ListPage")	'返回列表页
	
End If
'修改文章
If Action="editgo" then
	Pic = sub_str(Trim(request_Form("Pic")),"Upload")
	Set Rsa=server.createobject("adodb.recordSet")
	Sqla="select * from Jin_Article where PageName='"&request_Form("PageName")&"' And sysID<>"&request_QueryString("id")
	Rsa.open Sqla,conn,1,3
	If Rsa.eof then
		Set Rs=server.createobject("adodb.recordSet")
		Sql="select * from Jin_Article where sysID="&request_QueryString("id")
		Rs.open Sql,conn,1,3
		Rs("lang")=Web_NowLang
		Rs("Pid")=request_Form("Pid")
		Rs("PageName")=request_Form("PageName")
		Rs("Title")=request_Form("Title")
		Rs("Title_a")=request_Form("Title_a")
		Rs("Keywords")=replace(replace(request_Form("Keywords"),"，",",")," ",",")
		Rs("Descriptions")=request_Form("Descriptions")
		Rs("Author")=request_Form("Author")
		Rs("From")=request_Form("From")
		Rs("Pic")=Pic
		Rs("Content")=request_Form("Content")
		Rs("Link")=request_Form("Link")
		Rs("Remark")=request_Form("Remark")
		Rs("Edittime")=getDate(Now(),"Y-M-D H:M:S")
		Rs.Update
		'静态化
			If Web_HtmlType=1 Then htmlLink="Article/"&Rs("sysID")&".Html"
			If Web_HtmlType=2 Then htmlLink="Article/"&getDate(Rs("Addtime"),"YMDHMS")&".html"
			If Web_HtmlType=3 Then htmlLink="Article/"&Rs("Title")&".html"
			call getHtml( "Article.asp?ID="&Rs("sysID") , htmlLink ) 
		Rs.close
		Set Rs=nothing
	Else 
		Call ShowMsg("该页面名已存在，不可重复！",1)
	End If
	Rsa.close
	Set Rsa=nothing
	response.Redirect session("ListPage")	'返回列表页
End If

If action="WzSet" Then
	conn.execute "UPDATE [Jin_Config] SET Web_WzField = '"&replace(request_Form("WzField")," ","")&"' where exists(select top 1 sysID from Jin_Config)"
	Call ShowMsg("",2)
End If
%>

<%Call BackFoot()%>