CPAN-Testers-WWW-Reports

 view release on metacpan or  search on metacpan

vhost/html/js/OpenThought.js  view on Meta::CPAN

    {
        if(element.value == "on")
        {
            return this.config.checkbox_true_value;
        }
        else
        {
            return element.value;
        }
    }
    else
    {
        return this.config.checkbox_false_value;
    }

}

// Figure out which option is selected in our radio button
this.RadioValue = function(element)
{
    var values = new Array();

    // This occurrs if there is only one radio button
    if (element.length == null ) {
        if(element.checked == true) {
            values[values.length] = element.value;
        }
    }
    // More than one button
    else {

        for (var i=0, n=element.length; i < n; i++)
        {
            if(element[i].checked == true)
            {
                values[values.length] = element[i].value;
            }
        }
    }

    if ( values.length > 0 ) {
        if ( values.length == 1 ) {
            return values[0];
        }
        else {
            return values;
        }
    }
    else {
        return this.config.radio_null_selection_value;
    }
}

// Takes a fieldname as an argument, and gives that field the focus
this.Focus = function(element)
{
    var object  = this.FindElement(element)

    // If no object is found with the name "element", then either they typed in
    // wrong, or it's an anchor.  There's no way to know for sure, so let's
    // guess the latter.  This should make debugging fun.

    if( !object ) {
        if ( document.anchors[element] ) {
            this.log.info("Jumping to anchor tag ['" + element + "'].");
            location.hash = "#" + element;
        }
        else {
            this.log.error("Can't seem to find the element '" + element + "', unable to focus.");
        }
    }
    else {
        this.log.info("Focusing form element ['" + element + "'].");
        object.focus();
    }
}

// Do the call to the server
this.Send = function(args, eventType) {

    this.log.debug("Preparing to send.");

    var params = this.ParseParams(args);

    return this.communicator.Beam(params.url, params.args, params.method, eventType );
}

this.ParseParams = function(args) {
    var start_index = 0;
    var params = new Object;
    params["args"] = new Array;

    if (args[0] == "GET") {
        params["method"] = args[0];
        params["url"]    = args[1];
        start_index = 2;
    }
    else if (args[0] == "POST") {
        params["method"] = args[0];
        params["url"]    = args[1];
        start_index = 2;
    }
    else {
        params["method"] = this.config.http_request_type;
        params["url"]    = args[0];
        start_index = 1;
    }

    for (var i = start_index; i < args.length; i++) {
        // We allow arrays for parameters, test for them here
        if (typeof(args[i]) == "object" && args[i].length) {
            params["args"] = params["args"].concat(args[i]);
        }
        else {
            params["args"][params["args"].length] = args[i];
        }
    }

    return params;
}



( run in 0.760 second using v1.01-cache-2.11-cpan-364913b4093 )