[Cartoweb-users] Search plugin failure

Jady jadychow at gmail.com
Mon Dec 3 21:52:40 EST 2007


Dear all,

I am using CartoWeb 3.4 and got a failure message when trying to add the
search plugin in my project.
I have set the followings:

1)  included 'search' in the loadplugins parameter on both client and server
side

2)  in client_conf/search.ini :
dbType = pgsql
dsn = pgsql://myname:mypwd@myhost:5432/mydb
encodingContext = searchDb

config.buoy.provider.type = fulltextTable
config.buoy.provider.table = buoy2
config.buoy.provider.aliases = objnam, Name
config.buoy.provider.id = gid
config.buoy.provider.columns = objnam
config.buoy.provider.fulltextColumns = objnam
config.buoy.provider.sortColumn = objnam
config.buoy.provider.sortDirection = asc
config.buoy.provider.sortPriorities = objnam
config.buoy.provider.labels = objnam
config.buoy.formatter.type = smarty
config.buoy.formatter.template = search_results

3)  in search.tpl :
  <div id="search_div">
        <fieldset><legend>{t}SearchBuoy{/t}</legend> <br/>
            <table width="100%">
                <tr>
                    <td>
                      {t}objnam: {/t}
                    </td>
                    <td>
                        <input type="text" id="search_objnam"
name="search_objnam" size="13"/> 
                    </td>
                </tr>
            </table>
            <p>
              <input type="submit" value="{t}Search{/t}"
onclick="JavaScript: CartoWeb.trigger('Search.DoIt'); return false;"/>                                    
              <input type="hidden" id="search_config" name="search_config"
value="buoy" />
              <input type="hidden" id="search_sort_column"
name="search_sort_column"/>
              <input type="hidden" id="search_sort_direction"
name="search_sort_direction" value="asc" />
              <input type="hidden" id="search_number" name="search_number"
/>

              <div id="search_results_div"></div>
            </p>
        </fieldset>
    </div>

4)  in search_results.tpl :
       {if $table->numRows > 0}
     <table >
         <tr>
           <th>{t}Id{/t}</th>
           {foreach from=$table->columnIds item=column}
           <th>  JavaScript: order('{$column}'); {t}{$column}{/t} </th>               
           {/foreach}
         </tr>
         {foreach from=$table->rows item=row}
         <tr>
            <td>{$row->rowId}</td>
            {foreach from=$row->cells item=value}
            <td> "JavaScript: recenter('{$row- rowId}');">{$value} </td>
            {/foreach}
         </tr>
         {/foreach}
     </table>
     {else}
     {t}No results{/t}
     {/if}

5)  in search.ajax.js :
  AjaxPlugins.Search = {

      handleResponse: function(pluginOutput) {
        //should be the same value as the input search_config
        if (pluginOutput.htmlCode.buoy) 
          $('search_results_div').innerHTML = pluginOutput.htmlCode.buoy;        
      }  
    };

    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 == 'buoy') {
        $('id_recenter_ids').value = id;
        $('id_recenter_layer').value = $('search_config').value;

        CartoWeb.trigger('Location.Recenter');
      } 
    }

6)  in cartoclient.tpl, I added:
     i)  {if $search_active|default:''}<script type="text/javascript"
src="{r type=js plugin=search}Search.ajax.js{/r}"></script>{/if}   //in the
head section
     ii)   {if $search_active|default:''}
      {$search}
      {/if}      //already exists


The failure message I got is:

Failure  
Class : CartoclientExceptionMessage : Empty config or config not found
Backtrace:

file: UNKNOWN - UNKNOWN
call: ClientSearch->handleHttpPostRequest(Array(55))

file: 270 - C:\ms4w\apps\cartoweb3\common\PluginManager.php
call: call_user_func_array(Array(2), Array(1))

file: 320 - C:\ms4w\apps\cartoweb3\common\PluginManager.php
call: PluginManager->callPluginImplementing(Object(ClientSearch),
"GuiProvider", "handleHttpPostRequest", Array(1))

file: 712 - C:\ms4w\apps\cartoweb3\client\Cartoclient.php
call: PluginManager->callEnabledPluginsImplementing(1, "GuiProvider",
"handleHttpPostRequest", Array(1))

file: 1033 - C:\ms4w\apps\cartoweb3\client\Cartoclient.php
call: Cartoclient->callEnabledPluginsImplementing(1, "GuiProvider",
"handleHttpPostRequest", Array(55))

file: 1261 - C:\ms4w\apps\cartoweb3\client\Cartoclient.php
call: Cartoclient->doMain()

file: 33 - C:\ms4w\apps\cartoweb3\htdocs\client.php
call: Cartoclient->main()

file: 3 - C:\ms4w\apps\cartoweb3\htdocs\test_ho.php
call: require_once("C:\ms4w\apps\cartoweb3\htdocs\client.php")


What have I missed out or done wrong?

Thank you very much for your help in advance.

Best regards,
Jady
-- 
View this message in context: http://www.nabble.com/Search-plugin-failure-tf4940812.html#a14143585
Sent from the cartoweb-users mailing list archive at Nabble.com.



More information about the Cartoweb-users mailing list