<div class="rounded table" style="width: 100%;">
<table width="100%" cellpadding="0" cellspacing="0" border="0" class="box_top">
        <thead class="thead">
            <tr class="space">
                <th colspan="10">列表查看  </th>
            </tr>
        </thead>
    </table>
    <form action="{:U("Admin/$modulename/doDelete")}" method="post" name="submitform" id="submitform">
    <div class="contentbox" data-uri='{:U("Admin/$modulename/doEditStatus")}'>
        <table width="100%" class="list td_align">
            <thead>
                <tr class="thead">
                    <th class="align-center" width="5%"><input name="id" type="checkbox" class="checkAll" id="checkboxall"  data-checklist="checkSon_x" data-direction="x"/></th>
                    
                    <th class="align-center"  width="5%">ID</th>
                    <th class="align-center"  width="5%">缩略图</th>
                    <th class="align-center"  width="30%">信息标题</th>
                    <th class="align-center"  width="12%">所属栏目</th>
                    <th class="align-center"  width="5%">点击</th>
                    <th class="align-center"  width="10%">发布人</th>
                    <th class="align-center"  width="15%">更新时间</th>
                    <th class="align-center">状态</th>
                    <th class="align-center">操作</th>
                </tr>
            </thead>
            <tbody>
            <volist name="data" id="vo">
                <tr id="list_{$vo.id}">
                    <td class="align-center" width="5%">
                        <input type="checkbox" value="{$vo.id}" name="ids[]" class="checkSon" data-xid="checkSon_x"/>
                    </td>
                    
                    <td class="align-center" width="5%">
                        {$vo.id}
                    </td>
                      <td class="align-center" width="5%">
                        <img src="{$vo.pic}" width="30" height="30" />
                    </td>
                    <td class="align-center" width="30%"><font color="{$vo.colorval}">{$vo.title}</font></td>
                    
                    <td class="align-center" width="12%">{$vo.cat_title}</td>
                    <td class="align-center" width="5%">
                        {$vo.hits}
                    </td>
                    <td class="align-center" width="10%">{$vo.author_name}</td>
                    <td class="align-center" width="15%">{$vo.update_time}</td>
                    <td class="align-center">
                        <img class="pointer" data-id="{$vo[id]}" style="cursor: pointer;" data-field="status" data-value="{$vo.status}"
                                <if condition="$vo.status eq '1'">
                                    src="__PUBLIC__/Admin/images/icons/icon_1.png" alt="启用" title="启用"
                                <else />
                                    src="__PUBLIC__/Admin/images/icons/icon_0.png" alt="停用" title="停用"
                                </if> 
                            />
                    </td>
                    <td class="align-center">
                        <div class="button-group">

                            <a data-url="{:U("Admin/$modulename/edit","id=$vo[id]")}"   class="button danger icon dialog edit" alt="编辑" title="编辑"></a>
                            <a href="javascript:void(0);"  data-uri='{:U("Admin/$modulename/doDelete","ids=$vo[id]")}' val="{$vo[id]}" data-msg="确定要删吗？" data-acttype="ajax" class="button danger icon pill remove doDel" title="删除"></a>
                        </div>
                    </td>
                </tr>
            </volist>
            <empty name="data">
                <tr><td colspan="10" class="left align-center" style="height:50px;">暂时没有数据!</td></tr>
            </empty>
            </tbody>
        </table>
        <div style="float:left; line-height:50px; width:600px; padding-left:20px;">
        
        <input id="submit" data-url="{:U("Admin/$modulename/add")}" title="添加" class="btn dialog" type="button" value="添加">
              <input id="delete"  class="btn" type="submit" value="删除选中">          
        </div>        
        <div class="pagination">
        <div style="float:left;">         
            <ul>           
            
            {$page}
            <select name="pageall" onChange="window.location.href=this.value">
                <option value='{:U("/Admin/$modulename/index/cid/$cid","pageall=1")}' <if condition="$filter.pageall eq '1'">selected="selected"</if>>1条/页</option>
                <option value='{:U("/Admin/$modulename/index/cid/$cid","pageall=5")}' <if condition="$filter.pageall eq '5'">selected="selected"</if>>5条/页</option>
                <option value='{:U("/Admin/$modulename/index/cid/$cid","pageall=10")}'<if condition="$filter.pageall eq '10'">selected="selected"</if>>10条/页</option>
                <option value='{:U("/Admin/$modulename/index/cid/$cid","pageall=20")}'<if condition="$filter.pageall eq '20'">selected="selected"</if>>20条/页</option>
                <option value='{:U("/Admin/$modulename/index/cid/$cid","pageall=50")}'<if condition="$filter.pageall eq '50'">selected="selected"</if>>50条/页</option>
                <option value='{:U("/Admin/$modulename/index/cid/$cid","pageall=80")}'<if condition="$filter.pageall eq '80'">selected="selected"</if>>80条/页</option>
                <option value='{:U("/Admin/$modulename/index/cid/$cid","pageall=100")}'<if condition="$filter.pageall eq '100'">selected="selected"</if>>100条/页</option>
                <option value='{:U("/Admin/$modulename/index/cid/$cid","pageall=500")}'<if condition="$filter.pageall eq '500'">selected="selected"</if>>500条/页</option>
            </select>    
        {$category}
        </ul>
        </div>
        </div>
        <div style="clear: both;"></div>
    </div>
	</form>
