[Cartoweb-users] StatsReports plugins : error in javascript

Oliver Christen oliver.christen at camptocamp.com
Wed May 20 01:11:44 EST 2009


Hi Bruno

I would advice you to NOT use database storage for accounting, because there 
is at the moment no simple way to use the logs in db directly with the 
statsReport plugin (direct db usage was simply not implemented as nobody 
paid for it)
you certainly can use it but you will need to make your own "DB to text 
file" export script to be able to use the logs

the logs contain the project info, so once the logs are imported using the 
java's commands explained in the documentation and the reports configured 
and initiated (also using the java's commands explained in the 
documentation ), the list of projects are listed as a dropdown option in the 
report visualisation interface in cartoweb.

if you only want to allow the user to see the stats for one projects, you 
can certainly do so by extending a bit the way the projects dropdown option 
is populated, using the auth plugin.

but you can also differenciate the logs before import and use a different 
table namespace (using --tableName when importing) , but then you will need 
to set up as many cartoweb project as you have of different logs to 
visualize, as the database access dsn will be different (the statsReport 
only accept one dsn at the moment, but then you can always modify the plugin 
to suit your needs). in my opinion this would be more work than the first 
option.

I hope i wasnt too confusing

regards
Oliver

> Thank you Oliver, I will give it a try in some days.
>
> As I'm reading, and understanding how it works, a question has emerged.
>
> Do you think it would be a good idea to store all accounting inside a 
> dedicated db
> with one table for each project doing accounting.
> I've a simple storage engine as file doing this (or as the db stats are 
> made)
> use the stats scripts against this db to populate the different project.
>
> and after that, build a special project dedicated to have the reports
> choosing them project by project ?
>
>
>
> Oliver Christen wrote:
>> I commited into cvs the missing js and template header elements and also
>> completed the documentation. the elements in the body of the template
>> still need to be added by hand, but thats explained in the doc.
>>
>> regards
>> Oliver
>>
>>
>>> Thank you Oliver.
>>>
>>> I've also seen that this plugin doesn't support the traditionnale
>>> {if}statsReports|default ...
>>> to activate css/js div only if the plugin is active.
>>>
>>> I should hack it but if you goes to a review, I prefer let you done 
>>> this.
>>>
>>>
>>> Oliver Christen wrote:
>>>> Hi Bruno
>>>>
>>>> indeed, I just had the same error a moment ago as im also installing
>>>> that plugin in a new project
>>>>
>>>> it seems that plugin has not been used much since it was added...
>>>>
>>>> there is a missing javascript function and also some missing template
>>>> elements.
>>>>
>>>> here is the missing function:
>>>>
>>>> function toggleGeneratedResult(action) {
>>>>    if (action == 'show') {
>>>>        $('generated_result').innerHTML = '';
>>>>        $('generated_result').show();
>>>>    } else {
>>>>        $('generated_result').hide();
>>>>    }
>>>> }
>>>>
>>>> and the missing template elements (to put into the cartoclient.tpl):
>>>>
>>>> <div id="generated_result" name="generated_result" style="display:
>>>> none"></div>
>>>> and
>>>> <div id="statscvslink"></div>
>>>>
>>>> I will complet the documentation and add the missing elements into cvs
>>>> after a few tests
>>>>
>>>> regards
>>>> Oliver
>>>>
>>>> ----- Original Message ----- From: "Bruno Friedmann" 
>>>> <bruno at ioda-net.ch>
>>>> To: <cartoweb-users at lists.maptools.org>
>>>> Sent: Monday, May 18, 2009 11:42 AM
>>>> Subject: [Cartoweb-users] StatsReports plugins : error in javascript
>>>>
>>>>
>>>>> When we try to get the result there's an error coming from javascript
>>>>>
>>>>> Updating GUI for plugin StatsReports
>>>>> Error: An error occured in Plugins StatsReports
>>>>> Error: Message:
>>>>>
>>>>> ReferenceError:
>>>>> toggleGeneratedResult is not defined
>>>>>
>>>>> in file:
>>>>> http://mycw/statsReports/js/statsReports.js
>>>>>
>>>>> on line:
>>>>> 34
>>>>>
>>>>>
>>>>> toggleGeneratedResult('hide');
>>>>>
>>>>>
>>>>> Did someone has already a working installation ?
>>>>>
>>>>>
>>>>>
>
>
> -- 
>
>     Bruno Friedmann
>
>
> 



More information about the Cartoweb-users mailing list