[Carbon-dev] svn commit r32826 - trunk/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/js
chanaka at wso2.com
chanaka at wso2.com
Sun Mar 29 23:01:43 PDT 2009
Author: chanaka
Date: Sun Mar 29 23:01:43 2009
New Revision: 32826
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=32826
Log:
removed the duplicated code and fixed the menu appearing in different places issue
Removed:
trunk/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/js/lbvalidation.js
Modified:
trunk/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/js/ep_common.js
trunk/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/js/validation.js
Modified: trunk/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/js/ep_common.js
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/js/ep_common.js?rev=32826&r1=32825&r2=32826&view=diff
==============================================================================
--- trunk/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/js/ep_common.js (original)
+++ trunk/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/js/ep_common.js Sun Mar 29 23:01:43 2009
@@ -13,6 +13,14 @@
~ See the License for the specific language governing permissions and
~ limitations under the License.
*/
+ var aMenuItems = [
+
+ { text: "Address" },
+ { text: "WSDL" },
+ { text: "Failover Group" },
+ { text: "Load-balance group"}
+
+ ];
function initDoc() {
if (doc == null) {
@@ -51,14 +59,6 @@
oMenu = new YAHOO.widget.Menu("basicmenu");
// Show the Menu instance
- var aMenuItems = [
-
- { text: "Address" },
- { text: "WSDL" },
- { text: "Failover Group" },
- { text: "Load-balance group"}
-
- ];
oMenu.addItems(aMenuItems);
}
@@ -415,10 +415,19 @@
}
//This is to generate the menu when someone clicks a Add endpoint
+var menuCount = 0;
function menuCallback(e, obj) {
+ menuCount++;
var parms = [obj[0],'bl','tr'];
if (!doValidation('true')) return;
-
+
+ //The following block is to fix a bug with the YUI menu whic display at different places when clicked twice
+ if(menuCount>=2) {
+ oMenu.destroy();
+ oMenu = new YAHOO.widget.Menu("basicmenu");
+ oMenu.clearContent();
+ oMenu.addItems(aMenuItems);
+ }
selectNode(obj[1]);
//Select the form
Deleted: trunk/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/js/lbvalidation.js
URL: http://wso2.org/svn/browse/wso2/None?pathrev=32825
Modified: trunk/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/js/validation.js
URL: http://wso2.org/svn/browse/wso2/trunk/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/js/validation.js?rev=32826&r1=32825&r2=32826&view=diff
==============================================================================
--- trunk/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/js/validation.js (original)
+++ trunk/carbon-components/endpoint/org.wso2.carbon.endpoint.ui/src/main/resources/web/endpoints/js/validation.js Sun Mar 29 23:01:43 2009
@@ -14,488 +14,6 @@
~ limitations under the License.
*/
-function doValidation(checkEmpty) {
- var error = "";
- var errorDiv = document.getElementById("errorDiv");
- var formId = "form_" + selectedFlag;
- var splitedId = selectedFlag.split(".");
- var endpointNode = getNodeById(selectedFlag);
-
- if (splitedId[0] == "failover") {
- if (selectedFlag == "failover.0") {
- if (checkEmpty == 'true') {
- error += validateEmpty(document.getElementById("mainName"), "Failover Name");
- }
- } else {
- //do something TODO-complete this?
- }
- }
- getNodeById("failover.0").setAttribute("name", document.getElementById("mainName").value);
- if (splitedId[0] == "load") {
- var endpointSubNode = endpointNode.childNodes[0];
- var sessionNode = doc.createElement("syn:session");
- if (endpointNode.childNodes.length > 1) {
- sessionNode = endpointNode.childNodes[1];
- if (endpointSubNode.nodeName != "syn:loadbalance") {
- endpointSubNode = endpointNode.childNodes[1];
- sessionNode = endpointNode.childNodes[0];
- }
- }
- else {
- endpointNode.appendChild(sessionNode);
-
- //The following code will put the seesion node on top
- endpointNode.removeChild(endpointSubNode);
- endpointNode.appendChild(endpointSubNode);
- }
-
- var the_sesOptions = document.getElementById(formId + '_sesOptions');
- var the_sesOptionsValue = the_sesOptions.childNodes[the_sesOptions.selectedIndex].value;
- if (the_sesOptionsValue == "SelectAValue") {
- endpointNode.removeChild(sessionNode);
- } else {
- sessionNode.setAttribute("type", the_sesOptionsValue);
- }
- }
- if (splitedId[0] == "address") {
- //Clear the previosly added configuration settings from the doc
- var endpointSubNode = endpointNode.childNodes[0];
-
- //Do the validation for each field
- var the_address = document.getElementById(formId + '_address');
- var the_format = document.getElementById(formId + '_format');
- var the_optimize = document.getElementById(formId + '_optimize');
- var the_suspend = document.getElementById(formId + '_suspend');
- var the_timeoutAction = document.getElementById(formId + '_timeoutAction');
- var the_duration = document.getElementById(formId + '_duration');
- var the_wsAddressing = document.getElementById(formId + '_wsAddressing');
- var the_listener = document.getElementById(formId + '_listener');
- var the_security = document.getElementById(formId + '_security');
- var the_policy = document.getElementById(formId + '_policy');
- var the_wsrm = document.getElementById(formId + '_wsrm');
- var the_wsrmPolicy = document.getElementById(formId + '_wsrmPolicy');
- var the_errorCodes = document.getElementById(formId + '_errorCodes');
- var the_maxDur = document.getElementById(formId + '_maxDur');
- var the_factor = document.getElementById(formId + '_factor');
- var the_timedoutErrCodes = document.getElementById(formId + '_timedoutErrCodes');
- var the_retry = document.getElementById(formId + '_retry');
- var the_retryDelay = document.getElementById(formId + '_retryDelay');
-
- //Reqviored field validation
- error += validateEmpty(the_address, "Address");
- error += validateUrl(the_address, "Address");
-
- //Update the doc xml object with the new config settings
-
- if (error == "") {
- endpointSubNode.setAttribute("uri", the_address.value);
- if (the_format.childNodes[the_format.selectedIndex].value != "SelectAValue") {
- endpointSubNode.setAttribute("format", the_format.childNodes[the_format.selectedIndex].value);
- }
- else {
- endpointSubNode.removeAttribute("format");
- }
- if (the_optimize.value != "SelectAValue") {
- endpointSubNode.setAttribute("optimize", the_optimize.value);
- }
- else {
- endpointSubNode.removeAttribute("optimize");
- }
-
- if (the_suspend.value != "" || the_errorCodes.value != "") {
- var optimizeNode = doc.createElement("syn:suspendOnFailure");
- if (endpointSubNode.getElementsByTagName("syn:suspendOnFailure").length > 0) {
- endpointSubNode.removeChild(endpointSubNode.getElementsByTagName("syn:suspendOnFailure")[0]);
- }
- if (the_suspend.value != "") {
- var initialDurNode = doc.createElement("syn:initialDuration");
- initialDurNode.appendChild(doc.createTextNode(the_suspend.value));
- optimizeNode.appendChild(initialDurNode)
- }
- if (the_errorCodes.value != "") {
- var errorCodesNode = doc.createElement("syn:errorCodes");
- errorCodesNode.appendChild(doc.createTextNode(the_errorCodes.value));
- optimizeNode.appendChild(errorCodesNode);
- }
- else {
- if (optimizeNode.getElementsByTagName("syn:errorCodes").length > 0) {
- var dd = optimizeNode.getElementsByTagName("syn:errorCodes")[0];
- optimizeNode.removeChild(dd);
- }
- }
-
- if (the_maxDur.value != "") {
- var maxDurationElement = doc.createElement("syn:maximumDuration");
- maxDurationElement.appendChild(doc.createTextNode(the_maxDur.value));
- optimizeNode.appendChild(maxDurationElement);
- }
- if (the_factor.value != "") {
- var factorElement = doc.createElement("syn:progressionFactor");
- factorElement.appendChild(doc.createTextNode(the_factor.value));
- optimizeNode.appendChild(factorElement);
- }
-
- //optimizeNode.appendChild(doc.createTextNode(the_suspend.value));
- endpointSubNode.appendChild(optimizeNode);
- }
- else {
- if (endpointSubNode.getElementsByTagName("syn:suspendOnFailure").length > 0) {
- var dd = endpointSubNode.getElementsByTagName("syn:suspendOnFailure")[0];
- endpointSubNode.removeChild(dd);
- }
- }
-
- if (the_retryDelay.value != "" || the_timedoutErrCodes.value != "") {
- var markForSuspensionNode = doc.createElement("syn:markForSuspension");
- if (endpointSubNode.getElementsByTagName("syn:markForSuspension").length > 0) {
- endpointSubNode.removeChild(endpointSubNode.getElementsByTagName("syn:markForSuspension")[0]);
- }
-
- if (the_retryDelay.value != "") {
- var retryDelayNode = doc.createElement("syn:retryDelay");
- retryDelayNode.appendChild(doc.createTextNode(the_retryDelay.value));
- markForSuspensionNode.appendChild(retryDelayNode);
- }
-
- if (the_timedoutErrCodes.value != "") {
- var errorCodesNode = doc.createElement("syn:errorCodes");
- errorCodesNode.appendChild(doc.createTextNode(the_timedoutErrCodes.value));
- markForSuspensionNode.appendChild(errorCodesNode);
- }
- else {
- if (markForSuspensionNode.getElementsByTagName("syn:errorCodes").length > 0) {
- var dd = markForSuspensionNode.getElementsByTagName("syn:errorCodes")[0];
- markForSuspensionNode.removeChild(dd);
- }
- }
-
- if (the_retry.value != "") {
- var retriesBeforeSuspensionNode = doc.createElement("syn:retriesBeforeSuspension");
- retriesBeforeSuspensionNode.appendChild(doc.createTextNode(the_retry.value));
- markForSuspensionNode.appendChild(retriesBeforeSuspensionNode);
- }
-
- endpointSubNode.appendChild(markForSuspensionNode);
- }
- else {
- if (endpointSubNode.getElementsByTagName("syn:markForSuspension").length > 0) {
- var dd = endpointSubNode.getElementsByTagName("syn:markForSuspension")[0];
- endpointSubNode.removeChild(dd);
- }
- }
-
- if (the_timeoutAction.childNodes[the_timeoutAction.selectedIndex].value != "SelectAValue") {
- var timeoutNode = doc.createElement("syn:timeout");
- var timeoutActionNode = doc.createElement("syn:action");
- var timeoutDurationNode = doc.createElement("syn:duration");
-
- //Remove this node if previously defined
- if (endpointSubNode.getElementsByTagName("syn:timeout").length > 0) {
- endpointSubNode.removeChild(endpointSubNode.getElementsByTagName("syn:timeout")[0]);
- }
-
- //Put the selected timeout action in the syn:action node
- timeoutActionNode.appendChild(doc.createTextNode(the_timeoutAction.childNodes[the_timeoutAction.selectedIndex].value));
- timeoutDurationNode.appendChild(doc.createTextNode(the_duration.value));
-
- //Append the sub node of the timeout node to the main timeout node
- timeoutNode.appendChild(timeoutActionNode);
- timeoutNode.appendChild(timeoutDurationNode);
-
- //Add the timeout node to the main endpoint node
- endpointSubNode.appendChild(timeoutNode);
- }
- else {
- if (endpointSubNode.getElementsByTagName("syn:timeout").length > 0) {
- var dd = endpointSubNode.getElementsByTagName("syn:timeout")[0];
- endpointSubNode.removeChild(dd);
- }
- }
-
- if (the_wsAddressing.checked) {
-
- var wsAddressingNode = doc.createElement("syn:enableAddressing");
- //Remove this node if previously defined
- if (endpointSubNode.getElementsByTagName("syn:enableAddressing").length > 0) {
- endpointSubNode.removeChild(endpointSubNode.getElementsByTagName("syn:enableAddressing")[0]);
- }
-
- if (the_listener.checked) {
- wsAddressingNode.setAttribute("separateListener", "true");
- }
- else {
- wsAddressingNode.removeAttribute("separateListener");
- }
- endpointSubNode.appendChild(wsAddressingNode);
- }
- else {
- if (endpointSubNode.getElementsByTagName("syn:enableAddressing").length > 0) {
- var dd = endpointSubNode.getElementsByTagName("syn:enableAddressing")[0];
- endpointSubNode.removeChild(dd);
- }
- }
- if (the_security.checked) {
- var securityNode = doc.createElement("syn:enableSec");
-
- //Remove this node if previously defined
- if (endpointSubNode.getElementsByTagName("syn:enableSec").length > 0) {
- endpointSubNode.removeChild(endpointSubNode.getElementsByTagName("syn:enableSec")[0]);
- }
-
- if (the_policy.value != "") {
- securityNode.setAttribute("policy", the_policy.value);
- }
- endpointSubNode.appendChild(securityNode);
- }
- else {
- if (endpointSubNode.getElementsByTagName("syn:enableSec").length > 0) {
- var dd = endpointSubNode.getElementsByTagName("syn:enableSec")[0];
- endpointSubNode.removeChild(dd);
- }
- }
- if (the_wsrm.checked) {
- var wsrmNode = doc.createElement("syn:enableRM");
-
- //Remove this node if previously defined
- if (endpointSubNode.getElementsByTagName("syn:enableRM").length > 0) {
- endpointSubNode.removeChild(endpointSubNode.getElementsByTagName("syn:enableRM")[0]);
- }
-
- if (the_wsrmPolicy.value != "") {
- wsrmNode.setAttribute("policy", the_wsrmPolicy.value);
- }
- endpointSubNode.appendChild(wsrmNode);
- }
- else {
- if (endpointSubNode.getElementsByTagName("syn:enableRM").length > 0) {
- var dd = endpointSubNode.getElementsByTagName("syn:enableRM")[0];
- endpointSubNode.removeChild(dd);
- }
- }
- }
- }
- if (splitedId[0] == "wsdl") {
- //Clear the previosly added configuration settings from the doc
- var endpointSubNode = endpointNode.childNodes[0];
- endpointNode.appendChild(endpointSubNode);
-
- var the_uri = document.getElementById(formId + 'endpoint_address0');
- var the_service = document.getElementById(formId + 'endpoint_service0');
- var the_port = document.getElementById(formId + 'endpoint_port0');
- var the_susDur = document.getElementById(formId + 'endpoint_suspend_duration0');
- var the_timeoutAct = document.getElementById(formId + 'endpoint_timeout_action0');
- var the_timeDur = document.getElementById(formId + 'endpoint_duration0');
- var the_wsAdd = document.getElementById(formId + 'wsAddressingEngaged0');
- var the_wsAddSepList = document.getElementById(formId + 'separateListener0');
- var the_wsSec = document.getElementById(formId + 'wsSecEngaged0');
- var the_secPolKey = document.getElementById(formId + 'sec_policy0');
- var the_wsRm = document.getElementById(formId + 'wsRMEngaged0');
- var the_rmPolKey = document.getElementById(formId + 'rm_policy0');
- var the_errorCodes = document.getElementById(formId + '_errorCodes');
- var the_maxDur = document.getElementById(formId + '_maxDur');
- var the_factor = document.getElementById(formId + '_factor');
- var the_timedoutErrCodes = document.getElementById(formId + '_timedoutErrCodes');
- var the_retry = document.getElementById(formId + '_retry');
- var the_retryDelay = document.getElementById(formId + '_retryDelay');
- var the_inlinedval = document.getElementById(formId + 'inlineprop_value');
- var urisel = document.getElementById(formId + 'uriselect');
- var inlinesel = document.getElementById(formId + 'inlineselect');
-
- var radBox = document.getElementsByName("group0");
-
- if (radBox[0].checked == "") {
- error += validateEmpty(the_uri, "Address");
- }
- error += validateEmpty(the_service, "Service");
- error += validateEmpty(the_port, "Port");
-
- if (error == "") {
- if (radBox[0].checked == "") {
- //alert('2')
- endpointSubNode.setAttribute("uri", the_uri.value);
- }
- endpointSubNode.setAttribute("service", the_service.value);
- endpointSubNode.setAttribute("port", the_port.value);
-
- if (radBox[0].checked != "") {
- if (the_inlinedval != "") {
- endpointSubNode.appendChild(newXmlFromString(the_inlinedval.value).firstChild);
- }
- }
- if (the_susDur.value != "" || the_errorCodes.value != "") {
- var optimizeNode = doc.createElement("syn:suspendOnFailure");
- if (endpointSubNode.getElementsByTagName("syn:suspendOnFailure").length > 0) {
- endpointSubNode.removeChild(endpointSubNode.getElementsByTagName("syn:suspendOnFailure")[0]);
- }
- if (the_susDur.value != "") {
- var initialDurNode = doc.createElement("syn:initialDuration");
- initialDurNode.appendChild(doc.createTextNode(the_susDur.value));
- optimizeNode.appendChild(initialDurNode)
- }
- if (the_errorCodes.value != "") {
- var errorCodesNode = doc.createElement("syn:errorCodes");
- errorCodesNode.appendChild(doc.createTextNode(the_errorCodes.value));
- optimizeNode.appendChild(errorCodesNode);
- }
- else {
- if (optimizeNode.getElementsByTagName("syn:errorCodes").length > 0) {
- var dd = optimizeNode.getElementsByTagName("syn:errorCodes")[0];
- endpointSubNode.removeChild(dd);
- }
- }
-
- if (the_maxDur.value != "") {
- var maxDurationElement = doc.createElement("syn:maximumDuration");
- maxDurationElement.appendChild(doc.createTextNode(the_maxDur.value));
- optimizeNode.appendChild(maxDurationElement);
- }
- if (the_factor.value != "") {
- var factorElement = doc.createElement("syn:progressionFactor");
- factorElement.appendChild(doc.createTextNode(the_factor.value));
- optimizeNode.appendChild(factorElement);
- }
-
- //optimizeNode.appendChild(doc.createTextNode(the_suspend.value));
- endpointSubNode.appendChild(optimizeNode);
- }
- else {
- if (endpointSubNode.getElementsByTagName("syn:suspendOnFailure").length > 0) {
- var dd = endpointSubNode.getElementsByTagName("syn:suspendOnFailure")[0];
- endpointSubNode.removeChild(dd);
- }
- }
-
- if (the_retryDelay.value != "" || the_timedoutErrCodes.value != "") {
- var markForSuspensionNode = doc.createElement("syn:markForSuspension");
-
- if (endpointSubNode.getElementsByTagName("syn:markForSuspension").length > 0) {
- endpointSubNode.removeChild(endpointSubNode.getElementsByTagName("syn:markForSuspension")[0]);
- }
-
- if (the_retryDelay.value != "") {
- var retryDelayNode = doc.createElement("syn:retryDelay");
- retryDelayNode.appendChild(doc.createTextNode(the_retryDelay.value));
- markForSuspensionNode.appendChild(retryDelayNode);
- }
-
- if (the_timedoutErrCodes.value != "") {
- var errorCodesNode = doc.createElement("syn:errorCodes");
- errorCodesNode.appendChild(doc.createTextNode(the_timedoutErrCodes.value));
- markForSuspensionNode.appendChild(errorCodesNode);
- }
- else {
- if (markForSuspensionNode.getElementsByTagName("syn:errorCodes").length > 0) {
- var dd = markForSuspensionNode.getElementsByTagName("syn:errorCodes")[0];
- endpointSubNode.removeChild(dd);
- }
- }
-
- if (the_retry.value != "") {
- var retriesBeforeSuspensionNode = doc.createElement("syn:retriesBeforeSuspension");
- retriesBeforeSuspensionNode.appendChild(doc.createTextNode(the_retry.value));
- markForSuspensionNode.appendChild(retriesBeforeSuspensionNode);
- }
- endpointSubNode.appendChild(markForSuspensionNode);
- }
- else {
- if (endpointSubNode.getElementsByTagName("syn:markForSuspension").length > 0) {
- var dd = endpointSubNode.getElementsByTagName("syn:markForSuspension")[0];
- endpointSubNode.removeChild(dd);
- }
- }
-
- if (the_timeoutAct.childNodes[the_timeoutAct.selectedIndex].value != "SelectAValue") {
- var timeoutNode = doc.createElement("syn:timeout");
- var timeoutActionNode = doc.createElement("syn:action");
- var timeoutDurationNode = doc.createElement("syn:duration");
-
- //Remove this node if previously defined
- if (endpointSubNode.getElementsByTagName("syn:action").length > 0) {
- endpointSubNode.removeChild(endpointSubNode.getElementsByTagName("syn:action")[0]);
- }
- //Put the selected timeout action in the syn:action node
- timeoutActionNode.appendChild(doc.createTextNode(the_timeoutAct.childNodes[the_timeoutAct.selectedIndex].value));
- timeoutDurationNode.appendChild(doc.createTextNode(the_timeDur.value));
-
- //Append the sub node of the timeout node to the main timeout node
- timeoutNode.appendChild(timeoutActionNode);
- timeoutNode.appendChild(timeoutDurationNode);
- //Add the timeout node to the main endpoint node
- endpointSubNode.appendChild(timeoutNode);
- }
- else {
- if (endpointSubNode.getElementsByTagName("syn:timeout").length > 0) {
- var dd = endpointSubNode.getElementsByTagName("syn:timeout")[0];
- endpointSubNode.removeChild(dd);
- }
- }
-
- if (the_wsAdd.checked) {
- var wsAddressingNode = doc.createElement("syn:enableAddressing");
- //Remove this node if previously defined
- if (endpointSubNode.getElementsByTagName("syn:enableAddressing").length > 0) {
- endpointSubNode.removeChild(endpointSubNode.getElementsByTagName("syn:enableAddressing")[0]);
- }
-
- if (the_wsAddSepList.checked) {
- wsAddressingNode.setAttribute("separateListener", "true");
- }
- else {
- wsAddressingNode.removeAttribute("separateListener");
- }
- endpointSubNode.appendChild(wsAddressingNode);
- }
- else {
- if (endpointSubNode.getElementsByTagName("syn:enableAddressing").length > 0) {
- var dd = endpointSubNode.getElementsByTagName("syn:enableAddressing")[0];
- endpointSubNode.removeChild(dd);
- }
- }
- if (the_wsSec.checked) {
- var securityNode = doc.createElement("syn:enableSec");
- //Remove this node if previously defined
- if (endpointSubNode.getElementsByTagName("syn:enableSec").length > 0) {
- endpointSubNode.removeChild(endpointSubNode.getElementsByTagName("syn:enableSec")[0]);
- }
-
- if (the_secPolKey.value != "") {
- securityNode.setAttribute("policy", the_secPolKey.value);
- }
- endpointSubNode.appendChild(securityNode);
- }
- else {
- if (endpointSubNode.getElementsByTagName("syn:enableSec").length > 0) {
- var dd = endpointSubNode.getElementsByTagName("syn:enableSec")[0];
- endpointSubNode.removeChild(dd);
- }
- }
- if (the_wsRm.checked) {
- var wsrmNode = doc.createElement("syn:enableRM");
- //Remove this node if previously defined
- if (endpointSubNode.getElementsByTagName("syn:enableRM").length > 0) {
- endpointSubNode.removeChild(endpointSubNode.getElementsByTagName("syn:enableRM")[0]);
- }
- if (the_rmPolKey.value != "") {
- wsrmNode.setAttribute("policy", the_rmPolKey.value);
- }
- endpointSubNode.appendChild(wsrmNode);
- }
- else {
- if (endpointSubNode.getElementsByTagName("syn:enableRM").length > 0) {
- var dd = endpointSubNode.getElementsByTagName("syn:enableRM")[0];
- endpointSubNode.removeChild(dd);
- }
- }
- }
- }
- if (error != "") {
- CARBON.showWarningDialog(error);
- return false;
- } else {
- return true;
- }
-}
-
function validateAddress(endpointNode, formId, error) {
//Clear the previosly added configuration settings from the doc
var endpointSubNode = endpointNode.childNodes[0];
@@ -961,6 +479,16 @@
return error;
}
function validateLoad(endpointNode, formId, error) {
+ //Define id's according to the form state
+ var the_sesOptions = "";
+ var the_sesTimeout = "";
+ if(formId == "form_load.0"){
+ the_sesOptions = document.getElementById('sesOptions');
+ the_sesTimeout = document.getElementById('sesTimeout');
+ }else{
+ the_sesOptions = document.getElementById(formId + '_sesOptions');
+ the_sesTimeout = document.getElementById(formId+'sesTimeout');
+ }
var endpointSubNode = endpointNode.childNodes[0];
var sessionNode = doc.createElement("syn:session");
if (endpointNode.childNodes.length > 1) {
@@ -979,17 +507,14 @@
}
- var the_sesOptions = document.getElementById(formId + '_sesOptions');
- // var the_sesTimeout = document.getElementById(formId+'sesTimeout');
-
var the_sesOptionsValue = the_sesOptions.childNodes[the_sesOptions.selectedIndex].value;
if (the_sesOptionsValue == "SelectAValue") {
endpointNode.removeChild(sessionNode);
} else {
sessionNode.setAttribute("type", the_sesOptionsValue);
- // var sesTimeoutNode = doc.createElement("syn:sessionTimeout");
- // sesTimeoutNode.appendChild(doc.createTextNode(sesTimeoutNode.value));
- // sessionNode.appendChild(sesTimeoutNode);
+ var sesTimeoutNode = doc.createElement("syn:sessionTimeout");
+ sesTimeoutNode.appendChild(doc.createTextNode(sesTimeoutNode.value));
+ sessionNode.appendChild(sesTimeoutNode);
}
return error;
}
More information about the Carbon-dev
mailing list