def display_member_groups(uid, ln=CFG_SITE_LANG): """Display groups the user is member of. @param uid: user id @param ln: language @return: body body : html groups representation the user is member of """ body = "" records = db.get_groups_by_user_status(uid, user_status=CFG_WEBSESSION_USERGROUP_STATUS["MEMBER"]) body = websession_templates.tmpl_display_member_groups(groups=records, ln=ln) return body
def display_admin_groups(uid, ln=CFG_SITE_LANG): """Display groups the user is admin of. @param uid: user id @param ln: language @return: body return html groups representation the user is admin of """ body = "" record = db.get_groups_by_user_status(uid=uid, user_status=CFG_WEBSESSION_USERGROUP_STATUS["ADMIN"]) body = websession_templates.tmpl_display_admin_groups(groups=record, ln=ln) return body
def display_moderator_groups(uid, ln=CFG_SITE_LANG): """Display groups the user is moderator of. @param uid: user id @param ln: language @return: body body : html groups representation the user is moderator of """ body = "" records = db.get_groups_by_user_status(uid, user_status=CFG_WEBSESSION_USERGROUP_STATUS["MODERATOR"]) body = websession_templates.tmpl_display_moderator_groups(groups=records, ln=ln) return body
def display_admin_groups(uid, ln=CFG_SITE_LANG): """Display groups the user is admin of. @param uid: user id @param ln: language @return: body return html groups representation the user is admin of """ body = "" record = db.get_groups_by_user_status( uid=uid, user_status=CFG_WEBSESSION_USERGROUP_STATUS["ADMIN"]) body = websession_templates.tmpl_display_admin_groups(groups=record, ln=ln) return body
def perform_request_input_leave_group(uid, warnings=[], ln=CFG_SITE_LANG): """Return html for leaving group. @param uid: user ID @param warnings: warnings != [] if 0 group is selected or if not admin of the @param ln: language @return: body with warnings """ body = "" groups = [] records = db.get_groups_by_user_status(uid=uid, user_status=CFG_WEBSESSION_USERGROUP_STATUS["MEMBER"]) map(lambda x: groups.append((x[0], x[1])), records) body = websession_templates.tmpl_display_input_leave_group(groups, warnings=warnings, ln=ln) return body
def display_member_groups(uid, ln=CFG_SITE_LANG): """Display groups the user is member of. @param uid: user id @param ln: language @return: a (body, errors[]) formed tuple body : html groups representation the user is member of """ body = "" errors = [] records = db.get_groups_by_user_status(uid, user_status=CFG_WEBSESSION_USERGROUP_STATUS["MEMBER"] ) body = websession_templates.tmpl_display_member_groups(groups=records, ln=ln) return (body, errors)
def perform_request_input_leave_group(uid, warnings=[], ln=CFG_SITE_LANG): """Return html for leaving group. @param uid: user ID @param warnings: warnings != [] if 0 group is selected or if not admin of the @param ln: language @return: body with warnings """ body = "" groups = [] records = db.get_groups_by_user_status( uid=uid, user_status=CFG_WEBSESSION_USERGROUP_STATUS["MEMBER"]) map(lambda x: groups.append((x[0], x[1])), records) body = websession_templates.tmpl_display_input_leave_group( groups, warnings=warnings, ln=ln) return body