diff --git a/data/interfaces/default/css/plexpy.css b/data/interfaces/default/css/plexpy.css index 7bbf8d46..81b24a97 100644 --- a/data/interfaces/default/css/plexpy.css +++ b/data/interfaces/default/css/plexpy.css @@ -418,6 +418,7 @@ input[type="color"], webkit-box-shadow: 0 0 4px rgba(0,0,0,.3),inset 0 0 0 1px rgba(255,255,255,.1); -moz-box-shadow: 0 0 4px rgba(0,0,0,.3),inset 0 0 0 1px rgba(255,255,255,.1); box-shadow: 0 0 4px rgba(0,0,0,.3),inset 0 0 0 1px rgba(255,255,255,.1); + overflow: hidden; } .cover-face { background-position: center; @@ -826,8 +827,6 @@ input[type="color"], -ms-backface-visibility: hidden; -o-backface-visibility: hidden; backface-visibility: hidden; - width: auto; - height: 260px; border: 1px solid rgba(128, 128, 128, 0.3); } .summary-content { @@ -1684,6 +1683,26 @@ input[type="color"], .history-title .popover.right .popover-content { padding: 5px 8px; } +.edit-user-toggles { + padding-right: 10px; +} +.edit-user-toggles > input[type='checkbox'] { + display: none; +} +.edit-user-toggles > input[type='checkbox'] + label { + color: #444; + cursor: pointer; +} +.edit-user-toggles > input[type='checkbox']:checked + label { + color: #fff; + cursor: pointer; +} +.popover .popover-content { + color: #000; +} +#users-to-delete > li { + color: #e9a049; +} #updatebar { background-color: #444; color: #999999; diff --git a/data/interfaces/default/js/tables/users.js b/data/interfaces/default/js/tables/users.js index c3d1ae1e..b3f54778 100644 --- a/data/interfaces/default/js/tables/users.js +++ b/data/interfaces/default/js/tables/users.js @@ -11,13 +11,28 @@ users_list_table_options = { "processing": false, "serverSide": true, "pageLength": 10, - "order": [ 1, 'asc'], + "order": [ 2, 'asc'], "autoWidth": true, "stateSave": true, "pagingType": "bootstrap", "columnDefs": [ { "targets": [0], + "data": null, + "createdCell": function (td, cellData, rowData, row, col) { + $(td).html('
   ' + + ' ' + + ' ' + + // Show/hide user currently doesn't work + ''); + }, + "width": "7%", + "className": "edit-control no-wrap hidden", + "searchable": false, + "orderable": false + }, + { + "targets": [1], "data": "user_thumb", "createdCell": function (td, cellData, rowData, row, col) { if (cellData === '') { @@ -32,23 +47,26 @@ users_list_table_options = { "className": "users-poster-face" }, { - "targets": [1], + "targets": [2], "data": "friendly_name", "createdCell": function (td, cellData, rowData, row, col) { if (cellData !== '') { if (rowData['user_id'] > 0) { - $(td).html('' + cellData + ''); + $(td).html('
' + cellData + '' + + '
'); } else { - $(td).html('' + cellData + ''); + $(td).html('
' + cellData + '' + + '
'); } } else { $(td).html(cellData); } }, - "width": "15%" + "width": "12%", + "className": "edit-user-control no-wrap" }, { - "targets": [2], + "targets": [3], "data": "last_seen", "render": function ( data, type, full ) { if (data) { @@ -58,11 +76,11 @@ users_list_table_options = { } }, "searchable": false, - "width": "15%", + "width": "12%", "className": "no-wrap hidden-xs" }, { - "targets": [3], + "targets": [4], "data": "ip_address", "createdCell": function (td, cellData, rowData, row, col) { if (cellData) { @@ -79,32 +97,32 @@ users_list_table_options = { $(td).html('n/a'); } }, - "width": "15%", + "width": "12%", "className": "no-wrap hidden-md hidden-sm hidden-xs modal-control-ip" }, { - "targets": [4], + "targets": [5], "data":"platform", "createdCell": function (td, cellData, rowData, row, col) { if (cellData) { var transcode_dec = ''; if (rowData['video_decision'] === 'transcode') { - transcode_dec = ' '; + transcode_dec = ''; } else if (rowData['video_decision'] === 'copy') { - transcode_dec = ' '; + transcode_dec = ''; } else if (rowData['video_decision'] === 'direct play' || rowData['video_decision'] === '') { - transcode_dec = ' '; + transcode_dec = ''; } $(td).html('
' + transcode_dec + ' ' + cellData + '
'); } else { $(td).html('n/a'); } }, - "width": "15%", + "width": "12%", "className": "no-wrap hidden-md hidden-sm hidden-xs modal-control" }, { - "targets": [5], + "targets": [6], "data":"last_watched", "createdCell": function (td, cellData, rowData, row, col) { if (cellData !== '') { @@ -129,14 +147,15 @@ users_list_table_options = { } } }, + "width": "30%", "className": "hidden-sm hidden-xs" }, { - "targets": [6], + "targets": [7], "data": "plays", "searchable": false, "width": "10%" - } + } ], "drawCallback": function (settings) { @@ -145,6 +164,8 @@ users_list_table_options = { $('#ajaxMsg').fadeOut(); // Create the tooltips. + $('.purge-tooltip').tooltip(); + $('.edit-tooltip').tooltip(); $('.transcode-tooltip').tooltip(); $('.media-type-tooltip').tooltip(); $('.watched-tooltip').tooltip(); @@ -157,6 +178,11 @@ users_list_table_options = { } }); + if ($('#row-edit-mode').hasClass('active')) { + $('.edit-control').each(function () { + $(this).removeClass('hidden'); + }); + } }, "preDrawCallback": function(settings) { var msg = "
 Fetching rows...
"; @@ -204,4 +230,51 @@ $('#users_list_table').on('click', 'td.modal-control-ip', function () { } getUserLocation(rowData['ip_address']); +}); + +$('#users_list_table').on('change', 'td.edit-control > .edit-user-toggles > input, td.edit-user-control > .edit-user-name > input', function () { + var tr = $(this).parents('tr'); + var row = users_list_table.row(tr); + var rowData = row.data(); + + var do_notify = 0; + var keep_history = 0; + if ($('#do_notify-' + rowData['user_id']).is(':checked')) { + do_notify = 1; + } + if ($('#keep_history-' + rowData['user_id']).is(':checked')) { + keep_history = 1; + } + + friendly_name = tr.find('td.edit-user-control > .edit-user-name > input').val(); + + $.ajax({ + url: 'edit_user', + data: { + user_id: rowData['user_id'], + friendly_name: friendly_name, + do_notify: do_notify, + keep_history: keep_history, + thumb: rowData['user_thumb'] + }, + cache: false, + async: true, + success: function (data) { + var msg = "User updated"; + showMsg(msg, false, true, 2000); + } + }); +}); + +$('#users_list_table').on('click', 'td.edit-control > .edit-user-toggles > button', function () { + var tr = $(this).parents('tr'); + var row = users_list_table.row(tr); + var rowData = row.data(); + + //$(this).prop('disabled', true); + if ($(this).hasClass('active')) { + $(this).toggleClass('btn-warning').toggleClass('btn-danger'); + } else { + $(this).toggleClass('btn-danger').toggleClass('btn-warning'); + } }); \ No newline at end of file diff --git a/data/interfaces/default/users.html b/data/interfaces/default/users.html index 37cf9bc7..72cb2303 100644 --- a/data/interfaces/default/users.html +++ b/data/interfaces/default/users.html @@ -12,6 +12,11 @@ All Users
+ +   +
@@ -19,6 +24,7 @@ + @@ -35,6 +41,25 @@ + @@ -47,7 +72,7 @@ - + \ No newline at end of file diff --git a/plexpy/users.py b/plexpy/users.py index 8a24b38b..26f46abf 100644 --- a/plexpy/users.py +++ b/plexpy/users.py @@ -40,7 +40,9 @@ class Users(object): 'session_history_metadata.media_type', 'session_history.rating_key as rating_key', 'session_history_media_info.video_decision', - 'users.username as user' + 'users.username as user', + 'users.do_notify as do_notify', + 'users.keep_history as keep_history' ] try: query = data_tables.ssp_query(table_name='users', @@ -94,7 +96,9 @@ class Users(object): "video_decision": item['video_decision'], "user_thumb": user_thumb, "user": item["user"], - "user_id": item['user_id'] + "user_id": item['user_id'], + "do_notify": helpers.checked(item['do_notify']), + "keep_history": helpers.checked(item['keep_history']) } rows.append(row)
Edit User Last Seen