Make the zedifus changes.

This commit is contained in:
Andrew 2022-11-30 18:14:37 -05:00
parent b2182919ff
commit 9bd0bd2f7e
3 changed files with 33 additions and 7 deletions

View File

@ -874,6 +874,7 @@ class PanelHandler(BaseHandler):
): ):
if item not in page_data["backgrounds"]: if item not in page_data["backgrounds"]:
page_data["backgrounds"].append(item) page_data["backgrounds"].append(item)
page_data["background"] = self.controller.cached_login
else: else:
page_data["managed_users"] = self.controller.users.get_managed_users( page_data["managed_users"] = self.controller.users.get_managed_users(
exec_user["user_id"] exec_user["user_id"]

View File

@ -247,11 +247,13 @@
<div class="col-sm-12"> <div class="col-sm-12">
<div class="form-group"> <div class="form-group">
<label for="server">Background Upload</label><br> <label for="server">{{ translate('panelConfig', 'backgroundUpload', data['lang'])
}}</label><br>
<span id="upload_input"> <span id="upload_input">
<input type="file" multiple="false" class="form-control" id="file" name="file" required <input type="file" multiple="false" class="form-control" id="file" name="file" required
style="width: 70%;"> style="width: 70%;">
<button type="button" class="btn btn-info" onclick="sendFile()">UPLOAD</button> <button type="button" class="btn btn-info" id="upload-button" onclick="sendFile()"
disabled>UPLOAD</button>
</span> </span>
</div> </div>
</div> </div>
@ -265,7 +267,7 @@
<div class="col-sm-6 grid-margin stretch-card"> <div class="col-sm-6 grid-margin stretch-card">
<div class="card"> <div class="card">
<div class="card-body"> <div class="card-body">
<h4>Login Background Image</h4><br /><br> <h4>{{ translate('panelConfig', 'loginBackground', data['lang']) }}</h4><br /><br><br />
<form id="photo_form"> <form id="photo_form">
<select class="form-select form-control form-control-lg select-css" id="photo" name="photo" <select class="form-select form-control form-control-lg select-css" id="photo" name="photo"
form="photo_form"> form="photo_form">
@ -273,10 +275,18 @@
<option value="{{image}}">{{image}}</option> <option value="{{image}}">{{image}}</option>
{% end %} {% end %}
</select> </select>
<div>
<br>
<h6>{{ translate('panelConfig', 'preview', data['lang']) }}:</h6>
<img style="width: 200px; height: 113px;"
src="../../static/assets/images/auth/{{ data['background'] }}">
</div>
<br /> <br />
<br /> <br />
<button class="btn btn-outline-success select-photo" type="button">Select</button> <button class="btn btn-outline-success select-photo" type="button">{{ translate('panelConfig',
<button class="btn btn-outline-danger delete-photo" type="button">Delete</button> 'select', data['lang']) }}</button>
<button class="btn btn-outline-danger delete-photo" type="button">{{ translate('panelConfig',
'delete', data['lang']) }}</button>
</form> </form>
</div> </div>
</div> </div>
@ -332,6 +342,13 @@
$('.too_small2').popover("hide"); $('.too_small2').popover("hide");
} // New width } // New width
}); });
$('#file').change(function () {
console.log("File changed");
if ($('#file').val()) {
$('#upload-button').prop("disabled", false);
console.log("File changed good");
}
});
</script> </script>
<script> <script>
@ -382,6 +399,7 @@
headers: { 'X-XSRFToken': token }, headers: { 'X-XSRFToken': token },
url: '/ajax/select_photo?photo=' + photo, url: '/ajax/select_photo?photo=' + photo,
success: function (data) { success: function (data) {
window.location.reload();
}, },
}); });
}) })
@ -409,7 +427,9 @@
if (event.target.responseText == 'success') { if (event.target.responseText == 'success') {
console.log('Upload for file', file.name, 'was successful!') console.log('Upload for file', file.name, 'was successful!')
document.getElementById("upload_input").innerHTML = '<div class="card-header header-sm d-flex justify-content-between align-items-center"><span id="file-uploaded" style="color: gray;">' + fileName + '</span> 🔒</div>'; document.getElementById("upload_input").innerHTML = '<div class="card-header header-sm d-flex justify-content-between align-items-center"><span id="file-uploaded" style="color: gray;">' + fileName + '</span> 🔒</div>';
document.getElementById("lower_half").style.visibility = "visible"; setTimeout(function () {
window.location.reload();
}, 2000);
} }
else { else {
alert('Upload failed with response: ' + event.target.responseText); alert('Upload failed with response: ' + event.target.responseText);

View File

@ -227,7 +227,12 @@
"superConfirmTitle": "Enable superuser? Are you sure?", "superConfirmTitle": "Enable superuser? Are you sure?",
"user": "User", "user": "User",
"users": "Users", "users": "Users",
"loginImage": "Upload a background image for the login screen." "loginImage": "Upload a background image for the login screen.",
"backgroundUpload": "Background Upload",
"loginBackground": "Login Background Image",
"select": "Select",
"selectImage": "Select an image",
"preview": "Preview"
}, },
"rolesConfig": { "rolesConfig": {
"config": "Role Config", "config": "Role Config",