132 lines
3.8 KiB
JavaScript
132 lines
3.8 KiB
JavaScript
|
/**
|
||
|
* /script/users.js
|
||
|
* @version 2.1
|
||
|
* @desc javascript for users submenu
|
||
|
* @author Fándly Gergő Zoltán (fandlygergo@gmail.hu, systemtest.tk)
|
||
|
* @copy 2017 Fándly Gergő Zoltán
|
||
|
* License:
|
||
|
Result Manager for managing results of students in bilingual school systems.
|
||
|
Copyright (C) 2017 Fándly Gergő Zoltán
|
||
|
|
||
|
This program is free software: you can redistribute it and/or modify
|
||
|
it under the terms of the GNU General Public License as published by
|
||
|
the Free Software Foundation, either version 3 of the License, or
|
||
|
(at your option) any later version.
|
||
|
|
||
|
This program is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
GNU General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU General Public License
|
||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||
|
**/
|
||
|
|
||
|
function usersLoadList(){
|
||
|
$("#list").slideUp(function(){
|
||
|
$.ajax({
|
||
|
url: "./subs/loader.php?load=users&backend&list",
|
||
|
type: "GET",
|
||
|
success: function(response){
|
||
|
$("#list").html(response);
|
||
|
$(".table").footable();
|
||
|
$("#list").slideDown();
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function usersFilterApply(){
|
||
|
$("#list").slideUp(function(){
|
||
|
$.ajax({
|
||
|
url: "./subs/loader.php?load=users&backend&list",
|
||
|
type: "POST",
|
||
|
data: $("#dd_filter_form").serialize(),
|
||
|
success: function(response){
|
||
|
$("#list").html(response);
|
||
|
$("#list").slideDown(function(){
|
||
|
$(".table").footable();
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function usersFilterReset(){
|
||
|
$("#dd_filter_form")[0].reset();
|
||
|
loadList();
|
||
|
}
|
||
|
|
||
|
function usersNew(){
|
||
|
$.ajax({
|
||
|
url: "./subs/loader.php?load=users&backend",
|
||
|
type: "POST",
|
||
|
data: $("#dd_new_form").serialize(),
|
||
|
success: function(){
|
||
|
$("#dd_new_form")[0].reset();
|
||
|
loadMessages();
|
||
|
usersLoadList();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function usersEdit(id){
|
||
|
$.ajax({
|
||
|
url: "./subs/loader.php?load=users&backend&getdata="+id,
|
||
|
type: "GET",
|
||
|
success: function(response){
|
||
|
var data=JSON.parse(response);
|
||
|
$("#dd_edit_form input[name=edit]").val(data.id);
|
||
|
$("#dd_edit_form input[name=username]").val(data.username);
|
||
|
$("#dd_edit_form input[name=fullname]").val(data.fullname);
|
||
|
$("#dd_edit_form input[name=accesslevel]").val(data.accesslevel);
|
||
|
$("#dd_edit_form input[name=class]").val(data.class);
|
||
|
$("#dd_edit_form input[name=password]").val("");
|
||
|
$("#dd_edit_form input[name=perm_message]").prop("checked", data.perm_message==1);
|
||
|
$("#dd_edit").slideDown();
|
||
|
smoothScroll("#dd_edit");
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function usersSubmitEdit(){
|
||
|
$.ajax({
|
||
|
url: "./subs/loader.php?load=users&backend",
|
||
|
type: "POST",
|
||
|
data: $("#dd_edit_form").serialize(),
|
||
|
success: function(){
|
||
|
$("#dd_edit").slideUp(function(){
|
||
|
$("#dd_edit_form")[0].reset();
|
||
|
});
|
||
|
loadMessages();
|
||
|
usersLoadList();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function usersCancelEdit(){
|
||
|
$("#dd_edit").slideUp(function(){
|
||
|
$("#dd_edit_form")[0].reset();
|
||
|
});
|
||
|
}
|
||
|
|
||
|
function usersDelete(id, elem){
|
||
|
if(confirm($("#usersDeleteConfirm").text())){
|
||
|
$.ajax({
|
||
|
url: "./subs/loader.php?load=users&backend",
|
||
|
type: "POST",
|
||
|
data: {"delete": id},
|
||
|
success: function(){
|
||
|
loadMessages();
|
||
|
footableRemoveElem(elem);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/*
|
||
|
* RUN
|
||
|
*/
|
||
|
//autoload list
|
||
|
usersLoadList();
|