interface adjustments for apikey interaction

Signed-off-by: Michael Kaufmann <michael.kaufmann@aixit.com>
This commit is contained in:
Michael Kaufmann
2018-06-21 08:21:27 +02:00
parent f198833f8c
commit f1d91dfef8
9 changed files with 115 additions and 39 deletions

45
templates/Sparkle/assets/js/apikey.js vendored Normal file
View File

@@ -0,0 +1,45 @@
/**
*
*/
$(document).ready(function() {
function editApikey(id) {
var sid = getUrlParameter('s');
var page = getUrlParameter('page');
var apikey_id = $('#dialog-' + id + ' input[name="id"]').val();
var allowed_from = $('#dialog-' + id + ' input[name="allowed_from"]').val();
var valid_until = $('#dialog-' + id + ' input[name="valid_until"]').val();
$.ajax({
url: "admin_index.php?s="+sid+"&page="+page+"&action=jqEditApiKey",
type: "POST",
data: {
id: apikey_id, allowed_from: allowed_from, valid_until: valid_until
},
dataType: "json",
success: function(json) {
$('#dialog-' + id).dialog("close");
location.reload();
},
error: function(a, b) {
console.log(a, b);
}
});
}
$("span[id|='apikey'], span[id|='secret']").click(function() {
var id = $(this).attr('data-id');
$('#dialog-' + id).dialog({
modal : true,
buttons : {
Ok : function() {
editApikey(id);
$(this).dialog("close");
}
},
width : 800
});
});
});

View File

@@ -1,20 +1,5 @@
$(document).ready(function() {
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
/**
* disable unusable php-configuration by customer settings
*/

View File

@@ -5,6 +5,22 @@ function twoDigits(value) {
return value;
}
$(document).ready(function() {
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return sParameterName[1] === undefined ? true : sParameterName[1];
}
}
};
// Scroll to top
$(window).scroll(function() {
if ($(this).scrollTop() > 100) {