diff --git a/LICENSE.3RDPARTY b/LICENSE.3RDPARTY index a42ffa6a..ecc88b72 100644 --- a/LICENSE.3RDPARTY +++ b/LICENSE.3RDPARTY @@ -1,5 +1,5 @@ This file contains license details for 3rd party software which is -distributed with Jutda Helpdesk. +distributed with django-helpdesk. 1. License for jQuery & jQuery UI 2. License for jQuery UI 'Smoothness' theme diff --git a/helpdesk/forms.py b/helpdesk/forms.py index ecadc515..ca86dd5d 100644 --- a/helpdesk/forms.py +++ b/helpdesk/forms.py @@ -77,7 +77,7 @@ class EditTicketForm(CustomFieldMixin, forms.ModelForm): class Meta: model = Ticket exclude = ('created', 'modified', 'status', 'on_hold', 'resolution', 'last_escalation', 'assigned_to') - + def __init__(self, *args, **kwargs): """ Add any custom fields that are defined to the form @@ -101,7 +101,7 @@ class EditTicketForm(CustomFieldMixin, forms.ModelForm): def save(self, *args, **kwargs): - + for field, value in self.cleaned_data.items(): if field.startswith('custom_'): field_name = field.replace('custom_', '', 1) @@ -112,7 +112,7 @@ class EditTicketForm(CustomFieldMixin, forms.ModelForm): cfv = TicketCustomFieldValue(ticket=self.instance, field=customfield) cfv.value = value cfv.save() - + return super(EditTicketForm, self).save(*args, **kwargs) @@ -228,7 +228,7 @@ class TicketForm(CustomFieldMixin, forms.Form): except User.DoesNotExist: t.assigned_to = None t.save() - + for field, value in self.cleaned_data.items(): if field.startswith('custom_'): field_name = field.replace('custom_', '', 1) @@ -251,7 +251,7 @@ class TicketForm(CustomFieldMixin, forms.Form): } f.save() - + files = [] if self.cleaned_data['attachment']: import mimetypes @@ -265,9 +265,9 @@ class TicketForm(CustomFieldMixin, forms.Form): ) a.file.save(file.name, file, save=False) a.save() - + if file.size < getattr(settings, 'MAX_EMAIL_ATTACHMENT_SIZE', 512000): - # Only files smaller than 512kb (or as defined in + # Only files smaller than 512kb (or as defined in # settings.MAX_EMAIL_ATTACHMENT_SIZE) are sent via email. try: files.append([a.filename, a.file]) @@ -276,7 +276,7 @@ class TicketForm(CustomFieldMixin, forms.Form): context = safe_template_context(t) context['comment'] = f.comment - + messages_sent_to = [] if t.submitter_email: @@ -443,9 +443,9 @@ class PublicTicketForm(CustomFieldMixin, forms.Form): ) a.file.save(file.name, file, save=False) a.save() - + if file.size < getattr(settings, 'MAX_EMAIL_ATTACHMENT_SIZE', 512000): - # Only files smaller than 512kb (or as defined in + # Only files smaller than 512kb (or as defined in # settings.MAX_EMAIL_ATTACHMENT_SIZE) are sent via email. files.append([a.filename, a.file]) @@ -523,12 +523,11 @@ class UserSettingsForm(forms.Form): required=False, ) - tickets_per_page = forms.IntegerField( + tickets_per_page = forms.ChoiceField( label=_('Number of tickets to show per page'), help_text=_('How many tickets do you want to see on the Ticket List page?'), required=False, - min_value=1, - max_value=1000, + choices=((10,'10'),(25,'25'),(50,'50'),(100,'100')), ) use_email_as_submitter = forms.BooleanField( @@ -543,17 +542,39 @@ class EmailIgnoreForm(forms.ModelForm): exclude = [] class TicketCCForm(forms.ModelForm): + ''' Adds either an email address or helpdesk user as a CC on a Ticket. Used for processing POST requests. ''' def __init__(self, *args, **kwargs): super(TicketCCForm, self).__init__(*args, **kwargs) if helpdesk_settings.HELPDESK_STAFF_ONLY_TICKET_CC: users = User.objects.filter(is_active=True, is_staff=True).order_by(User.USERNAME_FIELD) else: users = User.objects.filter(is_active=True).order_by(User.USERNAME_FIELD) - self.fields['user'].queryset = users + self.fields['user'].queryset = users class Meta: model = TicketCC exclude = ('ticket',) +class TicketCCUserForm(forms.ModelForm): + ''' Adds a helpdesk user as a CC on a Ticket ''' + def __init__(self, *args, **kwargs): + super(TicketCCUserForm, self).__init__(*args, **kwargs) + if helpdesk_settings.HELPDESK_STAFF_ONLY_TICKET_CC: + users = User.objects.filter(is_active=True, is_staff=True).order_by(User.USERNAME_FIELD) + else: + users = User.objects.filter(is_active=True).order_by(User.USERNAME_FIELD) + self.fields['user'].queryset = users + class Meta: + model = TicketCC + exclude = ('ticket','email',) + +class TicketCCEmailForm(forms.ModelForm): + ''' Adds an email address as a CC on a Ticket ''' + def __init__(self, *args, **kwargs): + super(TicketCCEmailForm, self).__init__(*args, **kwargs) + class Meta: + model = TicketCC + exclude = ('ticket','user',) + class TicketDependencyForm(forms.ModelForm): class Meta: model = TicketDependency diff --git a/helpdesk/static/helpdesk/helpdesk-extend.css b/helpdesk/static/helpdesk/helpdesk-extend.css index ddc23fcb..e2c0e59a 100644 --- a/helpdesk/static/helpdesk/helpdesk-extend.css +++ b/helpdesk/static/helpdesk/helpdesk-extend.css @@ -2,6 +2,26 @@ Bootstrap overrides */ +.btn-file { + position: relative; + overflow: hidden; +} +.btn-file input[type=file] { + position: absolute; + top: 0; + right: 0; + min-width: 100%; + min-height: 100%; + font-size: 100px; + text-align: right; + filter: alpha(opacity=0); + opacity: 0; + outline: none; + background: white; + cursor: inherit; + display: block; +} + .thumbnail.filterBox { display: none; float: left; @@ -52,4 +72,4 @@ Add your custom styles here padding: 10px 0; } #helpdesk-body {padding-top: 100px;} -img.brand {padding-right: 30px;} \ No newline at end of file +img.brand {padding-right: 30px;} diff --git a/helpdesk/templates/helpdesk/base.html b/helpdesk/templates/helpdesk/base.html index 45eba476..8c53fff8 100644 --- a/helpdesk/templates/helpdesk/base.html +++ b/helpdesk/templates/helpdesk/base.html @@ -27,10 +27,6 @@ - - - - {% if helpdesk_settings.HELPDESK_USE_CDN %} @@ -38,6 +34,16 @@ {% endif %} + + + + + + + + + + @@ -47,7 +53,7 @@ {% else %} {% endif %} - + {% if helpdesk_settings.HELPDESK_USE_CDN %} @@ -56,6 +62,14 @@ {% endif %} + + + + + + + + diff --git a/helpdesk/templates/helpdesk/include/unassigned.html b/helpdesk/templates/helpdesk/include/unassigned.html index ba4e3d57..266615d3 100644 --- a/helpdesk/templates/helpdesk/include/unassigned.html +++ b/helpdesk/templates/helpdesk/include/unassigned.html @@ -28,7 +28,7 @@ {{ ticket.title }} {{ ticket.queue }} {{ ticket.created|naturaltime }} - {% trans "Take" %} | {% trans "Delete" %} + | {% empty %} {% trans "There are no unassigned tickets." %} diff --git a/helpdesk/templates/helpdesk/ticket.html b/helpdesk/templates/helpdesk/ticket.html index 5f095b6d..92c9863a 100644 --- a/helpdesk/templates/helpdesk/ticket.html +++ b/helpdesk/templates/helpdesk/ticket.html @@ -11,7 +11,6 @@ $(document).ready(function() { return false; }); - processAddFileClick(); $("#ShowFileUpload").click(function() { $("#FileUpload").fadeIn(); $("#ShowFileUploadPara").hide(); @@ -28,19 +27,37 @@ $(document).ready(function() { }); $("[data-toggle=tooltip]").tooltip(); -}); -function processAddFileClick() { - /* Until jQuery includes some 'livequery' functionality in the core - distribution, this will have to do. */ - $(".AddAnotherFile>a").click(function() { - $(this).parent().remove(); - $("#FileUpload>dl").append("
({% trans "Add Another File" %})
"); - processAddFileClick(); - return false; + // for CSS customized file select/browse button + $(':file').on('fileselect', function(event, numFiles, label, browseButtonNum) { + $("#selectedfilename"+browseButtonNum).html(label); }); -} + var x = 0; + var wrapper = $(".input_fields_wrap"); //Fields wrapper + var add_button = $(".add_field_button"); //Add button ID + + $(add_button).click(function(e){ //on add input button click + x++; + e.preventDefault(); + $(wrapper).append("
 {% trans 'No files selected.' %}
"); //add input box + + $(document).on('change', '#file'+x, function() { + var input = $(this), + numFiles = input.get(0).files ? input.get(0).files.length : 1, + label = input.val().replace(/\\/g, '/').replace(/.*\//, ''); + input.trigger('fileselect', [numFiles, label, x]); + }); + }); + +}); + +$(document).on('change', '#file0', function() { + var input = $(this), + numFiles = input.get(0).files ? input.get(0).files.length : 1, + label = input.val().replace(/\\/g, '/').replace(/.*\//, ''); + input.trigger('fileselect', [numFiles, label, 0]); +}); {% endblock %} @@ -99,7 +116,7 @@ function processAddFileClick() { {% for attachment in followup.attachment_set.all %}{% if forloop.first %}
{% endif %} @@ -165,7 +182,7 @@ function processAddFileClick() { {% endif %} -

+

-

+

- + {% csrf_token %} diff --git a/helpdesk/templates/helpdesk/ticket_attachment_del.html b/helpdesk/templates/helpdesk/ticket_attachment_del.html new file mode 100644 index 00000000..6997e616 --- /dev/null +++ b/helpdesk/templates/helpdesk/ticket_attachment_del.html @@ -0,0 +1,16 @@ +{% extends "helpdesk/base.html" %}{% load i18n %} + +{% block helpdesk_title %}{% trans "Delete Ticket Attachment" %}{% endblock %} + +{% block helpdesk_body %}{% blocktrans %} +

Delete Ticket Attachment

+ +

Are you sure you wish to delete the attachment {{ filename }} from this ticket? The attachment data will be permanently deleted from the database, but the attachment itself will still exist on the server.

+{% endblocktrans %} + +

+ +
+ +{% csrf_token %}
+{% endblock %} diff --git a/helpdesk/templates/helpdesk/ticket_cc_add.html b/helpdesk/templates/helpdesk/ticket_cc_add.html index 4e6f23bd..edd724f9 100644 --- a/helpdesk/templates/helpdesk/ticket_cc_add.html +++ b/helpdesk/templates/helpdesk/ticket_cc_add.html @@ -2,24 +2,62 @@ {% block helpdesk_title %}{% trans "Add Ticket CC" %}{% endblock %} -{% block helpdesk_body %}{% blocktrans %} -

Add Ticket CC

+{% block helpdesk_body %} +

{% trans 'Add Ticket CC' %}

-

To automatically send an email to a user or e-mail address when this ticket is updated, select the user or enter an e-mail address below.

{% endblocktrans %} +
+
+
+
+ {% trans 'To automatically send an email to a user or e-mail address when this ticket is updated, select the user or enter an e-mail address below.' %} +
+ +
+ + -
- -
-
{% for field in form %} -
-
{{ field }}
- {% if field.errors %}
{{ field.errors }}
{% endif %} - {% if field.help_text %}
{{ field.help_text }}
{% endif %} - {% endfor %}
-
- - - -{% csrf_token %}
+ +
+
+

{% trans 'Add Email' %}

+
+
+
{% for field in form_email %} +
+
{{ field }}
+ {% if field.errors %}
{{ field.errors }}
{% endif %} + {% if field.help_text %}
{{ field.help_text }}
{% endif %} + {% endfor %}
+
+ + {% csrf_token %}
+
+
+

{% trans 'Add User' %}

+
+
+
{% for field in form_user %} +
+
{{ field }}
+ {% if field.errors %}
{{ field.errors }}
{% endif %} + {% if field.help_text %}
{{ field.help_text }}
{% endif %} + {% endfor %}
+
+ + {% csrf_token %}
+
+
+
+ +
+ +
+
+ {% endblock %} diff --git a/helpdesk/templates/helpdesk/ticket_dependency_del.html b/helpdesk/templates/helpdesk/ticket_dependency_del.html index 7319d5d5..8cbfa6b3 100644 --- a/helpdesk/templates/helpdesk/ticket_dependency_del.html +++ b/helpdesk/templates/helpdesk/ticket_dependency_del.html @@ -8,7 +8,9 @@

Are you sure you wish to remove the dependency on this ticket?

{% endblocktrans %} -

{% trans "Don't Delete" %}

+

-
{% csrf_token %}
+
+ +{% csrf_token %}
{% endblock %} diff --git a/helpdesk/templates/helpdesk/ticket_desc_table.html b/helpdesk/templates/helpdesk/ticket_desc_table.html index 7717f961..aec8d39b 100644 --- a/helpdesk/templates/helpdesk/ticket_desc_table.html +++ b/helpdesk/templates/helpdesk/ticket_desc_table.html @@ -13,9 +13,9 @@ diff --git a/helpdesk/templates/helpdesk/ticket_list.html b/helpdesk/templates/helpdesk/ticket_list.html index 51c685a7..17a90ac1 100644 --- a/helpdesk/templates/helpdesk/ticket_list.html +++ b/helpdesk/templates/helpdesk/ticket_list.html @@ -3,17 +3,14 @@ {% load static from staticfiles %} {% block helpdesk_title %}{% trans "Tickets" %}{% endblock %} {% block helpdesk_head %} +

{{ ticket.id }}. {{ ticket.title }} [{{ ticket.get_status }}]

- {% trans "Edit" %} - | {% trans "Delete" %} - {% if ticket.on_hold %} | {% trans "Unhold" %}{% else %} | {% trans "Hold" %}{% endif %} + + | + {% if ticket.on_hold %} | {% else %} | {% endif %}
{% blocktrans with ticket.queue as queue %}Queue: {{ queue }}{% endblocktrans %}