comparison MoinMoin/theme/__init__.py @ 1787:f4a941fe32f8

added SisterSites/SisterPages support
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 22 Feb 2007 13:45:23 +0100
parents 2668d470091f
children 6dd2e29acffe
comparison
equal deleted inserted replaced
1786:2c9853dc11f8 1787:f4a941fe32f8
4 4
5 @copyright: 2003-2006 by MoinMoin:ThomasWaldmann 5 @copyright: 2003-2006 by MoinMoin:ThomasWaldmann
6 @license: GNU GPL, see COPYING for details. 6 @license: GNU GPL, see COPYING for details.
7 """ 7 """
8 8
9 from MoinMoin import i18n, wikiutil, config, version 9 from MoinMoin import i18n, wikiutil, config, version, caching
10 from MoinMoin.Page import Page 10 from MoinMoin.Page import Page
11 from MoinMoin.util import pysupport 11 from MoinMoin.util import pysupport
12 12
13 modules = pysupport.getPackageModules(__file__) 13 modules = pysupport.getPackageModules(__file__)
14 14
434 else: 434 else:
435 cls = 'userlink' 435 cls = 'userlink'
436 items.append(item % (cls, link)) 436 items.append(item % (cls, link))
437 found[pagename] = 1 437 found[pagename] = 1
438 438
439 # Add current page at end 439 # Add current page at end of local pages
440 if not current in found: 440 if not current in found:
441 title = d['page'].split_title() 441 title = d['page'].split_title()
442 title = self.shortenPagename(title) 442 title = self.shortenPagename(title)
443 link = d['page'].link_to(request, title) 443 link = d['page'].link_to(request, title)
444 cls = 'current' 444 cls = 'current'
445 items.append(item % (cls, link)) 445 items.append(item % (cls, link))
446
447 # Add sister pages.
448 for sistername in request.cfg.sistersites: # TODO: sort?
449 if sistername == request.cfg.interwikiname: # it is THIS wiki
450 cls = 'sisterwiki current'
451 items.append(item % (cls, sistername))
452 else:
453 # TODO optimize performance
454 cache = caching.CacheEntry(request, 'sisters', sistername, 'farm', use_pickle=True)
455 if cache.exists():
456 data = cache.content()
457 sisterpages = data['sisterpages']
458 if current in sisterpages:
459 cls = 'sisterwiki'
460 url = sisterpages[current]
461 link = request.formatter.url(1, url) + \
462 request.formatter.text(sistername) +\
463 request.formatter.url(0)
464 items.append(item % (cls, link))
446 465
447 # Assemble html 466 # Assemble html
448 items = u''.join(items) 467 items = u''.join(items)
449 html = u''' 468 html = u'''
450 <ul id="navibar"> 469 <ul id="navibar">