<%@ Page Language="C#" MasterPageFile="Admin.Master" AutoEventWireup="true" CodeBehind="Editionadd.aspx.cs" Inherits="Mvcb2b.admin.Editionadd" Title="版面添加" ValidateRequest="false" %>
<%@ MasterType VirtualPath="Admin.Master" %>
<%@ Register src="controls/Uponenopostpic.ascx" tagname="Uponenopostpic" tagprefix="uc1" %>
<%@ Register src="controls/Upmappic.ascx" tagname="Upmappic" tagprefix="uc2" %>
<%@ Register src="controls/Upzoompic.ascx" tagname="Upzoompic" tagprefix="uc3" %>
<%--@ Register src="controls/news/Eachqiselect.ascx" tagname="Eachqiselect" tagprefix="uc3" --%>
<%@ Register src="controls/Pageclass.ascx" tagname="Pageclass" tagprefix="uc4" %>
<%@ Register src="controls/Date_Qi.ascx" tagname="Date_Qi" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script type="text/javascript" src="Comja/up.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        var $dt = $('#banmianpic .dt');
        var $dd = $('#banmianpic .dd');
        $dt.each(function (n) {
            $(this).click(function () { /*点击时运行的函数*/
                if ($(this)[0].checked) {
                    var nowobj = $(this)[0];
                    $dt.each(function (j) {
                        if ($(this)[0] != nowobj) {
                            $(this)[0].checked = false;
                        }
                    });
                    $dd.slideUp(); /*全部关闭*/
                    $($dd[n]).slideDown();
                }
            });
        });

        $("#<%=ismany_txt.ClientID%>").click(function () {
            if (document.getElementById("<%=ismany_txt.ClientID%>").checked)
                window.frames['ifrmap'].document.getElementById("pictype").value = "many";
            else
                window.frames['ifrmap'].document.getElementById("pictype").value = "jpg";
        });
    });

    function Win_open(link) {
        window.open(link, '', 'top=200,left=450,width=550,height=380,scrollbars=yes,resizable=yes');
    }

function checkform()
{
    if (typeof (Page_ClientValidate) == 'function') {
        if (Page_ClientValidate())    //(Page_ClientValidate())
           {
               if (document.getElementById("qi_sel").value == "" || document.getElementById("qi_sel").value == null) {
                   alert("刊期不能为空！");
                   return false;
               }
               if (document.getElementById("selpage0").value == "" || document.getElementById("selpage0").value == null) {
                   alert("-版面不能为空！");
                   return false;
               }               
           } 
    }
   }

   function upzoompic() {
   var path=$("#ctl00_ContentPlaceHolder1_Upzoompic1_zoompic_txt").val();
   if (path!=""){alert("请先删除图片");return false;}
    <%if (Upfile!=null){ %>
    var upfile= "<%=Upfile%>";
	upfilebox(upfile);		
    return false;
    <%} %>
   }
 function makepagemap() {
              var path=$("#ctl00_ContentPlaceHolder1_Upzoompic1_zoompic_txt").val();
              var mappath=$("#ctl00_ContentPlaceHolder1_Upmappic1_map_txt").val();
             
              if (path=="")
              {
                  $("#zoommake span").html("<strong style='color:red;'>请先上传手机版面图片！</strong>"); 
                  return false;
              }
              if (mappath=="")
              {
                   var many=0;
                   if (document.getElementById("<%=ismany_txt.ClientID%>").checked)
                      many=1;
                     $.ajax({
                        type: "POST",
                        url: "jquery/MakePagemap.aspx",
                        dataType: "html",
                        data: { "p": "" + path + "","many": "" + many + "" }, //p传输的参数
                        success: function(html) {
                            if (html != "0") {
                                parentcfmmap(html,-1);$("#zoommake span").html("<strong style='color:#5ea03a;'>生成成功！</strong>");
                            }
                        }, error: function(html) { alert("没有权限!"); }
                    });
            }
            else
            {
                 $("#zoommake span").html("<strong style='color:red;'>请先删除已生成版面图片！</strong>"); 
            }
   }

  function makephoto() {
              var zoompic=$("#ctl00_ContentPlaceHolder1_Upzoompic1_zoompic_txt").val();
              var mappath=$("#ctl00_ContentPlaceHolder1_Upmappic1_map_txt").val();              
              if (mappath=="" && zoompic=="")
              {
                      var pdffile="";
                        var $dt = $('#banmianpic .dt');
                        var $dd = $('#banmianpic .dd');
                        $dt.each(function (n) {
                                if ($(this)[0].checked) {
                                   pdffile= $($dd[n]).find("input[type='text']").val();
                                }
                        });
                        $("#pdfmake span").html("<strong style='color:#5ea03a;'>正在处理……请稍候！</strong>");
                      if (pdffile=="")
                      {
                          $("#pdfmake span").html("<strong style='color:red;'>请先上传PDF文件！</strong>");
                          return false;
                      }
                     $.ajax({
                        type: "POST",
                        url: "jquery/MakePhoto.aspx",
                        dataType: "json",
                        data: { "p": "" + pdffile + "" }, //p传输的参数
                        success: function(json) {
                            for (i = 0; i < json.classtable.length; i++) {    
                                if (json.classtable[i].success == 1) {
                                    var pcdir=json.classtable[i].pcpath;
                                    var mobiledir=json.classtable[i].mobilepath;
                                    var ismany0=json.classtable[i].ismany;
                                    parentcfmmap(pcdir,ismany0);                    
                                    parentzoompic(mobiledir,"",0) ;           
                                    $("#pdfmake span").html("<strong style='color:#5ea03a;'>生成成功！</strong>");
                                }
                                else
                                {
                                    $("#pdfmake span").html("<strong style='color:red;'>生成失败！原因：服务器PDF环境错误！</strong>");
                                }                                 
                            }
                        }, error: function(html) {$("#pdfmake span").html("<strong style='color:red;'>生成失败！原因：网络或者程序错误！</strong>"); }
                    });
            }
            else
            {
                  $("#pdfmake span").html("<strong style='color:red;'>请先删除已生成电脑端和手机端版面图片！</strong>"); 
            }
   }
