<!-- #include file="../inc/dataconn.asp" -->
<!-- #include file="../inc/newfun.asp" -->
<html>
<head>
<title>公告信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

   <link href="../inc/wdiii/common.css" rel="stylesheet">
   <link href="../inc/wdiii/table.css" rel="stylesheet">
   <script src="../inc/wdiii/index.js" type="text/javascript"></script>
   
   <link rel="stylesheet" href="../inc/qingeditor/qingstyle.css" />
	 <script charset="utf-8" src="../inc/qingeditor/qingeditor-min.js"></script>
     <script>var textarea_name='news_ny';</script>
     <script charset="utf-8" src="../inc/qingeditor/qingeditor-set.js"></script>

</head>

<body>
<!-- #include file="../inc/checksession_hygl.asp" -->
<%
page_no=chknum(trim_fun(request("page_no")))
mydo=trim_fun(request("mydo"))
news_own=session("gl_user")
call dperror(len(session("gl_user"))=0 or isnull(session("gl_user")),"登录超时，请重新登录后再操作","")	


modid=chknum(trim_fun(request("modid")))
news_title=trim_fun(request("news_title"))
news_ny=trim(request("news_ny"))
news_title_color=trim(request("news_title_color"))
news_time=trim(request("news_time"))
if len(news_time)=0 or isnull(news_time) then news_time=thistime

news_time=formattime(news_time)
news_type=trim_fun(request("news_type"))

select case mydo
	case "del"
dperror_doing="删除文章"
%><!-- #include file="../inc/OnError_top.asp" --><%
		call dperror(modid=0,"读取文章信息出错，请重新登录后再操作","lastnews.asp")		
		sql="delete * from news_list where id="& modid &""
		set rs=conn.execute(sql)
%><!-- #include file="../inc/OnError_end.asp" --><%	
		call dperror(true,"删除成功","lastnews.asp")
	case "addok"
dperror_doing="添加文章"
%><!-- #include file="../inc/OnError_top.asp" --><%
		call dperror(len(news_title)=0 or isnull(news_title),"标题不能为空","")
		sql="select * from news_list where news_title='"& news_title &"'"
		set rs=server.CreateObject("adodb.recordset")
		rs.open sql,conn,1,3
		call dperror(not rs.eof,"标题有相同，请检查","")
		rs.addnew
			rs("news_own")=news_own
			rs("news_title")=news_title
			rs("news_ny")=news_ny
			rs("news_type")=news_type
			rs("news_time")=news_time
			rs("news_title_color")=news_title_color
			
		rs.update
%><!-- #include file="../inc/OnError_end.asp" --><%	
		call dperror(true,"添加成功","lastnews.asp")
	case "modok"
dperror_doing="修改文章"
%><!-- #include file="../inc/OnError_top.asp" --><%
		call dperror(len(news_title)=0 or isnull(news_title),"标题不能为空","")
		sql="select * from news_list where id="& modid &""
		set rs=server.CreateObject("adodb.recordset")
		rs.open sql,conn,1,3		
			rs("news_own")=news_own
			rs("news_title")=news_title
			rs("news_ny")=news_ny
			rs("news_type")=news_type			
			rs("news_time")=news_time
			rs("news_title_color")=news_title_color
		rs.update
%><!-- #include file="../inc/OnError_end.asp" --><%	
		call dperror(true,"修改成功","lastnews.asp")
end select

%>



<div class="table-topmenu" >

    <div class="table-topmenu-left">
    <a href="lastnews.asp" class="btn btn-gray2">文章列表</a>
    <a href="?mydo=add" class="btn btn-gray">发表新文章</a>
    
    </div>
    
    <div class="table-topmenu-right">

    </div>
    
</div>

