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