Merge pull request #64 from joshuajonah/master

Added flexibility to disable the knowledgebase by using settings.HELPDESK_KB_ENABLED = False.
This commit is contained in:
Ross Poulton 2011-06-15 01:20:26 -07:00
commit 3b43cec5cf
7 changed files with 71 additions and 60 deletions

View File

@ -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)

View File

@ -0,0 +1,2 @@
{% load i18n %}
{% trans "Powered by <a href='https://github.com/rossp/django-helpdesk'>django-helpdesk</a>." %}

View File

@ -12,7 +12,7 @@
<link rel='alternate' href='{% url helpdesk_rss "user" %}{{ user.username }}/' type='application/rss+xml' title='{% trans "My Open Tickets" %}' />
<link rel='alternate' href='{% url helpdesk_rss "recent_activity" %}' type='application/rss+xml' title='{% trans "All Recent Activity" %}' />
<link rel='alternate' href='{% url helpdesk_rss "unassigned" %}' type='application/rss+xml' title='{% trans "Unassigned Tickets" %}' />
<script type="text/javascript">
$(document).ready(function(){
// replace display while hovering over menu item
@ -21,22 +21,22 @@
function() { $('ul', this).css('display', 'none'); });
});
</script>
<style type="text/css">
<style type="text/css">
/* header */
#dropdown li.headerlink { width: auto; float: left; text-align: center; }
/* query list */
#dropdown li.headerlink ul { display: none;
text-align: left;
position: absolute;
#dropdown li.headerlink ul { display: none;
text-align: left;
position: absolute;
padding: 5px;
z-index: 2; }
/* query entries */
#dropdown li.headerlink:hover ul { display: block; width: auto; }
#dropdown li.headerlink:hover ul li { padding: 5px; margin: 1px; float: none; display: block; }
</style>
</style>
{% block helpdesk_head %}{% endblock %}
</head>
<body>
@ -45,13 +45,13 @@
<h1>{% trans "Helpdesk" %}</h1>
{% include "helpdesk/navigation.html" %}
</div>
<div id='body'>
{% block helpdesk_body %}{% endblock %}
</div>
<div id='footer'>
<p>{% trans "Powered by <a href='https://github.com/rossp/django-helpdesk'>django-helpdesk</a>." %} <a href='{% url helpdesk_rss_index %}'><img src='{{ STATIC_URL }}helpdesk/rss_icon.png' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "RSS Feeds" %}' border='0' />{% trans "RSS Feeds" %}</a> <a href='{% url helpdesk_api_help %}'>{% trans "API" %}</a> <a href='{% url helpdesk_user_settings %}'>{% trans "User Settings" %}</a> {% if user.is_superuser %}<a href='{% url helpdesk_system_settings %}'>{% trans "System Settings" %}</a>{% endif %}</p>
<p>{% include "helpdesk/attribution.html" %}<a href='{% url helpdesk_rss_index %}'><img src='{{ STATIC_URL }}helpdesk/rss_icon.png' width='14' height='14' alt='{% trans "RSS Icon" %}' title='{% trans "RSS Feeds" %}' border='0' />{% trans "RSS Feeds" %}</a> <a href='{% url helpdesk_api_help %}'>{% trans "API" %}</a> <a href='{% url helpdesk_user_settings %}'>{% trans "User Settings" %}</a> {% if user.is_superuser %}<a href='{% url helpdesk_system_settings %}'>{% trans "System Settings" %}</a>{% endif %}</p>
</div>
</div>
{% include "helpdesk/debug.html" %}

View File

@ -1,29 +1,29 @@
{% load i18n %}
{% if user.is_staff %}
<ul id="dropdown">
<li><a href='{% url helpdesk_dashboard %}'>{% trans "Dashboard" %}</a></li>
<li><a href='{% url helpdesk_list %}'>{% trans "Tickets" %}</a></li>
<li><a href='{% url helpdesk_submit %}'>{% trans "New Ticket" %}</a></li>
<li><a href='{% url helpdesk_report_index %}'>{% trans "Stats" %}</a></li>
{% if user_saved_queries_ %}
<li class="headerlink"><a>Load Saved Query</a>
<ul>
{% for q in user_saved_queries_ %}
<li><a href="{% url helpdesk_list %}?saved_query={{ q.id }}">{{ q.title }}
{% if q.shared %}
(Shared{% ifnotequal user q.user %} by {{ q.user.username }}{% endifnotequal %})
{% endif %}</a></li>
{% endfor %}
</ul>
</li>
{% endif %}
<li><a href='{% url logout %}'>{% trans "Logout" %}</a></li>
{% if not query %}<li><form id='searchform' method='get' action='{% url helpdesk_list %}'><input type='text' name='q' size='10' class='input' value='{% trans "Search..." %}' id='search_query' onFocus='s=document.getElementById("search_query");if (s.value == "{% trans "Search..." %}") { s.value = ""; }' title='{% trans "Enter a keyword, or a ticket number to jump straight to that ticket." %}'/><input type='hidden' name='status' value='1' /><input type='hidden' name='status' value='2' /><input type='hidden' name='status' value='3' /><input type='hidden' name='search_type' value='header' />{% csrf_token %}</form></li>{% endif %}
</ul>
{% else %}
<ul>
<li><a href='{% url helpdesk_home %}'>{% trans "Submit A Ticket" %}</a></li>
<li><a href='{% url helpdesk_kb_index %}'>{% trans "Knowledgebase" %}</a></li>
<li><a href='{% url login %}?next={% url helpdesk_dashboard %}'>{% trans "Log In" %}</a></li>
</ul>
{% endif %}
{% if user.is_staff %}
<ul id="dropdown">
<li><a href='{% url helpdesk_dashboard %}'>{% trans "Dashboard" %}</a></li>
<li><a href='{% url helpdesk_list %}'>{% trans "Tickets" %}</a></li>
<li><a href='{% url helpdesk_submit %}'>{% trans "New Ticket" %}</a></li>
<li><a href='{% url helpdesk_report_index %}'>{% trans "Stats" %}</a></li>
{% if user_saved_queries_ %}
<li class="headerlink"><a>Load Saved Query</a>
<ul>
{% for q in user_saved_queries_ %}
<li><a href="{% url helpdesk_list %}?saved_query={{ q.id }}">{{ q.title }}
{% if q.shared %}
(Shared{% ifnotequal user q.user %} by {{ q.user.username }}{% endifnotequal %})
{% endif %}</a></li>
{% endfor %}
</ul>
</li>
{% endif %}
<li><a href='{% url logout %}'>{% trans "Logout" %}</a></li>
{% if not query %}<li><form id='searchform' method='get' action='{% url helpdesk_list %}'><input type='text' name='q' size='10' class='input' value='{% trans "Search..." %}' id='search_query' onFocus='s=document.getElementById("search_query");if (s.value == "{% trans "Search..." %}") { s.value = ""; }' title='{% trans "Enter a keyword, or a ticket number to jump straight to that ticket." %}'/><input type='hidden' name='status' value='1' /><input type='hidden' name='status' value='2' /><input type='hidden' name='status' value='3' /><input type='hidden' name='search_type' value='header' />{% csrf_token %}</form></li>{% endif %}
</ul>
{% else %}
<ul>
<li><a href='{% url helpdesk_home %}'>{% trans "Submit A Ticket" %}</a></li>
{% if helpdesk_settings.HELPDESK_KB_ENABLED %}<li><a href='{% url helpdesk_kb_index %}'>{% trans "Knowledgebase" %}</a></li>{% endif %}
<li><a href='{% url login %}?next={% url helpdesk_dashboard %}'>{% trans "Log In" %}</a></li>
</ul>
{% endif %}

View File

@ -15,8 +15,8 @@
{% block helpdesk_body %}{% endblock %}
</div>
<div id='footer'>
<p>{% trans "Powered by <a href='http://github.com/rossp/django-helpdesk'>django-helpdesk</a>." %}</p>
<p>{% include "helpdesk/attribution.html" %}</p>
</div>
</div>{% include "helpdesk/debug.html" %}
</body>
</html>
</html>

View File

@ -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<ticket_id>[0-9]+)/$',
'view_ticket',
name='helpdesk_view'),
url(r'^tickets/(?P<ticket_id>[0-9]+)/followup_edit/(?P<followup_id>[0-9]+)/$',
'followup_edit',
name='helpdesk_followup_edit'),
@ -70,7 +72,7 @@ urlpatterns = patterns('helpdesk.views.staff',
url(r'^tickets/(?P<ticket_id>[0-9]+)/cc/delete/(?P<cc_id>[0-9]+)/$',
'ticket_cc_del',
name='helpdesk_ticket_cc_del'),
url(r'^tickets/(?P<ticket_id>[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<ticket_id>[0-9]+)/dependency/delete/(?P<dependency_id>[0-9]+)/$',
'ticket_dependency_del',
name='helpdesk_ticket_dependency_del'),
url(r'^raw/(?P<type>\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<id>[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<slug>[A-Za-z_-]+)/$',
'category', name='helpdesk_kb_category'),
url(r'^kb/(?P<slug>[A-Za-z_-]+)/$',
'category', name='helpdesk_kb_category'),
url(r'^kb/(?P<item>[0-9]+)/$',
'item', name='helpdesk_kb_item'),
url(r'^kb/(?P<item>[0-9]+)/$',
'item', name='helpdesk_kb_item'),
url(r'^kb/(?P<item>[0-9]+)/vote/$',
'vote', name='helpdesk_kb_vote'),
)
url(r'^kb/(?P<item>[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',
{

View File

@ -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,
}))