Index: Chameleon/trunk/Chameleon/BoundingBoxPopup/BoundingBoxPopup.en-ca.doc.xml =================================================================== --- (revision ) +++ Chameleon/trunk/Chameleon/BoundingBoxPopup/BoundingBoxPopup.en-ca.doc.xml (revision 13) @@ -1,0 +1,536 @@ + + + + + English (en-ca) + + + 2004-12-18 + + + $id: $ + + + + Doc_Builder + DM Solutions Group Inc. + chameleon@lists.maptools.org + + + + + + Christopher R. Thorne + DM Solutions Group Inc. + chameleon@lists.maptools.org + + + + + + + boundingboxpopup + + + TBD + + + TBD + + + 1.99 + + + 1999-12-31 + + + BETA + + + + Paul Spencer + DM Solutions Group Inc. + chameleon@lists.maptools.org + + + + + + + + The BoundingBoxPopupWidget displays a popup dialog box that allows the user +to enter bounding box coordinates to zoom to (either rectangle or point) + + + + + + + + + + + + + + + + + + + + This button provides the capability to display a specific location. To use it, click the Bounding Box icon to popup the Bounding Box dialog. This dialog box provides two different mechanisms for displaying a new location. The first way is to specify the minimum and maximum values in both the X and Y directions. The second is to specify a point to center to. In both cases, the coordinates must be entered in the units of the projection that the map is displayed in. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hawaii Demo + http://www.mapsherpa.com/hawaii2/ + The Hawaii Demo uses the latest 1.99 Chameleon version. + + + + + + + + + + + + + + + + + + base + button + popup + + + + + + + XML + Child Element to Chameleon widget tag (subtag) + + + Widget & Shared Resource + + + + + + float + + + + Widget & Shared Resource + + + + + + + + + + + + + + + NAV_CMD + + unknown + + + + + + + + + The last command that was used to interact with the map + + + NAV_INPUT_TYPE + + unknown + + + + + + + + + + the type of the last navigation command, either POINT or RECTANGLE + + + NAV_INPUT_COORDINATES + + unknown + + + + + + + + + + the coordinates that the last command generated. May be a single point, or two points representing a rectangle + + + NAV_INPUT_SRS + + unknown + + + + + + + + + + + + + + + + + clickBoundingBoxPopup + + Private + + callback function for the user clicking the Zoom to Bounding Box button + + + + unknown + + + + + + + + + + + + + + + + + + + + + + applyBoundingBox + + Private + + callback function to apply a Zoom to Bounding Box or Point Coordinates. + + + nMinX + + string + + + + + + + + + + + + nMinY + + string + + + + + + + + + + + + nMaxX + + string + + + + + + + + + + + + nMaxY + + string + + + + + + + + + + + + + + + unknown + + + + + + + + + + + + + + + + + + + + + + getMapExtents + + Private + + return the current extents of the map. + + + + unknown + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + string + + + Private + + + + + + + + + + + + + + + Private + + + + + + + string + + + false + + + + + + + + + + + + + + + unknown + + + + + + + + + + + + + + + + + + + + + + + + + + + JSAPI function calls for this widget are outlined here. + + + + + + + + + + + + + + + string + + + false + + + + + + + + + + + + + + + + + + PHP Mapscript + + + none + + + + + Error message string.... + + + + + The description of what the message means...... + + + + + Any possible solution that will help application developers troubleshoot and fix the problem. + + + + + Index: Chameleon/trunk/Chameleon/BoundingBoxPopup/BoundingBoxPopup.fr-ca.doc.xml =================================================================== --- (revision ) +++ Chameleon/trunk/Chameleon/BoundingBoxPopup/BoundingBoxPopup.fr-ca.doc.xml (revision 13) @@ -1,0 +1,533 @@ + + + + + French (fr-ca) + + + 2004-12-18 + + + $id: $ + + + + Doc_Builder + DM Solutions Group Inc. + chameleon@lists.maptools.org + + + + + + Christopher R. Thorne + DM Solutions Group Inc. + chameleon@lists.maptools.org + + + + + + + boundingboxpopup + + + TBD + + + TBD + + + 1.99 + + + 1999-12-31 + + + BETA + + + + Paul Spencer + DM Solutions Group Inc. + chameleon@lists.maptools.org + + + + + + + + The BoundingBoxPopupWidget displays a popup dialog box that allows the user +to enter bounding box coordinates to zoom to (either rectangle or point) + + + + + + + + + + + + + + + + + + + + Ce bouton ouvre une boîte de dialogue qui permet à l'usager de définir et d'afficher une région spécifique. Pour l'utiliser, cliquez sur l'icône « Boîte de sélection » pour ouvrir la boîte de dialogue. Cette boîte offre deux façons d'afficher une nouvelle région. La première façon est de spécifier les valeurs maximales et minimales pour les axes X et Y. La seconde façon est donner le point de centre de la carte. Dans les deux cas, les unités de mesure doivent être les mêmes que la carte. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hawaii Demo + http://www.mapsherpa.com/hawaii2/ + The Hawaii Demo uses the latest 1.99 Chameleon version. + + + + + + + + + + + + + + + + + + base + button + popup + + + + + + + XML + Child Element to Chameleon widget tag (subtag) + + + Widget & Shared Resource + + + + + + float + + + + Widget & Shared Resource + + + + + + + + + + + + + + + NAV_CMD + + unknown + + + + + + + + + + + + + NAV_INPUT_TYPE + + unknown + + + + + + + + + + + + + NAV_INPUT_COORDINATES + + unknown + + + + + + + + + + + + + NAV_INPUT_SRS + + unknown + + + + + + + + + + + + + + + + clickBoundingBoxPopup + + Private + + + + + + unknown + + + + + + + + + + + + + Describe the JS functions (if any) that define or rather trigger events through the Chameleon JSAPI. + + + + + + + + applyBoundingBox + + Private + + + + + nMinX + + string + + + + + + + + + + + + nMinY + + string + + + + + + + + + + + + nMaxX + + string + + + + + + + + + + + + nMaxY + + string + + + + + + + + + + + + + + + unknown + + + + + + + + + + + + + Describe the JS functions (if any) that define or rather trigger events through the Chameleon JSAPI. + + + + + + + + getMapExtents + + Private + + + + + + unknown + + + + + + + + + + + + + Describe the JS functions (if any) that define or rather trigger events through the Chameleon JSAPI. + + + + + + + + + + + + + + + + string + + + Private + + + + + + + + + + + + + + + Private + + + + + + + string + + + false + + + + + + + + + + + + + + + unknown + + + + + + + + + + + + + + + + + + + + + + + + + + + JSAPI function calls for this widget are outlined here. + + + + + + + + + + + + + + + string + + + false + + + + + + + + + + + + + + + + + + PHP Mapscript + + + none + + + + + Error message string.... + + + + + The description of what the message means...... + + + + + Any possible solution that will help application developers troubleshoot and fix the problem. + + + + + Index: Chameleon/trunk/Chameleon/BoundingBoxPopup/BoundingBoxPopup.phtml =================================================================== --- (revision ) +++ Chameleon/trunk/Chameleon/BoundingBoxPopup/BoundingBoxPopup.phtml (revision 13) @@ -1,0 +1,143 @@ + + + +<?php echo trim($oMLT->get("0", "Zoom to Coordinates")) ?> + + + + + + + + +
+ + + + + + + + + + + +
+ + + + +
 get("1", "Bounding Box Coordinates")) ?>
+ + + + +

get("2", "Please enter the coordinates of the bounding box (i.e. extents) of the area you wish to view.")) ?>

+ + + + + + + + + + + + + + + + + + + +
 get("Max", "Max")) ?> Y
+ +
  
get("Min", "Min")) ?> X
+ +
 get("Max", "Max")) ?> X
+ +
 
 get("Min", "Min")) ?> Y
+ +
  + get("Zoom", "Zoom")), trim($oCommonMLT->get("ZoomRectTip", "Zoom to Bounding Coordinates")), array( 'width' => 75 )); ?> +
+
+ + + + +
 get("4", "Point Coordinates")) ?>
+ + + + +

get("5", "Please enter the coordinates of the location (i.e. point) you wish to view.")) ?>

