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