<%@ Page Language="C#" AutoEventWireup="true" Inherits="User_Info_SetArticle, QianboCMS" EnableEventValidation="false" %>
<%@ Import Namespace="Qianbo.BLL" %>
<%@ Import Namespace="System.Data" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>会员投搞</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../Images/default.css" rel="stylesheet" type="text/css" />
<link href="../Images/model.css" rel="stylesheet" type="text/css" />
<style type="text/css">
body, .wrapper {
    float: left;
    padding: 0;
    margin: 0;
    background: none;
}
.wrapper {
    width: 100%;
}
.user_main {
    background: none;
}
</style>
<script src="../../Js/Common.js" type="text/javascript"></script>
<script src="../../Js/XmlHttp.js" type="text/javascript"></script>
</head>

<body>
<form id="form1" runat="server">
  <div class="wrapper">
    <div class="user_main_all">
      <div class="user_main">
        <!-- 主体内容开始 -->
        <div class="user_summary">
          <div class="user_sitepath">您现在的位置：<span id="YourPosition"><span>
            <asp:HyperLink ID="hylnkIndex" runat="server">首页</asp:HyperLink>
            </span><span>&gt;&gt; </span><span>会员中心</span><span> &gt;&gt; </span><span><a href="InfoList.aspx?ChId=<%=ChId %>">稿件管理</a></span><span> &gt;&gt; </span>添加<%=ChannelModel.TypeName %></span></div>
          <div class="model_info_list">
            <div class="model_info_one">添加<%=ChannelModel.TypeName %></div>
            <div class="model_info_content">
              <table width="100%" border="0" cellspacing="1" cellpadding="0" class="table_style">
                <tr class="first">
                  <td class="ok_tab" style="width: 40%;"><%=ChannelModel.TypeName %>标题：</td>
                  <td><asp:TextBox ID="txtTitle" runat="server" Text='' Width="35%" MaxLength="30"></asp:TextBox>
                    <strong><span style="color: #ff0000;">*</span></strong>
                    <input class="submit_button" onclick="CheckTitle()" type="button" value="重名检测" /></td>
                </tr>
                <tr>
                  <td class="ok_tab">所属栏目：</td>
                  <td><select name="ddlColId">
<%
        DataTable dt = ColumnBll.GetFormatListItemByChannelId(ChId);
        Response.Write("<option value=\"-1\" selected>请选择栏目</ption>");
        foreach (DataRow dr in dt.Rows)
        {
            string colName = dr["ColName"].ToString();
            int colId = Convert.ToInt32(dr["ColId"]);
            bool flag = ColumnBll.ChkHasChildByColId(colId);
            bool columnFlag = UserGroupBll.Power_ColumnPower(colId, UserModel.GroupID, 3);
            if ((flag && !ColumnBll.GetColumn(colId).IsAllowAddInfo) || !columnFlag)
            {
                if (colId == ColId)
                    Response.Write("<option value=\"" + ColId + "\" style=\"background-color: red;\" selected>" + colName + "</option>");
                else
                    Response.Write("<option value=\"" + colId + "\" style=\"background-color: red;\">" + colName + "</option>");
            }
            else
            {
                if (colId == ColId)
                    Response.Write("<option value=\"" + colId + "\" selected>" + colName + "</option>");
                else
                    Response.Write("<option value=\"" + colId + "\">" + colName + "</option>");
            };
        }
