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

Allow disabling links to pages at intranet installations #10223

Open
tmuic opened this issue Jun 8, 2016 · 4 comments
Open

Allow disabling links to pages at intranet installations #10223

tmuic opened this issue Jun 8, 2016 · 4 comments
Labels
c: New plugin For features that probably will not be added to Matomo, but could be implemented as plugins. Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.

Comments

@tmuic
Copy link

tmuic commented Jun 8, 2016

On Pages and some other reports page URLs are automatically generated when URL is detected.
On Intranet installations this is problematic behaviour since it might be that Piwik is on separate server and that pages are not accessible from computer which Piwik is accessed from

Would it be possible to add parameter that makes links unclickable in that situation?

I am willing to fix that myself if I get a few pointers how to get started (propably add site setting and access it somehow from twig?)

piwik/plugins/CoreHome/templates/_dataTableCell.twig

{% if not row.getIdSubDataTable() and column=='label' and row.getMetadata('url') %}
    <a rel="noreferrer"
       target="_blank"
       href='{% if row.getMetadata('url')|slice(0,4) not in ['http','ftp:'] %}http://{% endif %}{{ row.getMetadata('url')|rawSafeDecoded }}'>
    {% if not row.getMetadata('logo') %}
        <img class="link" width="10" height="9"
             src="plugins/Morpheus/images/link.gif"/>
    {% endif %}
{% endif %}

(I added style="pointer-events: none" as a temporary workaround to my piwik installation)

@tsteur
Copy link
Member

tsteur commented Jun 10, 2016

I think this would be a perfect use case to solve in a plugin.

Rough idea would be to create a plugin see http://developer.piwik.org/guides/getting-started-part-1

Then listen to the event http://developer.piwik.org/guides/events called API.Request.dispatch.end see http://developer.piwik.org/api-reference/events#apirequestdispatchend or you could listen to only a specific API method via the API.$pluginName.$methodName.end http://developer.piwik.org/api-reference/events#apipluginnamemethodnameend event.

When your event is triggered you could check if the response is a Piwik\DataTable and if so, unset all url metadata eg $row->deleteMetadata('url').

You could make the plugin even configurable eg by adding a config entries in config/config.ini.php that you can access with Piwik\Config class see http://developer.piwik.org/api-reference/Piwik/Config . For example could be

[MyPluginName]
intranet_urls[] = "..."
intranet_urls[] = "..."

does this help?

@tsteur tsteur added Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. c: New plugin For features that probably will not be added to Matomo, but could be implemented as plugins. labels Jun 10, 2016
@tmuic
Copy link
Author

tmuic commented Jun 10, 2016

I will try that. I have already created plugin so this seems be good way to go.
Not sure how will I share this with community. Plugin for such small isolated feature seems to much

@tsteur
Copy link
Member

tsteur commented Jun 10, 2016

I'm sure some other users would be interested in such a plugin / feature as well as Piwik is often used in an intranet. You could share it via our Marketplace see http://developer.piwik.org/guides/distributing-your-plugin

@mattab
Copy link
Member

mattab commented Jul 8, 2016

Hi @tmuic we look forward to seeing your plugin on the marketplace 👍

@mattab mattab added this to the Long term milestone Jul 14, 2016
@mattab mattab modified the milestones: Long term, Mid term Dec 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: New plugin For features that probably will not be added to Matomo, but could be implemented as plugins. 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

3 participants