<!--#include file="const.asp"-->
<!--#include file="../../inc/cls_editor.asp" -->
<!--#include file="../inc/cls_tags.asp"-->
<%
Admin_header
'=====================================================================
' 软件名称：新云网站管理系统
' 当前版本：NewAsp Content Management System Version 4.0
' 文件名称：admin_post.asp
' 更新日期：2008-06-16
' 官方网站：新云网络(www.NewAsp.net www.NewAsp.cn) QQ：94022511
'=====================================================================
' Copyright 2003-2008 NewAsp.net - All Rights Reserved.
' newasp is a trademark of NewAsp.net
'=====================================================================
Dim Action,isEdit,ArticleID,classid
ArticleID=NewAsp.ChkNumeric(Request("ArticleID"))
classid=NewAsp.ChkNumeric(Request("classid"))

Dim m_arrAuthor,m_arrComeFrom,m_strXmlFilePath
Channel_Setting = Split(Newasp.Channel_Setting & "|||||||||||||||", "|||")
If Len(Channel_Setting(0)) < 3 Then Channel_Setting(0) = "佚名,本站,不详,未知,新云"
If Len(Channel_Setting(1)) < 3 Then Channel_Setting(1) = "本站整理,本站原创,不详,转载,新云网络"
m_arrAuthor = Split(Channel_Setting(0), ",")
m_arrComeFrom = Split(Channel_Setting(1), ",")
%>
<table class="table1" cellspacing="1" cellpadding="3" align="center" border="0">
	<tr>
		<td class="tableline linetitle" width="200" align="left"><%=NewAsp.ModuleName%>频道</td>
		<td class="tableline" width="*" align="right"><a href="admin_index.asp?ChannelID=<%=ChannelID%>">管理首页</a>
			 - <a href="admin_list.asp?ChannelID=<%=ChannelID%>"><%=NewAsp.ModuleName%>列表</a>
			 - <a href="admin_list.asp?ChannelID=<%=ChannelID%>&showmode=1">专题列表</a>
			 - <a href="admin_list.asp?ChannelID=<%=ChannelID%>&isaccept=1">审核列表</a>
			 - <a href="../sys/admin_class.asp?ChannelID=<%=ChannelID%>">分类管理</a>
		</td>
	</tr>
</table>
<%
If Not ChkAdmin("PostArticle_"&ChannelID) Then
	Call Transfer_error()
End If
Action = LCase(Request("action"))
Select Case Trim(Action)
Case "add"
	isEdit = False
	Call showmain()
Case "edit"
	isEdit = True
	Call showmain()
Case Else
	isEdit = False
	Call showmain()
End Select
If FoundErr = True Then
	ReturnError(ErrMsg)
End If
Admin_footer
SaveLogInfo(AdminName)
NewAsp.PageEnd

Sub showmain()
	Dim EditTitle,TitleColor
	Dim Rs,SQL,RsObj,i,TextContent
	If isEdit Then
		SQL = "SELECT * FROM NC_Article WHERE ArticleID=" & ArticleID
		Set Rs = NewAsp.Execute(SQL)
		classid = Rs("classid")
		ArticleID=Rs("ArticleID")
		EditTitle = "编辑" & NewAsp.ModuleName & ""
	Else
		EditTitle = "添加" & NewAsp.ModuleName & ""
		classid = NewAsp.ChkNumeric(Request("classid"))
		ArticleID=NewAsp.ChkNumeric(Request("ArticleID"))
	End If
%>
<script src="../script/checknews.js" type="text/javascript"></script>
<script language= JavaScript>
function SelectPhoto(){
  var arr=showModalDialog('admin_selfile.asp?ChannelID=<%=ChannelID%>&action=img', '', 'dialogWidth:860px; dialogHeight:680px; help: no; scroll: yes; status: no');
  if(arr!=null){
    var ss=arr.split('|');
    document.myform.ImageUrl.value=ss[0];
    //document.myform.ImageFileList.value=ss[0];
  }
}
function InsertTags(){
	if(!detectMacXFF()){
		var ss=window.showModalDialog('../inc/getTags.asp?channelid=<%=ChannelID%>',window, 'dialogWidth:800px; dialogHeight:600px; help: no; scroll: yes; status: no');
		if(ss!=null) document.getElementById("Tagstring").value=ss;
	}else{
		var feature="width=800,height=600,menubar=no,toolbar=no,location=no,";
		feature+="scrollbars=yes,resizable=yes,status=no,modal=yes";
		window.open('../inc/getTags.asp?channelid=<%=ChannelID%>',null,feature);
	}
}
</script>

