예제 #1
0
def createTile():
    authToken = AuthModule.validateCookie()
    rawData = flask.request.form

    projectID = int(rawData.get("projectID"))
    updateJsonString = rawData.get("tileData")

    entryType = "createTile"
    returnMessage = DivcoDataStore.addToProjectHistory(projectID, entryType,
                                                       updateJsonString)

    transTileChange = map(lambda node: DivcoDataStore.getTransFormat(node),
                          returnMessage["tileChange"])

    response = {}
    response["result"] = returnMessage["status"]
    response["dataChange"] = list(transTileChange)

    return jsonResponse(response, authToken)
예제 #2
0
def getData():
    authToken = AuthModule.validateCookie()

    projectID = int(flask.request.args.get('projectID', ''))
    tileID = int(flask.request.args.get('tileID', ''))

    currentRoot = DivcoDataStore.getTileDataNode(projectID, tileID)
    divcoTileData = DivcoDataStore.getTileDataTree(
        projectID, tileID, currentRoot["stepCounter"] + 4)

    currentNode = DivcoDataStore.getTileDataNode(projectID, tileID)
    parentPath = currentNode["parentPath"]

    for pathTileID in parentPath:
        if pathTileID != tileID:
            pathNode = DivcoDataStore.getTileDataNode(projectID, pathTileID)
            divcoTileData.append(DivcoDataStore.getTransFormat(pathNode))

    response = {}
    response["crumbPath"] = parentPath
    response["data"] = divcoTileData

    return jsonResponse(response, authToken)