<page xmlns="http://xmlns.oracle.com/uix/controller"
      xmlns:baja="http://xmlns.oracle.com/uix/controller"
      xmlns:uix="http://xmlns.oracle.com/uix/ui" 
      xmlns:html="http://www.w3.org/TR/REC-html40">
      
    <baja:head  xmlns="http://xmlns.oracle.com/uix/ui">
        <dataScope>
            <contents>
                <head xmlns="http://xmlns.oracle.com/uix/ui"  uix:title="pageTitle@getPageTitle"/>
            </contents>
            <provider>
                <data name="getPageTitle">
                    <method class="oracle.sysman.eml.admin.rep.proxy.ProxyData" method="getPageTitle"/>
                </data>
            </provider>
        </dataScope>
    </baja:head>
    
    
    <baja:content xmlns="http://xmlns.oracle.com/uix/ui">
        <body>
            <contents>
                <dataScope>
                    <contents>
        
                        <script>
                            <contents>
                                function delimitSpaceToCaret(chkStr)
                                {
                                    var newStr = "";
                                    var cmpStr = "";
                                    var space = " ";
                                    var caret = "^";
                                    
                                    strBegLoc = 0;
                                    spcLoc = chkStr.indexOf(space);
                                    while ( spcLoc > -1)
                                    {
                                        newStr = newStr+chkStr.substr(strBegLoc,spcLoc)+caret;
                                        cmpStr = chkStr.substr(strBegLoc+spcLoc+1);
                                        spcLoc = cmpStr.indexOf(space);
                                        strBegLoc = newStr.length;
                                    }
                                    // add the last chunk
                                    if (cmpStr.length > 0)
                                        newStr = newStr+cmpStr;
                                    
                                    if (newStr.length > 0)
                                     return newStr;
                                    else
                                     return chkStr;
                                }
                                function setHostRedirValue()
                                {
                                    var parentRef = document.proxySetupForm.protocol;
                                    var protocolId = parentRef.options[parentRef.selectedIndex].value;
                                    var protocolName = parentRef.options[parentRef.selectedIndex].text;
                                    var hostName = document.proxySetupForm.hostLov.value;
                                    
                                    var contextpath = document.proxySetupForm.contextPath.value;
                                    var path = contextpath + "admin/rep/proxy/hostListLov";
                                    var params = "$protocolId="+protocolId+"$protocolName="+protocolName+"$hostName="+hostName
                                    var imagepath = document.proxySetupForm.imagePath.value;
                                    var redir = imagepath + "cabo/jsps/frameRedirect.jsp?redirect="+path+delimitSpaceToCaret(params);
                                    
                                    // set hidden param to use in openWindow
                                    document.proxySetupForm.hostRedir.value=redir;
                                    //document.proxySetupForm.host.value=hostName;
                                }
                                function hostListCallBack(lovwin, event)
                                {
                                    var h = lovwin.retHost;
                                    var p = lovwin.retPort;
                                    var d = lovwin.retDont;
                                    var r = lovwin.retRelm;
                                    var u = lovwin.retUser;
                                    var s = lovwin.retPass;
                                    if (h !=(void 0))
                                    {
                                        document.proxySetupForm.hostLov.value = h;
                                        document.proxySetupForm.port.value = p;
                                        document.proxySetupForm.dont.value = d;
                                        document.proxySetupForm.relm.value = r;
                                        document.proxySetupForm.user.value = u;
                                        document.proxySetupForm.pass.value = s;
                                        /*
                                        document.patchWiz_Patch.productId.value = value;
                                        */
                                    }
                                }
                                function clearParams()
                                {
                                    with (document.proxySetupForm)
                                    {
                                        hostLov.value = "";
                                        port.value = "80";
                                        dont.value = "localhost,127.0.0.1"
                                        relm.value = "";
                                        user.value = "";
                                        pass.value = "";
                                    }
                                }
                            </contents>
                        </script>

                        <pageLayout>
                            
                            <mediumAdvertisement>
                                <include baja:node="/oemBanner" />
                            </mediumAdvertisement>
                            <globalButtons>
                                <include baja:node="/globalButtonBar" />
                            </globalButtons>
                            <tabs>
                                <include baja:node="/globalTabs" />
                            </tabs>
                            <pageHeader>
                                <include baja:node="../header"/>
                            </pageHeader>
                            <copyright>
                                <include baja:node="/copyright" />
                            </copyright>
                            <uix:start>
                                <include baja:node="../adminSideNav" />
                            </uix:start>
                            <location>
                                <include baja:node="/breadCrumbs" />
                            </location>

            <contents>
                <stackLayout>
                  <contents>
                    <messageBox automatic="true" />
                    <spacer height="10"/>
                    
                    <subTabLayout>

                      <subTabs>
                        <subTabBar selectedIndex="1">
                          <contents>
                            <link uix:text="PRP_SUB_TAB_PATCH@ResourceBundle" destination="/console/ecm/patch/patchConfigParams" />
                            <link uix:text="PRP_SUB_TAB_PROXY@ResourceBundle" destination="/console/admin/rep/proxy/server"/>
                            <link uix:text="PRP_SUB_TAB_CACHE@ResourceBundle" destination="/console/admin/rep/proxy/cache"/>
                          </contents>
                        </subTabBar>
                      </subTabs>

                      <contents>
                    <spacer height="10"/>
                    <tableLayout width="100%">
                        <contents>
                            <rowLayout>
                                <contents>
                                    <cellFormat width="50%" vAlign="top">
                                        <contents>
                                        
                                            <form name="proxySetupForm" method="POST">
                                                <contents>
                                                
						<html:noScript>
						JavaScript is not supported by your browser. Oracle requires JavaScript support to completely render this page
						</html:noScript>
                                                    <formValue name="hostRedir" />
                                                    <formValue name="contextPath" uix:value="contextPath@getContextPath"/>
                                                    <formValue name="imagePath" uix:value="imagePath@getImagePath"/>
                                                    
                                                    <stackLayout>
                                                        <contents>
                                                        
                                                            <radioButton name="type"
                                                                         uix:text="RADIO_DIRECT@ResourceBundle"
                                                                         uix:selected="connDirect@proxyData"
                                                                         value="Direct"
                                                                         onClick="submitForm('proxySetupForm', true, {'event':'directConnection'})"/>
                                                            <radioButton name="type"
                                                                         uix:text="RADIO_PROXY@ResourceBundle"
                                                                         uix:selected="connProxy@proxyData"
                                                                         value="Proxy"
                                                                         onClick="submitForm('proxySetupForm', true, {'event':'proxyConnection'})" />
                                                            
                                                            <spacer height="10" />
                                                            
                                                            <switcher uix:childName="connType@proxyData">
                                                            <case name="proxy">
                                                            <header uix:text="RADIO_PROXY@ResourceBundle" size="1">
                                                                <contents>
                                                                    <stackLayout>
                                                                        <contents>
                                                                            <labeledFieldLayout labelWidth="10%"
                                                                                                fieldWidth="90%">
                                                                                <contents>
                                                                                    <messageChoice name="protocol" uix:prompt="SERVER_PROTOCOL@ResourceBundle">
                                                                                        <contents>
                                                                                            <option text="HTTP"  value="HTTP"/>
                                                                                        </contents>
                                                                                    </messageChoice>
                                                                                    <messageLovField	name="hostLov"
                                                                                                     uix:prompt="SERVER_HOST@ResourceBundle"
                                                                                                     uix:text="host@proxy@proxyData"
                                                                                                     columns="39"
                                                                                                     shortDesc="Select the proxy server"
                                                                                                     searchDesc="Select the proxy server"
                                                                                                     onClick= "setHostRedirValue();
                                                                                                               openWindow(top,
                                                                                                               document.proxySetupForm.hostRedir.value,
                                                                                                               'lovWindow',
                                                                                                               {width:600, height:200},
                                                                                                               true,
                                                                                                               'dialog',
                                                                                                               hostListCallBack); "/>
                                                                                    <messageTextInput uix:prompt="SERVER_PORT@ResourceBundle" 
                                                                                                      name="port" 
                                                                                                      uix:text="port@proxy@proxyData"/>
                                                                                    <messageTextInput uix:prompt="SERVER_DONT@ResourceBundle" 
                                                                                                      name="dont" 
                                                                                                      rows="5" 
                                                                                                      shortDesc="Comma seperated URLs that will not be connected through the Proxy." 
                                                                                                      uix:tip="SERVER_DONT_TIP@ResourceBundle" 
                                                                                                      uix:text="dont@proxy@proxyData" />
                                                                                    <spacer height="40" />
                                                                                    <messagePrompt uix:prompt="SERVER_ADD@ResourceBundle" 
                                                                                                   messageType="info" />
                                                                                    <messageTextInput uix:prompt="SERVER_RELM@ResourceBundle" 
                                                                                                      name="relm"
                                                                                                      uix:text="relm@proxy@proxyData" />
                                                                                    <messageTextInput uix:prompt="SERVER_USER@ResourceBundle" 
                                                                                                      name="user"
                                                                                                      noAutoComplete="true"
                                                                                                      uix:text="user@proxy@proxyData" />
                                                                                    <messageTextInput uix:prompt="SERVER_PASS@ResourceBundle" 
                                                                                                      name="pass" 
                                                                                                      secret="true"
                                                                                                      noAutoComplete="true"
                                                                                                      uix:text="pass@proxy@proxyData" />
                                                                                </contents>
                                                                            </labeledFieldLayout>
                                                                        </contents>
                                                                    </stackLayout>
                                                                </contents>
                                                            </header>
                                                            </case>
                                                            </switcher>
                                                            
                                                            <spacer height="10" />
                                                            
                                                            <header uix:text="CONFIG_TEST_URL@ResourceBundle" size="1">
                                                                <contents>
                                                                    <stackLayout>
                                                                        <contents>
                                                                            <styledText uix:text="PRP_MSG_TEST_URL@ResourceBundle" styleClass="OraInstructionText" />
                                                                            <textInput name="testURL"
	shortDesc="Test URL"
                                                                                   uix:text="testURL@proxyData" />
                                                                            <styledText styleClass="OraTipText" uix:text="TEST_URL_TIP@ResourceBundle"/>
                                                                        </contents>
                                                                    </stackLayout>
                                                                </contents>
                                                            </header>
                                                            
                                                            <spacer height="15" />
                                                            
                                                            <flowLayout>
                                                                <contents>
                                                                    <submitButton uix:text="BTN_TEST@ResourceBundle" name="event" value="test" />
                                                                    <spacer width="3" />
                                                                    <submitButton uix:text="BTN_APPLY@ResourceBundle" name="event" value="apply" />
                                                                    <spacer width="3" />
                                                                    <button uix:text="BTN_CLEAR@ResourceBundle" onClick="submitForm('proxySetupForm',0);return true"/>
                                                                </contents>
                                                            </flowLayout>
                                                        
                                                        </contents>
                                                    </stackLayout>
                                                    
                                                </contents>
                                            </form>
                                        
                                        </contents>
                                    </cellFormat>
                                    
                                    <!-- This cell displays the currently used proxy details. -->
                                    <cellFormat width="50%"
                                                vAlign="top">
                                        <contents>
                                            
                                            <include baja:node="currProxyDetails" />
                                            
                                            <spacer height="10" />
                                            
                                            <include baja:node="connDetails" />
                                            
                                        </contents>
                                    </cellFormat>
                                </contents>
                            </rowLayout>
                        </contents>
                    </tableLayout>
                     </contents>
                     </subTabLayout>
                    
                  </contents>
                </stackLayout>
            </contents>
        </pageLayout>
        
        </contents>
        
        <provider>
        
            <data name="ResourceBundle">
                <bundle class = "oracle.sysman.eml.ecm.patch.util.PatchResourceBundle"/>
            </data>
            
            <data name="proxyData">
                <method class="oracle.sysman.eml.admin.rep.proxy.ProxyData"
                        method="getProxyData"/>
            </data>
            
            <data name="getContextPath">
                <method class="oracle.sysman.eml.ecm.ContextPathData" method="getContextPath"/>
            </data>
            
            <data name="getImagePath">
                <method class="oracle.sysman.eml.ecm.ContextPathData" method="getImagePath"/>
            </data>
            
            <data name="configData">
                <method class="oracle.sysman.eml.admin.rep.proxy.ProxyData" method="getConfigData" />
            </data>

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

