Ejemplo n.º 1
0
	def has_crib(events):
		'''Anything with a crib.'''
		for evt in sorted(events.events, key = lambda x: x['start'], reverse = True):
			if 'crib' not in evt:
				continue
			alg = hashlib.sha1()
			alg.update(evt['crib'].encode('utf-8'))
			dance_id = alg.hexdigest()
			print("<table class=\"program_box\">\n")
			print("<tr><td>\n")
			print("<span id=\"progbody_%s_ctl\" onclick=\"crib_toggle('progbody_%s');\" class=\"crib_ctl\">&#9654;</span>\n" % (dance_id, dance_id))
			print("</td><td class=\"program_title_cell\">\n")
			print("<h2>")
			print("<a id=\"program_%s\"></a>" % dance_id)
			print("<a href=\"#program_%s\" onclick=\"crib_toggle('progbody_%s'); return false;\" class=\"program_title\">%s</a>\n" % (dance_id, dance_id, evt['name']))
			print("</h2>\n")
			print("</td></tr>\n")
			loc = ''
			if 'location' in evt:
				loc = '%s on ' % evt['location']
			date = ''
			if evt['start'] > datetime.datetime.min:
				date = evt['start'].strftime('%e %B %Y')
			if loc != '' or date != '':
				print("<tr><td></td><td>\n")
				print("<p>%s%s</p>" % (loc, date))
				print("</td></tr>\n")

			print("<tr id=\"progbody_%s\" class=\"program_body\"><td></td><td>\n" % dance_id);
			crib_name = 'cribs/' + evt['crib']
			crib.generate_crib(crib_name, open(crib_name), sys.stdout)
			print("</td></tr>\n")
			print("</table>\n")
Ejemplo n.º 2
0
	def next_dance_crib(events):
		'''Generate a crib of the next dance.'''
		for evt in events.dances(starts_after = event_database.today(), is_local = True):
			if 'crib' in evt:
				crib_name = 'cribs/' + evt['crib']
				crib.generate_crib(crib_name, open(crib_name), sys.stdout)
			else:
				print('We are sorry, but there is no posted program yet.  Please check back later.')
			return
Ejemplo n.º 3
0
	def next_dance_crib(events):
		'''Generate a crib of the next dance.'''
		for evt in events.dances(starts_after = event_database.today(), is_local = True):
			if 'crib' in evt:
				crib_name = 'cribs/' + evt['crib']
				crib.generate_crib(crib_name, open(crib_name), sys.stdout)
				sys.stdout.write('<p class="noprint">[<a href="javascript:crib_toggle_all(true);">Expand All</a> | <a href="javascript:crib_toggle_all(false);">Collapse All</a>]</p>\n')
			elif 'url' in evt:
				sys.stdout.write('<p>Download a <a href="%s">printable brochure</a> of information about the dance program.</p>\n' % evt['url'])
			else:
				print('We are sorry, but there is no posted program yet.  Please check back later.')
			return
Ejemplo n.º 4
0
	def sw_wa_ball_crib(events):
		'''Generate a crib of the most recent complete SW Washington ball.'''
		ready_balls = [x for x in events.balls() if (x['local'] and x['ready'] and x['location'] == "Vancouver, Wash.")]
		crib_fname = None
		for evt in ready_balls:
			if 'crib' in evt:
				crib_fname = evt['crib']

		if crib_fname == None:
			print('We are sorry, but there is no posted program yet.  Please check back later.')
		else:
			crib_name = 'cribs/' + crib_fname
			crib.generate_crib(crib_name, open(crib_name), sys.stdout)