last 2 tasks to go
This commit is contained in:
parent
96c7f3a532
commit
36039fceed
@ -37,6 +37,7 @@ def create_app():
|
|||||||
|
|
||||||
APP.config["SECRET_KEY"] = os.urandom(24)
|
APP.config["SECRET_KEY"] = os.urandom(24)
|
||||||
APP.config["UPLOAD_FOLDER"] = "tmpupload"
|
APP.config["UPLOAD_FOLDER"] = "tmpupload"
|
||||||
|
APP.config["PUBLIC_THEMES"] = "themes/publicthemes"
|
||||||
|
|
||||||
csrf.init_app(APP)
|
csrf.init_app(APP)
|
||||||
login_manager.init_app(APP)
|
login_manager.init_app(APP)
|
||||||
|
@ -43,9 +43,11 @@ def ValidateEditCssForm(editorform, current_distribusi):
|
|||||||
newcssfolder = os.path.join("themes/userthemes", current_distribusi)
|
newcssfolder = os.path.join("themes/userthemes", current_distribusi)
|
||||||
if os.path.exists(newcssfolder):
|
if os.path.exists(newcssfolder):
|
||||||
shutil.rmtree(newcssfolder)
|
shutil.rmtree(newcssfolder)
|
||||||
|
|
||||||
publicfolder = os.path.join("themes/publicthemes", current_distribusi)
|
publicfolder = os.path.join("themes/publicthemes", current_distribusi)
|
||||||
if os.path.exists(publicfolder):
|
if os.path.exists(publicfolder):
|
||||||
shutil.rmtree(publicfolder)
|
shutil.rmtree(publicfolder)
|
||||||
|
|
||||||
if editorform.public.data:
|
if editorform.public.data:
|
||||||
MakePublicTheme(editorform, current_distribusi)
|
MakePublicTheme(editorform, current_distribusi)
|
||||||
if editorform.cssfile.data:
|
if editorform.cssfile.data:
|
||||||
|
@ -15,6 +15,7 @@ from flask_login import (
|
|||||||
from flask_mail import Mail
|
from flask_mail import Mail
|
||||||
from flask_wtf.csrf import CSRFError
|
from flask_wtf.csrf import CSRFError
|
||||||
from app import create_app, login_manager
|
from app import create_app, login_manager
|
||||||
|
|
||||||
from usermodel import User
|
from usermodel import User
|
||||||
|
|
||||||
# Use upload form to populate filters
|
# Use upload form to populate filters
|
||||||
@ -50,19 +51,21 @@ def session_handler():
|
|||||||
@APP.route("/")
|
@APP.route("/")
|
||||||
def index():
|
def index():
|
||||||
ResetUserState()
|
ResetUserState()
|
||||||
|
# http://localhost:5000/themes/publicthemes/RomeroTape/blueskies.css
|
||||||
uploadform = UploadForm()
|
uploadform = UploadForm()
|
||||||
distribusis = DistribusisInfo.visibledistribusis()
|
distribusis = DistribusisInfo.visibledistribusis()
|
||||||
distribusies = {}
|
distribusisindex = {}
|
||||||
for distribusi in distribusis:
|
for distribusi in distribusis:
|
||||||
user = User.query.filter_by(id=distribusi.userid).first()
|
user = User.query.filter_by(id=distribusi.userid).first()
|
||||||
singledistribusi = {
|
singledistribusi = {
|
||||||
"username": user.username,
|
"username": user.username,
|
||||||
|
"publictheme": distribusi.publictheme,
|
||||||
"term": distribusi.term,
|
"term": distribusi.term,
|
||||||
"course": distribusi.course,
|
"course": distribusi.course,
|
||||||
"year": distribusi.year,
|
"year": distribusi.year,
|
||||||
"tags": distribusi.tags.split(","),
|
"tags": distribusi.tags.split(","),
|
||||||
}
|
}
|
||||||
distribusies[distribusi.distribusiname] = singledistribusi
|
distribusisindex[distribusi.distribusiname] = singledistribusi
|
||||||
years = uploadform.academicyear.choices
|
years = uploadform.academicyear.choices
|
||||||
terms = uploadform.term.choices
|
terms = uploadform.term.choices
|
||||||
courses = uploadform.course.choices
|
courses = uploadform.course.choices
|
||||||
@ -70,7 +73,7 @@ def index():
|
|||||||
adminuser = isadminuser()
|
adminuser = isadminuser()
|
||||||
template = render_template(
|
template = render_template(
|
||||||
"index.html",
|
"index.html",
|
||||||
distribusies=distribusies,
|
distribusisindex=distribusisindex,
|
||||||
years=years,
|
years=years,
|
||||||
terms=terms,
|
terms=terms,
|
||||||
courses=courses,
|
courses=courses,
|
||||||
@ -79,6 +82,11 @@ def index():
|
|||||||
return template
|
return template
|
||||||
|
|
||||||
|
|
||||||
|
@APP.route("/help")
|
||||||
|
def help():
|
||||||
|
return render_template("help.html")
|
||||||
|
|
||||||
|
|
||||||
@APP.route("/distribusi", methods=["GET", "POST"])
|
@APP.route("/distribusi", methods=["GET", "POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def distribusi():
|
def distribusi():
|
||||||
|
@ -104,8 +104,12 @@ fieldset.tagfield > input {
|
|||||||
}
|
}
|
||||||
#publicthemes > ul {
|
#publicthemes > ul {
|
||||||
max-height: 20em;
|
max-height: 20em;
|
||||||
overflow: scroll;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
#publicthemes > ul > li{
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
input {
|
input {
|
||||||
border: none;
|
border: none;
|
||||||
background: #E0B0FF;
|
background: #E0B0FF;
|
||||||
|
@ -11,6 +11,11 @@
|
|||||||
<input type="button" name="button" value="Logout"></input>
|
<input type="button" name="button" value="Logout"></input>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="help">
|
||||||
|
<a href="/help">
|
||||||
|
<input type="button" name="button" value="Help"></input>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="mainworkflow">
|
<div id="mainworkflow">
|
||||||
{% if selectorvisible %}
|
{% if selectorvisible %}
|
||||||
|
50
verse/templates/help.html
Normal file
50
verse/templates/help.html
Normal 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 %}
|
@ -1,6 +1,7 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block main %}
|
{% block main %}
|
||||||
<div id="buttons">
|
<div id="buttons">
|
||||||
|
|
||||||
{% if not current_user.is_authenticated %}
|
{% if not current_user.is_authenticated %}
|
||||||
<div class="signin">
|
<div class="signin">
|
||||||
<a href="/login">
|
<a href="/login">
|
||||||
@ -18,12 +19,6 @@
|
|||||||
<input type="button" name="button" value="Distribusi"></input>
|
<input type="button" name="button" value="Distribusi"></input>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="logout">
|
|
||||||
<a href="/logout">
|
|
||||||
<input type="button" name="button" value="Logout"></input>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
{% if adminuser %}
|
{% if adminuser %}
|
||||||
<div class="admin">
|
<div class="admin">
|
||||||
<a href="/admin">
|
<a href="/admin">
|
||||||
@ -31,6 +26,17 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% 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>
|
</div>
|
||||||
{% if current_user.is_authenticated %}
|
{% if current_user.is_authenticated %}
|
||||||
<h2 id="fancyboi"> Hi {{ current_user.email }}!</h2>
|
<h2 id="fancyboi"> Hi {{ current_user.email }}!</h2>
|
||||||
@ -51,7 +57,7 @@
|
|||||||
<h2>List of distribusis</h2>
|
<h2>List of distribusis</h2>
|
||||||
{% include 'filtermenu.html' %}
|
{% include 'filtermenu.html' %}
|
||||||
<ul>
|
<ul>
|
||||||
{% for name, distribusi in distribusies.items() %}
|
{% for name, distribusi in distribusisindex.items() %}
|
||||||
<li class='distribusi filter {{ distribusi["term"] }} {{ distribusi["year"] }} {{ distribusi["course"] }}'>
|
<li class='distribusi filter {{ distribusi["term"] }} {{ distribusi["year"] }} {{ distribusi["course"] }}'>
|
||||||
<a href='stash/{{name}}/index.html'>{{distribusi["username"]}}:{{name}}</a>
|
<a href='stash/{{name}}/index.html'>{{distribusi["username"]}}:{{name}}</a>
|
||||||
{% for tag in distribusi["tags"] %}
|
{% for tag in distribusi["tags"] %}
|
||||||
|
Loading…
Reference in New Issue
Block a user