last 2 tasks to go

This commit is contained in:
crunk 2022-03-27 12:46:08 +02:00
parent 96c7f3a532
commit 36039fceed
7 changed files with 87 additions and 11 deletions

View File

@ -37,6 +37,7 @@ def create_app():
APP.config["SECRET_KEY"] = os.urandom(24)
APP.config["UPLOAD_FOLDER"] = "tmpupload"
APP.config["PUBLIC_THEMES"] = "themes/publicthemes"
csrf.init_app(APP)
login_manager.init_app(APP)

View File

@ -43,9 +43,11 @@ def ValidateEditCssForm(editorform, current_distribusi):
newcssfolder = os.path.join("themes/userthemes", current_distribusi)
if os.path.exists(newcssfolder):
shutil.rmtree(newcssfolder)
publicfolder = os.path.join("themes/publicthemes", current_distribusi)
if os.path.exists(publicfolder):
shutil.rmtree(publicfolder)
if editorform.public.data:
MakePublicTheme(editorform, current_distribusi)
if editorform.cssfile.data:

View File

@ -15,6 +15,7 @@ from flask_login import (
from flask_mail import Mail
from flask_wtf.csrf import CSRFError
from app import create_app, login_manager
from usermodel import User
# Use upload form to populate filters
@ -50,19 +51,21 @@ def session_handler():
@APP.route("/")
def index():
ResetUserState()
# http://localhost:5000/themes/publicthemes/RomeroTape/blueskies.css
uploadform = UploadForm()
distribusis = DistribusisInfo.visibledistribusis()
distribusies = {}
distribusisindex = {}
for distribusi in distribusis:
user = User.query.filter_by(id=distribusi.userid).first()
singledistribusi = {
"username": user.username,
"publictheme": distribusi.publictheme,
"term": distribusi.term,
"course": distribusi.course,
"year": distribusi.year,
"tags": distribusi.tags.split(","),
}
distribusies[distribusi.distribusiname] = singledistribusi
distribusisindex[distribusi.distribusiname] = singledistribusi
years = uploadform.academicyear.choices
terms = uploadform.term.choices
courses = uploadform.course.choices
@ -70,7 +73,7 @@ def index():
adminuser = isadminuser()
template = render_template(
"index.html",
distribusies=distribusies,
distribusisindex=distribusisindex,
years=years,
terms=terms,
courses=courses,
@ -79,6 +82,11 @@ def index():
return template
@APP.route("/help")
def help():
return render_template("help.html")
@APP.route("/distribusi", methods=["GET", "POST"])
@login_required
def distribusi():

View File

@ -104,8 +104,12 @@ fieldset.tagfield > input {
}
#publicthemes > ul {
max-height: 20em;
overflow: scroll;
overflow: auto;
}
#publicthemes > ul > li{
word-break: break-all;
}
input {
border: none;
background: #E0B0FF;

View File

@ -11,6 +11,11 @@
<input type="button" name="button" value="Logout"></input>
</a>
</div>
<div class="help">
<a href="/help">
<input type="button" name="button" value="Help"></input>
</a>
</div>
</div>
<div id="mainworkflow">
{% if selectorvisible %}

50
verse/templates/help.html Normal file
View File

@ -0,0 +1,50 @@
{% extends "base.html" %}
{% block main %}
<div id="buttons">
{% if not current_user.is_authenticated %}
<div class="signin">
<a href="/login">
<input type="button" name="button" value="Sign in"></input>
</a>
</div>
<div class="signin">
<a href="/register">
<input type="button" name="button" value="Register"></input>
</a>
</div>
{% else %}
<div class="distribusi">
<a href="/distribusi">
<input type="button" name="button" value="Distribusi"></input>
</a>
</div>
<div class="logout">
<a href="/logout">
<input type="button" name="button" value="Logout"></input>
</a>
</div>
{% endif %}
{% if adminuser %}
<div class="admin">
<a href="/admin">
<input type="button" name="button" value="Admin"></input>
</a>
</div>
{% endif %}
</div>
{% if current_user.is_authenticated %}
<h2 id="fancyboi"> Hi {{ current_user.email }}!</h2>
{% else %}
<h2 id="fancyboi"> Welcome to distribusi-verse</h2>
{% endif %}
<div class="maincontent">
<h2>Distribusi-verse</h2>
<h3>Zipfiles become websites</h3>
<h3>Folders become links and pages</h3>
<h3>Media files become visible</h3>
<h3>Text files become readable</h3>
<h3>Use Css to style your page</h3>
</div>
<!-- a div with all the distribusis listed in the distribusiverse -->
{% endblock %}

View File

@ -1,6 +1,7 @@
{% extends "base.html" %}
{% block main %}
<div id="buttons">
{% if not current_user.is_authenticated %}
<div class="signin">
<a href="/login">
@ -18,12 +19,6 @@
<input type="button" name="button" value="Distribusi"></input>
</a>
</div>
<div class="logout">
<a href="/logout">
<input type="button" name="button" value="Logout"></input>
</a>
</div>
{% endif %}
{% if adminuser %}
<div class="admin">
<a href="/admin">
@ -31,6 +26,17 @@
</a>
</div>
{% endif %}
<div class="logout">
<a href="/logout">
<input type="button" name="button" value="Logout"></input>
</a>
</div>
{% endif %}
<div class="help">
<a href="/help">
<input type="button" name="button" value="Help"></input>
</a>
</div>
</div>
{% if current_user.is_authenticated %}
<h2 id="fancyboi"> Hi {{ current_user.email }}!</h2>
@ -51,7 +57,7 @@
<h2>List of distribusis</h2>
{% include 'filtermenu.html' %}
<ul>
{% for name, distribusi in distribusies.items() %}
{% for name, distribusi in distribusisindex.items() %}
<li class='distribusi filter {{ distribusi["term"] }} {{ distribusi["year"] }} {{ distribusi["course"] }}'>
<a href='stash/{{name}}/index.html'>{{distribusi["username"]}}:{{name}}</a>
{% for tag in distribusi["tags"] %}