%>
                    </select></td>
                </tr>
                <tr>
                  <td class="ok_tab">所属专栏：</td>
                  <td><asp:DropDownList ID="ddlUserCate" runat="server"></asp:DropDownList></td>
                </tr>
                <tr>
                  <td class="ok_tab">Tag关键字：</td>
                  <td><asp:TextBox ID="txtTagNameStr" runat="server" Text='' Width="50%" MaxLength="100"></asp:TextBox>
                    <span class="tips">多个关键字请用“<a href="javascript:SepTagName()"><span style="color: #00f; font-weight: 600;">|</span></a>”分隔</span></td>
                </tr>
                <tr>
                  <td class="ok_tab"><%=ChannelModel.TypeName %>来源：</td>
                  <td><asp:TextBox ID="txtSource" runat="server" Text='' Width="35%" MaxLength="50"></asp:TextBox></td>
                </tr>
                <tr>
                  <td class="ok_tab"><%=ChannelModel.TypeName %>作者：</td>
                  <td><asp:TextBox ID="txtAuthor" runat="server" Text='' Width="35%" MaxLength="50"></asp:TextBox></td>
                </tr>
                <tr>
                  <td class="ok_tab"><%=ChannelModel.TypeName %>导读：</td>
                  <td><asp:TextBox ID="txtShortContent" runat="server" Rows="6" TextMode="MultiLine" Width="70%"></asp:TextBox></td>
                </tr>
                <tr>
                  <td class="ok_tab"><%=ChannelModel.TypeName %>内容：</td>
                  <td><asp:TextBox ID="FilePicPath" runat="server" Text="" Style="display: none;"></asp:TextBox>
                    <asp:TextBox ID="txtContent" runat="server" Rows="12" TextMode="MultiLine" Width="95%"></asp:TextBox></td>
                </tr>
                <tr>
                  <td class="ok_tab">阅读收取金币数：</td>
                  <td><asp:TextBox ID="txtPoint" runat="server" Width="70px" onkeyup="value=value.replace(/[^\d]/g,'')" MaxLength="10">0</asp:TextBox>
                    <strong><span style="color: #ff0000;">*</span></strong>（阅读本文需要消耗多少<%=SiteModel.GUnitName %>金币）
                    <asp:HiddenField ID="hfIsOpened" runat="server" Value="2" /></td>
                </tr>
                <tr>
                  <td class="ok_tab"></td>
                  <td><asp:Button ID="btnAddCateSave" runat="server" Text="发布" OnClick="btnAddCateSave_Click" CommandArgument="Save" CssClass="submit_button" OnClientClick="return CheckValidate()" />
                    <asp:Button ID="btnSaveCaoGao" runat="server" Text="保存草稿" CommandArgument="Save_C" OnClick="btnAddCateSave_Click" CssClass="submit_button" OnClientClick="return CheckValidate()" />
                    <asp:Button ID="btnUpdate" runat="server" Text="保存修改" CommandArgument="Save_Update" OnClick="btnAddCateSave_Click" CssClass="submit_button" OnClientClick="return CheckValidate()" Visible="false" />
                    <input type="button" id="btnCanCel" name="btnCanCel" value="取消" class="submit_button" onclick="javascript:history.back();" /></td>
                </tr>
              </table>
              <asp:Label ID="litMsg" runat="server" Text=""></asp:Label>
            </div>
          </div>
        </div>
        <!-- 主体内容结束 -->
        <div class="clear"></div>
      </div>
    </div>
  </div>
</form>
</body>
</html>
<script language="javascript" type="text/javascript">
var typeName='<%=ChannelModel.TypeName %>'
function CheckTitle(){
	var title = $("txtTitle").value.trim();
	if(title.length==0){
		alert("检查"+typeName+"标题不能为空！") ;
		return;
	}
	var flag = CheckHas("../../System/Common/CheckHas.aspx",title,"Title","Qianbo_Article")
	if(!flag){
		alert(""+typeName+"标题不存在！");
	}
	else{
		alert(""+typeName+"标题已存在！");
	}
}
function SepTagName(){
	$("txtTagNameStr").focus();
	if(document.selection){
		var range=document.selection.createRange();
		range.text="|";
	}
}
function CheckValidate(){
	var title = $("txtTitle").value.trim();
	if(title.length==0){
		alert(""+typeName+"标题不能为空！");
		return false;
	}
	if($('ddlColId').value=="-1"){
		alert("请选择栏目！");
		return false;
	}
	if($('ddlColId').options[$('ddlColId').selectedIndex].style.backgroundColor.trim().length!=0){
		alert("所选栏目不能添加/修改"+typeName+"！");
		return false;
	}
	if($("txtPoint").value.trim().length==0){
		alert("阅读收取金币数不能为空！");
		return false;
	}
}
</script>