Hi Achectl,
It is encouraging that it got that far before it failed this time. In the code
below, you've commented out the original call to get the selection from the
map, and instead retrieve it from the $selectionXml parameter. I don't see this
defined anywhere, which is presumably why it fails.
Try changing this:
// Retrieve the selection
$selection = new MgSelection($map, $selectionXml);
//$selection = new MgSelection();
//$selection->Open($resourceService, $mapName);
To this:
// Retrieve the selection
$selection = new MgSelection();
$selection->Open($resourceService, $mapName);
$selectionXml = $selection->ToXml();
Chris.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of achectl
Sent: Thursday, March 26, 2009 3:33 AM
To: [email protected]
Subject: RE: [mapguide-users] What is %24CurrentSelection???
Hi Chris,
I've tried to follow your script and try to modify a little of date.php as
below:
<?php
$mapName = "";
$sessionId = "";
$ID = "";
$Area = "";
try
{
// Initialize the web tier API
MgInitializeWebTier("C:\Program
Files\MapGuideOpenSource2.0\WebServerExtensions\www\webconfig.ini");
// Read the map name and session ID
GetRequestParameters();
// Create a site connection
$user = new MgUserInformation($sessionId);
$siteConnection = new MgSiteConnection();
$siteConnection->Open($user);
// Create a resource service instance
$resourceService = $siteConnection->CreateService(0);
// Retrieve the selection
$selection = new MgSelection($map, $selectionXml);
//$selection = new MgSelection();
//$selection->Open($resourceService, $mapName);
// Output the selection
echo $selection->ToXml();
}
catch(MgException $e)
{
// Output error details
echo "<Message>" . $e->GetMessage() . "</Message>";
echo "<Details>" . $e->GetDetails() . "</Details>";
}
function GetParameters($params)
{
global $mapName;
global $sessionId;
global $ID;
global $Area;
$mapName = $params['MAPNAME'];
$sessionId = $params['SESSION'];
$ID = $params['ID'];
$Area = $params['Area'];
echo $mapName;
echo $ID;
echo $Area;
}
function GetRequestParameters()
{
if($_SERVER['REQUEST_METHOD'] == "POST")
GetParameters($_POST);
else
GetParameters($_GET);
}
?>
After click the invokeURL command of the fusion layout, it prompts the error
"Default49cb4916a1dfe$CurrentSelection$CurrentSelectionAn unclassified
exception occurred.An unclassified exception occurred. Exception occurred in
method new_MgSelection at line 12308 in file .\MgApi_wrap.cpp" of the new
date.php window.
The $ID & $Area is the key of the invokeURL.js. It seems that the proper value
still can't to find! I think it should be something missing of the date.php.
Thanks
Achectl
If your date.php file is on a separate server, it seems like a good idea to
save the sample code in a local file, as you've done, and then make that script
issue a subsequent request to date.php.
It looks like the SESSION parameter is not getting sent to your script. It
could be a case issue - it might get sent as lowercase 'session' instead. Are
you able to use Fiddler or Firebug to determine which parameters are actually
getting sent to your script? I also remember seeing a defect where the
parameters got sent twice, which caused problems.
If your InvokeUrl.js (in the fusion/widgets folder) contains a section like
this:
execute : function() {
var url = this.sBaseUrl;
//add in other parameters to the url here
var map = this.getMap();
var params = [];
params.push('LOCALE='+Fusion.locale);
params.push('SESSION='+map.getSessionID());
params.push('MAPNAME='+map.getMapName());
params = params.concat(this.additionalParameters);
try changing it to:
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);
An alternative approach would be to fix the InvokeUrl.js file so that it
handles the $CurrentSelection variable correctly, but that would require a bit
of figuring out.
Chris.
--
View this message in context:
http://n2.nabble.com/What-is--24CurrentSelection----tp2490302p2537430.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users