def set_location_section(P, req): uid = UR.getUserId(req) if not auth.canAdministrateLocation(uid, P["id_location"]): return UR.prepare_response({}, 1, "NOT ALLOWED") result = annotations.setLocationSection(P["id_location"], P["id_section"]) locations, html5locations = annotations.getLocation(result.pk) return UR.prepare_response(locations)
def set_location_section(P, req): uid = UR.getUserId(req) if not auth.canAdministrateLocation(uid, P["id_location"]): return UR.prepare_response({}, 1, "NOT ALLOWED") result = annotations.setLocationSection(P["id_location"], P["id_section"]) locations, html5locations = annotations.getLocation(result.pk) return UR.prepare_response( locations )
def promote_location_by_copy(P, req): uid = UR.getUserId(req) if not auth.canAdministrateLocation(uid, P["id_location"]): return UR.prepare_response({}, 1, "NOT ALLOWED") location_ids, comment_ids = annotations.promoteLocationByCopy(P["id_location"]) retval = {} retval["comments"] = {} for cid in comment_ids: retval["comments"].update(annotations.getComment(cid, uid)) retval["locations"] = {} retval["html5locations"] = {} for lid in location_ids: locations, html5locations = annotations.getLocation(lid) retval["locations"].update(locations) if not html5locations: retval["html5locations"].update(html5locations) # clear out html5locations if none exist if retval["html5locations"]: del retval["html5locations"] return UR.prepare_response( retval )
def promote_location_by_copy(P, req): uid = UR.getUserId(req) if not auth.canAdministrateLocation(uid, P["id_location"]): return UR.prepare_response({}, 1, "NOT ALLOWED") location_ids, comment_ids = annotations.promoteLocationByCopy( P["id_location"]) retval = {} retval["comments"] = {} for cid in comment_ids: retval["comments"].update(annotations.getComment(cid, uid)) retval["locations"] = {} retval["html5locations"] = {} for lid in location_ids: locations, html5locations = annotations.getLocation(lid) retval["locations"].update(locations) if not html5locations: retval["html5locations"].update(html5locations) # clear out html5locations if none exist if retval["html5locations"]: del retval["html5locations"] return UR.prepare_response(retval)