<%@ Page Language="C#" MasterPageFile="Admin.Master" AutoEventWireup="true" CodeBehind="Termedit.aspx.cs" Inherits="Mvcb2b.admin.Termedit" Title="用户修改"  ValidateRequest="false" %>
<%@ MasterType VirtualPath="Admin.Master" %>
<%@ Register src="controls/Yearselect.ascx" tagname="Yearselect" tagprefix="uc1" %>
<%@ Register src="controls/Monthselect.ascx" tagname="Monthselect" tagprefix="uc2" %>
<%@ Register src="controls/Dayselect.ascx" tagname="Dayselect" tagprefix="uc5" %>
<%@ Register src="controls/Upmappic.ascx" tagname="Upmappic" tagprefix="uc6" %>
<%@ Register src="controls/Upqipdf.ascx" tagname="Upqipdf" tagprefix="uc3" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script type="text/javascript" src="Comja/up.js"></script>
<script type="text/javascript" src="Comja/classforpage.js" ></script>
<script type="text/javascript" src="calendar/calendar.js"></script>
<script type="text/javascript">
    function setCheckInstartdate(d) {
        document.getElementById("<%=startdate_txt.ClientID%>").value = d;
    }
    function setCheckInenddate(d) {
        document.getElementById("<%=enddate_txt.ClientID%>").value = d;
    }
    function upqipdf() {
       var path=$("#ctl00_ContentPlaceHolder1_downpdf_txt_qipdf_txt").val();
       if (path!=""){alert("请先删除PDF文件！");return false;}
        <%if (Upfile!=null){ %>
        var upfile= "<%=Upfile%>";
	    upfilebox(upfile);		
        return false;
        <%} %>
     }
    $(document).ready(function () {
        var $dt = $('#uppic_rar .dt');
        var $dd = $('#uppic_rar .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();
                }
            });
        });


        var $dtpdf = $('#uppdf_rar .dt');
        var $ddpdf = $('#uppdf_rar .dd');
        $dtpdf.each(function (n) {
            $(this).click(function () { /*点击时运行的函数*/
                if ($(this)[0].checked) {
                    var nowobj = $(this)[0];
                    $dtpdf.each(function (j) {
                        if ($(this)[0] != nowobj) {
                            $(this)[0].checked = false;
                        }
                    });
                    $ddpdf.slideUp(); /*全部关闭*/
                    $($ddpdf[n]).slideDown();
                }
            });
        });

        $(document).on("click","#bigpagesubmit1",function (e) {
            $('#wrapeditor').hide();
            $('#zoomtueditor').slideUp('slow');            
            bigpagesubmit();
         });
    });
    function Win_open(link) {
        window.open(link, '', 'top=200,left=450,width=550,height=380,scrollbars=yes,resizable=yes');
    }
    function bigpagesubmit()
    {
        var qiid=$('#<%=id_txt.ClientID%>').val();
        if (qiid=="0")
        {
            $("#qipdfmake span").html("<strong style='color:red;'>请先保存出版刊期！</strong>");
            return false;
        }
        var ispdf=0;
        if ($("#ispdf_txt")[0].checked)
            ispdf=1;
        var pdffile="";
        var $dt = $('#uppdf_rar .dt');
        var $dd = $('#uppdf_rar .dd');
        $dt.each(function (n) {
                if ($(this)[0].checked) {
                    pdffile= $($dd[n]).find("input[type='text']").val();
                }
        });
        $("#qipdfmake span").html("<strong style='color:#2970d8;'>正在处理……请稍候！</strong>");
        if (pdffile=="")
        {
            $("#qipdfmake span").html("<strong style='color:red;'>请先上传PDF文件！</strong>");
            return false;
        }        
        var bigpageid= document.getElementById("bigpageid").value; 
        startmakeqi(pdffile,qiid,ispdf,bigpageid); //选择大类后处理
    } 
    function makeqipage() {
        var qiid=$('#<%=id_txt.ClientID%>').val();
        if (qiid=="0")
        {
            $("#qipdfmake span").html("<strong style='color:red;'>请先保存出版刊期！</strong>");
            return false;
        }
        var ispdf=0;
        if ($("#ispdf_txt")[0].checked)
            ispdf=1;
        var pdffile="";
        var $dt = $('#uppdf_rar .dt');
        var $dd = $('#uppdf_rar .dd');
        $dt.each(function (n) {
                if ($(this)[0].checked) {
                    pdffile= $($dd[n]).find("input[type='text']").val();
                }
        });
        $("#qipdfmake span").html("<strong style='color:#2970d8;'>正在处理……请稍候！</strong>");
        if (pdffile=="")
        {
            $("#qipdfmake span").html("<strong style='color:red;'>请先上传PDF文件！</strong>");
            return false;
        }        
        showbigpage(pdffile,qiid,ispdf);
   }

    function showbigpage(pdffile,qiid,ispdf)
    {
        var pageurl="jquery/Pageclass.aspx";    
        $.ajax({
            type: "POST",
            url: pageurl, //
            dataType: "json",
            data: { "p": "0",  "maxdepth": "1"},  
            success: function(json) {
                if (json != 0) { 
                    var ztu = $('#zoomtueditor');
                    ztu[0].innerHTML = '<div class="bigpage"><select id="bigpageid" name="bigpageid"><option value="">选择大类</option></select><input type="button" value="确定" name="bigpagesubmit1" id="bigpagesubmit1"></div>';
                    $('<div class="clear"></div><div class="oneCloseBtn"><a href="javascript:void(0);" rel="nofollow"></a></div>').prependTo($('#zoomtueditor'));
                    var sel = document.getElementById("bigpageid");
                    for (i = 0; i < json.classtable.length; i++) {   
                        var issel=0;
                        opt_page(sel, json.classtable[i].classname, json.classtable[i].id, issel, json.classtable[i].sortid); //opt--------opt
                    }
                     $('#wrapeditor').show();		
	                 var w=320;
	                 var h=150;
	                 ztu.width(w);
	                 ztu.height(h);       
	                 var br_height=document.documentElement.clientHeight;
	                 var topheight =((br_height-(h + 48))/2 +$(document).scrollTop()) + "px";	
	                 ztu.css("top", topheight);	
	                 ztu.css("margin-left", "-" + (w + 36) / 2 + "px");
	                 ztu.fadeIn('slow');        
                }
                else
                   startmakeqi(pdffile,qiid,ispdf,0); //没有选择大类处理
   
            }, error: function (json) {
                ////////error
            }
          });       
   }
   function startmakeqi(pdffile,qiid,ispdf,bigpageid)
   {
       $.ajax({
                type: "POST",
                url: "jquery/MakeQiPhoto.aspx",
                dataType: "json",
                data: { "p": "" + pdffile + "", "id": "" + qiid + "", "pdf": "" + ispdf + "", "bigpageid": "" + bigpageid + ""}, //p传输的参数
                success: function(json) {
                    if (json.success == 1)
                    {
                        $("#qipdfmake span").html("<strong style='color:#5ea03a;'>版面发布成功！本期共发布"+json.page+"版面。</strong> ");
                    }
                    if (json.success ==0)
                    {
                        $("#qipdfmake span").html("<strong style='color:red;'>发布失败！原因：服务器PDF环境错误！</strong>");
                    }
                    if (json.success ==3)
                    {
                        $("#qipdfmake span").html("<strong style='color:red;'>"+json.msg+"</strong>");
                    }
            
                }, error: function(html) {$("#qipdfmake span").html("<strong style='color:red;'>发布失败！原因：网络或者程序错误！</strong>"); }
        });
   }
