diff --git a/README.md b/README.md index 877ef9d..f9fef6f 100644 --- a/README.md +++ b/README.md @@ -8,10 +8,15 @@ The contribution consisted of setting up distribusi. ruruhuis.nl (distribusi is This particular work in progress project is an attempt to make distribusi into a webinterface that can be operated remotely without any knowlegde of CLI. Trying to somehow combine the ideas of distribusi with the ideas of a [tildeverse](https://tildeverse.org/) or [Tilde club ](https://tilde.club/), but also be neither of these ideas. -This project is made for Autonomous Practices at the WDKA in Rotterdam. +This project was made for Autonomous Practices at the WDKA in Rotterdam. + +The second stage of this project might be the archiving part of the [Toolsheds fellowship.](https://nieuweinstituut.nl/en/articles/call-for-fellows-tool-sheds) + + ## Work in progress -Amazingly helpful testers, currently I am writing some database upgrades and new functionalities, and they don't work, so have some patience with testing the in development material. +Currently this repo is transforming the academic based search filters into adjustable +small Autonomous space filters. ## Start your engines! diff --git a/notes.md b/notes.md deleted file mode 100644 index 7b002ba..0000000 --- a/notes.md +++ /dev/null @@ -1,34 +0,0 @@ -# these are some notes - -from distribusi.cli import build_argparser -# from distribusi.distribusi import distribusify -Works! - -# Shit! We need entire CRUD functionality. -Done! -## Create: -Done - -### Uploading -Done - -### CSS editing. -a user can edit CSS of a file in the folder called $distribusiname -Todo: render the placeholder for html editor better. - -### Theme selection -a user can select a CSS file from a radio menu - -### Distribusi -A flag in de DB is set to true and distribusi is run on the folder of the users -called $distribusiname - -## Read: -Based on flags set in the user DB the distribusi folders are set to visible. - - -## Update: -Done - -## Delete: -Done diff --git a/pyproject.toml b/pyproject.toml index 27f62cd..9b286c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,25 +1,25 @@ -[tool.black] -line-length = 79 -target-version = ['py37', 'py38', 'py39'] -include = '\.pyi?$' -exclude = ''' -/( - \.eggs - | \.git - | \.hg - | \.mypy_cache - | \.tox - | \.venv - | _build - | buck-out - | build - | dist - +[tool.black] +line-length = 79 +target-version = ['py311'] +include = '\.pyi?$' +exclude = ''' +/( + \.eggs + | \.git + | \.hg + | \.mypy_cache + | \.tox + | \.venv + | _build + | buck-out + | build + | dist + # The following are specific to Black, you probably don't want those. | blib2to3 - | tests/data + | tests/data | profiling )/ -''' +''' diff --git a/requirements.txt b/requirements.txt index bd1311a..952979d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,48 +1,57 @@ alembic==1.7.5 +APScheduler==3.10.4 Babel==2.9.1 bcrypt==3.2.0 -black==21.11b1 +black==24.4.0 bleach==4.1.0 bleach-allowlist==1.0.3 -blinker==1.4 +blinker==1.7.0 cffi==1.15.0 -click==8.0.3 +click==8.1.7 +distribusi @ git+https://git.vvvvvvaria.org/crunk/distribusi@e291e7497e40211c2ebd54ca32a1f4bdaed71230 dnspython==2.1.0 email-validator==1.1.3 -Flask==2.0.2 +Flask==3.0.3 +Flask-APScheduler==1.13.1 Flask-BabelEx==0.9.4 -Flask-Bcrypt==0.7.1 -Flask-Login==0.5.0 +Flask-Bcrypt==1.0.1 +Flask-Login==0.6.3 Flask-Mail==0.9.1 Flask-Migrate==3.1.0 Flask-Principal==0.4.0 Flask-Security==3.0.0 Flask-Security-Too==4.1.3 -Flask-SQLAlchemy==2.5.1 -Flask-WTF==1.0.0 -greenlet==1.1.2 +Flask-SQLAlchemy==3.1.1 +Flask-WTF==1.2.1 +greenlet==3.0.3 idna==3.3 -itsdangerous==2.0.1 -Jinja2==3.0.3 +isort==5.13.2 +itsdangerous==2.2.0 +Jinja2==3.1.3 Mako==1.1.6 -MarkupSafe==2.0.1 +MarkupSafe==2.1.5 +msgpack==1.0.8 mypy-extensions==0.4.3 -packaging==21.3 +neovim==0.3.1 +packaging==24.0 passlib==1.7.4 pathspec==0.9.0 Pillow==8.3.2 platformdirs==2.4.0 pycparser==2.21 +pynvim==0.5.0 pyparsing==3.0.7 +python-dateutil==2.9.0.post0 python-magic==0.4.24 pytz==2021.3 regex==2021.11.10 six==1.16.0 speaklater==1.3 -SQLAlchemy==1.4.27 +SQLAlchemy==2.0.29 tomli==1.2.2 -typing_extensions==4.0.1 +typing_extensions==4.11.0 +tzlocal==5.2 webencodings==0.5.1 -Werkzeug==2.0.2 +Werkzeug==3.0.2 +Whoosh==2.7.4 WTForms==3.0.0 -distribusi @ git+https://git.vvvvvvaria.org/crunk/distribusi diff --git a/setup.py b/setup.py index 340f994..ce7462a 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,3 @@ -from setuptools import setup, find_packages +from setuptools import find_packages, setup -setup(name='library', version='1.0', packages=find_packages()) +setup(name="library", version="1.0", packages=find_packages()) diff --git a/verse/adminpage.py b/verse/adminpage.py index c310fde..4d78d26 100644 --- a/verse/adminpage.py +++ b/verse/adminpage.py @@ -1,21 +1,20 @@ import os import shutil -from flask import render_template +from flask import render_template from sqlalchemy.exc import ( - DataError, DatabaseError, + DataError, InterfaceError, InvalidRequestError, ) -from app import db - -from usermodel import User -from distribusimodel import Distribusis -from distribusisinfo import DistribusisInfo -from forms.adminuserform import AdminUserForm +from app import db +from distribusikan.distribusisinfo import DistribusisInfo from forms.admindistribusiform import AdminDistribusiForm +from forms.adminuserform import AdminUserForm +from models.distribusi_model import Distribusis +from models.user_model import User def AdminPage(): @@ -27,10 +26,6 @@ def AdminPage(): if adminuserform.validate_on_submit(): if adminuserform.delete.data: DeleteUsers(adminuserform) - if adminuserform.tutors.data: - ToggleUsersAsTutors(adminuserform, True) - if adminuserform.nottutors.data: - ToggleUsersAsTutors(adminuserform, False) template = render_template( "admin.html", @@ -51,23 +46,6 @@ def DeleteUsers(adminuserform): userform.errors.append(f"User {useremail} deleted!") -def ToggleUsersAsTutors(adminuserform, is_tutor): - for userform in adminuserform: - if "user" in userform.id: - if userform.data: - useremail = userform.label.text - user = User.query.filter_by(email=useremail).first() - ToggleUserTutorinDb(user, is_tutor) - userform.errors.append(f"Is User {useremail} tutor {is_tutor}") - - -def ToggleUserTutorinDb(user, is_tutor): - try: - user.tutor = is_tutor - db.session.commit() - except (InvalidRequestError, DataError, InterfaceError, DatabaseError): - db.session.rollback() - def DeleteUserFromDb(user): try: diff --git a/verse/admintool.py b/verse/admintool.py index 9410eaa..c8ddac3 100644 --- a/verse/admintool.py +++ b/verse/admintool.py @@ -1,13 +1,15 @@ import sys -from app import create_app, db + from sqlalchemy.exc import ( - InvalidRequestError, - InterfaceError, - DataError, DatabaseError, + DataError, + InterfaceError, + InvalidRequestError, ) -from usermodel import User # noqa: F401 -from distribusimodel import Distribusis # noqa: F401 + +from app import create_app, db +from models.distribusi_model import Distribusis # noqa: F401 +from models.user_model import User # noqa: F401 def admintool(): diff --git a/verse/app.py b/verse/app.py index 18dceb3..56dd762 100644 --- a/verse/app.py +++ b/verse/app.py @@ -1,13 +1,14 @@ import os +import tomllib + from flask import Flask -from flask_sqlalchemy import SQLAlchemy from flask_bcrypt import Bcrypt +from flask_login import LoginManager from flask_migrate import Migrate +from flask_sqlalchemy import SQLAlchemy from flask_wtf.csrf import CSRFProtect -from flask_login import ( - LoginManager, -) +APP = Flask(__name__, static_folder="static") db = SQLAlchemy() migrate = Migrate() bcrypt = Bcrypt() @@ -15,18 +16,16 @@ login_manager = LoginManager() def create_app(): - APP = Flask(__name__, static_folder="static") - - APP.secret_key = "secret-key" - APP.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///data/distribusiverse.db" + APP.secret_key = os.urandom(24) + APP.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///distribusiverse.db" APP.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = True - APP.config["MAX_CONTENT_LENGTH"] = 150 * 1024 * 1024 + APP.config["MAX_CONTENT_LENGTH"] = 1024 * 1024 * 1024 APP.config["MAIL_SERVER"] = "mail.autonomic.zone" APP.config["MAIL_PORT"] = 587 APP.config["MAIL_USE_SSL"] = False APP.config["MAIL_USE_TLS"] = True - APP.config['MAIL_USERNAME'] = "noreply@vvvvvvaria.org" + APP.config["MAIL_USERNAME"] = "noreply@vvvvvvaria.org" login_manager.session_protection = "strong" login_manager.login_view = "index" @@ -38,10 +37,36 @@ def create_app(): APP.config["UPLOAD_FOLDER"] = "tmpupload" APP.config["PUBLIC_THEMES"] = "themes/publicthemes" + # user settings_file + settings() + csrf.init_app(APP) login_manager.init_app(APP) db.init_app(APP) migrate.init_app(APP, db, render_as_batch=True) bcrypt.init_app(APP) + @APP.context_processor + def inject_title(): + return dict(title=APP.config["title"]) + + return APP + + +def settings(): + settings = settings_from_file() + APP.config.update(settings) return APP + + +def get_app(): + return APP + + +def settings_from_file(): + settings = {} + if os.path.isfile("settings_development.toml"): + with open("settings_development.toml", "rb") as settings_file: + return tomllib.load(settings_file) + with open("settings.toml", "rb") as settings_file: + return tomllib.load(settings_file) diff --git a/verse/deploydb.py b/verse/deploydb.py index 236baf8..9a33cdc 100644 --- a/verse/deploydb.py +++ b/verse/deploydb.py @@ -1,11 +1,12 @@ def deploy(): """Run deployment of database.""" + from flask_migrate import init, migrate, stamp, upgrade + from app import create_app, db - from flask_migrate import upgrade, migrate, init, stamp + from models.distribusi_model import Distribusis # noqa: F401 # This model is required for flask_migrate to make the table - from usermodel import User # noqa: F401 - from distribusimodel import Distribusis # noqa: F401 + from models.user_model import User # noqa: F401 app = create_app() app.app_context().push() diff --git a/verse/distribusikan/distribusikan.py b/verse/distribusikan/distribusikan.py new file mode 100644 index 0000000..4ba50ae --- /dev/null +++ b/verse/distribusikan/distribusikan.py @@ -0,0 +1,48 @@ +from flask import Blueprint +from flask_login import login_required + +from distribusikan.distribusiselector import DistribusiSelector + +# Distribusi Information +from distribusikan.distribusisinfo import DistribusisInfo +from distribusikan.distribusiworkflow import DistribusiWorkflow +from distribusikan.editor import Editor +from distribusikan.themeselector import ThemeSelector +from distribusikan.uploadpage import UploadPage + +distribusikan = Blueprint( + "distribusikan", + __name__, + template_folder="templates/distribusikan", + static_folder="static", +) + + +@distribusikan.route("/distribusi", methods=["GET", "POST"]) +@login_required +def distribusi(): + return DistribusiWorkflow() + + +@distribusikan.route("/upload", methods=["POST"]) +@login_required +def upload(): + return UploadPage() + + +@distribusikan.route("/theme", methods=["GET", "POST"]) +@login_required +def theme(): + return ThemeSelector() + + +@distribusikan.route("/editor", methods=["GET", "POST"]) +@login_required +def editor(): + return Editor() + + +@distribusikan.route("/selector", methods=["GET", "POST"]) +@login_required +def selector(): + return DistribusiSelector() diff --git a/verse/distribusiselector.py b/verse/distribusikan/distribusiselector.py similarity index 95% rename from verse/distribusiselector.py rename to verse/distribusikan/distribusiselector.py index 788ec35..ccc5770 100644 --- a/verse/distribusiselector.py +++ b/verse/distribusikan/distribusiselector.py @@ -1,29 +1,28 @@ import os import shutil + from flask import flash, render_template from flask_login import current_user from sqlalchemy.exc import ( - DataError, DatabaseError, + DataError, InterfaceError, InvalidRequestError, ) -from usermodel import User -from distribusimodel import Distribusis -from distribusisinfo import DistribusisInfo - -from forms.selectorform import SelectorForm -from forms.uploadform import UploadForm +from app import db +from distribusikan.distribusisinfo import DistribusisInfo from forms.distribusiform import DistribusiForm -from forms.themeform import ThemeForm from forms.publicthemeform import PublicThemeForm +from forms.selectorform import SelectorForm +from forms.themeform import ThemeForm +from forms.uploadform import UploadForm +from models.distribusi_model import Distribusis +from models.user_model import User # UserPengguna from statuspengguna.helper import UserHelper -from app import db - def DistribusiSelector(): uploadform = UploadForm() @@ -54,9 +53,8 @@ def AutoFillInUploadForm(uploadform, current_distribusi): ).first() uploadform.sitename.data = distribusi.distribusiname uploadform.sitename.render_kw = {"readonly": True} - uploadform.term.data = distribusi.term - uploadform.course.data = distribusi.course - uploadform.academicyear.data = distribusi.year + uploadform.category.data = distribusi.category + uploadform.year.data = distribusi.year uploadform.tags.data = distribusi.tags return uploadform diff --git a/verse/distribusisinfo.py b/verse/distribusikan/distribusisinfo.py similarity index 93% rename from verse/distribusisinfo.py rename to verse/distribusikan/distribusisinfo.py index 9bbd80e..19ef284 100644 --- a/verse/distribusisinfo.py +++ b/verse/distribusikan/distribusisinfo.py @@ -1,7 +1,7 @@ from flask_login import current_user -from usermodel import User -from distribusimodel import Distribusis +from models.distribusi_model import Distribusis +from models.user_model import User class DistribusisInfo: diff --git a/verse/distribusiworkflow.py b/verse/distribusikan/distribusiworkflow.py similarity index 91% rename from verse/distribusiworkflow.py rename to verse/distribusikan/distribusiworkflow.py index cea215b..4e3a376 100644 --- a/verse/distribusiworkflow.py +++ b/verse/distribusikan/distribusiworkflow.py @@ -1,40 +1,34 @@ import os import shutil import zipfile + +# Tada! +from distribusi.cli import build_argparser +from distribusi.distribusi import distribusify +from flask import flash, redirect, render_template, url_for from flask_login import current_user -from flask import ( - render_template, - redirect, - url_for, - flash, -) from sqlalchemy.exc import ( - InvalidRequestError, + DatabaseError, DataError, InterfaceError, - DatabaseError, + InvalidRequestError, ) -from app import db - -from usermodel import User -from distribusimodel import Distribusis - -# UserPengguna -from statuspengguna.helper import UserHelper -from distribusiselector import SelectorVisible -# Forms! -from forms.uploadform import UploadForm +from app import db +from distribusikan.distribusiselector import SelectorVisible +from distribusikan.distribusisinfo import DistribusisInfo from forms.distribusiform import DistribusiForm -from forms.themeform import ThemeForm from forms.publicthemeform import PublicThemeForm from forms.selectorform import SelectorForm +from forms.themeform import ThemeForm -from distribusisinfo import DistribusisInfo +# Forms! +from forms.uploadform import UploadForm +from models.distribusi_model import Distribusis +from models.user_model import User -# Tada! -from distribusi.cli import build_argparser -from distribusi.distribusi import distribusify +# UserPengguna +from statuspengguna.helper import UserHelper def DistribusiWorkflow(): @@ -78,7 +72,7 @@ def CleanUpDistribusiFiles(userfolder): def RemoveMacFolders(path): for filename in os.listdir(path): fullpath = os.path.join(path, filename) - if filename.startswith('.'): + if filename.startswith("."): if os.path.isdir(fullpath): shutil.rmtree(fullpath) else: @@ -101,7 +95,7 @@ def GetCssFile(distribusi): def RunDistribusi(userfolder, cssfile): parser = build_argparser() - args = parser.parse_args(["--menu-with-index", "-s", cssfile]) + args = parser.parse_args(["-t", "--menu-with-index", "-s", cssfile]) distribusify(args, userfolder) diff --git a/verse/editor.py b/verse/distribusikan/editor.py similarity index 95% rename from verse/editor.py rename to verse/distribusikan/editor.py index a515d53..88e63c2 100644 --- a/verse/editor.py +++ b/verse/distribusikan/editor.py @@ -1,28 +1,27 @@ import os +import shutil + import bleach from bleach_allowlist import all_styles -import shutil from flask import render_template - -from werkzeug.utils import secure_filename from sqlalchemy.exc import ( - DataError, DatabaseError, + DataError, InterfaceError, InvalidRequestError, ) -from app import db -from distribusimodel import Distribusis - -from statuspengguna.helper import UserHelper -from distribusisinfo import DistribusisInfo +from werkzeug.utils import secure_filename -from forms.uploadform import UploadForm +from app import db +from distribusikan.distribusisinfo import DistribusisInfo from forms.distribusiform import DistribusiForm -from forms.themeform import ThemeForm -from forms.publicthemeform import PublicThemeForm from forms.editorform import EditorForm +from forms.publicthemeform import PublicThemeForm from forms.selectorform import SelectorForm +from forms.themeform import ThemeForm +from forms.uploadform import UploadForm +from models.distribusi_model import Distribusis +from statuspengguna.helper import UserHelper def Editor(): @@ -68,7 +67,7 @@ def SaveUploadCssFile(editorform, newcssfolder): cssfile.save(os.path.join(newcssfolder, cssfilename)) openfile = open(os.path.join(newcssfolder, cssfilename), "r") cleancss = bleach.clean(openfile.read(), all_styles) - cleancss = cleancss.replace('>', '>') + cleancss = cleancss.replace(">", ">") openfile.close() cleanfile = open(os.path.join(newcssfolder, cssfilename), "w") cleanfile.write(cleancss) @@ -81,7 +80,7 @@ def WriteCssToFile(editorform, newcssfolder): cssfilename = f"{secure_filename(editorform.cssname.data)}.css" cleancss = bleach.clean(editorform.css.data, all_styles) - cleancss = cleancss.replace('>', '>') + cleancss = cleancss.replace(">", ">") with open(os.path.join(newcssfolder, cssfilename), "w") as cssfile: cssfile.write(cleancss) cssfile.close @@ -91,8 +90,7 @@ def CopyPublicToUserFolder(editorform, publicfolder, newcssfolder): if not os.path.exists(newcssfolder): os.mkdir(newcssfolder) copycssfile = os.path.join( - publicfolder, - f"{secure_filename(editorform.cssname.data)}.css" + publicfolder, f"{secure_filename(editorform.cssname.data)}.css" ) print(f"copying file: {copycssfile}") print(f"to folder: {newcssfolder}") diff --git a/verse/templates/distribusi.html b/verse/distribusikan/templates/distribusikan/distribusi.html similarity index 97% rename from verse/templates/distribusi.html rename to verse/distribusikan/templates/distribusikan/distribusi.html index 8182e00..e85f04c 100644 --- a/verse/templates/distribusi.html +++ b/verse/distribusikan/templates/distribusikan/distribusi.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "base/base.html" %} {% block main %}
diff --git a/verse/templates/distribusiworkflow/editcss.html b/verse/distribusikan/templates/distribusikan/distribusiworkflow/editcss.html similarity index 79% rename from verse/templates/distribusiworkflow/editcss.html rename to verse/distribusikan/templates/distribusikan/distribusiworkflow/editcss.html index 4b850b5..0170599 100644 --- a/verse/templates/distribusiworkflow/editcss.html +++ b/verse/distribusikan/templates/distribusikan/distribusiworkflow/editcss.html @@ -4,7 +4,7 @@

Go to CSS editor

{% else %}

- You need to upload your files first before you can a css theme + You need to upload your files first before you can select a css theme for your files.

Go to Step 1

diff --git a/verse/templates/distribusiworkflow/launch.html b/verse/distribusikan/templates/distribusikan/distribusiworkflow/launch.html similarity index 95% rename from verse/templates/distribusiworkflow/launch.html rename to verse/distribusikan/templates/distribusikan/distribusiworkflow/launch.html index 3c4685a..562b616 100644 --- a/verse/templates/distribusiworkflow/launch.html +++ b/verse/distribusikan/templates/distribusikan/distribusiworkflow/launch.html @@ -3,7 +3,7 @@

Run distribusi on your files. This will generate your website and make your content public. Distribusi will unpack your zip file and turn it into a website!

-
+ {{ distribusiform.csrf_token }} {% if files_uploaded or distribusi_live %}
diff --git a/verse/templates/distribusiworkflow/selector.html b/verse/distribusikan/templates/distribusikan/distribusiworkflow/selector.html similarity index 97% rename from verse/templates/distribusiworkflow/selector.html rename to verse/distribusikan/templates/distribusikan/distribusiworkflow/selector.html index 44d6da4..88dac97 100644 --- a/verse/templates/distribusiworkflow/selector.html +++ b/verse/distribusikan/templates/distribusikan/distribusiworkflow/selector.html @@ -1,7 +1,7 @@

Welcome back to your Distribusi

You have already uploaded a distribusi website:

- + {{ selectorform.csrf_token }}
{{ selectorform.distribusis.label }} diff --git a/verse/templates/distribusiworkflow/theme.html b/verse/distribusikan/templates/distribusikan/distribusiworkflow/theme.html similarity index 84% rename from verse/templates/distribusiworkflow/theme.html rename to verse/distribusikan/templates/distribusikan/distribusiworkflow/theme.html index 3a371d1..e6a7b1e 100644 --- a/verse/templates/distribusiworkflow/theme.html +++ b/verse/distribusikan/templates/distribusikan/distribusiworkflow/theme.html @@ -4,7 +4,7 @@ step 3.

Don't forget to press Save


- + {{ themeform.csrf_token }}
{{ themeform.theme.label }} @@ -16,14 +16,14 @@
{% else %}

- You need to upload your files first before you can a css theme + You need to upload your files first before you can select a css theme for your files.

Go to Step 1 {% endif %}
-
+ {{ publicthemeform.csrf_token }}
{{ publicthemeform.publicthemes.label }} @@ -35,7 +35,7 @@
{% else %}

- You need to upload your files first before you can a css theme + You need to upload your files first before you can select a css theme for your files.

Go to Step 1 diff --git a/verse/templates/distribusiworkflow/upload.html b/verse/distribusikan/templates/distribusikan/distribusiworkflow/upload.html similarity index 72% rename from verse/templates/distribusiworkflow/upload.html rename to verse/distribusikan/templates/distribusikan/distribusiworkflow/upload.html index f01bb73..fe3aa78 100644 --- a/verse/templates/distribusiworkflow/upload.html +++ b/verse/distribusikan/templates/distribusikan/distribusiworkflow/upload.html @@ -1,7 +1,7 @@

Step 1: Upload

Upload your files here:

- + {{ uploadform.csrf_token }}
{{ uploadform.sitename.label }} @@ -11,28 +11,19 @@ {% endfor %}
- {{ uploadform.academicyear.label }} + {{ uploadform.year.label }}
- {{ uploadform.academicyear }} - {% for message in uploadform.academicyear.errors %} + {{ uploadform.year }} + {% for message in uploadform.year.errors %}
{{ message }}
{% endfor %}
- {{ uploadform.term.label }} + {{ uploadform.category.label }}
- {{ uploadform.term }} - {% for message in uploadform.term.errors %} -
{{ message }}
- {% endfor %} -
-
-
- {{ uploadform.course.label }} -
- {{ uploadform.course }} - {% for message in uploadform.course.errors %} + {{ uploadform.category }} + {% for message in uploadform.category.errors %}
{{ message }}
{% endfor %}
diff --git a/verse/templates/editor.html b/verse/distribusikan/templates/distribusikan/editor.html similarity index 96% rename from verse/templates/editor.html rename to verse/distribusikan/templates/distribusikan/editor.html index 69fc8e8..b6e39f4 100644 --- a/verse/templates/editor.html +++ b/verse/distribusikan/templates/distribusikan/editor.html @@ -1,6 +1,6 @@ -{% extends "base.html" %} +{% extends "base/base.html" %} {% block main %} - +
diff --git a/verse/themeselector.py b/verse/distribusikan/themeselector.py similarity index 95% rename from verse/themeselector.py rename to verse/distribusikan/themeselector.py index 8ea5bfa..96b2d8a 100644 --- a/verse/themeselector.py +++ b/verse/distribusikan/themeselector.py @@ -1,15 +1,15 @@ import os import shutil -from flask import render_template -from statuspengguna.helper import UserHelper -from distribusisinfo import DistribusisInfo +from flask import render_template -from forms.uploadform import UploadForm +from distribusikan.distribusisinfo import DistribusisInfo from forms.distribusiform import DistribusiForm -from forms.themeform import ThemeForm from forms.publicthemeform import PublicThemeForm from forms.selectorform import SelectorForm +from forms.themeform import ThemeForm +from forms.uploadform import UploadForm +from statuspengguna.helper import UserHelper def ThemeSelector(): @@ -30,9 +30,7 @@ def ThemeSelector(): ) MoveCssToUserFolder(current_distribusi, copycssfile) return RenderDistribusiTemplate( - themeform, - publicthemeform, - current_distribusi + themeform, publicthemeform, current_distribusi ) diff --git a/verse/upload.py b/verse/distribusikan/upload.py similarity index 87% rename from verse/upload.py rename to verse/distribusikan/upload.py index 5f12794..83110b5 100644 --- a/verse/upload.py +++ b/verse/distribusikan/upload.py @@ -1,22 +1,22 @@ import os import shutil + from flask import flash from flask_login import current_user from sqlalchemy.exc import ( - IntegrityError, - InvalidRequestError, + DatabaseError, DataError, + IntegrityError, InterfaceError, - DatabaseError, + InvalidRequestError, ) -from app import db - -from usermodel import User -from distribusimodel import Distribusis -from statuspengguna.helper import UserHelper -from distribusiselector import SelectCurrentDistribusi +from app import db +from distribusikan.distribusiselector import SelectCurrentDistribusi from forms.uploadform import UploadForm +from models.distribusi_model import Distribusis +from models.user_model import User +from statuspengguna.helper import UserHelper def UploadNewDistribusi(uploadfolder): @@ -27,9 +27,8 @@ def UploadNewDistribusi(uploadfolder): newdistribusi = Distribusis( distribusiname=uploadform.sitename.data, userid=user.id, - term=uploadform.term.data, - course=uploadform.course.data, - year=uploadform.academicyear.data, + category=uploadform.category.data, + year=uploadform.year.data, tags=uploadform.tags.data, ) user.currentdistribusi = uploadform.sitename.data @@ -71,9 +70,8 @@ def UploadUpdatedFiles(uploadfolder): distribusi = Distribusis.query.filter_by( distribusiname=current_distribusi ).first() - distribusi.term = uploadform.term.data - distribusi.course = uploadform.course.data - distribusi.year = uploadform.academicyear.data + distribusi.category = uploadform.category.data + distribusi.year = uploadform.year.data distribusi.tags = uploadform.tags.data distribusi.visible = False db.session.commit() diff --git a/verse/uploadpage.py b/verse/distribusikan/uploadpage.py similarity index 85% rename from verse/uploadpage.py rename to verse/distribusikan/uploadpage.py index a1349f6..a8f2510 100644 --- a/verse/uploadpage.py +++ b/verse/distribusikan/uploadpage.py @@ -1,20 +1,21 @@ from flask import render_template +from app import APP +from distribusikan.distribusiselector import SelectorVisible +from distribusikan.distribusisinfo import DistribusisInfo +from distribusikan.upload import UploadNewDistribusi, UploadUpdatedFiles from forms.distribusiform import DistribusiForm -from forms.themeform import ThemeForm from forms.publicthemeform import PublicThemeForm from forms.selectorform import SelectorForm +from forms.themeform import ThemeForm # UserPengguna from statuspengguna.helper import UserHelper -from upload import UploadNewDistribusi, UploadUpdatedFiles -from distribusisinfo import DistribusisInfo -from distribusiselector import SelectorVisible - -def UploadPage(uploadfolder): +def UploadPage(): "render upload page section of distribusi workflow" + uploadfolder = APP.config["UPLOAD_FOLDER"] distribusiform = DistribusiForm() themeform = ThemeForm() publicthemeform = PublicThemeForm() diff --git a/verse/forms/admindistribusiform.py b/verse/forms/admindistribusiform.py index c2002fc..f00f3db 100644 --- a/verse/forms/admindistribusiform.py +++ b/verse/forms/admindistribusiform.py @@ -1,9 +1,7 @@ """Form object declaration.""" + from flask_wtf import FlaskForm -from wtforms import ( - BooleanField, - SubmitField, -) +from wtforms import BooleanField, SubmitField class AdminDistribusiForm(FlaskForm): @@ -15,7 +13,7 @@ class AdminDistribusiForm(FlaskForm): class DistribusiListForm(AdminDistribusiForm): pass - for (i, distribusi) in enumerate(distribusis): + for i, distribusi in enumerate(distribusis): setattr( DistribusiListForm, f"distribusi_{i}", diff --git a/verse/forms/adminuserform.py b/verse/forms/adminuserform.py index 3d7ae22..aeda2e4 100644 --- a/verse/forms/adminuserform.py +++ b/verse/forms/adminuserform.py @@ -1,9 +1,7 @@ """Form object declaration.""" + from flask_wtf import FlaskForm -from wtforms import ( - SubmitField, - BooleanField, -) +from wtforms import BooleanField, SubmitField class AdminUserForm(FlaskForm): @@ -13,7 +11,7 @@ class AdminUserForm(FlaskForm): class UserListForm(AdminUserForm): pass - for (i, user) in enumerate(users): + for i, user in enumerate(users): setattr( UserListForm, f"user_{i}", @@ -22,8 +20,4 @@ class AdminUserForm(FlaskForm): return UserListForm() - tutors = SubmitField("Are tutors") - - nottutors = SubmitField("Are not tutors") - delete = SubmitField("Delete") diff --git a/verse/forms/editorform.py b/verse/forms/editorform.py index 49a6436..284082d 100644 --- a/verse/forms/editorform.py +++ b/verse/forms/editorform.py @@ -1,15 +1,15 @@ """Form to save your CSS editor work.""" + +from flask_wtf import FlaskForm +from flask_wtf.file import FileAllowed, FileField, FileSize from wtforms import ( - StringField, - TextAreaField, BooleanField, + StringField, SubmitField, + TextAreaField, + validators, ) - -from wtforms import validators from wtforms.validators import Length -from flask_wtf.file import FileField, FileAllowed, FileSize -from flask_wtf import FlaskForm class EditorForm(FlaskForm): diff --git a/verse/forms/forgotpasswordform.py b/verse/forms/forgotpasswordform.py index 3737181..385327d 100644 --- a/verse/forms/forgotpasswordform.py +++ b/verse/forms/forgotpasswordform.py @@ -1,12 +1,8 @@ """Forgotten password form to help user.""" -from wtforms import ( - StringField, - SubmitField, -) -from wtforms import validators -from wtforms.validators import Length, Email from flask_wtf import FlaskForm +from wtforms import StringField, SubmitField, validators +from wtforms.validators import Email, Length class ForgotPasswordForm(FlaskForm): diff --git a/verse/forms/loginform.py b/verse/forms/loginform.py index f9e650d..b446850 100644 --- a/verse/forms/loginform.py +++ b/verse/forms/loginform.py @@ -1,13 +1,8 @@ """Login form to validate user.""" -from wtforms import ( - StringField, - SubmitField, - PasswordField, -) -from wtforms import validators -from wtforms.validators import Length, Email from flask_wtf import FlaskForm +from wtforms import PasswordField, StringField, SubmitField, validators +from wtforms.validators import Email, Length class LoginForm(FlaskForm): diff --git a/verse/forms/publicthemeform.py b/verse/forms/publicthemeform.py index 482de0f..103fbeb 100644 --- a/verse/forms/publicthemeform.py +++ b/verse/forms/publicthemeform.py @@ -1,9 +1,7 @@ """Form object declaration.""" + from flask_wtf import FlaskForm -from wtforms import ( - RadioField, - SubmitField, -) +from wtforms import RadioField, SubmitField class PublicThemeForm(FlaskForm): diff --git a/verse/forms/registerform.py b/verse/forms/registerform.py index 7a8d1b1..cca23ab 100644 --- a/verse/forms/registerform.py +++ b/verse/forms/registerform.py @@ -1,22 +1,13 @@ """Register form to make a new user.""" -from wtforms import ( - StringField, - SubmitField, - PasswordField, -) -from wtforms import validators -from wtforms.validators import Length, Email, EqualTo, ValidationError from flask_wtf import FlaskForm +from wtforms import PasswordField, StringField, SubmitField, validators +from wtforms.validators import Email, EqualTo, Length, ValidationError class RegisterForm(FlaskForm): """Register for distribusi-verse form class""" - def hremail(form, field): - if not field.data.endswith("@hr.nl"): - raise ValidationError("Only HRO accounts are allowed.") - username = StringField( "Username:", validators=[validators.InputRequired(), Length(3, 150)], @@ -27,9 +18,8 @@ class RegisterForm(FlaskForm): validators=[ validators.InputRequired(), Email(), - Length(6, 64), - hremail, - ] + Length(6, 128), + ], ) password = PasswordField( diff --git a/verse/forms/resetpasswordform.py b/verse/forms/resetpasswordform.py index ed32281..481cb02 100644 --- a/verse/forms/resetpasswordform.py +++ b/verse/forms/resetpasswordform.py @@ -1,12 +1,8 @@ """Reset Password Form form to reset a users PasswordField.""" -from wtforms import ( - SubmitField, - PasswordField, -) -from wtforms import validators -from wtforms.validators import Length, EqualTo from flask_wtf import FlaskForm +from wtforms import PasswordField, SubmitField, validators +from wtforms.validators import EqualTo, Length class ResetPasswordForm(FlaskForm): diff --git a/verse/forms/selectorform.py b/verse/forms/selectorform.py index bcdad85..d726971 100644 --- a/verse/forms/selectorform.py +++ b/verse/forms/selectorform.py @@ -1,5 +1,5 @@ from flask_wtf import FlaskForm -from wtforms import SubmitField, SelectField +from wtforms import SelectField, SubmitField class SelectorForm(FlaskForm): diff --git a/verse/forms/themeform.py b/verse/forms/themeform.py index 5968f04..a1c3e02 100644 --- a/verse/forms/themeform.py +++ b/verse/forms/themeform.py @@ -1,9 +1,7 @@ """Form object declaration.""" + from flask_wtf import FlaskForm -from wtforms import ( - RadioField, - SubmitField, -) +from wtforms import RadioField, SubmitField class ThemeForm(FlaskForm): diff --git a/verse/forms/uploadform.py b/verse/forms/uploadform.py index 8f3e8da..5d1f21f 100644 --- a/verse/forms/uploadform.py +++ b/verse/forms/uploadform.py @@ -1,18 +1,20 @@ from flask_wtf import FlaskForm -from flask_wtf.file import FileField, FileAllowed, FileRequired, FileSize -from wtforms import validators +from flask_wtf.file import FileAllowed, FileField, FileRequired, FileSize +from wtforms import ( + IntegerField, + SelectField, + StringField, + SubmitField, + validators, +) from wtforms.validators import ( + DataRequired, Length, NumberRange, - DataRequired, ValidationError, ) -from wtforms import ( - SubmitField, - StringField, - IntegerField, - SelectField, -) + +from app import settings class UploadForm(FlaskForm): @@ -22,64 +24,61 @@ class UploadForm(FlaskForm): if field.data.lower() == "new": raise ValidationError("Name has to be unique and not just new.") + def category_choices(): + APP = settings() + config_categories = APP.config["categories"] + categories = [] + for config_category in config_categories: + categories.append((config_category, config_category)) + return categories + + def year_choices(): + APP = settings() + start_time = APP.config["start_time"] + end_time = APP.config["end_time"] + year_range = range(start_time.year, end_time.year, 1) + year_choices = [] + for year in year_range: + year_choices.append((str(year), str(year))) + return year_choices + sitename = StringField( - "Name of your website:", - validators=[validators.InputRequired(), Length(2, 100), distribusiname], + "Name of your archive section:", + validators=[ + validators.InputRequired(), + Length(2, 100), + distribusiname, + ], ) - academicyear = SelectField( - "Academic year:", + year = SelectField( + "Year:", validate_choice=True, coerce=str, - choices=[ - (u'2021-2022', u'2021-2022'), - (u'2022-2023', u'2022-2023'), - (u'2023-2024', u'2023-2024'), - (u'2024-2025', u'2024-2025'), - (u'2020-2021', u'past: 2020-2021'), - ], + choices=year_choices, option_widget=None, - validators=[DataRequired()] + validators=[DataRequired()], ) - term = SelectField( - "Term:", + category = SelectField( + "Category:", validate_choice=True, coerce=str, - choices=[ - (u'1.2', u'1.2'), - (u'2.3', u'2.3'), - (u'3.1', u'3.1'), - (u'4.1', u'4.1'), - (u'4.2', u'4.2'), - ], + choices=category_choices, option_widget=None, - validators=[DataRequired()] + validators=[DataRequired()], ) + tags = StringField( "Add tags, seperated by commas. No need for the '#' sign:", validators=[validators.InputRequired(), Length(2, 500)], ) - course = SelectField( - u'Course:', - validate_choice=True, - coerce=str, - choices=[ - ('hacking', u'Autonomous - Hacking'), - ('digitalcraft', u'Autonomous - Digital Craft'), - ('criticalstudies', u'Autonomous - Critical Studies'), - ('publicprivate', u'Autonomous - Public&Private'), - ], - option_widget=None, - validators=[DataRequired()] - ) - zipfile = FileField( "Upload your zip file with content here:", validators=[ FileAllowed(["zip"], "Zip archives only!"), FileRequired(), FileSize( - max_size=104857600, + max_size=1073741824, message="Zipfile size must be smaller than 100MB", ), ], diff --git a/verse/data/.gitignore b/verse/instance/.gitignore similarity index 100% rename from verse/data/.gitignore rename to verse/instance/.gitignore diff --git a/verse/migrations/env.py b/verse/migrations/env.py index 68feded..847c719 100644 --- a/verse/migrations/env.py +++ b/verse/migrations/env.py @@ -3,9 +3,8 @@ from __future__ import with_statement import logging from logging.config import fileConfig -from flask import current_app - from alembic import context +from flask import current_app # this is the Alembic Config object, which provides # access to the values within the .ini file in use. @@ -14,17 +13,19 @@ config = context.config # Interpret the config file for Python logging. # This line sets up loggers basically. fileConfig(config.config_file_name) -logger = logging.getLogger('alembic.env') +logger = logging.getLogger("alembic.env") # add your model's MetaData object here # for 'autogenerate' support # from myapp import mymodel # target_metadata = mymodel.Base.metadata config.set_main_option( - 'sqlalchemy.url', - str(current_app.extensions['migrate'].db.get_engine().url).replace( - '%', '%%')) -target_metadata = current_app.extensions['migrate'].db.metadata + "sqlalchemy.url", + str(current_app.extensions["migrate"].db.get_engine().url).replace( + "%", "%%" + ), +) +target_metadata = current_app.extensions["migrate"].db.metadata # other values from the config, defined by the needs of env.py, # can be acquired: @@ -65,20 +66,20 @@ def run_migrations_online(): # when there are no changes to the schema # reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html def process_revision_directives(context, revision, directives): - if getattr(config.cmd_opts, 'autogenerate', False): + if getattr(config.cmd_opts, "autogenerate", False): script = directives[0] if script.upgrade_ops.is_empty(): directives[:] = [] - logger.info('No changes in schema detected.') + logger.info("No changes in schema detected.") - connectable = current_app.extensions['migrate'].db.get_engine() + connectable = current_app.extensions["migrate"].db.get_engine() with connectable.connect() as connection: context.configure( connection=connection, target_metadata=target_metadata, process_revision_directives=process_revision_directives, - **current_app.extensions['migrate'].configure_args + **current_app.extensions["migrate"].configure_args, ) with context.begin_transaction(): diff --git a/verse/models/distribusi_file_model.py b/verse/models/distribusi_file_model.py new file mode 100644 index 0000000..503f7bb --- /dev/null +++ b/verse/models/distribusi_file_model.py @@ -0,0 +1,17 @@ +from app import db + + +class DistribusiFiles(db.Model): + """Distribusi file model class for a single file in a distribusi""" + + __tablename__ = "distribusi_files" + + id = db.Column(db.Integer, primary_key=True) + type = db.Column(db.String(300), nullable=False, unique=True) + distribusi = db.Column(db.Integer, db.ForeignKey("distribusis.id")) + path = db.Column(db.String(4096), nullable=True, unique=False) + description = db.Column(db.String(9), nullable=True, unique=False) + tags = db.Column(db.String(500), nullable=True, unique=False) + + def __repr__(self): + return "" % self.distribusiname diff --git a/verse/distribusimodel.py b/verse/models/distribusi_model.py similarity index 77% rename from verse/distribusimodel.py rename to verse/models/distribusi_model.py index 6e1b5c0..d8f114e 100644 --- a/verse/distribusimodel.py +++ b/verse/models/distribusi_model.py @@ -9,14 +9,10 @@ class Distribusis(db.Model): id = db.Column(db.Integer, primary_key=True) distribusiname = db.Column(db.String(300), nullable=False, unique=True) userid = db.Column(db.Integer, db.ForeignKey("users.id")) - term = db.Column(db.String(5), nullable=False, unique=False) - course = db.Column(db.String(500), nullable=True, unique=False) - - # Academic year eg:2020-2021, so no need for a Datetime object + category = db.Column(db.String(500), nullable=True, unique=False) year = db.Column(db.String(9), nullable=True, unique=False) tags = db.Column(db.String(500), nullable=True, unique=False) publictheme = db.Column(db.String(300), unique=True, nullable=True) - visible = db.Column(db.Boolean, default=False) def __repr__(self): diff --git a/verse/usermodel.py b/verse/models/user_model.py similarity index 88% rename from verse/usermodel.py rename to verse/models/user_model.py index 333d3e5..9522024 100644 --- a/verse/usermodel.py +++ b/verse/models/user_model.py @@ -1,6 +1,7 @@ -from app import db from flask_login import UserMixin +from app import db + class User(UserMixin, db.Model): """User model class for a user in distribusi-verse""" @@ -14,8 +15,6 @@ class User(UserMixin, db.Model): currentdistribusi = db.Column(db.String(300), nullable=True, unique=False) resethash = db.Column(db.String(300), nullable=True, unique=True) resettime = db.Column(db.DateTime) - #active = db.Column(db.Boolean, default=False) - tutor = db.Column(db.Boolean, default=False) admin = db.Column(db.Boolean, default=False) def __repr__(self): diff --git a/verse/settings.toml b/verse/settings.toml new file mode 100644 index 0000000..287c705 --- /dev/null +++ b/verse/settings.toml @@ -0,0 +1,4 @@ +title = "Varia Archive X Distribusi-Verse" +categories = ["event","gathering","work session","workgroup","performance","music event"] +start_time = 2017-11-03 +end_time = 2025-12-31 diff --git a/verse/start.py b/verse/start.py index 740be4d..5cbe8c5 100644 --- a/verse/start.py +++ b/verse/start.py @@ -1,50 +1,41 @@ """This is the main flask distribusi page""" + from datetime import timedelta + from flask import ( - render_template, + Blueprint, redirect, - url_for, - session, + render_template, send_from_directory, - Blueprint, -) -from flask_login import ( - logout_user, - login_required, - current_user, + session, + url_for, ) +from flask_login import current_user, login_required, logout_user from flask_mail import Mail from flask_wtf.csrf import CSRFError -from app import create_app, login_manager - -from usermodel import User -from distribusimodel import Distribusis - -# Use upload form to populate filters -from forms.uploadform import UploadForm # Interface! these are seperate files in main folder from adminpage import AdminPage -from editor import Editor -from themeselector import ThemeSelector -from distribusiworkflow import DistribusiWorkflow -from distribusiselector import DistribusiSelector -from uploadpage import UploadPage +from app import create_app, login_manager +from distribusikan.distribusikan import distribusikan +from distribusikan.distribusisinfo import DistribusisInfo -# UserPengguna +# Use upload form to populate filters +from forms.uploadform import UploadForm +from models.distribusi_model import Distribusis +from models.user_model import User +from statuspengguna.forgotpassword import forgot_password from statuspengguna.helper import UserHelper -from statuspengguna.loginuser import LoginUser -from statuspengguna.registeruser import RegisterUser -from statuspengguna.forgotpassword import ForgotPassword -from statuspengguna.resetpassword import ResetPassword - -# Distribusi Information -from distribusisinfo import DistribusisInfo +from statuspengguna.loginuser import login_section +from statuspengguna.registeruser import register_user APP = create_app() stash_page = Blueprint("stash_page", __name__, static_folder="stash") +APP.register_blueprint(login_section, url_prefix="/login") +APP.register_blueprint(register_user, url_prefix="/register") +APP.register_blueprint(forgot_password, url_prefix="/login/forgotpassword") +APP.register_blueprint(distribusikan) APP.register_blueprint(stash_page) -mail = Mail(APP) @APP.before_request @@ -56,7 +47,6 @@ def session_handler(): @APP.route("/") def index(): UserHelper.reset_user_state() - # http://localhost:5000/themes/publicthemes/RomeroTape/blueskies.css uploadform = UploadForm() distribusis = DistribusisInfo.visibledistribusis() distribusisindex = {} @@ -65,23 +55,19 @@ def index(): singledistribusi = { "username": user.username, "publictheme": distribusi.publictheme, - "term": distribusi.term, - "course": distribusi.course, + "category": distribusi.category, "year": distribusi.year, "tags": distribusi.tags.split(","), } distribusisindex[distribusi.distribusiname] = singledistribusi - years = uploadform.academicyear.choices - terms = uploadform.term.choices - courses = uploadform.course.choices - + years = uploadform.year.choices + categories = uploadform.category.choices adminuser = isadminuser() template = render_template( - "index.html", + "base/index.html", distribusisindex=distribusisindex, years=years, - terms=terms, - courses=courses, + categories=categories, adminuser=adminuser, ) return template @@ -89,26 +75,7 @@ def index(): @APP.route("/help") def help(): - return render_template("help.html") - - -@APP.route("/distribusi", methods=["GET", "POST"]) -@login_required -def distribusi(): - return DistribusiWorkflow() - - -@APP.route("/upload", methods=["POST"]) -@login_required -def upload(): - uploadfolder = APP.config["UPLOAD_FOLDER"] - return UploadPage(uploadfolder) - - -@APP.route("/theme", methods=["GET", "POST"]) -@login_required -def theme(): - return ThemeSelector() + return render_template("base/help.html") @APP.route("/publicthemes/") @@ -116,22 +83,9 @@ def publicthemes(path): distribusi = Distribusis.query.filter_by(distribusiname=path).first() publicthemefolder = f"publicthemes/{distribusi.distribusiname}/" cssfile = f"{publicthemefolder}/{distribusi.publictheme}.css" - print(cssfile) return send_from_directory("themes", cssfile, as_attachment=True) -@APP.route("/editor", methods=["GET", "POST"]) -@login_required -def editor(): - return Editor() - - -@APP.route("/selector", methods=["GET", "POST"]) -@login_required -def selector(): - return DistribusiSelector() - - @APP.route("/stash") def shortstashurl(): return redirect(url_for("index")) @@ -152,26 +106,6 @@ def logout(): return redirect(url_for("index")) -@APP.route("/login", methods=["GET", "POST"]) -def login(): - return LoginUser() - - -@APP.route("/register", methods=["GET", "POST"]) -def register(): - return RegisterUser() - - -@APP.route("/forgotpassword", methods=["GET", "POST"]) -def forgotpassword(): - return ForgotPassword(mail) - - -@APP.route("/resetpassword/", methods=["GET", "POST"]) -def resetpassword(path): - return ResetPassword(path) - - @APP.errorhandler(CSRFError) def handle_csrf_error(e): return render_template("csrf_error.html", reason=e.description), 400 diff --git a/verse/static/css/dropdown.css b/verse/static/css/dropdown.css index 5111481..07509d5 100644 --- a/verse/static/css/dropdown.css +++ b/verse/static/css/dropdown.css @@ -1,5 +1,5 @@ /* Dropdown Button */ -/* for sorting on Academicyear, Term, Course +/* for sorting on year and category */ button { background-color: #E0B0FF; diff --git a/verse/static/css/style.css b/verse/static/css/style.css index ee67d83..2f772a8 100644 --- a/verse/static/css/style.css +++ b/verse/static/css/style.css @@ -2,8 +2,8 @@ body { font-family: monospace, monospace; font-size: 15px; - background-color: #272a33; - color:#E0B0FF; + background-color: #fdfdfd; + color:#29d148; word-wrap: break-word; line-height: 1.1; } @@ -12,7 +12,7 @@ div#login{ width: 30%; margin-left: auto; margin-right: auto; - background-color:#272a33; + background-color:#fdfdfd; text-decoration: none; } @@ -24,10 +24,10 @@ div#login form { } input[type=text], input[type=password], input[type=file] { - color: white; + color: #C397DF; width: 18em; max-width: 18em; - background-color: #2D3039; + background-color: #fdfdfd; border: 1px solid #E0B0FF; } @@ -41,7 +41,7 @@ div#upload form { padding-left: auto; padding-right: auto; width: 31em; - background-color:#30333f; + background-color:#fdfdfd; text-decoration: none; scroll-behavior: smooth; border-style: outset; @@ -149,12 +149,6 @@ input[type="submit"]:disabled:focus { background-color: #62b264; } -#tutors { - color: black; - background-color: #62b264; -} - - /* unvisited link */ a:link { color: #fff600; diff --git a/verse/static/js/dropdown.js b/verse/static/js/dropdown.js index e0ce738..505d4a8 100644 --- a/verse/static/js/dropdown.js +++ b/verse/static/js/dropdown.js @@ -24,9 +24,8 @@ function filterSelection(c, name, id) { } function resetDropDownButtons(){ - document.getElementById("Academicyear").innerText = "Academic year"; - document.getElementById("Term").innerText = "Term"; - document.getElementById("Course").innerText = "Course"; + document.getElementById("Year").innerText = "Year"; + document.getElementById("Category").innerText = "Category"; allactivebuttons = document.getElementsByClassName("activebtn"); for(var i = 0;allactivebuttons.length; i++) { removeClass(allactivebuttons[i], "activebtn"); diff --git a/verse/statuspengguna/__init__.py b/verse/statuspengguna/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/verse/statuspengguna/forgotpassword.py b/verse/statuspengguna/forgotpassword.py index 2d09c38..dbb8049 100644 --- a/verse/statuspengguna/forgotpassword.py +++ b/verse/statuspengguna/forgotpassword.py @@ -1,17 +1,31 @@ -from uuid import uuid1 from datetime import datetime +from uuid import uuid1 + +from flask import Blueprint, render_template +from flask_mail import Mail, Message from sqlalchemy.exc import ( - DataError, DatabaseError, + DataError, InterfaceError, InvalidRequestError, ) -from flask import render_template -from flask_mail import Message -from usermodel import User +from app import db, get_app from forms.forgotpasswordform import ForgotPasswordForm -from app import db +from models.user_model import User + +mail = Mail(get_app()) +forgot_password = Blueprint( + "forgotpassword", + __name__, + template_folder="templates/statuspengguna", + static_folder="static", +) + + +@forgot_password.route("/", methods=["GET", "POST"]) +def forgotpassword(): + return ForgotPassword(mail) def ForgotPassword(mail): diff --git a/verse/statuspengguna/helper.py b/verse/statuspengguna/helper.py index 3a6d2de..a8b26bd 100644 --- a/verse/statuspengguna/helper.py +++ b/verse/statuspengguna/helper.py @@ -1,17 +1,18 @@ import os -from flask_login import current_user + from flask import flash +from flask_login import current_user from sqlalchemy.exc import ( - DataError, DatabaseError, + DataError, InterfaceError, InvalidRequestError, ) -from usermodel import User -from distribusimodel import Distribusis -from distribusisinfo import DistribusisInfo from app import db +from distribusikan.distribusisinfo import DistribusisInfo +from models.distribusi_model import Distribusis +from models.user_model import User class UserHelper: @@ -76,10 +77,7 @@ class UserHelper: def distribusi_limit_reached(): user = User.query.filter_by(email=current_user.email).first() distribusiamount = len(DistribusisInfo.getuserdistribusis(user.email)) - if user.tutor and distribusiamount > 14: - print("tutor already has 15 distribusis") - return True - if not user.tutor and distribusiamount > 4: - print("user already has 5 distribusis") + if distribusiamount > 19: + print("user already has 20 distribusis") return True return False diff --git a/verse/statuspengguna/loginuser.py b/verse/statuspengguna/loginuser.py index 2d5e349..db08cac 100644 --- a/verse/statuspengguna/loginuser.py +++ b/verse/statuspengguna/loginuser.py @@ -1,15 +1,31 @@ from flask import ( - render_template, + Blueprint, + abort, + flash, redirect, + render_template, request, - flash, + send_from_directory, + session, url_for, - abort, ) -from usermodel import User -from forms.loginform import LoginForm -from flask_login import login_user from flask_bcrypt import check_password_hash +from flask_login import login_user + +from forms.loginform import LoginForm +from models.user_model import User + +login_section = Blueprint( + "login", + __name__, + template_folder="templates/statuspengguna", + static_folder="static", +) + + +@login_section.route("/", methods=["GET", "POST"]) +def login(): + return LoginUser() def LoginUser(): @@ -21,11 +37,14 @@ def LoginUser(): loginform.password.errors.append("Invalid email or password!") return render_template("login.html", loginform=loginform) if check_password_hash(user.password, loginform.password.data): + print(type(user)) login_user(user) flash("Logged in successfully.", "success") next = request.args.get("next") if next is not None and not is_safe_url(next): # noqa: F821 + print(next) return abort(400) + print("index") return redirect(next or url_for("index")) else: flash("Invalid email or password!", "danger") diff --git a/verse/statuspengguna/registeruser.py b/verse/statuspengguna/registeruser.py index 722f3c8..e97f1ee 100644 --- a/verse/statuspengguna/registeruser.py +++ b/verse/statuspengguna/registeruser.py @@ -1,22 +1,30 @@ -from flask import ( - render_template, - redirect, - flash, - url_for, -) +from flask import Blueprint, flash, redirect, render_template, url_for +from flask_bcrypt import generate_password_hash +from flask_login import login_user from sqlalchemy.exc import ( - IntegrityError, - DataError, DatabaseError, + DataError, + IntegrityError, InterfaceError, InvalidRequestError, ) from werkzeug.routing import BuildError -from usermodel import User -from forms.registerform import RegisterForm -from flask_login import login_user -from flask_bcrypt import generate_password_hash + from app import db +from forms.registerform import RegisterForm +from models.user_model import User + +register_user = Blueprint( + "register", + __name__, + template_folder="templates/statuspengguna", + static_folder="static", +) + + +@register_user.route("/", methods=["GET", "POST"]) +def register(): + return RegisterUser() def RegisterUser(): diff --git a/verse/statuspengguna/resetpassword.py b/verse/statuspengguna/resetpassword.py index b802dab..a75f86e 100644 --- a/verse/statuspengguna/resetpassword.py +++ b/verse/statuspengguna/resetpassword.py @@ -1,23 +1,33 @@ from datetime import datetime -from flask import ( - render_template, - redirect, - flash, - url_for, -) + +from flask import flash, redirect, render_template, url_for +from flask_bcrypt import generate_password_hash +from flask_login import login_user from sqlalchemy.exc import ( - IntegrityError, - DataError, DatabaseError, + DataError, + IntegrityError, InterfaceError, InvalidRequestError, ) from werkzeug.routing import BuildError -from usermodel import User -from forms.resetpasswordform import ResetPasswordForm -from flask_login import login_user -from flask_bcrypt import generate_password_hash + from app import db +from forms.resetpasswordform import ResetPasswordForm +from models.user_model import User +from statuspengguna import statuspengguna + +reset_password = Blueprint( + "reset_password", + __name__, + template_folder="templates/statuspengguna", + static_folder="static", +) + + +@reset_password.route("/resetpassword/", methods=["GET", "POST"]) +def resetpassword(path): + return ResetPassword(path) def ResetPassword(path): diff --git a/verse/statuspengguna/static/css/dropdown.css b/verse/statuspengguna/static/css/dropdown.css new file mode 100644 index 0000000..07509d5 --- /dev/null +++ b/verse/statuspengguna/static/css/dropdown.css @@ -0,0 +1,69 @@ +/* Dropdown Button */ +/* for sorting on year and category +*/ +button { + background-color: #E0B0FF; + text-decoration: none; + border: none; +} +.filter { + display: none; +} + +.activebtn { + background-color: #62b264; +} + +.show { + display: block; +} +.dropdown { + position: relative; + display: inline-block; +} + +/* Dropdown Content (Hidden by Default) */ +.dropdown-content { + display: none; + position: absolute; + background-color: #E0B0FF; + min-width: 120px; + border: 2px solid; + z-index: 1; + border-style: outset; +} + +/* Links inside the dropdown */ +.dropdown-content button { + color: black; + padding: 6px; + border: none; + min-width: inherit; + text-align: left; + text-decoration: none; + display: block; +} +.dropbtn { + margin-top: 1em; +} +/* Change color of dropdown links on hover */ +.dropdown-content button:hover {background-color: #62b264;} + + +/* Show the dropdown menu on hover */ +.dropdown:hover .dropdown-content {display: block;} + +/* Change the background color of the dropdown button when the dropdown content is shown */ +.dropdown:hover .dropbtn {background-color: #62b264;} + +@media only screen and (min-device-width: 320px) and (max-device-width: 480px) { + .dropdown-content button { + font-size: 0.7em; + } + .container > button { + font-size: 0.7em; + } + .dropdown > button { + font-size: 0.7em; + } +} diff --git a/verse/statuspengguna/static/css/editor.css b/verse/statuspengguna/static/css/editor.css new file mode 100644 index 0000000..d087622 --- /dev/null +++ b/verse/statuspengguna/static/css/editor.css @@ -0,0 +1,50 @@ +.editareas { + margin: auto; + display: flex; + justify-content: flex-start; +} +.editarea { + width: 30%; + border: 3px solid #E0B0FF; + border-style: outset; + margin-right: 1em; + margin-left: 0; +} + +.editor { + min-width: 35%; +} +.editform { + width: 100%%; + margin: 0 auto; +} +#editorsubmitform { + padding-top: 1em; +} +.required label { + display: block; + padding-bottom: 2px; + width: 100% +} +textarea { + width: 100%; + height: 100%; + box-sizing: border-box; + min-height: 250px; + background: #E0B0FF; + outline: none; + font-family: Courier, sans-serif; + font-size: 16px; +} + +iframe { + bottom: 0; + position: relative; + margin-top: 1em; + width: 100%; + height: 30em; +} +#html { + background-color: #60337F; + color: lightgrey; +} diff --git a/verse/statuspengguna/static/css/selector.css b/verse/statuspengguna/static/css/selector.css new file mode 100644 index 0000000..a500a61 --- /dev/null +++ b/verse/statuspengguna/static/css/selector.css @@ -0,0 +1,53 @@ +.selector-style { + padding: 0; + width: 20em; + max-width: 20em; + position: relative; + border: none; + background: #E0B0FF; + text-decoration: none; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + margin: 1px; +} + +.selector-style select { + padding: 0.2em 0.2em; + width: 20em; + max-width: 20em; + border: none; + box-shadow: none; + background-color: #E0B0FF; + background-image: none; + -webkit-appearance: none; + -moz-appearance: none; + appearance: none; +} + +.selector-style:after { + top: 50%; + left: 95%; + border: solid; + content: " "; + height: 0; + width: 0; + position: absolute; + pointer-events: none; + border-color: rgba(0, 0, 0, 0); + border-top-color: #000000; + margin-top: -2px; + z-index: 100; +} +select.selector option{ + color: white; + background-color: #60337F; + padding: 0 10px; +} + +.selector-style select:focus { + outline: none; +} +.selector-style select option:hover { + background: #60337F; +} diff --git a/verse/statuspengguna/static/css/style.css b/verse/statuspengguna/static/css/style.css new file mode 100644 index 0000000..fb743fc --- /dev/null +++ b/verse/statuspengguna/static/css/style.css @@ -0,0 +1,281 @@ +body +{ + font-family: monospace, monospace; + font-size: 15px; + background-color: #fdfdfd; + color:#29d148; + word-wrap: break-word; + line-height: 1.1; +} + +div#login{ + width: 30%; + margin-left: auto; + margin-right: auto; + background-color:#fdfdfd; + text-decoration: none; +} + +div#login form { + width: 24em; + margin: 0 auto; + padding-left: 15%; + padding-right: 15%; +} + +input[type=text], input[type=password], input[type=file] { + color: #C397DF; + width: 18em; + max-width: 18em; + background-color: #fdfdfd; + border: 1px solid #E0B0FF; +} + +div#upload form { + padding-right: 15%; +} + +.workflow{ + margin-top: 1em; + padding: 0.5em; + padding-left: auto; + padding-right: auto; + width: 31em; + background-color:#fdfdfd; + text-decoration: none; + scroll-behavior: smooth; + border-style: outset; +} +.workflow > p { + padding-left: 1em; +} +.workflow > h2 { + padding-left: 0.4em;; +} + +.workflow input{ + max-width: 20em; +} + +#mainworkflow +{ + width: 30em; + margin:0 auto; +} + +#distribusiverse { + margin-bottom: 11em; +} +#distribusi-index { + padding-left: 1em; +} + +div#buttons{ + position: fixed; + top: 0.5em; + right: 0.5em; + display:flex; + flex-direction: row; + justify-content: center; + align-items: center; +} + +div#buttons .distribusi input{ + border: none; + background: #fff600; + text-decoration: none; + margin: 0.2em; +} +div#buttons .distribusi input:hover{ + background: #ffbf00; + +} +fieldset.required { + border: none; +} + +fieldset.required > ul { + padding-left: 0px; +} + +fieldset.required > ul > li{ + list-style-type: none; +} +fieldset.tagfield > input { + width: 100%; + max-width: 100%; +} +#publicthemes > ul { + max-height: 20em; + overflow: auto; +} +#publicthemes > ul > li{ + word-break: break-all; +} + +input { + border: none; + background: #E0B0FF; + text-decoration: none; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + margin: 0.2em; +} + +input:hover { + background: #60337F; +} + +input[type="submit"]:disabled:hover, +input[type="submit"]:disabled, +input[type="submit"]:disabled:focus { + background-color: #2D3039; + color: #d28cff; +} + +.error { + font-size: 110%; + color: #F92020; +} + +#delete { + color: black; + background-color: #F92020; +} + +#update { + color: black; + background-color: #62b264; +} + + +/* unvisited link */ +a:link { + color: #fff600; +} + +/* visited link */ +a:visited { + color: #d28cff; +} + +/* mouse over link */ +a:hover { + color: #60337F; +} + +/* selected link */ +a:active { + color: white; +} + +/* STOLEN GOODS */ +#fancyboi::before { + content: "$ "; +} + +@media (prefers-reduced-motion: no-preference) { + @keyframes flash { + 50% { opacity: 0; } + } + @keyframes reveal { + from { width: 2em; } /* Width of ::before */ + to { width: 55%; } + } + #fancyboi { + width: 55%; + padding: 0.5em; + overflow: hidden; + white-space: nowrap; + animation: reveal 4s linear; + text-overflow: "█"; + background-color: #2D3039; + } + #fancyboi::after { + content: "█"; + animation: flash 0.5s step-end infinite; + } +} + +div.maincontent{ + width: 55%; + border: 3px #E0B0FF; + margin-top: 0.5em; + padding: 0.5em; + border-style: outset; +} + +.tags{ + background-color: #000; + color: #fff; + display: inline-block; + padding-left: 4px; + padding-right: 4px; + text-align: center; + margin: 1px; +} + +.searched { + background: #fff600 !important; + color: black !important; +} + +.tooltip { + position: relative; + display: inline-block; + border-bottom: 1px dotted black; +} + +.tooltip .tooltiptext { + visibility: hidden; + width: 120px; + background-color: black; + color: #fff; + text-align: center; + padding: 5px 0; + position: absolute; + z-index: 1; + bottom: 100%; + left: 50%; + margin-left: -60px; + + /* Fade in tooltip - takes 1 second to go from 0% to 100% opac: */ + opacity: 0; + transition: opacity 2s; +} + +.tooltip:hover .tooltiptext { + visibility: visible; + opacity: 1; +} + +.code-example { + width: 100%; + color: black; + padding: 1em; + box-sizing: border-box; + background: #E0B0FF; + outline: none; + font-family: Courier, sans-serif; + font-size: 16px; +} +/* +Project colors so far. +light +#E0B0FF +medium +#d28cff +dark +#60337F + +background dark +#2D3039 + +yellow important +#fff600 + +red: danger +ff5a5a +backgrounds +*/ diff --git a/verse/statuspengguna/static/icons/about.txt b/verse/statuspengguna/static/icons/about.txt new file mode 100644 index 0000000..f6a9f45 --- /dev/null +++ b/verse/statuspengguna/static/icons/about.txt @@ -0,0 +1,6 @@ +This favicon was generated using the following font: + +- Font Title: Klee One +- Font Author: Copyright 2020 The Klee Project Authors (https://github.com/fontworks-fonts/Klee) +- Font Source: http://fonts.gstatic.com/s/kleeone/v5/LDIxapCLNRc6A8oT4q4AOeekWPrP.ttf +- Font License: SIL Open Font License, 1.1 (http://scripts.sil.org/OFL)) diff --git a/verse/statuspengguna/static/icons/android-chrome-192x192.png b/verse/statuspengguna/static/icons/android-chrome-192x192.png new file mode 100644 index 0000000..3b958ff Binary files /dev/null and b/verse/statuspengguna/static/icons/android-chrome-192x192.png differ diff --git a/verse/statuspengguna/static/icons/android-chrome-512x512.png b/verse/statuspengguna/static/icons/android-chrome-512x512.png new file mode 100644 index 0000000..1d68c63 Binary files /dev/null and b/verse/statuspengguna/static/icons/android-chrome-512x512.png differ diff --git a/verse/statuspengguna/static/icons/apple-touch-icon.png b/verse/statuspengguna/static/icons/apple-touch-icon.png new file mode 100644 index 0000000..97255bd Binary files /dev/null and b/verse/statuspengguna/static/icons/apple-touch-icon.png differ diff --git a/verse/statuspengguna/static/icons/favicon-16x16.png b/verse/statuspengguna/static/icons/favicon-16x16.png new file mode 100644 index 0000000..05a6e48 Binary files /dev/null and b/verse/statuspengguna/static/icons/favicon-16x16.png differ diff --git a/verse/statuspengguna/static/icons/favicon-32x32.png b/verse/statuspengguna/static/icons/favicon-32x32.png new file mode 100644 index 0000000..8478c1e Binary files /dev/null and b/verse/statuspengguna/static/icons/favicon-32x32.png differ diff --git a/verse/statuspengguna/static/icons/favicon.ico b/verse/statuspengguna/static/icons/favicon.ico new file mode 100644 index 0000000..f3757b9 Binary files /dev/null and b/verse/statuspengguna/static/icons/favicon.ico differ diff --git a/verse/statuspengguna/static/icons/site.webmanifest b/verse/statuspengguna/static/icons/site.webmanifest new file mode 100644 index 0000000..45dc8a2 --- /dev/null +++ b/verse/statuspengguna/static/icons/site.webmanifest @@ -0,0 +1 @@ +{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} \ No newline at end of file diff --git a/verse/statuspengguna/static/js/dropdown.js b/verse/statuspengguna/static/js/dropdown.js new file mode 100644 index 0000000..505d4a8 --- /dev/null +++ b/verse/statuspengguna/static/js/dropdown.js @@ -0,0 +1,92 @@ +filterSelection("all", "None"); +function filterSelection(c, name, id) { + resetDropDownButtons(); + var i; + var button = document.getElementById(id); + if(button){ + button.innerText = name; + addClass(button, "activebtn"); + } + var alldistribusis = document.getElementsByClassName("filter"); + if (c == "all") { + for (i = 0; i < alldistribusis.length; i++) { + addClass(alldistribusis[i], "show"); + } + } + else { + for (i = 0; i < alldistribusis.length; i++) { + removeClass(alldistribusis[i], "show"); + if (alldistribusis[i].className.indexOf(c) > -1) { + addClass(alldistribusis[i], "show"); + } + } + } +} + +function resetDropDownButtons(){ + document.getElementById("Year").innerText = "Year"; + document.getElementById("Category").innerText = "Category"; + allactivebuttons = document.getElementsByClassName("activebtn"); + for(var i = 0;allactivebuttons.length; i++) { + removeClass(allactivebuttons[i], "activebtn"); + } +} +function addClass(element, name) { + var i, arr1, arr2; + arr1 = element.className.split(" "); + arr2 = name.split(" "); + for (i = 0; i < arr2.length; i++) { + if (arr1.indexOf(arr2[i]) == -1) {element.className += " " + arr2[i];} + } +} + +function removeClass(element, name) { + var i, arr1, arr2; + arr1 = element.className.split(" "); + arr2 = name.split(" "); + for (i = 0; i < arr2.length; i++) { + while (arr1.indexOf(arr2[i]) > -1) { + arr1.splice(arr1.indexOf(arr2[i]), 1); + } + } + element.className = arr1.join(" "); +} + + +let searchInput = document.getElementById('tagsearch'); +let timeout = null; +// Listen for keystroke events +searchInput.addEventListener('keyup', function (e) { + // Clear the timeout if it has already been set. + clearTimeout(timeout); + // Make a new timeout set to go off in 1000ms (1 second) + timeout = setTimeout(function () { + console.log('Input Value:', searchInput.value); + if (searchInput.value.length > 2) { + searchTags(searchInput.value); + } else { + clearSearchTags(); + } + }, 1000); +}); + +function searchTags(searchInput) { + let tag_ele = document.getElementsByClassName('tags'); + for (var i = 0; i < tag_ele.length; ++i) { + let searchText = searchInput.toLowerCase().trim(); + let tagtext = tag_ele[i].innerText.toLowerCase(); + if(searchText.includes(tagtext) || tagtext.includes(searchText)) { + addClass(tag_ele[i], "searched"); + } + else { + removeClass(tag_ele[i], "searched"); + } + } +} + +function clearSearchTags() { + let tag_ele = document.getElementsByClassName('tags'); + for (var i = 0; i < tag_ele.length; ++i) { + removeClass(tag_ele[i], "searched"); + } +} diff --git a/verse/statuspengguna/static/js/editorupdate.js b/verse/statuspengguna/static/js/editorupdate.js new file mode 100644 index 0000000..f76219e --- /dev/null +++ b/verse/statuspengguna/static/js/editorupdate.js @@ -0,0 +1,19 @@ +function update() { + +var html = document.getElementById("html"); +var css = document.getElementById("css"); +var code = document.getElementById("code").contentWindow.document; + +document.body.onkeyup = function(){ + code.open(); + code.writeln(html.value+""); + code.close(); + }; +document.addEventListener("DOMContentLoaded", function(){ + code.open(); + code.writeln(html.value+""); + code.close(); + }); +}; + +update(); diff --git a/verse/statuspengguna/static/js/script.js b/verse/statuspengguna/static/js/script.js new file mode 100644 index 0000000..2bd662b --- /dev/null +++ b/verse/statuspengguna/static/js/script.js @@ -0,0 +1,25 @@ +console.log("everything is still smooth") + +function scrollToTheme() { + var uploadsuccessful = document.getElementById("uploadsuccessful"); + if(uploadsuccessful){ + const theme = document.getElementById('theme') + theme.scrollIntoView({ behavior: 'smooth', block: 'start' }); + } +} + +function scrollToLaunch() { + var cssSelected = document.getElementById("cssSelected"); + if(cssSelected){ + const launch = document.getElementById('launch') + launch.scrollIntoView({ behavior: 'smooth', block: 'end' }); + } +} + + +document.addEventListener("DOMContentLoaded", scrollToTheme); +document.addEventListener("DOMContentLoaded", scrollToLaunch); + +// function(e) { +// (e.keyCode === 13 || e.keyCode === 32) && $(this).trigger("click") +// } diff --git a/verse/statuspengguna/static/svg/arrow_1.svg b/verse/statuspengguna/static/svg/arrow_1.svg new file mode 100644 index 0000000..21073fd --- /dev/null +++ b/verse/statuspengguna/static/svg/arrow_1.svg @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + diff --git a/verse/statuspengguna/static/svg/arrow_2.svg b/verse/statuspengguna/static/svg/arrow_2.svg new file mode 100644 index 0000000..ea2a026 --- /dev/null +++ b/verse/statuspengguna/static/svg/arrow_2.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/verse/statuspengguna/static/svg/arrow_3.svg b/verse/statuspengguna/static/svg/arrow_3.svg new file mode 100644 index 0000000..c447811 --- /dev/null +++ b/verse/statuspengguna/static/svg/arrow_3.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/verse/templates/forgotpassword.html b/verse/statuspengguna/templates/statuspengguna/forgotpassword.html similarity index 86% rename from verse/templates/forgotpassword.html rename to verse/statuspengguna/templates/statuspengguna/forgotpassword.html index 3932ca0..bed8afc 100644 --- a/verse/templates/forgotpassword.html +++ b/verse/statuspengguna/templates/statuspengguna/forgotpassword.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "base/base.html" %} {% block main %}
@@ -6,7 +6,8 @@

Enter the email address that was used to register with Distribusiverse.

- + {{ forgotpasswordform.csrf_token }}
{{ forgotpasswordform.email.label }} diff --git a/verse/templates/login.html b/verse/statuspengguna/templates/statuspengguna/login.html similarity index 80% rename from verse/templates/login.html rename to verse/statuspengguna/templates/statuspengguna/login.html index b21c11f..70a02b2 100644 --- a/verse/templates/login.html +++ b/verse/statuspengguna/templates/statuspengguna/login.html @@ -1,7 +1,7 @@ -{% extends "base.html" %} +{% extends "base/base.html" %} {% block main %}
- + {{ loginform.csrf_token }}
{{ loginform.email.label }} @@ -19,7 +19,7 @@
{{ loginform.submit }} - Forgot Password? + Forgot Password?
diff --git a/verse/templates/register.html b/verse/statuspengguna/templates/statuspengguna/register.html similarity index 91% rename from verse/templates/register.html rename to verse/statuspengguna/templates/statuspengguna/register.html index 729ba7d..dcdcbad 100644 --- a/verse/templates/register.html +++ b/verse/statuspengguna/templates/statuspengguna/register.html @@ -1,7 +1,7 @@ -{% extends "base.html" %} +{% extends "base/base.html" %} {% block main %}
-
+ {{ registerform.csrf_token }}
{{ registerform.username.label }} diff --git a/verse/templates/resetpassword.html b/verse/statuspengguna/templates/statuspengguna/resetpassword.html similarity index 96% rename from verse/templates/resetpassword.html rename to verse/statuspengguna/templates/statuspengguna/resetpassword.html index cb7cf54..bf2438e 100644 --- a/verse/templates/resetpassword.html +++ b/verse/statuspengguna/templates/statuspengguna/resetpassword.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "base/base.html" %} {% block main %}
{% if linkvalid%} diff --git a/verse/templates/admin.html b/verse/templates/base/admin.html similarity index 82% rename from verse/templates/admin.html rename to verse/templates/base/admin.html index c1fe24a..e0f4982 100644 --- a/verse/templates/admin.html +++ b/verse/templates/base/admin.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "base/base.html" %} {% block main %}
@@ -14,9 +14,6 @@

