Exemplo n.º 1
0
def displaygroup(group_id):

    groupInfo = Group_interface.getAGroupInfo(str(group_id))
    print(groupInfo['created_by'])

    groupTopic = Group_interface.getGroupTopics(str(group_id))
    groupInfo = Group_interface.getAGroupInfo(str(group_id))

    if groupInfo['created_by'] == user_interface.getLoggedInUser():
        admin = True
    else:
        admin = False

    loggUser = user_interface.getIDFromUsername(
        user_interface.getLoggedInUser())
    loggedUserId = loggUser[0]

    if request.method == 'POST':
        topic_interface.createTopic(request.form['topic'],
                                    user_interface.getLoggedInUser(), group_id)

        return redirect(url_for('creategroup'))
    grouptopic = Group_interface.getGroupTopics(str(group_id))

    Members = Group_interface.getGroupMembers(group_id)

    return render_template('creategrouptopic.html',
                           grouptopic=grouptopic,
                           groupInfo=groupInfo,
                           admin=admin,
                           Members=Members,
                           loggedUserId=loggedUserId)
Exemplo n.º 2
0
def createpost(topic_id):
    if request.method == 'POST':
        post_interface.createPost(topic_id, user_interface.getLoggedInUser(),
                                  request.form['title'], request.form['body'])
        notificationInterface.sendNotifications("post", topic_id)
        return redirect(url_for('index'))
    return render_template('createpost.html', topic_id=topic_id)
Exemplo n.º 3
0
def createtopic():
    if request.method == 'POST':
        group_id = str(0)
        topic_interface.createTopic(request.form['topic'],
                                    user_interface.getLoggedInUser(), group_id)
        return redirect(url_for('index'))
    return render_template('createtopic.html')
Exemplo n.º 4
0
def userProfile():
    user = user_interface.getUserInfoDict()
    if request.method == 'POST':
        username = user_interface.getLoggedInUser()
        logout()
        user_interface.deleteUser(username)
        return redirect(url_for('index'))
    return render_template('userInfo.html', user=user)
Exemplo n.º 5
0
def creategroup():
    if request.method == 'POST':
        if request.form['Group name']:
            groupName = request.form['Group name']
            Group_interface.createGroup(groupName,
                                        user_interface.getLoggedInUser())

            group_id = Group_interface.getGroupId(str(groupName))[0]

            userid = user_interface.getIDFromUsername(
                user_interface.getLoggedInUser())
            Group_interface.AddMemberToGroup(group_id, userid[0])

            print(user_interface.getLoggedInUser())

    groups = Group_interface.getGroups()

    return render_template('creategroup.html', groups=groups)