</script>
<div class="path">当前位置： <%=Data.Bkname %> >>  出版期数修改</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 colspan="2" class="bg_must" style="padding-left:18px;padding-top:4px;font-weight:bold;">必填选项</td>
  </tr>  
<tr><td width="180" align="right"><span style="color: Red">*</span>本期开始日期：</td><td><asp:TextBox ID="startdate_txt" runat="server" Text="" Width="120px" style="vertical-align:middle"></asp:TextBox> <a onClick="event.cancelBubble=true;" href="javascript:showCalendar('dimg1',false,'<%=startdate_txt.ClientID%>',null,'setCheckInstartdate')"><img src="calendar/timebtn.gif" alt="" width="34" height="21" border="0" align="middle"  style="vertical-align:middle" id="dimg1" /></a> <span style="color:#ccc;">&nbsp; 可直接输入日期如：2012-2-12</span> </td></tr>   
<tr><td align="right"><span style="color: Red">*</span>本期结束日期：</td><td><asp:TextBox ID="enddate_txt" runat="server" Text="" Width="120px" style="vertical-align:middle"></asp:TextBox> <a onClick="event.cancelBubble=true;" href="javascript:showCalendar('dimg2',false,'<%=enddate_txt.ClientID%>',null,'setCheckInenddate')"><img src="calendar/timebtn.gif" alt="" width="34" height="21" border="0" style="vertical-align:middle" align="middle"  id="dimg2" /></a></td></tr>
<tr><td align="right"><span style="color: Red">*</span>总第：</td><td><asp:TextBox ID="totalqi_txt" runat="server" Text="" Width="30px" ValidationGroup="Haosubmit"></asp:TextBox>期 <span style="color:#ccc;">前台按此编号排序</span><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="总第多少期不能为空" Display="None" ValidationGroup="Haosubmit" ControlToValidate="totalqi_txt"></asp:RequiredFieldValidator>
            <asp:comparevalidator id="comparevalidator2" runat="server" ErrorMessage="总第多少期只能为数字!" ControlToValidate="totalqi_txt"	ValidationGroup="Haosubmit" Display="None" Type="Integer" Operator="DataTypeCheck"></asp:comparevalidator>
 &nbsp;今年第<asp:TextBox ID="y_qi_txt" runat="server" Text="" Width="30px"></asp:TextBox>期</td></tr>
