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

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

    <script src="../../js/Common.js" type="text/javascript"></script>

    <style type="text/css">
        BODY
        {
            margin: 0px;
        }
    </style>

    <script language="javascript" type="text/javascript">
    
   function showMap()
   {
   window.open("map.aspx?pic="+document.getElementById("<%=HiddenField1.ClientID %>").value);
   }
   
   	function showBtype()
	{
	 if($("<%=DropDownList1.ClientID %>").value!=""){
	var strUrl="ajax/getBtype.aspx?paperName="+escape($("<%=DropDownList1.ClientID %>").value);
		Ajaxs.GET(strUrl,showtypeexist);
		}
		
	}
	function showtypeexist(req)
	{
		var text = req.responseText;
		var text1=text.split("|");
		
		document.getElementById("<%=HiddenField3.ClientID %>").value=text1[0];
	
		document.getElementById("<%=HiddenField4.ClientID %>").value=text1[1];
		document.getElementById("<%=HiddenField_scan.ClientID %>").value=text1[2];
		var d = text1[0].split(',');
		
		document.getElementById("<%=DropDownList2.ClientID %>").options.length=0;

		
		for (i=0;i<d.length;i++)
		{
		if(d[i]!=""){
		$("<%=DropDownList2.ClientID %>").options.add(new Option( d[i],d[i]));
		}
		}
		document.getElementById("<%=HiddenField2.ClientID %>").value=document.getElementById("<%=DropDownList2.ClientID %>").value;
	
	}
	function info()
	{
	 document.getElementById("<%=HiddenField2.ClientID %>").value=document.getElementById("<%=DropDownList2.ClientID %>").value;
	}
	function showDiv()
	{
	var str="<table >    ";
	var d=document.getElementById("<%=txtNum.ClientID %>").value;
	if(!isNaN(d)){
	for (i=1;i<=d;i++)
		{
	
		
		str=str+"<tr><td><table>   <tr>  ";
                   str=str+     "<td height='25' align=\"right\">  版面名称:</td><td height=\"25\"  align=\"left\"> <select name=\"Drp"+i+"\" onchange=\"info()\">";
		var d1 = document.getElementById("<%=HiddenField3.ClientID %>").value.split(',');
		
		for (j=0;j<d1.length;j++)
		{
		if(d1[j]!=""){
		str=str+"<option  value='"+d1[j]+"'>"+d1[j]+"</option>";
		}
		}
	
		if(	document.getElementById("<%=HiddenField_scan.ClientID %>").value=="flash"){
                     str=str+    " </select></td>    <td height=\"25\" align=\"right\" >热点图片:&nbsp;"+
                        "</td>  <td height=\"25\"  align=\"left\" >  <input type=\"file\" name=\"uploadfile"+i+"\"  size=\"12\"/>"+

                          " &nbsp;</td>  <td height=\"25\"  align=\"right\">  PDF文件:"+
                        "</td><td height=\"25\" align=\"left\"> <input type=\"text\" name=\"txtscoreNum"+i+"\" id=\"txtscoreNum"+i+"\" size=\"12\" disabled=\"disabled\"/>"+
                        "<input type=\"button\"  value=\"上传\" disabled=\"disabled\" />"+
                       " </td><td height=\"25\" align=\"left\"> &nbsp; 关键字:</td>"+
                        "<td height=\"25\" align=\"left\"> &nbsp;<input type=\"text\" name=\"txtkeyWords"+i+"\" size=\"12\"/>"+
                      "  </td> </tr> <tr>"    +  "  <td height=\"25\" align=\"left\">是否是广告:</td> <td height=\"25\" align=\"left\">  <input id=\"Radio1\" type=\"radio\" disabled='disabled' name=\"ad"+i+"\" value='true' checked=\"checked\" />是<input id=\"Radio2\" disabled='disabled' type=\"radio\" name=\"ad"+i+"\"  value='false'/>否</td> "+
                      "<td height=\"25\" align=\"left\">文章名称:</td> <td height=\"25\" align=\"left\">  <input id=\"textbox1\" disabled='disabled' type=\"text\" name=\"text"+i+"\" /></td>"
                       +"<td height=\"25\" align=\"right\" >广告图片:&nbsp;</td> <td height=\"25\"  align=\"left\" >  <input type=\"file\" disabled='disabled' name=\"adfile"+i+"\"  size=\"8\"/> <br />(图片大小:133*50) "+

                          "</td>  "+"<td colspan=2><span  style=\" color:Red\">(免费版本不具有此功能)</span></td></tr></table></td></tr>";
                          }else
                          {
                            str=str+    " </select></td>    <td height=\"25\" align=\"right\" >热点图片:&nbsp;"+
                        "</td>  <td height=\"25\"  align=\"left\" >  <input type=\"file\" name=\"uploadfile"+i+"\"  size=\"12\"/>"+

                          " &nbsp;</td>  <td height=\"25\"  align=\"right\">  PDF文件:"+
                        "</td><td height=\"25\" align=\"left\"> <input type=\"text\" name=\"txtscoreNum"+i+"\" id=\"txtscoreNum"+i+"\"  size=\"12\" disabled=\"disabled\"/>"+
                        "<input type=\"button\"  value=\"上传\" disabled=\"disabled\"/>"+
                       " </td><td height=\"25\" align=\"left\"> &nbsp; 关键字:</td>"+
                        "<td height=\"25\" align=\"left\"> &nbsp;<input type=\"text\" name=\"txtkeyWords"+i+"\" size=\"12\"/>"+
                      "  </td>  </table></td></tr>";
                          }


	
		}
		str=str+"</tr></table>";
		document.getElementById("<%=divInfo.ClientID %>").innerHTML=str;
		}else
		{
		alert("其他页请填写数字!");
		}
	}
   function check()
   {

  //alert(document.getElementById("txtreferDate").value);
   if(document.getElementById("<%=txtQnum.ClientID %>").value=="")
   
   {
   alert("请填写期号!");
   return false;
   }else if(isNaN(document.getElementById("<%=txtQnum.ClientID %>").value))
   {
    alert("期号无效,请填写数字!");
   return false;
   }
   if(document.getElementById("<%=txtreferDate.ClientID %>").value=="")
   {
   alert("请填写发行日期!");
   return false;
   }
   return true;
   }

    </script>

    <table cellspacing="0" cellpadding="0" width="99%" align="center" border="0">
        <tbody>
            <tr>
                <td>
                    <fieldset>
                        <legend class="tt1">添加期刊</legend>
                        <table bgcolor="#a4b6d7" width="99%" border="0" align="center" cellpadding="3" cellspacing="1"
                            runat="server">
                            <tr>
                                <td height="25" align="right" bgcolor="#ecf5ff">
                                    所属报纸:
                                </td>
                                <td height="25" align="left" bgcolor="#FFFFFF">
                                    <asp:DropDownList ID="DropDownList1" runat="server" onchange="showBtype()">
                                    </asp:DropDownList>
                                </td>
                                <td height="25" align="right" bgcolor="#ecf5ff">
                                    发行日期:
                                </td>
                                <td height="25" align="left" bgcolor="#FFFFFF">
                                    <input name="b_name" id="txtreferDate" size="12" onfocus="calendar();" type="text"
                                        runat="server" />
                                    <span style="color: Red">(* )</span>
                                </td>
                            </tr>
                            <tr>
                                <td height="25" align="right" bgcolor="#ecf5ff">
                                    &nbsp;期号:
                                </td>
                                <td height="25" align="left" bgcolor="#FFFFFF">
                                    <asp:TextBox ID="txtQnum" runat="server" Width="200px"></asp:TextBox>
                                    <span style="color: Red">(* 请填写数字)</span>
                                </td>
                                <td height="25" align="right" bgcolor="#ecf5ff">
                                    添加人:
                                </td>
                                <td height="25" align="left" bgcolor="#FFFFFF">
                                    <asp:TextBox ID="txtaddName" runat="server" Width="200px" Enabled="False"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td height="25" colspan="4" align="left" bgcolor="#ecf5ff" style="background-image: url(../../Images/bg1.jpg);">
                                    <strong><font color="#3169b5">首页:</font></strong>
                                </td>
                            </tr>
                            <tr>
                                <td height="25" align="right" bgcolor="#ecf5ff">
                                    版面名称:
                                </td>
                                <td height="25" align="left" bgcolor="#FFFFFF">
                                    <asp:DropDownList ID="DropDownList2" runat="server" onchange="info()">
                                    </asp:DropDownList>
                                </td>
                                <td height="25" align="right" bgcolor="#ecf5ff">
                                    热点图片:&nbsp;
                                </td>
                                <td height="25" align="left" bgcolor="#FFFFFF">
                                    <asp:FileUpload ID="uploadfile" runat="server" />
                                    <asp:Label ID="info" runat="server"></asp:Label>
                                    &nbsp;
                                    <br />
                                    (图片大小:800*1078)
                                </td>
                            </tr>
                            <tr>
                                <td height="25" align="right" bgcolor="#ecf5ff">
                                    PDF文件地址:
                                </td>
                                <td height="25" align="left" bgcolor="#FFFFFF">
                                    <asp:TextBox ID="txtscoreNum" runat="server" Enabled="false"></asp:TextBox>
                                    <input type="button" value="上传"  disabled="disabled"/>
                                    <span style="color: Red">(免费版本暂无此功能)</span>
                                                                   
                                </td>
                                <td height="25" align="right" bgcolor="#ecf5ff">
                                    &nbsp; 关键字:
                                </td>
                                <td height="25" align="left" bgcolor="#FFFFFF">
                                    <asp:TextBox ID="txtkeyWords" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td height="25" align="right" bgcolor="#ecf5ff">
                                    其他页:
                                </td>
                                <td height="25" colspan="3" align="left" bgcolor="#FFFFFF">
                                    <asp:TextBox ID="txtNum" runat="server">0</asp:TextBox><span style="color: Red"> (请填写数字
                                        该期其他版本的页数)</span>
                                    <input id="Button1" type="button" value="添加" onclick="showDiv()" />
                                </td>
                            </tr>
                            <tr>
                                <td colspan="4" align="left" bgcolor="#FFFFFF" runat="server">
                                    <div id="divInfo" runat="server">
                                        &nbsp;</div>
                                </td>
                            </tr>
                            <tr>
                                <td id="Td1" height="35" colspan="4" align="center" bgcolor="#FFFFFF" runat="server">
                                    <asp:Button ID="Button2" runat="server" Text="添加" OnClick="Button2_Click" CssClass="button2"
                                        OnClientClick="return check()" />
                                    <input id="Reset1" type="reset" value="重填" runat="server" class="button2" />
                                </td>
                            </tr>
                        </table>
                    </fieldset>
                </td>
            </tr>
        </tbody>
    </table>
    <asp:HiddenField ID="HiddenField1" runat="server" />
    <asp:HiddenField ID="HiddenField2" runat="server" />
    <asp:HiddenField ID="HiddenField3" runat="server" />
    <asp:HiddenField ID="HiddenField4" runat="server" />
    <asp:HiddenField ID="HiddenField_largerPic" runat="server" />
    <asp:HiddenField ID="HiddenField6" runat="server" />
    <asp:HiddenField ID="HiddenField_smallPic" runat="server" />
    <asp:HiddenField ID="HiddenField5" runat="server" Value="1" />
    <asp:HiddenField ID="HiddenField_scan" runat="server" />
    <asp:HiddenField ID="HiddenField_specialRole" runat="server" />
</asp:Content>
