[fusion-commits] r1352 - in sandbox/aboudreault: MapServer/php widgets

svn_fusion at osgeo.org svn_fusion at osgeo.org
Fri Mar 28 16:33:50 EDT 2008


Author: aboudreault
Date: 2008-03-28 16:33:50 -0400 (Fri, 28 Mar 2008)
New Revision: 1352

Modified:
   sandbox/aboudreault/MapServer/php/Search.php
   sandbox/aboudreault/widgets/MSSearch.js
Log:
Commit last version of MapServer search widget to aboudreault sandbox


Modified: sandbox/aboudreault/MapServer/php/Search.php
===================================================================
--- sandbox/aboudreault/MapServer/php/Search.php	2008-03-28 19:16:09 UTC (rev 1351)
+++ sandbox/aboudreault/MapServer/php/Search.php	2008-03-28 20:33:50 UTC (rev 1352)
@@ -2,7 +2,7 @@
 /**
  * Search
  *
- * $Id: Query.php 1108 2007-12-11 00:27:33Z aboudreault at mapgears.com $
+ * $Id: Search.php 1108 2007-12-11 00:27:33Z aboudreault at mapgears.com $
  *
  * Copyright (c) 2007, DM Solutions Group Inc.
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -34,14 +34,14 @@
 include('../../common/php/Utilities.php');
 
 /* the name of the layer in the map to query */
-if ( ($_REQUEST['layer'] != '') && ($_REQUEST['attribute'] != '') && ($_REQUEST['value'] != ''))  {
+if ( ($_REQUEST['layer'] != '') && ($_REQUEST['attribute'] != '') && ($_REQUEST['pattern'] != ''))  {
     $szLayer = $_REQUEST['layer'];
     $szAttribute = $_REQUEST['attribute'];
-    $szValue = $_REQUEST['value'];
+    $szPattern = $_REQUEST['pattern'];
 } 
 else 
 {
-    die('layer, attribute or value not set'); //TODO this must be enabled
+    die('layer, attribute or value not set');
 }
 
 if (!isset($mapName)) {
@@ -59,7 +59,7 @@
 
 $oLayer = $oMap->GetLayerByName($szLayer);
 
-if (@$oLayer->queryByAttributes($szAttribute,"/".$szValue."/", MS_MULTIPLE) == MS_SUCCESS) //TODO the layer name must be configurable (OWNER, MATTSON..)
+if (@$oLayer->queryByAttributes($szAttribute,$szPattern, MS_MULTIPLE) == MS_SUCCESS)
 {
     if ( ($iMatchLimit != -1) && ($oLayer->getNumResults() > $iMatchLimit) )
         $numResults = $iMatchLimit;

Modified: sandbox/aboudreault/widgets/MSSearch.js
===================================================================
--- sandbox/aboudreault/widgets/MSSearch.js	2008-03-28 19:16:09 UTC (rev 1351)
+++ sandbox/aboudreault/widgets/MSSearch.js	2008-03-28 20:33:50 UTC (rev 1352)
@@ -37,14 +37,15 @@
     oTextBox : '',
     sMatchLimit: '',
     sAttribute: '',
-    bCaseSensitive: false, //TODO insensitive case search
+    bCaseSensitive: false,
     iBoxSize: 15,
 
     initialize : function(widgetTag){
         Object.inheritFrom(this,Fusion.Widget.prototype, [widgetTag, true]);
-        Object.inheritFrom(this, Fusion.Tool.ButtonBase.prototype, []);
+       
         
         this.enable = Fusion.Widget.MSSearch.prototype.enable;
+
         var json = widgetTag.extension;
 
         this.sLayerName = json.LayerName ? json.LayerName : '';
@@ -60,9 +61,10 @@
         this.oTextBox = document.createElement('input');
         this.oTextBox.type = 'text';
         this.oTextBox.size = this.iBoxSize; 
+        this.oTextBox.className = "searchBox";
      
         this.domObj.appendChild(this.oTextBox);
-           
+        Object.inheritFrom(this, Fusion.Tool.ButtonBase.prototype, []);
     },
 
   enable : function() {
@@ -74,7 +76,9 @@
       var options = {};
       options.queryType = 'search';
       options.attribute = this.sAttribute;
-      options.value = this.oTextBox.value;
+      options.pattern = "/"+this.oTextBox.value.trim()+"/";
+      if (!this.bCaseSensitive)
+          options.pattern += "i";
       options.matchlimit = this.sMatchLimit;
       options.layer = this.sLayerName;
       



More information about the fusion-commits mailing list