Dump from SVN

This commit is contained in:
Fándly Gergő
2019-08-08 16:58:29 +03:00
parent 712dbfbe28
commit 310f1b2438
71 changed files with 6883 additions and 0 deletions

24
script/.js Normal file
View File

@ -0,0 +1,24 @@
/**
* /script/.js
* @version 1.0
* @desc Index javascript
* @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/>.
**/

115
script/admin.js Normal file
View File

@ -0,0 +1,115 @@
/**
* /script/admin.js
* @version 1.3
* @desc Javascript file for the admin 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 adminImportUsers(){
//hide all status messages if any shown
$("#statuses").children().each(function(){
$(this).css("display", "none");
});
//get file
var file=$("#csvFile")[0].files[0];
//if greater than 10MB don't upload
if(file.size>10000000){
$("#status_fileTooBig").slideDown();
return;
}
else{
$("#status_uploading").slideDown(function(){
//generate form data
var data=new FormData();
data.append("import_file", file);
//run ajax upload request
$.ajax({
url: "./subs/loader.php?load=admin&backend",
type: "POST",
data: data,
cache: false,
contentType: false,
processData: false,
xhr: function(){
var myXHR=$.ajaxSettings.xhr();
if(myXHR.upload){
myXHR.upload.addEventListener("progress", function(e){
if(e.lengthComputable){
//calculate percent with 1 decimal precision
var percent=Math.round(e.loaded*100/e.total*10)/10;
percent=percent.toString()+"%";
//upload progressbar
$("#uploadStatus").children("div").css("width", percent);
$("#uploadStatus").children("div").children("span").text(percent);
}
});
}
return myXHR;
},
success: function(response){
$("#status_uploading").slideUp();
//something went wrong during the upload
if(response=="error"){
loadMessages();
$("#status_uploadError").slideDown();
}
else{
//everything ok so far
$("#status_processing").slideDown();
//start listener that checks processing status (run every 500ms)
var progressChecker=setInterval(function(){
$.ajax({
url: "./subs/loader.php",
type: "GET",
data: {"load":"admin", "backend":true, "import_progress":response},
success: function(response2){
//update progressbar
$("#processStatus").children("div").css("width", response2);
$("#processStatus").children("div").children("span").text(response2);
}
});
}, 500);
//start processing of file with ajax
$.ajax({
url: "./subs/loader.php?load=admin&backend",
type: "POST",
data: {"process_file":response},
success: function(response2){
//import complete
$("#status_processing").slideUp();
$("#status_done").slideDown();
//stop progress checker
clearInterval(progressChecker);
}
});
}
}
});
});
}
}

63
script/classes.js Normal file
View File

@ -0,0 +1,63 @@
/**
* /script/classes.js
* @version 1.0
* @desc Javascript file for the classes 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 classesLoadList(){
$("#list").slideUp(function(){
$.ajax({
url: "./subs/loader.php?load=classes&backend&list",
type: "GET",
success: function(response){
$("#list").html(response);
$(".table").footable();
$("#list").slideDown();
}
});
});
}
function classesFilterApply(){
$("#list").slideUp(function(){
$.ajax({
url: "./subs/loader.php?load=classes&backend&list",
type: "POST",
data: $("#dd_filter_form").serialize(),
success: function(response){
$("#list").html(response);
$(".table").footable();
$("#list").slideDown();
}
});
});
}
function classesFilterReset(){
$("#dd_filter_form")[0].reset();
classesLoadList();
}
/*
* RUN
*/
//autoload list
classesLoadList();

130
script/contests.js Normal file
View File

