mapAgentURL is not defined in FUSION mapguide

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

mapAgentURL is not defined in FUSION mapguide

Rodolfo Moreno
Hi All,
I have installed Mapguide OS MapGuideOpenSource-3.1.2.9484-Final-x64 and
MapGuideMaestro-Release-6.0m10. After I loaded Sheybogan.mgp using Maestro.
However when I tried the fusion slate template from maestro I got error
message: "mapAgentURL is not defined". I tested the ajax viewer sucessfully
but I dont know why fusion is not working.
My enviroment is: windows 10 pro 64 bits

</file/t195405/ErrorFusion.png>

Thanks in advance.



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: mapAgentURL is not defined in FUSION mapguide

RenoSun
This post was updated on .
This works for me...

When you use .NET to display fusion with iframe, you no longer need to send session id.

Also, please double check if using SSL/non-SSL affect this as well.

Finally, make sure you assign proper role to the mapguide user that you use to load fusion.

Cheers,
Reno

--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: mapAgentURL is not defined in FUSION mapguide

Rodolfo Moreno
Hi Reno, thanks for your response
- "When you use .NET to display fusion with iframe, you no longer need to
send session id"
I am not using iframe with fusion
- "please double check if using SSL/non-SSL affect this as well"
I am not using SSL
- "make sure you assign proper role to the mapguide user that you use to
load fusion"
I am loading the fusion template from maestro. which must be the role to
mapguide user? Where must I specify this role?
by last, Is there some piece of code that I should modify in fusion.js or in
other files?

Thanks in advance



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: mapAgentURL is not defined in FUSION mapguide

Liglio
This post was updated on .
Hi,

I got the same error. I changed the file FusionSF.js at line 1710 the
original was:

