<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hello,<br>
<br>
if you are in development mode, when an error occurs, an alert box is
displayed and allows you to print the cartoweb error message. Can you
post this error message?<br>
<br>
Regards,<br>
Damien<br>
<br>
<br>
<a class="moz-txt-link-abbreviated" href="mailto:veroh@bluewin.ch">veroh@bluewin.ch</a> wrote:
<blockquote
 cite="mid4600407.692851176799710599.JavaMail.webmail@lps6zhh.bluewin.ch"
 type="cite">
  <pre wrap="">Hello,

I am trying to implement the plugin search in my project but I got 
the following error

--- Action Search.DoIt triggered ---

Calling Search.DoIt onBeforeAjaxCall()

Calling AjaxPlugins.Common.onBeforeAjaxCall()
Initiating AJAX request
Pending actions: 1
GET params:
ajaxActionRequest=Search.DoIt&amp;
POST params:

posted=1&amp;js_folder_idx=5&amp;js_toolbar_idx=&amp;selection_type=&amp;selection_coords=&amp;features=&amp;js_accounting=version=0;
hasJava=true;winInnerWidth=1024;winInnerHeight=578;screenWidth=1024;
screenHeight=768;screenColorDepth=32&amp;outline_label_text=votre 
titre&amp;tool=zoomin&amp;project=n16&amp;recenter_x=&amp;recenter_y=&amp;recenter_doit=0&amp;shortcut_doit=0&amp;openNodes=&amp;layers
[]=OPA&amp;layers[]=OPB&amp;layers[]=OPC&amp;layers[]=OPD&amp;layers[]=OPE&amp;layers[]
=OPF&amp;layers[]=OPG&amp;layers[]=OPH&amp;layers[]=N16&amp;layers[]
=POSTGIS_MAJ&amp;layers[]=EDITPOINT&amp;layers[]=EDITPOLY&amp;layers[]
=EDITLINE&amp;pdfMarginX=20&amp;pdfMarginY=20&amp;pdfA4x=210&amp;pdfA4y=297&amp;pdfA3x=297&amp;pdfA3y=420&amp;pdfOrientation=portrait&amp;pdfMapAngle=&amp;pdfMapCenterX=&amp;pdfMapCenterY=&amp;pdfTitle=&amp;pdfNote=&amp;pdfScalebar=&amp;pdfLegend=0&amp;viewTitle=&amp;author=&amp;handleView=0&amp;locate_MAJ=&amp;locate_MAJ2=&amp;id_recenter_ids=&amp;search_mandat_n16=N2354&amp;search_travaux=&amp;search_date_txt=&amp;search_en_cours=&amp;search_config=&amp;search_sort_column=&amp;search_sort_direction=asc&amp;search_number=&amp;outline_mask=no&amp;outline_point_symbol=circle&amp;outline_point_size=10&amp;outline_line_size=3&amp;outline_line_transparency=100&amp;outline_polygon_transparency=60&amp;edit_validate_all=0&amp;recenter_scale=0&amp;shortcut_id=-
1&amp;mapsize=1&amp;pdfFormat=A4&amp;pdfResolution=96&amp;pdfScale=2500&amp;id_recenter_layer=MAJ&amp;edit_layer=0&amp;
Waiting for response...
Response received!
Error: AjaxHandler.actionRequest(): received response is 
malformed!

I have a search.ini file in my client_conf :

config.POSTGIS_MAJ.provider.type = fulltextTable
config.POSTGIS_MAJ.provider.table = maj2
config.POSTGIS_MAJ.provider.id = gid
config.POSTGIS_MAJ.provider.columns = mandat_n16, travaux, 
date_txt, en_cours
config.POSTGIS_MAJ.provider.fulltextColumns = mandat_n16, travaux, 
date_txt, en_cours
config.POSTGIS_MAJ.provider.sortColumn = date_txt
config.POSTGIS_MAJ.provider.sortDirection = asc
config.POSTGIS_MAJ.provider.sortPriorities = date_txt, mandat_n16, 
travaux, en_cours
config.POSTGIS_MAJ.provider.labels = mandat_n16, travaux, date_txt, 
en_cours

