Changeset 3997 for Serveur


Ignore:
Timestamp:
09/21/10 14:39:28 (9 years ago)
Author:
kent1
Message:

On continue à simplifier

Location:
Serveur/trac/TracPiwik/tracext/piwik
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Serveur/trac/TracPiwik/tracext/piwik/__init__.py

    r3995 r3997  
    22# vim: sw=4 ts=4 fenc=utf-8 et
    33# ==============================================================================
    4 # Copyright © 2008 UfSoft.org - kent1 <kent1@arscenic.org>
     4# Copyright © 2010 kent1 <kent1@arscenic.org>
    55#
    66# Please view LICENSE for additional licensing information.
     
    2626# ==============================================================================
    2727class PiwikConfig(Component):
    28     uid = Option(
    29         'google.analytics', 'uid', None,
    30         """Google Analytics' UID.
    31         The UID is needed for Google Analytics to log your website stats.
    32         Your UID can be found by looking in the JavaScript Google Analytics
    33         gives you to put on your page. Look for your UID in between
    34         `var pageTracker = _gat._getTracker("UA-111111-11");` in the javascript.
    35         In this example you would put UA-11111-1 in the UID box.""")
    36     admin_logging = BoolOption(
    37         'google.analytics', 'admin_logging', False,
    38         """Disabling this option will prevent all logged in admins from showing
    39         up on your Google Analytics reports.""")
    40     authenticated_logging = BoolOption(
    41         'google.analytics', 'authenticated_logging', True,
    42         """Disabling this option will prevent all authenticated users from
    43         showing up on your Google Analytics reports.""")
    44     outbound_link_tracking = BoolOption(
    45         'google.analytics', 'outbound_link_tracking', True,
    46         """Disabling this option will turn off the tracking of outbound links.
    47         It's recommended not to disable this option unless you're a privacy
    48         advocate (now why would you be using Google Analytics in the first
    49         place?) or it's causing some kind of weird issue.""")
    50     google_external_path = Option(
    51         'google.analytics', 'google_external_path', '/external/',
    52         """This will be the path shown on Google Analytics
    53         regarding external links. Consider the following link:
    54           http://trac.edgewall.org/"
    55         The above link will be shown as for example:
    56           /external/trac.edgewall.org/
    57         This way you will be able to track outgoing links.
    58         Outbound link tracking must be enabled for external links to be
    59         tracked.""")
    60     extensions = Option(
    61         'google.analytics', 'extensions', 'zip,tar,tar.gz,tar.bzip,egg',
    62         """Enter any extensions of files you would like to be tracked as a
    63         download. For example to track all MP3s and PDFs enter:
    64             mp3,pdf
    65         Outbound link tracking must be enabled for downloads to be tracked.""")
    66     tracking_domain_name = Option(
    67         'google.analytics', 'tracking_domain_name', None,
    68         """If you're tracking multiple subdomains with the same Google Analytics
    69         profile, like what's talked about in:
    70             https://www.google.com/support/googleanalytics/bin/answer.py?answer=55524
    71         enter your main domain here. For more info, please visit the previous
    72         link.""")
     28    tracking_site = Option(
     29        'piwik', 'tracking_site', None,
     30        """Piwik's tracked site ID.
     31        This ID is needed to know which site is tracked.""")
     32    tracking_server = Option(
     33        'piwik', 'tracking_server', None,
     34        """Piwik's tracking server address.
     35        Without the "http://" or "https://" and without trailing slash""")
    7336
    7437# ==============================================================================
  • Serveur/trac/TracPiwik/tracext/piwik/admin.py

    r3995 r3997  
    2525        add_stylesheet(req, 'piwik/piwik.css')
    2626        if req.method.lower() == 'post':
    27             self.config.set('piwik', 'uid',
    28                             req.args.get('uid'))
    29             self.config.set('piwik', 'admin_logging',
    30                             req.args.get('admin_logging') in _TRUE_VALUES)
    31             self.config.set('piwik', 'authenticated_logging',
    32                             req.args.get('authenticated_logging') in
    33                             _TRUE_VALUES)
    34             self.config.set('piwik', 'outbound_link_tracking',
    35                             req.args.get('outbound_link_tracking') in \
    36                             _TRUE_VALUES)
    37             self.config.set('piwik', 'google_external_path',
    38                             req.args.get('google_external_path'))
    39             self.config.set('piwik', 'extensions',
    40                             req.args.get('extensions'))
    41             self.config.set('piwik', 'tracking_domain_name',
    42                             req.args.get('tracking_domain_name'))
     27            self.config.set('piwik', 'tracking_site',
     28                            req.args.get('tracking_site'))
     29            self.config.set('piwik', 'tracking_server',
     30                            req.args.get('tracking_server'))
    4331            self.config.save()
    4432        self.update_config()
    45         return 'piwik_admin.html', {'ga': self.options}
     33        return 'piwik_admin.html', {'piwik': self.options}
    4634
    4735    def update_config(self):
    4836        for option in [option for option in Option.registry.values()
    4937                       if option.section == 'piwik']:
    50             if option.name in ('admin_logging', 'authenticated_logging',
    51                                'outbound_link_tracking'):
    52                 value = self.config.getbool('piwik', option.name,
    53                                             option.default)
    54                 option.value = value
    55             else:
    56                 value = self.config.get('piwik', option.name,
    57                                         option.default)
    58                 option.value = value
    5938            self.options[option.name] = option
  • Serveur/trac/TracPiwik/tracext/piwik/web_ui.py

    r3995 r3997  
    2424
    2525        options = self.get_options()
    26         if not options.get('uid'):
     26        if not options.get('tracking_site'):
    2727            self.log.debug('Plugin not configured, returning stream')
    2828            return stream
    29         elif ('TRAC_ADMIN' in req.perm) and (not options['admin_logging']):
    30             self.log.debug("Not tracking TRAC_ADMIN's, returning stream")
    31             return stream
    32         elif (req.authname and req.authname != "anonymous") \
    33                                     and (not options['authenticated_logging']):
    34             self.log.debug("Not tracking authenticated users, returning stream")
     29        elif not options.get('tracking_server'):
     30            self.log.debug('Plugin not configured, returning stream')
    3531            return stream
    3632
Note: See TracChangeset for help on using the changeset viewer.