working version alpha

This commit is contained in:
crunk 2024-04-21 22:09:44 +02:00
parent cefdc8cd11
commit 963b33f170
4 changed files with 6 additions and 15 deletions

View File

@ -9,14 +9,10 @@ class Distribusis(db.Model):
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
distribusiname = db.Column(db.String(300), nullable=False, unique=True) distribusiname = db.Column(db.String(300), nullable=False, unique=True)
userid = db.Column(db.Integer, db.ForeignKey("users.id")) userid = db.Column(db.Integer, db.ForeignKey("users.id"))
term = db.Column(db.String(5), nullable=False, unique=False)
category = db.Column(db.String(500), nullable=True, unique=False) category = db.Column(db.String(500), nullable=True, unique=False)
# Academic year eg:2020-2021, so no need for a Datetime object
year = db.Column(db.String(9), nullable=True, unique=False) year = db.Column(db.String(9), nullable=True, unique=False)
tags = db.Column(db.String(500), nullable=True, unique=False) tags = db.Column(db.String(500), nullable=True, unique=False)
publictheme = db.Column(db.String(300), unique=True, nullable=True) publictheme = db.Column(db.String(300), unique=True, nullable=True)
visible = db.Column(db.Boolean, default=False) visible = db.Column(db.Boolean, default=False)
def __repr__(self): def __repr__(self):

View File

@ -59,7 +59,6 @@ def index():
distribusisindex[distribusi.distribusiname] = singledistribusi distribusisindex[distribusi.distribusiname] = singledistribusi
years = uploadform.year.choices years = uploadform.year.choices
categories = uploadform.category.choices categories = uploadform.category.choices
adminuser = isadminuser() adminuser = isadminuser()
template = render_template( template = render_template(
"index.html", "index.html",
@ -100,7 +99,6 @@ def publicthemes(path):
distribusi = Distribusis.query.filter_by(distribusiname=path).first() distribusi = Distribusis.query.filter_by(distribusiname=path).first()
publicthemefolder = f"publicthemes/{distribusi.distribusiname}/" publicthemefolder = f"publicthemes/{distribusi.distribusiname}/"
cssfile = f"{publicthemefolder}/{distribusi.publictheme}.css" cssfile = f"{publicthemefolder}/{distribusi.publictheme}.css"
print(cssfile)
return send_from_directory("themes", cssfile, as_attachment=True) return send_from_directory("themes", cssfile, as_attachment=True)

View File

@ -24,9 +24,8 @@ function filterSelection(c, name, id) {
} }
function resetDropDownButtons(){ function resetDropDownButtons(){
document.getElementById("Academicyear").innerText = "Academic year"; document.getElementById("Year").innerText = "Year";
document.getElementById("Term").innerText = "Term"; document.getElementById("Category").innerText = "Category";
document.getElementById("Course").innerText = "Course";
allactivebuttons = document.getElementsByClassName("activebtn"); allactivebuttons = document.getElementsByClassName("activebtn");
for(var i = 0;allactivebuttons.length; i++) { for(var i = 0;allactivebuttons.length; i++) {
removeClass(allactivebuttons[i], "activebtn"); removeClass(allactivebuttons[i], "activebtn");

View File

@ -22,9 +22,8 @@ def UploadNewDistribusi(uploadfolder):
newdistribusi = Distribusis( newdistribusi = Distribusis(
distribusiname=uploadform.sitename.data, distribusiname=uploadform.sitename.data,
userid=user.id, userid=user.id,
term=uploadform.term.data, category=uploadform.category.data,
course=uploadform.course.data, year=uploadform.year.data,
year=uploadform.academicyear.data,
tags=uploadform.tags.data, tags=uploadform.tags.data,
) )
user.currentdistribusi = uploadform.sitename.data user.currentdistribusi = uploadform.sitename.data
@ -66,9 +65,8 @@ def UploadUpdatedFiles(uploadfolder):
distribusi = Distribusis.query.filter_by( distribusi = Distribusis.query.filter_by(
distribusiname=current_distribusi distribusiname=current_distribusi
).first() ).first()
distribusi.term = uploadform.term.data distribusi.category = uploadform.category.data
distribusi.course = uploadform.course.data distribusi.year = uploadform.year.data
distribusi.year = uploadform.academicyear.data
distribusi.tags = uploadform.tags.data distribusi.tags = uploadform.tags.data
distribusi.visible = False distribusi.visible = False
db.session.commit() db.session.commit()