<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/enrgise-html.tld" prefix="enrgise" %>


<html:html>
<head>
  <html:base />
  <TITLE><bean:message key="WFL.title" /></TITLE>
  <jsp:include page="GenIncludes.jsp" flush="true" />  
  <meta http-equiv="pragma" content="no-cache" >
</head>

<BODY onload="doOnLoad()" scroll="auto">
<html:form  action="/WlfGenCondBaseAction" name="WflConditionForm" type="wenrgise.workflow.webtier.form.WflConditionForm" >
<bean:define id="WflConditionForm" name="WflConditionForm" toScope="request" />
<SCRIPT language=JavaScript1.2 src="../includes/Menujs.js"></SCRIPT>
<bean:define id="left" name="WflConditionForm" property="positionRequested"/>
<bean:define id="right" name="WflConditionForm" property="totalCount"/>
<table cellSpacing=0 bgColor=#bdd0ef>
<tr height=27>
  <td colSpan=11></td>
</tr>
  <TR > 
    <TD ><img name="WflConditionForm" property="butQuery" onmouseover='this.src="../includes/images/query_dis.jpg"' onmouseout='this.src="../includes/images/query_dis.jpg"' alt="Query (Ctrl+Q)" src="../includes/images/query_dis.jpg"  /><img name="WflConditionForm" property="butInsert" onmouseover='this.src="../includes/images/insert_dis.jpg"' onmouseout='this.src="../includes/images/insert_dis.jpg"' alt="Insert (Alt+N)" src="../includes/images/insert_dis.jpg"  /></TD>
    <TD width="2%"></TD>
    <TD ><img name="WflConditionForm" property="butExecute" onmouseover='this.src="../includes/images/execute_dis.jpg"' onmouseout='this.src="../includes/images/execute_dis.jpg"' alt="Execute (Ctrl+U)" src="../includes/images/execute_dis.jpg"  /><img name="WflConditionForm" property="butSave" onmouseover='this.src="../includes/images/save_dis.jpg"' onmouseout='this.src="../includes/images/save_dis.jpg"' alt="Save (Ctrl+S)" src="../includes/images/save_dis.jpg"  />
    <img name="WflConditionForm" property="butDelete" onmouseover='this.src="../includes/images/delete_dis.jpg"' onmouseout='this.src="../includes/images/delete_dis.jpg"' alt="Delete (Ctrl+D)" src="../includes/images/delete_dis.jpg"  /><enrgise:img name="WflConditionForm" property="butRefresh" onmouseover='this.src="../includes/images/refresh_act.jpg"' onmouseout='this.src="../includes/images/refresh.jpg"' alt="Refresh (Ctrl+R)"  src="../includes/images/refresh.jpg" onclick="doBaseRefresh()" />
    <img name="WflConditionForm" property="butPrint" onmouseover='this.src="../includes/images/print_dis.jpg"' onmouseout='this.src="../includes/images/print.jpg"' alt="Print (Ctrl+P)"  src="../includes/images/print.jpg" /></TD>
    <TD width="2%" bgColor=#bdd0ef></TD>
    <TD><enrgise:img name="WflConditionForm" property="butExit" onmouseover='this.src="../includes/images/exit_act.jpg"' onmouseout='this.src="../includes/images/exit.jpg"' alt="Exit (Alt+X)"  src="../includes/images/exit.jpg" /><enrgise:img name="WflConditionForm" property="butHelp" onmouseover='this.src="../includes/images/help_act.jpg"' onmouseout='this.src="../includes/images/help.jpg"' alt="Help (Ctrl+?)" src="../includes/images/help.jpg" /></TD>
    <TD width="50%"></TD>
    <TD ><enrgise:img name="WflConditionForm" property="butPrevHeader" src='../includes/images/butn_prev_dis.jpg' onmouseover='this.src="../includes/images/butn_prev_dis.jpg"' onmouseout='this.src="../includes/images/butn_prev_dis.jpg"' alt="Butn_prev (Ctrl+<)" onclick="doBasePrevHeader()" /></td>
    <td class=dtlNavText><bean:write  name="left" /> of 
    <bean:write name="right" /></td>
    <td align=right><enrgise:img name="WflConditionForm" property="butNextHeader" src="../includes/images/butn_next.jpg" onmouseover='this.src="../includes/images/butn_next_act.jpg"' onmouseout='this.src="../includes/images/butn_next.jpg"' alt="Butn_next (Ctrl+>)" onclick="doBaseNextHeader()" /></td>
    <td align=right><enrgise:text property="newPositionRequested" size="1" onkeydown="isInteger(event)" title="wenrgise.common.jumpDetail" alt="N" disabledClass="locked" styleClass="optional" /></td>
    <td ><enrgise:img name="WflConditionForm" property="butJumpHeader" alt="Go (Ctrl+G)" src="../includes/images/go.jpg" onmouseover='this.src="../includes/images/go_act.jpg"' onmouseout='this.src="../includes/images/go.jpg"' onclick="doBaseJumpHeader()" /></td>
    <td > </td>
