<%--
/*
 * %W% %E% 
 * 
 * Copyright 2002-2003 by Sun Microsystems, Inc. All rights reserved.
 * Use is subject to license terms.
 */
--%>
<%@ 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.revision.RAUpgradeViewBean">

<sa:primarymasthead name="Masthead" showDefaultPageTitle="withBarOnly"/>
<jato:form name="form" method="post">

<%
  String warningMessageUpgrade = (String)session.getAttribute("warningMessageUpgrade");
  if (warningMessageUpgrade == null) warningMessageUpgrade = "Generate Patch Upgrade Report?";

  String warningMessageClear = (String)session.getAttribute("warningMessageClear");
  if (warningMessageClear == null) warningMessageClear = "Clear Patch Report?";
%>


<script language="javascript">

function confirmRevUpgrade() {
  return confirm("<%=warningMessageUpgrade%>");
}

function confirmClearReport() {
  return confirm("<%=warningMessageClear%>");
}

// 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?
   // Action button and menu names.
   var applyButton   = "RAUpgrade.applyButton";
   var viewVolButton = "RAUpgrade.viewAffectedVolumes";

   // Element name (prefix) of selection checkbox/radiobutton.
   var elementName = "RAUpgrade.RevisionAnalysisUpgradeReportTable.Selection";
  
   // Document form.
   var form = document.form;
 
   // Flag indicating to disable action button and menu options.
   var disabled = true;
 
   var numChecked = 0;
   // Set flags according to single or multiple selections.
   for (i = 0; i < form.elements.length; i++) {
        var e = form.elements[i];

        if (e.name.indexOf(elementName) != -1) {
             if (e.checked) {
                disabled = false;
                numChecked++;
            }
        }
   }
   if (numChecked > 1) {
     ccSetButtonDisabled(viewVolButton, "form", true);
   } else {
     ccSetButtonDisabled(viewVolButton, "form", disabled);
   }
  
   // Toggle action button disabled state.
   ccSetButtonDisabled(applyButton, "form", disabled);
}
</script>

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

<div class="ConMgn">
<!-- Page Inline Help -->
<table>
 <tr>
  <td>
   <cc:helpinline type="page">
    <cc:text name="StaticText" bundleID="appBundle" defaultValue="ra.help.text" />
   </cc:helpinline>
  </td>
 </tr>
</table>
</div>

<div class="ConMgn">

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

<cc:button name="generateRevAnalysisUpgradeReportButton" bundleID="appBundle" 
     defaultValue="button.generateRevAnalysisReport"
     title="button.generateRevAnalysisReport"
     type="primary"
     dynamic="true" 
     onClick="javascript: return confirmRevUpgrade();" />

<jato:content name="ClearButtonSection">

  <cc:button name="clearRevAnalysisUpgradeReportButton" bundleID="appBundle" 
       defaultValue="button.clearRevAnalysisReport"
       title="button.clearRevAnalysisReport"
       type="primary"
       dynamic="true" 
       onClick="javascript: return confirmClearReport();" />

</jato:content>

</div>

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

<jato:content name="RevisionAnalysisReportSection">

  <div class="ConMgn">
  <cc:text name="ReportText" bundleID="appBundle" defaultValue="assets.revision.upgrade.report"/>
  </div>

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

  <cc:actiontable
      name="RevisionAnalysisUpgradeReportTable" 
      bundleID="appBundle" 
      title="assets.revision.upgrade.table.title" 
      summary="assets.revision.upgrade.table.summary" 
      empty="assets.revision.upgrade.table.empty"
      showAdvancedSortingIcon="false" 
      showLowerActions="true" 
      showPaginationControls="true" 
      showPaginationIcon="true" 
      showSelectionIcons="true" 
      selectionType="multiple"
      selectionJavascript="toggleDisabledState()"
      page="1" />

</jato:content>

<jato:content name="noRevisionAnalysisReportSection">

  <div class="ConMgn">
  <cc:text name="NoReportText" bundleID="appBundle" defaultValue="assets.revision.upgrade.noreport"/>
  </div>

</jato:content>

</jato:form>
</jato:useViewBean>


