Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#760 closed New feature (fixed)

Changes to 'Basic HTML' format

Reported by: vipsoft Owned by: vipsoft
Priority: low Milestone: Piwik 0.4.1
Component: Core Keywords:
Cc: Sensitive:

Description

Drop styling. Developers will apply their own theme anyways.

  • Drop <style>...</style> from output
  • Remove <b></b> tags
  • Drop border and width attributes from <table> definition

Recommended changes:

  • Enclose attribute values in double quotes.
  • Separate header and body using <thead></thead> and <tbody></tbody>
  • Set table id, e.g., id="Actions_getActions"
  • Instead of "Sub DataTable not loaded", add a pseudo-column that contains an integer (idSubtable)

Improvements:

Attachments (3)

datatable.jpg (17.4 KB) - added by vipsoft 5 years ago.
Screenshot of data table
graphtable.jpg (17.5 KB) - added by vipsoft 5 years ago.
screenshot of graph table
dataTable.html (1.2 KB) - added by vipsoft 5 years ago.
Sample code

Download all attachments as: .zip

Change History (19)

comment:1 Changed 5 years ago by vipsoft (robocoder)

  • Owner set to vipsoft
  • Priority changed from normal to low
  • Type changed from Bug to New feature

comment:2 Changed 5 years ago by vipsoft (robocoder)

  • Status changed from new to assigned

comment:3 Changed 5 years ago by vipsoft (robocoder)

  • Add unit tests to tests/core/DataTable/Renderer.test.php
  • Fix missing </tr> on header row.

comment:5 Changed 5 years ago by vipsoft (robocoder)

  • Milestone changed from 2- DigitalVibes to 1 - Piwik 0.4.1

comment:6 Changed 5 years ago by vipsoft (robocoder)

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [1222]) fixes #760 - changes to Basic HTML format

comment:7 Changed 5 years ago by vipsoft (robocoder)

(In [1223]) refs #760 - use <th> for header

Changed 5 years ago by vipsoft (robocoder)

Screenshot of data table

Changed 5 years ago by vipsoft (robocoder)

screenshot of graph table

Changed 5 years ago by vipsoft (robocoder)

Sample code

comment:8 Changed 5 years ago by vipsoft (robocoder)

The attached example uses the following jquery plugins:

comment:9 Changed 5 years ago by matt (mattab)

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening:

  • before the html output was a simple debug output; now it seems it will be part of the feature as your examples suggest: it makes it very easy to reuse the data in external apps. As such, we need to add unit test to the output of this table, just like other format are tested in tests/core/DataTable/Renderer.test.php
  • how could we best showcase this new feature? It looks like something that could be very useful to many people integrating Piwik in their project.. I would suggest a short and sweet blog post tutorial explaining how to do so - just an idea :-) but would definitely advertise this to the community
  • could we also include it in misc/?
  • you mention "flot", is it in the screenshots attached to the ticket?

good work!

comment:10 Changed 5 years ago by matt (mattab)

  • why do you do the following?
$value = html_entity_decode($value, ENT_COMPAT, 'UTF-8');
$value = htmlspecialchars($value);

I would instead suggest to use Piwik_DataTable_Filter_SafeDecodeLabel to keep this logic in one place only.

comment:11 Changed 5 years ago by vipsoft (robocoder)

  • Milestone changed from 1 - Piwik 0.4.1 to 2- DigitalVibes
  • I can't include a test case/tutorial until #772 is fixed because the variance in column order means the tests would pass on one machine and fail on another; similarly, dataTables and graphTable use row/column position/index to select data, not by row/column name
  • flot is used by graphTable, so there isn't a separate screenshot
  • the samples are just a proof-of-concept; Let's create a separate ticket to spec out what a flashy non-flash demo would be
  • why do I... hang on, I copied that snippet of code from another Renderer ;)

comment:12 Changed 5 years ago by vipsoft (robocoder)

  • Milestone changed from 2- DigitalVibes to 1 - Piwik 0.4.1

Closing in favor of #804; test case will be included in #772

comment:13 Changed 5 years ago by vipsoft (robocoder)

  • Resolution set to fixed
  • Status changed from reopened to closed

comment:14 Changed 5 years ago by vipsoft (robocoder)

Note: dataTable.html is a proof-of-concept; in practice, the data would be embedded in the page from the server-side so that token_auth is not exposed in the page source

comment:15 Changed 5 years ago by alivenk

comment:16 Changed 5 years ago by koteiko

Note: See TracTickets for help on using tickets.