</script>
<div class="path">当前位置： <%=Data.Bkname %> >>  <%=Mvcbll.Share.BkType.Pagename%>添加</div>
<h3><asp:Literal  ID="Literal1" runat="server"></asp:Literal></h3>
<table width="92%" border="0" class="editor" align="center" style="background-color:#f5f5f5;" cellpadding="3" cellspacing="1">     
<tr><td width="120" align="right">选择期号：</td><td><uc1:Date_Qi ID="Date_Qi1" runat="server" /> <span style="color:#ccc;">&nbsp; *为必填</span> </td></tr>   
<tr><td align="right">选择<%=Mvcbll.Share.BkType.Pagename%>：</td><td><uc4:Pageclass ID="Pageclass1"   runat="server" /></td></tr>
<tr><td align="right"></td><td>本期第<asp:TextBox ID="numberid_txt" runat="server" Text="" Width="30px"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="版面编号不能为空" Display="None" ControlToValidate="numberid_txt"></asp:RequiredFieldValidator> 
            <asp:comparevalidator id="comparevalidator2" runat="server" ErrorMessage="本期第多少版只能为数字!" ControlToValidate="numberid_txt" Display="None" Type="Integer" Operator="DataTypeCheck"></asp:comparevalidator><%=Mvcbll.Share.BkType.Pgname%> &nbsp; <span style="color:#ccc;">前台按此编号排序</span><span style="color:red;font-size:13px;"> * </span></td></tr>
<tr><td align="right"><span style="color: Red">*</span><%=Mvcbll.Share.BkType.Pagename%>标题：</td><td><asp:TextBox ID="pagetitle_txt" runat="server" Text="" Width="120px"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="版面标题不能为空" Display="None" ControlToValidate="pagetitle_txt"></asp:RequiredFieldValidator><span style="color:red;font-size:13px;"> *  导读与索引 如：激光专栏</span></td></tr>
<%
    string css = "";
    if (Data.ProductType <3)
        css = "style=\"display:none;\""; %>