@ -0,0 +1,130 @@
/**
* /script/contests.js
* @version 1.0
* @desc Javascript file for the contests 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 contestsLoadList(){
$("#list").slideUp(function(){
$.ajax({
url: "./subs/loader.php",
data: {"load":"contests", "backend":true, "list":$("#schoolyear").val()},
type: "GET",
success: function(response){
$("#list").html(response);
$(".table").footable();
$("#list").slideDown();
}
});
});
}
function contestsFilterApply(){
$("#list").slideUp(function(){
$.ajax({
url: "./subs/loader.php?load=contests&backend&list="+$("#schoolyear").val(),
type: "POST",
data: $("#dd_filter_form").serialize(),
success: function(response){
$("#list").html(response);
$(".table").footable();
$("#list").slideDown();
}
});
});
}
function contestsFilterReset(){
$("#dd_filter_form")[0].reset();
contestsLoadList();
}
function contestsNew(){
$.ajax({
url: "./subs/loader.php?load=contests&backend",
type: "POST",
data: $("#dd_new_form").serialize(),
success: function(){
$("#dd_new_form")[0].reset();
loadMessages();
contestsLoadList();
}
});
}
function contestsEdit(id){
$.ajax({
url: "./subs/loader.php?load=contests&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=name_1]").val(data.name_1);
$("#dd_edit_form input[name=name_2]").val(data.name_2);
$("#dd_edit_form select[name=subject] option[value="+data.subject+"]").attr("selected", true);
$("#dd_edit_form textarea[name=description]").text(data.description);
$("#dd_edit_form input[name=ministry_support][value="+data.ministry_support+"]").attr("checked", true);
$("#dd_edit_form input[name=ministry_place]").val(data.ministry_place);
$("#dd_edit").slideDown();
smoothScroll("#dd_edit");
}
});
}
function contestsSubmitEdit(){
$.ajax({
url: "./subs/loader.php?load=contests&backend",
type: "POST",
data: $("#dd_edit_form").serialize(),
success: function(){
$("#dd_edit").slideUp(function(){
$("#dd_edit_form")[0].reset();
});
loadMessages();
contestsLoadList();
}
});
}
function contestsCancelEdit(){
$("#dd_edit").slideUp(function(){
$("#dd_edit_form")[0].reset();
});
}
function contestsDelete(id, elem){
if(confirm($("#contestsDeleteConfirm").text())){
$.ajax({
url: "./subs/loader.php?load=contests&backend",
type: "POST",
data: {"delete": id},
success: function(){
loadMessages();
footableRemoveElem(elem);
}
});
}
}
/*
* RUN
*/
contestsLoadList();

29
script/js.php Normal file
View File

@ -0,0 +1,29 @@
<?php
/**
* /script/js.php
* @version 1.0
* @desc Loader for JS
* @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/>.
**/
if(isset($_GET['load'])){
header("Content-type: application/javascript");
readfile($_GET['load'].".js", true);
}

203
script/main.js Normal file
View File

@ -0,0 +1,203 @@
/**
* /script/main.js
* @version 1.4
* @desc Main javascript file
* @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/>.
**/
var Site="";
function disposeMessageOverlay(){
$("#messageOverlay").html("");
$("#messageOverlay").fadeOut();
}
function showMessage(html){
$("#messageOverlay").html(html);
$("#messageOverlay").fadeIn();
setTimeout(function(){
disposeMessageOverlay()
}, 5000);
}
function loadMessages(){
$.ajax({
url: "./subs/msg.php",
type: "GET",
success: function(response){
if(response!=""){
showMessage(response);
}
}
});
}
function smoothScroll(selector){
$('html, body').stop().animate({
scrollTop: $(selector).offset().top
}, 500);
}
function goTo(site, pop=false){
Site=site;
//slide up
$("#content").slideUp(function(){
//load part
$.ajax({
url: "./subs/loader.php",
type: "GET",
data: {"load": site},
success: function(response){
$("#content").html(response);
if(!pop){
window.history.pushState({"site": site}, null, "./"+site);
}
},
complete: function(){
$("#content").slideDown(function(){
//load script
$.getScript("./script/js.php?load="+site);
//prepare site
prepareSite();
});
}
});
});
}
function prepareSite(){
//smooth scroll
$('a[href^="#"]').on('click', function(event) {
var target = $(this.getAttribute('href'));
if( target.length ) {
event.preventDefault();
$('html, body').stop().animate({
scrollTop: target.offset().top
}, 500);
}
});
//disable ajax forms submit
$(".ajaxform").submit(function(e){
e.preventDefault(); //prevent classic submit
});
}
function toggleDropdown(content, img){
if($(content).css("display")=="none"){
$(content).slideDown();
$(img).attr("src", "./res/minus.png");
}
else{
$(content).slideUp();
$(img).attr("src", "./res/plus.png");
}
}
function footableRemoveElem(elem){
//delete from table
var button=$(elem);
var current=button.parents("tr:first");
var remove;
//if we in the detail row or not
if(current.hasClass("footable-detail-row")){
//get the previous row and add it with the current row to be removed later
remove = current.add(current.prev());
}
else{
//get the next row after the current row and check if it's a detail row
var next = current.next();
//if the next row is a detail row or not
if (next.hasClass("footable-detail-row")){
//get the next row and add it with the current row to be removed later
remove = current.add(next);
}
else{
//we can't find a detail row so just remove the current row later
remove = current;
}
}
remove.fadeOut(function(){
remove.remove();
});
}
function search(field, list){
$(list).children("li").each(function(){
if($(this).children("label").text().toLowerCase().indexOf($(field).val().toLowerCase())!=-1){
$(this).css("display", "block");
}
else{
$(this).css("display", "none");
}
});
}
function toggleRequiredFormElement(container, to=-1){
if(to==-1){
if($(container).css("display")=="none"){
$(container).children("input").attr("required", true);
$(container).slideDown();
}
else{
$(container).slideUp();
$(container).children("input").attr("required", false);
}
}
else{
if(to==1){
$(container).children("input").attr("required", true);
$(container).slideDown();
}
else{
$(container).slideUp();
$(container).children("input").attr("required", false);
}
}
}
/*
* RUN
*/
jQuery(function($){
//get correct site
Site=window.location.pathname.substring(window.location.pathname.lastIndexOf("/")+1);
$.getScript("./script/js.php?load="+Site);
prepareSite();
//ajax loading functions
$(document).ajaxStart(function(){
$("#loadingOverlay").css("display", "block");
});
$(document).ajaxComplete(function(){
$("#loadingOverlay").css("display", "none");
});
//go back in history
window.addEventListener("popstate", function(e){
if(e.state!=null){
goTo(e.state["site"], true);
}
else{
goTo("", true);
}
});
});

