def ticketAction2(ticket_id, action): start_time = time() result = create_default_result() result2 = create_default_result() if request.query.o == '' or not user_auth.check_id(request.query.o): result.update({'message': ''}) return template('auth', result) # Apply the action to the ticket result.update( ticket_actions( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o)), ticket_id, action, request.query.email, user_auth.get_email_from_id(request.query.o))) # Update table for this user result.update( user_tickets_details( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o)), request.query.email)) result2.update( user_tickets_details( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o)), "inbox")) result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({'email': request.query.email}) result.update({'username_id': request.query.o}) # Is there any URGENT ticket? result.update({'urgent': get_urgent_tickets(rt_object)}) result.update({'summary': get_summary_info()}) result.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) result2.update({'urgent': get_urgent_tickets(rt_object)}) result2.update({'summary': get_summary_info()}) result2.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) if request.query.email == 'inbox' or request.query.email == 'unknown': return template('ticket_list', result) else: return template('detail', result, tickets2=result2)
def search(): start_time = time() result = create_default_result() if request.query.o == "" or not user_auth.check_id(request.query.o): result.update({"message": ""}) return template("auth", result) if not request.forms.get("search"): redirect("/?o=%s" % request.query.o) search = request.forms.get("search") result.update({"username": user_auth.get_email_from_id(request.query.o)}) result.update({"email": search}) result.update({"username_id": request.query.o}) result.update( search_tickets(user_auth.get_rt_object_from_email(user_auth.get_email_from_id(request.query.o)), search) ) # Is there any URGENT ticket? result.update({"urgent": get_urgent_tickets(rt_object)}) result.update({"time_spent": "%0.2f seconds" % (time() - start_time)}) return template("search", result)
def archivedTickets(): global emailGlobal email = emailGlobal start_time = time() result = create_default_result() if request.query.o == '' or not user_auth.check_id(request.query.o): result.update({'message': ''}) return template('auth', result) result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({'email': email}) result.update({'username_id': request.query.o}) result.update( user_tickets_details( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o)), email)) # Is there any URGENT ticket? result.update({'urgent': get_urgent_tickets(rt_object)}) result.update({'summary': get_summary_info()}) result.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) result.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) return template('archive', result, tickets2=result)
def search(): start_time = time() result = create_default_result() if request.query.o == '' or not user_auth.check_id(request.query.o): result.update({'message': ''}) return template('auth', result) if not request.forms.get('search'): redirect('/?o=%s' % request.query.o) search = request.forms.get('search') result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({'email': search}) result.update({'username_id': request.query.o}) result.update(search_tickets( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o) ), search)) # Is there any URGENT ticket? result.update({'urgent': get_urgent_tickets(rt_object)}) result.update({'summary:': get_summary_info()}) result.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) return template('search', result)
def email_detail(email): global emailGlobal emailGlobal = email start_time = time() result = create_default_result() if request.query.o == '' or not user_auth.check_id(request.query.o): result.update({'message': ''}) return template('auth', result) result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({'email': email}) result.update({'username_id': request.query.o}) result.update(user_tickets_details( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o) ), email)) # Is there any URGENT ticket? result.update({'urgent': get_urgent_tickets(rt_object)}) result.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) result.update({'summary:': get_summary_info()}) if email == 'dir' or email == 'dir-inbox' or email == 'unknown' or not email: return template('ticket_list', result) else: return template('detail', result)
def search(): start_time = time() result = create_default_result() if request.query.o == '' or not user_auth.check_id(request.query.o): result.update({'message': ''}) return template('auth', result) if not request.forms.get('search'): redirect('/?o=%s' % request.query.o) search = request.forms.get('search') result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({'email': search}) result.update({'username_id': request.query.o}) result.update( search_tickets( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o)), search)) # Is there any URGENT ticket? result.update({'urgent': get_urgent_tickets(rt_object)}) result.update({'summary:': get_summary_info()}) result.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) return template('search', result)
def get_urgent_modal(): print "getUrgentTicketModal" result = create_default_result() result.update({'tickets': get_urgent_tickets(rt_object)}) result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({'username_id': request.query.o}) return template('urgentModal', result)
def test_get_urgent_tickets(): rt_object = RTApiMock() rt_object.set_return([ u'rt/4.0.6 200 ok', u'', u'81818: This is a test...', ]) result = get_urgent_tickets(rt_object) assert result == [{'id': '81818', 'subject': 'This is a test...'}]
def get_root(): start_time = time() result = create_default_result() # Removed to be a display at the TV # if request.query.o == '' or not user_auth.check_id(request.query.o): # result.update({'message': ''}) # return template('auth', result) # result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({"username_id": request.query.o}) today = date.today().isoformat() result.update({"statistics": get_statistics(get_date(30, today), today)}) # Is there any URGENT ticket? result.update({"urgent": get_urgent_tickets(rt_object)}) result.update({"time_spent": "%0.2f seconds" % (time() - start_time)}) return template("entrance_summary", result)
def ticket_action2(ticket_id, action): start_time = time() result = create_default_result() if request.query.o == '' or not user_auth.check_id(request.query.o): result.update({'message': ''}) return template('auth', result) # Apply the action to the ticket result.update(ticket_actions( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o) ), ticket_id, action, request.query.email, user_auth.get_email_from_id(request.query.o) )) # Update table for this user result.update(user_tickets_details( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o) ), request.query.email)) result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({'email': request.query.email}) result.update({'username_id': request.query.o}) # Is there any URGENT ticket? result.update({'urgent': get_urgent_tickets(rt_object)}) result.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) #update all if request.query.email == 'dir' or request.query.email == 'dir-inbox' or request.query.email == 'unknown': return template('ticket_list', result) elif request.query.email == 'history': return template('history', result) else: return template('detail', result)
def archive_tickets_server(email): start_time = time() result = create_default_result() dictResultRes = user_get_resolved_tickets(rt_object, email) listTickets = getTicketsIds(dictResultRes) if request.query.o == '' or not user_auth.check_id(request.query.o): result.update({'message': ''}) return template('auth', result) for i in range(len(listTickets)): # Apply the action to the ticket result.update(ticket_actions( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o) ), listTickets[i], 'forward', request.query.email, user_auth.get_email_from_id(request.query.o) )) # Update table for this user result.update(user_tickets_details( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o) ), request.query.email)) result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({'email': request.query.email}) result.update({'username_id': request.query.o}) # Is there any URGENT ticket? result.update({'urgent': get_urgent_tickets(rt_object)}) result.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) result.update({'summary:': get_summary_info()}) os.system('update_statistics') os.system("generate_summary_file") return template('detail', result)
def archive_ticket(ticket_id,action): start_time = time() result = create_default_result() if request.query.o == '' or not user_auth.check_id(request.query.o): result.update({'message': ''}) return template('auth', result) # Apply the action to the ticket result.update(ticket_actions( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o) ), ticket_id, action, request.query.email, user_auth.get_email_from_id(request.query.o) )) # Update table for this user result.update(user_tickets_details( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o) ), request.query.email)) result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({'email': request.query.email}) result.update({'username_id': request.query.o}) # Is there any URGENT ticket? result.update({'urgent': get_urgent_tickets(rt_object)}) result.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) modify_ticket( rt_object, ticket_id, { 'status': 'archived', } ) return template('history', result)
def get_root(): start_time = time() result = create_default_result() # Removed to be a display at the TV #if request.query.o == '' or not user_auth.check_id(request.query.o): # result.update({'message': ''}) # return template('auth', result) #result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({'username_id': request.query.o}) today = date.today().isoformat() result.update({'statistics': get_statistics(get_date(30, today), today)}) result.update({'summary': get_summary_info()}) # Is there any URGENT ticket? result.update({'urgent': get_urgent_tickets(rt_object)}) result.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) return template('entrance_summary', result)
def email_detail(email): global emailGlobal emailGlobal = email start_time = time() result = create_default_result() if request.query.o == '' or not user_auth.check_id(request.query.o): result.update({'message': ''}) return template('auth', result) result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({'email': email}) result.update({'username_id': request.query.o}) result.update( user_tickets_details( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o)), email)) # Is there any URGENT ticket? result.update({'urgent': get_urgent_tickets(rt_object)}) result.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) result.update({'summary:': get_summary_info()}) result.update({'dir_inbox_limit': my_config.get_dir_inbox_limit()}) if email == 'dir': print email return template('dir', result) elif email == 'dir-inbox': print email return template('dir-inbox', result) elif email == 'unknown' or not email: print email return template('ticket_list', result) else: print email return template('detail', result)
def email_detail(email): start_time = time() result = create_default_result() if request.query.o == "" or not user_auth.check_id(request.query.o): result.update({"message": ""}) return template("auth", result) result.update({"username": user_auth.get_email_from_id(request.query.o)}) result.update({"email": email}) result.update({"username_id": request.query.o}) result.update( user_closed_tickets(user_auth.get_rt_object_from_email(user_auth.get_email_from_id(request.query.o)), email) ) # Is there any URGENT ticket? result.update({"urgent": get_urgent_tickets(rt_object)}) result.update({"time_spent": "%0.2f seconds" % (time() - start_time)}) return template("ticket_list", result)
def get_root(): start_time = time() result = create_default_result() if request.query.o == '' or not user_auth.check_id(request.query.o): result.update({'message': ''}) return template('auth', result) result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({'username_id': request.query.o}) today = date.today().isoformat() result.update({'statistics': get_statistics(get_date(30, today), today)}) # Is there any URGENT ticket? result.update({'urgent': get_urgent_tickets(rt_object)}) result.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) result.update({'summary:': get_summary_info()}) return template('entrance_summary', result)
def ticket_action_2(ticket_id, action): start_time = time() result = create_default_result() if request.query.o == "" or not user_auth.check_id(request.query.o): result.update({"message": ""}) return template("auth", result) # Apply the action to the ticket result.update( ticket_actions( user_auth.get_rt_object_from_email(user_auth.get_email_from_id(request.query.o)), ticket_id, action, request.query.email, user_auth.get_email_from_id(request.query.o), ) ) # Update table for this user result.update( user_tickets_details( user_auth.get_rt_object_from_email(user_auth.get_email_from_id(request.query.o)), request.query.email ) ) result.update({"username": user_auth.get_email_from_id(request.query.o)}) result.update({"email": request.query.email}) result.update({"username_id": request.query.o}) # Is there any URGENT ticket? result.update({"urgent": get_urgent_tickets(rt_object)}) result.update({"time_spent": "%0.2f seconds" % (time() - start_time)}) if request.query.email == "dir" or request.query.email == "dir-inbox" or request.query.email == "unknown": return template("ticket_list", result) else: return template("detail", result)
def email_detail(email): start_time = time() result = create_default_result() if request.query.o == '' or not user_auth.check_id(request.query.o): result.update({'message': ''}) return template('auth', result) result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({'email': email}) result.update({'username_id': request.query.o}) result.update(user_closed_tickets( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o) ), email)) # Is there any URGENT ticket? result.update({'urgent': get_urgent_tickets(rt_object)}) result.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) return template('ticket_list', result)
def email_detail(email): start_time = time() global emailGlobal emailGlobal=email result = create_default_result() if request.query.o == '' or not user_auth.check_id(request.query.o): result.update({'message': ''}) return template('auth', result) result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({'email': email}) result.update({'username_id': request.query.o}) result.update(user_tickets_details( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o) ), email)) # Is there any URGENT ticket? result.update({'urgent': get_urgent_tickets(rt_object)}) today = date.today().isoformat() result.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) result.update({'statistics': get_statistics(get_date(30, today), today)}) if email == 'dir' or email == 'dir-inbox': return template('dir', result) elif email == 'history': return template('history', result) elif email == 'main' or email == 'unknown': return template('entrance_summary', result) elif email == 'new_ticket': return template('newticket', result) elif email == 'statistic': return template('statistic', result) else: return template('detail', result)
def get_urgent_number(): return str(len(get_urgent_tickets(rt_object)))
def search(): start_time = time() result = create_default_result() result2 = create_default_result() result3 = create_default_result() if request.query.o == '' or not user_auth.check_id(request.query.o): result.update({'message': ''}) return template('auth', result) search = request.forms.get('search') result2.update( user_tickets_details( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o)), "inbox")) result.update( search_tickets( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o)), search)) result3.update( user_tickets_details( user_auth.get_rt_object_from_email( user_auth.get_email_from_id(request.query.o)), user_auth.get_email_from_id(request.query.o))) # Is there any URGENT ticket? result3.update({'urgent': get_urgent_tickets(rt_object)}) result3.update({'summary': get_summary_info()}) result3.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) result.update({'username': user_auth.get_email_from_id(request.query.o)}) result.update({'email': search}) result.update({'username_id': request.query.o}) result.update({'summary': get_summary_info()}) result2.update({'urgent': get_urgent_tickets(rt_object)}) result2.update({'summary': get_summary_info()}) result2.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) result.update({'urgent': get_urgent_tickets(rt_object)}) result.update({'time_spent': '%0.2f seconds' % (time() - start_time)}) #Vamos buscar os campos de Tickets de um determinado utilizador e fazemos merge res2 = result2['tickets'] res3 = result3['tickets'] allTickets = res2.copy() res2.clear() lst2 = filterTicketStatus(res3) lst = refineTicketSearch(allTickets, lst2, search) ticketsDic = dict() ticketsDic['tickets'] = lst return template('search', result, tickets2=ticketsDic)