Esempio n. 1
0
 def _extend_indico_help(self, sender, **kwargs):
     return {
         _('Statistics'): {
             _('Piwik'): (url_for_plugin(self.name + '.static',
                                         filename='help/html/index.html'),
                          url_for_plugin(self.name + '.static',
                                         filename='help/pdf/index.pdf'))
         }
     }
Esempio n. 2
0
 def _extend_indico_help(self, sender, **kwargs):
     return {
         _('Statistics'): {
             _('Piwik'): (
                 url_for_plugin(self.name + '.static', filename='help/html/index.html'),
                 url_for_plugin(self.name + '.static', filename='help/pdf/index.pdf')
             )
         }
     }
Esempio n. 3
0
 def add_sidemenu_item(self, sender, event, **kwargs):
     if not event.can_manage(session.user):
         return
     return SideMenuItem(u'statistics',
                         _(u"Statistics"),
                         url_for_plugin(u'piwik.view', event),
                         section=u'reports')
Esempio n. 4
0
 def add_sidemenu_item(self, sender, event, **kwargs):
     if not event.can_manage(session.user) or not PiwikPlugin.settings.get(
             'site_id_events'):
         return
     return SideMenuItem('statistics',
                         _("Statistics"),
                         url_for_plugin('piwik.view', event),
                         section='reports')
Esempio n. 5
0
 def validate_site_id_events(self, field):
     if self.site_id_general is not None and field is not None and self.site_id_general.data == field.data:
         raise ValidationError(_("Event statistics can't use the same Piwik site as global statistics"))
Esempio n. 6
0
class SettingsForm(IndicoForm):
    enabled = BooleanField(_("Track global visits"), widget=SwitchWidget())
    enabled_for_events = BooleanField(_("Track events"), widget=SwitchWidget())
    enabled_for_downloads = BooleanField(_("Track downloads"), widget=SwitchWidget())
    cache_enabled = BooleanField(_("Cache results"), widget=SwitchWidget())
    server_url = StringField(_("Piwik server URL"))
    server_api_url = StringField(_("Piwik API server URL"),
                                 description=_("Should be pointing to 'index.php'"))
    server_token = StringField(_("Piwik API token"),
                               description=_("Token to access the API. Do not share it!"))
    site_id_general = StringField(_("Global statistics ID"),
                                  description=_("Piwik site ID for global statistics"))
    site_id_events = StringField(_("Event statistics ID"),
                                 description=_("Piwik site ID for event statistics"))
    cache_ttl = IntegerField(_("Result cache TTL (seconds)"),
                             description=_("How long event reports are kept cached"))
    use_only_server_url = BooleanField(_("Use Piwik server URL for all requests"))

    def validate_site_id_events(self, field):
        if self.site_id_general is not None and field is not None and self.site_id_general.data == field.data:
            raise ValidationError(_("Event statistics can't use the same Piwik site as global statistics"))
Esempio n. 7
0
 def validate_site_id_events(self, field):
     if self.site_id_general is not None and field is not None and self.site_id_general.data == field.data:
         raise ValidationError(_("Event statistics can't use the same Piwik site as global statistics"))
Esempio n. 8
0
 def add_sidemenu_item(self, sender, event, **kwargs):
     if not event.can_manage(session.user) or not PiwikPlugin.settings.get('site_id_events'):
         return
     return SideMenuItem(u'statistics', _(u"Statistics"), url_for_plugin(u'piwik.view', event), section=u'reports')