<!--
 * Copyright (c) 2001, 2006, Oracle. All rights reserved.  
 *
 *      NAME
 *       searchSelectHomeLov.uix
 *
 *      NOTES
 *       Use to select CRS home to extend from
 *

 * MODIFIED   (MM/DD/YY)  VERSION
 *    amani    09/11/06 - Backport amani_fix 5467873 from main
 *    amani    07/31/06 - Backport amani_bug-4870299 from main
 *    amani    08/31/06 - For autopopulating the CRS name and extend nodes
 *    amani    05/11/06 - Changing the max length values.
 *    anusharm 03/24/05 - Removing switch case, allow for empty table
 *
 *  @author  anusharm
 *
-->

<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@homeList" childName="success">
            <case name="failure">
            <rowLayout>
            <contents>
                <messageBox automatic="false"
                    uix:text="errHdr@homeList"
                    uix:message="errMsg@homeList"
                    messageType="error" />
            </contents>
            </rowLayout>
            </case>
            </switcher>
          
            <stackLayout>
              <contents>
                <form name="searchSelectHomeLov">
                  <contents>

                  <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_HOMES"/>
                        </concat>
                    </boundAttribute>


                    <pageButtons>
                    <pageButtonBar>
                    <contents>
			<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>

                       
                    </contents>
                    </pageButtonBar>
                    </pageButtons>

                   <contents>

                      <stackLayout>
                        <contents>
                          <spacer height="8"/>

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

                                <rowLayout>
                                <contents>

				  <choice     id="searchOpt"  name="searchCol" partialRenderMode="multiple" partialTargets="dep1"
					      uix:selectedValue="lookUpCol@homeList">
					<contents>
					 <option value="HOST_NAME"       uix:text="HOST_NAME@ResourceBundle" />
					 <option value="HOME_LOCATION"   uix:text="LOCATION@ResourceBundle" />
					 <option value="HOME_NAME"       uix:text="ORACLE_HOME@ResourceBundle" />
					 <option value="PRODUCT_NAME"    uix:text="PRODUCT_NAME@ResourceBundle"  />
					 <option value="PLATFORM"        uix:text="PLATFORM@ResourceBundle" />
				       </contents>
				  </choice>

				  <textInput id="searchOpt" required="no" uix:text="lookUpVal@homeList" name="searchVal" columns="35"  onKeyDown="javascript:doSearch();" maximumLength="255"/>

                                  <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="homeTable"
                                       width="100%" minValue="1"
                                       formSubmitted="true"
                                       uix:columnHeaderData="columnHeaderData@homeList"
                                       uix:tableData="tableData@homeList"
                                       uix:maxValue="maxValue@homeList"
                                       uix:blockSize="blockSize@homeList"
                                       uix:value="value@homeList"
                                       uix:alternateText="ALT_NOHOMES@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="host" uix:sort="SORT_hostName@homeList"  value="host"    uix:columnHeaderText="HDR_HOST@ResourceBundle"/>
                                        <column  id="locHome"  uix:sort="SORT_locHome@homeList"   value="locHome"     uix:columnHeaderText="HDR_HOME_LOC@ResourceBundle"/>
					<column  id="platform"  uix:sort="SORT_platform@homeList"   value="platform"     uix:columnHeaderText="HDR_PLATFORM@ResourceBundle"/>
					<column  id="targets"  uix:sort="SORT_targets@homeList"   value="targets"     uix:columnHeaderText="HDR_TARGETS@ResourceBundle"/>
					<column  id="products"  uix:sort="SORT_products@homeList"   value="products"     uix:columnHeaderText="HDR_PRODUCTS@ResourceBundle"/>
                                     </columnHeaderData>
 

                                    <contents>
                                      <styledText headers="host" name="host" uix:text="host"/>
                                      <styledText headers="locHome"  name="locHome"  uix:text="locHome"/>
				      <styledText headers="platform"  name="platform"  uix:text="platform"/>
				      <styledText headers="targets"  name="targets"  uix:text="targets"/>
				      <styledText headers="products"  name="products"  uix:text="products"/>
                                      <formValue  name="id"       uix:value="locHome"/>
				      <formValue  name="hostid"       uix:value="host"/>
				      <formValue  name="nodesid"       uix:value="clusNodes"/>
				      <formValue  name="clusNameid"       uix:value="clusName"/>
                                    </contents>
                                  </table>

                                </contents>
                              </header>

                       </contents>
                      </stackLayout>
                    

                    


 
                  <script>
                    <contents>

		      // do search if user clicks enter in search textfield
		      function doSearch()
		      {
		        if ((window.event.which == 13) || (window.event.keyCode == 13))
			{
			  submitForm('searchSelectHomeLov',0,{'event':'doGo'});
			}

			return true;
		      }

                      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('homeTable');
                        var selectedRowIndex = proxy.getSelectedRow();

                        if (selectedRowIndex >= 0)
                        {
			  var selectedName_homeLoc = proxy.getFormElement('id', selectedRowIndex);
			  var selectedName_host = proxy.getFormElement('hostid', selectedRowIndex);
			  var selectedName_node = proxy.getFormElement('nodesid', selectedRowIndex);
			  var selectedName_clusName = proxy.getFormElement('clusNameid', selectedRowIndex);
			  top.returnValue = selectedName_homeLoc.value+"+"+selectedName_node.value+"+"+selectedName_host.value+"+"+selectedName_clusName.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="homeList">
          <method class="oracle.sysman.eml.ecm.cloneHome.SearchSelectHomeData" 
             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="homeTable">
      <method class="oracle.sysman.eml.ecm.cloneHome.CloneHomeHandler"
          method ="tableGoto"/>
    </event>

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

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


  </handlers>
</page>
