<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeBehind="Add.aspx.cs" Inherits="Maticsoft.Web.A.Add" Title="添加新闻" EnableEventValidation="false"
    ValidateRequest="false" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script src="../../js/Common.js"type="text/javascript"></script>
    <script language="javascript">
	function showBtype()
	{
	
	if(document.getElementById("<%=DropDownList1.ClientID %>").value!=""){
	var strUrl="ajax/getB1.aspx?paperName="+escape(document.getElementById("<%=DropDownList1.ClientID %>").value);
	
		Ajaxs.GET(strUrl,showtypeexist);
		}
		
	}
	
	function showtypeexist(req)
	{
		var text = req.responseText;
		
		
		var text1=text.split("|");
		
		document.getElementById("<%=HiddenField3.ClientID %>").value=text1[1];
		var d = text1[0].split(',');

		document.getElementById("<%=DropDownList3.ClientID %>").options.length=0;
document.getElementById("<%=DropDownList3.ClientID %>").options.add(new Option('',''));
		for (i=0;i<d.length;i++)
		{
	    if(d[i]!=""){
		document.getElementById("<%=DropDownList3.ClientID %>").options.add(new Option( d[i],d[i]));
		}
		
		}
		document.getElementById("<%=HiddenField2.ClientID %>").value=document.getElementById("<%=DropDownList3.ClientID %>").value;
	
	}
	
	function showInfo1()
	{
	 document.getElementById("<%=HiddenField2.ClientID %>").value=document.getElementById("<%=DropDownList3.ClientID %>").value;
	 if(document.getElementById("<%=DropDownList1.ClientID %>").value!=""&&document.getElementById("<%=DropDownList3.ClientID %>").value!="")
	 {
	var strUrl="ajax/getInfo1.aspx?paperName="+escape(document.getElementById("<%=DropDownList1.ClientID %>").value)+"&Qnum="+escape(document.getElementById("<%=DropDownList3.ClientID %>").value);
	Ajaxs.GET(strUrl,showtypeexist2);
	}
	
		
		
	}
	function showtypeexist2(req)
	{
	
	if( req.responseText.split('|').length>0){
		var text = req.responseText.split('|');
	
		document.getElementById("<%=DropDownList2.ClientID %>").options.length=0;
  document.getElementById("<%=DropDownList2.ClientID %>").options.add(new Option( '',''));
	
		for (i=0;i<text.length;i++)
		{
            	var d = text[i].split(',')[0];
		var d1 = text[i].split(',')[1];
		
		if(d!=""&&d1!=""){
		document.getElementById("<%=DropDownList2.ClientID %>").options.add(new Option( d,d1));
		document.getElementById("<%=HiddenField1.ClientID %>").value=d;
		}
		}
		}
		
		//document.getElementById("<%=HiddenField1.ClientID %>").value=document.getElementById("<%=DropDownList2.ClientID %>").value; 
	
	}
	
	function showInfo()
	{
	
	document.getElementById("<%=HiddenField1.ClientID %>").value=document.getElementById("<%=DropDownList2.ClientID %>").value; 
	if(document.getElementById("<%=DropDownList1.ClientID %>").value!=""&&document.getElementById("<%=HiddenField1.ClientID %>").value!=""&&document.getElementById("<%=HiddenField2.ClientID %>").value!=""){
	var strUrl="ajax/getInfo.aspx?paperName="+escape(document.getElementById("<%=DropDownList1.ClientID %>").value)+"&BName="+escape(document.getElementById("<%=HiddenField1.ClientID %>").value)+"&Qnum="+escape(document.getElementById("<%=HiddenField2.ClientID %>").value);
		Ajaxs.GET(strUrl,showtypeexist1);
		}
	}
	function showtypeexist1(req)
	{
		var text = req.responseText;
		
		var d = text.split(',');
		if(d.length>1){
		
         document.getElementById("<%=txtreferDate.ClientID %>").value=d[1];
          document.getElementById("<%=txtPageNum.ClientID %>").value=d[0];
          	document.getElementById("<%=HiddenField6.ClientID %>").value=d[1];
          		document.getElementById("<%=HiddenField7.ClientID %>").value=d[0];
          		document.getElementById("<%=HiddenField1.ClientID %>").value=d[2];
          }else
          {
          document.getElementById("<%=txtreferDate.ClientID %>").value="";
           document.getElementById("<%=txtPageNum.ClientID %>").value="";
          }
	
	
	}
	function showHistory(paperName,qnum,bname,pagenum)
	{
	document.getElementById("<%=DropDownList1.ClientID %>").value=paperName;
	showBtype();
    document.getElementById("<%=DropDownList3.ClientID %>").value=qnum;
    showInfo1();
    document.getElementById("<%=DropDownList2.ClientID %>").value=pagenum;
    showInfo();
//    document.getElementById("<%=txtreferDate.ClientID %>").value=referdate;
//    document.getElementById("<%=txtPageNum.ClientID %>").value=pagenum;
	}
    </script>

    <script language="javascript" type="text/javascript">


//function Reset1_onclick() {
//document.getElementById("<%=txtATitle.ClientID %>").value="";

