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

  <baja:head xmlns="http://www.w3.org/TR/REC-html40">
    <html:meta content="no-cache" http-equiv="pragma"/>
    <html:meta content="no-cache" http-equiv="Cache-Control"/>
    <html:meta content="-1" http-equiv="Expires"/>
  </baja:head>

  <baja:content xmlns="http://bali.us.oracle.com/cabo/marlin">
    <form name="userSearch" method="POST">
      <contents>
        <dataScope>
          <contents>
            <html:title>
              <text data:text="pageTitle@users" />
            </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>

            <script>
              <contents>
                function mySelect()
                {
                  var proxy = new TableProxy("resultTable");
                  var selectedIndex = proxy.getSelectedRow();

                  var userName = proxy.getFormElement("userName", selectedIndex);

                  if (userName != null)
                  {
                    window.opener.document.forms[0][window.opener.myData].value = userName.value;
                  }
                  top.close();
                }
              </contents>
            </script>

            <pageLayout>

              <contentFooter>
                <pageButtonBar>
                  <contents>
                    <button data:text="CANCEL_BUTTON@commonResourceBundle" 
                            onClick="top.close();" />
                    <button data:text="SELECT@commonResourceBundle" 
                            disabled="false"
                            data:disabled="disableSelect@users"
                            onClick="mySelect();"  />
                  </contents>                 
                </pageButtonBar>
              </contentFooter>

              <contents>  <!-- pageLayout contents... -->

                <formValue name="userShown" data:value="userShown@users"/>

                <stackLayout>
                  <contents>
                    <header data:text="header@users" >

                      <contents>

                        <spacer height="5"/>

                        <stackLayout>
                          <contents>
                            <spacer width="20"/>

                            <stackLayout>
                              <contents>
                                <header data:text="SEARCH@commonResourceBundle">
                                  <contents>
                                    <rowLayout>
                                      <contents>
                                        <messageTextInput name="search"
                                                          data:prompt="SEARCH@commonResourceBundle"
                                                          data:shortDesc="SEARCH@commonResourceBundle"
                                                          columns="40"
                                                          data:text="search@users"/>
                                        <spacer width="10" />
                                        <submitButton data:text="GO@notifResourceBundle"
                                                      name="event"
                                                      value="search"/>
                                        <formValue name="searchPage"/>

                                      </contents>
                                    </rowLayout>
                                  </contents>
                                </header>

                                <header data:text="RESULTS@commonResourceBundle">
                                  <contents>

                                    <rowLayout hAlign="right" >
                                      <contents>
                                        <button data:text="CANCEL_BUTTON@commonResourceBundle"
                                                onClick="top.close();" />
                                        <spacer width="10" />
                                        <button data:text="SELECT@commonResourceBundle"
                                                disabled="false"
                                                data:disabled="disableSelect@users"
                                                onClick="mySelect();"  />
                                      </contents>
                                    </rowLayout>

                                    <spacer height="25" />

                                    <table name="resultTable"
                                           width="100%"
                                           formSubmitted="true"
                                           data:alternateText="NO_USER_FOUND@notifResourceBundle"
                                           data:summary="ADMINISTRATOR_NAME@notifResourceBundle"
                                           proxied="true"
                                           data:tableData="row@users" >
                                      <tableFormat tableBanding="rowBanding"/>
                                      <columnHeaderData>
                                        <col data:text="USER_NAME@notifResourceBundle" />
                                      </columnHeaderData>

                                      <columnHeaderStamp>
                                        <sortableHeader data:text="text" />
                                      </columnHeaderStamp>
                                      <columnFormats>
                                        <columnFormat width="100%" columnDataFormat="textFormat"/>
                                      </columnFormats>

                                      <tableSelection>
                                        <singleSelection data:selectedIndex="selIndex" data:shortDesc="SELECT@commonResourceBundle" />
                                      </tableSelection>

                                      <contents>
                                        <styledText data:text="username"
                                                    data:value="username" />
                                        <formValue name="userName" data:value="username"/>
                                      </contents>
                                    </table>

                                    <spacer height="10" />

                                  </contents>
                                </header>
                              </contents>
                            </stackLayout>

                          </contents>
                        </stackLayout>
                      </contents>
                    </header>

                  </contents>
                </stackLayout>  <!-- end of all page header sections -->
              </contents>
            </pageLayout>
          </contents>
          
          <!-- Data Providers -->
          <provider>
            <data name="users">
              <method class="oracle.sysman.eml.pref.NotifScheduleData"
                      method="getUsersData" />
            </data>         
            <data name="sortHeaders">
              <method class="oracle.sysman.eml.mntr.util.TableHeaderSort"
                      method="getIsSortable"/>
            </data>
            <data name="sort">
              <method class="oracle.sysman.eml.mntr.util.TableHeaderSort"
                      method="sort"/>
            </data>
            <data name="commonResourceBundle">
              <bundle class="oracle.sysman.resources.CommonResourceBundle"/>
            </data>
            <data name="notifResourceBundle">
              <bundle class="oracle.sysman.resources.NotifMsg"/>
            </data>
          </provider>

        </dataScope>
      </contents>
    </form>
  </baja:content>

  <baja:handlers>
    <event name="search">
      <method class="oracle.sysman.eml.pref.NotifScheduleData"
              method="doSearchUser"/>
    </event>
    <event name="null">
      <method class="oracle.sysman.eml.pref.NotifScheduleData"
              method="doNull"/>
    </event>
  </baja:handlers>
</page>

