<%@ Page Language="C#" MasterPageFile="Admin.Master" AutoEventWireup="true" CodeBehind="Newsedit.aspx.cs" Inherits="Mvcb2b.admin.Newsedit" Title="版面内容添加" ValidateRequest="false" %>
<%@ Import Namespace="Mvcb2b.admin"%>
<%@ MasterType VirtualPath="Admin.Master" %>
<%@ Register src="controls/Upcon.ascx" tagname="Up" tagprefix="uc2" %>
<%@ Register src="controls/Upsmall.ascx" tagname="Upsmall" tagprefix="uc3" %>
<%@ Register src="controls/Class.ascx" tagname="Class" tagprefix="uc4" %>
<%@ Register src="controls/Date_Qi.ascx" tagname="Date_Qi" tagprefix="uc1" %>
<%@ Register src="controls/Upallfiles.ascx" tagname="UpallfilesTv" tagprefix="uc5" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script type="text/javascript" src="calendar/calendar.js"></script>
<script type="text/javascript" src="Comja/inputlen.js"></script>
<script type="text/javascript">
function setCheckInedittime(d) {
    document.getElementById("<%=edittime_txt.ClientID%>").value = d;
}
function checkform()
{
    if (typeof (Page_ClientValidate) == 'function') {
        if (Page_ClientValidate('Haosubmit'))    //(Page_ClientValidate())
        { 
           <%if (Mvcbll.Share.BkType.Id == 0)
            { %>  
            /*            
               if (document.getElementById("sel0").value == "" || document.getElementById("sel0").value == null) {
                   alert("-分类不能为空！");
                   return false;
               }*/
               <%} %>
               if (document.getElementById("qi_sel").value == "" || document.getElementById("qi_sel").value == null) {
                   alert("刊期不能为空！");
                   return false;
               }         
               if (document.getElementById("eachpage").value == "" || document.getElementById("eachpage").value == null) {
                   alert("-版面不能为空！");
                   return false;
               }
			   
               if ($("#<%=isrefer_txt.ClientID%>").prop("checked")  != true) {// if (document.Form1.linkmanadd.checked == true) {    
                 <%
                string  haoid="";
                if (Mvcbll.E_settingbll.Sitesetting.Editor == "tinymce")
                {
                   tinyMCE content1= (tinyMCE)editor_div.FindControl("content_txt");
                   haoid=content1.Haoid;
               %>
                 var contentvalue = GetTinyMceContent("<%=haoid%>");
                   if (contentvalue == "" || contentvalue == null) {
                       alert("-内容不能为空！");
                       return false;
                   }
                <%
                 }
                else if (Mvcbll.E_settingbll.Sitesetting.Editor == "ueditor")
                {
                %>
                   var contentvalue = getUeContent();
                   if (contentvalue == "" || contentvalue == null) {
                       alert("-内容不能为空！");
                       return false;
                   }
               <% }%> 
                  
                }
           } 
    }  
}

function showhttp() {
    if ($("#<%=isrefer_txt.ClientID%>").prop("checked")  == true) {// if (document.Form1.linkmanadd.checked == true) {    
        https.style.display = "";
    }
    else {
        https.style.display = "none";
    }
}

function showpic() {
    if ($("#<%=ispic_txt.ClientID%>").prop("checked")  == true) {
        picsmall_id.style.display = "";
    }
    else {
        picsmall_id.style.display = "none";

    }

}
function showtv() {
    if ($("#<%=istv_txt.ClientID%>").prop("checked")  == true) {
        tv_id.style.display = "";
    }
    else {
        tv_id.style.display = "none";
    }
}
var nowqiclid = "<%=nowqiclid%>";