125
script/phases.js Normal file
View File

@ -0,0 +1,125 @@
/**
* /script/phases.js
* @version 1.0
* @desc phases javascript file
* @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 phasesLoadList(){
$("#list").slideUp(function(){
$.ajax({
url: "./subs/loader.php?load=phases&backend&list",
type: "GET",
success: function(response){
$("#list").html(response);
$(".table").footable();
$("#list").slideDown();
}
});
});
}
function phasesFilterApply(){
$("#list").slideUp(function(){
$.ajax({
url: "./subs/loader.php?load=phases&backend&list",
type: "POST",
data: $("#dd_filter_form").serialize(),
success: function(response){
$("#list").html(response);
$(".table").footable();
$("#list").slideDown();
}
});
});
}
function phasesFilterReset(){
$("#dd_filter_form")[0].reset();
phasesLoadList();
}
function phasesNew(){
$.ajax({
url: "./subs/loader.php?load=phases&backend",
type: "POST",
data: $("#dd_new_form").serialize(),
success: function(){
$("#dd_new_form")[0].reset();
loadMessages();
phasesLoadList();
}
});
}
function phasesEdit(id){
$.ajax({
url: "./subs/loader.php?load=phases&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=name_1]").val(data.name_1);
$("#dd_edit_form input[name=name_2]").val(data.name_2);
$("#dd_edit").slideDown();
smoothScroll("#dd_edit");
}
});
}
function phasesSubmitEdit(){
$.ajax({
url: "./subs/loader.php?load=phases&backend",
type: "POST",
data: $("#dd_edit_form").serialize(),
success: function(){
$("#dd_edit").slideUp(function(){
$("#dd_edit_form")[0].reset();
});
loadMessages();
phasesLoadList();
}
});
}
function phasesCancelEdit(){
$("#dd_edit").slideUp(function(){
$("#dd_edit_form")[0].reset();
});
}
function phasesDelete(id, elem){
if(confirm($("#phasesDeleteConfirm").text())){
$.ajax({
url: "./subs/loader.php?load=phases&backend",
type: "POST",
data: {"delete": id},
success: function(){
loadMessages();
footableRemoveElem(elem);
}
});
}
}
/*
* RUN
*/
phasesLoadList();

35
script/profile.js Normal file
View File

