#!/usr/bin/env python
#Yet Another Meeting Assistant (YaMA), is a program that primarily
#helps any minute taker with minutes of meetings.
#Copyright (C) 2005-2008 Atul Nene (www.atulnene.com)
#
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License
#as published by the Free Software Foundation; specifically version 2
#of the License
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details at
#http://www.gnu.org/licenses/gpl.html .

import string
from datetime import date
from datetime import timedelta
from time import strftime, tzname
from Tkinter import *
import os
import tkFileDialog
import tkFont
import sys

#TODO: Put in a Save and Load Meeting feature
#TODO: Launch Email app for MIs and AIs

class Form:
	def __init__(self, parentApp, pageID):
		self.parentApp = parentApp
		self.pageID = pageID

		self.frame = Frame (parentApp.pageFrame)

	def hide(self):
		self.frame.forget()		

	def show(self):
		self.frame.pack()		

class ActionItemObj:
	def __init__(self):
		self.ID = ""
		self.contactNick = ""
		self.contactName = ""
		self.contactEmail = ""
		self.expEndDate = ""
		self.details = ""
		self.pastRef = ""

	def previewText(self):
			return "Action Item ID: " + self.ID + "\n" + "Contact: " + self.contactNick + ":" + self.contactName + " <" + self.contactEmail + ">" + "\n" + "Expected Closure Date: " + self.expEndDate + "\n" +  "Past Reference: " + self.pastRef + "\n" + "Action Details: " + self.details

class AttendeeObj:
	def __init__(self):
		self.attendeeNick= ""
		self.attendeeName = ""
		self.attendeeEmail = ""
		self.attendeeType = 2	# 1=Organizer, 2=Required, 3=Optional, 4=NonParticipant
		
	def previewText(self):
		tmpText = "Organizer"
		if self.attendeeType == 2:
			tmpText = "Required Attendee"
		elif self.attendeeType == 3:
			tmpText = "Optional Attendee"
		elif self.attendeeType == 4:
			tmpText = "Non Participant"
						
		return "Attendee Details:\nShort Name:" + self.attendeeNick + "\n" + "Full Name: " + self.attendeeName + "\n" + "Email:" + self.attendeeEmail + "\n" + "Type:" + tmpText + "\n"

class IssueObj:
	def __init__(self):
		self.details = ""
		
	def previewText(self):
		return "Issue Details: " + self.details

class AgendaObj:
	def __init__(self):
		self.details = ""
		
	def previewText(self):
		return "Agenda Item Details: " + self.details

class DecisionObj:
	def __init__(self):
		self.contactNick= ""
		self.contactName= ""
		self.contactEmail= ""
		self.details = ""

	def previewText(self):
		return "Contact: " + self.contactNick + ":" + self.contactName + " <" + self.contactEmail + ">" + "\n" + "Decision Details: " + self.details

class AboutPage(Form):
	def __init__(self, parentApp, pageID):
		Form.__init__(self, parentApp, pageID)

		tcl_patchLevel = root.tk.eval("return $tcl_patchLevel")
		tk_patchLevel = root.tk.eval("return $tk_patchLevel")
		python_version = sys.version
		
		self.label1 = Label (self.frame, text = "Yet Another Meeting Assistant (YaMA)\n", font=("Helvetica", 15, "bold"))
		self.label1.grid(row=0, column=0, sticky=N)
		
		self.tipArea = Frame (self.frame, border=5)
		self.tipArea.grid(row=1, column=0, sticky=N) 
		self.tip = Label(self.tipArea, justify=LEFT, text="YaMA can help you with the Agenda, Minutes, Invitations and Action Items of Meetings.\n\nUsage:\n1. Click on the tabs on the left to begin creating your Agenda/Minutes. \n2. Enter information in the respective tabs, and when done, click on the \"Publish\" tab.\n3. Preview the text, Copy To Clipboard, Paste into your favorite email client, and Send - thats it !\n4. Export Meeting Invitations and Action Items to iCalendar format to interoperate with other applications.", bd=1, relief=SUNKEN) 
		self.tip.grid(row=0, column=0) 

		self.label3 = Label (self.frame, text = "\nYaMA comes with ABSOLUTELY NO WARRANTY; \n This is free software, and you are welcome to \nredistribute it under certain conditions; see \nhttp://www.gnu.org/licenses/gpl.html for details.\n", font=("Courier", 8, "bold"))
		self.label3.grid(row=2, column=0, sticky=N)
		
		self.label4 = Label (self.frame, text = "Please see http://yama.sourceforge.net for help.\n\nPlease write to atul@atulnene.com with comments,\n suggestions, and customization requests and include\n the following information in your email:")
		self.label4.grid(row=4, column=0, sticky=N)
		
		self.versionText = Text (self.frame, height=5, width=70, bd=1, background="light grey")
		self.versionText.insert(END, "YaMA : v" + parentApp.yama_version + "\nPython : " + python_version + "\nTCL : " + tcl_patchLevel + ", Tk : " + tk_patchLevel + "\nOS : " + os.name + ", Platform : " + sys.platform + ", Hex Version : " + `sys.hexversion`)
		if os.name == "nt":
			self.versionText.insert(END, "\nWindows Version : " + `sys.getwindowsversion()`)	
		self.versionText.grid(row=5, column=0)
		
class PreviewReportForm(Form):
	def __init__(self, parentApp, pageID):
		Form.__init__(self, parentApp, pageID)

		self.parentApp = parentApp
		
		self.frame.rowconfigure(0, weight = 1)
		self.frame.columnconfigure(0, weight = 1)

		self.titlePanel = Frame (self.frame)
		self.titlePanel.grid(row=0, column=0, sticky=NSEW)

		self.titleLabel = Label(self.titlePanel, text="Preview the Minutes", anchor=CENTER, font=("Helvetica", 15, "bold"))
		self.titleLabel.pack(fill=X, anchor=W)

		self.buttonPanel = Frame (self.frame)
		self.buttonPanel.grid (row=1, column=0)

		self.startTitleWithDate = Checkbutton (self.buttonPanel, text="Start Title with Date", variable = self.parentApp.dateInReportTitle)
		self.startTitleWithDate.grid (row=0, column=1)

		self.includeTimeInTitle = Checkbutton (self.buttonPanel, text="Include Time in Title", variable = self.parentApp.timeInReportTitle)
		self.includeTimeInTitle.grid (row=0, column=2)

		self.previewNow = Button (self.buttonPanel, text="Preview Now", command=self.commandPreviewNow)
		self.previewNow.grid (row=1, column=1, columnspan=2)

		self.previewPanel = Frame (self.frame, border=5)
		self.previewPanel.grid(row=2, column=0, sticky=NSEW)
		
		self.notePanel = Frame (self.previewPanel)
		self.notePanel.grid(row=2, column=0,sticky=W)

		self.noteScrollbar = Scrollbar (self.notePanel)
		self.noteScrollbar.pack(side=RIGHT, fill=Y)
 
		self.note = Text (self.notePanel, height=21, width=80, yscrollcommand=self.noteScrollbar.set)
		self.note.pack(side=LEFT, fill=BOTH, expand=1)

		self.noteScrollbar.config(command=self.note.yview)

		self.copyTo = Button (self.previewPanel, text="Copy To Clipboard (Select+^C))", command=self.copyToClipboard)
		self.copyTo.grid (row=3, column=0)

	def changeFontSize(self):
		self.note.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))

	def copyToClipboard(self):
		self.parentApp.master.clipboard_clear()
		self.parentApp.master.clipboard_append(self.note.get(1.0,END))

	def commandPreviewNow(self):
		self.parentApp.makeReport()
		self.note.delete(1.0, END)
		self.note.insert(END, self.parentApp.finalReport)

	def show(self):
		self.parentApp.makeReport()
		self.note.delete(1.0, END)
		self.note.insert(END, self.parentApp.finalReport)
		Form.show(self)

