Ejemplo n.º 1
0
def comments_execute_page():
    isAuthenticated()
    if request.forms.send == "yes":
        _user = session.checkSession(request)
        layer = usefull.avoidJavascript(request.forms.layer)
        content = usefull.avoidJavascript(request.forms.content)
        date = usefull.getCurrentDate()
        comments.addComment(_user, layer, date, content)
        return template("achieved",{"message": "Votre commentaire a bien ete enregistré.", "link": "/layer/"+str(layer)})
Ejemplo n.º 2
0
def follow_execute_page():
    isAuthenticated()
    if request.forms.follow == "yes":
        _userId = session.checkSession(request)
        _user = user.getUserInformations(_userId)
        idUserFollowed = usefull.avoidJavascript(request.forms.id)
        if int(idUserFollowed) == int(_userId):
            return {"state": "same user"}
        user.followUser(_user[0], idUserFollowed)
        info = user.getUserInformations(idUserFollowed)
        return {"state":"success", "follow":info[1]}
    elif request.forms.unfollow == "yes":
        _userId = session.checkSession(request)
        _user = user.getUserInformations(_userId)
        idUserFollowed = usefull.avoidJavascript(request.forms.id)
        if int(idUserFollowed) == int(_userId):
            return {"state": "same user"}
        user.unfollowUser(_user[0], idUserFollowed)
        info = user.getUserInformations(idUserFollowed)
        return {"state":"success", "unfollow": info[1]}
Ejemplo n.º 3
0
def layer_execute_page():
    isAuthenticated()
    user = session.checkSession(request)
    delete = request.forms.delete
    save = request.forms.save
    if delete == "yes":
        id = request.forms.id
        userId = request.forms.user
        if str(userId) == str(user):
            layers.removeLayer(id)
            return {"state": "success"}
        else:
            return {"state": "Vous n'etes pas le proprietaire de ce calque."}
    if save == "yes":
        user = session.checkSession(request)
        basedOn = usefull.avoidJavascript(request.forms.basedOn)
        chapter = usefull.avoidJavascript(request.forms.chapter)
        content = usefull.avoidJavascript(request.forms.content)
        date = usefull.getCurrentDate()
        layers.addLayer(basedOn, user, chapter, date, content)
        return { "state": "success"}