|
||||
[Chameleon] another widget that workshuub fleuren huub fleuren <huub@geodan.nl>Tue, 25 Nov 2003 19:59:23 +0100
|
Hallo list, If you remember, i contributed two widgets that worked, partly, earlier today. I asked everybody why the map was updated but the legend list was not. Well i have here another widget, that will remove the selected layer from the map. Basically is does the same thing. Except that the LayerOrder widgets use $oMap->moveLayerDown($i); and $oMap->moveLayerUp($i); and this one uses $oLayer->set("status",MS_DELETE); and guess what... the legend list is updated correctly. (In an older version of chameleon it happened only once. I swear. In a later version it seemes to be stable) the tag <CWC2 TYPE="RemoveLayer" Image="images/icon_remove.png" ImageTip="Remove Layer" TextButtonWidth="24" TextButtonHeight="24" Label=""/> the listing (because it works better). <?php /** * RemoveLayer Widget class * * @project CWC2 * @revision $Id: RemoveLayer.widget.php, v 1 2003/11/25 16:49:46 * @purpose RemoveLayer Widget class * @author DM Solutions Group (assefa@dmsolutions.ca, huub@geodan.nl) * @copyright * <b>Copyright (c) 2002, DM Solutions Group Inc.</b> * 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_once("NavTool.php"); include_once("TextButton.php"); /** * RemoveLayer * * @desc Removes a SELECTED_LAYER (SelectLayer.Widget) from the map */ class RemoveLayer extends CWCWidget { /** * RemoveLayer * * Constructor for the RemoveLayer */ function RemoveLayer() { // invoke constructor of parent parent::CWCWidget(); $this->moParent =& $oParent; // set the description for this widget $this->szWidgetDescription = <<<EOT See alse the UpdateMap Widget The RemoveLayer widget will cause the selected layer to disappear from the map EOT; $this->moTextButton = new CWCTextButton($this); } function InitDefaults() { $this->moTextButton->InitDefaults(); } /** * GetHTMLHiddenVariables * * Return HTML hidden variables. */ function GetHTMLHiddenVariables() { $szVariable = "REMOVE_LAYER"; $szValue = " <INPUT TYPE=HIDDEN NAME=$szVariable VALUE=\"0\">"; $aReturn[$szVariable] = $szValue; return $aReturn; } /** * GetJavascriptFunctions * * Return the Javacriptfunctions needed by the widget. */ function GetJavascriptFunctions() { $aReturn = array(); $szJsFunctionName = "clickRemoveLayer"; $szFunction = <<<EOT /** * {$szJsFunctionName} * called when the user clicks the RemoveLayer icon */ function {$szJsFunctionName}() { with({$this->mszHTMLForm}) { REMOVE_LAYER.value = "1"; submit(); } return; } EOT; $aReturn[$szJsFunctionName] = $szFunction; return $aReturn; } /** * DrawPublish * * Return the HTML code using the name in the map file and the * parameters of the CWC tag. */ function DrawPublish() { if (!$this->mbVisible) return "<!-- RemoveLayer widget hidden -->"; $this->moTextButton->SetOnClickEvent( "clickRemoveLayer()" ); return $this->moTextButton->DrawPublish(); } /** * ParseURL * * Look for selected layers and move them UP */ function ParseURL() { if (isset($this->moURLArray['REMOVE_LAYER'])) { if ($this->moURLArray['REMOVE_LAYER'] == "1") { if (isset($this->moURLArray['SELECTED_LAYERS'])) { if (strlen($this->moURLArray['SELECTED_LAYERS']) > 0) { $szSelectedLayers = $this->moURLArray['SELECTED_LAYERS'] ; $oMap = $this -> moMapObject -> oMap; for($i=0; $i < $oMap->numlayers; $i++) { $oLayer = $oMap->getLayer($i); if ( $oLayer->name == $szSelectedLayers ) { $oLayer->set("status",MS_DELETE); } } } } } } } } ?> -- Huub Fleuren Geodan IT Vestiging Zuid Buitenhaven 27A 5711 TP 's-Hertogenbosch huub@geodan.nl Tel. +31 (0)73 - 6925 160 Fax. +31 (0)73 - 6925 150 Website http://www.vz.geodan.nl/ -- Geodan IT b.v. President Kennedylaan 1 1079 MB Amsterdam (NL) Tel. +31 (0)20 - 5711 311 Fax +31 (0)20 - 5711 333 Website http://www.geodan.nl/
This archive was generated by Pipermail. |
MapTools.org -- Hosted by DM Solutions Group |