matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.81k stars 2.64k forks source link

Allow Email Reports to be sent in HTML #2318

Closed julienmoumne closed 12 years ago

julienmoumne commented 13 years ago

See /trac/ticket/151#comment:11

Actions :

julienmoumne commented 13 years ago

Attachment: gmail-piwik-logo.jpg

julienmoumne commented 13 years ago

Attachment: gmail-browsers.jpg

julienmoumne commented 13 years ago

Attachment: msn-piwik-logo.jpg

julienmoumne commented 13 years ago

Attachment: msn-browsers.jpg

julienmoumne commented 13 years ago

Attachment: outlook2010-piwik-logo.jpg

julienmoumne commented 13 years ago

Attachment: outlook2010-browsers.jpg

julienmoumne commented 13 years ago

Attachment: thunderbird3piwik-logo.jpg

julienmoumne commented 13 years ago

Attachment: thunderbird3-browsers.jpg

julienmoumne commented 13 years ago

Attachment: yahoomail-piwik-logo.jpg

julienmoumne commented 13 years ago

Attachment: yahoomail-browsers.jpg

julienmoumne commented 13 years ago

Attachment: fixes#2318#2320.patch

julienmoumne commented 13 years ago

I have almost finished working on this ticket.

Images (Piwik logo, browser logos, ..) in emails have to link to a Piwik instance so they can be downloaded by email clients.

Should we add a config option with the URL of the piwik instance to use ? Or should we use

$_SERVER['SERVER_NAME']

or some sort?

julienmoumne commented 13 years ago

I understand changing file names of a plugin is virtually impossible. (PDFReports -> EmailReports).

However, Is it ok to change

'name' => 'Pdf Export Plugin',

to

'name' => 'Email Report Plugin',

?

Same goes for

'PDFReports_PluginDescription' => 'Create and download your custom PDF reports, and have them emailed daily, weekly or monthly.',

'PDFReports_DefaultPDFContainingAllReports' => 'Default PDF containing all available reports.',

and many others

?

What about translations ?

robocoder commented 13 years ago

Replying to JulienM:

Should we add a config option with the URL of the piwik instance to use ? Or should we use

$_SERVER['SERVER_NAME']

or some sort?

See Piwik_Url.

robocoder commented 13 years ago

re: comment:2 it's easy to rename a plugin but a bit messy for the update script, and a PITA for translators.

That said, since pdf reports can also be downloaded, I would prefer simply "Reports".

julienmoumne commented 13 years ago

Piwik_Url is what I was looking for thanks.

"Reports" is more correct indeed.

For translations, how about removing the translation for other languages so it appears as "not translated" in the translation ui ?

julienmoumne commented 13 years ago

I've read the code managing database updates. I understand there is a way for plugins to define database updates the same way core does.

I have to add 'format' column to the pdf table. Should this go in core or plugin DB updates ?

robocoder commented 13 years ago

core/Updates/

mattab commented 13 years ago

Excellent work mate...!

I tested report for komodo island and it worked well :)

Some feedback:

julienmoumne commented 13 years ago

