Changeset 592
- Timestamp:
- 10/16/08 04:11:52 (5 years ago)
- Location:
- trunk/plugins/mailmanplugin/mailinglists
- Files:
-
- 2 edited
-
prefs.py (modified) (4 diffs)
-
templates/prefs_mailinglists.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/mailmanplugin/mailinglists/prefs.py
r52 r592 12 12 class MailingListPrefsPanel(Component): 13 13 """Allows users to subscribe or unsubscribe to mailing lists that 14 have been register d for a project.14 have been registered for a project. 15 15 The TracMailmanPlugin module must be set in trac.ini in order to use this. 16 16 """ … … 23 23 #IPreferencePanelProvider methods 24 24 def get_preference_panels(self, req): 25 if req.authname and req.authname != 'anonymous':25 if self._mailing_lists and req.authname and req.authname != 'anonymous': 26 26 yield 'mailinglists', 'Mail Lists' 27 27 … … 31 31 req.redirect(req.href.prefs('mailinglists')) 32 32 33 data = {'mailinglists': self._get_mailinglists(req.session['email'])} 33 user_email = self._get_user_email(req) 34 data = {'mailinglists': self._get_mailinglists(user_email)} 34 35 35 36 return 'prefs_mailinglists.html', data 37 38 def _get_user_email(self, req): 39 address = req.session.get('email') 40 if not address: 41 domain = self.config.get('notification', 'smtp_default_domain') 42 if domain: 43 address = "%s@%s" % (req.authname, domain) 44 45 return address 36 46 37 47 def _get_mailinglists(self, user_email): … … 47 57 def _do_change_subscriptions(self, req): 48 58 # determine the email for the given user 49 if 'email' not in req.session:50 raise TracError('You must have an email address configured in \'General\' preferences')51 52 59 mlapi = MailingListAPI(self.env) 53 60 54 user_email = req.session['email'] 61 user_email = self._get_user_email(req) 62 # store the users email address in the session if it wasn't already 63 if user_email != req.session.get('email'): 64 req.session['email'] = user_email 65 req.session.save() 66 55 67 user_fullname = req.session.get('name', req.authname) 56 68 project_name = self.config.get('project', 'name') -
trunk/plugins/mailmanplugin/mailinglists/templates/prefs_mailinglists.html
r18 r592 10 10 </head> 11 11 <body> 12 <div class="system-message" py:if="not req.session['email']">13 <h2>Warning</h2>14 <p>You must configure your <a href="${req.href.prefs()}">email address</a> before subscribing to mailing lists.</p>15 </div>16 17 12 <table class="listing" style="width: 60%" id="existinglists"> 18 13 <tr> … … 26 21 <td>${list.listname}</td> 27 22 </tr> 28 <tr py:if="not mailinglists">29 <td colspan="2">No mailing lists have been configured for this project.</td>30 </tr>31 23 </table> 32 24 <p class="hint">Subscribe or unsubscribe from mailing lists associated with this project.</p>
Note: See TracChangeset
for help on using the changeset viewer.
