/usr/share/pyshared/MoinMoin/action/MyPages.py is in python-moinmoin 1.9.3-1ubuntu2.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | # -*- coding: iso-8859-1 -*-
"""
MoinMoin - MyPages - assisting creation of Homepage subpages
@copyright: 2005-2006 Bastian Blank, Florian Festi, Thomas Waldmann
@license: GNU GPL, see COPYING for details.
"""
def execute(pagename, request):
from MoinMoin import wikiutil
from MoinMoin.Page import Page
_ = request.getText
thispage = Page(request, pagename)
if request.user.valid:
username = request.user.name
else:
username = ''
if not username:
request.theme.add_msg(_('Please log in first.'), "error")
return thispage.send_page()
userhomewiki = request.cfg.user_homewiki
if userhomewiki != 'Self' and userhomewiki != request.cfg.interwikiname:
interwiki = wikiutil.getInterwikiHomePage(request, username=username)
wikitag, wikiurl, wikitail, wikitag_bad = wikiutil.resolve_interwiki(request, *interwiki)
wikiurl = wikiutil.mapURL(request, wikiurl)
homepageurl = wikiutil.join_wiki(wikiurl, wikitail)
request.http_redirect('%s?action=MyPages' % homepageurl)
homepage = Page(request, username)
if not homepage.exists():
request.theme.add_msg(_('Please first create a homepage before creating additional pages.'), "error")
return homepage.send_page()
pagecontent = _("""\
You can add some additional sub pages to your already existing homepage here.
You can choose how open to other readers or writers those pages shall be,
access is controlled by group membership of the corresponding group page.
Just enter the sub page's name and click on the button to create a new page.
Before creating access protected pages, make sure the corresponding group page
exists and has the appropriate members in it. Use HomepageGroupsTemplate for creating
the group pages.
||'''Add a new personal page:'''||'''Related access control list group:'''||
||<<NewPage(HomepageReadWritePageTemplate,read-write page,%(username)s)>>||[[%(username)s/ReadWriteGroup]]||
||<<NewPage(HomepageReadPageTemplate,read-only page,%(username)s)>>||[[%(username)s/ReadGroup]]||
||<<NewPage(HomepagePrivatePageTemplate,private page,%(username)s)>>||%(username)s only||
""")
pagecontent = pagecontent % locals()
pagecontent = pagecontent.replace('\n', '\r\n')
from MoinMoin.parser.text_moin_wiki import Parser as WikiParser
# This action generate data using the user language
request.setContentLanguage(request.lang)
request.theme.send_title(_('MyPages management'), page=homepage)
parser = WikiParser(pagecontent, request)
p = Page(request, "$$$")
request.formatter.setPage(p)
parser.format(request.formatter)
# Start content - IMPORTANT - without content div, there is no direction support!
request.write(request.formatter.startContent("content"))
request.write(request.formatter.endContent())
request.theme.send_footer(homepage.page_name)
request.theme.send_closing_html()
|