class ExportActionsForm(Form):
	def __init__(self, parentApp, pageID):
		Form.__init__(self, parentApp, pageID)

		self.parentApp = parentApp
		
		self.frame.rowconfigure(0, weight = 1)
		self.frame.columnconfigure(0, weight = 1)

		self.titlePanel = Frame (self.frame)
		self.titlePanel.grid(row=0, column=0, sticky=NSEW)

		self.titleLabel = Label(self.titlePanel, text="Export to iCalendar Format", anchor=CENTER, font=("Helvetica", 15, "bold"))
		self.titleLabel.pack(fill=X, anchor=W)

		self.buttonPanel = Frame (self.frame)
		self.buttonPanel.grid (row=1, column=0)

		self.outlookCompatibility = Checkbutton (self.buttonPanel, text="Ensure Outlook Compatibility", variable = self.parentApp.outlookCompatibleWhenExport)
		self.outlookCompatibility.grid (row=0, column=0, columnspan=2)

		self.exportInviteNow = Button (self.buttonPanel, text="Export Meeting Invitation Now", command=self.commandExportMINow)
		self.exportInviteNow.grid (row=1, column=0)

		self.exportAINow = Button (self.buttonPanel, text="Export Action Items Now", command=self.commandExportAINow)
		self.exportAINow.grid (row=1, column=1)

		self.logPanel = Frame (self.frame, border=5)
		self.logPanel.grid(row=2, column=0, sticky=NSEW)
		
		self.notePanel = Frame (self.logPanel)
		self.notePanel.grid(row=1, column=0,sticky=W)

		self.noteScrollbar = Scrollbar (self.notePanel)
		self.noteScrollbar.pack(side=RIGHT, fill=Y)
 
		self.note = Text (self.notePanel, height=21, width=80, yscrollcommand=self.noteScrollbar.set)
		self.note.pack(side=LEFT, fill=BOTH, expand=1)

		self.noteScrollbar.config(command=self.note.yview)

		self.openTemp = Button (self.logPanel, text="Open Temporary Location", command=self.commandOpenTemp)
		self.openTemp.grid (row=3, column=0)

	def changeFontSize(self):
		self.note.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))

	def commandExportAINow(self):
		if self.parentApp.actionItemCount == 0:
			self.note.insert(END, "To Export, add at least one Action Item\n")	
			return
		if self.parentApp.outlookCompatibleWhenExport.get() == 1:
			self.note.insert(END, "\nImplementing Special Considerations for Outlook Compatibility ...\n")	
		tmpKeys = self.parentApp.actionItems.keys()
		tmpKeys.sort()

		self.note.insert(END, "Evaluating suitability of Action Items for Export ...\n")	
		for id in tmpKeys:
			evalFlag = TRUE
			obj = self.parentApp.actionItems[id]
			if obj.ID == "":
				self.note.insert(END, "Action Item " + id + " should have an ID.\n")	
				evalFlag = FALSE
			if obj.contactName == "":
				self.note.insert(END, "Action Item " + id + " should have the Contact Name.\n")	
				evalFlag = FALSE
			if obj.contactEmail == "":
				self.note.insert(END, "Action Item " + id + " should have the Email Address.\n")	
				evalFlag = FALSE
			if obj.expEndDate == "":
				self.note.insert(END, "Action Item " + id + " should have the Closure Date.\n")	
				evalFlag = FALSE
			if obj.details == "":
				self.note.insert(END, "Action Item " + id + " should have the Action Item Text.\n")	
				evalFlag = FALSE
			if evalFlag == FALSE:
				self.note.insert(END, "To Export, correct the Action Item as specified above.\n")	
				return

		self.note.insert(END, "Evaluation Complete.\n")	
		self.note.insert(END, "Exporting Action Items to temporary location ...\n")	
		for id in tmpKeys:
			obj = self.parentApp.actionItems[id]

			strlist1 = string.split (obj.expEndDate, '-')
			tmpDate1 = date (int(strlist1[0]), int(strlist1[1]), int(strlist1[2]))
			tmpDate2 = tmpDate1 + timedelta(days=1)
			tmpDateStr1 = tmpDate1.strftime ("%Y") + tmpDate1.strftime ("%m") + tmpDate1.strftime ("%d")
			tmpDateStr2 = tmpDate2.strftime ("%Y") + tmpDate2.strftime ("%m") + tmpDate2.strftime ("%d")

			today = date.today()
			tmpCreatedDateStr = today.strftime ("%Y") + today.strftime ("%m") + today.strftime ("%d")
		
			tmpText = "BEGIN:VCALENDAR" + "\n"
			tmpText = tmpText + "PRODID:-//" + self.parentApp.yama_copyright + "//NONSGML YaMA v" + self.parentApp.yama_version + "//EN\n"
			tmpText = tmpText + "VERSION:2.0" + "\n"
			if self.parentApp.outlookCompatibleWhenExport.get() == 1:
				tmpText = tmpText + "METHOD:REQUEST" + "\n"
				tmpText = tmpText + "X-MS-OLK-FORCEINSPECTOROPEN:TRUE" + "\n"
			tmpText = tmpText + "BEGIN:VTIMEZONE" + "\n"
			tmpText = tmpText + "TZID:Chennai\, Kolkata\, Mumbai\, New Delhi" + "\n"
			tmpText = tmpText + "BEGIN:STANDARD" + "\n"
			tmpText = tmpText + "DTSTART:16010101T000000" + "\n"
			tmpText = tmpText + "TZOFFSETFROM:+0530" + "\n"
			tmpText = tmpText + "TZOFFSETTO:+0530" + "\n"
			tmpText = tmpText + "END:STANDARD" + "\n"
			tmpText = tmpText + "END:VTIMEZONE" + "\n"
			tmpText = tmpText + "BEGIN:VTIMEZONE" + "\n"
			tmpText = tmpText + "TZID:India Standard Time" + "\n"
			tmpText = tmpText + "BEGIN:STANDARD" + "\n"
			tmpText = tmpText + "DTSTART:16010101T000000" + "\n"
			tmpText = tmpText + "TZOFFSETFROM:+0630" + "\n"
			tmpText = tmpText + "TZOFFSETTO:+0530" + "\n"
			tmpText = tmpText + "END:STANDARD" + "\n"
			tmpText = tmpText + "END:VTIMEZONE" + "\n"

			if self.parentApp.outlookCompatibleWhenExport.get() == 1:
				tmpText = tmpText + "BEGIN:VEVENT" + "\n"
			else:
				tmpText = tmpText + "BEGIN:VTODO" + "\n"

			tmpText = tmpText + "DTEND;TZID=\"Chennai, Kolkata, Mumbai, New Delhi\";VALUE=DATE:" + tmpDateStr2 + "\n"
			tmpText = tmpText + "DTSTAMP;TZID=\"Chennai, Kolkata, Mumbai, New Delhi\":VALUE=DATE:" + tmpCreatedDateStr + "\n"
			tmpText = tmpText + "DTSTART;TZID=\"Chennai, Kolkata, Mumbai, New Delhi\";VALUE=DATE:" + tmpDateStr1 + "\n"
			tmpText = tmpText + "DUE;VALUE=DATE:" + tmpDateStr1 + "\n"
			tmpText = tmpText + "UID:" + "YaMA-AI-"+ today.isoformat() + "\n"
			tmpText = tmpText + "SEQUENCE:0" + "\n"

			if self.parentApp.organizerName.get() == "":
				self.note.insert(END, "Note: Organizer unspecified for this Action Item\n")	
				
			if (self.parentApp.outlookCompatibleWhenExport.get() == 1) and (self.parentApp.organizerName.get() == obj.contactName):
				tmpText = tmpText + "ORGANIZER;CN=\"Meeting Organizer\":MAILTO:organizer@meeting.dummy\n"
			else:
				tmpText = tmpText + "ORGANIZER;CN=\"" + self.parentApp.organizerName.get() + "\":MAILTO:"+self.parentApp.organizerEmail.get() + "\n"

			tmpTokenList = string.split (obj.details, "\n", 1)
			#print tmpTokenList
			tmpToken = tmpTokenList[0]
			#print tmpToken
			#print len(tmpToken)
			if len(tmpToken) > 50:
				tmpToken = tmpToken[0:49]
				tmpToken = tmpToken + "..."
			#print tmpToken
			tmpText = tmpText + "SUMMARY;ENCODING=QUOTED-PRINTABLE:" + obj.ID + " : " + tmpToken + "\n"

			tmpText = tmpText + "ATTENDEE;CN=\"" + obj.contactName + "\";RSVP=TRUE;PARTSTAT=NEEDS-ACTION;ROLE=REQ-PARTICIPANT:MAILTO:" + obj.contactEmail +"\n" 

			tmpDescription = obj.details
			tmpDescription = string.replace(obj.details, "\n", "\n\t")
			oldOrNew = " (Old) "
			if today.isoformat() in obj.ID:
				oldOrNew = " (New) "

			if obj.pastRef != "":
				tmpDescription = tmpDescription + "\n\tPast Reference:" + obj.pastRef
				oldOrNew = oldOrNew + " (with a Past Ref) "
			tmpText = tmpText + "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:\"" + tmpDescription + "\t\"\n"

			tmpText = tmpText + "TRANSP:TRANSPARENT" + "\n"
			tmpText = tmpText + "CATEGORIES;ENCODING=QUOTED-PRINTABLE:YaMA" + "\n"

			if self.parentApp.meetingStatus.get() == 2:	
				tmpStatus = "CONFIRMED"
			elif self.parentApp.meetingStatus.get() == 3:	
				tmpStatus = "CANCELLED"
			else: 
				tmpStatus	 = "TENTATIVE"
		
			tmpText = tmpText + "STATUS:" + tmpStatus + "\n"
			tmpText = tmpText + "PRIORITY:3" + "\n"
			tmpText = tmpText + "LOCATION:" + self.parentApp.meetingLocation.get() + "\n"
			tmpText = tmpText + "CLASS:PRIVATE" + "\n"

			tmpText = tmpText + "BEGIN:VALARM" + "\n"
			tmpText = tmpText + "TRIGGER:-PT720M" + "\n"
			tmpText = tmpText + "ACTION:DISPLAY" + "\n"
			tmpText = tmpText + "DESCRIPTION:Reminder" + "\n"
			tmpText = tmpText + "END:VALARM" + "\n"

			if self.parentApp.outlookCompatibleWhenExport.get() == 1:
				tmpText = tmpText + "END:VEVENT" + "\n"
			else:
				tmpText = tmpText + "END:VTODO" + "\n"
			tmpText = tmpText + "END:VCALENDAR" + "\n"
				
			self.note.insert(END, "\nAction Item \"" + obj.ID + " " + tmpToken + "\"" + oldOrNew + " for " + obj.contactName + " " )	

			tmpFileName = os.tempnam (None, "YaMA-AI-") + ".ics"
			print tmpFileName
			tmpFd = open (tmpFileName, "w")
			tmpFd.write (tmpText)
			tmpFd.flush()
			tmpFd.close()
			#os.startfile (tmpFileName)

			self.note.insert(END, "exported to File:" + tmpFileName + "\n")	

		self.note.insert(END, "\nFor each of these, you may send it attached to an email to notify the assignee. In order that the assignee remembers to add it to the Personal Information Manager, it is suggested that you include the following text in the email:\n")	
		if self.parentApp.outlookCompatibleWhenExport.get() == 0:
			self.note.insert(END, "\n\"Attached is an Action Item from the Meeting (in the iCalendar format). Please open it with your favorite Personal Information Manager so as to mark your ToDo List. This will help you remember that task - you should be reminded a day prior to the due date.\"\n")	
		else:
			self.note.insert(END, "\n\"Attached is an Action Item from the Meeting (in the iCalendar format). Please open it with Outlook. It will appear as an appointment request and you will need to 'Accept' it, after which it will become an All-Day-Event on the due date of the Action Item. This will help you remember that task - you should be reminded by Outlook a day prior to the due date.\"\n")	

	def commandExportMINow(self):
		if self.parentApp.agendaCount == 0:
			self.note.insert(END, "To Export, add at least one Agenda Item\n")	
			return
		tmpOrganizer = self.parentApp.organizerNick.get()
		if tmpOrganizer == "":
			self.note.insert(END, "To Export, enter the Organizer details\n")	
			return
		if self.parentApp.attendeeCount == 0:
			self.note.insert(END, "To Export, add at least one Attendee\n")	
			return
		tmpSubject = self.parentApp.meetingSubject.get()
		if tmpSubject == "":
			self.note.insert(END, "To Export, enter Subject of the meeting\n")	
			return
		tmpLocation = self.parentApp.meetingLocation.get()
		if tmpLocation == "":
			self.note.insert(END, "To Export, enter Location of the meeting\n")	
			return
		tmpDate = self.parentApp.meetingDate.get()
		if tmpDate == "":
			self.note.insert(END, "To Export, enter Date of the meeting\n")	
			return
		tmpFromTime = self.parentApp.meetingFromTime.get()
		if tmpFromTime == "":
			self.note.insert(END, "To Export, enter Start Time of the meeting\n")	
			return
		tmpToTime = self.parentApp.meetingToTime.get()
		if tmpToTime == "":
			self.note.insert(END, "To Export, enter End Time of the meeting\n")	
			return

		if self.meetingType.get() == 0:	
			tmpType = self.specifiedMeetingType.get()
			if tmpType == "":
				tmpType = "[Specified Meeting Type]"
		else: 
			tmpType	 = self.meetingTypeText[self.meetingType.get()]

		if self.parentApp.outlookCompatibleWhenExport.get() == 1:
			self.note.insert(END, "\nImplementing Special Considerations for Outlook Compatibility ...\n")	
		self.note.insert(END, "Exporting Meeting Invitation to temporary location ...\n")	

		strlist1 = string.split (tmpDate, '-')
		tmpDate1 = date (int(strlist1[0]), int(strlist1[1]), int(strlist1[2]))
		tmpDateStr = tmpDate1.strftime ("%Y") + tmpDate1.strftime ("%m") + tmpDate1.strftime ("%d")
		strlist2 = string.split (tmpFromTime, ':')
		tmpFromTimeStr = strlist2[0] + strlist2[1]
		strlist3 = string.split (tmpToTime, ':')
		tmpToTimeStr = strlist3[0] + strlist3[1]
		
		tmpText = "BEGIN:VCALENDAR" + "\n"
		tmpText = tmpText + "PRODID:-//" + self.parentApp.yama_copyright + "//NONSGML YaMA v" + self.parentApp.yama_version + "//EN\n"
		tmpText = tmpText + "VERSION:2.0" + "\n"
		tmpText = tmpText + "METHOD:REQUEST" + "\n"
		if self.parentApp.outlookCompatibleWhenExport.get() == 1:
			tmpText = tmpText + "X-MS-OLK-FORCEINSPECTOROPEN:TRUE" + "\n"
		tmpText = tmpText + "BEGIN:VTIMEZONE" + "\n"
		tmpText = tmpText + "TZID:Chennai\, Kolkata\, Mumbai\, New Delhi" + "\n"
		tmpText = tmpText + "BEGIN:STANDARD" + "\n"
		tmpText = tmpText + "DTSTART:16010101T000000" + "\n"
		tmpText = tmpText + "TZOFFSETFROM:+0530" + "\n"
		tmpText = tmpText + "TZOFFSETTO:+0530" + "\n"
		tmpText = tmpText + "END:STANDARD" + "\n"
		tmpText = tmpText + "END:VTIMEZONE" + "\n"
		tmpText = tmpText + "BEGIN:VTIMEZONE" + "\n"
		tmpText = tmpText + "TZID:India Standard Time" + "\n"
		tmpText = tmpText + "BEGIN:STANDARD" + "\n"
		tmpText = tmpText + "DTSTART:16010101T000000" + "\n"
		tmpText = tmpText + "TZOFFSETFROM:+0630" + "\n"
		tmpText = tmpText + "TZOFFSETTO:+0530" + "\n"
		tmpText = tmpText + "END:STANDARD" + "\n"
		tmpText = tmpText + "END:VTIMEZONE" + "\n"
		tmpText = tmpText + "BEGIN:VEVENT" + "\n"
		tmpText = tmpText + "DTSTART;TZID=\"Chennai, Kolkata, Mumbai, New Delhi\":" + tmpDateStr + "T" + tmpFromTimeStr + "00\n"
		tmpText = tmpText + "DTEND;TZID=\"Chennai, Kolkata, Mumbai, New Delhi\":" + tmpDateStr + "T" + tmpToTimeStr + "00\n"
		today = date.today()
		tmpText = tmpText + "UID:" + "YaMA-MI-"+ today.isoformat() + "\n"
		tmpText = tmpText + "SEQUENCE:0" + "\n"
		tmpText = tmpText + "ORGANIZER;CN=\"" + self.parentApp.organizerName.get() + "\":MAILTO:"+self.parentApp.organizerEmail.get() + "\n"
		tmpText = tmpText + "SUMMARY;ENCODING=QUOTED-PRINTABLE:" + tmpType + ":" + self.parentApp.meetingSubject.get() + "\n"

		tmpKeys = self.parentApp.attendees.keys()
		tmpKeys.sort()
		for id in tmpKeys:
			obj = self.parentApp.attendees[id]
			if obj.attendeeType != 1:
				tmpRole = "REQ-PARTICIPANT"
				if obj.attendeeType == 3:
					tmpRole = "OPT-PARTICIPANT"
				elif obj.attendeeType == 4:
					tmpRole = "NON-PARTICIPANT"
				tmpText = tmpText + "ATTENDEE;CN=\"" + obj.attendeeName + "\";RSVP=TRUE;PARTSTAT=NEEDS-ACTION;ROLE=" + tmpRole + ":MAILTO:" + obj.attendeeEmail +"\n" 

		tmpAgenda = "Agenda for " + tmpType + ": " + tmpSubject + ", " + tmpDate + ", " + tmpFromTime + "-" + tmpToTime + "\n\n"
		tmpCount = 1
		tmpKeys = self.parentApp.agenda.keys()
		tmpKeys.sort()
		for id in tmpKeys:
			obj = self.parentApp.agenda[id]
			tmpText1 = "\t" + `tmpCount` + ". " + obj.details + "\n"
			tmpCount = tmpCount + 1
			tmpAgenda = tmpAgenda + tmpText1

		tmpDial = self.parentApp.meetingDialNum.get()
		if tmpDial != "":
			tmpAgenda = tmpAgenda + "\tDial " + tmpDial + "\n"

		tmpAccess = self.parentApp.meetingAccessCode.get()
		if tmpAccess != "":
			tmpAgenda = tmpAgenda + "\tAccess Code " + tmpAccess + "\n"

		tmpURL = self.parentApp.meetingURL.get()
		if tmpURL != "":
			tmpAgenda = tmpAgenda + "\tURL " + tmpURL + "\n"
	
		tmpText = tmpText + "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:\"" + tmpAgenda + "\t\"\n"
		tmpText = tmpText + "TRANSP:OPAQUE" + "\n"
		tmpText = tmpText + "CATEGORIES;ENCODING=QUOTED-PRINTABLE:YaMA" + "\n"
		tmpText = tmpText + "STATUS:NEEDS-ACTION" + "\n"
		tmpText = tmpText + "PRIORITY:3" + "\n"
		tmpText = tmpText + "LOCATION:" + tmpLocation + "\n"
		tmpText = tmpText + "CLASS:PUBLIC" + "\n"
		tmpText = tmpText + "BEGIN:VALARM" + "\n"
		tmpText = tmpText + "TRIGGER:-PT15M" + "\n"
		tmpText = tmpText + "ACTION:DISPLAY" + "\n"
		tmpText = tmpText + "DESCRIPTION:Reminder" + "\n"
		tmpText = tmpText + "END:VALARM" + "\n"
		tmpText = tmpText + "END:VEVENT" + "\n"
		tmpText = tmpText + "END:VCALENDAR" + "\n"
				
		self.note.insert(END, "\nMeeting Invitation " + tmpSubject + " ")	

		tmpFileName = os.tempnam (None, "YaMA-MI-") + ".ics"
		print tmpFileName
		tmpFd = open (tmpFileName, "w")
		tmpFd.write (tmpText)
		tmpFd.flush()
		tmpFd.close()
		#os.startfile (tmpFileName)

		self.note.insert(END, "exported to File:" + tmpFileName + "\n")	
		self.note.insert(END, "\nYou may send the same attached to an email to notify attendees. In order that the attendees remember to add it to their calendars, it is suggested that you include the following text in the email:\n")	
		self.note.insert(END, "\n\"Attached is an Invitation for a Meeting (in the iCalendar format). Please open it with your favorite calendaring application so as to mark your calendars. Do respond to the invitation as appropriate.\"\n")	

	def commandOpenTemp(self):
		# find a way to do this cleanly in a crossplatform manner
		if os.name == "nt":
			tmpFileName = os.environ ['TMP']
			os.startfile (tmpFileName)
		pass

	def show(self):
		#self.note.delete(1.0, END)
		Form.show(self)

