mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-07 13:41:15 -07:00
178 lines
No EOL
7.6 KiB
HTML
178 lines
No EOL
7.6 KiB
HTML
<%doc>
|
|
USAGE DOCUMENTATION :: PLEASE LEAVE THIS AT THE TOP OF THIS FILE
|
|
|
|
For Mako templating syntax documentation please visit: http://docs.makotemplates.org/en/latest/
|
|
|
|
Filename: edit_user.html
|
|
Version: 0.1
|
|
Variable names: data [list]
|
|
|
|
data :: Usable parameters
|
|
|
|
== Global keys ==
|
|
user_id Returns the user id of the user.
|
|
username Returns the user's username.
|
|
friendly_name Returns the friendly name of the user.
|
|
email Returns the user's email address.
|
|
user_thumb Returns the thumbnail for the user.
|
|
is_home_user Returns bool value for whether the user is part of a Plex Home.
|
|
is_allow_sync Returns bool value for whether the user has sync rights.
|
|
is_restricted Returns bool value for whether the user account is restricted.
|
|
do_notify Returns bool value for whether to send notifications for the user.
|
|
keep_history Returns bool value for whether to keep history for the user.
|
|
|
|
DOCUMENTATION :: END
|
|
</%doc>
|
|
|
|
<%!
|
|
from plexpy import helpers
|
|
%>
|
|
|
|
% if data != None:
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-remove"></i></button>
|
|
<h4 class="modal-title">Edit user <strong>${data['username']}</strong></h4>
|
|
</div>
|
|
<div class="modal-body" id="modal-text">
|
|
<fieldset>
|
|
<div class="form-group">
|
|
<label for="friendly_name">Friendly Name</label>
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<input type="text" class="form-control" id="friendly_name" name="friendly_name" value="${data['friendly_name']}" size="30">
|
|
</div>
|
|
</div>
|
|
<p class="help-block">Replace all occurances of the username with this name.</p>
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="profile_url">Profile Picture URL</label>
|
|
<div class="row">
|
|
<div class="col-md-8">
|
|
<input type="text" class="form-control" id="custom_avatar_url" name="custom_avatar_url" value="${data['user_thumb']}">
|
|
</div>
|
|
</div>
|
|
<p class="help-block">Change the users profile picture in PlexPy. To reset to default, leave this field empty and save.</p>
|
|
</div>
|
|
<div class="checkbox">
|
|
<label>
|
|
<input type="checkbox" id="do_notify" name="do_notify" value="1" ${helpers.checked(data['do_notify'])}> Enable notifications
|
|
</label>
|
|
<p class="help-block">Uncheck this if you do not want to receive notifications for this user's activity.</p>
|
|
</div>
|
|
<div class="checkbox">
|
|
<label>
|
|
<input type="checkbox" id="keep_history" name="keep_history" value="1" ${helpers.checked(data['keep_history'])}> Keep history
|
|
</label>
|
|
<p class="help-block">Uncheck this if you do not want to keep any history on this user's activity.</p>
|
|
</div>
|
|
% if data['user_id']:
|
|
<div class="form-group">
|
|
<button class="btn btn-danger" id="delete-all-history">Purge</button>
|
|
<p class="help-block">DANGER ZONE! Click the purge button to remove all history logged for this user. This is permanent!</p>
|
|
</div>
|
|
% endif
|
|
</fieldset>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<div>
|
|
<span id="edit-user-status-message"></span>
|
|
<input type="button" id="save_user" class="btn btn-bright" value="Save">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="confirm-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="confirm-modal">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-remove"></i></button>
|
|
<h4 class="modal-title" id="myModalLabel">Confirm Purge</h4>
|
|
</div>
|
|
<div class="modal-body" style="text-align: center;">
|
|
<p>Are you REALLY sure you want to purge all history for this user?</p>
|
|
<p>This is permanent and cannot be undone!</p>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-dark" data-dismiss="modal">Cancel</button>
|
|
<button type="button" class="btn btn-danger btn-ok" data-dismiss="modal" id="confirm-purge">Purge</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<script>
|
|
// Set user options
|
|
$("#save_user").on('click', function () {
|
|
var friendly_name = $("#friendly_name").val();
|
|
var custom_thumb = $("#custom_avatar_url").val();
|
|
var do_notify = 0;
|
|
var keep_history = 0;
|
|
if ($("#do_notify").is(":checked")) {
|
|
do_notify = 1;
|
|
}
|
|
if ($("#keep_history").is(":checked")) {
|
|
keep_history = 1;
|
|
}
|
|
|
|
$.ajax({
|
|
url: 'edit_user',
|
|
data: {
|
|
user_id: '${data["user_id"]}',
|
|
friendly_name: friendly_name,
|
|
custom_thumb: custom_thumb,
|
|
do_notify: do_notify,
|
|
keep_history: keep_history
|
|
},
|
|
cache: false,
|
|
async: true,
|
|
success: function(data) {
|
|
location.reload();
|
|
}
|
|
});
|
|
});
|
|
|
|
$("#delete-all-history").on('click', function() {
|
|
$('#confirm-modal').modal();
|
|
$('#confirm-modal').one('click', '#confirm-purge', function () {
|
|
$.ajax({
|
|
url: 'delete_all_user_history',
|
|
data: { user_id: '${data["user_id"]}' },
|
|
cache: false,
|
|
async: true,
|
|
success: function(data) {
|
|
location.reload();
|
|
}
|
|
});
|
|
});
|
|
});
|
|
|
|
$(document).ready(function() {
|
|
// Move #confirm-modal to parent container
|
|
if(!($('#edit-user-modal').next().is('#confirm-modal'))) {
|
|
$('#confirm-modal').appendTo($('#edit-user-modal').parent());
|
|
}
|
|
$('#edit-user-modal > #confirm-modal').remove();
|
|
|
|
$('#edit-user-modal').css('z-index', '1050');
|
|
$('.modal-backdrop').not('.modal-backdrop-stack').css('z-index', '1049');
|
|
$('.modal-backdrop').not('.modal-backdrop-stack').addClass('modal-backdrop-stack');
|
|
|
|
$('#confirm-modal').on('show.bs.modal', function () {
|
|
// Fix position to match parent modal
|
|
var currentPadding = parseInt($('body').css('padding-right'));
|
|
$(this).children('.modal-dialog').css('left', -currentPadding/2);
|
|
$('#edit-user-modal').css('overflow-y', 'hidden');
|
|
});
|
|
$('#confirm-modal').on('shown.bs.modal', function () {
|
|
$(this).css('z-index', '1060');
|
|
$('.modal-backdrop').not('.modal-backdrop-stack').css('z-index', '1059');
|
|
$('.modal-backdrop').not('.modal-backdrop-stack').addClass('modal-backdrop-stack');
|
|
});
|
|
$('#confirm-modal').on('hidden.bs.modal', function() {
|
|
$('body').addClass('modal-open');
|
|
$('#edit-user-modal').css('overflow-y', 'auto');
|
|
});
|
|
});
|
|
</script>
|
|
% endif |