function addpage()
{
   //选择值
   var selp=document.getElementById("eachpage");
   var addvalue = selp.options[selp.selectedIndex].value;
   var addname=selp.options[selp.selectedIndex].text;

   if (addvalue=="")
   {
      alert("没有选择任何页面！");
   }
   else
   {
       //添加到input-值
       var pagevalue=document.getElementById("pagevalue");
       var value=pagevalue.value;

       //验证是否重复添加
       var isadd=false;
       var arrtemp =value.split(',');
       if (arrtemp.length>0 && arrtemp[0]!="")
       {
          for (i = 0; i < arrtemp.length; i++) {            
            if (arrtemp[i]==addvalue)
            {
             alert("该页面已添加！");
             isadd=true;
            }
          }
       }
       if (isadd==false)
       {
           //input值
           if (value.length>0)
               value=value+","+addvalue;
           else
               value=addvalue;
           pagevalue.value=value;

           //添加到input-文本信息
           var pagename=document.getElementById("pagename");
           var text=pagename.value;
           if (text.length>0)
               text=text+","+addname;
           else
               text=addname;
           pagename.value=text;

           //添加到信息显示
           var showdiv=document.getElementById("edition_div")
           var showmsg="";       
           var arr =value.split(',');
           var arrtext=text.split(',');
           if (arr.length>0 && arr[0]!="")
           {
              for (i = 0; i < arr.length; i++) {
                  if (showmsg=="")
                     showmsg=arrtext[i]+"(<a href=\"javascript:delpage("+arr[i]+",'"+arrtext[i]+"');\">删除</a>)";       
                  else
                     showmsg+=", "+arrtext[i]+"(<a href=\"javascript:delpage("+arr[i]+",'"+arrtext[i]+"');\">删除</a>)";  
              }
           }
           else
              showmsg="<span style=\"color:Red;\">没有选择任何<%=Mvcbll.Share.BkType.Pagename%>!</span>";

           showdiv.innerHTML=showmsg;
       }//isadd==false

   }//addvalue==""

   //funtion finish
}

function delpage(edid,edname)
{
       //值
       var pagevalue=document.getElementById("pagevalue");
       var value=pagevalue.value;
       var arrtemp =value.split(',');
       var valuetemp="";
       if (arrtemp.length>0 && arrtemp[0]!="")
       {
          for (i = 0; i < arrtemp.length; i++) {            
            if (arrtemp[i]!=edid)
            {
               if (valuetemp.length>0)
                  valuetemp=valuetemp+","+arrtemp[i];
               else
                  valuetemp=arrtemp[i];
            }
          }
       }
       pagevalue.value=valuetemp; //重新加值

       //文本
       var pagename=document.getElementById("pagename");
       var text=pagename.value;
       var arrtemp2 =text.split(',');
       var texttemp="";
       if (arrtemp2.length>0 && arrtemp2[0]!="")
       {
          for (i = 0; i < arrtemp2.length; i++) {            
            if (arrtemp2[i]!=edname)
            {
               if (texttemp.length>0)
                  texttemp=texttemp+","+arrtemp2[i];
               else
                  texttemp=arrtemp2[i];
            }
          }
       }
       pagename.value=texttemp; //重新加值

      //添加到信息显示
       var showdiv=document.getElementById("edition_div")
       var showmsg="";       
       var arr =valuetemp.split(',');
       var arrtext=texttemp.split(',');
       if (arr.length>0 && arr[0]!="")
       {
              for (i = 0; i < arr.length; i++) {
                  if (showmsg=="")
                     showmsg=arrtext[i]+"(<a href=\"javascript:delpage("+arr[i]+",'"+arrtext[i]+"')\">删除</a>)";       
                  else
                     showmsg+=", "+arrtext[i]+"(<a href=\"javascript:delpage("+arr[i]+",'"+arrtext[i]+"')\">删除</a>)";  
              }
       }
       else
          showmsg="<span style=\"color:Red;\">没有选择任何<%=Mvcbll.Share.BkType.Pagename%>!</span>";
       showdiv.innerHTML=showmsg;
}
$(document).ready(function () {
    var waptitleid="<%=waptitle_txt.ClientID%>";
    var waptitle=$('#'+waptitleid).val();
    $('#waptitle_len').html(DataLength(waptitle)); 
    $('#'+waptitleid).keyup(function(){ 
        waptitle=$('#'+waptitleid).val();
        $('#waptitle_len').html(DataLength(waptitle)); 
     });
    $('#'+waptitleid).change(function(){ 
        waptitle=$('#'+waptitleid).val();
        $('#waptitle_len').html(DataLength(waptitle));
    });
});
</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">
<span style="color: Red">*</span>选择刊期：</td>
<td><uc1:Date_Qi ID="Date_Qi1" runat="server" /> <span style="color:#ccc;">&nbsp;
&nbsp;*为必填</span></td></tr>  

<!--版面选择-->
<tr>
  <td align="right" style="color:#FF8000;">已选择<%=Mvcbll.Share.BkType.Pagename%>：</td>
  <td id="edition_div" class="blue"><%=pageshowmsg%></td>
