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
|
from MoinMoin.theme.modernized import Theme as _Theme
from MoinMoin.Page import Page
from MoinMoin import wikiutil
class Theme(_Theme):
# Hook to add an override stylesheet, favicon, iPhone icon, and viewport
# tag
def universal_edit_button(self, d, **k):
return u'\n'.join([
('<meta name="viewport" content="width=device-width, '
'initial-scale=1" />'),
('<link rel="shortcut icon" href="/WikiStatic?'
'action=AttachFile&do=get&target=favicon.ico">'),
('<link rel="apple-touch-icon-precomposed" href="/WikiStatic?'
'action=AttachFile&do=get&target=iphone-icon.png"/>'),
('<link rel="stylesheet" type="text/css" charset="utf-8" '
'media="all" href="/WikiStatic?'
'action=AttachFile&do=get&target=mcrute.css">'),
('<script type="text/javascript" src="/WikiStatic?'
'action=AttachFile&do=get&target=dnd-upload.js">'
'</script>'),
]) + _Theme.universal_edit_button(self, d, **k)
# Hook to add a Home link to the header links next to the logo
def username(self, d):
html = _Theme.username(self, d)
first_tag = html.index('>') + 1
page = wikiutil.getFrontPage(self.request)
return u'{} {} <span class="sep"> | </span> {}'.format(
html[:first_tag], page.link_to_raw(self.request, "Home"),
html[first_tag:])
def editbarItems(self, page):
actions = _Theme.editbarItems(self, page)
# Add quick link actions for starting/stopping activities
if page.pi['format'] == 'timecsv':
actions.insert(len(actions) - 1, page.link_to(
self.request, text='Start Activity',
querystr={ 'action': 'StartActivity' }, rel='nofollow'))
actions.insert(len(actions) - 1, page.link_to(
self.request, text='Stop Activity',
querystr={ 'action': 'StopActivity' }, rel='nofollow'))
return actions
def send_title(self, text, **keywords):
if 'editor_mode' in keywords:
if 'body_attr' in keywords:
keywords['body_attr'] += 'id="page-editor"'
else:
keywords['body_attr'] = 'id="page-editor"'
return _Theme.send_title(self, text, **keywords)
def execute(request):
return Theme(request)
|