|
|
@@ -38,8 +38,10 @@ def delete(mid):
|
|
38
|
38
|
@login_required
|
|
39
|
39
|
def edit(mid):
|
|
40
|
40
|
db = get_db()
|
|
|
41
|
+ edit_location=None
|
|
41
|
42
|
|
|
42
|
43
|
if request.method == "POST":
|
|
|
44
|
+
|
|
43
|
45
|
if "name" in request.form:
|
|
44
|
46
|
name = request.form['name']
|
|
45
|
47
|
bio = request.form['bio']
|
|
|
@@ -49,6 +51,8 @@ def edit(mid):
|
|
49
|
51
|
db.execute("UPDATE member SET member_name=(?), bio=(?), subtitle=(?), public=(?), theme=(?) WHERE id=(?)",(name, bio, subtitle, privacy, theme, mid))
|
|
50
|
52
|
db.commit()
|
|
51
|
53
|
|
|
|
54
|
+ edit_location="details"
|
|
|
55
|
+
|
|
52
|
56
|
if "file" in request.files:
|
|
53
|
57
|
# here we are just saving the uploaded file to the icons folder.
|
|
54
|
58
|
# we're not going hard on security because we expect there to only be 1 admin
|
|
|
@@ -56,22 +60,48 @@ def edit(mid):
|
|
56
|
60
|
file = request.files["file"]
|
|
57
|
61
|
filename = str(uuid.uuid4()) + "." + file.filename.split(".")[1]
|
|
58
|
62
|
file.save(os.path.join(current_app.config["ICON_UPLOAD_FOLDER"], filename))
|
|
59
|
|
- db.execute("INSERT INTO icons (member_id, icon_location) VALUES (?, ?)", (mid, filename),)
|
|
|
63
|
+ db.execute("INSERT INTO icons (member_id, icon_location) VALUES (?, ?)", (mid, filename))
|
|
60
|
64
|
db.commit()
|
|
61
|
65
|
|
|
|
66
|
+ edit_location="icons"
|
|
|
67
|
+
|
|
62
|
68
|
if "gid_add" in request.form:
|
|
63
|
69
|
gid = request.form["gid_add"]
|
|
64
|
70
|
db.execute("INSERT INTO group_members (group_id,member_id) VALUES (?,?)",(gid,mid))
|
|
65
|
71
|
db.commit()
|
|
66
|
72
|
|
|
|
73
|
+ edit_location="groups"
|
|
|
74
|
+
|
|
67
|
75
|
elif "gid_remove" in request.form:
|
|
68
|
76
|
gid = request.form["gid_remove"]
|
|
69
|
77
|
db.execute("DELETE FROM group_members WHERE group_id=(?) AND member_id=(?)",(gid,mid))
|
|
70
|
78
|
db.commit()
|
|
71
|
79
|
|
|
|
80
|
+ edit_location="groups"
|
|
|
81
|
+
|
|
|
82
|
+ if "blinkie" in request.files:
|
|
|
83
|
+ file = request.files["blinkie"]
|
|
|
84
|
+ filename = str(uuid.uuid4()) + "." + file.filename.split(".")[1]
|
|
|
85
|
+ file.save(os.path.join(current_app.config["BLINKIES_UPLOAD_FOLDER"], filename))
|
|
|
86
|
+ db.execute("INSERT INTO blinkies (member_id, blinkie_location) VALUES (?, ?)", (mid, filename))
|
|
|
87
|
+ db.commit()
|
|
|
88
|
+
|
|
|
89
|
+ edit_location="blinkies"
|
|
|
90
|
+
|
|
|
91
|
+ if "stamp" in request.files:
|
|
|
92
|
+ file = request.files["stamp"]
|
|
|
93
|
+ filename = str(uuid.uuid4()) + "." + file.filename.split(".")[1]
|
|
|
94
|
+ file.save(os.path.join(current_app.config["STAMPS_UPLOAD_FOLDER"], filename))
|
|
|
95
|
+ db.execute("INSERT INTO stamps (member_id, stamp_location) VALUES (?, ?)", (mid, filename))
|
|
|
96
|
+ db.commit()
|
|
|
97
|
+
|
|
|
98
|
+ edit_location="stamps"
|
|
|
99
|
+
|
|
72
|
100
|
|
|
73
|
101
|
member = db.execute("SELECT * FROM member WHERE id=(?)",(mid,)).fetchone()
|
|
74
|
102
|
icons = db.execute("SELECT * FROM icons WHERE member_id=(?)",(mid,)).fetchall()
|
|
|
103
|
+ blinkies = db.execute("SELECT * FROM blinkies WHERE member_id=(?)",(mid,)).fetchall()
|
|
|
104
|
+ stamps = db.execute("SELECT * FROM stamps WHERE member_id=(?)",(mid,)).fetchall()
|
|
75
|
105
|
|
|
76
|
106
|
groups = db.execute("SELECT * FROM groups").fetchall()
|
|
77
|
107
|
member_groups = db.execute("SELECT * FROM group_members WHERE member_id=(?)",(mid,)).fetchall()
|
|
|
@@ -91,7 +121,7 @@ def edit(mid):
|
|
91
|
121
|
|
|
92
|
122
|
themes = os.listdir(current_app.config["THEMES_FOLDER"])
|
|
93
|
123
|
|
|
94
|
|
- return render_template("manage/edit.html", member=member, icons=icons, unjoined_groups=unjoined_groups, joined_groups=joined_groups, themes=themes)
|
|
|
124
|
+ return render_template("manage/edit.html", member=member, icons=icons, unjoined_groups=unjoined_groups, joined_groups=joined_groups, themes=themes, edit_location=edit_location, blinkies=blinkies, stamps=stamps)
|
|
95
|
125
|
|
|
96
|
126
|
@bp.route("/set_main_icon/<mid>/<icon_id>")
|
|
97
|
127
|
@login_required
|
|
|
@@ -164,10 +194,21 @@ def remove_home(mid,location):
|
|
164
|
194
|
return redirect(url_for('home.full_list'))
|
|
165
|
195
|
|
|
166
|
196
|
|
|
167
|
|
-@bp.route("/assets")
|
|
|
197
|
+@bp.route("/assets", methods=('GET', 'POST'))
|
|
168
|
198
|
@login_required
|
|
169
|
199
|
def assets():
|
|
170
|
200
|
db = get_db()
|
|
|
201
|
+
|
|
|
202
|
+ if "blinkie" in request.files:
|
|
|
203
|
+ file = request.files["blinkie"]
|
|
|
204
|
+ filename = file.filename
|
|
|
205
|
+ file.save(os.path.join(current_app.config["BLINKIES_UPLOAD_FOLDER"], filename))
|
|
|
206
|
+
|
|
|
207
|
+ if "stamp" in request.files:
|
|
|
208
|
+ file = request.files["stamp"]
|
|
|
209
|
+ filename = file.filename
|
|
|
210
|
+ file.save(os.path.join(current_app.config["STAMPS_UPLOAD_FOLDER"], filename))
|
|
|
211
|
+
|
|
171
|
212
|
icons = db.execute("SELECT * FROM icons").fetchall()
|
|
172
|
213
|
icon_storage = os.listdir(current_app.config["ICON_UPLOAD_FOLDER"])
|
|
173
|
214
|
|
|
|
@@ -188,7 +229,10 @@ def assets():
|
|
188
|
229
|
if not in_storage:
|
|
189
|
230
|
unlinked_icons.append(i)
|
|
190
|
231
|
|
|
191
|
|
- return render_template("manage/assets.html", icons=unlinked_icons, icon_storage=i_storage)
|
|
|
232
|
+ blinkies = os.listdir(current_app.config["BLINKIES_UPLOAD_FOLDER"])
|
|
|
233
|
+ stamps = os.listdir(current_app.config["STAMPS_UPLOAD_FOLDER"])
|
|
|
234
|
+
|
|
|
235
|
+ return render_template("manage/assets.html", icons=unlinked_icons, icon_storage=i_storage, blinkies=blinkies, stamps=stamps)
|
|
192
|
236
|
|
|
193
|
237
|
@bp.route("/delete_idb")
|
|
194
|
238
|
@login_required
|