</tr>
<tr><td align="right">
<%=Mvcbll.Share.BkType.Pagename%>选择：
</td>
<td>
<select id="eachpage" name="eachpage">
<option value="">请选择</option>
</select>
<input type="hidden" name="pagevalue" value="<%=nowpagevalue%>" id="pagevalue" />
<input type="hidden" name="pagename" value="<%=nowpagename%>" id="pagename" />
<span id="eachpage_msg"></span> <a href="javascript:addpage();">添加到选择</a>
<span style="color:Gray;">一篇文章可以选择多个<%=Mvcbll.Share.BkType.Pagename%>;修改版面时，请先删除已选择版面.</span>
</td></tr> 


 <%if (Mvcbll.Share.BkType.Id == 0)
 { %>
<tr><td align="right">
<span style="color: Red">*</span><%=Mvcbll.Share.BkType.Pagename%>内容分类：</td>
<td><uc4:Class ID="Class1" runat="server" /> </td></tr> 
 <%
   }
  if (Mvcbll.Share.BkType.Id == 8)
 { %>
<tr><td align="right"><%=Mvcbll.Share.BkType.Pagename%>内容分类：</td>
<td>
<select id="qiclid_txt" name="qiclid_txt">
<option value="">选择分类</option>
</select> <span id="qiclmsg"></span> </td></tr>   
<%} %>
<tr><td  align="right" style="height: 23px">兼题：</td>
<td ><asp:TextBox ID="jiantitle_txt" runat="server" Width="300px" ValidationGroup="Haosubmit"></asp:TextBox> 
</td></tr>  
<tr>
  <td  align="right" style="height: 23px"><span style="color: Red">*</span>标题：</td><td style="height: 23px">
  <asp:TextBox ID="title_txt" runat="server" Width="300px" ValidationGroup="Haosubmit"></asp:TextBox> 
  <span style="color:#ccc;"> （浏览量：<span style="color:Red;"><asp:Literal ID="hits_txt" runat="server"></asp:Literal></span> ）</span>
  <asp:RequiredFieldValidator ID="RequiredFieldValidator1"   runat="server" ErrorMessage="标题不能为空"  Display="None" ControlToValidate="title_txt" ValidationGroup="Haosubmit"></asp:RequiredFieldValidator>
  </td></tr>  
<tr><td  align="right" style="height: 23px">副标题：</td>
<td ><asp:TextBox ID="subtitle_txt" runat="server" Width="300px" ValidationGroup="Haosubmit"></asp:TextBox> 
</td></tr>  
<%string mobilecss = "style=\"display:none;\"";
  if (ismobile == 1)
      mobilecss = ""; %>
<tr <%=mobilecss %>><td  align="right" style="height: 23px">手机标题：</td>
<td ><asp:TextBox ID="waptitle_txt" runat="server" Width="300px" ValidationGroup="Haosubmit"></asp:TextBox>   已输入<span style="color:red" id="waptitle_len">0</span>字符，默认限制为<span style="color:blue">14</span>中文字符
</td></tr>  
<tr><td align="right">关键字：</td><td><asp:TextBox ID="keywords_txt" runat="server" Text="" Width="300px"></asp:TextBox> <span style="color:#ccc;">以,号分隔</span></td></tr>
<tr><td align="right">作者：</td><td><asp:TextBox ID="author_txt" runat="server" Text="" Width="200px"></asp:TextBox> </td></tr>
<tr><td align="right">本报记者：</td><td><asp:TextBox ID="reporter_txt" runat="server" Text="" Width="200px"></asp:TextBox> </td></tr>
<tr><td align="right">编辑：</td><td><asp:TextBox ID="editer_txt" runat="server" Text="" Width="200px"></asp:TextBox> <span style="color:#ccc;">录入人</span></td></tr>
<tr><td align="right">审核人：</td><td><asp:TextBox ID="auditor_txt" runat="server" Text="" Width="200px"></asp:TextBox></td></tr>
<tr><td align="right">是否直接指向: </td><td><asp:CheckBox ID="isrefer_txt" runat="server" />直接转向</td></tr>
<tr id="https" class="bg1" style="display:none;">
  <td align="right">直接指向网址：</td>
  <td><input name="referurl_txt" id="referurl_txt" type="text" value="" style="width:300px;" runat="server" /></td>
