Ticket #195 (closed defect: fixed)

Opened 5 years ago

Last modified 4 years ago

Request.QueryString Returns Null or Nothing Parameters

Reported by: bberdel Owned by: madair
Priority: P2 Milestone: 2.0
Component: Core Version: 1.1.0
Severity: Major Keywords: parameter querystring
Cc: External ID:
state: New Browser: All
Operating System: All

Description

In all previous versions of Fusion (before 1.1) I was able to use request.querystring from the task frame to return parameters such as MapName? and SessionID. However this no returns an empty list and there are no paramaters. I have also tried the code below.

NameValueCollection? parameters;

if(Request.HttpMethod? == "POST")

parameters = Request.Form;

else

parameters = Request.QueryString?;

String mapName = GetParameter?(parameters, "MAPNAME"); String session = GetParameter?(parameters, "SESSION");

_

Where the GetParameter? method looks like this:

_

String GetParameter?(NameValueCollection? parameters, String name) {

String strval = parameters[name]; if (null == strval)

return "";

return strval.Trim();

}

Attachments

TaskPane.js Download (7.0 KB) - added by bberdel 4 years ago.
TaskPane? Widget Update...Allows parameters to be set for initial task pane view

Change History

Changed 5 years ago by chrisclaydon

I'm seeing the same problem with MGE 2009 Update 1 using the .NET web tier. It looks like the MAPNAME and SESSION parameters are sent twice as URL request parameters when the target is the task pane. That causes my particular script to fail. But if I set the target to be a new window, it succeeds. In this case, the parameters only show up in the URL request once.

If you set your target to be a new window, does it work for you?

Changed 5 years ago by chrisclaydon

I changed the execute method in InvokeURL.js to this, and it fixed the problem. It doesn't add the extra params when the target is the task pane, since the setContent() method adds them anyway:

    execute : function() {
        var url = this.sBaseUrl;
        //add in other parameters to the url here

        var map = this.getMap();
        var taskPaneTarget = Fusion.getWidgetById(this.sTarget);
        var params = [];
        if ( taskPaneTarget == null ) {
            params.push('LOCALE='+Fusion.locale);
            params.push('SESSION='+map.getSessionID());
            params.push('MAPNAME='+map.getMapName());
        }
        params = params.concat(this.additionalParameters);
        if (url.indexOf('?') < 0) {
            url += '?';
        } else if (url.slice(-1) != '&') {
            url += '&';
        }
        url += params.join('&');
        if ( taskPaneTarget ) {
            taskPaneTarget.setContent(url);
        } else {
            var pageElement = $(this.sTarget);
            if ( pageElement ) {
                pageElement.src = url;
            } else {
                window.open(url, this.sTarget, this.sWinFeatures);
            }
        }
    }

Changed 5 years ago by bberdel

Thanks for the quick reponses. When using invokeScipt the parameters do come up for a new window and the task pane withoug changing the execute method. I just verified that it does work. However my problem was when calling the parameters from the initial task pane url. Your post pointed me in the right direction in that the following code was missing from the TaskPane?.js

var map = this.getMap();

var params = []; params.push('LOCALE=' + Fusion.locale); params.push('SESSION=' + map.getSessionID()); params.push('MAPNAME=' + map.getMapName()); if (url.indexOf('?') < 0) {

url += '?';

} else if (url.slice(-1) != '&') {

url += '&';

} url += params.join('&');

Thanks, that did it, but I guess the code should be verified in version 2

Changed 4 years ago by madair

  • status changed from new to assigned

I'm having trouble figuring this one out. Can you provide a patch for this? I can see the code that cclaydon describes in InvokeUrl?.js but I am unable to find the code in TaskPane?.js that bberdel mentions.

Changed 4 years ago by chrisclaydon

The 1.0 version of TaskPane?.js has the code referenced by bberdel in the setContent method.

In the 1.1 version, it has been removed, which would break any initial task script that requires the additional parameters.

Changed 4 years ago by bberdel

TaskPane? Widget Update...Allows parameters to be set for initial task pane view

Changed 4 years ago by bberdel

The code wasn't there, I added it starting @ line 155

Changed 4 years ago by madair

  • status changed from assigned to closed
  • resolution set to fixed

fixed at rev. 1925, but parameters will be added in lower case only if they aren't already included in the URL

Note: See TracTickets for help on using tickets.