Hi Valerio

you have two possibilities: 
extend the table plugin to output an extra variable to the template after a 
query. In this case the selection will appear once.
or use tableTrules, to add an extra column in the query result table, 
containing the selection coordinate.

Since the coordinates are the same for all the results, I think the first 
option is better, but feel free to experiment ^_^

option 1:

create a new plugin,
class ClientMyProjectTables extends ClientTables {    $coordinates;

    public function replacePlugin() {
        return 'tables';
    }

    public function handleHttpPostRequest($request) {      if 
(isset($request['selection_coords']) {          $this->coordinates = 
$request['selection_coords'];      }    }        protected function 
renderFormPrepare() {                    $smarty = new 
Smarty_Plugin($this->getCartoclient(), $this);            
$smarty->assign('tables', $this->tableGroups);            
$smarty->assign('queryCoordinates', $this->coordinates);                    
$this->assignExportCsv($smarty);                    return 
$smarty->fetch('tables.tpl');    }}and, if it is not already donw, overload the 
table template in your project (copy tables.tpl in 
/yourproject/coreplugins/tables/templates/) and add the new smarty variable 
inside {$queryCoordinates}

option 2:
to add extra info in a query result, you can use the tableRules system in 
cartoweb.

basically, it is a special kind of plugin that contain query result 
modifications
I have attached an exemple file, containing a basic modification (adding a html 
link in the query result table)

in the initialize() function, you define the type of action. In the exemple 
"addCellFilter" which will add new data in an extra cell in each row of the 
query result table . For a complet list of possible action, see: 
http://www.cartoweb.org/doc/cw3.3/xhtml/dev.newplugin.html#dev.newplugin.special.tables

public function addCellFilter($groupId, $tableId, $columnId,
                              $inputColumnIds, $callback)$groupId is usualy 
'query', $tableId is the name of the layer queried, $columnId is the name of 
the column, $inputColumnIds is an array containing the IDs of the columns you 
want to have at disposal when applying modification, $callback is an array 
containing a reference to the current tableRule class and the function where 
the modification will be done.this modification function must be declared 
static public. It receive as parameters ($tableId, $columnId, 
$inputValues)$tableId and $columnId are the same as described above. 
$inputValues is an associative array containing the values of the selected 
columns you passed with $inputColumnIds.then you can simply generate the 
content of the new cell. For exemple recovering the selection coordinates as I 
told you in my last email.Regards
Oliver
  ----- Original Message ----- 
  From: Valerio Noti 
  To: Oliver Christen ; [email protected] 
  Sent: Friday, February 09, 2007 9:53 AM
  Subject: Re: [Cartoweb-users] retrieve map coordinates with query tool


  Oliver,
  I added:

  if (isset($request['selection_coords']) {
      $this->coordinates = $request['selection_coords'];
  }

  in handleHttpPostRequest  in coreplugins/query/client/ClientQuery.php file 
(is the right file?)

  How can I call coordinates string from tables.tpl file if I want to display 
them with other query results?

  Thank you

  Valerio


  /*
  Valerio Noti
  [EMAIL PROTECTED]
  */
    ----- Original Message ----- 
    From: Oliver Christen 
    To: Valerio Noti ; [email protected] 
    Sent: Thursday, February 08, 2007 7:42 AM
    Subject: Re: [Cartoweb-users] retrieve map coordinates with query tool


    Hi Valerio,

    yes, each query return the coordinate of the point or selection on the map.
    you can retrieve the data from the handleHttpPostRequest ( or 
filterPostRequest, depending what you want to do with the values)
    the variable name is "selection_coords"

    for exemple, in handleHttpPostRequest :

    if (isset($request['selection_coords']) {
        $this->coordinates = $request['selection_coords'];
    }

    or in filterPostRequest :

    if ($request->getValue('selection_coords') && 
!empty($request->getValue('selection_coords'))) {
        this->coordinates = $request->getValue('selection_coords');
    }

    the coordinates are a string like this 'x,y' for point or 
'xmin,ymin;xmax,ymax;...' for box

    regards
    Oliver
      ----- Original Message ----- 
      From: Valerio Noti 
      To: [email protected] 
      Sent: Wednesday, February 07, 2007 3:23 PM
      Subject: [Cartoweb-users] retrieve map coordinates with query tool


      hello,
      is it possible to retrieve map coordinates where user clicked with query 
tool?

      Thanks in advance

      Valerio


      /*
      Valerio Noti
      [EMAIL PROTECTED]
      */


--------------------------------------------------------------------------


      _______________________________________________
      Cartoweb-users mailing list
      [email protected]
      http://lists.maptools.org/mailman/listinfo/cartoweb-users



----------------------------------------------------------------------------


    No virus found in this incoming message.
    Checked by AVG Free Edition.
    Version: 7.5.432 / Virus Database: 268.17.29/673 - Release Date: 06/02/07 
17.52
_______________________________________________
Cartoweb-users mailing list
[email protected]
http://lists.maptools.org/mailman/listinfo/cartoweb-users

Reply via email to