static.js.admin.users.folders.js Maven / Gradle / Ivy
function updateFoldersTable(token) {
var email = $("#email").val();
$.getJSON("/api/folders/list?email=" + email + "&token=" + token, function(data) {
var count = 0;
var list = data.folders;
$("#formlisttable > tbody").html("");
$("#formlisttable").append(
$.map(list, function (item, index) {
count++;
return ''
+ '' + item.foldername + ' '
+ '' + item.permissions + ' '
+ ''
+ ''
+ ' '
+ ' ';
}).join());
if (data.prevtoken === undefined) {
$('#prev-button').hide();
} else {
$('#prev-button').show();
$('#prev-button').data('token', data.prevtoken);
}
if (data.nexttoken === undefined) {
$('#next-button').hide();
} else {
$("#next-button").data("token", data.nexttoken );
$('#next-button').show();
}
if (count == 0) {
$("#formlisttable").append("No " + type + "s ");
}
});
}
function backbutton() {
$("#formlist").slideDown( "slow", function() {
$("#folderadd").hide();
hidemessages();
});
}
$(document).ready(function() {
$("#folderadd").hide();
updateFoldersTable("");
$(".backbutton").click(function(){
backbutton();
});
$("#next-button").click(function() {
var client = $("#formsclient");
var token = $("#next-button").data("token");
updateFormsTable(client.val(), token);
});
$("#prev-button").click(function() {
var client = $("#formsclient");
var token = $("#prev-button").data("token");
updateFormsTable(client.val(), token);
});
$("#addfolderbutton").click(function() {
$("#folderadd").show();
$("#formlist").slideUp( "slow", function() {
});
});
$('.savefolder').submit(function(event) {
postRequest($(this), "/api/folders/save", "", "", function(data) {
updateFoldersTable("");
});
return false;
});
});