fix #15 REQUIRES DB INIT
This commit is contained in:
@@ -80,7 +80,19 @@ def edit(mid):
|
||||
db.execute("UPDATE member SET member_name=(?), bio=(?), subtitle=(?), public=(?), theme=(?) WHERE id=(?)",(name, bio, subtitle, privacy, theme, mid))
|
||||
db.commit()
|
||||
|
||||
edit_location="details"
|
||||
edit_location = "details"
|
||||
|
||||
if "page_settings" in request.form:
|
||||
show_groups = "show_groups" in request.form
|
||||
show_blog = "show_blog" in request.form
|
||||
show_icons = "show_icons" in request.form
|
||||
show_blinkies = "show_blinkies" in request.form
|
||||
show_stamps = "show_stamps" in request.form
|
||||
|
||||
db.execute("UPDATE member SET show_groups=(?), show_blog=(?), show_icons=(?), show_blinkies=(?), show_stamps=(?) WHERE id=(?)",(show_groups, show_blog, show_icons, show_blinkies, show_stamps, mid))
|
||||
db.commit()
|
||||
|
||||
edit_location = "page_settings"
|
||||
|
||||
if "file" in request.files:
|
||||
# here we are just saving the uploaded file to the icons folder.
|
||||
@@ -92,21 +104,21 @@ def edit(mid):
|
||||
db.execute("INSERT INTO icons (member_id, icon_location) VALUES (?, ?)", (mid, filename))
|
||||
db.commit()
|
||||
|
||||
edit_location="icons"
|
||||
edit_location = "icons"
|
||||
|
||||
if "gid_add" in request.form:
|
||||
gid = request.form["gid_add"]
|
||||
db.execute("INSERT INTO group_members (group_id,member_id) VALUES (?,?)",(gid,mid))
|
||||
db.commit()
|
||||
|
||||
edit_location="groups"
|
||||
edit_location = "groups"
|
||||
|
||||
elif "gid_remove" in request.form:
|
||||
gid = request.form["gid_remove"]
|
||||
db.execute("DELETE FROM group_members WHERE group_id=(?) AND member_id=(?)",(gid,mid))
|
||||
db.commit()
|
||||
|
||||
edit_location="groups"
|
||||
edit_location = "groups"
|
||||
|
||||
if "blinkie" in request.files:
|
||||
file = request.files["blinkie"]
|
||||
@@ -115,7 +127,7 @@ def edit(mid):
|
||||
db.execute("INSERT INTO blinkies (member_id, blinkie_location) VALUES (?, ?)", (mid, filename))
|
||||
db.commit()
|
||||
|
||||
edit_location="blinkies"
|
||||
edit_location = "blinkies"
|
||||
|
||||
if "stamp" in request.files:
|
||||
file = request.files["stamp"]
|
||||
@@ -124,7 +136,7 @@ def edit(mid):
|
||||
db.execute("INSERT INTO stamps (member_id, stamp_location) VALUES (?, ?)", (mid, filename))
|
||||
db.commit()
|
||||
|
||||
edit_location="stamps"
|
||||
edit_location = "stamps"
|
||||
|
||||
|
||||
member = db.execute("SELECT * FROM member WHERE id=(?)",(mid,)).fetchone()
|
||||
|
||||
@@ -27,6 +27,16 @@ CREATE TABLE member (
|
||||
front BOOLEAN NOT NULL DEFAULT 0,
|
||||
public BOOLEAN NOT NULL DEFAULT 1,
|
||||
theme TEXT NOT NULL DEFAULT 'default',
|
||||
show_blog BOOLEAN NOT NULL DEFAULT 1,
|
||||
show_icons BOOLEAN NOT NULL DEFAULT 1,
|
||||
show_blinkies BOOLEAN NOT NULL DEFAULT 1,
|
||||
show_stamps BOOLEAN NOT NULL DEFAULT 1,
|
||||
show_groups BOOLEAN NOT NULL DEFAULT 1,
|
||||
blog_title TEXT DEFAULT "Blog",
|
||||
icons_title TEXT DEFAULT "Icons",
|
||||
blinkies_title TEXT DEFAULT "Blinkies",
|
||||
stamps_title TEXT DEFAULT "Stamps",
|
||||
groups_title TEXT DEFAULT "Groups",
|
||||
FOREIGN KEY (user_id) REFERENCES user (id),
|
||||
FOREIGN KEY (main_icon) REFERENCES icons (id)
|
||||
);
|
||||
|
||||
@@ -33,6 +33,22 @@
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
|
||||
<div class="heading">Public Page Settings</div>
|
||||
<form method="post" id="page_settings">
|
||||
<p>Select which sections to show on this member's public page</p>
|
||||
<input type="checkbox" id="show_groups" name="show_groups" {% if member[15] %}checked{% endif %}>
|
||||
<label for="show_groups">Groups</label><br>
|
||||
<input type="checkbox" id="show_blog" name="show_blog" {% if member[11] %}checked{% endif %}>
|
||||
<label for="show_blog">Blog</label><br>
|
||||
<input type="checkbox" id="show_icons" name="show_icons" {% if member[12] %}checked{% endif %}>
|
||||
<label for="show_icons">Icons</label><br>
|
||||
<input type="checkbox" id="show_blinkies" name="show_blinkies" {% if member[13] %}checked{% endif %}>
|
||||
<label for="show_blinkies">Blinkies</label><br>
|
||||
<input type="checkbox" id="show_stamps" name="show_stamps" {% if member[14] %}checked{% endif %}>
|
||||
<label for="show_stamps">Stamps</label><br>
|
||||
<input type="submit" name="page_settings" value="Submit">
|
||||
</form>
|
||||
|
||||
{% if unjoined_groups or joined_groups %}
|
||||
<div class="heading">Manage groups</div>
|
||||
|
||||
|
||||
@@ -26,50 +26,58 @@
|
||||
{{member[5].replace('\n', '<br>')|safe}}
|
||||
</div>
|
||||
<br class="clear" />
|
||||
|
||||
{% if blog|length > 0 %}
|
||||
{% if not g.user and not blog_public_show %}
|
||||
{% else %}
|
||||
<div class="heading big">{{member[3]}}'s blog</div>
|
||||
{% endif %}
|
||||
<div id="blog">
|
||||
{% for post in blog %}
|
||||
{% if not g.user and post[5]==0 %}
|
||||
|
||||
{% if member[11] %}
|
||||
{% if blog|length > 0 %}
|
||||
{% if not g.user and not blog_public_show %}
|
||||
{% else %}
|
||||
<div class="post">
|
||||
<div class="title">{{post[3]|safe}}</div>
|
||||
<div class="timestamp">{{post[2]}} {% if g.user %}{% if post[5]==0 %}(Private){% else %}(Public){% endif %}{% endif %}</div>
|
||||
<div class="content">
|
||||
{{post[4].replace('\n', '<br>')|safe}}
|
||||
</div>
|
||||
{% if g.user %}<a href="{{url_for('blog.toggle',pid=post[0], location=member[0])}}">Toggle privacy</a> | <a href="{{url_for('blog.edit',pid=post[0],location=member[0])}}">Edit Post</a> | <a href="{{url_for('blog.delete', pid=post[0], location=member[0])}}" class="danger">Delete post</a>{% endif %}
|
||||
</div>
|
||||
<div class="heading big">{{member[3]}}'s blog</div>
|
||||
{% endif %}
|
||||
<div id="blog">
|
||||
{% for post in blog %}
|
||||
{% if not g.user and post[5]==0 %}
|
||||
{% else %}
|
||||
<div class="post">
|
||||
<div class="title">{{post[3]|safe}}</div>
|
||||
<div class="timestamp">{{post[2]}} {% if g.user %}{% if post[5]==0 %}(Private){% else %}(Public){% endif %}{% endif %}</div>
|
||||
<div class="content">
|
||||
{{post[4].replace('\n', '<br>')|safe}}
|
||||
</div>
|
||||
{% if g.user %}<a href="{{url_for('blog.toggle',pid=post[0], location=member[0])}}">Toggle privacy</a> | <a href="{{url_for('blog.edit',pid=post[0],location=member[0])}}">Edit Post</a> | <a href="{{url_for('blog.delete', pid=post[0], location=member[0])}}" class="danger">Delete post</a>{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if member[13] %}
|
||||
{% if blinkies|length > 0 %}
|
||||
<div class="heading big">Blinkies</div>
|
||||
{% for blinkie in blinkies %}
|
||||
<img class="blinkie" src="{{ url_for('static', filename='blinkies/'+blinkie[0]) }}">
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if blinkies|length > 0 %}
|
||||
<div class="heading big">Blinkies</div>
|
||||
{% for blinkie in blinkies %}
|
||||
<img class="blinkie" src="{{ url_for('static', filename='blinkies/'+blinkie[0]) }}">
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<br class="clear" />
|
||||
|
||||
{% if stamps|length > 0 %}
|
||||
<div class="heading big">Stamps</div>
|
||||
{% for stamp in stamps %}
|
||||
<img class="stamp" src="{{ url_for('static', filename='stamps/'+stamp[0]) }}">
|
||||
{% endfor %}
|
||||
{% if member[14] %}
|
||||
{% if stamps|length > 0 %}
|
||||
<div class="heading big">Stamps</div>
|
||||
{% for stamp in stamps %}
|
||||
<img class="stamp" src="{{ url_for('static', filename='stamps/'+stamp[0]) }}">
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<br class="clear" />
|
||||
|
||||
{% if all_icons|length > 1 %}
|
||||
<div class="heading big">Icons</div>
|
||||
{% for i in all_icons %}
|
||||
<img class="icon" src="{{ url_for('static', filename='icons/'+i[0]) }}">
|
||||
{% endfor %}
|
||||
{% if member[12] %}
|
||||
{% if all_icons|length > 1 %}
|
||||
<div class="heading big">Icons</div>
|
||||
{% for i in all_icons %}
|
||||
<img class="icon" src="{{ url_for('static', filename='icons/'+i[0]) }}">
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<br class="clear" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user