<!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>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
            <title>{{$lang.admin_title}}</title>
            <script type="text/javascript" src="{{$js_path}}global.js"></script>
            <script type="text/javascript" src="{{$js_path}}transport.js"></script>
            <script type="text/javascript" src="{{$admin_js_path}}admin.js"></script>
            <script type="text/javascript">
                var fnChangeComment = function(cId, cValue) {
                    sComment = $(cId).value;
                    Ajax.call('includes/transport.php?&act=edit_comment&reply_id='+cValue+'&reply_content='+sComment,'', fnCheckCommentResponse, 'GET', 'JSON');
                }
                var fnCheckCommentResponse = function(result) {
                    if (result.error) {
                        alert(result.error);
                    } else {
                        alert(result.status);
                    }
                }
                var fnChangeStatus = function(rId) {
                    var statusVal = $('auth_value'+rId).value;
                    Ajax.call('includes/transport.php?&act=change_comment_status&reply_id='+rId+'&is_auth='+statusVal,'', fnCheckStatusResponse, 'GET', 'JSON');
                }
                var fnCheckStatusResponse = function(result) {
                    if (result.error) {
                        alert(result.error);
                    } else {
                        oReplyStatus = $('reply_status'+result.reply_id);
                        oAuthValue = $('auth_value'+result.reply_id);
                        if (result.is_auth == 1) {
                            oReplyStatus.innerHTML = '{{$lang.already_approved}}';
                            oAuthValue.value = '0';
                        } else {
                            oReplyStatus.innerHTML = '{{$lang.through_examination}}';
                            oAuthValue.value = '1';
                        }
                        //alert(result.status);
                    }
                }
            </script>
            <link href="{{$style_path}}main.css" rel="stylesheet" type="text/css" />
    </head>
    <body>
        <div class="layout">
            <!-- 当前所在位置和相关链接 -->
            <div class="location_nav">
                <!-- 当前所在位置 -->
                <div class="location_link">
                    <ol id='breadcrumb'>
                        {{foreach from=$location_link item=link name=link}}
                        <li>{{$link}}{{if !$smarty.foreach.link.last}}&nbsp;&gt;&nbsp;{{/if}}</li>
                        {{/foreach}}
                    </ol>
                </div>
                <div id="load-div" class="loaddiv"></div>
                <!-- 相关链接 -->
                <div class="location_other">
                    {{foreach from=$location_other item=other_link}}
                    {{$other_link}}&nbsp;
                    {{/foreach}}
                </div>
            </div>

            <!-- 文章列表标题行 -->
            <div class="title_bgcolor">
                <span>{{$lang.comment_list}}</span>
            </div>
            <!-- 评论列表 -->
            <div class="div_li_data">
                <form style="margin-top:0px;" action="{{$current_page_url}}" method="post">
                    <span>
                            <input type="checkbox" onclick="fnSelectCheckbox(this, 'reply_box')"/>
                        （{{$lang.select_all}}&nbsp;/&nbsp;{{$lang.select_notall}}）
                    </span>

                    <span>
                        <input type='submit' name="sub_del_reply" class='button' value='{{$lang.delete_select}}' onclick="javascript: return fnRunterDel('{{$lang.notice_allow_delete}}')"/>
                    </span>
                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <label>{{$lang.label_cate}}：</label>
                    <select name="text_cate_search">
                        <option value="0">{{$lang.please_select_cate}}</option>
                        {{foreach from=$cate_list item=cate}}
                        <option value="{{$cate.category_id}}" {{if $w_cate_id eq $cate.category_id}}selected{{/if}}>{{$cate.category_name}}</option>
                        {{/foreach}}
                    </select>
                    <label>{{$lang.label_tag}}：</label>
                    <select name="text_tag_search">
                        <option value="0">{{$lang.please_select_tag}}</option>
                        {{foreach from=$tags_list item=tags}}
                        <option value="{{$tags.tag_id}}" {{if $w_tag_id eq $tags.tag_id}}selected{{/if}} >{{$tags.tag_name}}</option>
                        {{/foreach}}
                    </select>
                    <label>{{$lang.label_blog_subject}}：</label>
                    <input type="text" name="text_subject_search" value="{{if $w_subject_val}}{{$w_subject_val}}{{/if}}" size="5"/>
                    <label>{{$lang.label_comment_content}}：</label>
                    <input type="text" name="text_comment_search" value="{{if $w_comment_val}}{{$w_comment_val}}{{/if}}" size="5"/>
                    <input type="submit" class='button' name="text_search_sub" value="{{$lang.search}}" />
                    <span><hr></span>
                    <table width="100%" bgcolor="#E4EAF1" cellpadding="1" cellspacing="1" border="0" id="reply_box">
                        <tr style="background:#6D829C;font-size:14px;color:#FFF; font-weight:bold;height:25px;">
                            <th width="2%"></th>
                            <th width="5%">{{$lang.label_number}}</th>
                            <th width="19%">{{$lang.label_blog_subject}}</th>
                            <th width="18%">{{$lang.label_comment_content}}</th>
                            <th width="16%">{{$lang.label_comment_time}}</th>
                            <th width="10%">{{$lang.label_user_ip}}</th>
                            <th width="10%">{{$lang.label_reply_author}}</th>
                            <th width="10%">{{$lang.label_last_reply_time}}</th>
                            <th width="10%">{{$lang.label_operate}}</th>
                        </tr>
                        {{foreach from=$comment_list item=comment}}
                        <tr style="background:#FFF;font-size:14px;color:#6D829C;height:25px;">
                            <td style="padding-left:10px;"><input type="checkbox" name="text_reply_id[]" value="{{$comment.reply_id}}"/></td>
                            <td style="padding-left:10px;">{{$comment.reply_id}}</td>
                            <td style="padding-left:10px;" class="list"><a href="../view_content.php?aid={{$comment.article_id}}" target="_blank">{{$comment.subject}}</a></td>
                            <td style="padding-left:10px;">
                                <textarea class="textarea_comment">{{$comment.content}}</textarea><br/>
                                <font color="red">{{$lang.label_reply_content}}：</font>
                                <input type="hidden" name="text_change_comment_id" value="{{$comment.reply_id}}"/>
                                <input type="button" value="{{$lang.button_change_repl}}"onclick="fnChangeComment('text_change_comment', '{{$comment.reply_id}}');" class="small_button"/><br/>
                                <textarea name="text_change_comment" class="textarea_comment" id="text_change_comment">{{$comment.admin_reply_content}}</textarea><br/>
                            </td>
                            <td style="padding-left:18px;">{{$comment.submit_time|date_format:"%Y-%m-%e %T"}}</td>
                            <td style="padding-left:10px;">{{$comment.author_name}}({{$comment.email}}).{{$comment.author_ip}}</td>
                            <td style="padding-left:10px;">{{$comment.admin_user_name}}</td>
                            <td style="padding-left:10px;">{{$comment.admin_last_change_time|date_format:"%Y-%m-%e %T"}}</td>
                            <td style="padding-left:10px;" class="list">
                                <input type="button" value="{{$lang.label_approved}}"onclick="fnChangeStatus('{{$comment.reply_id}}');" class="small_button"/>
                                <span id="reply_status{{$comment.reply_id}}" style="float:right;width:150px;">
                                {{if $comment.is_auth eq 1}}
                                {{$lang.already_approved}}
                                {{else}}
                                {{$lang.through_examination}}
                                {{/if}}
                                </span>
                                {{if $comment.is_auth eq 1}}
                                <input type="hidden" id="auth_value{{$comment.reply_id}}" value="0"/>
                                {{else}}
                                <input type="hidden" id="auth_value{{$comment.reply_id}}" value="1"/>
                                {{/if}}
                                <a href="{{$current_page_url}}&mod=del&rid={{$comment.reply_id}}" onclick="javascript: return fnRunterDel('{{$lang.notice_allow_delete}}')">{{$lang.operate_delete}}</a>
                            </td>
                        </tr>
                        {{/foreach}}
                        <tr>
                            <td colspan="9" style="text-align:right;padding-right:20px;">
                                <div class="sabrosus" id="local_page" style="text-align:right;">
                                    {{$page}}
                                </div>
                            </td>
                        </tr>
                    </table>
                    <div>&nbsp;</div>
            </form>
            </div>

        </div>
    </body>
    <!-- 加载分页的样式和框架的高度 -->
    <script type="text/javascript">
            var sSpan = $('local_page').childNodes;
            var iNum  = sSpan.length;
            for (i = 0; i < iNum; i++) {
                if (sSpan[i].tagName == 'SPAN') {
                    sSpan[i].className += 'current';
                }
            }
            iHeight = parseInt(document.body.scrollHeight);
            if (iHeight < 700) {
                iHeight = 700;
            }
            window.parent.document.getElementById('main').style.height =  iHeight  + 2 + "px";
    </script>
</html>