<%
select case mydo
case "mod","add"
	this_title="添加新"
	if mydo="mod" then
		this_title="修改"
		call dperror(modid=0,"读取文章信息出错，请重新登录后再操作","")
		sql="select * from news_list where id="& modid &""		
		set rs=conn.execute(sql)
		call dperror(rs.eof,"读取文章信息出错，请重新登录后再操作","")
		news_title=rs("news_title")
		news_ny=rs("news_ny")
		news_type=rs("news_type")
		news_time=rs("news_time")
		news_title_color=rs("news_title_color")
	end if
	
	%>
	<form action="?mydo=<%=mydo%>ok&modid=<%=modid%>" name="form1" method="post">
    <table class="table table-bordered table-responsive td_title">
    <thead>
    <tr> 
        	<th colspan="2">&nbsp;</th>
        </tr>
    </thead>
        
          
        <tr> 
            <td style="width:20%;"><div align="right">标题:&nbsp;</div></td>
            <td><div align="left">
            <input id="news_title" class="form-control" style="width:50%; color:<%=news_title_color%>" name="news_title" value="<%=news_title%>">
            
             
             
            </div></td>
        </tr>
        <tr> 
            <td style="width:20%;"><div align="right">标题加颜色:&nbsp;</div></td>
            <td><div align="left">
            		
			<input type="radio" value="black" id="radio-1-1" name="news_title_color" class="regular-radio" <%if news_title_color="black" then response.Write("checked")%> /><label for="radio-1-1" style="background-color:black" onClick="window.document.getElementById('news_title').style.color='black'" title="黑色"></label>
			<input type="radio" value="red" id="radio-1-2" name="news_title_color" class="regular-radio" <%if news_title_color="red" then response.Write("checked")%> /><label for="radio-1-2" style="background-color:red" onClick="window.document.getElementById('news_title').style.color='red'" title="红色"></label> 
			<input type="radio" value="green" id="radio-1-3" name="news_title_color" class="regular-radio" <%if news_title_color="green" then response.Write("checked")%> /><label for="radio-1-3" style="background-color:green" onClick="window.document.getElementById('news_title').style.color='green'" title="绿色"></label> 
			<input type="radio" value="blue" id="radio-1-4" name="news_title_color" class="regular-radio" <%if news_title_color="blue" then response.Write("checked")%> /><label for="radio-1-4" style="background-color:blue" onClick="window.document.getElementById('news_title').style.color='blue'" title="蓝色"></label> 
            <input type="radio" value="purple" id="radio-1-5" name="news_title_color" class="regular-radio" <%if news_title_color="purple" then response.Write("checked")%> /><label for="radio-1-5" style="background-color:purple" onClick="window.document.getElementById('news_title').style.color='purple'" title="紫色"></label> 
		
             
            </div></td>
        </tr>
         <tr> 
            <td><div align="right">时间:&nbsp;</div></td>
            <td><div align="left">
            
           <input class="form-control" style="width:20%;" name="news_time" value="<%=news_time%>">
           
         </div>


          </td>
        </tr>
        <tr> 
            <td><div align="right">类型:&nbsp;</div></td>
            <td><div align="left">
            
             <select class="form-control" name="news_type">
                     <%
			'读取后台设置
			news_class=session("news_class")
				if instr(news_class,"-")>0 then
					arrList=split(news_class,"-")
					for i=Lbound(arrList) to Ubound(arrList)%>				
						<option <%if news_type=arrList(i) then%> selected<%end if%> value="<% =arrList(i)%>"><% =arrList(i)%></option>
					<%next
				else
					%><option value="<% =arrList(i)%>"><% =arrList(i)%></option>
				<%end if%>
                         
                     </select>
            </div></td>
        </tr>
        <tr> 
            <td><div align="right">内容:&nbsp;</div></td>
            <td><div align="left">
            
           
            <textarea class="form-control" cols="50" role="50" name="news_ny" style=" color:#000; width:900px; height:600px;">
            <%=news_ny%>
            </textarea>
            
         </div>


          </td>
        </tr>
			<tr> 
            <td style="height:50px;"><div align="right">内容:&nbsp;</div></td>
            <td><div align="left">
            
            <input class="btn btn-primary" type="submit" name="Submit" value="确定">
</div>
            </td>
        </tr>
    		
     </table>
				</form>
<%
end select%>



</body>
</html>

