<div class="row-fluid">
	<div class="col-xs-12">
		<div class="span2" style="min-height:700px;">
	      	<?php echo $nav_view; ?>
	    </div>
	    <?php if (!empty($announce_detail)) { ?>
      <div class="span7 offset1">
	    	<h3><?php echo $announce_detail->ta_title; ?></h3>
	    	<p><?php echo $announce_detail->ta_content; ?></p>
      </div>
	    <?php }elseif(!empty($announce_list)){ ?>
      <div class="span9">
	    	<table class="table table-striped">
              <thead>
                <tr>
                  <th>#</th>
                  <th>公告</th>
                  <th>操作</th>
                </tr>
              </thead>
              <tbody>
              	<?php foreach ($announce_list as $k => $v) { ?>
                <tr id="announce_<?php echo $v->ta_id; ?>">
                  <td><?php echo $k+1; ?></td>
                  <td><a href="<?php echo site_url('author/announce_detail'.'/'.$v->ta_id.'/announce'); ?>"><?php echo $v->ta_title; ?></a></td>
                  <td><a class="announce_delete" href="<?php echo site_url('author/announce_delete'.'/'.$v->ta_id); ?>">删除</a> / 
                  	  <a href="<?php echo site_url('author/announce_edit/'.$v->ta_id.'/announce'); ?>">编辑</a></td>
                </tr>
                <?php } ?>
                <tr><td style="background: #fff;">.</td><td style="background: #fff;"></td><td style="background: #fff;"></td></tr>
                <tr>
                  <td  style="background: #fff; border-top:none;">#</td>
                  <td  style="background: #fff; border-top:none;"><strong>规则</strong></td>
                  <td  style="background: #fff; border-top:none;"></td>
                </tr>
                <?php foreach ($notice_list as $k => $v) { ?>
                <tr id="announce_<?php echo $v->ta_id; ?>">
                  <td><?php echo $k+1; ?></td>
                  <td><a href="<?php echo site_url('author/announce_detail'.'/'.$v->ta_id); ?>"><?php echo $v->ta_title; ?></a></td>
                  <td><a class="announce_delete" href="<?php echo site_url('author/announce_delete'.'/'.$v->ta_id); ?>">删除</a> / 
                      <a href="<?php echo site_url('author/announce_edit'.'/'.$v->ta_id); ?>">编辑</a></td>
                </tr>
                <?php } ?>
              </tbody>
            </table>
        <?php } ?>
	    </div>
	    <div class="span1"></div>
	</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
	//删除公告
	$(".announce_delete").click(function(event){
		var url= $(this).attr('href');
		$.post(url,'',function(responseText){
            var responseText=eval("("+responseText+")");//转换为json对象 
            for (var key in responseText) {
                if (responseText[key].name == 'ok') {
                   var urls=url.split('/');
                   var announce_id=urls.pop();
                   $("#announce_"+announce_id).remove();
                }else if(responseText[key].name == 'no'){
                    alert('error!');
                }
            }
        });
	    event.preventDefault();
	});
});

</script>
</body>
</html>