<%@ Page Title="" Language="C#" MasterPageFile="~/Manage/Master/AdminMP.Master" AutoEventWireup="true" CodeBehind="ArticleEdit.aspx.cs" Inherits="MyCms.Manage.Articles.ArticleEdit" %>
<%@ MasterType VirtualPath="~/Manage/Master/AdminMP.Master" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table cellpadding="5" cellspacing="5">
        <tr>
            <td>标题：</td>
            <td><asp:TextBox ID="tbTitle" runat="server"></asp:TextBox></td>
            <td></td>
        </tr>
        <tr>
            <td>分类：</td>
            <td><asp:DropDownList ID="ddlCategoryID" runat="server"></asp:DropDownList></td>
            <td></td>
        </tr>
        <tr>
             <td>封面：</td>
            <td>
                <%=(article!=null&&article.CoverImg!=null&&article.CoverImg!=string.Empty)?"<div id=\"CoverImgDiv\"><img src=\""+article.CoverImg+"\" width=\"158\" height=\"98\" /><br /><a href=\"javascript:clear();\">删除</a></div>":string.Empty %>
                <input type="button" id="CoverImgBtn" value="选择图片" /> <span id="uploadstatus">大小158x98</span>
                <input type="hidden" id="CoverImg" name="CoverImg" value="<%=article==null?string.Empty:article.CoverImg %>" />
            </td>
            <td></td>
        </tr>
        <tr>
            <td>标签：</td>
            <td><asp:TextBox ID="tbKeywords" runat="server"></asp:TextBox></td>
            <td></td>
        </tr>
        <tr>
            <td>摘要：</td>
            <td><asp:TextBox ID="tbDescription" runat="server"></asp:TextBox></td>
            <td></td>
        </tr>
        <tr>
            <td>正文：</td>
            <td><CKEditor:CKEditorControl ID="ckeAContent" BasePath="~/ckeditor" runat="server"></CKEditor:CKEditorControl></td>
            <td></td>
        </tr>
        <tr>
            <td>置顶：</td>
            <td><asp:CheckBox ID="chkIsTop" runat="server" /></td>
            <td></td>
        </tr>
        <tr>
            <td></td>
            <td><asp:Button ID="btnSubmit" runat="server" Text=" 保 存 " OnClick="btnSubmit_Click" /></td>
            <td></td>
        </tr>
        
    </table>
    <script type="text/javascript" src="<%=ResolveUrl("~/Static/Script/ajaxupload.js") %>"></script>
    <script type="text/javascript" src="<%=ResolveUrl("~/Static/Script/Comm.js") %>"></script>
    <script>
        var action = '<%=ResolveUrl("~/Handler/Upload.ashx")%>';
        $(function () {
            upload("CoverImgBtn", "uploadstatus", "image", action, callback);
        });
        function callback(file,response){
            if (response.status) {
                $('#CoverImg').val(response.imgurl);
                $('#uploadstatus').html('上传成功!');
                if ($('#CoverImgDiv').length > 0) {
                    $('#CoverImgDiv').html('<img src="' + response.imgurl + '" width="158" height="98" /><br /><a href=\"javascript:clear();\">删除</a>');
                } else {
                    $('#CoverImgBtn').before('<div id="CoverImgDiv"><img src="' + response.imgurl + '" width="158" height="98" /><br /><a href=\"javascript:clear();\">删除</a></div>');
                }
            }
        }

        function clear() {
            $('#CoverImgDiv').remove();
            $('#CoverImg').val('');
        }
    </script>
</asp:Content>
