|
@ -44,6 +44,7 @@ from forms.distribusiform import DistribusiForm |
|
|
from forms.themeform import ThemeForm |
|
|
from forms.themeform import ThemeForm |
|
|
from forms.editorform import EditorForm |
|
|
from forms.editorform import EditorForm |
|
|
|
|
|
|
|
|
|
|
|
from statuspengguna.helper import AreFilesUploaded |
|
|
# Tada! |
|
|
# Tada! |
|
|
from distribusi.cli import build_argparser |
|
|
from distribusi.cli import build_argparser |
|
|
from distribusi.distribusi import distribusify |
|
|
from distribusi.distribusi import distribusify |
|
@ -134,9 +135,8 @@ def distribusi(): |
|
|
uploadform = UploadForm() |
|
|
uploadform = UploadForm() |
|
|
distribusiform = DistribusiForm() |
|
|
distribusiform = DistribusiForm() |
|
|
themeform = ThemeForm() |
|
|
themeform = ThemeForm() |
|
|
|
|
|
files_uploaded = AreFilesUploaded() |
|
|
user = User.query.filter_by(email=current_user.email).first() |
|
|
user = User.query.filter_by(email=current_user.email).first() |
|
|
if user.distribusiname is None: |
|
|
|
|
|
print("nothing to deploy!") |
|
|
|
|
|
if distribusiform.validate_on_submit(): |
|
|
if distribusiform.validate_on_submit(): |
|
|
zipfilename = "{}.zip".format(user.distribusiname) |
|
|
zipfilename = "{}.zip".format(user.distribusiname) |
|
|
userfolder = os.path.join("stash", user.distribusiname) |
|
|
userfolder = os.path.join("stash", user.distribusiname) |
|
@ -163,6 +163,7 @@ def distribusi(): |
|
|
uploadform=uploadform, |
|
|
uploadform=uploadform, |
|
|
distribusiform=distribusiform, |
|
|
distribusiform=distribusiform, |
|
|
themeform=themeform, |
|
|
themeform=themeform, |
|
|
|
|
|
files_uploaded=files_uploaded, |
|
|
) |
|
|
) |
|
|
return template |
|
|
return template |
|
|
|
|
|
|
|
@ -170,10 +171,10 @@ def distribusi(): |
|
|
@APP.route("/upload", methods=["POST"]) |
|
|
@APP.route("/upload", methods=["POST"]) |
|
|
@login_required |
|
|
@login_required |
|
|
def upload(): |
|
|
def upload(): |
|
|
success = False |
|
|
|
|
|
uploadform = UploadForm() |
|
|
uploadform = UploadForm() |
|
|
distribusiform = DistribusiForm() |
|
|
distribusiform = DistribusiForm() |
|
|
themeform = ThemeForm() |
|
|
themeform = ThemeForm() |
|
|
|
|
|
files_uploaded = False |
|
|
if uploadform.validate_on_submit(): |
|
|
if uploadform.validate_on_submit(): |
|
|
user = User.query.filter_by(email=current_user.email).first() |
|
|
user = User.query.filter_by(email=current_user.email).first() |
|
|
user.distribusiname = uploadform.sitename.data |
|
|
user.distribusiname = uploadform.sitename.data |
|
@ -189,13 +190,13 @@ def upload(): |
|
|
copyzipfile = os.path.join(APP.config["UPLOAD_FOLDER"], zipfilename) |
|
|
copyzipfile = os.path.join(APP.config["UPLOAD_FOLDER"], zipfilename) |
|
|
shutil.copy(copyzipfile, newuserfolder) |
|
|
shutil.copy(copyzipfile, newuserfolder) |
|
|
os.remove(os.path.join(APP.config["UPLOAD_FOLDER"], zipfilename)) |
|
|
os.remove(os.path.join(APP.config["UPLOAD_FOLDER"], zipfilename)) |
|
|
success = True |
|
|
files_uploaded = AreFilesUploaded() |
|
|
template = render_template( |
|
|
template = render_template( |
|
|
"distribusi.html", |
|
|
"distribusi.html", |
|
|
uploadform=uploadform, |
|
|
uploadform=uploadform, |
|
|
distribusiform=distribusiform, |
|
|
distribusiform=distribusiform, |
|
|
success=success, |
|
|
|
|
|
themeform=themeform, |
|
|
themeform=themeform, |
|
|
|
|
|
files_uploaded=files_uploaded, |
|
|
) |
|
|
) |
|
|
return template |
|
|
return template |
|
|
|
|
|
|
|
@ -206,6 +207,7 @@ def theme(): |
|
|
uploadform = UploadForm() |
|
|
uploadform = UploadForm() |
|
|
distribusiform = DistribusiForm() |
|
|
distribusiform = DistribusiForm() |
|
|
themeform = ThemeForm() |
|
|
themeform = ThemeForm() |
|
|
|
|
|
files_uploaded = AreFilesUploaded() |
|
|
if themeform.validate_on_submit(): |
|
|
if themeform.validate_on_submit(): |
|
|
user = User.query.filter_by(email=current_user.email).first() |
|
|
user = User.query.filter_by(email=current_user.email).first() |
|
|
newuserfolder = os.path.join("stash", user.distribusiname) |
|
|
newuserfolder = os.path.join("stash", user.distribusiname) |
|
@ -220,6 +222,7 @@ def theme(): |
|
|
uploadform=uploadform, |
|
|
uploadform=uploadform, |
|
|
distribusiform=distribusiform, |
|
|
distribusiform=distribusiform, |
|
|
themeform=themeform, |
|
|
themeform=themeform, |
|
|
|
|
|
files_uploaded=files_uploaded, |
|
|
) |
|
|
) |
|
|
return template |
|
|
return template |
|
|
|
|
|
|
|
@ -228,11 +231,8 @@ def theme(): |
|
|
@login_required |
|
|
@login_required |
|
|
def editor(): |
|
|
def editor(): |
|
|
editorform = EditorForm() |
|
|
editorform = EditorForm() |
|
|
|
|
|
files_uploaded = AreFilesUploaded() |
|
|
user = User.query.filter_by(email=current_user.email).first() |
|
|
user = User.query.filter_by(email=current_user.email).first() |
|
|
files_uploaded = True |
|
|
|
|
|
if user.distribusiname is None: |
|
|
|
|
|
files_uploaded = False |
|
|
|
|
|
print("no folder to add css to!") |
|
|
|
|
|
if editorform.validate_on_submit(): |
|
|
if editorform.validate_on_submit(): |
|
|
userfolder = os.path.join("stash", user.distribusiname) |
|
|
userfolder = os.path.join("stash", user.distribusiname) |
|
|
cssfilename = "{}.css".format(editorform.cssname.data) |
|
|
cssfilename = "{}.css".format(editorform.cssname.data) |
|
|