Mercurial > moin-europython
annotate europython.py @ 22:2be4ac3eeded
Add title to the subscribe icon
| author | Radomir Dopieralski <sheep@stxnext.pl> |
|---|---|
| date | Tue, 15 Mar 2011 15:31:20 +0100 |
| parents | c636bfecbb1d |
| children |
| rev | line source |
|---|---|
| 0 | 1 from MoinMoin.theme import rightsidebar |
| 2 | |
| 3 class Theme(rightsidebar.Theme): | |
| 4 name = "europython" | |
| 5 | |
| 6 | 6 _ = lambda x: x # We don't have gettext at this moment, so we fake it |
| 7 icons = { | |
| 8 # key alt icon filename w h | |
| 9 # FileAttach | |
| 10 'attach': ("%(attach_count)s", "moin-attach.png", 16, 16), | |
| 11 'info': ("[INFO]", "moin-info.png", 16, 16), | |
| 12 'attachimg': (_("[ATTACH]"), "attach.png", 32, 32), | |
| 13 # RecentChanges | |
| 14 'rss': (_("[RSS]"), "moin-rss.png", 16, 16), | |
| 15 'deleted': (_("[DELETED]"), "moin-deleted.png",16, 16), | |
| 16 'updated': (_("[UPDATED]"), "moin-updated.png",16, 16), | |
| 17 'renamed': (_("[RENAMED]"), "moin-renamed.png",16, 16), | |
| 18 'conflict': (_("[CONFLICT]"), "moin-conflict.png", 16, 16), | |
| 19 'new': (_("[NEW]"), "moin-new.png", 16, 16), | |
| 20 'diffrc': (_("[DIFF]"), "moin-diff.png", 16, 16), | |
| 21 # General | |
| 22 'bottom': (_("[BOTTOM]"), "moin-bottom.png", 16, 16), | |
| 23 'top': (_("[TOP]"), "moin-top.png", 16, 16), | |
| 24 'www': ("[WWW]", "moin-www.png", 16, 16), | |
| 25 'mailto': ("[MAILTO]", "moin-email.png", 16, 16), | |
| 26 'news': ("[NEWS]", "moin-news.png", 16, 16), | |
| 27 'telnet': ("[TELNET]", "moin-telnet.png", 16, 16), | |
| 28 'ftp': ("[FTP]", "moin-ftp.png", 16, 16), | |
| 29 'file': ("[FILE]", "moin-ftp.png", 16, 16), | |
| 30 # search forms | |
| 31 'searchbutton': ("[?]", "moin-search.png", 16, 16), | |
| 32 'interwiki': ("[%(wikitag)s]", "moin-inter.png", 16, 16), | |
| 33 | |
| 34 # smileys (this is CONTENT, but good looking smileys depend on looking | |
| 35 # adapted to the theme background color and theme style in general) | |
| 36 #vvv == vvv this must be the same for GUI editor converter | |
| 37 'X-(': ("X-(", 'angry.png', 16, 16), | |
| 38 ':D': (":D", 'biggrin.png', 16, 16), | |
| 39 '<:(': ("<:(", 'frown.png', 16, 16), | |
| 40 ':o': (":o", 'redface.png', 16, 16), | |
| 41 ':(': (":(", 'sad.png', 16, 16), | |
| 42 ':)': (":)", 'smile.png', 16, 16), | |
| 43 'B)': ("B)", 'smile2.png', 16, 16), | |
| 44 ':))': (":))", 'smile3.png', 16, 16), | |
| 45 ';)': (";)", 'smile4.png', 16, 16), | |
| 46 '/!\\': ("/!\\", 'alert.png', 16, 16), | |
| 47 '<!>': ("<!>", 'attention.png', 16, 16), | |
| 48 '(!)': ("(!)", 'idea.png', 16, 16), | |
| 49 ':-?': (":-?", 'tongue.png', 16, 16), | |
| 50 ':\\': (":\\", 'ohwell.png', 16, 16), | |
| 51 '>:>': (">:>", 'devil.png', 16, 16), | |
| 52 '|)': ("|)", 'tired.png', 16, 16), | |
| 53 ':-(': (":-(", 'sad.png', 16, 16), | |
| 54 ':-)': (":-)", 'smile.png', 16, 16), | |
| 55 'B-)': ("B-)", 'smile2.png', 16, 16), | |
| 56 ':-))': (":-))", 'smile3.png', 16, 16), | |
| 57 ';-)': (";-)", 'smile4.png', 16, 16), | |
| 58 '|-)': ("|-)", 'tired.png', 16, 16), | |
| 59 '(./)': ("(./)", 'checkmark.png', 16, 16), | |
| 60 '{OK}': ("{OK}", 'thumbs-up.png', 16, 16), | |
| 61 '{X}': ("{X}", 'icon-error.png', 16, 16), | |
| 62 '{i}': ("{i}", 'icon-info.png', 16, 16), | |
| 63 '{1}': ("{1}", 'prio1.png', 15, 13), | |
| 64 '{2}': ("{2}", 'prio2.png', 15, 13), | |
| 65 '{3}': ("{3}", 'prio3.png', 15, 13), | |
| 66 '{*}': ("{*}", 'star_on.png', 16, 16), | |
| 67 '{o}': ("{o}", 'star_off.png', 16, 16), | |
| 68 } | |
| 69 del _ | |
| 70 | |
|
21
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
71 def subscribeLink(self, page): |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
72 """ Return subscribe/unsubscribe link to valid users |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
73 |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
74 @rtype: unicode |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
75 @return: subscribe or unsubscribe link |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
76 """ |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
77 if not ((self.cfg.mail_enabled or |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
78 self.cfg.jabber_enabled) and self.request.user.valid): |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
79 return '' |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
80 |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
81 _ = self.request.getText |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
82 if self.request.user.isSubscribedTo([page.page_name]): |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
83 action, text = 'unsubscribe', _("Unsubscribe") |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
84 else: |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
85 action, text = 'subscribe', _("Subscribe") |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
86 if action in self.request.cfg.actions_excluded: |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
87 return '' |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
88 return page.link_to(self.request, text=text, |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
89 querystr={'action': action}, |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
90 css_class='nbsubscribe %s' % action, |
|
22
2be4ac3eeded
Add title to the subscribe icon
Radomir Dopieralski <sheep@stxnext.pl>
parents:
21
diff
changeset
|
91 title=text, |
|
21
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
92 rel='nofollow') |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
93 |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
94 def wikipanel(self, d): |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
95 """ Create wiki panel """ |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
96 _ = self.request.getText |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
97 html = [ |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
98 u'<div id="star">', self.subscribeLink(d['page']), '</div>', |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
99 u'<div class="sidepanel">', self.navibar(d), u'</div>', |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
100 ] |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
101 return u'\n'.join(html) |
|
c636bfecbb1d
Add a subscribe link next to the page title.
Radomir Dopieralski <sheep@stxnext.pl>
parents:
6
diff
changeset
|
102 |
| 0 | 103 def execute(request): |
| 104 return Theme(request) |