</TR>
</TABLE>
<!-- Icon Menu -->
<!--Top Most Blue Bar-->
<TABLE cellSpacing=0 bgColor=#bdd0ef>
    <tr>
        <TD  colSpan=12 class=mainHeader height=10><bean:message key="wfl.wflGenCond.heading" /></TD>
    </TR>
</TABLE>
<!--//  Display Errors -->
<enrgise:errors/>
<logic:messagesPresent message="true">
<Table>
    <html:messages id="message" message="true">
    <TR><TD>
      <bean:write name="message"/>
    </TD></TR>
    </html:messages>      
</Table>
</logic:messagesPresent>
<!--//  Display Errors --> 

<TABLE cellSpacing=0 cellPadding=0 border=0 >
    <TR>
        <TD>
        <TABLE cellSpacing=0 cellPadding=0 >
        <!-- Header Starts -->
            <TR>
                  <TD class=subHeader colspan=6><bean:message key="wfl.WorkFlowConditions.header" /></TD>
            </TR>
            <TR>
                  <TD colspan=6 bgColor=#4682b4><IMG height=1 src="../includes/images/pixel.gif" width=1 border=0></TD>
            </TR>
            <tr>
                  <td class="labelText"><bean:message key="wfl.WorkFlowConditions.docCode" /></td>
                  <td><html:text  property="documentCode" titleKey="wfl.WorkFlowConditions.docCode" maxlength="10" size="26" styleClass="optional"  readonly="true" /></td>
                  <td class="labelText"> </td>
                  <td></td>
       
           </tr>
            
            <tr>
                  <td class="labelText"><bean:message key="wfl.WorkFlowConditions.docAttr" /></td>
                  <td><html:select property="docAttr" titleKey="wfl.WorkFlowConditions.docAttr"  styleClass="required" onchange="doValidate()" >
                      <html:option value="" ><bean:message   key="wfl.pleaseSelect" /></html:option>      
                      <logic:notEmpty property="docAttributes" name="WflConditionForm">
                      <bean:define  id="DocumentAttributes" name="WflConditionForm" property="docAttributes" />
                      <html:options collection="DocumentAttributes" property="key" labelProperty="value"  />
                      </logic:notEmpty>
                      </html:select>
                  </td> 
                  
                  <td class="labelText"><bean:message key="wfl.WorkFlowConditions.operator" /></td>
                  <td><enrgise:select property="operator" titleKey="wfl.WorkFlowConditions.operator" alt="X" styleClass="required" disabledClass="locked"  >
                      <enrgise:option value="" ><bean:message   key="wfl.pleaseSelect" /></enrgise:option>      
                      <enrgise:option value="=" > =</enrgise:option> 
                      <enrgise:option value="==" >==</enrgise:option> 
                      <enrgise:option value="<>" >NOT = </enrgise:option>
                      <enrgise:option value=">" >&gt;</enrgise:option> 
                      <enrgise:option value="<" >&lt;</enrgise:option> 
                      <enrgise:option value="=>" >=&gt; </enrgise:option> 
                      <enrgise:option value="<=" >&lt;= </enrgise:option> 
                      <enrgise:option value="IN" >IN </enrgise:option> 
                      <enrgise:option value="NOT IN" >NOT IN </enrgise:option> 
                      </enrgise:select>
                  </td> 
                  
                  <td class="labelText"><bean:message key="wfl.WorkFlowConditions.values" /></td>
                  <td><enrgise:text property="values" titleKey="wfl.WorkFlowConditions.values" size="23"  styleClass="required" disabledClass="locked"  readonly="false"   /><enrgise:img height="16" align="center" styleClass="icon" src="../includes/images/lov.jpg" name="WflConditionForm" property="butValues" onclick="getValuesLov()"/></td>
       
           </tr>
           <tr height="10">
                  <td colspan="6"></td>
          </tr>
       
          <tr height="10">
                  <td colspan="6"></td>
          </tr>
                
           <tr> 
                  <td class="labelText"><bean:message key="wfl.WorkFlowConditions.formula" /></td>
                  <td colspan="5"><html:textarea  property="formula" titleKey="wfl.WorkFlowConditions.formula" cols="159" rows="15" alt="A" styleClass="locked" readonly="true" /></td>
           </tr>
              
                        
      </table>
      
      
     <table cellspacing=0 cellpadding=0 border=0>
         <!-- Detail Information Row starts -->
 	 
