Remove old templates

This commit is contained in:
JonnyWong16 2016-10-09 14:39:58 -07:00 committed by JonnyWong16
parent 50941055fb
commit f42d7b0da0
2 changed files with 0 additions and 393 deletions

View file

@ -1,235 +0,0 @@
<%!
from plexpy import helpers
%>
% if data:
<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" id="notification-config-modal-header">${agent['name']} Settings</h4>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<form action="set_notification_config" method="post" class="form" id="set_notification_config" data-parsley-validate>
<div class="col-md-12">
% for item in data:
% if item['input_type'] == 'help':
<div class="form-group">
<label>${item['label']}</label>
<p class="help-block">${item['description'] | n}</p>
</div>
% elif item['input_type'] == 'text' or item['input_type'] == 'number' or item['input_type'] == 'password':
<div class="form-group">
<label for="${item['name']}">${item['label']}</label>
<div class="row">
<div class="col-md-8">
<input type="${item['input_type']}" class="form-control" id="${item['name']}" name="${item['name']}" value="${item['value']}" size="30">
% if item['name'] == 'osx_notify_app':
<a href="javascript:void(0)" id="osxnotifyregister">Register</a>
% endif
</div>
</div>
<p class="help-block">${item['description'] | n}</p>
</div>
% elif item['input_type'] == 'button':
<div class="form-group">
<label for="${item['name']}">${item['label']}</label>
<div class="row">
<div class="col-md-8">
<input type="${item['input_type']}" class="btn btn-bright" id="${item['name']}" name="${item['name']}" value="${item['value']}">
</div>
</div>
<p class="help-block">${item['description'] | n}</p>
</div>
% elif item['input_type'] == 'checkbox':
<div class="checkbox">
<label>
<input type="checkbox" data-id="${item['name']}" class="checkboxes" value="1" ${helpers.checked(item['value'])}> ${item['label']}
</label>
<p class="help-block">${item['description'] | n}</p>
<input type="hidden" id="${item['name']}" name="${item['name']}" value="${item['value']}">
</div>
% elif item['input_type'] == 'select':
<div class="form-group">
<label for="${item['name']}">${item['label']}</label>
<div class="row">
<div class="col-md-8">
<select class="form-control" id="${item['name']}" name="${item['name']}" >
% for key, value in sorted(item['select_options'].iteritems()):
% if key == item['value']:
<option value="${key}" selected>${value}</option>
% else:
<option value="${key}">${value}</option>
% endif
% endfor
</select>
</div>
</div>
<p class="help-block">${item['description'] | n}</p>
</div>
% endif
% endfor
</div>
</form>
<div class="col-md-12" style="margin-top: 10px; padding-top: 10px; border-top: 1px solid #444;">
<h4>Test ${agent['name']}</h4>
<p class="help-block">Test if ${agent['name']} notifications are working. See <a href="logs">logs</a> for troubleshooting.</p>
% if agent['name'] == 'Scripts':
<div class="form-group">
<label for="test_script">Script</label>
<select class="form-control" id="test_script" name="test_script">
% for key, value in sorted(data[2]['select_options'].iteritems()):
<option value="${key}">${value}</option>
% endfor
</select>
<p class="help-block">Choose the script to test.</p>
</div>
<div class="form-group">
<label for="test_script_args">Script Arguments</label>
<input class="form-control" type="text" id="test_script_args" name="test_script_args" value="">
<p class="help-block">Set custom arguments passed to the script.</p>
</div>
% else:
<div class="form-group">
<label for="test_subject">Subject Line</label>
<input class="form-control" type="text" id="test_subject" name="test_subject" value="PlexPy">
<p class="help-block">Set a custom subject line.</p>
</div>
<div class="form-group">
<label for="test_body">Message Body</label>
<input class="form-control" type="text" id="test_body" name="test_body" value="Test notification">
<p class="help-block">Set a custom body.</p>
</div>
% endif
<div class="form-group">
<div class="row">
<div class="col-md-8">
<input type="button" class="btn btn-bright" id="test_notifier" name="test_notifier" value="Test ${agent['name']}">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<%
nosave = any(d['input_type'] == 'nosave' for d in data)
%>
% if not nosave:
<input type="button" id="save-notification-item" class="btn btn-bright" value="Save">
% else:
<input type="button" class="btn btn-bright" data-dismiss="modal" value="Close">
% endif
</div>
</div>
</div>
% endif
<script>
function reloadModal() {
$.ajax({
url: 'get_notification_agent_config',
data: { agent_id: '${agent["id"]}' },
cache: false,
async: true,
complete: function (xhr, status) {
$('#notification-config-modal').html(xhr.responseText);
}
});
}
$('#osxnotifyregister').click(function () {
var osx_notify_app = $('#osx_notify_app').val();
$.get('osxnotifyregister', { 'app': osx_notify_app }, function (data) { showMsg('<i class="fa fa-check"></i> ' + data, false, true, 3000); });
})
$('#save-notification-item').click(function () {
// Reload modal to update certain fields
doAjaxCall('set_notification_config', $(this), 'tabs', true, true, reloadModal);
return false;
});
function disableFacebookRequest() {
if ($('#facebook_app_id').val() != '' && $('#facebook_app_secret').val() != '') { $('#facebookStep1').prop('disabled', false); }
else { $('#facebookStep1').prop('disabled', true); }
}
disableFacebookRequest();
$('#facebook_app_id, #facebook_app_secret').on('change', function () {
disableFacebookRequest()
});
$('#facebookStep1').click(function () {
// Remove trailing '/' from Facebook redirect URI
if ($('#facebook_redirect_uri') && $('#facebook_redirect_uri').val().endsWith('/')) {
$('#facebook_redirect_uri').val($('#facebook_redirect_uri').val().slice(0, -1));
}
doAjaxCall('set_notification_config', $(this), 'tabs', true);
$.get('facebookStep1', function (data) { window.open(data); })
.done(function () { showMsg('<i class="fa fa-check"></i> Confirm Authorization. Check pop-up blocker if no response.', false, true, 3000); });
});
$('#allow_browser').click(function () {
PNotify.desktop.permission();
})
$('#test_notifier').click(function () {
doAjaxCall('set_notification_config', $(this), 'tabs', true, false, sendTestNotification);
});
function sendTestNotification() {
if ('${agent["id"]}' != '17') {
$.ajax({
url: 'send_notification',
data: {
agent_id: '${agent["id"]}',
subject: $('#test_subject').val(),
body: $('#test_body').val(),
script: $('#test_script').val(),
script_args: $('#test_script_args').val(),
notify_action: 'test'
},
cache: false,
async: true,
complete: function (xhr, status) {
if (xhr.responseText.indexOf('sent') > -1) {
msg = '<i class="fa fa-check"></i>&nbsp; ' + xhr.responseText;
showMsg(msg, false, true, 2000);
} else {
msg = '<i class="fa fa-times"></i>&nbsp; ' + xhr.responseText;
showMsg(msg, false, true, 2000, true);
}
}
});
} else {
if ($('#browser_auto_hide_delay').val() == "0") {
PNotify.prototype.options.hide = false;
} else {
PNotify.prototype.options.hide = true;
PNotify.prototype.options.delay = $('#browser_auto_hide_delay').val() * 1000;
}
var notification = new PNotify({
title: $('#test_subject').val(),
text: $('#test_body').val()
});
}
}
$('#pushbullet_apikey, #pushover_apitoken, #scripts_folder, #join_apikey').on('change', function () {
// Reload modal to update certain fields
doAjaxCall('set_notification_config', $(this), 'tabs', true, false, reloadModal);
return false;
});
// Never send checkbox values directly, always substitute value in hidden input.
$('.checkboxes').click(function () {
var configToggle = $(this).data('id');
if ($(this).is(':checked')) {
$('#'+configToggle).val(1);
} else {
$('#'+configToggle).val(0);
}
});
</script>