<div onkeydown="CtrlEnter()">
<table  border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
        <tr>
          <th colspan="4"><%=EditTitle%></th>
        </tr>
		<form method="Post" name="myform" action="admin_save.asp" onsubmit="return checkPost()">
<%
	If isEdit Then
		Response.Write "<input type=""Hidden"" name=""action"" value=""modify"">"
		Response.Write "<input type=""Hidden"" name=""ArticleID"" value="""& ArticleID &""">"
	Else
		Response.Write "<input type=""Hidden"" name=""action"" value=""save"">"
	End If
	Response.Write "<input type=hidden name=ChannelID value='" & ChannelID & "'>"
%>
        <tr>
          <td width="15%" align="right" nowrap class="tablerow1"><b>所属分类：</b></td>
          <td width="35%" class="tablerow1">
<%
	Call selectClasslist(ChannelID,classid)
%>
		  </td>
          <td width="15%" align="right" nowrap class="tablerow1"><b>所属专题：</b></td>
          <td width="35%" class="tablerow1"><select name="SpecialID" id="SpecialID">
            <option value="0">不指定<%=NewAsp.ModuleName%>专题</option>
<%
	Set RsObj = NewAsp.Execute("SELECT SpecialID,SpecialName From NC_Special WHERE ChannelID = "& ChannelID &" And ChangeLink=0 ORDER BY orders")
	Do While Not RsObj.EOF
		Response.Write Chr(9) & Chr(9) & "<option value=""" & RsObj("SpecialID") & """"
		If isEdit Then
			If Rs("SpecialID") = RsObj("SpecialID") Then Response.Write " selected"
		End If
		Response.Write ">"
		Response.Write RsObj("SpecialName")
		Response.Write "</option>" & vbCrLf
		RsObj.movenext
	Loop
	Set RsObj = Nothing
%>
          </select></td>
        </tr>
        <tr>
          <td align="right" class="tablerow2"><b><%=NewAsp.ModuleName%>标题：</b></td>
          <td colspan="3" class="tablerow2"><select name="BriefTopic" id="BriefTopic">
			  <%If isEdit Then%>
			<option value="0"<%If Rs("BriefTopic") = 0 Then Response.Write (" selected")%>>选择话题</option>
			<option value="1"<%If Rs("BriefTopic") = 1 Then Response.Write (" selected")%>>[图文]</option>
			<option value="2"<%If Rs("BriefTopic") = 2 Then Response.Write (" selected")%>>[组图]</option>
			<option value="3"<%If Rs("BriefTopic") = 3 Then Response.Write (" selected")%>>[新闻]</option>
			<option value="4"<%If Rs("BriefTopic") = 4 Then Response.Write (" selected")%>>[推荐]</option>
			<option value="5"<%If Rs("BriefTopic") = 5 Then Response.Write (" selected")%>>[注意]</option>
			<option value="6"<%If Rs("BriefTopic") = 6 Then Response.Write (" selected")%>>[转载]</option>
			<%Else%>
            <option value="0">选择话题</option>
			<option value="1">[图文]</option>
			<option value="2">[组图]</option>
			<option value="3">[新闻]</option>
			<option value="4">[推荐]</option>
			<option value="5">[注意]</option>
			<option value="6">[转载]</option>
			<%End If%>
          </select> <span style="position:relative"><input name="title" type="text" id="searchwordbox" size="60" value="<%If isEdit Then Response.Write Rs("title")%>">
          <font color="red">*</font><div style="display:none" id="sugAutoComplete" onselectstart="return false">&nbsp;</div></span></td>
        </tr>
        <tr>
          <td align="right" class="tablerow1"><b>标题模式：</b></td>
          <td colspan="3" class="tablerow1">颜色：
            <select size="1" name="ColorMode">
		<option value="0">请选择颜色</option>
<%
	TitleColor = "," & NewAsp.MainSetting(48)
	TitleColor = Split(TitleColor, ",")
	For i = 1 To UBound(TitleColor)
		Response.Write ("<option style=""background-color:"& TitleColor(i) &";color: "& TitleColor(i) &""" value='"& i &"'")
		If isEdit Then
			If Rs("ColorMode") = i Then Response.Write (" selected")
		End If
		Response.Write (">"& TitleColor(i) &"</option>")
	Next
