示例#1
0
def perform_request_edit_group(uid, grpID, warnings=[], ln=CFG_SITE_LANG):
    """Return html for group editing.
    @param uid: user ID
    @param grpID: ID of the group
    @param warnings: warnings
    @param ln: language
    @return: body with warnings
    """
    body = ""
    _ = gettext_set_language(ln)
    user_status = db.get_user_status(uid, grpID)
    if not len(user_status):
        try:
            raise InvenioWebSessionError(
                _('Sorry, there was an error with the database.'))
        except InvenioWebSessionError, exc:
            register_exception()
            body = websession_templates.tmpl_error(exc.message, ln)
            return body
示例#2
0
def perform_request_add_member(uid, grpID, user_id, ln=CFG_SITE_LANG):
    """Add waiting member to a group.
    @param uid: user ID
    @param grpID: ID of the group
    @param user_id: selected member ID
    @param ln: language
    @return: body with warnings
    """
    body = ''
    warnings = []
    infos = []
    _ = gettext_set_language(ln)
    user_status = db.get_user_status(uid, grpID)
    if not len(user_status):
        try:
            raise InvenioWebSessionError(_('Sorry, there was an error with the database.'))
        except InvenioWebSessionError, exc:
            register_exception()
            body = websession_templates.tmpl_error(exc.message, ln)
            return body
示例#3
0
 @return: body with warnings
 """
 body = ""
 _ = gettext_set_language(ln)
 user_status = db.get_user_status(uid, grpID)
 if not len(user_status):
     try:
         raise InvenioWebSessionError(
             _('Sorry, there was an error with the database.'))
     except InvenioWebSessionError, exc:
         register_exception()
         body = websession_templates.tmpl_error(exc.message, ln)
         return body
 elif user_status[0][0] != CFG_WEBSESSION_USERGROUP_STATUS['ADMIN']:
     try:
         raise InvenioWebSessionError(
             _('Sorry, you do not have sufficient rights on this group.'))
     except InvenioWebSessionError, exc:
         register_exception()
         body = websession_templates.tmpl_error(exc.message, ln)
         return body
 group_infos = db.get_group_infos(grpID)[0]
 if not len(group_infos):
     try:
         raise InvenioWebSessionError(
             _('Sorry, there was an error with the database.'))
     except InvenioWebSessionError, exc:
         register_exception()
         body = websession_templates.tmpl_error(exc.message, ln)
         return body
 body = websession_templates.tmpl_display_input_group_info(
     group_name=group_infos[1],