@ -0,0 +1,35 @@
/**
* /script/profile.js
* @version 1.0
* @desc Profile javascript file
* @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 profileSetNewPassword(){
$.ajax({
url: "./subs/loader.php?load=profile&backend",
type: "POST",
data: $("#editpasswd").serialize(),
success: function(){
loadMessages();
$("#editpasswd")[0].reset();
}
});
}

190
script/register.js Normal file
View File

@ -0,0 +1,190 @@
/**
* /script/register.js
* @version 1.4
* @desc Register javascript file
* @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 registerLoadList(){
$("#list").slideUp(function(){
$.ajax({
url: "./subs/loader.php",
data: {"load":"register", "backend":true, "list":$("#schoolyear").val()},
type: "GET",
success: function(response){
$("#list").html(response);
$(".table").footable();
$("#list").slideDown();
}
});
});
}
function registerFilterApply(){
$("#list").slideUp(function(){
$.ajax({
url: "./subs/loader.php?load=register&backend&list",
type: "POST",
data: $("#dd_filter_form").serialize(),
success: function(response){
$("#list").html(response);
$(".table").footable();
$("#list").slideDown();
}
});
});
}
function registerFilterReset(){
$("#dd_filter_form")[0].reset();
registerLoadList();
}
function registerEdit(id){
$.ajax({
url: "./subs/loader.php?load=register&backend&getdata="+id,
type: "GET",
success: function(response){
var data=JSON.parse(response);
$("#dd_edit_form input[name=edit]").val(id);
$("#dd_edit_form input[name=student][value="+data.student+"]").attr("checked", true);
$("#dd_edit_form input[name=contest][value="+data.contest+"]").attr("checked", true);
$("#dd_edit_form input[name=phase][value="+data.phase+"]").attr("checked", true);
$("#dd_edit_form input[name=teacher][value="+data.teacher+"]").attr("checked", true);
$("#dd_edit_form input[name=place][value="+(data.place<0?data.place:0)+"]").attr("checked", true);
if(data.place>0){
$("#dd_edit_form input[name=place_c]").val(data.place);
$("#registerCustomPlaceEdit").slideDown();
}
$("#dd_edit_form input[name=place_c]").attr("required", data.place>0);
$("#dd_edit_form textarea[name=mention]").text(data.mention);
$("#dd_edit").slideDown();
smoothScroll("#dd_edit");
}
});
}
function registerSubmitEdit(){
$.ajax({
url: "./subs/loader.php?load=register&backend",
type: "POST",
data: $("#dd_edit_form").serialize(),
success: function(){
$("#dd_edit").slideUp(function(){
$("#dd_edit_form")[0].reset();
});
loadMessages();
registerLoadList();
}
});
}
function registerCancelEdit(){
$("#dd_edit").slideUp(function(){
$("#dd_edit_form")[0].reset();
});
}
function registerDelete(id, elem){
if(confirm($("#registerDeleteConfirm").text())){
$.ajax({
url: "./subs/loader.php?load=register&backend",
type: "POST",
data: {"delete": id},
success: function(){
loadMessages();
footableRemoveElem(elem);
}
});
}
}
function registerNew(){
$.ajax({
url: "./subs/loader.php?load=register&backend",
type: "POST",
data: $("#dd_new_form").serialize(),
success: function(response){
var data=JSON.parse(response);
$("#newSubmitPrevContent tbody").html(data.prev);
$("#dd_newSubmit_form input[name=newSubmit]").val(JSON.stringify(data.params));
$("#newSubmitPrevContent").footable();
$("#dd_new_form")[0].reset();
$("#dd_newSubmit").slideDown();
smoothScroll("#dd_newSubmit");
}
});
}
function registerNewSubmit(){
$.ajax({
url: "./subs/loader.php?load=register&backend",
type: "POST",
data: $("#dd_newSubmit_form").serialize(),
success: function(){
$("#dd_newSubmit").slideUp(function(){
$("#dd_newSubmit_form")[0].reset();
$("#newSubmitPrevContent tbody").html("");
loadMessages();
registerLoadList();
});
}
});
}
function registerNewCancel(){
$("#dd_newSubmit").slideUp(function(){
$("#dd_newSubmit_form")[0].reset();
$("#newSubmitPrevContent tbody").html("");
});
}
function registerExport(){
$.ajax({
url: "./subs/loader.php?load=register&backend",
type: "POST",
data: $("#dd_export_form").serialize(),
beforeSend: function(){
$("#export_progress").css("display", "block");
},
success: function(response){
$("#download_file").val(response);
$("#export_progress").css("display", "none");
$("#export_ready").css("display", "block");
}
});
}
function registerExportDownload(){
$("#export_ready").css("display", "none");
window.location="./subs/loader.php?load=register&backend&expdownload="+$("#download_file").val();
loadMessages();
}
/*
* RUN
*/
registerLoadList();
$("#dd_new_form input[name=place]").click(function(){
toggleRequiredFormElement("#registerCustomPlaceNew", $("#dd_new_form input[name=place][value=0]").is(":checked"));
});
$("#dd_edit_form input[name=place]").click(function(){
toggleRequiredFormElement("#registerCustomPlaceEdit", $("#dd_edit_form input[name=place][value=0]").is(":checked"));
});

