Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New plugin to let a Super User create a custom, parameterised page in Piwik #6796

Closed
mattab opened this issue Dec 3, 2014 · 6 comments
Closed
Assignees
Labels
c: Usability For issues that let users achieve a defined goal more effectively or efficiently. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Milestone

Comments

@mattab
Copy link
Member

mattab commented Dec 3, 2014

The goal of this issue is to create a new free plugin available on the Marketplace that will let Super User create a new custom Page in Piwik.

Notes:

  • this page is available via a top menu link
  • the page displays the website selector and the calendar
  • the main content is editable by the Super User in Plugin settings:
    • it is possible to also set some placeholders which will be replaced when the page is rendered.
    • support these placeholders at least: {{date}}, {{period}} and {{idSite}} and {{idsite}} and {{token_auth}}, {{siteName}} and {{siteMainUrl}}

Example use cases:

  • As the Super User, I want to create a public announcement page in Piwik to give out information to all Piwik users (such as contact details, who to contact in case of problem, etc.)
  • As the super user, I want to create a page that lists various links to useful API reports. For example my users care most about 3 particular API requests. I can set the page content as something like this:
Hello,

Find below the export links most useful for our reporting:

<a href='index.php?module=API&method=API.myFavoriteAPI&format=xml&token_auth={{token_auth}}&idSite={{idSite}}&period={{period}}&date={{date}}'>API Export - my favorite API</a>


Have a nice day!

Signed: Piwik Super User

Proposed steps

  • Find plugin name
  • Add to travis CI
  • Plugin Settings for this plugin is self-documented: lists the available placeholders
  • Publish on Marketplace with README and screenshot
@mattab mattab added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. c: Usability For issues that let users achieve a defined goal more effectively or efficiently. labels Dec 3, 2014
@mattab mattab added this to the Piwik 2.10.0 milestone Dec 3, 2014
@mnapoli
Copy link
Contributor

mnapoli commented Dec 3, 2014

In those placeholders, which come from the URL (i.e. just pass the value of Common::getRequestVar('date')) and which come from somewhere else?

More particularly: where should I get token_auth, siteName and siteMainUrl? Request parameters or somewhere else?

@mnapoli mnapoli self-assigned this Dec 3, 2014
@mattab
Copy link
Member Author

mattab commented Dec 4, 2014

Hi Matt,

these can all be fetched from the Controller values.
See in the source of Piwik the values are currently printed in the JS array:



    piwik.token_auth = "anonymous";
    piwik.piwik_url = "http://demo.piwik.org/";
    piwik.cacheBuster = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
    piwik.userLogin = "anonymous";
    piwik.idSite = "7";
    piwik.siteName = "Piwik\x20Forums";
    piwik.siteMainUrl = "http\x3A\x2F\x2Fforum.piwik.org";
    piwik.period = "day";
    piwik.currentDateString = "2014-12-03";
    piwik.language = "en";

@mnapoli
Copy link
Contributor

mnapoli commented Dec 4, 2014

  • current plugin name: CustomPage
  • should the new plugin be published on Piwik or PiwikPro?
  • I don't escape the content configured by the super user (because it would prevent him to use HTML), I just want to confirm that

Also the page is really ugly, is there something I should use in HTML to make it look good?

capture d ecran 2014-12-04 a 17 04 56

I've used this by copying what's in the Widgetize plugin:

{% extends 'dashboard.twig' %}

{% block content %}

    <div class="top_controls">
        {% include "@CoreHome/_siteSelectHeader.twig" %}
        {% include "@CoreHome/_periodSelect.twig" %}
    </div>

    {{ content|raw }}

{% endblock %}

Should I be extending from another template? I'd like to limit the copy-paste of HTML from the widget page…

@mnapoli
Copy link
Contributor

mnapoli commented Dec 5, 2014

ping @mattab :)

@mattab
Copy link
Member Author

mattab commented Dec 5, 2014

Hello!

  • what do you think of SimplePageBuilder rather than CustomPage? (we have already Page URL, page Title, custom variable of scope page, etc.)
  • PiwikPro
  • jeez it is ugly ;-)
    • maybe add a title <h2> in the sample content?
    • it looks better in widgets page because there is widgetize DIV which has css: font-size: 13px; padding: 15px 15px 0; - maybe we can create or reuse this css class?

I don't escape the content configured by the super user

Correct, Super Users are trusted.

@mnapoli
Copy link
Contributor

mnapoli commented Dec 8, 2014

@mnapoli mnapoli closed this as completed Dec 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Usability For issues that let users achieve a defined goal more effectively or efficiently. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

2 participants