Now the ground work is done it's very easy to add new formats. I'm going to implement Piwik_ReportRenderer_Odt (using http://www.odtphp.com/) if that's ok.

julienmoumne commented 13 years ago
robocoder commented 13 years ago

It looks like the ODTPHP is license incompatible with the GPLv3. Also, development on the library seems to have tapered off -- what version of the Open Document Format does it support?

In the meantime, feel free to add support for odt, but check for the presence of the library in the event we can't include the library in the distribution.

julienmoumne commented 13 years ago

How about http://phpdocwriter.sourceforge.net/ ?

robocoder commented 13 years ago

phpdocwriter is LGPL (ok), but also hasn't been updated in a while.

If odtphp is a better library, you could try asking the devs to update the license (eg from "GPLv2" to "GPLv2 or above").

julienmoumne commented 13 years ago

phpdocwriter generates .sxw files [http://phpdocwriter.sourceforge.net/phpdocwriter/examples/ex6.php] so I'm going to send an email to the developers of ODTPHP

julienmoumne commented 13 years ago

On this page [they link to http://www.gnu.org/copyleft/gpl.html.

In [they also link to http://www.gnu.org/copyleft/gpl.html.

[http://www.gnu.org/copyleft/gpl.html] seems to be v3.

Do they only need to update the text in [http://www.odtphp.com/index.php?i=credits] from

OdtPHP is released under the terms of the GNU Public License. To get more informations about the GPL license, click here. 

to

OdtPHP is released under the terms of the GNU Public License. To get more informations about the GPLv3 license, click here. 

?

robocoder commented 13 years ago

It must have been the sleep deprivation -- I swear I saw "v2" somewhere. Thanks for double checking. Go head.

julienmoumne commented 13 years ago

I'm running into a bit of trouble with that library.

To zip/unzip odt data they use the PclZip library.

With the latest packaged version (1.0.1) it is not possible to override the temp directory used by PclZip.

Looking at the latest revision http://odtphp.svn.sourceforge.net/viewvc/odtphp?view=revision&revision=51 second point:

- Option to choose tmp directory by appplication works correctly now

shows they have fixed the issue.

However, it has not been packaged yet.

Should I update the file myself or drop the idea of having odt export for lack of quality libraries?

robocoder commented 13 years ago

grab the latest from their svn

julienmoumne commented 13 years ago

I should have investigated before. This library doesn't allow table generation with a variable number of columns.

They suggest to use http://pear.php.net/package/OpenDocument/

julienmoumne commented 13 years ago

No table support in this library.

mattab commented 13 years ago

As per discussion I think safer not to implement ODT at this point.

julienmoumne commented 13 years ago

Updates:

julienmoumne commented 13 years ago

Here is the proposed patch

mattab commented 13 years ago

Feedback

After these modifications, OK to commit. Very good code, great work Julien!! :)

TODO post commit

(I can do it when this is committed)

julienmoumne commented 13 years ago

(In [4512]) fixes #2318 #2320

robocoder commented 13 years ago

(In [4516]) refs #2318

mattab commented 13 years ago

(In [4517]) refs #2318 Prevent "Notice undefined index" for existing (PDF) reports

mattab commented 13 years ago

(In [4518]) refs #2318 xss protection + working if piwik installed in sub dir (eg. in http://localhost/piwik)

mattab commented 13 years ago

(In [4519]) Adding link on logo. refs #2318 I think this feature is done, kuddos Julien! I will just try and add integratio tests on the html output

mattab commented 13 years ago

Reopening, to not forget: HTML wont work correctly when sent from cron, since the hostname can't be read most of the time. We need to record the piwik hostname+path in a flag in the DB, that would be used in place in $smarty->assign("currentPath", Piwik_Url::getCurrentUrlWithoutFileName() );

mattab commented 13 years ago

(In [4552]) Fixes #2318, #2325 - URL will be checked for in each piwik request to UI and API (not tracker), and will be set if not already set. then, we use this URL for the HTML email images & link to the piwik reports

mattab commented 13 years ago

(In [4568]) Fixing Notice:</strong> <i>Undefined variable: reportFont</i> in <b>/home/www/dev5.piwik.org/core/ReportRenderer/Pdf.php</b> on line <b>95</b> Refs #2318

mattab commented 13 years ago

Regression in PDF: in Greek for example, letters now appear as ???? after 1.4-rc2 upgrade (reproducible on localhost). Before, it used to display OK. Maybe a refactoring miss out?

julienmoumne commented 13 years ago

(In [4577]) fixes #2318 refs #2320 : revert font to the one used before trying to make style uniform

julienmoumne commented 13 years ago

(In [4619]) refs #2318 fixing font-size incorrectly interpreted in gmail

julienmoumne commented 13 years ago

(In [4659]) refs #2318 font & size enhancements

julienmoumne commented 13 years ago

(In [5313]) refs #2318 fix for r4518, xss protection broke URLs in HTML Reports, applying same protection as in datatable_cell.tpl

julienmoumne commented 12 years ago

(In [5415]) fixes #2706

julienmoumne commented 12 years ago

(In [5582]) * fixes #2706, #2828, #2704, refs #1721, #2637, #2711, #2318, #71 : horizontal static graph implemented