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

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

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

<script language="javascript">

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

   // Element name (prefix) of selection checkbox/radiobutton.
   var elementName = "SolutionExtract.SolutionExtractTable.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(delSolButton, "form", disabled);
}

function viewLog(url) {
  var logFile = getParameter(url.search, "SolutionExtract.viewLogHREF");
  var win = window.open('/<%=appName%>/admin/SolutionExtractLog?logFile=' + logFile, 'secondaryWindow','scrollbars,resizable,height=400,width=700,top='+((screen.height-(screen.height/1.618))-(400/2))+',left='+((screen.width-700)/2));
  win.focus();
}

function getParameter(query, key) {
  var ret = new String("not found!");
  var pos1 = query.indexOf(key + "=");

  if(pos1 == -1) return ret;

  var pos2 = pos1 + key.length + 1;
  var pos3 = query.substring(pos2, query.length).indexOf("&");
  if(pos3 != -1) {
    var pos4 = pos2 + pos3;
    ret = query.substring(pos2, pos4);
  } else {
    ret = query.substring(pos2, query.length);
  }
  return ret;
}

</script>

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

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

<div class="ConMgn">

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

<cc:text name="SolutionExtractLabel" bundleID="appBundle" defaultValue="label.solutionExtract"/>&nbsp;

<cc:button name="SolutionExtractButton" bundleID="appBundle" 
     defaultValue="button.extract"
     title="button.extract"
     type="primary"
     dynamic="true" />

</div>

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

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

</jato:form>

</sa:primarymasthead>

</jato:useViewBean>


