예제 #1
0
def displayAddUser(doctype):
    """Display controls for adding users"""
    t = ""
    # start displaying the table which will contain the add form
    t += """
    <table class="searchbox" summary="">
        <tr>
            <th class="portalboxheader">Add</th>
        </tr>
        <tr>
            <td>
    User:<br/>"""
    users = list_registered_users()
    if len(users) < 20:
        numrows = len(users)
    else:
        numrows = 20
    t += '<select multiple="multiple" name="addusers" size="%s">' % numrows
    for user in users:
        if user[1] != "":
            t += '<option value="%s">%s</option>' % (user[0], user[1])
    t += '</select><br/>'
    t += '<select name="categ">'
    t += '<option value="*">All categories</option>'
    res = run_sql("select lname,sname FROM sbmCATEGORIES WHERE doctype=%s ORDER BY lname", (doctype,))
    for row in res:
        t += '<option value="%s">%s</option>' % (row[1], row[0])
    t += '</select><br/>'
    t += '''<input class="adminbutton" type="button" onclick="document.forms[0].todo.value='adduser';document.forms[0].submit();" value="ADD" />'''
    t += '</td></tr></table>'
    return t
예제 #2
0
파일: utils.py 프로젝트: jiangmin9/invenio
def get_new_ticket_RT_info(uid, recId):
    response = {}
    response["resultCode"] = 0
    if BIBCATALOG_SYSTEM is None:
        response["description"] = "<!--No ticket system configured-->"
    elif BIBCATALOG_SYSTEM and uid:
        bibcat_resp = BIBCATALOG_SYSTEM.check_system(uid)
        if bibcat_resp == "":
            # add available owners
            users = []
            users_list = list_registered_users()
            for user_tuple in users_list:
                try:
                    user = {"username": get_user_preferences(user_tuple[0])["bibcatalog_username"], "id": user_tuple[0]}
                except KeyError:
                    continue
                users.append(user)
            response["users"] = users
            # add available queues
            response["queues"] = BIBCATALOG_SYSTEM.get_queues(uid)
            # add user email
            response["email"] = get_email(uid)
            # TODO try catch
            response["ticketTemplates"] = load_ticket_templates(recId)
            response["resultCode"] = 1
        else:
            # put something in the tickets container, for debug
            response["description"] = "Error connecting to RT<!--" + bibcat_resp + "-->"
    return response
예제 #3
0
def get_new_ticket_RT_info(uid, recId):
    response = {}
    response['resultCode'] = 0
    if BIBCATALOG_SYSTEM is None:
        response['description'] = "<!--No ticket system configured-->"
    elif BIBCATALOG_SYSTEM and uid:
        bibcat_resp = BIBCATALOG_SYSTEM.check_system(uid)
        if bibcat_resp == "":
            # add available owners
            users = []
            users_list = list_registered_users()
            for user_tuple in users_list:
                try:
                    user = {'username': get_user_preferences(user_tuple[0])['bibcatalog_username'],
                        'id': user_tuple[0]}
                except KeyError:
                    continue
                users.append(user)
            response['users'] = users
            # add available queues
            response['queues'] = BIBCATALOG_SYSTEM.get_queues(uid)
            # add user email
            response['email'] = get_email(uid)
            # TODO try catch
            response['ticketTemplates'] = load_ticket_templates(recId)
            response['resultCode'] = 1
        else:
            # put something in the tickets container, for debug
            response['description'] = "Error connecting to RT<!--" + bibcat_resp + "-->"
    return response