+ + + + + + +
X: + + Y: + + + get("Zoom", "Zoom")), trim($oCommonMLT->get("ZoomPointTip", "Zoom to Point Coordinates")), array( 'width' => 75 )); ?> +
+
+ get("Cancel", "Cancel")), trim($oCommonMLT->get("CancelTip", "Cancel Dialog")), array( 'width' => 75 )); ?> +
+ +
+ + + Index: Chameleon/trunk/Chameleon/BoundingBoxPopup/BoundingBoxPopup.widget.php =================================================================== --- (revision ) +++ Chameleon/trunk/Chameleon/BoundingBoxPopup/BoundingBoxPopup.widget.php (revision 13) @@ -1,0 +1,377 @@ +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_once(dirname(__FILE__)."/../Widget.php"); +include_once(dirname(__FILE__)."/../Button.php"); +include_once(dirname(__FILE__)."/../Popup.php"); +include_once ( COMMON."wrapper/map_navigator.php" ); + +/** + * BoundingBoxPopup + * + * @desc Display a widget that pops up a projection selection widget. + */ +class BoundingBoxPopup extends CWCWidget +{ + var $moButton; + var $moPopup; + var $moMapNavigator; + + /** + * BoundingBoxPopup + * + * Constctor method for the BoundingBoxPopup + */ + function BoundingBoxPopup() + { + $this->mszLanguageResource = str_replace("\\","/",dirname(__FILE__))."/BoundingBoxPopup.dbf"; + parent::CWCWidget(); + + $this->moButton = new CWCButton( $this ); + + $this->moPopup = new CWCPopup( $this ); + $this->moPopup->mszLink = $_SESSION['gszCoreWebPath']."/widgets/BoundingBoxPopup/BoundingBoxPopup.phtml"; + + // set the description for this widget + $this->szWidgetDescription = <<mnMaturityLevel = MATURITY_BETA; + + } + + function InitDefaults() + { + parent::InitDefaults(); + + //this widget should never belong to a toolset + $this->maParams["TOOLSET"] = ""; + $this->moButton->InitDefaults(); + $this->moButton->SetOnClick('clickBoundingBoxPopup'); + } + + /** + * SetMap + * + * Set the map session and create a navigation tool. + */ + function SetMap($oMapSession) + { + $this->moMapObject = $oMapSession; + + $this->moMapNavigator = new MapNavigator( $oMapSession ); + } + + + function GetJavascriptInitFunctions() + { + return $this->moButton->GetJavascriptInitFunctions(); + } + + function GetJavascriptVariables() + { + return $this->moButton->GetJavascriptVariables(); + } + + function GetJavascriptOnLoadFunctions() + { + return $this->moButton->GetJavascriptOnLoadFunctions(); + } + + function GetJavascriptIncludeFunctions() + { + return $this->moButton->GetJavascriptIncludeFunctions(); + } + + /** + * GetHTMLHiddenVariables + * + * return the NAV_CMD varaiable. + */ + function GetHTMLHiddenVariables() + { + $aReturn = $this->moButton->GetHTMLHiddenVariables(); + + $szCmd = ''; + if ($this->isVarSet('NAV_CMD')) + $szCmd = $this->getVar('NAV_CMD'); + $szVariable = "NAV_CMD"; + $szValue = " \n"; + $aReturn[$szVariable] = $szValue; + + $szVariable = "NAV_INPUT_TYPE"; + $szValue = " "; + $aReturn[$szVariable] = $szValue; + + $szVariable = "NAV_INPUT_COORDINATES"; + $szValue = " \n"; + $aReturn[$szVariable] = $szValue; + + $szVariable = "NAV_INPUT_SRS"; + $szValue = " \n"; + $aReturn[$szVariable] = $szValue; + + return $aReturn; + } + + /** + * ParseURL + * + * Look for the COMPASS_POINT command and if found, recenter + * the image in the appropriate direction. + * according to the other NAV paramaters. + */ + function ParseURL() + { + $szCmd = ""; + if ($this->isVarSet("NAV_CMD")) + $szCmd = $this->getVar("NAV_CMD"); + + if ($szCmd == "ZOOM_BBOX") + { + //process navigation here + $szInputCoords = ""; + $szInputCoords = $this->getVar("NAV_INPUT_COORDINATES"); + $szInputType = $this->getVar("NAV_INPUT_TYPE"); + + if(strlen($szInputCoords) <= 0) + { + $_SESSION['gErrorManager']->setError(ERR_WARNING, + trim($this->moMLT->get("7", "ERROR: No input coordinates specified in BoundingBoxPopup.php."))); + return; + } + if (strlen($szInputType) <= 0) + { + $_SESSION['gErrorManager']->setError(ERR_WARNING, + trim($this->moMLT->get("8", "ERROR: No input type specified in BoundingBoxPopup.php."))); + return; + } + + $aPixPos = explode(",", $szInputCoords); + + $szSRS = ''; + if ($this->isVarSet('NAV_INPUT_SRS') && $this->getVar('NAV_INPUT_SRS') != "") + { + $szSRS = trim($this->getVar('NAV_INPUT_SRS')); + if (strcasecmp( substr( $szSRS, 0, 4 ), 'epsg') == 0) + { + $szSRS = "init=".strtolower($szSRS); + } + $oProjIn = ms_newProjectionObj( $szSRS ); + $oProjOut = ms_newProjectionObj( $this->moMapObject->oMap->getProjection() ); + if ($szInputType == "POINT") + { + $oPoint = ms_newPointObj(); + $oPoint->setXY( $aPixPos[0], $aPixPos[1] ); + $oPoint->project( $oProjIn, $oProjOut ); + $aPixPos[0] = $oPoint->x; + $aPixPos[1] = $oPoint->y; + } + else + { + $oRect = ms_newRectObj(); + $oRect->setExtent( $aPixPos[0], $aPixPos[1], $aPixPos[2], $aPixPos[3] ); + $oRect->project( $oProjIn, $oProjOut ); + $aPixPos[0] = $oRect->minx; + $aPixPos[1] = $oRect->miny; + $aPixPos[2] = $oRect->maxx; + $aPixPos[3] = $oRect->maxy; + } + } + + if ($szInputType == "POINT") + { + //echo "zooming to ".$aPixPos[0].",". $aPixPos[1]."
"; + $oRect = $this->moMapObject->oMap->extent; + $nX = $oRect->minx + ($oRect->maxx - $oRect->minx)/2; + $nY = $oRect->miny + ($oRect->maxy - $oRect->miny)/2; + $nOffX = $aPixPos[0] - $nX; + $nOffY = $aPixPos[1] - $nY; + + $this->moMapObject->oMap->setextent( $oRect->minx + $nOffX, + $oRect->miny + $nOffY, + $oRect->maxx + $nOffX, + $oRect->maxy + $nOffY ); + } + else + { + $this->moMapObject->oMap->setextent( $aPixPos[0], $aPixPos[1], $aPixPos[2], $aPixPos[3] ); + } +/* -------------------------------------------------------------------- */ +/* Call the reporjectauto function in case the map projection */ +/* is set to AUTO:XXX. If it is not, the function will do */ +/* nothing. */ +/* -------------------------------------------------------------------- */ + $this->ReprojectAuto(); + + } + + // return success + return true; + } + + /** + * GetJavascriptFunctions + * + * Build and return the array of functions needed in the + * widget. + */ + function GetJavascriptFunctions() + { + if (isset($this->maSharedResourceWidgets["CWCJSAPI"])) + $bCWCJSAPI = 1; + else + $bCWCJSAPI = 0; + + $aReturn = $this->moButton->GetJavascriptFunctions();//array(); + $szJsFunctionName = "clickBoundingBoxPopup"; + $szButtonJS = $this->moPopup->DrawPublish(); + $szFunction = <<mszHTMLForm}.NAV_CMD.value="ZOOM_BBOX"; + {$this->mszHTMLForm}.NAV_INPUT_TYPE.value=szType; + {$this->mszHTMLForm}.NAV_INPUT_COORDINATES.value=szCoords; + + if (arguments.length == 5) + { + {$this->mszHTMLForm}.NAV_INPUT_SRS.value=arguments[4]; + } + + if ({$bCWCJSAPI}) + { + goCWCJSAPI.NAV_CMD="ZOOM_BBOX"; + goCWCJSAPI.NAV_INPUT_TYPE = szType; + goCWCJSAPI.NAV_INPUT_COORDINATES=szCoords; + if (arguments.length == 5) + { + goCWCJSAPI.NAV_INPUT_SRS=arguments[4]; + } + goCWCJSAPI.UpdateNavTools(); + } + else + { + {$this->mszHTMLForm}.submit(); + } + return; +} +EOT; + + $aReturn[$szJsFunctionName] = $szFunction; + + if (is_object($this->moMapObject)) + { + $nPixWidth = $this->moMapObject->oMap->width; + $nGeoWidth = $this->moMapObject->oMap->extent->minx - + $this->moMapObject->oMap->extent->maxx; + + $nPixelWidth = abs($nPixWidth / $nGeoWidth); + + if ($nPixelWidth > 1) + $nNbDecimal = abs(log($nPixelWidth))/log(10)+1; + else + $nNbDecimal = 0; + + $nMinX = number_format($this->moMapObject->oMap->extent->minx, $nNbDecimal, ".", ""); + $nMinY = number_format($this->moMapObject->oMap->extent->miny, $nNbDecimal, ".", ""); + $nMaxX = number_format($this->moMapObject->oMap->extent->maxx, $nNbDecimal, ".", ""); + $nMaxY = number_format($this->moMapObject->oMap->extent->maxy, $nNbDecimal, ".", ""); + } + else + { + $nMinX = 0; + $nMinY = 0; + $nMaxX = 1; + $nMaxY = 1; + } + + $szJsFunctionName = "getMapExtents"; + $szFunction = <<mbVisible) + return ""; + + $szResult = $this->moButton->DrawPublish(); + + return $szResult; + } +} +?> Index: Chameleon/trunk/Chameleon/Button.help.xml =================================================================== --- (revision ) +++ Chameleon/trunk/Chameleon/Button.help.xml (revision 13) @@ -1,0 +1,106 @@ + + + +Base attribute for Button. + + + + +Toolset + + + + +default + + + + +Style resource + + + + +Aligment of the label (LEFT, CENTER, RIGHT). + + + + +Button image + + + + +Image width. + + + + +Image height. + + + + +Image tip + + + + +On click + + + + + + +Base attribute for Popup. + + + + +Toolset + + + + +default + + + + +Style resource + + + + +Aligment of the label (LEFT, CENTER, RIGHT). + + + + +Button image + + + + +Image width. + + + + +Image height. + + + + +Image tip + + + + +On click + + + + + Index: Chameleon/trunk/Chameleon/Button.php =================================================================== --- (revision ) +++ Chameleon/trunk/Chameleon/Button.php (revision 13) @@ -1,0 +1,780 @@ +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. + */ + +/** + * the button types. + */ +define ("CWCBUTTONTYPE_CLICK", 0); +define( "CWCBUTTONTYPE_TOGGLE", 1); +define( "CWCBUTTONTYPE_RADIO", 2); + +include_once(COMMON."buttonizer/buttonizer.php" ); + +/** + * CWCButton + * + * @desc CWCButton manages button attributes for other classes. + */ +class CWCButton +{ + var $mszOnClick = null; + var $mxParams = null; + var $mszToolSet = "null"; + var $mbCurrentTool = false; + var $mszStyleResource = ""; + var $mnImageWidth = -1; + var $mnImageHeight = -1; + var $mszImageTip = ""; + var $mszImageName = "cwcimage_"; + var $maszImages = array(); + var $mszLabel = ''; + var $mszLabelAlign = ""; + var $mnType = CWCBUTTONTYPE_CLICK; + var $moParent = null; + var $mszDiv = ''; + var $mbEnabled = true; + + /** + * CWCButton + * + * @param oParent - the parent widget that contains the parsed + * attribute info. + */ + function CWCButton( &$oParent ) + { + $this->moParent =& $oParent; + $oParent->maAttributes["TOOLSET"] = new StringAttribute( "TOOLSET", false ); + $oParent->maAttributes["DEFAULT"] = new BooleanAttribute( "DEFAULT", false ); + $oParent->maAttributes["STYLERESOURCE"] = new StringAttribute( "STYLERESOURCE", false ); + $oParent->maAttributes["LABEL"] = new StringAttribute( "LABEL", false); + $oParent->maAttributes["LABELALIGN"] = new StringAttribute( "LABELALIGN", false, array( "LEFT", "CENTER", "RIGHT" ) ); + $oParent->maAttributes["IMAGE"] = new StringAttribute( "IMAGE", false ); + $oParent->maAttributes["IMAGEWIDTH"] = new IntegerAttribute( "IMAGEWIDTH", false, 1 ); + $oParent->maAttributes["IMAGEHEIGHT"] = new IntegerAttribute( "IMAGEHEIGHT", false, 1 ); + $oParent->maAttributes["IMAGETIP"] = new StringAttribute( "IMAGETIP", false ); + $oParent->maAttributes["ONCLICK"] = new StringAttribute( "ONCLICK", false ); + $this->maszImages['normal'] = null; + $this->maszImages['selected'] = null; + $this->maszImages['hover'] = null; + $this->maszImages['disabled'] = null; + + //hidden for this version + //$this->maAttributes['DIV'] = new StringAttribute( "DIV", false ); + } + + /** + * Set the onclick event of this button. This can be provided in the widget tag + * also, using the ONCLICK attribute + * + * @param szOnClick - the name of the javascript function to call. It cannot + * include the function parameter list or parentheses. + */ + function SetOnClick( $szOnClick, $mxParams=null ) + { + if ($szOnClick != "") + { + $this->mszOnClick = $szOnClick; + if ($mxParams != null) + { + $this->mxParams = $mxParams; + } + } + else + { + $this->mszOnClick = null; + $this->mxParams = null; + } + } + + function SetType( $nType ) + { + $this->mnType = $nType; + } + + /** + * initialize the default values from the parameters of the widget tag if + * provided + */ + function InitDefaults() + { + $oApp = GetChameleonApplication(); + + if (isset($this->moParent->maParams["TOOLSET"]) && + $this->moParent->maParams["TOOLSET"] != "") + { + $this->mszToolSet = $this->moParent->maParams["TOOLSET"]; + if ($this->mnType == CWCBUTTONTYPE_CLICK) + $this->mnType = CWCBUTTONTYPE_RADIO; + } + + if (isset($this->moParent->maParams['DEFAULT'])) + { + $this->mbCurrentTool = strcasecmp($this->moParent->maParams['DEFAULT'], 'true') == 0 ? true : false; + } + if (isset($this->moParent->maParams["STYLERESOURCE"])) + $this->mszStyleResource = $this->moParent->maParams["STYLERESOURCE"]; + + if (isset($this->moParent->maParams["LABELALIGN"])) + $this->mszLabelAlign = strtolower( $this->moParent->maParams["LABELALIGN"] ); + + if (isset($this->moParent->maParams["LABEL"])) + $this->mszLabel = $this->moParent->maParams["LABEL"]; + + if (isset($this->moParent->maParams["IMAGEWIDTH"])) + $this->mnImageWidth = $this->moParent->maParams["IMAGEWIDTH"]; + + if (isset($this->moParent->maParams["IMAGEHEIGHT"])) + $this->mnImageHeight = $this->moParent->maParams["IMAGEHEIGHT"]; + + if (isset($this->moParent->maParams["IMAGETIP"])) + $this->mszImageTip = $this->moParent->maParams["IMAGETIP"]; + + if (isset($this->moParent->maParams["ONCLICK"])) + $this->mszOnClick = $this->moParent->maParams["ONCLICK"]; + + if (isset($this->moParent->maParams["DIV"])) + $this->mszDiv = $this->moParent->maParams["DIV"]; + + $this->mszImageName .= $this->moParent->mnId; + + if (isset($this->moParent->maszContents['IMAGE'])) + { + $nImages = count($this->moParent->maszContents['IMAGE']); + for ($i=0; $i<$nImages; $i++) + { + $aImage = $this->moParent->maszContents['IMAGE'][$i]; + if (!isset($aImage['IMAGE']) && isset($this->moParent->maParams['IMAGE'])) + { + $aImage['IMAGE'] = $oApp->findFile( $this->moParent->maParams['IMAGE'] ); + if ($aImage['IMAGE'] == '') + { + $aImage['IMAGE'] = $this->moParent->maParams['IMAGE']; + $_SESSION['gErrorManager']->setError(ERR_WARNING, + "ERROR: Button.php was unable to find the image '".$aImage['IMAGE']."' in any of the registered or default skins."); + } + + } + else if (isset($aImage['IMAGE'])) + { + $aImage['IMAGE'] = $oApp->findFile( $aImage['IMAGE'] ); + } + + + $szState = (isset($aImage['STATE'])) ? strtolower($aImage['STATE']) : 'normal'; + + if ($this->mszStyleResource != "") //use buttonizer to generate image + { + $this->maszImages[$szState] = $this->GetImage( $szState, array_change_key_case( $aImage ) ); + } + elseif( isset($aImage['IMAGE']) ) //assume a normal image URL + { + $this->maszImages[$szState] = $oApp->fileSystemToURL($aImage['IMAGE']); + } + } + } + else if (isset($this->moParent->maParams['IMAGE'])) + { + //only a 'normal' state for this image + $szState = 'normal'; + $szImage = $oApp->findFile( $this->moParent->maParams['IMAGE'] ); + + if ($this->mszStyleResource != "" ) + { + $this->maszImages[$szState] = $this->GetImage( $szState, array( "image" => $szImage ) ); + } + else + { + $this->maszImages[$szState] = $oApp->fileSystemToURL( $szImage ); + } + } + } + + /** + * parse the URL and retrieve button states for groups if possible + */ + function ParseURL() + { + if ($this->mszToolSet != "" && $this->mszToolSet != "null") + { + if ($this->moParent->moFormVars->isVarSet('BUTTON_TOOLSET_'.$this->mszToolSet) && + $this->moParent->moFormVars->getVar('BUTTON_TOOLSET_'.$this->mszToolSet) != '') + { + if ($this->moParent->moFormVars->getVar('BUTTON_TOOLSET_'.$this->mszToolSet) == $this->mszImageName) + { + $this->mbCurrentTool = true; + } + else + { + $this->mbCurrentTool = false; + } + } + } + return true; + } + + /** + * return an array of javascript functions used by the CWCButton, + * currently none are required since everything has been moved to + * cwc_button.js + */ + function GetJavascriptFunctions() + { + return array(); + } + + /** + * return an array of functions to be called when the page has finished + * loading, currently none are required. + * + */ + function GetJavascriptOnLoadFunctions() + { + $aReturn = array(); + + if ($this->mbCurrentTool) + { + $szFunction = 'CWCButtonInit_'.$this->moParent->mnId; + if ($this->maszImages['normal'] != null && + ( $this->maszImages['selected'] != null || + $this->maszImages['hover'] != null || + $this->maszImages['disabled'] != null ) ) + { + + $szCode = 'var '.$szFunction.' = goCWCButtonManager.GetButton( "'.$this->mszImageName.'" );'."\n"; + $szCode .= <<mxParams)) + { + $szParams = 'null, new Array('; + $szSep = ''; + foreach ($this->mxParams as $szVal) + { + $szParams .= $szSep.'"'.$szVal.'"'; + $szSep = ','; + } + $szParams .= ')'; + } + else + { + if(isset($this->mxParams) && $this->mxParams != "") + $szParams = 'null, "'.$this->mxParams.'"'; + else + $szParams = "null, \"\""; + } + $szCode = $this->mszOnClick.'('.$szParams.');'; + } + $aReturn[$szFunction] = $szCode; + } + + return $aReturn; + } + + /** + * return an array of files to include. Currently, just cwc_button.js is + * required + */ + function GetJavascriptIncludeFunctions() + { + $aReturn = array(); + + if ($this->maszImages['normal'] != null && + ( $this->maszImages['selected'] != null || + $this->maszImages['hover'] != null || + $this->maszImages['disabled'] != null ) ) + { + $szVar = 'cwc_dhtml.js'; + $aReturn[$szVar] = ''; + $szVar = 'cwc_button.js'; + $aReturn[$szVar] = ''; + + } + + return $aReturn; + } + /** + * return an array of functions to call as the page loads. Currently, this registers + * the button with the button manager if necessary. + * + */ + function GetJavascriptInitFunctions() + { + $aReturn = array(); + + if ($this->maszImages['normal'] != null && + ( $this->maszImages['selected'] != null || + $this->maszImages['hover'] != null || + $this->maszImages['disabled'] != null ) ) + { + $szSelected = ($this->maszImages['selected'] != null) ? '"'.$this->maszImages['selected'].'"' : 'null'; + $szHover = ($this->maszImages['hover'] != null) ? '"'.$this->maszImages['hover'].'"' : 'null'; + $szDisabled = ($this->maszImages['disabled'] != null) ? '"'.$this->maszImages['disabled'].'"' : 'null'; + + $szOnClick = ($this->mszOnClick != null) ? $this->mszOnClick : 'null'; + if ($this->mxParams != null) + { + if (is_array($this->mxParams)) + { + $szParams = 'new Array('; + $szSep = ''; + foreach ($this->mxParams as $szVal) + { + $szParams .= $szSep.'"'.$szVal.'"'; + $szSep = ','; + } + $szParams .= ')'; + } + else + { + $szParams = '"'.$this->mxParams.'"'; + } + } + else + { + $szParams = 'null'; + } + + $szCode = 'oButton = new CWCButton('. + '"'.$this->mszImageName.'", '. + $this->mnType. ', '. + '"'.$this->mszToolSet.'", '. + $szOnClick . ', ' . $szParams . ', "'. + $this->maszImages['normal'] . '", '.$szHover.', '.$szSelected . + ', '. $szDisabled . ");\n"; + $szCode .= 'oButton.oForm = '.$this->moParent->mszHTMLForm.";\n"; + $szCode .= 'oButton.szDivName = "'.$this->mszDiv.'"'."\n;"; + + if (!$this->mbEnabled) + $szCode .= 'oButton.SetState( CWCBUTTONSTATE_DISABLED );'."\n"; + + $szCode .= 'goCWCButtonManager.AddButton( oButton );'."\n"; + $aReturn[$this->mszImageName] = $szCode; + } + + return $aReturn; + } + + /** + * return an array of javascript variables to register in global scope, + * currently none are required. + */ + function GetJavascriptVariables() + { + return array(); + } + + function GetHTMLHiddenVariables() + { + $aReturn = array(); + + if ($this->mszToolSet != "" && strcasecmp($this->mszToolSet, "null") != 0 && + $this->maszImages['normal'] != null && + ( $this->maszImages['selected'] != null || + $this->maszImages['hover'] != null || + $this->maszImages['disabled'] != null )) + { + $szVariable = "BUTTON_TOOLSET_".$this->mszToolSet; + $szTool=""; + if ($this->moParent->moFormVars->isVarSet($szVariable)) + $szTool = $this->moParent->moFormVars->getVar($szVariable); + $szValue = ""; + $aReturn[$szVariable] = $szValue; + + } + return $aReturn; + } + + /** + * DrawPublish + * + * Return the HTML code for this button. + */ + function DrawPublish( ) + { + + if (//$this->maszImages['normal'] != null && + ( $this->maszImages['selected'] == null && + $this->maszImages['hover'] == null && + $this->maszImages['disabled'] == null ) ) + { + $bNeedAnchor = true; + } + else + $bNeedAnchor = false; + $szResult = ""; + + if ($bNeedAnchor) + { + if (is_array($this->mxParams)) + { + $szParams = 'null, new Array('; + $szSep = ''; + foreach ($this->mxParams as $szVal) + { + $szParams .= $szSep.'"'.$szVal.'"'; + $szSep = ','; + } + $szParams .= ')'; + } + else + { + if(isset($this->mxParams) && $this->mxParams != "") + $szParams = 'null, "'.$this->mxParams.'"'; + else + $szParams = "null, \"\""; + } + + if ($this->mszToolSet == "" || $this->mszToolSet == null || $this->mszToolSet == "null") + { + $szResult .= 'mszOnClick.'('. $szParams .')\'>'; + } + else + { + if ($this->mbCurrentTool) + $szChecked = " CHECKED"; + else + $szChecked = ""; + + if (isset($this->moParent->mszCmd)) + { + $szCmd = ' value="'.$this->mszImageName.'"'; + } + else + { + $szCmd = ' value="'.$this->mszImageName.'"'; + } + $szResult .= 'mszOnClick.'('. $szParams .')\''.$szChecked.'>'; + /* + * TODO: I'd like to enable the following line and remove + * $bNeedAnchor=false so that the user could click on the + * image to set the radio button but that turns out to be + * somewhat problematic. You need to access the radio + * buttons as an array and search it for a radio button with + * the right value. This can be difficult because in IE + * radio buttons that aren't grouped (i.e. there is only + * one of them) are not represented as arrays ... or at + * least, that was our experience from programming Studio. + */ + //$szResult .= 'moParent->mszHTMLForm.'.BUTTON_TOOLSET_'.$this->mszToolSet.'.click(); '.$this->mszOnClick.'('. $szParams .');\'>'; + $bNeedAnchor = false; + } + + } + + if ($this->maszImages['selected'] != '' && $this->mbCurrentTool) + { + $szResult .= ''.
+                        $this->mszImageTip.''; + } + else if ($this->maszImages['normal'] != '') + { + $szResult .= ''.
+                        $this->mszImageTip.''; + } + else if ($this->mszLabel != '') + { + $szResult .= $this->mszLabel; + } + else + { + $szResult .= $this->mszImageName; + } + + if ($bNeedAnchor) + { + $szResult .= ""; + } + + return $szResult; + } + + /** + * functions for making images from shared resources + */ + + /** + * this function takes an image name and returns a URL. If the image + * is a SharedResource image then it will create a buttonized image + * from the SharedResource settings and then cache the result. + * @param szState the state of the image. One of 'normal', 'selected', 'hover', + * or 'disabled'. The image will get all the default settings from + * the shared resource, plus any state-specific settings from the + * appropriate 'state' entries. + * @aImage an array of image settings. + */ + function GetImage( $szState, $aImage ) + { + + //handle the simple cases first, if the image is in the session then + //just use that value. Side effect is that you will need to restart + //your session to see changes ;) + + //turns out that multiple chameleon apps sharing the same session can + //get confused about which button is which in the session. To make + //sure that we get the right button, use the template name as well + + $oApp = GetChameleonApplication(); + $szTemplate = $oApp->mszTemplateName; + + $szCacheName = $szTemplate.'_'.$this->mszImageName.'_'.$szState; + if (isset($_SESSION[$szCacheName])) + { + if ($this->mnImageHeight == -1) + { + $this->mnImageHeight = $_SESSION[$this->mszStyleResource.$szTemplate][$szState]['height']; + } + if ($this->mnImageWidth == -1) + { + $this->mnImageWidth = $_SESSION[$this->mszStyleResource.$szTemplate][$szState]['width']; + } + return $_SESSION[$szCacheName]; + } + + $params = $this->moParent->maParams; + + //gather info about this SharedResource image, use session copy if available. + if (isset($_SESSION[$this->mszStyleResource.$szTemplate][$szState])) + { + $aParams = $_SESSION[$this->mszStyleResource.$szTemplate][$szState]; + } + else + { + if (isset($this->moParent->maSharedResourceWidgets[$this->mszStyleResource])) + { + $share = $this->moParent->maSharedResourceWidgets[$this->mszStyleResource]->maszContents; + $aParams = $this->LoadSharedResource( $share, array(), $szState ); + if (!isset($_SESSION[$this->mszStyleResource.$szTemplate])) + { + $_SESSION[$this->mszStyleResource.$szTemplate] = array(); + } + $_SESSION[$this->mszStyleResource.$szTemplate][$szState] = $aParams; //make a copy in the session. + } + else + { + //error ... no shared resource of this name + $_SESSION['gErrorManager']->setError(ERR_WARNING, + "ERROR: Button.php was unable to find a shared resource named ". + $this->mszStyleResource." for widget ".get_class($this->moParent)); + return; } + } + + $aParams = array_merge( $aParams, $aImage ); + + //these values override the sharedresource + if ($this->mnImageHeight != -1) + { + $aParams['height'] = $this->mnImageHeight; + } + else + { + $this->mnImageHeight = $aParams['height']; + } + + if ($this->mnImageWidth != -1) + { + $aParams['width'] = $this->mnImageWidth; + } + else + { + $this->mnImageWidth = $aParams['width']; + } + + if ($this->mszLabelAlign != "") + { + $aParams['labelalign'] = $this->mszLabelAlign; + } + + //the image parameter needs to be 'graphic' for the buttonizer + if (isset($aParams['image'])) + { + $aParams['graphic'] = $oApp->findFile( $aParams['image'] ); + } + //these values don't have entries in the shared resource. + /* + if (!isset($aParams['label'])) + { + if (isset( $params["LABEL"] )) + $aParams["label"] = $params["LABEL"]; + else + $aParams["label"] = ""; + } + */ + $aParams['label'] = $this->mszLabel; + + //load platform specific behaviours + $aParams["gd_module"] = "gd2"; + $aParams["freetype"] = "FreeType"; + + //generate the cached image. + $szImageFile = "b".md5( implode( "", $aParams ) ).".png"; + + $szImagePath = $_SESSION['gszButtonCachePath'].$szImageFile; + + $szImageWebPath = $_SESSION['gszButtonCacheWebPath'].$szImageFile; + + //print_r($aParams); + + //cache the URL and generate the image, if required. + if (!isset($aParams['usecache']) || (isset($aParams['usecache']) && $aParams['usecache'])) + { + $_SESSION[$szCacheName] = $szImageWebPath; + if (!is_file( $szImagePath )) + { + buttonize( $szImagePath, $aParams ); + } + } + else + { + buttonize( $szImagePath, $aParams ); + } + + return $szImageWebPath; + } + + /** + * load a shared resource into an array that contains buttonizer values + * return the loaded array + */ + function LoadSharedResource( $share, $aParams = array(), $szState ) + { + $oApp = GetChameleonApplication(); + + if (isset($share["IMAGEWIDTH"][0]["VALUE"])) + $aParams["width"] = $share["IMAGEWIDTH"][0]["VALUE"]; + + if (isset($share["IMAGEHEIGHT"][0]["VALUE"])) + $aParams["height"] = $share["IMAGEHEIGHT"][0]["VALUE"]; + + if (isset($share["TEXTBUTTONCOLOR"][0]["VALUE"])) + $aParams["backgroundcolor"] = $share["TEXTBUTTONCOLOR"][0]["VALUE"]; + + if (isset($share["BACKGROUNDIMAGE"][0]["VALUE"])) + $aParams["backgroundgraphic"] = $oApp->findFile( $share["BACKGROUNDIMAGE"][0]["VALUE"] ); + + if (isset($share["TEXTBUTTONBORDER_TOPLEFT_IMAGE"][0]["VALUE"])) + $aParams["border_tl_image"] = $oApp->findFile( $share["TEXTBUTTONBORDER_TOPLEFT_IMAGE"][0]["VALUE"] ); + + if (isset($share["TEXTBUTTONBORDER_TOP_IMAGE"][0]["VALUE"])) + $aParams["border_t_image"] = $oApp->findFile( $share["TEXTBUTTONBORDER_TOP_IMAGE"][0]["VALUE"] ); + + if (isset($share["TEXTBUTTONBORDER_TOPRIGHT_IMAGE"][0]["VALUE"])) + $aParams["border_tr_image"] = $oApp->findFile( $share["TEXTBUTTONBORDER_TOPRIGHT_IMAGE"][0]["VALUE"] ); + + if (isset($share["TEXTBUTTONBORDER_RIGHT_IMAGE"][0]["VALUE"])) + $aParams["border_r_image"] = $oApp->findFile( $share["TEXTBUTTONBORDER_RIGHT_IMAGE"][0]["VALUE"] ); + + if (isset($share["TEXTBUTTONBORDER_BOTTOMRIGHT_IMAGE"][0]["VALUE"])) + $aParams["border_br_image"] = $oApp->findFile( $share["TEXTBUTTONBORDER_BOTTOMRIGHT_IMAGE"][0]["VALUE"] ); + + if (isset($share["TEXTBUTTONBORDER_BOTTOM_IMAGE"][0]["VALUE"])) + $aParams["border_b_image"] = $oApp->findFile( $share["TEXTBUTTONBORDER_BOTTOM_IMAGE"][0]["VALUE"] ); + + if (isset($share["TEXTBUTTONBORDER_BOTTOMLEFT_IMAGE"][0]["VALUE"])) + $aParams["border_bl_image"] =$oApp->findFile( $share["TEXTBUTTONBORDER_BOTTOMLEFT_IMAGE"][0]["VALUE"] ); + + if (isset($share["TEXTBUTTONBORDER_LEFT_IMAGE"][0]["VALUE"])) + $aParams["border_l_image"] = $oApp->findFile( $share["TEXTBUTTONBORDER_LEFT_IMAGE"][0]["VALUE"] ); + + if (isset($share["TEXTBUTTONNUDGE"][0]["VALUE"])) + $aParams["nudge"] = $share["TEXTBUTTONNUDGE"][0]["VALUE"]; + + if (isset($share["TEXTBUTTONPADDING"][0]["VALUE"])) + $aParams["padding"] = $share["TEXTBUTTONPADDING"][0]["VALUE"]; + + if (isset($share["LABELFONT"][0]["VALUE"])) + { + $szFont = $oApp->findFile( $share["LABELFONT"][0]["VALUE"] ); + if (!$szFont) + { + $aParams["labelfont"] = $share["LABELFONT"][0]["VALUE"]; + $_SESSION['gErrorManager']->setError(ERR_WARNING, + "ERROR: Button.php was unable to find the font '".$aParams["labelfont"]."' in any of the registered or default skins."); + } + else + { + $aParams["labelfont"] = $szFont; + } + } + + if (isset($share["LABELFONTSIZE"][0]["VALUE"])) + $aParams["labelsize"] = $share["LABELFONTSIZE"][0]["VALUE"]; + + if (isset($share["LABELCOLOR"][0]["VALUE"])) + $aParams["labelcolor"] = $share["LABELCOLOR"][0]["VALUE"]; + + if (isset($share["LABELALIGN"][0]["VALUE"])) + $aParams["labelalign"] = $share["LABELALIGN"][0]["VALUE"]; + + if (isset($share["LABELANTIALIAS"][0]["VALUE"])) + $aParams["antialias"] = ($share["LABELANTIALIAS"][0]["VALUE"] == "true" )? true : false; + + if (isset($share["IMAGE"])) + { + $aParams["graphic"] = $oApp->findFile( $share["IMAGE"][0]['VALUE'] ); + } + if (isset($share["USETEXTBUTTONCACHE"][0]["VALUE"])) + $aParams['usecache'] = ($share["USETEXTBUTTONCACHE"][0]["VALUE"] == "true" )? true : false; + + //process states last + if (isset($share['STATE'])) + { + foreach( $share["STATE"] as $aszSR ) + { + if($aszSR["VALUE"] == $szState) + { + $aParams = $this->LoadSharedResource($aszSR["CHILDREN"][0], $aParams, $szState); + } + } + } + + return $aParams; + } +} +?> Index: Chameleon/trunk/Chameleon/CWC2ButtonCache.php =================================================================== --- (revision ) +++ Chameleon/trunk/Chameleon/CWC2ButtonCache.php (revision 13) @@ -1,0 +1,295 @@ + + +EOT; + } + else + { + //none-buttonized-version :) + $szReturn = << +EOT; + } + + return $szReturn; +} + +/** + * GetImage returns the name of an image to use for a particular resource and state + */ +function GetImage( $szImageID, $aParams ) +{ + //TODO: figure out an effective caching mechanism for this? + //using $szImageID + + //load platform specific behaviours + $aParams["gd_module"] = "gd2"; + $aParams["freetype"] = "FreeType"; + + //generate the cached image. + $szImageFile = md5( implode( "", $aParams ) ).".png"; + + $szImagePath = $_SESSION['gszButtonCachePath'].$szImageFile; + + $szImageWebPath = $_SESSION['gszButtonCacheWebPath'].$szImageFile; + + //fix relative paths if necessary + $aPaths = array( 'graphic', + 'border_tl_image', + 'border_t_image', + 'border_tr_image', + 'border_r_image', + 'border_br_image', + 'border_b_image', + 'border_bl_image', + 'border_l_image', + 'backgroundimage', + 'labelfont' + ); + + foreach ($aPaths as $aPath) + if (isset($aParams[$aPath])) + { + $aParams[$aPath] = findFile( $aParams[$aPath] ); + } + //cache the URL and generate the image, if required. + if (!isset($aParams['usecache']) || (isset($aParams['usecache']) && $aParams['usecache'])) + { + //TODO: can we effectively cache this? + //$_SESSION[$szCacheName] = $szImageWebPath; + if (!is_file( $szImagePath )) + { + buttonize( $szImagePath, $aParams ); + } + } + else + { + buttonize( $szImagePath, $aParams ); + } + + return $szImageWebPath; +} + +/** + * this function attempts to locate a file in one of + * (possibly) several locations. If the original file + * path is absolute, it will be returned as is. If it + * is relative, the it will be looked for in four possible + * cases. + * + * 1. relative to app path in skin search paths + * 2. relative to app path + * 3. relative to chameleon in skin search paths + * 4. relative to chameleon + * + * @param szFilePath an absolute or relative path and file + * name to locate + * @return an absolute path to the file or false if the file + * could not be found. + */ +function findFile( $szFilePath ) +{ + /* case 1 - skin search path relative to app */ + foreach( array_reverse($_SESSION['gaszSkinSearchPath']) as $szPath ) + { + $szTempPath = resolvePath2( $szFilePath, $_SESSION['gszAppPath'].'/'.$szPath."/" ); + if ($szTempPath != "" && file_exists($szTempPath)) + { + return $szTempPath; + } + } + + /* case 2 - relative to app */ + $szTempPath = resolvePath2( $szFilePath, $_SESSION['gszAppPath'] ); + if ($szTempPath != "" && file_exists($szTempPath)) + { + return $szTempPath; + } + + /* case 3 - skin search path relative to chameleon */ + foreach( array_reverse($_SESSION['gaszSkinSearchPath']) as $szPath ) + { + $szTempPath = resolvePath2( $szFilePath, $_SESSION['gszCorePath'].'/'.$szPath.'/' ); + if ($szTempPath != "" && file_exists($szTempPath)) + { + return $szTempPath; + } + } + + /* case 4 - relative to chameleon */ + $szTempPath = resolvePath2( $szFilePath, $_SESSION['gszCorePath'] ); + if ($szTempPath != "" && file_exists($szTempPath)) + { + return $szTempPath; + } + + return false; +} + +function fileSystemToURL( $szFileSystemPath ) +{ + if (strncmp( $szFileSystemPath, $_SESSION['gszAppPath'], strlen($_SESSION['gszAppPath']) ) == 0) + return $_SESSION['gszAppWebPath'].'/'.substr( $szFileSystemPath, strlen($_SESSION['gszAppPath'])); + + if (strncmp( $szFileSystemPath, $_SESSION['gszCorePath'], strlen($_SESSION['gszCorePath']) ) == 0) + return $_SESSION['gszCoreWebPath'].'/'.substr($szFileSystemPath,strlen($_SESSION['gszCorePath'])); + + return $szFileSystemPath; +} + +/** + * this function determines if a path represents an absolute path and returns + * true if it is, and false if it is not + * @param szPath the path to test + * @result boolean, true if the path is absolute, false otherwise + */ +function isAbsolutePath( $szPath ) +{ + if ($szPath == "") return false; + if ($szDestPath[0] == "/" || preg_match('/^(\w:)/', $szDestPath)) + { + return true; + } + else + { + return false; + } +} + +/** + * This function translate $szDestPath (relative or absolute) + * to a absolute path based on $szOrigPath. + * + * @param $szDestPath Destination path to translate + * @param $szOrigPath Refenrece path + */ +function resolvePath2 ($szDestPath, $szOrigPath) +{ + // If one or other path is missing or absolute, return it. + if ($szDestPath == "") return $szOrigPath; + if ($szOrigPath == "") return $szDestPath; + if ($szDestPath[0] == "/" || preg_match('/^(\w:)/', $szDestPath)) + { + return $szDestPath; + } + + // If windows prefix (eg: c:) get it + $szPrefix = ""; + if ($szOrigPath[0] != "/") + { + if (preg_match('/^(\w:)(.*)/i', $szOrigPath, $aMatch)) + { + $szPrefix = $aMatch[1]; + $szOrigPath = $aMatch[2]; + } + else + { + $szOrigPath = "/".$szOrigPath; + } + } + + // Make sure path finishing with "/" + if ($szOrigPath[strlen($szOrigPath)-1] != "/" && + !is_dir($szOrigPath)) + $szOrigPath = dirname($szOrigPath)."/"; + if ($szOrigPath[strlen($szOrigPath)-1] != "/") + $szOrigPath = $szOrigPath."/"; + + $szPath = $szOrigPath.$szDestPath; + + // Remove repetitive "/" + $szPath = ereg_replace ("/+", "/", $szPath); + + $szPath = iterate_ereg_replace ("/\./", "/", $szPath); + $szPath = iterate_ereg_replace ("/[^(/|\.)]+/\.\./", "/", $szPath); + + //Rest of the function + return $szPrefix.$szPath; +} + +/** + * Recursive ereg_replace + */ +function iterate_ereg_replace ( $szPattern, $szReplacement, $szString) +{ + $szResult = $szString; + do + { + $szString = $szResult; + $szResult = ereg_replace ($szPattern, $szReplacement, $szString); + } + while ($szResult != $szString); + + return $szResult; +} + +?> Index: Chameleon/trunk/Chameleon/CatalogSearch/CatalogSearch.en-ca.doc.xml =================================================================== --- (revision ) +++ Chameleon/trunk/Chameleon/CatalogSearch/CatalogSearch.en-ca.doc.xml (revision 13) @@ -1,0 +1,684 @@ + + + + + English (en-ca) + + + 2004-12-18 + + + $id: $ + + + + Doc_Builder + DM Solutions Group Inc. + chameleon@lists.maptools.org + + + + + + Christopher R. Thorne + DM Solutions Group Inc. + chameleon@lists.maptools.org + + + + + + + catalogsearch + + + TBD + + + TBD + + + 1.99 + + + 1999-12-31 + + + BETA + + + + Paul Spencer + DM Solutions Group Inc. + chameleon@lists.maptools.org + + + + + + + + The catalog search width allows a user to search a catalog of WMS layers +based on an entered keyword and select one or more layers from the results +to add to the current context. + + + + + + + + + + + + + + + + + + + + The Catalog Search widget provides the capability to connect to an OGC service to search for layers by keyword. To use the Catalog Search widget, click he Catalog Search button to open the Catalog Search dialog. Enter a keyword into the keyword text box and click "Locate Layers". If matching layers are found, they will be listed in the Search Results list. Click this icon next to each result to add this layer to your current Context. + + + + + + + + + + + + + + + + + + + + EMBEDEDMODE ="[boolean]" + DEFAULTURL ="[string]" + LAYERSHAREDRESOURCENAME ="[string]" + SERVERSHAREDRESOURCENAME ="[string]" + HTMLINPUTNAME ="[string]" + HTMLINPUTVALUE ="[string]" + SERVERIMAGE ="[string]" + THEMEIMAGE ="[string]" + THEMEOPENIMAGE ="[string]" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hawaii Demo + http://www.mapsherpa.com/hawaii2/ + The Hawaii Demo uses the latest 1.99 Chameleon version. + + + + + + + + + + + + + + + + + + base + button + popup + label + + + + + EMBEDEDMODE + + boolean + + + + Widget Only + + + + + + true + false + + + + DEFAULTURL + + string + + + + Widget Only + + + + + + + LAYERSHAREDRESOURCENAME + + string + + + + Widget Only + + + + + + + SERVERSHAREDRESOURCENAME + + string + + + + Widget Only + + + + + + + HTMLINPUTNAME + + string + + + + Widget Only + + + + + + + HTMLINPUTVALUE + + string + + + + Widget Only + + + + + + + SERVERIMAGE + + string + + + + Widget Only + + + + + + + THEMEIMAGE + + string + + + + Widget Only + + + + + + + THEMEOPENIMAGE + + string + + + + Widget Only + + + + + + + + + XML + Child Element to Chameleon widget tag (subtag) + + + Widget & Shared Resource + + + + + + float + + + + Widget & Shared Resource + + + + + + + + + + + + + + + LAYER_TITLE + + unknown + + + + + + + + + + The title for the last layer that was selected from the catalog search function + + + LAYER_ALT_TITLE + + unknown + + + + + + + + + + The alternate title for the last layer that was selected from the catalog search function + + + LAYER_SERVER_VERSION + + unknown + + + + + + + + + + The version of WMS that the server supports for the last layer that was selected from the catalog search function + + + LAYER_CONNECT_STRING + + unknown + + + + + + + + + + The connection string for the last layer that was selected from the catalog search function + + + LAYER_ABSTRACT + + unknown + + + + + + + + + + The abstract for the last layer that was selected from the catalog search function + + + LAYER_LLBB + + unknown + + + + + + + + + + The LatLong bounding box for the last layer that was selected from the catalog search function + + + LAYER_STYLES + + unknown + + + + + + + + + + The styles supported by the last layer that was selected from the catalog search function + + + LAYER_FORMATS + + unknown + + + + + + + + + + The formats for the last layer that was selected from the catalog search function + + + LAYER_SRSS + + unknown + + + + + + + + + + The SRS values supported by the last layer that was selected from the catalog search function + + + + + + clickCatalogSearch + + Private + + callback function for the user clicking the "catalog" button + + + + unknown + + + + + + + + + + + + + Describe the JS functions (if any) that define or rather trigger events through the Chameleon JSAPI. + + + + + + + + catalogSearchCB + + Private + + callback function for the catalog search page. + + + actionID + + string + + + + + + + + + + + + wh + + string + + + + + + + + + + + + + + + unknown + + + + + + + + + + + + + Describe the JS functions (if any) that define or rather trigger events through the Chameleon JSAPI. + + + + + + + + + + + + + + + + string + + + Private + + + + + + + + + + + + + + + Private + + + + + + + string + + + false + + + + + + + + + + + + + + + unknown + + + + + + + + + + + + + + + + + + + + + + + + + + + JSAPI function calls for this widget are outlined here. + + + + + + + + + + + + + + + string + + + false + + + + + + + + + + + + + + + + + + PHP Mapscript + + + none + + + + + Error message string.... + + + + + The description of what the message means...... + + + + + Any possible solution that will help application developers troubleshoot and fix the problem. + + + + + Index: Chameleon/trunk/Chameleon/CatalogSearch/CatalogSearch.fr-ca.doc.xml =================================================================== --- (revision ) +++ Chameleon/trunk/Chameleon/CatalogSearch/CatalogSearch.fr-ca.doc.xml (revision 13) @@ -1,0 +1,684 @@ + + + + + French (fr-ca) + + + 2004-12-18 + + + $id: $ + + + + Doc_Builder + DM Solutions Group Inc. + chameleon@lists.maptools.org + + + + + + Christopher R. Thorne + DM Solutions Group Inc. + chameleon@lists.maptools.org + + + + + + + catalogsearch + + + TBD + + + TBD + + + 1.99 + + + 1999-12-31 + + + BETA + + + + Paul Spencer + DM Solutions Group Inc. + chameleon@lists.maptools.org + + + + + + + + The catalog search width allows a user to search a catalog of WMS layers +based on an entered keyword and select one or more layers from the results +to add to the current context. + + + + + + + + + + + + + + + + + + + + L'outil Catalog Search permet de se connecter à un service OGC pour repérer des couches par mots clés. Pour utiliser l'outil, cliquez sur « Recherche par catalogue » pour ouvrir la boîte de dialogue. Entrez un mot clé dans la case « Localiser couches ». Si les couches correspondantes sont trouvées, elles se retrouveront dans la liste « Résultat de la recherche ». Cliquez sur le bouton « Ajouter » adjascent à une couche pour ajouter cette couche à votre contexte. + + + + + + + + + + + + + + + + + + + + EMBEDEDMODE ="[boolean]" + DEFAULTURL ="[string]" + LAYERSHAREDRESOURCENAME ="[string]" + SERVERSHAREDRESOURCENAME ="[string]" + HTMLINPUTNAME ="[string]" + HTMLINPUTVALUE ="[string]" + SERVERIMAGE ="[string]" + THEMEIMAGE ="[string]" + THEMEOPENIMAGE ="[string]" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Hawaii Demo + http://www.mapsherpa.com/hawaii2/ + The Hawaii Demo uses the latest 1.99 Chameleon version. + + + + + + + + + + + + + + + + + + base + button + popup + label + + + + + EMBEDEDMODE + + boolean + + + + Widget Only + + + + + + true + false + + + + DEFAULTURL + + string + + + + Widget Only + + + + + + + LAYERSHAREDRESOURCENAME + + string + + + + Widget Only + + + + + + + SERVERSHAREDRESOURCENAME + + string + + + + Widget Only + + + + + + + HTMLINPUTNAME + + string + + + + Widget Only + + + + + + + HTMLINPUTVALUE + + string + + + + Widget Only + + + + + + + SERVERIMAGE + + string + + + + Widget Only + + + + + + + THEMEIMAGE + + string + + + + Widget Only + + + + + + + THEMEOPENIMAGE + + string + + + + Widget Only + + + + + + + + + XML + Child Element to Chameleon widget tag (subtag) + + + Widget & Shared Resource + + + + + + float + + + + Widget & Shared Resource + + + + + + + + + + + + + + + LAYER_TITLE + + unknown + + + + + + + + + + + + + LAYER_ALT_TITLE + + unknown + + + + + + + + + + + + + LAYER_SERVER_VERSION + + unknown + + + + + + + + + + + + + LAYER_CONNECT_STRING + + unknown + + + + + + + + + + + + + LAYER_ABSTRACT + + unknown + + + + + + + + + + + + + LAYER_LLBB + + unknown + + + + + + + + + + + + + LAYER_STYLES + + unknown + + + + + + + + + + + + + LAYER_FORMATS + + unknown + + + + + + + + + + + + + LAYER_SRSS + + unknown + + + + + + + + + + + + + + + + clickCatalogSearch + + Private + + + + + + unknown + + + + + + + + + + + + + Describe the JS functions (if any) that define or rather trigger events through the Chameleon JSAPI. + + + + + + + + catalogSearchCB + + Private + + + + + actionID + + string + + + + + + + + + + + + wh + + string + + + + + + + + + + + + + + + unknown + + + + + + + + + + + + + Describe the JS functions (if any) that define or rather trigger events through the Chameleon JSAPI. + + + + + + + + + + + + + + + + string + + + Private + + + + + + + + + + + + + + + Private + + + + + + + string + + + false + + + + + + + + + + + + + + + unknown + + + + + + + + + + + + + + + + + + + + + + + + + + + JSAPI function calls for this widget are outlined here. + + + + + + + + + + + + + + + string + + + false + + + + + + + + + + + + + + + + + + PHP Mapscript + + + none + + + + + Error message string.... + + + + + The description of what the message means...... + + + + + Any possible solution that will help application developers troubleshoot and fix the problem. + + + + + Index: Chameleon/trunk/Chameleon/CatalogSearch/CatalogSearch.php =================================================================== --- (revision ) +++ Chameleon/trunk/Chameleon/CatalogSearch/CatalogSearch.php (revision 13) @@ -1,0 +1,129 @@ + + * + * John + * 20K + * + * + * Ren + * 2K + * + * + * + * Sample PHP code: + * $MyDoc = xml_ge_children(parse_into_struct(...)); + * if $MyDoc->Employees->attributes['version'] >= "1.0") + * { + * foreach($MyDoc->Employees->value->Employee as $oEmployee) + * { + * echo $oEmployee->attributes['Id']." "; + * echo "Name: ".$oEmployee->value->Name->value; + * echo "Paid: ".$oEmployee->value->Salary->value."("; + * echo $oEmployee->value->Salary->attributes['Type'].")"; + * } + * } + * else + * echo "Wrong document version"; + * + * + * PS: This code was not tested. + */ +function xml_get_children(&$vals) +{ + $children = new Foo(); + + $j = count($vals); + + while ($GLOBALS['i']++ < $j) + { + $k = $GLOBALS['i']; + + // if current record is a closing tag + if (isset($vals[$k]['type']) && $vals[$k]['type'] == "close") + return $children; + + // Check if there's already a tage with that name + // If so and it is not an array, set it as an array + if (@isset($children->$vals[$k]['tag']) && + !is_array($children->$vals[$k]['tag'])) + { + $oTmp = $children->$vals[$k]['tag']; + $children->$vals[$k]['tag'] = array($oTmp); + } + if (isset($vals[$k])) + { + switch ($vals[$k]['type']) + { + // If current record is a complete tag or cdata + case 'cdata': + case 'complete': + // if current record is an array + if (@is_array($children->$vals[$k]['tag'])) + { + // Set attributes property + $o->attributes = (isset($vals[$k]['attributes']) ? + $vals[$k]['attributes'] : array()); + + // Set value property + $o->value = (isset($vals[$k]['value']) ? + $vals[$k]['value'] : ""); + + // Add it to current record (to an array) + array_push($children->$vals[$k]['tag'], $o); + } + else // It is not an array, so add it as a simple attribute + { + $children->$vals[$k]['tag']->attributes = + (isset($vals[$k]['attributes']) ? + $vals[$k]['attributes'] : array()); + $children->$vals[$k]['tag']->value = + (isset($vals[$k]['value']) ? + $vals[$k]['value'] : ""); + } + break; + + // If current record is an open tag + case 'open': + if (@is_array($children->$vals[$k]['tag'])) + { + $o->attributes = (isset($vals[$k]['attributes']) ? + $vals[$k]['attributes'] : array()); + + // Call function recursivly + $o->value = xml_get_children($vals); + + array_push($children->$vals[$k]['tag'], $o); + } + else + { + $children->$vals[$k]['tag']->attributes = + @(isset($vals[$k]['attributes']) ? + $vals[$k]['attributes'] : array()); + + // Call function recursivly + $children->$vals[$k]['tag']->value = xml_get_children($vals); + } + break; + } + } + } + + // Return last created object + return $children; +} + +class Foo +{ +} + +$GLOBALS['i']=-1; +?> Index: Chameleon/trunk/Chameleon/CatalogSearch/CatalogSearch.widget.php =================================================================== --- (revision ) +++ Chameleon/trunk/Chameleon/CatalogSearch/CatalogSearch.widget.php (revision 13) @@ -1,0 +1,973 @@ +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_once(dirname(__FILE__)."/../Widget.php"); +include_once(dirname(__FILE__)."/../Button.php"); +include_once(dirname(__FILE__)."/../Popup.php"); +include_once(dirname(__FILE__)."/../Label.php"); +include_once( COMMON."wrapper/map_navigator.php" ); +include_once("CatalogSearch.php"); + +/** + * CatalogSearch + * + * Display a widget that pops up a projection selection widget. + */ +class CatalogSearch extends CWCWidget +{ + var $moButton; + var $moPopup; + var $moLabel; + var $mbEmbeded = false; + var $mszEmbededURL = "http://ceomap2.ccrs.nrcan.gc.ca/cgi-bin/cslt/wes/service_manager/catquery?RS=XML&catalog=http%3A%2F%2Fceomap2.ccrs.nrcan.gc.ca%2Fcgi-bin%2Fcslt%2Fwes%2Fservice_manager%2Fcatquery&QUERY="; + var $mszLayerSRName = ""; + var $mszServerSRName = ""; + var $mszHTMLInputName = ""; + var $mszHTMLInputValue = ""; + var $mszServerImage = "images/tree_servers.gif"; + var $mszThemeImage = "images/tree_layers.gif"; + var $mszThemeOpenImage = "images/tree_layers.gif"; + var $mbSearchResultFound = false; + var $mbResultIsActive = false; + + var $mszLink = "/widgets/CatalogSearch/CatalogSearch.phtml"; + var $mszParam = "&szCallbackFunc=catalogSearchCB"; + + /** + * CatalogSearch + * + * Constctor method for the CatalogSearchWidget + */ + function CatalogSearch() + { + // invoke constructor of parent + parent::CWCWidget(); + + // set the description for this widget + $this->szWidgetDescription = <<mnPriority = PRIORITY_LOW; + + $this->maAttributes["EMBEDEDMODE"] = new BooleanAttribute( "EMBEDEDMODE", false ); + $this->maAttributes["DEFAULTURL"] = new StringAttribute( "DEFAULTURL", false ); + $this->maAttributes["LAYERSHAREDRESOURCENAME"] = + new StringAttribute( "LAYERSHAREDRESOURCENAME", false ); + $this->maAttributes["SERVERSHAREDRESOURCENAME"] = + new StringAttribute( "SERVERSHAREDRESOURCENAME", false ); + $this->maAttributes["HTMLINPUTNAME"] = + new StringAttribute( "HTMLINPUTNAME", false ); + $this->maAttributes["HTMLINPUTVALUE"] = + new StringAttribute( "HTMLINPUTVALUE", false ); + $this->maAttributes["SERVERIMAGE"] = + new StringAttribute( "SERVERIMAGE", false ); + $this->maAttributes["THEMEIMAGE"] = + new StringAttribute( "THEMEIMAGE", false ); + $this->maAttributes["THEMEOPENIMAGE"] = + new StringAttribute( "THEMEOPENIMAGE", false ); + + $this->moButton = new CWCButton( $this ); + + $this->moPopup = new CWCPopup( $this ); + + $this->moLabel = new CWCLabel( $this ); + + $this->mnMaturityLevel = MATURITY_BETA; + + } + + function InitDefaults() + { + parent::InitDefaults(); + //this widget should never belong to a toolset + $this->maParams["TOOLSET"] = ""; + $this->moButton->InitDefaults(); + $this->moButton->SetOnClick("clickCatalogSearch"); + + if (isset($this->maParams["EMBEDEDMODE"])) + $this->mbEmbeded = ((strcasecmp($this->maParams["EMBEDEDMODE"], "TRUE")==0) ? true : false); + + if( isset($this->maParams["DEFAULTURL"]) ) + $this->mszEmbededURL = $this->maParams["DEFAULTURL"]; + + if (isset($this->maParams["LAYERSHAREDRESOURCENAME"])) + $this->mszLayerSRName = + $this->maParams["LAYERSHAREDRESOURCENAME"]; + if (isset($this->maParams["SERVERSHAREDRESOURCENAME"])) + $this->mszServerSRName = + $this->maParams["SERVERSHAREDRESOURCENAME"]; + + if (isset($this->maParams["HTMLINPUTNAME"])) + $this->mszHTMLInputName = $this->maParams["HTMLINPUTNAME"]; + if (isset($this->maParams["HTMLINPUTVALUE"])) + { + $this->mszHTMLInputValue = $this->maParams["HTMLINPUTVALUE"]; + } + + if (isset($this->maParams["SERVERIMAGE"])) + $this->mszServerImage = $this->maParams["SERVERIMAGE"]; + if (isset($this->maParams["THEMEIMAGE"])) + $this->mszThemeImage = $this->maParams["THEMEIMAGE"]; + if (isset($this->maParams["THEMEOPENIMAGE"])) + $this->mszThemeOpenImage = $this->maParams["THEMEOPENIMAGE"]; + + if( !$this->mbEmbeded ) + { + $this->moPopup->mszLink = $this->mszLink; + $this->moPopup->mszParam = $this->mszParam; + $this->moPopup->InitDefaults(); + } + } + + function GetJavascriptVariables() + { + if ($this->mbVisible) + return $this->moButton->GetJavascriptVariables(); + else return array(); + } + + function GetJavascriptInitFunctions() + { + if ($this->mbVisible) + return $this->moButton->GetJavascriptInitFunctions(); + else return array(); + } + + function GetJavascriptOnLoadFunctions() + { + if ($this->mbVisible) + $aReturn = $this->moButton->GetJavascriptOnLoadFunctions(); + else + $aReturn = array(); + + if($this->isVarSet("CATALOGSEARCHEMBEDED_SEARCH") && + $this->getVar("CATALOGSEARCHEMBEDED_SEARCH") != "") + { + if( !$this->mbSearchResultFound ) + { + $szJsFunctionName = "catalogSearch"; + $szSearchString = $this->getVar("CATALOGSEARCHEMBEDED_SEARCH"); + + $szFunction = <<mbEmbeded ) + { + if ($this->isVarSet("LAYER_ALT_TITLE") && + $this->getVar("LAYER_ALT_TITLE") != "") + { + $szJsFunctionName = "catalogSearch"; + $szFunction = <<mbVisible) + $aReturn = $this->moButton->GetJavascriptIncludeFunctions(); + else + $aReturn = array(); + return $aReturn; + } + + /** + * GetJavascriptFunctions + * + * Build and return the array of functions needed in the + * widget. + */ + function GetJavascriptFunctions() + { + $aReturn = array(); + $szJsFunctionName = "clickCatalogSearch"; + + if( !$this->mbEmbeded ) + { + $this->moPopup->mszLink = $_SESSION['gszCoreWebPath']."/widgets/CatalogSearch/CatalogSearchPopup.phtml?"; + $bEmbeded = (strcasecmp($this->getValue("EMBEDED",0), "TRUE")==0)? + 1 : 0; + $this->moPopup->mszParam .= (($bEmbeded) ? "&bSearch=1&szSearchString='+{$this->mszHTMLForm}.szSearchString.value+'" : ""); + $szButtonJS = $this->moPopup->DrawPublish(); + + $szFunction = <<mszHTMLForm}.LAYER_TITLE.value = wh.LayerTitle; + {$this->mszHTMLForm}.LAYER_ALT_TITLE.value = wh.LayerAltTitle; + {$this->mszHTMLForm}.LAYER_SERVER_VERSION.value = wh.LayerServerVersion; + {$this->mszHTMLForm}.LAYER_CONNECT_STRING.value = wh.LayerConnectString; + {$this->mszHTMLForm}.LAYER_ABSTRACT.value = wh.LayerAbstract; + {$this->mszHTMLForm}.LAYER_LLBB.value = wh.LayerLLBB; + {$this->mszHTMLForm}.LAYER_STYLES.value = wh.LayerStyles; + {$this->mszHTMLForm}.LAYER_FORMATS.value = wh.LayerFormats; + {$this->mszHTMLForm}.LAYER_SRSS.value = wh.LayerSRSs; + + wh.close(); + {$this->mszHTMLForm}.submit(); + } + else + if (actionID == 1) // apply + { + // Here we should handle the load mapcontext + {$this->mszHTMLForm}.LAYER_TITLE.value = wh.LayerTitle; + {$this->mszHTMLForm}.LAYER_ALT_TITLE.value = wh.LayerAltTitle; + {$this->mszHTMLForm}.LAYER_SERVER_VERSION.value = wh.LayerServerVersion; + {$this->mszHTMLForm}.LAYER_CONNECT_STRING.value = wh.LayerConnectString; + {$this->mszHTMLForm}.LAYER_ABSTRACT.value = wh.LayerAbstract; + {$this->mszHTMLForm}.LAYER_LLBB.value = wh.LayerLLBB; + {$this->mszHTMLForm}.LAYER_STYLES.value = wh.LayerStyles; + {$this->mszHTMLForm}.LAYER_FORMATS.value = wh.LayerFormats; + {$this->mszHTMLForm}.LAYER_SRSS.value = wh.LayerSRSs; + + {$this->mszHTMLForm}.submit(); + } + if (actionID == 2) // cancel + { + wh.close(); + } + + return; +} + +EOF; + $aReturn[$szJsFunctionName] = $szFunction; + + } + else + { + $szFunction = <<mszHTMLForm}.CATALOGSEARCHEMBEDED_SEARCH.value = {$this->mszHTMLForm}.szSearchString.value; + {$this->mszHTMLForm}.submit(); + + return; +} +EOT; + $aReturn[$szJsFunctionName] = $szFunction; + + $szJsFunctionName = "catalogSearchCB"; + $szFunction = <<mszHTMLForm}.LAYER_TITLE.value = aszLayerAttributes[0]; + {$this->mszHTMLForm}.LAYER_ALT_TITLE.value = aszLayerAttributes[1]; + {$this->mszHTMLForm}.LAYER_SERVER_VERSION.value = aszLayerAttributes[2]; + {$this->mszHTMLForm}.LAYER_CONNECT_STRING.value = aszLayerAttributes[3]; + {$this->mszHTMLForm}.LAYER_ABSTRACT.value = aszLayerAttributes[4]; + {$this->mszHTMLForm}.LAYER_LLBB.value = aszLayerAttributes[5]; + {$this->mszHTMLForm}.LAYER_STYLES.value = aszLayerAttributes[6]; + {$this->mszHTMLForm}.LAYER_FORMATS.value = aszLayerAttributes[7]; + {$this->mszHTMLForm}.LAYER_SRSS.value = aszLayerAttributes[8]; + + return; +} + +EOF; + $aReturn[$szJsFunctionName] = $szFunction; + + $szJsFunctionName = "catalogSearchReset"; + $szFunction = <<mszHTMLForm}.LAYER_TITLE.value = ""; + {$this->mszHTMLForm}.LAYER_ALT_TITLE.value = ""; + {$this->mszHTMLForm}.LAYER_SERVER_VERSION.value = ""; + {$this->mszHTMLForm}.LAYER_CONNECT_STRING.value = ""; + {$this->mszHTMLForm}.LAYER_ABSTRACT.value = ""; + {$this->mszHTMLForm}.LAYER_LLBB.value = ""; + {$this->mszHTMLForm}.LAYER_STYLES.value = ""; + {$this->mszHTMLForm}.LAYER_FORMATS.value = ""; + {$this->mszHTMLForm}.LAYER_SRSS.value = ""; + + return; +} + +EOF; + $aReturn[$szJsFunctionName] = $szFunction; + + $szJsFunctionName = "applyCatalogSearchLayer"; + $szFunction = <<mszHTMLForm}.submit(); +} + +EOF; + $aReturn[$szJsFunctionName] = $szFunction; + + + $szJsFunctionName = "CatalogSearchResult_Select"; + if( $this->mbResultIsActive && + $this->isVarSet($this->mszServerSRName)) + { + $szFunction = <<mszHTMLForm}.{$this->mszServerSRName}.value ="CatalogSearchResult"; +} + +EOF; + } + else + { + $szFunction = <<