<%-- 
  * @Title: 富客户端登陆首页
  * @Description: 
  * @Copyright: Copyright (c) 2015
  * @Company:  
  * @Changelog: 2015-12-23，创建，高伟杰
  */ 
--%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page contentType="text/html; charset=UTF-8"%>
<html>
    <head>
       
        <title>资源平台 | Res Platform</title>
        <%--  富客户端环境引用文件  --%> 
		<%@ include file="/gaowj/header-simple-1.0.jsp"%>
		<link rel="shortcut icon" href="images/main/logo.ico" />
        <link rel="icon" type="image/gif" href="images/main/logo.png" />
    </head>
    <body class="easyui-layout" data-options="fit:true">
		<div id="layout_north" data-options="region:'north'" style="height:80px;background:url('${ctx}/images/main/nbjwtop.jpg') no-repeat;"></div>
		<div id="layout_south" data-options="region:'south',split:true" style="height:30px;overflow:hidden;border-top:none;">
		  <div id="foot" ></div>
		</div>
		<div id="layout_west" data-options="region:'west',split:true,iconCls:'icon-ext-22_27_menu'" title="&nbsp;菜单导航" style="width:163px;overflow:auto;">
            <jsp:include page="/system/pages/frameEasyui/menu.jsp" />
		</div>
		<div id="layout_center" data-options="region:'center'" style="overflow:hidden;">
			<div id="tt" class="easyui-tabs" data-options="tools:'#tab-tools',fit:true" style="margin:1px 0 0 0;">
				<div id="tab_1" title="欢迎使用"  data-options="iconCls:'icon-ext-48_02'">	
				</div>
			</div>
			<div id="tab-tools">
			    <a href="javascript:void(0)" class="easyui-linkbutton"  style = "text-decoration:none;"
					data-options="plain:true,iconCls:'icon-ext-22_27_undo'" onclick="removeAllPanel()"><font style="color:#ccc;">全部关闭</font></a>
			</div>
		</div>
	</div>
    </body>
    
    <script type="text/javascript">
    var index = 0;
    function addPanel(title,url,icon){
      index++;
      $('#tt').tabs('add',{
          title: title,
          iconCls:'icon-ext-41_15',
          href: url,            
        closable: true
      });
     }
     
     function addTab(title, href,icon){
        var tt = $('#tt');
        if (tt.tabs('exists', title)){//如果tab已经存在,则选中并刷新该tab  
           tt.tabs('select', title);
           refreshTab({tabTitle:title,url:href});
        } else {
           if (href){
              var content = '<iframe class="tt1" frameborder="0" scrolling="auto" marginheight="0" marginwidth="0"  src="'+href+'" style="margin:2px 0 0 0;width:100%;height:100%"></iframe>';  
           } else {  
              var content = '未实现';  
           }  
           tt.tabs('add',{  
                  title:title, 
                  closable:true,  
                  content:content,  
                  iconCls:icon||'icon-ext-41_15',
                  height: "auto",
                  width: "auto"
                });  
        }  
      }  
     /**     
       * 刷新tab 
       * @cfg  
       *example: {tabTitle:'tabTitle',url:'refreshUrl'} 
       *如果tabTitle为空，则默认刷新当前选中的tab 
       *如果url为空，则默认以原来的url进行reload 
       */  
      function refreshTab(cfg){  
         var refresh_tab = cfg.tabTitle?$('#tt').tabs('getTab',cfg.tabTitle):$('#tt').tabs('getSelected');  
         if(refresh_tab && refresh_tab.find('iframe').length > 0){  
             var _refresh_ifram = refresh_tab.find('iframe')[0];  
             var refresh_url = cfg.url?cfg.url:_refresh_ifram.src;  
             //_refresh_ifram.src = refresh_url;  
             _refresh_ifram.contentWindow.location.href=refresh_url;  
         }  
       } 
     
     
		function removePanel() {
			var tab = $('#tt').tabs('getSelected');
			if (tab) {
				var index = $('#tt').tabs('getTabIndex', tab);
				if(index == 0) return;
				$('#tt').tabs('close', index);
			}
		}
		function removeAllPanel() {
			$(".tabs li").each(function(index, obj) {
			   //获取所有可关闭的选项卡
			   var tab = $(".tabs-closable", this).text();
			   $(".easyui-tabs").tabs('close', tab);
		     });

		}
		function to_page(name,url,icon){
		  addTab(name,url,icon);
		}
					
					
		$(document).ready(function() {
			$('#foot').css("border", "none").panel({
				href : '${ctx}/system/pages/frameEasyui/foot.jsp'
			});
			$('#tab_1').panel({
				href : '${ctx}/system/pages/frameEasyui/welcome.jsp'
			});
			$('#layout_north').panel({
				href : '${ctx}/system/pages/frameEasyui/top.jsp'
			});
		});
	</script>
</html>
