<page xmlns="http://bali.us.oracle.com/cabo/baja" 
      xmlns:baja="http://bali.us.oracle.com/cabo/baja"
      xmlns:html="http://www.w3.org/TR/REC-html40"
      xmlns:data="http://bali.us.oracle.com/cabo/marlin">

  <baja:content xmlns="http://bali.us.oracle.com/cabo/marlin">
    <dataScope>
      <contents>

        <html:title>
          <text data:text="title@notifDevicesHeaderData" />
        </html:title>
        <html:noScript>
          "This page uses JavaScript to perform the list of values lookup. Your browser either does not support JavaScript, or it is disabled.  Please enable JavaScript, or upgrade your browser."
        </html:noScript>
        
        <!-- added to enable/disable input text based on repeat flag -->
        <script>
          <contents>
            function repeatNotifiCheck(){
              if(document.notifDevicesSetupForm.REPEAT_ENABLED.checked){
                document.notifDevicesSetupForm.REPEAT_FREQUENCY.disabled = false;
                document.notifDevicesSetupForm.REPEAT_COUNT.disabled =false;
              }
              else{
                document.notifDevicesSetupForm.REPEAT_FREQUENCY.disabled =true;
                document.notifDevicesSetupForm.REPEAT_COUNT.disabled =true;
                document.notifDevicesSetupForm.REPEAT_FREQUENCY.value =
                    document.notifDevicesSetupForm.REPEAT_FREQUENCY_HIDDEN.value;
                document.notifDevicesSetupForm.REPEAT_COUNT.value =
                    document.notifDevicesSetupForm.REPEAT_COUNT_HIDDEN.value;
              }
            }
          </contents>
        </script>

        <form name="notifDevicesSetupForm" method="POST">
          <contents>

            <pageLayout>

              <mediumAdvertisement>
                <include baja:node="../../oemBanner" />
              </mediumAdvertisement>

              <globalButtons>
                <include baja:node="../../globalButtonBar" />
              </globalButtons>

              <tabs>
                <include baja:node="../../globalTabs" />
              </tabs>

   <location>
      <include baja:node="/breadCrumbs"/>
   </location>


              <pageHeader>
               <include baja:node="header"/>
              </pageHeader>

              <copyright>
               <include baja:node="../../copyright" />
              </copyright>
              <data:start>
                <include baja:node="adminSideNav" />
              </data:start>

              <contents>  <!-- pageLayout contents... -->
                <messageBox rendered="false"
                            data:rendered="errorOccurred@notifDevicesData"
                            data:message="CORRECT_ERRORS_MSG@notifResourceBundle"
                            messageType="error">
                  <contents data:childData="errorData@notifDevicesData">
                    <link data:text="label"
                          data:longDesc="message"
                          data:destination="destination"/>
                  </contents>
                </messageBox>

                <messageBox data:messageType="updateResultType@notifDevicesData"
                            rendered="false"
                            data:rendered="showUpdateMessage@notifDevicesData"
                            longDescURL="unimpl"
                            data:message="updateMessage@notifDevicesData" >
                </messageBox>

                    <header data:text="NOTIF_DEVICES_HEADER@notifResourceBundle" 
                            width="100%">
                      <contents>
                        <styledText data:text="NOTIF_DEVICES_HEADER_MSG@notifResourceBundle"
                                    styleClass="OraInstructionText"/>
                        
                        <header data:text="MAIL_SERVER_SETUP_HEADER@notifResourceBundle" width="100%">
                          <contents>
                            <tableLayout width="100%">
                              <contents>
                                <rowLayout>
                                  <contents>
                                    <cellFormat hAlign="left" width="95%">
                                      <contents>
                                        <styledText data:text="MAIL_SERVER_SETUP_HEADER_MSG@notifResourceBundle"
                                                    styleClass="OraInstructionText"/>
                                      </contents>
                                    </cellFormat>
                                    <cellFormat hAlign="right" width="5%">
                                      <contents>
                                        <!--
                                        <resetButton data:text="REVERT@commonResourceBundle"/>
                                        -->
                                        <submitButton data:text="REVERT@commonResourceBundle"
                                                      name="event" 
                                                      value="Revert"/>
                                        <spacer width="3"/>
                                        <submitButton data:text="APPLY@commonResourceBundle" 
                                                      name="event" 
                                                      value="Apply" />
                                        <spacer width="3"/>
                                        <submitButton data:text="TEST_MAIL_SERVERS@notifResourceBundle" 
                                                      name="event" 
                                                      value="TestSmtpGateways"/>  
                                      </contents>
                                    </cellFormat>
                                  </contents>
                                </rowLayout>
                              </contents>
                            </tableLayout>
                            <tableLayout cellSpacing="10" width="100%">
                              <contents>
                               <rowLayout vAlign="top">
                                 <contents>
                                   <cellFormat vAlign="top">
                                     <contents>                           
                                       <labeledFieldLayout fieldWidth="75%" labelWidth="25%"> 
                                         <contents>
                                           <messageTextInput data:prompt="OUTGOING_MAIL_SERVER@notifResourceBundle"
                                                             data:shortDesc="OUTGOING_MAIL_SERVER@notifResourceBundle"
                                                             columns="60" 
                                                             data:messageType="gatewayMsgType@notifDevicesData"
                                                             data:message="gatewayInlineMsg@notifDevicesData"
                                                             data:anchor="gatewayAnchor@notifDevicesData"
                                                             name="notifPrefMailGateway"
                                                             data:text="mailGateway@notifDevicesData"/>
                                           <messageTextInput data:prompt="MAIL_SERVER_USER_NAME@notifResourceBundle"
                                                             data:shortDesc="MAIL_SERVER_USER_NAME@notifResourceBundle"
                                                             columns="30" 
                                                             noAutoComplete="true"
                                                             data:messageType="userNameMsgType@notifDevicesData"
                                                             data:message="userNameInlineMsg@notifDevicesData"
                                                             data:anchor="userNameAnchor@notifDevicesData"
                                                             name="notifPrefUserName"
                                                             data:text="userName@notifDevicesData"/>
                                           <messageTextInput data:prompt="MAIL_SERVER_PASSWORD@notifResourceBundle"
                                                             data:shortDesc="MAIL_SERVER_PASSWORD@notifResourceBundle"
                                                             columns="30" 
                                                             data:messageType="passwordMsgType@notifDevicesData"
                                                             data:message="passwordInlineMsg@notifDevicesData"
                                                             data:anchor="passwordAnchor@notifDevicesData"
                                                             name="notifPrefPassword"
                                                             secret="true"
                                                             noAutoComplete="true"
                                                             data:text="password@notifDevicesData"/>
                                           <messageTextInput data:prompt="MAIL_SERVER_CONFIRM_PASSWORD@notifResourceBundle"
                                                             data:shortDesc="MAIL_SERVER_CONFIRM_PASSWORD@notifResourceBundle"
                                                             columns="30" 
                                                             data:messageType="confirmPasswordMsgType@notifDevicesData"
                                                             data:message="confirmPasswordInlineMsg@notifDevicesData"
                                                             data:anchor="confirmPasswordAnchor@notifDevicesData"
                                                             name="notifPrefConfirmPassword"
                                                             secret="true"
                                                             noAutoComplete="true"
                                                             data:text="confirmPassword@notifDevicesData"/>
                                           <messageTextInput data:prompt="IDENTIFY_SENDER@notifResourceBundle"
                                                             data:shortDesc="IDENTIFY_SENDER@notifResourceBundle"
                                                             columns="30" 
                                                             data:messageType="mailNameMsgType@notifDevicesData"
                                                             data:message="mailNameInlineMsg@notifDevicesData"
                                                             data:anchor="mailNameAnchor@notifDevicesData"
                                                             name="notifPrefMailName"
                                                             data:text="mailName@notifDevicesData"/>
                                           <messageTextInput data:prompt="SENDERS_MAIL_ADDRESS@notifResourceBundle"
                                                             data:shortDesc="SENDERS_MAIL_ADDRESS@notifResourceBundle"
                                                             columns="30" 
                                                             data:messageType="mailAddressMsgType@notifDevicesData"
                                                             data:message="mailAddressInlineMsg@notifDevicesData"
                                                             data:anchor="mailAddressAnchor@notifDevicesData"
                                                             name="notifPrefMailAddress"
                                                             data:text="mailAddress@notifDevicesData"/>
                                           <messageRadioSet data:prompt="SMTP_SSL@notifResourceBundle"
                                                  data:shortDesc="SMTP_SSL@notifResourceBundle"
                                                  columns="60" 
                                                  data:messageType="smtpSSLMsgType@notifDevicesData" 
                                                  data:message="smtpSSLInlineMsg@notifDevicesData" 
                                                  data:anchor="smtpSSLAnchor@notifDevicesData"
                                                  name="notifPrefSmtpSSL"
                                                  data:selectedValue="smtpSSL@notifDevicesData" >
                                                 <contents>
                                                   <option data:text="NO_SSL@notifResourceBundle" value="NONE"/> 
                                                   <option data:text="TLS@notifResourceBundle" value="TLS"/> 
                                                   <option data:text="SSL@notifResourceBundle" value="SSL"/>
                                                 </contents>
                                           </messageRadioSet>
                                         </contents>           
                                       </labeledFieldLayout>
                                      </contents>
                                    </cellFormat>
                                  </contents>
                                </rowLayout>         
                              </contents>
                            </tableLayout>

                            <!-- start repeat-->

                            <header data:text="REPEATED_NOTIFICATIONS@notifResourceBundle" width="100%" size="1">
                              <contents>
                                <tableLayout width="100%">
                                  <contents>
                                    <rowLayout>
                                      <contents>
                                        <cellFormat hAlign="left" vAlign="top" width="100%">
                                          <contents>
                                            <styledText data:text="REPEAT_NOTIFICATION_GLOBAL_MSG@notifResourceBundle"
                                                           styleClass="OraInstructionText"/>
                                          </contents>
                                        </cellFormat>
                                      </contents>
                                    </rowLayout>
                                    <rowLayout>
                                      <contents><spacer height="5"/></contents>
                                    </rowLayout>  
                                    <rowLayout>
                                      <contents>
                                        <cellFormat hAlign="left" vAlign="top" width="100%">
                                          <contents>
                                            <spacer width="20"/>
                                            <checkBox data:text="ENABLE_REPEATED_NOTIFICATIONS@notifResourceBundle"
                                                      data:checked="REPEAT_ENABLED@notifDevicesData"
                                                      data:shortDesc="ENABLE_REPEATED_NOTIFICATIONS@notifResourceBundle"
                                                      name="REPEAT_ENABLED"
                                                      value="true"
                                                      onClick="repeatNotifiCheck()"/>
                                            <labeledFieldLayout fieldWidth="75%" labelWidth="25%"> 
                                              <contents>
                                                <spacer height="5"/>
                                                <messageTextInput data:prompt="FREQUENCY@notifResourceBundle"                                                             
                                                                  columns="5"
                                                                  data:text="REPEAT_FREQUENCY@notifDevicesData"
                                                                  name="REPEAT_FREQUENCY"
                                                                  data:shortDesc="FREQUENCY@notifResourceBundle"
                                                                  data:messageType="repeatFreqMsgType@notifDevicesData"
                                                                  data:message="repeatFreqInlineMsg@notifDevicesData"
                                                                  data:anchor="repeatFrequencyAnchor@notifDevicesData"/>

                                                <messageTextInput data:prompt="MAXIMUM_REPEATED_NOTIFICATIONS@notifResourceBundle"
                                                                  columns="5"
                                                                  data:text="REPEAT_COUNT@notifDevicesData"
                                                                  name="REPEAT_COUNT"
                                                                  data:shortDesc="MAXIMUM_REPEATED_NOTIFICATIONS@notifResourceBundle"
                                                                  data:messageType="repeatCountMsgType@notifDevicesData"
                                                                  data:message="repeatCountInlineMsg@notifDevicesData"
                                                                  data:anchor="repeatCountAnchor@notifDevicesData"/>
                                              </contents>           
                                            </labeledFieldLayout>
                                          </contents>
                                        </cellFormat>
                                      </contents>
                                    </rowLayout>         
                                  </contents>
                                </tableLayout>
                                <!-- holds orig value before Apply Operation to be used for REVERT Operation -->
                                <formValue name="REPEAT_FREQUENCY_HIDDEN"
                                           data:value="REPEAT_FREQUENCY_HIDDEN@notifDevicesData"/>
                                <formValue name="REPEAT_COUNT_HIDDEN"
                                           data:value="REPEAT_COUNT_HIDDEN@notifDevicesData"/>

                              </contents>
                            </header> 
                            <!-- end repeat -->
                          </contents>
                        </header>

                        <switcher data:childName="node@notifDevicesData">
                          <case name="okNode">
                            <header data:text="NOTIF_DEVICES_SETUP_HEADER@notifResourceBundle" 
                                    width="100%">
                              <contents>
                                <link data:name="anchor@notifDevicesData"/>
                                <stackLayout>
                                  <contents>
                                    <tableLayout width="100%">
                                      <contents>
                                        <rowLayout>
                                          <contents>
                                            <cellFormat hAlign="left" width="95%">
                                              <contents>
                                                <styledText data:text="NOTIF_DEVICES_SETUP_HEADER_MSG@notifResourceBundle"
                                                            styleClass="OraInstructionText"/>
                                              </contents>
                                            </cellFormat>
                                          </contents>
                                        </rowLayout>
                                      </contents>
                                    </tableLayout>
                                    <tableLayout width="100%">
                                      <contents>
                                        <rowLayout>
                                          <contents>
                                            <cellFormat>
                                              <contents>
                                                <rowLayout hAlign="right">
                                                  <contents>
                                                    <styledText data:text="ADD@commonResourceBundle"
                                                                labeledNodeId="createTypeChoice"
                                                                styleClass="OraPromptText"/>
                                                    <spacer width="5"/>
                                                    <choice name="createTypeChoice" 
                                                                  id="createTypeChoice"
                                                                  columns="50">
                                                     <contents data:childData="typeList@notifDevicesData">
                                                      <option data:text="typeName" 
                                                              data:value="typeId" />
                                                     </contents>
                                                    </choice>
                                                    <spacer width="5"/>
                                                    <submitButton data:text="GO@commonResourceBundle"
                                                                  name="event" 
                                                                  value="CreateDevice"/>
                                                  </contents>
                                                </rowLayout>
                                              </contents>
                                            </cellFormat>
                                          </contents>
                                        </rowLayout>
                                      </contents>
                                    </tableLayout>
                                    <tableLayout width="100%">
                                      <contents>
                                        <rowLayout>
                                          <contents>
                                            <table name="devicesTable" 
                                                         data:alternateText="NO_DEVICES_FOUND_MSG@notifResourceBundle"
                                                         data:summary="NOTIF_DEVICES_SETUP_HEADER@notifResourceBundle"
                                                         width="100%" hAlign="right"
                                                         data:columnHeaderData="column@notifDevicesData" 
                                                         data:value="value@notifDevicesData"
                                                         data:blockSize="blockSize@notifDevicesData"
                                                         data:maxValue="maxValue@notifDevicesData"
                                                         data:minValue="minValue@notifDevicesData"
                                                         data:tableData="row@notifDevicesData" 
                                                         formSubmitted="true" >
                                              <tableFormat tableBanding="rowBanding"/>
                                              <columnHeaderStamp>
                                                <sortableHeader data:text="text" 
                                                                data:sortable="sortable" />  
                                              </columnHeaderStamp> 
                                              <tableSelection >
                                                <singleSelection data:rendered="hasSelection@notifDevicesData"  
                                                                 data:disabled="disabled" 
                                                                 data:selected="selected" 
                                                                 data:shortDesc="SELECT@commonResourceBundle" >
                                                  <contents>
                                                    <!--  todo
                                                    <submitButton data:text="CREATE_LIKE@commonResourceBundle" 
                                                                  name="event" 
                                                                  value="CreateLike"/>   
                                                    <spacer width="5"/>
                                                    -->
                                                    <submitButton data:text="VIEW@commonResourceBundle" 
                                                                  data:disabled="disableButtons@notifDevicesData" 
                                                                  name="event" 
                                                                  value="View"/>   
                                                    <spacer width="5"/>
                                                    <submitButton data:text="EDIT@commonResourceBundle" 
                                                                  data:disabled="disableButtons@notifDevicesData" 
                                                                  name="event" 
                                                                  value="Edit"/>   
                                                    <spacer width="5"/>
                                                    <submitButton data:text="DELETE@commonResourceBundle" 
                                                                  data:disabled="disableButtons@notifDevicesData" 
                                                                  name="event"
                                                                  value="Remove" />
                                                   </contents>
                                                </singleSelection>
                                              </tableSelection>
                                              <columnFormats>
                                                <columnFormat width="50%" columnDataFormat="textFormat"/>
                                                <columnFormat width="50%" columnDataFormat="textFormat"/>
                                              </columnFormats>
                                              <contents>
                                                <styledText data:text="deviceName" 
                                                            data:shortDesc="DEVICE_NAME@notifResourceBundle" 
                                                            data:destination="deviceNameDest"/>
                                                <styledText data:text="deviceTypeDisplayName"
                                                            data:shortDesc="DEVICE_TYPE@notifResourceBundle" />
                                                <formValue name="deviceName" 
                                                           data:value="deviceName" />  
                                                <formValue name="deviceType" 
                                                           data:value="deviceType" />  
                                              </contents>
                                            </table>
                                          </contents>
                                        </rowLayout>
                                      </contents>
                                    </tableLayout>
                                    <spacer height="10"/>
                                    <tip>
                                      <contents>
                                        <styledText data:text="NOTIF_DEVICES_RULE_CREATE_TIP_MSG@notifResourceBundle"/>
                                      </contents>
                                    </tip>
                                  </contents>
                                </stackLayout>
                              </contents>
                            </header>                  
                          </case>
                          <case name="errNode">
                            <messageBox messageType="error"
                                        longDescURL="unimpl"
                                        data:message="errMsg@notifDevicesData"
                                        data:text="ERROR_OCCURRED_MSG@notifResourceBundle">
                            </messageBox>
                          </case>
                        </switcher>

                      </contents>
                    </header>
    
                  </contents>
            </pageLayout>

            <script>
              <contents>
                repeatNotifiCheck();
              </contents>
            </script>

          </contents>
        </form> 

      </contents>
      
      <!-- Data Providers -->
      <provider>
        <data name="columnHeaderData">
          <inline>
            <column data:text="DEVICE_NAME@notifResourceBundle" />
            <column data:text="DEVICE_TYPE@notifResourceBundle" />
          </inline>
        </data>
        <data name="notifDevicesHeaderData">
          <method class="oracle.sysman.eml.admin.rep.NotifPrefData" 
                  method="getNotifDevicesHeaderData"/>
        </data>
        <data name="notifDevicesData">
          <method class="oracle.sysman.eml.admin.rep.NotifPrefData" 
                  method="getNotifDevicesData"/>
        </data>
        <data name="commonResourceBundle">
          <bundle class="oracle.sysman.resources.CommonResourceBundle"/>
        </data>
        <data name="notifResourceBundle">
          <bundle class="oracle.sysman.resources.NotifMsg"/>
        </data>
      </provider>
    </dataScope>
  </baja:content>
  <baja:handlers>
    <event name="*">
      <method class="oracle.sysman.eml.admin.rep.NotifPrefEvents" 
              method="doNull"/>
    </event>
    <event name="sort">
      <method class="oracle.sysman.eml.admin.rep.NotifPrefEvents" 
              method="doSort"/>
    </event>
    <event name="goto">
      <method class="oracle.sysman.eml.admin.rep.NotifPrefEvents" 
              method="doGoto"/>
    </event>
    <event name="CreateLike">
      <method class="oracle.sysman.eml.admin.rep.NotifPrefEvents" 
              method="createLikeDevice"/>
    </event>  
    <event name="View">
      <method class="oracle.sysman.eml.admin.rep.NotifPrefEvents" 
              method="viewDevice"/>
    </event>  
    <event name="Edit">
      <method class="oracle.sysman.eml.admin.rep.NotifPrefEvents" 
              method="editDevice"/>
    </event>  
    <event name="Remove">
      <method class="oracle.sysman.eml.admin.rep.NotifPrefEvents" 
              method="confirmDeleteDevice"/>
    </event>  
    <event name="Apply">
      <method class="oracle.sysman.eml.admin.rep.NotifPrefEvents" 
              method="updateGatewayData"/>
    </event>  
    <event name="CreateDevice">
      <method class="oracle.sysman.eml.admin.rep.NotifPrefEvents" 
              method="createDevice"/>
    </event>  
    <event name="TestSmtpGateways">
      <method class="oracle.sysman.eml.admin.rep.NotifPrefEvents" 
              method="testSmtpGateways"/>
    </event>  
  </baja:handlers>
</page>

