from flask import render_template from forms.distribusiform import DistribusiForm from forms.themeform import ThemeForm from forms.publicthemeform import PublicThemeForm from forms.selectorform import SelectorForm # UserPengguna from statuspengguna.helper import UserHelper from upload import UploadNewDistribusi, UploadUpdatedFiles from distribusisinfo import DistribusisInfo from distribusiselector import SelectorVisible def UploadPage(uploadfolder): "render upload page section of distribusi workflow" distribusiform = DistribusiForm() themeform = ThemeForm() publicthemeform = PublicThemeForm() publicthemeform.publicthemes.choices = DistribusisInfo.publicthemes() selectorform = SelectorForm() selectorform.distribusis.choices = DistribusisInfo.userdistribusinames() selectorvisible = SelectorVisible() current_distribusi = UserHelper.current_distribusi() if current_distribusi == "new" or UserHelper.has_distribusi() is False: uploadform = UploadNewDistribusi(uploadfolder) else: uploadform = UploadUpdatedFiles(uploadfolder) 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