示例#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 项目: 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)
示例#3
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)
示例#4
0
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
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)
示例#6
0
文件: server.py 项目: brpv/Projeto
def create_default_result():
    # Default header configuration
    result = {"title": "Still testing..."}

    # Summary information
    result.update({"summary": get_summary_info()})

    # Mapping email do uer alias
    config = DITICConfig()
    result.update({"alias": config.get_email_to_user()})

    return result
示例#7
0
def create_default_result():
    # Default header configuration
    result = {
        'title': 'Still testing...'
    }

    # Summary information
    result.update({'summary': get_summary_info()})

    # Mapping email do uer alias
    config = DITICConfig()
    result.update({'alias': config.get_email_to_user()})

    return result
示例#8
0
def create_default_result():
    # Default header configuration
    result = {'title': 'Dashboard'}

    call(['update_statistics'])
    call(["generate_summary_file"])

    # Summary information
    result.update({'summary': get_summary_info()})

    # Mapping email do uer alias
    config = DITICConfig()
    result.update({'alias': config.get_email_to_user()})

    return result
示例#9
0
def create_default_result():
    # Default header configuration
    result = {
        'title': 'Dashboard'
    }

    call(['update_statistics'])
    call(["generate_summary_file"])

    # Summary information
    result.update({'summary': get_summary_info()})


    # Mapping email do uer alias
    config = DITICConfig()
    result.update({'alias': config.get_email_to_user()})

    return result
示例#10
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)
示例#11
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)
示例#12
0
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)
示例#13
0
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)
示例#14
0
def ticket_action_aux(ticket_id, action):
    start_time = time()
    print(request.query.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)

    # 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)})
    result.update({'summary:': get_summary_info()})
    result.update({'dir_inbox_limit':my_config.get_dir_inbox_limit()})

    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)
示例#15
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)