config.POSTGIS_MAJ.formatter.type = smarty
config.POSTGIS_MAJ.formatter.template = search_results

Where POSTGIS is the layer I declared in my MAP file which is a 
POSTGRESQL/POSTGIS table (maj2) and gid is the 'id_attribute_string'

I have also one in the server_side :

dbType = pgsql
dsn = pgsql://postgres:afgan6@localhost:5432/demo_n16

config.POSTGIS_MAJ.provider.type = fulltextTable
config.POSTGIS_MAJ.provider.table = maj2
config.POSTGIS_MAJ.provider.id = gid
config.POSTGIS_MAJ.provider.columns = mandat_n16, travaux, 
date_txt, en_cours
config.POSTGIS_MAJ.provider.fulltextColumns = mandat_n16, travaux, 
date_txt, en_cours
config.POSTGIS_MAJ.provider.sortColumn = date_txt
config.POSTGIS_MAJ.provider.sortDirection = asc
config.POSTGIS_MAJ.provider.sortPriorities = date_txt, mandat_n16, 
travaux, en_cours
config.POSTGIS_MAJ.provider.labels = mandat_n16, travaux, date_txt, 
en_cours

config.POSTGIS_MAJ.formatter.type = smarty
config.POSTGIS_MAJ.formatter.template = search_results

I modified my cartoclient.tpl by adding two lines

{if $search_active|default:''}&lt;script type="text/javascript" src="
{r type=js plugin=search}Search.ajax.js{/r}"&gt;&lt;/script&gt;{/if}
which is just after the one for the Ajax ({if $ajaxOn|default:''} 
etc..)
and in the div="container", I added in one of my div=folder : 
{if $search_active|default:''} {$search} {/if}

I got in templates, two files :

search.tpl:

&lt;div id="search_div"&gt;
        &lt;fieldset&gt;
                &lt;legend&gt;{t}Search{/t}
                &lt;/legend&gt;
                &lt;br/&gt;
                &lt;table width="100%"&gt;
                        &lt;tr&gt;
                        &lt;td&gt;
                                {t}Mandat: {/t}
                        &lt;/td&gt;
                        
                        &lt;td&gt;
                                &lt;input type="text" id="search_mandat_n16" name="
search_mandat_n16" size="13"/&gt;
                        &lt;/td&gt;
                        &lt;/tr&gt;
                        
                        &lt;tr&gt;
                        &lt;td&gt;
                                {t}Type de travaux: {/t}
                        &lt;/td&gt;
                        
                        &lt;td&gt;
                                &lt;input type="text" id="search_travaux" name="search_travaux" 
size="13"/&gt;
                        &lt;/td&gt;
                        &lt;/tr&gt;

                        &lt;tr&gt;
                        &lt;td&gt;
                                {t}Date: {/t}
                        &lt;/td&gt;
                        
                        &lt;td&gt;
                                &lt;input type="text" id="search_date_txt" name="search_date_txt" 
size="13"/&gt;
                        &lt;/td&gt;
                        &lt;/tr&gt;                        
                        
                        &lt;tr&gt;
                        &lt;td&gt;
                                {t}En cours ou non: {/t}
                        &lt;/td&gt;
                        
                        &lt;td&gt;
                                &lt;input type="text" id="search_en_cours" name="search_en_cours" 
size="13"/&gt;
                        &lt;/td&gt;
                        &lt;/tr&gt;
                &lt;/table&gt;
                
                &lt;p&gt;
                        &lt;input type="submit" value="{t}Search{/t}" class="form_button" 
onclick="Javascript: CartoWeb.trigger('Search.DoIt'); return false;" 
/&gt;
                        &lt;input type="hidden" id="search_config" name="search_config" /&gt;
                        &lt;input type="hidden" id="search_sort_column" name="
search_sort_column" /&gt;
                        &lt;input type="hidden" id="search_sort_direction" name="
search_sort_direction" value="asc" /&gt;
                        &lt;input type="hidden" id="search_number" name="search_number" /&gt;
                                        
                        &lt;div id="search_results_div"&gt;
                        &lt;/div&gt;
                &lt;/p&gt;
        &lt;/fieldset&gt;
&lt;/div&gt;

and search_results.tpl

