fix #15 REQUIRES DB INIT

This commit is contained in:
cube
2026-04-03 21:49:39 +01:00
parent 567f736d0d
commit b40cb00d4d
4 changed files with 87 additions and 41 deletions

View File

@@ -82,6 +82,18 @@ def edit(mid):
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.
# we're not going hard on security because we expect there to only be 1 admin

View File

@@ -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)
);

View File

@@ -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>

View File

@@ -27,6 +27,7 @@
</div>
<br class="clear" />
{% if member[11] %}
{% if blog|length > 0 %}
{% if not g.user and not blog_public_show %}
{% else %}
@@ -48,29 +49,36 @@
{% 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 %}
{% endif %}
{% endif %}
<br class="clear" />
{% 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 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" />