<handlers>

    <event name="null">
        <method class="oracle.sysman.eml.admin.rep.proxy.ProxyHandler" method="load" />
    </event>
    
    <event name="directConnection">
        <method class="oracle.sysman.eml.admin.rep.proxy.ProxyHandler"
                method="useDirectConnection"/>
    </event>
    
    <event name="proxyConnection">
        <method class="oracle.sysman.eml.admin.rep.proxy.ProxyHandler"
                method="useProxyConnection"/>
    </event>

    <event name="test">
        <method class="oracle.sysman.eml.admin.rep.proxy.ProxyHandler"
                method="doTest"/>
    </event>
    
    <event name="apply">
        <method class="oracle.sysman.eml.admin.rep.proxy.ProxyHandler"
                method="doApply"/>
    </event>
    
    <event name="clear">
        <method class="oracle.sysman.eml.admin.rep.proxy.ProxyHandler"
                method="doClear"/>
    </event>
    
    <event name="updateConfig">
        <method class="oracle.sysman.eml.admin.rep.proxy.ProxyHandler"
                method="doConfigUpdate"/>
    </event>
    
    <event name="defConfig">
        <method class="oracle.sysman.eml.admin.rep.proxy.ProxyHandler"
                method="doConfigDefault"/>
    </event>
    
    <!-- Handlers for the Current Proxy details -->
    <event name="hide" source="hideShowRepProxy">
        <method class="oracle.sysman.eml.admin.rep.proxy.ProxyHandler"
                method="doHideRepProxy"/>
    </event>
    <event name="show" source="hideShowRepProxy">
        <method class="oracle.sysman.eml.admin.rep.proxy.ProxyHandler"
                method="doShowRepProxy"/>
    </event>

</handlers>

</page>
