[CMF-checkins] CVS: CMF/CMFCalendar/skins/zpt_calendar - CalendarStyle.css:1.1 calendarBox.pt:1.1 calendar_day_view.pt:1.1 getDaysClass.py:1.1 getEndAsString.py:1.1 getMonthAndYear.py:1.1 getNextDayLink.py:1.1 getNextMonthLink.py:1.1 getPreviousDayLink.py:1.1 getPreviousMonthLink.py:1.1 getStartAsString.py:1.1
Chris Withers
chrisw@nipltd.com
Thu, 2 May 2002 09:51:51 -0400
Update of /cvs-repository/CMF/CMFCalendar/skins/zpt_calendar
In directory cvs.zope.org:/tmp/cvs-serv22207/skins/zpt_calendar
Added Files:
CalendarStyle.css calendarBox.pt calendar_day_view.pt
getDaysClass.py getEndAsString.py getMonthAndYear.py
getNextDayLink.py getNextMonthLink.py getPreviousDayLink.py
getPreviousMonthLink.py getStartAsString.py
Log Message:
Initial checkin of AndyD's CMFCalendar.
=== Added File CMF/CMFCalendar/skins/zpt_calendar/CalendarStyle.css ===
<dtml-unless do_inline_css>
<dtml-call "RESPONSE.setHeader('Content-Type','text/css')">
</dtml-unless>
div.CalendarBox {
background-color: white;
border: None;
}
table.calendar {
border: 1px solid Black;
text-align: right;
}
table.calendar th {
background-color: #DDDDDD;
font-weight: bold;
text-align: center;
}
table.calendar td {
white-space: nowrap
background-color: white;
width: 1.5em;
}
table.calendar a {
text-decoration: none;
color: Blue;
}
table.calendar a:hover {
text-decoration: none;
}
table.calendar td.weekdays {
background-color: #AAAAAA;
border: Black;
border-style: solid none;
text-align: center;
}
table.calendar td.event {
background-color: #DDDDDD;
font-weight: bold;
}
table.calendar td.todayevent {
background-color: #DDDDDD;
border: 2px solid Orange;
font-weight: bold;
}
table.calendar td.todaynoevent {
border-collapse: collapse;
border: 2px solid Orange;
}
div.day {
background-color: #FFFFBB;
border: 1px solid Black;
visibility: hidden;
width: 12em;
z-index: 2;
}
div.dayViewBox {
background-color: white;
border: None;
}
table.dayView {
border: 1px solid Black;
text-align: right;
}
table.dayView th {
background-color: #DDDDDD;
font-weight: bold;
font-size: 75%;
text-align: center;
}
table.dayView td {
white-space: nowrap
background-color: white;
font-size: 75%;
width: 1.5em;
padding: 0.2em;
text-align: center;
}
table.dayView td.startDate {
text-align: right;
}
table.dayView td.endDate {
text-align: left;
}
table.dayView td.heading {
background-color: #AAAAAA;
border: 1px solid Black;
text-align: center;
}
=== Added File CMF/CMFCalendar/skins/zpt_calendar/calendarBox.pt ===
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
metal:use-macro="here/main_template/macros/master">
<div metal:fill-slot="header"> </div>
<div metal:fill-slot="main">
<div metal:define-macro="calendarBox"
class="CalendarBox"
tal:define="DateTime python:modules['DateTime'].DateTime;
yearmonth python:here.getMonthAndYear();
year python:yearmonth[0];
month python:yearmonth[1];
weeks python:here.portal_calendar.getEventsForCalendar(month=month, year=year);">
<!-- The calendar, rendered as a table -->
<table cellpadding="2" cellspacing="0" border="0" class="calendar">
<tr>
<!-- The headers. The month with links either side -->
<th>
<a href="#" tal:attributes="href python:here.getPreviousMonthLink(request.URL0, month, year)">«</a>
</th>
<th colspan="5" tal:define="date string:$month/1/$year">
<span tal:replace="python:DateTime(date).strftime('%B').capitalize()"/> <span tal:replace="python:DateTime(date).year()"/>
</th>
<th>
<a href="#" tal:attributes="href python:here.getNextMonthLink(request.URL0, month, year)">»</a>
</th>
</tr>
<!-- The week days across the top -->
<tr tal:define="weekdays here/portal_calendar/getDays">
<tal:weekday tal:repeat="weekday weekdays">
<td class="weekdays" tal:content="weekday">Su</td>
</tal:weekday>
</tr>
<!-- The actual days with in the weeks -->
<tr tal:repeat="week weeks">
<tal:week tal:define="days week">
<tal:day tal:repeat="day days">
<tal:daynumber tal:define="daynumber day/day;
datestring python: '%d/%0.2d/%0.2d' % (year, month, daynumber);">
<tal:event tal:condition="day/event">
<!-- There is an event on this day -->
<td class="event"
tal:attributes="class python:here.getDaysClass(daynumber, month, year, day['event'])">
<a href tal:attributes="href python:here.portal_url()+'/calendar_day_view?date=%s'%(datestring)"
tal:content="python: daynumber or default">
</a>
</td>
</tal:event>
<tal:event tal:condition="not: day/event">
<!-- There is no event on this day -->
<td tal:content="python: daynumber or default"
tal:attributes="class python:here.getDaysClass(daynumber, month, year)">
</td>
</tal:event>
</tal:daynumber>
</tal:day>
</tal:week>
</tr>
</table>
</div>
</div>
</html>
=== Added File CMF/CMFCalendar/skins/zpt_calendar/calendar_day_view.pt ===
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
metal:use-macro="here/main_template/macros/master">
<div metal:fill-slot="header"> </div>
<div metal:fill-slot="main">
<div metal:define-macro="dayViewBox"
class="dayViewBox"
tal:define="DateTime python:modules['DateTime'].DateTime;
thisDay python:DateTime(request.get('date', DateTime().aCommon()[:12]))">
<table class="dayView" cellpadding="0" cellspacing="0" border="0">
<tr>
<th>
<a href="#" tal:attributes="href python:here.getPreviousDayLink(template.absolute_url(), thisDay)">«</a>
</th>
<th tal:content="python:thisDay.aCommon()[:12]" colspan="3" nowrap>Date Heading</th>
<th>
<a href="#" tal:attributes="href python:here.getNextDayLink(template.absolute_url(), thisDay)">»</a>
</th>
</tr>
<tal:events tal:repeat="event python:here.portal_calendar.getEventsForThisDay(thisDay)">
<tr>
<td class="heading" colspan="5" nowrap>
<a href="#" tal:attributes="href event/getURL" tal:content="event/title">
event title
</a>
</td>
</tr>
<tr>
<td class="startDate" tal:content="python:here.getStartAsString(thisDay, event)" nowrap colspan="2">
Event Start
</td>
<td nowrap>
--
</td>
<td class="endDate" tal:content="python:here.getEndAsString(thisDay, event)" nowrap colspan="2">
Event End
</td>
</tr>
</tal:events>
</div>
</div>
</html>
=== Added File CMF/CMFCalendar/skins/zpt_calendar/getDaysClass.py ===
##parameters=day, month, year, event=None
# Is the date given today?
# If so we want to return a class of 'todayevent' so that the event gets the
# today border around it.
# If not we want to return just 'event' so the event gets the proper shading.
import DateTime
current = DateTime.DateTime()
if current.year()==year and current.month()==month and current.day()==int(day):
if event:
return "todayevent"
else:
return "todaynoevent"
if event:
return "event"
else:
return ""
=== Added File CMF/CMFCalendar/skins/zpt_calendar/getEndAsString.py ===
##parameters=thisDay, event
# Returns a string to represent the event
from DateTime import DateTime
text = ""
last_date=DateTime(thisDay.Date()+" 23:59:59")
if event.end > last_date:
return event.end.aCommon()[:12]
else:
return event.end.TimeMinutes()
=== Added File CMF/CMFCalendar/skins/zpt_calendar/getMonthAndYear.py ===
# Get the year and month that the calendar should display.
import DateTime
current = DateTime.DateTime()
year = None
month = None
use_session = container.portal_calendar.getUseSession()
# First priority goes to the data in the request
year = context.REQUEST.get('year', None)
month = context.REQUEST.get('month', None)
# Next get the data from the SESSION
session = context.REQUEST.get('SESSION', None)
if session and use_session=="True":
if not year: year = session.get('calendar_year', None)
if not month: month = session.get('calendar_month', None)
# Last resort to Today
if not year: year = current.year()
if not month: month = current.month()
# Then store the results in the session for next time
if session and use_session=="True":
session.set('calendar_year', year)
session.set('calendar_month', month)
# Finally return the results
return (year, month)
=== Added File CMF/CMFCalendar/skins/zpt_calendar/getNextDayLink.py ===
##parameters=base_url, thisDay
# Takes a base url and returns a link to the previous day
thisDay += 1
x = '%s?date=%s' % (
base_url,
thisDay.Date()
)
return x
=== Added File CMF/CMFCalendar/skins/zpt_calendar/getNextMonthLink.py ===
##parameters=base_url, month, year
nextMonthTime = container.portal_calendar.getNextMonth(month, year)
# Takes a base url and returns a link to the previous month
x = '%s?month:int=%d&year:int=%d' % (
base_url,
nextMonthTime.month(),
nextMonthTime.year()
)
return x
=== Added File CMF/CMFCalendar/skins/zpt_calendar/getPreviousDayLink.py ===
##parameters=base_url, thisDay
# Takes a base url and returns a link to the next day
thisDay -= 1
x = '%s?date=%s' % (
base_url,
thisDay.Date()
)
return x
=== Added File CMF/CMFCalendar/skins/zpt_calendar/getPreviousMonthLink.py ===
##parameters=base_url, month, year
prevMonthTime = container.portal_calendar.getPreviousMonth(month, year)
# Takes a base url and returns a link to the previous month
x = '%s?month:int=%d&year:int=%d' % (
base_url,
prevMonthTime.month(),
prevMonthTime.year()
)
return x
=== Added File CMF/CMFCalendar/skins/zpt_calendar/getStartAsString.py ===
##parameters=thisDay, event
# Returns a string to represent the start of the event
from DateTime import DateTime
first_date=DateTime(thisDay.Date()+" 00:00:00")
if event.start < first_date:
return event.start.aCommon()[:12]
else:
return event.start.TimeMinutes()