class ParseActionsForm(Form):
	def __init__(self, parentApp, pageID):
		Form.__init__(self, parentApp, pageID)

		self.parentApp = parentApp
		self.parsedAIO = ActionItemObj()
		
		self.frame.rowconfigure(0, weight = 1)
		self.frame.columnconfigure(0, weight = 1)

		self.titlePanel = Frame (self.frame)
		self.titlePanel.grid(row=0, column=0, sticky=NSEW)

		self.titleLabel = Label(self.titlePanel, text="Parse Actions into YaMA", anchor=CENTER, font=("Helvetica", 15, "bold"))
		self.titleLabel.pack(fill=X, anchor=W)

		self.logPanel = Frame (self.frame, border=5)
		self.logPanel.grid(row=1, column=0, sticky=NSEW)
		
		self.label4 = Label (self.logPanel, text = "Paste the text for ONE Action, from Minutes of a previous Meeting below and Click 'Parse':")
		self.label4.grid(row=1, column=0, sticky=W)
		
		self.clearButton = Button (self.logPanel, text="Clear", command=self.commandClear)
		self.clearButton.grid (row=2, column=0, sticky=W)

		self.notePanel1 = Frame (self.logPanel)
		self.notePanel1.grid(row=3, column=0,sticky=W)

		self.noteScrollbar1 = Scrollbar (self.notePanel1)
		self.noteScrollbar1.pack(side=RIGHT, fill=Y)
 
		self.note1 = Text (self.notePanel1, height=10, width=80, yscrollcommand=self.noteScrollbar1.set)
		self.note1.pack(side=LEFT, fill=BOTH, expand=1)

		self.noteScrollbar1.config(command=self.note1.yview)

		self.parseButton = Button (self.logPanel, text="Parse", command=self.commandParse)
		self.parseButton.grid (row=4, column=0, sticky=W)

		self.notePanel2 = Frame (self.logPanel)
		self.notePanel2.grid(row=5, column=0,sticky=W)

		self.noteScrollbar2 = Scrollbar (self.notePanel2)
		self.noteScrollbar2.pack(side=RIGHT, fill=Y)
 
		self.note2 = Text (self.notePanel2, height=10, width=80, bd=1, background="light grey", yscrollcommand=self.noteScrollbar2.set)
		self.note2.pack(side=LEFT, fill=BOTH, expand=1)

		self.noteScrollbar2.config(command=self.note2.yview)

		self.buttonPanel = Frame (self.logPanel)
		self.buttonPanel.grid (row=6, column=0, sticky=W)

		self.addToMinutes = Button (self.buttonPanel, text="Add to Minutes", command=self.commandAddToMinutes)
		self.addToMinutes.grid (row=0, column=0)

		self.changeToANewID = IntVar()
		self.changeIDCheck = Checkbutton (self.buttonPanel, text="Generate A New ID", variable = self.changeToANewID)
		self.changeIDCheck.grid (row=0, column=1)

		self.changeToANewDate = IntVar()
		self.changeDateCheck = Checkbutton (self.buttonPanel, text="Set A New Closure Date", variable = self.changeToANewDate)
		self.changeDateCheck.grid (row=0, column=2)

		self.eedStr = StringVar()
		self.eedEntry = Entry (self.buttonPanel, width=10, textvariable=self.eedStr)
		self.eedEntry.grid(row=0, column=3)

		self.todayButton = Button (self.buttonPanel, text="<< Today",command=self.commandToday)
		self.todayButton.grid(row=0, column=4) 

		self.useMatchingNick = IntVar()
		self.useMatchingNick.set(1)
		self.matchingNickCheck = Checkbutton (self.buttonPanel, text="Use matching name from Attendee List", variable = self.useMatchingNick)
		self.matchingNickCheck.grid (row=1, column=1, columnspan=2, sticky=W)

	def changeFontSize(self):
		self.note1.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.note2.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.eedEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))

	def commandAddToMinutes(self):
		if 1 == self.changeToANewID.get():
			#if past reference is empty, set it to the current ID before updating
			if "" == self.parsedAIO.pastRef:
				self.parsedAIO.pastRef = self.parsedAIO.ID
			self.parentApp.lastIDUsed = self.parentApp.lastIDUsed + 1
			today = date.today()
			self.parsedAIO.ID = "AI-"+ today.isoformat() + "-#" + `self.parentApp.lastIDUsed`
		
		if 1 == self.changeToANewDate.get():
			self.parsedAIO.expEndDate = self.eedEntry.get()

		self.note2.delete(1.0, END)

		tmpMatchingNickFound = FALSE
		if 1 == self.useMatchingNick.get():
			tmpKeys = self.parentApp.attendees.keys()
			for id in tmpKeys:
				obj = self.parentApp.attendees[id]
				if obj.attendeeNick == self.parsedAIO.contactNick:
					self.parsedAIO.contactName = obj.attendeeName
					self.parsedAIO.contactEmail = obj.attendeeEmail
					tmpMatchingNickFound = TRUE
					break
			if TRUE == tmpMatchingNickFound:
				self.note2.insert(END, "Using matching Attendee information: " + self.parsedAIO.contactName + "<" + self.parsedAIO.contactEmail + ">\n")
			else:	
				self.note2.insert(END, "No matching Attendee found.\n")

		idStr = self.parentApp.addActionItem(self.parsedAIO)
		print idStr
		str = idStr + ". "+ self.parsedAIO.details
		self.parentApp.pageList["ActionItems"].list.insert(END, str)

		self.note2.insert(END, "Action Item " + self.parsedAIO.ID + " added to Minutes\n")

	def commandClear(self):
		self.note1.delete(1.0, END)
		
	def commandParse(self):
		#reset data structure contents
		self.parsedAIO = ActionItemObj()
		str = self.note1.get(1.0, END)
		if str != "":
			#print str
			strlist = string.split (str, "\n")
			#print strlist
			strlist1 = string.split (strlist[0], "ID: ")
			self.parsedAIO.ID = strlist1[1]
			self.parsedAIO.contactName = ""
			self.parsedAIO.contactEmail = ""
			for substr in strlist[1:]:
				#print substr
				if "" == substr:
					continue
				if "Contact:" in substr:
					strlist1 = string.split (substr, "Contact: ")
					#print strlist1
					self.parsedAIO.contactNick = strlist1[1]
				elif "Expected Closure Date:" in substr:
					strlist1 = string.split (substr, "Expected Closure Date: ")
					#print strlist1
					self.parsedAIO.expEndDate = strlist1[1]
				elif "Past Reference:" in substr:
					strlist1 = string.split (substr, "Past Reference: ")
					#print strlist1
					self.parsedAIO.pastRef = strlist1[1]
				else:
					#print "Yoyo" + substr
					self.parsedAIO.details = substr
			self.note2.delete(1.0, END)
			self.note2.insert(END, "The following data is recognized...\n")
			self.note2.insert(END, self.parsedAIO.previewText() + "\n")
			if "" == self.parsedAIO.ID:
				self.note2.insert(END, "Warning: Action Item does not have an ID\n")
			if "" == self.parsedAIO.details:
				self.note2.insert(END, "Warning: Action Item does not have the Action Text\n")

	def commandToday(self):
		today = date.today()
		self.eedStr.set (today.isoformat())
		
	def show(self):
		#self.note.delete(1.0, END)
		Form.show(self)

