From 7932ace133ffc9a19bd1ee7b1de626c4ae4484d7 Mon Sep 17 00:00:00 2001 From: Ross Poulton Date: Mon, 14 Jan 2008 23:39:43 +0000 Subject: [PATCH] * Improve ticket submission form by adding help text and flagging optional fields as such * When submitting an e-mail, if a submitters e-mail is provided send them an e-mail --- forms.py | 38 ++++++++++++++++++--------- htdocs/helpdesk.css | 10 +++++++ templates/helpdesk/create_ticket.html | 11 +++++--- 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/forms.py b/forms.py index a74f267a..e3a7539a 100644 --- a/forms.py +++ b/forms.py @@ -40,18 +40,21 @@ class TicketForm(forms.Form): label=u'Summary of the problem') submitter_email = forms.EmailField(required=False, - label=u'Submitter E-Mail Address') + label=u'Submitter E-Mail Address', + help_text=u'This e-mail address will receive copies of all public updates to this ticket.') body = forms.CharField(widget=forms.Textarea(), label=u'Description of Issue', required=True) assigned_to = forms.ChoiceField(choices=(), required=False, - label=u'Case owner') + label=u'Case owner', + help_text=u'If you select an owner other than yourself, they\'ll be e-mailed details of this ticket immediately.') priority = forms.ChoiceField(choices=Ticket.PRIORITY_CHOICES, required=False, initial='3', - label=u'Priority') + label=u'Priority', + help_text=u'Please select a priority carefully. If unsure, leave it as \'3\'.') def save(self, user): """ @@ -59,14 +62,16 @@ class TicketForm(forms.Form): """ q = Queue.objects.get(id=int(self.cleaned_data['queue'])) - t = Ticket( title=self.cleaned_data['title'], - submitter_email=self.cleaned_data['submitter_email'], - created=datetime.now(), + + t = Ticket( title = self.cleaned_data['title'], + submitter_email = self.cleaned_data['submitter_email'], + created = datetime.now(), status = Ticket.OPEN_STATUS, queue = q, description = self.cleaned_data['body'], priority = self.cleaned_data['priority'], ) + if self.cleaned_data['assigned_to']: try: u = User.objects.get(id=self.cleaned_data['assigned_to']) @@ -75,16 +80,25 @@ class TicketForm(forms.Form): t.assigned_to = None t.save() - f = FollowUp( ticket=t, - title='Ticket Opened', - date=datetime.now(), - public=True, - comment=self.cleaned_data['body'], - user=user, + f = FollowUp( ticket = t, + title = 'Ticket Opened', + date = datetime.now(), + public = True, + comment = self.cleaned_data['body'], + user = user, ) if self.cleaned_data['assigned_to']: f.title = 'Ticket Opened & Assigned to %s' % t.get_assigned_to f.save() + + context = { + 'ticket': t, + 'queue': q, + } + + if t.submitter_email: + from helpdesk.lib import send_multipart_mail + send_multipart_mail('helpdesk/emails/submitter_newticket', context, '%s %s' % (t.ticket, t.title), t.submitter_email,, q.from_address) return t diff --git a/htdocs/helpdesk.css b/htdocs/helpdesk.css index c40c0839..6da57b91 100644 --- a/htdocs/helpdesk.css +++ b/htdocs/helpdesk.css @@ -37,6 +37,16 @@ label { font-weight: bold; } +span.form_optional { + color: #666; + font-size: 95%; +} + +dd.form_help_text { + color: #666; + font-size: 95%; +} + .row_tablehead { background-color: #6593C0; font-weight: bold; diff --git a/templates/helpdesk/create_ticket.html b/templates/helpdesk/create_ticket.html index 277acba1..0484e328 100644 --- a/templates/helpdesk/create_ticket.html +++ b/templates/helpdesk/create_ticket.html @@ -4,6 +4,8 @@ {% block helpdesk_body %}

Submit a Ticket

+

Unless otherwise stated, all fields are required. Please provide as descriptive a title and description as possible.

+
@@ -17,29 +19,32 @@ {% if form.title.errors %}
{{ form.title.errors }}
{% endif %} -
+
(Optional)
{{ form.submitter_email }}
{% if form.submitter_email.errors %}
{{ form.submitter_email.errors }}
{% endif %} +
{{ form.submitter_email.help_text }}
{{ form.body }}
{% if form.body.errors %}
{{ form.body.errors }}
{% endif %} -
+
(Optional)
{{ form.assigned_to }}
{% if form.assigned_to.errors %}
{{ form.assigned_to.errors }}
{% endif %} +
{{ form.assigned_to.help_text }}
{{ form.priority }}
{% if form.priority.errors %}
{{ form.priority.errors }}
{% endif %} +
{{ form.priority.help_text }}
- +