<%@ page language="java" %> 
<%@taglib uri="/WEB-INF/tld/com_iplanet_jato/jato.tld" prefix="jato"%> 
<%@taglib uri="/WEB-INF/tld/com_sun_web_ui/cc.tld" prefix="cc"%>
<%@taglib uri="/WEB-INF/lib/sa.tld" prefix="sa"%>

<jato:useViewBean className="com.sun.netstorage.mgmt.fm.storade.ui.viewbeans.reports.AssetDetailsViewBean">

<%
  String isPrivilegedUser = (String)session.getAttribute("storade.privilegedRole");
  if (isPrivilegedUser == null) isPrivilegedUser = "false";
%>

<%
  String assetClass = (String)session.getAttribute("assetClass");
  if (assetClass == null) assetClass = "";
  // should use com.sun.web.ui.taglib.common.CCTagBase.POPUP_WINDOW, but get JSP compilation error
  String popupKey = "com_sun_web_ui_popup";
%>

<%
  String appName = com.sun.netstorage.mgmt.fm.storade.ui.util.Connection.getAppName();
%>

<script language="javascript">
// This function will toggle the disabled state of action buttons
// depending on single or multiple selections.
function toggleDisabledState() {
   // do we have the role to activate the menu?
   if (!('true' == '<%=isPrivilegedUser%>')) return;

  // Action button and menu names.
  var actionButton = "AssetDetails.RunTestButton";

  // Element name (prefix) of selection checkbox/radiobutton.
  var elementName = "AssetDetails.AssetDetailsDiagnosticTable.Selection";

  // Document form.
  var form = document.assetDetailsForm;

  // Flag indicating to disable action button and menu options.
  var disabled = true;

  // Set flags according to single or multiple selections.
  for (i = 0; i < form.elements.length; i++) {
    var e = form.elements[i];
    if (e.name != null && e.name.indexOf(elementName) != -1) {
      if (e.checked) {
        disabled = false;
        break;
      }
    }
  }

  // Toggle action button disabled state.
  ccSetButtonDisabled(actionButton, "assetDetailsForm", disabled);
}
</script>

<script language="javascript">
// Determine if a popup should be launched directly
function launch() {
  var form    = document.assetDetailsForm;
  var element = document.assetDetailsForm.PageMenu;
  for (var i = 0; i < element.options.length; i++) {
    var v = element.options[i];
    if (v.selected) {
      if (v.value == "asset.details.option.monitor") {
        window.open('/<%=appName%>/reports/<%=assetClass%>SetupInformation?<%=popupKey%>=true','setupWindow','scrollbars,resizable,height=400,width=600,left='+((window.screen.width-600)/2)+',top='+((window.screen.height-400)/2));
        return false;
      } else if (v.value.substr(0,30) == "asset.details.option.launchApp") {
        var location = v.value.substr(30, v.value.length);
        window.open(location, 'secondaryWindow','scrollbars,menubar,toolbar,resizable,height=480,width=640,top='+((window.screen.height-(window.screen.height/1.618))-(480/2))+',left='+((window.screen.width-640)/2));
        return false;
      }


    }
  }
  return false;
}
</script>


<!-- Bread Crumb component -->
<sa:primarymasthead name="Masthead" showDefaultPageTitle="withBarOnly">

<jato:form name="assetDetailsForm" method="post">

<cc:spacer name="sp0" height="10" newline="true"/>

<!-- Page-level action menu and View menus -->
<table width=100% border=0 cellspacing=0 cellpadding=10>
<tr>

<td align=left>
<cc:dropdownmenu name="PageMenu" elementId="PageMenu" bundleID="appBundle" 
    onChange="javascript:launch();"
    commandChild="PageMenuHref"/>
</td>
<td align=right nowrap>
<cc:label name="ViewLabel" defaultValue="asset.details.view"
    bundleID="appBundle" elementName="ViewMenu" />
<cc:dropdownmenu name="ViewMenu" bundleID="appBundle"
    commandChild="ViewMenuHref"/>
</td></tr></table>

<cc:spacer name="sp1" height="15" newline="true"/>

<sa:jumpto name="JumpTo" bundleID="appBundle"/>

<sa:section name="Details" sectionPosition="details"
            sectionTitle="asset.details.section.title.details"
            bundleID="appBundle">

<cc:actiontable 
 name="AssetDetailsTable" 
 bundleID="appBundle" 
 title="asset.details.table.title.details" 
 summary="asset.details.table.title.details.summary"
 empty="asset.details.table.title.details.empty" 
 selectionType="none"
 showAdvancedSortingIcon="false" 
 showLowerActions="false" 
 showPaginationControls="false" 
 showPaginationIcon="false" 
 showSelectionIcons="false" 
 page="1" />

</sa:section>

<sa:section name="Diags" sectionPosition="diagnostics"
            sectionTitle="asset.details.section.title.diagnostics"
            bundleID="appBundle">

<cc:actiontable 
 name="AssetDetailsDiagnosticTable" 
 bundleID="appBundle" 
 title="asset.details.table.title.diagnostics" 
 summary="asset.details.table.title.diagnostics.summary"
 empty="asset.details.table.title.diagnostics.empty"
 selectionType="single"
 selectionJavascript="toggleDisabledState()"
 showAdvancedSortingIcon="false" 
 showLowerActions="false" 
 showPaginationControls="false" 
 showPaginationIcon="false" 
 showSelectionIcons="true" 
 showSelectionSortIcon="false" 
 page="1" />

</sa:section>

<sa:section name="FRUs" sectionPosition="fru"
            sectionTitle="asset.details.section.title.fru"
            bundleID="appBundle">