class ActionItemsForm(Form):
	def __init__(self, parentApp, pageID):
		Form.__init__(self, parentApp, pageID)

		self.parentApp = parentApp
		
		self.frame.rowconfigure(0, weight = 1)
		self.frame.columnconfigure(0, weight = 1)

		self.titlePanel = Frame (self.frame)
		self.titlePanel.grid(row=0, column=0, sticky=NSEW, columnspan=3)

		self.titleLabel = Label(self.titlePanel, text="Actions: Record the Action Items", anchor=CENTER, font=("Helvetica", 15, "bold"))
		self.titleLabel.pack(fill=X, anchor=W)

		self.aiOuterPanel = Frame (self.frame, border=5)
		self.aiOuterPanel.grid(row=1, column=0)

		self.idPanel = Frame (self.aiOuterPanel)
		self.idPanel.grid(row=0, column=0)

		self.idLabel = Label (self.idPanel, text="ID:", font=("Helvetica", 13, "normal"))
		self.idLabel.grid (row=0, column=0, sticky=NSEW)

		self.idStr = StringVar()
		self.idEntry = Entry (self.idPanel, textvariable=self.idStr)
		self.idEntry.grid(row=0, column=1)

		self.generateButton = Button (self.idPanel, text="<< Generate",command=self.commandGenerate)
		self.generateButton.grid(row=0, column=2, sticky=W) 

		self.contactNameLabel = Label (self.idPanel, text="Contact:", font=("Helvetica", 13, "normal"))
		self.contactNameLabel.grid (row=1, column=0, sticky=NSEW)

		self.contactNickStr = StringVar()
		self.contactNickEntry = Entry (self.idPanel, textvariable=self.contactNickStr)
		self.contactNickEntry.grid(row=1, column=1)

		self.contactFullNameStr = StringVar()
		self.contactFullNameEntry = Entry (self.idPanel, textvariable=self.contactFullNameStr)
		self.contactFullNameEntry.grid(row=2, column=1)

		self.contactEmailLabel = Label (self.idPanel, text="Email:", font=("Helvetica", 13, "normal"))
		self.contactEmailLabel.grid (row=3, column=0, sticky=NSEW)

		self.contactEmailStr = StringVar()
		self.contactEmailEntry = Entry (self.idPanel, textvariable=self.contactEmailStr)
		self.contactEmailEntry.grid(row=3, column=1)

		self.ctListPanel = Frame (self.idPanel, border=5)
		self.ctListPanel.grid(row=1, column=2, rowspan=3)

		self.selectContactButton = Button (self.ctListPanel, text="<< Select",command=self.commandSelectContact)
		self.selectContactButton.grid(row=1, column=0, sticky=NSEW)

		self.ctListBoxPanel = Frame (self.ctListPanel)
		self.ctListBoxPanel.grid(row=0, column=0,sticky=NSEW)

		self.ctListScrollbar = Scrollbar (self.ctListBoxPanel)
		self.ctListScrollbar.pack(side=RIGHT, fill=Y)

		self.ctList = Listbox (self.ctListBoxPanel, height=5, width=10, yscrollcommand=self.ctListScrollbar.set)
		self.ctList.pack(side=LEFT, fill=BOTH, expand=1)

		self.ctListScrollbar.config(command=self.ctList.yview)

		self.eedLabel = Label (self.idPanel, text="Closure:", font=("Helvetica", 13, "normal"))
		self.eedLabel.grid (row=4, column=0, sticky=NSEW)

		self.eedStr = StringVar()
		self.eedEntry = Entry (self.idPanel, textvariable=self.eedStr)
		self.eedEntry.grid(row=4, column=1)

		self.pastRefLabel = Label (self.idPanel, text="Past Ref:", font=("Helvetica", 13, "normal"))
		self.pastRefLabel.grid (row=5, column=0, sticky=NSEW)

		self.pastRefStr = StringVar()
		self.pastRefEntry = Entry (self.idPanel, textvariable=self.pastRefStr)
		self.pastRefEntry.grid(row=5, column=1)

		self.todayButton = Button (self.idPanel, text="<< Today",command=self.commandToday)
		self.todayButton.grid(row=4, column=2, sticky=W) 

		self.aisPanel = Frame (self.aiOuterPanel)
		self.aisPanel.grid(row=1, column=0)

		self.aisLabel = Label (self.aisPanel, text="Action Item Text:", font=("Helvetica", 13, "normal"))
		self.aisLabel.grid(row=0, column=0, stick=W)
		
		self.notePanel = Frame (self.aisPanel)
		self.notePanel.grid(row=1, column=0,sticky=W)

		self.noteScrollbar = Scrollbar (self.notePanel)
		self.noteScrollbar.pack(side=RIGHT, fill=Y)
		
		self.note = Text (self.notePanel, height=4, width=45, yscrollcommand=self.noteScrollbar.set)
		self.note.pack(side=LEFT, fill=BOTH, expand=1)

		self.noteScrollbar.config(command=self.note.yview)

		self.buttonPanel = Frame (self.frame)
		self.buttonPanel.grid(row=1, column=1)

		self.addActionItem = Button (self.buttonPanel, text="Save >>\nTo List",command=self.commandAddActionItem)
		self.addActionItem.grid(row=0, column=0, sticky=S) 

		self.editSelected = Button (self.buttonPanel, text="<< Edit \nSelected",command=self.commandEditSelected)
		self.editSelected.grid(row=1, column=0, sticky=S) 

		self.copySelected = Button (self.buttonPanel, text="<= Copy \nSelected",command=self.commandCopySelected)
		self.copySelected.grid(row=2, column=0, sticky=S) 

		self.delSelected = Button (self.buttonPanel, text="Delete \nSelected",command=self.commandDelSelected)
		self.delSelected.grid(row=3, column=0, sticky=S) 

		self.previewSelected = Button (self.buttonPanel, text="Preview \nSelected",command=self.commandPreviewSelected)
		self.previewSelected.grid(row=4, column=0, sticky=S) 

		self.listPanel = Frame (self.frame, border=5)
		self.listPanel.grid(row=1, column=2)

		self.listLabel = Label(self.listPanel, text="Actions List:", font=("Helvetica", 13, "normal"))
		self.listLabel.grid(row=0, column=0,sticky=W)

		self.listBoxPanel = Frame (self.listPanel)
		self.listBoxPanel.grid(row=1, column=0,sticky=W)

		self.listScrollbar = Scrollbar (self.listBoxPanel)
		self.listScrollbar.pack(side=RIGHT, fill=Y)

		self.list = Listbox (self.listBoxPanel, height=17, width=25, yscrollcommand=self.listScrollbar.set)
		self.list.pack(side=LEFT, fill=BOTH, expand=1)

		self.listScrollbar.config(command=self.list.yview)

		self.previewPanel = Frame (self.frame, border=5)
		self.previewPanel.grid(row=2, column=0, columnspan=3)

		self.previewLabel = Label (self.previewPanel, text="Preview:", font=("Helvetica", 13, "normal"))
		self.previewLabel.grid(row=0, column=0)

		self.previewTextPanel = Frame (self.previewPanel)
		self.previewTextPanel.grid(row=0, column=1)

		self.previewScrollbar = Scrollbar (self.previewTextPanel)
		self.previewScrollbar.pack(side=RIGHT, fill=Y)
		
		self.previewText = Text (self.previewTextPanel, height=5, width=60, bd=1, background="light grey", yscrollcommand=self.previewScrollbar.set)
		self.previewText.pack(side=LEFT, fill=BOTH, expand=1)

		self.previewScrollbar.config(command=self.previewText.yview)

	def changeFontSize(self):
		self.idEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))	
		self.contactNickEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.contactFullNameEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.contactEmailEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.eedEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.pastRefEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.note.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.list.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.ctList.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.previewText.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))

	def commandAddActionItem(self):
		str = self.note.get(1.0, END)
		if str != "":
			aio = ActionItemObj()
			aio.details = str
			aio.ID = self.idStr.get()
			aio.contactNick = self.contactNickStr.get()
			aio.contactName = self.contactFullNameStr.get()
			aio.contactEmail = self.contactEmailStr.get()
			aio.expEndDate = self.eedStr.get()
			aio.pastRef = self.pastRefStr.get()
			idStr = self.parentApp.addActionItem(aio)
			str = idStr + ". "+ str

			self.list.insert(END, str)

			self.note.delete(1.0, END)
			self.idStr.set("")
			self.contactNickStr.set("")
			self.contactFullNameStr.set("")
			self.contactEmailStr.set("")
			self.eedStr.set("")
			self.pastRefStr.set("")
		
	def commandSelectContact(self):
			items = self.ctList.curselection()
			if len (items) > 0:
				tmpstr = self.ctList.get(items[0])
				strlist = string.split(tmpstr, ".")
				self.contactNickStr.set(self.parentApp.attendees[strlist[0]].attendeeNick)
				self.contactFullNameStr.set(self.parentApp.attendees[strlist[0]].attendeeName)
				self.contactEmailStr.set(self.parentApp.attendees[strlist[0]].attendeeEmail)

	def commandToday(self):
		today = date.today()
		self.eedStr.set (today.isoformat())
		
	def commandGenerate(self):
		self.parentApp.lastIDUsed = self.parentApp.lastIDUsed + 1
		today = date.today()
		self.idStr.set ("AI-"+ today.isoformat() + "-#" + `self.parentApp.lastIDUsed`)
		
	def commandPreviewSelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			self.previewText.delete (1.0,END)
			self.previewText.insert(END, self.parentApp.actionItems[strlist[0]].previewText())

	def commandEditSelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			aio = self.parentApp.actionItems[strlist[0]]
			self.note.delete(1.0, END)
			self.note.insert(END, aio.details)
			self.idStr.set(aio.ID)
			self.contactNickStr.set(aio.contactNick)
			self.contactFullNameStr.set(aio.contactName)
			self.contactEmailStr.set(aio.contactEmail)
			self.eedStr.set(aio.expEndDate)
			self.pastRefStr.set(aio.pastRef)
			self.parentApp.delActionItem(strlist[0])
			self.list.delete(ANCHOR)

	def commandCopySelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			aio = self.parentApp.actionItems[strlist[0]]
			self.note.delete(1.0, END)
			self.note.insert(END, aio.details)
			self.idStr.set(aio.ID)
			self.contactNickStr.set(aio.contactNick)
			self.contactFullNameStr.set(aio.contactName)
			self.contactEmailStr.set(aio.contactEmail)
			self.eedStr.set(aio.expEndDate)
			self.pastRefStr.set(aio.pastRef)

	def commandDelSelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			self.parentApp.delActionItem(strlist[0])
			self.list.delete(ANCHOR)

	def show(self):
		self.ctList.delete(0, END)
		tmpKeys = self.parentApp.attendees.keys()
		tmpKeys.sort()
		for id in tmpKeys:
			obj = self.parentApp.attendees[id]
			self.ctList.insert (END, id + "." + obj.attendeeNick)
		self.ctList.selection_anchor(0)
		Form.show(self)

class DecisionsForm(Form):
	def __init__(self, parentApp, pageID):
		Form.__init__(self, parentApp, pageID)

		self.parentApp = parentApp
		
		self.frame.rowconfigure(0, weight = 1)
		self.frame.columnconfigure(0, weight = 1)

		self.titlePanel = Frame (self.frame)
		self.titlePanel.grid(row=0, column=0, columnspan=3, sticky=NSEW)

		self.titleLabel = Label(self.titlePanel, text="Decisions: Record the decisions reached", anchor=CENTER, font=("Helvetica", 15, "bold"))
		self.titleLabel.pack(fill=X, anchor=W)

		self.decisionsPanel = Frame (self.frame, border=5)
		self.decisionsPanel.grid(row=1, column=0)

		self.contactPanel = Frame (self.decisionsPanel)
		self.contactPanel.grid(row=0, column=0)


		self.contactNameLabel = Label (self.contactPanel, text="Contact:", font=("Helvetica", 13, "normal"))
		self.contactNameLabel.grid (row=0, column=0, sticky=NSEW)

		self.contactNickStr = StringVar()
		self.contactNickEntry = Entry (self.contactPanel, textvariable=self.contactNickStr)
		self.contactNickEntry.grid(row=0, column=1)

		self.contactFullNameStr = StringVar()
		self.contactFullNameEntry = Entry (self.contactPanel, textvariable=self.contactFullNameStr)
		self.contactFullNameEntry.grid(row=1, column=1)

		self.contactEmailLabel = Label (self.contactPanel, text="Email:", font=("Helvetica", 13, "normal"))
		self.contactEmailLabel.grid (row=2, column=0, sticky=NSEW)

		self.contactEmailStr = StringVar()
		self.contactEmailEntry = Entry (self.contactPanel, textvariable=self.contactEmailStr)
		self.contactEmailEntry.grid(row=2, column=1)

		self.ctListPanel = Frame (self.contactPanel, border=5)
		self.ctListPanel.grid(row=0, column=2, rowspan=3)

		self.selectContactButton = Button (self.ctListPanel, text="<< Select",command=self.commandSelectContact)
		self.selectContactButton.grid(row=1, column=0, sticky=NSEW)

		self.ctListBoxPanel = Frame (self.ctListPanel)
		self.ctListBoxPanel.grid(row=0, column=0,sticky=NSEW)

		self.ctListScrollbar = Scrollbar (self.ctListBoxPanel)
		self.ctListScrollbar.pack(side=RIGHT, fill=Y)

		self.ctList = Listbox (self.ctListBoxPanel, height=5, width=10, yscrollcommand=self.ctListScrollbar.set)
		self.ctList.pack(side=LEFT, fill=BOTH, expand=1)

		self.ctListScrollbar.config(command=self.ctList.yview)

		self.decisionLabel = Label (self.decisionsPanel, text="Decision Text:", font=("Helvetica", 13, "normal"))
		self.decisionLabel.grid(row=1, column=0, stick=W)
		
		self.notePanel = Frame (self.decisionsPanel)
		self.notePanel.grid(row=2, column=0,sticky=W)

		self.noteScrollbar = Scrollbar (self.notePanel)
		self.noteScrollbar.pack(side=RIGHT, fill=Y)
		
		self.note = Text (self.notePanel, height=10, width=45, yscrollcommand=self.noteScrollbar.set)
		self.note.pack(side=LEFT, fill=BOTH, expand=1)

		self.noteScrollbar.config(command=self.note.yview)

		self.buttonPanel = Frame (self.frame)
		self.buttonPanel.grid(row=1, column=1)

		self.addDecision = Button (self.buttonPanel, text="Save >>\nTo List",command=self.commandAddDecision)
		self.addDecision.grid(row=0, column=0, sticky=S) 

		self.editSelected = Button (self.buttonPanel, text="<< Edit \nSelected",command=self.commandEditSelected)
		self.editSelected.grid(row=1, column=0, sticky=S) 

		self.copySelected = Button (self.buttonPanel, text="<= Copy \nSelected",command=self.commandCopySelected)
		self.copySelected.grid(row=2, column=0, sticky=S) 

		self.delSelected = Button (self.buttonPanel, text="Delete \nSelected",command=self.commandDelSelected)
		self.delSelected.grid(row=3, column=0, sticky=S) 

		self.previewSelected = Button (self.buttonPanel, text="Preview \nSelected",command=self.commandPreviewSelected)
		self.previewSelected.grid(row=4, column=0, sticky=S) 

		self.listPanel = Frame (self.frame, border=5)
		self.listPanel.grid(row=1, column=2)

		self.listLabel = Label(self.listPanel, text="Decision List:", font=("Helvetica", 13, "normal"))
		self.listLabel.grid(row=0, column=0,sticky=W)

		self.listBoxPanel = Frame (self.listPanel)
		self.listBoxPanel.grid(row=1, column=0,sticky=W)

		self.listScrollbar = Scrollbar (self.listBoxPanel)
		self.listScrollbar.pack(side=RIGHT, fill=Y)

		self.list = Listbox (self.listBoxPanel, height=15, width=25, yscrollcommand=self.listScrollbar.set)
		self.list.pack(side=LEFT, fill=BOTH, expand=1)

		self.listScrollbar.config(command=self.list.yview)

		self.previewPanel = Frame (self.frame, border=5)
		self.previewPanel.grid(row=2, column=0, columnspan=3)

		self.previewLabel = Label (self.previewPanel, text="Preview:", font=("Helvetica", 13, "normal"))
		self.previewLabel.grid(row=0, column=0)

		self.previewTextPanel = Frame (self.previewPanel)
		self.previewTextPanel.grid(row=0, column=1)

		self.previewScrollbar = Scrollbar (self.previewTextPanel)
		self.previewScrollbar.pack(side=RIGHT, fill=Y)
		
		self.previewText = Text (self.previewTextPanel, height=5, width=60, bd=1, background="light grey", yscrollcommand=self.previewScrollbar.set)
		self.previewText.pack(side=LEFT, fill=BOTH, expand=1)

		self.previewScrollbar.config(command=self.previewText.yview)

	def changeFontSize(self):
		self.contactNickEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.contactFullNameEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.contactEmailEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.note.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.list.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.ctList.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.previewText.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))

	def commandAddDecision(self):
		str = self.note.get(1.0, END)
		if str != "":
			do = DecisionObj()
			do.details = str
			do.contactNick = self.contactNickStr.get()
			do.contactName = self.contactFullNameStr.get()
			do.contactEmail = self.contactEmailStr.get()
			idStr = self.parentApp.addDecision(do)
			str = idStr + ". "+ str
			self.list.insert(END, str)
			self.note.delete(1.0, END)
			self.contactNickStr.set("")
			self.contactFullNameStr.set("")
			self.contactEmailStr.set("")

	def commandSelectContact(self):
		items = self.ctList.curselection()
		if len (items) > 0:
			tmpstr = self.ctList.get(items[0])
			strlist = string.split(tmpstr, ".")
			self.contactNickStr.set(self.parentApp.attendees[strlist[0]].attendeeNick)
			self.contactFullNameStr.set(self.parentApp.attendees[strlist[0]].attendeeName)
			self.contactEmailStr.set(self.parentApp.attendees[strlist[0]].attendeeEmail)
		
	def commandPreviewSelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			self.previewText.delete (1.0,END)
			self.previewText.insert(END, self.parentApp.decisions[strlist[0]].previewText())

	def commandEditSelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			do = self.parentApp.decisions[strlist[0]]
			self.note.delete(1.0, END)
			self.note.insert(END, do.details)
			self.contactNickStr.set(do.contactNick)
			self.contactFullNameStr.set(do.contactName)
			self.contactEmailStr.set(do.contactEmail)
			self.parentApp.delDecision(strlist[0])
			self.list.delete(ANCHOR)

	def commandCopySelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			do = self.parentApp.decisions[strlist[0]]
			self.note.delete(1.0, END)
			self.note.insert(END, do.details)
			self.contactNickStr.set(do.contactNick)
			self.contactFullNameStr.set(do.contactName)
			self.contactEmailStr.set(do.contactEmail)

	def commandDelSelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			self.parentApp.delDecision(strlist[0])
			self.list.delete(ANCHOR)

	def show(self):
		self.ctList.delete(0, END)
		tmpKeys = self.parentApp.attendees.keys()
		tmpKeys.sort()
		for id in tmpKeys:
			obj = self.parentApp.attendees[id]
			self.ctList.insert (END, id + "." + obj.attendeeNick)
		self.ctList.selection_anchor(0)
		Form.show(self)

