Copyright (c) 2002, DM Solutions Group Inc. * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ /*****************************************************************************/ // include the supporting php code define("LOAD_MAPSESSION", "1"); //set the language resource file $szLanguageResource = str_replace("\\","/",dirname(__FILE__))."/LegendTemplate.dbf"; include_once("../session.inc.php"); include_once(COMMON."/phpwms/dbf.php"); include_once("../CWC2ButtonCache.php"); //for convenience $oMap =& $oMapSession->oMap; /* * hack for wms layers to make an icon available through metadata if possible\ */ for ($i=0; $i<$oMap->numlayers; $i++) { $oLayer = $oMap->getLayer( $i ); if ($oLayer->connectiontype == MS_WMS) { if ($oLayer->getMetadata( "cwc2_legendurl" ) == "") { $szStyle = $oLayer->getMetadata( "wms_style" ); $szLegendURL = $oLayer->getMetadata( "wms_style_".$szStyle."_legendurl_href" ); $oLayer->setMetadata( "cwc2_legendurl", $szLegendURL ); } } } /* -------------------------------------------------------------------- */ /* check if the set_layer is set and then update the status of */ /* the layers. */ /* -------------------------------------------------------------------- */ if (isset($http_form_vars["set_layer"]) && $http_form_vars["set_layer"] != "" && ((isset($http_form_vars['controlvisibility']) && $http_form_vars['controlvisibility'] != 0) || !isset($http_form_vars['controlvisibility']))) { if (isset( $http_form_vars['legendlayername'] )) { for ($i=0; $i<$oMap->numlayers; $i++) { $oLayer = $oMap->getlayer($i); if (in_array($oLayer->name, $http_form_vars['legendlayername'] ) ) { $oLayer->set("status", MS_ON); } else { $oLayer->set("status", MS_OFF); } } } else { $_SESSION['gErrorManager']->setError(ERR_WARNING, trim($oMLT->get("2", "The legend template has no inputs named legendlayername[]."))); } } $_SESSION['gszCurrentState'] = $oMapSession->saveState(); /* -------------------------------------------------------------------- */ /* Get the ouput using the template. If template is not */ /* available fall back on mapserver legend. */ /* -------------------------------------------------------------------- */ if (isset($_GET['widgetId']) && isset($_SESSION['LEGENDTEMPLATE'.$_GET['widgetId']])) { $oMap->legend->set("template",$_SESSION['LEGENDTEMPLATE'.$_GET['widgetId']]); } $szLegendTemplate = $oMap->processLegendTemplate( array() ); ?> <?php echo $oMLT->get("0", "Legend");?>
get("0", "Legend");?>

get("1", "The legend displays the layers in your map.");?>

get( "Ok", "Ok" ), "Apply and Close", array( 'width' => 75 ) ); ?>    get( "Apply", "Apply" ), "Apply", array( 'width' => 75 ) ); ?>    get( "Cancel", "Cancel" ), "Close Dialog", array( 'width' => 75 ) ); ?>