<tr><td align="right"><span style="color: Red">*</span>发行日期：</td><td><uc1:Yearselect ID="year_txt"  runat="server"  />年 <uc2:Monthselect  ID="month_txt" runat="server" />月 <uc5:Dayselect ID="day_txt" runat="server" />日

 </td></tr>
 <%if (typeid == 8)
              {%>
 <tr><td align="right" valign="top">目录分类：</td>
<td><asp:Literal  ID="Literal2" runat="server"></asp:Literal></td></tr>
 <%} %>
 <tr><td align="right">属性：</td>
<td>
<asp:CheckBox ID="isshow_txt" runat="server" /> <span style="color:#108410;">前台显示</span>&nbsp;
</td>
</tr>
 <tr>
  <td colspan="2"  class="bg_must" style="padding-left:18px;padding-top:4px;font-weight:bold;">选填选项</td>
</tr>
<tr><td align="right" valign="top">封面图片：</td>
<td><uc6:Upmappic ID="Upmappic1" runat="server" /> <span style="color:Gray">仅对期刊杂志</span>
</td></tr>
<tr><td align="right">封面链接：</td>
<td><asp:TextBox ID="qilink_txt" runat="server" Text="" Width="150px"></asp:TextBox>
   <span style="color:Gray">仅对期刊杂志</span>
</td>
</tr>

<%
    string _s1 = "";
    string _s3 = "";
    string _check1=" checked=\"checked\" ";
    string _check3 = " checked=\"checked\" ";
    if (ispicurl == true)
    {
        _check1 = "";
        _s1 = "seeno";
    }
    else
    {
        _check3 = "";
        _s3 = "seeno";
    }
        
     %><asp:HiddenField ID="downpic_txt" runat="server" />
     <%--
<tr><td align="right" valign="top">在线下载（打包图片）：</td>
<td>请上传本期所有图片打包文件：<br />
<table width="100%" border="0" id="uppic_rar" cellspacing="0" cellpadding="0">
  <tr>
    <td><input name="downpic" id="downpic1" type="checkbox" class="dt" <%=_check1 %> value="0" /> 直接上传</td>
  </tr>
  <tr id="forup1"  class="<%=_s1 %> dd">
    <td><uc3:Upallfiles ID="downpic_txt" runat="server" /></td>
  </tr>
  <tr>
    <td><input name="downpic" id="downpic2" type="checkbox" class="dt" value="1" /> 浏览已上传文件
    <span style="color:Gray;">(可浏览用FTP软件批量上传的文件 如：Img/2011/10/qipic6.rar)</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="downpic_txt2" style="width:250px;" id="downpic_txt2"  /></div>
    <div style="width:51px;float:left;"> <a class="browse" href="javascript:Win_open('FileBrowse.aspx?n=downpic_txt2');" title="点击此处浏览已上传到服务器文件.."><span>浏览</span></a></div>
    </div>
    <div id="downpic_txt2_img"></div></td>
  </tr>
  <tr >
    <td><input name="downpic" id="downpic3"  type="checkbox" <%=_check3 %> class="dt" value="2" /> 直接输入在线下载文件网址</td>
  </tr>
  <tr id="forup3" class="<%=_s3 %> dd">
    <td><input type="text" value="<%=downpicurl%>" style="width:250px;" name="downpicurl_txt" id="downpicurl_txt"  /></td>
  </tr>
</table></td>
</tr>--%>