class AgendaForm(Form):
	def __init__(self, parentApp, pageID):
		Form.__init__(self, parentApp, pageID)

		self.parentApp = parentApp
		
		self.frame.rowconfigure(0, weight = 1)
		self.frame.columnconfigure(0, weight = 1)

		self.titlePanel = Frame (self.frame)
		self.titlePanel.grid(row=0, column=0, sticky=NSEW, columnspan=3)

		self.titleLabel = Label(self.titlePanel, text="Agenda: Record the Agenda items", anchor=CENTER, font=("Helvetica", 15, "bold"))
		self.titleLabel.pack(fill=X, anchor=W)

		self.agendaItemPanel = Frame (self.frame, border=5)
		self.agendaItemPanel.grid(row=1, column=0)

		self.agendaItemLabel = Label (self.agendaItemPanel, text="Agenda Item Text:", font=("Helvetica", 13, "normal"))
		self.agendaItemLabel.grid(row=0, column=0, stick=W)
		
		self.notePanel = Frame (self.agendaItemPanel)
		self.notePanel.grid(row=1, column=0,sticky=W)

		self.noteScrollbar = Scrollbar (self.notePanel)
		self.noteScrollbar.pack(side=RIGHT, fill=Y)
		
		self.note = Text (self.notePanel, height=15, width=45, yscrollcommand=self.noteScrollbar.set)
		self.note.pack(side=LEFT, fill=BOTH, expand=1)

		self.noteScrollbar.config(command=self.note.yview)

		self.buttonPanel = Frame (self.frame)
		self.buttonPanel.grid(row=1, column=1)

		self.addAgenda = Button (self.buttonPanel, text="Save >>\nTo List",command=self.commandAddAgenda)
		self.addAgenda.grid(row=0, column=0, sticky=S) 

		self.editSelected = Button (self.buttonPanel, text="<< Edit \nSelected",command=self.commandEditSelected)
		self.editSelected.grid(row=1, column=0, sticky=S) 

		self.copySelected = Button (self.buttonPanel, text="<= Copy \nSelected",command=self.commandCopySelected)
		self.copySelected.grid(row=2, column=0, sticky=S) 

		self.delSelected = Button (self.buttonPanel, text="Delete \nSelected",command=self.commandDelSelected)
		self.delSelected.grid(row=3, column=0, sticky=S) 

		self.previewSelected = Button (self.buttonPanel, text="Preview \nSelected",command=self.commandPreviewSelected)
		self.previewSelected.grid(row=4, column=0, sticky=S) 

		self.listPanel = Frame (self.frame, border=5)
		self.listPanel.grid(row=1, column=2)

		self.listLabel = Label(self.listPanel, text="Agenda List:", font=("Helvetica", 13, "normal"))
		self.listLabel.grid(row=0, column=0,sticky=W)

		self.listBoxPanel = Frame (self.listPanel)
		self.listBoxPanel.grid(row=1, column=0,sticky=W)

		self.listScrollbar = Scrollbar (self.listBoxPanel)
		self.listScrollbar.pack(side=RIGHT, fill=Y)

		self.list = Listbox (self.listBoxPanel, height=17, width=25, yscrollcommand=self.listScrollbar.set)
		self.list.pack(side=LEFT, fill=BOTH, expand=1)

		self.listScrollbar.config(command=self.list.yview)

		self.previewPanel = Frame (self.frame, border=5)
		self.previewPanel.grid(row=2, column=0, columnspan=3)

		self.previewLabel = Label (self.previewPanel, text="Preview:", font=("Helvetica", 13, "normal"))
		self.previewLabel.grid(row=0, column=0)

		self.previewTextPanel = Frame (self.previewPanel)
		self.previewTextPanel.grid(row=0, column=1)

		self.previewScrollbar = Scrollbar (self.previewTextPanel)
		self.previewScrollbar.pack(side=RIGHT, fill=Y)
		
		self.previewText = Text (self.previewTextPanel, height=5, width=60, bd=1, background="light grey", yscrollcommand=self.previewScrollbar.set)
		self.previewText.pack(side=LEFT, fill=BOTH, expand=1)

		self.previewScrollbar.config(command=self.previewText.yview)

	def changeFontSize(self):
		self.note.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.list.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.previewText.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))

	def commandAddAgenda(self):
		str = self.note.get(1.0, END)
		if str != "":
			ao = AgendaObj()
			ao.details = str
			idStr = self.parentApp.addAgenda(ao)
			str = idStr + ". "+ str
			self.list.insert(END, str)
			self.note.delete(1.0, END)

	def commandPreviewSelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			self.previewText.delete (1.0,END)
			self.previewText.insert(END, self.parentApp.agenda[strlist[0]].previewText())

	def commandEditSelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			ao = self.parentApp.agenda[strlist[0]]
			self.note.delete(1.0, END)
			self.note.insert(END, ao.details)
			self.parentApp.delAgenda(strlist[0])
			self.list.delete(ANCHOR)

	def commandCopySelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			ao = self.parentApp.agenda[strlist[0]]
			self.note.delete(1.0, END)
			self.note.insert(END, ao.details)

	def commandDelSelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			self.parentApp.delAgenda(strlist[0])
			self.list.delete(ANCHOR)

class IssuesForm(Form):
	def __init__(self, parentApp, pageID):
		Form.__init__(self, parentApp, pageID)

		self.parentApp = parentApp
		
		self.frame.rowconfigure(0, weight = 1)
		self.frame.columnconfigure(0, weight = 1)

		self.titlePanel = Frame (self.frame)
		self.titlePanel.grid(row=0, column=0, sticky=NSEW, columnspan=3)

		self.titleLabel = Label(self.titlePanel, text="Issues: Record the issues discussed", anchor=CENTER, font=("Helvetica", 15, "bold"))
		self.titleLabel.pack(fill=X, anchor=W)

		self.issuesPanel = Frame (self.frame, border=5)
		self.issuesPanel.grid(row=1, column=0)

		self.issueLabel = Label (self.issuesPanel, text="Issue Text:", font=("Helvetica", 13, "normal"))
		self.issueLabel.grid(row=0, column=0, stick=W)
		
		self.notePanel = Frame (self.issuesPanel)
		self.notePanel.grid(row=1, column=0,sticky=W)

		self.noteScrollbar = Scrollbar (self.notePanel)
		self.noteScrollbar.pack(side=RIGHT, fill=Y)
		
		self.note = Text (self.notePanel, height=15, width=45, yscrollcommand=self.noteScrollbar.set)
		self.note.pack(side=LEFT, fill=BOTH, expand=1)

		self.noteScrollbar.config(command=self.note.yview)

		self.buttonPanel = Frame (self.frame)
		self.buttonPanel.grid(row=1, column=1)

		self.addIssue = Button (self.buttonPanel, text="Save >>\nTo List",command=self.commandAddIssue)
		self.addIssue.grid(row=0, column=0, sticky=S) 

		self.editSelected = Button (self.buttonPanel, text="<< Edit \nSelected",command=self.commandEditSelected)
		self.editSelected.grid(row=1, column=0, sticky=S) 

		self.copySelected = Button (self.buttonPanel, text="<= Copy \nSelected",command=self.commandCopySelected)
		self.copySelected.grid(row=2, column=0, sticky=S) 

		self.delSelected = Button (self.buttonPanel, text="Delete \nSelected",command=self.commandDelSelected)
		self.delSelected.grid(row=3, column=0, sticky=S) 

		self.previewSelected = Button (self.buttonPanel, text="Preview \nSelected",command=self.commandPreviewSelected)
		self.previewSelected.grid(row=4, column=0, sticky=S) 

		self.listPanel = Frame (self.frame, border=5)
		self.listPanel.grid(row=1, column=2)

		self.listLabel = Label(self.listPanel, text="Issue List:", font=("Helvetica", 13, "normal"))
		self.listLabel.grid(row=0, column=0,sticky=W)

		self.listBoxPanel = Frame (self.listPanel)
		self.listBoxPanel.grid(row=1, column=0,sticky=W)

		self.listScrollbar = Scrollbar (self.listBoxPanel)
		self.listScrollbar.pack(side=RIGHT, fill=Y)

		self.list = Listbox (self.listBoxPanel, height=17, width=25, yscrollcommand=self.listScrollbar.set)
		self.list.pack(side=LEFT, fill=BOTH, expand=1)

		self.listScrollbar.config(command=self.list.yview)

		self.previewPanel = Frame (self.frame, border=5)
		self.previewPanel.grid(row=2, column=0, columnspan=3)

		self.previewLabel = Label (self.previewPanel, text="Preview:", font=("Helvetica", 13, "normal"))
		self.previewLabel.grid(row=0, column=0)

		self.previewTextPanel = Frame (self.previewPanel)
		self.previewTextPanel.grid(row=0, column=1)

		self.previewScrollbar = Scrollbar (self.previewTextPanel)
		self.previewScrollbar.pack(side=RIGHT, fill=Y)
		
		self.previewText = Text (self.previewTextPanel, height=5, width=60, bd=1, background="light grey", yscrollcommand=self.previewScrollbar.set)
		self.previewText.pack(side=LEFT, fill=BOTH, expand=1)

		self.previewScrollbar.config(command=self.previewText.yview)

	def changeFontSize(self):
		self.note.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.list.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.previewText.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))

	def commandAddIssue(self):
		str = self.note.get(1.0, END)
		if str != "":
			io = IssueObj()
			io.details = str
			idStr = self.parentApp.addIssue(io)
			str = idStr + ". "+ str
			self.list.insert(END, str)
			self.note.delete(1.0, END)

	def commandPreviewSelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			self.previewText.delete (1.0,END)
			self.previewText.insert(END, self.parentApp.issues[strlist[0]].previewText())

	def commandEditSelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			io = self.parentApp.issues[strlist[0]]
			self.note.delete(1.0, END)
			self.note.insert(END, io.details)
			self.parentApp.delIssue(strlist[0])
			self.list.delete(ANCHOR)

	def commandCopySelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			io = self.parentApp.issues[strlist[0]]
			self.note.delete(1.0, END)
			self.note.insert(END, io.details)

	def commandDelSelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			self.parentApp.delIssue(strlist[0])
			self.list.delete(ANCHOR)