%>
		</select> 字体：
		<select size="1" name="FontMode">
		<%If isEdit Then%>
		<option value="0"<%If Rs("FontMode") = 0 Then Response.Write (" selected")%>>请选择字体</option>
		<option value="1"<%If Rs("FontMode") = 1 Then Response.Write (" selected")%>>粗体</option>
		<option value="2"<%If Rs("FontMode") = 2 Then Response.Write (" selected")%>>斜体</option>
		<option value="3"<%If Rs("FontMode") = 3 Then Response.Write (" selected")%>>下划线</option>
		<option value="4"<%If Rs("FontMode") = 4 Then Response.Write (" selected")%>>粗体+斜体</option>
		<option value="5"<%If Rs("FontMode") = 5 Then Response.Write (" selected")%>>粗体+下划线</option>
		<option value="6"<%If Rs("FontMode") = 6 Then Response.Write (" selected")%>>斜体+下划线</option>
		<%Else%>
		<option value="0">请选择字体</option>
		<option value="1">粗体</option>
		<option value="2">斜体</option>
		<option value="3">下划线</option>
		<option value="4">粗体+斜体</option>
		<option value="5">粗体+下划线</option>
		<option value="6">斜体+下划线</option>
		<%End If%>
		</select></td>
        </tr>
		<tr>
          <td align="right" class="tablerow2"><b>副 标 题：</b></td>
          <td colspan="3" class="tablerow2"><input name="subtitle" type="text" id="subtitle" size="60" value="<%If isEdit Then Response.Write Rs("subtitle") & ""%>"></td>
        </tr>
        <tr>
          <td align="right" class="tablerow1"><b>相关<%=NewAsp.ModuleName%>：</b></td>
          <td colspan="3" class="tablerow1"><input name="Related" type="text" id="Related" size="60" value="<%If isEdit Then Response.Write Rs("Related") & ""%>"></td>
        </tr>
        <tr>
          <td align="right" class="tablerow2"><b><%=NewAsp.ModuleName%>作者：</b></td>
          <td class="tablerow2"><input name="Author" type="text" size="20" value="<%If isEdit Then Response.Write Rs("Author") Else Response.Write m_arrAuthor(0)%>">
		    <select name="font2" onChange="Author.value=this.value;">
			<option value="" selected>选择作者</option>
			<%
			For i = 0 To UBound(m_arrAuthor)
				Response.Write " <option value=""" & m_arrAuthor(i) & """>" & m_arrAuthor(i) & "</option>"
			Next
			%>
			</select></td>
			<td align="right" class="tablerow2"><b><%=NewAsp.ModuleName%>来源：</b></td>
          <td class="tablerow2"><input name="ComeFrom" type="text" size="20" value="<%If isEdit Then Response.Write Rs("ComeFrom") Else Response.Write m_arrComeFrom(0)%>">
		  	<select name="font1" onChange="ComeFrom.value=this.value;">
			<option value="" selected>选择来源</option>
			<%
			For i = 0 To UBound(m_arrComeFrom)
				Response.Write " <option value=""" & m_arrComeFrom(i) & """>" & m_arrComeFrom(i) & "</option>"
			Next
			%>
			</select></td>
        </tr>
        <tr>
          <td align="right" class="tablerow1"><b><%=NewAsp.ModuleName%>Tags：</b></td>
          <td colspan="3" class="tablerow1"><%
	Response.Write "<input type=""hidden"" name=""Taglist"" id=""Taglist"""
	If isEdit Then
		Response.Write " value="""
		Response.Write Tag.getTagQuery(Rs("Taglist"))
		Response.Write """"
	End If
	Response.Write ">"
	Response.Write "<input type=""text"" name=""Tagstring"" id=""Tagstring"" size=""65"""
	If isEdit Then
		Response.Write " value="""
		Response.Write Tag.getTagString(Rs("Taglist"))
		Response.Write """"
	End If
	Response.Write ">"
%> <input type="button" name="selectags" value="插入已经使用的标签" onclick="InsertTags()" class="button"></td>
        </tr>
        <tr>
          <td align="right" class="tablerow2"><b><%=NewAsp.ModuleName%>内容：</b><br><%=NewAsp.ModuleName%>内容分页标签<br><font color=red>[page_break]</font><br>请注意标签字母小写</td>
          <td colspan="3" class="tablerow2">
<%
Dim oEditor
Set oEditor = New Editor_Cls
oEditor.UserMode	= 0
oEditor.setEditMode	= NewAsp.setAdminEditor(0)
oEditor.ChannelID	= ChannelID
oEditor.Width		= NewAsp.setAdminEditor(2)
oEditor.Height		= NewAsp.setAdminEditor(3)
oEditor.BasePath	= "../../" & NewAsp.setAdminEditor(4)
oEditor.ToolbarSet	= NewAsp.setAdminEditor(1)'Default,AdminMode,Simple,UserMode,Basic
If isEdit Then
	TextContent = Rs("content") & ""
	oEditor.Value		= Re_Replace(TextContent, "[InstallDir_ChannelDir]", InstallDir_ChannelDir)
End If
oEditor.InstanceName	= "content"
oEditor.Execute()
Set oEditor = Nothing
%></td>
        </tr>
        <tr>
          <td align="right" class="tablerow1"><b><%=NewAsp.ModuleName%>缩略图：</b></td>
          <td colspan="3" class="tablerow1"><input name="ImageUrl" type="text" id="ImageUrl" size="70" value="<%If isEdit Then Response.Write Rs("ImageUrl")%>">
			<input type="hidden" name="UploadFileList" id="UploadFileList" onchange="doChange(this,document.myform.ImageFileList)" value="<%If isEdit Then Response.Write Rs("UploadImage")%>">&nbsp;&nbsp;
			<%If NewAsp.setAdminEditor(0)=0 Then%><input type="checkbox" name="AutoRemote" value='1' onClick="remoteUpload(this.checked);"> 自动保存远程图片<%End If%>
			<br>直接从上传图片中选择：
			<%
			If IsEdit Then
			Response.Write InitSelect(Rs("UploadImage"),Rs("ImageUrl"))
			Else
			%>
			<select name="ImageFileList" id="ImageFileList" onChange="ImageUrl.value=this.value;"><option value=''>不选择首页推荐图片</option></select><%End If%>
			<input type="button" name="selectpic" value="从已上传图片中选择" onclick="SelectPhoto()" class="button">&nbsp;&nbsp;
			</td>
        </tr>
		<tr>
          <td align="right" class="tablerow2"><b>上传图片：</b></td>
          <td colspan="3" class="tablerow2"><iframe name="image" frameborder="0" width='100%' height="45" scrolling="no" src="../upload.asp?ChannelID=<%=ChannelID%>&stype=image&m=news&inst=content&s=1" allowTransparency="true"></iframe></td>
        </tr>
        <tr>
          <td align="right" class="tablerow1"><b>浏览等级：</b></td>
          <td class="tablerow1"><select name="UserGroup">
<%
	Set RsObj = NewAsp.Execute("SELECT GroupName,Grades FROM NC_UserGroup ORDER BY Groupid")
	Do While Not RsObj.EOF
		Response.Write Chr(9) & Chr(9) & "<option value=""" & RsObj("Grades") & """"
		If isEdit Then
			If Rs("UserGroup") = RsObj("Grades") Then Response.Write " selected"
		Else
			If RsObj("Grades") = 0 Then Response.Write " selected"
		End If
		Response.Write ">"
		Response.Write RsObj("GroupName")
		Response.Write "</option>" & vbCrLf
		RsObj.movenext
	Loop
	Set RsObj = Nothing
%>
          </select> <b>点数：</b><input name="PointNum" type="text" size="10" value="<%If isEdit Then Response.Write Rs("PointNum"):Else Response.Write 0:End If%>"></td>
          <td align="right" class="tablerow1"><b>用户评价：</b></td>
          <td class="tablerow1">好：<input name="good" type="text" size="10" value="<%If isEdit Then Response.Write NewAsp.ChkNumeric(Rs("good")):Else Response.Write (0)%>">
		  差：<input name="bad" type="text" size="10" value="<%If isEdit Then Response.Write NewAsp.ChkNumeric(Rs("bad")):Else Response.Write (0)%>"></td>
        </tr>
        <tr>
          <td align="right" class="tablerow2"><b>初始点击数：</b></td>
          <td class="tablerow2"><input name="AllHits" type="text" id="AllHits" size="15" value="<%If isEdit Then Response.Write Rs("AllHits"):Else Response.Write 0%>">
          <font color="red">*</font></td>
          <td align="right" class="tablerow2"><b><%=NewAsp.ModuleName%>星级：</b></td>
          <td class="tablerow2"><select name="star">
		<%If isEdit Then%>
          	<option value="5"<%If Rs("star") = 5 Then Response.Write (" selected")%>>★★★★★</option>
          	<option value="4"<%If Rs("star") = 4 Then Response.Write (" selected")%>>★★★★</option>
          	<option value="3"<%If Rs("star") = 3 Then Response.Write (" selected")%>>★★★</option>
			<option value="2"<%If Rs("star") = 2 Then Response.Write (" selected")%>>★★</option>
			<option value="1"<%If Rs("star") = 1 Then Response.Write (" selected")%>>★</option>
		<%Else%>
			<option value="5"<%If Trim(Channel_Setting(3)) = "5" Then Response.Write " selected"%>>★★★★★</option>
			<option value="4"<%If Trim(Channel_Setting(3)) = "4" Then Response.Write " selected"%>>★★★★</option>
			<option value="3"<%If Trim(Channel_Setting(3)) = "3" Then Response.Write " selected"%>>★★★</option>
			<option value="2"<%If Trim(Channel_Setting(3)) = "2" Then Response.Write " selected"%>>★★</option>
			<option value="1"<%If Trim(Channel_Setting(3)) = "1" Then Response.Write " selected"%>>★</option>
		<%End If%>
          </select></td>
        </tr>
	<tr>
          <td align="right" class="tablerow1"><b>更新时间：</b></td>
          <td class="tablerow1"><input name="WriteTime" type="text" id="WriteTime" size="25" value="<%If isEdit Then Response.Write Rs("WriteTime"):Else Response.Write (Now())%>">
          <font color="red">*</font><%If isEdit Then%>
	    <input name="Update" type="checkbox" value="1"<%If Trim(Channel_Setting(2))="1" Then Response.Write (" checked")%>>
            更新时间<%End If%></td>
		  <td align="right" class="tablerow1"><b>分页设置：</b></td>
          <td class="tablerow1">
		  <%If isEdit Then%>
		  <input type="radio" name="AutoPages" value="1"<%If Rs("AutoPages") <> 0 Then Response.Write (" checked")%>/> 自动分页&nbsp;&nbsp;
		  <input type="radio" name="AutoPages" value="0"<%If Rs("AutoPages") = 0 Then Response.Write (" checked")%>/> 手动分页&nbsp;&nbsp;
		  <%Else%>
		  <input type="radio" name="AutoPages" value="1"<%If Trim(Channel_Setting(13)) <> "1" Then Response.Write (" checked")%>/> 自动分页&nbsp;&nbsp;
		  <input type="radio" name="AutoPages" value="0"<%If Trim(Channel_Setting(13)) = "1" Then Response.Write (" checked")%>/> 手动分页&nbsp;&nbsp;
		  <%End If%></td>
        </tr>
	<tr>
          <td align="right" class="tablerow2"><b>其它选项：</b></td>
          <td class="tablerow2" colspan="3"><input name="isTop" type="checkbox" id="isTop" value="1"<%If isEdit Then:If Rs("isTop") <> 0 Then Response.Write (" checked")%>>
            <%=NewAsp.ModuleName%>置顶
            <input name="isBest" type="checkbox" id="isBest" value="1"<%If isEdit Then:If Rs("isBest") <> 0 Then Response.Write (" checked")%>>
            <%=NewAsp.ModuleName%>推荐
	    <%If isEdit Then%>
	    <input name="ForbidEssay" type="checkbox" id="ForbidEssay" value="1"<%If Rs("ForbidEssay") <> 0 Then Response.Write (" checked")%>>
		<%Else%>
		<input name="ForbidEssay" type="checkbox" id="ForbidEssay" value="1"<%If Trim(Channel_Setting(4))="1" Then Response.Write (" checked")%>>
		<%End If%>
            禁止发表评论
	    <input name="isAccept" type="checkbox" id="isAccept" value="1" checked>
            立即发布（<font color="blue">否则审核后才能发布。</font>）
	    </td>
        </tr>
		<tr>
          <td align="right" class="tablerow1"><b>外部连接URL：</b></td>
          <td colspan="3" class="tablerow1"><input name="OuterLinks" type="text" id="OuterLinks" size="60" value="<%If isEdit Then Response.Write Rs("OuterLinks") & ""%>"></td>
        </tr>
        <tr align="center">
          <td colspan="4" class="tablerow2">
	  <input type="button" name="Submit4" onclick="javascript:history.go(-1)" value="返回上一页" class="button">
	  <input type="submit" name="btnSubmit" value="保存<%=NewAsp.ModuleName%>" class="button"></td>
        </tr></form>
      </table><div id="BokeccBtn"> </div>
</div>
<%If NewAsp.setAdminEditor(0)=0 Then%>
<form name="NewAsp_UploadForm" action="../remoteupload.asp?action=upload&ChannelID=<%=ChannelID%>" method="post" target="NewAsp_UploadTarget">
<input type="hidden" name="NewAsp_UploadText" value=""/>
</form>
<div id="divProcessing" style="width:200px;height:30px;position:absolute;display:none">
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#000000" width="100%" height="100%"><tr><td bgcolor="#0650D2"><marquee align="middle" behavior="alternate" scrollamount="5" style="font-size:9pt"><font color="#FFFFFF">...正在保存数据...请等待...</font></marquee></td></tr></table>
</div>
<script type="text/javascript">
<!--
function remoteUpload(o) {
	try{
		var strText = GetInnerContentHTML() ;
		var objField = document.getElementsByName("NewAsp_UploadText")[0];
		objField.value = strText ;

		if (o) {
			divProcessing.style.top = (document.body.clientHeight-parseFloat(divProcessing.style.height))/2;
			divProcessing.style.left = (document.body.clientWidth-parseFloat(divProcessing.style.width))/2;
			divProcessing.style.display = "";
			document.NewAsp_UploadForm.submit();
		}else{
			divProcessing.style.display = "none";
		}
	}
	catch(e){}
}

function remoteUploadDone() {
	try{
	divProcessing.style.display = "none";
	}
	catch(e){}
}

function GetInnerContentHTML(){
	var strHTML ;
	try{
		var oEditor = FCKeditorAPI.GetInstance('content') ;
		strHTML = oEditor.GetXHTML()
	}
	catch(e){
		strHTML = '';
	}
	return strHTML
}
//-->
</script>
<%
	End If
	If isEdit Then
		Rs.Close
		Set Rs = Nothing
	Else
		Call LoadAutoComplete("myform")
	End If
End Sub

Function InitSelect(UploadFileList, ImageUrl)
	Dim i
	InitSelect = "<select name='ImageFileList' onChange=""ImageUrl.value=this.value;"">"
	InitSelect = InitSelect & "<option value=''>不选择首页推荐图片</option>"
	If Not IsNull(UploadFileList) Then
		UploadFileList = Split(UploadFileList, "|")
		For i = 0 To UBound(UploadFileList)
			If UploadFileList(i) <> "" Then
				InitSelect = InitSelect & "<option value=""" & UploadFileList(i) & """"
				If UploadFileList(i) = ImageUrl Then
					InitSelect = InitSelect & " selected"
				End If
				InitSelect = InitSelect & ">" & UploadFileList(i) & "</option>"
			End If
		Next
	End If
	InitSelect = InitSelect & "</select>"
End Function
%>