</div>
<script>
    $(document).ready(function(){
        $(".doDel").click(function(){
            var title = $(this).attr("data-msg");
            var uri = $(this).attr("data-uri");
            if(confirm("提示：您确定要删除吗？")){
				window.location.href=uri;
            };
        });
		
		$("select[name='cid']").change(function(){
			var cid=$(this).children('option:selected').val();
			var url='{:U("/Admin/$modulename/index/cid/")}'+"/"+cid;
			window.location.href=url;	
		});
		
		$("#delete").click(function(){
			if(confirm("提示：您确定要删除吗？删除后不能恢复！")){
				return true;	
			}	
			return false;
		});
	
        
        //切换
        $('.pointer').live('click', function() {
            var url = $(".contentbox").attr("data-uri");
            var img    = this,
            s_val  = ($(img).attr('data-value'))== 0 ? 1 : 0,
            s_name = $(img).attr('data-field'),
            s_id   = $(img).attr('data-id'),
            s_src  = $(img).attr('src');
            s_msg = ($(img).attr('data-value'))== 0 ? '启用' : '停用';
            $.ajax({
                url:url,
                cache:false,
                dataType:"json",
                data: {id:s_id, field:s_name, val:s_val},
                type:"POST",
                beforeSend:function(){
                    $("#J_ajax_loading").stop().removeClass('ajax_error').addClass('ajax_loading').html("提交请求中，请稍候...").show();
                },
                error:function(){
                    $("#J_ajax_loading").addClass('ajax_error').html("AJAX请求发生错误！").show().fadeOut(5000);
                },
                success:function(msgObj){
                    $("#J_ajax_loading").hide();
                    if(msgObj.status == '1'){
                        $("#J_ajax_loading").removeClass('ajax_error').addClass('ajax_success').html(msgObj.info).show().fadeOut(5000);
                        if(s_src.indexOf('0')>-1) {
                                $(img).attr({'src':s_src.replace('0','1'),'data-value':s_val,'title':s_msg,'alt':s_msg});
                        } else {
                                $(img).attr({'src':s_src.replace('1','0'),'data-value':s_val,'title':s_msg,'alt':s_msg});
                        }
                    }else{
                        $("#J_ajax_loading").removeClass('ajax_success').addClass('ajax_error').html(msgObj.info).show().fadeOut(5000);
                    }
                }
            });
        });
    });
</script>