{if $table-&gt;numRows &gt; 0}
        &lt;table class="n16table"&gt;
                &lt;tr&gt;
                        &lt;th&gt;
                                {t}Id{/t}
                        &lt;/th&gt;
                        {foreach from=$table-&gt;columnIds item=column}
                                &lt;th&gt;
                                        &lt;a href="Javascript: order('{$column}');"&gt;{t}{$column}{/t}
&lt;/a&gt;
                                &lt;/th&gt;
                        {/foreach}
                &lt;/tr&gt;
                
                {foreach from=$table-&gt;rows item=row}
                &lt;tr&gt;
                {foreach from=$row-&gt;cells item=value}
                &lt;td&gt;
                        &lt;a href="Javascript: recenter('{$row-&gt;rowId}');"&gt;{$value}&lt;/a&gt;
                &lt;/td&gt;
                {/foreach}
                &lt;/tr&gt;
                {/foreach}
        &lt;/table&gt;
{else}
{t}No results{/t}
{/if}


Last but not least, I got the js ! Namely Search.ajax.js

AjaxPlugins.Search = {
  
    handleResponse: function(pluginOutput) {
        
        if (pluginOutput.htmlCode.POSTGIS_MAJ)
            $('search_results').innerHTML = pluginOutput.htmlCode.
POSTGIS_MAJ;
                        }
                        };


/*
 * Search plugin's Actions
 */
 
AjaxPlugins.Search.Actions = {};

AjaxPlugins.Search.Actions.DoIt = {

    buildPostRequest: function(argObject) {
        return AjaxHandler.buildPostRequest();
    }
};

function order(column) {
    
    if (column != $('search_sort_column').value){
        $('search_sort_column').value = column;
        $('search_sort_direction').value = 'asc';
        } else {
        if ($('search_sort_direction').value == 'asc') {
        $('search_sort_direction').value = 'desc';
        } else {
        $('search_sort_direction').value = 'asc';
        }
        }
    
    CartoWeb.trigger('Search.DoIt');
}

function recenter(id) {
        if ($('search_config').value == 'POSTGIS_MAJ') {
    $('id_recenter_ids').value = gid; //id to recenter
        $('recenter_scale').value = 1000; //scale for recentering
        $('recenter_doit').value = '1';
    
    CartoWeb.trigger('Location.Recenter');
}

I guess you now know all I did. Could someone please tell me what 
is wrong.

Apparently, someone else asked the same thing last month but no 
final answer was given on the mail list.

PS : Yes, I did clean all the file before trying

VĂ©ronique

_______________________________________________
Cartoweb-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Cartoweb-users@lists.maptools.org">Cartoweb-users@lists.maptools.org</a>
<a class="moz-txt-link-freetext" href="http://lists.maptools.org/mailman/listinfo/cartoweb-users">http://lists.maptools.org/mailman/listinfo/cartoweb-users</a>
  </pre>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
<style>
<!--
.signature {
  font-family:verdana,helvetica,sans-serif;
  font-size:0.8em;
  line-height: 1.25em;
  color: #9999BB;
  width: 27em;
}

.signature div {
  padding: 0.22em;
  margin-bottom: 0.5em;
  margin-top: 0.5em;
  border-bottom: 1px dotted lightgray;
  background-color: #FCFCFF;
}

.signature .attention {
  background-color: #FFFAFA;
  color: #FFBBBB;
  font-size: 0.8em;
  font-weight: bold;
}

.header {
}
-->
</style>
<div class="signature">
<div> <span style="font-weight: bold;">Camptocamp SA</span><br>
Damien Corpataux<br>
PSE A<br>
CH-1015 Lausanne<br>
</div>
<div> +41 21 619 10 22 <span class="header">(Direct)</span><br>
+41 21 619 10 10 <span class="header">(Centrale)</span><br>
+41 21 619 10 00 <span class="header">(Fax)</span><br>
</div>
<div style="color: rgb(102, 204, 102);"> <span
 style="position: relative; top: -3px; font-family: Webdings; font-size: 24pt;">P</span>
<span style="">Please consider the environment <br>
Do you really need to print this email?</span>
</div>
</div>
</div>
</body>
</html>