Admin Page

-

Here you can bulk delete distribusis and users or make users into tutors - These actions cannot be undone! -

List of distribusis

@@ -53,12 +50,6 @@
{% endif %} {% endfor %} -
- {{ adminuserform.tutors }} -
-
- {{ adminuserform.nottutors }} -
{{ adminuserform.delete }}
diff --git a/verse/templates/base.html b/verse/templates/base/base.html similarity index 94% rename from verse/templates/base.html rename to verse/templates/base/base.html index 93102fb..d1d6e54 100644 --- a/verse/templates/base.html +++ b/verse/templates/base/base.html @@ -3,7 +3,7 @@ - Autonomous Practices X Distribusi-Verse + {{title}} diff --git a/verse/templates/base/filtermenu.html b/verse/templates/base/filtermenu.html new file mode 100644 index 0000000..f641751 --- /dev/null +++ b/verse/templates/base/filtermenu.html @@ -0,0 +1,20 @@ +{% block menu %} + + + + +{% endblock menu %} diff --git a/verse/templates/help.html b/verse/templates/base/help.html similarity index 99% rename from verse/templates/help.html rename to verse/templates/base/help.html index 953a795..2abef0c 100644 --- a/verse/templates/help.html +++ b/verse/templates/base/help.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "base/base.html" %} {% block main %}
diff --git a/verse/templates/index.html b/verse/templates/base/index.html similarity index 72% rename from verse/templates/index.html rename to verse/templates/base/index.html index 5aeaf74..e828dcd 100644 --- a/verse/templates/index.html +++ b/verse/templates/base/index.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "base/base.html" %} {% block main %}
@@ -46,19 +46,14 @@

Distribusi is a content management system for the web that produces static index pages based on folders in the files system. It is inspired by the automatic index functions featured in several popular web servers. Distribusi works by traversing the file system and directory hierarchy to automatically list all the files in the directory, detect the file types and providing them with relevant html classes and tags for easy styling.

-
-

- This particular work in progress project Distribusi-verse is an attempt to make distribusi into a webinterface that can be operated remotely without any knowlegde of CLI. Attempting to combine the ideas of distribusi with the ideas of a Tildeverse and Tilde club, but also be neither of these ideas. See a full list of tildeverse members here.

-
-

This project is made for Autonomous Practices at the WDKA in Rotterdam.

List of distribusis

- {% include 'filtermenu.html' %} + {% include 'base/filtermenu.html' %}
    {% for name, distribusi in distribusisindex.items() %} -
  • +
  • {{distribusi["username"]}}:{{name}} {% for tag in distribusi["tags"] %} {{tag}} diff --git a/verse/templates/filtermenu.html b/verse/templates/filtermenu.html deleted file mode 100644 index c84abb7..0000000 --- a/verse/templates/filtermenu.html +++ /dev/null @@ -1,28 +0,0 @@ -{% block menu %} - - - - - -{% endblock menu %}