View file

@ -1,158 +0,0 @@
<%!
from plexpy import helpers
%>
% if data:
<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" id="notification-triggers-modal-header">${data['name']} Notification Triggers</h4>
</div>
<div class="modal-body">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<p class="help-block">
Watched notifications are only applicable for video items.
</p>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_play" ${helpers.checked(data['on_play'])} class="toggle-switches">
Notify on playback start
</label>
<p class="help-block">Trigger notification when a new media item is started.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_stop" ${helpers.checked(data['on_stop'])} class="toggle-switches">
Notify on playback stop
</label>
<p class="help-block">Trigger notification when a media item is stopped.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_pause" ${helpers.checked(data['on_pause'])} class="toggle-switches">
Notify on playback pause
</label>
<p class="help-block">Trigger notification when a media item is paused.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_resume" ${helpers.checked(data['on_resume'])} class="toggle-switches">
Notify on playback resume
</label>
<p class="help-block">Trigger notification when a media item is resumed from a paused state.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_watched" ${helpers.checked(data['on_watched'])} class="toggle-switches">
Notify on watched
</label>
<p class="help-block">Trigger notification when a video item reaches the defined watch percentage.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_buffer" ${helpers.checked(data['on_buffer'])} class="toggle-switches">
Notify on buffer warning
</label>
<p class="help-block">Trigger notification when a media item triggers the defined buffer threshold.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_concurrent" ${helpers.checked(data['on_concurrent'])} class="toggle-switches">
Notify on user concurrent streams
</label>
<p class="help-block">Trigger notification when a user has concurrent streams.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_newdevice" ${helpers.checked(data['on_newdevice'])} class="toggle-switches">
Notify on user new device
</label>
<p class="help-block">Trigger notification when a user streams from a new device.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_created" ${helpers.checked(data['on_created'])} class="toggle-switches">
Notify on recently added
</label>
<p class="help-block">Trigger notification when a media item is added to the Plex Media Server.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_intdown" ${helpers.checked(data['on_intdown'])} class="toggle-switches">
Notify on Plex server down
</label>
<p class="help-block">Trigger notification when the Plex Media Server cannot be reached internally.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_intup" ${helpers.checked(data['on_intup'])} class="toggle-switches">
Notify on Plex server back up
</label>
<p class="help-block">Trigger notification when the Plex Media Server can be reached internally after being down.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_extdown" ${helpers.checked(data['on_extdown'])} class="toggle-switches">
Notify on Plex remote access down
</label>
<p class="help-block">Trigger notification when the Plex Media Server cannot be reached externally.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_extup" ${helpers.checked(data['on_extup'])} class="toggle-switches">
Notify on Plex remote access back up
</label>
<p class="help-block">Trigger notification when the Plex Media Server can be reached externally after being down.</p>
</div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_pmsupdate" ${helpers.checked(data['on_pmsupdate'])} class="toggle-switches">
Notify on Plex update available
</label>
<p class="help-block">Trigger notification when an update for the Plex Media Server is available.</p>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<input type="button" class="btn btn-bright" data-dismiss="modal" value="Close">
</div>
</div>
</div>
<script>
$('.toggle-switches').click(function() {
var configToggle = $(this).data('id');
var toggle = $(this);
if ($(this).is(":checked")) {
var data = {};
data[$(this).data('config-name')] = 1;
$.ajax({
url: 'set_notification_config',
data: data,
async: true,
success: function(data) {
console.log('success');
}
});
$('.toggle-notification-triggers-modal[data-id=' + configToggle + ']').addClass('active');
} else {
var data = {};
data[$(this).data('config-name')] = 0;
$.ajax({
url: 'set_notification_config',
data: data,
async: true,
success: function(data) {
console.log('success');
}
});
if (!($('.toggle-switches').is(":checked"))) {
$('.toggle-notification-triggers-modal[data-id=' + configToggle + ']').removeClass('active');
}
}
});
</script>
% endif