diff --git a/htdocs/helpdesk.css b/htdocs/helpdesk.css index bb85a24f..0625ff31 100644 --- a/htdocs/helpdesk.css +++ b/htdocs/helpdesk.css @@ -33,6 +33,7 @@ table { margin: 2px; border: solid #444 1px; color: #000; + background-color: #eee; text-decoration: none; font-size: 10pt; line-height: 12pt; diff --git a/models.py b/models.py index 88cc280b..dd40be39 100644 --- a/models.py +++ b/models.py @@ -29,6 +29,8 @@ class Queue(models.Model): title = models.CharField(_('Title'), max_length=100) slug = models.SlugField(_('Slug'), help_text=_('This slug is used when building ticket ID\'s. Once set, try not to change it or e-mailing may get messy.')) email_address = models.EmailField(_('E-Mail Address'), blank=True, null=True, help_text=_('All outgoing e-mails for this queue will use this e-mail address. If you use IMAP or POP3, this should be the e-mail address for that mailbox.')) + allow_public_submission = models.BooleanField(_('Allow Public Submission?'), blank=True, null=True, help_text=_('Should this queue be listed on the public submission form?')) + allow_email_submission = models.BooleanField(_('Allow E-Mail Submission?'), blank=True, null=True, help_text=_('Do you want to poll the e-mail box below for new tickets?')) escalate_days = models.IntegerField(_('Escalation Days'), blank=True, null=True, help_text=_('For tickets which are not held, how often do you wish to increase their priority? Set to 0 for no escalation.')) def _from_address(self): @@ -180,7 +182,7 @@ class Ticket(models.Model): return u'%s' % self.title def get_absolute_url(self): - return ('helpdesk.views.view_ticket', [str(self.id)]) + return ('helpdesk_view', [str(self.id)]) get_absolute_url = models.permalink(get_absolute_url) def save(self): @@ -364,3 +366,65 @@ class EmailTemplate(models.Model): class Meta: ordering = ['template_name',] + +class KBCategory(models.Model): + """ + Lets help users help themselves: the Knowledge Base is a categorised + listing of questions & answers. + """ + + title = models.CharField(_('Title'), max_length=100) + slug = models.SlugField(_('Slug')) + description = models.TextField(_('Description')) + + def __unicode__(self): + return u'%s' % self.title + + class Admin: + pass + + class Meta: + ordering = ['title',] + + def get_absolute_url(self): + return ('helpdesk_kb_category', [str(self.slug)]) + get_absolute_url = models.permalink(get_absolute_url) + +class KBItem(models.Model): + """ + An item within the knowledgebase. Very straightforward question/answer + style system. + """ + category = models.ForeignKey(KBCategory) + title = models.CharField(_('Title'), max_length=100) + question = models.TextField(_('Question')) + answer = models.TextField(_('Answer')) + + votes = models.IntegerField(_('Votes'), help_text=_('Total number of votes cast for this item')) + recommendations = models.IntegerField(_('Positive Votes'), help_text=_('Number of votes for this item which were POSITIVE.')) + + last_updated = models.DateTimeField(_('Last Updated')) + + def save(self): + self.last_updated = datetime.now() + return super(KBItem, self).save() + + def _score(self): + if self.votes > 0: + return int(self.recommendations / self.votes) + else: + return _('Unrated') + score = property(_score) + + def __unicode__(self): + return u'%s' % self.title + + class Admin: + pass + + class Meta: + ordering = ['title',] + + def get_absolute_url(self): + return ('helpdesk_kb_item', [str(self.id)]) + get_absolute_url = models.permalink(get_absolute_url) diff --git a/scripts/get_email.py b/scripts/get_email.py index 05483f4b..22285b25 100644 --- a/scripts/get_email.py +++ b/scripts/get_email.py @@ -18,7 +18,7 @@ from helpdesk.models import Queue, Ticket, FollowUp, Attachment from helpdesk.lib import send_templated_mail def process_email(): - for q in Queue.objects.filter(email_box_type__isnull=False): + for q in Queue.objects.filter(email_box_type__isnull=False, allow_email_submission=True): if not q.email_box_last_check: q.email_box_last_check = datetime.now()-timedelta(minutes=30) if not q.email_box_interval: q.email_box_interval = 0 diff --git a/templates/helpdesk/base.html b/templates/helpdesk/base.html index 634bfed5..ca2f4c31 100644 --- a/templates/helpdesk/base.html +++ b/templates/helpdesk/base.html @@ -14,7 +14,7 @@ diff --git a/templates/helpdesk/public_view_form.html b/templates/helpdesk/public_view_form.html index b53f1c39..f24c5001 100644 --- a/templates/helpdesk/public_view_form.html +++ b/templates/helpdesk/public_view_form.html @@ -16,7 +16,7 @@
- + diff --git a/templates/helpdesk/ticket.html b/templates/helpdesk/ticket.html index 891653f1..ffdc03af 100644 --- a/templates/helpdesk/ticket.html +++ b/templates/helpdesk/ticket.html @@ -93,7 +93,7 @@ {% if followup.comment %}{{ followup.comment|num_to_link|safe }}{% endif %} {% for change in followup.ticketchange_set.all %} {% if forloop.first %}
{% endif %} {% endfor %} {% for attachment in followup.attachment_set.all %}{% if forloop.first %}