@using Common
@model string
<div class="main">
    <form method="post" class="form-horizontal form form-group-sm ui-validForm">
        <table border="0" cellpadding="0" cellspacing=0 align="center" class="table table-bordered">
            <tr style="display:none;">
                <td width="100px">收件人</td>
                <td>
                    <input type="hidden" id="id" name="id" />
                    <input type="hidden" id="receiver" name="receiver" class="ui-convertTextById Member" data-custom-params="url:'@Url.Action("GetFieldByIds", "Member")',textField:'username'" value="">
                </td>
            </tr>

            <tr>
                <td width="100px">标题</td>
                <td class="form-group-sm">
                    <input type="text" id="title" name="title" class="form-control" style="width:80%" value="" data-validate="dataType:'*" nullMsg:'请填写标题!">
                </td>
            </tr>
            <tr>
                <td>回复内容</td>
                <td>
                    <textarea name="content" id="content" style="width:100%;height:400px;" data-validate="dataType:'editor" nullMsg:'请填写内容!"></textarea>
                    <script charset="utf-8" src="/e/incs/kindeditor/kindeditor.js"></script>
                    <script type="text/javascript">
                        var KE_content;
                        KindEditor.ready(function (K) {
                            KE_content = K.create('#content',
                                {
                                    uploadJson: kindeditor_uploadJson,
                                    fileManagerJson: kindeditor_fileManagerJson,
                                    allowFileManager: false,
                                    items: SmallEditor,
                                    filterMode: false,
                                    extraFileUploadParams: { table: 'pa_msg', field: 'content', username: '@ViewBag.siteId' },
                                    afterBlur: function () { this.sync(); }
                                }
                            );
                        });
                    </script>
                </td>
            </tr>
        </table>
        <div class="postarea text-center">
            <span class="help-block"></span>
            <input type="hidden" id="uid" name="uid" value="@PA.GetCurrentUser().Uid" />
            <input type="hidden" id="thedate" name="thedate" value="@DateTime.Now" />
            <input type="hidden" id="guid" name="guid" value="@PA.NewGuid()" />
            <button type="button" class="btn btn-primary btn-sm bt_submit ui-pagePost" data-custom-params="url:'@Url.Action("Add","MsgoutBox")'">回复</button>
            <button type="button" class="btn btn-default btn-sm ui-closeDialog">关闭</button>
        </div>
    </form>
</div>

<div class="ysyj" style="display:none;">
    <br/>
    <div class="">
        <div><br/></div>
        <div><br /></div>
        <div class="head">------------------ 原始邮件 ------------------</div>
        <div class="information" style="background:#EFEFEF;padding:10px 5px;margin:5px 0px 10px 0px;">
            <div>
                <b>发件人:</b>
                <span class="uid"></span>
            </div>
            <div>
                <b>发送时间:</b>
                <span class="thedate"></span>
            </div>
            <div>
                <b>收件人:</b>
                <span>@PA.GetCurrentUser().UserName</span>
            </div>
            <div>
                <b>主题:</b>
                <span class="title"></span>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">    
    var ajaxUrl = "@Url.Action("DetailData", "MsgoutBox")?id=" + Request("msg_id");
    $(".tb-list").FormBind(data);

    $(function () {
        var json=CallAjax("get",false,"@Url.Action("DetailData", "MsgoutBox")","id=" + Request("msg_id"))
        json = eval("(" + json + ")");
        $("#receiver").val(json[0].uid)
        $(".uid").text(json[0].uid);
        $(".thedate").text(json[0].thedate);
        $(".title").text(json[0].title);
        $(".content").text(json[0].content);
        ConvertText($(".Member"));

        $(".uid").text($("#receiver").val())
        $(".post_guid").val($(".guid").text())
        $("#title").val(function (n, c) {
            if (c.indexOf("回复:") >=0) {
                return json[0].title;
            } else {
                return "回复:"+json[0].title;
            }
            
        });
        $("#content").val(function (n, c) {
            return $(".ysyj").html() + c;

        });
    })
</script>