[wiki/macro/EventCalendar] On passe à la version 0.99a

Ignore-this: 2558d3e32ca5684ef5852238874aa3c7

darcs-hash:20120426100341-bd074-fd45300a9cebc489f6fddeb416e065f69489f7ce.gz
This commit is contained in:
Antoine Durand-Gasselin 2012-04-26 12:03:41 +02:00
parent 1b99a84115
commit 88d0440100

View file

@ -1,6 +1,22 @@
# -*- coding: iso-8859-1 -*-
"""
EventCalendar.py Version 0.98 May 12, 2006
EventCalendar.py Version 0.99a July 22, 2009
* Base 0.99 version
* Add ErikMartin's Defaults patch (defaults-099-01)
* Add AlanSnelson 2008-11-05 patch for Moin 1.8.0 caching methods
* Add tidyup patch for 1.6.1 (EventCalendar-099.py.patch) NeoCoin
* Add Weeknumber patch from KlausMariaPfeiffer 2008-01-25
* Add label colour patch DavidOCallahan 2006-07-18 {see here for names: http://www.w3schools.com/html/html_colornames.asp}
* Add pagelinks-099-01.patch for OrphanedPages maintenance.
* Add showpagelist, to append list of contributing pages pagelist-099-01.patch (except: default now off not on)
* Add event sorting patch RuthIvimey 2007-05-17
* Fix url_prefix usage DaveGore 2008-04-04
Not included:
ErikMartin's Label Priority patch - too big a patch for this wrapup release.
RuthIvimey's page label colour patch - not sure of side-effects
HyungyongKim's unicode patch: described as temporary
EventCalendar.py Version 0.99 May 22, 2006
This macro gives a list of the events recorded at the sub-pages in the form of various views:
monthly, weekly, daily, simple-month, list, and upcoming.
@ -28,6 +44,7 @@
* numcal: # of calendar. default: 1
* showlastweekday: shows the event at the last weekday if the recurred weekday is not available. (1: enalbed, 0: disabled). default: 0
* showerror: shows error messages below the calendar if event data format is invalid. (1: enalbed, 0: disabled). default: 1
* showpagelist: shows a list of the pages used for event data below the calendar. (1: enalbed, 0: disabled). default: 0
* showweeknumber: shows the week number of the year (1: enalbed, 0: disabled). default: 0
@ -157,7 +174,6 @@ CategoryEventCalendar
from MoinMoin import wikiutil, config, search, caching
from MoinMoin.Page import Page
from MoinMoin.parser import text_moin_wiki as wiki
import re, calendar, time, datetime
import codecs, os, urllib, sha
@ -174,7 +190,7 @@ PICKLE_PROTOCOL = pickle.HIGHEST_PROTOCOL
# the first day of the week. Only SUNDAY or MONDAY (case sensitive) are
# valid here. All other values will not make good calendars.
# XXX change here ----------------vvvvvv
calendar.setfirstweekday(calendar.SUNDAY)
calendar.setfirstweekday(calendar.MONDAY)
class Globs:
@ -217,6 +233,7 @@ class Params:
numcal = 1
showlastweekday = 0
showerror = 1
showpagelist = 0
showweeknumber = 0
debug = 0
@ -250,7 +267,7 @@ def execute(macro, args):
if args:
args=request.getText(args)
for item in macro.request.form.items():
for item in macro.form.items():
if not form_vals.has_key(item[0]):
try:
form_vals[item[0]]=item[1][0]
@ -301,6 +318,8 @@ def execute(macro, args):
html.append( html_result )
html.append( showmenubar() )
html.append( showpagelist() )
if Params.showerror and Globs.errormsg:
html.append(u'<p><i><font size="2" color="#aa0000"><ol>%s</ol></font></i>' % Globs.errormsg)
@ -329,6 +348,7 @@ def getparams(args):
# category name:
# default: 'CategoryEventCalendar'
Params.category = params.get('category', Globs.defaultcategory)
# menu bar: shows menubar or not (1: show, 0: no menubar)
# default: 1
try:
@ -411,6 +431,13 @@ def getparams(args):
except (TypeError, ValueError):
Params.showweeknumber = 0
# show definition table
# default: 1
try:
Params.showpagelist = int(params.get('showpagelist', '0'))
except (TypeError, ValueError):
Params.showpagelist = 1
# default bgcolor
Params.bgcolor = '#ddffdd'
@ -434,15 +461,15 @@ def setglobalvalues(macro):
Globs.pagepath = formatter.page.getPagePath()
# european / US differences
months = (u'Janvier',u'Fevrier',u'Mars',u'Avril',u'Mai',u'Juin',u'Juillet',u'Aout',u'Septembre',u'Octobre',u'Novembre',u'Decembre')
months = ('January','February','March','April','May','June','July','August','September','October','November','December')
# Set things up for Monday or Sunday as the first day of the week
if calendar.firstweekday() == calendar.MONDAY:
wkend = 6
wkdays = ('Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam', 'Dim')
wkdays = ('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')
elif calendar.firstweekday() == calendar.SUNDAY:
wkend = 0
wkdays = ('Dim', 'Lun', 'Mar', 'Mer', 'Jeu', 'Ven', 'Sam')
wkdays = ('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat')
Globs.months = months
Globs.wkdays = wkdays
@ -550,10 +577,10 @@ def getquerystring(req_fields):
if not tmp_form_vals.has_key('prevcalaction'):
m_query.append(u'%s=%s' % ('prevcalaction', tmp_form_vals['calaction']) )
m_query = u'&amp;'.join(m_query)
m_query = u'&'.join(m_query)
if m_query:
m_query = '&amp;%s' % m_query
m_query = '&%s' % m_query
return m_query
@ -581,25 +608,25 @@ def showmenubar():
# Go Today
year, month, day = gettodaydate()
mnu_curmonthcal = u'<a href="%s?calaction=%s&amp;caldate=%d%02d%02d%s" title="Aujourd\'hui">[Aujourd\'hui]</a>' % (page_url, cal_action, year, month, day, getquerystring(['numcal']))
mnu_curmonthcal = u'<a href="%s?calaction=%s&caldate=%d%02d%02d%s" title="Go Today">[Today]</a>' % (page_url, cal_action, year, month, day, getquerystring(['numcal']))
# List View
mnu_listview = u'<a href="%s?calaction=list%s" title="Liste de tous les évènements">[Liste]</a>' % (page_url, getquerystring(['caldate', 'numcal']))
mnu_listview = u'<a href="%s?calaction=list%s" title="List of all events">[List]</a>' % (page_url, getquerystring(['caldate', 'numcal']))
# Monthly View
mnu_monthview = u'<a href="%s?calaction=monthly%s" title="Vue du mois">[Mois]</a>' % (page_url, getquerystring(['caldate', 'numcal']) )
mnu_monthview = u'<a href="%s?calaction=monthly%s" title="Monthly view">[Monthly]</a>' % (page_url, getquerystring(['caldate', 'numcal']) )
# Simple Calendar View
mnu_simpleview = u'<a href="%s?calaction=simple%s" title="Simple calendrier">[Simple]</a>' % (page_url, getquerystring(['caldate', 'numcal']) )
mnu_simpleview = u'<a href="%s?calaction=simple%s" title="Simple calendar view">[Simple]</a>' % (page_url, getquerystring(['caldate', 'numcal']) )
# Upcoming Event List
mnu_upcomingview = u'<a href="%s?calaction=upcoming%s" title="Évènements à venir">[À venir]</a>' % (page_url, getquerystring(['caldate', 'numcal']) )
mnu_upcomingview = u'<a href="%s?calaction=upcoming%s" title="Upcoming event list">[Upcoming]</a>' % (page_url, getquerystring(['caldate', 'numcal']) )
# Daily View
mnu_dayview = u'<a href="%s?calaction=daily%s" title="Vue du jour">[Jour]</a>' % (page_url, getquerystring(['caldate', 'numcal']) )
mnu_dayview = u'<a href="%s?calaction=daily%s" title="Daily view">[Daily]</a>' % (page_url, getquerystring(['caldate', 'numcal']) )
# Weekly View
mnu_weekview = u'<a href="%s?calaction=weekly%s" title="Vue de la semaine" >[Semaine]</a>' % (page_url, getquerystring(['caldate', 'numcal']) )
mnu_weekview = u'<a href="%s?calaction=weekly%s" title="Weekly view">[Weekly]</a>' % (page_url, getquerystring(['caldate', 'numcal']) )
html = [
u'\r\n',
@ -665,6 +692,42 @@ def showmenubar():
return html
def show_page_list():
html = ""
request = Globs.request
formatter = Globs.formatter
if Params.showpagelist:
source_pages = []
events, cal_events, labels = loadEvents()
for eid in events.keys():
event = events[eid]
refer = event['refer']
refer_url = '%s/%s' % (request.getScriptname(), wikiutil.quoteWikinameURL(refer))
targetlink = '<a href="%s">%s</a>' % ( refer_url, wikiutil.escape(refer))
source_pages.append( targetlink )
from sets import Set
page_set = Set(source_pages)
html = "\n"
html += formatter.paragraph(1)
html += "Constructed from events defined on these pages"
html += formatter.paragraph(0)
html += "\n"
html += formatter.bullet_list(1)
html += "\n"
for p in page_set:
html += formatter.listitem(1)
html += p
html += formatter.listitem(0)
html += "\n"
html += formatter.bullet_list(0)
html += "\n"
return html
def getdatefield(str_date):
str_year = ''
@ -730,13 +793,13 @@ def cal_listhead():
html = [
u' <tr>',
u' <td class="list_head">Titre</td>',
u' <td class="list_head">Début</td>',
u' <td class="list_head">Fin</td>',
u' <td class="list_head">Fréquence</td>',
u' <td class="list_head">Title</td>',
u' <td class="list_head">Start Date</td>',
u' <td class="list_head">End Date</td>',
u' <td class="list_head">Recurrence</td>',
u' <td class="list_head">Label</td>',
u' <td class="list_head">Description</td>',
u' <td class="list_head">Page source</td>',
u' <td class="list_head">Reference</td>',
u' </tr>',
]
@ -850,7 +913,7 @@ def showupcomingeventlist():
html_list_table = [
u'\r\n<div id="eventlist">',
u'<table class="eventlist">',
u'<tr><td colspan="7" class="list_entry" style="border-width: 0px;"><b>Évènement à venir: %s ~ %s</b><p><br><p></td></tr>' % (datefrom, dateto),
u'<tr><td colspan="7" class="list_entry" style="border-width: 0px;"><b>Upcoming Event List: %s ~ %s</b><p><br><p></td></tr>' % (datefrom, dateto),
u'%s' % html_list_header,
u'%s' % html_event_rows,
u'</table>',
@ -1052,8 +1115,12 @@ def comp_cal_events(xid, yid):
def comp_list_events(xid, yid):
events = Globs.events
if events[xid]['startdate'] == events[yid]['startdate']:
return cmp(events[xid]['starttime'], events[yid]['starttime'])
else:
return cmp(events[xid]['startdate'], events[yid]['startdate'])
# load events from wiki pages
def loadEvents(datefrom='', dateto='', nocache=0):
@ -1386,6 +1453,7 @@ def loadEventsFromWikiPages():
stored_errmsg = ''
request = Globs.request
formatter = Globs.formatter
category = Params.category
# cache configurations
@ -1419,14 +1487,19 @@ def loadEventsFromWikiPages():
if Globs.page_action == 'refresh' or cache_pages.needsUpdate(arena._text_filename()) or timedelta_days >= 1:
categorypages = searchPages(request, 'category:'+category)
categorypages = searchPages(request, category)
for page in categorypages:
# this is to workaround the bug in the category search returning
# pages that only referance the category but are not in it
# i.e. in the paramiter list for this macro
if not page.page_name == request.page.page_name:
formatter.pagelink(1, pagename=page.page_name)
eventpages.append(page.page_name)
cache_pages.update('\n'.join(eventpages))
debug('New page list is built: %d pages<p>%s</p>' % (len(eventpages), "<br/>\n".join(eventpages)))
cache_pages.update('\n'.join(eventpages).encode('utf-8'))
debug('New page list is built: %d pages' % len(eventpages))
else:
eventpages = cache_pages.content().split('\n')
debug('Cached page list is used: %d pages<p>%s</p>' % (len(eventpages), "<br/>\n".join(eventpages)))
eventpages = cache_pages.content().decode('utf-8').split('\n')
debug('Cached page list is used: %d pages' % len(eventpages))
if not Globs.page_action == 'refresh':
# check the cache validity
@ -1443,7 +1516,6 @@ def loadEventsFromWikiPages():
if dirty:
# generating events
debug('dirty')
dirty_local = 0
debug_records = {}
@ -1505,6 +1577,34 @@ def loadEventsFromWikiPages():
debug('Checking event cache: it\'s dirty or requested to refresh')
else:
debug('Checking event cache: still valid')
try:
events = pickle.loads(cache_events.content())
labels = pickle.loads(cache_labels.content())
stored_errmsg = pickle.loads(cache_errmsglist.content())
cached_event_loaded = 1
debug('Cached event information is used: total %d events' % len(events))
except (pickle.UnpicklingError, IOError, EOFError, ValueError):
events = {}
labels = {}
stored_errmsg = ''
debug('Picke error at fetching cached events')
# if it needs refreshed, generate events dictionary
if not cached_event_loaded:
# XXX: just for debugging
debug('Building new event information')
for page_name in eventpages:
debug(debug_records[page_name])
for eventrecords in eventrecord_list:
for evtrecord in eventrecords:
e_id = evtrecord['id']
@ -1525,30 +1625,10 @@ def loadEventsFromWikiPages():
debug('Event information is newly built: total %d events' % len(events))
else:
debug('Checking event cache: still valid')
try:
events = pickle.loads(cache_events.content())
labels = pickle.loads(cache_labels.content())
stored_errmsg = pickle.loads(cache_errmsglist.content())
cached_event_loaded = 1
debug('Cached event information is used: total %d events' % len(events))
except (pickle.UnpicklingError, IOError, EOFError, ValueError):
" " +1
events = {}
labels = {}
stored_errmsg = ''
debug('Picke error at fetching cached events')
Globs.errormsg = stored_errmsg
# end of updating events block
return events, labels
@ -1568,7 +1648,7 @@ def getEventRecordFromPage(pagecontent, referpage):
regex_page_bgcolor = r"""
(?P<req_field>^[ ]+default_bgcolor::[ ]+)
(
(?P<pagebgcolor>\#[0-9a-fA-F]{6})
(?P<pagebgcolor>(\#[0-9a-fA-F]{6}|[a-zA-Z]+))
\s*?
$
)?
@ -1609,7 +1689,7 @@ def getEventRecordFromPage(pagecontent, referpage):
(
(?P<name>[^,^:^\s]+?)
[,: ]+
(?P<bgcolor>\#[0-9a-fA-F]{6})
(?P<bgcolor>(\#[0-9a-fA-F]{6}|[a-zA-Z]+))
\s*?
$
)?
@ -1881,7 +1961,7 @@ def geteventfield(detail):
regex_bgcolor = r"""
(?P<reqfield>^[ ]+bgcolor::[ ]+)
(
(?P<bgcolor>\#[0-9a-fA-F]{6})?
(?P<bgcolor>(\#[0-9a-fA-F]{6}|[a-zA-Z]+))?
\s*?
$
)?
@ -1966,7 +2046,7 @@ def geteventfield(detail):
if match:
if match.group('startdate'):
passed = 1
# yyyy/mm/dd: 2006/05/10; 06/05/10,
if match.group('startdate1'):
if len(match.group('startyear1')) == 2:
@ -2000,13 +2080,22 @@ def geteventfield(detail):
startmonth = match.group('startmonth3')
startday = match.group('startday3')
else:
if len(match.group('startdate').strip()) > 0:
raise EventcalError('invalid_startdate')
else:
passed = 0
if passed:
startdate = '%d/%02d/%02d' % (int(startyear), int(startmonth), int(startday))
else:
startdate = ''
else:
startdate = ''
if match.group('starttime'):
passed = 1
# 12h with ':': 12:00; 9:00pm
if match.group('starttime1'):
starthour = int(match.group('starthour1'))
@ -2046,7 +2135,16 @@ def geteventfield(detail):
if starthour < 12 and match.group('am4').lower().startswith('p'):
starthour += 12
else:
if len(match.group('starttime').strip()) > 0:
raise EventcalError('invalid_starttime')
else:
passed = 0
if passed:
starttime = '%02d:%02d' % (int(starthour), int(startmin))
else:
starttime = ''
else:
starttime = ''
@ -2063,6 +2161,7 @@ def geteventfield(detail):
if match:
if match.group('enddate'):
passed = 1
# yyyy/mm/dd: 2006/05/10; 06/05/10,
if match.group('enddate1'):
if len(match.group('endyear1')) == 2:
@ -2096,12 +2195,22 @@ def geteventfield(detail):
endmonth = match.group('endmonth3')
endday = match.group('endday3')
else:
if len(match.group('enddate').strip()) > 0:
raise EventcalError('invalid_enddate')
else:
passed = 0
if passed:
enddate = '%d/%02d/%02d' % (int(endyear), int(endmonth), int(endday))
else:
enddate = ''
if match.group('endtime'):
else:
enddate = ''
if match.group('endtime'):
passed = 1
# 12h with ':': 12:00; 9:00pm
if match.group('endtime1'):
endhour = int(match.group('endhour1'))
@ -2141,7 +2250,16 @@ def geteventfield(detail):
if endhour < 12 and match.group('am4').lower() == 'pm':
endhour += 12
else:
if len(match.group('endtime').strip()) > 0:
raise EventcalError('invalid_endtime')
else:
passed = 0
if passed:
endtime = '%02d:%02d' % (int(endhour), int(endmin))
else:
endtime = ''
else:
endtime = ''
@ -2248,7 +2366,11 @@ def geteventfield(detail):
endmonth = match.group('endmonth3')
endday = match.group('endday3')
else:
raise EventcalError('invalid_recur_until')
recur_until = '%d/%02d/%02d' % (int(endyear), int(endmonth), int(endday))
else:
raise EventcalError('invalid_recur_until')
@ -2269,7 +2391,7 @@ def geteventfield(detail):
if not endtime:
endtime = starttime
elif not starttime:
raise EventcalError('invalid_starttime')
raise EventcalError('need_starttime')
# if no time, it's 1-day event
@ -2340,12 +2462,12 @@ def geteventfield(detail):
try:
ryear, rmonth, rday = getdatefield(recur_until)
except (TypeError, ValueError):
raise EventcalError('invalid_date')
raise EventcalError('invalid_recur_until')
recur_until = formatDate(ryear, rmonth, rday)
if int(recur_until) < int(enddate):
raise EventcalError('invalid_date')
raise EventcalError('recur_until_precede')
return startdate, starttime, enddate, endtime, bgcolor, label, description, recur_freq, recur_type, recur_until
@ -2355,7 +2477,7 @@ def converttext(targettext):
# Converts some special characters of html to plain-text style
# What else to handle?
targettext = targettext.replace(u'&', '&amp;')
targettext = targettext.replace(u'&', '&amp')
targettext = targettext.replace(u'>', '&gt;')
targettext = targettext.replace(u'<', '&lt;')
targettext = targettext.replace(u'\n', '<br>')
@ -2812,7 +2934,7 @@ def showdailyeventcalendar(year, month, day):
#debug('appending left %d slots: %d' % (left_slots, hour_index))
html_hour_cols[hour_index].append ( calshow_blankeventbox2( left_slots * colspan, left_slots * width ) )
html_cols = u'\r\n'.join(html_hour_cols[hour_index]) % {'colspan': colspan, 'width': u'%d' % width}
html_cols = u'\r\n'.join(html_hour_cols[hour_index]) % {'colspan': colspan, 'width': u'%d%%' % width}
html_cols = u'<tr>%s</tr>\r\n' % html_cols
html_calendar_rows.append (html_cols)
@ -3073,7 +3195,7 @@ def showweeklyeventcalendar(year, month, day):
#debug('appending left %d slots: %d' % (left_slots, hour_index))
html_hour_cols[hour_index][dayindex].append ( calshow_blankeventbox2( left_slots * colspan, left_slots * width ) )
html_cols = u'\r\n'.join(html_hour_cols[hour_index][dayindex]) % {'colspan': colspan, 'width': "%d%%" % width}
html_cols = u'\r\n'.join(html_hour_cols[hour_index][dayindex]) % {'colspan': colspan, 'width': u'%d%%' % width}
html_cols_days.append(html_cols)
html_cols_collected = u'\r\n'.join(html_cols_days)
@ -3314,7 +3436,7 @@ def showsimpleeventcalendar(year, month):
// -->
</script>
""" % (request.cfg.url_prefix, "\n".join(maketip_js))
""" % (request.cfg.url_prefix_static, "\n".join(maketip_js))
html_cal_table = [
@ -3347,9 +3469,9 @@ def calhead_yearmonth(year, month, headclass):
nextyear, nextmonth = yearmonthplusoffset(year, month, 1)
prevyear, prevmonth = yearmonthplusoffset(year, month, -1)
prevlink = u'%s?calaction=%s&amp;caldate=%d%02d%s' % (page_url, cal_action, prevyear, prevmonth, getquerystring(['numcal']) )
nextlink = u'%s?calaction=%s&amp;caldate=%d%02d%s' % (page_url, cal_action, nextyear, nextmonth, getquerystring(['numcal']))
curlink = u'%s?calaction=%s&amp;caldate=%d%02d%s' % (page_url, cal_action, year, month, getquerystring(['numcal']))
prevlink = u'%s?calaction=%s&caldate=%d%02d%s' % (page_url, cal_action, prevyear, prevmonth, getquerystring(['numcal']) )
nextlink = u'%s?calaction=%s&caldate=%d%02d%s' % (page_url, cal_action, nextyear, nextmonth, getquerystring(['numcal']))
curlink = u'%s?calaction=%s&caldate=%d%02d%s' % (page_url, cal_action, year, month, getquerystring(['numcal']))
if monthstyle_us:
stryearmonth = u'%s %d' % (months[month-1], year)
@ -3389,9 +3511,9 @@ def calhead_yearmonthday(year, month, day, headclass, colspan):
prevdate = date_today - datetime.timedelta(days=1)
nextdate = date_today + datetime.timedelta(days=1)
prevlink = u'%s?calaction=%s&amp;caldate=%d%02d%02d%s' % (page_url, cal_action, prevdate.year, prevdate.month, prevdate.day, getquerystring(['numcal']) )
nextlink = u'%s?calaction=%s&amp;caldate=%d%02d%02d%s' % (page_url, cal_action, nextdate.year, nextdate.month, nextdate.day, getquerystring(['numcal']))
curlink = u'%s?calaction=%s&amp;caldate=%d%02d%02d%s' % (page_url, cal_action, year, month, day, getquerystring(['numcal']))
prevlink = u'%s?calaction=%s&caldate=%d%02d%02d%s' % (page_url, cal_action, prevdate.year, prevdate.month, prevdate.day, getquerystring(['numcal']) )
nextlink = u'%s?calaction=%s&caldate=%d%02d%02d%s' % (page_url, cal_action, nextdate.year, nextdate.month, nextdate.day, getquerystring(['numcal']))
curlink = u'%s?calaction=%s&caldate=%d%02d%02d%s' % (page_url, cal_action, year, month, day, getquerystring(['numcal']))
if monthstyle_us:
stryearmonth = u'%s %d, %d' % (months[month-1], day, year)
@ -3446,9 +3568,9 @@ def calhead_yearmonthday2(year, month, day, headclass, colspan):
prevdate_l = last_date_week - datetime.timedelta(days=7)
nextdate_l = last_date_week + datetime.timedelta(days=7)
prevlink = u'%s?calaction=%s&amp;caldate=%d%02d%02d%s' % (page_url, cal_action, prevdate.year, prevdate.month, prevdate.day, getquerystring(['numcal']) )
nextlink = u'%s?calaction=%s&amp;caldate=%d%02d%02d%s' % (page_url, cal_action, nextdate.year, nextdate.month, nextdate.day, getquerystring(['numcal']))
curlink = u'%s?calaction=%s&amp;caldate=%d%02d%02d%s' % (page_url, cal_action, year, month, day, getquerystring(['numcal']))
prevlink = u'%s?calaction=%s&caldate=%d%02d%02d%s' % (page_url, cal_action, prevdate.year, prevdate.month, prevdate.day, getquerystring(['numcal']) )
nextlink = u'%s?calaction=%s&caldate=%d%02d%02d%s' % (page_url, cal_action, nextdate.year, nextdate.month, nextdate.day, getquerystring(['numcal']))
curlink = u'%s?calaction=%s&caldate=%d%02d%02d%s' % (page_url, cal_action, year, month, day, getquerystring(['numcal']))
if monthstyle_us:
stryearmonth = u'%s %d, %d ~ %s %d, %d' % (months[first_date_week.month-1], first_date_week.day, first_date_week.year, months[last_date_week.month-1], last_date_week.day, last_date_week.year)
@ -3572,12 +3694,12 @@ def calhead_day(year, month, day, wkday):
html_text = u'%s' % day
page_url = Globs.pageurl
html_text = u'<a href="%s?calaction=daily&amp;caldate=%d%02d%02d">%s</a>' % (page_url, year, month, day, html_text)
html_text = u'<a href="%s?calaction=daily&caldate=%d%02d%02d">%s</a>' % (page_url, year, month, day, html_text)
cyear, cmonth, cday = gettodaydate()
if (not wkday) and Params.showweeknumber:
html_text = u'%s <font size="1" color="#aaaaaa"><i>(%d)</i></font>' % (html_text, (int(datetime.date(year, month, day).strftime('%W')) + 1))
html_text = u'%s <font size="1" color="#aaaaaa"><i>(%d)</i></font>' % (html_text, (int(datetime.date(year, month, day).isocalendar()[1])))
if cyear == year and cmonth == month and cday == day:
html = u' <td class="head_day_today">&nbsp;%s</td>\r\n' % html_text
@ -3785,7 +3907,7 @@ def calshow_weekly_eventbox(event):
u' width: %(width)s;" ',
u' rowspan="%(rowspan)d"' % { 'rowspan': time_len },
u' class="cal_weekly_eventbox">',
u' %s' % (showReferPageParsed(event, 'title', 1).replace("%","%%")),
u' %s' % showReferPageParsed(event, 'title', 1),
u' </td>',
]
@ -3984,7 +4106,7 @@ def geterrormsg(errmsgcode, refer='', title='', hid=''):
msg = 'Error: Invalid date format. Not handled.'
elif errmsgcode == 'enddate_precede':
msg = 'Error: Enddate precedes startdate. Not handled.'
msg = 'Error: Startdate should be earlier than Enddate. Not handled.'
elif errmsgcode == 'invalid_starttime':
msg = 'Error: Invalid starttime format. Not handled.'
@ -3996,7 +4118,7 @@ def geterrormsg(errmsgcode, refer='', title='', hid=''):
msg = 'Error: Invalid time format. Not handled.'
elif errmsgcode == 'endtime_precede':
msg = 'Error: Enddate precedes startdate. Not handled.'
msg = 'Error: Starttime should be earlier than Endtime. Not handled.'
elif errmsgcode == 'len_recur_int':
msg = 'Error: Event length should be smaller than recurrence interval. Not handled.'
@ -4028,6 +4150,12 @@ def geterrormsg(errmsgcode, refer='', title='', hid=''):
elif errmsgcode == 'empty_label_definition':
msg = 'Warning: Invalid label definition. Ignored.'
elif errmsgcode == 'need_starttime':
msg = 'Error: Starttime should be specified. Not handled.'
elif errmsgcode == 'recur_until_precede':
msg = 'Error: Enddate should be earlier than the end date (until) of recurrence. Not handled.'
else:
msg = 'undefined: %s' % errmsgcode