<!--
 * Copyright (c) 2001, 2006, Oracle. All rights reserved.  
 *
 *      NAME
 *       searchSelectHostLov.uix
 *
 *      NOTES
 *       LOV to find the host in cloneWiz_selectDestination
 *

 * MODIFIED   (MM/DD/YY)  VERSION
 *    audupi   01/18/06 - Backport audupi_bug-4870686 from main 
 *    audupi   07/07/05 - 4467739 - Addition of maximum length for text-input
 *    kchiasso 10/28/03 - bugfix 3211721 
 *    kchiasso 08/19/03 - 
 *    kchiasso 06/05/03 -
 *    kchiasso 02/04/03 - remove ^M
 *    kchiasso 02/03/03 - kchiasso_new_clonehome
 *  @author  kChiasson
 *
--><page xmlns="http://bali.us.oracle.com/cabo/baja"
      xmlns:baja="http://bali.us.oracle.com/cabo/baja">

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

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

    <dataScope>
      <contents>

        <body>
          <contents>

            <switcher uix:childName="status@hostList" childName="success">
            <case name="failure">
            <rowLayout>
            <contents>
                <messageBox automatic="false"
                    uix:text="errHdr@hostList"
                    uix:message="errMsg@hostList"
                    messageType="error" />
            </contents>
            </rowLayout>
            </case>
            </switcher>
          
            <stackLayout>
              <contents>
                <form name="searchSelectHostLov">
                  <contents>
                    <formValue  id="dep1" name="blockStart" uix:value="blockStart@hostList"/>

                  <pageLayout xmlns="http://bali.us.oracle.com/cabo/marlin">
                    <boundAttribute name="title">
                        <concat>
                          <dataObject source="ResourceBundle" select="HDR_SEARCH_AND_SELECT"/>
                          <dataObject source="ResourceBundle" select="HDR_HOST"/>
                        </concat>
                    </boundAttribute>


                    <pageStatus>
                      <html:span class="OraInstructionText">
                        <rawText uix:text="searchInstr@hostList" />
                      </html:span>
                    </pageStatus>
 
                    <pageButtons>
                    <pageButtonBar>
                    <contents>

                      <switcher uix:childName="getHost@hostList" childName="hostFound">
                        <case name="hostFound">
                        <rowLayout>
                        <contents>
                            <button id="cancelButton" uix:textAndAccessKey="BTN_CANCEL@ResourceBundle"
                              onClick="doCancel()" />
                            <spacer width="3"/>
                            <button id="selectButton" uix:textAndAccessKey="BTN_SELECT@ResourceBundle" 
                            onClick="doSelect()" />
                        </contents>
                        </rowLayout>
                       </case>
 
                        <case name="errorFound">
                        <rowLayout>
                        <contents>
                            <button  id="okButton" uix:text="BTN_OK@ResourceBundle" uix:destination="destination@hostList"/>
                        </contents>
                        </rowLayout>
                        </case>
                      </switcher>
  
                    </contents>
                    </pageButtonBar>
                    </pageButtons>

                   <contents>

                  <switcher uix:childName="getHost@hostList" childName="hostFound">
                    <case name="hostFound">
                      <stackLayout>
                        <contents>
                          <spacer height="8"/>

                              <header uix:text="HDR_SEARCH@ResourceBundle" >
                                <contents>

                                <rowLayout>
                                <contents>

                                  <messageTextInput
                                    uix:prompt="HDR_HOST@ResourceBundle"
                                    name="hostNameLookup"
                                    id="hostname"
                                    uix:text="hostNameLookup@hostList"
                                    columns="50"
                                    uix:shortDesc="DESC_SEARCHHOSTNAME@ResourceBundle"
                                    maximumLength="64">
                                  </messageTextInput>

                                  <spacer width="5"/>
       
                                  <submitButton name="event" value="doGo" uix:text="BTN_GO@ResourceBundle"/>

                                </contents>
                                </rowLayout>

                                </contents>
                              </header>

                              <spacer height="2"/>
                              <header uix:text="HDR_RESULTS@ResourceBundle" >
                                <contents>

                                  <table name="hostTable"
                                       width="100%" minValue="1"
                                       formSubmitted="true"
                                       uix:columnHeaderData="columnHeaderData@hostList"
                                       uix:tableData="tableData@hostList"
                                       uix:maxValue="maxValue@hostList"
                                       uix:blockSize="blockSize@hostList"
                                       uix:value="value@hostList"
                                       uix:alternateText="ALT_NOHOST@ResourceBundle"
                                       proxied="true">
                                    <tableFormat tableBanding="rowBanding"/>
                                      <columnHeaderStamp>
                                        <sortableHeader uix:text="columnHeaderText"
                                            uix:value="value"
                                            uix:sortable="sort">
                                          <boundAttribute name="sortable">
                                          <defaulting>
                                            <dataObject uix:source="(value)@sortColumnHeader"/>
                                            <dataObject select="sort"/>
                                          </defaulting>
                                          </boundAttribute>
                                        </sortableHeader>
                                      </columnHeaderStamp>
                                      <tableSelection>
                                        <singleSelection selectedIndex="0">
                                        <contents>
                                        </contents>
                                      </singleSelection>
                                    </tableSelection>

                                    <columnHeaderData>
                                        <column  id="hostName" uix:sort="SORT_hostName@hostList"  value="hostName"    uix:columnHeaderText="HDR_HOST@ResourceBundle"/>
                                        <column  id="locHome"  uix:sort="SORT_locHome@hostList"   value="locHome"     uix:columnHeaderText="HDR_HOMES@ResourceBundle"/>
                                     </columnHeaderData>
 

                                    <contents>
                                      <styledText headers="hostName" name="hostName" uix:text="hostName"/>
                                      <styledText headers="locHome"  name="locHome"  uix:text="locHome"/>
                                      <formValue  name="id"       uix:value="id"/>
                                      <formValue  name="un"       uix:value="un"/>
                                    </contents>
                                  </table>

                                </contents>
                              </header>

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

                    <case name="errorFound">
                      <stackLayout >
                        <contents >
                          <spacer height="5"/>
                          <header uix:icon="ERROR_IMAGE@getHostList" uix:text="HDR_ERROR@ResourceBundle"/>

                          <rowLayout >
                            <contents >
                              <spacer width="20" height="1"/>
                              <styledText styleClass="OraDataText" uix:text="ERROR_MESSAGE@getHostList"/>
                            </contents>
                          </rowLayout>
                        </contents>
                      </stackLayout>

                    </case>
                  </switcher>


 
                  <script>
                    <contents>
                      function setFocus(element)
                      {
                        if (element[0]==(void 0)) element.focus();
                        else element[0].focus();
                      }

                      function doCancel()
                      {
                        top.returnValue = (void 0);
                        top.close();
                        return false;
                      }

                      function doSelect()
                      {
                        var proxy = new TableProxy('hostTable');
                        var selectedRowIndex = proxy.getSelectedRow();

//                        alert("selIdx "+ selectedRowIndex);

                        if (selectedRowIndex >= 0)
                        {
                          var selectedName_id = proxy.getFormElement('id', selectedRowIndex);
                          var selectedName_un = proxy.getFormElement('un', selectedRowIndex);
                          // pass back hostName + username
                          top.returnValue = selectedName_id.value +"+"+selectedName_un.value;
                        }

                        top.close();
                        return false;
                     }

                    </contents>
                  </script>


                  </contents>
                  </pageLayout>
                  </contents>
                </form>
              </contents>
            </stackLayout>
          </contents>
        </body>
      </contents>

      <provider>
        <data name="ResourceBundle">
          <bundle class="oracle.sysman.eml.ecm.cloneHome.util.CloneHomeResourceBundle"/>
        </data>

        <data name="hostList">
          <method class="oracle.sysman.eml.ecm.cloneHome.SearchSelectHostData" 
             method="populateResultsTable"/>
        </data>

       <data name="sortColumnHeader">
          <method class="oracle.sysman.eml.ecm.cloneHome.CloneHomeData"
              method="getSortColumnHeader"/>
       </data>


      </provider>
    </dataScope>
  </baja:content>

  <handlers>

      <!-- This handles the next/prev buttons in the results table -->
    <event name="goto" source="hostTable">
      <method class="oracle.sysman.eml.ecm.cloneHome.CloneHomeHandler"
          method ="tableGoto"/>
    </event>

    <event name="doGo">
      <method class="oracle.sysman.eml.ecm.cloneHome.SearchSelectHostHandler" 
          method="doGo"/>
    </event>

 
    <event name="sort">
        <method class="oracle.sysman.eml.ecm.cloneHome.CloneHomeHandler"
          method="doSort"/>
    </event>


  </handlers>
</page>