<tr <%=css%>><td align="right">属性：</td><td><asp:CheckBox ID="ismany_txt" runat="server" />对开页面（连版）<span style="color:Gray;">(如果为对开页面，请先选择此属性，再上传版面图片)</span></td></tr> 
<tr><td align="right" valign="top"><%=Mvcbll.Share.BkType.Pagename%>图片：</td><td>
<uc2:Upmappic ID="Upmappic1"  runat="server" />
<div style="color:#333;padding-bottom:3px;">图片大小限制：宽&lt;=<%=pwidth%>px*高&lt;=<%=pheight%>px，小于或等于此规格图片程序将不再压缩处理；<br />
为保证图片质量，请先处理后再上传。</div></td></tr>

<%string zoomcss = "";
  if (Ismobile==0)
      zoomcss = "style=\"display:none;\"";%>
<tr <%=zoomcss%>><td align="right" valign="top"><%=Mvcbll.Share.BkType.Pagename%>手机图片：</td><td  style="position:relative;"><uc3:Upzoompic ID="Upzoompic1" runat="server" />  
 <div class="make" id="zoommake"><a href="javascript:void(0);" onclick="makepagemap();" title="一键自动生成电脑端版面图片" >生成版面图片</a> <span></span> </div>
<div style="color:#333;padding-bottom:3px;">图片大小限制：宽&lt;=<%=mwidth%>px，小于或等于此规格图片程序将不再压缩处理；<br />
为保证图片质量，请先处理后再上传。</div></td></tr> 

<tr><td align="right" valign="top"><%=Mvcbll.Share.BkType.Pagename%>PDF：
<br /> （可为jpg格式）</td>
<td class="uprelative">
<div class="make" id="pdfmake"><a href="javascript:void(0);" onclick="makephoto();" title="一键自动生成电脑端和手机端版面图片" >一键生成</a> <span></span> </div>
<table width="100%" border="0" id="banmianpic" cellspacing="0" cellpadding="0">
  <tr>
    <td><input name="forpdf" id="forpdf1" type="checkbox" class="dt" checked="checked" value="0" /> 直接上传</td>
  </tr>
  <tr id="forup1"  class="dd">
    <td><uc1:Uponenopostpic ID="Uponenopostpic1"  runat="server" /></td>
  </tr>
  <tr>
    <td><input name="forpdf" id="forpdf2" type="checkbox" class="dt" value="1" /> 浏览已上传PDF文件
    <span style="color:Gray;">(可浏览用FTP软件批量上传的文件 如：Img/2011/10/a1.pdf)</span>
    </td>
  </tr>
  <tr id="forup2" class="seeno dd">
    <td>
    <div style="width:100%;height:24px;line-height:24px;">
    <div style="width:258px;float:left;"><input type="text" value="" name="pagepdf_txt2" style="width:250px;" id="pagepdf_txt2"  /></div>
    <div style="width:51px;float:left;"> <a class="browse" href="javascript:Win_open('FileBrowse.aspx');" title="点击此处浏览已上传到服务器文件.."><span>浏览</span></a></div>
    </div>
    <div id="pagepdf_txt2_img"></div></td>
  </tr>
  <tr >
    <td><input name="forpdf" id="forpdf3"  type="checkbox" class="dt" value="2" /> 直接输入PDF文件网址</td>
  </tr>
  <tr id="forup3" class="seeno dd">
    <td><input type="text" value="http://" style="width:250px;" name="pdfurl_txt" id="pdfurl_txt"  /></td>
  </tr>
</table>
</td></tr>
<tr><td colspan="2" align="center">
<asp:Button ID="Add" runat="server" Text="添加" Width="58px"  onclick="Add_Click" />&nbsp;<asp:validationsummary id="ValidationSummary1"  runat="server" ShowMessageBox="True" ShowSummary="False" ></asp:validationsummary> <input type="button" value="返回" name="go" style="width:58px;" onclick="javascript:history.go(-1);"  /></td></tr>
</table>


<div class="help">
        <h4>? 帮助</h4>
        <ul>   
        <li>1. 电脑端版面图片必须上传，可作为缩略图或者画热点基图，手机版面图片和版面PDF为可选选项，并不是必须要上传的；</li> 
        <li>2. 开启手机版后，可先上传手机版版面图片，再生成电脑端版面图片；</li>   
        <li>3. 如需要上传版面PDF，可通过版面PDF一键生成电脑端图片和手机版面图片。</li>  
        <li>4. 如果是杂志期刊，请在版面pdf那里上传大图JPG格式。</li>       
        </ul>
</div>
<div class="h12"></div>
</asp:Content>
