~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to MoinMoin/macro/MonthCalendar.py

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mfrom: (0.9.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080622211713-fpo2zrq3s5dfecxg
Tags: 1.7.0-3
Simplify /etc/moin/wikilist format: "USER URL" (drop unneeded middle
CONFIG_DIR that was wrongly advertised as DATA_DIR).  Make
moin-mass-migrate handle both formats and warn about deprecation of
the old one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
    The days are links to Wiki pages following this naming convention:
7
7
    BasePageName/year-month-day
8
8
 
9
 
    @copyright: 2002-2005 by Thomas Waldmann <ThomasWaldmann@gmx.de>
10
 
    @license: GNU GPL - see COPYING for details.
 
9
    @copyright: 2002-2007 MoinMoin:ThomasWaldmann
 
10
    @license: GNU GPL, see COPYING for details.
11
11
 
12
12
    Revisions:
13
13
    * first revision without a number (=1.0):
87
87
        * do a correct calculation of "today" using user's timezone
88
88
    * 2.2:
89
89
        * added template argument for specifying an edit template for new pages
 
90
    * 2.3:
 
91
        * adapted to moin 1.7 new macro parameter parsing
90
92
 
91
93
    Usage:
92
 
        [[MonthCalendar(BasePage,year,month,monthoffset,monthoffset2,height6)]]
 
94
        <<MonthCalendar(BasePage,year,month,monthoffset,monthoffset2,height6)>>
93
95
 
94
96
        each parameter can be empty and then defaults to currentpage or currentdate or monthoffset=0
95
97
 
96
98
    Samples (paste that to one of your pages for a first try):
97
99
 
98
100
Calendar of current month for current page:
99
 
[[MonthCalendar]]
 
101
<<MonthCalendar>>
100
102
 
101
103
Calendar of last month:
102
 
[[MonthCalendar(,,,-1)]]
 
104
<<MonthCalendar(,,,-1)>>
103
105
 
104
106
Calendar of next month:
105
 
[[MonthCalendar(,,,+1)]]
 
107
<<MonthCalendar(,,,+1)>>
106
108
 
107
109
Calendar of Page SampleUser, this years december:
108
 
[[MonthCalendar(SampleUser,,12)]]
 
110
<<MonthCalendar(SampleUser,,12)>>
109
111
 
110
112
Calendar of current Page, this years december:
111
 
[[MonthCalendar(,,12)]]
 
113
<<MonthCalendar(,,12)>>
112
114
 
113
115
Calendar of December, 2001:
114
 
[[MonthCalendar(,2001,12)]]
 
116
<<MonthCalendar(,2001,12)>>
115
117
 
116
118
Calendar of the month two months after December, 2001
117
119
(maybe doesn't make much sense, but is possible)
118
 
[[MonthCalendar(,2001,12,+2)]]
 
120
<<MonthCalendar(,2001,12,+2)>>
119
121
 
120
122
Calendar of year 2002 (every month padded to height of 6):
121
123
||||||Year 2002||
122
 
||[[MonthCalendar(,2002,1,,,1)]]||[[MonthCalendar(,2002,2,,,1)]]||[[MonthCalendar(,2002,3,,,1)]]||
123
 
||[[MonthCalendar(,2002,4,,,1)]]||[[MonthCalendar(,2002,5,,,1)]]||[[MonthCalendar(,2002,6,,,1)]]||
124
 
||[[MonthCalendar(,2002,7,,,1)]]||[[MonthCalendar(,2002,8,,,1)]]||[[MonthCalendar(,2002,9,,,1)]]||
125
 
||[[MonthCalendar(,2002,10,,,1)]]||[[MonthCalendar(,2002,11,,,1)]]||[[MonthCalendar(,2002,12,,,1)]]||
 
124
||<<MonthCalendar(,2002,1,,,1)>>||<<MonthCalendar(,2002,2,,,1)>>||<<MonthCalendar(,2002,3,,,1)>>||
 
125
||<<MonthCalendar(,2002,4,,,1)>>||<<MonthCalendar(,2002,5,,,1)>>||<<MonthCalendar(,2002,6,,,1)>>||
 
126
||<<MonthCalendar(,2002,7,,,1)>>||<<MonthCalendar(,2002,8,,,1)>>||<<MonthCalendar(,2002,9,,,1)>>||
 
127
||<<MonthCalendar(,2002,10,,,1)>>||<<MonthCalendar(,2002,11,,,1)>>||<<MonthCalendar(,2002,12,,,1)>>||
126
128
 
127
129
Current calendar of me, also showing entries of A and B:
128
 
[[MonthCalendar(MyPage*TestUserA*TestUserB)]]
 
130
<<MonthCalendar(MyPage*TestUserA*TestUserB)>>
129
131
 
130
132
SubPage calendars:
131
 
[[MonthCalendar(MyName/CalPrivate)]]
132
 
[[MonthCalendar(MyName/CalBusiness)]]
133
 
[[MonthCalendar(MyName/CalBusiness*MyName/CalPrivate)]]
 
133
<<MonthCalendar(MyName/CalPrivate)>>
 
134
<<MonthCalendar(MyName/CalBusiness)>>
 
135
<<MonthCalendar(MyName/CalBusiness*MyName/CalPrivate)>>
134
136
 
135
137
 
136
138
Anniversary Calendars: (no year data)
137
 
[[MonthCalendar(Yearly,,,+1,,6,1)]]
 
139
<<MonthCalendar(Yearly,,,+1,,6,1)>>
138
140
 
139
 
This creates calendars of the format Yearly/MM-DD 
140
 
By leaving out the year, you can set birthdays, and anniversaries in this 
 
141
This creates calendars of the format Yearly/MM-DD
 
142
By leaving out the year, you can set birthdays, and anniversaries in this
141
143
calendar and not have to re-enter each year.
142
144
 
143
145
This creates a calendar which uses MonthCalendarTemplate for directly editing
144
146
nonexisting day pages:
145
 
[[MonthCalendar(,,,,,,MonthCalendarTemplate)]]
 
147
<<MonthCalendar(,,,,,,MonthCalendarTemplate)>>
146
148
"""
147
149
 
148
 
Dependencies = ['namespace','time']
 
150
Dependencies = ['namespace', 'time', ]
 
151
 
 
152
import re, calendar, time
149
153
 
150
154
from MoinMoin import wikiutil
151
155
from MoinMoin.Page import Page
152
 
import re, calendar, time
153
156
 
154
157
# The following line sets the calendar to have either Sunday or Monday as
155
158
# the first day of the week. Only SUNDAY or MONDAY (case sensitive) are
158
161
# XXX change here ----------------vvvvvv
159
162
calendar.setfirstweekday(calendar.MONDAY)
160
163
 
161
 
def cliprgb(r,g,b): # don't use 255!
162
 
    if r < 0:   r=0
163
 
    if r > 254: r=254
164
 
    if b < 0:   b=0
165
 
    if b > 254: b=254
166
 
    if g < 0:   g=0
167
 
    if g > 254: g=254
168
 
    return r, g, b
 
164
def cliprgb(r, g, b):
 
165
    """ clip r,g,b values into range 0..254 """
 
166
    def clip(x):
 
167
        """ clip x value into range 0..254 """
 
168
        if x < 0:
 
169
            x = 0
 
170
        elif x > 254:
 
171
            x = 254
 
172
        return x
 
173
    return clip(r), clip(g), clip(b)
169
174
 
170
175
def yearmonthplusoffset(year, month, offset):
171
 
    month = month+offset
 
176
    """ calculate new year/month from year/month and offset """
 
177
    month += offset
172
178
    # handle offset and under/overflows - quick and dirty, yes!
173
179
    while month < 1:
174
 
        month = month + 12
175
 
        year = year - 1
 
180
        month += 12
 
181
        year -= 1
176
182
    while month > 12:
177
 
        month = month - 12
178
 
        year = year + 1
 
183
        month -= 12
 
184
        year += 1
179
185
    return year, month
180
186
 
181
 
def parseargs(args, defpagename, defyear, defmonth, defoffset, defoffset2, defheight6, defanniversary, deftemplate):
182
 
    strpagename = args.group('basepage')
183
 
    if strpagename:
184
 
        parmpagename = wikiutil.unquoteWikiname(strpagename)
185
 
    else:
186
 
        parmpagename = defpagename
 
187
def parseargs(request, args, defpagename, defyear, defmonth, defoffset, defoffset2, defheight6, defanniversary, deftemplate):
 
188
    """ parse macro arguments """
 
189
    args = wikiutil.parse_quoted_separated(args, name_value=False)
 
190
    args += [None] * 8 # fill up with None to trigger defaults
 
191
    parmpagename, parmyear, parmmonth, parmoffset, parmoffset2, parmheight6, parmanniversary, parmtemplate = args[:8]
 
192
    parmpagename = wikiutil.get_unicode(request, parmpagename, 'pagename', defpagename)
 
193
    parmyear = wikiutil.get_int(request, parmyear, 'year', defyear)
 
194
    parmmonth = wikiutil.get_int(request, parmmonth, 'month', defmonth)
 
195
    parmoffset = wikiutil.get_int(request, parmoffset, 'offset', defoffset)
 
196
    parmoffset2 = wikiutil.get_int(request, parmoffset2, 'offset2', defoffset2)
 
197
    parmheight6 = wikiutil.get_bool(request, parmheight6, 'height6', defheight6)
 
198
    parmanniversary = wikiutil.get_bool(request, parmanniversary, 'anniversary', defanniversary)
 
199
    parmtemplate = wikiutil.get_unicode(request, parmtemplate, 'template', deftemplate)
 
200
 
187
201
    # multiple pagenames separated by "*" - split into list of pagenames
188
202
    parmpagename = re.split(r'\*', parmpagename)
189
203
 
190
 
    stryear = args.group('year')
191
 
    if stryear:
192
 
        parmyear = int(stryear)
193
 
    else:
194
 
        parmyear = defyear
195
 
 
196
 
    strmonth = args.group('month')
197
 
    if strmonth:
198
 
        parmmonth = int(strmonth)
199
 
    else:
200
 
        parmmonth = defmonth
201
 
    
202
 
    stroffset = args.group('offset')
203
 
    if stroffset:
204
 
        parmoffset = int(stroffset)
205
 
    else:
206
 
        parmoffset = defoffset
207
 
 
208
 
    stroffset2 = args.group('offset2')
209
 
    if stroffset2:
210
 
        parmoffset2 = int(stroffset2)
211
 
    else:
212
 
        parmoffset2 = defoffset2
213
 
 
214
 
    strheight6 = args.group('height6')
215
 
    if strheight6:
216
 
        parmheight6 = int(strheight6)
217
 
    else:
218
 
        parmheight6 = defheight6
219
 
 
220
 
    stranniversary = args.group('anniversary')
221
 
    if stranniversary:
222
 
            parmanniversary = int(stranniversary)
223
 
    else:
224
 
        parmanniversary = defanniversary
225
 
 
226
 
    strtemplate = args.group('template')
227
 
    if strtemplate:
228
 
        parmtemplate = wikiutil.unquoteWikiname(strtemplate)
229
 
    else:
230
 
        parmtemplate = deftemplate
231
204
    return parmpagename, parmyear, parmmonth, parmoffset, parmoffset2, parmheight6, parmanniversary, parmtemplate
232
 
        
233
 
# FIXME:                          vvvvvv is there a better way for matching a pagename ?
234
 
_arg_basepage = r'\s*(?P<basepage>[^, ]+)?\s*'
235
 
_arg_year = r',\s*(?P<year>\d+)?\s*'
236
 
_arg_month = r',\s*(?P<month>\d+)?\s*'
237
 
_arg_offset = r',\s*(?P<offset>[+-]?\d+)?\s*'
238
 
_arg_offset2 = r',\s*(?P<offset2>[+-]?\d+)?\s*'
239
 
_arg_height6 = r',\s*(?P<height6>[+-]?\d+)?\s*'
240
 
_arg_anniversary =  r',\s*(?P<anniversary>[+-]?\d+)?\s*'
241
 
_arg_template = r',\s*(?P<template>[^, ]+)?\s*' # XXX see basepage comment
242
 
_args_re_pattern = r'^(%s)?(%s)?(%s)?(%s)?(%s)?(%s)?(%s)?(%s)?$' % \
243
 
                     (_arg_basepage,_arg_year,_arg_month, \
244
 
                      _arg_offset,_arg_offset2,_arg_height6,_arg_anniversary,_arg_template)
245
 
 
246
205
 
247
206
def execute(macro, text):
248
207
    request = macro.request
253
212
    if request.mode_getpagelinks:
254
213
        return ''
255
214
 
256
 
    args_re = re.compile(_args_re_pattern)
257
 
    
258
215
    currentyear, currentmonth, currentday, h, m, s, wd, yd, ds = request.user.getTime(time.time())
259
216
    thispage = formatter.page.page_name
260
217
    # does the url have calendar params (= somebody has clicked on prev/next links in calendar) ?
261
 
    if macro.form.has_key('calparms'):
 
218
    if 'calparms' in macro.form:
 
219
        has_calparms = 1 # yes!
262
220
        text2 = macro.form['calparms'][0]
263
 
        args2 = args_re.match(text2)
264
 
        if not args2:
265
 
            return ('<p><strong class="error">%s</strong></p>' % _('Invalid MonthCalendar calparms "%s"!')) % (text2,)
266
 
        else:
267
 
            has_calparms = 1 # yes!
 
221
        try:
268
222
            cparmpagename, cparmyear, cparmmonth, cparmoffset, cparmoffset2, cparmheight6, cparmanniversary, cparmtemplate = \
269
 
                parseargs(args2, thispage, currentyear, currentmonth, 0, 0, 0, 0, '')
 
223
                parseargs(request, text2, thispage, currentyear, currentmonth, 0, 0, False, False, u'')
 
224
        except (ValueError, TypeError), err:
 
225
            return macro.format_error(err)
270
226
    else:
271
227
        has_calparms = 0
272
228
 
273
229
    if text is None: # macro call without parameters
 
230
        text = u''
 
231
 
 
232
    # parse and check arguments
 
233
    try:
274
234
        parmpagename, parmyear, parmmonth, parmoffset, parmoffset2, parmheight6, anniversary, parmtemplate = \
275
 
            [thispage], currentyear, currentmonth, 0, 0, 0, 0, ''
276
 
    else:
277
 
        # parse and check arguments
278
 
        args = args_re.match(text)
279
 
        if not args:
280
 
            return ('<p><strong class="error">%s</strong></p>' % _('Invalid MonthCalendar arguments "%s"!')) % (text,)
281
 
        else:
282
 
            parmpagename, parmyear, parmmonth, parmoffset, parmoffset2, parmheight6, anniversary, parmtemplate = \
283
 
                parseargs(args, thispage, currentyear, currentmonth, 0, 0, 0, 0, '')
 
235
            parseargs(request, text, thispage, currentyear, currentmonth, 0, 0, False, False, u'')
 
236
    except (ValueError, TypeError), err:
 
237
        return macro.format_error(err)
284
238
 
285
239
    # does url have calendar params and is THIS the right calendar to modify (we can have multiple
286
240
    # calendars on the same page)?
287
241
    #if has_calparms and (cparmpagename,cparmyear,cparmmonth,cparmoffset) == (parmpagename,parmyear,parmmonth,parmoffset):
288
 
    
 
242
 
289
243
    # move all calendars when using the navigation:
290
244
    if has_calparms and cparmpagename == parmpagename:
291
 
        year,month = yearmonthplusoffset(parmyear, parmmonth, parmoffset + cparmoffset2)
 
245
        year, month = yearmonthplusoffset(parmyear, parmmonth, parmoffset + cparmoffset2)
292
246
        parmoffset2 = cparmoffset2
293
247
        parmtemplate = cparmtemplate
294
248
    else:
295
 
        year,month = yearmonthplusoffset(parmyear, parmmonth, parmoffset)
 
249
        year, month = yearmonthplusoffset(parmyear, parmmonth, parmoffset)
 
250
 
 
251
    if request.isSpiderAgent and abs(currentyear - year) > 1:
 
252
        return '' # this is a bot and it didn't follow the rules (see below)
 
253
    if currentyear == year:
 
254
        attrs = {}
 
255
    else:
 
256
        attrs = {'rel': 'nofollow' } # otherwise even well-behaved bots will index forever
296
257
 
297
258
    # get the calendar
298
259
    monthcal = calendar.monthcalendar(year, month)
299
260
 
300
261
    # european / US differences
301
 
    months = ('January','February','March','April','May','June','July','August','September','October','November','December')
 
262
    months = ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December')
302
263
    # Set things up for Monday or Sunday as the first day of the week
303
264
    if calendar.firstweekday() == calendar.MONDAY:
304
265
        wkend = (5, 6)
309
270
 
310
271
    colorstep = 85
311
272
    p = Page(request, thispage)
312
 
    qpagenames = '*'.join(map(wikiutil.quoteWikinameURL, parmpagename))
 
273
    qpagenames = '*'.join([wikiutil.quoteWikinameURL(pn) for pn in parmpagename])
313
274
    qtemplate = wikiutil.quoteWikinameURL(parmtemplate)
314
275
    querystr = "calparms=%%s,%d,%d,%d,%%d,%%s" % (parmyear, parmmonth, parmoffset)
315
 
    prevlink  = p.url(request, querystr % (qpagenames, parmoffset2 - 1, qtemplate), 0)
316
 
    nextlink  = p.url(request, querystr % (qpagenames, parmoffset2 + 1, qtemplate), 0)
317
 
    prevylink = p.url(request, querystr % (qpagenames, parmoffset2 - 12, qtemplate), 0)
318
 
    nextylink = p.url(request, querystr % (qpagenames, parmoffset2 + 12, qtemplate), 0)
319
 
    prevmonth = formatter.url(1, prevlink, 'cal-link') + '&lt;' + formatter.url(0)
320
 
    nextmonth = formatter.url(1, nextlink, 'cal-link') + '&gt;' + formatter.url(0)
321
 
    prevyear  = formatter.url(1, prevylink, 'cal-link') + '&lt;&lt;' + formatter.url(0)
322
 
    nextyear  = formatter.url(1, nextylink, 'cal-link') + '&gt;&gt;' + formatter.url(0)
323
 
    
 
276
    prevlink = p.url(request, querystr % (qpagenames, parmoffset2 - 1, qtemplate))
 
277
    nextlink = p.url(request, querystr % (qpagenames, parmoffset2 + 1, qtemplate))
 
278
    prevylink = p.url(request, querystr % (qpagenames, parmoffset2 - 12, qtemplate))
 
279
    nextylink = p.url(request, querystr % (qpagenames, parmoffset2 + 12, qtemplate))
 
280
 
 
281
    prevmonth = formatter.url(1, prevlink, 'cal-link', **attrs) + '&lt;' + formatter.url(0)
 
282
    nextmonth = formatter.url(1, nextlink, 'cal-link', **attrs) + '&gt;' + formatter.url(0)
 
283
    prevyear = formatter.url(1, prevylink, 'cal-link', **attrs) + '&lt;&lt;' + formatter.url(0)
 
284
    nextyear = formatter.url(1, nextylink, 'cal-link', **attrs) + '&gt;&gt;' + formatter.url(0)
 
285
 
324
286
    if parmpagename != [thispage]:
325
287
        pagelinks = ''
326
288
        r, g, b = (255, 0, 0)
334
296
        while st < l:
335
297
            ch = parmpagename[0][st:st+chstep]
336
298
            r, g, b = cliprgb(r, g, b)
337
 
            pagelinks = pagelinks + '<a style="%s" href="%s">%s</a>' % \
338
 
                ('background-color:#%02x%02x%02x;color:#000000;text-decoration:none' % \
339
 
                    (r,g,b), Page(request, parmpagename[0]).url(request), ch)
 
299
            link = Page(request, parmpagename[0]).link_to(request, ch,
 
300
                        rel='nofollow',
 
301
                        style='background-color:#%02x%02x%02x;color:#000000;text-decoration:none' % (r, g, b))
 
302
            pagelinks = pagelinks + link
340
303
            r, g, b = (r, g+colorstep, b)
341
304
            st = st + chstep
342
305
        r, g, b = (255-colorstep, 255, 255-colorstep)
343
306
        for page in parmpagename[1:]:
344
 
            pagelinks = pagelinks + '*<a style="%s" href="%s">%s</a>' % \
345
 
                            ('background-color:#%02x%02x%02x;color:#000000;text-decoration:none' % \
346
 
                                (r,g,b), Page(request, page).url(request), page)
 
307
            link = Page(request, page).link_to(request, page,
 
308
                        rel='nofollow',
 
309
                        style='background-color:#%02x%02x%02x;color:#000000;text-decoration:none' % (r, g, b))
 
310
            pagelinks = pagelinks + '*' + link
347
311
        showpagename = '   %s<BR>\n' % pagelinks
348
312
    else:
349
313
        showpagename = ''
367
331
            cssday = "cal-weekend"
368
332
        else:
369
333
            cssday = "cal-workday"
370
 
        restd2.append('  <td class="%s" width="14%%">%s</td>\n' % (cssday, wday))
 
334
        restd2.append('  <td class="%s">%s</td>\n' % (cssday, wday))
371
335
    restr2 = ' <tr>\n%s </tr>\n' % "".join(restd2)
372
 
 
 
336
 
373
337
    if parmheight6:
374
338
        while len(monthcal) < 6:
375
 
            monthcal = monthcal + [[0,0,0,0,0,0,0]]
 
339
            monthcal = monthcal + [[0, 0, 0, 0, 0, 0, 0]]
376
340
 
377
341
    maketip_js = []
378
342
    restrn = []
399
363
                    for match in header1_re.finditer(daycontent):
400
364
                        if match:
401
365
                            title = match.group(1)
402
 
                            title = wikiutil.escape(title).replace("'","\\'")
 
366
                            title = wikiutil.escape(title).replace("'", "\\'")
403
367
                            titletext.append(title)
404
368
                    tipname = link
405
369
                    tiptitle = link
406
370
                    tiptext = '<br>'.join(titletext)
407
371
                    maketip_js.append("maketip('%s','%s','%s');" % (tipname, tiptitle, tiptext))
408
 
                    onmouse = {'onMouseOver': "tip('%s')" % tipname,
409
 
                               'onMouseOut':  "untip()"}
 
372
                    attrs = {'onMouseOver': "tip('%s')" % tipname,
 
373
                             'onMouseOut': "untip()"}
410
374
                else:
411
375
                    csslink = "cal-emptyday"
412
376
                    if parmtemplate:
416
380
                    r, g, b, u = (255, 255, 255, 0)
417
381
                    if wkday in wkend:
418
382
                        csslink = "cal-weekend"
419
 
                    onmouse = {}
 
383
                    attrs = {'rel': 'nofollow'}
420
384
                for otherpage in parmpagename[1:]:
421
385
                    otherlink = "%s/%4d-%02d-%02d" % (otherpage, year, month, day)
422
386
                    otherdaypage = Page(request, otherlink)
428
392
                            r, g, b = (r, g+colorstep, b)
429
393
                r, g, b = cliprgb(r, g, b)
430
394
                style = 'background-color:#%02x%02x%02x' % (r, g, b)
431
 
                fmtlink = formatter.url(1, daypage.url(request, query), csslink, **onmouse) + str(day) + formatter.url(0)
 
395
                fmtlink = formatter.url(1, daypage.url(request, query), csslink, **attrs) + str(day) + formatter.url(0)
432
396
                if day == currentday and month == currentmonth and year == currentyear:
433
397
                    cssday = "cal-today"
434
398
                    fmtlink = "<b>%s</b>" % fmtlink # for browser with CSS probs
437
401
                restdn.append('  <td style="%s" class="%s">%s</td>\n' % (style, cssday, fmtlink))
438
402
        restrn.append(' <tr>\n%s </tr>\n' % "".join(restdn))
439
403
 
440
 
    restable = '<table border="2" cellspacing="2" cellpadding="2">\n%s%s%s</table>\n'
 
404
    restable = '<table border="2" cellspacing="2" cellpadding="2">\n<col width="14%%" span="7">%s%s%s</table>\n'
441
405
    restable = restable % (restr1, restr2, "".join(restrn))
442
406
 
443
 
    result = """\
444
 
<script language="JavaScript" type="text/javascript" src="%s/common/js/infobox.js"></script>
445
 
<div id="infodiv" style="position:absolute; visibility:hidden; z-index:20; top:-999em; left:0px;"></div>
446
 
<script language="JavaScript" type="text/javascript">
 
407
    if maketip_js:
 
408
        tip_js = '''<script language="JavaScript" type="text/javascript">
447
409
<!--
448
410
%s
449
411
// -->
450
412
</script>
451
 
%s
452
 
""" % (request.cfg.url_prefix, "\n".join(maketip_js), restable)
 
413
''' % '\n'.join(maketip_js)
 
414
    else:
 
415
        tip_js = ''
 
416
 
 
417
    result = """\
 
418
<script type="text/javascript" src="%s/common/js/infobox.js"></script>
 
419
<div id="%s" style="position:absolute; visibility:hidden; z-index:20; top:-999em; left:0px;"></div>
 
420
%s%s
 
421
""" % (request.cfg.url_prefix_static, formatter.make_id_unique('infodiv'), tip_js, restable)
453
422
    return formatter.rawHTML(result)
454
423
 
455
424
# EOF