1.1 --- a/actions/EventAggregatorNewEvent.py Sat Mar 13 16:00:03 2010 +0100
1.2 +++ b/actions/EventAggregatorNewEvent.py Sun Mar 14 02:32:51 2010 +0100
1.3 @@ -65,6 +65,18 @@
1.4 elif selected:
1.5 category_list.append('<input value="%s" name="category" type="hidden" />' % category_pagename)
1.6
1.7 + # Prepare the topics list.
1.8 +
1.9 + topics = form.get("topics", [])
1.10 +
1.11 + if form.get("add-topic"):
1.12 + topics.append("")
1.13 + else:
1.14 + for i in range(0, len(topics)):
1.15 + if form.get("remove-topic-%d" % i):
1.16 + del topics[i]
1.17 + break
1.18 +
1.19 # Initialise month lists.
1.20
1.21 start_month_list = []
1.22 @@ -104,6 +116,13 @@
1.23 "title_default" : form.get("title", [""])[0],
1.24 "description_label" : _("Event description"),
1.25 "description_default" : form.get("description", [""])[0],
1.26 + "location_label" : _("Event location"),
1.27 + "location_default" : form.get("location", [""])[0],
1.28 + "link_label" : _("Event URL"),
1.29 + "link_default" : form.get("link", [""])[0],
1.30 + "topics_label" : _("Topics"),
1.31 + "add_topic_label" : _("Add topic"),
1.32 + "remove_topic_label" : _("Remove topic"),
1.33 "template_label" : _("Event template"),
1.34 "template_default" : form.get("template", [""])[0] or template_default,
1.35 "parent_label" : _("Parent page"),
1.36 @@ -147,8 +166,45 @@
1.37 <td>
1.38 <input name="description" type="text" size="40" value="%(description_default)s" />
1.39 </td>
1.40 + </tr>
1.41 + <tr>
1.42 + <td class="label"><label>%(location_label)s</label></td>
1.43 + <td>
1.44 + <input name="location" type="text" size="40" value="%(location_default)s" />
1.45 + </td>
1.46 + </tr>
1.47 + <tr>
1.48 + <tr>
1.49 + <td class="label"><label>%(link_label)s</label></td>
1.50 + <td>
1.51 + <input name="link" type="text" size="40" value="%(link_default)s" />
1.52 + </td>
1.53 </tr>''' % d
1.54
1.55 + # Topics.
1.56 +
1.57 + for i, topic in enumerate(topics):
1.58 + d["topic"] = topic
1.59 + d["topic_number"] = i
1.60 + html += '''
1.61 + <tr>
1.62 + <td class="label"><label>%(topics_label)s</label></td>
1.63 + <td>
1.64 + <input name="topics" type="text" size="20" value="%(topic)s" />
1.65 + <input name="remove-topic-%(topic_number)s" type="submit" value="%(remove_topic_label)s" />
1.66 + </td>
1.67 + </tr>''' % d
1.68 +
1.69 + html += '''
1.70 + <tr>
1.71 + <td></td>
1.72 + <td>
1.73 + <input name="add-topic" type="submit" value="%(add_topic_label)s" />
1.74 + </td>
1.75 + </tr>''' % d
1.76 +
1.77 + # Advanced options.
1.78 +
1.79 if show_advanced:
1.80 html += '''
1.81 <tr>
1.82 @@ -245,6 +301,11 @@
1.83
1.84 category_pagenames = form.get("category", [])
1.85 description = form.get("description", [None])[0]
1.86 + location = form.get("location", [None])[0]
1.87 + link = form.get("link", [None])[0]
1.88 + topics = form.get("topics", [])
1.89 +
1.90 + # Validate certain fields.
1.91
1.92 try:
1.93 title = form["title"][0]
1.94 @@ -278,7 +339,8 @@
1.95 event_details = {
1.96 "start" : start_date, "end" : end_date,
1.97 "title" : title, "summary" : title,
1.98 - "description" : description
1.99 + "description" : description, "location" : location, "link" : link,
1.100 + "topics" : [topic for topic in topics if topic]
1.101 }
1.102
1.103 # Copy the template.