![]() |
||||
|
|
||||
[maplab-users] Code to add MapSize to MaplabBryan Tolka btolka@geointeractive.bizThu, 05 Sep 2002 18:45:47 -0400
|
||||
Add mapsize to Maplab(GMAP Factory)
Note: Some of code used is from the GMAP demo.
1.) Add this javascript to index.html under <SCRIPT> tags.
function mapsize()
{
if (document.forms[0].MapSize.selectedIndex != 0 &&
document.forms[0].MapSize.selectedIndex !=1)
document.forms[0].submit();
}
2.)Change your main.php file.
Change
$oMapSession->oMap->set( "width", MAP_WIDTH );
$oMapSession->oMap->set( "height", MAP_HEIGHT );
to:
if ($HTTP_GET_VARS["MapSize"])
{
if (ereg("([0-9]+),([0-9]+)", $HTTP_GET_VARS["MapSize"], $MapSizeExtents))
{
$WidthPixel = intval($MapSizeExtents[1]);
$HeightPixel = intval($MapSizeExtents[2]);
$oMapSession->oMap->set("width",$WidthPixel);
$oMapSession->oMap->set("height",$HeightPixel);
$oMapSession->oMap->set( "width", MAP_WIDTH );
$oMapSession->oMap->set( "height", MAP_HEIGHT );
$oMapNavigator->zoomOut( 999999 );
}
}
else
{
$oMapSession->oMap->set( "width", $MAP_WIDTH );
$oMapSession->oMap->set( "height", $MAP_HEIGHT );
// debugging print("$MAP_WIDTH $MAP_HEIGHT");
}
3.) Change you globalprefs.php file
Change this:
define( "MAP_WIDTH", "400" );
define( "MAP_HEIGHT", "300" );
to
$MAP_WIDTH=400;
$MAP_HEIGHT=300;
4.) Add this code somehwhere in your contents.php file.
I will let the guys at DM add this to the gmapfactory of placement.
<td bgcolor="#333333"><FONT FACE="Arial, Helvetica, sans-serif" SIZE="2">
<SELECT NAME="MapSize" onChange="mapsize()">
<OPTION>Map Size</OPTION>
<OPTION>---------------</OPTION>
<OPTION VALUE="400,300"
<?php if (($omap->width == 400) && ($omap->height == 300))
echo "SELECTED";?>> 400 x 300</OPTION>
<OPTION VALUE="600,450"
<?php if (($omap->width == 600) && ($omap->height == 450))
echo "SELECTED";?>> 600 x 450</OPTION>
<OPTION VALUE="800,600"
<?php if (($omap->width == 800) && ($omap->height == 600))
echo "SELECTED";?>> 800 x 600</OPTION>
<OPTION VALUE="1024,768"
<?php if (($omap->width == 1024) && ($omap->height == 768))
echo "SELECTED";?>> 1024 x 768</OPTION>
</SELECT>
</FONT>
</td>
If I have missed anything email me a btolka@geointeractive.biz
Bryan Tolka
This archive was generated by Pipermail. |
MapTools.org -- Hosted by DM Solutions Group |