PHPMailer

This commit is contained in:
aschwarz
2023-04-27 17:15:50 +02:00
parent de6abfa26c
commit 1235a0e270
167 changed files with 32558 additions and 22071 deletions

View File

@ -1,169 +1,169 @@
function checkUser(){
var mail = document.getElementById("mail").value;
$.ajax({
type: 'POST',
url: '../controller/admin_create_member.php',
data: {
'function': 'checkuser',
'mail': mail
},
success: function(result) { //we got the response
if(result!=''){
$('#msg').show().delay(5000).fadeOut(500);
$('#msg').html(result);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function membersave(){
var vorname = document.getElementById("vorname").value;
var nachname = document.getElementById("nachname").value;
var mail = document.getElementById("mail").value;
var bemerkung =tinyMCE.get('bemerkung').getContent()
//var my_data = $("form").serialize();
//komma getrennte Werte bei Mehrfachauswahl
var singstimme = $("#singstimme").val();
$.ajax({
type: 'POST',
url: '../controller/admin_create_member.php',
data: {
'function': 'membersave',
'vorname': vorname,
'nachname': nachname,
'mail': mail,
'singstimme': singstimme,
'bemerkung': bemerkung
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("vorname").value ="";
document.getElementById("nachname").value ="";
document.getElementById("mail").value ="";
tinymce.get("bemerkung").setContent("");
var elements = document.getElementById("singstimme").options;
for(var i = 0; i < elements.length; i++){
elements[i].selected = false;
}
}
$('#msg1').show().delay(10000).fadeOut(500);
$('#msg1').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
/*
function userupdate(uid){
var vorname = document.getElementById("vorname").value;
var nachname = document.getElementById("nachname").value;
var mail = document.getElementById("mail").value;
var pwdback = document.getElementById("pwdback");
if(pwdback.checked == true){
var var_pwdback = 1;
}else{
var var_pwdback = 0;
}
//var my_data = $("form").serialize();
//komma getrennte Werte bei Mehrfachauswahl
var rollen = $("#rollen").val();
$.ajax({
type: 'POST',
url: '../controller/admin_create_member.php',
data: {
'function': 'userupdate',
'vorname': vorname,
'nachname': nachname,
'mail': mail,
'rollen': rollen,
'pwdback': var_pwdback,
'uid': uid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "edit_user.php"; }, 1000);
});
}
$('#msg1').show().delay(10000).fadeOut(500);
$('#msg1').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function disableuser(uid){
$.ajax({
type: 'POST',
url: '../controller/admin_create_member.php',
data: {
'function': 'disableuser',
'uid': uid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "edit_user.php"; }, 1000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function enableuser(uid){
$.ajax({
type: 'POST',
url: '../controller/admin_create_member.php',
data: {
'function': 'enableuser',
'uid': uid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "edit_user.php"; }, 1000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function checkUser(){
var mail = document.getElementById("mail").value;
$.ajax({
type: 'POST',
url: '../controller/admin_create_member.php',
data: {
'function': 'checkuser',
'mail': mail
},
success: function(result) { //we got the response
if(result!=''){
$('#msg').show().delay(5000).fadeOut(500);
$('#msg').html(result);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function membersave(){
var vorname = document.getElementById("vorname").value;
var nachname = document.getElementById("nachname").value;
var mail = document.getElementById("mail").value;
var bemerkung =tinyMCE.get('bemerkung').getContent()
//var my_data = $("form").serialize();
//komma getrennte Werte bei Mehrfachauswahl
var singstimme = $("#singstimme").val();
$.ajax({
type: 'POST',
url: '../controller/admin_create_member.php',
data: {
'function': 'membersave',
'vorname': vorname,
'nachname': nachname,
'mail': mail,
'singstimme': singstimme,
'bemerkung': bemerkung
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("vorname").value ="";
document.getElementById("nachname").value ="";
document.getElementById("mail").value ="";
tinymce.get("bemerkung").setContent("");
var elements = document.getElementById("singstimme").options;
for(var i = 0; i < elements.length; i++){
elements[i].selected = false;
}
}
$('#msg1').show().delay(10000).fadeOut(500);
$('#msg1').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
/*
function userupdate(uid){
var vorname = document.getElementById("vorname").value;
var nachname = document.getElementById("nachname").value;
var mail = document.getElementById("mail").value;
var pwdback = document.getElementById("pwdback");
if(pwdback.checked == true){
var var_pwdback = 1;
}else{
var var_pwdback = 0;
}
//var my_data = $("form").serialize();
//komma getrennte Werte bei Mehrfachauswahl
var rollen = $("#rollen").val();
$.ajax({
type: 'POST',
url: '../controller/admin_create_member.php',
data: {
'function': 'userupdate',
'vorname': vorname,
'nachname': nachname,
'mail': mail,
'rollen': rollen,
'pwdback': var_pwdback,
'uid': uid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "edit_user.php"; }, 1000);
});
}
$('#msg1').show().delay(10000).fadeOut(500);
$('#msg1').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function disableuser(uid){
$.ajax({
type: 'POST',
url: '../controller/admin_create_member.php',
data: {
'function': 'disableuser',
'uid': uid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "edit_user.php"; }, 1000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function enableuser(uid){
$.ajax({
type: 'POST',
url: '../controller/admin_create_member.php',
data: {
'function': 'enableuser',
'uid': uid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "edit_user.php"; }, 1000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
*/

View File

@ -1,32 +1,32 @@
function changepwd(){
var password = document.getElementById("password").value;
var password_new1 = document.getElementById("password_new1").value;
var password_new2 = document.getElementById("password_new2").value;
$.ajax({
type: 'POST',
url: '../controller/admin_changepwd.php',
data: {
'function': 'changepwd',
'password': password,
'password_new1': password_new1,
'password_new2': password_new2
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("password").value ="";
document.getElementById("password_new1").value ="";
document.getElementById("password_new2").value ="";
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
function changepwd(){
var password = document.getElementById("password").value;
var password_new1 = document.getElementById("password_new1").value;
var password_new2 = document.getElementById("password_new2").value;
$.ajax({
type: 'POST',
url: '../controller/admin_changepwd.php',
data: {
'function': 'changepwd',
'password': password,
'password_new1': password_new1,
'password_new2': password_new2
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("password").value ="";
document.getElementById("password_new1").value ="";
document.getElementById("password_new2").value ="";
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}

View File

@ -1,163 +1,163 @@
function checkUser(){
var mail = document.getElementById("mail").value;
$.ajax({
type: 'POST',
url: '../controller/admin_create_user.php',
data: {
'function': 'checkuser',
'mail': mail
},
success: function(result) { //we got the response
if(result!=''){
$('#msg').show().delay(5000).fadeOut(500);
$('#msg').html(result);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function usersave(){
var vorname = document.getElementById("vorname").value;
var nachname = document.getElementById("nachname").value;
var mail = document.getElementById("mail").value;
//var my_data = $("form").serialize();
//komma getrennte Werte bei Mehrfachauswahl
var rollen = $("#rollen").val();
$.ajax({
type: 'POST',
url: '../controller/admin_create_user.php',
data: {
'function': 'usersave',
'vorname': vorname,
'nachname': nachname,
'mail': mail,
'rollen': rollen
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("vorname").value ="";
document.getElementById("nachname").value ="";
document.getElementById("mail").value ="";
var elements = document.getElementById("rollen").options;
for(var i = 0; i < elements.length; i++){
elements[i].selected = false;
}
}
$('#msg1').show().delay(10000).fadeOut(500);
$('#msg1').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function userupdate(uid){
var vorname = document.getElementById("vorname").value;
var nachname = document.getElementById("nachname").value;
var mail = document.getElementById("mail").value;
var pwdback = document.getElementById("pwdback");
if(pwdback.checked == true){
var var_pwdback = 1;
}else{
var var_pwdback = 0;
}
//var my_data = $("form").serialize();
//komma getrennte Werte bei Mehrfachauswahl
var rollen = $("#rollen").val();
$.ajax({
type: 'POST',
url: '../controller/admin_create_user.php',
data: {
'function': 'userupdate',
'vorname': vorname,
'nachname': nachname,
'mail': mail,
'rollen': rollen,
'pwdback': var_pwdback,
'uid': uid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "edit_user.php"; }, 1000);
});
}
$('#msg1').show().delay(10000).fadeOut(500);
$('#msg1').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function disableuser(uid){
$.ajax({
type: 'POST',
url: '../controller/admin_create_user.php',
data: {
'function': 'disableuser',
'uid': uid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "edit_user.php"; }, 1000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function enableuser(uid){
$.ajax({
type: 'POST',
url: '../controller/admin_create_user.php',
data: {
'function': 'enableuser',
'uid': uid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "edit_user.php"; }, 1000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
function checkUser(){
var mail = document.getElementById("mail").value;
$.ajax({
type: 'POST',
url: '../controller/admin_create_user.php',
data: {
'function': 'checkuser',
'mail': mail
},
success: function(result) { //we got the response
if(result!=''){
$('#msg').show().delay(5000).fadeOut(500);
$('#msg').html(result);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function usersave(){
var vorname = document.getElementById("vorname").value;
var nachname = document.getElementById("nachname").value;
var mail = document.getElementById("mail").value;
//var my_data = $("form").serialize();
//komma getrennte Werte bei Mehrfachauswahl
var rollen = $("#rollen").val();
$.ajax({
type: 'POST',
url: '../controller/admin_create_user.php',
data: {
'function': 'usersave',
'vorname': vorname,
'nachname': nachname,
'mail': mail,
'rollen': rollen
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("vorname").value ="";
document.getElementById("nachname").value ="";
document.getElementById("mail").value ="";
var elements = document.getElementById("rollen").options;
for(var i = 0; i < elements.length; i++){
elements[i].selected = false;
}
}
$('#msg1').show().delay(10000).fadeOut(500);
$('#msg1').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function userupdate(uid){
var vorname = document.getElementById("vorname").value;
var nachname = document.getElementById("nachname").value;
var mail = document.getElementById("mail").value;
var pwdback = document.getElementById("pwdback");
if(pwdback.checked == true){
var var_pwdback = 1;
}else{
var var_pwdback = 0;
}
//var my_data = $("form").serialize();
//komma getrennte Werte bei Mehrfachauswahl
var rollen = $("#rollen").val();
$.ajax({
type: 'POST',
url: '../controller/admin_create_user.php',
data: {
'function': 'userupdate',
'vorname': vorname,
'nachname': nachname,
'mail': mail,
'rollen': rollen,
'pwdback': var_pwdback,
'uid': uid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "edit_user.php"; }, 1000);
});
}
$('#msg1').show().delay(10000).fadeOut(500);
$('#msg1').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function disableuser(uid){
$.ajax({
type: 'POST',
url: '../controller/admin_create_user.php',
data: {
'function': 'disableuser',
'uid': uid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "edit_user.php"; }, 1000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function enableuser(uid){
$.ajax({
type: 'POST',
url: '../controller/admin_create_user.php',
data: {
'function': 'enableuser',
'uid': uid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "edit_user.php"; }, 1000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}

View File

@ -1,20 +1,20 @@
function onClickDeleteSurvey(id) {
r = confirm('Gesamte Umfrage löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_edit.php',
data: {
'function': 'deleteSurvey',
'id': id
},
success: function(result) {
// document.getElementById("del").innerHTML = "<strong>entfernt</strong>";
//Text einblenden geht nicht, da ein Refresh gemacht wird. Dann sieht man den Text nicht
$(document).ajaxStop(function(){
window.location = "?";
});
}
});
}
function onClickDeleteSurvey(id) {
r = confirm('Gesamte Umfrage löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_edit.php',
data: {
'function': 'deleteSurvey',
'id': id
},
success: function(result) {
// document.getElementById("del").innerHTML = "<strong>entfernt</strong>";
//Text einblenden geht nicht, da ein Refresh gemacht wird. Dann sieht man den Text nicht
$(document).ajaxStop(function(){
window.location = "?";
});
}
});
}
}

View File

@ -1,114 +1,114 @@
function erf_multiple(){
var checkBox = document.getElementById("multiple");
if(checkBox.checked == true){
var var_multiple = 1;
}else{
var var_multiple = 0;
}
$.ajax({
type: 'POST',
url: '../controller/admin_erfassen.php',
data: {
'function': 'erfmultiple',
'multiple': var_multiple
},
success: function(result) { //we got the response
// if(result==-1){
// alert("Bitte zunächst die Frage erfassen");
// $(document).ajaxStop(function(){
// window.location = "?action=fragen&erfassen=1";
// });
// }else{
// $(document).ajaxStop(function(){
// window.location = "?action=fragen&erfassen=1";
// });
// }
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function erfassensave(){
var frage = document.getElementById("frage").value;
var antwort = document.getElementById("antwort").value;
var checkBox = document.getElementById("multiple");
if(checkBox.checked == true){
var var_multiple = 1;
}else{
var var_multiple = 0;
}
$.ajax({
type: 'POST',
url: '../controller/admin_erfassen.php',
data: {
'function': 'save',
'frage': frage,
'antwort': antwort,
'multiple': var_multiple
},
success: function(result) { //we got the response
$(document).ajaxStop(function(){
window.location = "?action=fragen&erfassen=1";
});
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function onClickDelete(id) {
document.getElementById("antwort").value = "";
r = confirm('Antwort löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_erfassen.php',
data: {
'function': 'delete',
'tabelle': 'jumi_umfragen_antworten',
'spalte': 'uaid',
'id': id
},
success: function(result) { //we got the response
$(document).ajaxStop(function(){
window.location = "?action=fragen&erfassen=1";
});
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
}
function onClickDeleteQuestion(id2) {
document.getElementById("frage").value = "";
document.getElementById("antwort").value = "";
r = confirm('Gesamte Frage löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_erfassen.php',
data: {
'function': 'deleteQuestion',
'id2': id2
},
success: function(result) {
// document.getElementById("del").innerHTML = "<strong>entfernt</strong>";
//Text einblenden geht nicht, da ein Refresh gemacht wird. Dann sieht man den Text nicht
$(document).ajaxStop(function(){
window.location = "?action=fragen&erfassen=1";
});
}
});
}
function erf_multiple(){
var checkBox = document.getElementById("multiple");
if(checkBox.checked == true){
var var_multiple = 1;
}else{
var var_multiple = 0;
}
$.ajax({
type: 'POST',
url: '../controller/admin_erfassen.php',
data: {
'function': 'erfmultiple',
'multiple': var_multiple
},
success: function(result) { //we got the response
// if(result==-1){
// alert("Bitte zunächst die Frage erfassen");
// $(document).ajaxStop(function(){
// window.location = "?action=fragen&erfassen=1";
// });
// }else{
// $(document).ajaxStop(function(){
// window.location = "?action=fragen&erfassen=1";
// });
// }
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function erfassensave(){
var frage = document.getElementById("frage").value;
var antwort = document.getElementById("antwort").value;
var checkBox = document.getElementById("multiple");
if(checkBox.checked == true){
var var_multiple = 1;
}else{
var var_multiple = 0;
}
$.ajax({
type: 'POST',
url: '../controller/admin_erfassen.php',
data: {
'function': 'save',
'frage': frage,
'antwort': antwort,
'multiple': var_multiple
},
success: function(result) { //we got the response
$(document).ajaxStop(function(){
window.location = "?action=fragen&erfassen=1";
});
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function onClickDelete(id) {
document.getElementById("antwort").value = "";
r = confirm('Antwort löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_erfassen.php',
data: {
'function': 'delete',
'tabelle': 'jumi_umfragen_antworten',
'spalte': 'uaid',
'id': id
},
success: function(result) { //we got the response
$(document).ajaxStop(function(){
window.location = "?action=fragen&erfassen=1";
});
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
}
function onClickDeleteQuestion(id2) {
document.getElementById("frage").value = "";
document.getElementById("antwort").value = "";
r = confirm('Gesamte Frage löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_erfassen.php',
data: {
'function': 'deleteQuestion',
'id2': id2
},
success: function(result) {
// document.getElementById("del").innerHTML = "<strong>entfernt</strong>";
//Text einblenden geht nicht, da ein Refresh gemacht wird. Dann sieht man den Text nicht
$(document).ajaxStop(function(){
window.location = "?action=fragen&erfassen=1";
});
}
});
}
}

View File

@ -1,106 +1,106 @@
function login(){
var mail = document.getElementById("mail").value;
var password = document.getElementById("password").value;
var angemeldet_bleiben = document.getElementById("angemeldet_bleiben");
if(angemeldet_bleiben.checked == true){
var angemeldet_bleiben = 1;
}else{
var angemeldet_bleiben = 0;
}
$.ajax({
type: 'POST',
url: '../controller/admin_login.php',
data: {
'function': 'login',
'mail': mail,
'password': password,
'angemeldet_bleiben': angemeldet_bleiben
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("mail").value ="";
document.getElementById("password").value ="";
$('#msg').show().delay(1000).fadeOut(500);
$('#msg').html(a[0]);
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "index.php"; }, 1000);
});
}else{
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function passwortvergessen(){
var email = document.getElementById("mail_pwvergessen").value;
$.ajax({
type: 'POST',
url: '../controller/admin_login.php',
data: {
'function': 'passwortvergessen',
'email': email
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("mail_pwvergessen").value ="";
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function resetpasswort(){
var password_new1 = document.getElementById("password_new1").value;
var password_new2 = document.getElementById("password_new2").value;
var code = document.getElementById("code").value;
var uid = document.getElementById("uid").value;
$.ajax({
type: 'POST',
url: '../controller/admin_login.php',
data: {
'function': 'resetpasswort',
'password_new1': password_new1,
'password_new2': password_new2,
'code': code,
'uid': uid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("password_new1").value ="";
document.getElementById("password_new2").value ="";
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "login.php"; }, 1000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
function login(){
var mail = document.getElementById("mail").value;
var password = document.getElementById("password").value;
var angemeldet_bleiben = document.getElementById("angemeldet_bleiben");
if(angemeldet_bleiben.checked == true){
var angemeldet_bleiben = 1;
}else{
var angemeldet_bleiben = 0;
}
$.ajax({
type: 'POST',
url: '../controller/admin_login.php',
data: {
'function': 'login',
'mail': mail,
'password': password,
'angemeldet_bleiben': angemeldet_bleiben
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("mail").value ="";
document.getElementById("password").value ="";
$('#msg').show().delay(1000).fadeOut(500);
$('#msg').html(a[0]);
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "index.php"; }, 1000);
});
}else{
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function passwortvergessen(){
var email = document.getElementById("mail_pwvergessen").value;
$.ajax({
type: 'POST',
url: '../controller/admin_login.php',
data: {
'function': 'passwortvergessen',
'email': email
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("mail_pwvergessen").value ="";
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function resetpasswort(){
var password_new1 = document.getElementById("password_new1").value;
var password_new2 = document.getElementById("password_new2").value;
var code = document.getElementById("code").value;
var uid = document.getElementById("uid").value;
$.ajax({
type: 'POST',
url: '../controller/admin_login.php',
data: {
'function': 'resetpasswort',
'password_new1': password_new1,
'password_new2': password_new2,
'code': code,
'uid': uid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("password_new1").value ="";
document.getElementById("password_new2").value ="";
$(document).ajaxStop(function(){
setTimeout(() => { window.location = "login.php"; }, 1000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}

View File

@ -1,294 +1,294 @@
function notenbuchsave() {
var notenbuch = document.getElementById("notenbuchname").value;
var anz_lizenz = document.getElementById("notenbuchlizenz").value;
var checkliz = document.getElementById("checkliz");
if (checkliz.checked == true) {
var var_checkliz = 1;
} else {
var var_checkliz = 0;
}
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'notenbuchsave',
'notenbuch': notenbuch,
'var_checkliz': var_checkliz,
'anz_lizenz': anz_lizenz
},
success: function(result) { //we got the response
if (result != '') {
var a = result.split('|***|');
if (a[1] == "success") {
setTimeout(function() {
document.getElementById("notenbuchname").value = "";
window.location = "?";
}, 1000);
}
$('#msg').show().delay(1000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function notenbuchupdate(zsid) {
var notenbuch = document.getElementById("notenbuchname").value;
var anz_lizenz = document.getElementById("notenbuchlizenz").value;
var checkliz = document.getElementById("checkliz");
if (checkliz.checked == true) {
var var_checkliz = 1;
} else {
var var_checkliz = 0;
}
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'notenbuchupdate',
'notenbuch': notenbuch,
'var_checkliz': var_checkliz,
'zsid': zsid,
'anz_lizenz': anz_lizenz
},
success: function(result) { //we got the response
if (result != '') {
var a = result.split('|***|');
if (a[1] == "success") {
setTimeout(function() {
document.getElementById("notenbuchname").value = "";
window.location = "?";
}, 1000);
}
$('#msg').show().delay(1000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function editNotenbuch(zsid) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'editNotenbuch',
'zsid': zsid
},
success: function(result) { //we got the response
const obj = JSON.parse(result);
var bezeichnung = obj.bezeichnung;
var lizenzpflicht = obj.lizenzpflicht;
var anzahl_lizenz = obj.anzahl_lizenz;
document.getElementById('notenbuchname').value = bezeichnung;
document.getElementById('save').onclick = function() {
notenbuchupdate(zsid)
};
document.getElementById('save').innerText = 'Update';
if (lizenzpflicht == 1) {
document.getElementById("checkliz").checked = true;
document.getElementById('notenbuchlizenz').disabled = false;
document.getElementById('notenbuchlizenz').value = anzahl_lizenz;
} else {
document.getElementById("checkliz").checked = false;
document.getElementById('notenbuchlizenz').disabled = true;
document.getElementById('notenbuchlizenz').value = '';
}
// if(result!=''){
// var a = result.split('|***|');
// if(a[1]=="success"){
// setTimeout(function() {
// document.getElementById("notenbuchname").value ="";
// window.location = "?";
// }, 1000);
// }
// $('#msg').show().delay(1000).fadeOut(500);
// $('#msg').html(a[0]);
// }
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function erfzuordnung(jndid, zsid) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'erfzuordnung',
'jndid': jndid,
'zsid': zsid
},
success: function(result) { //we got the response
if (result != '') {
var a = result.split('|***|');
if (a[1] == "success") {
setTimeout(function() {
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('notenbuchzuordnung.php?edit=' + value, function() {
$("#ZuordnungModal").modal("show");
});
}, 1000);
}
$('#msg').show().delay(1000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function delzuordnung(jndid, zsid) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'delzuordnung',
'jndid': jndid,
'zsid': zsid
},
success: function(result) { //we got the response
if (result != '') {
var a = result.split('|***|');
if (a[1] == "success") {
setTimeout(function() {
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('notenbuchzuordnung.php?edit=' + value, function() {
$("#ZuordnungModal").modal("show");
});
}, 2000);
}
$('#msg').show().delay(1000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function erfNotenUser(csid, zsid) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'erfNotenUser',
'csid': csid,
'zsid': zsid
},
success: function(result) { //we got the response
if (result != '') {
var a = result.split('|***|');
if (a[1] == "success") {
$(document).ajaxStop(function() {
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('notenuserzuordnung.php?edit=' + value, function() {
$("#ZuordnungModal").modal("show");
});
});
}
$('#msg').show().delay(5000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function delNotenUser(csid, zsid) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'delNotenUser',
'csid': csid,
'zsid': zsid
},
success: function(result) { //we got the response
if (result != '') {
var a = result.split('|***|');
if (a[1] == "success") {
$(document).ajaxStop(function() {
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('notenuserzuordnung.php?edit=' + value, function() {
$("#ZuordnungModal").modal("show");
});
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function delZusammenstellung(zsid) {
r = confirm('Zusammenstellung löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'delZusammenstellung',
'zsid': zsid
},
success: function(result) { //we got the response
if (result != '') {
var a = result.split('|***|');
if (a[1] == "success") {
$(document).ajaxStop(function() {
window.location = "?";
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function notenbuchsave() {
var notenbuch = document.getElementById("notenbuchname").value;
var anz_lizenz = document.getElementById("notenbuchlizenz").value;
var checkliz = document.getElementById("checkliz");
if (checkliz.checked == true) {
var var_checkliz = 1;
} else {
var var_checkliz = 0;
}
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'notenbuchsave',
'notenbuch': notenbuch,
'var_checkliz': var_checkliz,
'anz_lizenz': anz_lizenz
},
success: function(result) { //we got the response
if (result != '') {
var a = result.split('|***|');
if (a[1] == "success") {
setTimeout(function() {
document.getElementById("notenbuchname").value = "";
window.location = "?";
}, 1000);
}
$('#msg').show().delay(1000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function notenbuchupdate(zsid) {
var notenbuch = document.getElementById("notenbuchname").value;
var anz_lizenz = document.getElementById("notenbuchlizenz").value;
var checkliz = document.getElementById("checkliz");
if (checkliz.checked == true) {
var var_checkliz = 1;
} else {
var var_checkliz = 0;
}
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'notenbuchupdate',
'notenbuch': notenbuch,
'var_checkliz': var_checkliz,
'zsid': zsid,
'anz_lizenz': anz_lizenz
},
success: function(result) { //we got the response
if (result != '') {
var a = result.split('|***|');
if (a[1] == "success") {
setTimeout(function() {
document.getElementById("notenbuchname").value = "";
window.location = "?";
}, 1000);
}
$('#msg').show().delay(1000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function editNotenbuch(zsid) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'editNotenbuch',
'zsid': zsid
},
success: function(result) { //we got the response
const obj = JSON.parse(result);
var bezeichnung = obj.bezeichnung;
var lizenzpflicht = obj.lizenzpflicht;
var anzahl_lizenz = obj.anzahl_lizenz;
document.getElementById('notenbuchname').value = bezeichnung;
document.getElementById('save').onclick = function() {
notenbuchupdate(zsid)
};
document.getElementById('save').innerText = 'Update';
if (lizenzpflicht == 1) {
document.getElementById("checkliz").checked = true;
document.getElementById('notenbuchlizenz').disabled = false;
document.getElementById('notenbuchlizenz').value = anzahl_lizenz;
} else {
document.getElementById("checkliz").checked = false;
document.getElementById('notenbuchlizenz').disabled = true;
document.getElementById('notenbuchlizenz').value = '';
}
// if(result!=''){
// var a = result.split('|***|');
// if(a[1]=="success"){
// setTimeout(function() {
// document.getElementById("notenbuchname").value ="";
// window.location = "?";
// }, 1000);
// }
// $('#msg').show().delay(1000).fadeOut(500);
// $('#msg').html(a[0]);
// }
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function erfzuordnung(jndid, zsid) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'erfzuordnung',
'jndid': jndid,
'zsid': zsid
},
success: function(result) { //we got the response
if (result != '') {
var a = result.split('|***|');
if (a[1] == "success") {
setTimeout(function() {
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('notenbuchzuordnung.php?edit=' + value, function() {
$("#ZuordnungModal").modal("show");
});
}, 1000);
}
$('#msg').show().delay(1000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function delzuordnung(jndid, zsid) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'delzuordnung',
'jndid': jndid,
'zsid': zsid
},
success: function(result) { //we got the response
if (result != '') {
var a = result.split('|***|');
if (a[1] == "success") {
setTimeout(function() {
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('notenbuchzuordnung.php?edit=' + value, function() {
$("#ZuordnungModal").modal("show");
});
}, 2000);
}
$('#msg').show().delay(1000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function erfNotenUser(csid, zsid) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'erfNotenUser',
'csid': csid,
'zsid': zsid
},
success: function(result) { //we got the response
if (result != '') {
var a = result.split('|***|');
if (a[1] == "success") {
$(document).ajaxStop(function() {
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('notenuserzuordnung.php?edit=' + value, function() {
$("#ZuordnungModal").modal("show");
});
});
}
$('#msg').show().delay(5000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function delNotenUser(csid, zsid) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'delNotenUser',
'csid': csid,
'zsid': zsid
},
success: function(result) { //we got the response
if (result != '') {
var a = result.split('|***|');
if (a[1] == "success") {
$(document).ajaxStop(function() {
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('notenuserzuordnung.php?edit=' + value, function() {
$("#ZuordnungModal").modal("show");
});
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function delZusammenstellung(zsid) {
r = confirm('Zusammenstellung löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenbuch.php',
data: {
'function': 'delZusammenstellung',
'zsid': zsid
},
success: function(result) { //we got the response
if (result != '') {
var a = result.split('|***|');
if (a[1] == "success") {
$(document).ajaxStop(function() {
window.location = "?";
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
}

View File

@ -1,38 +1,38 @@
// Anders als sonst. Hier ist das Javascript auf der ID des Textfelds
// https://stackoverflow.com/questions/8300381/jquery-ui-autocomplete-how-to-send-post-data
$("#titel").autocomplete({
source: function(request, response) {
$.ajax({
type: "POST",
url: "../controller/admin_suche.php",
data: {
term: request.term,
function: "titel"
},
success: response,
dataType: 'json',
delay: 10
});
}
}, {
minLength: 2
});
$("#verlag").autocomplete({
source: function(request, response) {
$.ajax({
type: "POST",
url: "../controller/admin_suche.php",
data: {
term: request.term,
function: "verlag"
},
success: response,
dataType: 'json',
delay: 10
});
}
}, {
minLength: 2
// Anders als sonst. Hier ist das Javascript auf der ID des Textfelds
// https://stackoverflow.com/questions/8300381/jquery-ui-autocomplete-how-to-send-post-data
$("#titel").autocomplete({
source: function(request, response) {
$.ajax({
type: "POST",
url: "../controller/admin_suche.php",
data: {
term: request.term,
function: "titel"
},
success: response,
dataType: 'json',
delay: 10
});
}
}, {
minLength: 2
});
$("#verlag").autocomplete({
source: function(request, response) {
$.ajax({
type: "POST",
url: "../controller/admin_suche.php",
data: {
term: request.term,
function: "verlag"
},
success: response,
dataType: 'json',
delay: 10
});
}
}, {
minLength: 2
});

View File

@ -1,22 +1,22 @@
function onClickSaveParameter() {
var inputs = $(":input").serializeArray()
inputs = JSON.stringify(inputs)
$.ajax({
type: 'POST',
url: '../controller/admin_parameter.php',
data: {
'function': 'saveParameter',
'inputs': inputs
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
$('#msg').show().delay(5000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
function onClickSaveParameter() {
var inputs = $(":input").serializeArray()
inputs = JSON.stringify(inputs)
$.ajax({
type: 'POST',
url: '../controller/admin_parameter.php',
data: {
'function': 'saveParameter',
'inputs': inputs
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
$('#msg').show().delay(5000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}

View File

@ -0,0 +1,73 @@
$(document).ready(function (e){
$("#frmEnquiry").on('submit',(function(e){
e.preventDefault();
$('#loader-icon').show();
var valid;
valid = validateContact();
if(valid) {
$.ajax({
url: "../controller/admin_phpmailer.php",
type: "POST",
data: new FormData(this),
contentType: false,
cache: false,
processData:false,
success: function(data){
//alert(data);
$("#mail-status").html(data);
$('#loader-icon').hide();
},
error: function(){}
});
}
}));
function validateContact() {
var valid = true;
$(".InputBox").css('background-color','');
$(".info").html('');
// $("#userName").removeClass("invalid");
// $("#userEmail").removeClass("invalid");
$("#empfaenger").removeClass("invalid");
$("#subject").removeClass("invalid");
$("#content").removeClass("invalid");
// Bei TinyMCE geht das anders
var t = tinyMCE.get(0);
var color = '#fff';
t.getBody().style.backgroundColor = color;
if($("#empfaenger").val()=='') {
$("#empfaenger").addClass("invalid");
$("#empfaenger").attr("title","Required");
valid = false;
}
/*
if(!$("#userEmail").val()) {
$("#userEmail").addClass("invalid");
$("#userEmail").attr("title","Required");
valid = false;
}
if(!$("#userEmail").val().match(/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/)) {
$("#userEmail").addClass("invalid");
$("#userEmail").attr("title","Invalid Email");
valid = false;
}
*/
if(!$("#subject").val()) {
$("#subject").addClass("invalid");
$("#subject").attr("title","Required");
valid = false;
}
if($("#content").val()=='') {
var color = '#fbf2f2';
t.getBody().style.backgroundColor = color;
$("#content").attr("title","Required");
valid = false;
}
return valid;
}
});

View File

@ -1,207 +1,207 @@
function rollesave(){
var rollenname = document.getElementById("rollenname").value;
$.ajax({
type: 'POST',
url: '../controller/admin_rollen.php',
data: {
'function': 'rollesave',
'rollenname': rollenname
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("rollenname").value ="";
$(document).ajaxStop(function(){
window.location = "?";
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function erfzuordnung(val) {
var param = val.split('|');
var meid = param[0];
var rid = param[1];
$.ajax({
type: 'POST',
url: '../controller/admin_rollen.php',
data: {
'function': 'erfzuordnung',
'meid': meid,
'rid': rid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('rollenzuordnung.php?edit='+value, function() {
$("#ZuordnungModal").modal("show");
});
});
}
$('#msg').show().delay(5000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function delzuordnung(val) {
var param = val.split('|');
var meid = param[0];
var rid = param[1];
$.ajax({
type: 'POST',
url: '../controller/admin_rollen.php',
data: {
'function': 'delzuordnung',
'meid': meid,
'rid': rid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('rollenzuordnung.php?edit='+value, function() {
$("#ZuordnungModal").modal("show");
});
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function erfuser(val) {
var param = val.split('|');
var uid = param[0];
var rid = param[1];
$.ajax({
type: 'POST',
url: '../controller/admin_rollen.php',
data: {
'function': 'erfuser',
'uid': uid,
'rid': rid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('userzuordnung.php?edit='+value, function() {
$("#ZuordnungModal").modal("show");
});
});
}
$('#msg').show().delay(5000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function deluser(val) {
var param = val.split('|');
var uid = param[0];
var rid = param[1];
$.ajax({
type: 'POST',
url: '../controller/admin_rollen.php',
data: {
'function': 'deluser',
'uid': uid,
'rid': rid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('userzuordnung.php?edit='+value, function() {
$("#ZuordnungModal").modal("show");
});
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function delRole(rid) {
r = confirm('Rolle löschen? Benutzer sind dann unzugeordnet!');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_rollen.php',
data: {
'function': 'delRole',
'rid': rid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
window.location = "?";
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
}
function rollesave(){
var rollenname = document.getElementById("rollenname").value;
$.ajax({
type: 'POST',
url: '../controller/admin_rollen.php',
data: {
'function': 'rollesave',
'rollenname': rollenname
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("rollenname").value ="";
$(document).ajaxStop(function(){
window.location = "?";
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function erfzuordnung(val) {
var param = val.split('|');
var meid = param[0];
var rid = param[1];
$.ajax({
type: 'POST',
url: '../controller/admin_rollen.php',
data: {
'function': 'erfzuordnung',
'meid': meid,
'rid': rid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('rollenzuordnung.php?edit='+value, function() {
$("#ZuordnungModal").modal("show");
});
});
}
$('#msg').show().delay(5000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function delzuordnung(val) {
var param = val.split('|');
var meid = param[0];
var rid = param[1];
$.ajax({
type: 'POST',
url: '../controller/admin_rollen.php',
data: {
'function': 'delzuordnung',
'meid': meid,
'rid': rid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('rollenzuordnung.php?edit='+value, function() {
$("#ZuordnungModal").modal("show");
});
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function erfuser(val) {
var param = val.split('|');
var uid = param[0];
var rid = param[1];
$.ajax({
type: 'POST',
url: '../controller/admin_rollen.php',
data: {
'function': 'erfuser',
'uid': uid,
'rid': rid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('userzuordnung.php?edit='+value, function() {
$("#ZuordnungModal").modal("show");
});
});
}
$('#msg').show().delay(5000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function deluser(val) {
var param = val.split('|');
var uid = param[0];
var rid = param[1];
$.ajax({
type: 'POST',
url: '../controller/admin_rollen.php',
data: {
'function': 'deluser',
'uid': uid,
'rid': rid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
// Refresh Modal
var value = a[2];
// load the url and show modal on success
$("#ZuordnungModal .modal-body").load('userzuordnung.php?edit='+value, function() {
$("#ZuordnungModal").modal("show");
});
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
function delRole(rid) {
r = confirm('Rolle löschen? Benutzer sind dann unzugeordnet!');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_rollen.php',
data: {
'function': 'delRole',
'rid': rid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
window.location = "?";
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
}

View File

@ -1,40 +1,40 @@
function membersave(){
var vorname = document.getElementById("vorname").value;
var nachname = document.getElementById("nachname").value;
var mail = document.getElementById("mail").value;
var alter16 = document.querySelector('input[name="alter16"]:checked').value;
//komma getrennte Werte bei Mehrfachauswahl
var singstimme = $("#singstimme").val();
$.ajax({
type: 'POST',
url: '../controller/selfregistration.php',
data: {
'function': 'membersave',
'vorname': vorname,
'nachname': nachname,
'mail': mail,
'singstimme': singstimme,
'alter16': alter16
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("vorname").value ="";
document.getElementById("nachname").value ="";
document.getElementById("mail").value ="";
var elements = document.getElementById("singstimme").options;
for(var i = 0; i < elements.length; i++){
elements[i].selected = false;
}
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
function membersave(){
var vorname = document.getElementById("vorname").value;
var nachname = document.getElementById("nachname").value;
var mail = document.getElementById("mail").value;
var alter16 = document.querySelector('input[name="alter16"]:checked').value;
//komma getrennte Werte bei Mehrfachauswahl
var singstimme = $("#singstimme").val();
$.ajax({
type: 'POST',
url: '../controller/selfregistration.php',
data: {
'function': 'membersave',
'vorname': vorname,
'nachname': nachname,
'mail': mail,
'singstimme': singstimme,
'alter16': alter16
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
document.getElementById("vorname").value ="";
document.getElementById("nachname").value ="";
document.getElementById("mail").value ="";
var elements = document.getElementById("singstimme").options;
for(var i = 0; i < elements.length; i++){
elements[i].selected = false;
}
}
$('#msg1').show().delay(10000).fadeOut(500);
$('#msg1').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}

View File

@ -1,433 +1,433 @@
function vpb_multiple_file_uploader(vpb_configuration_settings) {
this.vpb_settings = vpb_configuration_settings;
this.vpb_files = "";
this.vpb_browsed_files = []
var self = this;
var vpb_msg = "Sorry, your browser does not support this application. Thank You!";
//Get all browsed file extensions
function vpb_file_ext(file) {
return (/[.]/.exec(file)) ? /[^.]+$/.exec(file.toLowerCase()) : '';
}
/* Display added files which are ready for upload */
//with their file types, names, size, date last modified along with an option to remove an unwanted file
vpb_multiple_file_uploader.prototype.vpb_show_added_files = function(vpb_value) {
this.vpb_files = vpb_value;
if (this.vpb_files.length > 0) {
var vpb_added_files_displayer = vpb_file_id = "";
for (var i = 0; i < this.vpb_files.length; i++) {
//Use the names of the files without their extensions as their ids
var files_name_without_extensions = this.vpb_files[i].name.substr(0, this.vpb_files[i].name.lastIndexOf('.')) || this.vpb_files[i].name;
vpb_file_id = files_name_without_extensions.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
var vpb_file_to_add = vpb_file_ext(this.vpb_files[i].name);
var vpb_class = $("#added_class").val();
var vpb_file_icon;
//Check and display File Size
var vpb_fileSize = (this.vpb_files[i].size / 1024);
if (vpb_fileSize / 1024 > 1) {
if (((vpb_fileSize / 1024) / 1024) > 1) {
vpb_fileSize = (Math.round(((vpb_fileSize / 1024) / 1024) * 100) / 100);
var vpb_actual_fileSize = vpb_fileSize + " GB";
} else {
vpb_fileSize = (Math.round((vpb_fileSize / 1024) * 100) / 100)
var vpb_actual_fileSize = vpb_fileSize + " MB";
}
} else {
vpb_fileSize = (Math.round(vpb_fileSize * 100) / 100)
var vpb_actual_fileSize = vpb_fileSize + " KB";
}
//Check and display the date that files were last modified
var vpb_date_last_modified = new Date(this.vpb_files[i].lastModifiedDate);
var dd = vpb_date_last_modified.getDate();
var mm = vpb_date_last_modified.getMonth() + 1;
var yyyy = vpb_date_last_modified.getFullYear();
var vpb_date_last_modified_file = dd + '/' + mm + '/' + yyyy;
//File Display Classes
if (vpb_class == 'vpb_blue') {
var new_classc = 'vpb_white';
} else {
var new_classc = 'vpb_blue';
}
if (typeof this.vpb_files[i] != undefined && this.vpb_files[i].name != "") {
//Check for the type of file browsed so as to represent each file with the appropriate file icon
if (vpb_file_to_add == "jpg" || vpb_file_to_add == "JPG" || vpb_file_to_add == "jpeg" || vpb_file_to_add == "JPEG" || vpb_file_to_add == "gif" || vpb_file_to_add == "GIF" || vpb_file_to_add == "png" || vpb_file_to_add == "PNG") {
vpb_file_icon = '<img src="../media/file_upload_images/images_file.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "doc" || vpb_file_to_add == "docx" || vpb_file_to_add == "rtf" || vpb_file_to_add == "DOC" || vpb_file_to_add == "DOCX") {
vpb_file_icon = '<img src="../media/file_upload_images/doc.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "pdf" || vpb_file_to_add == "PDF") {
vpb_file_icon = '<img src="../media/file_upload_images/pdf.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "txt" || vpb_file_to_add == "TXT" || vpb_file_to_add == "RTF") {
vpb_file_icon = '<img src="../media/file_upload_images/txt.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "php") {
vpb_file_icon = '<img src="../media/file_upload_images/php.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "css") {
vpb_file_icon = '<img src="../media/file_upload_images/general.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "js") {
vpb_file_icon = '<img src="../media/file_upload_images/general.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "html" || vpb_file_to_add == "HTML" || vpb_file_to_add == "htm" || vpb_file_to_add == "HTM") {
vpb_file_icon = '<img src="../media/file_upload_images/html.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "setup") {
vpb_file_icon = '<img src="../media/file_upload_images/setup.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "video") {
vpb_file_icon = '<img src="../media/file_upload_images/video.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "real") {
vpb_file_icon = '<img src="../media/file_upload_images/real.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "psd") {
vpb_file_icon = '<img src="../media/file_upload_images/psd.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "fla") {
vpb_file_icon = '<img src="../media/file_upload_images/fla.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "xls" || vpb_file_to_add == "xlsx") {
vpb_file_icon = '<img src="../media/file_upload_images/xls.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "swf") {
vpb_file_icon = '<img src="../media/file_upload_images/swf.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "eps") {
vpb_file_icon = '<img src="../media/file_upload_images/eps.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "exe") {
vpb_file_icon = '<img src="../media/file_upload_images/exe.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "binary") {
vpb_file_icon = '<img src="../media/file_upload_images/binary.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "zip") {
vpb_file_icon = '<img src="../media/file_upload_images/archive.png" align="absmiddle" border="0" alt="" />';
} else {
vpb_file_icon = '<img src="../media/file_upload_images/general.png" align="absmiddle" border="0" alt="" />';
}
var split = this.vpb_files[i].name.split('.');
var filename = split[0];
var extension = split[1];
if (filename.length > 15) {
filename = filename.substring(0, 10) + '[...]';
}
var result = filename + '.' + extension;
//Assign browsed files to a variable so as to later display them below
vpb_added_files_displayer += '<tr id="add_fileID' + vpb_file_id + '" class="' + new_classc + '"><td><div align="left"><span style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:gray;">' + vpb_file_icon + '&nbsp;' + result + '</span></div></td><td><span id="uploading_' + vpb_file_id + '"><span style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:gray;">Uploadbereit</span></span></td><td><div align="right"><span style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:gray;">' + vpb_actual_fileSize + '</span></div></td><td><span id="remove' + vpb_file_id + '"><span class="vpb_files_remove_left_inner" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;" onclick="vpb_remove_this_file(\'' + vpb_file_id + '\',\'' + this.vpb_files[i].name + '\');">Entfernen</span></span></td></tr></div>';
}
}
//Display browsed files on the screen to the user who wants to upload them
$("#add_files").append(vpb_added_files_displayer);
$("#added_class").val(new_classc);
}
}
//File Reader
vpb_multiple_file_uploader.prototype.vpb_read_file = function(vpb_e) {
if (vpb_e.target.files) {
self.vpb_show_added_files(vpb_e.target.files);
self.vpb_browsed_files.push(vpb_e.target.files);
} else {
alert('Sorry, a file you have specified could not be read at the moment. Thank You!');
}
}
function addEvent(type, el, fn) {
if (window.addEventListener) {
el.addEventListener(type, fn, false);
} else if (window.attachEvent) {
var f = function() {
fn.call(el, window.event);
};
el.attachEvent('on' + type, f)
}
}
//Get the ids of all added files and also start the upload when called
vpb_multiple_file_uploader.prototype.vpb_starter = function() {
if (window.File && window.FileReader && window.FileList && window.Blob) {
var vpb_browsed_file_ids = $("#" + this.vpb_settings.vpb_form_id).find("input[type='file']").eq(0).attr("id");
document.getElementById(vpb_browsed_file_ids).addEventListener("change", this.vpb_read_file, false);
document.getElementById(this.vpb_settings.vpb_form_id).addEventListener("submit", this.vpb_submit_added_files, true);
} else {
alert(vpb_msg);
}
}
//Call the uploading function when click on the upload button
vpb_multiple_file_uploader.prototype.vpb_submit_added_files = function() {
self.vpb_upload_bgin();
}
//Start uploads
vpb_multiple_file_uploader.prototype.vpb_upload_bgin = function() {
if (this.vpb_browsed_files.length > 0) {
for (var k = 0; k < this.vpb_browsed_files.length; k++) {
var file = this.vpb_browsed_files[k];
this.vasPLUS(file, 0);
}
} else {
// Else Zweig ergänzt A. Schwarz. Wenn keine Dateien zum hochladen sind, dann Insert mit den Daten machen
this.vasINSERT();
}
}
//Main file uploader
// A. Schwarz: Insert mit File
vpb_multiple_file_uploader.prototype.vasPLUS = function(file, file_counter) {
if (typeof file[file_counter] != undefined && file[file_counter] != '') {
//Use the file names without their extensions as their ids
var files_name_without_extensions = file[file_counter].name.substr(0, file[file_counter].name.lastIndexOf('.')) || file[file_counter].name;
var ids = files_name_without_extensions.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
var vpb_browsed_file_ids = $("#" + this.vpb_settings.vpb_form_id).find("input[type='file']").eq(0).attr("id");
var removed_file = $("#" + ids).val();
if (removed_file != "" && removed_file != undefined && removed_file == ids) {
self.vasPLUS(file, file_counter + 1);
} else {
var dataString = new FormData();
dataString.append('upload_file', file[file_counter]);
dataString.append('upload_file_ids', ids);
var titel = document.getElementById("titel").value;
var liednr = document.getElementById("liednr").value;
var verlag = document.getElementById("verlag").value;
var anz_lizenzen = document.getElementById("anz_lizenzen").value;
var chk_streamlizenz = document.getElementById("streamlizenz");
// jndid beim Bearbeiten von Noten
var jndid_edit = document.getElementById("jndid").value;
if (chk_streamlizenz.checked == true) {
var streamlizenz = 1;
} else {
var streamlizenz = 0;
}
dataString.append('titel', titel);
dataString.append('liednr', liednr);
dataString.append('verlag', verlag);
dataString.append('anz_lizenzen', anz_lizenzen);
dataString.append('streamlizenz', streamlizenz);
dataString.append('jndid_edit', jndid_edit);
dataString.append('function', 'save_with_files');
$.ajax({
type: "POST",
url: this.vpb_settings.vpb_server_url,
data: dataString,
cache: false,
contentType: false,
processData: false,
beforeSend: function() {
$("#uploading_" + ids).html('<div align="left"><img src="../media/file_upload_images/loadings.gif" width="80" align="absmiddle" title="Upload...."/></div>');
$("#remove" + ids).html('<div align="center" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:blue;">Uploading...</div>');
},
success: function(response) {
var a = response.split('|***|');
// Länge der Zeit berechnen, wie lange die Messagebox angezeigt wird. Jedes File wird zumindest optisch einzeln hochgeladen.
var waitempty_chk = ($('[id^=add_fileID]').length*2000)+3000;
if(waitempty_chk >5000 ){
var waitempty = waitempty_chk;
}else{
// Mindestens aber 5 Sekunden
var waitempty = 5000;
}
setTimeout(function() {
// document.getElementById("titel").value = "";
// document.getElementById("verlag").value = "";
// document.getElementById("anz_lizenzen").value = "";
// document.getElementById("vasplus_multiple_files").value = "";
// document.getElementById("streamlizenz").checked = false;
// var $el = $('#vasplus_multiple_files');
// $el.wrap('<form>').closest('form').get(0).reset();
// $el.unwrap();
//
// $("#add_files > tbody").empty();
// Alternativlösung. Felder leeren alleine bringt nichts. Wenn man eine File hochlädt und das nächste Mal ohne File, dann werden die letzten Files nochmals hochgeladen.
// Daher eine Weiterleitung auf sich selbst, damit der Prozess neu initiiert wird.
window.location = "";
}, waitempty);
$('#msg').show().delay(waitempty).fadeOut(500);
$('#msg').html(a[0]);
var responseid = a[2];
setTimeout(function() {
var response_brought = responseid.indexOf(ids);
if (response_brought != -1) {
$("#uploading_" + ids).html('<div align="left" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:blue;">Vollst&auml;ndig</div>');
$("#remove" + ids).html('<div align="center" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:gray;">Hochgeladen</div>');
} else {
var fileType_response_brought = responseid.indexOf('file_type_error');
if (fileType_response_brought != -1) {
var filenamewithoutextension = responseid.replace('file_type_error&', '').substr(0, responseid.replace('file_type_error&', '').lastIndexOf('.')) || responseid.replace('file_type_error&', '');
var fileID = filenamewithoutextension.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
$("#uploading_" + fileID).html('<div align="left" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:red;">Invalid File</div>');
$("#remove" + fileID).html('<div align="center" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:orange;">Abgebrochen</div>');
} else {
var filesize_response_brought = responseid.indexOf('file_size_error');
if (filesize_response_brought != -1) {
var filenamewithoutextensions = responseid.replace('file_size_error&', '').substr(0, responseid.replace('file_size_error&', '').lastIndexOf('.')) || responseid.replace('file_size_error&', '');
var fileID = filenamewithoutextensions.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
$("#uploading_" + fileID).html('<div align="left" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:red;">Exceeded Size</div>');
$("#remove" + fileID).html('<div align="center" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:orange;">Abgebrochen</div>');
} else {
var general_response_brought = responseid.indexOf('general_system_error');
if (general_response_brought != -1) {
alert('Sorry, the file was not uploaded...');
} else {
/* Do nothing */ }
}
}
}
if (file_counter + 1 < file.length) {
self.vasPLUS(file, file_counter + 1);
} else {}
}, 2000);
}
});
}
} else {
alert('Sorry, this system could not verify the identity of the file you were trying to upload at the moment. Thank You!');
}
}
// By A. Schwarz: Insert ohne File
vpb_multiple_file_uploader.prototype.vasINSERT = function() {
var titel = document.getElementById("titel").value;
var liednr = document.getElementById("liednr").value;
var verlag = document.getElementById("verlag").value;
var anz_lizenzen = document.getElementById("anz_lizenzen").value;
var chk_streamlizenz = document.getElementById("streamlizenz");
// jndid beim Bearbeiten von Noten
var jndid_edit = document.getElementById("jndid").value;
if (chk_streamlizenz.checked == true) {
var streamlizenz = 1;
} else {
var streamlizenz = 0;
}
$.ajax({
type: 'POST',
url: this.vpb_settings.vpb_server_url,
data: {
'function': 'save_without_files',
'titel': titel,
'liednr': liednr,
'verlag': verlag,
'anz_lizenzen': anz_lizenzen,
'streamlizenz': streamlizenz,
'jndid_edit': jndid_edit
},
success: function(response) { //we got the response
if (response != '') {
var a = response.split('|***|');
if (a[1] == "success") {
//document.getElementById("titel").value = "";
//document.getElementById("verlag").value = "";
//document.getElementById("anz_lizenzen").value = "";
//document.getElementById("vasplus_multiple_files").value = "";
//document.getElementById("streamlizenz").checked = false;
if(jndid_edit == '-1'){
setTimeout(function() {
window.location = "";
}, 2000);
}
}
$('#msg').show().delay(2000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
this.vpb_starter();
}
function vpb_remove_this_file(id, filename) {
if (confirm('If you are sure to remove the file: ' + filename + ' then click on OK otherwise, Cancel it.')) {
$("#vpb_removed_files").append('<input type="hidden" id="' + id + '" value="' + id + '">');
$("#add_fileID" + id).slideUp();
}
return false;
}
function delNotenFile(id) {
r = confirm('Dokument löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenupload.php',
data: {
'function': 'delNotenFile',
'id': id
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
var jndid = a[2];
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(function() {
window.location = "?editjndid="+jndid;
}, 2000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
}
function delNoten(jndid) {
r = confirm('Noten löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenupload.php',
data: {
'function': 'delNoten',
'jndid': jndid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(function() {
window.location = "";
}, 2000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
}
function vpb_multiple_file_uploader(vpb_configuration_settings) {
this.vpb_settings = vpb_configuration_settings;
this.vpb_files = "";
this.vpb_browsed_files = []
var self = this;
var vpb_msg = "Sorry, your browser does not support this application. Thank You!";
//Get all browsed file extensions
function vpb_file_ext(file) {
return (/[.]/.exec(file)) ? /[^.]+$/.exec(file.toLowerCase()) : '';
}
/* Display added files which are ready for upload */
//with their file types, names, size, date last modified along with an option to remove an unwanted file
vpb_multiple_file_uploader.prototype.vpb_show_added_files = function(vpb_value) {
this.vpb_files = vpb_value;
if (this.vpb_files.length > 0) {
var vpb_added_files_displayer = vpb_file_id = "";
for (var i = 0; i < this.vpb_files.length; i++) {
//Use the names of the files without their extensions as their ids
var files_name_without_extensions = this.vpb_files[i].name.substr(0, this.vpb_files[i].name.lastIndexOf('.')) || this.vpb_files[i].name;
vpb_file_id = files_name_without_extensions.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
var vpb_file_to_add = vpb_file_ext(this.vpb_files[i].name);
var vpb_class = $("#added_class").val();
var vpb_file_icon;
//Check and display File Size
var vpb_fileSize = (this.vpb_files[i].size / 1024);
if (vpb_fileSize / 1024 > 1) {
if (((vpb_fileSize / 1024) / 1024) > 1) {
vpb_fileSize = (Math.round(((vpb_fileSize / 1024) / 1024) * 100) / 100);
var vpb_actual_fileSize = vpb_fileSize + " GB";
} else {
vpb_fileSize = (Math.round((vpb_fileSize / 1024) * 100) / 100)
var vpb_actual_fileSize = vpb_fileSize + " MB";
}
} else {
vpb_fileSize = (Math.round(vpb_fileSize * 100) / 100)
var vpb_actual_fileSize = vpb_fileSize + " KB";
}
//Check and display the date that files were last modified
var vpb_date_last_modified = new Date(this.vpb_files[i].lastModifiedDate);
var dd = vpb_date_last_modified.getDate();
var mm = vpb_date_last_modified.getMonth() + 1;
var yyyy = vpb_date_last_modified.getFullYear();
var vpb_date_last_modified_file = dd + '/' + mm + '/' + yyyy;
//File Display Classes
if (vpb_class == 'vpb_blue') {
var new_classc = 'vpb_white';
} else {
var new_classc = 'vpb_blue';
}
if (typeof this.vpb_files[i] != undefined && this.vpb_files[i].name != "") {
//Check for the type of file browsed so as to represent each file with the appropriate file icon
if (vpb_file_to_add == "jpg" || vpb_file_to_add == "JPG" || vpb_file_to_add == "jpeg" || vpb_file_to_add == "JPEG" || vpb_file_to_add == "gif" || vpb_file_to_add == "GIF" || vpb_file_to_add == "png" || vpb_file_to_add == "PNG") {
vpb_file_icon = '<img src="../media/file_upload_images/images_file.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "doc" || vpb_file_to_add == "docx" || vpb_file_to_add == "rtf" || vpb_file_to_add == "DOC" || vpb_file_to_add == "DOCX") {
vpb_file_icon = '<img src="../media/file_upload_images/doc.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "pdf" || vpb_file_to_add == "PDF") {
vpb_file_icon = '<img src="../media/file_upload_images/pdf.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "txt" || vpb_file_to_add == "TXT" || vpb_file_to_add == "RTF") {
vpb_file_icon = '<img src="../media/file_upload_images/txt.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "php") {
vpb_file_icon = '<img src="../media/file_upload_images/php.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "css") {
vpb_file_icon = '<img src="../media/file_upload_images/general.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "js") {
vpb_file_icon = '<img src="../media/file_upload_images/general.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "html" || vpb_file_to_add == "HTML" || vpb_file_to_add == "htm" || vpb_file_to_add == "HTM") {
vpb_file_icon = '<img src="../media/file_upload_images/html.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "setup") {
vpb_file_icon = '<img src="../media/file_upload_images/setup.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "video") {
vpb_file_icon = '<img src="../media/file_upload_images/video.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "real") {
vpb_file_icon = '<img src="../media/file_upload_images/real.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "psd") {
vpb_file_icon = '<img src="../media/file_upload_images/psd.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "fla") {
vpb_file_icon = '<img src="../media/file_upload_images/fla.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "xls" || vpb_file_to_add == "xlsx") {
vpb_file_icon = '<img src="../media/file_upload_images/xls.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "swf") {
vpb_file_icon = '<img src="../media/file_upload_images/swf.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "eps") {
vpb_file_icon = '<img src="../media/file_upload_images/eps.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "exe") {
vpb_file_icon = '<img src="../media/file_upload_images/exe.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "binary") {
vpb_file_icon = '<img src="../media/file_upload_images/binary.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "zip") {
vpb_file_icon = '<img src="../media/file_upload_images/archive.png" align="absmiddle" border="0" alt="" />';
} else {
vpb_file_icon = '<img src="../media/file_upload_images/general.png" align="absmiddle" border="0" alt="" />';
}
var split = this.vpb_files[i].name.split('.');
var filename = split[0];
var extension = split[1];
if (filename.length > 15) {
filename = filename.substring(0, 10) + '[...]';
}
var result = filename + '.' + extension;
//Assign browsed files to a variable so as to later display them below
vpb_added_files_displayer += '<tr id="add_fileID' + vpb_file_id + '" class="' + new_classc + '"><td><div align="left"><span style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:gray;">' + vpb_file_icon + '&nbsp;' + result + '</span></div></td><td><span id="uploading_' + vpb_file_id + '"><span style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:gray;">Uploadbereit</span></span></td><td><div align="right"><span style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:gray;">' + vpb_actual_fileSize + '</span></div></td><td><span id="remove' + vpb_file_id + '"><span class="vpb_files_remove_left_inner" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;" onclick="vpb_remove_this_file(\'' + vpb_file_id + '\',\'' + this.vpb_files[i].name + '\');">Entfernen</span></span></td></tr></div>';
}
}
//Display browsed files on the screen to the user who wants to upload them
$("#add_files").append(vpb_added_files_displayer);
$("#added_class").val(new_classc);
}
}
//File Reader
vpb_multiple_file_uploader.prototype.vpb_read_file = function(vpb_e) {
if (vpb_e.target.files) {
self.vpb_show_added_files(vpb_e.target.files);
self.vpb_browsed_files.push(vpb_e.target.files);
} else {
alert('Sorry, a file you have specified could not be read at the moment. Thank You!');
}
}
function addEvent(type, el, fn) {
if (window.addEventListener) {
el.addEventListener(type, fn, false);
} else if (window.attachEvent) {
var f = function() {
fn.call(el, window.event);
};
el.attachEvent('on' + type, f)
}
}
//Get the ids of all added files and also start the upload when called
vpb_multiple_file_uploader.prototype.vpb_starter = function() {
if (window.File && window.FileReader && window.FileList && window.Blob) {
var vpb_browsed_file_ids = $("#" + this.vpb_settings.vpb_form_id).find("input[type='file']").eq(0).attr("id");
document.getElementById(vpb_browsed_file_ids).addEventListener("change", this.vpb_read_file, false);
document.getElementById(this.vpb_settings.vpb_form_id).addEventListener("submit", this.vpb_submit_added_files, true);
} else {
alert(vpb_msg);
}
}
//Call the uploading function when click on the upload button
vpb_multiple_file_uploader.prototype.vpb_submit_added_files = function() {
self.vpb_upload_bgin();
}
//Start uploads
vpb_multiple_file_uploader.prototype.vpb_upload_bgin = function() {
if (this.vpb_browsed_files.length > 0) {
for (var k = 0; k < this.vpb_browsed_files.length; k++) {
var file = this.vpb_browsed_files[k];
this.vasPLUS(file, 0);
}
} else {
// Else Zweig ergänzt A. Schwarz. Wenn keine Dateien zum hochladen sind, dann Insert mit den Daten machen
this.vasINSERT();
}
}
//Main file uploader
// A. Schwarz: Insert mit File
vpb_multiple_file_uploader.prototype.vasPLUS = function(file, file_counter) {
if (typeof file[file_counter] != undefined && file[file_counter] != '') {
//Use the file names without their extensions as their ids
var files_name_without_extensions = file[file_counter].name.substr(0, file[file_counter].name.lastIndexOf('.')) || file[file_counter].name;
var ids = files_name_without_extensions.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
var vpb_browsed_file_ids = $("#" + this.vpb_settings.vpb_form_id).find("input[type='file']").eq(0).attr("id");
var removed_file = $("#" + ids).val();
if (removed_file != "" && removed_file != undefined && removed_file == ids) {
self.vasPLUS(file, file_counter + 1);
} else {
var dataString = new FormData();
dataString.append('upload_file', file[file_counter]);
dataString.append('upload_file_ids', ids);
var titel = document.getElementById("titel").value;
var liednr = document.getElementById("liednr").value;
var verlag = document.getElementById("verlag").value;
var anz_lizenzen = document.getElementById("anz_lizenzen").value;
var chk_streamlizenz = document.getElementById("streamlizenz");
// jndid beim Bearbeiten von Noten
var jndid_edit = document.getElementById("jndid").value;
if (chk_streamlizenz.checked == true) {
var streamlizenz = 1;
} else {
var streamlizenz = 0;
}
dataString.append('titel', titel);
dataString.append('liednr', liednr);
dataString.append('verlag', verlag);
dataString.append('anz_lizenzen', anz_lizenzen);
dataString.append('streamlizenz', streamlizenz);
dataString.append('jndid_edit', jndid_edit);
dataString.append('function', 'save_with_files');
$.ajax({
type: "POST",
url: this.vpb_settings.vpb_server_url,
data: dataString,
cache: false,
contentType: false,
processData: false,
beforeSend: function() {
$("#uploading_" + ids).html('<div align="left"><img src="../media/file_upload_images/loadings.gif" width="80" align="absmiddle" title="Upload...."/></div>');
$("#remove" + ids).html('<div align="center" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:blue;">Uploading...</div>');
},
success: function(response) {
var a = response.split('|***|');
// Länge der Zeit berechnen, wie lange die Messagebox angezeigt wird. Jedes File wird zumindest optisch einzeln hochgeladen.
var waitempty_chk = ($('[id^=add_fileID]').length*2000)+3000;
if(waitempty_chk >5000 ){
var waitempty = waitempty_chk;
}else{
// Mindestens aber 5 Sekunden
var waitempty = 5000;
}
setTimeout(function() {
// document.getElementById("titel").value = "";
// document.getElementById("verlag").value = "";
// document.getElementById("anz_lizenzen").value = "";
// document.getElementById("vasplus_multiple_files").value = "";
// document.getElementById("streamlizenz").checked = false;
// var $el = $('#vasplus_multiple_files');
// $el.wrap('<form>').closest('form').get(0).reset();
// $el.unwrap();
//
// $("#add_files > tbody").empty();
// Alternativlösung. Felder leeren alleine bringt nichts. Wenn man eine File hochlädt und das nächste Mal ohne File, dann werden die letzten Files nochmals hochgeladen.
// Daher eine Weiterleitung auf sich selbst, damit der Prozess neu initiiert wird.
window.location = "";
}, waitempty);
$('#msg').show().delay(waitempty).fadeOut(500);
$('#msg').html(a[0]);
var responseid = a[2];
setTimeout(function() {
var response_brought = responseid.indexOf(ids);
if (response_brought != -1) {
$("#uploading_" + ids).html('<div align="left" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:blue;">Vollst&auml;ndig</div>');
$("#remove" + ids).html('<div align="center" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:gray;">Hochgeladen</div>');
} else {
var fileType_response_brought = responseid.indexOf('file_type_error');
if (fileType_response_brought != -1) {
var filenamewithoutextension = responseid.replace('file_type_error&', '').substr(0, responseid.replace('file_type_error&', '').lastIndexOf('.')) || responseid.replace('file_type_error&', '');
var fileID = filenamewithoutextension.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
$("#uploading_" + fileID).html('<div align="left" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:red;">Invalid File</div>');
$("#remove" + fileID).html('<div align="center" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:orange;">Abgebrochen</div>');
} else {
var filesize_response_brought = responseid.indexOf('file_size_error');
if (filesize_response_brought != -1) {
var filenamewithoutextensions = responseid.replace('file_size_error&', '').substr(0, responseid.replace('file_size_error&', '').lastIndexOf('.')) || responseid.replace('file_size_error&', '');
var fileID = filenamewithoutextensions.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
$("#uploading_" + fileID).html('<div align="left" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:red;">Exceeded Size</div>');
$("#remove" + fileID).html('<div align="center" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:orange;">Abgebrochen</div>');
} else {
var general_response_brought = responseid.indexOf('general_system_error');
if (general_response_brought != -1) {
alert('Sorry, the file was not uploaded...');
} else {
/* Do nothing */ }
}
}
}
if (file_counter + 1 < file.length) {
self.vasPLUS(file, file_counter + 1);
} else {}
}, 2000);
}
});
}
} else {
alert('Sorry, this system could not verify the identity of the file you were trying to upload at the moment. Thank You!');
}
}
// By A. Schwarz: Insert ohne File
vpb_multiple_file_uploader.prototype.vasINSERT = function() {
var titel = document.getElementById("titel").value;
var liednr = document.getElementById("liednr").value;
var verlag = document.getElementById("verlag").value;
var anz_lizenzen = document.getElementById("anz_lizenzen").value;
var chk_streamlizenz = document.getElementById("streamlizenz");
// jndid beim Bearbeiten von Noten
var jndid_edit = document.getElementById("jndid").value;
if (chk_streamlizenz.checked == true) {
var streamlizenz = 1;
} else {
var streamlizenz = 0;
}
$.ajax({
type: 'POST',
url: this.vpb_settings.vpb_server_url,
data: {
'function': 'save_without_files',
'titel': titel,
'liednr': liednr,
'verlag': verlag,
'anz_lizenzen': anz_lizenzen,
'streamlizenz': streamlizenz,
'jndid_edit': jndid_edit
},
success: function(response) { //we got the response
if (response != '') {
var a = response.split('|***|');
if (a[1] == "success") {
//document.getElementById("titel").value = "";
//document.getElementById("verlag").value = "";
//document.getElementById("anz_lizenzen").value = "";
//document.getElementById("vasplus_multiple_files").value = "";
//document.getElementById("streamlizenz").checked = false;
if(jndid_edit == '-1'){
setTimeout(function() {
window.location = "";
}, 2000);
}
}
$('#msg').show().delay(2000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
this.vpb_starter();
}
function vpb_remove_this_file(id, filename) {
if (confirm('If you are sure to remove the file: ' + filename + ' then click on OK otherwise, Cancel it.')) {
$("#vpb_removed_files").append('<input type="hidden" id="' + id + '" value="' + id + '">');
$("#add_fileID" + id).slideUp();
}
return false;
}
function delNotenFile(id) {
r = confirm('Dokument löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenupload.php',
data: {
'function': 'delNotenFile',
'id': id
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
var jndid = a[2];
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(function() {
window.location = "?editjndid="+jndid;
}, 2000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
}
function delNoten(jndid) {
r = confirm('Noten löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_notenupload.php',
data: {
'function': 'delNoten',
'jndid': jndid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(function() {
window.location = "";
}, 2000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
}

View File

@ -1,433 +1,433 @@
function vpb_multiple_file_uploader(vpb_configuration_settings) {
this.vpb_settings = vpb_configuration_settings;
this.vpb_files = "";
this.vpb_browsed_files = []
var self = this;
var vpb_msg = "Sorry, your browser does not support this application. Thank You!";
//Get all browsed file extensions
function vpb_file_ext(file) {
return (/[.]/.exec(file)) ? /[^.]+$/.exec(file.toLowerCase()) : '';
}
/* Display added files which are ready for upload */
//with their file types, names, size, date last modified along with an option to remove an unwanted file
vpb_multiple_file_uploader.prototype.vpb_show_added_files = function(vpb_value) {
this.vpb_files = vpb_value;
if (this.vpb_files.length > 0) {
var vpb_added_files_displayer = vpb_file_id = "";
for (var i = 0; i < this.vpb_files.length; i++) {
//Use the names of the files without their extensions as their ids
var files_name_without_extensions = this.vpb_files[i].name.substr(0, this.vpb_files[i].name.lastIndexOf('.')) || this.vpb_files[i].name;
vpb_file_id = files_name_without_extensions.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
var vpb_file_to_add = vpb_file_ext(this.vpb_files[i].name);
var vpb_class = $("#added_class").val();
var vpb_file_icon;
//Check and display File Size
var vpb_fileSize = (this.vpb_files[i].size / 1024);
if (vpb_fileSize / 1024 > 1) {
if (((vpb_fileSize / 1024) / 1024) > 1) {
vpb_fileSize = (Math.round(((vpb_fileSize / 1024) / 1024) * 100) / 100);
var vpb_actual_fileSize = vpb_fileSize + " GB";
} else {
vpb_fileSize = (Math.round((vpb_fileSize / 1024) * 100) / 100)
var vpb_actual_fileSize = vpb_fileSize + " MB";
}
} else {
vpb_fileSize = (Math.round(vpb_fileSize * 100) / 100)
var vpb_actual_fileSize = vpb_fileSize + " KB";
}
//Check and display the date that files were last modified
var vpb_date_last_modified = new Date(this.vpb_files[i].lastModifiedDate);
var dd = vpb_date_last_modified.getDate();
var mm = vpb_date_last_modified.getMonth() + 1;
var yyyy = vpb_date_last_modified.getFullYear();
var vpb_date_last_modified_file = dd + '/' + mm + '/' + yyyy;
//File Display Classes
if (vpb_class == 'vpb_blue') {
var new_classc = 'vpb_white';
} else {
var new_classc = 'vpb_blue';
}
if (typeof this.vpb_files[i] != undefined && this.vpb_files[i].name != "") {
//Check for the type of file browsed so as to represent each file with the appropriate file icon
if (vpb_file_to_add == "jpg" || vpb_file_to_add == "JPG" || vpb_file_to_add == "jpeg" || vpb_file_to_add == "JPEG" || vpb_file_to_add == "gif" || vpb_file_to_add == "GIF" || vpb_file_to_add == "png" || vpb_file_to_add == "PNG") {
vpb_file_icon = '<img src="../media/file_upload_images/images_file.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "doc" || vpb_file_to_add == "docx" || vpb_file_to_add == "rtf" || vpb_file_to_add == "DOC" || vpb_file_to_add == "DOCX") {
vpb_file_icon = '<img src="../media/file_upload_images/doc.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "pdf" || vpb_file_to_add == "PDF") {
vpb_file_icon = '<img src="../media/file_upload_images/pdf.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "txt" || vpb_file_to_add == "TXT" || vpb_file_to_add == "RTF") {
vpb_file_icon = '<img src="../media/file_upload_images/txt.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "php") {
vpb_file_icon = '<img src="../media/file_upload_images/php.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "css") {
vpb_file_icon = '<img src="../media/file_upload_images/general.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "js") {
vpb_file_icon = '<img src="../media/file_upload_images/general.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "html" || vpb_file_to_add == "HTML" || vpb_file_to_add == "htm" || vpb_file_to_add == "HTM") {
vpb_file_icon = '<img src="../media/file_upload_images/html.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "setup") {
vpb_file_icon = '<img src="../media/file_upload_images/setup.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "video") {
vpb_file_icon = '<img src="../media/file_upload_images/video.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "real") {
vpb_file_icon = '<img src="../media/file_upload_images/real.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "psd") {
vpb_file_icon = '<img src="../media/file_upload_images/psd.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "fla") {
vpb_file_icon = '<img src="../media/file_upload_images/fla.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "xls" || vpb_file_to_add == "xlsx") {
vpb_file_icon = '<img src="../media/file_upload_images/xls.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "swf") {
vpb_file_icon = '<img src="../media/file_upload_images/swf.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "eps") {
vpb_file_icon = '<img src="../media/file_upload_images/eps.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "exe") {
vpb_file_icon = '<img src="../media/file_upload_images/exe.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "binary") {
vpb_file_icon = '<img src="../media/file_upload_images/binary.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "zip") {
vpb_file_icon = '<img src="../media/file_upload_images/archive.png" align="absmiddle" border="0" alt="" />';
} else {
vpb_file_icon = '<img src="../media/file_upload_images/general.png" align="absmiddle" border="0" alt="" />';
}
var split = this.vpb_files[i].name.split('.');
var filename = split[0];
var extension = split[1];
if (filename.length > 15) {
filename = filename.substring(0, 10) + '[...]';
}
var result = filename + '.' + extension;
//Assign browsed files to a variable so as to later display them below
vpb_added_files_displayer += '<tr id="add_fileID' + vpb_file_id + '" class="' + new_classc + '"><td><div align="left"><span style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:gray;">' + vpb_file_icon + '&nbsp;' + result + '</span></div></td><td><span id="uploading_' + vpb_file_id + '"><span style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:gray;">Uploadbereit</span></span></td><td><div align="right"><span style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:gray;">' + vpb_actual_fileSize + '</span></div></td><td><span id="remove' + vpb_file_id + '"><span class="vpb_files_remove_left_inner" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;" onclick="vpb_remove_this_file(\'' + vpb_file_id + '\',\'' + this.vpb_files[i].name + '\');">Entfernen</span></span></td></tr></div>';
}
}
//Display browsed files on the screen to the user who wants to upload them
$("#add_files").append(vpb_added_files_displayer);
$("#added_class").val(new_classc);
}
}
//File Reader
vpb_multiple_file_uploader.prototype.vpb_read_file = function(vpb_e) {
if (vpb_e.target.files) {
self.vpb_show_added_files(vpb_e.target.files);
self.vpb_browsed_files.push(vpb_e.target.files);
} else {
alert('Sorry, a file you have specified could not be read at the moment. Thank You!');
}
}
function addEvent(type, el, fn) {
if (window.addEventListener) {
el.addEventListener(type, fn, false);
} else if (window.attachEvent) {
var f = function() {
fn.call(el, window.event);
};
el.attachEvent('on' + type, f)
}
}
//Get the ids of all added files and also start the upload when called
vpb_multiple_file_uploader.prototype.vpb_starter = function() {
if (window.File && window.FileReader && window.FileList && window.Blob) {
var vpb_browsed_file_ids = $("#" + this.vpb_settings.vpb_form_id).find("input[type='file']").eq(0).attr("id");
document.getElementById(vpb_browsed_file_ids).addEventListener("change", this.vpb_read_file, false);
document.getElementById(this.vpb_settings.vpb_form_id).addEventListener("submit", this.vpb_submit_added_files, true);
} else {
alert(vpb_msg);
}
}
//Call the uploading function when click on the upload button
vpb_multiple_file_uploader.prototype.vpb_submit_added_files = function() {
self.vpb_upload_bgin();
}
//Start uploads
vpb_multiple_file_uploader.prototype.vpb_upload_bgin = function() {
if (this.vpb_browsed_files.length > 0) {
for (var k = 0; k < this.vpb_browsed_files.length; k++) {
var file = this.vpb_browsed_files[k];
this.vasPLUS(file, 0);
}
} else {
// Else Zweig ergänzt A. Schwarz. Wenn keine Dateien zum hochladen sind, dann Insert mit den Daten machen
this.vasINSERT();
}
}
//Main file uploader
// A. Schwarz: Insert mit File
vpb_multiple_file_uploader.prototype.vasPLUS = function(file, file_counter) {
if (typeof file[file_counter] != undefined && file[file_counter] != '') {
//Use the file names without their extensions as their ids
var files_name_without_extensions = file[file_counter].name.substr(0, file[file_counter].name.lastIndexOf('.')) || file[file_counter].name;
var ids = files_name_without_extensions.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
var vpb_browsed_file_ids = $("#" + this.vpb_settings.vpb_form_id).find("input[type='file']").eq(0).attr("id");
var removed_file = $("#" + ids).val();
if (removed_file != "" && removed_file != undefined && removed_file == ids) {
self.vasPLUS(file, file_counter + 1);
} else {
var dataString = new FormData();
dataString.append('upload_file', file[file_counter]);
dataString.append('upload_file_ids', ids);
var datum = document.getElementById("datum").value;
var beschreibung = document.getElementById("beschreibung").value;
var firma = document.getElementById("firma").value;
var art = $("#art").val();
var betrag = document.getElementById("betrag").value;
var bemerkung = document.getElementById("bemerkung").value;
if(art == 'A'){
betrag=betrag*(-1);
}
// fid beim Bearbeiten von Finanzen
var fid_edit = document.getElementById("fid").value;
dataString.append('datum', datum);
dataString.append('beschreibung', beschreibung);
dataString.append('firma', firma);
dataString.append('art', art);
dataString.append('betrag', betrag);
dataString.append('bemerkung', bemerkung);
dataString.append('fid_edit', fid_edit);
dataString.append('function', 'save_with_files');
$.ajax({
type: "POST",
url: this.vpb_settings.vpb_server_url,
data: dataString,
cache: false,
contentType: false,
processData: false,
beforeSend: function() {
$("#uploading_" + ids).html('<div align="left"><img src="../media/file_upload_images/loadings.gif" width="80" align="absmiddle" title="Upload...."/></div>');
$("#remove" + ids).html('<div align="center" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:blue;">Uploading...</div>');
},
success: function(response) {
var a = response.split('|***|');
// Länge der Zeit berechnen, wie lange die Messagebox angezeigt wird. Jedes File wird zumindest optisch einzeln hochgeladen.
var waitempty_chk = ($('[id^=add_fileID]').length*2000)+3000;
if(waitempty_chk >5000 ){
var waitempty = waitempty_chk;
}else{
// Mindestens aber 5 Sekunden
var waitempty = 5000;
}
setTimeout(function() {
// document.getElementById("datum").value = "";
// document.getElementById("verlag").value = "";
// document.getElementById("anz_lizenzen").value = "";
// document.getElementById("vasplus_multiple_files").value = "";
// document.getElementById("streamlizenz").checked = false;
// var $el = $('#vasplus_multiple_files');
// $el.wrap('<form>').closest('form').get(0).reset();
// $el.unwrap();
//
// $("#add_files > tbody").empty();
// Alternativlösung. Felder leeren alleine bringt nichts. Wenn man eine File hochlädt und das nächste Mal ohne File, dann werden die letzten Files nochmals hochgeladen.
// Daher eine Weiterleitung auf sich selbst, damit der Prozess neu initiiert wird.
window.location = "?";
}, waitempty);
$('#msg').show().delay(waitempty).fadeOut(500);
$('#msg').html(a[0]);
var responseid = a[2];
setTimeout(function() {
var response_brought = responseid.indexOf(ids);
if (response_brought != -1) {
$("#uploading_" + ids).html('<div align="left" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:blue;">Vollst&auml;ndig</div>');
$("#remove" + ids).html('<div align="center" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:gray;">Hochgeladen</div>');
} else {
var fileType_response_brought = responseid.indexOf('file_type_error');
if (fileType_response_brought != -1) {
var filenamewithoutextension = responseid.replace('file_type_error&', '').substr(0, responseid.replace('file_type_error&', '').lastIndexOf('.')) || responseid.replace('file_type_error&', '');
var fileID = filenamewithoutextension.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
$("#uploading_" + fileID).html('<div align="left" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:red;">Invalid File</div>');
$("#remove" + fileID).html('<div align="center" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:orange;">Abgebrochen</div>');
} else {
var filesize_response_brought = responseid.indexOf('file_size_error');
if (filesize_response_brought != -1) {
var filenamewithoutextensions = responseid.replace('file_size_error&', '').substr(0, responseid.replace('file_size_error&', '').lastIndexOf('.')) || responseid.replace('file_size_error&', '');
var fileID = filenamewithoutextensions.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
$("#uploading_" + fileID).html('<div align="left" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:red;">Exceeded Size</div>');
$("#remove" + fileID).html('<div align="center" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:orange;">Abgebrochen</div>');
} else {
var general_response_brought = responseid.indexOf('general_system_error');
if (general_response_brought != -1) {
alert('Sorry, the file was not uploaded...');
} else {
/* Do nothing */ }
}
}
}
if (file_counter + 1 < file.length) {
self.vasPLUS(file, file_counter + 1);
} else {}
}, 2000);
}
});
}
} else {
alert('Sorry, this system could not verify the identity of the file you were trying to upload at the moment. Thank You!');
}
}
// By A. Schwarz: Insert ohne File
vpb_multiple_file_uploader.prototype.vasINSERT = function() {
var datum = document.getElementById("datum").value;
var beschreibung = document.getElementById("beschreibung").value;
var firma = document.getElementById("firma").value;
var art = $("#art").val();
var betrag = document.getElementById("betrag").value;
var bemerkung = document.getElementById("bemerkung").value;
if(art == 'A'){
betrag=betrag*(-1);
}
// fid beim Bearbeiten von Finanzen
var fid_edit = document.getElementById("fid").value;
$.ajax({
type: 'POST',
url: this.vpb_settings.vpb_server_url,
data: {
'function': 'save_without_files',
'datum': datum,
'beschreibung': beschreibung,
'firma': firma,
'art': art,
'betrag': betrag,
'bemerkung': bemerkung,
'fid_edit': fid_edit
},
success: function(response) { //we got the response
if (response != '') {
var a = response.split('|***|');
if (a[1] == "success") {
//document.getElementById("datum").value = "";
//document.getElementById("verlag").value = "";
//document.getElementById("anz_lizenzen").value = "";
//document.getElementById("vasplus_multiple_files").value = "";
//document.getElementById("streamlizenz").checked = false;
//if(fid_edit == '-1'){
setTimeout(function() {
window.location = "?";
}, 2000);
//}
}
$('#msg').show().delay(2000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
this.vpb_starter();
}
function vpb_remove_this_file(id, filename) {
if (confirm('If you are sure to remove the file: ' + filename + ' then click on OK otherwise, Cancel it.')) {
$("#vpb_removed_files").append('<input type="hidden" id="' + id + '" value="' + id + '">');
$("#add_fileID" + id).slideUp();
}
return false;
}
function delBelegFile(id) {
r = confirm('Dokument löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_finanzen.php',
data: {
'function': 'delBelegFile',
'id': id
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
var fid = a[2];
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(function() {
window.location = "?editfid="+fid;
}, 2000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
}
function delBeleg(fid) {
r = confirm('Beleg löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_finanzen.php',
data: {
'function': 'delBeleg',
'fid': fid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(function() {
window.location = "?";
}, 2000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
}
function vpb_multiple_file_uploader(vpb_configuration_settings) {
this.vpb_settings = vpb_configuration_settings;
this.vpb_files = "";
this.vpb_browsed_files = []
var self = this;
var vpb_msg = "Sorry, your browser does not support this application. Thank You!";
//Get all browsed file extensions
function vpb_file_ext(file) {
return (/[.]/.exec(file)) ? /[^.]+$/.exec(file.toLowerCase()) : '';
}
/* Display added files which are ready for upload */
//with their file types, names, size, date last modified along with an option to remove an unwanted file
vpb_multiple_file_uploader.prototype.vpb_show_added_files = function(vpb_value) {
this.vpb_files = vpb_value;
if (this.vpb_files.length > 0) {
var vpb_added_files_displayer = vpb_file_id = "";
for (var i = 0; i < this.vpb_files.length; i++) {
//Use the names of the files without their extensions as their ids
var files_name_without_extensions = this.vpb_files[i].name.substr(0, this.vpb_files[i].name.lastIndexOf('.')) || this.vpb_files[i].name;
vpb_file_id = files_name_without_extensions.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
var vpb_file_to_add = vpb_file_ext(this.vpb_files[i].name);
var vpb_class = $("#added_class").val();
var vpb_file_icon;
//Check and display File Size
var vpb_fileSize = (this.vpb_files[i].size / 1024);
if (vpb_fileSize / 1024 > 1) {
if (((vpb_fileSize / 1024) / 1024) > 1) {
vpb_fileSize = (Math.round(((vpb_fileSize / 1024) / 1024) * 100) / 100);
var vpb_actual_fileSize = vpb_fileSize + " GB";
} else {
vpb_fileSize = (Math.round((vpb_fileSize / 1024) * 100) / 100)
var vpb_actual_fileSize = vpb_fileSize + " MB";
}
} else {
vpb_fileSize = (Math.round(vpb_fileSize * 100) / 100)
var vpb_actual_fileSize = vpb_fileSize + " KB";
}
//Check and display the date that files were last modified
var vpb_date_last_modified = new Date(this.vpb_files[i].lastModifiedDate);
var dd = vpb_date_last_modified.getDate();
var mm = vpb_date_last_modified.getMonth() + 1;
var yyyy = vpb_date_last_modified.getFullYear();
var vpb_date_last_modified_file = dd + '/' + mm + '/' + yyyy;
//File Display Classes
if (vpb_class == 'vpb_blue') {
var new_classc = 'vpb_white';
} else {
var new_classc = 'vpb_blue';
}
if (typeof this.vpb_files[i] != undefined && this.vpb_files[i].name != "") {
//Check for the type of file browsed so as to represent each file with the appropriate file icon
if (vpb_file_to_add == "jpg" || vpb_file_to_add == "JPG" || vpb_file_to_add == "jpeg" || vpb_file_to_add == "JPEG" || vpb_file_to_add == "gif" || vpb_file_to_add == "GIF" || vpb_file_to_add == "png" || vpb_file_to_add == "PNG") {
vpb_file_icon = '<img src="../media/file_upload_images/images_file.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "doc" || vpb_file_to_add == "docx" || vpb_file_to_add == "rtf" || vpb_file_to_add == "DOC" || vpb_file_to_add == "DOCX") {
vpb_file_icon = '<img src="../media/file_upload_images/doc.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "pdf" || vpb_file_to_add == "PDF") {
vpb_file_icon = '<img src="../media/file_upload_images/pdf.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "txt" || vpb_file_to_add == "TXT" || vpb_file_to_add == "RTF") {
vpb_file_icon = '<img src="../media/file_upload_images/txt.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "php") {
vpb_file_icon = '<img src="../media/file_upload_images/php.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "css") {
vpb_file_icon = '<img src="../media/file_upload_images/general.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "js") {
vpb_file_icon = '<img src="../media/file_upload_images/general.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "html" || vpb_file_to_add == "HTML" || vpb_file_to_add == "htm" || vpb_file_to_add == "HTM") {
vpb_file_icon = '<img src="../media/file_upload_images/html.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "setup") {
vpb_file_icon = '<img src="../media/file_upload_images/setup.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "video") {
vpb_file_icon = '<img src="../media/file_upload_images/video.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "real") {
vpb_file_icon = '<img src="../media/file_upload_images/real.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "psd") {
vpb_file_icon = '<img src="../media/file_upload_images/psd.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "fla") {
vpb_file_icon = '<img src="../media/file_upload_images/fla.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "xls" || vpb_file_to_add == "xlsx") {
vpb_file_icon = '<img src="../media/file_upload_images/xls.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "swf") {
vpb_file_icon = '<img src="../media/file_upload_images/swf.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "eps") {
vpb_file_icon = '<img src="../media/file_upload_images/eps.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "exe") {
vpb_file_icon = '<img src="../media/file_upload_images/exe.gif" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "binary") {
vpb_file_icon = '<img src="../media/file_upload_images/binary.png" align="absmiddle" border="0" alt="" />';
} else if (vpb_file_to_add == "zip") {
vpb_file_icon = '<img src="../media/file_upload_images/archive.png" align="absmiddle" border="0" alt="" />';
} else {
vpb_file_icon = '<img src="../media/file_upload_images/general.png" align="absmiddle" border="0" alt="" />';
}
var split = this.vpb_files[i].name.split('.');
var filename = split[0];
var extension = split[1];
if (filename.length > 15) {
filename = filename.substring(0, 10) + '[...]';
}
var result = filename + '.' + extension;
//Assign browsed files to a variable so as to later display them below
vpb_added_files_displayer += '<tr id="add_fileID' + vpb_file_id + '" class="' + new_classc + '"><td><div align="left"><span style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:gray;">' + vpb_file_icon + '&nbsp;' + result + '</span></div></td><td><span id="uploading_' + vpb_file_id + '"><span style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:gray;">Uploadbereit</span></span></td><td><div align="right"><span style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:gray;">' + vpb_actual_fileSize + '</span></div></td><td><span id="remove' + vpb_file_id + '"><span class="vpb_files_remove_left_inner" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;" onclick="vpb_remove_this_file(\'' + vpb_file_id + '\',\'' + this.vpb_files[i].name + '\');">Entfernen</span></span></td></tr></div>';
}
}
//Display browsed files on the screen to the user who wants to upload them
$("#add_files").append(vpb_added_files_displayer);
$("#added_class").val(new_classc);
}
}
//File Reader
vpb_multiple_file_uploader.prototype.vpb_read_file = function(vpb_e) {
if (vpb_e.target.files) {
self.vpb_show_added_files(vpb_e.target.files);
self.vpb_browsed_files.push(vpb_e.target.files);
} else {
alert('Sorry, a file you have specified could not be read at the moment. Thank You!');
}
}
function addEvent(type, el, fn) {
if (window.addEventListener) {
el.addEventListener(type, fn, false);
} else if (window.attachEvent) {
var f = function() {
fn.call(el, window.event);
};
el.attachEvent('on' + type, f)
}
}
//Get the ids of all added files and also start the upload when called
vpb_multiple_file_uploader.prototype.vpb_starter = function() {
if (window.File && window.FileReader && window.FileList && window.Blob) {
var vpb_browsed_file_ids = $("#" + this.vpb_settings.vpb_form_id).find("input[type='file']").eq(0).attr("id");
document.getElementById(vpb_browsed_file_ids).addEventListener("change", this.vpb_read_file, false);
document.getElementById(this.vpb_settings.vpb_form_id).addEventListener("submit", this.vpb_submit_added_files, true);
} else {
alert(vpb_msg);
}
}
//Call the uploading function when click on the upload button
vpb_multiple_file_uploader.prototype.vpb_submit_added_files = function() {
self.vpb_upload_bgin();
}
//Start uploads
vpb_multiple_file_uploader.prototype.vpb_upload_bgin = function() {
if (this.vpb_browsed_files.length > 0) {
for (var k = 0; k < this.vpb_browsed_files.length; k++) {
var file = this.vpb_browsed_files[k];
this.vasPLUS(file, 0);
}
} else {
// Else Zweig ergänzt A. Schwarz. Wenn keine Dateien zum hochladen sind, dann Insert mit den Daten machen
this.vasINSERT();
}
}
//Main file uploader
// A. Schwarz: Insert mit File
vpb_multiple_file_uploader.prototype.vasPLUS = function(file, file_counter) {
if (typeof file[file_counter] != undefined && file[file_counter] != '') {
//Use the file names without their extensions as their ids
var files_name_without_extensions = file[file_counter].name.substr(0, file[file_counter].name.lastIndexOf('.')) || file[file_counter].name;
var ids = files_name_without_extensions.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
var vpb_browsed_file_ids = $("#" + this.vpb_settings.vpb_form_id).find("input[type='file']").eq(0).attr("id");
var removed_file = $("#" + ids).val();
if (removed_file != "" && removed_file != undefined && removed_file == ids) {
self.vasPLUS(file, file_counter + 1);
} else {
var dataString = new FormData();
dataString.append('upload_file', file[file_counter]);
dataString.append('upload_file_ids', ids);
var datum = document.getElementById("datum").value;
var beschreibung = document.getElementById("beschreibung").value;
var firma = document.getElementById("firma").value;
var art = $("#art").val();
var betrag = document.getElementById("betrag").value;
var bemerkung = document.getElementById("bemerkung").value;
if(art == 'A'){
betrag=betrag*(-1);
}
// fid beim Bearbeiten von Finanzen
var fid_edit = document.getElementById("fid").value;
dataString.append('datum', datum);
dataString.append('beschreibung', beschreibung);
dataString.append('firma', firma);
dataString.append('art', art);
dataString.append('betrag', betrag);
dataString.append('bemerkung', bemerkung);
dataString.append('fid_edit', fid_edit);
dataString.append('function', 'save_with_files');
$.ajax({
type: "POST",
url: this.vpb_settings.vpb_server_url,
data: dataString,
cache: false,
contentType: false,
processData: false,
beforeSend: function() {
$("#uploading_" + ids).html('<div align="left"><img src="../media/file_upload_images/loadings.gif" width="80" align="absmiddle" title="Upload...."/></div>');
$("#remove" + ids).html('<div align="center" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:blue;">Uploading...</div>');
},
success: function(response) {
var a = response.split('|***|');
// Länge der Zeit berechnen, wie lange die Messagebox angezeigt wird. Jedes File wird zumindest optisch einzeln hochgeladen.
var waitempty_chk = ($('[id^=add_fileID]').length*2000)+3000;
if(waitempty_chk >5000 ){
var waitempty = waitempty_chk;
}else{
// Mindestens aber 5 Sekunden
var waitempty = 5000;
}
setTimeout(function() {
// document.getElementById("datum").value = "";
// document.getElementById("verlag").value = "";
// document.getElementById("anz_lizenzen").value = "";
// document.getElementById("vasplus_multiple_files").value = "";
// document.getElementById("streamlizenz").checked = false;
// var $el = $('#vasplus_multiple_files');
// $el.wrap('<form>').closest('form').get(0).reset();
// $el.unwrap();
//
// $("#add_files > tbody").empty();
// Alternativlösung. Felder leeren alleine bringt nichts. Wenn man eine File hochlädt und das nächste Mal ohne File, dann werden die letzten Files nochmals hochgeladen.
// Daher eine Weiterleitung auf sich selbst, damit der Prozess neu initiiert wird.
window.location = "?";
}, waitempty);
$('#msg').show().delay(waitempty).fadeOut(500);
$('#msg').html(a[0]);
var responseid = a[2];
setTimeout(function() {
var response_brought = responseid.indexOf(ids);
if (response_brought != -1) {
$("#uploading_" + ids).html('<div align="left" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:blue;">Vollst&auml;ndig</div>');
$("#remove" + ids).html('<div align="center" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:gray;">Hochgeladen</div>');
} else {
var fileType_response_brought = responseid.indexOf('file_type_error');
if (fileType_response_brought != -1) {
var filenamewithoutextension = responseid.replace('file_type_error&', '').substr(0, responseid.replace('file_type_error&', '').lastIndexOf('.')) || responseid.replace('file_type_error&', '');
var fileID = filenamewithoutextension.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
$("#uploading_" + fileID).html('<div align="left" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:red;">Invalid File</div>');
$("#remove" + fileID).html('<div align="center" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:orange;">Abgebrochen</div>');
} else {
var filesize_response_brought = responseid.indexOf('file_size_error');
if (filesize_response_brought != -1) {
var filenamewithoutextensions = responseid.replace('file_size_error&', '').substr(0, responseid.replace('file_size_error&', '').lastIndexOf('.')) || responseid.replace('file_size_error&', '');
var fileID = filenamewithoutextensions.replace(/[^a-z0-9\s]/gi, '').replace(/[_\s]/g, '');
$("#uploading_" + fileID).html('<div align="left" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:red;">Exceeded Size</div>');
$("#remove" + fileID).html('<div align="center" style="font-family:Verdana, Geneva, sans-serif;font-size:11px;color:orange;">Abgebrochen</div>');
} else {
var general_response_brought = responseid.indexOf('general_system_error');
if (general_response_brought != -1) {
alert('Sorry, the file was not uploaded...');
} else {
/* Do nothing */ }
}
}
}
if (file_counter + 1 < file.length) {
self.vasPLUS(file, file_counter + 1);
} else {}
}, 2000);
}
});
}
} else {
alert('Sorry, this system could not verify the identity of the file you were trying to upload at the moment. Thank You!');
}
}
// By A. Schwarz: Insert ohne File
vpb_multiple_file_uploader.prototype.vasINSERT = function() {
var datum = document.getElementById("datum").value;
var beschreibung = document.getElementById("beschreibung").value;
var firma = document.getElementById("firma").value;
var art = $("#art").val();
var betrag = document.getElementById("betrag").value;
var bemerkung = document.getElementById("bemerkung").value;
if(art == 'A'){
betrag=betrag*(-1);
}
// fid beim Bearbeiten von Finanzen
var fid_edit = document.getElementById("fid").value;
$.ajax({
type: 'POST',
url: this.vpb_settings.vpb_server_url,
data: {
'function': 'save_without_files',
'datum': datum,
'beschreibung': beschreibung,
'firma': firma,
'art': art,
'betrag': betrag,
'bemerkung': bemerkung,
'fid_edit': fid_edit
},
success: function(response) { //we got the response
if (response != '') {
var a = response.split('|***|');
if (a[1] == "success") {
//document.getElementById("datum").value = "";
//document.getElementById("verlag").value = "";
//document.getElementById("anz_lizenzen").value = "";
//document.getElementById("vasplus_multiple_files").value = "";
//document.getElementById("streamlizenz").checked = false;
//if(fid_edit == '-1'){
setTimeout(function() {
window.location = "?";
}, 2000);
//}
}
$('#msg').show().delay(2000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
this.vpb_starter();
}
function vpb_remove_this_file(id, filename) {
if (confirm('If you are sure to remove the file: ' + filename + ' then click on OK otherwise, Cancel it.')) {
$("#vpb_removed_files").append('<input type="hidden" id="' + id + '" value="' + id + '">');
$("#add_fileID" + id).slideUp();
}
return false;
}
function delBelegFile(id) {
r = confirm('Dokument löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_finanzen.php',
data: {
'function': 'delBelegFile',
'id': id
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
var fid = a[2];
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(function() {
window.location = "?editfid="+fid;
}, 2000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
}
function delBeleg(fid) {
r = confirm('Beleg löschen?');
if (r) {
$.ajax({
type: 'POST',
url: '../controller/admin_finanzen.php',
data: {
'function': 'delBeleg',
'fid': fid
},
success: function(result) { //we got the response
if(result!=''){
var a = result.split('|***|');
if(a[1]=="success"){
$(document).ajaxStop(function(){
setTimeout(function() {
window.location = "?";
}, 2000);
});
}
$('#msg').show().delay(10000).fadeOut(500);
$('#msg').html(a[0]);
}
},
error: function(xhr, status, exception) {
console.log(xhr);
}
});
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long