{include file="head.html"}
<div id="maincontent">
  <div class="wrap">
    <div class="crumbs"> <a href="__APP__/index/home">{lang='栏目管理'}</a> <a href="#">{lang='栏目管理'}</a> </div>
    <hr />
    <?php if(module('common')->auth_if(7)) { ?>
    <div class="admin_main_function">
      <a href="javascript:void(0)" onclick="open_window('__URL__/add_all','{lang='批量添加'}');">{lang='批量添加'}</a> <a  href="javascript:void(0)" onclick="open_window('__URL__/add','{lang='添加栏目'}');" >{lang='添加栏目'}</a>
    </div>
    <?php } ?>
    <table class="list_table table_style">
      <thead>
        <tr>
          <th width="10%"><div align="center">ID</div></th>
          <th width="25%"><div align="left">{lang='栏目名称'}</div></th>
          <th width="15%"><div align="center">{lang='属性'}</div></th>
          <th width="15%"><div align="center">{lang='类型'}</div></th>
          <th width="15%"><div align="center">{lang='排序'}</div></th>
          <th width="20%"><div align="center">{lang='管理操作'}</div></th>
        </tr>
      </thead>
      <?php if (is_array($cat)){ foreach ($cat as $vo) { ?>
      <tr id="del_{$vo['id']}">
        <td align="center">{$vo['id']}</td>
        <td align="left"><a href="__ROOTURL__/list/{$vo['id']}.html" target="_blank">{$vo['cname']}</a></td>
        <td align="center"><?php if ($vo['type'] == 0) {echo module('common')->getlang('栏目页');} ?>
          <?php if ($vo['type'] == 1) {echo module('common')->getlang('列表页');} ?></td>
        <td align="center"><?php echo module('common')->getlang($vo['model_name']) ?></td>
        <td align="center"><input name="sorter" onblur="sorter({$vo['id']},$(this).val())" style="width:50px; text-align:center;border:1px #ddd solid" type="text" value="{$vo['sorter']}" /></td>
        <td align="center"><?php if(module('common')->auth_if(8)) { ?>
          <a href="javascript:copylist({$vo['id']})" >{lang='复制'}</a> | <a href="__APP__{$vo['edit_url']}-{$vo['id']}" ><?php echo module('common')->getlang($vo['edit_name']) ?></a> |
          <?php }else{ ?>
          <span style="color:#999"><?php echo module('common')->getlang($vo['edit_name']) ?> |</span>
          <?php } ?>
          <?php if(module('common')->auth_if(9)) { ?>
          <a href="javascript:dellist('__APP__{$vo['del_url']}-{$vo['id']}',{$vo['id']})">{lang='删除'}</a></td>
        <?php }else{ ?>
        <span style="color:#999">{lang='删除'}</span>
        <?php } ?>
      </tr>
      <?php }} ?>
    </table>
  </div>
</div>
<script language="javascript">
//复制
function copylist(id) {
	parent.asyncbox.confirm('{lang='复制栏目将会复制栏目和包含子栏目的属性，不包括内容，确认要复制？'}', '{lang='操作提示'}',
	function(actioncopy) {　　
	if (actioncopy == 'ok') {
	window.location.href="__URL__/copy_class-"+id;
    }
	});

}

//删除
function dellist(url,id) {
	parent.asyncbox.confirm('{lang='确认删除？删除后不可恢复！'}', '{lang='操作提示'}',
	function(action) {　　　　
	if (action == 'ok') {
	$.ajax({
	type: 'POST',
	url: url,
	dataType: "json",
  success: function(json) {
	  if(json.result==1){//成功	
	  $('#del_' + id).remove();
	  }else{
		parent.asyncbox.error(json.msg,'{lang='删除失败'}');
	  }
  }
	});
	　
	}	　　
	});
}
//排序
function sorter(id,sid) {	
	$.ajax({
	type: 'POST',
	url: '__URL__/sorter',
	data:{ id:id, sorter:sid },
	dataType: "json",
  success: function(json) {
	  if(json.result==0){//失败
	  parent.asyncbox.error(json.msg,'{lang='操作失败'}');
	  }
     }
     });	
}


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