[mapguide-users] What is %24CurrentSelection???
achectl
achectl at gmail.com
Thu Mar 26 05:32:45 EDT 2009
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.
More information about the mapguide-users
mailing list