|
|
@ -81,7 +81,7 @@ def index(): |
|
|
|
"term": distribusi.term, |
|
|
|
"course": distribusi.course, |
|
|
|
"year": distribusi.year, |
|
|
|
"tags": distribusi.tags.split(','), |
|
|
|
"tags": distribusi.tags.split(","), |
|
|
|
} |
|
|
|
distribusies[distribusi.distribusiname] = singledistribusi |
|
|
|
years = uploadform.academicyear.choices |
|
|
@ -130,7 +130,9 @@ def distribusi(): |
|
|
|
os.remove(os.path.join(userfolder, zipfilename)) |
|
|
|
# To Do: Make sure nothing can be executed from the upload folder |
|
|
|
cssfile = "" |
|
|
|
cssfolder = os.path.join("themes/userstyles", distribusi.distribusiname) |
|
|
|
cssfolder = os.path.join( |
|
|
|
"themes/userstyles", distribusi.distribusiname |
|
|
|
) |
|
|
|
for filename in os.listdir(cssfolder): |
|
|
|
if filename.endswith(".css"): |
|
|
|
cssfile = os.path.join(cssfolder, filename) |
|
|
@ -164,11 +166,9 @@ def upload(): |
|
|
|
themeform = ThemeForm() |
|
|
|
selectorform = SelectorForm() |
|
|
|
selectorform.distribusis.choices = distribusisfields() |
|
|
|
|
|
|
|
selectorvisible = SelectorVisible() |
|
|
|
|
|
|
|
current_distribusi = CurrentDistribusi() |
|
|
|
if current_distribusi == "new" or HasDistribusi() == False: |
|
|
|
if current_distribusi == "new" or HasDistribusi() is False: |
|
|
|
uploadform = UploadNewDistribusi(APP.config["UPLOAD_FOLDER"]) |
|
|
|
else: |
|
|
|
uploadform = UploadUpdatedFiles(APP.config["UPLOAD_FOLDER"]) |
|
|
@ -238,19 +238,19 @@ def editor(): |
|
|
|
files_uploaded = IsZipUploaded(current_distribusi) |
|
|
|
distribusi_live = IsDistribusiLive(current_distribusi) |
|
|
|
cssplaceholder = "Try out your CSS here" |
|
|
|
with open('themes/editor/placeholder.css') as f: |
|
|
|
with open("themes/editor/placeholder.css") as f: |
|
|
|
cssplaceholder = f.read() |
|
|
|
editorform.css.data = cssplaceholder |
|
|
|
|
|
|
|
htmlplaceholder = "Write some test HTML here" |
|
|
|
with open('themes/editor/placeholder.html') as f: |
|
|
|
with open("themes/editor/placeholder.html") as f: |
|
|
|
htmlplaceholder = f.read() |
|
|
|
print(htmlplaceholder) |
|
|
|
if editorform.validate_on_submit(): |
|
|
|
userfolder = os.path.join("themes/userstyles", current_distribusi) |
|
|
|
os.mkdir(newuserfolder) |
|
|
|
cssfolder = os.path.join("themes/userstyles", current_distribusi) |
|
|
|
os.mkdir(cssfolder) |
|
|
|
cssfilename = "{}.css".format(editorform.cssname.data) |
|
|
|
with open(os.path.join(userfolder, cssfilename), "w") as cssfile: |
|
|
|
with open(os.path.join(cssfolder, cssfilename), "w") as cssfile: |
|
|
|
cssfile.write(editorform.css.data) |
|
|
|
cssfile.close |
|
|
|
|
|
|
|