Empfängerliste löschen
This commit is contained in:
parent
a38e8450af
commit
1f2a3b559b
@ -15,58 +15,16 @@ $absender = get_parameter(2);
|
|||||||
$mailpwd = get_parameter(3);
|
$mailpwd = get_parameter(3);
|
||||||
|
|
||||||
|
|
||||||
$empfaenger = $_POST['empfaenger'];
|
|
||||||
# $empfaenger = "S-1";
|
$empfaenger = $_POST['mailhidden'];
|
||||||
$mail_bcc = array();
|
$mail_bcc = array();
|
||||||
|
$mail_bccplain = explode("|", $empfaenger);
|
||||||
for ($i = 0; $i < sizeof($empfaenger); $i++) {
|
foreach($mail_bccplain as $mail_empfaenger) {
|
||||||
$trenner = explode("-", $empfaenger[$i]);
|
$mail_empfaenger = trim($mail_empfaenger);
|
||||||
|
array_push($mail_bcc, "$mail_empfaenger");
|
||||||
|
|
||||||
if ($trenner[0] == 'S') {
|
|
||||||
$query = "select mail
|
|
||||||
from jumi_admin a, jumi_admin_rollen_user_zuord b
|
|
||||||
where a.uid=b.uid
|
|
||||||
and b.rid=$trenner[1]";
|
|
||||||
|
|
||||||
$result = $db->query($query) or die("Cannot execute query");
|
|
||||||
|
|
||||||
while ($row = $result->fetch_array()) {
|
|
||||||
array_push($mail_bcc, "$row[mail]");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($trenner[0] == 'C') {
|
|
||||||
$query1 = "select mail
|
|
||||||
from jumi_chor_saenger";
|
|
||||||
|
|
||||||
$result1 = $db->query($query1) or die("Cannot execute query1");
|
|
||||||
|
|
||||||
while ($row1 = $result1->fetch_array()) {
|
|
||||||
array_push($mail_bcc, "$row1[mail]");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($trenner[0] == 'V') {
|
|
||||||
$query2 = "select mail
|
|
||||||
from jumi_mailverteiler a, jumi_mailverteiler_entries b, jumi_mailverteiler_user_zuord c
|
|
||||||
where a.mvid=c.mvid
|
|
||||||
and b.mveid=c.mveid
|
|
||||||
and c.mvid=$trenner[1]";
|
|
||||||
|
|
||||||
$result2 = $db->query($query2) or die("Cannot execute query2");
|
|
||||||
|
|
||||||
while ($row2 = $result2->fetch_array()) {
|
|
||||||
array_push($mail_bcc, "$row2[mail]");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
# doppelte und leere Arrays löschen
|
||||||
|
$mail_bcc = array_filter(array_unique($mail_bcc));
|
||||||
|
|
||||||
# Doppelte Mailadressen entfernen. Fall jemand in mehreren Gruppen aktiv ist.
|
|
||||||
$mail_bcc = array_unique($mail_bcc);
|
|
||||||
|
|
||||||
|
|
||||||
$mail = new PHPMailer();
|
$mail = new PHPMailer();
|
||||||
|
|
||||||
@ -123,6 +81,7 @@ catch (Exception $e) {
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($function == 'showmail') {
|
if ($function == 'showmail') {
|
||||||
@ -188,4 +147,6 @@ $mail_bcc = array_unique($mail_bcc);
|
|||||||
echo $out;
|
echo $out;
|
||||||
#echo "Mailadressen";
|
#echo "Mailadressen";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
@ -16,6 +16,7 @@
|
|||||||
cache: false,
|
cache: false,
|
||||||
processData:false,
|
processData:false,
|
||||||
success: function(result){
|
success: function(result){
|
||||||
|
//alert(result);
|
||||||
if(result!=''){
|
if(result!=''){
|
||||||
var a = result.split('|***|');
|
var a = result.split('|***|');
|
||||||
if(a[1]=="success"){
|
if(a[1]=="success"){
|
||||||
@ -112,14 +113,15 @@ function showmail(){
|
|||||||
result_array[i] = result_array[i].replace(/^\s*/, "").replace(/\s*$/, "");
|
result_array[i] = result_array[i].replace(/^\s*/, "").replace(/\s*$/, "");
|
||||||
// Add additional code here, such as:
|
// Add additional code here, such as:
|
||||||
var name_array = result_array[i].split('|');
|
var name_array = result_array[i].split('|');
|
||||||
//name += name_array[i][0] +"->"+ name_array[i][1]+",";
|
name += name_array[0]+"<a href='#' class='settings text-danger' id='disable' onclick='deleteContact(\""+name_array[0]+"|"+name_array[1]+"\");' title='Kontalt entfernen' data-toggle='tooltip'><i class='fa fa-trash'></i></a>, ";
|
||||||
name += name_array[0]+", ";
|
mail += name_array[1]+"|";
|
||||||
mail += name_array[1]+", ";
|
komplett += name_array[0]+"|"+name_array[1]+",";
|
||||||
komplett += name_array[0]+"|"+name_array[1]+", ";
|
|
||||||
}
|
}
|
||||||
name = name.substring(0,name.length-2);
|
name = name.substring(0,name.length-2);
|
||||||
mail = mail.substring(0,mail.length-2);
|
//mail = mail.substring(0,mail.length-1);
|
||||||
komplett = komplett.substring(0,komplett.length-2);
|
|
||||||
|
// auskommentiert, das letzte Komma wird beim deleteContact benötigt: komplett_neu = komplett_neu.replace(contact+',' , '');
|
||||||
|
//komplett = komplett.substring(0,komplett.length-1);
|
||||||
$('#empf').html(name);
|
$('#empf').html(name);
|
||||||
document.getElementById("mailhidden").value = mail;
|
document.getElementById("mailhidden").value = mail;
|
||||||
document.getElementById("komplett").value = komplett;
|
document.getElementById("komplett").value = komplett;
|
||||||
@ -133,9 +135,46 @@ function showmail(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function test(){
|
function deleteContact(contact){
|
||||||
//komma getrennte Werte bei Mehrfachauswahl
|
|
||||||
alert('hier');
|
|
||||||
$('#empf').html('klappt');
|
|
||||||
|
|
||||||
}
|
//komma getrennte Werte bei Mehrfachauswahl
|
||||||
|
var komplett_neu = document.getElementById("komplett").value;
|
||||||
|
komplett_neu = komplett_neu.replace(contact+',' , '');
|
||||||
|
|
||||||
|
//letztes Komma entfernen, damit die For Schleife nicht einmal zu viel durchläuft
|
||||||
|
komplett_neu = komplett_neu.substring(0,komplett_neu.length-1);
|
||||||
|
|
||||||
|
if(komplett_neu != ''){
|
||||||
|
var name = "";
|
||||||
|
var mail = "";
|
||||||
|
var komplett = "";
|
||||||
|
var komplett_neu_array = komplett_neu.split(',');
|
||||||
|
//Alexander2 Schwarz2|alexander@ja-schwarz.de,Alexander3 Schwarz3|technik@ju-and-mi.de,
|
||||||
|
|
||||||
|
|
||||||
|
for(var i = 0; i < komplett_neu_array.length; i++) {
|
||||||
|
|
||||||
|
// Trim the excess whitespace.
|
||||||
|
komplett_neu_array[i] = komplett_neu_array[i].replace(/^\s*/, "").replace(/\s*$/, "");
|
||||||
|
// Add additional code here, such as:
|
||||||
|
var name_array = komplett_neu_array[i].split('|');
|
||||||
|
//name += name_array[i][0] +"->"+ name_array[i][1]+",";
|
||||||
|
name += name_array[0]+"<a href='#' class='settings text-danger' id='disable' onclick='deleteContact(\""+name_array[0]+"|"+name_array[1]+"\");' title='Kontalt entfernen' data-toggle='tooltip'><i class='fa fa-trash'></i></a>, ";
|
||||||
|
mail += name_array[1]+"|";
|
||||||
|
komplett += name_array[0]+"|"+name_array[1]+",";
|
||||||
|
}
|
||||||
|
name = name.substring(0,name.length-2);
|
||||||
|
//mail = mail.substring(0,mail.length-1);
|
||||||
|
|
||||||
|
// auskommentiert, das letzte Komma wird beim deleteContact benötigt: komplett_neu = komplett_neu.replace(contact+',' , '');
|
||||||
|
//komplett = komplett.substring(0,komplett.length-1);
|
||||||
|
$('#empf').html(name);
|
||||||
|
document.getElementById("mailhidden").value = mail;
|
||||||
|
document.getElementById("komplett").value = komplett;
|
||||||
|
}else{
|
||||||
|
$('.selectpicker').selectpicker('deselectAll');
|
||||||
|
$('#empf').html('');
|
||||||
|
document.getElementById("mailhidden").value = '';
|
||||||
|
document.getElementById("komplett").value = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user