annotate MoinMoin/action/SlideShow.py @ 5094:180956b08fa2

action.Slideshow: fixed bug for no headings of level 1
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 12 Sep 2009 20:38:51 +0200
parents f17dd8cc0347
children c365adadb7f7
rev   line source
5092
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
2 """
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
3 MoinMoin - SlideShow action
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
4
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
5 Treat a wiki page as a set of slides. Displays a single slide at a
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
6 time, along with a navigation aid.
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
7
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
8 A slide show page uses headings level 1 to define slides::
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
9 #pragma date Sept 04 2009
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
10 #pragma Your Name
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
11
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
12 General introduction or comments
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
13
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
14 = Slide 1 =
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
15 Slide 1 contents
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
16
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
17 = Slide 2 =
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
18 Slide 2 contents ...
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
19
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
20 Selecting SlideShow from the "More Actions" menu will display the
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
21 first slide with navigation links at the top of the screen.
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
22 Move between slides by clicking the links or with the arrow keys.
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
23
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
24 @copyright: 2005 Jim Clark,
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
25 2005 Nir Soffer,
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
26 2008 MoinMoin:ThomasWaldmann,
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
27 2009 MoinMoin:ReimarBauer
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
28 @license: GNU GPL, see COPYING for details.
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
29 """
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
30
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
31 import re, time
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
32
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
33 from MoinMoin import wikiutil, i18n, error
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
34 from MoinMoin.Page import Page
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
35
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
36 Dependencies = ['language']
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
37
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
38
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
39 class Error(error.Error):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
40 """ Raised for errors in this module """
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
41
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
42 # This could be delivered in a separate plugin, but
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
43 # it is more convenient to have everything in one module.
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
44
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
45 class WikiSlideParser(object):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
46 """ Parse slides using wiki format
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
47
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
48 Typical usage::
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
49 for title, start, end in WikiSlideParser().parse(text):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
50 slides.append((title, start, end))
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
51
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
52 If you want to override this parser, you can add 'slideshow_wiki'
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
53 parser plugin, that provides a SlideParser class.
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
54 """
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
55 _heading_pattern = re.compile(r"""
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
56 # TODO: check, mhz found bug here
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
57 (?P<skip>{{{(?:.*\n)+?}}}) |
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
58 # Match headings level 1
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
59 (?P<heading>^=\s(?P<text>.*)\s=$\n?)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
60 """, re.MULTILINE | re.UNICODE | re.VERBOSE)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
61
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
62 def parse(self, text):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
63 """ Parse slide data in text
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
64
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
65 Wiki slides are defined by the headings, ignoring the text
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
66 before the first heading. This parser finds all headings,
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
67 skipping headings in preformatted code areas.
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
68
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
69 Returns an iterator over slide data. For each slide, a tuple
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
70 (title, bodyStart, bodyEnd) is returned. bodyStart and bodyEnd
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
71 are indexes into text.
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
72 """
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
73 matches = [match for match in self._heading_pattern.finditer(text)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
74 if match.start('skip') == -1]
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
75
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
76 for i in range(len(matches)):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
77 title = matches[i].group('text').strip()
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
78 bodyStart = matches[i].end('heading')
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
79 try:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
80 bodyEnd = matches[i + 1].start('heading')
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
81 except IndexError:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
82 bodyEnd = len(text)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
83 yield title, bodyStart, bodyEnd
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
84
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
85
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
86 class SlidePage(Page):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
87 """ A wiki page containing a slideshow
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
88
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
89 The slides are parsed according to the page #format xxx processing
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
90 instruction. This module implements only a wiki format slide parser.
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
91
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
92 To support other formats like rst, add a 'slideshow_rst' parser
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
93 plugin, providing SlideParser class, implementing the SlideParser
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
94 protocol. See WikiSlideParser for details.
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
95 """
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
96 defaultFormat = 'wiki'
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
97 defaultParser = WikiSlideParser
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
98
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
99 def __init__(self, request, name, **keywords):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
100 Page.__init__(self, request, name, **keywords)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
101 self._slideIndex = None
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
102 self.counter = ''
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
103
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
104 def __len__(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
105 """ Return the slide count """
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
106 return len(self.slideIndex())
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
107
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
108 def isEmpty(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
109 return len(self) == 0
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
110
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
111 # Slide accessing methods map 1 based slides to 0 based index.
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
112
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
113 def titleAt(self, number):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
114 """ Return the title of slide number """
5094
180956b08fa2 action.Slideshow: fixed bug for no headings of level 1
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5092
diff changeset
115 try:
180956b08fa2 action.Slideshow: fixed bug for no headings of level 1
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5092
diff changeset
116 return self.slideIndex()[number - 1][0]
180956b08fa2 action.Slideshow: fixed bug for no headings of level 1
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5092
diff changeset
117 except IndexError:
180956b08fa2 action.Slideshow: fixed bug for no headings of level 1
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5092
diff changeset
118 return 1
5092
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
119
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
120 def bodyAt(self, number):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
121 """ Return the body of slide number """
5094
180956b08fa2 action.Slideshow: fixed bug for no headings of level 1
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5092
diff changeset
122 try:
180956b08fa2 action.Slideshow: fixed bug for no headings of level 1
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5092
diff changeset
123 start, end = self.slideIndex()[number - 1][1:]
180956b08fa2 action.Slideshow: fixed bug for no headings of level 1
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5092
diff changeset
124 return self.get_raw_body()[start:end]
180956b08fa2 action.Slideshow: fixed bug for no headings of level 1
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5092
diff changeset
125 except IndexError:
180956b08fa2 action.Slideshow: fixed bug for no headings of level 1
Reimar Bauer <rb.proj AT googlemail DOT com>
parents: 5092
diff changeset
126 return self.get_raw_body()
5092
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
127
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
128 # Private ----------------------------------------------------------------
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
129
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
130 def slideIndex(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
131 if self._slideIndex is None:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
132 self.parseSlides()
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
133 return self._slideIndex
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
134
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
135 def parseSlides(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
136 body = self.get_raw_body()
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
137 self._slideIndex = []
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
138 parser = self.createSlideParser()
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
139 for title, bodyStart, bodyEnd in parser.parse(body):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
140 self._slideIndex.append((title, bodyStart, bodyEnd))
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
141
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
142 def createSlideParser(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
143 """ Import plugin and return parser class
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
144
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
145 If plugin is not found, and format is not defaultFormat, raise an error.
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
146 For defaultFormat, use builtin defaultParser in this module.
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
147 """
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
148 format = self.pi['format']
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
149 plugin = 'slideshow_' + format
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
150 try:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
151 Parser = wikiutil.importPlugin(self.request.cfg, 'parser', plugin, 'SlideParser')
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
152 except wikiutil.PluginMissingError:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
153 if format != self.defaultFormat:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
154 raise Error('SlideShow does not support %s format.' % format)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
155 Parser = self.defaultParser
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
156 return Parser()
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
157
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
158
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
159 class SlideshowAction:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
160
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
161 name = 'SlideShow'
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
162 maxSlideLinks = 15
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
163
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
164 def __init__(self, request, pagename, template):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
165 self.request = request
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
166 self.page = SlidePage(self.request, pagename)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
167 self.template = template
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
168
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
169 # Cache values used many times
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
170 self.pageURL = self.page.url(request)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
171
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
172 def execute(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
173 _ = self.request.getText
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
174 try:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
175 self.setSlideNumber()
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
176 language = self.page.pi['language']
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
177 self.request.setContentLanguage(language)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
178 self.request.write(self.template % self)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
179 except Error, err:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
180 self.page.send_page(self.request, msg=unicode(err))
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
181
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
182 # Private ----------------------------------------------------------------
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
183
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
184 def setSlideNumber(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
185 try:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
186 slideNumber = int(self.request.values.get('n', 1))
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
187 if not 1 <= slideNumber <= len(self.page):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
188 slideNumber = 1
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
189 except ValueError:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
190 slideNumber = 1
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
191 self.slideNumber = slideNumber
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
192
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
193 def createParser(self, format, text):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
194 if format == "wiki":
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
195 format = 'text_moin_wiki'
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
196 try:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
197 Parser = wikiutil.importPlugin(self.request.cfg, 'parser', format,
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
198 'Parser')
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
199 except wikiutil.PluginMissingError:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
200 from MoinMoin.parser.text import Parser
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
201 parser = Parser(text, self.request)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
202 return parser
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
203
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
204 def createFormatter(self, format):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
205 try:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
206 Formatter = wikiutil.importPlugin(self.request.cfg, 'formatter',
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
207 format, 'Formatter')
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
208 except wikiutil.PluginMissingError:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
209 from MoinMoin.formatter.text_plain import Formatter
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
210
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
211 formatter = Formatter(self.request)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
212 self.request.formatter = formatter
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
213 formatter.page = self.page
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
214 return formatter
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
215
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
216 def languageAttributes(self, lang):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
217 return ' lang="%s" dir="%s"' % (lang, i18n.getDirection(lang))
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
218
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
219 def linkToPage(self, text, query='', **attributes):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
220 """ Return a link to current page """
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
221 if query:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
222 url = '%s?%s' % (self.pageURL, query)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
223 else:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
224 url = self.pageURL
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
225 return self.formatLink(url, text, **attributes)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
226
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
227 def linkToSlide(self, number, text, **attributes):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
228 """ Return a link to current page """
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
229 if number == self.slideNumber:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
230 return self.disabledLink(text, **attributes)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
231
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
232 url = '%s?action=%s&n=%s' % (self.pageURL, self.name, number)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
233 return self.formatLink(url, text, **attributes)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
234
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
235 def disabledLink(self, text, **attributes):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
236 return '<span%s>%s</span>' % (self.formatAttributes(attributes), text)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
237
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
238 def formatLink(self, url, text, **attributes):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
239 return '<a href="%(url)s"%(attributes)s>%(text)s</a>' % {
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
240 'url': wikiutil.escape(url),
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
241 'attributes': self.formatAttributes(attributes),
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
242 'text': wikiutil.escape(text),
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
243 }
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
244
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
245 def formatAttributes(self, attributes):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
246 """ Return formatted attributes string """
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
247 formattedPairs = [' %s="%s"' % (k, v) for k, v in attributes.items()]
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
248 return ''.join(formattedPairs)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
249
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
250 def adaptToLanguage(self, direction):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
251 # In RTL, directional items should be switched
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
252 if i18n.getDirection(self.request.lang) == 'rtl':
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
253 return not direction
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
254 return direction
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
255
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
256 def forwardIcon(self, forward=True):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
257 return [u'\u2190', u'\u2192'][self.adaptToLanguage(forward)]
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
258
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
259 def backIcon(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
260 return self.forwardIcon(False)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
261
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
262 # Key codes constants
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
263 rightArrowKey = 39
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
264 leftArrowKey = 37
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
265
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
266 def slideLinksRange(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
267 """ Return range of slides to display, current centered """
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
268 other = self.maxSlideLinks - 1 # other slides except current
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
269 first, last = self.first_slide(), self.last_slide()
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
270 start = max(first, self.slideNumber - other / 2)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
271 end = min(start + other, last)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
272 start = max(first, end - other)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
273 return range(start, end + 1)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
274
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
275 def first_slide(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
276 return 1
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
277
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
278 def next_slide(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
279 return min(self.slideNumber + 1, self.last_slide())
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
280
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
281 def previous_slide(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
282 return max(self.slideNumber - 1, self.first_slide())
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
283
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
284 def last_slide(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
285 return max(len(self.page), 1)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
286
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
287 # Replacing methods ------------------------------------------------------
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
288
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
289 def __getitem__(self, name):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
290 item = getattr(self, 'item_' + name)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
291 if callable(item):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
292 return item()
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
293 else:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
294 return item
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
295
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
296 def item_language_attribtues(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
297 return self.languageAttributes(self.request.content_lang)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
298
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
299 def item_theme_url(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
300 return '%s/%s' % (self.request.cfg.url_prefix_static, self.request.theme.name)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
301
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
302 item_action_name = name
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
303
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
304 def item_title(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
305 return wikiutil.escape(self.page.page_name)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
306
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
307 def item_slide_title(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
308 return wikiutil.escape(self.page.titleAt(self.slideNumber))
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
309
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
310 def item_slide_body(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
311 text = self.page.bodyAt(self.slideNumber)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
312 format = self.page.pi['format']
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
313 parser = self.createParser(format, text)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
314 formatter = self.createFormatter('text_html')
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
315 return self.request.redirectedOutput(parser.format, formatter)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
316
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
317 def item_navigation_language_attributes(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
318 return self.languageAttributes(self.request.lang)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
319
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
320 def item_navigation_edit(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
321 _ = self.request.getText
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
322 text = _('Edit')
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
323 if self.request.user.may.write(self.page.page_name):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
324 return self.linkToPage(text, 'action=edit', title=_('Edit slide show'))
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
325 return self.disabledLink(text, title=_("you may need to login to edit this page"))
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
326
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
327 def item_navigation_quit(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
328 _ = self.request.getText
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
329 return self.linkToPage(_('Quit'), title=_('Quit slide show'))
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
330
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
331 def item_navigation_start(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
332 _ = self.request.getText
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
333 number = self.first_slide()
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
334 return self.linkToSlide(number, '|', title=_('Show first slide (up arrow)'))
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
335
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
336 def item_navigation_end(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
337 _ = self.request.getText
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
338 number = self.last_slide()
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
339 return self.linkToSlide(number, '|', title=_('Show last slide (down arrow)'))
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
340
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
341 def item_navigation_back(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
342 _ = self.request.getText
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
343 number = self.previous_slide()
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
344 return self.linkToSlide(number, text=self.backIcon(), title=_('Show previous slide (back arrow)'))
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
345
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
346 def item_navigation_forward(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
347 _ = self.request.getText
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
348 number = self.next_slide()
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
349 return self.linkToSlide(number, self.forwardIcon(), title=_('Show next slide (forward arrow)'))
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
350
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
351 def item_forward_key(self, forward=True):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
352 return (self.leftArrowKey, self.rightArrowKey)[self.adaptToLanguage(forward)]
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
353
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
354 def item_back_key(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
355 return self.item_forward_key(False)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
356
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
357 def item_navigation_slides(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
358 items = []
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
359 for i in self.slideLinksRange():
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
360 attributes = {'title': self.page.titleAt(i)}
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
361 if i == self.slideNumber:
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
362 attributes = {'class': 'current'}
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
363 items.append(self.linkToSlide(i, i, **attributes))
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
364 items = ['<li>%s</li>' % item for item in items]
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
365 return '\n'.join(items)
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
366
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
367 def item_slide_link_base(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
368 return wikiutil.escape(self.pageURL) + '?action=%s&n=' % self.name
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
369
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
370 item_next_slide = next_slide
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
371 item_previous_slide = previous_slide
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
372 item_first_slide = first_slide
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
373 item_last_slide = last_slide
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
374
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
375 def item_date(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
376 return wikiutil.escape(self.request.getPragma('date', defval=''))
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
377
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
378 def item_author(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
379 return wikiutil.escape(self.request.getPragma('author', defval=''))
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
380
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
381 def item_counter(self):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
382 return "%d|%d" % (self.slideNumber, self.last_slide())
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
383
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
384 # This is quite stupid template, but it cleans most of the code from
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
385 # html. With smarter templates, there will be no html in the action code.
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
386 template = """
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
387 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
388 "http://www.w3.org/TR/html4/strict.dtd">
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
389
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
390 <html%(language_attribtues)s>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
391 <head>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
392 <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
393 <meta name="robots" content="noindex,nofollow">
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
394 <title>%(title)s</title>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
395
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
396 <script type="text/javascript">
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
397 function getKey(e) {
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
398 // Support multiple browsers stupidity
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
399 var key;
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
400 if (e == null) {
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
401 // IE
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
402 key = event.keyCode;
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
403 } else {
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
404 // Standards compliant
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
405 if (e.altKey || e.ctrlKey) {
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
406 return null;
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
407 }
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
408 key = e.which;
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
409 }
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
410 return key;
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
411 }
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
412
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
413 function go(slide) {
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
414 window.location="%(slide_link_base)s" + slide;
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
415 }
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
416
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
417 function onkeydown(e) {
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
418 switch(getKey(e)) {
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
419 // presenter maybe rather wants to use up/down for scrolling content!
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
420 // case 38: go('%(first_slide)s'); break; // up arrow
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
421 // case 40: go('%(last_slide)s'); break; // down arrow
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
422 case %(forward_key)s: go('%(next_slide)s'); break;
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
423 case %(back_key)s: go('%(previous_slide)s'); break;
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
424 default: return true; // pass event to browser
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
425 }
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
426 // Return false to consume the event
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
427 return false;
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
428 }
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
429
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
430 document.onkeydown = onkeydown
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
431 </script>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
432
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
433 <link rel="stylesheet" type="text/css" charset="utf-8" media="all"
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
434 href="%(theme_url)s/css/%(action_name)s.css">
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
435 </head>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
436
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
437 <body>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
438 <h1>%(slide_title)s</h1>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
439
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
440 <div id="content">
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
441 %(slide_body)s
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
442 </div>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
443
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
444 <div id="navigation"%(navigation_language_attributes)s>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
445 <ul>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
446 <li>%(navigation_edit)s</li>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
447 <li>%(navigation_quit)s</li>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
448 <li>%(navigation_start)s</li>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
449 <li>%(navigation_back)s</li>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
450 %(navigation_slides)s
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
451 <li>%(navigation_forward)s</li>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
452 <li>%(navigation_end)s</li>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
453 </ul>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
454 </div>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
455 <div id="footer">
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
456 <ul id="date">%(date)s</ul>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
457 <ul id="author">%(author)s</ul>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
458 <ul id="counter">%(counter)s</ul>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
459 </div>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
460 <!--
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
461 <p><a href="http://validator.w3.org/check?uri=referer">
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
462 Valid HTML 4.01</a>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
463 </p>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
464 -->
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
465 </body>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
466 </html>
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
467 """
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
468
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
469
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
470 def execute(pagename, request):
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
471 """ Glue to current plugin system """
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
472 SlideshowAction(request, pagename, template).execute()
f17dd8cc0347 action SlideShow and its css (changeset 419:ca495f80cc5c) from moin/extensions added (slightly refactored).
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
473