コード例 #1
0
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)
コード例 #2
0
ファイル: server.py プロジェクト: brpv/Projeto
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)
コード例 #3
0
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)
コード例 #4
0
ファイル: server.py プロジェクト: FranciscoMSM/ES
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)
コード例 #5
0
ファイル: server.py プロジェクト: FranciscoMSM/ES
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)
コード例 #6
0
ファイル: server.py プロジェクト: pedrocb/ES-Project
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)
コード例 #7
0
ファイル: server.py プロジェクト: FranciscoMSM/ES
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)
コード例 #8
0
ファイル: test_tools.py プロジェクト: tomascarvalho/ES
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...'}]
コード例 #9
0
ファイル: test_tools.py プロジェクト: pedrocb/ES-Project
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...'}]
コード例 #10
0
ファイル: server.py プロジェクト: brpv/Projeto
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)
コード例 #11
0
ファイル: server.py プロジェクト: tomascarvalho/ES
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)
コード例 #12
0
ファイル: server.py プロジェクト: FranciscoMSM/ES
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)
コード例 #13
0
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)
コード例 #14
0
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)
コード例 #15
0
ファイル: server.py プロジェクト: pedrocb/ES-Project
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)
コード例 #16
0
ファイル: server.py プロジェクト: brpv/Projeto
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)
コード例 #17
0
ファイル: server.py プロジェクト: pedrocb/ES-Project
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)
コード例 #18
0
ファイル: server.py プロジェクト: brpv/Projeto
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)
コード例 #19
0
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)
コード例 #20
0
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)
コード例 #21
0
ファイル: server.py プロジェクト: FranciscoMSM/ES
def get_urgent_number():
    return str(len(get_urgent_tickets(rt_object)))
コード例 #22
0
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)