All Downloads are FREE. Search and download functionalities are using the official Maven repository.

web.throttle-mediator.js.mediator-util.js Maven / Gradle / Ivy

There is a newer version: 4.7.219
Show newest version
/*
 *  Copyright (c) 2008, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

function displaySetProperties(isDisply) {
    var toDisplayElement;
    displayElement("mediator.property.action_row", isDisply);
    displayElement("mediator.property.value_row", isDisply);
    toDisplayElement = document.getElementById("mediator.namespace.editor");
    if (toDisplayElement != null) {
        if (isDisply) {
            toDisplayElement.style.display = '';
        } else {
            toDisplayElement.style.display = 'none';
        }
    }
}

function displayElement(elementId, isDisplay) {
    var toDisplayElement = document.getElementById(elementId);
    if (toDisplayElement != null) {
        if (isDisplay) {
            toDisplayElement.style.display = '';
        } else {
            toDisplayElement.style.display = 'none';
        }
    }
}

function throttleMediatorValidate() {
    var throttleId = document.getElementById("throttle_id1");
    if (throttleId && throttleId.value == "") {
        CARBON.showErrorDialog(thottleMediatorJsi18n["throttle.id.required"]);
        return false;
    }

//    var policyInlineOpt = document.getElementById("policygroupInlineId");
//    if (policyInlineOpt && policyInlineOpt.checked) {
//        var throttleInlinePolicyValueId = document.getElementById("inlinepolicy_value");
//        if (throttleInlinePolicyValueId && throttleInlinePolicyValueId.value == "") {
//            CARBON.showErrorDialog(jsi18n["throttle.policyval.required"]);
//            return false;
//        }
//    }

//    var policyValueOpt = document.getElementById("policygroupValueId");
//    if (policyValueOpt && policyValueOpt.checked) {
//        var throttleregPolicyId = document.getElementById("mediator.throttle.regPolicy");
//        if (throttleregPolicyId && throttleregPolicyId.value.replace(/\s+/g,'') == "") {
//            CARBON.showErrorDialog(thottleMediatorJsi18n["throttle.policykey.required"]);
//            return false;
//        }
//    }

    return true;
}

function createNamespaceEditor(elementId, id, prefix, uri) {
    var ele = document.getElementById(elementId);
    if (ele != null) {
        var createEle = document.getElementById(id);
        if (createEle != null) {
            if (createEle.style.display == 'none') {
                createEle.style.display = '';
            } else {
                createEle.style.display = 'none';
            }
        } else {
            ele.innerHTML = '
' + '
Prefix
URI
'; } } } function showInLinedThrottlePolicyEditor(id) { if (id == null || id == undefined || id == "") { CARBON.showInfoDialog("ID cannot be null or empty"); } var loadingContent = "
Throttle policy editor loading please wait ..
"; CARBON.showPopupDialog(loadingContent, thottleMediatorJsi18n["throttle.policy.editor"], 500, false, null, 900); var random = Math.floor(Math.random() * 2000); var url = '../throttling/trottle-policy-editor_ajaxprocessor.jsp?popup=true&policyID=' + id ; jQuery("#dialog").load(url, null, function(res, status, t) { if (status != "success") { CARBON.showWarningDialog(thottleMediatorJsi18n["throttle.policy.error"]); } }); return false; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy