@{
    Dictionary<string, string> permissionsDictionary = ViewBag.PermissionsDictionary;
    IEnumerable<dynamic> fieldData = ViewBag.FieldData;
}
<div class="current-location">
    <ul>
        <li class="left"><i class="glyphicon glyphicon-home"></i><a href="javascript:void(0)" onclick="location.href=location.href">回复管理</a></li>
        <li class="right"><a href="javascript:void(0)" onclick="LoadData()" title="刷新"><span class="glyphicon glyphicon-refresh"></span></a></li>
    </ul>
</div>
<div class="main">

    <div class="head-tab" id="head_tab">
        <ul>
            <li data-state="1" class="current">使用中</li>
            <li data-state="0">已删除</li>
        </ul>
    </div>
    <table border=0 cellpadding=0 cellspacing=0 class="tb-head form-inline form-group-sm">
        <tr>
            <td>
                <div class="btn-group btn-group-sm">
                    <button type="button" class="btn btn-default ui-selectInvert">反选</button>
                    <div class="btn-group btn-group-sm">
                        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                            菜单<span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu" role="menu">
                            <li><a href="javascript:void(0)" class="ui-dialog" data-custom-params="title:'添加',url:'@Url.Action("add")?table=@ViewBag.Table',width:'95%',height:'95%'">添加</a></li>
                            <li class="divider"></li>
                            <li><a href="javascript:void(0)" class="ui-deleteMultiple" data-custom-params="url:'@Url.Action("Delete")?table=@(ViewBag.Table)',callBack:'delCallBack'">删除</a></li>
                        </ul>
                    </div>
                </div>
            </td>
            <td align="right">
                <div class="controls">
                    <select id="_sfield" name="_sfield" class="btn-xs ui-queryString ui-setName form-control">
                        <option value="username">回复用户</option>
                        <option value="content">回复内容</option>
                        <option value="replydate" searchType="range" valueType="date">回复时间</option>
                    </select>
                    <input type="text" id="keyword" name="keyword" class="ui-queryString ui-keyword  form-control" style="width:150px" placeholder="输入关键词">
                    <input type="button" value="确定" class="btn btn-default btn-sm ui-queryString-search">
                </div>
            </td>
        </tr>
    </table>

    <div id="tbList">
        <div class="item" id="item_{id}">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <ul class="clearfix">
                        <li class="left">
                            <input type="checkbox" id="id" name="id" value="{id}" class="id_{id}">
                            pageadmin最新版本的通知  &nbsp; 
                        </li>
                        <li class="right">
                            <div class="btn-group btn-group-sm">
                                <button type="button" data-custom-params="title:'修改',url:'@Url.Action("Edit")?table=@ViewBag.Table&guid={guid}&id={id}',width:'95%',height:'95%'" class="btn btn-default btn-sm ui-dialog">修改</button>
                                <button type="button" data-custom-params="url:'@Url.Action("Delete")?table=@(ViewBag.Table)',id:'{id}',addParams:'guid={guid}',callBack:'delCallBack'" class="btn btn-default btn-sm ui-deleteSingle">删除</button>
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="panel-body">
                    <ul class="clearfix">
                        <li><div style="max-height:100px;overflow-y:scroll">{content}</div></li>
                        <li>
                            <div class="attachmentsBox" data-custom-params="table:'reply',field:'attachments',guid:'{guid}',id:{id}"></div>
                        </li>
                        <li class="right">
                            回复时间：{thedate}&nbsp;&nbsp; 回复人：{username}  
                        </li>
                    </ul>
                </div>
        </div>
    </div>
</div>
    </div>
<script type="text/javascript">
    function LoadData() {
        var url = "@Url.Action("PageListData")"
        $("#tbList").ListBind(url, { callBack: "LoadAttachments" });
    }
    LoadData();

    function LoadAttachments()
    {
        var $attachmentsBox = $(".attachmentsBox");
        $attachmentsBox.each(function () {
            var $this = $(this);
            var thisParam = $this.attr("data-custom-params");
            thisParam = ExtendObject(thisParam);
            ListAttachments($this, thisParam);
        });
    }

    function ListAttachments(jqObj,param)
    {
        $.get("/api/AttachmentData/getlist",param,function (dataList){
            dataList = JsonParse(dataList);
            var html = "<ul>";
            $.each(dataList, function (idx, obj) {
                var name = obj.title;
                var path = obj.path;
                var thumbnail = obj.thumbnail;
                //if (IsImage(path))
                //{
                //    name = "<img src=\"" + path + "\" class=\"thumbnail\">";
                //}
                name = "<span class=\"glyphicon glyphicon-paperclip\">" + name + "</span>";
                html += "<li><a href=\"" + path + "\" target=_blank>" + name + "</a></li>";
                html += "</ul>";
                jqObj.html(html);
            });

        });

    }
</script>




