#NEWLINE# def view_ticket( request , ticket_id ) : #NEWLINE# #INDENT# ticket = get_object_or_404 ( Ticket , id = form ) #NEWLINE# if ( not _has_access_to_queue ( request . user , ticket . queue ) ) : #NEWLINE# #INDENT# raise PermissionDenied ( ) #NEWLINE# #UNINDENT# if ( 'take' in request . GET ) : #NEWLINE# #INDENT# request . POST = { #NEWLINE# #INDENT# 'owner' : request . user . id , #NEWLINE# 'public' : 1 , #NEWLINE# 'title' : ticket . title , #NEWLINE# 'comment' : '' , #NEWLINE# #UNINDENT# } #NEWLINE# return update_ticket ( request , ticket_id ) #NEWLINE# #UNINDENT# if ( 'subscribe' in request . GET ) : #NEWLINE# #INDENT# ( ticketcc_string , SHOW_SUBSCRIBE ) = return_ticketccstring_and_show_subscribe ( request . user , ticket ) #NEWLINE# if SHOW_SUBSCRIBE : #NEWLINE# #INDENT# subscribe_staff_member_to_ticket ( ticket , request . user ) #NEWLINE# return HttpResponseRedirect ( reverse ( 'helpdesk_view' , args = [ ticket . id ] ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( ( 'close' in request . GET ) and ( ticket . status == Ticket . RESOLVED_STATUS ) ) : #NEWLINE# #INDENT# if ( not ticket . assigned_to ) : #NEWLINE# #INDENT# owner = 0 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# owner = ticket . assigned_to . id #NEWLINE# #UNINDENT# request . POST = { #NEWLINE# #INDENT# 'new_status' : Ticket . CLOSED_STATUS , #NEWLINE# 'public' : 1 , #NEWLINE# 'owner' : owner , #NEWLINE# 'title' : ticket . title , #NEWLINE# 'comment' : _ ( 'Accepted resolution and closed ticket' ) , #NEWLINE# #UNINDENT# } #NEWLINE# return update_ticket ( request , ticket_id ) #NEWLINE# #UNINDENT# if helpdesk_settings . HELPDESK_STAFF_ONLY_TICKET_OWNERS : #NEWLINE# #INDENT# users = User . objects . filter ( is_active = True , is_staff = True ) . order_by ( User . USERNAME_FIELD ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# users = User . objects . filter ( is_active = True ) . order_by ( User . USERNAME_FIELD ) #NEWLINE# #UNINDENT# form = TicketForm ( initial = { #NEWLINE# #INDENT# 'due_date' : ticket . due_date , #NEWLINE# #UNINDENT# } ) #NEWLINE# ( ticketcc_string , SHOW_SUBSCRIBE ) = return_ticketccstring_and_show_subscribe ( request . user , ticket ) #NEWLINE# return render_to_response ( 'helpdesk/ticket.html' , RequestContext ( request , { #NEWLINE# #INDENT# 'ticket' : ticket , #NEWLINE# 'form' : form , #NEWLINE# 'active_users' : users , #NEWLINE# 'priorities' : Ticket . PRIORITY_CHOICES , #NEWLINE# 'preset_replies' : PreSetReply . objects . filter ( ( Q ( queues = ticket . queue ) | Q ( queues__isnull = True ) ) ) , #NEWLINE# 'ticketcc_string' : ticketcc_string , #NEWLINE# 'SHOW_SUBSCRIBE' : SHOW_SUBSCRIBE , #NEWLINE# #UNINDENT# } ) )