<jato:content name="FRUOverviewSection">
    <cc:actiontable 
     name="AssetDetailsFRUTable" 
     bundleID="appBundle" 
     title="asset.details.table.title.fru" 
     summary="asset.details.table.title.fru.summary"
     empty="asset.details.table.title.fru.empty"
     selectionType="none"
     showAdvancedSortingIcon="false" 
     showLowerActions="false" 
     showPaginationControls="false" 
     showPaginationIcon="false" 
     showSelectionIcons="false" 
     page="1" />
</jato:content>

<jato:content name="FRUDetailedSection">
    <cc:actiontable 
     name="AssetDetailsFRUDetailedTable" 
     bundleID="appBundle" 
     title="asset.details.table.title.fru" 
     summary="asset.details.table.title.fru.summary"
     empty="asset.details.table.title.fru.empty"
     selectionType="none"
     showAdvancedSortingIcon="false" 
     showLowerActions="false" 
     showPaginationControls="false" 
     showPaginationIcon="false" 
     showSelectionIcons="false" 
     page="1" />
</jato:content>

</sa:section>

<sa:section name="SubComponents" sectionPosition="subcomponent"
            sectionTitle="asset.details.section.title.subcomponent"
            bundleID="appBundle">

<jato:content name="SubComponentOverviewSection">
  <cc:actiontable 
   name="AssetDetailsSubComponentTable" 
   bundleID="appBundle" 
   title="asset.details.table.title.subcomponent" 
   summary="asset.details.table.title.subcomponent.summary"
   empty="asset.details.table.title.subcomponent.empty"
   selectionType="none"
   showAdvancedSortingIcon="false" 
   showLowerActions="false" 
   showPaginationControls="false" 
   showPaginationIcon="false" 
   showSelectionIcons="false" 
   page="1" />
</jato:content>

<jato:content name="SubComponentDetailedSection">
  <cc:actiontable 
   name="AssetDetailsSubComponentDetailedTable" 
   bundleID="appBundle" 
   title="asset.details.table.title.subcomponent" 
   summary="asset.details.table.title.subcomponent.summary"
   empty="asset.details.table.title.subcomponent.empty"
   selectionType="none"
   showAdvancedSortingIcon="false" 
   showLowerActions="false" 
   showPaginationControls="false" 
   showPaginationIcon="false" 
   showSelectionIcons="false" 
   page="1" />

  <cc:spacer name="sp0" height="15" newline="true"/>

  <cc:actiontable
   name="AssetDetailsConnectionTable"
   bundleID="appBundle"
   title="asset.details.connection.table.title"
   summary="asset.details.connection.table.summary"
   empty="asset.details.connection.table.empty"
   selectionType="none"
   showAdvancedSortingIcon="false"
   showLowerActions="false"
   showPaginationControls="false"
   showPaginationIcon="false"
   showSelectionIcons="true"
   page="1" />
</jato:content>

</sa:section>

<sa:section name="logical" sectionPosition="logical"
            sectionTitle="asset.details.section.title.logical"
            bundleID="appBundle">

<jato:content name="LogicalComponentOverviewSection">
  <cc:actiontable 
   name="AssetDetailsLogicalTable" 
   bundleID="appBundle" 
   title="asset.details.table.title.logical" 
   summary="asset.details.table.title.logical.summary"
   empty="asset.details.table.title.logical.empty"
   selectionType="none"
   showAdvancedSortingIcon="false" 
   showLowerActions="false" 
   showPaginationControls="false" 
   showPaginationIcon="false" 
   showSelectionIcons="false" 
   page="1" />
</jato:content>

<jato:content name="LogicalComponentDetailedSection">
  <cc:actiontable
   name="PoolSummaryTable"
   bundleID="appBundle"
   title="asset.details.pool.table.title"
   summary="asset.details.pool.table.summary"
   empty="asset.details.pool.table.empty"
   selectionType="none"
   showAdvancedSortingIcon="false"
   showLowerActions="false"
   showPaginationControls="false"
   showPaginationIcon="false"
   showSelectionIcons="true"
   page="1" />

  <cc:spacer name="sp0" height="15" newline="true"/>

  <cc:actiontable
   name="VolumeSummaryTable"
   bundleID="appBundle"
   title="asset.details.volume.table.title"
   summary="asset.details.volume.table.summary"
   empty="asset.details.volume.table.empty"
   selectionType="none"
   showAdvancedSortingIcon="false"
   showLowerActions="false"
   showPaginationControls="false"
   showPaginationIcon="false"
   showSelectionIcons="true"
   page="1" />
</jato:content>

<jato:content name="LogicalComponentGenericDetailedSection">

  <cc:spacer name="sp0" height="15" newline="true"/>

  <cc:actiontable
   name="AssetDetailsLogicalDetailedTable"
   bundleID="appBundle"
   title="asset.details.table.title.logical" 
   summary="asset.details.table.title.logical.summary"
   empty="asset.details.table.title.logical.empty"
   selectionType="none"
   showAdvancedSortingIcon="false" 
   showLowerActions="false" 
   showPaginationControls="false" 
   showPaginationIcon="false" 
   showSelectionIcons="false" 
   page="1" />
</jato:content>

</sa:section>

<sa:section name="notes" sectionPosition="notes"
            sectionTitle="asset.details.section.title.notes"
            bundleID="appBundle">

<div class="ConMgn">
  <cc:textarea name="Note" rows="4" cols="100" bundleID="appBundle"/>

  <cc:spacer name="spacer" height="10" newline="true"/>

  <sa:buttongroup name="SaveButton,ResetButton"
                  defaultValue="button.save,button.reset"
                  bundleID="appBundle"/>
</div>

</sa:section>

</jato:form>

</sa:primarymasthead>

</jato:useViewBean>
