[mapguide-users] What is %24CurrentSelection???
achectl
achectl at gmail.com
Mon Mar 30 01:51:58 EDT 2009
Hi Chris
Thanks for your help.
Now my date.php script is as below:
<?php
$mapName = "";
$sessionId = "";
$ID = "";
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();
$selection->Open($resourceService, $mapName);
$selectionXml = $selection->ToXml();
// Output the selection
//echo $selection->ToXml();
echo $selectionXml;
}
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;
$mapName = $params['MAPNAME'];
$sessionId = $params['SESSION'];
$ID = $params['ID'];
}
function GetRequestParameters()
{
if($_SERVER['REQUEST_METHOD'] == "POST")
GetParameters($_POST);
else
GetParameters($_GET);
}
?>
The output of url & content was generated by date.php is as below:
http://127.0.0.1:8008/mapguide/fusion/templates/mapguide/flr3/mapguide.php?LOCALE=en&SESSION=c9a91b36-ffff-ffff-8000-001c42ffa53c_en_7F0000010AFC0AFB0AFA&MAPNAME=Default49d05a9c7a129&ID=%24CurrentSelection <---- same the previous setting
AQAAAAAAAAA= <---- it would be changed when the differ feature data was selected.
This is the mapguide studio setting.
Does it have anything wrong?
Thanks
Achectl
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: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of achectl
Sent: Thursday, March 26, 2009 3:33 AM
To: mapguide-users at lists.osgeo.org
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
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
--
View this message in context: http://n2.nabble.com/What-is--24CurrentSelection----tp2490302p2555618.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list