2024-04-24 23:05:36 +02:00
|
|
|
from flask import render_template
|
2024-04-28 13:04:07 +02:00
|
|
|
|
|
|
|
from app import APP
|
2024-06-17 23:06:51 +02:00
|
|
|
from distribusikan.distribusi_selector import selector_visible
|
2024-06-17 22:36:23 +02:00
|
|
|
from distribusikan.distribusis_info import DistribusisInfo
|
|
|
|
from distribusikan.upload import upload_new_distribusi, upload_updates_files
|
2024-06-02 22:14:13 +02:00
|
|
|
from distribusikan.forms.distribusiform import DistribusiForm
|
|
|
|
from distribusikan.forms.publicthemeform import PublicThemeForm
|
|
|
|
from distribusikan.forms.selectorform import SelectorForm
|
|
|
|
from distribusikan.forms.themeform import ThemeForm
|
2024-04-28 13:15:23 +02:00
|
|
|
|
2022-03-23 21:57:28 +01:00
|
|
|
# UserPengguna
|
2022-03-28 20:16:34 +02:00
|
|
|
from statuspengguna.helper import UserHelper
|
2022-03-23 21:57:28 +01:00
|
|
|
|
|
|
|
|
2024-06-17 22:36:23 +02:00
|
|
|
def upload_page():
|
2024-05-28 23:02:17 +02:00
|
|
|
"render upload page section of distribusi workflow"
|
|
|
|
uploadfolder = APP.config["UPLOAD_FOLDER"]
|
|
|
|
distribusiform = DistribusiForm()
|
|
|
|
themeform = ThemeForm()
|
|
|
|
publicthemeform = PublicThemeForm()
|
2024-06-17 22:36:23 +02:00
|
|
|
publicthemeform.publicthemes.choices = DistribusisInfo.public_themes()
|
2024-05-28 23:02:17 +02:00
|
|
|
selectorform = SelectorForm()
|
2024-06-17 22:36:23 +02:00
|
|
|
selectorform.distribusis.choices = DistribusisInfo.user_distribusinames()
|
2024-06-17 23:06:51 +02:00
|
|
|
selectorvisible = selector_visible()
|
2022-03-23 21:57:28 +01:00
|
|
|
|
2024-05-28 23:02:17 +02:00
|
|
|
current_distribusi = UserHelper.current_distribusi()
|
|
|
|
if current_distribusi == "new" or UserHelper.has_distribusi() is False:
|
2024-06-17 22:36:23 +02:00
|
|
|
uploadform = upload_new_distribusi(uploadfolder)
|
2024-05-28 23:02:17 +02:00
|
|
|
else:
|
2024-06-17 22:36:23 +02:00
|
|
|
uploadform = upload_updates_files(uploadfolder)
|
2022-03-23 21:57:28 +01:00
|
|
|
|
2024-05-28 23:02:17 +02:00
|
|
|
files_uploaded = UserHelper.is_zip_uploaded(uploadform.sitename.data)
|
|
|
|
distribusi_live = UserHelper.is_distribusi_live(current_distribusi)
|
|
|
|
css_selected = UserHelper.is_css_selected(current_distribusi)
|
|
|
|
limit_reached = UserHelper.distribusi_limit_reached()
|
|
|
|
template = render_template(
|
|
|
|
"distribusi.html",
|
|
|
|
uploadform=uploadform,
|
|
|
|
distribusiform=distribusiform,
|
|
|
|
themeform=themeform,
|
|
|
|
publicthemeform=publicthemeform,
|
|
|
|
selectorform=selectorform,
|
|
|
|
files_uploaded=files_uploaded,
|
|
|
|
distribusi_live=distribusi_live,
|
|
|
|
css_selected=css_selected,
|
|
|
|
selectorvisible=selectorvisible,
|
|
|
|
limit_reached=limit_reached,
|
|
|
|
)
|
|
|
|
return template
|