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


<%
    String fromPage = (request.getParameter("fromPage") != null)
	? request.getParameter("fromPage")
	: "";

    String action = (request.getParameter("action") != null)
	? request.getParameter("action")
	: "";

    String formName = "";
    String commandChild = "";

    if("Alarms".equals(fromPage)) {
	formName="alarmForm";
        commandChild = "Alarms.AckCommand";
    } else if("AlarmDetails".equals(fromPage)) {
        formName="alarmDetailsForm";
        commandChild = "AlarmDetails.AckCommand";
    }
%>

<sa:secondarymasthead name="SecondaryMasthead">

<script language="javascript">
function checkAscii() {
 var tf = document.ackedByForm;
 var userName = tf.elements["AcknowledgedBy.userNameValue"].value;
 for(var i = 0; i < userName.length; i++) {
        var c = userName.charCodeAt(i);
        if(c < 32 || c > 126) {
           alert("<cc:text name="JSAlert" bundleID="appBundle" defaultValue="js.alert.nonascii" escape="false"/>");
           return false;
        } 
 }	

 return true;
 
}

function submitValues() {
    // Form names.
    var tf = document.ackedByForm;
    var pf = window.opener.document.<%=formName%>;

    var userName = tf.elements["AcknowledgedBy.userNameValue"].value;
    // Set form action url and submit.
    pf.action = pf.action + "?" + "<%=commandChild%>=&action=<%=action%>&ackedBy=" + escape(userName);
    pf.submit();	
}
</script>


<cc:form name="ackedByForm" method="post" onSubmit="javascript: if(!ps_CheckRequiredFields()) {return false;} else if(!checkAscii()) {return false;} else {submitValues();window.close(); return false;}">

<!-- Page Title --> 
<cc:pagetitle 
  name="PageTitle" 
  bundleID="appBundle"
  showPageTitleSeparator="true"
  showPageButtonsTop="false"
  showPageButtonsBottom="true">

<!-- PropertySheet -->
  <cc:propertysheet 
   name="AcknowledgedByPropertySheet" 
   bundleID="appBundle" 
   showJumpLinks="false"
   addJavaScript="true" />

</cc:pagetitle>

</cc:form>
</sa:secondarymasthead>
</jato:useViewBean>


