From e73f45e4f69e5a3695068adf7727624ee09a10cf Mon Sep 17 00:00:00 2001 From: Joshua Jonah Date: Thu, 9 Jun 2011 11:24:33 -0400 Subject: [PATCH 1/3] Added ability to turn of KB (my business doesn't need it) --- helpdesk/settings.py | 3 ++ helpdesk/templates/helpdesk/navigation.html | 56 ++++++++++----------- helpdesk/urls.py | 35 +++++++------ helpdesk/views/public.py | 7 ++- 4 files changed, 55 insertions(+), 46 deletions(-) diff --git a/helpdesk/settings.py b/helpdesk/settings.py index 661dc042..92e255ef 100644 --- a/helpdesk/settings.py +++ b/helpdesk/settings.py @@ -27,3 +27,6 @@ if type(DEFAULT_USER_SETTINGS) != type(dict()): 'email_on_ticket_apichange': True, 'tickets_per_page': 25 } + +# show knowledgebase links? +HELPDESK_KB_ENABLED = getattr(settings, 'HELPDESK_KB_ENABLED', True) diff --git a/helpdesk/templates/helpdesk/navigation.html b/helpdesk/templates/helpdesk/navigation.html index e76ab56d..15e38852 100644 --- a/helpdesk/templates/helpdesk/navigation.html +++ b/helpdesk/templates/helpdesk/navigation.html @@ -1,29 +1,29 @@ {% load i18n %} - {% if user.is_staff %} - - {% else %} - - {% endif %} +{% if user.is_staff %} + +{% else %} + +{% endif %} diff --git a/helpdesk/urls.py b/helpdesk/urls.py index 35433291..9bd8b1e4 100644 --- a/helpdesk/urls.py +++ b/helpdesk/urls.py @@ -12,8 +12,10 @@ from django.conf.urls.defaults import * from django.contrib.auth.decorators import login_required from django.contrib.syndication.views import feed as django_feed +from helpdesk import settings as helpdesk_settings from helpdesk.views.feeds import feed_setup + urlpatterns = patterns('helpdesk.views.staff', url(r'^dashboard/$', 'dashboard', @@ -34,7 +36,7 @@ urlpatterns = patterns('helpdesk.views.staff', url(r'^tickets/(?P[0-9]+)/$', 'view_ticket', name='helpdesk_view'), - + url(r'^tickets/(?P[0-9]+)/followup_edit/(?P[0-9]+)/$', 'followup_edit', name='helpdesk_followup_edit'), @@ -70,7 +72,7 @@ urlpatterns = patterns('helpdesk.views.staff', url(r'^tickets/(?P[0-9]+)/cc/delete/(?P[0-9]+)/$', 'ticket_cc_del', name='helpdesk_ticket_cc_del'), - + url(r'^tickets/(?P[0-9]+)/dependency/add/$', 'ticket_dependency_add', name='helpdesk_ticket_dependency_add'), @@ -78,7 +80,7 @@ urlpatterns = patterns('helpdesk.views.staff', url(r'^tickets/(?P[0-9]+)/dependency/delete/(?P[0-9]+)/$', 'ticket_dependency_del', name='helpdesk_ticket_dependency_del'), - + url(r'^raw/(?P\w+)/$', 'raw_details', name='helpdesk_raw'), @@ -98,7 +100,7 @@ urlpatterns = patterns('helpdesk.views.staff', url(r'^save_query/$', 'save_query', name='helpdesk_savequery'), - + url(r'^delete_query/(?P[0-9]+)/$', 'delete_saved_query', name='helpdesk_delete_query'), @@ -151,31 +153,32 @@ urlpatterns += patterns('', name='logout'), ) -urlpatterns += patterns('helpdesk.views.kb', - url(r'^kb/$', - 'index', name='helpdesk_kb_index'), +if helpdesk_settings.HELPDESK_KB_ENABLED: + urlpatterns += patterns('helpdesk.views.kb', + url(r'^kb/$', + 'index', name='helpdesk_kb_index'), - url(r'^kb/(?P[A-Za-z_-]+)/$', - 'category', name='helpdesk_kb_category'), + url(r'^kb/(?P[A-Za-z_-]+)/$', + 'category', name='helpdesk_kb_category'), - url(r'^kb/(?P[0-9]+)/$', - 'item', name='helpdesk_kb_item'), + url(r'^kb/(?P[0-9]+)/$', + 'item', name='helpdesk_kb_item'), - url(r'^kb/(?P[0-9]+)/vote/$', - 'vote', name='helpdesk_kb_vote'), -) + url(r'^kb/(?P[0-9]+)/vote/$', + 'vote', name='helpdesk_kb_vote'), + ) urlpatterns += patterns('', url(r'^api/$', 'django.views.generic.simple.direct_to_template', {'template': 'helpdesk/help_api.html',}, name='helpdesk_api_help'), - + url(r'^help/context/$', 'django.views.generic.simple.direct_to_template', {'template': 'helpdesk/help_context.html',}, name='helpdesk_help_context'), - + url(r'^system_settings/$', 'django.views.generic.simple.direct_to_template', { diff --git a/helpdesk/views/public.py b/helpdesk/views/public.py index 9bdf9515..6b9fd6f2 100644 --- a/helpdesk/views/public.py +++ b/helpdesk/views/public.py @@ -15,6 +15,7 @@ from django.shortcuts import render_to_response, get_object_or_404 from django.template import loader, Context, RequestContext from django.utils.translation import ugettext as _ +from helpdesk import settings as helpdesk_settings from helpdesk.forms import PublicTicketForm from helpdesk.lib import send_templated_mail, text_is_spam from helpdesk.models import Ticket, Queue, UserSettings @@ -62,6 +63,7 @@ def homepage(request): return render_to_response('helpdesk/public_homepage.html', RequestContext(request, { 'form': form, + 'helpdesk_settings': helpdesk_settings, })) @@ -89,7 +91,7 @@ def view_ticket(request): if request.GET.has_key('close'): redirect_url += '?close' return HttpResponseRedirect(redirect_url) - + if request.GET.has_key('close') and ticket.status == Ticket.RESOLVED_STATUS: from helpdesk.views.staff import update_ticket # Trick the update_ticket() view into thinking it's being called with @@ -105,7 +107,7 @@ def view_ticket(request): request.GET = {} return update_ticket(request, ticket_id, public=True) - + return render_to_response('helpdesk/public_view_ticket.html', RequestContext(request, { 'ticket': ticket, @@ -116,5 +118,6 @@ def view_ticket(request): 'ticket': ticket, 'email': email, 'error_message': error_message, + 'helpdesk_settings': helpdesk_settings, })) From 7daf3a7552181cf90ffc00fd417c9e4bd363cf5c Mon Sep 17 00:00:00 2001 From: Joshua Jonah Date: Thu, 9 Jun 2011 11:41:32 -0400 Subject: [PATCH 2/3] Consolidated attribution in footer to a single file for easier override without having to subclass more than one template. --- helpdesk/templates/helpdesk/attribution.html | 1 + helpdesk/templates/helpdesk/base.html | 24 ++++++++++---------- helpdesk/templates/helpdesk/public_base.html | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 helpdesk/templates/helpdesk/attribution.html diff --git a/helpdesk/templates/helpdesk/attribution.html b/helpdesk/templates/helpdesk/attribution.html new file mode 100644 index 00000000..fbd66d0a --- /dev/null +++ b/helpdesk/templates/helpdesk/attribution.html @@ -0,0 +1 @@ +{% trans "Powered by django-helpdesk." %} \ No newline at end of file diff --git a/helpdesk/templates/helpdesk/base.html b/helpdesk/templates/helpdesk/base.html index a92f585b..aad66a93 100644 --- a/helpdesk/templates/helpdesk/base.html +++ b/helpdesk/templates/helpdesk/base.html @@ -12,7 +12,7 @@ - + - - - + + {% block helpdesk_head %}{% endblock %} @@ -45,13 +45,13 @@

{% trans "Helpdesk" %}

{% include "helpdesk/navigation.html" %} - +
{% block helpdesk_body %}{% endblock %}
- + {% include "helpdesk/debug.html" %} diff --git a/helpdesk/templates/helpdesk/public_base.html b/helpdesk/templates/helpdesk/public_base.html index 49d2a556..f9340d31 100644 --- a/helpdesk/templates/helpdesk/public_base.html +++ b/helpdesk/templates/helpdesk/public_base.html @@ -15,7 +15,7 @@ {% block helpdesk_body %}{% endblock %} {% include "helpdesk/debug.html" %} From b546b0b879825cfcede75d7ed06da52d1ad876ed Mon Sep 17 00:00:00 2001 From: Joshua Jonah Date: Fri, 10 Jun 2011 08:22:40 -0400 Subject: [PATCH 3/3] Added attribution to public_base.html. Added missing i18n tag to attribution.html. --- helpdesk/templates/helpdesk/attribution.html | 1 + helpdesk/templates/helpdesk/public_base.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/helpdesk/templates/helpdesk/attribution.html b/helpdesk/templates/helpdesk/attribution.html index fbd66d0a..90be0ced 100644 --- a/helpdesk/templates/helpdesk/attribution.html +++ b/helpdesk/templates/helpdesk/attribution.html @@ -1 +1,2 @@ +{% load i18n %} {% trans "Powered by django-helpdesk." %} \ No newline at end of file diff --git a/helpdesk/templates/helpdesk/public_base.html b/helpdesk/templates/helpdesk/public_base.html index f9340d31..9638d8bc 100644 --- a/helpdesk/templates/helpdesk/public_base.html +++ b/helpdesk/templates/helpdesk/public_base.html @@ -19,4 +19,4 @@ {% include "helpdesk/debug.html" %} - + \ No newline at end of file