var fetchAppDef = function(appDefUrl, sessionId, onAppDefFetched) {
        var xhr = getXmlHttpRequest();
        xhr.open("GET", mapAgentUrl +
"?OPERATION=GETRESOURCECONTENT&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&RESOURCEID="
+ appDefUrl + "&FORMAT=text%2Fxml&SESSION="+ sessionId, true);

I changed to:

var fetchAppDef = function(mapAgentUrl, appDefUrl, sessionId,
onAppDefFetched) {
        var xhr = getXmlHttpRequest();
        xhr.open("GET", mapAgentUrl +
"?OPERATION=GETRESOURCECONTENT&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&RESOURCEID="
+ appDefUrl + "&FORMAT=text%2Fxml&SESSION="+ sessionId, true);

and passed the mapAgentUrl as argument at line 447

fetchAppDef(mapAgentUrl, appDefUrl, Fusion.sessionId, onAppDefFetched);

and I am using the FusionSF.js insted FusionSF-compressed.js




--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: mapAgentURL is not defined in FUSION mapguide

RenoSun
In reply to this post by Rodolfo Moreno
Hi Rodolfo,

Please try Liglio's solution first. The role should be "Administrator".

Thanks,
Reno



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: mapAgentURL is not defined in FUSION mapguide

Rodolfo Moreno
Thanks Liglio and RenoSun for your answer.
I reviewed the FusionSF.js and could see that the changes suggested already
were done.
Modify the index.html to work with FusionSF.js
next I launched the slate template from maestro and the error say:

Error Details:
Uncaught ReferenceError: mapAgentUrl is not defined

Stack Trace:
 - ? at http://localhost/mapguide/fusion/lib/fusionSF.js (line: 1747)

Source:
http://localhost/mapguide/fusion/templates/mapguide/slate/index.html?session=3ade0cc8-ae41-11e9-8000-fcf8aef6937a_en_MTI3LjAuMC4x0AFC0AFB0AFA&ApplicationDefinition=Session:3ade0cc8-ae41-11e9-8000-fcf8aef6937a_en_MTI3LjAuMC4x0AFC0AFB0AFA//Preview4.ApplicationDefinition&locale=en

Which could be the error?

Thanks in advance



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: mapAgentURL is not defined in FUSION mapguide

Liglio
Rodolfo,

Debug the FusionSF code to know where is the exact point, and copy here.

Regards



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: mapAgentURL is not defined in FUSION mapguide

Rodolfo Moreno
This post was updated on .
Hi Liglio,
This is the code (the error launch in 1747 line)

Line 1745: var getSiteVersion = function(sessionId, callback) {
Line 1746:        var xhr = getXmlHttpRequest();  
Line 1747:        xhr.open("GET", mapAgentUrl +
"?OPERATION=GETSITEVERSION&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&SESSION="+
sessionId, true);

Line 1748:        xhr.onload = function (e) {
Line 1749:            if (xhr.readyState === 4) {
                if (xhr.status === 200) {
                    var verXML = xhr.responseXML.documentElement;
                    var el = verXML.getElementsByTagName("Version")[0];
                    var version = el.textContent || el.text;
                    var bits = version.split('.');
                    callback([
                        parseInt(bits[0]),
                        parseInt(bits[1]),
                        parseInt(bits[2]),
                        parseInt(bits[3])
                    ]);
                } else {
                    console.error(xhr.statusText);
                }
            }
        };
        xhr.onerror = function (e) {
console.error(xhr.statusText);
        };
        xhr.send(null);
    };
____________________________________________________________

What I tried was to add the mapAgentUrl Parameter to the getSiteVersion function like this:

Line 1745: var getSiteVersion = function( mapAgentUrl, sessionId,
callback) {

but in that case fusion did not lunch any error but the map is in blank. The web browser console log show:

/mapguide/fusion/templates/mapguide/slate/92e7f2f6-b59b-11e9-8000-fcf8aef6937a_en_MTI3LjAuMC4x0AFC0AFB0AFA?OPERATION=GETSITEVERSION&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&SESSION=function(version)%20{%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Fusion.sessionId%20=%20passedSessionId;%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Fusion.siteVersion%20=%20version;%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20cb();%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20}:1
Failed to load resource: the server responded with a status of 404 (Not
Found)
fusionSF.js:1762 Not Found
xhr.onload @ fusionSF.js:1762

I hope that you can help me. Thanks in advance Liglio

--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: mapAgentURL is not defined in FUSION mapguide

Liglio
Hi Rodolfo,

Just put this line before line 1747, and mapAgentUrl variable will not be
null:
(don't add the mapAgentUrl Parameter to the getSiteVersion as you mentioned)

var mapAgentUrl = getAgentUrl();

This will work

Regards



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: mapAgentURL is not defined in FUSION mapguide

Rodolfo Moreno
This post was updated on .
Thanks Liglio,
I made what you suggested.
_____________________________________________________
    var getSiteVersion = function(sessionId, callback) {
        var xhr = getXmlHttpRequest();  
        var mapAgentUrl = getAgentUrl();
        xhr.open("GET", mapAgentUrl +
"?OPERATION=GETSITEVERSION&VERSION=1.0.0&LOCALE=en&CLIENTAGENT=MapGuide+Developer&SESSION="+
sessionId, true);
__________________________________________________________

And now fusion is launched another error:

Error Details:
Uncaught TypeError: callback is not a function

Stack Trace:
 - ? at http://localhost/mapguide/fusion/lib/fusionSF.js (line: 1698)

here the code in that line:
__________________________________________________________
var getAgentUrl = function(callback) {
        /*
        * if the application has been loaded from the same host as
        * fusion is installed in, then technically we don't need to
        * use the redirect script because we conform to the  
        * Same Origin Policy for XmlHttpRequest to work.
        */
        var fusionURL = Fusion._getScriptLocation();
        var testUrl = window.location.protocol + '//' +
window.location.host;
        var configUrl = 'config.json';
   
        if (((Fusion.fusionURL.indexOf("http://") < 0) ||
(Fusion.fusionURL.indexOf(testUrl, 0) == 0)) && !(Fusion.bForceRedirect)) {
            Fusion.sRedirectScript = '';
        }
        else {
            Fusion.sRedirectScript = 'redirect.php';
            configUrl += '&method=get';
        }
   
        var r = Fusion.getRedirectScript();
        if (r != '') {
            r = r + '?s=';
        }
   
        var fusionURL = r + Fusion.getFusionURL() + configUrl;
   
        var xhr = getXmlHttpRequest();
        xhr.open("GET", fusionURL, true);
        xhr.onload = function (e) {
            if (xhr.readyState === 4) {
                if (xhr.status === 200) {
                    //Can't use parseJSON as this JSON file will most likely
have comments
                    eval("Fusion.configuration=" + xhr.responseText);
                    var s = Fusion.configuration.mapguide.webTierUrl;
                    /* if it is set, use it ... otherwise assume fusion is
installed in
                    * the default location and compute the web tier url from
that
                    */
                    if (s) {
                        var nLength = s.length;
                        var slastChar = s.charAt((nLength - 1));
                        if (slastChar != '/') {
                            s = s + "/";
                        }
                    } else {
                        var idx = Fusion.fusionURL.lastIndexOf('fusion');
                        if (idx == -1) {
                            s = Fusion.fusionURL + "../";   //loaded
relatively from within fusion directory
                        }
                        else {
                            s = Fusion.fusionURL.substring(0, idx);
                        }
                    }
                    Fusion.configuration.mapguide.mapAgentUrl = s +
'mapagent/mapagent.fcgi';
                    callback(Fusion.configuration.mapguide.mapAgentUrl); (LINE 1698)
                } else {
                    console.error(xhr.statusText);
                }
            }
        };
        xhr.onerror = function (e) {
            console.error(xhr.statusText);
        };
        xhr.send(null);
    }
___________________________________________________________________

what it could be the problem?





--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: mapAgentURL is not defined in FUSION mapguide

Liglio
This post was updated on .
Rodrigo,

Try the fusionSF.js file I use (I also use Mapguide 3.1.2). See the link.

fusionSF.zip <http://osgeo-org.1560.x6.nabble.com/file/t215850/fusionSF.zip

Regards



--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
mapguide-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapguide-users
Reply | Threaded
Open this post in threaded view
|

Re: mapAgentURL is not defined in FUSION mapguide

Rodolfo Moreno
I am Rodolfo and Thanks Liglio.
I used the FusionSF.jc that you sent me. The fusion layout works fine by a
moment but after 1o seconds the fusion launched an error message:

Error Details:
Exception occurred in AJAX callback.
Message: Cannot read property 'message' of undefined
Location: undefined (undefined)
Inner Stack: TypeError: Cannot read property 'message' of undefined
    at Object.ajaxException
(http://localhost/mapguide/fusion/lib/fusionSF1.js:788:77)
    at http://localhost/mapguide/fusion/lib/fusionSF1.js:46607:25
    at initialize.respondToReadyState
(http://localhost/mapguide/fusion/lib/fusionSF1.js:97018:51)
    at initialize.onStateChange
(http://localhost/mapguide/fusion/lib/fusionSF1.js:96931:18)
    at XMLHttpRequest.
(http://localhost/mapguide/fusion/lib/fusionSF1.js:46607:25)
Response:  

When I compared my file with your fusionSF file I realized that your file is
of 2017 and the mine is of 2018.





--
Sent from: http://osgeo-org.1560.x6.nabble.com/MapGuide-Users-f4182607.html
_______________________________________________
mapguide-users mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/mapguide-users