//}


    </script>

    <style type="text/css">
        BODY
        {
            margin: 0px;
        }
    </style>
    <form>
    <asp:HiddenField ID="HiddenField1" runat="server" />
    <asp:HiddenField ID="HiddenField4" runat="server" />
    <asp:HiddenField ID="HiddenField2" runat="server" />
    <asp:HiddenField ID="HiddenField5" runat="server" />
    <asp:HiddenField ID="HiddenField3" runat="server" />
    <asp:HiddenField ID="HiddenField_specialRole" runat="server" />
    <asp:HiddenField ID="HiddenField7" runat="server" />
    <asp:HiddenField ID="HiddenField6" runat="server" />
    <table cellspacing="0" cellpadding="0" width="99%" align="left" border="0">
        <tbody>
            <tr>
                <td>
                    <fieldset>
                        <legend class="tt1">添加新闻</legend>
                        <table bgcolor="#a4b6d7" width="96%" border="0" align="center" cellpadding="3" cellspacing="1">
                            <tr>
                                <td width="30%" height="25" align="right" bgcolor="#ecf5ff">
                                    报纸名称：
                                </td>
                                <td width="*" height="25" align="left" bgcolor="#FFFFFF">
                                    <asp:DropDownList ID="DropDownList1" runat="server" onchange="showBtype()">
                                        <asp:ListItem Value="" Selected="True"></asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td width="30%" height="25" align="right" bgcolor="#ecf5ff">
                                    所属期号：
                                </td>
                                <td width="*" height="25" align="left" bgcolor="#FFFFFF">
                                    <asp:DropDownList ID="DropDownList3" runat="server" onchange="showInfo1()">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td width="30%" height="25" align="right" bgcolor="#ecf5ff">
                                    版面名称：
                                </td>
                                <td width="*" height="25" align="left" bgcolor="#FFFFFF">
                                    <asp:DropDownList ID="DropDownList2" runat="server" onchange="showInfo()">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td width="30%" height="25" align="right" bgcolor="#ecf5ff">
                                    发行时间：
                                </td>
                                <td width="*" height="25" align="left" bgcolor="#FFFFFF">
                                    <input name="b_name" id="txtreferDate" size="12" onfocus="calendar();" type="text"
                                        runat="server" readonly="readonly" disabled="disabled">
                                </td>
                            </tr>
                            <tr>
                                <td width="30%" height="25" align="right" bgcolor="#ecf5ff">
                                    版面号码：
                                </td>
                                <td width="*" height="25" align="left" bgcolor="#FFFFFF">
                                    <asp:TextBox ID="txtPageNum" runat="server" Width="200px" ReadOnly="True"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td width="30%" height="25" align="right" bgcolor="#ecf5ff">
                                    文章标题：
                                </td>
                                <td width="*" height="25" align="left" bgcolor="#FFFFFF">
                                    <asp:TextBox ID="txtATitle" runat="server" Width="200px"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td width="30%" height="25" align="right" bgcolor="#ecf5ff">
                                    文章内容：
                                </td>
                                <td width="*" height="25" align="left" bgcolor="#FFFFFF">
                                    <input type="hidden" name="WebEditor1" id="WebEditor1" value="" />
                                    <iframe id="myiframe" src="Edit/editor.htm?id=WebEditor1&ReadCookie=0" frameborder="0"
                                        scrolling="no" width="640" height="460"></iframe>
                                </td>
                            </tr>
                            <tr>
                                <td width="30%" height="25" align="right" bgcolor="#ecf5ff">
                                    是否是热点：</td>
                                <td width="*" height="25" align="left" bgcolor="#FFFFFF">
                                    <asp:CheckBox ID="chkHot" runat="server" />
                                    是</td>
                            </tr>
                            <tr>
                                <td width="30%" height="25" align="right" bgcolor="#ecf5ff">
                                    是否首页推荐：</td>
                                <td width="*" height="25" align="left" bgcolor="#FFFFFF">
                                    <asp:CheckBox ID="chkFirst" runat="server" />
                                    是</td>
                            </tr>
                            <tr>
                                <td width="30%" height="25" align="right" bgcolor="#ecf5ff">
                                    标签：</td>
                                <td width="*" height="25" align="left" bgcolor="#FFFFFF">
                                    <asp:TextBox ID="txttags" runat="server"  Width="200px"></asp:TextBox>
                                &nbsp;多个标签请用,隔开</td>
                            </tr>
                            <tr>
                                <td width="30%" height="25" align="right" bgcolor="#ecf5ff">
                                    添加人：
                                </td>
                                <td width="*" height="25" align="left" bgcolor="#FFFFFF">
                                    <asp:TextBox ID="txtaddName" runat="server" Width="200px" Enabled="False"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td height="35" colspan="2" bgcolor="#FFFFFF">
                                    <div align="center">
                                        <asp:Button ID="btnAdd" runat="server" Text="提交" OnClick="btnAdd_Click" CssClass="button2">
                                        </asp:Button>
                                        <input type="button" value="重填" class="button2" />
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </fieldset>
                </td>
            </tr>
        </tbody>
    </table>
    </form>
</asp:Content>
