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

                  <pageLayout xmlns="http://bali.us.oracle.com/cabo/marlin">
                    <boundAttribute name="title">
                      blah
                    </boundAttribute>


                    <pageStatus>
                      <html:span class="OraInstructionText">
                        <rawText uix:text="INSTR_SELECT_PREPOST@ResourceBundle" />
                      </html:span>
                    </pageStatus>

                    <pageButtons>
                    <pageButtonBar>
                    <contents>

                      <switcher uix:childName="getPrepost@prepostList" childName="prepostFound">
                        <case name="prepostFound">
                        <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@prepostList"/>
                        </contents>
                        </rowLayout>
                        </case>
                      </switcher>

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

                   <contents>

                  <switcher uix:childName="getPrepost@prepostList" childName="prepostFound">
                    <case name="prepostFound">
                      <stackLayout>
                        <contents>
                          <spacer height="8"/>
                              <header uix:text="HDR_SELECT_PREPOST@ResourceBundle" >
                                <contents>

                                  <table name="prepostTable"
                                       width="100%" minValue="1"
                                       formSubmitted="true"
                                       uix:columnHeaderData="columnHeaderData@prepostList"
                                       uix:tableData="tableData@prepostList"
                                       uix:maxValue="maxValue@prepostList"
                                       uix:blockSize="blockSize@prepostList"
                                       uix:value="value@prepostList"
                                       uix:alternateText="ALT_NOPREPOST@ResourceBundle"
                                       proxied="true">
                                    <tableFormat tableBanding="rowBanding"/>
                                      <columnHeaderStamp>
                                        <sortableHeader uix:text="columnHeaderText"/>
                                      </columnHeaderStamp>
                                      <tableSelection>
                                        <singleSelection selectedIndex="0">
                                        <contents>
                                        </contents>
                                      </singleSelection>
                                    </tableSelection>

                                    <columnHeaderData>
                                        <column  id="prepostName" uix:columnHeaderText="HDR_PREPOSTNAME@ResourceBundle"/>
                                        <column  id="prepostDesc" uix:columnHeaderText="HDR_PREPOSTDESC@ResourceBundle"/>
                                     </columnHeaderData>


                                    <contents>
                                      <styledText headers="prepostName" name="prepostName" uix:text="prepostName"/>
                                      <styledText headers="prepostDesc"  name="prepostDesc"  uix:text="prepostDesc"/>
                                      <formValue  name="prepostCmd"      uix:value="prepostCmd"/>
                                      <formValue  name="prepostRunAsRoot"      uix:value="prepostRunAsRoot"/>
                                    </contents>
                                  </table>

                                </contents>
                              </header>

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

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

                          <rowLayout >
                            <contents >
                              <spacer width="20" height="1"/>
                              <styledText styleClass="OraDataText" uix:text="ERROR_MESSAGE@getPrepostList"/>
                            </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('prepostTable');
                        var selectedRowIndex = proxy.getSelectedRow();

                        if (selectedRowIndex >= 0)
                        {
                          var selectedName_cmd = proxy.getFormElement('prepostCmd', selectedRowIndex);
                          var selectedName_runasroot = proxy.getFormElement('prepostRunAsRoot', selectedRowIndex);
                          // pass back prepostCmd+prepostRunAsRoot
                          top.returnValue = selectedName_cmd.value + "+" + selectedName_runasroot.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="prepostList">
          <method class="oracle.sysman.eml.ecm.cloneHome.SearchSelectPrepostData"
             method="populateResultsTable"/>
        </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>

  </handlers>
</page>
