Browse Source

last 2 tasks to go

current_wdka_release
crunk 3 years ago
parent
commit
36039fceed
  1. 1
      verse/app.py
  2. 2
      verse/editor.py
  3. 14
      verse/start.py
  4. 6
      verse/static/css/style.css
  5. 5
      verse/templates/distribusi.html
  6. 50
      verse/templates/help.html
  7. 18
      verse/templates/index.html

1
verse/app.py

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

2
verse/editor.py

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

14
verse/start.py

@ -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():

6
verse/static/css/style.css

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

5
verse/templates/distribusi.html

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

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

18
verse/templates/index.html

@ -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,19 +19,24 @@
<input type="button" name="button" value="Distribusi"></input>
</a>
</div>
{% if adminuser %}
<div class="admin">
<a href="/admin">
<input type="button" name="button" value="Admin"></input>
</a>
</div>
{% endif %}
<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>
<div class="help">
<a href="/help">
<input type="button" name="button" value="Help"></input>
</a>
</div>
{% endif %}
</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"] %}

Loading…
Cancel
Save