<%@ 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.admin.CoreFilesViewBean">

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

<script language="javascript">

function toggleDisabledStateForCF() {
   // do we have the role to activate the menu?
   if (!('true' == '<%=isPrivilegedUser%>')) return;
   // Action button and menu names.
   var delCoreButton = "CoreFiles.deleteCoreButton";

   // Element name (prefix) of selection checkbox/radiobutton.
   var elementName = "CoreFiles.CoreFilesTable.Selection";
  
   // Document form.
   var form = document.form;
 
   // 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.indexOf(elementName) != -1) {
             if (e.checked) {
                disabled = false;
            break;
            }
        }
   }
  
   // Toggle action button disabled state.
   ccSetButtonDisabled(delCoreButton, "form", disabled);
}

</script>

<sa:primarymasthead name="Masthead" showDefaultPageTitle="simple">

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

<cc:actiontable
    name="CoreFilesTable" 
    bundleID="appBundle" 
    title="table.title.coreFiles"
    summary="table.summary.coreFiles" 
    empty="table.empty.coreFiles"
    showAdvancedSortingIcon="false" 
    showLowerActions="true" 
    showPaginationControls="true" 
    showPaginationIcon="true" 
    showSelectionIcons="true" 
    selectionType="multiple"
    selectionJavascript="toggleDisabledStateForCF()"
    page="1" />

</jato:form>

</sa:primarymasthead>

</jato:useViewBean>

