small fixes and translation

This commit is contained in:
maccesch 2011-09-01 13:01:03 +02:00
parent e2407151ab
commit dcec449939
7 changed files with 30 additions and 21 deletions

2
.gitignore vendored
View File

@ -3,3 +3,5 @@ dist
django_helpdesk.egg-info django_helpdesk.egg-info
docs/html/* docs/html/*
docs/doctrees/* docs/doctrees/*
.project
.pydevproject

View File

@ -41,17 +41,17 @@ Usage example::
# or you can call api.setAPIKey() # or you can call api.setAPIKey()
# #
if api.key is None: if api.key is None:
print "No 'apikey.txt' file." print >> sys.stderr, "No 'apikey.txt' file."
elif not api.verify_key(): elif not api.verify_key():
print "The API key is invalid." print >> sys.stderr, "The API key is invalid."
else: else:
# data should be a dictionary of values # data should be a dictionary of values
# They can all be filled in with defaults # They can all be filled in with defaults
# from a CGI environment # from a CGI environment
if api.comment_check(comment, data): if api.comment_check(comment, data):
print 'This comment is spam.' print >> sys.stderr, 'This comment is spam.'
else: else:
print 'This comment is ham.' print >> sys.stderr, 'This comment is ham.'
""" """

View File

@ -38,12 +38,12 @@ $(document).ready(function() {
<div id="searchtabs"> <div id="searchtabs">
<ul> <ul>
<li><a href='#tabfilter'>Query Options</a></li> <li><a href='#tabfilter'>{% trans "Query Options" %}</a></li>
{% if not from_saved_query %} {% if not from_saved_query %}
<li><a href='#tabsave'>Save This Query</a></li> <li><a href='#tabsave'>{% trans "Save This Query" %}</a></li>
{% endif %} {% endif %}
{% if user_saved_queries %} {% if user_saved_queries %}
<li><a href='#tabload'>Load Saved Query</a></li> <li><a href='#tabload'>{% trans "Load Saved Query" %}</a></li>
{% endif %} {% endif %}
</ul> </ul>
@ -66,7 +66,7 @@ $(document).ready(function() {
<form method='get' action='./'> <form method='get' action='./'>
<div class='filterBox{% if query_params.sorting %} filterBoxShow{% endif %}' id='filterBoxSort'> <div class='filterBox{% if query_params.sorting %} filterBoxShow{% endif %}' id='filterBoxSort'>
<label for='id_sort'>Sorting</label> <label for='id_sort'>{% trans "Sorting" %}</label>
<select id='id_sort' name='sort'> <select id='id_sort' name='sort'>
<option value='created'{% ifequal query_params.sorting "created"%} selected='selected'{% endifequal %}> <option value='created'{% ifequal query_params.sorting "created"%} selected='selected'{% endifequal %}>
{% trans "Created" %} {% trans "Created" %}
@ -87,9 +87,9 @@ $(document).ready(function() {
{% trans "Owner" %} {% trans "Owner" %}
</option> </option>
</select> </select>
<label for='id_sortreverse'>Reverse</label> <label for='id_sortreverse'>{% trans "Reverse" %}</label>
<input type='checkbox' name='sortreverse' id='id_sortreverse'{% if query_params.sortreverse %} checked='checked'{% endif %} /> <input type='checkbox' name='sortreverse' id='id_sortreverse'{% if query_params.sortreverse %} checked='checked'{% endif %} />
<p class='filterHelp'>Ordering applied to tickets</p> <p class='filterHelp'>{% trans "Ordering applied to tickets" %}</p>
<input type='button' class='filterBuilderRemove' value='-' /> <input type='button' class='filterBuilderRemove' value='-' />
</div> </div>
@ -98,44 +98,44 @@ $(document).ready(function() {
<select id='id_owners' name='assigned_to' multiple='selected' size='5'> <select id='id_owners' name='assigned_to' multiple='selected' size='5'>
{% for u in user_choices %} {% for u in user_choices %}
<option value='{{ u.id }}'{% if u.id|in_list:query_params.filtering.assigned_to__id__in %} selected='selected'{% endif %}> <option value='{{ u.id }}'{% if u.id|in_list:query_params.filtering.assigned_to__id__in %} selected='selected'{% endif %}>
{{ u.username }}{% ifequal u user %} (ME){% endifequal %} {{ u.username }}{% ifequal u user %} {% trans "(ME)" %}{% endifequal %}
</option> </option>
{% endfor %} {% endfor %}
</select> </select>
<p class='filterHelp'>Ctrl-Click to select multiple options</p> <p class='filterHelp'>{% trans "Ctrl-Click to select multiple options" %}</p>
<input type='button' class='filterBuilderRemove' value='-' /> <input type='button' class='filterBuilderRemove' value='-' />
</div> </div>
<div class='filterBox{% if query_params.filtering.queue__id__in %} filterBoxShow{% endif %}' id='filterBoxQueue'> <div class='filterBox{% if query_params.filtering.queue__id__in %} filterBoxShow{% endif %}' id='filterBoxQueue'>
<label for='id_queues'>{% trans "Queue(s)" %}</label><select id='id_queues' name='queue' multiple='selected' size='5'>{% for q in queue_choices %}<option value='{{ q.id }}'{% if q.id|in_list:query_params.filtering.queue__id__in %} selected='selected'{% endif %}>{{ q.title }}</option>{% endfor %}</select> <label for='id_queues'>{% trans "Queue(s)" %}</label><select id='id_queues' name='queue' multiple='selected' size='5'>{% for q in queue_choices %}<option value='{{ q.id }}'{% if q.id|in_list:query_params.filtering.queue__id__in %} selected='selected'{% endif %}>{{ q.title }}</option>{% endfor %}</select>
<p class='filterHelp'>Ctrl-click to select multiple options</p> <p class='filterHelp'>{% trans "Ctrl-click to select multiple options" %}</p>
<input type='button' class='filterBuilderRemove' value='-' /> <input type='button' class='filterBuilderRemove' value='-' />
</div> </div>
<div class='filterBox{% if query_params.filtering.status__in %} filterBoxShow{% endif %}' id='filterBoxStatus'> <div class='filterBox{% if query_params.filtering.status__in %} filterBoxShow{% endif %}' id='filterBoxStatus'>
<label for='id_statuses'>{% trans "Status(es)" %}</label><select id='id_statuses' name='status' multiple='selected' size='5'>{% for s in status_choices %}<option value='{{ s.0 }}'{% if s.0|in_list:query_params.filtering.status__in %} selected='selected'{% endif %}>{{ s.1 }}</option>{% endfor %}</select> <label for='id_statuses'>{% trans "Status(es)" %}</label><select id='id_statuses' name='status' multiple='selected' size='5'>{% for s in status_choices %}<option value='{{ s.0 }}'{% if s.0|in_list:query_params.filtering.status__in %} selected='selected'{% endif %}>{{ s.1 }}</option>{% endfor %}</select>
<p class='filterHelp'>Ctrl-click to select multiple options</p> <p class='filterHelp'>{% trans "Ctrl-click to select multiple options" %}</p>
<input type='button' class='filterBuilderRemove' value='-' /> <input type='button' class='filterBuilderRemove' value='-' />
</div> </div>
<div class='filterBox{% if query_params.filtering.created__gte or query_params.filtering.created__lte %} filterBoxShow{% endif %}' id='filterBoxDates'> <div class='filterBox{% if query_params.filtering.created__gte or query_params.filtering.created__lte %} filterBoxShow{% endif %}' id='filterBoxDates'>
<label for='id_date_from'>{% trans "Date (From)" %}</label><input type='text' name='date_from' value='{{ query_params.filtering.created__gte }}' id='id_date_from' /> <label for='id_date_from'>{% trans "Date (From)" %}</label><input type='text' name='date_from' value='{{ query_params.filtering.created__gte }}' id='id_date_from' />
<label for='id_date_to'>{% trans "Date (To)" %}</label><input type='text' name='date_to' value='{{ query_params.filtering.created__lte }}' id='id_date_to' /> <label for='id_date_to'>{% trans "Date (To)" %}</label><input type='text' name='date_to' value='{{ query_params.filtering.created__lte }}' id='id_date_to' />
<p class='filterHelp'>Use YYYY-MM-DD date format, eg 2011-05-29</p> <p class='filterHelp'>{% trans "Use YYYY-MM-DD date format, eg 2011-05-29" %}</p>
<input type='button' class='filterBuilderRemove' value='-' /> <input type='button' class='filterBuilderRemove' value='-' />
</div> </div>
{% if tags_enabled %} {% if tags_enabled %}
<div class='filterBox{% if query_params.tags %} filterBoxShow{% endif %}' id='filterBoxTags'> <div class='filterBox{% if query_params.tags %} filterBoxShow{% endif %}' id='filterBoxTags'>
<label for='id_tags'>{% trans "Tag(s)" %}</label><select id='id_tags' name='tags' multiple='selected' size='5'>{% for t in tag_choices %}<option value='{{t.name}}'{% if t.name|in_list:query_params.tags %} selected='selected'{% endif %}>{{ t.name }}</option>{% endfor %}</select> <label for='id_tags'>{% trans "Tag(s)" %}</label><select id='id_tags' name='tags' multiple='selected' size='5'>{% for t in tag_choices %}<option value='{{t.name}}'{% if t.name|in_list:query_params.tags %} selected='selected'{% endif %}>{{ t.name }}</option>{% endfor %}</select>
<p class='filterHelp'>Ctrl-click to select multiple options</p> <p class='filterHelp'>{% trans "Ctrl-click to select multiple options" %}</p>
<input type='button' class='filterBuilderRemove' value='-' /> <input type='button' class='filterBuilderRemove' value='-' />
</div> </div>
{% endif %} {% endif %}
<div class='filterBox{% if query %} filterBoxShow{% endif %}' id='filterBoxKeywords'> <div class='filterBox{% if query %} filterBoxShow{% endif %}' id='filterBoxKeywords'>
<label for='id_query'>{% trans "Keywords" %}</label><input type='text' name='q' value='{{ query }}' id='id_query' /> <label for='id_query'>{% trans "Keywords" %}</label><input type='text' name='q' value='{{ query }}' id='id_query' />
<p class='filterHelp'>Keywords are case-insensitive, and will be looked for in the title, body and submitter fields.</p> <p class='filterHelp'>{% trans "Keywords are case-insensitive, and will be looked for in the title, body and submitter fields." %}</p>
<input type='button' class='filterBuilderRemove' value='-' /> <input type='button' class='filterBuilderRemove' value='-' />
</div> </div>
<hr style='clear: both;' /> <hr style='clear: both;' />
@ -193,7 +193,7 @@ $(document).ready(function() {
{{ search_message|safe }} {{ search_message|safe }}
<form method='post' action='{% url helpdesk_mass_update %}'> <form method='post' action='{% url helpdesk_mass_update %}' id="ticket_mass_update">
<table width='100%'> <table width='100%'>
<tr class='row_tablehead'><td colspan='9'>{% trans "Tickets" %}</td></tr> <tr class='row_tablehead'><td colspan='9'>{% trans "Tickets" %}</td></tr>
<tr class='row_columnheads'><th>#</th><th>&nbsp;</th><th>{% trans "Pr" %}</th><th>{% trans "Title" %}</th><th>{% trans "Queue" %}</th><th>{% trans "Status" %}</th><th>{% trans "Created" %}</th><th>{% trans "Owner" %}</th>{% if tags_enabled %}<th>{% trans "Tags" %}</th>{% endif %}</tr> <tr class='row_columnheads'><th>#</th><th>&nbsp;</th><th>{% trans "Pr" %}</th><th>{% trans "Title" %}</th><th>{% trans "Queue" %}</th><th>{% trans "Status" %}</th><th>{% trans "Created" %}</th><th>{% trans "Owner" %}</th>{% if tags_enabled %}<th>{% trans "Tags" %}</th>{% endif %}</tr>

View File

@ -16,8 +16,9 @@ def saved_queries(request):
user_saved_queries = SavedSearch.objects.filter(Q(user=request.user) | Q(shared__exact=True)) user_saved_queries = SavedSearch.objects.filter(Q(user=request.user) | Q(shared__exact=True))
return user_saved_queries return user_saved_queries
except Exception, e: except Exception, e:
print "'saved_queries' template tag (django-helpdesk) crashed with following error:" import sys
print e print >> sys.stderr, "'saved_queries' template tag (django-helpdesk) crashed with following error:"
print >> sys.stderr, e
return '' return ''
register = Library() register = Library()

View File

@ -15,6 +15,7 @@ from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext from django.template import RequestContext
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from helpdesk import settings as helpdesk_settings
from helpdesk.models import KBCategory, KBItem from helpdesk.models import KBCategory, KBItem
@ -24,6 +25,7 @@ def index(request):
return render_to_response('helpdesk/kb_index.html', return render_to_response('helpdesk/kb_index.html',
RequestContext(request, { RequestContext(request, {
'kb_categories': category_list, 'kb_categories': category_list,
'helpdesk_settings': helpdesk_settings,
})) }))
@ -34,6 +36,7 @@ def category(request, slug):
RequestContext(request, { RequestContext(request, {
'category': category, 'category': category,
'items': items, 'items': items,
'helpdesk_settings': helpdesk_settings,
})) }))
@ -42,6 +45,7 @@ def item(request, item):
return render_to_response('helpdesk/kb_item.html', return render_to_response('helpdesk/kb_item.html',
RequestContext(request, { RequestContext(request, {
'item': item, 'item': item,
'helpdesk_settings': helpdesk_settings,
})) }))

View File

@ -111,6 +111,7 @@ def view_ticket(request):
return render_to_response('helpdesk/public_view_ticket.html', return render_to_response('helpdesk/public_view_ticket.html',
RequestContext(request, { RequestContext(request, {
'ticket': ticket, 'ticket': ticket,
'helpdesk_settings': helpdesk_settings,
})) }))
return render_to_response('helpdesk/public_view_form.html', return render_to_response('helpdesk/public_view_form.html',

View File

@ -8,6 +8,7 @@ views/staff.py - The bulk of the application - provides most business logic and
""" """
from datetime import datetime from datetime import datetime
import sys
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import User from django.contrib.auth.models import User
@ -590,7 +591,7 @@ def ticket_list(request):
query_params['sortreverse'] = sortreverse query_params['sortreverse'] = sortreverse
ticket_qs = apply_query(Ticket.objects.select_related(), query_params) ticket_qs = apply_query(Ticket.objects.select_related(), query_params)
print str(ticket_qs.query) print >> sys.stderr, str(ticket_qs.query)
## TAG MATCHING ## TAG MATCHING
if HAS_TAG_SUPPORT: if HAS_TAG_SUPPORT: