changeset 91:ce330336739b

change the confusing "Quicklink" to "Add Link" and "Remove Link", chcking user quicklink state imported from: moin--main--1.5--patch-93
author Nir Soffer <nirs@freeshell.org>
date Sat, 08 Oct 2005 01:40:01 +0000
parents 246601c7b298
children 92a508340932
files MoinMoin/theme/__init__.py
diffstat 1 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/theme/__init__.py	Sat Oct 08 01:22:09 2005 +0000
+++ b/MoinMoin/theme/__init__.py	Sat Oct 08 01:40:01 2005 +0000
@@ -842,20 +842,22 @@
         return False
 
     def quicklinkLink(self, page):
-        """ Return add/remove quicklink link to valid users
+        """ Return add/remove quicklink link
         
         @rtype: unicode
-        @return: quicklink / quickunlink link
+        @return: link to add or remove a quicklink
         """
+        if not self.request.user.valid:
+            return ''
+        
         _ = self.request.getText
-        user = self.request.user
-        if user.valid:
-            title = _("Quicklink")
-            quotedname = wikiutil.quoteWikinameURL(page.page_name)
-            link = wikiutil.link_tag(self.request, quotedname + 
-                                     '?action=quicklink', title)
-            return link
-        return ''
+        if self.request.user.isQuickLinkedTo([page.page_name]):
+            title = _("Remove Link")
+        else:
+            title = _("Add Link")
+        quotedname = wikiutil.quoteWikinameURL(page.page_name)
+        return wikiutil.link_tag(self.request, quotedname + 
+                                 '?action=quicklink', title)
 
     def subscribeLink(self, page):
         """ Return subscribe/unsubscribe link to valid users