Esempio n. 1
0
def editNote(payload, req): 
    uid = UR.getUserId(req)
    if not auth.canEdit(uid,  payload["id_comment"]):
        return UR.prepare_response({}, 1,  "NOT ALLOWED")
    else:
        annotations.editNote(payload)
    #no need to worry about threadmarks: they can't be changed from an "edit-mode" editor        
    return UR.prepare_response({"comments":  annotations.getComment(payload["id_comment"], uid)})
Esempio n. 2
0
def editNote(payload, req): 
    uid = UR.getUserId(req)
    if not auth.canEdit(uid,  payload["id_comment"]):
        return UR.prepare_response({}, 1,  "NOT ALLOWED")
    else:
        annotations.editNote(payload)
    #no need to worry about threadmarks: they can't be changed from an "edit-mode" editor        
    return UR.prepare_response({"comments":  annotations.getComment(payload["id_comment"], uid)})
Esempio n. 3
0
def editNote(payload, req): 
    uid = UR.getUserId(req)
    if not auth.canEdit(uid,  payload["id_comment"]):
        return UR.prepare_response({}, 1,  "NOT ALLOWED")
    else:
        annotations.editNote(payload)
        #for mark in payload["marks"]:
        #    annotations.markNote(uid, {"action": payload["marks"][mark], "id_comment": payload["id_comment"]})
        return UR.prepare_response({"comments":  annotations.getComment(payload["id_comment"], uid), 
                   "marks": annotations.getMark(uid,{"id_comment":  payload["id_comment"]}) 
                   })
Esempio n. 4
0
def editNote(payload, req):
    uid = UR.getUserId(req)
    if not auth.canEdit(uid,  payload["id_comment"]):
        return UR.prepare_response({}, 1,  "NOT ALLOWED")
    else:
        edited_loc = annotations.editNote(payload)
    tags = {}
    tags.update(annotations.getTagsByComment(payload["id_comment"]))
    #no need to worry about threadmarks: they can't be changed from an "edit-mode" editor
    retval = {"comments":  [annotations.getComment(payload["id_comment"], uid)], "tags": tags, "cid": payload["id_comment"]}
    if not edited_loc == None:
        retval["edit_location"] = edited_loc
    return UR.prepare_response(retval)
Esempio n. 5
0
def editNote(payload, req):
    uid = UR.getUserId(req)
    if not auth.canEdit(uid, payload["id_comment"]):
        return UR.prepare_response({}, 1, "NOT ALLOWED")
    else:
        annotations.editNote(payload)
        #for mark in payload["marks"]:
        #    annotations.markNote(uid, {"action": payload["marks"][mark], "id_comment": payload["id_comment"]})
        return UR.prepare_response({
            "comments":
            annotations.getComment(payload["id_comment"], uid),
            "marks":
            annotations.getMark(uid, {"id_comment": payload["id_comment"]})
        })
Esempio n. 6
0
def editNote(payload, req):
    uid = UR.getUserId(req)
    if not auth.canEdit(uid, payload["id_comment"]):
        return UR.prepare_response({}, 1, "NOT ALLOWED")
    else:
        edited_loc = annotations.editNote(payload)
    tags = {}
    tags.update(annotations.getTagsByComment(payload["id_comment"]))
    #no need to worry about threadmarks: they can't be changed from an "edit-mode" editor
    retval = {
        "comments": [annotations.getComment(payload["id_comment"], uid)],
        "tags": tags,
        "cid": payload["id_comment"]
    }
    if not edited_loc == None:
        retval["edit_location"] = edited_loc
    return UR.prepare_response(retval)