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
|
|
|
|
from distribusikan.distribusiselector import SelectorVisible
|
|
|
|
from distribusikan.distribusisinfo import DistribusisInfo
|
|
|
|
from distribusikan.upload import UploadNewDistribusi, UploadUpdatedFiles
|
2022-03-23 21:57:28 +01:00
|
|
|
from forms.distribusiform import DistribusiForm
|
|
|
|
from forms.publicthemeform import PublicThemeForm
|
|
|
|
from forms.selectorform import SelectorForm
|
2024-04-21 20:44:08 +02:00
|
|
|
from 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-04-22 20:34:33 +02:00
|
|
|
def UploadPage():
|
2022-03-23 21:57:28 +01:00
|
|
|
"render upload page section of distribusi workflow"
|
2024-04-22 20:34:33 +02:00
|
|
|
uploadfolder = APP.config["UPLOAD_FOLDER"]
|
2022-03-23 21:57:28 +01:00
|
|
|
distribusiform = DistribusiForm()
|
|
|
|
themeform = ThemeForm()
|
|
|
|
publicthemeform = PublicThemeForm()
|
|
|
|
publicthemeform.publicthemes.choices = DistribusisInfo.publicthemes()
|
|
|
|
selectorform = SelectorForm()
|
|
|
|
selectorform.distribusis.choices = DistribusisInfo.userdistribusinames()
|
|
|
|
selectorvisible = SelectorVisible()
|
|
|
|
|
2022-03-28 20:16:34 +02:00
|
|
|
current_distribusi = UserHelper.current_distribusi()
|
2022-04-01 16:00:43 +02:00
|
|
|
if current_distribusi == "new" or UserHelper.has_distribusi() is False:
|
2022-03-23 21:57:28 +01:00
|
|
|
uploadform = UploadNewDistribusi(uploadfolder)
|
|
|
|
else:
|
|
|
|
uploadform = UploadUpdatedFiles(uploadfolder)
|
|
|
|
|
2022-03-28 20:16:34 +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()
|
2022-03-23 21:57:28 +01:00
|
|
|
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
|