|
|
@ -119,7 +119,12 @@ def upload(): |
|
|
|
uploadform = UploadForm() |
|
|
|
distribusiform = DistribusiForm() |
|
|
|
themeform = ThemeForm() |
|
|
|
files_uploaded = False |
|
|
|
selectorform = SelectorForm() |
|
|
|
selectorform.distribusis.choices = distribusisfields() |
|
|
|
|
|
|
|
files_uploaded = AreFilesUploaded() |
|
|
|
has_distribusi = HasDistribusi() |
|
|
|
|
|
|
|
if uploadform.validate_on_submit(): |
|
|
|
user = User.query.filter_by(email=current_user.email).first() |
|
|
|
|
|
|
@ -127,8 +132,9 @@ def upload(): |
|
|
|
newdistribusi = Distribusis( |
|
|
|
distribusiname=uploadform.sitename.data, |
|
|
|
userid=user.id, |
|
|
|
year=uploadform.academicyear.data, |
|
|
|
term=uploadform.term.data, |
|
|
|
course=uploadform.course.data, |
|
|
|
year=uploadform.academicyear.data, |
|
|
|
tags=uploadform.tags.data, |
|
|
|
) |
|
|
|
db.session.add(newdistribusi) |
|
|
@ -156,12 +162,17 @@ def upload(): |
|
|
|
shutil.copy(copyzipfile, newuserfolder) |
|
|
|
os.remove(os.path.join(APP.config["UPLOAD_FOLDER"], zipfilename)) |
|
|
|
files_uploaded = AreFilesUploaded() |
|
|
|
else: |
|
|
|
print("there is a problem with form validation") |
|
|
|
print(uploadform.course.data) |
|
|
|
template = render_template( |
|
|
|
"distribusi.html", |
|
|
|
uploadform=uploadform, |
|
|
|
distribusiform=distribusiform, |
|
|
|
themeform=themeform, |
|
|
|
selectorform=selectorform, |
|
|
|
files_uploaded=files_uploaded, |
|
|
|
has_distribusi=has_distribusi, |
|
|
|
) |
|
|
|
return template |
|
|
|
|
|
|
@ -172,7 +183,12 @@ def theme(): |
|
|
|
uploadform = UploadForm() |
|
|
|
distribusiform = DistribusiForm() |
|
|
|
themeform = ThemeForm() |
|
|
|
selectorform = SelectorForm() |
|
|
|
selectorform.distribusis.choices = distribusisfields() |
|
|
|
|
|
|
|
files_uploaded = AreFilesUploaded() |
|
|
|
has_distribusi = HasDistribusi() |
|
|
|
|
|
|
|
if themeform.validate_on_submit(): |
|
|
|
user = User.query.filter_by(email=current_user.email).first() |
|
|
|
distribusi = Distribusis.query.filter_by(userid=user.id).first() |
|
|
@ -188,7 +204,9 @@ def theme(): |
|
|
|
uploadform=uploadform, |
|
|
|
distribusiform=distribusiform, |
|
|
|
themeform=themeform, |
|
|
|
selectorform=selectorform, |
|
|
|
files_uploaded=files_uploaded, |
|
|
|
has_distribusi=has_distribusi, |
|
|
|
) |
|
|
|
return template |
|
|
|
|
|
|
@ -214,6 +232,26 @@ def editor(): |
|
|
|
return template |
|
|
|
|
|
|
|
|
|
|
|
@APP.route("/selector", methods=["GET", "POST"]) |
|
|
|
@login_required |
|
|
|
def selector(): |
|
|
|
selectorform = SelectorForm() |
|
|
|
selectorform.distribusis.choices = distribusisfields() |
|
|
|
user = User.query.filter_by(email=current_user.email).first() |
|
|
|
if selectorform.validate_on_submit(): |
|
|
|
print(selectorform.distribusis.data) |
|
|
|
print() |
|
|
|
template = render_template( |
|
|
|
"distribusi.html", |
|
|
|
uploadform=uploadform, |
|
|
|
distribusiform=distribusiform, |
|
|
|
themeform=themeform, |
|
|
|
selectorform=selectorform, |
|
|
|
files_uploaded=files_uploaded, |
|
|
|
has_distribusi=has_distribusi, |
|
|
|
) |
|
|
|
return template |
|
|
|
|
|
|
|
@APP.route("/stash/<path:path>") |
|
|
|
def distribusistash(path): |
|
|
|
return send_from_directory("stash", path) |
|
|
|