125
script/subjects.js Normal file
View File

@ -0,0 +1,125 @@
/**
* /script/subjects.js
* @version 1.3
* @desc Subjects javascript file
* @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 subjectsLoadList(){
$("#list").slideUp(function(){
$.ajax({
url: "./subs/loader.php?load=subjects&backend&list",
type: "GET",
success: function(response){
$("#list").html(response);
$(".table").footable();
$("#list").slideDown();
}
});
});
}
function subjectsFilterApply(){
$("#list").slideUp(function(){
$.ajax({
url: "./subs/loader.php?load=subjects&backend&list",
type: "POST",
data: $("#dd_filter_form").serialize(),
success: function(response){
$("#list").html(response);
$(".table").footable();
$("#list").slideDown();
}
});
});
}
function subjectsFilterReset(){
$("#dd_filter_form")[0].reset();
subjectsLoadList();
}
function subjectsNew(){
$.ajax({
url: "./subs/loader.php?load=subjects&backend",
type: "POST",
data: $("#dd_new_form").serialize(),
success: function(){
$("#dd_new_form")[0].reset();
loadMessages();
subjectsLoadList();
}
});
}
function subjectsEdit(id){
$.ajax({
url: "./subs/loader.php?load=subjects&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=name_1]").val(data.name_1);
$("#dd_edit_form input[name=name_2]").val(data.name_2);
$("#dd_edit").slideDown();
smoothScroll("#dd_edit");
}
});
}
function subjectsSubmitEdit(){
$.ajax({
url: "./subs/loader.php?load=subjects&backend",
type: "POST",
data: $("#dd_edit_form").serialize(),
success: function(){
$("#dd_edit").slideUp(function(){
$("#dd_edit_form")[0].reset();
});
loadMessages();
subjectsLoadList();
}
});
}
function subjectsCancelEdit(){
$("#dd_edit").slideUp(function(){
$("#dd_edit_form")[0].reset();
});
}
function subjectsDelete(id, elem){
if(confirm($("#subjectsDeleteConfirm").text())){
$.ajax({
url: "./subs/loader.php?load=subjects&backend",
type: "POST",
data: {"delete": id},
success: function(){
loadMessages();
footableRemoveElem(elem);
}
});
}
}
/*
* RUN
*/
subjectsLoadList();

131
script/users.js Normal file
View File

@ -0,0 +1,131 @@
/**
* /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();

86
script/wizard.js Normal file
View File

@ -0,0 +1,86 @@
/**
* /script/wizard.js
* @version 1.0
* @desc javascript for the input wizard
* @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 wizardNextStep(elem){
$(elem).parent("div").slideUp();
$(elem).parent("div").parent("div").next().next().children("div").eq(1).slideDown(function(){
smoothScroll($(elem).parent("div").parent("div").next().next());
});
}
function wizardPrevStep(elem){
$(elem).parent("div").slideUp();
$(elem).parent("div").parent("div").prev().prev().children("div").eq(1).slideDown(function(){
smoothScroll($(elem).parent("div").parent("div").prev().prev());
});
}
function wizardSelectMeAsTeacher(){
$("#wizform input[name=teacher][value="+$("#wizardCurrentId").text()+"]").attr("checked", true);
}
function wizardLoadPrevRecords(elem){
$.ajax({
url: "./subs/loader.php?load=register&backend",
type: "POST",
data: $("#wizform").serialize(),
success: function(response){
var data=JSON.parse(response);
$("input[name=recordParams]").val(JSON.stringify(data.params));
$("#wizardPrevContent tbody").html(data.prev);
$("#wizardPrevContent").footable();
$(elem).parent("div").slideUp();
$("#step7_content").slideDown(function(){
smoothScroll("#step7_content");
});
}
});
}
function wizardSubmitRecord(){
$.ajax({
url: "./subs/loader.php?load=register&backend",
type: "POST",
data: {"newSubmit": $("input[name=recordParams]").val()},
success: function(){
loadMessages();
$(".dropdown.content").slideUp(function(){
$("#wizform")[0].reset();
$("#step1_content").slideDown(function(){
smoothScroll("#step1");
});
});
}
});
}
/*
* RUN
*/
//load register scriptbase
$.getScript("./script/js.php?load=register");
//handler for custom place
$("#wizform input[name=place]").click(function(){
toggleRequiredFormElement("#registerCustomPlaceNew", $("#wizform input[name=place][value=0]").is(":checked"));
});