<!-- Bottom Blue Bar -->
       <TR>
            <td>
              <TABLE  cellspacing="0" cellpadding="0" border=0>
                    <tr>
                        <td bgColor=#4682b4>&nbsp;</td>
                        <td bgColor=#4682b4 align="center" ><enrgise:button styleClass="bottomBarText"  property="butOr" name="WflConditionForm" onclick="doOr()"  >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Or&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</enrgise:button>                  
                        <enrgise:button styleClass="bottomBarText" name="WflConditionForm" property="butAnd" onclick="doAnd()"  >&nbsp;&nbsp;&nbsp;&nbsp;And&nbsp;&nbsp;&nbsp;&nbsp;</enrgise:button>
                        <enrgise:button styleClass="bottomBarText" name="WflConditionForm" property="butShowFormula" onclick="doShowFormula()"  >Show Final Formula</enrgise:button>
                        <enrgise:button property="butSelect" name="WflConditionForm" onclick="Save_Close();" ><bean:message key="wenrgise.WorkFlowConditions.ok"/></enrgise:button> </td>
                        <td align=right bgColor=#4682b4><img src="../includes/images/man.jpg"></td>
                   </TR>
                </table>
            </td>
          </tr>
 
<!-- Container Table Ending Columns Starts-->
  </TD>
    
</TR>
</TBODY>
</TABLE>
<!-- Container Table Ends -->

<!--//Common hidden fields      -->
<html:hidden name="WflConditionForm"  property="screenMode"  />
<html:hidden name="WflConditionForm"  property="screenName" value="WflGenConditions" />
<html:hidden name="WflConditionForm"  property="forwardedPage" />
<html:hidden property="positionRequested" name="WflConditionForm" />
<html:hidden property="userPageRequested"  />
<html:hidden property="userPositionRequested" />
<html:hidden property="pageRequested" />

<html:hidden property="headerPrimaryKey" name="WflConditionForm" />
<html:hidden property="headerDataChanged" name="WflConditionForm" />
<html:hidden property="detailDataChanged" name="WflConditionForm" />

<html:hidden property="index" name="WflConditionForm"  />
<!--//For LOV-->
<html:hidden property="lovKey" />
<html:hidden property="txtSearchFields" />
<html:hidden property="txtDisplayFields" />
<input type="hidden" name="multipleFlag" >
<html:hidden property="queryParam" name="WflConditionForm" />
<!--//Page specific Hidden fields-->

