{include file="header.tpl" page_name=$page_name sys_name=$sys_name}
<div align="center">
	{$admin_nav}
    {if $do == 'list' || $do == ''}
    	{literal}
        	<script type="text/javascript">
				$(document).ready(function(){
					$("input[type='checkbox']").css("cursor","pointer");
				});
				function phpwms_submit(self){
					var flg = true;
					$(".form_checkbox").each(function(i){
						if($(this).attr("checked") == true){
							flg = false;
							return;
						}
					});
					if(flg){
						alert('请选择要操作的项');
						return false;
					}
					$("#phpwms_guestbook_form_delete").attr("action", $(self).attr("id"));
					$("#phpwms_guestbook_form_delete").submit();
				}
				function checkall(self){
					$(".form_checkbox").attr("checked", $(self).attr("checked"));
				}
            </script>
        {/literal}
    	<form action="" method="post" id="phpwms_guestbook_form_delete">
            <table width="98%" border="0" cellpadding="0" cellspacing="0" class="tableborder tableborder_line">
            	{if $result.data}
                	<tr class="header">
                    	<td width="50px"><input type="checkbox" onclick="checkall(this)" />全选</td>
                        <td>标题</td>
                        <td>昵称</td>
                        <td>类型</td>
                        <td>QQ</td>
                        <td>E-Mail</td>
                        <td>回复状态</td>
                        <td>审核状态</td>
                        <td>添加时间</td>
                        <td>操作</td>
                    </tr>
                    {foreach from=$result.data item=item}
                    	<tr>
                    		<td align="center" style="text-align:center"><input  type="checkbox" value="{$item.id}" name="gbid[]" class="form_checkbox" /></td>
                            <td>{$item.title}</td>
                            <td>{$item.user_name}</td>
                            <td>{if $item.request_type == 'request'}留言{else}评论{/if}</td>
                            <td><a target="blank" href="http://wpa.qq.com/msgrd?V=1&Uin={$item.qq}&Site=phpwms客服&Menu=yes">{$item.qq}</a></td>
                            <td><a href="admincp.php?action=replybook&email={$item.email}&gbid={$item.email}">{$item.email}</a></td>
                            <td align="center" style="text-align:center">{if  $item.request_type == 'reuqest'}不必回复{elseif $item.state==0} <font color="#FF0000">没回复</font>{else}已回复{/if}</td>
                            <td align="center" style="text-align:center">{if $item.hide eq '1'}待审{else}已通过{/if}</td>
                            <td align="center" style="text-align:center">{$item.post_time|date_format:"%Y-%m-%e-%H:%M:%S"}</td>
                            <td align="center" style="text-align:center">
                            	<a href="?action=guestbook&do=detail&gbid={$item.id}" >详情</a> | <a href="?action=guestbook&do=del&gbid={$item.id}">删除</a>
                            </td>
                        </tr>
                    {/foreach}
                    <tr>
                    	<td colspan="9">
                        	<div style="float:left" id="?action=guestbook&do=del&page={$result.curpage}" onclick="phpwms_submit(this)" class="block_button">批量删除</div>
                            <div style="float:right">{$result.page}</div>
                        </td>
                    </tr>
                {else}
                	<tr>
                        <td><div class="showNotice">暂时没有留言。</div></td>
                    </tr>
                {/if}
            </table>
        </form>
	{elseif $do=='detail'}
    	{literal}
        	<script type="text/javascript">
				$(document).ready(function(){
					$(".guestbook_btn_submit").click(function(){
						var value = $("#admin_content").val();
						if(empty(value)){
							alert("回复内容不能为空");
							return false;
						}
						$("#phpwms_from_add").attr("action", $(this).attr("id"));
						$("#phpwms_from_add").submit();
					});
				});
            </script>
        {/literal}
    	<form method="post" id="phpwms_from_add">
            <table width="98%" border="0" cellpadding="0" cellspacing="0" class="tableborder">
                <tr>
                    <td class="one">审核</td>
                    <td><input type="checkbox" value="1"  name="is_hide" checked="checked"/>&nbsp;当前状态:<font style="color:#F00">{if $result.hide eq '1'}已通过{else}待审{/if}</font></td>
                </tr>
                <tr>
                    <td class="one">标题</td>
                    <td>{$result.title}</td>
                </tr>
                <tr>
                    <td class="one">内容</td>
                    <td><pre>{$result.content}</pre></td>
                </tr>
                <tr>
                    <td class="one">其他</td>
                    <td>用户：{$result.user_name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;留言时间：{$result.post_time|date_format:"%Y-%m-%e-%H:%M:%S"} </td>
                </tr>
                <tr>
                	<td class="one">回复内容</td>
                    <td><textarea name="admin_content" id="admin_content" style="width:400px; height:200px" >{$result.admin_content}</textarea></td>
                </tr>
                {if $result.state}
                    <tr>
                    	<td class="one">回复信息</td>
                        <td>
                        	管理员：{$result.admin_name}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;回复时间：{$result.post_time|date_format:"%Y-%m-%e-%H:%M:%S"} </td>
                        </td>
                    </tr>
                {/if}
            </table>
            <input type="hidden" value="{$result.id}" name="gbid" />
            <div align="center" style="padding: 5px;"><input type="button" class="guestbook_btn_submit" id="?action=guestbook&do=reply&page={$curpage}" value="保存" /> <input type="button" value="返回"  onclick="window.location.href='admincp.php?action=guestbook&do=list'"/></div>
        </form>
    {/if}
</div>
{include file="footer.tpl"}