[Cartoweb-users] Troubles with tables.tpl

Oliver Christen oliver.christen at camptocamp.com
Mon Mar 17 05:59:10 EDT 2008


I think you didnt understand correctly what i said.

put an alert BEFORE and AFTER the piece of code you added in Table.ajax.js

the first alert is just to know if the file is parsed
the second is to know if it didnt silently crashed when parsing your code 
placed just before.
if the second alert doesnt show up, then something is wrong with your code.

regards
Oliver

----- Original Message ----- 
From: "Valerio Noti" <valerionoti at yahoo.it>
To: "Oliver Christen" <oliver.christen at camptocamp.com>
Cc: <cartoweb-users at lists.maptools.org>
Sent: Monday, March 17, 2008 10:54 AM
Subject: Re: [Cartoweb-users] Troubles with tables.tpl


> If I add a javascript code in Tables.ajax.js, it will works only the first 
> time.
> An alert('blabla') outputs when I click on the map with query tool the
> first time.
> no alert the second time, the same with other javascript code. It
> seems that it reads Tables.ajax.js only one time unless I reload the
> page but this would be a non-ajax use.
>
> thank you very much
>
> valerio
>
>
> 2008/3/17, Oliver Christen <oliver.christen at camptocamp.com>:
>> warning are not the problem here.
>>  but most certainly what happens just after that is what cause the 
>> problem.
>>  (the ajax implementation has some flaw as if some error occure in a 
>> plugin's
>>  ajax file, the error is not always returned)
>>
>>  I suspect what you put in Tables.ajax.js is the cause of the problem.
>>  try to add some alert('blabla') before and after the code you added and 
>> see
>>  until which point the code is executed before hanging
>>
>>  regards
>>
>> Oliver
>>
>>
>>  ----- Original Message -----
>>  From: "Valerio Noti" <valerionoti at yahoo.it>
>>  To: "Oliver Christen" <oliver.christen at camptocamp.com>
>>  Cc: <cartoweb-users at lists.maptools.org>
>>
>> Sent: Friday, March 14, 2008 4:30 PM
>>  Subject: Re: [Cartoweb-users] Troubles with tables.tpl
>>
>>
>>  > yes it was loaded before and now the error disappeared.
>>  > I'm now trying to work around Tables.ajax.js and I'm very confused.
>>  >
>>  > Modified tables.tpl in order to save a smarty parameter in a hidden 
>> input.
>>  > something like this:
>>  > <input type=hidden name=NomeTabella value="{$table->tableTitle}">
>>  >
>>  > In Tables.ajax.js I retrieve that input:
>>  >
>>  > strNomeTabella =
>>  > document.forms['carto_form'].elements['NomeTabella'].value;
>>  >
>>  > and use it to pass the value to pop-up window.
>>  > Apparently it works but I get an error in jtrace
>>  > Warning: given element (location_info) was not found in the DOM!
>>  >
>>  > and any zoomin selection remains on the map with a transparent
>>  > rectangle unless I reload the page.
>>  > Just to know if this could be a solution or if I'm on a totally wrong 
>> way.
>>  >
>>  > Thank you
>>  >
>>  > valerio
>>  >
>>  > 2008/3/14, Oliver Christen <oliver.christen at camptocamp.com>:
>>  >> be sure the Tables.ajax.js is loaded AFTER {include
>>  >>  file="cartoclient_ajaxHeader.tpl"} the <head>
>>  >>
>>  >>
>>  >>
>>  >>  ----- Original Message -----
>>  >>  From: "Valerio Noti" <valerionoti at yahoo.it>
>>  >>  To: "Oliver Christen" <oliver.christen at camptocamp.com>
>>  >>  Cc: <cartoweb-users at lists.maptools.org>
>>  >>
>>  >> Sent: Friday, March 14, 2008 2:59 PM
>>  >>  Subject: Re: [Cartoweb-users] Troubles with tables.tpl
>>  >>
>>  >>
>>  >>  > Hi Oliver,
>>  >>  > now Tables.ajax.js is loaded but javascript debugger returns this
>>  >> error:
>>  >>  >
>>  >>  > Errore: AjaxPlugins is not defined
>>  >>  > File sorgente:
>>  >>  > http://192.168.2.18/cartoweb3/htdocs/tables/js/Tables.ajax.js
>>  >>  > Riga: 1
>>  >>  >
>>  >>  > I wrote javascript code in Tables.ajax.js, it seems to work in IE, 
>> not
>>  >>  > in FF but maybe the above error is the main problem.
>>  >>  >
>>  >>  > Thanks again
>>  >>  >
>>  >>  > valerio
>>  >>  >
>>  >>  >
>>  >>  >
>>  >>  >
>>  >>  > 2008/3/14, Oliver Christen <oliver.christen at camptocamp.com>:
>>  >>  >> Warning: AjaxHandler.handlePluginReponse(): object 
>> AjaxPlugins.Tables
>>  >>  >>
>>  >>  >>
>>  >>  >> this means the file Tables.ajax.js is not loaded
>>  >>  >>  look in your page source, see what the url to that is and try to
>>  >> access
>>  >>  >> it
>>  >>  >>  directly with your browser
>>  >>  >>
>>  >>  >>  if you just copied it in your project, dont forget to do a
>>  >>  >>  cw3setup --install again so the paths are regenerated
>>  >>  >>
>>  >>  >>  regards
>>  >>  >>
>>  >>  >> Oliver
>>  >>  >>
>>  >>  >>
>>  >>  >>  ----- Original Message -----
>>  >>  >>  From: "Valerio Noti" <valerio.noti at gmail.com>
>>  >>  >>  To: "Oliver Christen" <oliver.christen at camptocamp.com>
>>  >>  >>  Cc: <cartoweb-users at lists.maptools.org>
>>  >>  >>
>>  >>  >> Sent: Friday, March 14, 2008 10:38 AM
>>  >>  >>  Subject: Re: [Cartoweb-users] Troubles with tables.tpl
>>  >>  >>
>>  >>  >>
>>  >>  >>  > ok, I'm not sure I'll be able to work around Table.ajax.js 
>> (don't
>>  >> know
>>  >>  >>  > ajax) but prior to any change I get an error from Jtrace 
>> debugger:
>>  >>  >>  >
>>  >>  >>  > Warning: AjaxHandler.handlePluginReponse(): object
>>  >> AjaxPlugins.Tables
>>  >>  >>  > not found. AJAX response processing will be ignored for this
>>  >> plugin.
>>  >>  >>  >
>>  >>  >>  > not a good message I think. I have Table.ajax.js in
>>  >>  >>  > cartoweb3\coreplugins\tables\htdocs\js and tried to copy also 
>> in
>>  >>  >>  > cartoweb3\projects\MyProject\coreplugins\tables\htdocs\js.
>>  >>  >>  >
>>  >>  >>  > actually any change to that file (a simple alert) doesn't 
>> work.
>>  >>  >>  >
>>  >>  >>  > thank you very much for your help
>>  >>  >>  >
>>  >>  >>  > valerio
>>  >>  >>  >
>>  >>  >>  >
>>  >>  >>  >
>>  >>  >>  > 2008/3/14, Oliver Christen <oliver.christen at camptocamp.com>:
>>  >>  >>  >>
>>  >>  >>  >>
>>  >>  >>  >> well, then it's absolutly normal your javascript is NOT
>>  >> executed.
>>  >>  >>  >>
>>  >>  >>  >> because the table html is loaded via ajax and the javascript
>>  >> INSIDE
>>  >>  >> the
>>  >>  >>  >> html are considered as text and NOT interpreted.
>>  >>  >>  >>
>>  >>  >>  >> if you want to execute some javascript code imported via ajax 
>> in
>>  >> an
>>  >>  >> html
>>  >>  >>  >> fragment , you have to explicitly call (initialize)  it from 
>> the
>>  >>  >>  >> handleResponse function in Table.ajax.js
>>  >>  >>  >>
>>  >>  >>  >> regards
>>  >>  >>  >> Oliver
>>  >>  >>  >>
>>  >>  >>  >> ----- Original Message -----
>>  >>  >>  >> From:    Valerio    Noti
>>  >>  >>  >> To: Oliver Christen
>>  >>  >>  >> Cc: cartoweb-users at lists.maptools.org
>>  >>  >>  >>
>>  >>  >>  >> Sent: Friday, March 14, 2008 9:56  AM
>>  >>  >>  >> Subject: Re: [Cartoweb-users] Troubles    with tables.tpl
>>  >>  >>  >>
>>  >>  >>  >> Oliver,
>>  >>  >>  >> yes it's in ajax mode and if I disable ajax,    javascript 
>> code
>>  >> works
>>  >>  >>  >> inside the tpl . If it's active it works only when I 
>> reload
>>  >> the
>>  >>  >> page.
>>  >>  >>  >> Any tips? or other ways to retrieve query information and 
>> open
>>  >> a
>>  >>  >> pop
>>  >>  >>  >> up window?
>>  >>  >>  >>
>>  >>  >>  >> valerio
>>  >>  >>  >>
>>  >>  >>  >>
>>  >>  >>  >> 2008/3/13, Oliver Christen <oliver.christen at camptocamp.com>:
>>  >>  >>  >> >
>>  >>  >>  >> >
>>  >>  >>  >> > you use your project in ajax mode now ?
>>  >>  >>  >> >
>>  >>  >>  >> > -----        Original Message -----
>>  >>  >>  >> > From:        Valerio Noti
>>  >>  >>  >> >
>>  >>  >>  >> > To:        Oliver        Christen
>>  >>  >>  >> > Cc:        cartoweb-users at lists.maptools.org
>>  >>  >>  >> > Sent:        Thursday, March 13, 2008 4:42 PM
>>  >>  >>  >> > Subject:        Re: [Cartoweb-users] Troubles with 
>> tables.tpl
>>  >>  >>  >> >
>>  >>  >>  >> > I tested democw3 tables.tpl in cw3.2 and 3.4
>>  >>  >>  >> > This code        works in 3.2 each time I click on the map 
>> with
>>  >>  >> query
>>  >>  >>  >> > tool. In 3.4 it works        only when I reload the page, 
>> when
>>  >> I
>>  >>  >> use
>>  >>  >>  >> > query tool alert doesn't        appear.
>>  >>  >>  >> >
>>  >>  >>  >> > [...]
>>  >>  >>  >> > {if $table->numRows >        0}
>>  >>  >>  >> > <script        language=javascript>
>>  >>  >>  >> >                {literal}
>>  >>  >>  >> >
>>  >>  >>  >> >            alert        ('Test');
>>  >>  >>  >> >                {/literal}
>>  >>  >>  >> > </script>
>>  >>  >>  >> > [...]
>>  >>  >>  >> >
>>  >>  >>  >> > Thank you        again
>>  >>  >>  >> >
>>  >>  >>  >> > Valerio
>>  >>  >>  >> >
>>  >>  >>  >> >
>>  >>  >>  >> >
>>  >>  >>  >> >
>>  >>  >>  >> >
>>  >>  >>  >> >
>>  >>  >>  >> > 2008/3/13, Valerio Noti <valerionoti at yahoo.it>:
>>  >>  >>  >> > > yes          it's what I did, I copied
>>  >>  >> /coreplugins/tables/templates
>>  >>  >>  >> > > folder in
>>  >>  >> projects/MyProject/coreplugins/tables/templates
>>  >>  >>  >> > > folder, modified 3.4          template and inserted
>>  >> javascript
>>  >>  >> code
>>  >>  >>  >> > > between          {foreach}{/foreach}
>>  >>  >>  >> > >
>>  >>  >>  >> > > thank you
>>  >>  >>  >> > >
>>  >>  >>  >> > >
>>  >>  >>  >> > > 2008/3/13, Oliver Christen 
>> <oliver.christen at camptocamp.com>:
>>  >>  >>  >> > >
>>  >>  >>  >> > > >
>>  >>  >>  >> > > >
>>  >>  >>  >> > > > chance are pretty high the table template was
>>  >>  >> modified
>>  >>  >>  >> > > > between 3.2 and 3.4 so I would suggest to compare a 
>> table
>>  >>  >>  >> > > > templates in 3.4 and use it as a basis
>>  >>  >>  >> > > >
>>  >>  >>  >> > > > regards
>>  >>  >>  >> > > > Oliver
>>  >>  >>  >> > > >
>>  >>  >>  >> > > >
>>  >>  >>  >> > > > -----              Original Message -----
>>  >>  >>  >> > > > From:              Valerio Noti
>>  >>  >>  >> > > > To:              cartoweb-users at lists.maptools.org
>>  >>  >>  >> > > > Sent:              Thursday, March 13, 2008 3:53 PM
>>  >>  >>  >> > > > Subject:              [Cartoweb-users] Troubles with
>>  >> tables.tpl
>>  >>  >>  >> > > >
>>  >>  >>  >> > > > Hello,
>>  >>  >>  >> > > > I usually modify tpl files inserting
>>  >> javascript
>>  >>  >> code.
>>  >>  >>  >> > > > i.e. I modified tables.tpl in order to open a
>>  >>  >> pop-up
>>  >>  >>  >> > > > windows when user click on the map with query
>>  >>  >> tool.
>>  >>  >>  >> > > >
>>  >>  >>  >> > > > The following code works fine in cartoweb 3.2 but not
>>  >>  >>  >> > > > in cw3.4:
>>  >>  >>  >> > > > [...]
>>  >>  >>  >> > > > {foreach from=$tables item=group}
>>  >>  >>  >> > > > foreach              from=$group->tables item=table}
>>  >>  >>  >> > > > {if $table->numRows >              0}
>>  >>  >>  >> > > > <script              language=javascript>
>>  >>  >>  >> > > >                      {literal}
>>  >>  >>  >> > > >                      strNomeTabella =
>>  >>  >>  >> > > > '{/literal}{$table->tableTitle
>>  >>  >>  >> > > > }{literal}';
>>  >>  >>  >> > > >                      alert ('Test');
>>  >>  >>  >> > > >                      {/literal}
>>  >>  >>  >> > > > </script>
>>  >>  >>  >> > > >      {foreach              from=$table->columnTitles
>>  >>  >>  >> > > > item=column}
>>  >>  >>  >> > > >       <script              language=javascript>
>>  >>  >>  >> > > >                            {literal}
>>  >>  >>  >> > > >                                var campo =
>>  >>  >>  >> > > > '{/literal}{$column}{literal}';
>>  >>  >>  >> > > >                            {/literal}
>>  >>  >>  >> > > >                    </script>
>>  >>  >>  >> > > >                    {/foreach}
>>  >>  >>  >> > > > [...]
>>  >>  >>  >> > > > {/foreach}
>>  >>  >>  >> > > > {/foreach}
>>  >>  >>  >> > > >
>>  >>  >>  >> > > > In cw3.4 it              seems that javascript code is 
>> not
>>  >>  >> active.
>>  >>  >>  >> > > > Nothing is saved in              variables and alert
>>  >> statement
>>  >>  >>  >> > > > doesn't work.
>>  >>  >>  >> > > >
>>  >>  >>  >> > > >
>>  >>  >>  >> > > >
>>  >>  >>  >> > > > Thank you              very much for any 
>> help
>>  >>  >>  >> > > >
>>  >>  >>  >> > > >
>>  >>  >>  >> > > > Valerio
>>  >>  >>  >> > > >
>>  >>  >>  >> > > >              ________________________________
>>  >>  >>  >
>>  >>  >>  >> > > >
>>  >>  >>  >> > > > _______________________________________________
>>  >>  >>  >> > > > Cartoweb-users              mailing list
>>  >>  >>  >> > > > Cartoweb-users at lists.maptools.org
>>  >>  >>  >> > > > 
>> http://lists.maptools.org/mailman/listinfo/cartoweb-users
>>  >>  >>  >> > > >
>>  >>  >>  >> > > >
>>  >>  >>  >> > > >
>>  >>  >>  >> > >
>>  >>  >>  >> > >
>>  >>  >>  >> > >
>>  >>  >>  >> > > --
>>  >>  >>  >> > > /*
>>  >>  >>  >> > > Valerio Noti
>>  >>  >>  >> > > */
>>  >>  >>  >> >
>>  >>  >>  >> >
>>  >>  >>  >> >
>>  >>  >>  >> > --
>>  >>  >>  >> > /*
>>  >>  >>  >> > Valerio        Noti
>>  >>  >>  >> > */
>>  >>  >>  >>
>>  >>  >>  >>
>>  >>  >>  >>
>>  >>  >>  >> --
>>  >>  >>  >> /*
>>  >>  >>  >> Valerio Noti
>>  >>  >>  >> */
>>  >>  >>  >
>>  >>  >>  >
>>  >>  >>  >
>>  >>  >>  > --
>>  >>  >>  > /*
>>  >>  >>  > Valerio Noti
>>  >>  >>  > */
>>  >>  >>  >
>>  >>  >>
>>  >>  >>
>>  >>  >
>>  >>  >
>>  >>  > --
>>  >>  > /*
>>  >>  > Valerio Noti
>>  >>  > */
>>  >>  >
>>  >>
>>  >>
>>  >
>>  >
>>  > --
>>  > /*
>>  > Valerio Noti
>>  > */
>>  >
>>
>>
>
>
> -- 
> /*
> Valerio Noti
> */
> 



More information about the Cartoweb-users mailing list