Skip to content

attilafekete73/CS50

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

#profPiggybank #Video Demo: https://youtu.be/zcLNv3gD4II #Description: app.py: the main flask file. It connects all the routes, wich are in other files for better visibility, this is achieved by blueprints. dbhead.py: this is a file, which introduces SQLAlchemy to the code, and connects to the Postgresql server, so that i can execute sql queries in my flask app, such as select, delete, update, insert etc. layout.html: this is the border file, the template. it is the one where the navbar is and where the stylesheet is linked to. on the navbar is the logo of the site, which is a button, which when clicked, redirects you automatically to the homepage. on the navbar, there is also a general searchbar, which searches in all data in the datatbase, it also has checkbox based search-filtering for a more convenient search experience. The last thing on the navbar is the logout button, which, i think i don't need to explain further. index.html: the user can see the courses they have joined, the documents that were added to those courses, and the comments that were added to the documents that the user has uploaded. index.py: this runs when a get request is sent to the "/" route. it runs 3 sqlalchemy select queries, to get the courses of the user, to get documents posted to the forementioned courses and to get the comments that were posted to the documents that the user has posted. then it sends the jinja of the index.html the returns of these queries, which will generate the tables in the index.html. login.html: A simple, username-password-submit form, which posts with 'post' to "/login" login.py: a flask file which serves the post and get requests of the "/login" route. it's get just renders the login.html, it's post checks if the user provided an username and a password, and if it is valid or not. If it is, then the user's id is saved to a cookie, and redirects the user to the homepage logout.py: simply clears the cookies and redirects to the login page register.html: A simple, username-password-confirm_password-submit form, which posts with 'post' to "/register" register.py: a flask file which serves the post and get requests of the "/request" route. it's get just renders the request.html, it's post chechs if all of the input fields were filled, if yes, it checks, if the password and the confirmation are the same, and if the username doesn't exist (checked with an sqlachemy query), with sqlalchemy a new user is added to the database, with a hashed password, an username and an id. finally it redirects to the login page. course.html: it shows the course's name, the names of the submissions posted to the course, which are buttons, that redirect to their own sites. it also has its own searchbar that only searches in the courses documents. also depending on whther the user is already a member of the course or not a join button is shown, or a leave and an 'add Data' button. courses.py: this flask file serves the post and get requests to the "/course/" route. it's get checks with sqlalchemy if the user is the member of the course or not, and it returns corresposive value to theat, so the html could be in the correct form. it also gets all the submissions posted to the course, also with sqlalchemy, and then it gives it to the html's jinja which will generate a table similarly to the index.html's. it's post is connected to it's searchbar, and it runs a search query in that course's documents, based on the search term given. person.html: it is basically the course.html, but you can't join, leave or add Data. people.py: a flask file which serves the post and get requests of the "/person/" route. it's post and get functions are aso the same as the course.py's except the memberchecking. addData.html: the first elements of it are two radio buttons, 'note' and 'file'. depending on which one is selected, either a file uploader or a textarea is shown. next comes the name of the submission, then the name of the teacher, and finally, 3 additional tags for better searchability. and it all ends with a submit button. addData.py:a flask file which serves the post and get requests of the "/addData/" route. it's get function just simply returns the template "addData.html". it's post saves the file to the database if a file was given, if the user gave a note, then it wil be converted to a .txt file, and then it will be saved to the database. joincourse.py:it is the python file that gets requested when the user wants to join a course. it is a simple sqlalchemy insert into fuction, which adds a connection between the given course and the user. leavecourse.py: it is a python file that gets rtequested when the user wants to leave a course. is is a simple sqlalchemy delete function, which deletes the connection between a course and a user. document.html: on the left side it shows the comments posted to a document (latest at the top), and also a textbox, which allows the user to make a comment. on the right side, if a file was given, then a download button is shown, which will give the user the desired file, but if a note was given than it will be displayed as text, so the user doesn't need to download it in order to read it. documents.py: a flask file which serves the post and get requests of the "/document/" route. with help of sqlalchemy search queries it gets all the information about a document, and gets all the comments posted to it. it also decides (with a search query) whether a document is a note or not. if it isn't, it will generate a download with the help of the download.py file, if it is then it will read out the contents of that file. the get will just render the template with these informations, the post will re-render the template, but with the new comment inserted into the database, and so in the html file. downloader.py:it is basically a send_from_directory return, which is called in the document.html serch.html: it is a bootstrap 5 accordion model with 3 cards. whatever the search results are, all 3 will be shown, but only the first which has content will be open. the results are clickable buttons, which lead to their corresponding pages. search.py: it is a post only flask file which serves the route "/search". it seaches through all tags, names, and notes searching for the closest match to the given term (optionally filtered by the checkbboxes below the searchbox.) then it just returns these results to the html file. apopogy.html: it was a cs50 pre-written file for scenarios where you want to give the user feedback, which you don't have an html file for. styles.css: makes the whole website look pretty and user-friendly

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published