<%--
  /**
   * Copyright (c) 2003 by Sun Microsystems, Inc. All rights reserved.
   * Use is subject to license terms.
   *
   * "%Z%%M%    %I%    %E%     SMI"
   * 
   */
 --%>
<% 
//
// check to see if the locale is set to one of the
// double-byte character set languages.  if so,
// then set the html header ContentType  to
// the UTF-8 character set.  this is necessary
// because Netscape 4.79 does not render font
// sizes properly for the UTF-8 character set.
//
java.util.Locale loc=request.getLocale();
String str = loc.toString();
String charset="text/html; charset=ISO-8859-1";
if (str.equals("ja") || str.equals("ja_JP")) {
    charset="text/html; charset=EUC-JP";
} else if(str.equals("zh") || str.equals("zh_CN")) {
    charset="text/html; charset=GB2312";
}
response.setContentType(charset);
%>

<%@ page language="java"%>
<%@ page buffer="64kb" %>
<%@ page errorPage="/error/Error.jsp" %>
<%-- Place each new import in a new import statement for readability --%>
<%@ page import="java.util.Vector"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Collection"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="java.text.DateFormat"%>
<%@ page import="java.text.NumberFormat"%>
<%@ page import="java.net.URLEncoder"%>
<%@ page import="org.apache.struts.util.MessageResources"%>
<%@ page import="org.apache.struts.action.*"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.mgmt.business.impl.PoolBreakdownForTray"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.mgmt.business.StorageVolumeInterface"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.admin.business.ArrayRegistration"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.mgmt.business.StorageProfile"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.mgmt.business.T4Interface"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.mgmt.business.TrayInterface"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.mgmt.business.RaidGroupInterface"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.access.business.BindingInterface"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.core.Constants"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.ui.business.AffectedPool"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.ui.business.TrayForProfile"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.ui.business.TrayWrapper"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.ui.business.VolumeGroupWrapper"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.ui.forms.VolumeForm"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.ui.forms.AdminGeneralForm"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.ui.forms.PoolCreateForm"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.access.business.InitiatorInterface"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.access.business.InitiatorGroupInterface"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.access.business.VolumeGroupInterface"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.ui.business.Profile"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.core.Trace"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.util.Convert"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.jobs.business.JobInterface"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.core.ini.MaseratiConfig"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.core.ini.Repository"%>
<%@ page import="com.sun.netstorage.array.mgmt.cfg.ui.core.data.ActiveUserInfo"%>
				
<%-- taglibs --%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
<%@ taglib uri="/WEB-INF/component.tld" prefix="component" %>
<%-- end taglibs --%>

<%
 // used for all the byte to GB conversions
 NumberFormat nf = NumberFormat.getInstance();

com.sun.netstorage.array.mgmt.cfg.ui.core.data.MenuContext mc = 
 			(com.sun.netstorage.array.mgmt.cfg.ui.core.data.MenuContext)
			request.getSession().getAttribute(com.sun.netstorage.array.mgmt.cfg.ui.core.data.MenuContext.MENU_KEY);
com.sun.netstorage.array.mgmt.cfg.ui.core.data.MenuData md = 
			com.sun.netstorage.array.mgmt.cfg.ui.core.data.MenuData.getInstance();
com.sun.netstorage.array.mgmt.cfg.ui.core.data.UserData userData = 
	com.sun.netstorage.array.mgmt.cfg.ui.core.data.UserData.getInstance();


String selectedItem = mc == null ? "" : mc.getSelectedMainItem() == null ? "" : mc.getSelectedMainItem();
String selectedSubItem = mc == null ? "" : mc.getSelectedSubItem() == null ? "" : mc.getSelectedSubItem();
//java.util.ArrayList mainItems = (java.util.ArrayList)md.getMenuItems(md.ROOT_MENU);
//String mainItems[] = md.getMenuItems(md.ROOT_MENU);
com.sun.netstorage.array.mgmt.cfg.ui.core.data.ActiveUserInfo aui = 
				(com.sun.netstorage.array.mgmt.cfg.ui.core.data.ActiveUserInfo)
				session.getAttribute(com.sun.netstorage.array.mgmt.cfg.core.Constants.HttpSessionFields.USER_INFO);
/*
java.util.List mainItems = null;
if(aui != null) {
	mainItems = aui.visibleMenus;
}
*/
boolean readOnly = false;
java.util.Iterator mainItems = null;
if(aui != null) {
	readOnly = userData.isReadOnly(aui.username, selectedItem);	
	mainItems = aui.visibleMenus.iterator();
}
//Trace.verbose(this, "toptags", "MainItems are:" + mainItems);
//Trace.verbose(this, "toptags", "==========================Is read only:" + readOnly);
//java.util.ArrayList subItems = (java.util.ArrayList)md.getMenuItems(selectedItem);
String subItems[] = md.getMenuItems(selectedItem);
boolean haveTabs=true;
	

	/*
com.sun.netstorage.array.mgmt.cfg.ui.core.data.ActiveUserInfo aui = 
	(com.sun.netstorage.array.mgmt.cfg.ui.core.data.ActiveUserInfo)
	com.sun.netstorage.array.mgmt.cfg.core.ini.Repository.getRepository().getProperty(session.getId());
	*/
%>
<script language="JavaScript">
var formSubmittedTwiceMsg=<bean:message key="form.submitted.twice"/>;
</script>
