fix #5
This commit is contained in:
@@ -70,12 +70,13 @@ def page(mid):
|
|||||||
blinkies = db.execute("SELECT blinkie_location FROM blinkies WHERE member_id=(?)",(mid,)).fetchall()
|
blinkies = db.execute("SELECT blinkie_location FROM blinkies WHERE member_id=(?)",(mid,)).fetchall()
|
||||||
stamps = db.execute("SELECT stamp_location FROM stamps WHERE member_id=(?)",(mid,)).fetchall()
|
stamps = db.execute("SELECT stamp_location FROM stamps WHERE member_id=(?)",(mid,)).fetchall()
|
||||||
blog_public = db.execute("SELECT * FROM blog WHERE member_id=(?) AND public=(?)",(mid,1)).fetchall()
|
blog_public = db.execute("SELECT * FROM blog WHERE member_id=(?) AND public=(?)",(mid,1)).fetchall()
|
||||||
|
sections = db.execute("SELECT * FROM sections WHERE member_id=(?) ORDER BY position ASC",(mid,)).fetchall()
|
||||||
|
|
||||||
blog_public_show = False
|
blog_public_show = False
|
||||||
if len(blog_public) > 0:
|
if len(blog_public) > 0:
|
||||||
blog_public_show = True
|
blog_public_show = True
|
||||||
|
|
||||||
return render_template('page.html', member=member, blog=blog, icon=icon, all_icons=all_icons, blinkies=blinkies, stamps=stamps, blog_public_show=blog_public_show)
|
return render_template('page.html', member=member, blog=blog, icon=icon, all_icons=all_icons, blinkies=blinkies, stamps=stamps, blog_public_show=blog_public_show, sections=sections)
|
||||||
|
|
||||||
@bp.route("/groups")
|
@bp.route("/groups")
|
||||||
def groups():
|
def groups():
|
||||||
|
|||||||
@@ -150,11 +150,32 @@ def edit(mid):
|
|||||||
|
|
||||||
edit_location = "stamps"
|
edit_location = "stamps"
|
||||||
|
|
||||||
|
if "new_section" in request.form:
|
||||||
|
section_title = request.form["section_title"]
|
||||||
|
section_content = request.form["section_content"]
|
||||||
|
|
||||||
|
db.execute("INSERT INTO sections (member_id, title, content) VALUES (?, ?, ?)", (mid, section_title, section_content))
|
||||||
|
db.commit()
|
||||||
|
|
||||||
|
edit_location = "sections"
|
||||||
|
|
||||||
|
if "update_section" in request.form:
|
||||||
|
section_id = request.form["section_id"]
|
||||||
|
section_title = request.form["section_title"]
|
||||||
|
section_content = request.form["section_content"]
|
||||||
|
section_position = request.form["section_pos"]
|
||||||
|
|
||||||
|
db.execute("UPDATE sections SET title=(?), content=(?), position=(?) WHERE id=(?)",(section_title, section_content, section_position, section_id))
|
||||||
|
db.commit()
|
||||||
|
|
||||||
|
edit_location = "sections"
|
||||||
|
|
||||||
|
|
||||||
member = db.execute("SELECT * FROM member WHERE id=(?)",(mid,)).fetchone()
|
member = db.execute("SELECT * FROM member WHERE id=(?)",(mid,)).fetchone()
|
||||||
icons = db.execute("SELECT * FROM icons WHERE member_id=(?)",(mid,)).fetchall()
|
icons = db.execute("SELECT * FROM icons WHERE member_id=(?)",(mid,)).fetchall()
|
||||||
blinkies = db.execute("SELECT * FROM blinkies WHERE member_id=(?)",(mid,)).fetchall()
|
blinkies = db.execute("SELECT * FROM blinkies WHERE member_id=(?)",(mid,)).fetchall()
|
||||||
stamps = db.execute("SELECT * FROM stamps WHERE member_id=(?)",(mid,)).fetchall()
|
stamps = db.execute("SELECT * FROM stamps WHERE member_id=(?)",(mid,)).fetchall()
|
||||||
|
sections = db.execute("SELECT * FROM sections WHERE member_id=(?)",(mid,)).fetchall()
|
||||||
|
|
||||||
groups = db.execute("SELECT * FROM groups").fetchall()
|
groups = db.execute("SELECT * FROM groups").fetchall()
|
||||||
member_groups = db.execute("SELECT * FROM group_members WHERE member_id=(?)",(mid,)).fetchall()
|
member_groups = db.execute("SELECT * FROM group_members WHERE member_id=(?)",(mid,)).fetchall()
|
||||||
@@ -174,7 +195,18 @@ def edit(mid):
|
|||||||
|
|
||||||
themes = os.listdir(current_app.config["THEMES_FOLDER"])
|
themes = os.listdir(current_app.config["THEMES_FOLDER"])
|
||||||
|
|
||||||
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)
|
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, sections=sections)
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route("/delete_section/<sid>")
|
||||||
|
@login_required
|
||||||
|
def delete_section(sid):
|
||||||
|
db = get_db()
|
||||||
|
mid = db.execute("SELECT member_id FROM sections WHERE id=(?)",(sid,)).fetchone()[0]
|
||||||
|
db.execute("DELETE FROM sections WHERE id=(?)",(sid,))
|
||||||
|
db.commit()
|
||||||
|
|
||||||
|
return redirect(url_for("manage.edit", mid=mid))
|
||||||
|
|
||||||
@bp.route("/set_main_icon/<mid>/<icon_id>")
|
@bp.route("/set_main_icon/<mid>/<icon_id>")
|
||||||
@login_required
|
@login_required
|
||||||
|
|||||||
@@ -147,6 +147,36 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<div class="heading">Custom Page Sections</div>
|
||||||
|
<p>Here you can make sections for your page, embed whatever you like</p>
|
||||||
|
<form method="post" id="sections">
|
||||||
|
<label for="section_title">Section Title</label>
|
||||||
|
<input name="section_title" id="section_title"><br>
|
||||||
|
<label for="section_content">Section Content</label>
|
||||||
|
<textarea name="section_content" id="section_content">Hello World!</textarea><br><br>
|
||||||
|
<input type="submit" name="new_section" value="Create New Section">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
{% for section in sections %}
|
||||||
|
<form method="post">
|
||||||
|
<label for="section_pos">Position</label>
|
||||||
|
<input name="section_pos" id="section_pos" value="{{section[4]}}"><br>
|
||||||
|
<label for="section_title">Section Title</label>
|
||||||
|
<input name="section_title" id="section_title" value="{{section[2]}}"><br>
|
||||||
|
<label for="section_content">Section Content</label>
|
||||||
|
<textarea name="section_content" id="section_content">{{section[3]}}</textarea><br><br>
|
||||||
|
<input type="hidden" id="section_id" name="section_id" value="{{section[0]}}">
|
||||||
|
<input type="submit" name="update_section" value="Update Section">
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<a href="{{ url_for('manage.delete_section', sid=section[0]) }}">Delete section</a>
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
<div class="heading">Manage Member Data</div>
|
<div class="heading">Manage Member Data</div>
|
||||||
<a href="{{ url_for('manage.export_fields', mid=member[0]) }}">Export Fields</a><br>
|
<a href="{{ url_for('manage.export_fields', mid=member[0]) }}">Export Fields</a><br>
|
||||||
|
|||||||
@@ -53,6 +53,13 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% for section in sections %}
|
||||||
|
{% if section[2] %}<div class="heading big">{{ section[2] }}</div>{% endif %}
|
||||||
|
<div class="maintext">
|
||||||
|
{{ section[3].replace('\n', '<br>')|safe }}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
<!-- {% if groups|length > 0 %}
|
<!-- {% if groups|length > 0 %}
|
||||||
<div class="heading big">{{ member[20] }}</div>
|
<div class="heading big">{{ member[20] }}</div>
|
||||||
{% for group in groups %}
|
{% for group in groups %}
|
||||||
|
|||||||
Reference in New Issue
Block a user