class AboutMeetingForm(Form):
	def __init__(self, parentApp, pageID):
		Form.__init__(self, parentApp, pageID)

		self.parentApp = parentApp
		
		self.titlePanel = Frame (self.frame)
		self.titlePanel.grid(row=0, column=0, sticky=NSEW)

		self.titleLabel = Label(self.titlePanel, text="Record information about the Meeting", font=("Helvetica", 15, "bold"),anchor=CENTER)
		self.titleLabel.pack(fill=X, anchor=W)

		self.meetInfoPanel = Frame (self.frame)
		self.meetInfoPanel.grid(row=1, column=0)

		self.separatorButton = Button (self.meetInfoPanel, text="", relief=FLAT, bd=1)
		self.separatorButton.grid (row=0, column=0, columnspan=4)

		self.documentTypePanel = Frame (self.meetInfoPanel)
		self.documentTypePanel.grid(row=1, column=0, columnspan=2, sticky=E)

		parentApp.documentType.set (1)
		tmpRadio = Radiobutton (self.documentTypePanel, text=parentApp.documentTypeText[1], variable=parentApp.documentType, value=1)
		tmpRadio.grid(row=0, column=1, sticky=W)
		tmpRadio = Radiobutton (self.documentTypePanel, text=parentApp.documentTypeText[2], variable=parentApp.documentType, value=2)
		tmpRadio.grid(row=0, column=2, sticky=W)
		tmpRadio = Radiobutton (self.documentTypePanel, text=parentApp.documentTypeText[3], variable=parentApp.documentType, value=3)
		tmpRadio.grid(row=1, column=1, sticky=W)
		tmpRadio = Radiobutton (self.documentTypePanel, text=parentApp.documentTypeText[4], variable=parentApp.documentType, value=4)
		tmpRadio.grid(row=1, column=2, sticky=W)
		tmpRadio = Radiobutton (self.documentTypePanel, text=parentApp.documentTypeText[0], variable=parentApp.documentType, value=0)
		tmpRadio.grid(row=2, column=1, sticky=W)

		self.specifiedDocumentType = Entry (self.documentTypePanel,textvariable=self.parentApp.specifiedDocumentType, width=10, font=(parentApp.widgetFontName, parentApp.widgetFontSize))
		self.specifiedDocumentType.grid(row=2, column=2, columnspan=2)

		self.meetingTypeLabel = Label (self.meetInfoPanel, text="of", font=("Helvetica", 13, "normal"))
		self.meetingTypeLabel.grid (row=1, column=2, sticky=EW)

		self.meetTypePanel = Frame (self.meetInfoPanel)
		self.meetTypePanel.grid(row=1, column=3, columnspan=2, sticky=W)

		parentApp.meetingType.set (1)
		tmpRadio = Radiobutton (self.meetTypePanel, text=parentApp.meetingTypeText[1], variable=parentApp.meetingType, value=1)
		tmpRadio.grid(row=0, column=1, sticky=W)
		tmpRadio = Radiobutton (self.meetTypePanel, text=parentApp.meetingTypeText[2], variable=parentApp.meetingType, value=2)
		tmpRadio.grid(row=0, column=2, sticky=W)
		tmpRadio = Radiobutton (self.meetTypePanel, text=parentApp.meetingTypeText[3], variable=parentApp.meetingType, value=3)
		tmpRadio.grid(row=0, column=3, sticky=W)
		tmpRadio = Radiobutton (self.meetTypePanel, text=parentApp.meetingTypeText[4], variable=parentApp.meetingType, value=4)
		tmpRadio.grid(row=1, column=1, sticky=W)
		tmpRadio = Radiobutton (self.meetTypePanel, text=parentApp.meetingTypeText[5], variable=parentApp.meetingType, value=5)
		tmpRadio.grid(row=1, column=2, sticky=W)
		tmpRadio = Radiobutton (self.meetTypePanel, text=parentApp.meetingTypeText[6], variable=parentApp.meetingType, value=6)
		tmpRadio.grid(row=1, column=3, sticky=W)
		tmpRadio = Radiobutton (self.meetTypePanel, text=parentApp.meetingTypeText[0], variable=parentApp.meetingType, value=0)
		tmpRadio.grid(row=2, column=1, sticky=W)

		self.specifiedMeetingType = Entry (self.meetTypePanel,textvariable=self.parentApp.specifiedMeetingType, width=20, font=(parentApp.widgetFontName, parentApp.widgetFontSize))
		self.specifiedMeetingType.grid(row=2, column=2, columnspan=2)

		self.subjectLabel = Label (self.meetInfoPanel, text="Subject:", font=("Helvetica", 13, "normal"))
		self.subjectLabel.grid (row=3, column=0, sticky=W)

		self.subject = Entry (self.meetInfoPanel,textvariable=self.parentApp.meetingSubject, width=50, font=(parentApp.widgetFontName, parentApp.widgetFontSize))
		self.subject.grid(row=3, column=1, columnspan=3, sticky=W)

		self.locationLabel = Label (self.meetInfoPanel, text="Location:", font=("Helvetica", 13, "normal"))
		self.locationLabel.grid (row=4, column=0, sticky=W)

		self.location = Entry (self.meetInfoPanel,textvariable=self.parentApp.meetingLocation, width=50, font=(parentApp.widgetFontName, parentApp.widgetFontSize))
		self.location.grid(row=4, column=1, columnspan=3, sticky=W)

		self.separatorButton = Button (self.meetInfoPanel, text="", relief=FLAT, bd=1)
		self.separatorButton.grid (row=5, column=0, columnspan=4)

		self.meetingDateLabel = Label (self.meetInfoPanel, text="Date:", font=("Helvetica", 13, "normal"))
		self.meetingDateLabel.grid (row=6, column=0, sticky=NSEW)

		self.meetingDateEntry = Entry (self.meetInfoPanel, textvariable=self.parentApp.meetingDate, font=(parentApp.widgetFontName, parentApp.widgetFontSize))
		self.meetingDateEntry.grid(row=6, column=1)

		self.todayButton = Button (self.meetInfoPanel, text="<< Today",command=self.commandToday)
		self.todayButton.grid(row=6, column=2, sticky=W) 

		self.meetingTimeLabel = Label (self.meetInfoPanel, text="Starts:", font=("Helvetica", 13, "normal"))
		self.meetingTimeLabel.grid (row=7, column=0, sticky=NSEW)

		self.meetingFromTimeEntry = Entry (self.meetInfoPanel, textvariable=self.parentApp.meetingFromTime, font=(parentApp.widgetFontName, parentApp.widgetFontSize))
		self.meetingFromTimeEntry.grid(row=7, column=1)

		self.fromTimeButton = Button (self.meetInfoPanel, text="<< Now",command=self.commandFromTime)
		self.fromTimeButton.grid(row=7, column=2, sticky=W) 

		self.meetingTimeZoneLabel = Label (self.meetInfoPanel, text="Time Zone", font=("Helvetica", 13, "normal"))
		self.meetingTimeZoneLabel.grid (row=7, column=3, sticky=NSEW)

		self.meetingTimeZoneEntry = Entry (self.meetInfoPanel, textvariable=self.parentApp.meetingTimeZone, width=20, background="light grey", font=(parentApp.widgetFontName, parentApp.widgetFontSize))
		self.meetingTimeZoneEntry.grid(row=8, column=3)

		self.meetingTimeLabel = Label (self.meetInfoPanel, text="Ends:", font=("Helvetica", 13, "normal"))
		self.meetingTimeLabel.grid (row=8, column=0, sticky=NSEW)

		self.meetingToTimeEntry = Entry (self.meetInfoPanel, textvariable=self.parentApp.meetingToTime, font=(parentApp.widgetFontName, parentApp.widgetFontSize))
		self.meetingToTimeEntry.grid(row=8, column=1)

		self.toTimeButton = Button (self.meetInfoPanel, text="<< Now",command=self.commandToTime)
		self.toTimeButton.grid(row=8, column=2, sticky=W) 

		self.separatorButton = Button (self.meetInfoPanel, text="", relief=FLAT, bd=1)
		self.separatorButton.grid (row=9, column=0, columnspan=4)

		self.meetingDialNumLabel = Label (self.meetInfoPanel, text="Dial#:", font=("Helvetica", 13, "normal"))
		self.meetingDialNumLabel.grid (row=10, column=0, sticky=NSEW)

		self.meetingDialNumEntry = Entry (self.meetInfoPanel, textvariable=self.parentApp.meetingDialNum, font=(parentApp.widgetFontName, parentApp.widgetFontSize))
		self.meetingDialNumEntry.grid(row=10, column=1, sticky=W)

		self.meetingAccessCodeLabel = Label (self.meetInfoPanel, text="Access#:", font=("Helvetica", 13, "normal"))
		self.meetingAccessCodeLabel.grid (row=10, column=2, sticky=NSEW)

		self.meetingAccessCodeEntry = Entry (self.meetInfoPanel, textvariable=self.parentApp.meetingAccessCode, font=(parentApp.widgetFontName, parentApp.widgetFontSize))
		self.meetingAccessCodeEntry.grid(row=10, column=3, sticky=W)

		self.meetingURLLabel = Label (self.meetInfoPanel, text="URL:", font=("Helvetica", 13, "normal"))
		self.meetingURLLabel.grid (row=11, column=0, sticky=NSEW)

		self.meetingURLEntry = Entry (self.meetInfoPanel, width=60, textvariable=self.parentApp.meetingURL, font=(parentApp.widgetFontName, parentApp.widgetFontSize))
		self.meetingURLEntry.grid(row=11, column=1, columnspan=3, sticky=W)

		self.separatorButton = Button (self.meetInfoPanel, text="", relief=FLAT, bd=1)
		self.separatorButton.grid (row=12, column=0, columnspan=4)

		self.meetingStatusLabel = Label (self.meetInfoPanel, text="Status:", font=("Helvetica", 13, "normal"))
		self.meetingStatusLabel.grid (row=13, column=0, sticky=W)

		parentApp.meetingStatus.set (2)
		tmpRadio = Radiobutton (self.meetInfoPanel, text="Tentative", variable=parentApp.meetingStatus, value=1)
		tmpRadio.grid(row=13, column=1)
		tmpRadio = Radiobutton (self.meetInfoPanel, text="Confirmed", variable=parentApp.meetingStatus, value=2)
		tmpRadio.grid(row=13, column=2)
		tmpRadio = Radiobutton (self.meetInfoPanel, text="Cancelled", variable=parentApp.meetingStatus, value=3)
		tmpRadio.grid(row=13, column=3)

		self.separatorButton = Button (self.meetInfoPanel, text="", relief=FLAT, bd=1)
		self.separatorButton.grid (row=14, column=0, columnspan=4)

	def changeFontSize(self):
		self.specifiedDocumentType.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.specifiedMeetingType.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.subject.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.location.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.meetingDateEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.meetingFromTimeEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.meetingToTimeEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.meetingDialNumEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.meetingAccessCodeEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.meetingURLEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))

	def commandToday(self):
		today = date.today()
		self.parentApp.meetingDate.set (today.isoformat())
		
	def commandFromTime(self):
		self.parentApp.meetingFromTime.set (strftime("%H:%M"))
		
	def commandToTime(self):
		self.parentApp.meetingToTime.set (strftime("%H:%M"))

class AttendeesForm(Form):
	def __init__(self, parentApp, pageID):
		Form.__init__(self, parentApp, pageID)

		self.parentApp = parentApp
		
		self.titlePanel = Frame (self.frame)
		self.titlePanel.grid(row=0, column=0, sticky=NSEW)

		self.titleLabel = Label(self.titlePanel, text="Record information about Attendees", font=("Helvetica", 15, "bold"),anchor=CENTER)
		self.titleLabel.pack(fill=X, anchor=W)

		self.attendeePanel = Frame (self.frame)
		self.attendeePanel.grid(row=1, column=0)

		self.separatorButton = Button (self.attendeePanel, text="", relief=FLAT, bd=1)
		self.separatorButton.grid (row=0, column=0, columnspan=3)

		self.attendeeInfoPanel = Frame (self.attendeePanel)
		self.attendeeInfoPanel.grid(row=1, column=0, rowspan=4)

		self.nickLabel = Label (self.attendeeInfoPanel, text="Short Name:", font=("Helvetica", 13, "normal"))
		self.nickLabel.grid (row=1, column=0, sticky=W)

		self.nickStr = StringVar()
		self.nickEntry = Entry (self.attendeeInfoPanel,textvariable=self.nickStr, width=15, font=(parentApp.widgetFontName, parentApp.widgetFontSize))
		self.nickEntry.grid(row=1, column=1, sticky=W)

		self.organizerEmailLabel = Label (self.attendeeInfoPanel, text="Full Name:", font=("Helvetica", 13, "normal"))
		self.organizerEmailLabel.grid (row=2, column=0, sticky=W)

		self.nameStr = StringVar()
		self.nameEntry = Entry (self.attendeeInfoPanel,textvariable=self.nameStr, width=20, font=(parentApp.widgetFontName, parentApp.widgetFontSize))
		self.nameEntry.grid(row=2, column=1, sticky=W)

		self.emailLabel = Label (self.attendeeInfoPanel, text="Email:", font=("Helvetica", 13, "normal"))
		self.emailLabel.grid (row=3, column=0, sticky=W)

		self.emailStr = StringVar()
		self.emailEntry = Entry (self.attendeeInfoPanel,textvariable=self.emailStr, width=20, font=(parentApp.widgetFontName, parentApp.widgetFontSize))
		self.emailEntry.grid(row=3, column=1, sticky=W)

		self.meetingTypeLabel = Label (self.attendeeInfoPanel, text="Type:", font=("Helvetica", 13, "normal"))
		self.meetingTypeLabel.grid (row=4, column=0, sticky=W)

		self.attendeeType = IntVar()
		self.attendeeType.set (2)
		tmpRadio = Radiobutton (self.attendeeInfoPanel, text="Organizer", variable=self.attendeeType, value=1)
		tmpRadio.grid(row=4, column=1, sticky=W)
		tmpRadio = Radiobutton (self.attendeeInfoPanel, text="Required", variable=self.attendeeType, value=2)
		tmpRadio.grid(row=5, column=1, sticky=W)
		tmpRadio = Radiobutton (self.attendeeInfoPanel, text="Optional", variable=self.attendeeType, value=3)
		tmpRadio.grid(row=6, column=1, sticky=W)
		tmpRadio = Radiobutton (self.attendeeInfoPanel, text="Non Participant", variable=self.attendeeType, value=4)
		tmpRadio.grid(row=7, column=1, sticky=W)

		self.buttonPanel = Frame (self.attendeePanel)
		self.buttonPanel.grid(row=1, column=1, rowspan=4)

		self.addName = Button (self.buttonPanel, text="Save >>\nTo List",command=self.commandAddName)
		self.addName.grid(row=1, column=1, sticky=S) 

		self.editSelected = Button (self.buttonPanel, text="<< Edit \nSelected",command=self.commandEditSelected)
		self.editSelected.grid(row=2, column=1, sticky=S) 

		self.copySelected = Button (self.buttonPanel, text="<= Copy \nSelected",command=self.commandCopySelected)
		self.copySelected.grid(row=3, column=1, sticky=S) 

		self.delSelected = Button (self.buttonPanel, text="Delete \nSelected",command=self.commandDelSelected)
		self.delSelected.grid(row=4, column=1, sticky=S) 

		self.previewSelected = Button (self.buttonPanel, text="Preview \nSelected",command=self.commandPreviewSelected)
		self.previewSelected.grid(row=5, column=1, sticky=S) 

		self.listPanel = Frame (self.attendeePanel, border=5)
		self.listPanel.grid(row=1, column=3, rowspan=4)

		self.listLabel = Label(self.listPanel, text="Attendee List:", font=("Helvetica", 13, "normal"))
		self.listLabel.grid(row=0, column=0, columnspan=2, sticky=W)

		self.listBoxPanel = Frame (self.listPanel)
		self.listBoxPanel.grid(row=1, column=0, columnspan=2, sticky=W)

		self.listScrollbar = Scrollbar (self.listBoxPanel)
		self.listScrollbar.pack(side=RIGHT, fill=Y)

		self.list = Listbox (self.listBoxPanel, height=13, width=25, yscrollcommand=self.listScrollbar.set, font=(parentApp.widgetFontName, parentApp.widgetFontSize))
		self.list.pack(side=LEFT, fill=BOTH, expand=1)

		self.listScrollbar.config(command=self.list.yview)

		self.importAListButton = Button (self.listPanel, text="Import (CSV) ...",command=self.commandImport)
		self.importAListButton.grid(row=2, column=0, sticky=S) 

		self.exportAListButton = Button (self.listPanel, text="Export (CSV) ...",command=self.commandExport)
		self.exportAListButton.grid(row=2, column=1, sticky=S) 

		self.previewPanel = Frame (self.attendeePanel, border=5)
		self.previewPanel.grid(row=5, column=0, columnspan=4)

		self.previewLabel = Label (self.previewPanel, text="Preview:", font=("Helvetica", 13, "normal"))
		self.previewLabel.grid(row=0, column=0)

		self.previewTextPanel = Frame (self.previewPanel)
		self.previewTextPanel.grid(row=0, column=1)

		self.previewScrollbar = Scrollbar (self.previewTextPanel)
		self.previewScrollbar.pack(side=RIGHT, fill=Y)
		
		self.previewText = Text (self.previewTextPanel, height=5, width=60, bd=1, background="light grey", yscrollcommand=self.previewScrollbar.set)
		self.previewText.pack(side=LEFT, fill=BOTH, expand=1)

		self.previewScrollbar.config(command=self.previewText.yview)

	def changeFontSize(self):
		self.nickEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.nameEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.emailEntry.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.list.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))
		self.previewText.config (font=(self.parentApp.widgetFontName, self.parentApp.widgetFontSize))

	def commandAddName(self):
		str0 = self.nickStr.get()
		str = self.nameStr.get()
		str1 = self.emailStr.get()
		if str0 != "":
			at = AttendeeObj()
			at.attendeeNick = str0
			dispStr = str0 
			if str != "":
				at.attendeeName = str
				dispStr = dispStr + ":" + str
			if str1 != "":
				at.attendeeEmail = str1
				dispStr = dispStr + " <" + str1 + ">"
			idStr = self.parentApp.addAttendee(at)
			dispStr = idStr + ". "+ dispStr
			self.list.insert(END, dispStr)
			at.attendeeType = self.attendeeType.get ()
			if at.attendeeType == 1:
				self.parentApp.organizerNick.set (str0) 
				self.parentApp.organizerName.set (str) 
				self.parentApp.organizerEmail.set (str1)
			
			self.nickStr.set("")
			self.nameStr.set("")
			self.emailStr.set("")
			self.attendeeType.set (2)
			
	def commandPreviewSelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			self.previewText.delete (1.0,END)
			self.previewText.insert(END, self.parentApp.attendees[strlist[0]].previewText())

	def commandEditSelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			ao = self.parentApp.attendees[strlist[0]]
			self.nickStr.set(ao.attendeeNick)
			self.nameStr.set(ao.attendeeName)
			self.emailStr.set(ao.attendeeEmail)
			self.attendeeType.set(ao.attendeeType)
			self.parentApp.delAttendee(strlist[0])
			self.list.delete(ANCHOR)

	def commandCopySelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			ao = self.parentApp.attendees[strlist[0]]
			self.nickStr.set(ao.attendeeNick)
			self.nameStr.set(ao.attendeeName)
			self.emailStr.set(ao.attendeeEmail)
			self.attendeeType.set(ao.attendeeType)

	def commandDelSelected(self):
		items = self.list.curselection()
		if len (items) > 0:
			tmpstr = self.list.get(items[0])
			strlist = string.split(tmpstr, ".")
			self.parentApp.delAttendee(strlist[0])
			self.list.delete(ANCHOR)

	def commandToday(self):
		today = date.today()
		self.parentApp.meetingDate.set (today.isoformat())
		
	def commandFromTime(self):
		self.parentApp.meetingFromTime.set (strftime("%H:%M"))
		
	def commandToTime(self):
		self.parentApp.meetingToTime.set (strftime("%H:%M"))

	def commandImport(self):
		fileName = tkFileDialog.askopenfilename	(parent=self.parentApp.master, title='Import From', filetypes=[('Comma Separated Values','*.csv'),('All Files','*.*')])
		if fileName != None and fileName != '':
			#print fileName
			fdInFile = open(fileName, "r")
			tmpstr = fdInFile.readline()
			count = 0
			while tmpstr:
				if not "#" in tmpstr:
					strlist = string.split (tmpstr, '\n')
					strlist0 = string.split (strlist[0], ',')
				
					str0 = strlist0[0]
					str1 = strlist0[1]
					str2 = strlist0[2]
					str3 = strlist0[3]
					if str0 != "":
						at = AttendeeObj()
						at.attendeeNick = str0
						count = count +1
						dispStr = str0 
						if str1 != "":
							at.attendeeName = str1
							dispStr = dispStr + ":" + str1
						if str2 != "":
							at.attendeeEmail = str2
							dispStr = dispStr + " <" + str2 + ">"
						idStr = self.parentApp.addAttendee(at)
						dispStr = idStr + ". " + dispStr
						self.list.insert(END, dispStr)
						if str3 != "":
							at.attendeeType = int(str3)
						else:
							at.attendeeType = 2
						if at.attendeeType == 1:
							self.parentApp.organizerNick.set (str0) 
							self.parentApp.organizerName.set (str1) 
							self.parentApp.organizerEmail.set (str2)
			
				tmpstr = fdInFile.readline()
			fdInFile.close()
			
	def commandExport(self):
		fileName = tkFileDialog.asksaveasfilename (parent=self.parentApp.master, title='Export To', filetypes=[('Comma Separated Values','*.csv'),('All Files','*.*')])
		if fileName != None and fileName != '':
			#print fileName
			fdOutFile = open(fileName, "w")
			fdOutFile.write("#Generated by " + self.parentApp.yama_copyright + ", " + `self.parentApp.attendeeCount` + " attendees\n")
			fdOutFile.write("#Sequence of fields: NickName, Full Name, Email, Attendee Type" + "\n")
			fdOutFile.write("#Attendee Type is numeric: 1=Organizer, 2=Required, 3=Optional, 4=NonParticipant" + "\n")
			for id in self.parentApp.attendees:
				rec = self.parentApp.attendees[id]
				fdOutFile.write(rec.attendeeNick + "," + rec.attendeeName + "," + rec.attendeeEmail + "," + `rec.attendeeType` + "\n")
			fdOutFile.close()

		
