示例#1
0
	def asBody(self,renderer):

		today = ND()
		
		wr = renderer.write
		
		year = self.year
		month = self.month

		wr('<br>year:')
		renderer.renderLink(renderer.uriToSelf(year-1,month),str(year-1))
		wr(' ')
		renderer.renderLink(renderer.uriToSelf(year+1,month),str(year+1))
		wr('<br>month:')
		renderer.renderLink(renderer.uriToSelf(year,month-1),'<<')
		wr(' ')
		renderer.renderLink(renderer.uriToSelf(year,month+1),'>>')
		
		day = ND((year,month,1))
		week = day.weekOfYear()
		
		#(year,week,isoday) = day.iso_week
		#(firstWeekDay,numDays) = calendar.monthrange(year, month)

		#while day.iso_week[1] == week:
		while day.weekOfYear() == week:
			day -= 1
			
		day += 1

		wr(str(day))
		
		wr('<table border=1>')
		wr('<tr>')
		wr('<td>week</td>')
		for wd in weekdays:
			wr('<td>%s</td>' % wd)
		wr('</tr>')
		
		while True:
			wr('<tr>')
			wr('<td>')
			wr(str(week))
			wr('</td>')
			for col in range(7):
				if day == today:
					wr('<td bgcolor="red">')
				elif day.month() == self.month:
					wr('<td bgcolor="white">')
				else:
					wr('<td bgcolor="gold">')
				self.writeDayInMonth(renderer,day)
				day += 1
				wr('</td>')
			wr('</tr>')
			week += 1
			if day.month() > month:
				break
		
		wr('</table>')
示例#2
0
 def asLeftMargin(self, renderer):
     renderer.write('<p>')
     today = ND()
     renderer.renderLink(renderer.uriToSelf(today.year(), today.month(),
                                            today.day()),
                         label='today')
     renderer.write('<p>')
     renderer.resource.db.asLeftMargin(renderer)
示例#3
0
	def asLeftMargin(self,renderer):
		renderer.write('<p>')
		today = ND()
		renderer.renderLink(renderer.uriToSelf(today.year(),
															today.month(),
															today.day()),
								  label='today')
		renderer.write('<p>')
		renderer.resource.db.asLeftMargin(renderer)
示例#4
0
    def asBody(self, renderer):

        today = ND()

        wr = renderer.write

        year = self.year
        month = self.month

        wr('<br>year:')
        renderer.renderLink(renderer.uriToSelf(year - 1, month), str(year - 1))
        wr(' ')
        renderer.renderLink(renderer.uriToSelf(year + 1, month), str(year + 1))
        wr('<br>month:')
        renderer.renderLink(renderer.uriToSelf(year, month - 1), '<<')
        wr(' ')
        renderer.renderLink(renderer.uriToSelf(year, month + 1), '>>')

        day = ND((year, month, 1))
        week = day.weekOfYear()

        #(year,week,isoday) = day.iso_week
        #(firstWeekDay,numDays) = calendar.monthrange(year, month)

        #while day.iso_week[1] == week:
        while day.weekOfYear() == week:
            day -= 1

        day += 1

        wr(str(day))

        wr('<table border=1>')
        wr('<tr>')
        wr('<td>week</td>')
        for wd in weekdays:
            wr('<td>%s</td>' % wd)
        wr('</tr>')

        while True:
            wr('<tr>')
            wr('<td>')
            wr(str(week))
            wr('</td>')
            for col in range(7):
                if day == today:
                    wr('<td bgcolor="red">')
                elif day.month() == self.month:
                    wr('<td bgcolor="white">')
                else:
                    wr('<td bgcolor="gold">')
                self.writeDayInMonth(renderer, day)
                day += 1
                wr('</td>')
            wr('</tr>')
            week += 1
            if day.month() > month:
                break

        wr('</table>')
示例#5
0
 def render_GET(self, request):
     renderer = TwistedRenderer(self, request)
     if len(request.postpath) == 0:
         year, month = localtime(time())[0:2]
         #month = localtime(time())[1]
         return renderer.show(MonthWidget(year, month))
     year = int(request.postpath[0])
     if len(request.postpath) == 1:
         return renderer.show(YearWidget(year))
     month = int(request.postpath[1])
     if len(request.postpath) == 2:
         return renderer.show(MonthWidget(year, month))
     day = int(request.postpath[2])
     widget = DayWidget(ND((year, month, day)))
     return renderer.show(widget)
示例#6
0
 def asLeftMargin(self, renderer):
     renderer.write('<p>')
     today = ND()
     renderer.renderLink(renderer.uriToSelf(), label='current month')
     renderer.write('<p>')
     renderer.resource.db.asLeftMargin(renderer)