<!--------------------session info begin-------------->
<%@ page import="net.sz600.organize.SzLoginInfo" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.database.SzConn" %>
<%@ page import="net.sz600.system.SzPageHelp" %>
<%@ page import="net.sz600.organize.*" %>
<%@ page import="java.util.Map" %>
<%
	/*模拟登陆用户，用于测试！
	SzLoginInfo szLoginInfo_SESSION2 = new SzLoginInfo();
	szLoginInfo_SESSION2.setDLID(1);	
	session.setAttribute("SzDLID", Integer.toString(szLoginInfo_SESSION2.getDLID()));
	session.setAttribute("SzLoginInfo", szLoginInfo_SESSION2);
	*/


    //get server name
    String sServer_SESSION  = request.getServerName();
    String sPort_SESSION    = Integer.toString( request.getServerPort() );
    String sContext_SESSION = request.getContextPath();
    session.setAttribute("SzServer",  sServer_SESSION);
    session.setAttribute("SzPort",    sPort_SESSION);
    session.setAttribute("SzContext", sContext_SESSION);

    //判断是否正在还原数据库
    if (SzConn.getRestore()) {
	//SzPageHelp.jsAlert("管理员正在还原系统数据库，稍后再重新登陆！");
       response.sendRedirect(sContext_SESSION + "/relogin.jsp");
       return; //这里必须要加return，否则以下的程序仍然会执行。
       }	

    //session.setAttribute("SzDLID", "");
    //session.setAttribute("SzDLZH", "");
    //session.setAttribute("SzLoginInfo", null);
    String szDLID_SESSION = SzConvert.toZeroStr((String)session.getAttribute("SzDLID"));
    String szDLZH_SESSION = SzConvert.toSpaceStr((String)session.getAttribute("SzDLZH"));
    SzLoginInfo szLoginInfo_SESSION = (SzLoginInfo)session.getAttribute("SzLoginInfo");
    //增加公司ID
    String szCOMPANY_SESSION = SzCompany.decryptCOMPANY((String)session.getAttribute("SzCOMPANY"));
    //获得用户的皮肤
    String skinType = SzConvert.toZeroStr((String)session.getAttribute("SzSkinType"));

    if (szDLID_SESSION.equals("0")
       || szLoginInfo_SESSION == null
       || szLoginInfo_SESSION.getDLID() == 0 ) {

       //out.println(SzPageHelp.jsTopGoUrl("../index.jsp"));
       response.sendRedirect(sContext_SESSION + "/relogin.jsp");
       return; //这里必须要加return，否则以下的程序仍然会执行。
    }
    //将常用的信息获取在这里
    //部门名称，部门ID，员工姓名，登陆ID
    int iBMID_SESSION =  szLoginInfo_SESSION.getDLBM();
    int iDLID_SESSION =  szLoginInfo_SESSION.getDLID();
    String sBMMC_SESSION = "";
    String sDLXM_SESSION = szLoginInfo_SESSION.getDLXM();
    if (iBMID_SESSION != 0) {
       sBMMC_SESSION = SzUserHelp.getDepartName(iBMID_SESSION);
    }
    session.setAttribute("SzDLXM", sDLXM_SESSION);
    session.setAttribute("SzBMMC", sBMMC_SESSION);
    session.setAttribute("SzBMID", Integer.toString(iBMID_SESSION));

    //get system manager login info
    SzPopedom szPopedom_SESSION = new SzPopedom();
    boolean isSuperManager_SESSION = szPopedom_SESSION.isSuperManager(szLoginInfo_SESSION.getDLID());
    boolean isSystemManager_SESSION = szPopedom_SESSION.isSystemManager(szLoginInfo_SESSION.getDLID());
    //2013-12-13
    if (szLoginInfo_SESSION.getDLQX() == 1) {
      isSuperManager_SESSION = true;
    }
    if (isSuperManager_SESSION == true) {
      isSystemManager_SESSION = true;
    }

    //if new bar?
    String sMKID_SESSION = SzConvert.toZeroStr(request.getParameter("MKID_SESSION"));
    //click a new bar
    if (!sMKID_SESSION.equals("0")) {
        session.setAttribute("MKID_SESSION", sMKID_SESSION);
    } else {
        sMKID_SESSION = SzConvert.toZeroStr((String)session.getAttribute("MKID_SESSION"));
    }
    int iMKID_SESSION = Integer.parseInt(sMKID_SESSION);

    //get this and all parent module name and link path by module id
    //String sMKMC_SESSION = SzModule.getNameAndPath(Integer.parseInt(sMKID_SESSION));
    //default dir path
    String strLevel_SESSION = SzUserSet.getUserLevel(request.getServletPath());

    //default skin path
    String strSkin_SESSION = strLevel_SESSION + SzUserSet.getUserSkin(iDLID_SESSION, skinType);

    //是否栏目管理员
    boolean isBarManager_SESSION = false;
    isBarManager_SESSION = szPopedom_SESSION.isModuleManager(iMKID_SESSION, szLoginInfo_SESSION.getDLID());
    //2013-12-13
    if (isSuperManager_SESSION == true) {
      isBarManager_SESSION = true;
    }

    //取得模块的属性
    //如果模块为系统管理员可见，则系统管理员就是栏目管理员。
    //取得模块的属性
    SzModule szModule_SESSION = new SzModule();
    SzModuleInfo szModuleInfo_SESSION = null;
    if (iMKID_SESSION > 0) {
       szModuleInfo_SESSION = (SzModuleInfo)szModule_SESSION.getInfoByKey(iMKID_SESSION);
       if (szModuleInfo_SESSION != null && szModuleInfo_SESSION.getMKQX() == 3 && isSystemManager_SESSION) {
          isBarManager_SESSION = true;
       }
    }
    //System.out.println("是否栏目管理员==" + isBarManager_SESSION + "==模块ID==" + iMKID_SESSION);

    //是否数据可见
    boolean isDataCanSee_SESSION = true;
    if ( !isBarManager_SESSION ) {
	isDataCanSee_SESSION = szPopedom_SESSION.isDataCanSee(iMKID_SESSION, szLoginInfo_SESSION.getDLID());
    } 

    //是否数据可添加
    boolean isDataCanAdd_SESSION = true;
    if ( !isBarManager_SESSION ) {
	isDataCanAdd_SESSION = szPopedom_SESSION.isModuleCanAdd(iMKID_SESSION, szLoginInfo_SESSION.getDLID());
    } 
%>

<%//@ include file="/safety.jsp"%>

    
