webcalendar

Check-in [d993e79f2f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Another variant of weekly by day; infer day and week index from base time.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:d993e79f2fb772e7983bee848de3adceaa209adbfa6b231591fb4ebdd260fd31
User & Date: ajv-899-334-8894@vsta.org 2017-06-14 14:18:26
Context
2017-08-05
16:09
For day count, be sure to allow for that event's time in the current day. Treat zero duration events with a time as timed. check-in: 281fe22e49 user: ajv-899-334-8894@vsta.org tags: master, trunk
2017-06-14
14:18
Another variant of weekly by day; infer day and week index from base time. check-in: d993e79f2f user: ajv-899-334-8894@vsta.org tags: master, trunk
2017-06-10
17:15
Handle event count on monthly by day. Handle display when there are no timed events. check-in: cb0f89b99e user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to cgi-bin/webcal.py.

    21     21   WER_CNT = 13	# Count
    22     22   
    23     23   # Indices in webcal_entry_repeats_not
    24     24   WEX_WHEN = 1	# Date of exclusion
    25     25   
    26     26   # Map from abbreviated weekday name to ical standard index
    27     27   DAYIDX = {"mo": 0, "tu": 1, "we": 2, "th": 3, "fr": 4, "sa": 5, "su": 6}
           28  +DAYNAMES = ("mo", "tu", "we", "th", "fr", "sa", "su")
    28     29   
    29     30   # Load Webcalendar config into cfg{}
    30     31   HTBASE = "/webcal/"
    31     32   CALBASE = "/var/www/vatclip/htdocs" + HTBASE
    32     33   CFG = CALBASE + "includes/settings.php"
    33     34   cfg = {}
    34     35   def load_cfg(fn):
................................................................................
   281    282   	else:
   282    283   	    self.days = frozenset([self.basetm.tm_wday])
   283    284   
   284    285   # Monthly, by day of week
   285    286   class RepeatMonthlyDay(Repeat):
   286    287   
   287    288       def init2(self, rep):
          289  +	global DAYNAMES
          290  +	btm = self.basetm
          291  +
          292  +	# Get weekday specifier.  If it's not there, we have to
          293  +	#  go make it up for ourselves.
          294  +	wday = rep[WER_WDAY]
          295  +	if wday is None:
          296  +	    weekidx = week_idx(btm.tm_mday)
          297  +	    wday = str(weekidx) + DAYNAMES[btm.tm_wday]
          298  +	else:
          299  +	    wday = wday.lower()
          300  +
   288    301   	# "2TU" means 2nd Tuesday of the month
   289         -	wday = rep[WER_WDAY].lower()
   290    302   	dow = wday[-2:]
   291         -	assert self.basetm.tm_wday == DAYIDX[dow]
          303  +	assert btm.tm_wday == DAYIDX[dow]
   292    304   	wday = wday[:-2]
   293    305   	if wday:
   294    306   	    self.offset = int(wday)
   295    307   	else:
   296    308   	    self.offset = None
   297    309   
   298    310       def _applies(self, target):