</tr>
<%string showtypecss1 = "", showtypecss2 = "", showtypecss3 = "";
  switch (Showtype)
  {
      case 0:
          showtypecss1 = " selected ";
          break;
      case 1:
          showtypecss2 = " selected ";
          break;
      case 2:
          showtypecss3 = " selected ";
          break;
          
  }

  string newscss = "style=\"display:none;\"";
  if (isintime == 1)
      newscss = ""; %>
<tr <%=newscss %>><td align="right">显示样式：</td><td><select name="showtype_txt" id="Select1">
<option value="0" <%=showtypecss1 %>>左侧图右侧标题</option>
<option value="1" <%=showtypecss2 %>>通栏（单图）</option>
<option value="2" <%=showtypecss3 %>>三图样式</option>
</select> <span style="color:#ccc;">通栏单图宽最大为800px,其他自动生成宽为300px;</span> </td></tr>
<tr><td align="right" valign="middle"><span style="color: Red">*</span>内容：</td><td id="editors">
<asp:PlaceHolder ID="editor_div" runat="server"></asp:PlaceHolder>
<%--<uc1:tinyMCE ID="content_txt"  runat="server" />--%>
<span style="color:#333">
1. 编辑图片时只有在编辑器中看到图片顶部时才能选择和编辑图片;<br />
2. 开启分页后，请先回车后再插入分页符。<br />
2. 如果想把两换行文本中加入回车符（段落空白），请在两行文本之间删除换行符后两行变成一行文字，再按回车即可加入段落空白。否则直接按回车则是空白换行符再加一段落符号。
</span>
</td></tr>
<uc2:Up ID="Up1" runat="server" />
<tr>
  <td align="right">属性：</td>
  <td><asp:CheckBox ID="ispic_txt" runat="server" />图片&nbsp; <asp:CheckBox ID="istv_txt" runat="server" />视频&nbsp; <asp:CheckBox ID="istj_txt" runat="server" />推荐&nbsp;
    </td>
</tr>
<tr id="picsmall_id" class="bg1" style="display:none;">
  <td align="right">导图：</td>
  <td><uc3:Upsmall ID="Upsmall1" runat="server" />
  <br /><span style="color:gray">导图将在网站文章的图文列表或图片列表控件中显现;</span></td>
</tr>
<tr id="tv_id" class="bg1" style="display:none;">
  <td align="right">视频文件：</td>
  <td><uc5:UpallfilesTv  ID="UpallfilesTv1" runat="server" /></td>
</tr>
  <tr><td align="right">稿件来源：</td><td><asp:TextBox ID="froms_txt" runat="server" Text="" Width="300px"></asp:TextBox></td></tr>
  <tr><td align="right">来源网址：</td><td><asp:TextBox ID="fromsurl_txt" runat="server" Text="" Width="300px"></asp:TextBox></td></tr>
  <tr><td align="right">本版排序：</td><td><asp:TextBox ID="sortid_txt" runat="server" Text="0" Width="30px"></asp:TextBox></td>
</tr>
<tr><td align="right">发稿日期：</td><td><asp:TextBox ID="edittime_txt" runat="server" Text="" Width="120px"></asp:TextBox>
 <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="发稿日期不能为空!" Display="None" ValidationGroup="Haosubmit" ControlToValidate="edittime_txt"></asp:RequiredFieldValidator><a onclick="event.cancelBubble=true;" href="javascript:showCalendar('dimg2',false,'<%=edittime_txt.ClientID%>',null,'setCheckInedittime')"><img src="calendar/timebtn.gif" alt="" width="34" height="21" border="0" align="middle"  id="dimg2" /></a>
 </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="infoid_txt" runat="server" />
<asp:HiddenField ID="fromrefer" runat="server" />
<asp:HiddenField ID="classbak_txt" runat="server" /> <asp:HiddenField ID="innewsid_txt" runat="server" /> <asp:HiddenField ID="ininfoid_txt" runat="server" />
    <asp:Button ID="Add" runat="server" Text="修改" Width="58px"  ValidationGroup="Haosubmit" onclick="Edit_Click" />&nbsp;&nbsp;<asp:validationsummary id="ValidationSummary1"  runat="server" ShowMessageBox="True" ShowSummary="False"  ValidationGroup="Haosubmit"></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. 网站设置中开启分页后请在文章中<span style="color:Red">按两个回车键后，然后回到前一个回车键后面</span>来插入分页符.</li>        
        </ul>
</div>
</asp:Content>
