<script language="javascript">
	function onClickTree(node){
		var id = node.id;
		var tit = node.text;
		var url = node.url;
		var icon = node.iconCls;
		//alert(url);
		if(url){
			addTabs(id,tit,url,icon);
		}
	}
	
	var idd = '';
	var tit = '';
	var url = '';
	var icon = '';
	function addTabs(id,tit,url,icon){
		$(function(){
			var mod = '{$TC.config.CFG_OPEN_TABS}';
			//alert(mod);
			if(mod==1){
				var ishas = $("#rightTabs").tabs('exists',tit);
				if(!ishas){
					//$.messager.alert('提示',ishas);
					$("#rightTabs").tabs('add',{
						id : idd,
						title : tit,
						href : '__ITEM__'+url,
						closable : true,
						iconCls : icon
					});
				}else{
					$("#rightTabs").tabs('select',tit);
				}
			}else{
				var ishas = $("#rightTabs").tabs('exists',tit);
				if(!ishas){
					var tab = $("#rightTabs").tabs('getSelected');
					$.get('__GROUP__/index/clear', function(data){});
					$("#rightTabs").tabs('update',{
						tab:tab,
						options:{
							title : tit,
							href : '__ITEM__'+url,
							closable : false,
							iconCls : icon
						} 
					});
				}
			}
		});
	}
</script>
<div id="leftMenu" data-options="fit:true,border:false" class="easyui-accordion">
<foreach name="info" item="t">
 <?php
   if($t['mode']==1){
   	$access = IndexPublic::GS('User_group_table',$gid);
   }elseif($t['mode']==2){
    $access = IndexPublic::GS('User_company_table',$cid);
   }elseif($t['mode']==3){
    $access = IndexPublic::GS('User_part_table',$pid);
   }
  
 ?>
 <if condition="$t['type']=='='">
  <?php
   $view = unserialize($t['view']);
   if(strstr($t['level'],$access) || ($group_access>=999 && $t['level']<9999) || in_array($uid,$view)){
  ?>
  <div title="{$t.text}" data-options="iconCls:'{$t.iconCls}'">
   <ul class="easyui-tree left-tree" data-options="url:'__APP__?g=<?php echo GROUP_NAME; ?>&m=Index&a=json&mid={$t.id}',editable:false,lines:true,method:'get',onClick:function(node){onClickTree(node);}"></ul>
  </div>
  <?php
   }
  ?>
 <else />
  <?php
   $view = unserialize($t['view']);
   if($access>=$t['level'] || in_array($uid,$view)){
  ?>
  <div title="{$t.text}" data-options="iconCls:'{$t.iconCls}'">
   <ul class="easyui-tree left-tree" data-options="url:'__APP__?g=<?php echo GROUP_NAME; ?>&m=Index&a=json&mid={$t.id}',editable:false,lines:true,method:'get',onClick:function(node){onClickTree(node);}"></ul>
  </div>
  <?php
   }
  ?>
 </if>
</foreach>
<!--
 <div title="系统管理" data-options="iconCls:'icon-setting'">
 <ul class="easyui-tree left-tree",editable:false,lines:true">
  <li data-options="text:'菜单管理',url:'__APP__?g=<?php echo GROUP_NAME; ?>&m=Menu&a=index'">菜单管理</li>
 </ul>
 </div>
-->
</div>