Dateianhang 'moinmoin-02-12-11.diff'

Herunterladen

   1 --- ../../../multilang.cvs/moin/MoinMoin/multilang.py	Mon Dec  2 08:15:09 2002
   2 +++ multilang.py	Tue Dec 10 13:43:15 2002
   3 @@ -52,7 +52,13 @@
   4      return total_hits
   5  
   6  def set_translation_automatically(page_name):
   7 -    """ ??? """
   8 +    """ If page doesn't have translations, set to other page with same Name,
   9 +        if this can be found unambigously. translation groups are treated
  10 +        as one translation.
  11 +    """
  12 +
  13 +    if get_translations(page_name) != []: return
  14 +    
  15      pages = []
  16      for lang in config.languages.keys():
  17          if os.path.exists(get_interwiki_filename(lang + ':' + page_name)):
  18 @@ -189,6 +195,9 @@
  19      """ ??? """
  20      lang_file = get_language_file(pagename)
  21      if translationfilename:
  22 +        if not os.path.exists(os.path.dirname(lang_file)):
  23 +            from MoinMoin.util import filesys
  24 +            filesys.makeDirs(os.path.dirname(lang_file))
  25          f = open(lang_file, 'w')
  26          f.write(translationfilename)
  27          f.close()
  28 @@ -250,8 +259,9 @@
  29              os.remove(translationfile)
  30  
  31  def new_translation_file(page_name):
  32 -    """ ??? """
  33 -    translationfile = os.path.join(config.multilingual_dir, page_name)
  34 +    """ returns unique aund quoted filename """
  35 +    translationfile = os.path.join(config.multilingual_dir,
  36 +                                   wikiutil.quoteFilename(page_name))
  37      newtranslationfile = translationfile
  38      i = 0
  39      while os.path.exists(newtranslationfile):
  40 @@ -279,13 +289,15 @@
  41      interwiki = interwikilink.split(':', 1)
  42      if len(interwiki) == 2:
  43          if config.languages.has_key(interwiki[0]):
  44 -            return os.path.join(config.languages[interwiki[0]], 'lang',
  45 -                                wikiutil.quoteFilename(interwiki[1]))
  46 +            return os.path.join(config.languages[interwiki[0]], 'pages',
  47 +                                wikiutil.quoteFilename(interwiki[1]),
  48 +                                'i18n.lnk')
  49          else:
  50              return None
  51      else:
  52 -        return os.path.join(config.data_dir, 'lang',
  53 -                            wikiutil.quoteFilename(interwiki[0]))
  54 +        return os.path.join(config.data_dir, 'pages',
  55 +                            wikiutil.quoteFilename(interwiki[0]),
  56 +                            'i18n.lnk')
  57                                                  
  58  
  59  # HTML
  60 --- ../../../multilang.cvs/moin/MoinMoin/Page.py	Mon Dec  2 14:39:36 2002
  61 +++ Page.py	Wed Dec 11 14:39:56 2002
  62 @@ -157,6 +157,7 @@
  63              result = wikiutil.link_tag(url, text, 'nonexistent', formatter=fmt, **kw)
  64  
  65          if config.multilingual_dir:
  66 +            # Show translations behind link
  67              from MoinMoin import multilang
  68              flags = ""
  69              translations = multilang.get_translations(self.page_name)
  70 @@ -164,8 +165,17 @@
  71                  for translation in translations:
  72                      if Page(translation).exists():
  73                          flags = flags + ' ' + multilang.language_link(translation, 0)
  74 +            # if none found show similar pages
  75              else:
  76                  pass
  77 +                other_languages = config.languages.keys()
  78 +                other_languages.remove(config.interwikilink)
  79 +                translations = multilang.title_search(self.page_name,
  80 +                                                      other_languages,
  81 +                                                      extended=None)
  82 +                for translation in translations:
  83 +                    if Page(translation).exists():
  84 +                        flags = flags + ' ' + multilang.language_link(translation, 0)
  85              if flags != "":
  86                  result = result + ' (' + flags + ' )'
  87          return result
  88 @@ -468,11 +478,37 @@
  89              'add a page with a name ending in Template.'))
  90          print self.formatter.paragraph(0)
  91  
  92 +        # list similar pages that already exist
  93 +        start, end, matches = LikePages.findMatches(self.page_name, request)
  94 +        if matches and not isinstance(matches, type('')):
  95 +            print self.formatter.rule()
  96 +            print _('<p>The following pages with similar names already exist...</p>')
  97 +            LikePages.showMatches(self.page_name, request, start, end, matches)
  98 +
  99          # Translations as templates
 100          if config.multilingual_dir:
 101              page_name = self.page_name
 102              from MoinMoin import multilang
 103              import re
 104 +
 105 +            pages = multilang.get_translations(page_name)
 106 +            if len(pages) > 0:
 107 +                print self.formatter.heading(2, _('Translations of this page'))
 108 +                print self.formatter.bullet_list(1)
 109 +                for p in pages:
 110 +                    tag, interwiki, tail = wikiutil.resolve_wiki(p)
 111 +                    print self.formatter.listitem(1)
 112 +                    print multilang.language_link(p)
 113 +                    print " ( "
 114 +                    print wikiutil.link_tag("%s?action=edit&template=%s" % (
 115 +                        wikiutil.quoteWikiname(self.page_name),
 116 +                        tag + ":" + wikiutil.quoteWikiname(tail)),
 117 +                                            _("Use as template"))
 118 +                    print " ) "
 119 +                    print self.formatter.listitem(0)
 120 +                print self.formatter.bullet_list(0)
 121 +            
 122 +            # Similar Pages in other languages as templates 
 123              splitname = re.split('([%s][%s]+)' % \
 124                                    (config.upperletters, config.lowerletters),
 125                                    self.page_name)
 126 @@ -481,8 +517,6 @@
 127                  if len(part) > 3:
 128  		    search = search + part + '|'
 129              search = search[:-1]
 130 -            # print `splitname`
 131 -            # print search
 132              pages = multilang.title_search(search, None, 1)
 133              i = 0
 134              langlength = len(config.interwikiname)
 135 @@ -494,26 +528,21 @@
 136              pages.sort()
 137              # print " " + `len(pages)`
 138              if len(pages) > 0:
 139 -                print '<h2>Similar Pages in other languages</h2>'
 140 -                print '<ul>'
 141 +                print self.formatter.heading(2,'Similar Pages in other languages')
 142 +                print self.formatter.bullet_list(1)
 143                  for p in pages:
 144                      tag, interwiki, tail = wikiutil.resolve_wiki(p)
 145 -                    print '<li>' + multilang.language_link(p)
 146 -                    print (' ( <a href="%(page_name)s?' +
 147 -                           'action=edit&template=%(tag)s:%(tail)s">' +
 148 -                           'Use as Template</a> ) </li>\n' ) % \
 149 -                           { 'page_name' : self.page_name, 'tag' : tag,
 150 -                             'interwiki' : interwiki, 'tail' : tail}
 151 -                print '</ul>\n'
 152 -
 153 -        # list similar pages that already exist
 154 -        start, end, matches = LikePages.findMatches(self.page_name, request)
 155 -        if matches and not isinstance(matches, type('')):
 156 -            print self.formatter.rule()
 157 -            print _('<p>The following pages with similar names already exist...</p>')
 158 -            LikePages.showMatches(self.page_name, request, start, end, matches)
 159 -
 160 -
 161 +                    print self.formatter.listitem(1)
 162 +                    print multilang.language_link(p)
 163 +                    print " ( "
 164 +                    print wikiutil.link_tag("%s?action=edit&template=%s" % (
 165 +                        wikiutil.quoteWikiname(self.page_name),
 166 +                        tag + ":" + wikiutil.quoteWikiname(tail)),
 167 +                                            _("Use as template"))
 168 +                    print " ) "
 169 +                    print self.formatter.listitem(0)
 170 +                print self.formatter.bullet_list(0)
 171 +                
 172      def getPageLinks(self, request):
 173          """Get a list of the links on this page"""
 174          if not self.exists(): return []
 175 @@ -572,25 +601,36 @@
 176          sys.stdout.write(doc_leader)
 177  
 178          wikiutil.send_title(page_name)
 179 -        from MoinMoin.multilang import *
 180          from MoinMoin import multilang        
 181 -        translations = get_translations(page_name)
 182 +        translations = multilang.get_translations(page_name)
 183          if len(translations) > 0:
 184 -            print '<h2>Translations of %s</h2>\n\n<ul>' % page_name
 185 +            print self.formatter.heading(2, 'Translations of %s' % page_name)
 186 +            print self.formatter.bullet_list(1)
 187              for translation in translations:
 188                  tag, interwiki, tail = wikiutil.resolve_wiki(translation)
 189 +                print self.formatter.listitem(1)
 190                  # Link
 191 -                print '<li>' + language_link(translation)
 192 +                print multilang.language_link(translation)
 193                  # Link for removing
 194 -                print (' ( <a href="%(page_name)s?' +
 195 -                       'action=TranslationMenu&do=unset&page=%(tag)s:%(tail)s">' +
 196 -                       'remove from group</a> ) </li>\n' ) % vars()
 197 -            print '</ul>\n'
 198 -            # Link for removing this page 
 199 -            print ('<p><a href="%(page_name)s?action=TranslationMenu&' +
 200 -                   'do=unset&page=%(page_name)s">' +
 201 -                   'Remove this page from Group</a></p>\n' ) % vars()
 202 +#                print (' ( <a href="%(page_name)s?' +
 203 +#                       'action=TranslationMenu&do=unset&page=%(tag)s:%(tail)s">' +
 204 +#                       'remove from group</a> ) </li>\n' ) % vars()
 205  
 206 +                print " ( " 
 207 +                print wikiutil.link_tag("%s?action=TranslationMenu&do=unset&page=%s" % (
 208 +                    wikiutil.quoteWikiname(self.page_name),
 209 +                    tag + ":" + wikiutil.quoteWikiname(tail)),
 210 +                                        _("remove from group"))
 211 +                print " ) "
 212 +                print self.formatter.listitem(0)
 213 +            print self.formatter.bullet_list(0)
 214 +            # Link for removing this page 
 215 +            print self.formatter.paragraph(1)
 216 +            print wikiutil.link_tag("%s?action=TranslationMenu&do=unset&page=%s" % (
 217 +                wikiutil.quoteWikiname(self.page_name),
 218 +                wikiutil.quoteWikiname(self.page_name)),
 219 +                                    _("Remove this page from group"))
 220 +            print self.formatter.paragraph(0)
 221          # Show similar Pages
 222          if request.form.has_key("text_title"):
 223              searchtext = request.form["text_title"].value
 224 @@ -604,15 +644,23 @@
 225              pages.remove(self.inter_wiki_link())
 226          pages.sort()
 227          if len(pages) > 0:
 228 -            print '<h2>Similar Pages</h2>'
 229 -            print '<ul>'
 230 +            print self.formatter.heading(2,'Similar Pages')
 231 +            print self.formatter.bullet_list(1)
 232              for p in pages:
 233                  tag, interwiki, tail = wikiutil.resolve_wiki(p)
 234 -                print '<li>' + language_link(p)
 235 -                print (' ( <a href="%(page_name)s?' +
 236 -                       'action=TranslationMenu&do=set&page=%(tag)s:%(tail)s">' +
 237 -                       'Add</a> ) </li>\n' ) % vars()
 238 -            print '</ul>\n'
 239 +                print self.formatter.listitem(1)
 240 +                print multilang.language_link(p)
 241 +                print " ( "
 242 +                print wikiutil.link_tag("%s?action=TranslationMenu&do=set&page=%s" % (
 243 +                wikiutil.quoteWikiname(self.page_name),
 244 +                tag + ":" + wikiutil.quoteWikiname(tail)),
 245 +                _("Add"))
 246 +                print " ) "
 247 +#                print (' ( <a href="%(page_name)s?' +
 248 +#                       'action=TranslationMenu&do=set&page=%(tag)s:%(tail)s">' +
 249 +#                       'Add</a> ) </li>\n' ) % vars()
 250 +                print self.formatter.listitem(0)
 251 +            print self.formatter.bullet_list(0)
 252  
 253              print """Search 
 254  <form method="POST" action="%s">

Gespeicherte Dateianhänge

Um Dateianhänge in eine Seite einzufügen sollte unbedingt eine Angabe wie attachment:dateiname benutzt werden, wie sie auch in der folgenden Liste der Dateien erscheint. Es sollte niemals die URL des Verweises ("laden") kopiert werden, da sich diese jederzeit ändern kann und damit der Verweis auf die Datei brechen würde.
  • [laden | anzeigen] (2002-08-12 17:25:30, 4.6 KB) [[attachment:257929.gif]]
  • [laden | anzeigen] (2004-05-20 18:56:10, 16.2 KB) [[attachment:RecentChanges.html]]
  • [laden | anzeigen] (2003-02-03 22:59:53, 2.0 KB) [[attachment:TranslationMenu.py]]
  • [laden | anzeigen] (2002-05-25 23:20:07, 5.0 KB) [[attachment:Waldmann_Thomas.gif]]
  • [laden | anzeigen] (2004-08-20 23:00:43, 8.2 KB) [[attachment:error.html]]
  • [laden | anzeigen] (2002-10-05 22:33:09, 1.6 KB) [[attachment:gpg-public-key.asc]]
  • [laden | anzeigen] (2002-12-16 17:10:09, 1.2 KB) [[attachment:hitcounts.diff]]
  • [laden | anzeigen] (2002-10-29 08:56:13, 2.8 KB) [[attachment:linuxworld.gif]]
  • [laden | anzeigen] (2002-12-11 12:16:03, 11.6 KB) [[attachment:moinmoin-02-12-11.diff]]
  • [laden | anzeigen] (2003-01-22 10:54:05, 24.0 KB) [[attachment:multilang-2003-01-22.diff]]
 Alle Dateien | Ausgewählte Dateien: löschen verschieben auf Seite kopieren auf Seite

Sie dürfen keine Anhänge an diese Seite anhängen!