{include file="header.tpl" page_name=$page_name sys_name=$sys_name}
<div align="center">
{$admin_nav}
{if $do == ''}
    {literal}
        <script type="text/javascript">
            function checkall(self){
                $(".form_checkbox").attr("checked", $(self).attr("checked"));
            }
            $(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_notice_delete_form").attr("action", $(self).attr("id"));
                $("#phpwms_notice_delete_form").submit();
            }
        </script>
    {/literal}
    <form action="" id="phpwms_notice_delete_form" method="post">
    <table width="98%" border="0" cellpadding="0" cellspacing="0" class="tableborder tableborder_line">
    	{if $data}
        <tr class="header">
            <td width="10%"><input type="checkbox" onclick="checkall(this)" />全选</td>
            <td>公告标题</td>
            <td>添加时间</td>
            <td>状态</td>
            <td>管理选项</td>
        </tr>
            {section name=i loop=$data}
                <tr>
                    <td align="center" style="text-align:center;"><input name="noticeid[]" class="form_checkbox" type="checkbox" value="{$data[i].id}" /></td>
                    <td>{$data[i].title}</td>
                    <td style="text-align:center">{$data[i].post_time}</td>
                    <td style="text-align:center">{if $data[i].state == 0}<font color=red>未发布</font>{else}已发布{/if}</td>
                    <td style="text-align:center"><a href="?action=notice&do=edit&noticeid={$data[i].id}&page={$curpage}">编辑</a> | <a href="?action=notice&do=del&noticeid={$data[i].id}&page={$curpage}">删除</a></td>
                </tr>
            {/section}
            <td colspan="9">
                <div style="float:left" id="?action=notice&do=del&page={$curpage}" onclick="phpwms_submit(this)" class="block_button">批量删除</div>
                <div style="float:right">{$show_page}</div>
            </td>
            
        {else}
       		 <tr>
                <td><div class="showNotice">没有数据，请您添加公告。</div></td>
             </tr>
        {/if}
    </table>
    </form>
{elseif $do == 'add' || $do == 'edit'}
    {literal}
        <script language="javascript">
            function chkForm() {
                var title = document.getElementById("title");
                if (title.value == "") {
                    alert('公告标题为空！');
                    return false;
                }
                return true;
            }
        </script>
    {/literal}
    <form action="?action=notice&do=oper&page={$curpage}" method="post" name="frm" onSubmit="return chkForm();">
        <table width="98%" border="0" cellpadding="0" cellspacing="0" class="tableborder">
        <tbody>
            <tr>
                <td width="13%"  class="one">公告标题：</td>
                <td width="87%"><input type="text" name="data[title]" size=50 id="title" value="{$result.title}">&nbsp;&nbsp;<font color=red>*</font></td>
            </tr>
            <tr>
                <td  class="one">公告内容：</td>
                <td>{$body}</td>
            </tr>
            <tr>
                <td  class="one">立即发布：</td>
                <td>
                   <input type="radio" name="data[state]" value="1" {if $result.state != 0 || $result.state == ''} checked="checked"{/if}> 是
                    <input type="radio" name="data[state]" value="0" {if $result.state == 0 && $result.state != ''} checked="checked"{/if}> 否
                </td>
            </tr>
            <tr>
                <td colspan="2"><div align="center"><input type="submit" value=" 提交 "></div></td>
            </tr>
        </tbody>
        </table>
        <input type="hidden" name="noticeid"  value="{$result.id}" />
    </form>
{/if}
</div>
{include file="footer.tpl"}