class App:
	def __init__(self, master):
		self.yama_version = "1.5.3"
		self.yama_copyright = "YaMA v1.5.3 (C) 2005-2009, Atul Nene (www.atulnene.com)"
		self.master = master

		self.lastIDUsed = 0 

		self.attendeeCount = 0
		self.lastAttendeeIDUsed = 0
		self.attendees = {}

		self.agendaCount = 0
		self.lastAgendaIDUsed = 0
		self.agenda = {}

		self.issueCount = 0
		self.lastIssueIDUsed = 0
		self.issues = {}

		self.decisionCount = 0
		self.lastDecisionIDUsed = 0
		self.decisions = {}

		self.actionItemCount = 0
		self.lastActionItemIDUsed = 0
		self.actionItems = {}

		self.fileName = ""

		self.meetingType = IntVar()
		self.specifiedMeetingType = StringVar() 
		self.meetingTypeText = ["As Specified:","Meeting","Visit","Video Conference", "Proceedings", "Session", "Tele Conference"]

		self.documentType = IntVar()
		self.specifiedDocumentType = StringVar() 
		self.documentTypeText = ["As Specified:","Minutes","Report","Record", "Summary"]

		self.meetingSubject = StringVar() 
		self.meetingLocation = StringVar() 
		self.organizerNick = StringVar() 
		self.organizerName = StringVar() 
		self.organizerEmail = StringVar() 
		self.meetingDate = StringVar()
		self.meetingFromTime = StringVar()
		self.meetingToTime = StringVar()
		self.meetingStatus = IntVar()
		self.meetingDialNum = StringVar()
		self.meetingTimeZone = StringVar()
		self.meetingAccessCode = StringVar()
		self.meetingURL = StringVar()

		self.outlookCompatibleWhenExport = IntVar()
		self.dateInReportTitle = IntVar()
		self.timeInReportTitle = IntVar()

		self.statusText = StringVar()
		
		self.pageList = {}
		self.tabList = {}
		self.currPageID = ""

		self.currFileName = ""
		
		self.meetingTimeZone.set (tzname[0])

		self.entryFontDescr = Entry()["font"]
		#print self.entryFontDescr

		entryFont = tkFont.Font (font=self.entryFontDescr)
		#print entryFont.actual()
		
		#list = self.entryFontDescr.rsplit (" ", 1)
		#self.widgetFontName = list[0]
		#try:
		#	self.widgetFontSize = abs(int(list[1]))
		#except ValueError:
			#print 'the font descr doesnt end with the size !'
			#list = self.widgetFontName.rsplit (" ", 1)
			#self.widgetFontName = list[0]
			#self.widgetFontSize = abs(int(list[1]))
		self.widgetFontName = entryFont.actual()['family'] 
		self.widgetFontSize = abs(entryFont.actual()['size'])
		#print self.widgetFontName
		#print self.widgetFontSize
		self.minWidgetFontSize = self.widgetFontSize
		self.maxWidgetFontSize = 24

		self.frame = Frame (master)
		master.title(self.yama_copyright)
		self.frame.grid()
		self.frame.rowconfigure(1, weight = 1)
		self.frame.columnconfigure(1, weight = 1)

		self.toolBar = Frame (self.frame)
		self.toolBar.grid(column=0,sticky=NS)

		self.subToolBar1 = Frame (self.toolBar)
		#self.subToolBar1.grid(row=0,column=0,sticky=N)
		self.subToolBar1.pack(fill=Y, anchor=N)

		self.aboutButton = Button (self.subToolBar1, relief=FLAT, text="About YaMA", command=self.commandAbout)
		self.aboutButton.grid(row=0, column=0, sticky=NSEW)

		self.aboutMeetingButton = Button (self.subToolBar1, relief=SUNKEN, text="About the Meeting", command=self.commandAboutMeeting)
		self.aboutMeetingButton.grid(row=1, column=0, sticky=NSEW)

		self.attendeesButton = Button (self.subToolBar1, relief=SUNKEN, text="Attendees", command=self.commandAttendees)
		self.attendeesButton.grid(row=2, column=0, sticky=NSEW)

		self.agendaButton = Button (self.subToolBar1, relief=SUNKEN, text="Agenda", command=self.commandAgenda)
		self.agendaButton.grid(row=3, column=0, sticky=NSEW)

		self.issuesButton = Button (self.subToolBar1, relief=SUNKEN, text="Issues", command=self.commandIssues)
		self.issuesButton.grid(row=4, column=0, sticky=NSEW)

		self.decisionsButton = Button (self.subToolBar1, relief=SUNKEN, text="Decisions",command=self.commandDecisions)
		self.decisionsButton.grid(row=5, column=0, sticky=NSEW)

		self.actionItemsButton = Button (self.subToolBar1, relief=SUNKEN, text="Action Items",command=self.commandActionItems)
		self.actionItemsButton.grid(row=6, column=0, sticky=NSEW)

		self.publishButton = Button (self.subToolBar1, relief=SUNKEN, text="Publish", command=self.commandPublish)
		self.publishButton.grid(row=7, column=0, sticky=NSEW)

		self.exportActionsButton = Button (self.subToolBar1, relief=SUNKEN, text="Export", command=self.commandExportActions)
		self.exportActionsButton.grid(row=8, column=0, sticky=NSEW)

		self.parseActionsButton = Button (self.subToolBar1, relief=SUNKEN, text="Parse", command=self.commandParseActions)
		self.parseActionsButton.grid(row=9, column=0, sticky=NSEW)

		self.subToolBar2 = Frame (self.toolBar)
		self.subToolBar2.pack(fill=Y, anchor=S, expand=1)

		self.cancel = Button (self.subToolBar2, relief=RAISED, text="Font++", command=self.commandIncFont)
		self.cancel.grid(row=1, column=0, sticky=NSEW)

		self.help = Button (self.subToolBar2, relief=RAISED, text="Font--", command=self.commandDecFont)
		self.help.grid(row=2, column=0, sticky=NSEW)

		#self.help = Button (self.subToolBar2, relief=RAISED, text="Load...", command=self.commandLoad)
		#self.help.grid(row=3, column=0, sticky=NSEW)

		#self.help = Button (self.subToolBar2, relief=RAISED, text="Save...", command=self.commandSave)
		#self.help.grid(row=4, column=0, sticky=NSEW)

		self.help = Button (self.subToolBar2, relief=RAISED, text="Help", command=self.commandHelp)
		self.help.grid(row=5, column=0, sticky=NSEW)

		self.cancel = Button (self.subToolBar2, relief=RAISED, text="Quit", command=self.commandQuit)
		self.cancel.grid(row=6, column=0, sticky=NSEW)

		self.pageFrame = Frame (self.frame) 
		self.pageFrame.grid(row=0, column=1, sticky=NSEW)

		wp = AboutPage(self, "About")
		self.pageList["About"] = wp
		self.tabList["About"] = self.aboutButton
		self.currPageID = "About"
		self.finalReport = ""
		wp.show()
		wp = AboutMeetingForm (self, "AboutMeeting")
		self.pageList["AboutMeeting"] = wp
		self.tabList["AboutMeeting"] = self.aboutMeetingButton
		wp = AttendeesForm (self, "Attendees")
		self.pageList["Attendees"] = wp
		self.tabList["Attendees"] = self.attendeesButton
		wp = AgendaForm (self, "Agenda")
		self.pageList["Agenda"] = wp
		self.tabList["Agenda"] = self.agendaButton
		wp = IssuesForm(self, "Issues")
		self.pageList["Issues"] = wp
		self.tabList["Issues"] = self.issuesButton
		wp = DecisionsForm (self, "Decisions")
		self.pageList["Decisions"] = wp
		self.tabList["Decisions"] = self.decisionsButton
		wp = ActionItemsForm (self, "ActionItems")
		self.pageList["ActionItems"] = wp
		self.tabList["ActionItems"] = self.actionItemsButton
		wp = PreviewReportForm (self, "Publish")
		self.pageList["Publish"] = wp
		self.tabList["Publish"] = self.publishButton
		wp = ExportActionsForm (self, "ExportActions")
		self.pageList["ExportActions"] = wp
		self.tabList["ExportActions"] = self.exportActionsButton
		wp = ParseActionsForm (self, "ParseActions")
		self.pageList["ParseActions"] = wp
		self.tabList["ParseActions"] = self.parseActionsButton
		
		self.updateStatus()
		self.status = Label(self.frame, textvariable=self.statusText, bd=1, relief=SUNKEN, anchor=W)
		self.status.grid(row=1,column=0,columnspan=2,sticky=NSEW) 

	def updateStatus(self):
		tmpText = self.fileName
		if tmpText == "":
			tmpText = "Statistics"

		self.statusText.set (tmpText + ":" + `self.agendaCount` + " agenda items, " + `self.attendeeCount` + " attendees, " + `self.issueCount` + " issues, " + `self.decisionCount` + " decisions and " + `self.actionItemCount` + " action items.")

	def addAttendee (self, at):
		self.lastAttendeeIDUsed = self.lastAttendeeIDUsed + 1
		self.attendeeCount = self.attendeeCount + 1
		idStr = `self.lastAttendeeIDUsed`
		if self.lastAttendeeIDUsed <= 9:
			idStr = '0' + idStr
		self.attendees[idStr] = at
		self.updateStatus()
		return idStr

	def delAttendee (self, key):
		del self.attendees[key]
		self.attendeeCount = self.attendeeCount - 1
		self.updateStatus()

	def addAgenda(self, ao):
		self.lastAgendaIDUsed = self.lastAgendaIDUsed + 1
		self.agendaCount = self.agendaCount + 1
		idStr = `self.lastAgendaIDUsed`
		if self.lastAgendaIDUsed <= 9:
			idStr = '0' + idStr
		self.agenda[idStr] = ao
		self.updateStatus()
		return idStr

	def delAgenda (self, key):
		del self.agenda[key]
		self.agendaCount = self.agendaCount - 1
		self.updateStatus()

	def addIssue(self, io):
		self.lastIssueIDUsed = self.lastIssueIDUsed + 1
		self.issueCount = self.issueCount + 1
		idStr = `self.lastIssueIDUsed`
		if self.lastIssueIDUsed <= 9:
			idStr = '0' + idStr
		self.issues[idStr] = io
		self.updateStatus()
		return idStr

	def delIssue (self, key):
		del self.issues[key]
		self.issueCount = self.issueCount - 1
		self.updateStatus()

	def addDecision(self, do):
		self.lastDecisionIDUsed = self.lastDecisionIDUsed + 1
		self.decisionCount = self.decisionCount + 1
		idStr = `self.lastDecisionIDUsed`
		if self.lastDecisionIDUsed <= 9:
			idStr = '0' + idStr
		self.decisions[idStr] = do
		self.updateStatus()
		return idStr

	def delDecision (self, key):
		del self.decisions[key]
		self.decisionCount = self.decisionCount - 1
		self.updateStatus()

	def addActionItem(self, aio):
		self.lastActionItemIDUsed = self.lastActionItemIDUsed + 1
		self.actionItemCount = self.actionItemCount + 1
		idStr = `self.lastActionItemIDUsed`
		if self.lastActionItemIDUsed <= 9:
			idStr = '0' + idStr
		self.actionItems[idStr] = aio
		self.updateStatus()
		return idStr

	def delActionItem (self, key):
		del self.actionItems[key]
		self.actionItemCount = self.actionItemCount - 1
		self.updateStatus()

	def commandIncFont(self):
		if self.widgetFontSize < self.maxWidgetFontSize:
			self.widgetFontSize = self.widgetFontSize + 1
			self.pageList["AboutMeeting"].changeFontSize ()
			self.pageList["Attendees"].changeFontSize ()
			self.pageList["Agenda"].changeFontSize ()
			self.pageList["Issues"].changeFontSize ()
			self.pageList["Decisions"].changeFontSize ()
			self.pageList["ActionItems"].changeFontSize ()
			self.pageList["Publish"].changeFontSize ()
			self.pageList["ExportActions"].changeFontSize ()
			self.pageList["ParseActions"].changeFontSize ()

	def commandDecFont(self):
		if self.widgetFontSize > self.minWidgetFontSize:
			self.widgetFontSize = self.widgetFontSize - 1
			self.pageList["AboutMeeting"].changeFontSize ()
			self.pageList["Attendees"].changeFontSize ()
			self.pageList["Agenda"].changeFontSize ()
			self.pageList["Issues"].changeFontSize ()
			self.pageList["Decisions"].changeFontSize ()
			self.pageList["ActionItems"].changeFontSize ()
			self.pageList["Publish"].changeFontSize ()
			self.pageList["ExportActions"].changeFontSize ()
			self.pageList["ParseActions"].changeFontSize ()

	def commandQuit(self):
		self.master.quit()

	def commandLoad(self):
		pass

	def commandSave(self):
		pass

	def switchToTab(self, pageID):
		self.tabList[self.currPageID].configure(relief=SUNKEN)
		self.pageList[self.currPageID].hide()
		self.currPageID = pageID
		self.pageList[self.currPageID].show()
		self.tabList[self.currPageID].configure(relief=FLAT)

	def commandAbout(self):
		if self.currPageID != "About":
			self.switchToTab ("About")

	def commandAboutMeeting(self):
		if self.currPageID != "AboutMeeting":
			self.switchToTab ("AboutMeeting")

	def commandAttendees(self):
		if self.currPageID != "Attendees":
			self.switchToTab ("Attendees")

	def commandAgenda(self):
		if self.currPageID != "Agenda":
			self.switchToTab ("Agenda")

	def commandIssues(self):
		if self.currPageID != "Issues":
			self.switchToTab ("Issues")

	def commandDecisions(self):
		if self.currPageID != "Decisions":
			self.switchToTab ("Decisions")

	def commandActionItems(self):
		if self.currPageID != "ActionItems":
			self.switchToTab ("ActionItems")

	def commandDashboard(self):
		if self.currPageID != "DashBoard":
			self.switchToTab ("DashBoard")

	def commandPublish(self):
		if self.currPageID != "Publish":
			self.switchToTab ("Publish")

	def commandExportActions(self):
		if self.currPageID != "ExportActions":
			self.switchToTab ("ExportActions")

	def commandParseActions(self):
		if self.currPageID != "ParseActions":
			self.switchToTab ("ParseActions")

	def commandHelp(self):
		#os.startfile ("http://www.atulnene.com/")
		pass

	def makeReport(self):	
		self.finalReport = ""
		tmpAgenda = ""
		tmpInvite = ""

		if self.documentType.get() == 0:	
			tmpDocType = self.specifiedDocumentType.get()
			if tmpDocType == "":
				tmpDocType = "[Specified Document Type]"
		else: 
			tmpDocType = self.documentTypeText[self.documentType.get()]

		if self.meetingType.get() == 0:	
			tmpType = self.specifiedMeetingType.get()
			if tmpType == "":
				tmpType = "[Specified Meeting Type]"
		else: 
			tmpType	 = self.meetingTypeText[self.meetingType.get()]

		tmpSubject = self.meetingSubject.get()
		if tmpSubject == "":
			tmpSubject = "[Subject]"
		tmpDate = self.meetingDate.get()
		if tmpDate == "":
			tmpDate = "[yyyy-mm-dd]"
		tmpFromTime = self.meetingFromTime.get()
		if tmpFromTime == "":
				tmpFromTime = "[HH:MM]"
		tmpToTime = self.meetingToTime.get()
		if tmpToTime == "":
				tmpToTime = "[HH:MM]"
		tmpLocation = self.meetingLocation.get()
		if tmpLocation == "":
				tmpLocation = "[Location]"

		if 1 == self.dateInReportTitle.get():
			tmpInvite = tmpDate + " " + "Invitation to " + tmpType + ": "  + tmpSubject
		else:
			tmpInvite = "Invitation to " + tmpType + ": "  + tmpSubject + ", " + tmpDate 
		if 1 == self.timeInReportTitle.get():
			tmpInvite = tmpInvite + ", " + tmpFromTime + "-" + tmpToTime
		tmpInvite = tmpInvite + "\n"
		tmpInvite = tmpInvite + "What : " + tmpSubject + "\n"
		tmpInvite = tmpInvite + "When : " + tmpDate + ", " +tmpFromTime + "-" + tmpToTime + " (" + self.meetingTimeZone.get() + ")" + "\n"
		tmpInvite = tmpInvite + "Where: " + tmpLocation + "\n"

		if self.agendaCount != 0:
			if 1 == self.dateInReportTitle.get():
				tmpAgenda = tmpAgenda + "\n" + tmpDate + " " + "Agenda for " + tmpType + ": " + tmpSubject 
			else:
				tmpAgenda = tmpAgenda + "\n" + "Agenda for " + tmpType + ": " + tmpSubject + ", " + tmpDate 
			if 1 == self.timeInReportTitle.get():
				tmpAgenda = tmpAgenda + ", " + tmpFromTime + "-" + tmpToTime
			tmpAgenda = tmpAgenda + "\n"
			tmpCount = 1
			tmpKeys = self.agenda.keys()
			tmpKeys.sort()
			for id in tmpKeys:
				obj = self.agenda[id]
				tmpText = `tmpCount` + ". " + obj.details + "\n"
				tmpCount = tmpCount + 1
				tmpAgenda = tmpAgenda + tmpText

		nonAttendees = ""
		tmpText = ""
		if self.attendeeCount != 0:
			tmpKeys = self.attendees.keys()
			tmpKeys.sort()
			for id in tmpKeys:
				obj = self.attendees[id]
				if obj.attendeeType == 4:
					if "" != nonAttendees:
						nonAttendees = nonAttendees + ", "
					nonAttendees = nonAttendees + obj.attendeeNick
				elif obj.attendeeType != 1:
					if "" != tmpText:
						tmpText = tmpText + ", "
					tmpText = tmpText + obj.attendeeNick
		if self.organizerNick.get() != "":
			if "" != tmpText:
				tmpText = tmpText + ", "
			tmpText = tmpText + self.organizerNick.get()
			tmpText = tmpText + " (Organizer)"
		if "" != nonAttendees:
			tmpText = tmpText + "\n\nNon Attendees:\n--------------\n" + nonAttendees
		if "" == tmpText:
			tmpText = "[Attendee List]"	
		tmpText = tmpText + "\n"

		tmpInvite = tmpInvite + "Who  : " + tmpText
		
		tmpDial = self.meetingDialNum.get()
		tmpAccess = self.meetingAccessCode.get()
		tmpURL = self.meetingURL.get()

		if tmpDial != "":
			tmpInvite = tmpInvite + "\nDial: " + tmpDial
		if tmpAccess != "":
			tmpInvite = tmpInvite + "\nAccess Code: " + tmpAccess
		if tmpURL != "":
			tmpInvite = tmpInvite + "\nURL: " + tmpURL

		#I know its strange to print this depending on # of Attendees,
		#however I think any valid meeting will have at least one attendee
		#and in case of no Attendees, its safe to not print location here.
		if self.attendeeCount != 0:
			self.finalReport = self.finalReport + "\nLocation:\n"
			self.finalReport = self.finalReport + "---------\n"
			self.finalReport = self.finalReport + tmpLocation + "\n"

		if self.attendeeCount != 0:
			self.finalReport = self.finalReport + "\nAttendees:\n"
			self.finalReport = self.finalReport + "----------\n"
			self.finalReport = self.finalReport + tmpText

		if self.issueCount != 0:
			self.finalReport = self.finalReport + "\nIssues:\n"
			self.finalReport = self.finalReport + "-------\n"
			tmpCount = 1
			tmpKeys = self.issues.keys()
			tmpKeys.sort()
			for id in tmpKeys:
				obj = self.issues[id]
				tmpText = `tmpCount` + ". " + obj.details + "\n"
				tmpCount = tmpCount + 1
				self.finalReport = self.finalReport + tmpText
		if self.decisionCount != 0:
			self.finalReport = self.finalReport + "\nDecisions:\n"
			self.finalReport = self.finalReport + "----------\n"
			tmpCount = 1
			tmpKeys = self.decisions.keys()
			tmpKeys.sort()
			for id in tmpKeys:
				obj = self.decisions[id]
				tmpText = `tmpCount` + ". " + obj.details 
				if obj.contactNick != "":
					tmpText  = tmpText + "Contact: " + obj.contactNick
					#if obj.contactEmail != "":
					#	tmpText  = tmpText + " <" + obj.contactEmail + ">"
					tmpText  = tmpText + "\n\n"	
				tmpCount = tmpCount + 1
				self.finalReport = self.finalReport + tmpText
		if self.actionItemCount != 0:
			self.finalReport = self.finalReport + "\nAction Items:\n"
			self.finalReport = self.finalReport + "-------------\n"
			tmpKeys = self.actionItems.keys()
			tmpKeys.sort()
			for id in tmpKeys:
				obj = self.actionItems[id]
				tmpText = "ID: " + obj.ID + "\n" 
				if obj.contactNick != "":
					tmpText  = tmpText + "Contact: " + obj.contactNick
					#if obj.contactEmail != "":
					#	tmpText  = tmpText + " <" + obj.contactEmail + ">"
					tmpText  = tmpText + "\n"	
				if obj.expEndDate != "":
					tmpText  = tmpText + "Expected Closure Date: " + obj.expEndDate +"\n" 
				if obj.pastRef != "":
					tmpText  = tmpText + "Past Reference: " + obj.pastRef +"\n" 
				tmpText = tmpText + obj.details + "\n"
				self.finalReport = self.finalReport + tmpText

		if self.finalReport == "":
			self.finalReport = "No " + tmpDocType + " of " + tmpType

		if 1 == self.dateInReportTitle.get():
			tmpTitle = tmpDate + " " + tmpDocType + " of " + tmpType + " for " + tmpSubject 
		else:	
			tmpTitle = tmpDocType + " of " + tmpType + " for " + tmpSubject + ", " + tmpDate 
		if 1 == self.timeInReportTitle.get():
			tmpTitle = tmpTitle + ", " + tmpFromTime + "-" + tmpToTime
		tmpTitle = tmpTitle + "\n"

		self.finalReport = tmpTitle + self.finalReport
		if tmpAgenda != "":
			self.finalReport = tmpAgenda + "\n\n" + self.finalReport
		self.finalReport = tmpInvite + "\n" + self.finalReport

root = Tk()

app = App(root)

root.mainloop ()

print"Thanks for using YaMA. Bye"
