Attachment 'modern_v2.patch'

Download

   1 --- share/moin/htdocs/modern/css/screen.css.orig	Thu Apr  5 18:26:32 2007
   2 +++ share/moin/htdocs/modern/css/screen.css	Thu Apr  5 18:26:37 2007
   3 @@ -251,6 +251,55 @@
   4      background: #81BBF2; /* url(../img/tab-selected.png) repeat-x; */
   5  }
   6  
   7 +
   8 +#langbar {
   9 +    display: block;
  10 +    margin: 0;
  11 +    padding: 0 10px;
  12 +    font-size: 0.82em;
  13 +    zoom: 1; /* for avoiding a gap between navibar and pageline on IE */
  14 +}
  15 +
  16 +#langbar li {
  17 +    float: right;
  18 +    display: inline;
  19 +    margin: 0 2px;
  20 +    padding: 2px 5px;
  21 +    border: 1px solid #9C9C9C;
  22 +    border-bottom: none;
  23 +    white-space: nowrap;
  24 +}
  25 +
  26 +*[dir="rtl"] #langbar li {
  27 +    float: left;
  28 +}
  29 +
  30 +#langbar li.wikilink {
  31 +    background: white; /*url(../img/tab-wiki.png) repeat-x;*/
  32 +}
  33 +
  34 +#langbar li.userlink {
  35 +    background: #E6EAF0; /*url(../img/tab-user.png) repeat-x;*/
  36 +}
  37 +
  38 +#langbar a, #langbar a:visited {
  39 +    color: black;
  40 +    text-decoration: none;    
  41 +}
  42 +
  43 +#langbar li.current a {
  44 +    font-weight: bold;
  45 +}
  46 +
  47 +#langbar li:hover {
  48 +    background: #CCCCCC;
  49 +}
  50 +
  51 +#langbar li.current, #langbar li.current:hover {
  52 +    background: #81BBF2; /* url(../img/tab-selected.png) repeat-x; */
  53 +}
  54 +
  55 +
  56  #pageline {
  57      clear: both;
  58      margin: 0;
  59 --- lib/python2.4/site-packages/MoinMoin/theme/modern.py.orig	Thu Apr  5 18:28:26 2007
  60 +++ lib/python2.4/site-packages/MoinMoin/theme/modern.py	Thu Apr  5 18:27:59 2007
  61 @@ -34,6 +34,7 @@
  62              u'</div>',
  63              self.trail(d),
  64              self.navibar(d),
  65 +            self.langbar(d),
  66              #u'<hr id="pageline">',
  67              u'<div id="pageline"><hr style="display:none;"></div>',
  68              self.msg(d),
  69 @@ -47,6 +48,56 @@
  70              self.startPage(),
  71          ]
  72          return u'\n'.join(html)
  73 +
  74 +    def langbar(self, d):
  75 +        """ Create language panel """
  76 +	from MoinMoin.Page import Page
  77 +        from MoinMoin import i18n
  78 +        from MoinMoin.i18n import _unformatted_text_cache
  79 +        from types import *
  80 +        _ = self.request.getText
  81 +
  82 +        page_title = d['page_name']
  83 +        lang_links = []
  84 +        request = self.request
  85 +        for l in i18n.languages:
  86 +                trans = i18n.getText(page_title, self.request, l, False)
  87 +                if trans == page_title:
  88 +                        lang = Page(self.request, page_title).language
  89 +                        if lang is None:
  90 +                                # this is a hack: the page should always have a lang, and the default should not be .fr
  91 +                                lang = 'fr'
  92 +                        ## costly hideous operation to find the root page name in english
  93 +                        global _unformatted_text_cache
  94 +                        if not lang in _unformatted_text_cache:
  95 +                                (texts, unformatted) = i18n.loadLanguage(request, lang)
  96 +                                # XXX add error handling
  97 +                                _unformatted_text_cache[lang] = unformatted
  98 +                        for k, v in _unformatted_text_cache[lang].iteritems():
  99 +                                if v == page_title:
 100 +                                        trans = i18n.getText(k, self.request, l, False)
 101 +                                        en = i18n.getText(k, self.request, 'en', False)
 102 +                                        if trans == en and l != 'en':
 103 +                                                trans = page_title # false translation
 104 +                else:
 105 +                        en = i18n.getText(page_title, self.request, 'en', False)
 106 +                        if trans == en and l != 'en':
 107 +                                trans = page_title # false translation
 108 +
 109 +                if trans != page_title:
 110 +                        translated_page = Page(self.request, trans)
 111 +                        if translated_page.exists():
 112 +                                lang_links.append(translated_page.link_to(request, l))
 113 +
 114 +        if lang_links:
 115 +                html = [
 116 +			u'<ul id="langbar"><li>',
 117 +                        u'</li>\n<li>'.join(lang_links),
 118 +                        u'</li></ul>'
 119 +                        ]
 120 +                return u'\n'.join(html)
 121 +        else:
 122 +                return u''
 123  
 124      def editorheader(self, d, **kw):
 125          """ Assemble wiki header for editor

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2007-04-05 22:30:23, 2.7 KB) [[attachment:modern.patch]]
  • [get | view] (2007-04-11 04:59:29, 4.2 KB) [[attachment:modern_v2.patch]]
  • [get | view] (2010-10-13 05:21:50, 2.9 KB) [[attachment:simpler.patch]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.