<html:hidden property="hidAction" name="WflConditionForm" />
<html:hidden property="formStatus" name="WflConditionForm" />
<input type="hidden" name="firstLoad" >
<html:hidden property="docId" name="WflConditionForm" />
<html:hidden property="hidFormula" name="WflConditionForm"  />
<html:hidden property="conditionLovKey" name="WflConditionForm"  />
</html:form>
</body>
</html:html>

<script>
function doQueryMode()
{

  return "WflGenCondQueryModeAction.do";
}

function doInsertMode()
{

  return "WflGenCondNewModeAction.do";
}


function doExecute()
{

  return "WflGenCondGetHeaderAction.do";
}

function doSave()
{
  document.forms[0].screenMode.value="N";
  document.forms[0].headerDataChanged.value = "true";
  return "WflGenCondSaveAction.do";
}


function doDelete()
{

  return "WflGenCondDeleteAction.do";
  
}

function doBaseRefresh()
{
  document.forms[0].hidAction.value="refresh";
   document.forms[0].submit();
  
}

function doPrevHeader()
{
  return "WflGenCondGetNextHeaderAction.do"; 
}

function doNextHeader()
{
  return "WflGenCondGetNextHeaderAction.do"; 
}

function doJumpHeader()
{
  return "WflGenCondGetNextHeaderAction.do"; 
}

function doGetDetail()
{

  return "WflGenCondGetDetailAction.do";
}

function doAddRow()
{

  return "WflGenCondAddRowAction.do"; 
}

function doDelRow()
{
 return "WflGenCondDeleteRowAction.do";  
}

function doGetDetailTableName()
{
  return "tableName";
}

function doPrevDetail()
{

  return "WflGenCondGetDetailPageAction.do";  
}

function doNextDetail()
{

  return "WflGenCondGetDetailPageAction.do";
}

function doJumpDetail()
{
  return  "WflGenCondGetDetailPageAction.do"; 
}


function doOnLoad()
{
  document.forms[0].docId.value=document.forms[0].headerPrimaryKey.value;

 
    if(opener.document.forms[0].formStatus.value!="false")
    {
        opener.document.forms[0].formStatus.value=document.forms[0].formStatus.value;
        document.forms[0].hidAction.value="classinfo";
         document.forms[0].submit();
    }
 
}
function doAnd()
{
    document.forms[0].hidAction.value="and";
    document.forms[0].submit(); 

}
function doOr()
{
    document.forms[0].hidAction.value="or";
    document.forms[0].submit(); 
 
}

function getValuesLov()
{         
          document.forms[0].lovKey.value = document.forms[0].conditionLovKey.value;
          document.forms[0].txtSearchFields.value = "WFL.WFLDocAttrDtl.docAttr";
          document.forms[0].txtDisplayFields.value = "values";
          showLov('<html:rewrite page="/hrms/jsp/CommonSearchScreen.jsp" />','WflConditionForm');
          return true;
  
}
function doShowFormula()
{
   document.forms[0].hidAction.value="show";
    document.forms[0].headerDataChanged.value = "true";
    document.forms[0].submit(); 
}
function Save_Close()
{
     var iIndex = opener.document.forms[0].index.value;
     opener.document.forms[0].formStatus.value="";
     opener.document.getElementsByName("conditionExpression")[iIndex].value=document.forms[0].formula.value;
     opener.document.forms[0].detailDataChanged.value="true"; 
     opener.document.forms[0].headerDataChanged.value="false";  
     if(opener.document.getElementsByName("status")[iIndex])
      {
        if(opener.document.getElementsByName("status")[iIndex].value!="N")
        {
          opener.document.getElementsByName("status")[iIndex].value="U";
          
        }
    
      }
     self.close();
}
function doValidate()
{
    if(document.forms[0].conditionLovKey.value!="")
    {
     document.forms[0].hidAction.value="validate";
     document.forms[0].submit(); 
    }
}

</script>