[CalendarServer-changes] [3269] CalendarServer/branches/users/sagen/localization-3218/twistedcaldav
source_changes at macosforge.org
source_changes at macosforge.org
Wed Oct 29 17:57:35 PDT 2008
Revision: 3269
http://trac.macosforge.org/projects/calendarserver/changeset/3269
Author: sagen at apple.com
Date: 2008-10-29 17:57:35 -0700 (Wed, 29 Oct 2008)
Log Message:
-----------
Adding support for date-specific icons
Modified Paths:
--------------
CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/config.py
CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/mail.py
Modified: CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/config.py
===================================================================
--- CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/config.py 2008-10-30 00:37:50 UTC (rev 3268)
+++ CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/config.py 2008-10-30 00:57:35 UTC (rev 3269)
@@ -228,6 +228,7 @@
"Password" : "", # For account receving mail
},
"AddressPatterns" : [], # Reg-ex patterns to match iMIP-able calendar user addresses
+ "MailIconsDirectory": "/usr/share/caldavd/images", # Directory containing date-specific icons for email invitations
},
},
Modified: CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/mail.py
===================================================================
--- CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/mail.py 2008-10-30 00:37:50 UTC (rev 3268)
+++ CalendarServer/branches/users/sagen/localization-3218/twistedcaldav/mail.py 2008-10-30 00:57:35 UTC (rev 3269)
@@ -737,6 +737,11 @@
details = self.getEventDetails(calendar, language=language)
+ iconDir = config.Scheduling["iMIP"]["MailIconsDirectory"].rstrip("/")
+ iconName = "cal-icon-%02d-%02d.tiff" % (details['month'],
+ details['day'])
+ iconPath = os.path.join(iconDir, iconName)
+
with translationTo(language):
msg = MIMEMultipart()
msg["From"] = fromAddress
@@ -824,9 +829,11 @@
else:
details['htmlOrganizer'] = orgCN
+ details['iconName'] = iconName
+
htmlTemplate = u"""<html>
<body><div>
- <img src="cid:ical.jpg"/>
+ <img src="cid:%(iconName)s"/>
<p>%(inviteLabel)s</p>
@@ -861,17 +868,15 @@
msgHtmlRelated.attach(msgHtml)
# an image for html version
- imageName = "ical.jpg"
- imageFile = open(os.path.join(os.path.dirname(__file__),
- "images", "mail", imageName))
- msgImage = MIMEImage(imageFile.read(),
- _subtype='jpeg;x-apple-mail-type=stationery;name="%s"' %
- (imageName,))
- imageFile.close()
- msgImage.add_header("Content-ID", "<%s>" % (imageName,))
- msgImage.add_header("Content-Disposition", "inline;filename=%s" %
- (imageName,))
- msgHtmlRelated.attach(msgImage)
+ iconFile = open(iconPath)
+ msgIcon = MIMEImage(iconFile.read(),
+ _subtype='tiff;x-apple-mail-type=stationery;name="%s"' %
+ (iconName,))
+ iconFile.close()
+ msgIcon.add_header("Content-ID", "<%s>" % (iconName,))
+ msgIcon.add_header("Content-Disposition", "inline;filename=%s" %
+ (iconName,))
+ msgHtmlRelated.attach(msgIcon)
# the icalendar attachment
self.log_debug("Mail gateway sending calendar body: %s" % (str(calendar)))
@@ -894,6 +899,10 @@
results = { }
+ dtStart = component.propertyNativeValue("DTSTART")
+ results['month'] = dtStart.month
+ results['day'] = dtStart.day
+
summary = component.propertyValue("SUMMARY")
if summary is None:
summary = ""
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20081029/5ce6a01e/attachment.html>
More information about the calendarserver-changes
mailing list