コード例 #1
0
ファイル: CoreService.py プロジェクト: syuhei176/cloocagame
def myprojects(session):
    if "user" in session:
        connect = MySQLdb.connect(
            db=config.DB_NAME, host=config.DB_HOST, port=config.DB_PORT, user=config.DB_USER, passwd=config.DB_PASSWD
        )
        myprojects = ProjectService.loadMyOwnProjectList(session["user"], connect)
        connect.close()
        return json.dumps(myprojects)
コード例 #2
0
ファイル: CoreService.py プロジェクト: syuhei176/cloocagame
def dashboard(gid):
    if "user" in session:
        connect = MySQLdb.connect(
            db=config.DB_NAME, host=config.DB_HOST, port=config.DB_PORT, user=config.DB_USER, passwd=config.DB_PASSWD
        )
        cur = connect.cursor()
        cur.execute("SELECT group_id,role FROM JoinInfo WHERE user_id=%s AND group_id=%s;", (session["user"]["id"], id))
        rows = cur.fetchall()
        cur.close()
        if not len(rows) == 0:
            joinInfo = {}
            joinInfo["id"] = int(id)
            joinInfo["role"] = int(rows[0][1])
            if joinInfo["role"] == 0:
                return render_template(
                    "dashboard.html",
                    loggedin=True,
                    username=session["user"]["uname"],
                    mymetamodel=json.dumps(MetaModelService.loadMyMetaModelList(session["user"], id, connect)),
                    myproject=json.dumps(ProjectService.loadMyProjectList(session["user"], id, connect)),
                    metamodels=json.dumps(MetaModelService.loadMetaModelList(session["user"], id, connect)),
                    group=GroupService.getGroup(session["user"], joinInfo["id"], connect),
                    #                                       members = GroupService.getGroupMember(session['user'], joinInfo['id'], connect),
                    group_id=joinInfo["id"],
                )
            elif joinInfo["role"] == 1:
                return render_template(
                    "dashboard1.html",
                    loggedin=True,
                    username=session["user"]["uname"],
                    mymetamodel=json.dumps(MetaModelService.loadMyMetaModelList(session["user"], id, connect)),
                    groupmetamodel=json.dumps(MetaModelService.loadGroupMetaModelList(session["user"], id, connect)),
                    myproject=json.dumps(ProjectService.loadMyProjectList(session["user"], id, connect)),
                    metamodels=json.dumps(MetaModelService.loadMetaModelList(session["user"], id, connect)),
                    group=GroupService.getGroup(session["user"], joinInfo["id"], connect),
                    members=GroupService.getGroupMember(session["user"], joinInfo["id"], connect),
                    group_id=joinInfo["id"],
                    hash_key=hash(joinInfo["id"]),
                )
    else:
        return redirect(url_for("login_view"))
    return render_template("request_deny.html")
コード例 #3
0
ファイル: CoreService.py プロジェクト: syuhei176/cloocagame
def mydashboard(user):
    connect = MySQLdb.connect(
        db=config.DB_NAME, host=config.DB_HOST, port=config.DB_PORT, user=config.DB_USER, passwd=config.DB_PASSWD
    )
    myprojects = ProjectService.loadMyOwnProjectList(user, connect)
    mymetamodels = MetaModelService.loadMyOwnMetaModelList(user, connect)
    mytools = MetaModelService.loadMyTools(user, connect)
    # accountinfo = UserService.getAccountInfo()
    connect.close()
    return render_template(
        "mydashboard.html",
        myprojects=json.dumps(myprojects),
        mymetamodels=json.dumps(mymetamodels),
        mytools=json.dumps(mytools),
    )