webcalendar

Check-in [774850c495]
Login

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

Overview
Comment:Update path. Fix false positive when we should filter by days of week. Include account name in Python event dict, sometimes useful in displaying events.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | master | trunk
Files: files | file ages | folders
SHA3-256:774850c495a13ff4fd139f98d12c77bd098243923b3492d30511b0a5a2460cd6
User & Date: ajv-899-334-8894@vsta.org 2018-01-11 23:51:30
Context
2018-01-11
23:52
Quick-n-dirty CLI display of a calendar. check-in: c6c2a85406 user: ajv-899-334-8894@vsta.org tags: master, trunk
23:51
Update path. Fix false positive when we should filter by days of week. Include account name in Python event dict, sometimes useful in displaying events. check-in: 774850c495 user: ajv-899-334-8894@vsta.org tags: master, trunk
2017-08-05
16:10
Fiddle with import of calendar events and when they should be treated as untimed rather than timed with 24 hour duration check-in: b3bc3cc813 user: ajv-899-334-8894@vsta.org tags: master, trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to cgi-bin/webcal.py.

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
...
235
236
237
238
239
240
241





242
243
244
245
246
247
248
...
250
251
252
253
254
255
256










257
258
259
260
261
262
263
...
457
458
459
460
461
462
463

464
465
466
467
468
469
470

# Map from abbreviated weekday name to ical standard index
DAYIDX = {"mo": 0, "tu": 1, "we": 2, "th": 3, "fr": 4, "sa": 5, "su": 6}
DAYNAMES = ("mo", "tu", "we", "th", "fr", "sa", "su")

# Load Webcalendar config into cfg{}
HTBASE = "/webcal/"
CALBASE = "/var/www/vatclip/htdocs" + HTBASE
CFG = CALBASE + "includes/settings.php"
cfg = {}
def load_cfg(fn):
    global cfg

    f = open(CFG, "r")
    for l in f:
................................................................................
	# Repetition-specific reason
	return self._applies(target)

# Daily repeat
class RepeatDaily(Repeat):

    def _applies(self, target):






	# We need to talk about this event AT THIS HOUR
	#  of the target day.
	ttm = list(target)
	ttm[3] = self.basetm.tm_hour

	# This day or one within the counted range?
................................................................................
	if self.intvl:
	    if (days % self.intvl):
		return False
	    days /= self.intvl
	if not self.count:
	    return True
	return (days < self.count)











# Weekly repeat
class RepeatWeekly(Repeat):

    def _applies(self, target):

	# Not right day of week
................................................................................
	c2.close()
	if tup2 is not None:
	    if tup2[0] == 'D':
		continue

	# Encode the event
	ev = as_event(tup)


	# Gather relevant ones
	if (filter is None) or filter(ev):
	    res.add(ev)

    c.close()








|







 







>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>







 







>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
...
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
...
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
...
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486

# Map from abbreviated weekday name to ical standard index
DAYIDX = {"mo": 0, "tu": 1, "we": 2, "th": 3, "fr": 4, "sa": 5, "su": 6}
DAYNAMES = ("mo", "tu", "we", "th", "fr", "sa", "su")

# Load Webcalendar config into cfg{}
HTBASE = "/webcal/"
CALBASE = "/var/www/" + HTBASE
CFG = CALBASE + "includes/settings.php"
cfg = {}
def load_cfg(fn):
    global cfg

    f = open(CFG, "r")
    for l in f:
................................................................................
	# Repetition-specific reason
	return self._applies(target)

# Daily repeat
class RepeatDaily(Repeat):

    def _applies(self, target):

        # Quick filter for just specific days of week
        if self.days is not None:
            if target.tm_wday not in self.days:
                return False

	# We need to talk about this event AT THIS HOUR
	#  of the target day.
	ttm = list(target)
	ttm[3] = self.basetm.tm_hour

	# This day or one within the counted range?
................................................................................
	if self.intvl:
	    if (days % self.intvl):
		return False
	    days /= self.intvl
	if not self.count:
	    return True
	return (days < self.count)

    # We can get a list of days here
    def init2(self, rep):
	global DAYIDX

	if rep[WER_WDAY]:
	    self.days = frozenset(DAYIDX[s.lower()] for
		s in rep[WER_WDAY].split(','))
	else:
            self.days = None

# Weekly repeat
class RepeatWeekly(Repeat):

    def _applies(self, target):

	# Not right day of week
................................................................................
	c2.close()
	if tup2 is not None:
	    if tup2[0] == 'D':
		continue

	# Encode the event
	ev = as_event(tup)
	ev.uname = calname

	# Gather relevant ones
	if (filter is None) or filter(ev):
	    res.add(ev)

    c.close()