<page xmlns="http://bali.us.oracle.com/cabo/baja" 
      xmlns:baja="http://bali.us.oracle.com/cabo/baja" 
      xmlns:marlin="http://bali.us.oracle.com/cabo/marlin"
      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@userPreferencesData" />
          </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>

          <form name="userPrefForm" 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>

                <data:start>
                  <include baja:node="../prefSideNav" />
                </data:start>
  
                <contentFooter>
                  <pageButtonBar>
                    <contents>
                      <flowLayout>
                        <contents>
                          <button data:text="REVERT@commonResourceBundle"
                                  data:destination="revertDest@userPreferencesData" /> 
                          <submitButton data:text="APPLY@commonResourceBundle" 
                                        name="event" 
                                        value="Apply" />
                        </contents>
                      </flowLayout>
                    </contents>
                  </pageButtonBar>
                </contentFooter>

                <copyright>
                 <include baja:node="../copyright" />
                </copyright>
    
                <contents>

                  <messageBox 
                    rendered="false"
                    data:rendered="showApplyMessage@userPreferencesData"
                    messageType="info"
                    data:message="applyMessage@userPreferencesData">
                  </messageBox>

                  <messageBox rendered="false"
                              data:rendered="showInfo@userPreferencesData"
                              messageType="info"
                              data:message="updateSucceededMessage@userPreferencesData"
                              data:text="updateMessage@userPreferencesData">
                  </messageBox> 

                  <messageBox rendered="false"
                              data:rendered="showErr@userPreferencesData"
                              messageType="error"
                              data:message="updateFailedMessage@userPreferencesData"
                              data:text="updateMessage@userPreferencesData">
                  </messageBox>

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

                  <header data:text="GENERAL_HDR@notifResourceBundle" width="100%"> 
                    <contents>
                      <tableLayout width="100%">
                        <contents>
                          <rowLayout hAlign="right" >
                            <contents>
                              <cellFormat hAlign="right" >
                                <contents>
                                  <button data:text="REVERT@commonResourceBundle"
                                          data:destination="revertDest@userPreferencesData" /> 
                                  <spacer width="8"/>
                                  <submitButton data:text="APPLY@commonResourceBundle" 
                                                name="event" 
                                                value="Apply" />
                                </contents>
                              </cellFormat>
                            </contents>
                          </rowLayout>
                        </contents>
                      </tableLayout>
                      <header data:text="PASSWORD@notifResourceBundle" width="100%" >
                        <contents>

                          <switcher data:childName="authType@userPreferencesData" defaultCase="oms">
                            <case name="oms">
                              <flowLayout>
                                <contents>

                                      <styledText data:text="GENERAL_HDR_MSG@notifResourceBundle"
                                                  rendered="true"
                                                  styleClass="OraInstructionText">
                                        <boundAttribute name="rendered">
                                          <not>
                                            <dataObject select="isRepositoryUser"
                                                        source="userPreferencesData"/>
                                          </not>
                                        </boundAttribute>
                                      </styledText>
                                      <styledText data:text="REP_CONNECT_USER_HDR_MSG@notifResourceBundle"
                                                  rendered="false"
                                                  data:rendered="isRepositoryUser@userPreferencesData"
                                                  styleClass="OraInstructionText"/>
                                </contents>
                              </flowLayout>
                            </case>
                          </switcher>

                          <tableLayout cellSpacing="10" width="100%">
                            <contents>

                          <rowLayout vAlign="top">
                            <contents>
                              <cellFormat vAlign="top">
                                <contents>

                                <switcher data:childName="authType@userPreferencesData" defaultCase="oms">
                                <case name="sso">
                                  <stackLayout>
                                    <contents>
                                      <labeledFieldLayout fieldWidth="100%" labelWidth="0%"> 
                                        <contents>
                                          <styledText data:text="ADMINISTRATOR_NAME@notifResourceBundle"/>
                                          <styledText data:text="userName@userPreferencesData" 
                                                      styleClass="OraInstructionTextStrong" />
                                          <styledText data:text="PASSWORD@notifResourceBundle"/>
                                          <styledText data:text="CHANGE_SSO_PASSWORD@notifResourceBundle"
                                                      styleClass="OraInstructionTextStrong"
                                                      data:destination="changeSsoPasswdLink@userPreferencesData" 
                                                       />
                                        </contents>
                                      </labeledFieldLayout>

                                    </contents>
                                  </stackLayout>
                                </case>
                                <case name="euser">
                                  <stackLayout>
                                    <contents>
                                      <labeledFieldLayout fieldWidth="100%" labelWidth="0%"> 
                                        <contents>
                                          <styledText data:text="ADMINISTRATOR_NAME@notifResourceBundle"/>
                                          <styledText data:text="userName@userPreferencesData" 
                                                      styleClass="OraInstructionTextStrong" />
                                          <spacer height="10"/>
                                          <tip>
                                            <contents>
                                              <styledText data:text="PASSWORD_IN_DIRECTORY@notifResourceBundle"/>
                                            </contents>
                                          </tip>
                                        </contents>
                                      </labeledFieldLayout>

                                    </contents>
                                  </stackLayout>
                                </case>
                                <case name="oms">
                                  <stackLayout>
                                    <contents>
                                      <labeledFieldLayout fieldWidth="100%" labelWidth="0%" 
                                                          rendered="true"
                                                          data:rendered="notRepositoryUser@userPreferencesData" > 
                                        <contents>
                                          <styledText data:text="ADMINISTRATOR_NAME@notifResourceBundle"/>
                                          <styledText data:text="userName@userPreferencesData" 
                                                      styleClass="OraInstructionTextStrong" />
                                          <styledText data:text="PASSWORD@notifResourceBundle"
                                                      data:rendered="isRepositoryUser@userPreferencesData"/>
                                          <styledText data:text="userPwd@userPreferencesData" 
                                                      secret="true"
                                                      noAutoComplete="true"
                                                      styleClass="OraInstructionTextStrong"
                                                      data:rendered="isRepositoryUser@userPreferencesData" />
                                          <messageTextInput data:prompt="OLD_PASSWORD@notifResourceBundle"
                                                            data:shortDesc="OLD_PASSWORD@notifResourceBundle"
                                                            columns="30"
                                                            data:messageType="oldPwdMsgType@userPreferencesData"
                                                            data:message="oldPwdInlineMsg@userPreferencesData"
                                                            data:anchor="oldPwdAnchor@userPreferencesData"
                                                            name="oldUserPwd"
                                                            secret="true"
                                                            noAutoComplete="true"
                                                            data:text="oldUserPwd@userPreferencesData">
                                            <boundAttribute name="rendered">
                                              <not>
                                                <dataObject select="isRepositoryUser"
                                                            source="userPreferencesData"/>
                                              </not>
                                            </boundAttribute>
                                          </messageTextInput>

                                          <messageTextInput data:prompt="NEW_PASSWORD@notifResourceBundle"
                                                            data:shortDesc="NEW_PASSWORD@notifResourceBundle"
                                                            columns="30" 
                                                            data:messageType="pwdMsgType@userPreferencesData"
                                                            data:message="pwdInlineMsg@userPreferencesData"
                                                            data:anchor="pwdAnchor@userPreferencesData"
                                                            name="userPwd"
                                                            secret="true"
                                                            noAutoComplete="true"
                                                            data:text="userPwd@userPreferencesData">
                                            <boundAttribute name="rendered">
                                              <not>
                                                <dataObject select="isRepositoryUser"
                                                            source="userPreferencesData"/>
                                              </not>
                                            </boundAttribute>
                                          </messageTextInput>
                                          <messageTextInput data:prompt="CONFIRM_PASSWORD@notifResourceBundle"
                                                            data:shortDesc="CONFIRM_PASSWORD@notifResourceBundle"
                                                            columns="30" 
                                                            data:messageType="confirmPwdMsgType@userPreferencesData"
                                                            data:message="confirmPwdInlineMsg@userPreferencesData"
                                                            data:anchor="confirmPwdAnchor@userPreferencesData"
                                                            name="userConfirmPwd"
                                                            secret="true"
                                                            noAutoComplete="true"
                                                            data:text="userConfirmPwd@userPreferencesData">
                                            <boundAttribute name="rendered">
                                              <not>
                                                <dataObject select="isRepositoryUser"
                                                            source="userPreferencesData"/>
                                              </not>
                                            </boundAttribute>
                                          </messageTextInput>
                                        </contents>
                                      </labeledFieldLayout>

                                    </contents>
                                  </stackLayout>
                                </case>
                                </switcher>

                                </contents>
                              </cellFormat>
                            </contents>
                          </rowLayout>

                            </contents>
                          </tableLayout>

                        </contents>
                      </header>

                      <header data:text="EMAIL_ADDRESSES@notifResourceBundle" width="100%" >
                        <contents>
                          <stackLayout>
                            <contents>
                              <styledText data:text="EMAIL_HDR_MSG@notifResourceBundle"
                                          rendered="true"
                                          styleClass="OraInstructionText" />
                              <spacer height="10" />
                              <table name="emailAddresses"
                                     width="500"
                                     data:tableData="emailAddresses@userPreferencesData"
                                     data:summary="EMAIL_HDR_MSG@notifResourceBundle"
                                     formSubmitted="true"
                                     data:alternateText = "NO_EMAIL_ADDRESS_SPECIFIED@notifResourceBundle">
                                <columnHeaderData>
                                  <col data:text="EMAIL_ADDRESS@notifResourceBundle" />
                                  <col data:text="MESSAGE_FORMAT@notifResourceBundle" />
                                </columnHeaderData>
                                <columnHeaderStamp>
                                  <data:boundText select="text"/>
                                </columnHeaderStamp>
                                <columnFormats>
                                  <columnFormat columnDataFormat="textFormat" />
                                  <columnFormat columnDataFormat="textFormat" />
                                </columnFormats>
                                <tableSelection>
                                  <multipleSelection data:selected="selected" data:shortDesc="SELECT@commonResourceBundle" >
                                    <contents>
                                      <submitButton data:text="REMOVE@commonResourceBundle"
                                                    name="event"
                                                    value="delete" />
                                      <submitButton data:text="TEST_EMAILS@notifResourceBundle"
                                                    name="event"
                                                    value="testEmails"/>
                                    </contents>
                                  </multipleSelection>
                                </tableSelection>
                                <columnFooter>
                                  <addTableRow />
                                </columnFooter>
                                <contents>
                                  <textInput name="emailAddr"
                                             data:text="emailAddr"
                                             data:shortDesc="EMAIL_ADDRESS@notifResourceBundle"
                                             columns="50" />
                                  <choice name="format" data:shortDesc="MESSAGE_FORMAT@notifResourceBundle" >
                                    <contents>
                                      <option data:text="LONG_FORMAT@notifResourceBundle"
                                              data:selected="long"
                                              value="0" />
                                      <option data:text="SHORT_FORMAT@notifResourceBundle"
                                              data:selected="short"
                                              value="1" />
                                    </contents>
                                  </choice>
                                </contents>
                              </table>

                              <spacer height="10"/>
                              <tip>
                                 <contents>
                                   <styledText data:text="EMAIL_FORMAT_TEXT@notifResourceBundle"/>
                                 </contents>
                              </tip>
                            </contents>
                          </stackLayout>

                        </contents>
                      </header>

                    </contents>
                  </header>

                </contents>
              </pageLayout>

            </contents>
          </form> 

        </contents>
       
        <provider>           
          <data name="commonResourceBundle">
            <bundle class="oracle.sysman.resources.CommonResourceBundle"/>
          </data>
          <data name="notifResourceBundle">
            <bundle class="oracle.sysman.resources.NotifMsg"/>
          </data>
          <data name="userPreferencesData">
            <method class="oracle.sysman.eml.pref.NotifRulesPref"
                    method="getUserPreferencesData" />
          </data>                     
        </provider>
      </dataScope>
    </baja:content>

    <handlers>
      <event name="*">
        <method class="oracle.sysman.eml.pref.NotifRuleEvents"
                method="doNull"/>
      </event>
      <event name="Apply">
        <method class="oracle.sysman.eml.pref.NotifRuleEvents" 
                method="updateUserPreferencesData"/>
      </event>  
      <event name="addRows">
        <method class="oracle.sysman.eml.pref.NotifRuleEvents"
                method="handleEmailAddrEvents"/>
      </event>
      <event name="delete">
        <method class="oracle.sysman.eml.pref.NotifRuleEvents"
                method="handleEmailAddrEvents"/>
      </event>
      <event name="testEmails">
        <method class="oracle.sysman.eml.pref.NotifRuleEvents"
                method="handleEmailAddrEvents"/>
      </event>
    </handlers>

</page>
