changeset 18:316340dd9a7f

remove subscribe icon in classic when no mail is enabled. fix check for sendmail. imported from: moin--main--1.5--patch-19
author Thomas Waldmann <tw@waldmann-edv.de>
date Fri, 23 Sep 2005 23:00:59 +0000
parents 3ef174b732c6
children 6772e845059d
files MoinMoin/PageEditor.py MoinMoin/PageGraphicalEditor.py MoinMoin/multiconfig.py MoinMoin/theme/__init__.py MoinMoin/theme/classic.py MoinMoin/userform.py MoinMoin/wikiaction.py
diffstat 7 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/PageEditor.py	Fri Sep 23 22:44:37 2005 +0000
+++ b/MoinMoin/PageEditor.py	Fri Sep 23 23:00:59 2005 +0000
@@ -401,7 +401,7 @@
             'category': unicode(util.web.makeSelection('category', cat_pages)),
         })
 
-        if self.cfg.mail_smarthost:
+        if self.cfg.mail_enabled:
             self.request.write('''
 &nbsp;
 <input type="checkbox" name="trivial" id="chktrivial" value="1" %(checked)s>
@@ -930,7 +930,7 @@
             self.clean_acl_cache()
   
             # send notification mails
-            if self.request.cfg.mail_smarthost:
+            if self.request.cfg.mail_enabled:
                 msg = msg + self._notifySubscribers(comment, trivial)
           
             if self.request.cfg.lupy_search:
--- a/MoinMoin/PageGraphicalEditor.py	Fri Sep 23 22:44:37 2005 +0000
+++ b/MoinMoin/PageGraphicalEditor.py	Fri Sep 23 23:00:59 2005 +0000
@@ -320,7 +320,7 @@
         self.request.write(_('Add to: %(category)s') % {
             'category': unicode(util.web.makeSelection('category', cat_pages)),
         })
-        if self.cfg.mail_smarthost:
+        if self.cfg.mail_enabled:
             self.request.write('''
 &nbsp;
 <input type="checkbox" name="trivial" id="chktrivial" value="1" %(checked)s>
--- a/MoinMoin/multiconfig.py	Fri Sep 23 22:44:37 2005 +0000
+++ b/MoinMoin/multiconfig.py	Fri Sep 23 23:00:59 2005 +0000
@@ -426,6 +426,8 @@
         # list to cache lupy searcher objects
         self.lupy_searchers = []
 
+        # check if mail is possible and set flag:
+        self.mail_enabled = not (self.mail_smarthost is None and self.mail_sendmail is None)
 
     def _config_check(self):
         """ Check namespace and warn about unknown names
--- a/MoinMoin/theme/__init__.py	Fri Sep 23 22:44:37 2005 +0000
+++ b/MoinMoin/theme/__init__.py	Fri Sep 23 23:00:59 2005 +0000
@@ -858,7 +858,7 @@
         """
         _ = self.request.getText
         user = self.request.user
-        if self.cfg.mail_smarthost and user.valid:
+        if self.cfg.mail_enabled and user.valid:
             # Email enabled and user valid, get current page status
             if user.isSubscribedTo([page.page_name]):
                 title = _("Unsubscribe")
--- a/MoinMoin/theme/classic.py	Fri Sep 23 22:44:37 2005 +0000
+++ b/MoinMoin/theme/classic.py	Fri Sep 23 23:00:59 2005 +0000
@@ -73,7 +73,7 @@
                 if icon == "up":
                     if d['page_parent_page']:
                         iconbar.append('<li>%s</li>\n' % self.make_iconlink(icon, d))
-                elif icon == "subscribe":
+                elif icon == "subscribe" and self.cfg.mail_enabled:
                     iconbar.append('<li>%s</li>\n' % self.make_iconlink(
                         ["subscribe", "unsubscribe"][self.request.user.isSubscribedTo([d['page_name']])], d))
                 else:
--- a/MoinMoin/userform.py	Fri Sep 23 22:44:37 2005 +0000
+++ b/MoinMoin/userform.py	Fri Sep 23 23:00:59 2005 +0000
@@ -72,7 +72,7 @@
             return _("Cookie deleted. You are now logged out.")
     
         if form.has_key('account_sendmail'):
-            if not self.cfg.mail_smarthost:
+            if not self.cfg.mail_enabled:
                 return _("""This wiki is not enabled for mail processing.
 Contact the owner of the wiki, who can enable email.""")
             try:
@@ -559,7 +559,7 @@
             ], valign="top")
 
             # subscribed pages
-            if self.cfg.mail_smarthost:
+            if self.cfg.mail_enabled:
                 # Get list of subscribe pages, DO NOT sort! it should
                 # stay in the order the user entered it in his input
                 # box.
@@ -594,7 +594,7 @@
                     self.make_row(_(label),
                               [ html.INPUT(type=type, size=length, name=key, value=getattr(self.request.user, key)), ' ', _(textafter), ])
 
-        if self.cfg.mail_smarthost:
+        if self.cfg.mail_enabled:
             buttons.append(("account_sendmail", _('Mail me my account data')))
 
         # Add buttons
--- a/MoinMoin/wikiaction.py	Fri Sep 23 22:44:37 2005 +0000
+++ b/MoinMoin/wikiaction.py	Fri Sep 23 23:00:59 2005 +0000
@@ -714,7 +714,7 @@
         msg = _("You are not allowed to subscribe to a page you can't read.")
 
     # check config
-    elif not cfg.mail_smarthost:
+    elif not cfg.mail_enabled:
         msg = _('''This wiki is not enabled for mail processing. '''
                 '''Contact the owner of the wiki, who can either enable email, or remove the "Subscribe" icon.''')