Copyright (c) 2004 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. |_____________________________________________________________________________ **/ // inherit from the NavTool include_once(dirname(__FILE__)."/../NavTool.php"); /** _____________________________________________________________________________ | | MapNotes Widget Class |_____________________________________________________________________________ **/ class MapNotes extends NavTool { // define member vars var $mszMode; var $mszLayer; var $mszFontColor; var $mszFontOutlineColor; var $mszSymbol; var $mnSymbolSize; var $mszSymbolColor; var $mszSymbolOutlineColor; var $mszFont; var $mnFontSize; var $mbMarquee; var $mnOffsetX; var $mnOffsetY; var $mszLabelPosition; // property page location var $mszPropertyPage; var $mszProcessingPage; // property page default query string var $mszPropertyPageDefaults; // property page layer name var $mszPropertyLayerName = 'divMapNotes'; // property page iframe name var $mszPropertyIframeName = 'ifMapNotes'; /** _________________________________________________________________________ | | Constructor: MapNotes Widget Class |_________________________________________________________________________ **/ function MapNotes() { // set the language file $this->mszLanguageResource = dirname(__FILE__).'/MapNotes.dbf'; // invoke constructor of parent parent::NavTool(); // set the popup property page location $this->mszPropertyPage = $_SESSION['gszCoreWebPath']. 'widgets/MapNotes/properties.phtml'; $this->mszProcessingPage = $_SESSION['gszCoreWebPath']. 'widgets/MapNotes/processing.phtml'; // define attributes // Layer - If set and not empty, all notes will be managed in // this layer. If the layer does not exist, it will be created // when the first note is added. If not set, MapNotes will generate // a unique layer name. $this->maAttributes['LAYER'] = new StringAttribute( 'LAYER', false ); // FontColor - default 0 0 0. The color of the label. $this->maAttributes['FONTCOLOR'] = new RGBColorAttribute( 'FONTCOLOR', false ); // FontOutlineColor - default 255 255 255. The outline color for // the label. $this->maAttributes['FONTOUTLINECOLOR'] = new RGBColorAttribute( 'FONTOUTLINECOLOR', false ); // Symbol - default 'circle'. The symbol to use for this note. // The symbol name can be either the name or symbol index from // the symbolset referred to in the map file. List of available // symbols needs to be generated from the symbol set or through //mapscript if possible, or at least validated. $this->maAttributes['SYMBOL'] = new StringAttribute( 'SYMBOL', false ); // SymbolSize - minimum 1, no maximum, default is 8. // Size to draw the symbol. $this->maAttributes["SYMBOLSIZE"] = new IntegerAttribute( 'SYMBOLSIZE', false, 1 ); // SymbolColor - default 0 0 0. Color to draw the symbol. $this->maAttributes['SYMBOLCOLOR'] = new RGBColorAttribute( 'SYMBOLCOLOR', false ); // SymbolOutlineColor - default 255 255 255. Outline color. $this->maAttributes['SYMBOLOUTLINECOLOR'] = new RGBColorAttribute( 'SYMBOLOUTLINECOLOR', false ); // Font - default 'sans'. This refers to the name of a font in the // fontfile in the map. A list of valid fonts should be available // through this widget, and the value must be validated before using // it. $this->maAttributes['FONT'] = new StringAttribute( 'FONT', false ); // FontSize - minimum 6, no maximum, default is 10. $this->maAttributes["FONTSIZE"] = new IntegerAttribute( 'FONTSIZE', false, 6 ); // Marquee - default is true. This controls the display of a solid // box behind the label. $this->maAttributes["MARQUEE"] = new BooleanAttribute( 'MARQUEE', false ); // OffsetX - minimum 0, no maximum, default is 6. Distance in pixels // to horizontally offset the label from the point. $this->maAttributes["OFFSETX"] = new IntegerAttribute( 'OFFSETX', false, 0 ); // OffsetY - minimum 0, no maximum, default is 0. Distance in pixels // to vertically offset the label from the point. $this->maAttributes["OFFSETY"] = new IntegerAttribute( 'OFFSETY', false, 0 ); // LabelPosition - restricted to (UL, LR, UR, LL, CR, CL, UC, LC, // CC, AUTO) where first character is U = Upper, L = Lower, // C = Center and second character is L=Left, R=Right, C=Center. // These translate into the equivalent PHP/MapScript constants by // prepending MS_ to the value. The default is CR (Center Right). $this->maAttributes['LABELPOSITION'] = new StringAttribute( 'LABELPOSITION', false, array( 'UL', 'LR', 'UR', 'LL', 'CR', 'CL', 'UC', 'LC', 'CC', 'AUTO' ) ); // set the description for this widget $this->szWidgetDescription = <<mnMaturityLevel = MATURITY_BETA; // end MapNotes constructor } /** _________________________________________________________________________ | | InitDefaults() | | Postcondition: Initialize defaults. | | @return n/a | @desc Initialize defaults. |_________________________________________________________________________ **/ function InitDefaults() { // init defaults for parent parent::InitDefaults(); // set defaults for parameters that are not supplied // mode $this->mszMode = 'ADD'; // Layer $this->mszLayer = isset( $this->maParams['LAYER'] )? $this->maParams['LAYER'] : 'MapNotesAnnotation'; // FontColor $this->mszFontColor = isset( $this->maParams['FONTCOLOR'] )? $this->maParams['FONTCOLOR'] : '0 0 0'; // FontOutlineColor $this->mszFontOutlineColor = isset( $this->maParams['FONTOUTLINECOLOR'] )? $this->maParams['FONTOUTLINECOLOR'] : '255 255 255'; // Symbol $this->mszSymbol = isset( $this->maParams['SYMBOL'] )? $this->maParams['SYMBOL'] : 'circle'; // SymbolSize $this->mnSymbolSize = isset( $this->maParams['SYMBOLSIZE'] )? $this->maParams['SYMBOLSIZE'] : 8; // SymbolColor $this->mszSymbolColor = isset( $this->maParams['SYMBOLCOLOR'] )? $this->maParams['SYMBOLCOLOR'] : '0 0 0'; // SymbolOutlineColor $this->mszSymbolOutlineColor = isset( $this->maParams['SYMBOLOUTLINECOLOR'] )? $this->maParams['SYMBOLOUTLINECOLOR'] : '255 255 255'; // Font $this->mszFont = isset( $this->maParams['FONT'] )? $this->maParams['FONT'] : 'sans'; // FontSize $this->mnFontSize = isset( $this->maParams['FONTSIZE'] )? $this->maParams['FONTSIZE'] : 10; // Marquee $this->mbMarquee = isset( $this->maParams['MARQUEE'] )? $this->maParams['MARQUEE'] : true; // OffsetX $this->mnOffsetX = isset( $this->maParams['OFFSETX'] )? $this->maParams['OFFSETX'] : 6; // OffsetY $this->mnOffsetY = isset( $this->maParams['OFFSETY'] )? $this->maParams['OFFSETY'] : 0; // LabelPosition $this->mszLabelPosition = isset( $this->maParams['LABELPOSITION'] )? $this->maParams['LABELPOSITION'] : 'CR'; // combine all property defaults $this->mszPropertyPageDefaults = 'layer='.$this->mszLayer.'&'. 'font='.$this->mszFont.'&'. 'fontsize='.$this->mnFontSize.'&'. 'fontcolor='.$this->mszFontColor.'&'. 'fontoutlinecolor='.$this->mszFontOutlineColor.'&'. 'symbol='.$this->mszSymbol.'&'. 'symbolsize='.$this->mnSymbolSize.'&'. 'symbolcolor='.$this->mszSymbolColor.'&'. 'symboloutlinecolor='.$this->mszSymbolOutlineColor.'&'. 'marquee='.$this->mbMarquee.'&'. 'offsetx='.$this->mnOffsetX.'&'. 'offsety='.$this->mnOffsetY.'&'. 'labelposition='.$this->mszLabelPosition; // set default mode $this->SetNavCommand( $this->mszMode.'_MAPNOTE'); $this->mbNavSubmit = false; // end InitDefaults function. } /** _________________________________________________________________________ | | ParseURL() | | Postcondition: This function parses information passed on the URL and | acts on it. | | @return boolean - True if successful, false if not. | @desc Parses info passed on URL. |_________________________________________________________________________ **/ function ParseURL() { // execute parent function parent::ParseURL(); // return success return true; } /** _________________________________________________________________________ | | DrawPublish() | | Postcondition: This function builds the html output for the physical | appearance of the widget. | | @return string - Output | @desc Generates HTML output for the widget. |_________________________________________________________________________ **/ function DrawPublish() { // init vars $szReturn = ''; // execute parent $szReturn .= parent::DrawPublish(); // return return $szReturn; // end DrawPublish() function } /** _________________________________________________________________________ | | GetJavascriptIncludeFunctions() | | Postcondition: This function defines the javascript include statements. | | @return Array - Array of include statements. | @desc Defines javascript include statements. |_________________________________________________________________________ **/ function GetJavascriptIncludeFunctions() { // init vars $aReturn = parent::GetJavascriptIncludeFunctions(); // include the base javascript functions for dhtml $szVar = "cwc_dhtml.js"; $aReturn[$szVar] = ''; // return return $aReturn; // end GetJavascriptIncludeFunctions() function } /** _________________________________________________________________________ | | GetJavascriptFunctions() | | Postcondition: This function defines javascript functions and adds | them to the array. | | @return Array - Array of javascript functions. | @desc Defines javascript functions. |_________________________________________________________________________ **/ function GetJavascriptFunctions() { // init vars $aReturn = parent::GetJavascriptFunctions(); $szSID = SID; //initialize dynamic layers $szContent = '