Opened 16 years ago

Closed 15 years ago

#195 closed defect (fixed)

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: Browser: All
External ID: Operating System: All
state: New

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 (1)

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

Download all attachments as: .zip

Change History (8)

comment:1 by chrisclaydon, 16 years ago

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?

comment:2 by chrisclaydon, 16 years ago

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);
            }
        }
    }

comment:3 by bberdel, 16 years ago

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

comment:4 by madair, 16 years ago

Status: newassigned

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.

comment:5 by chrisclaydon, 16 years ago

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.

by bberdel, 16 years ago

Attachment: TaskPane.js added

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

comment:6 by bberdel, 16 years ago

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

comment:7 by madair, 15 years ago

Resolution: fixed
Status: assignedclosed

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.