Merge branch 'master' of https://github.com/kotowicz/django-helpdesk into kotowicz-master

This commit is contained in:
Ross Poulton 2011-02-03 09:28:40 +00:00
commit 2b1be97197
2 changed files with 39 additions and 1 deletions

View File

@ -9,6 +9,22 @@
<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(){
// hide queryloadheader div by default
$("#queryloadheader").hide();
// toggle the event
$("#toggle_query").click(function(){
}).toggle( function() {
$("#queryloadheader").show();
}, function() {
$("#queryloadheader").hide();
});
});
</script>
{% block helpdesk_head %}{% endblock %}
</head>
<body>
@ -20,10 +36,27 @@
<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><a href="#queryloadheader" id="toggle_query">Load Saved Query</a></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>
</div>
{% if user_saved_queries %}
<div id="queryloadheader" style="float:right; padding: 20px; background:#ECF1EF; ">
<form method='get' action='{% url helpdesk_list %}'>
<label for='id_query_selector'>{% trans "Query" %}</label> <select name='saved_query' id='id_query_selector' />
{% for q in user_saved_queries %}
<option value='{{ q.id }}'>{{ q.title }}{% if q.shared %} (Shared{% ifnotequal user q.user %} by {{ q.user.username }}{% endifnotequal %}){% endif %}</option>
{% endfor %}
</select>
<input type='submit' value='{% trans "Run Query" %}'>
{% csrf_token %}</form>
</div>
{% endif %}
<div id='body'>
{% block helpdesk_body %}{% endblock %}
</div>

View File

@ -74,12 +74,14 @@ def dashboard(request):
ORDER BY q.id;
""")
dash_tickets = query_to_dict(cursor.fetchall(), cursor.description)
user_saved_queries = SavedSearch.objects.filter(Q(user=request.user) | Q(shared__exact=True))
return render_to_response('helpdesk/dashboard.html',
RequestContext(request, {
'user_tickets': tickets,
'unassigned_tickets': unassigned_tickets,
'dash_tickets': dash_tickets,
'user_saved_queries': user_saved_queries,
}))
dashboard = staff_member_required(dashboard)
@ -133,6 +135,7 @@ def followup_edit(request, ticket_id, followup_id, ):
def view_ticket(request, ticket_id):
ticket = get_object_or_404(Ticket, id=ticket_id)
user_saved_queries = SavedSearch.objects.filter(Q(user=request.user) | Q(shared__exact=True))
if request.GET.has_key('take'):
# Allow the user to assign the ticket to themselves whilst viewing it.
@ -153,6 +156,7 @@ def view_ticket(request, ticket_id):
'owner': owner,
'title': ticket.title,
'comment': _('Accepted resolution and closed ticket'),
'user_saved_queries': user_saved_queries,
}
return update_ticket(request, ticket_id)
@ -163,7 +167,8 @@ def view_ticket(request, ticket_id):
'active_users': User.objects.filter(is_active=True).filter(is_staff=True),
'priorities': Ticket.PRIORITY_CHOICES,
'preset_replies': PreSetReply.objects.filter(Q(queues=ticket.queue) | Q(queues__isnull=True)),
'tags_enabled': HAS_TAG_SUPPORT
'tags_enabled': HAS_TAG_SUPPORT,
'user_saved_queries': user_saved_queries,
}))
view_ticket = staff_member_required(view_ticket)