From cb34b1933a6530d62e0e9916f69e5cb2d242b072 Mon Sep 17 00:00:00 2001 From: Andreas Kotowicz Date: Sat, 19 Nov 2011 09:34:07 +0100 Subject: [PATCH 01/27] make django-helpdesk more customizable + bug fixes: - look at settings.py for all new options regarding customization. - settings can be accessed inside the templates via the new templatetag 'load_helpdesk_settings' - allow editing of personal followups, but only if followup does not contain any ticketchanges - otherwise this information is lost after the editing. - add 'delete' link to attachments - link to list of closed tickets in queue overview - add 'closed & resolved' section to dashboard - hide 'pre-set reply' box if no pre-set replies are found. - use 'SelectDateWidget' for custom DateField - fix how we update followups so that attachments don't get deleted - fix bug where resolution emails contained the solution 'None' - fix stats crashing bug - fix locale bug --- helpdesk/forms.py | 2 + helpdesk/lib.py | 8 +- helpdesk/settings.py | 54 ++++++++++++++ helpdesk/templates/helpdesk/attribution.html | 5 +- helpdesk/templates/helpdesk/base.html | 9 ++- helpdesk/templates/helpdesk/dashboard.html | 35 +++++++-- helpdesk/templates/helpdesk/navigation.html | 10 ++- helpdesk/templates/helpdesk/public_base.html | 8 +- .../templates/helpdesk/public_homepage.html | 9 +++ helpdesk/templates/helpdesk/ticket.html | 18 ++++- .../templates/helpdesk/ticket_desc_table.html | 11 ++- .../templatetags/load_helpdesk_settings.py | 21 ++++++ helpdesk/urls.py | 4 + helpdesk/views/public.py | 5 +- helpdesk/views/staff.py | 74 ++++++++++++++----- 15 files changed, 237 insertions(+), 36 deletions(-) create mode 100644 helpdesk/templatetags/load_helpdesk_settings.py diff --git a/helpdesk/forms.py b/helpdesk/forms.py index 502a90bb..3e45d0c6 100644 --- a/helpdesk/forms.py +++ b/helpdesk/forms.py @@ -11,6 +11,7 @@ from datetime import datetime from StringIO import StringIO from django import forms +from django.forms import extras from django.conf import settings from django.contrib.auth.models import User from django.utils.translation import ugettext as _ @@ -195,6 +196,7 @@ class TicketForm(forms.Form): fieldclass = forms.BooleanField elif field.data_type == 'date': fieldclass = forms.DateField + instanceargs['widget'] = extras.SelectDateWidget elif field.data_type == 'time': fieldclass = forms.TimeField elif field.data_type == 'datetime': diff --git a/helpdesk/lib.py b/helpdesk/lib.py index 05469588..0826b346 100644 --- a/helpdesk/lib.py +++ b/helpdesk/lib.py @@ -54,7 +54,13 @@ def send_templated_mail(template_name, email_context, recipients, sender=None, b import os context = Context(email_context) - locale = context['queue'].get('locale', 'en') + + if hasattr(context['queue'], 'locale'): + locale = getattr(context['queue'], 'locale', '') + else: + locale = context['queue'].get('locale', 'en') + if not locale: + locale = 'en' t = None try: diff --git a/helpdesk/settings.py b/helpdesk/settings.py index 92e255ef..79a609b5 100644 --- a/helpdesk/settings.py +++ b/helpdesk/settings.py @@ -28,5 +28,59 @@ if type(DEFAULT_USER_SETTINGS) != type(dict()): 'tickets_per_page': 25 } +''' generic options - visible on all pages ''' +# redirect to login page instead of the default homepage when users visits "/"? +HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT = getattr(settings, 'HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT', False) + # show knowledgebase links? HELPDESK_KB_ENABLED = getattr(settings, 'HELPDESK_KB_ENABLED', True) + +# show extended navigation by default, to all users, irrespective of staff status? +HELPDESK_NAVIGATION_ENABLED = getattr(settings, 'HELPDESK_NAVIGATION_ENABLED', False) + +# show 'stats' link in navigation bar? +HELPDESK_NAVIGATION_STATS_ENABLED = getattr(settings, 'HELPDESK_NAVIGATION_STATS_ENABLED', True) + +# set this to an email address inside your organization and a footer below +# the 'Powered by django-helpdesk' will be shown, telling the user whom to contact +# in case they have technical problems. +HELPDESK_SUPPORT_PERSON = getattr(settings, 'HELPDESK_SUPPORT_PERSON', False) + + +''' options for public pages ''' +# show 'view a ticket' section on public page? +HELPDESK_VIEW_A_TICKET_PUBLIC = getattr(settings, 'HELPDESK_VIEW_A_TICKET_PUBLIC', True) + +# show 'submit a ticket' section on public page? +HELPDESK_SUBMIT_A_TICKET_PUBLIC = getattr(settings, 'HELPDESK_SUBMIT_A_TICKET_PUBLIC', True) + + +''' options for update_ticket views ''' +# allow non-staff users to interact with tickets? this will also change how 'staff_member_required' +# in staff.py will be defined. +HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE = getattr(settings, 'HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE', False) + +# show edit buttons in ticket follow ups. +HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP = getattr(settings, 'HELPDESK_HIDE_EDIT_BUTTON_FOLLOW_UP', True) + +# show ticket edit button on top of ticket description. +HELPDESK_SHOW_EDIT_BUTTON_TICKET_TOP = getattr(settings, 'HELPDESK_SHOW_EDIT_BUTTON_TICKET_TOP', True) + +# show ticket delete button on top of ticket description. +HELPDESK_SHOW_DELETE_BUTTON_TICKET_TOP = getattr(settings, 'HELPDESK_SHOW_DELETE_BUTTON_TICKET_TOP', True) + +# show hold / unhold button on top of ticket description. +HELPDESK_SHOW_HOLD_BUTTON_TICKET_TOP = getattr(settings, 'HELPDESK_SHOW_HOLD_BUTTON_TICKET_TOP', True) + +# make all updates public by default? this will hide the 'is this update public' checkbox +HELPDESK_UPDATE_PUBLIC_DEFAULT = getattr(settings, 'HELPDESK_UPDATE_PUBLIC_DEFAULT', True) + + +''' options for dashboard ''' +# show delete button next to unassigned tickets +HELPDESK_DASHBOARD_SHOW_DELETE_UNASSIGNED = getattr(settings, 'HELPDESK_DASHBOARD_SHOW_DELETE_UNASSIGNED', True) + + +''' options for footer ''' +# show 'API' link at bottom of page +HELPDESK_FOOTER_SHOW_API_LINK = getattr(settings, 'HELPDESK_FOOTER_SHOW_API_LINK', True) diff --git a/helpdesk/templates/helpdesk/attribution.html b/helpdesk/templates/helpdesk/attribution.html index 90be0ced..461621e3 100644 --- a/helpdesk/templates/helpdesk/attribution.html +++ b/helpdesk/templates/helpdesk/attribution.html @@ -1,2 +1,5 @@ {% load i18n %} -{% trans "Powered by django-helpdesk." %} \ No newline at end of file +{% trans "Powered by django-helpdesk." %} +{% if helpdesk_settings.HELPDESK_SUPPORT_PERSON %} +

{% trans "For technical support please contact:" %} {{ helpdesk_settings.HELPDESK_SUPPORT_PERSON }}

+{% endif %} diff --git a/helpdesk/templates/helpdesk/base.html b/helpdesk/templates/helpdesk/base.html index aad66a93..252e5232 100644 --- a/helpdesk/templates/helpdesk/base.html +++ b/helpdesk/templates/helpdesk/base.html @@ -1,5 +1,7 @@ {% load i18n %} {% load saved_queries %} +{% load load_helpdesk_settings %} +{% with request|load_helpdesk_settings as helpdesk_settings %} {% with request|saved_queries as user_saved_queries_ %} @@ -51,10 +53,15 @@ {% include "helpdesk/debug.html" %} {% endwith %} +{% endwith %} diff --git a/helpdesk/templates/helpdesk/dashboard.html b/helpdesk/templates/helpdesk/dashboard.html index 4a087073..bb2094fc 100644 --- a/helpdesk/templates/helpdesk/dashboard.html +++ b/helpdesk/templates/helpdesk/dashboard.html @@ -6,13 +6,14 @@ {% block helpdesk_body %} - - + + {% for queue in dash_tickets %} - - + + + {% endfor %}
{% trans "Helpdesk Summary" %}
{% trans "Queue" %}{% trans "Open" %}{% trans "Resolved" %}
{% trans "Helpdesk Summary" %}
{% trans "Queue" %}{% trans "Open" %}{% trans "Resolved" %}{% trans "Closed" %}
{{ queue.name }}{% if queue.open %}{% endif %}{{ queue.open }}{% if queue.open %}{% endif %}{% if queue.resolved %}{% endif %}{{ queue.resolved }}{% if queue.resolved %}{% endif %}{% if queue.open %}{% endif %}{{ queue.open }}{% if queue.open %}{% endif %}{% if queue.resolved %}{% endif %}{{ queue.resolved }}{% if queue.resolved %}{% endif %}{% if queue.closed %}{% endif %}{{ queue.closed }}{% if queue.closed %}{% endif %}
@@ -22,7 +23,7 @@
- + {% for ticket in user_tickets %} @@ -39,6 +40,8 @@ {% endif %}
{% trans "Your Tickets" %}
{% trans "Your Open Tickets" %}
#{% trans "Pr" %}{% trans "Title" %}{% trans "Queue" %}{% trans "Status" %}{% trans "Last Update" %}
+
+ @@ -49,7 +52,7 @@ - + {% endfor %} {% if not unassigned_tickets %} @@ -57,4 +60,24 @@ {% endif %}
{% trans "Unassigned Tickets" %}
#{% trans "Pr" %}{% trans "Title" %}{% trans "Queue" %}{% trans "Created" %} 
{{ ticket.title }} {{ ticket.queue }} {{ ticket.created|timesince }} ago{% trans "Take" %} | {% trans "Delete" %}{% trans "Take" %} {% if helpdesk_settings.HELPDESK_DASHBOARD_SHOW_DELETE_UNASSIGNED %}| {% trans "Delete" %}{% endif %}
+ +{% if user_tickets_closed_resolved %} +
+ + + + +{% for ticket in user_tickets_closed_resolved %} + + + + + + + + +{% endfor %} +
{% trans "Your closed & resolved Tickets" %}
#{% trans "Pr" %}{% trans "Title" %}{% trans "Queue" %}{% trans "Status" %}{% trans "Last Update" %}
{{ ticket.ticket }}{{ ticket.get_priority_span }}{{ ticket.title }}{{ ticket.queue }}{{ ticket.get_status }}{{ ticket.modified|timesince }}
+{% endif %} + {% endblock %} diff --git a/helpdesk/templates/helpdesk/navigation.html b/helpdesk/templates/helpdesk/navigation.html index 15e38852..6fc52b0d 100644 --- a/helpdesk/templates/helpdesk/navigation.html +++ b/helpdesk/templates/helpdesk/navigation.html @@ -1,10 +1,12 @@ {% load i18n %} -{% if user.is_staff %} +{% if helpdesk_settings.HELPDESK_NAVIGATION_ENABLED and user.is_authenticated or user.is_staff %} {% endif %} {% endfor %} {% for attachment in followup.attachment_set.all %}{% if forloop.first %}
{% endif %} {% endfor %} @@ -73,9 +81,11 @@
+ {% if preset_replies %}
(Optional)
{% trans "Selecting a pre-set reply will over-write your comment below. You can then modify the pre-set reply to your liking before saving this update." %}
+ {% endif %}
@@ -109,9 +119,13 @@ {% endifequal %} + {% if helpdesk_settings.HELPDESK_UPDATE_PUBLIC_DEFAULT %} + + {% else %}
(Optional)
-
+
{% trans "If this is public, the submitter will be e-mailed your comment or resolution." %}
+ {% endif %}

{% trans "Change Further Details »" %}

diff --git a/helpdesk/templates/helpdesk/ticket_desc_table.html b/helpdesk/templates/helpdesk/ticket_desc_table.html index 01239590..20b40b75 100644 --- a/helpdesk/templates/helpdesk/ticket_desc_table.html +++ b/helpdesk/templates/helpdesk/ticket_desc_table.html @@ -1,6 +1,15 @@ {% load i18n %} - + diff --git a/helpdesk/templatetags/load_helpdesk_settings.py b/helpdesk/templatetags/load_helpdesk_settings.py new file mode 100644 index 00000000..74f3647f --- /dev/null +++ b/helpdesk/templatetags/load_helpdesk_settings.py @@ -0,0 +1,21 @@ +""" +django-helpdesk - A Django powered ticket tracker for small enterprise. + +templatetags/load_helpdesk_settings.py - returns the settings as defined in + django-helpdesk/helpdesk/settings.py +""" + +from django.template import Library +from helpdesk import settings as helpdesk_settings_config + +def load_helpdesk_settings(request): + try: + return helpdesk_settings_config + except Exception, e: + import sys + print >> sys.stderr, "'load_helpdesk_settings' template tag (django-helpdesk) crashed with following error:" + print >> sys.stderr, e + return '' + +register = Library() +register.filter('load_helpdesk_settings', load_helpdesk_settings) diff --git a/helpdesk/urls.py b/helpdesk/urls.py index 4aa4ce7f..0e950d55 100644 --- a/helpdesk/urls.py +++ b/helpdesk/urls.py @@ -80,6 +80,10 @@ 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'^tickets/(?P[0-9]+)/attachment_delete/(?P[0-9]+)/$', + 'attachment_del', + name='helpdesk_attachment_del'), url(r'^raw/(?P\w+)/$', 'raw_details', diff --git a/helpdesk/views/public.py b/helpdesk/views/public.py index b72034b0..e7ee1682 100644 --- a/helpdesk/views/public.py +++ b/helpdesk/views/public.py @@ -22,7 +22,10 @@ from helpdesk.models import Ticket, Queue, UserSettings def homepage(request): - if request.user.is_staff: + if not request.user.is_authenticated() and helpdesk_settings.HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT: + return HttpResponseRedirect(reverse('login')) + + if (request.user.is_staff or (request.user.is_authenticated() and helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE)): try: if getattr(request.user.usersettings.settings, 'login_view_ticketlist', False): return HttpResponseRedirect(reverse('helpdesk_list')) diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index bc80f60a..44e9722c 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -28,14 +28,20 @@ from helpdesk.forms import TicketForm, UserSettingsForm, EmailIgnoreForm, EditTi from helpdesk.lib import send_templated_mail, query_to_dict, apply_query, safe_template_context from helpdesk.models import Ticket, Queue, FollowUp, TicketChange, PreSetReply, Attachment, SavedSearch, IgnoreEmail, TicketCC, TicketDependency from helpdesk.settings import HAS_TAG_SUPPORT +from helpdesk import settings as helpdesk_settings if HAS_TAG_SUPPORT: from tagging.models import Tag, TaggedItem -staff_member_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active and u.is_staff) -superuser_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active and u.is_superuser) +if helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE: + # treat 'normal' users like 'staff' + staff_member_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active) +else: + staff_member_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active and u.is_staff) +superuser_required = user_passes_test(lambda u: u.is_authenticated() and u.is_active and u.is_superuser) + def dashboard(request): """ @@ -44,12 +50,18 @@ def dashboard(request): with options for them to 'Take' ownership of said tickets. """ + # open & reopened tickets tickets = Ticket.objects.filter( assigned_to=request.user, ).exclude( - status=Ticket.CLOSED_STATUS, + status__in = [Ticket.CLOSED_STATUS, Ticket.RESOLVED_STATUS], ) + # closed & resolved tickets + tickets_closed_resolved = Ticket.objects.filter( + assigned_to=request.user, + status__in = [Ticket.CLOSED_STATUS, Ticket.RESOLVED_STATUS]) + unassigned_tickets = Ticket.objects.filter( assigned_to__isnull=True, ).exclude( @@ -67,7 +79,8 @@ def dashboard(request): SELECT q.id as queue, q.title AS name, COUNT(CASE t.status WHEN '1' THEN t.id WHEN '2' THEN t.id END) AS open, - COUNT(CASE t.status WHEN '3' THEN t.id END) AS resolved + COUNT(CASE t.status WHEN '3' THEN t.id END) AS resolved, + COUNT(CASE t.status WHEN '4' THEN t.id END) AS closed FROM helpdesk_ticket t, helpdesk_queue q WHERE q.id = t.queue_id @@ -79,6 +92,7 @@ def dashboard(request): return render_to_response('helpdesk/dashboard.html', RequestContext(request, { 'user_tickets': tickets, + 'user_tickets_closed_resolved': tickets_closed_resolved, 'unassigned_tickets': unassigned_tickets, 'dash_tickets': dash_tickets, })) @@ -127,9 +141,18 @@ def followup_edit(request, ticket_id, followup_id, ): new_status = form.cleaned_data['new_status'] #will save previous date old_date = followup.date - followup.delete() new_followup = FollowUp(title=title, date=old_date, ticket=_ticket, comment=comment, public=public, new_status=new_status, ) + # keep old user if one did exist before. + if followup.user: + new_followup.user = followup.user new_followup.save() + # get list of old attachments & link them to new_followup + attachments = Attachment.objects.filter(followup = followup) + for attachment in attachments: + attachment.followup = new_followup + attachment.save() + # delete old followup + followup.delete() return HttpResponseRedirect(reverse('helpdesk_view', args=[ticket.id])) def view_ticket(request, ticket_id): @@ -169,7 +192,7 @@ def view_ticket(request, ticket_id): return render_to_response('helpdesk/ticket.html', RequestContext(request, { 'ticket': ticket, - 'active_users': User.objects.filter(is_active=True).filter(is_staff=True).order_by('username'), + 'active_users': User.objects.filter(is_active=True).order_by('username'), 'priorities': Ticket.PRIORITY_CHOICES, 'preset_replies': PreSetReply.objects.filter(Q(queues=ticket.queue) | Q(queues__isnull=True)), 'tags_enabled': HAS_TAG_SUPPORT, @@ -178,7 +201,7 @@ view_ticket = staff_member_required(view_ticket) def update_ticket(request, ticket_id, public=False): - if not (public or (request.user.is_authenticated() and request.user.is_active and request.user.is_staff)): + if not (public or (request.user.is_authenticated() and request.user.is_active and (request.user.is_staff or helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE))): return HttpResponseForbidden(_('Sorry, you need to login to do that.')) ticket = get_object_or_404(Ticket, id=ticket_id) @@ -195,6 +218,10 @@ def update_ticket(request, ticket_id, public=False): # comment. from django.template import loader, Context context = safe_template_context(ticket) + # this line sometimes creates problems if code is sent as a comment. + # if comment contains some django code, like "why does {% if bla %} crash", + # then the following line will give us a crash, since django expects {% if %} + # to be closed with an {% endif %} tag. comment = loader.get_template_from_string(comment).render(Context(context)) if owner is None and ticket.assigned_to: @@ -202,7 +229,7 @@ def update_ticket(request, ticket_id, public=False): f = FollowUp(ticket=ticket, date=datetime.now(), comment=comment) - if request.user.is_staff: + if request.user.is_staff or helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE: f.user = request.user f.public = public @@ -217,9 +244,11 @@ def update_ticket(request, ticket_id, public=False): } ticket.assigned_to = new_user reassigned = True - elif owner == 0 and ticket.assigned_to is not None: - f.title = _('Unassigned') - ticket.assigned_to = None + # This makes no sense to me. Why should we ever remove the 'assigned to' + # value? + #elif owner == 0 and ticket.assigned_to is not None: + # f.title = _('Unassigned') + # ticket.assigned_to = None if new_status != ticket.status: ticket.status = new_status @@ -289,7 +318,7 @@ def update_ticket(request, ticket_id, public=False): c.save() ticket.tags = tags - if f.new_status == Ticket.RESOLVED_STATUS: + if new_status == Ticket.RESOLVED_STATUS: ticket.resolution = comment messages_sent_to = [] @@ -377,7 +406,7 @@ def update_ticket(request, ticket_id, public=False): ticket.save() - if request.user.is_staff: + if request.user.is_staff or helpdesk_settings.HELPDESK_ALLOW_NON_STAFF_TICKET_UPDATE: return HttpResponseRedirect(ticket.get_absolute_url()) else: return HttpResponseRedirect(ticket.ticket_url) @@ -419,11 +448,11 @@ def mass_update(request): f = FollowUp(ticket=t, date=datetime.now(), title=_('Closed in bulk update'), public=True, user=request.user, new_status=Ticket.CLOSED_STATUS) f.save() # Send email to Submitter, Owner, Queue CC - context = { - 'ticket': t, - 'queue': t.queue, - 'resolution': t.resolution, - } + context = safe_template_context(t) + context.update( + resolution = t.resolution, + queue = t.queue, + ) messages_sent_to = [] @@ -833,7 +862,7 @@ def run_report(request, report): month = 1 if (year > last_year) or (month > last_month and year >= last_year): working = False - periods.append("%s %s" % (months[month], year)) + periods.append("%s %s" % (months[month - 1], year)) if report == 'userpriority': title = _('User by Priority') @@ -1087,3 +1116,10 @@ def ticket_dependency_del(request, ticket_id, dependency_id): })) ticket_dependency_del = staff_member_required(ticket_dependency_del) +def attachment_del(request, ticket_id, attachment_id): + ticket = get_object_or_404(Ticket, id=ticket_id) + attachment = get_object_or_404(Attachment, id=attachment_id) + attachment.delete() + return HttpResponseRedirect(reverse('helpdesk_view', args=[ticket_id])) +attachment_del = staff_member_required(attachment_del) + From d5164e96c46a663632d801b9aaff478299460cf5 Mon Sep 17 00:00:00 2001 From: Andreas Kotowicz Date: Mon, 21 Nov 2011 17:39:13 +0100 Subject: [PATCH 02/27] add possibility to translate ticket comments using jquery & google translate. --- helpdesk/settings.py | 6 +++ ...adapter.ui.progress.native.parallel.min.js | 43 +++++++++++++++++++ helpdesk/templates/helpdesk/base.html | 42 ++++++++++++++++++ helpdesk/templates/helpdesk/ticket.html | 7 +++ 4 files changed, 98 insertions(+) create mode 100644 helpdesk/static/helpdesk/jquery.translate-1.4.7.NCT.core.NCT-adapter.ui.progress.native.parallel.min.js diff --git a/helpdesk/settings.py b/helpdesk/settings.py index 79a609b5..ea3662ae 100644 --- a/helpdesk/settings.py +++ b/helpdesk/settings.py @@ -46,6 +46,12 @@ HELPDESK_NAVIGATION_STATS_ENABLED = getattr(settings, 'HELPDESK_NAVIGATION_STATS # in case they have technical problems. HELPDESK_SUPPORT_PERSON = getattr(settings, 'HELPDESK_SUPPORT_PERSON', False) +# show dropdown list of languages that ticket comments can be translated into? +HELPDESK_TRANSLATE_TICKET_COMMENTS = getattr(settings, 'HELPDESK_TRANSLATE_TICKET_COMMENTS', False) + +# list of languages to offer. if set to false, all default google translate languages will be shown. +HELPDESK_TRANSLATE_TICKET_COMMENTS_LANG = getattr(settings, 'HELPDESK_TRANSLATE_TICKET_COMMENTS_LANG', ["en", "de", "fr", "ru"]) + ''' options for public pages ''' # show 'view a ticket' section on public page? diff --git a/helpdesk/static/helpdesk/jquery.translate-1.4.7.NCT.core.NCT-adapter.ui.progress.native.parallel.min.js b/helpdesk/static/helpdesk/jquery.translate-1.4.7.NCT.core.NCT-adapter.ui.progress.native.parallel.min.js new file mode 100644 index 00000000..24870f93 --- /dev/null +++ b/helpdesk/static/helpdesk/jquery.translate-1.4.7.NCT.core.NCT-adapter.ui.progress.native.parallel.min.js @@ -0,0 +1,43 @@ +//jQuery Translate plugin and related components + + /* + * jQuery nodesContainingText plugin + * Version: 1.1.2 + * http://code.google.com/p/jquery-translate/ + * Copyright (c) 2009 Balazs Endresz (balazs.endresz@gmail.com) + * Dual licensed under the MIT and GPL licenses. + */ +(function(b){function a(){}a.prototype={init:function(e,d){this.textArray=[];this.elements=[];this.options=d;this.jquery=e;this.n=-1;if(d.async===true){d.async=2}if(d.not){e=e.not(d.not);e=e.add(e.find("*").not(d.not)).not(b(d.not).find("*"))}else{e=e.add(e.find("*"))}this.jq=e;this.jql=this.jq.length;return this.process()},process:function(){this.n++;var i=this,d=this.options,p="",h=false,g=false,f=this.jq[this.n],k,m,j;if(this.n===this.jql){j=this.jquery.pushStack(this.elements,"nodesContainingText");d.complete.call(j,j,this.textArray);if(d.returnAll===false&&d.walk===false){return this.jquery}return j}if(!f){return this.process()}k=b(f);var n=f.nodeName.toUpperCase(),l=n==="INPUT"&&b.attr(f,"type").toLowerCase();if(({SCRIPT:1,NOSCRIPT:1,STYLE:1,OBJECT:1,IFRAME:1})[n]){return this.process() +}if(typeof d.subject==="string"){p=k.attr(d.subject)}else{if(d.altAndVal&&(n==="IMG"||l==="image")){p=k.attr("alt")}else{if(d.altAndVal&&({text:1,button:1,submit:1})[l]){p=k.val()}else{if(n==="TEXTAREA"){p=k.val()}else{m=f.firstChild;if(d.walk!==true){g=true}else{while(m){if(m.nodeType==1){g=true;break}m=m.nextSibling}}if(!g){p=k.text()}else{if(d.walk!==true){h=true}m=f.firstChild;while(m){if(m.nodeType==3&&m.nodeValue.match(/\S/)!==null){if(m.nodeValue.match(//)!==null){if(m.nodeValue.match(/(\S+(?=.*<))|(>(?=.*\S+))/)!==null){h=true;break}}else{h=true;break}}m=m.nextSibling}if(h){p=k.html();p=d.stripScripts?p.replace(/]*>([\s\S]*?)<\/script>/gi,""):p;this.jq=this.jq.not(k.find("*"))}}}}}}if(!p){return this.process()}this.elements.push(f);this.textArray.push(p);d.each.call(f,this.elements.length-1,f,p);if(d.async){setTimeout(function(){i.process()},d.async);return this.jquery}else{return this.process()}}};var c={not:"",async:false,each:function(){},complete:function(){},comments:false,returnAll:true,walk:true,altAndVal:false,subject:true,stripScripts:true}; +b.fn.nodesContainingText=function(d){d=b.extend({},c,b.fn.nodesContainingText.defaults,d);return new a().init(this,d)};b.fn.nodesContainingText.defaults=c})(jQuery); +/* + * jQuery Translate plugin + * Version: 1.4.7 + * http://code.google.com/p/jquery-translate/ + * Copyright (c) 2009 Balazs Endresz (balazs.endresz@gmail.com) + * Dual licensed under the MIT and GPL licenses. + * This plugin uses the 'Google AJAX Language API' (http://code.google.com/apis/ajaxlanguage/) + * You can read the terms of use at http://code.google.com/apis/ajaxlanguage/terms.html + */ +(function(c){function p(){}var d=true,g=false,e,u="".replace,v=String,k=Function,t=Object,n,l,f,q={},b,j=[],h={from:"",to:"",start:p,error:p,each:p,complete:p,onTimeout:p,timeout:0,stripComments:d,stripWhitespace:d,stripScripts:d,separators:/\.\?\!;:/,limit:1750,walk:d,returnAll:g,replace:d,rebind:d,data:d,setLangAttr:g,subject:d,not:"",altAndVal:d,async:g,toggle:g,fromOriginal:d,parallel:false,trim:true,alwaysReplace:false};function s(){c.translate.GL=n=google.language;c.translate.GLL=l=n.Languages;f=c.translate.toLanguageCode;c.each(l,function(y,z){q[z.toUpperCase()]=y}); +c.translate.isReady=d;var x;while((x=j.shift())){x()}}function i(z,y){var x={};c.each(z,function(A,B){if(y(B,A)===d){x[A]=B}});return x}function w(y,z,x){return function(){return y.apply(z===d?arguments[0]:z,x||arguments)}}function r(x){return x!==e}function o(y,B,A){var x,C={},z=c.grep(y,r);c.each(B,function(D,E){var F=c.grep(E[0],function(H,G){return r(z[G])&&z[G].constructor===H}).length;if(F===z.length&&F===E[0].length&&(x=d)){c.each(E[1],function(G,H){C[H]=z[G]});return g}});if(!x){throw A}return C}function m(A,z){var x=o(A,c.translate.overload,"jQuery.translate: Invalid arguments"),y=x.options||{};delete x.options;y=c.extend({},h,z,c.extend(y,x));if(y.fromOriginal){y.toggle=d}if(y.toggle){y.data=d}if(y.async===d){y.async=2}return y}function a(){this.extend(c.translate);delete this.defaults;delete this.fn}a.prototype={version:"1.4.7",_init:function(z,C){var B=C.separators.source||C.separators,y=this.isString=typeof z==="string",x=0,A;c.each(["stripComments","stripScripts","stripWhitespace"],function(E,D){var F=c.translate[D]; +if(C[D]){z=y?F(z):c.map(z,F)}});this.rawSource="
"+(y?z:z.join("
"))+"
";this._m3=new RegExp("["+B+"](?![^"+B+"]*["+B+"])");this.options=C;this.from=C.from=f(C.from)||"";this.to=C.to=f(C.to)||"";this.source=z;this.rawTranslation="";this.translation=[];this.i=0;this.stopped=g;this.elements=C.nodes;this._i=-1;this.rawSources=[];while(d){A=this.truncate(this.rawSource.substr(x),C.limit);if(!A){break}this.rawSources.push(A);x+=A.length}this.queue=new Array(this.rawSources.length);this.done=0;C.start.call(this,z,C.from,C.to,C);if(C.timeout){this.timeout=setTimeout(w(C.onTimeout,this,[z,C.from,C.to,C]),C.timeout)}(C.toggle&&C.nodes)?(C.textNodes?this._toggleTextNodes():this._toggle()):this._process()},_process:function(){if(this.stopped){return}var x=this.options,E=this.rawTranslation.length,I,J,G,F;var H=this;while((I=this.rawTranslation.lastIndexOf("",E))>-1){E=I-1;J=this.rawTranslation.substr(0,E+1);G=J.match(/ ]/gi);F=J.match(/<\/div>/gi);G=G?G.length:0;F=F?F.length:0; +if(G!==F+1){continue}var A=c(this.rawTranslation.substr(0,E+7)),C=A.length,B=this.i;if(B===C){break}A.slice(B,C).each(w(function(M,P){if(this.stopped){return g}var L=c(P).html(),O=x.trim?c.trim(L):L,N=B+M,Q=this.source,R=!this.from&&this.detectedSourceLanguage||this.from;this.translation[N]=O;this.isString?this.translation=O:Q=this.source[N];x.each.call(this,N,O,Q,R,this.to,x);this.i++},this));break}if(this.rawSources.length-1==this._i){this._complete()}var z=w(this._translate,this);if(x.parallel){if(this._i<0){if(!x.parallel){c.each(this.rawSources,z)}else{var D=0,y=this.rawSources.length;function K(){z();if(Dthis.done)||(x===this.queue.length-1)){for(var y=0;y<=x;y++){this.rawTranslation+=this.queue[y]}this._process()}this.done=x},_complete:function(){clearTimeout(this.timeout);this.options.complete.call(this,this.translation,this.source,!this.from&&this.detectedSourceLanguage||this.from,this.to,this.options)},stop:function(){if(this.stopped){return this}this.stopped=d;this.options.error.call(this,{message:"stopped"});return this}};c.translate=function(z,x){if(z==e){return new a()}if(c.isFunction(z)){return c.translate.ready(z,x)}var A=new a();var y=[].slice.call(arguments,0);y.shift();return c.translate.ready(w(A._init,A,[z,m(y,c.translate.defaults)]),g,A)};c.translate.fn=c.translate.prototype=a.prototype;c.translate.fn.extend=c.translate.extend=c.extend;c.translate.extend({_bind:w,_filter:i,_validate:o,_getOpt:m,_defaults:h,defaults:c.extend({},h),capitalize:function(x){return x.charAt(0).toUpperCase()+x.substr(1).toLowerCase() +},truncate:function(D,y){var z,G,E,C,B,F,x=encodeURIComponent(D);for(z=0;z<10;z++){try{F=decodeURIComponent(x.substr(0,y-z))}catch(A){continue}if(F){break}}return(!(G=/<(?![^<]*>)/.exec(F)))?((!(E=/>\s*$/.exec(F)))?((C=this._m3.exec(F))?((B=/>(?![^>]*<)/.exec(F))?(C.index>B.index?F.substring(0,C.index+1):F.substring(0,B.index+1)):F.substring(0,C.index+1)):F):F):F.substring(0,G.index)},getLanguages:function(E,D){if(E==e||(D==e&&!E)){return l}var B={},A=typeof E,z=D?c.translate.getLanguages(E):l,F=(A==="object"||A==="function")?E:D;if(F){if(F.call){B=i(z,F)}else{for(var C=0,y=F.length,x;C]*>([\s\S]*?)<\/script>/gi,""]),stripWhitespace:w(u,d,[/\s\s+/g," "]),stripComments:w(u,d,[//g,""])}) +})(jQuery); + +(function(g){var f=true,a={text:f,button:f,submit:f},b={SCRIPT:f,NOSCRIPT:f,STYLE:f,OBJECT:f,IFRAME:f},e=g([]);e.length=1;function d(i){while(i&&i.nodeType!=9){i=i.parentNode}return i}function c(j,i){var k=j.css("text-align");j.css("direction",i);if(k==="right"){j.css("text-align","left")}if(k==="left"){j.css("text-align","right")}}function h(j,k){var l=j.nodeName.toUpperCase(),i=l==="INPUT"&&g.attr(j,"type").toLowerCase();k=k||{altAndVal:f,subject:f};return typeof k.subject==="string"?k.subject:k.altAndVal&&(l==="IMG"||i==="image")?"alt":k.altAndVal&&a[i]?"$val":l==="TEXTAREA"?"$val":"$html"}g.translate.fn._toggle=function(){var j=this.options,k=j.to,i;this.elements.each(g.translate._bind(function(l,m){this.i=l;var o=g(m),n=g.translate.getData(o,k,j);if(!n){return !(i=f)}this.translation.push(n);j.each.call(this,l,m,n,this.source[l],this.from,k,j) +},this));!i?this._complete():this._process()};g.translate.extend({_getType:h,each:function(k,m,j,l,q,p,n){e[0]=m;g.translate.setData(e,p,j,q,l,n);g.translate.replace(e,j,p,n);g.translate.setLangAttr(e,p,n)},getData:function(k,m,l){var i=k[0]||k,j=g.data(i,"translation");return j&&j[m]&&j[m][h(i,l)]},setData:function(l,n,q,p,r,i){if(i&&!i.data){return}var j=l[0]||l,m=h(j,i),k=g.data(j,"translation");k=k||g.data(j,"translation",{});(k[p]=k[p]||{})[m]=r;(k[n]=k[n]||{})[m]=q},replace:function(m,u,s,k){if(k&&!k.replace){return}if(k&&typeof k.subject==="string"){return m.attr(k.subject,u)}var l=m[0]||m,q=l.nodeName.toUpperCase(),p=q==="INPUT"&&g.attr(l,"type").toLowerCase(),n=g.translate.isRtl,j=g.data(l,"lang");if(!k.alwaysReplace){if(j===s){return}}if(n[s]!==n[j||k&&k.from]){if(n[s]){c(m,"rtl")}else{if(m.css("direction")==="rtl"){c(m,"ltr")}}}if((!k||k.altAndVal)&&(q==="IMG"||p==="image")){m.attr("alt",u)}else{if(q==="TEXTAREA"||(!k||k.altAndVal)&&a[p]){m.val(u)}else{if(!k||k.rebind){this.doc=this.doc||d(l); +var i=m.find("*").not("script"),r=g(this.doc.createElement("div")).html(u);g.translate.copyEvents(i,r.find("*"));m.html(r.contents())}else{m.html(u)}}}g.data(l,"lang",s)},setLangAttr:function(i,k,j){if(!j||j.setLangAttr){i.attr((!j||j.setLangAttr===f)?"lang":j.setLangAttr,k)}},copyEvents:function(j,i){i.each(function(l,o){var p=j[l];if(!o||!p){return false}if(b[p.nodeName.toUpperCase()]){return f}var k=g.data(p,"events");if(!k){return f}for(var n in k){for(var m in k[n]){g.event.add(o,n,k[n][m],k[n][m].data)}}})}});g.fn.translate=function(j,i,m){var k=g.translate._getOpt(arguments,g.fn.translate.defaults),l=g.extend({},g.translate._defaults,g.fn.translate.defaults,k,{complete:function(o,n){g.translate(function(){var r=g.translate.toLanguageCode(k.from);if(k.fromOriginal){o.each(function(s,t){e[0]=t;var u=g.translate.getData(e,r,k);if(!u){return true}n[s]=u})}var q=k.each;function p(s){return function(){[].unshift.call(arguments,this.elements);s.apply(this,arguments)}}k.nodes=o;k.start=p(k.start); +k.onTimeout=p(k.onTimeout);k.complete=p(k.complete);k.each=function(t){var s=arguments;if(arguments.length!==7){[].splice.call(s,1,0,this.elements[t])}this.each.apply(this,s);q.apply(this,s)};g.translate(n,k)})},each:function(){}});if(this.nodesContainingText){return this.nodesContainingText(l)}k.nodes=this;g.translate(g.map(this,function(n){return g(n).html()||g(n).val()}),k);return this};g.fn.translate.defaults=g.extend({},g.translate._defaults)})(jQuery); + +(function(a){var b={tags:["select","option"],filter:a.translate.isTranslatable,label:a.translate.toNativeLanguage||function(d,c){return a.translate.capitalize(c)},includeUnknown:false};a.translate.ui=function(){var g={},f="",d="",c="";if(typeof arguments[0]==="string"){g.tags=a.makeArray(arguments)}else{g=arguments[0]}g=a.extend({},b,a.translate.ui.defaults,g);if(g.tags[2]){d="<"+g.tags[2]+">";c=""}var e=a.translate.getLanguages(g.filter);if(!g.includeUnknown){delete e.UNKNOWN}a.each(e,function(h,i){f+=("<"+g.tags[1]+" value="+i+">"+d+g.label(i,h)+c+"")});return a("<"+g.tags[0]+' class="jq-translate-ui">'+f+"")};a.translate.ui.defaults=a.extend({},b)})(jQuery); + +jQuery.translate.fn.progress=function(a,c){if(!this.i){this._pr=0}this._pr+=this.source[this.i].length;var b=100*this._pr/(this.rawSource.length-(11*(this.i+1)));if(a){var d=jQuery(a);if(!this.i&&!d.hasClass("ui-progressbar")){d.progressbar(c)}d.progressbar("option","value",b)}return b}; + +(function(a){a.translate.extend({toNativeLanguage:function(b){return a.translate.nativeLanguages[b]||a.translate.nativeLanguages[a.translate.toLanguageCode(b)]},nativeLanguages:{af:"Afrikaans",be:"Беларуская",is:"Íslenska",ga:"Gaeilge",mk:"Македонски",ms:"Bahasa Melayu",sw:"Kiswahili",cy:"Cymraeg",yi:"ייִדיש",sq:"Shqipe",ar:"العربية",bg:"Български",ca:"Català",zh:"中文","zh-CN":"简体中文","zh-TW":"繁體中文",hr:"Hrvatski",cs:"Čeština",da:"Dansk",nl:"Nederlands",en:"English",et:"Eesti",tl:"Tagalog",fi:"Suomi",fr:"Français",gl:"Galego",de:"Deutsch",el:"Ελληνικά",iw:"עברית",hi:"हिन्दी",hu:"Magyar",id:"Bahasa Indonesia",it:"Italiano",ja:"日本語",ko:"한국어",lv:"Latviešu",lt:"Lietuvių",mt:"Malti",no:"Norsk",fa:"فارسی",pl:"Polski","pt-PT":"Português",ro:"Român",ru:"Русский",sr:"Српски",sk:"Slovenský",sl:"Slovenski",es:"Español",sv:"Svenska",th:"ไทย",tr:"Türkçe",uk:"Українська",vi:"Tiếng Việt"}}) +})(jQuery); + +(function(a){a.translate.extend({defer:function(){return a.translate._bind(a.translate,null,arguments)},run:function(d,c){var b=d.length;a.each(d,function(){var f=this(),e=f.options.complete;f.options.complete=function(){e.apply(this,arguments);if(!--b){c()}}})}})})(jQuery); \ No newline at end of file diff --git a/helpdesk/templates/helpdesk/base.html b/helpdesk/templates/helpdesk/base.html index 252e5232..38de46ea 100644 --- a/helpdesk/templates/helpdesk/base.html +++ b/helpdesk/templates/helpdesk/base.html @@ -9,6 +9,7 @@ {% block helpdesk_title %}Helpdesk{% endblock %} :: {% trans "Powered by django-helpdesk" %} + @@ -16,11 +17,52 @@ diff --git a/helpdesk/templates/helpdesk/ticket.html b/helpdesk/templates/helpdesk/ticket.html index ad248a9b..5f7fbc36 100644 --- a/helpdesk/templates/helpdesk/ticket.html +++ b/helpdesk/templates/helpdesk/ticket.html @@ -41,6 +41,10 @@ {% endblock %} {% block helpdesk_body %} +{% if helpdesk_settings.HELPDESK_TRANSLATE_TICKET_COMMENTS %} +
{% trans "Translate ticket comments into" %}
+
+{% endif %} {% include "helpdesk/ticket_desc_table.html" %} @@ -74,6 +78,9 @@
{% endfor %} {% endif %} +{% if helpdesk_settings.HELPDESK_TRANSLATE_TICKET_COMMENTS %} + +{% endif %}

{% trans "Respond to this ticket" %}

From 2cee519d1c3645b165898789f9f09fc37627e173 Mon Sep 17 00:00:00 2001 From: Andreas Kotowicz Date: Mon, 21 Nov 2011 19:15:43 +0100 Subject: [PATCH 03/27] translate code changes: - change js code, so that 'click' and not 'change' will trigger the translation. - do not assume that English is the source language - the comments might be in a different language. --- helpdesk/templates/helpdesk/base.html | 29 +++++++++++++-------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/helpdesk/templates/helpdesk/base.html b/helpdesk/templates/helpdesk/base.html index 38de46ea..3c550a2c 100644 --- a/helpdesk/templates/helpdesk/base.html +++ b/helpdesk/templates/helpdesk/base.html @@ -29,7 +29,7 @@ $.translate(function(){ //when the Google Language API is loaded $.translate().ui({ tags: ["select", "option"], - //a function that filters the languages: + // a function that filters the languages: {% if helpdesk_settings.HELPDESK_TRANSLATE_TICKET_COMMENTS_LANG %} filter: {{ helpdesk_settings.HELPDESK_TRANSLATE_TICKET_COMMENTS_LANG|safe }}, {% else %} @@ -41,24 +41,23 @@ function(langCode, lang){ return $.translate.capitalize(lang); }, - //whether to include the UNKNOWN:"" along with the languages: + // whether to include the UNKNOWN:"" along with the languages: includeUnknown: false, }) - .change(function(){ - $('#translate_block').translate( 'en', { //revert to english first - not: 'select, pre' - }) - - .translate( 'en', $(this).val(), { - not: 'select, pre', - async: true, - toggle: true, - walk: false - }); + .click(function(){ // when selecting a language - 'change' is not enough, because your first language in the menu might be your target language + $('#translate_block').translate( '', $(this).val(), { // translate from current language to the selected language + not: '.option, select, pre, .translate_dropdown', // exclude these elements + fromOriginal: true, // always translate from original version (even after the page has been translated) + async: true, // this prevents the browser from freezing on larger sites by executing each DOM filtering iteration with a delay + toggle: true, // all translation will be cached (stored with $.data) and used if it's found, or translated to otherwise + walk: true // finds elements having textnodes and translates only their content; on very large and complex pages this might take some time + }) }) - .val('English') //select English as default - .appendTo('#translate_dropdown'); //insert the dropdown to the page + .appendTo('#translate_dropdown'); // insert the dropdown menu to the page + + //insert Google's logo after the dropdown: + $.translate.getBranding().appendTo('#translate_dropdown'); }); {% endif %} From f897d5bcb4475d28f4793d26de74bbb2368f06d9 Mon Sep 17 00:00:00 2001 From: Andreas Kotowicz Date: Mon, 21 Nov 2011 20:04:05 +0100 Subject: [PATCH 04/27] add option to override default look of followups - this is work in progress. --- helpdesk/settings.py | 4 ++++ helpdesk/static/helpdesk/helpdesk.css | 18 +++++++++++--- helpdesk/templates/helpdesk/ticket.html | 31 ++++++++++++++++++------- 3 files changed, 41 insertions(+), 12 deletions(-) diff --git a/helpdesk/settings.py b/helpdesk/settings.py index ea3662ae..fa61e230 100644 --- a/helpdesk/settings.py +++ b/helpdesk/settings.py @@ -52,6 +52,10 @@ HELPDESK_TRANSLATE_TICKET_COMMENTS = getattr(settings, 'HELPDESK_TRANSLATE_TICKE # list of languages to offer. if set to false, all default google translate languages will be shown. HELPDESK_TRANSLATE_TICKET_COMMENTS_LANG = getattr(settings, 'HELPDESK_TRANSLATE_TICKET_COMMENTS_LANG', ["en", "de", "fr", "ru"]) +# allow user to override default layout for 'followups' - work in progress. +HELPDESK_FOLLOWUP_MOD = getattr(settings, 'HELPDESK_FOLLOWUP_MOD', False) + + ''' options for public pages ''' # show 'view a ticket' section on public page? diff --git a/helpdesk/static/helpdesk/helpdesk.css b/helpdesk/static/helpdesk/helpdesk.css index 638ee98d..d52f420d 100644 --- a/helpdesk/static/helpdesk/helpdesk.css +++ b/helpdesk/static/helpdesk/helpdesk.css @@ -153,22 +153,34 @@ td { background-color: #bcd4ec; } -div.followup { +div.followup, div.followup_mod { width: 100%; border-top: solid #666 1px; padding:0 0 2px; } -div.followup .title { +div.followup_mod { + border: solid #666 1px; + padding: 5px; + margin: 0px 0px 10px; +} + +div.followup .title, div.followup_mod .title { font-weight: bold; font-size: 10pt; } -div.followup .title span { +div.followup .title span, div.followup_mod .title span { color: #aaa; font-weight: normal; } +div.followup_mod small { + float: right; + font-weight: bold; + font-style: italic; +} + span.private { color: #aaa; font-style: italic; diff --git a/helpdesk/templates/helpdesk/ticket.html b/helpdesk/templates/helpdesk/ticket.html index 5f7fbc36..e3f4cb15 100644 --- a/helpdesk/templates/helpdesk/ticket.html +++ b/helpdesk/templates/helpdesk/ticket.html @@ -52,15 +52,28 @@

{% trans "Follow-Ups" %}

{% load ticket_to_link %} {% for followup in ticket.followup_set.all %} -
-
- {{ followup.title }} - {% if helpdesk_settings.HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP %} - {% if followup.user and request.user == followup.user and not followup.ticketchange_set.all %} - Edit - {% endif %} - {% endif %} -
+{% if helpdesk_settings.HELPDESK_FOLLOWUP_MOD %} +
+
+ {{ followup.title }} + {% if not followup.public %} ({% trans "Private" %}){% endif %} + {% if helpdesk_settings.HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP %} + {% if followup.user and request.user == followup.user and not followup.ticketchange_set.all %} + Edit + {% endif %} + {% endif %} +
+{% else %} +
+
+ {{ followup.title }} + {% if helpdesk_settings.HELPDESK_SHOW_EDIT_BUTTON_FOLLOW_UP %} + {% if followup.user and request.user == followup.user and not followup.ticketchange_set.all %} + Edit + {% endif %} + {% endif %} +
+{% endif %} {% if followup.comment %}{{ followup.comment|force_escape|urlizetrunc:50|num_to_link|linebreaksbr }}{% endif %} {% for change in followup.ticketchange_set.all %} {% if forloop.first %}
    {% endif %} From 4b0b6287244e8b67269cfc952780540e8b540a77 Mon Sep 17 00:00:00 2001 From: Andreas Kotowicz Date: Wed, 23 Nov 2011 19:56:36 +0100 Subject: [PATCH 05/27] hide "log in" button on '/helpdesk/login/' page. modify "log in" redirect if possbible, so that user lands on same ticket (instead of dashboard) after login. --- helpdesk/templates/helpdesk/navigation.html | 4 ++-- helpdesk/views/public.py | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/helpdesk/templates/helpdesk/navigation.html b/helpdesk/templates/helpdesk/navigation.html index 6fc52b0d..4cc2ea89 100644 --- a/helpdesk/templates/helpdesk/navigation.html +++ b/helpdesk/templates/helpdesk/navigation.html @@ -28,8 +28,8 @@
  • {% trans "Submit A Ticket" %}
  • {% endif %} {% if helpdesk_settings.HELPDESK_KB_ENABLED %}
  • {% trans "Knowledgebase" %}
  • {% endif %} -{% if not helpdesk_settings.HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT or user.is_authenticated %} -
  • {% if user.is_authenticated %}{% trans "Logout" %}{% else %}{% trans "Log In" %}{% endif %}
  • +{% if not request.path == '/helpdesk/login/' or user.is_authenticated %} +
  • {% if user.is_authenticated %}{% trans "Logout" %}{% else %}{% trans "Log In" %}{% endif %}
  • {% endif %}
{% endif %} diff --git a/helpdesk/views/public.py b/helpdesk/views/public.py index e7ee1682..d3506e9e 100644 --- a/helpdesk/views/public.py +++ b/helpdesk/views/public.py @@ -111,10 +111,16 @@ def view_ticket(request): return update_ticket(request, ticket_id, public=True) + # redirect user back to this ticket if possible. + redirect_url = '' + if helpdesk_settings.HELPDESK_NAVIGATION_ENABLED: + redirect_url = reverse('helpdesk_view', args=[ticket_id]) + return render_to_response('helpdesk/public_view_ticket.html', RequestContext(request, { 'ticket': ticket, 'helpdesk_settings': helpdesk_settings, + 'next': redirect_url, })) return render_to_response('helpdesk/public_view_form.html', From 1eb0760f3267e806ccb81953c9ea7625257cc976 Mon Sep 17 00:00:00 2001 From: Andreas Kotowicz Date: Wed, 23 Nov 2011 19:57:11 +0100 Subject: [PATCH 06/27] redirect user to 'helpdesk_home' from /helpdesk/login/ page, if user is already authenticated. --- .../helpdesk/registration/login.html | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/helpdesk/templates/helpdesk/registration/login.html b/helpdesk/templates/helpdesk/registration/login.html index 0dba9ad4..b97a8249 100644 --- a/helpdesk/templates/helpdesk/registration/login.html +++ b/helpdesk/templates/helpdesk/registration/login.html @@ -2,19 +2,24 @@ {% block helpdesk_title %}{% trans "Helpdesk Login" %}{% endblock %} {% block helpdesk_body %} -

{% trans "Login" %}

-

{% trans "To log in and begin responding to cases, simply enter your username and password below." %}

+{% if request.user.is_authenticated %} + +{% else %} +

{% trans "Login" %}

-
- {% if form.errors %}

{% trans "Your username and password didn't match. Please try again." %}

{% endif %} -
-
-
{{ form.username }}
-
-
{{ form.password }}
-
- - -{% csrf_token %} +

{% trans "To log in and begin responding to cases, simply enter your username and password below." %}

+ +
+ {% if form.errors %}

{% trans "Your username and password didn't match. Please try again." %}

{% endif %} +
+
+
{{ form.username }}
+
+
{{ form.password }}
+
+ + + {% csrf_token %} +{% endif %} {% endblock %} From 45620f96d0046953f56b151976da452acc79dc71 Mon Sep 17 00:00:00 2001 From: Andreas Kotowicz Date: Wed, 23 Nov 2011 20:12:27 +0100 Subject: [PATCH 07/27] new setting: HELPDESK_PREPEND_ORG_NAME customize helpdesk name on a few pages, i.e., your organization, so that users know that they came to the right page. --- helpdesk/settings.py | 3 +++ helpdesk/templates/helpdesk/dashboard.html | 2 +- helpdesk/templates/helpdesk/public_base.html | 4 ++-- helpdesk/templates/helpdesk/registration/login.html | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/helpdesk/settings.py b/helpdesk/settings.py index fa61e230..b0c9d825 100644 --- a/helpdesk/settings.py +++ b/helpdesk/settings.py @@ -32,6 +32,9 @@ if type(DEFAULT_USER_SETTINGS) != type(dict()): # redirect to login page instead of the default homepage when users visits "/"? HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT = getattr(settings, 'HELPDESK_REDIRECT_TO_LOGIN_BY_DEFAULT', False) +# customize helpdesk name on a few pages, i.e., your organization. +HELPDESK_PREPEND_ORG_NAME = getattr(settings, 'HELPDESK_PREPEND_ORG_NAME', False) + # show knowledgebase links? HELPDESK_KB_ENABLED = getattr(settings, 'HELPDESK_KB_ENABLED', True) diff --git a/helpdesk/templates/helpdesk/dashboard.html b/helpdesk/templates/helpdesk/dashboard.html index bb2094fc..2c3715d7 100644 --- a/helpdesk/templates/helpdesk/dashboard.html +++ b/helpdesk/templates/helpdesk/dashboard.html @@ -1,5 +1,5 @@ {% extends "helpdesk/base.html" %}{% load i18n %} -{% block helpdesk_title %}{% trans "Helpdesk Dashboard" %}{% endblock %} +{% block helpdesk_title %}{{ helpdesk_settings.HELPDESK_PREPEND_ORG_NAME|default:'' }} {% trans "Helpdesk Dashboard" %}{% endblock %} {% block helpdesk_head %} {% endblock %} diff --git a/helpdesk/templates/helpdesk/public_base.html b/helpdesk/templates/helpdesk/public_base.html index 4522cfd1..887656f6 100644 --- a/helpdesk/templates/helpdesk/public_base.html +++ b/helpdesk/templates/helpdesk/public_base.html @@ -3,7 +3,7 @@ {% with request|load_helpdesk_settings as helpdesk_settings %} -{% block helpdesk_title %}{% trans "Helpdesk" %}{% endblock %} +{% block helpdesk_title %}{{ helpdesk_settings.HELPDESK_PREPEND_ORG_NAME|default:'' }} {% trans "Helpdesk" %}{% endblock %} {% block helpdesk_head %}{% endblock %} @@ -11,7 +11,7 @@
diff --git a/helpdesk/templates/helpdesk/registration/login.html b/helpdesk/templates/helpdesk/registration/login.html index b97a8249..5f15a4d0 100644 --- a/helpdesk/templates/helpdesk/registration/login.html +++ b/helpdesk/templates/helpdesk/registration/login.html @@ -1,5 +1,5 @@ {% extends "helpdesk/public_base.html" %}{% load i18n %} -{% block helpdesk_title %}{% trans "Helpdesk Login" %}{% endblock %} +{% block helpdesk_title %}{{ helpdesk_settings.HELPDESK_PREPEND_ORG_NAME|default:'' }} {% trans "Helpdesk Login" %}{% endblock %} {% block helpdesk_body %} From d876c1be13a23479884f8e122174ce2f29da88bd Mon Sep 17 00:00:00 2001 From: Andreas Kotowicz Date: Thu, 24 Nov 2011 13:29:54 +0100 Subject: [PATCH 08/27] css fix for followup_mod being too wide. --- helpdesk/static/helpdesk/helpdesk.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/helpdesk/static/helpdesk/helpdesk.css b/helpdesk/static/helpdesk/helpdesk.css index d52f420d..a37c2b8c 100644 --- a/helpdesk/static/helpdesk/helpdesk.css +++ b/helpdesk/static/helpdesk/helpdesk.css @@ -153,13 +153,14 @@ td { background-color: #bcd4ec; } -div.followup, div.followup_mod { +div.followup { width: 100%; border-top: solid #666 1px; padding:0 0 2px; } div.followup_mod { + width: auto; border: solid #666 1px; padding: 5px; margin: 0px 0px 10px; From 1c3a7a8a7bf0c12f7b900985e1d00c4f45839c96 Mon Sep 17 00:00:00 2001 From: Andreas Kotowicz Date: Thu, 24 Nov 2011 13:30:45 +0100 Subject: [PATCH 09/27] add option 'HELPDESK_SHOW_CHANGE_PASSWORD' so that local users find a link to change their password. (needs django-registration https://bitbucket.org/ubernostrum/django-registration/). --- helpdesk/settings.py | 3 +++ helpdesk/templates/helpdesk/user_settings.html | 14 ++++++++++++-- helpdesk/views/staff.py | 7 +++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/helpdesk/settings.py b/helpdesk/settings.py index b0c9d825..7cd1765b 100644 --- a/helpdesk/settings.py +++ b/helpdesk/settings.py @@ -55,6 +55,9 @@ HELPDESK_TRANSLATE_TICKET_COMMENTS = getattr(settings, 'HELPDESK_TRANSLATE_TICKE # list of languages to offer. if set to false, all default google translate languages will be shown. HELPDESK_TRANSLATE_TICKET_COMMENTS_LANG = getattr(settings, 'HELPDESK_TRANSLATE_TICKET_COMMENTS_LANG', ["en", "de", "fr", "ru"]) +# show link to 'change password' on 'User Settings' page? +HELPDESK_SHOW_CHANGE_PASSWORD = getattr(settings, 'HELPDESK_SHOW_CHANGE_PASSWORD', False) + # allow user to override default layout for 'followups' - work in progress. HELPDESK_FOLLOWUP_MOD = getattr(settings, 'HELPDESK_FOLLOWUP_MOD', False) diff --git a/helpdesk/templates/helpdesk/user_settings.html b/helpdesk/templates/helpdesk/user_settings.html index 45cd659a..19cf72c4 100644 --- a/helpdesk/templates/helpdesk/user_settings.html +++ b/helpdesk/templates/helpdesk/user_settings.html @@ -2,10 +2,20 @@ {% block helpdesk_title %}{% trans "Change User Settings" %}{% endblock %} -{% block helpdesk_body %}{% blocktrans %} +{% block helpdesk_body %} +{% if show_password_change_link %} +{% url auth_password_change as password_change_url %} +

Change Password

+

+Change your password here. +

+{% endif %} + +{% blocktrans %}

User Settings

-

Use the following options to change the way your helpdesk system works for you. These settings do not impact any other user.

{% endblocktrans %} +

Use the following options to change the way your helpdesk system works for you. These settings do not impact any other user.

+{% endblocktrans %}
diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index 44e9722c..17af2ad2 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -1004,9 +1004,16 @@ def user_settings(request): else: form = UserSettingsForm(s.settings) + user = User.objects.get(id = request.user.id) + show_password_change_link = 0 + # we don't want non-local users to see the 'change password' link. + if helpdesk_settings.HELPDESK_SHOW_CHANGE_PASSWORD and user.has_usable_password(): + show_password_change_link = 1 + return render_to_response('helpdesk/user_settings.html', RequestContext(request, { 'form': form, + 'show_password_change_link': show_password_change_link, })) user_settings = staff_member_required(user_settings) From ab67f1397a7427e5ced0d7a650db8aa4aff00539 Mon Sep 17 00:00:00 2001 From: Andreas Kotowicz Date: Thu, 24 Nov 2011 14:26:15 +0100 Subject: [PATCH 10/27] added toolips to 'Copies to' and 'Dependencies' links, explaining what these links are for. added a.tooltip class to css file. --- helpdesk/static/helpdesk/helpdesk.css | 31 +++++++++++++++++++ .../templates/helpdesk/ticket_desc_table.html | 4 +-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/helpdesk/static/helpdesk/helpdesk.css b/helpdesk/static/helpdesk/helpdesk.css index a37c2b8c..48b434d2 100644 --- a/helpdesk/static/helpdesk/helpdesk.css +++ b/helpdesk/static/helpdesk/helpdesk.css @@ -280,3 +280,34 @@ span.priority5 { a.followup-edit { float:right; } + +/* tooltips for link hover */ +a.tooltip, a.tooltip:link, a.tooltip:visited, a.tooltip:active { + position: relative; + text-decoration: none; + font-style: italic; +} + +a.tooltip:hover { + background: transparent; +} + +a.tooltip span { + display: none; + text-decoration: none; +} + +a.tooltip:hover span { + display: block; + position: absolute; + top: 25px; + left: 0; + width: 250px; + z-index: 10; + color: #000000; + border:1px solid #000000; + background: #FFFFCC; + font: 12px Verdana, sans-serif; + text-align: left; +} + diff --git a/helpdesk/templates/helpdesk/ticket_desc_table.html b/helpdesk/templates/helpdesk/ticket_desc_table.html index 20b40b75..3535c8d8 100644 --- a/helpdesk/templates/helpdesk/ticket_desc_table.html +++ b/helpdesk/templates/helpdesk/ticket_desc_table.html @@ -34,7 +34,7 @@
- + {% if tags_enabled %} @@ -53,7 +53,7 @@ {% empty %}

{% trans "This ticket has no dependencies." %}

{% endfor %} -

{% trans "Add Dependency" %}

+

{% trans "Add Dependency" %}{% trans "Click on 'Add Dependency', if you want to make this ticket dependent on another ticket. A ticket may not be closed until all tickets it depends on are closed." %}

From d27e4a0178b334512b8c90a89953e0f22cfbda80 Mon Sep 17 00:00:00 2001 From: Andreas Kotowicz Date: Thu, 24 Nov 2011 15:25:48 +0100 Subject: [PATCH 11/27] change search box padding, otherwise the bottom of the searchbox will not be aligned with the buttons on the left. --- helpdesk/static/helpdesk/helpdesk.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpdesk/static/helpdesk/helpdesk.css b/helpdesk/static/helpdesk/helpdesk.css index 48b434d2..85034e9d 100644 --- a/helpdesk/static/helpdesk/helpdesk.css +++ b/helpdesk/static/helpdesk/helpdesk.css @@ -43,7 +43,7 @@ table { border: solid #444 1px; background-color: #fff; color: #ccc; - padding: 2px 3px; + padding: 0px 3px; margin: 0px 2px; font-size: 10pt; line-height: 12pt; From 5a92dafbdcce700d938d8eb1479d715f7ed0936c Mon Sep 17 00:00:00 2001 From: Andreas Kotowicz Date: Sun, 27 Nov 2011 09:26:56 +0100 Subject: [PATCH 12/27] new option: 'HELPDESK_FOOTER_SHOW_CHANGE_LANGUAGE_LINK' If activated, a 'change language' link will be shown in the footer. You need to add this line to your 'urlpatterns' variable in your urls.py file: (r'^i18n/', include('django.conf.urls.i18n')) --- helpdesk/settings.py | 4 ++++ helpdesk/templates/helpdesk/base.html | 3 +++ .../helpdesk/public_change_language.html | 19 +++++++++++++++++++ helpdesk/urls.py | 4 ++++ helpdesk/views/public.py | 3 +++ 5 files changed, 33 insertions(+) create mode 100644 helpdesk/templates/helpdesk/public_change_language.html diff --git a/helpdesk/settings.py b/helpdesk/settings.py index 7cd1765b..e5a4696c 100644 --- a/helpdesk/settings.py +++ b/helpdesk/settings.py @@ -100,3 +100,7 @@ HELPDESK_DASHBOARD_SHOW_DELETE_UNASSIGNED = getattr(settings, 'HELPDESK_DASHBOAR ''' options for footer ''' # show 'API' link at bottom of page HELPDESK_FOOTER_SHOW_API_LINK = getattr(settings, 'HELPDESK_FOOTER_SHOW_API_LINK', True) + +# show / hide 'change language' link at bottom of page +HELPDESK_FOOTER_SHOW_CHANGE_LANGUAGE_LINK = getattr(settings, 'HELPDESK_FOOTER_SHOW_CHANGE_LANGUAGE_LINK', False) + diff --git a/helpdesk/templates/helpdesk/base.html b/helpdesk/templates/helpdesk/base.html index 3c550a2c..f5425bb6 100644 --- a/helpdesk/templates/helpdesk/base.html +++ b/helpdesk/templates/helpdesk/base.html @@ -98,6 +98,9 @@ {% trans "RSS Icon" %}{% trans "RSS Feeds" %} {% if helpdesk_settings.HELPDESK_FOOTER_SHOW_API_LINK %}{% trans "API" %}{% endif %} {% trans "User Settings" %} + {% if helpdesk_settings.HELPDESK_FOOTER_SHOW_CHANGE_LANGUAGE_LINK %} + {% trans "Change Language" %} + {% endif %} {% if user.is_superuser %}{% trans "System Settings" %}{% endif %}

diff --git a/helpdesk/templates/helpdesk/public_change_language.html b/helpdesk/templates/helpdesk/public_change_language.html new file mode 100644 index 00000000..ead9b2fc --- /dev/null +++ b/helpdesk/templates/helpdesk/public_change_language.html @@ -0,0 +1,19 @@ +{% extends "helpdesk/public_base.html" %}{% load i18n %} +{% block helpdesk_title %}{% trans "View a Ticket" %}{% endblock %} + +{% block helpdesk_body %} + +

{% trans "Change the display language" %}

+ + {% csrf_token %} + + + + + +{% endblock %} diff --git a/helpdesk/urls.py b/helpdesk/urls.py index 0e950d55..7c059be4 100644 --- a/helpdesk/urls.py +++ b/helpdesk/urls.py @@ -134,6 +134,10 @@ urlpatterns += patterns('helpdesk.views.public', url(r'^view/$', 'view_ticket', name='helpdesk_public_view'), + + url(r'^change_language/$', + 'change_language', + name='helpdesk_public_change_language'), ) urlpatterns += patterns('', diff --git a/helpdesk/views/public.py b/helpdesk/views/public.py index d3506e9e..3f77ad37 100644 --- a/helpdesk/views/public.py +++ b/helpdesk/views/public.py @@ -131,3 +131,6 @@ def view_ticket(request): 'helpdesk_settings': helpdesk_settings, })) +def change_language(request): + return render_to_response('helpdesk/public_change_language.html', + RequestContext(request, {})) From eaf78115d24219e99fd3bca5668fd8b0375ef556 Mon Sep 17 00:00:00 2001 From: Andreas Kotowicz Date: Sun, 27 Nov 2011 09:43:51 +0100 Subject: [PATCH 13/27] send user back to the same page before changing the display language. --- helpdesk/templates/helpdesk/base.html | 2 +- helpdesk/templates/helpdesk/public_change_language.html | 2 +- helpdesk/views/public.py | 6 +++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/helpdesk/templates/helpdesk/base.html b/helpdesk/templates/helpdesk/base.html index f5425bb6..e437de2d 100644 --- a/helpdesk/templates/helpdesk/base.html +++ b/helpdesk/templates/helpdesk/base.html @@ -99,7 +99,7 @@ {% if helpdesk_settings.HELPDESK_FOOTER_SHOW_API_LINK %}{% trans "API" %}{% endif %} {% trans "User Settings" %} {% if helpdesk_settings.HELPDESK_FOOTER_SHOW_CHANGE_LANGUAGE_LINK %} - {% trans "Change Language" %} + {% trans "Change Language" %} {% endif %} {% if user.is_superuser %}{% trans "System Settings" %}{% endif %}

diff --git a/helpdesk/templates/helpdesk/public_change_language.html b/helpdesk/templates/helpdesk/public_change_language.html index ead9b2fc..5d872773 100644 --- a/helpdesk/templates/helpdesk/public_change_language.html +++ b/helpdesk/templates/helpdesk/public_change_language.html @@ -6,7 +6,7 @@

{% trans "Change the display language" %}

{% csrf_token %} - +
{{ ticket.id }}. {{ ticket.title }} [{{ ticket.get_status }}] EditDelete{% if ticket.on_hold %}{% trans "Unhold" %}{% else %}{% trans "Hold" %}{% endif %}
{{ ticket.id }}. {{ ticket.title }} [{{ ticket.get_status }}] + {% if helpdesk_settings.HELPDESK_SHOW_EDIT_BUTTON_TICKET_TOP %} + Edit + {% endif %} + {% if helpdesk_settings.HELPDESK_SHOW_DELETE_BUTTON_TICKET_TOP %} + Delete + {% endif %} + {% if helpdesk_settings.HELPDESK_SHOW_HOLD_BUTTON_TICKET_TOP %} + {% if ticket.on_hold %}{% trans "Unhold" %}{% else %}{% trans "Hold" %}{% endif %} + {% endif %}
{% blocktrans with ticket.queue as queue %}Queue: {{ queue }}{% endblocktrans %}
{% trans "Copies To" %}{% for ticketcc in ticket.ticketcc_set.all %}{{ ticketcc.display }}{% if not forloop.last %}, {% endif %}{% endfor %} {% trans "Manage" %}{% for ticketcc in ticket.ticketcc_set.all %}{{ ticketcc.display }}{% if not forloop.last %}, {% endif %}{% endfor %} {% trans "Manage" %}{% trans "Click here to add / remove people who should receive an e-mail whenever this ticket is updated." %}
+{% if helpdesk_settings.HELPDESK_CUSTOM_WELCOME %} +

{% trans "Welcome to your Helpdesk Dashboard! From here you can quickly see tickets submitted by you, tickets you are working on, and those tickets that have no owner. Why not pick up an orphan ticket and sort it out for a customer?" %}

+{% else %}

{% trans "Welcome to your Helpdesk Dashboard! From here you can quickly see your own tickets, and those tickets that have no owner. Why not pick up an orphan ticket and sort it out for a customer?" %}

+{% endif %} + + + +{% if all_tickets_reported_by_current_user %} +
+ + + + +{% for ticket in all_tickets_reported_by_current_user %} + + + + + + + + +{% endfor %} +
{% trans "All Tickets submitted by you" %}
#{% trans "Pr" %}{% trans "Title" %}{% trans "Queue" %}{% trans "Status" %}{% trans "Last Update" %}
{{ ticket.ticket }}{{ ticket.get_priority_span }}{{ ticket.title }}{{ ticket.queue }}{{ ticket.get_status }}{{ ticket.modified|timesince }}
+{% endif %} + +
- + {% for ticket in user_tickets %} @@ -43,7 +70,7 @@
{% trans "Your Open Tickets" %}
{% trans "Open Tickets assigned to you (you are working on this ticket)" %}
#{% trans "Pr" %}{% trans "Title" %}{% trans "Queue" %}{% trans "Status" %}{% trans "Last Update" %}
- + {% for ticket in unassigned_tickets %} @@ -65,7 +92,7 @@
{% trans "Unassigned Tickets" %}
{% trans "Unassigned Tickets" %} {% trans "(pick up a ticket if you start to work on it)" %}
#{% trans "Pr" %}{% trans "Title" %}{% trans "Queue" %}{% trans "Created" %} 
- + {% for ticket in user_tickets_closed_resolved %} diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index 5a955f8f..b4fef2d7 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -51,14 +51,14 @@ def dashboard(request): with options for them to 'Take' ownership of said tickets. """ - # open & reopened tickets + # open & reopened tickets, assigned to current user tickets = Ticket.objects.filter( assigned_to=request.user, ).exclude( status__in = [Ticket.CLOSED_STATUS, Ticket.RESOLVED_STATUS], ) - # closed & resolved tickets + # closed & resolved tickets, assigned to current user tickets_closed_resolved = Ticket.objects.filter( assigned_to=request.user, status__in = [Ticket.CLOSED_STATUS, Ticket.RESOLVED_STATUS]) @@ -69,6 +69,15 @@ def dashboard(request): status=Ticket.CLOSED_STATUS, ) + # all tickets, reported by current user + all_tickets_reported_by_current_user = '' + email_current_user = request.user.email + if email_current_user: + all_tickets_reported_by_current_user = Ticket.objects.filter( + submitter_email=email_current_user, + ).order_by('status') + + # The following query builds a grid of queues & ticket statuses, # to be displayed to the user. EG: # Open Resolved @@ -95,6 +104,7 @@ def dashboard(request): 'user_tickets': tickets, 'user_tickets_closed_resolved': tickets_closed_resolved, 'unassigned_tickets': unassigned_tickets, + 'all_tickets_reported_by_current_user': all_tickets_reported_by_current_user, 'dash_tickets': dash_tickets, })) dashboard = staff_member_required(dashboard) From f823b72db6e79a4596f283c652ec69a4009e8af2 Mon Sep 17 00:00:00 2001 From: Andreas Kotowicz Date: Tue, 29 Nov 2011 15:07:44 +0100 Subject: [PATCH 18/27] css fixes: - fix space problems between helpdesk lists and welcome text. in languages other then English, these two used to overlap. - make search input field smaller, so that there is no ugly 'out-of-space' artifact, when 'saved queries' exist and the buttons wrap into the 'helpdesk' h1. --- helpdesk/templates/helpdesk/dashboard.html | 11 +++++++---- helpdesk/templates/helpdesk/navigation.html | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/helpdesk/templates/helpdesk/dashboard.html b/helpdesk/templates/helpdesk/dashboard.html index 283277c2..39adc7d3 100644 --- a/helpdesk/templates/helpdesk/dashboard.html +++ b/helpdesk/templates/helpdesk/dashboard.html @@ -5,7 +5,8 @@ {% endblock %} {% block helpdesk_body %} -
{% trans "Your closed & resolved Tickets" %}
{% trans "Closed & resolved Tickets you used to work on" %}
#{% trans "Pr" %}{% trans "Title" %}{% trans "Queue" %}{% trans "Status" %}{% trans "Last Update" %}
+
+
{% for queue in dash_tickets %} @@ -17,13 +18,15 @@ {% endfor %}
{% trans "Helpdesk Summary" %}
{% trans "Queue" %}{% trans "Open" %}{% trans "Resolved" %}{% trans "Closed" %}
+ +
{% if helpdesk_settings.HELPDESK_CUSTOM_WELCOME %} -

{% trans "Welcome to your Helpdesk Dashboard! From here you can quickly see tickets submitted by you, tickets you are working on, and those tickets that have no owner. Why not pick up an orphan ticket and sort it out for a customer?" %}

+

{% trans "Welcome to your Helpdesk Dashboard! From here you can quickly see tickets submitted by you, tickets you are working on, and those tickets that have no owner. Why not pick up an orphan ticket and sort it out for a customer?" %}

{% else %} -

{% trans "Welcome to your Helpdesk Dashboard! From here you can quickly see your own tickets, and those tickets that have no owner. Why not pick up an orphan ticket and sort it out for a customer?" %}

+

{% trans "Welcome to your Helpdesk Dashboard! From here you can quickly see your own tickets, and those tickets that have no owner. Why not pick up an orphan ticket and sort it out for a customer?" %}

{% endif %} - +
{% if all_tickets_reported_by_current_user %} diff --git a/helpdesk/templates/helpdesk/navigation.html b/helpdesk/templates/helpdesk/navigation.html index 4cc2ea89..3393f450 100644 --- a/helpdesk/templates/helpdesk/navigation.html +++ b/helpdesk/templates/helpdesk/navigation.html @@ -20,7 +20,7 @@ {% endif %}
  • {% trans "Logout" %}
  • - {% if not query %}
  • {% csrf_token %}
  • {% endif %} + {% if not query %}
  • {% csrf_token %}
  • {% endif %} {% else %}