<%
    string _sp1 = "";
    string _sp3 = "";
    string _checkp1 = " checked=\"checked\" ";
    string _checkp3 = " checked=\"checked\" ";
    if (ispicurl == true)
    {
        _checkp1 = "";
        _sp1 = "seeno";
    }
    else
    {
        _checkp3 = "";
        _sp3 = "seeno";
    }
        
     %>
<tr><td align="right" valign="top">在线下载（打包PDF）：</td>
<td>请上传本期所有<%=Mvcbll.Share.BkType.Pagename%>PDF打包文件：<br />
<table width="100%" border="0" id="uppdf_rar" cellspacing="0" cellpadding="0">
  <tr>
    <td><input name="downpdf" id="downpdf1" type="checkbox" class="dt" <%=_checkp1 %> value="0" /> 直接上传</td>
  </tr>
  <tr id="forpdfup1"  class="<%=_sp1 %> dd">
    <td  style="position:relative;">
      <uc3:Upqipdf ID="downpdf_txt" runat="server" />  
     <div class="make" id="qipdfmake" style="top:-5px;left:435px; vertical-align:middle;">
     <input id="ispdf_txt" type="checkbox" name="ispdf" checked="checked" style="vertical-align:middle;" /> 生成版面PDF(图片格式) <a href="javascript:void(0);" onclick="makeqipage();" title="一键自动生成版面" >一键发布</a> <span></span> 
     <a href="Editionmanage.aspx?qi=<%=Qiid%>" style="margin-left:5px;">管理版面</a>
     <a href="Newsmanage.aspx?qi=<%=Qiid%>" style="margin-left:5px;">管理新闻内容</a>
     </div>
     </td>
  </tr>
  <tr>
    <td><input name="downpdf" id="downpdf2" type="checkbox" class="dt" value="1" /> 浏览已上传PDF文件包
    <span style="color:Gray;">(可浏览用FTP软件批量上传的文件 如：Img/2011/10/qipdf6.pdf)</span>
    </td>
  </tr>
  <tr id="forpdfup2" class="seeno dd">
    <td>
    <div style="width:100%;height:24px;line-height:24px;">
    <div style="width:308px;float:left;"><input type="text" value="" name="downpdf_txt2" style="width:300px;" id="downpdf_txt2"  /></div>
    <div style="width:51px;float:left;"> <a class="browse" href="javascript:Win_open('FileBrowse.aspx?n=downpdf_txt2');" title="点击此处浏览已上传到服务器文件.."><span>浏览</span></a></div>
    </div>
    <div id="downpdf_txt2_img"></div></td>
  </tr>
  <tr >
    <td><input name="downpdf" id="downpdf3"  type="checkbox" <%=_checkp3 %> class="dt" value="2" /> 直接输入在线下载PDF文件包网址</td>
  </tr>
  <tr id="forpdfup3" class="<%=_sp3 %> dd">
    <td><input type="text" value="<%=downpdfurl%>" style="width:300px;" name="downpdfurl_txt" id="downpdfurl_txt2"  /></td>
  </tr>
</table></td>
</tr>

<tr><td colspan="2" align="center">
<asp:HiddenField ID="action_txt" runat="server" />
<asp:HiddenField ID="id_txt" runat="server" />
<asp:HiddenField ID="fromrefer" runat="server" />
    <asp:Button ID="Add" runat="server" Text="修改" Width="58px" ValidationGroup="Haosubmit"  onclick="Edit_Click" /> &nbsp;<input type="button" value="返回" name="go" style="width:58px;" onclick="javascript:history.go(-1);"  /><asp:validationsummary id="ValidationSummary1" ValidationGroup="Haosubmit"  runat="server" ShowMessageBox="True" ShowSummary="False"></asp:validationsummary>
</td></tr>
</table>

 <div class="help">
        <h4>? 帮助</h4>
        <ul>        
        <li>1. 请不要添加两期以上的空期（即不要添加没有版面内容的刊期），否则过多空期会导致前台找不到报刊内容而提示出错.</li>
        <li>2. 前台在线下载默认为PDF打包下载.</li>
        <li>3. 本处一键发布仅能自动发布生成版面或者页面图片，不包括文章内容的自动发布.</li>
        <li>4. 杂志支持：1,2,3,4,5,6……end/1,2-3,4-5,6-7,8……end；杂志首页和尾页必须为单页，对开页只能是偶数开头。</li>
        </ul>
   </div>  
</asp:Content>
