コード例 #1
0
ファイル: views.py プロジェクト: pwilkins/nbproject
def markNote(payload, req):
    uid = UR.getUserId(req)
    id_comment =  payload["id_comment"]
    if not auth.canMark(uid,id_comment ):
        return UR.prepare_response({}, 1,  "NOT ALLOWED")
    else: 
        annotations.markNote(uid, payload);        
        comments = annotations.getComment(id_comment,uid)
        locs, h5locs = annotations.getLocation(comments[int(id_comment)]["ID_location"])
        p = {"locations":locs, "html5locations": h5locs, "marks": annotations.getMark(uid, payload), "comments": comments}
        return UR.prepare_response(p)
コード例 #2
0
def markNote(payload, req):
    uid = UR.getUserId(req)
    id_comment =  payload["id_comment"]
    if not auth.canMark(uid,id_comment ):
        return UR.prepare_response({}, 1,  "NOT ALLOWED")
    else: 
        annotations.markNote(uid, payload);        
        comments = annotations.getComment(id_comment,uid)
        locs, h5locs = annotations.getLocation(comments[int(id_comment)]["ID_location"])
        p = {"locations":locs, "html5locations": h5locs, "marks": annotations.getMark(uid, payload), "comments": comments}
        return UR.prepare_response(p)
コード例 #3
0
ファイル: views.py プロジェクト: computercolin/nbproject
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"]}) 
                   })
コード例 #4
0
ファイル: views.py プロジェクト: sdcgreene/nbproject
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"]})
        })
コード例 #5
0
ファイル: views.py プロジェクト: computercolin/nbproject
def saveNote(payload, req): 
    uid = UR.getUserId(req)
    if not auth.canAnnotate(uid,  payload["id_ensemble"]):
        return UR.prepare_response({}, 1,  "NOT ALLOWED")
 
    payload["id_author"] = uid
    retval = {}
    a = annotations.addNote(payload)
    #for mark in payload["marks"]:
    #    annotations.markNote(uid, {"action": payload["marks"][mark], "id_comment": a["id_comment"]})
    if "id_location" in a:
        retval["locations"] = annotations.getLocation(a["id_location"])
    retval["comments"] = annotations.getComment(a["id_comment"], uid)
    retval["marks"] =  annotations.getMark(uid,{"id_comment":  a["id_comment"]})
    return UR.prepare_response(retval)
コード例 #6
0
ファイル: views.py プロジェクト: sdcgreene/nbproject
def saveNote(payload, req):
    uid = UR.getUserId(req)
    if not auth.canAnnotate(uid, payload["id_ensemble"]):
        return UR.prepare_response({}, 1, "NOT ALLOWED")

    payload["id_author"] = uid
    retval = {}
    a = annotations.addNote(payload)
    #for mark in payload["marks"]:
    #    annotations.markNote(uid, {"action": payload["marks"][mark], "id_comment": a["id_comment"]})
    if "id_location" in a:
        retval["locations"] = annotations.getLocation(a["id_location"])
    retval["comments"] = annotations.getComment(a["id_comment"], uid)
    retval["marks"] = annotations.getMark(uid, {"id_comment": a["id_comment"]})
    return UR.prepare_response(retval)