def comment (self, article_slug=None): # Verify user is logged in. if (not pageutils.is_logged_in_p()): raise cherrypy.HTTPRedirect ("/login") if (article_slug == None): return pageutils.generate_page ("No Article Specified", "Unable to add comment.") # Form to add a comment. pagecontents = "" pagecontents += "<form action=\"/articles/addcomment\" method=\"post\">" pagecontents += "<textarea cols=80 rows=10 name=\"body\"></textarea>\n" pagecontents += "<br><br>" pagecontents += "<input type=\"hidden\" name=\"slug\" value=\"" + str(article_slug) + "\">" pagecontents += "<input type=\"submit\" value=\"Add Comment\">" pagecontents += "</form>" pagecontents += pageutils.generate_disclaimer() return pageutils.generate_page ("Add a comment", pagecontents)
def new (self): # Verify user is logged in. if (not pageutils.is_logged_in_p()): raise cherrypy.HTTPRedirect ("/login/access") pagetext = "" pagetitle = "Start a New Discussion" pagetext += "<form action=\"/discussions/process\" method=\"post\">" pagetext += "<b>Subject</b>:" pagetext += "<br>" pagetext += "<input type=\"text\" name=\"subject\">\n" pagetext += "<br><br>" pagetext += "<b>Message</b>:\n<br>\n" pagetext += "<textarea cols=80 rows=10 name=\"body\"></textarea>\n" pagetext += "<br><br>" pagetext += "<input type=\"submit\" value=\"Start New Discussion\">" pagetext += "</form>" pagetext += pageutils.generate_disclaimer() return pageutils.generate_page (pagetitle, pagetext)
def reply (self, discussion_id=None): # Verify user is logged in. if (not pageutils.is_logged_in_p()): raise cherrypy.HTTPRedirect ("/login") # Verify a discussion_id was supplied, so we know where this comment goes. if (discussion_id == None): return pageutils.generate_page ("Discussion Reference Missing", "<div class=\"error\"><p>Unable to add comment.</p></div>") pagetext = "" pagetitle = "Add a Reply" pagetext += "<form action=\"/discussions/process\" method=\"post\">" pagetext += "<textarea cols=80 rows=10 name=\"body\"></textarea>\n" pagetext += "<br><br>" pagetext += "<input type=\"hidden\" name=\"refers_to\" value=\"" + (str(discussion_id)) + "\">\n" pagetext += "<input type=\"submit\" value=\"Add Comment\">" pagetext += "</form>" pagetext += pageutils.generate_disclaimer() return pageutils.generate_page (pagetitle, pagetext)
def new(self, missing=False, title=None, description=None): # Create new event, available to logged in users. # Verify user is logged in. if not pageutils.is_logged_in_p(): raise cherrypy.HTTPRedirect("/login") # Form to create new event. pagecontents = "" if missing: pagecontents += '<div class="error"><h2>Error</h2>Be sure to fill in both the ' pagecontents += "title and description fields.</div>\n" pagecontents += '<form action="/events/process" method="post">' pagecontents += "<b>Title</b>:" pagecontents += "<br>" pagecontents += '<input type="text" ' if title <> None: pagecontents += 'value="' + title + '" ' pagecontents += 'name="title">' pagecontents += "<br><br>\n" pagecontents += "<b>Description</b>:" pagecontents += "<br>" pagecontents += '<textarea cols=80 rows=10 name="description">' if description <> None: pagecontents += description pagecontents += "</textarea>\n" pagecontents += "<br><br>" pagecontents += "<b>Start Date</b>:" pagecontents += "<br>" pagecontents += '<select name="start_month">\n' for month in [ ["01", "January"], ["02", "February"], ["03", "March"], ["04", "April"], ["05", "May"], ["06", "June"], ["07", "July"], ["08", "August"], ["09", "September"], ["10", "October"], ["11", "November"], ["12", "December"], ]: pagecontents += '<option value="' + month[0] + '">' + month[1] + "</option>\n" pagecontents += "</select>\n" pagecontents += '<select name="start_day">\n' for day in [ "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", ]: pagecontents += '<option value="' + day + '">' + day + "</option>\n" pagecontents += "</select>\n" pagecontents += '<select name="start_year">\n' for year in ["2009", "2010", "2011", "2012"]: pagecontents += '<option value="' + year + '">' + year + "</option>\n" pagecontents += "</select>\n" pagecontents += "<br><br>\n" pagecontents += "<b>End Date</b>: (<i>Leave blank for one-day events</i>)" pagecontents += "<br>" pagecontents += '<select name="end_month">\n' for month in [ ["", ""], ["01", "January"], ["02", "February"], ["03", "March"], ["04", "April"], ["05", "May"], ["06", "June"], ["07", "July"], ["08", "August"], ["09", "September"], ["10", "October"], ["11", "November"], ["12", "December"], ]: pagecontents += '<option value="' + month[0] + '">' + month[1] + "</option>\n" pagecontents += "</select>\n" pagecontents += '<select name="end_day">\n' for day in [ "", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", ]: pagecontents += '<option value="' + day + '">' + day + "</option>\n" pagecontents += "</select>\n" pagecontents += '<select name="end_year">\n' for year in ["", "2009", "2010", "2011", "2012"]: pagecontents += '<option value="' + year + '">' + year + "</option>\n" pagecontents += "</select>\n" pagecontents += "<br><br>\n" pagecontents += '<input type="submit" value="Create New Event">' pagecontents += "</form>" pagecontents += pageutils.generate_disclaimer() return pageutils.generate_page("Create New Event", pagecontents)