def ContactPage(self, message=None): """Print contact's edit page.""" user = CGImodule.CGIgetUser() title = "%s Contact" % calendarAbbr content = HTML.Container() if message: content.Add(HTML.Para(message, class_="alert")) content.Add(HTML.Header("Contact Details")) form = HTML.Form("ModifyContact.py") table = HTML.Table([150, 400], cellspacing="0", align="center") row = HTML.Row() row.Add(HTML.HeaderCell("Contact's Name")) row.Add( HTML.HeaderCell( "%s %s" % (HTML.Input( "firstname", self.firstname, size=18, maxlength=255), HTML.Input("lastname", self.lastname, size=29, maxlength=255)), class_="sunday")) table.Add(row) row = HTML.Row() row.Add(HTML.HeaderCell("Email")) row.Add( HTML.HeaderCell(HTML.Input("email", self.email, size=50, maxlength=255), class_="sunday")) table.Add(row) row = HTML.Row() row.Add(HTML.HeaderCell("Phone")) row.Add( HTML.HeaderCell(HTML.Input("phone", self.phone, size=50, maxlength=255), class_="sunday")) table.Add(row) form.Add(table) form.Add( HTML.Para("%s%s%s%s%s" % (HTML.Submit(value="Update Contact Details"), HTML.TAB, HTML.Submit("delete", "Delete Contact"), HTML.TAB, HTML.Submit("cancel", "Cancel")), class_="center")) form.Add(HTML.HiddenInput("username", self.user)) content.Add(form) content.Add(PrintModule.CalendarOptions()) content.Add(PrintModule.BottomMonthsTable()) return HTML.Page(title, content)
def EditPage(options, selection): """Print a web page to edit the values of an option.""" if options == "categories": option = "category" else: option = options[:-1] title = "Edit %s" % option.capitalize() content = HTML.Container() content.Add(HTML.Header("Edit %s" % option.capitalize())) selections = DatabaseModule.Read(options, "options") form = HTML.Form("ModifyOption.py") table = HTML.Table([200, 350], cellspacing="0", align="center") row = HTML.Row() row.Add(HTML.HeaderCell(option.capitalize())) row.Add(HTML.HeaderCell(selection, class_="sunday")) table.Add(row) row = HTML.Row() row.Add(HTML.HeaderCell("Description")) if selections[selection]: row.Add( HTML.Cell( HTML.TextArea("description", ConvertBreaks(selections[selection]), rows=5, cols=40))) else: row.Add(HTML.Cell(HTML.TextArea("description", rows=5, cols=40))) table.Add(row) form.Add(table) form.Add( HTML.Para("%s%s%s%s%s" % (HTML.Submit("modify", "Modify %s" % option.capitalize()), HTML.TAB, HTML.Submit("delete", "Delete %s" % option.capitalize()), HTML.TAB, HTML.Submit("cancel", "Cancel")), class_="center")) form.Add(HTML.HiddenInput("options", options)) form.Add(HTML.HiddenInput("selection", selection)) content.Add(form) content.Add(PrintModule.BottomMonthsTable()) return HTML.Page(title, content)
def EditorPage(self, message=None): """Print editor's home page.""" user = CGImodule.CGIgetUser() title = "%s Editor Page" % calendarAbbr content = HTML.Container() content.Add( HTML.Header("Username <em>%s</em> : %s" % (self.user, self.name), level=2, class_="title")) if message: content.Add(HTML.Para(message, class_="alert")) content.Add(HTML.Header("Editor Contact Details")) form = HTML.Form("ModifyEditor.py") table = HTML.Table([150, 400], cellspacing="0", align="center") row = HTML.Row() row.Add(HTML.HeaderCell("Editor's Name")) row.Add( HTML.HeaderCell( "%s %s" % (HTML.Input( "firstname", self.firstname, size=18, maxlength=255), HTML.Input("lastname", self.lastname, size=29, maxlength=255)), class_="sunday")) table.Add(row) row = HTML.Row() row.Add(HTML.HeaderCell("Email")) row.Add( HTML.HeaderCell(HTML.Input("email", self.email, size=50, maxlength=255), class_="sunday")) table.Add(row) row = HTML.Row() row.Add(HTML.HeaderCell("Phone")) row.Add( HTML.HeaderCell(HTML.Input("phone", self.phone, size=50, maxlength=255), class_="sunday")) table.Add(row) if user == "admin" or user in GetModule.GetSupervisors(): authorized = True else: authorized = False if authorized: row = HTML.Row() row.Add(HTML.HeaderCell("Authority")) if self.authority == "": self.authority = "Editor" options = ["Editor", "Supervisor"] row.Add( HTML.HeaderCell(HTML.RadioButtons("authority", options, self.authority), class_="sunday")) table.Add(row) form.Add(table) form.Add( HTML.Para(HTML.Submit(value="Update Editor Details"), class_="center")) form.Add(HTML.HiddenInput("username", self.user)) content.Add(form) if authorized and user <> self.user: content.Add(HTML.Header("Delete Editor", level=2)) content.Add( HTML.Para(""" Only supervisors can delete an editor record. This operation is immediate and irreversible. You can add an equivalent record but the password will be different.""")) form = HTML.Form("ModifyEditor.py") form.Add( HTML.Para(HTML.Submit("delete", "Delete Editor"), class_="center")) form.Add(HTML.HiddenInput("username", self.user)) content.Add(form) content.Add(HTML.Header("Notify Editor", level=2)) content.Add( HTML.Para(""" Send an email informing the editor of the currently assigned username and password.""")) form = HTML.Form("SendReminder.py") form.Add( HTML.Para(HTML.Submit(value="Send Login Info to Editor"), class_="center")) form.Add(HTML.HiddenInput("user", self.user)) content.Add(form) content.Add(HTML.Header("Change Password", level=2)) form = HTML.Form("ChangePassword.py") form.Add( HTML.Para( "Password : %s%s Verify Password : %s" % (HTML.Password("newpassword", size=20, maxlength=25), HTML.TAB, HTML.Password("verification", size=20, maxlength=25)), class_="center")) form.Add( HTML.Para(HTML.Submit(value="Change Password..."), class_="center")) form.Add(HTML.HiddenInput("username", self.user)) content.Add(form) if user == self.user: content.Add(PrintModule.AdminOptions()) else: content.Add(HTML.Header("Calendar Editors", level=2)) form = HTML.Form("ViewEditors.py") form.Add( HTML.Para( HTML.Submit(value="Return to List of Calendar Editors..."), class_="center")) content.Add(form) content.Add(PrintModule.CalendarOptions()) content.Add(PrintModule.BottomMonthsTable()) return HTML.Page(title, content)