");
$("#mail_page").html(null);
}
$("html, body").animate({scrollTop:0}, 100);
return;
} else {
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
if(message=="") {
message = LANGUAGE[54][LANGTYPE]+"
"+LANGUAGE[14][LANGTYPE];
}
$("html, body").animate({scrollTop:0}, 100);
popupModal(message);
return;
}
},
error: function(e) {
$("html, body").animate({scrollTop:0}, 100);
popupModal(LANGUAGE[13][LANGTYPE]+"
"+LANGUAGE[14][LANGTYPE]);
return;
}
});
$("#mailmove_boxinfo").html($("#mailbox_info").val());
LayerOpen("close", "");
}
//예약메일 수정 확인
function reservemailEdit() {
var message_id = $("#message_id").val();
var mbox = $.URLDecode($("#mbox").val());
var msgid = $("#msgid").val();
bootbox.dialog({
message: LANGUAGE[138][LANGTYPE]+"
"+LANGUAGE[139][LANGTYPE],
buttons: {
danger: {
label: LANGUAGE[114][LANGTYPE],
className: "btn-primary",
callback: function() {
reservemailCancel('one');
}
},
main: {
label: LANGUAGE[115][LANGTYPE],
className: "btn-default",
callback: function() {
}
}
},
className: "bootbox-sm"
});
}
//예약메일 취소
function reservemailCancel(mode) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var mbox = $.URLDecode($("#mbox").val());
if(mode=="one") {
var command = "reservecancel";
var message_id = $("#message_id").val();
var msgid = $("#msgid").val();
var ajaxdata = "mbox="+$.URLEncode(mbox)+"&msgid="+msgid+"&message_id="+$.URLEncode(message_id)+"&command="+command;
var ajaxurl = "/module/reservemail.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
var timestamp = tstamp();
$.history.load("mailwrite^"+mbox+"^VIEWDRAFT^"+timestamp+"^"+msgid);
}
},
error: function(e) {
popupModal(LANGUAGE[13][LANGTYPE]+"
"+LANGUAGE[14][LANGTYPE]);
return;
}
});
} else {
}
}
//메일 읽음/안읽음 으로 변경
function mailread(val) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var msgid = "";
var command = "";
var checkedlist = getChecked();
if(checkedlist.length == "") {
bootbox.confirm({
message: LANGUAGE[140][LANGTYPE],
callback: function(result) {
return;
},
className: "bootbox-sm"
});
return;
}
msgid = checkedlist;
if(val == "read") {
command = "SETMAILREAD";
}
else if(val == "unread") {
command = "SETMAILUNREAD";
}
var mbox = $.URLDecode($("#mbox").val());
var ajaxdata = "mbox="+$.URLEncode(mbox)+"&msgid="+msgid+"&command="+command;
var ajaxurl = "/module/mail_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open", "");
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
//2020-02-21// showMaillistBtn("hide");
//2020-02-21// maillist_Init();
var xmldata = $(xml).find("DATA");
var boxcountid = $.URLDecode(xmldata.find("BOXCOUNTID").text());
var boxnameid = boxcountid.replace(/\./g, "_");
boxnameid = boxnameid.replace(/\,/g, "_");
boxnameid = boxnameid.replace(/\ /g, "_");
boxnameid = boxnameid.replace(/\(/gi, "BRACKET_");
boxnameid = boxnameid.replace(/\)/gi, "_BRACKET");
boxnameid = boxnameid.replace(/\+/gi, "__PLUS__");
var unseen = xmldata.find("UNSEEN").text();
if(unseen!=0) $("#COUNT_"+boxnameid).text(unseen);
else $("#COUNT_"+boxnameid).text("");
$("#unseen_count").text(unseen);
LayerOpen("close", "");
var checkedlist = getChecked2();
var msgid_arr = checkedlist.split("|");
for(i=0; i<(msgid_arr.length - 1); i++) {
var muid = msgid_arr[i];
if(command=="SETMAILREAD") {
$("#mailimg_"+muid).attr("src", "/images/ico_mail_seen.png");
$("#mailuid_"+muid).removeClass("unread");
} else {
$("#mailimg_"+muid).attr("src", "/images/ico_mail_unseen.png");
$("#mailuid_"+muid).addClass("unread");
}
}
},
error: function(e) {
LayerOpen("close", "");
popupModal(LANGUAGE[13][LANGTYPE]+"
"+LANGUAGE[14][LANGTYPE]);
return;
}
});
}
function mailread2(val) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var msgid = $("#msgid").val();
if(val == "read") {
command = "SETMAILREAD";
}
else if(val == "unread") {
command = "SETMAILUNREAD";
}
//2022-03-14//var mbox = $.URLDecode($("#mbox").val());
var mbox = decodeURIComponent($("#mbox").val());
var ajaxdata = "mbox="+encodeURIComponent(mbox)+"&msgid="+msgid+"&command="+command;
var ajaxurl = "/module/mail_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open", "");
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
var boxname = $.URLDecode(xmldata.find("BOXNAME").text());
var boxcountid = $.URLDecode(xmldata.find("BOXCOUNTID").text());
var boxnameid = boxcountid.replace(/\./g, "_");
boxnameid = boxnameid.replace(/\,/g, "_");
boxnameid = boxnameid.replace(/\ /g, "_");
boxnameid = boxnameid.replace(/\(/gi, "BRACKET_");
boxnameid = boxnameid.replace(/\)/gi, "_BRACKET");
boxnameid = boxnameid.replace(/\+/gi, "__PLUS__");
var unseen = xmldata.find("UNSEEN").text();
//$("#COUNT_"+boxnameid).text(unseen);
var pagetype = $("#pagetype").val();
if(pagetype=="popup") {
if(unseen!=0) $("#COUNT_"+boxnameid, opener.document).text(unseen);
else $("#COUNT_"+boxnameid, opener.document).text("");
$("#unseen_count", opener.document).text(unseen);
var pagecode = $("#pagecode", opener.document).val();
if(pagecode=="maillist") {
setMailreadFlag2(msgid, command);
}
} else {
if(unseen!=0) $("#COUNT_"+boxnameid).text(unseen);
else $("#COUNT_"+boxnameid).text("");
$("#unseen_count").text(unseen);
}
},
error: function(e) {
popupModal(LANGUAGE[13][LANGTYPE]+"
"+LANGUAGE[14][LANGTYPE]);
return;
}
});
LayerOpen("close", "");
}
// 메일상태 개별변경
function setMailreadFlag(muid) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var chk = $("input:checkbox[name='muid[]']");
var chk_h = $("input:hidden[name='chk_hidden[]']");
var msgid = chk[muid].value;
var h = chk_h[muid].value;
var arr = h.split("_");
if(arr[2]=="U") {
var command = "SETMAILREAD";
$("#mailimg_"+muid).attr("src", "/images/ico_mail_seen.png");
$("#mailuid_"+muid).removeClass("unread");
} else {
var command = "SETMAILUNREAD";
$("#mailimg_"+muid).attr("src", "/images/ico_mail_unseen.png");
$("#mailuid_"+muid).addClass("unread");
}
//2020-01-31//var mbox = $.URLDecode($("#mbox").val());
var mbox = $("#mbox").val();
var ajaxdata = "mbox="+encodeURIComponent(mbox)+"&msgid="+msgid+"&command="+command;
var ajaxurl = "/module/mail_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open", "");
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var boxname = $.URLDecode(xmldata.find("BOXNAME").text());
var boxcountid = $.URLDecode(xmldata.find("BOXCOUNTID").text());
var boxnameid = boxcountid.replace(/\./g, "_");
boxnameid = boxnameid.replace(/\,/g, "_");
boxnameid = boxnameid.replace(/\ /g, "_");
boxnameid = boxnameid.replace(/\(/gi, "BRACKET_");
boxnameid = boxnameid.replace(/\)/gi, "_BRACKET");
boxnameid = boxnameid.replace(/\+/gi, "__PLUS__");
var unseen = xmldata.find("UNSEEN").text();
//$("#COUNT_"+boxnameid).text(unseen);
if(unseen!=0) $("#COUNT_"+boxnameid).text(numberSetComma(unseen));
else $("#COUNT_"+boxnameid).text("");
$("#unseen_count").text(unseen);
var i = 0;
var chk_h = $("input:hidden[id='chk_hidden[]']");
chk_h.each(function(){
var h = this.value;
var arr = h.split("_");
if(msgid==arr[0]) {
if(command=="SETMAILREAD") {
var val = "S";
} else {
var val = "U";
}
var chk_value = arr[0]+"_"+arr[1]+"_"+val+"_"+arr[3];
chk_h[i].value = chk_value;
}
i++;
});
},
error: function(e) {
}
});
LayerOpen("close", "");
}
// 메일상태 개별변경(팝업)
function setMailreadFlag2(msgid, command) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var n = 0;
var muid = "";
$("input[name='muid[]']", opener.document).each(function() {
if(this.value==msgid) {
muid = n;
}
n++;
})
var chk = $("input:checkbox[name='muid[]']", opener.document);
var chk_h = $("input:hidden[name='chk_hidden[]']", opener.document);
var h = chk_h[muid].value;
var arr = h.split("_");
if(command == "SETMAILREAD") {
$("#mailimg_"+muid, opener.document).attr("src", "/images/ico_mail_seen.png");
$("#mailuid_"+muid, opener.document).removeClass("unread");
var chk_value = arr[0]+"_"+arr[1]+"_S_"+arr[3];
} else {
$("#mailimg_"+muid, opener.document).attr("src", "/images/ico_mail_unseen.png");
$("#mailuid_"+muid, opener.document).addClass("unread");
var chk_value = arr[0]+"_"+arr[1]+"_U_"+arr[3];
}
chk_h[muid].value = chk_value;
}
// 중요메일 설정
function setStarFlag(muid) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var chk = $("input:checkbox[name='muid[]']");
var chk_h = $("input:hidden[name='chk_hidden[]']");
var msgid = chk[muid].value;
var h = chk_h[muid].value;
var arr = h.split("_");
if(arr[3]=="X") {
var command = "RESETIMPORTANT";
$("#mailuid_"+muid).removeClass("starred");
} else {
var command = "SETIMPORTANT";
$("#mailuid_"+muid).addClass("starred");
}
var mbox = $.URLDecode($("#mbox").val());
var ajaxdata = "mbox="+$.URLEncode(mbox)+"&msgid="+msgid+"&command="+command;
var ajaxurl = "/module/mail_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open", "");
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var i = 0;
var chk_h = $("input:hidden[id='chk_hidden[]']");
chk_h.each(function(){
var h = this.value;
var arr = h.split("_");
var chk_value = arr[0]+"_"+arr[1]+"_"+arr[2]+"_";
if(msgid==arr[0]) {
if(command=="SETIMPORTANT") {
chk_value += "X";
} else {
chk_value += "N";
}
chk_h[i].value = chk_value;
}
i++
});
LayerOpen("close", "");
},
error: function(e) {
LayerOpen("close", "");
}
});
}
function setStarFlag2(msgid, flag) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var h = $("#chk_hidden_"+msgid).val();
var arr = h.split("_");
if(flag==undefined && flag=="") {
if(arr[3]=="X") {
var command = "RESETIMPORTANT";
$("#mailuid_"+msgid).removeClass("starred");
} else {
var command = "SETIMPORTANT";
$("#mailuid_"+msgid).addClass("starred");
}
} else {
if(arr[3]=="X") {
var command = "RESETIMPORTANT";
$("#mail_headers").removeClass("starred");
} else {
var command = "SETIMPORTANT";
$("#mail_headers").addClass("starred");
}
}
//2022-03-14//var mbox = $.URLDecode($("#mbox").val());
var mbox = decodeURIComponent($("#mbox").val());
var ajaxdata = "mbox="+encodeURIComponent(mbox)+"&msgid="+msgid+"&command="+command;
var ajaxurl = "/module/mail_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open", "");
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var chk_value = arr[0]+"_"+arr[1]+"_"+arr[2]+"_";
if(command=="SETIMPORTANT") {
chk_value += "X";
} else {
chk_value += "N";
}
$("#chk_hidden_"+msgid).val(chk_value);
var pagetype = $("#pagetype").val();
if(pagetype=="popup") {
var pagecode = $("#pagecode", opener.document).val();
} else {
var pagecode = $("#pagecode").val();
}
if(pagetype=="popup" && pagecode=="maillist") {
var n = 0;
var muid = "";
$("input[name='muid[]']", opener.document).each(function() {
if(this.value==msgid) {
muid = n;
}
n++;
})
var chk_h = $("input:hidden[name='chk_hidden[]']", opener.document);
chk_h[muid].value = chk_value;
if(command == "SETIMPORTANT") {
$("#mailuid_"+muid, opener.document).addClass("starred");
} else {
$("#mailuid_"+muid, opener.document).removeClass("starred");
}
}
LayerOpen("close", "");
},
error: function(e) {
LayerOpen("close", "");
}
});
}
// 메일삭제
function deleteMails(val) {
var command = "";
var msgid = "";
var mode = "";
if(usertypeCheck()==false) return;
if($("#pagetype").val()=="popup") {
msgid = $("#msgid").val();
} else {
if($("#hash").val() == "maillist" || $("#hash").val() == "") {
var checkedlist = getChecked();
mode = "maillist";
if(checkedlist.length == "") {
bootboxAlert(LANGUAGE[140][LANGTYPE]);
return;
}
msgid = checkedlist;
} else if($("#hash").val() == "mailview" || $("#hash").val() == "mailview_unseen") {
mode = "mailview";
msgid = $("#msgid").val();
}
}
//2022-03-14//var mbox = $.URLDecode($("#mbox").val());
var mbox = decodeURIComponent($("#mbox").val());
if(mbox == "Trash" || mbox == "Spam") val = "REALDELETE";
var delete_msg = "";
if(mbox == "Reserved") {
delete_msg = "";
val = "RESERVECANCEL";
}
if(val == "DELETE") {
bootbox.dialog({
message: LANGUAGE[112][LANGTYPE]+"
"+LANGUAGE[113][LANGTYPE],
buttons: {
danger: {
label: LANGUAGE[97][LANGTYPE],
className: "btn-primary",
callback: function() {
command = "DELETEMAIL";
deleteMails_action(command, msgid);
}
},
main: {
label: LANGUAGE[115][LANGTYPE],
className: "btn-default",
callback: function() {
}
}
},
className: "bootbox-sm"
});
} else if(val == "REALDELETE") {
bootbox.dialog({
message: LANGUAGE[117][LANGTYPE]+"
"+LANGUAGE[112][LANGTYPE],
buttons: {
danger: {
label: LANGUAGE[97][LANGTYPE],
className: "btn-primary",
callback: function() {
command = "DELETEMAILCOMPLETELY";
deleteMails_action(command, msgid);
}
},
main: {
label: LANGUAGE[115][LANGTYPE],
className: "btn-default",
callback: function() {
}
}
},
className: "bootbox-sm"
});
} else if(val == "RESERVECANCEL") {
if(mode=="mailview") {
var reservemail_code = $("#reservemail_code").val();
if(reservemail_code=="N") {
var delete_message = LANGUAGE[118][LANGTYPE]+"
"+LANGUAGE[119][LANGTYPE];
} else {
var delete_message = LANGUAGE[112][LANGTYPE]+"
"+LANGUAGE[113][LANGTYPE];
}
} else {
var delete_message = LANGUAGE[112][LANGTYPE]+"
"+LANGUAGE[119][LANGTYPE];
}
bootbox.dialog({
message: delete_message,
buttons: {
danger: {
label: LANGUAGE[97][LANGTYPE],
className: "btn-primary",
callback: function() {
command = "RESERVECANCEL";
deleteMails_action(command, msgid);
}
},
main: {
label: LANGUAGE[115][LANGTYPE],
className: "btn-default",
callback: function() {
}
}
},
className: "bootbox-sm"
});
} else {
bootbox.dialog({
message: LANGUAGE[112][LANGTYPE],
buttons: {
danger: {
label: LANGUAGE[97][LANGTYPE],
className: "btn-primary",
callback: function() {
command = "DELETEMAIL";
deleteMails_action(command, msgid);
}
},
main: {
label: LANGUAGE[115][LANGTYPE],
className: "btn-default",
callback: function() {
}
}
},
className: "bootbox-sm"
});
}
}
function deleteMails_action(command, msgid) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
//2022-03-14//var mbox = $.URLDecode($("#mbox").val());
var mbox = decodeURIComponent($("#mbox").val());
var showtype = $("#showtype").val();
if(showtype == "") {
showtype = "ALL";
}
var ajaxdata = "mbox="+encodeURIComponent(mbox)+"&msgid="+msgid+"&command="+command;
var ajaxurl = "/module/mail_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open", "");
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
LayerOpen("close", "");
if($("#pagetype").val()=="popup") {
if($("#pagecode", opener.document).val()=="maillist") {
opener.maillist_Init();
} else {
if($("#pagecode", opener.document).val()=="mailview" && $.URLDecode($.URLDecode($("#mbox", opener.document).val())) == $.URLDecode($("#mbox").val()) && $("#msgid", opener.document).val()==msgid) {
var timestamp = tstamp();
var page = $("#page", opener.document).val();
var showtype = $("#showtype", opener.document).val();
$(opener.location).attr("href", "/main.php#maillist%5E"+mbox+"%5E"+page+"%5E"+showtype+"%5E"+timestamp);
}
}
window.close();
} else {
var xmldata = $(xml).find("DATA");
var xmldata_quota = xmldata.find("QUOTA");
var mail_allot_quota = $.URLDecode(xmldata_quota.find("USER_QUOTA").text());
var mail_used_quota = $.URLDecode(xmldata_quota.find("MAIL_QUOTA").text());
var mail_used_percent = $.URLDecode(xmldata_quota.find("MAIL_PERCENT").text());
$("#mail-allot-quota").html(mail_allot_quota);
$("#mail-used-quota").html(mail_used_quota);
$("#mail-quota-bar").css("width", mail_used_percent+"%");
var page = $("#page").val();
if($("#hash").val() == "maillist") {
if($("#mbox").val()!="Reserved") {
maillist_Init();
} else {
reservelist_Init();
}
} else {
var timestamp = tstamp();
$.history.load("maillist^"+mbox+"^"+page+"^"+showtype+"^"+timestamp);
}
showMaillistBtn("hide");
menuMailCountInit();
}
},
error: function(e) {
LayerOpen("close", "");
popupModal(LANGUAGE[142][LANGTYPE]);
}
});
}
// 읽지 않은 메일 삭제
function deleteUnseenMails(val) {
var command = "";
var msgid = "";
var mode = "";
if($("#pagetype").val()=="popup") {
msgid = $("#msgid").val();
} else {
if($("#hash").val() == "maillist_unseen" || $("#hash").val() == "") {
var checkedlist = getChecked3();
mode = "maillist_unseen";
if(checkedlist.length == "") {
bootboxAlert(LANGUAGE[140][LANGTYPE]);
return;
}
msgid = checkedlist;
}
}
var mbox = $.URLDecode($("#mbox").val());
if(val == "DELETE") {
bootbox.dialog({
message: LANGUAGE[112][LANGTYPE]+"
"+LANGUAGE[113][LANGTYPE],
buttons: {
danger: {
label: LANGUAGE[97][LANGTYPE],
className: "btn-primary",
callback: function() {
command = "DELETEMAIL";
deleteUnseenMails_action(command, msgid);
}
},
main: {
label: LANGUAGE[115][LANGTYPE],
className: "btn-default",
callback: function() {
}
}
},
className: "bootbox-sm"
});
}
}
function deleteUnseenMails_action(command, msgid) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var mbox = $.URLDecode($("#mbox").val());
var showtype = $("#showtype").val();
if(showtype == "") {
showtype = "ALL";
}
var ajaxdata = "mbox="+$.URLEncode(mbox)+"&msgid="+$.URLEncode(msgid)+"&command="+command;
var ajaxurl = "/module/mail_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open", "");
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
LayerOpen("close", "");
if($("#pagetype").val()=="popup") {
if($("#pagecode", opener.document).val()=="maillist") {
opener.maillist_Init();
} else {
if($("#pagecode", opener.document).val()=="mailview" && $.URLDecode($.URLDecode($("#mbox", opener.document).val())) == $.URLDecode($("#mbox").val()) && $("#msgid", opener.document).val()==msgid) {
var timestamp = tstamp();
var page = $("#page", opener.document).val();
var showtype = $("#showtype", opener.document).val();
$(opener.location).attr("href", "/main.php#maillist%5E"+mbox+"%5E"+page+"%5E"+showtype+"%5E"+timestamp);
}
}
window.close();
} else {
var xmldata = $(xml).find("DATA");
var xmldata_quota = xmldata.find("QUOTA");
var mail_allot_quota = $.URLDecode(xmldata_quota.find("USER_QUOTA").text());
var mail_used_quota = $.URLDecode(xmldata_quota.find("MAIL_QUOTA").text());
var mail_used_percent = $.URLDecode(xmldata_quota.find("MAIL_PERCENT").text());
$("#mail-allot-quota").html(mail_allot_quota);
$("#mail-used-quota").html(mail_used_quota);
$("#mail-quota-bar").css("width", mail_used_percent+"%");
var page = $("#page").val();
var timestamp = tstamp();
$.history.load("maillist_unseen^ALL^"+page+"^"+showtype+"^"+timestamp);
showMaillistBtn("hide");
menuMailCountInit();
}
},
error: function(e) {
LayerOpen("close", "");
popupModal(LANGUAGE[142][LANGTYPE]);
}
});
}
// 메일함 비우기
function emptyMailbox(boxname) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var hash = $("#hash").val();
var mbox = $("#mbox").val();
var ajaxdata = "mbox="+boxname+"&command=EMPTYMAILBOX";
var ajaxurl = "/module/mail_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open", LANGUAGE[141][LANGTYPE]);
$.ajax({
type:"POST",
url:"/module/mail_action.php",
data:ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
var boxname = $.URLDecode(xmldata.find("BOXNAME").text());
var boxcountid = $.URLDecode(xmldata.find("BOXCOUNTID").text());
var boxnameid = boxcountid.replace(/\./g, "_");
boxnameid = boxnameid.replace(/\,/g, "_");
boxnameid = boxnameid.replace(/\ /g, "_");
boxnameid = boxnameid.replace(/\(/gi, "BRACKET_");
boxnameid = boxnameid.replace(/\)/gi, "_BRACKET");
boxnameid = boxnameid.replace(/\+/gi, "__PLUS__");
var unseen = xmldata.find("UNSEEN").text();
var xmldata_quota = xmldata.find("QUOTA");
var mail_allot_quota = $.URLDecode(xmldata_quota.find("USER_QUOTA").text());
var mail_used_quota = $.URLDecode(xmldata_quota.find("MAIL_QUOTA").text());
var mail_used_percent = $.URLDecode(xmldata_quota.find("MAIL_PERCENT").text());
$("#mail-allot-quota").html(mail_allot_quota);
$("#mail-used-quota").html(mail_used_quota);
$("#mail-quota-bar").css("width", mail_used_percent+"%");
if(boxname==mbox && (mbox=="Trash" || mbox=="Spam")) {
maillist_Init();
} else {
//$("#COUNT_"+boxnameid).text(unseen);
if(unseen>0) $("#COUNT_"+boxnameid).text(unseen);
else $("#COUNT_"+boxnameid).text("");
}
LayerOpen("close");
},
error: function(e) {
LayerOpen("close");
alert(LANGUAGE[143][LANGTYPE])
}
});
}
//스팸신고
function addBlacklist() {
if(usertypeCheck()==false) return;
var msgid = "";
if($("#pagetype").val()=="popup") {
msgid = $("#msgid").val();
} else {
if($("#hash").val() == "maillist" || $("#hash").val() == "") {
var checkedlist = getChecked();
if(checkedlist.length == "") {
bootboxAlert(LANGUAGE[140][LANGTYPE]);
return;
}
msgid = checkedlist;
} else if($("#hash").val() == "mailview" || $("#hash").val() == "mailview_unseen" || $("pagetype").val()=="popup") {
msgid = $("#msgid").val();
}
}
bootbox.dialog({
message: LANGUAGE[116][LANGTYPE],
buttons: {
danger: {
label: LANGUAGE[114][LANGTYPE],
className: "btn-primary",
callback: function() {
command = "ADDBLACKLIST";
addBlacklist_action(command, msgid);
}
},
main: {
label: LANGUAGE[115][LANGTYPE],
className: "btn-default",
callback: function() {
}
}
},
className: "bootbox-sm"
});
}
function addBlacklist_Init(email, msgid) {
bootbox.dialog({
message: "<"+email+">
"+LANGUAGE[116][LANGTYPE]+" ",
title: LANGUAGE[144][LANGTYPE],
buttons: {
main: {
label: LANGUAGE[115][LANGTYPE],
className: "btn-default",
callback: function() {
}
},
danger: {
label: LANGUAGE[114][LANGTYPE],
className: "btn-primary",
callback: function() {
addBlacklist_action("ADDBLACKLIST", msgid);
}
}
},
className: "bootbox-sm"
});
}
function unseenAddBlacklist_Init(email, mbox, msgid) {
bootbox.dialog({
message: "<"+email+">
"+LANGUAGE[116][LANGTYPE]+" ",
title: LANGUAGE[144][LANGTYPE],
buttons: {
main: {
label: LANGUAGE[115][LANGTYPE],
className: "btn-default",
callback: function() {
}
},
danger: {
label: LANGUAGE[114][LANGTYPE],
className: "btn-primary",
callback: function() {
unseenAddBlacklist_action("ADDBLACKLIST", mbox, msgid);
}
}
},
className: "bootbox-sm"
});
}
function addBlacklist_action(command, msgid) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
//2022-03-14//var mbox = $.URLDecode($("#mbox").val());
var mbox = decodeURIComponent($("#mbox").val());
var showtype = $("#showtype").val();
if(showtype == "") {
showtype = "ALL";
}
var ajaxdata = "mbox="+encodeURIComponent(mbox)+"&msgid="+msgid+"&command="+command;
var ajaxurl = "/module/mail_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open", "");
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
LayerOpen("close", "");
if($("#pagetype").val()=="popup") {
if($("#pagecode", opener.document).val()=="maillist") {
opener.maillist_Init();
} else {
if($("#pagecode", opener.document).val()=="mailview" && $.URLDecode($.URLDecode($("#mbox", opener.document).val())) == $.URLDecode($("#mbox").val()) && $("#msgid", opener.document).val()==msgid) {
var timestamp = tstamp();
var page = $("#page", opener.document).val();
var showtype = $("#showtype", opener.document).val();
$(opener.location).attr("href", "/main.php#maillist%5E"+mbox+"%5E"+page+"%5E"+showtype+"%5E"+timestamp);
}
}
window.close();
} else {
var xmldata = $(xml).find("DATA");
var xmldata_quota = xmldata.find("QUOTA");
var mail_allot_quota = $.URLDecode(xmldata_quota.find("USER_QUOTA").text());
var mail_used_quota = $.URLDecode(xmldata_quota.find("MAIL_QUOTA").text());
var mail_used_percent = $.URLDecode(xmldata_quota.find("MAIL_PERCENT").text());
$("#mail-allot-quota").html(mail_allot_quota);
$("#mail-used-quota").html(mail_used_quota);
$("#mail-quota-bar").css("width", mail_used_percent+"%");
var page = $("#page").val();
if($("#hash").val() == "maillist") {
maillist_Init();
} else {
var timestamp = tstamp();
$.history.load("maillist^"+mbox+"^"+page+"^"+showtype+"^"+timestamp);
}
showMaillistBtn("hide");
menuMailCountInit();
}
},
error: function(e) {
LayerOpen("close", "");
popupModal(LANGUAGE[145][LANGTYPE]);
}
});
}
function unseenAddBlacklist_action(command, mbox, msgid) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
//2022-03-14//var mbox = $.URLDecode($("#mbox").val());
var showtype = $("#showtype").val();
if(showtype == "") {
showtype = "ALL";
}
var ajaxdata = "mbox="+encodeURIComponent(mbox)+"&msgid="+msgid+"&command="+command;
var ajaxurl = "/module/mail_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open", "");
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
LayerOpen("close", "");
if($("#pagetype").val()=="popup") {
if($("#pagecode", opener.document).val()=="maillist") {
opener.maillistUnseen_Init();
} else {
if($("#pagecode", opener.document).val()=="mailview" && $.URLDecode($.URLDecode($("#mbox", opener.document).val())) == $.URLDecode($("#mbox").val()) && $("#msgid", opener.document).val()==msgid) {
var timestamp = tstamp();
var page = $("#page", opener.document).val();
var showtype = $("#showtype", opener.document).val();
$(opener.location).attr("href", "/main.php#maillist%5E"+mbox+"%5E"+page+"%5E"+showtype+"%5E"+timestamp);
}
}
window.close();
} else {
var xmldata = $(xml).find("DATA");
var xmldata_quota = xmldata.find("QUOTA");
var mail_allot_quota = $.URLDecode(xmldata_quota.find("USER_QUOTA").text());
var mail_used_quota = $.URLDecode(xmldata_quota.find("MAIL_QUOTA").text());
var mail_used_percent = $.URLDecode(xmldata_quota.find("MAIL_PERCENT").text());
$("#mail-allot-quota").html(mail_allot_quota);
$("#mail-used-quota").html(mail_used_quota);
$("#mail-quota-bar").css("width", mail_used_percent+"%");
var page = $("#page").val();
if($("#hash").val() == "maillist") {
maillistUnseen_Init();
} else {
var timestamp = tstamp();
$.history.load("maillist_unseen^ALL^"+page+"^"+showtype+"^"+timestamp);
}
showMaillistBtn("hide");
menuMailCountInit();
}
},
error: function(e) {
LayerOpen("close", "");
popupModal(LANGUAGE[145][LANGTYPE]);
}
});
}
// 메일리스트 규칙 추가
function addMailFilterPopup_action() {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
$("#custom_modal_message").html("");
var mbox = $.URLDecode($("#mbox").val());
var email = $("#addmailfilter_email").val();
if($("#addMailFilter_mbox1").is(":checked")) {
var mboxtype = "BASIC";
var destmbox = $("#addMailFilter_filterbox").val();
if(mbox==destmbox) {
$("#custom_modal_message").html("
"+LANGUAGE[848][LANGTYPE]+" ");
return;
}
} else {
var mboxtype = "NEW";
var destmbox = $("#addMailFilter_newbox").val();
var checkMailboxName = usermailboxNameCheck(JSON.parse($("#MailboxData").val()), destmbox);
var checkResult = checkMailboxName.split("|");
if(checkResult[0]!="RES") {
$("#custom_modal_message").html("
"+checkResult[1]+" ");
return;
}
}
if($("#addMailFilter_allmail").is(":checked")) {
var ruleapply = "ALL";
} else {
var ruleapply = "ONE";
}
pattern = /^[A-Za-z0-9\._-]+[@][A-Za-z0-9\._-]+[\.].[A-Za-z0-9]+$/;
if (!pattern.test(email)) {
$("#custom_modal_message").html("
"+LANGUAGE[775][LANGTYPE]+" ");
return;
}
var ajaxdata = "command=ADDMAILFILTER&mbox="+encodeURIComponent(mbox)+"&email="+encodeURIComponent(email)+"&mboxtype="+mboxtype+"&destination="+encodeURIComponent(destmbox)+"&ruleapply="+ruleapply;
var ajaxurl = "/module/mail_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
$("#custom_modal_message").html("
"+LANGUAGE[9][LANGTYPE]+" ");
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
$("#custom_modal_message").html("");
$("#popup_modal2").modal("hide");
var xmldata_quota = xmldata.find("QUOTA");
var mail_allot_quota = $.URLDecode(xmldata_quota.find("USER_QUOTA").text());
var mail_used_quota = $.URLDecode(xmldata_quota.find("MAIL_QUOTA").text());
var mail_used_percent = $.URLDecode(xmldata_quota.find("MAIL_PERCENT").text());
$("#mail-allot-quota").html(mail_allot_quota);
$("#mail-used-quota").html(mail_used_quota);
$("#mail-quota-bar").css("width", mail_used_percent+"%");
var page = $("#page").val();
if($("#hash").val() == "maillist") {
if($("#mbox").val()!="Reserved") {
maillist_Init();
} else {
reservelist_Init();
}
} else {
var timestamp = tstamp();
$.history.load("maillist^"+mbox+"^"+page+"^"+showtype+"^"+timestamp);
}
showMaillistBtn("hide");
menuMailCountInit();
} else {
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
if(message=="") {
$("#custom_modal_message").html("
"+LANGUAGE[671][LANGTYPE]+" "+LANGUAGE[14][LANGTYPE]+" ");
} else {
$("#custom_modal_message").html("
"+message+" ");
}
}
},
error: function(e) {
popupModal(LANGUAGE[671][LANGTYPE]);
}
});
}
//수신허용
function addWhitelist() {
if(usertypeCheck()==false) return;
var msgid = "";
if($("#pagetype").val()=="popup") {
msgid = $("#msgid").val();
} else {
if($("#hash").val() == "maillist" || $("#hash").val() == "") {
var checkedlist = getChecked();
if(checkedlist.length == "") {
bootboxAlert(LANGUAGE[140][LANGTYPE]);
return;
}
msgid = checkedlist;
} else if($("#hash").val() == "mailview" || $("#hash").val() == "mailview_unseen" || $("pagetype").val()=="popup") {
msgid = $("#msgid").val();
}
}
bootbox.dialog({
message: LANGUAGE[841][LANGTYPE],
buttons: {
danger: {
label: LANGUAGE[114][LANGTYPE],
className: "btn-primary",
callback: function() {
command = "ADDWHITELIST";
addWhitelist_action(command, msgid);
}
},
main: {
label: LANGUAGE[115][LANGTYPE],
className: "btn-default",
callback: function() {
}
}
},
className: "bootbox-sm"
});
}
function addWhitelist_action(command, msgid) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var mbox = $.URLDecode($("#mbox").val());
var showtype = $("#showtype").val();
if(showtype == "") {
showtype = "ALL";
}
var ajaxdata = "mbox="+$.URLEncode(mbox)+"&msgid="+msgid+"&command="+command;
var ajaxurl = "/module/mail_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open", "");
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
/***
if($("#pagetype").val()=="popup") {
if($("#pagecode", opener.document).val()=="maillist") {
opener.maillist_Init();
} else {
if($("#pagecode", opener.document).val()=="mailview" && $.URLDecode($.URLDecode($("#mbox", opener.document).val())) == $.URLDecode($("#mbox").val()) && $("#msgid", opener.document).val()==msgid) {
var timestamp = tstamp();
var page = $("#page", opener.document).val();
var showtype = $("#showtype", opener.document).val();
$(opener.location).attr("href", "/main.php#maillist%5E"+mbox+"%5E"+page+"%5E"+showtype+"%5E"+timestamp);
}
}
window.close();
} else {
***/
var xmldata = $(xml).find("DATA");
var xmldata_quota = xmldata.find("QUOTA");
var mail_allot_quota = $.URLDecode(xmldata_quota.find("USER_QUOTA").text());
var mail_used_quota = $.URLDecode(xmldata_quota.find("MAIL_QUOTA").text());
var mail_used_percent = $.URLDecode(xmldata_quota.find("MAIL_PERCENT").text());
$("#mail-allot-quota").html(mail_allot_quota);
$("#mail-used-quota").html(mail_used_quota);
$("#mail-quota-bar").css("width", mail_used_percent+"%");
/***
var page = $("#page").val();
if($("#hash").val() == "maillist") {
maillist_Init();
} else {
var timestamp = tstamp();
$.history.load("maillist^"+mbox+"^"+page+"^"+showtype+"^"+timestamp);
}
showMaillistBtn("hide");
menuMailCountInit();
}
***/
LayerOpen("close", "");
popupModal(LANGUAGE[760][LANGTYPE]);
},
error: function(e) {
LayerOpen("close", "");
popupModal(LANGUAGE[145][LANGTYPE]);
}
});
}
//메일이동
function mailMove(name) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var destmbox = $.URLEncode(name);
//2022-03-14//var mbox = $.URLDecode($("#mbox").val());
var mbox = decodeURIComponent($("#mbox").val());
var msgid = "";
if($("#pagetype").val()=="popup") {
msgid = $("#msgid").val();
} else {
if($("#hash").val() == "maillist" || $("#hash").val() == "") {
var checkedlist = getChecked();
if(checkedlist.length == "") {
bootboxAlert(LANGUAGE[140][LANGTYPE]);
return;
}
msgid = checkedlist;
} else if($("#hash").val() == "mailview" || $("#hash").val() == "mailview_unseen") {
msgid = $("#msgid").val();
}
if(mbox == name) {
bootboxAlert(LANGUAGE[146][LANGTYPE]);
return;
}
}
var command = "MOVEMAILS";
var ajaxdata = "mbox="+encodeURIComponent(mbox)+"&msgid="+msgid+"&command="+command+"&destination="+destmbox;
var ajaxurl = "/module/mail_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open", "");
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
LayerOpen("close", "");
if($("#pagetype").val()=="popup") {
if($("#pagecode", opener.document).val()=="maillist") {
opener.maillist_Init();
} else {
if($("#pagecode", opener.document).val()=="mailview" && $.URLDecode($.URLDecode($("#mbox", opener.document).val())) == $.URLDecode($("#mbox").val()) && $("#msgid", opener.document).val()==msgid) {
var timestamp = tstamp();
var page = $("#page", opener.document).val();
var showtype = $("#showtype", opener.document).val();
$(opener.location).attr("href", "/main.php#maillist%5E"+mbox+"%5E"+page+"%5E"+showtype+"%5E"+timestamp);
}
}
window.close();
} else {
var xmldata = $(xml).find("DATA");
var xmldata_quota = xmldata.find("QUOTA");
var mail_allot_quota = $.URLDecode(xmldata_quota.find("USER_QUOTA").text());
var mail_used_quota = $.URLDecode(xmldata_quota.find("MAIL_QUOTA").text());
var mail_used_percent = $.URLDecode(xmldata_quota.find("MAIL_PERCENT").text());
$("#mail-allot-quota").html(mail_allot_quota);
$("#mail-used-quota").html(mail_used_quota);
$("#mail-quota-bar").css("width", mail_used_percent+"%");
var page = $("#page").val();
if($("#hash").val() == "maillist") {
maillist_Init();
} else {
var timestamp = tstamp();
$.history.load("maillist^"+mbox+"^"+page+"^"+showtype+"^"+timestamp);
}
showMaillistBtn("hide");
menuMailCountInit();
}
},
error: function(e) {
LayerOpen("close", "");
popupModal(LANGUAGE[147][LANGTYPE]);
}
});
}
function quickMailMove_action(name, msgid) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var destmbox = $.URLEncode(name);
var mbox = $.URLDecode($("#mbox").val());
if(mbox == name) {
bootboxAlert(LANGUAGE[146][LANGTYPE]);
return;
}
var command = "MOVEMAIL_ONE";
var ajaxdata = "mbox="+$.URLEncode(mbox)+"&msgid="+msgid+"&command="+command+"&destination="+destmbox;
var ajaxurl = "/module/mail_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open", "");
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
if($("#pagetype").val()=="popup") {
if($("#pagecode", opener.document).val()=="maillist") {
opener.maillist_Init();
} else {
if($("#pagecode", opener.document).val()=="mailview" && $.URLDecode($.URLDecode($("#mbox", opener.document).val())) == $.URLDecode($("#mbox").val()) && $("#msgid", opener.document).val()==msgid) {
var timestamp = tstamp();
var page = $("#page", opener.document).val();
var showtype = $("#showtype", opener.document).val();
$(opener.location).attr("href", "/main.php#maillist%5E"+mbox+"%5E"+page+"%5E"+showtype+"%5E"+timestamp);
}
}
window.close();
} else {
var xmldata = $(xml).find("DATA");
var xmldata_quota = xmldata.find("QUOTA");
var mail_allot_quota = $.URLDecode(xmldata_quota.find("USER_QUOTA").text());
var mail_used_quota = $.URLDecode(xmldata_quota.find("MAIL_QUOTA").text());
var mail_used_percent = $.URLDecode(xmldata_quota.find("MAIL_PERCENT").text());
$("#mail-allot-quota").html(mail_allot_quota);
$("#mail-used-quota").html(mail_used_quota);
$("#mail-quota-bar").css("width", mail_used_percent+"%");
var page = $("#page").val();
LayerOpen("close", "");
if($("#hash").val() == "maillist") {
maillist_Init();
} else {
var timestamp = tstamp();
$.history.load("maillist^"+mbox+"^"+page+"^"+showtype+"^"+timestamp);
}
showMaillistBtn("hide");
menuMailCountInit();
}
},
error: function(e) {
popupModal(LANGUAGE[147][LANGTYPE]);
}
});
}
function mailview_Init() {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var mbox = $.URLDecode($("#mbox").val());
var msgid = $("#msgid").val();
var html = "";
var search_content = $("#scontent").val();
var search_type = $("#stype").val();
var showtype = $("#showtype").val();
var command = $("#scommand").val();
var pagecode = $("#pagecode").val();
$("#resend_btn").removeClass("show");
$("#resend_btn").removeClass("hide");
$("#reserve_btn").removeClass("show");
$("#reserve_btn").removeClass("hide");
$("#reply_btn").removeClass("show");
$("#reply_btn").removeClass("hide");
$("#replyall_btn").removeClass("show");
$("#replyall_btn").removeClass("hide");
$("#forward_btn").removeClass("show");
$("#forward_btn").removeClass("hide");
$("#deletemail_btn").removeClass("show");
$("#deletemail_btn").removeClass("hide");
$("#addspam_btn").removeClass("show");
$("#addspam_btn").removeClass("hide");
$("#addwhite_btn").removeClass("show");
$("#addwhite_btn").removeClass("hide");
$("#movemail_btn").removeClass("show");
$("#movemail_btn").removeClass("hide");
$("#mailview_addfunction").removeClass("show");
$("#mailview_addfunction").removeClass("hide");
$("#mailview_addfunction2").removeClass("show");
$("#mailview_addfunction2").removeClass("hide");
if(mbox=="Sent") {
$("#resend_btn").addClass("show");
$("#reply_btn").addClass("show");
$("#replyall_btn").addClass("show");
$("#forward_btn").addClass("show");
$("#deletemail_btn").addClass("show");
$("#addspam_btn").addClass("show");
$("#addwhite_btn").addClass("hide");
$("#movemail_btn").addClass("show");
$("#mailview_addfunction").addClass("show");
$("#reserve_btn").addClass("hide");
$("#mailview_addfunction2").addClass("hide");
}
else if(mbox=="Reserved") {
$("#reserve_btn").addClass("show");
$("#forward_btn").addClass("show");
$("#deletemail_btn").addClass("show");
$("#mailview_addfunction2").addClass("show");
$("#resend_btn").addClass("hide");
$("#reply_btn").addClass("hide");
$("#replyall_btn").addClass("hide");
$("#addspam_btn").addClass("hide");
$("#addwhite_btn").addClass("hide");
$("#movemail_btn").addClass("hide");
$("#mailview_addfunction").addClass("hide");
}
else if(mbox=="Spam") {
$("#reply_btn").addClass("show");
$("#replyall_btn").addClass("show");
$("#forward_btn").addClass("show");
$("#deletemail_btn").addClass("show");
$("#movemail_btn").addClass("show");
$("#mailview_addfunction").addClass("show");
$("#addspam_btn").addClass("hide");
$("#addwhite_btn").addClass("show");
$("#resend_btn").addClass("hide");
$("#reserve_btn").addClass("hide");
$("#mailview_addfunction2").addClass("hide");
}
else {
$("#reply_btn").addClass("show");
$("#replyall_btn").addClass("show");
$("#forward_btn").addClass("show");
$("#deletemail_btn").addClass("show");
$("#addspam_btn").addClass("show");
$("#addwhite_btn").addClass("hide");
$("#movemail_btn").addClass("show");
$("#mailview_addfunction").addClass("show");
$("#resend_btn").addClass("hide");
$("#reserve_btn").addClass("hide");
$("#mailview_addfunction2").addClass("hide");
}
var viewheader = $("#viewheader").val();
var ajaxdata = "mbox="+encodeURIComponent(mbox)+"&msgid="+msgid+"&search_type="+search_type+"&search_content="+$.URLEncode(search_content)+"&showtype="+showtype+"&command="+command;
var ajaxurl = "/module/mailview.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
$("#search_content").val(search_content);
if(search_content=="") search_type = "SUBJECT";
$("#search_type").val(search_type);
LayerOpen("open", "");
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:true,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
var msgid = $("#msgid").val();
var chk_hidden = "";
if(result=="SUCCESS") {
// 메일함 이름
var mailboxkoname = $.URLDecode(xmldata.find("MAILBOXNAME").text());
var boxname = $.URLDecode(xmldata.find("BOXNAME").text());
var boxcountid = $.URLDecode(xmldata.find("BOXCOUNTID").text());
var boxnameid = boxcountid.replace(/\./g, "_");
boxnameid = boxnameid.replace(/\,/g, "_");
boxnameid = boxnameid.replace(/\ /g, "_");
boxnameid = boxnameid.replace(/\(/gi, "BRACKET_");
boxnameid = boxnameid.replace(/\)/gi, "_BRACKET");
boxnameid = boxnameid.replace(/\+/gi, "__PLUS__");
$("#mailbox_title").html(mailboxkoname);
// 안읽은메일 갯수/전체메일 갯수
var total_count = xmldata.find("TOTAL_COUNT").text();
var unseen_count = xmldata.find("UNSEEN_COUNT").text();
$("#total_count").text(total_count);
$("#unseen_count").text(unseen_count);
//$("#COUNT_"+boxnameid).text(unseen_count);
if(unseen_count!=0) $("#COUNT_"+boxnameid).html(unseen_count);
else $("#COUNT_"+boxnameid).html("");
var starstate = xmldata.find("STARSTATE").text();
chk_hidden += msgid+"_N_S_";
if(starstate=="X") {
$("#mail_headers").addClass("starred");
chk_hidden += "X";
}
/* 메일 본문 시작 */
// 날짜
var datetime = $.URLDecode(xmldata.find("DATETIME").text());
$("#mailheader_date").html(datetime);
$("#print_datetime").val(datetime);
// Starred 설정
$("#mailheader_starred").attr("href", "javascript:setStarFlag2('"+msgid+"', 'none');");
$("#mail_headers").append("
");
// 제목
var subject = $.URLDecode(xmldata.find("SUBJECT").text());
var popup_view = "
";
$("#mailheader_subject").html(subject);
$("#mailheader_popupview").html(popup_view);
$("#print_subject").val(subject);
// Message-ID
var message_id = $.URLDecode(xmldata.find("MESSAGE_ID").text());
$("#message_id").val("");
if(message_id!=undefined) {
$("#message_id").val(message_id);
}
// 보낸사람
var sender_name = $.URLDecode(xmldata.find("SENDER").find("SNAME").text());
var sender_email = xmldata.find("SENDER").find("SEMAIL").text();
var sender_html = $.URLDecode(xmldata.find("SENDER").find("SENDER_HTML").text());
var sender_html_layer = $.URLDecode(xmldata.find("SENDER").find("SENDER_HTML_LAYER").text());
$("#mailheader_sender").html(sender_html);
$("#print_sender").val(sender_html_layer);
// 수신인
var to_html = $.URLDecode(xmldata.find("TO_HTML").text());
var cc_html = $.URLDecode(xmldata.find("CC_HTML").text());
var bcc_html = $.URLDecode(xmldata.find("BCC_HTML").text());
var to_html_all = $.URLDecode(xmldata.find("TO_HTML_ALL").text());
var cc_html_all = $.URLDecode(xmldata.find("CC_HTML_ALL").text());
var bcc_html_all = $.URLDecode(xmldata.find("BCC_HTML_ALL").text());
var print_to = $.URLDecode(xmldata.find("PRINT_TO").text());
var print_cc = $.URLDecode(xmldata.find("PRINT_CC").text());
var print_bcc = $.URLDecode(xmldata.find("PRINT_BCC").text());
$("#to_html").val(to_html);
$("#to_html_all").val(to_html_all);
$("#cc_html").val(cc_html);
$("#cc_html_all").val(cc_html_all);
$("#bcc_html").val(bcc_html);
$("#bcc_html_all").val(bcc_html_all);
$("#mailheader_to").html(to_html);
$("#print_to").val(print_to);
if(cc_html) {
$("#mailheader_cc").html(cc_html);
$("#mailheader_cc_dl").css("display", "block");
$("#print_cc").val(print_cc);
}
if(bcc_html && (mbox == "Sent" || mbox == "Reserved" || mbox == "Drafts")) {
$("#mailheader_bcc").html(bcc_html);
$("#mailheader_bcc_dl").css("display", "block");
$("#print_bcc").val(print_bcc);
}
$('#mailheader_to a').tooltip();
$('#mailheader_cc a').tooltip();
$('#mailheader_bcc a').tooltip();
// 메일전달 정보
var forward_email = $.URLDecode(xmldata.find("FORWARD_EMAIL").text());
var sender_check = $.URLDecode(xmldata.find("SENDER_CHECK").text());
if(forward_email!="NONE" && mbox!="Reserved") {
$("#mailheader_info_title").html(" ");
$("#mailheader_info").html(sprintf(LANGUAGE[148][LANGTYPE], forward_email));
$("#mailheader_info_dl").removeClass("hide");
$("#mailheader_info_dl").addClass("show");
}
else if(sender_check!="NONE" && mbox!="Reserved" && mbox!="Sent") {
$("#mailheader_info_title").html(" ");
$("#mailheader_info").html(sender_check);
$("#mailheader_info_dl").removeClass("hide");
$("#mailheader_info_dl").addClass("show");
}
// 예약발송 정보
var reservemail_code = "";
if(mbox=="Reserved") {
var reservemail_date = $.URLDecode(xmldata.find("RESERVE_DATE").text());
var reservemail_status = $.URLDecode(xmldata.find("RESERVE_STATUS").text());
reservemail_code = $.URLDecode(xmldata.find("RESERVE_CODE").text());
$("#mailheader_info_title").html(LANGUAGE[149][LANGTYPE]);
$("#mailheader_info").html(LANGUAGE[150][LANGTYPE]+" :
"+reservemail_date+" | "+LANGUAGE[151][LANGTYPE]+" :
"+reservemail_status+" ");
$("#mailheader_info_dl").removeClass("hide");
$("#mailheader_info_dl").addClass("show");
if(reservemail_code!="N") {
$("#reserve_btn").removeClass("show");
$("#reserve_btn").addClass("hide");
}
}
$("#reservemail_code").val(reservemail_code);
// 본문
var content = $.URLDecode(xmldata.find("CONTENT").text());
var print_content = $.URLDecode(xmldata.find("PRINT_CONTENT").text());
$("#mail_contents").html(content);
$("#print_mail_message").val($.URLEncode(print_content));
var attach_cnt = xmldata.find("ATTACH").find("ROW").length;
if(attach_cnt > 0) {
$("#attach_box").css("display", "");
var ms_tnef_check = xmldata.find("MS_TNEF_CHECK").text();
var ms_ics_check = xmldata.find("MS_ICS_CHECK").text();
if(ms_tnef_check=="TRUE") {
$("#attachfile_info_text").html(LANGUAGE[839][LANGTYPE]);
$("#attachfile_info").removeClass("hide");
$("#attachfile_info").addClass("show");
} else if(ms_ics_check=="TRUE") {
$("#attachfile_info_text").html(LANGUAGE[850][LANGTYPE]);
$("#attachfile_info").removeClass("hide");
$("#attachfile_info").addClass("show");
}
}
$("#total_att_count").text(attach_cnt+LANGUAGE[152][LANGTYPE]);
//$("#print_total_att_count").val(attach_cnt);
var total_size = xmldata.find("ATTACH").find("TOTAL_SIZE").text();
if(total_size > 1024) {
total_size = total_size/1024;
total_size = "("+total_size.toFixed(1) + "MB)";
} else {
total_size = "("+total_size+"KB)";
}
$("#total_att_size").text(total_size);
$("#print_total_att_size").val(total_size);
var downloadlist = $.URLDecode(xmldata.find("ATTACH").find("DOWNLOADLIST").text());
var print_downloadlist = $.URLDecode(xmldata.find("ATTACH").find("PRINT_DOWNLOADLIST").text());
var saveall = $.URLDecode(xmldata.find("ATTACH").find("SAVEALL").text());
$("#saveall").html(saveall);
$("#attachfile").html(downloadlist);
$("#print_attachfile").html(print_downloadlist);
var list_html = "";
var next_list = xmldata.find("NEXT_LIST");
if(next_list.length > 0) {
var next_msgno = next_list.find("NEXT_MSGNO").text();
var next_subject = $.URLDecode(next_list.find("NEXT_SUBJECT").text());
var next_sender_name = $.URLDecode(next_list.find("NEXT_SENDER").find("NEXT_SENDER_NAME").text());
var next_sender_all = $.URLDecode(next_list.find("NEXT_SENDER").find("NEXT_SENDER_ALL").text());
var next_date = $.URLDecode(next_list.find("NEXT_DATE").text());
var next_status = next_list.find("NEXT_STATUS").text();
var next_starred = next_list.find("NEXT_STARSTATE").text();
var chk_hidden = next_msgno+"_N_";
var mail_icon = "";
list_html += "
";
list_html += " ";
list_html += "
";
list_html += "
";
list_html += " ";
list_html += " "+next_sender_name+"
";
list_html += "
";
list_html += " "+next_subject+"
";
list_html += "
";
list_html += " "+next_date+"
";
list_html += " ";
$("#mailview_list_up").html("
"+LANGUAGE[198][LANGTYPE]+"");
} else {
$("#mailview_list_up").html("
"+LANGUAGE[198][LANGTYPE]);
}
var prev_list = xmldata.find("PREV_LIST");
if(prev_list.length > 0) {
var prev_msgno = prev_list.find("PREV_MSGNO").text();
var prev_subject = $.URLDecode(prev_list.find("PREV_SUBJECT").text());
var prev_sender_name = $.URLDecode(prev_list.find("PREV_SENDER").find("PREV_SENDER_NAME").text());
var prev_sender_all = $.URLDecode(prev_list.find("PREV_SENDER").find("PREV_SENDER_ALL").text());
var prev_date = $.URLDecode(prev_list.find("PREV_DATE").text());
var prev_status = prev_list.find("PREV_STATUS").text();
var prev_starred = prev_list.find("PREV_STARSTATE").text();
var chk_hidden = next_msgno+"_N_";
var mail_icon = "";
list_html += "
";
list_html += " ";
list_html += "
";
list_html += "
";
list_html += " ";
list_html += " "+prev_sender_name+"
";
list_html += "
";
list_html += " "+prev_subject+"
";
list_html += "
";
list_html += " "+prev_date+"
";
list_html += " ";
$("#mailview_list_down").html("
"+LANGUAGE[199][LANGTYPE]+" ");
} else {
$("#mailview_list_down").html(LANGUAGE[199][LANGTYPE]+"
");
}
if(list_html!="") {
list_html = "
";
}
if(pagecode!="mailview_unseen") {
$("#maillist").html(list_html);
}
//alert($("#mail_contents").css("width"));
LayerOpen("close", "");
if(viewheader=="1") {
showMailinfo();
}
} else {
LayerOpen("close", "");
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
} else {
popupModal(message);
}
}
},
error: function(e) {
LayerOpen("close", "");
popupModal(LANGUAGE[153][LANGTYPE]);
}
});
LayerOpen("close","");
}
function mailviewPopup_Init() {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
//2022-03-14//var mbox = $.URLDecode($("#mbox").val());
var mbox = decodeURIComponent($("#mbox").val());
var msgid = $("#msgid").val();
var html = "";
var search_content = $("#scontent").val();
$("#search_content").val(search_content);
$("#resend_btn").removeClass("show");
$("#resend_btn").removeClass("hide");
$("#reserve_btn").removeClass("show");
$("#reserve_btn").removeClass("hide");
$("#reply_btn").removeClass("show");
$("#reply_btn").removeClass("hide");
$("#replyall_btn").removeClass("show");
$("#replyall_btn").removeClass("hide");
$("#forward_btn").removeClass("show");
$("#forward_btn").removeClass("hide");
$("#deletemail_btn").removeClass("show");
$("#deletemail_btn").removeClass("hide");
$("#addspam_btn").removeClass("show");
$("#addspam_btn").removeClass("hide");
$("#addwhite_btn").removeClass("show");
$("#addwhite_btn").removeClass("hide");
$("#movemail_btn").removeClass("show");
$("#movemail_btn").removeClass("hide");
$("#mailview_addfunction").removeClass("show");
$("#mailview_addfunction").removeClass("hide");
$("#mailview_addfunction2").removeClass("show");
$("#mailview_addfunction2").removeClass("hide");
if(mbox=="Sent") {
$("#resend_btn").addClass("show");
$("#reply_btn").addClass("show");
$("#replyall_btn").addClass("show");
$("#forward_btn").addClass("show");
$("#deletemail_btn").addClass("show");
$("#addspam_btn").addClass("show");
$("#addwhite_btn").addClass("hide");
$("#movemail_btn").addClass("show");
$("#mailview_addfunction").addClass("show");
$("#reserve_btn").addClass("hide");
$("#mailview_addfunction2").addClass("hide");
}
else if(mbox=="Reserved") {
$("#reserve_btn").addClass("show");
$("#forward_btn").addClass("show");
$("#deletemail_btn").addClass("show");
$("#mailview_addfunction2").addClass("show");
$("#resend_btn").addClass("hide");
$("#reply_btn").addClass("hide");
$("#replyall_btn").addClass("hide");
$("#addspam_btn").addClass("hide");
$("#addwhite_btn").addClass("hide");
$("#movemail_btn").addClass("hide");
$("#mailview_addfunction").addClass("hide");
}
else if(mbox=="Spam") {
$("#reply_btn").addClass("show");
$("#replyall_btn").addClass("show");
$("#forward_btn").addClass("show");
$("#deletemail_btn").addClass("show");
$("#movemail_btn").addClass("show");
$("#mailview_addfunction").addClass("show");
$("#addspam_btn").addClass("hide");
$("#addwhite_btn").addClass("show");
$("#resend_btn").addClass("hide");
$("#reserve_btn").addClass("hide");
$("#mailview_addfunction2").addClass("hide");
} else {
$("#reply_btn").addClass("show");
$("#replyall_btn").addClass("show");
$("#forward_btn").addClass("show");
$("#deletemail_btn").addClass("show");
$("#addspam_btn").addClass("show");
$("#addwhite_btn").addClass("hide");
$("#movemail_btn").addClass("show");
$("#mailview_addfunction").addClass("show");
$("#resend_btn").addClass("hide");
$("#reserve_btn").addClass("hide");
$("#mailview_addfunction2").addClass("hide");
}
var viewheader = $("#viewheader").val();
var ajaxdata = "mbox="+encodeURIComponent(mbox)+"&msgid="+msgid;
var ajaxurl = "/module/mailview.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open", "");
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:true,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
var msgid = $("#msgid").val();
var chk_hidden = "";
if(result=="SUCCESS") {
// 메일함 이름
var mailboxkoname = $.URLDecode(xmldata.find("MAILBOXNAME").text());
var boxname = $.URLDecode(xmldata.find("BOXNAME").text());
var boxcountid = $.URLDecode(xmldata.find("BOXCOUNTID").text());
var boxnameid = boxcountid.replace(/\./g, "_");
boxnameid = boxnameid.replace(/\,/g, "_");
boxnameid = boxnameid.replace(/\ /g, "_");
boxnameid = boxnameid.replace(/\(/gi, "BRACKET_");
boxnameid = boxnameid.replace(/\)/gi, "_BRACKET");
boxnameid = boxnameid.replace(/\+/gi, "__PLUS__");
//2018-01-29//$("#mailbox_title").html(mailboxkoname);
// 안읽은메일 갯수/전체메일 갯수
var total_count = xmldata.find("TOTAL_COUNT").text();
var unseen_count = xmldata.find("UNSEEN_COUNT").text();
/***2018-01-29
$("#total_count").text(total_count);
$("#unseen_count").text(unseen_count);
***/
//$("#COUNT_"+boxnameid).text(unseen_count);
if(unseen_count!=0) $("#COUNT_"+boxnameid, opener.document).html(unseen_count);
else $("#COUNT_"+boxnameid, opener.document).html("");
var starstate = xmldata.find("STARSTATE").text();
chk_hidden += msgid+"_N_S_";
if(starstate=="X") {
$("#mail_headers").addClass("starred");
chk_hidden += "X";
}
/* 메일 본문 시작 */
// 날짜
var datetime = $.URLDecode(xmldata.find("DATETIME").text());
$("#mailheader_date").html(datetime);
$("#print_datetime").val(datetime);
// Starred 설정
$("#mailheader_starred").attr("href", "javascript:setStarFlag2('"+msgid+"', 'none');");
$("#mail_headers").append("
");
// 제목
var subject = $.URLDecode(xmldata.find("SUBJECT").text());
$("#mailheader_subject").html(subject);
$("#print_subject").val(subject);
// Message-ID
var message_id = $.URLDecode(xmldata.find("MESSAGE_ID").text());
$("#message_id").val("");
if(message_id!=undefined) {
$("#message_id").val(message_id);
}
// 보낸사람
var sender_name = $.URLDecode(xmldata.find("SENDER").find("SNAME").text());
var sender_email = xmldata.find("SENDER").find("SEMAIL").text();
var sender_html = $.URLDecode(xmldata.find("SENDER").find("SENDER_HTML").text());
var sender_html_layer = $.URLDecode(xmldata.find("SENDER").find("SENDER_HTML_LAYER").text());
$("#mailheader_sender").html(sender_html);
$("#print_sender").val(sender_html_layer);
// 수신인
var to_html = $.URLDecode(xmldata.find("TO_HTML").text());
var cc_html = $.URLDecode(xmldata.find("CC_HTML").text());
var bcc_html = $.URLDecode(xmldata.find("BCC_HTML").text());
var to_html_all = $.URLDecode(xmldata.find("TO_HTML_ALL").text());
var cc_html_all = $.URLDecode(xmldata.find("CC_HTML_ALL").text());
var bcc_html_all = $.URLDecode(xmldata.find("BCC_HTML_ALL").text());
var print_to = $.URLDecode(xmldata.find("PRINT_TO").text());
var print_cc = $.URLDecode(xmldata.find("PRINT_CC").text());
var print_bcc = $.URLDecode(xmldata.find("PRINT_BCC").text());
$("#mailheader_to").html(to_html);
$("#print_to").val(print_to);
if(cc_html) {
$("#mailheader_cc").html(cc_html);
$("#mailheader_cc_dl").css("display", "block");
$("#print_cc").val(print_cc);
}
if(bcc_html && (mbox == "Sent" || mbox == "Reserved" || mbox == "Drafts")) {
$("#mailheader_bcc").html(bcc_html);
$("#mailheader_bcc_dl").css("display", "block");
$("#print_bcc").val(print_bcc);
}
$('#mailheader_to a').tooltip();
$('#mailheader_cc a').tooltip();
$('#mailheader_bcc a').tooltip();
// 메일전달 정보
var forward_email = $.URLDecode(xmldata.find("FORWARD_EMAIL").text());
var sender_check = $.URLDecode(xmldata.find("SENDER_CHECK").text());
if(forward_email!="NONE" && mbox!="Reserved") {
$("#mailheader_info_title").html(" ");
$("#mailheader_info").html(sprintf(LANGUAGE[148][LANGTYPE], forward_email));
$("#mailheader_info_dl").removeClass("hide");
$("#mailheader_info_dl").addClass("show");
}
else if(sender_check!="NONE" && mbox!="Reserved" && mbox!="Sent") {
$("#mailheader_info_title").html(" ");
$("#mailheader_info").html(sender_check);
$("#mailheader_info_dl").removeClass("hide");
$("#mailheader_info_dl").addClass("show");
}
// 예약발송 정보
var reservemail_code = "";
if(mbox=="Reserved") {
var reservemail_date = $.URLDecode(xmldata.find("RESERVE_DATE").text());
var reservemail_status = $.URLDecode(xmldata.find("RESERVE_STATUS").text());
reservemail_code = $.URLDecode(xmldata.find("RESERVE_CODE").text());
$("#mailheader_info_title").html(LANGUAGE[149][LANGTYPE]);
$("#mailheader_info").html(LANGUAGE[150][LANGTYPE]+" :
"+reservemail_date+" | "+LANGUAGE[151][LANGTYPE]+" :
"+reservemail_status+" ");
$("#mailheader_info_dl").removeClass("hide");
$("#mailheader_info_dl").addClass("show");
if(reservemail_code!="N") {
$("#reserve_btn").removeClass("show");
$("#reserve_btn").addClass("hide");
}
}
$("#reservemail_code").val(reservemail_code);
// 본문
var content = $.URLDecode(xmldata.find("CONTENT").text());
$("#mail_contents").html(content);
$("#print_mail_message").val($.URLEncode(content));
var attach_cnt = xmldata.find("ATTACH").find("ROW").length;
if(attach_cnt > 0) {
$("#attach_box").css("display", "");
var ms_tnef_check = xmldata.find("MS_TNEF_CHECK").text();
var ms_ics_check = xmldata.find("MS_ICS_CHECK").text();
if(ms_tnef_check=="TRUE") {
$("#attachfile_info_text").html(LANGUAGE[836][LANGTYPE]);
$("#attachfile_info").removeClass("hide");
$("#attachfile_info").addClass("show");
} else if(ms_ics_check=="TRUE") {
$("#attachfile_info_text").html(LANGUAGE[850][LANGTYPE]);
$("#attachfile_info").removeClass("hide");
$("#attachfile_info").addClass("show");
}
}
$("#total_att_count").text(attach_cnt+""+LANGUAGE[152][LANGTYPE]);
//$("#print_total_att_count").val(attach_cnt);
var total_size = xmldata.find("ATTACH").find("TOTAL_SIZE").text();
if(total_size > 1024) {
total_size = total_size/1024;
total_size = "("+total_size.toFixed(1) + "MB)";
} else {
total_size = "("+total_size+"KB)";
}
$("#total_att_size").text(total_size);
$("#print_total_att_size").val(total_size);
var downloadlist = $.URLDecode(xmldata.find("ATTACH").find("DOWNLOADLIST").text());
var print_downloadlist = $.URLDecode(xmldata.find("ATTACH").find("PRINT_DOWNLOADLIST").text());
var saveall = $.URLDecode(xmldata.find("ATTACH").find("SAVEALL").text());
$("#saveall").html(saveall);
$("#attachfile").html(downloadlist);
$("#print_attachfile").html(print_downloadlist);
/***
var list_html = "";
var next_list = xmldata.find("NEXT_LIST");
if(next_list.length > 0) {
var next_msgno = next_list.find("NEXT_MSGNO").text();
var next_subject = $.URLDecode(next_list.find("NEXT_SUBJECT").text());
var next_sender_name = $.URLDecode(next_list.find("NEXT_SENDER").find("NEXT_SENDER_NAME").text());
var next_sender_all = $.URLDecode(next_list.find("NEXT_SENDER").find("NEXT_SENDER_ALL").text());
var next_date = $.URLDecode(next_list.find("NEXT_DATE").text());
var next_status = next_list.find("NEXT_STATUS").text();
var next_starred = next_list.find("NEXT_STARSTATE").text();
var chk_hidden = next_msgno+"_N_";
var mail_icon = "";
list_html += "
";
list_html += " ";
list_html += "
";
list_html += "
";
list_html += " ";
list_html += " "+next_sender_name+"
";
list_html += "
";
list_html += " "+next_subject+"
";
list_html += "
";
list_html += " "+next_date+"
";
list_html += " ";
$("#mailview_list_up").html("
위");
} else {
$("#mailview_list_up").html("
위");
}
var prev_list = xmldata.find("PREV_LIST");
if(prev_list.length > 0) {
var prev_msgno = prev_list.find("PREV_MSGNO").text();
var prev_subject = $.URLDecode(prev_list.find("PREV_SUBJECT").text());
var prev_sender_name = $.URLDecode(prev_list.find("PREV_SENDER").find("PREV_SENDER_NAME").text());
var prev_sender_all = $.URLDecode(prev_list.find("PREV_SENDER").find("PREV_SENDER_ALL").text());
var prev_date = $.URLDecode(prev_list.find("PREV_DATE").text());
var prev_status = prev_list.find("PREV_STATUS").text();
var prev_starred = prev_list.find("PREV_STARSTATE").text();
var chk_hidden = next_msgno+"_N_";
var mail_icon = "";
list_html += "
";
list_html += " ";
list_html += "
";
list_html += "
";
list_html += " ";
list_html += " ";
list_html += "
";
list_html += " "+prev_subject+"
";
list_html += "
";
list_html += " "+prev_date+"
";
list_html += " ";
$("#mailview_list_down").html("
아래 ");
} else {
$("#mailview_list_down").html("아래
");
}
if(list_html!="") {
list_html = "
";
}
$("#maillist").html(list_html);
***/
//alert($("#mail_contents").css("width"));
if(viewheader=="1") {
showMailinfo();
}
} else {
LayerOpen("close", "");
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
} else {
popupModal(message);
}
}
},
error: function(e) {
popupModal(LANGUAGE[153][LANGTYPE]);
}
});
LayerOpen("close","");
}
// 메일리스트 간편보기
function mailSimpleLoad(muid) {
var offset = $("#mailuid_"+muid).offset();
var id = $("#preview_muid").val();
if(muid!=id) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var chk = $("input:checkbox[name='muid[]']");
var msgid = chk[muid].value;
var mbox = $.URLDecode($("#mbox").val());
var html = "";
var ajaxdata = "mbox="+encodeURIComponent(mbox)+"&msgid="+msgid;
var ajaxurl = "/module/mailsimpleview.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:true,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
// 본문
var content = $.URLDecode(xmldata.find("CONTENT").text());
$("#mail_simple_preview").text(content);
$("#preview_muid").val(muid);
$("#mail_simple_load_box").css("top", offset.top + 30);
$("#mail_simple_load_box").removeClass("uplus-box-hide");
$("#mail_simple_load_box").addClass("uplus-box-show");
} else {
LayerOpen("close", "");
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
} else {
popupModal(message);
}
}
},
error: function(e) {
popupModal(LANGUAGE[153][LANGTYPE]);
}
});
} else {
if($("#mail_simple_load_box").css("display")=="none") {
$("#preview_muid").val(muid);
$("#mail_simple_load_box").css("top", offset.top + 30);
$("#mail_simple_load_box").removeClass("uplus-box-hide");
$("#mail_simple_load_box").addClass("uplus-box-show");
} else {
$("#mail_simple_load_box").removeClass("uplus-box-show");
$("#mail_simple_load_box").addClass("uplus-box-hide");
}
}
}
// 읽지않은 메일 리스트 간편보기
function mailSimpleLoad_unseen(mbox, muid) {
var offset = $("#mailuid_"+muid).offset();
var id = $("#preview_muid").val();
if(muid!=id) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var chk = $("input:checkbox[name='muid[]']");
var msgid = chk[muid].value;
var mbox = $.URLDecode(mbox);
var html = "";
var ajaxdata = "mbox="+encodeURIComponent(mbox)+"&msgid="+msgid;
var ajaxurl = "/module/mailsimpleview.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
$.ajax({
type:"POST",
url: ajaxurl,
data: ajaxdata,
dataType:"xml",
cache:true,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
// 본문
var content = $.URLDecode(xmldata.find("CONTENT").text());
$("#mail_simple_preview").text(content);
$("#preview_muid").val(muid);
$("#mail_simple_load_box").css("top", offset.top + 30);
$("#mail_simple_load_box").removeClass("uplus-box-hide");
$("#mail_simple_load_box").addClass("uplus-box-show");
} else {
LayerOpen("close", "");
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
} else {
popupModal(message);
}
}
},
error: function(e) {
popupModal(LANGUAGE[153][LANGTYPE]);
}
});
} else {
if($("#mail_simple_load_box").css("display")=="none") {
$("#preview_muid").val(muid);
$("#mail_simple_load_box").css("top", offset.top + 30);
$("#mail_simple_load_box").removeClass("uplus-box-hide");
$("#mail_simple_load_box").addClass("uplus-box-show");
} else {
$("#mail_simple_load_box").removeClass("uplus-box-show");
$("#mail_simple_load_box").addClass("uplus-box-hide");
}
}
}
// 메일리스트 간편보기 HIDE
function mailSimpleLoadHide() {
if($("#mail_simple_load_box").css("display")!="none") {
$("#mail_simple_load_box").removeClass("uplus-box-show");
$("#mail_simple_load_box").addClass("uplus-box-hide");
}
}
function attach_upload() {
var agt = navigator.userAgent.toLowerCase();
if(agt.indexOf("msie") != -1) {
var form = document.composeForm;
$("#attach_uploading").val("1");
$.ajaxFileUpload ({
url:"/module/upload_attachfile.php",
secureurl:false,
fileElementId:"fileselect",
dataType:"json",
data:{name:"frm", id:"frm"},
success: function (data, status) {
if(typeof(data.error) != 'undefined') {
if(data.error != '') {
$("#attach_uploading").val("0");
alert(data.error);
} else {
$("#attach_uploading").val("0");
var filename = decodeURIComponent(data.filename);
var filesize = data.filesize;
var filesize_org = filesize;
var filedir = data.attach_dir;
var fileattachtype = data.fileattachtype;
var en_filename = data.en_filename;
var filetype = data.filetype;
var fileattachtype_html = "";
var fileattachtype_change = "";
var attachcount = $("input[name='mail_f']").length;
var attach_total_count = parseInt($("#attach_total_count").val());
attach_total_count++;
$("#attach_total_count").val(attach_total_count);
if(filesize > 1024) {
filesize = parseInt(filesize / 1024);
if(filesize > 1024) {
filesize = parseInt(filesize / 1024);
if(filesize > 1024) {
filesize = parseInt(filesize / 1024)+"GB";
} else {
filesize += "MB";
}
} else {
filesize += "KB";
}
} else {
filesize += "B";
}
if(fileattachtype == "NORMAL") {
fileattachtype_html = LANGUAGE[155][LANGTYPE];
fileattachtype_change = "
";
} else {
fileattachtype_html = LANGUAGE[156][LANGTYPE];
}
var attach_html =
"
"+
" "+
" "+filename+"
"+
" "+filesize+"
"+
" "+
" "+fileattachtype_html+" "+fileattachtype_change+"
"+
" "+
" "+
" "+
" "+
" "+
" "+
" ";
$("#attachfile_list").append(attach_html);
$("#messages").css("display","none");
$("#attachfile_box").css("display", "");
}
}
}
})
}
}
/***
function mailSignChange(n) {
}
***/
function popupReceiver(checkTab) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var receiver_form_type = $("#receiver_form_type").val();
var ajaxdata = "command=popupview";
var ajaxurl = "/module/orgtree.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
$.ajax({
type:"POST",
url:ajaxurl,
data:ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
$("#popupUserOrgData").val($.URLDecode(xmldata.find("ORGDATA1").text()));
$("#popupUserAddrData").val($.URLDecode(xmldata.find("ADDRBOOKDATA").text()));
var orgdata = JSON.parse($.URLDecode(xmldata.find("ORGDATA1").text()));
var addrdata = JSON.parse($.URLDecode(xmldata.find("ADDRBOOKDATA").text()));
var recentdata = JSON.parse($("#recentlist_data").val());
var organizationObj;
var addrbookObj;
var setting1 = {
data: {
simpleData: {
enable: true
}
},
callback: {
onClick: popupReceiverAddOrg
}
};
var setting2 = {
data: {
simpleData: {
enable: true
}
},
callback: {
onClick: popupReceiverAddAddr
}
};
var orgNodes = orgdata;
var addrNodes = addrdata;
if($("#orgchart").val()=="Y" && $("#orgchart_addressbook").val()=="Y") {
organizationObj = $.fn.zTree.init($("#popup_orgtree_box"), setting1, orgNodes);
}
addrbookObj = $.fn.zTree.init($("#popup_addrtree_box"), setting2, addrNodes);
var receiver_to_html = "";
if(receiver_form_type=="INPUT") {
var receiver_to = $("input:hidden[name='mail-to_receiver[]']");
receiver_to.each(function() {
var email_val = this.value;
var email_text = email_val.replace(//g,'>');
receiver_to_html+= "
"+email_text+" ";
});
} else {
var optsize = $("#select-to option").size();
for(var i=0; i
/g,'>');
receiver_to_html+= ""+email_text+" ";
}
}
$("#select_receiverlist_to").html(receiver_to_html);
var receiver_cc_html = "";
if(receiver_form_type=="INPUT") {
var receiver_cc = $("input:hidden[name='mail-cc_receiver[]']");
receiver_cc.each(function() {
var email_val = this.value;
var email_text = email_val.replace(//g,'>');
receiver_cc_html+= ""+email_text+" ";
});
} else {
var optsize = $("#select-cc option").size();
for(var i=0; i/g,'>');
receiver_cc_html+= ""+email_text+" ";
}
}
$("#select_receiverlist_cc").html(receiver_cc_html);
var receiver_bcc_html = "";
if(receiver_form_type=="INPUT") {
var receiver_bcc = $("input:hidden[name='mail-bcc_receiver[]']");
receiver_bcc.each(function() {
var email_val = this.value;
var email_text = email_val.replace(//g,'>');
receiver_bcc_html+= ""+email_text+" ";
});
} else {
var optsize = $("#select-bcc option").size();
for(var i=0; i/g,'>');
receiver_bcc_html+= ""+email_text+" ";
}
}
$("#select_receiverlist_bcc").html(receiver_bcc_html);
$("#popup_receiver_to_li").removeClass("active");
$("#popup_receiver_cc_li").removeClass("active");
$("#popup_receiver_bcc_li").removeClass("active");
$("#popup_receiver_to").removeClass("active");
$("#popup_receiver_cc").removeClass("active");
$("#popup_receiver_bcc").removeClass("active");
if(checkTab=="to") {
$("#popup_receiver_to_li").addClass("active");
$("#popup_receiver_to").addClass("active");
}
if(checkTab=="cc") {
$("#popup_receiver_cc_li").addClass("active");
$("#popup_receiver_cc").addClass("active");
}
if(checkTab=="bcc") {
$("#popup_receiver_bcc_li").addClass("active");
$("#popup_receiver_bcc").addClass("active");
}
var select_recentlist_html = "";
if(recentdata.length>0) {
for(var i=0; i/g,'>');
select_recentlist_html += ""+recent_email+" ";
}
}
$("#select_recentlist").html(select_recentlist_html);
$("#popup_receiver").modal({backdrop: 'static', keyboard: false, toggle: true});
} else {
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
popupModal(message);
}
},
error: function(e) {
popupModal(LANGUAGE[13][LANGTYPE]+" "+LANGUAGE[14][LANGTYPE]);
}
});
}
function mailSend(mode) {
var command = $("#command").val();
var external_send_check = $("#externalSendCheck").val();
var external_mailsend_permit = $("#external_mailsend_permit").val();
var external_send = $("#external_send").val();
var receiver_form_type = $("#receiver_form_type").val();
//if(command=="SENDMAILME") mode = command;
if($("#attach_uploading").val() > 0) {
popupModal(LANGUAGE[157][LANGTYPE]);
return;
}
if($("#mailwrite_securityuse").attr("checked")) {
if($("#mailwrite_securitypass").val()=="") {
popupModal(LANGUAGE[158][LANGTYPE]);
return;
}
}
if($("#reserve_date").val()!="") {
mode = "RESERVEMAIL";
if($("#mailwrite_securityuse").is(":checked")==true) {
popupModal(LANGUAGE[159][LANGTYPE], "400");
return;
}
//popupModal('메일 예약발송은 현재 서비스 준비중입니다.')
//return;
}
if(receiver_form_type=="INPUT") {
if($("#mail-to").val()=="" && mode!="DRAFTS") {
popupModal(LANGUAGE[160][LANGTYPE]);
return;
}
} else {
if($("#select-to option").size() < 1 && mode!="DRAFTS" && command!="SENDMAILME") {
popupModal(LANGUAGE[160][LANGTYPE]);
return;
}
}
if(mode!="DRAFTS" && mode!="SENDMAILME" && command!="SENDMAILME") {
if(external_send_check=="YES") {
var chk_receiver_to = "";
var chk_receiver_cc = "";
var chk_receiver_bcc = "";
if(receiver_form_type=="INPUT") {
$("input[name='mail-to_receiver[]']").each(function() {
if(chk_receiver_to!="") {
chk_receiver_to += "^||^"+$(this).val();
} else {
chk_receiver_to += $(this).val();
}
});
$("input[name='mail-cc_receiver[]']").each(function() {
if(chk_receiver_cc!="") {
chk_receiver_cc += "^||^"+$(this).val();
} else {
chk_receiver_cc += $(this).val();
}
});
$("input[name='mail-bcc_receiver[]']").each(function() {
if(chk_receiver_bcc!="") {
chk_receiver_bcc += "^||^"+$(this).val();
} else {
chk_receiver_bcc += $(this).val();
}
});
} else {
var optsize_to = $("#select-to option").size();
for(var i=0; i "+$("#loadingLayer2").css("display"));
if($("#loadingLayer2").css("display")!="none") {
//console.log("loadingLayer2 1=> display: "+$("#loadingLayer2").css("display"));
return;
}
LayerOpen2("open");
$.ajax({
type:"POST",
url:ajaxurl,
data:ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
var external_send_checkrslt = $.URLDecode(xmldata.find("EXTERNAL_SEND_CHECK").text());
var external_send_message = $.URLDecode(xmldata.find("EXTERNAL_SEND_MESSAGE").text());
if(result=="SUCCESS") {
if(external_send_checkrslt=="REMOTE" && external_send_message!=undefined && external_send_message!="") {
var check_message = ""+external_send_message+" "+LANGUAGE[161][LANGTYPE]+"
";
var boxclass = "bootbox-md";
} else {
var check_message = ""+LANGUAGE[161][LANGTYPE]+"
";
var boxclass = "bootbox-sm";
}
LayerOpen2("close");
bootbox.dialog({
message: check_message,
buttons: {
danger: {
label: LANGUAGE[114][LANGTYPE],
className: "btn-primary",
callback: function(e) {
e.preventDefault();
//console.log("mailSend ==> 1");
Sendmail(mode);
}
},
main: {
label: LANGUAGE[115][LANGTYPE],
className: "btn-default",
callback: function() {
return;
}
}
},
className: boxclass
});
} else {
LayerOpen2("close");
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
popupModal(message);
}
},
error: function(e) {
LayerOpen2("close");
popupModal(LANGUAGE[13][LANGTYPE]+" "+LANGUAGE[14][LANGTYPE]);
}
});
}
else if(external_mailsend_permit=="YES" && external_send=="N") {
var chk_receiver_to = "";
var chk_receiver_cc = "";
var chk_receiver_bcc = "";
if(receiver_form_type=="INPUT") {
$("input[name='mail-to_receiver[]']").each(function() {
if(chk_receiver_to!="") {
chk_receiver_to += "^||^"+$(this).val();
} else {
chk_receiver_to += $(this).val();
}
});
$("input[name='mail-cc_receiver[]']").each(function() {
if(chk_receiver_cc!="") {
chk_receiver_cc += "^||^"+$(this).val();
} else {
chk_receiver_cc += $(this).val();
}
});
$("input[name='mail-bcc_receiver[]']").each(function() {
if(chk_receiver_bcc!="") {
chk_receiver_bcc += "^||^"+$(this).val();
} else {
chk_receiver_bcc += $(this).val();
}
});
} else {
var optsize_to = $("#select-to option").size();
for(var i=0; i "+$("#loadingLayer2").css("display"));
if($("#loadingLayer2").css("display")!="none") {
//console.log("loadingLayer2 2=> display: "+$("#loadingLayer2").css("display"));
return;
}
LayerOpen2("open");
$.ajax({
type:"POST",
url:ajaxurl,
data:ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
LayerOpen2("close");
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
var external_send_checkrslt = $.URLDecode(xmldata.find("EXTERNAL_SEND_CHECK").text());
var external_send_message = $.URLDecode(xmldata.find("EXTERNAL_SEND_MESSAGE").text());
if(result=="SUCCESS") {
if(external_send_checkrslt=="REMOTE" && external_send_message!=undefined && external_send_message!="") {
var check_message = ""+external_send_message+"
";
var boxclass = "bootbox-md";
bootbox.dialog({
message: check_message,
buttons: {
danger: {
label: LANGUAGE[114][LANGTYPE],
className: "btn-primary",
callback: function() {
return;
}
}
},
className: boxclass
});
} else {
var check_message = ""+LANGUAGE[161][LANGTYPE]+"
";
var boxclass = "bootbox-sm";
bootbox.dialog({
message: check_message,
buttons: {
danger: {
label: LANGUAGE[114][LANGTYPE],
className: "btn-primary",
callback: function(e) {
e.preventDefault();
//console.log("mailSend ==> 2");
Sendmail(mode);
}
},
main: {
label: LANGUAGE[115][LANGTYPE],
className: "btn-default",
callback: function() {
return;
}
}
},
className: boxclass
});
}
} else {
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
popupModal(message);
}
},
error: function(e) {
LayerOpen2("close");
popupModal(LANGUAGE[13][LANGTYPE]+" "+LANGUAGE[14][LANGTYPE]);
}
});
}
else {
bootbox.dialog({
message: ""+LANGUAGE[161][LANGTYPE]+"
",
buttons: {
danger: {
label: LANGUAGE[114][LANGTYPE],
className: "btn-primary",
callback: function(e) {
e.preventDefault();
//console.log("mailSend ==> 3");
Sendmail(mode);
}
},
main: {
label: LANGUAGE[115][LANGTYPE],
className: "btn-default",
callback: function() {
return;
}
}
},
className: "bootbox-sm"
});
}
} else {
Sendmail(mode);
}
return;
}
// 메일발송
function Sendmail(mode) {
//console.log("Sendmail ==>");
LayerOpen2("open", LANGUAGE[162][LANGTYPE]);
var receiver_form_type = $("#receiver_form_type").val();
var mailbox = $("#mbox").val();
var contents = CrossEditor.GetBodyValue();
var contents_text = CrossEditor.GetTextValue();
$("#send_mode").val(mode);
$("#contents").val(contents);
$("#mailbox").val(mailbox);
$("#contents_text").val(contents_text);
$("#completeSubject").val("");
$("#completeToList").val("");
$("#completeCcList").val("");
$("#completeBccList").val("");
//첨부파일 하나의 hidden 값에 입력
var attach_total_count = $("#attach_total_count").val();
var attach_filename = "";
var attach_dir = "";
var attach_en_filename = "";
var attach_filetype = "";
var attach_fileattachtype = "";
$("input[name='tmp_attach_filename']").each(function() {
if($(this).val() != "") {
if(attach_filename == "") {
attach_filename = $(this).val();
} else {
attach_filename += "|"+$(this).val();
}
}
});
$("input[name='tmp_attach_dir']").each(function() {
if($(this).val() != "") {
if(attach_dir == "") {
attach_dir = $(this).val();
} else {
attach_dir += "|"+$(this).val();
}
}
});
$("input[name='tmp_attach_en_filename']").each(function() {
if($(this).val() != "") {
if(attach_en_filename == "") {
attach_en_filename = $(this).val();
} else {
attach_en_filename += "|"+$(this).val();
}
}
});
$("input[name='tmp_filetype']").each(function() {
if($(this).val() != "") {
if(attach_filetype == "") {
attach_filetype = $(this).val();
} else {
attach_filetype += "|"+$(this).val();
}
}
});
$("input[name='tmp_fileattachtype']").each(function() {
if($(this).val() != "") {
if(attach_fileattachtype == "") {
attach_fileattachtype = $(this).val();
} else {
attach_fileattachtype += "|"+$(this).val();
}
}
});
if(receiver_form_type=="SELECT") {
var optsize_to = $("#select-to option").size();
var chk_receiver_to = "";
for(var i=0; i 0) {
var i = 0;
xmldata.find("LIST").find("ROW").each(function() {
var idx = $(this).find("IDX").text();
var tolist = $.URLDecode($(this).find("TOLIST").text());
var subject = $.URLDecode($(this).find("SUBJECT").text());
var senddate = $.URLDecode($(this).find("SENDDATE").text());
var sendtime = $.URLDecode($(this).find("SENDTIME").text());
var receivetime = $.URLDecode($(this).find("RECEIVETIME").text());
var recv_count = $(this).find("RECV_COUNT").text();
var message_id = $.URLDecode(idx);
confirmhtml += '';
confirmhtml += '
';
confirmhtml += ' '+tolist+'
';
confirmhtml += ' '+subject+'
';
confirmhtml += ' '+senddate+'
';
confirmhtml += ' '+receivetime+'
';
confirmhtml += ' '+recv_count+'
';
confirmhtml += ' ';
i++;
});
} else {
var text = $.URLDecode(xmldata.find("MESSAGE").text());
confirmhtml += '';
confirmhtml += ' '+text+'
';
confirmhtml += ' ';
}
//document.getElementById("confirmlist").innerHTML = confirmhtml;
$("#confirmlist_body").html(confirmhtml);
var paging_html = $.URLDecode(xmldata.find("PAGING").text());
if(paging_html == "" || paging_html == undefined || paging_html == "undefined") {
$("#mail_page").html(null);
} else {
$("#mail_page").html(paging_html);
}
LayerOpen("close");
} else {
LayerOpen("close", "");
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
} else {
popupModal(message);
}
}
},
error: function(e) {
popupModal(LANGUAGE[166][LANGTYPE]);
}
});
}
// 수신확인 리스트 메일보기
function confirmMailView(senddate, messageid) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var ajaxdata = "mode=mailsearch&senddate="+senddate+"&messageid="+messageid;
var ajaxurl = "/module/confirmlist.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
$.ajax({
type:"POST",
url:ajaxurl,
data:ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
var msgno = xmldata.find("MSGNO").text();
var timestamp = tstamp();
var mbox = "Sent";
$.history.load("mailview^"+mbox+"^"+msgno+"^ALL^"+timestamp);
} else {
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
popupModal(message);
}
},
error: function(e) {
popupModal(LANGUAGE[167][LANGTYPE]);
}
});
}
// 수신확인 수신인 리스트
function confirm_emaillist(senddate, message_id) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var ajaxdata = "command=RECEIVERLIST&senddate="+senddate+"&message_id="+message_id;
var ajaxurl = "/module/confirm_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open");
$.ajax({
type:"POST",
url:ajaxurl,
data:ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
var html = "x
"+LANGUAGE[35][LANGTYPE]+" ";
html += ""+LANGUAGE[168][LANGTYPE]+":
";
html += "";
html += "
";
html += "
";
html += "
";
html += "
";
html += "
";
html += "
";
html += ""+LANGUAGE[171][LANGTYPE]+" "+LANGUAGE[172][LANGTYPE]+"
";
$("#popup_modal2_message").html(html);
$("#popup_modal2_div").css("width", "600px");
$("#popup_modal2").modal('toggle');
$('#confirmlist_layer').slimScroll({ height: 250, alwaysVisible: true, color: '#888',allowPageScroll: true });
LayerOpen("close");
} else {
LayerOpen("close");
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
} else {
popupModal(message);
}
}
},
error: function(e) {
LayerOpen("close");
popupModal(LANGUAGE[173][LANGTYPE]);
}
});
}
// 수신확인리스트 삭제
function deleteConfirmlist() {
var message_id = "";
$("input[name='confirm_chkbox']").each(function() {
if($(this).is(":checked")==true) {
message_id += $(this).val()+"|";
}
});
if(message_id=="") {
popupModal(LANGUAGE[174][LANGTYPE]);
return;
}
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var ajaxdata = "command=DELETELIST&message_id="+$.URLEncode(message_id);
var ajaxurl = "/module/confirm_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
bootbox.dialog({
message: LANGUAGE[175][LANGTYPE],
buttons: {
danger: {
label: LANGUAGE[97][LANGTYPE],
className: "btn-primary",
callback: function() {
LayerOpen("open");
$.ajax({
type:"POST",
url:ajaxurl,
data:ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
$("#confirmlist_btn_02").removeClass("uplus-maillist-btn-show");
$("#confirmlist_btn_02").addClass("uplus-maillist-btn-hide");
if(result!="SUCCESS") {
LayerOpen("close");
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
} else {
popupModal(message);
}
} else {
confirmlist();
}
},
error: function(e) {
LayerOpen("close");
popupModal(LANGUAGE[176][LANGTYPE]);
}
});
}
},
main: {
label: LANGUAGE[115][LANGTYPE],
className: "btn-default",
callback: function() {
}
}
},
className: "bootbox-sm"
});
}
// 수신확인 메일회수
function confirm_Callback() {
var message_id = $("#confirm_messageid").val();
var callback_info = "";
$("input[name='mailcancel_chkbox']").each(function() {
if($(this).is(":checked")==true) {
callback_info += $(this).val()+"|";
}
});
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var ajaxdata = "command=CALLBACK&message_id="+$.URLEncode(message_id)+"&callback_info="+$.URLEncode(callback_info);
var ajaxurl = "/module/confirm_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open");
$.ajax({
type:"POST",
url:ajaxurl,
data:ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result!="SUCCESS") {
LayerOpen("close");
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
} else {
popupModal(message);
}
} else {
popupModal(message);
LayerOpen("close");
$("#popup_modal2").modal('hide');
}
},
error: function(e) {
LayerOpen("close");
popupModal(LANGUAGE[177][LANGTYPE]);
}
});
}
// 주소록 리스트
function addrbookList() {
var page = $("#addrbook_page").val();
var showtype= $("#addrbook_showtype").val();
var listscale = $("#addrbook_listscale").val();
var order = $("#addrbook_order").val();
var sort = $("#addrbook_sort").val();
var groupidx = $("#addrbook_groupidx").val();
var alphasearch = $("#addrbook_alphasearch").val();
var search = $("#search_content").val();
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var ajaxdata = "search="+$.URLEncode(search)+"&alphaSearch="+alphasearch+"&groupidx="+groupidx+"&order="+order+"&sort="+sort+"&listscale="+listscale+"&showtype="+showtype+"&page="+page;
var ajaxurl = "/module/addressbook.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open");
$.ajax({
type: "POST",
url: ajaxurl,
data: ajaxdata,
dataType: "xml",
cache: true,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
var title = $.URLDecode(xmldata.find("TITLE").text());
var group = $.URLDecode(xmldata.find("GROUP").text());
var total = xmldata.find("TOTAL").text();
var addrbook_list_html = "";
if(showtype=="USER") {
var addressBookUser_Data = JSON.parse($("#addressBookUser_Data").val());
var addressBookSharedAuth_Data = JSON.parse($("#addressBookSharedAuth_Data").val());
addrbook_list_html += "";
addrbook_list_html += " ";
addrbook_list_html += " ";
addrbook_list_html += " ";
addrbook_list_html += " ";
addrbook_list_html += " ";
addrbook_list_html += " ";
addrbook_list_html += " ";
addrbook_list_html += " "+LANGUAGE[58][LANGTYPE]+" ";
for(i=0; i" + addressBookUser_Data[i].GROUPNAME + "";
}
for(i=0; i("+LANGUAGE[186][LANGTYPE]+") " + addressBookSharedAuth_Data[i].GROUPNAME + "";
}
addrbook_list_html += " ";
//addrbook_list_html += " 등록 ";
addrbook_list_html += " ";
addrbook_list_html += " "+LANGUAGE[238][LANGTYPE]+" ";
addrbook_list_html += " ";
}
$("#addressbook_title").html(title);
$("#addressbook_groupname").html(group);
if($("#addrbook_alphasearch").val()=="") {
$("#addressbook_count").html(total);
}
if(result=="SUCCESS") {
var i = 0;
xmldata.find("ROW").each(function() {
var kind, idx, userid, writeid, name, email, hp, company, tel, writer_info;
kind = $(this).find("KIND").text();
idx = $(this).find("IDX").text();
num = $(this).find("NUM").text();
userid = $(this).find("USERID").text();
writeid = $(this).find("WRITEID").text();
writer_info = $.URLDecode($(this).find("WRITER_INFO").text());
if(writer_info==undefined) writer_info = "";
name = $.URLDecode($(this).find("NAME").text());
if(name==undefined) name = "";
email = $.URLDecode($(this).find("EMAIL").text());
if(email==undefined) email = "";
hp = $.URLDecode($(this).find("HP").text());
if(hp==undefined) hp = "";
company = $.URLDecode($(this).find("COMPANY").text());
if(company==undefined) company = "";
tel = $.URLDecode($(this).find("TEL").text());
if(tel==undefined) tel = "";
group = $.URLDecode($(this).find("GROUPNAME").text());
if(group==undefined) group = "";
var usertype_class = "";
var owner = $(this).find("ADDROWNER").text();
if(owner!="Y") usertype_class="text-info";
else usertype_class = "text-default";
addrbook_list_html += "\n";
addrbook_list_html += " \r\n";
addrbook_list_html += " "+name+" \r\n";
addrbook_list_html += " ');\">"+email+" \r\n";
addrbook_list_html += " "+hp+" \r\n";
addrbook_list_html += " "+company+" \r\n";
addrbook_list_html += " "+group+" \r\n";
addrbook_list_html += " "+writer_info+" \r\n";
addrbook_list_html += " \r\n";
i++;
});
//alert(addrbook_list_html);
$("#addrbook_list_body").html(addrbook_list_html);
$("#addEmail_group2").select2({
minimumResultsForSearch: Infinity
});
var jsondata = $.URLDecode(xmldata.find("JSON_DATA").text());
if(jsondata == "" || jsondata == undefined || jsondata == "undefined") {
$("#addrbook_jsondata").val("");
} else {
$("#addrbook_jsondata").val(jsondata);
}
var paging_html = $.URLDecode(xmldata.find("PAGING").text());
if(paging_html == "" || paging_html == undefined || paging_html == "undefined") {
$("#mail_page").html(null);
} else {
$("#mail_page").html(paging_html);
}
LayerOpen("close");
} else {
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
popupModal(message, 400);
LayerOpen("close");
}
if($("#addrbook_sort_use").val()=="YES") {
if(order=="DATE") {
$("#addrsort_chk1").css("display", "none");
$("#addrsort_title1").css("padding-left", "23px");
$("#addrsort_chk2").css("display", "");
$("#addrsort_title2").css("padding-left", "10px");
$("#addrsort_title1").removeClass("text-semibold");
$("#addrsort_title2").addClass("text-semibold");
} else {
$("#addrsort_chk1").css("display", "");
$("#addrsort_title1").css("padding-left", "10px");
$("#addrsort_chk2").css("display", "none");
$("#addrsort_title2").css("padding-left", "23px");
$("#addrsort_title1").addClass("text-semibold");
$("#addrsort_title2").removeClass("text-semibold");
}
}
},
error: function(e) {
$("html, body").animate({scrollTop:0}, 100);
popupModal(LANGUAGE[13][LANGTYPE]+" "+LANGUAGE[14][LANGTYPE]);
LayerOpen("close");
return;
}
});
}
// 주소록 간편 추가
function simpleAddEmailAction(mode) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var name, email, groupidx, hp, phone, company, grouptype;
name = $("#addEmail_name").val();
email = $("#addEmail_email").val();
if(mode=="addrbook") {
temp_groupidx = $("#addEmail_group2").val();
hp = $("#addEmail_hp").val();
company = $("#addEmail_company").val();
} else if(mode=="popup_org") {
temp_groupidx = $("#addEmail_group").val();
hp = $("#addEmail_mobile").val();
phone = $("#addEmail_phone").val();
}
else {
temp_groupidx = $("#addEmail_group").val();
}
temp_grouparr = temp_groupidx.split(":");
groupidx = temp_grouparr[0];
grouptype = temp_grouparr[1];
if(hp==undefined) hp = "";
if(phone==undefined) phone = "";
if(company==undefined) company = "";
if(name=="") {
if(mode=="mail") {
$("#custom_modal_message").html(""+LANGUAGE[239][LANGTYPE]+" ");
} else {
popupModal(LANGUAGE[239][LANGTYPE]);
}
return;
}
if(!checkEmail(email)) {
if(mode=="mail") {
$("#custom_modal_message").html(""+LANGUAGE[240][LANGTYPE]+" ");
} else {
popupModal(LANGUAGE[240][LANGTYPE]);
}
return;
}
var ajaxdata = "mode=INSERT&inputName="+$.URLEncode(name)+"&inputEmail="+$.URLEncode(email)+"&inputHp="+$.URLEncode(hp)+"&inputCompanyTel="+$.URLEncode(phone)+"&inputCompany="+$.URLEncode(company)+"&inputAddrGroupIdx="+groupidx+"&inputAddrGroupType="+grouptype;
var ajaxurl = "/module/addressbook_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
$.ajax({
type: "POST",
url: ajaxurl,
data: ajaxdata,
dataType: "xml",
cache: true,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
if(mode=="mail" || mode=="popup_org") {
$("#popup_modal2").modal('hide');
$("#popup_modal_message").html(LANGUAGE[241][LANGTYPE]);
$("#popup_modal").modal('toggle');
} else {
addrbookList();
}
} else {
if(mode=="mail" || mode=="popup_org") {
$("#popup_modal2").modal('hide');
$("#popup_modal_message").html(message);
$("#popup_modal").modal('toggle');
} else {
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
if(message==undefined || message=="") message = LANGUAGE[242][LANGTYPE];
popupModal(message, 400);
}
}
},
error: function(e) {
$("html, body").animate({scrollTop:0}, 100);
popupModal(LANGUAGE[13][LANGTYPE]+" "+LANGUAGE[14][LANGTYPE]);
return;
}
});
}
// 주소록 추가
function addEmailAction() {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var groupidx, name, email, hp, company, dept, position, company_tel, company_fax, company_addr, home_tel, home_addr, memo, grouptype;
temp_groupidx = $("#popupAddEmail_group").val();
temp_grouparr = temp_groupidx.split(":");
groupidx = temp_grouparr[0];
grouptype = temp_grouparr[1];
name = $("#popupAddEmail_name").val();
email = $("#popupAddEmail_email").val();
hp = $("#popupAddEmail_hp").val();
company = $("#popupAddEmail_company").val();
dept = $("#popupAddEmail_dept").val();
position = $("#popupAddEmail_position").val();
company_tel = $("#popupAddEmail_companytel").val();
company_fax = $("#popupAddEmail_companyfax").val();
company_addr = $("#popupAddEmail_companyaddress").val();
home_tel = $("#popupAddEmail_hometel").val();
home_addr = $("#popupAddEmail_homeaddress").val();
memo = $("#popupAddEmail_memo").val();
$("#custom_modal_message").removeClass("uplus-box-show");
$("#custom_modal_message").addClass("uplus-box-hide");
if(name=="") {
$("#custom_modal_message").removeClass("uplus-box-hide");
$("#custom_modal_message").addClass("uplus-box-show");
$("#custom_modal_message").html(""+LANGUAGE[239][LANGTYPE]+" ");
return;
}
if(!checkEmail(email)) {
$("#custom_modal_message").removeClass("uplus-box-hide");
$("#custom_modal_message").addClass("uplus-box-show");
$("#custom_modal_message").html(""+LANGUAGE[240][LANGTYPE]+" ");
return;
}
var strDeptsToShare = $("#strDeptsToShare").val();
var strUsersToShare = $("#strUsersToShare").val();
var ajaxdata = "mode=INSERT&inputName="+$.URLEncode(name)+"&inputEmail="+$.URLEncode(email)+"&inputHp="+$.URLEncode(hp)+"&inputCompany="+$.URLEncode(company)+"&inputAddrGroupIdx="+groupidx+"&inputAddrGroupType="+grouptype+"&inputDept="+$.URLEncode(dept)+"&inputPosition="+$.URLEncode(position)+"&inputCompanyTel="+$.URLEncode(company_tel)+"&inputCompanyFax="+$.URLEncode(company_fax)+"&inputCompanyAddr="+$.URLEncode(company_addr)+"&inputHomeTel="+$.URLEncode(home_tel)+"&inputHomeAddr="+$.URLEncode(home_addr)+"&inputMemo="+$.URLEncode(memo)+"&strDeptsToShare="+$.URLEncode(strDeptsToShare)+"&strUsersToShare="+$.URLEncode(strUsersToShare);
var ajaxurl = "/module/addressbook_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
$.ajax({
type: "POST",
url: ajaxurl,
data: ajaxdata,
dataType: "xml",
cache: true,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
/***
$("#popup_modal2").modal('hide');
$("#popup_modal_message").html("주소록이 등록되었습니다.");
$("#popup_modal").modal('toggle');
***/
$("#popup_modal2").modal('hide');
addrbookList();
} else {
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
/***
$("#popup_modal2").modal('hide');
$("#popup_modal_message").html(message);
$("#popup_modal").modal('toggle');
***/
popupModal(message, 400);
}
},
error: function(e) {
$("html, body").animate({scrollTop:0}, 100);
popupModal(LANGUAGE[13][LANGTYPE]+" "+LANGUAGE[14][LANGTYPE]);
return;
}
});
}
// 주소록 수정
function modifyEmailAction(idx) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var groupidx, temp_groupidx, name, email, hp, company, dept, position, company_tel, company_fax, company_addr, home_tel, home_addr, memo;
groupidx_old = $("#popupAddEmail_groupidx_old").val();
temp_groupidx = $("#popupAddEmail_group").val().split(":");
groupidx = temp_groupidx[0];
name = $("#popupAddEmail_name").val();
email = $("#popupAddEmail_email").val();
hp = $("#popupAddEmail_hp").val();
company = $("#popupAddEmail_company").val();
dept = $("#popupAddEmail_dept").val();
position = $("#popupAddEmail_position").val();
company_tel = $("#popupAddEmail_companytel").val();
company_fax = $("#popupAddEmail_companyfax").val();
company_addr = $("#popupAddEmail_companyaddress").val();
home_tel = $("#popupAddEmail_hometel").val();
home_addr = $("#popupAddEmail_homeaddress").val();
memo = $("#popupAddEmail_memo").val();
$("#custom_modal_message").removeClass("uplus-box-show");
$("#custom_modal_message").addClass("uplus-box-hide");
if(name=="") {
$("#custom_modal_message").removeClass("uplus-box-hide");
$("#custom_modal_message").addClass("uplus-box-show");
$("#custom_modal_message").html(""+LANGUAGE[239][LANGTYPE]+" ");
return;
}
if(!checkEmail(email)) {
$("#custom_modal_message").removeClass("uplus-box-hide");
$("#custom_modal_message").addClass("uplus-box-show");
$("#custom_modal_message").html(""+LANGUAGE[240][LANGTYPE]+" ");
return;
}
var strDeptsToShare = $("#strDeptsToShare").val();
var strUsersToShare = $("#strUsersToShare").val();
var ajaxdata = "mode=MODIFY&inputIdx="+idx+"&inputName="+$.URLEncode(name)+"&inputEmail="+$.URLEncode(email)+"&inputHp="+$.URLEncode(hp)+"&inputCompany="+$.URLEncode(company)+"&inputAddrGroupIdx="+groupidx+"&inputDept="+$.URLEncode(dept)+"&inputPosition="+$.URLEncode(position)+"&inputCompanyTel="+$.URLEncode(company_tel)+"&inputCompanyFax="+$.URLEncode(company_fax)+"&inputCompanyAddr="+$.URLEncode(company_addr)+"&inputHomeTel="+$.URLEncode(home_tel)+"&inputHomeAddr="+$.URLEncode(home_addr)+"&inputMemo="+$.URLEncode(memo)+"&inputGroupidxold="+groupidx_old+"&strDeptsToShare="+strDeptsToShare+"&strUsersToShare="+strUsersToShare;
var ajaxurl = "/module/addressbook_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
$.ajax({
type: "POST",
url: ajaxurl,
data: ajaxdata,
dataType: "xml",
cache: true,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
if(message!=undefined) {
$("#popup_modal_message").html(message);
$("#popup_modal").modal('toggle');
}
$("#popup_modal2").modal('hide');
addrbookList();
} else {
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
popupModal(message, 400);
}
},
error: function(e) {
$("html, body").animate({scrollTop:0}, 100);
popupModal(LANGUAGE[13][LANGTYPE]+" "+LANGUAGE[14][LANGTYPE]);
return;
}
});
}
// 주소록 삭제
function deleteAddrbook() {
var addrbook_data = JSON.parse($("#addrbook_jsondata").val());
var idx = "";
$("input[name='addrbook_chkbox']").each(function() {
if($(this).is(":checked")==true) {
idx += $(this).val()+"|";
}
});
if(idx=="") {
popupModal(LANGUAGE[174][LANGTYPE]);
return;
}
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var ajaxdata = "mode=REMOVE&idx="+$.URLEncode(idx);
var ajaxurl = "/module/addressbook_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open");
$.ajax({
type:"POST",
url:ajaxurl,
data:ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
LayerOpen("close");
//$("#popup_modal_message").html("주소록이 삭제되었습니다.");
//$("#popup_modal").modal('toggle');
addrbookList();
$("#addrbook_btn_01").removeClass("uplus-maillist-btn-show");
$("#addrbook_btn_01").addClass("uplus-maillist-btn-hide");
$("#addrbook_btn_02").removeClass("uplus-maillist-btn-show");
$("#addrbook_btn_02").addClass("uplus-maillist-btn-hide");
$("#addrbook_btn_03").removeClass("uplus-maillist-btn-show");
$("#addrbook_btn_03").addClass("uplus-maillist-btn-hide");
} else {
LayerOpen("close");
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
$("#popup_modal_message").html(message);
$("#popup_modal").modal('toggle');
}
},
error: function(e) {
LayerOpen("close");
popupModal(LANGUAGE[243][LANGTYPE]);
}
});
}
// 팝업창에서 주소록 삭제
function popupDeleteAddrbook(idx) {
if(confirm(LANGUAGE[244][LANGTYPE])) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var ajaxdata = "mode=REMOVE&idx="+$.URLEncode(idx);
var ajaxurl = "/module/addressbook_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
$("#popup_modal2").modal('hide');
LayerOpen("open");
$.ajax({
type:"POST",
url:ajaxurl,
data:ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
LayerOpen("close");
//$("#popup_modal_message").html("주소록이 삭제되었습니다.");
//$("#popup_modal").modal('toggle');
addrbookList();
$("#addrbook_btn_01").removeClass("uplus-maillist-btn-show");
$("#addrbook_btn_01").addClass("uplus-maillist-btn-hide");
$("#addrbook_btn_02").removeClass("uplus-maillist-btn-show");
$("#addrbook_btn_02").addClass("uplus-maillist-btn-hide");
$("#addrbook_btn_03").removeClass("uplus-maillist-btn-show");
$("#addrbook_btn_03").addClass("uplus-maillist-btn-hide");
} else {
LayerOpen("close");
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
$("#popup_modal_message").html(message);
$("#popup_modal").modal('toggle');
}
},
error: function(e) {
LayerOpen("close");
popupModal(LANGUAGE[243][LANGTYPE]);
}
});
}
}
// 주소록 이동
function moveAddrbook(groupidx) {
var addrbook_data = JSON.parse($("#addrbook_jsondata").val());
var idx = "";
$("input[name='addrbook_chkbox']").each(function() {
if($(this).is(":checked")==true) {
idx += $(this).val()+"|";
}
});
if(idx=="") {
popupModal(LANGUAGE[245][LANGTYPE]);
return;
}
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var ajaxdata = "mode=MOVE&groupidx="+groupidx+"&idx="+$.URLEncode(idx);
var ajaxurl = "/module/addressbook_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open");
$.ajax({
type:"POST",
url:ajaxurl,
data:ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
LayerOpen("close");
if(message!=undefined) {
$("#popup_modal_message").html(message);
$("#popup_modal").modal('toggle');
}
$("#addrbook_chkbox_all").attr("checked", false);
addrbookList();
$("#addrbook_btn_01").removeClass("uplus-maillist-btn-show");
$("#addrbook_btn_01").addClass("uplus-maillist-btn-hide");
$("#addrbook_btn_02").removeClass("uplus-maillist-btn-show");
$("#addrbook_btn_02").addClass("uplus-maillist-btn-hide");
$("#addrbook_btn_03").removeClass("uplus-maillist-btn-show");
$("#addrbook_btn_03").addClass("uplus-maillist-btn-hide");
} else {
LayerOpen("close");
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
$("#popup_modal_message").html(message);
$("#popup_modal").modal('toggle');
}
},
error: function(e) {
LayerOpen("close");
popupModal(LANGUAGE[246][LANGTYPE]);
}
});
}
// 주소록 복사
function copyAddrbook(groupidx) {
var addrbook_data = JSON.parse($("#addrbook_jsondata").val());
var idx = "";
$("input[name='addrbook_chkbox']").each(function() {
if($(this).is(":checked")==true) {
idx += $(this).val()+"|";
}
});
if(idx=="") {
popupModal(LANGUAGE[247][LANGTYPE]);
return;
}
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var ajaxdata = "mode=COPY&groupidx="+groupidx+"&idx="+$.URLEncode(idx);
var ajaxurl = "/module/addressbook_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
LayerOpen("open");
$.ajax({
type:"POST",
url:ajaxurl,
data:ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
LayerOpen("close");
if(message!=undefined) {
$("#popup_modal_message").html(message);
$("#popup_modal").modal('toggle');
}
addrbookList();
$("#addrbook_btn_01").removeClass("uplus-maillist-btn-show");
$("#addrbook_btn_01").addClass("uplus-maillist-btn-hide");
$("#addrbook_btn_02").removeClass("uplus-maillist-btn-show");
$("#addrbook_btn_02").addClass("uplus-maillist-btn-hide");
$("#addrbook_btn_03").removeClass("uplus-maillist-btn-show");
$("#addrbook_btn_03").addClass("uplus-maillist-btn-hide");
} else {
LayerOpen("close");
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
$("#popup_modal_message").html(message);
$("#popup_modal").modal('toggle');
}
},
error: function(e) {
LayerOpen("close");
popupModal(LANGUAGE[248][LANGTYPE]);
}
});
}
// 전사주소록 복사
function copyAddrbookCompany(groupidx) {
var addrbook_data = JSON.parse($("#addressbook_company").val());
var userids = "";
$("input[name='addrbook_chkbox']").each(function() {
if($(this).is(":checked")==true) {
for(var i=0; i"+LANGUAGE[249][LANGTYPE]+"");
return;
}
for(i=0; i"+LANGUAGE[250][LANGTYPE]+"");
return;
}
}
var strDeptsToShare = $("#strDeptsToShare").val();
var strUsersToShare = $("#strUsersToShare").val();
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var ajaxdata = "mode=GROUPINSERT&inputGroupname="+$.URLEncode(inputGroupname)+"&inputGroupdesc="+$.URLEncode(inputGroupdesc)+"&strDeptsToShare="+$.URLEncode(strDeptsToShare)+"&strUsersToShare="+$.URLEncode(strUsersToShare);
var ajaxurl = "/module/addressbook_action.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
$.ajax({
type: "POST",
url: ajaxurl,
data: ajaxdata,
dataType: "xml",
cache: true,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
var addressBookGroup_Data = $.URLDecode(xmldata.find("ADDRESSBOOKGROUP_DATA").text());
var addressBookUser_Data = $.URLDecode(xmldata.find("ADDRESSBOOKUSER_DATA").text());
var addressBookShared_Data = $.URLDecode(xmldata.find("ADDRESSBOOKSHARED_DATA").text());
$("#addressBookGroup_Data").val(addressBookGroup_Data);
$("#addressBookUser_Data").val(addressBookUser_Data);
$("#addressBookShared_Data").val(addressBookShared_Data);
$("#popup_modal2").modal('hide');
$("#pagecode").val("");
var timestamp = tstamp();
$.history.load("addressbook^USER^1^^"+timestamp);
//menuInit("addrbook");
//addrbookList();
} else {
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
popupModal(message, 400);
}
},
error: function(e) {
$("html, body").animate({scrollTop:0}, 100);
popupModal(LANGUAGE[13][LANGTYPE]+" "+LANGUAGE[14][LANGTYPE]);
return;
}
});
}
// 주소록 상세보기
function viewAddrbook(num) {
var addrbook_data = JSON.parse($("#addrbook_jsondata").val());
//alert(addrbook_data[1].EMAIL);
var idx = addrbook_data[num].IDX;
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var ajaxdata = "mode=update&join_type=addrBook&idx="+idx;
var ajaxurl = "/module/join_select.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
$.ajax({
type: "POST",
url: ajaxurl,
data: ajaxdata,
dataType: "xml",
cache: true,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
var deptstoshare = "";
var userstoshare = "";
var temp_deptstoshare = "";
var temp_userstoshare = "";
var addrbook_data = JSON.parse($("#addrbook_jsondata").val());
var addrbook_kind = addrbook_data[num].KIND
var groupname = (addrbook_data[num].GROUPNAME==null) ? " " : addrbook_data[num].GROUPNAME;
var name = addrbook_data[num].NAME;
var email = addrbook_data[num].EMAIL;
var hp = (addrbook_data[num].HP==undefined) ? " " : addrbook_data[num].HP;
var company = (addrbook_data[num].COMPANY==null) ? " " : addrbook_data[num].COMPANY;
var dept = (addrbook_data[num].DEPT==null) ? " " : addrbook_data[num].DEPT;
var position = (addrbook_data[num].POSITION==null) ? " " : addrbook_data[num].POSITION;
var company_tel = (addrbook_data[num].COMPANY_TEL==null) ? " " : addrbook_data[num].COMPANY_TEL;
var fax = (addrbook_data[num].FAX==null) ? " " : addrbook_data[num].FAX;
var company_addr1 = (addrbook_data[num].COMPANY_ADDR1==null) ? " " : addrbook_data[num].COMPANY_ADDR1;
var tel = (addrbook_data[num].TEL==null) ? " " : addrbook_data[num].TEL;
var addr1 = (addrbook_data[num].ADDR1==null) ? " " : addrbook_data[num].ADDR1;
var memo = (addrbook_data[num].MEMO==null) ? " " : addrbook_data[num].MEMO;
var authflag = addrbook_data[num].AUTHFLAG;
var owner = addrbook_data[num].ADDROWNER;
var html = "x
"+LANGUAGE[251][LANGTYPE]+" ";
html += "
";
html += "";
$("#popup_modal2_message").html(html);
$("#popup_modal2_div").css("width", "650px");
$("#popup_modal2").modal('toggle');
} else {
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
popupModal(message, 400);
}
},
error: function(e) {
$("html, body").animate({scrollTop:0}, 100);
popupModal(LANGUAGE[13][LANGTYPE]+" "+LANGUAGE[14][LANGTYPE]);
return;
}
});
}
// 주소록 수정
function modifyAddrbook(num) {
var sharing_permit_addressbook = $("#sharing_addressbook").val();
var addrbook_data = JSON.parse($("#addrbook_jsondata").val());
//alert(addrbook_data[1].EMAIL);
var idx = addrbook_data[num].IDX;
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var ajaxdata = "mode=update&join_type=addrBook&idx="+idx;
var ajaxurl = "/module/join_select.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
$.ajax({
type: "POST",
url: ajaxurl,
data: ajaxdata,
dataType: "xml",
cache: true,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
var deptstoshare = "";
var userstoshare = "";
var temp_deptstoshare = "";
var temp_userstoshare = "";
var addrbook_data = JSON.parse($("#addrbook_jsondata").val());
var addressBookUser_Data = JSON.parse($("#addressBookUser_Data").val());
var addressBookSharedAuth_Data = JSON.parse($("#addressBookSharedAuth_Data").val());
var idx = addrbook_data[num].IDX;
var groupidx = addrbook_data[num].ADDRBOOKGROUP_IDX;
var groupname = (addrbook_data[num].GROUPNAME==null) ? "" : addrbook_data[num].GROUPNAME;
var name = addrbook_data[num].NAME;
var email = addrbook_data[num].EMAIL;
var hp = (addrbook_data[num].HP==undefined) ? "" : addrbook_data[num].HP;
var company = (addrbook_data[num].COMPANY==null) ? "" : addrbook_data[num].COMPANY;
var dept = (addrbook_data[num].DEPT==null) ? "" : addrbook_data[num].DEPT;
var position = (addrbook_data[num].POSITION==null) ? "" : addrbook_data[num].POSITION;
var company_tel = (addrbook_data[num].COMPANY_TEL==null) ? "" : addrbook_data[num].COMPANY_TEL;
var fax = (addrbook_data[num].FAX==null) ? "" : addrbook_data[num].FAX;
var company_addr1 = (addrbook_data[num].COMPANY_ADDR1==null) ? "" : addrbook_data[num].COMPANY_ADDR1;
var tel = (addrbook_data[num].TEL==null) ? "" : addrbook_data[num].TEL;
var addr1 = (addrbook_data[num].ADDR1==null) ? "" : addrbook_data[num].ADDR1;
var memo = (addrbook_data[num].MEMO==null) ? "" : addrbook_data[num].MEMO;
var authflag = addrbook_data[num].AUTHFLAG;
var owner = addrbook_data[num].ADDROWNER;
var html = "x
"+LANGUAGE[267][LANGTYPE]+" ";
html += "
";
html += "";
html += ""+LANGUAGE[274][LANGTYPE]+"
";
html += "";
html += "
";
html += " ";
html += " ";
html += " "+LANGUAGE[275][LANGTYPE]+" ";
html += " ";
html += " ";
html += " ";
html += " "+LANGUAGE[276][LANGTYPE]+" ";
html += " ";
html += " ";
if(sharing_permit_addressbook=="Y") {
html += " ";
html += " ";
html += " "+LANGUAGE[262][LANGTYPE]+"
";
html += " "+LANGUAGE[268][LANGTYPE]+"
";
html += " ";
html += " ";
html += " ";
var shared_flag = xmldata.find("SHARED_FLAG").text();
if(shared_flag=="Y") {
var shared_data = xmldata.find("SHARED_DATA");
shared_data.find("ROW").each(function() {
var idx = $.URLDecode($(this).find("IDX").text());
var kind = $.URLDecode($(this).find("KIND").text());
var deptname = $.URLDecode($(this).find("DEPTNAME").text());
var name = $.URLDecode($(this).find("NAME").text());
var positionname = $.URLDecode($(this).find("POSITIONNAME").text());
var authflag = $.URLDecode($(this).find("AUTHFLAG").text());
var auth = "";
if(authflag == "W") auth = LANGUAGE[263][LANGTYPE];
if(authflag == "R") auth = LANGUAGE[264][LANGTYPE];
if(authflag == "A") auth = LANGUAGE[265][LANGTYPE];
if(kind=="DEPT") {
html += "
";
html += "
"+name+"
";
html += "
"+auth+"
";
html += "
";
deptstoshare += idx+":"+authflag+",";
temp_deptstoshare += name+":"+idx+":"+authflag+",";
} else {
if(positionname!="" && positionname!=undefined) name += " "+positionname;
html += "
";
html += "
"+name+"
";
html += "
"+auth+"
";
html += "
";
userstoshare += idx+":"+authflag+",";
temp_userstoshare += name+":"+idx+":"+authflag+",";
}
});
}
html += "
";
html += " ";
html += " ";
}
html += " ";
html += "
";
html += "
";
html += "";
html += "
"+LANGUAGE[269][LANGTYPE]+"
";
html += "
";
html += "
";
html += "
";
html += "
";
html += "
";
html += " ";
html += " ";
html += "
";
html += " ";
html += " ";
html += "
";
html += "
";
html += "
";
html += "
";
html += "
";
html += "
";
html += "
";
html += " "+LANGUAGE[271][LANGTYPE]+" "+LANGUAGE[272][LANGTYPE]+" ";
html += "
";
html += "
";
html += " ";
html += " ";
html += "
";
html += "
";
html += "
";
html += "
"+LANGUAGE[277][LANGTYPE]+"
";
html += "
";
html += " ";
html += " "+LANGUAGE[264][LANGTYPE]+" ";
html += " "+LANGUAGE[263][LANGTYPE]+" ";
html += " ";
html += "
";
html += "
";
html += "
";
html += "
"+LANGUAGE[114][LANGTYPE]+" "+LANGUAGE[115][LANGTYPE]+"
";
html += "
";
html += " ";
html += " ";
html += " ";
html += " ";
html += " ";
html += "
";
html += ""+LANGUAGE[278][LANGTYPE]+" "+LANGUAGE[115][LANGTYPE]+"
";
$("#popup_modal2_message").html(html);
$("#popup_modal2_div").css("width", "650px");
$("#popup_modal2").modal('toggle');
} else {
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
popupModal(message, 400);
}
},
error: function(e) {
$("html, body").animate({scrollTop:0}, 100);
popupModal(LANGUAGE[13][LANGTYPE]+" "+LANGUAGE[14][LANGTYPE]);
return;
}
});
}
// 주소록 그룹 상세보기
function viewEmailGroupPopup(groupidx) {
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var ajaxdata = "mode=update&join_type=addrBookGroup&idx="+groupidx;
var ajaxurl = "/module/join_select.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
$.ajax({
type: "POST",
url: ajaxurl,
data: ajaxdata,
dataType: "xml",
cache: true,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
var deptstoshare = "";
var userstoshare = "";
var temp_deptstoshare = "";
var temp_userstoshare = "";
var addressBookUser_Data = JSON.parse($("#addressBookShared_Data").val());
var groupname = "";
var memo = "";
for(i=0; i ";
$("#popup_modal2_message").html(html);
$("#popup_modal2_div").css("width", "650px");
$("#popup_modal2").modal('toggle');
} else {
var error_type = $.URLDecode(xmldata.find("ERRORTYPE").text());
if(error_type=="CHECKLOGIN") {
bootbox.dialog({
message: LANGUAGE[851][LANGTYPE],
buttons: {
danger: {
label: "확인",
className: "btn-primary",
callback: function() {
$(location).attr("href", "/login.php");
}
}
},
className: "bootbox-sm"
});
return;
}
popupModal(message, 400);
}
},
error: function(e) {
$("html, body").animate({scrollTop:0}, 100);
popupModal(LANGUAGE[13][LANGTYPE]+"
"+LANGUAGE[14][LANGTYPE]);
return;
}
});
}
// 주소록 공유설정
function addrBookOrgView() {
var tempDeptsToShare = $("#tempDeptsToShare").val();
var tempUsersToShare = $("#tempUsersToShare").val();
var request_url = $("#requestUrl").val();
var request_type = $("#requestType").val();
var tocken = $("#inputTocken").val();
var ajaxdata = "command=popupview";
var ajaxurl = "/module/orgtree.php";
if(request_type=="SSL") {
var request_port = $("#requestPort").val();
ajaxdata += "&tocken="+tocken;
ajaxurl = "https://"+request_url+ajaxurl;
if(request_port!="443") ajaxurl+= ":"+request_port
}
$.ajax({
type:"POST",
url:ajaxurl,
data:ajaxdata,
dataType:"xml",
cache:false,
success: function(xml) {
var xmldata = $(xml).find("DATA");
var result = xmldata.find("RESULT").text();
var message = $.URLDecode(xmldata.find("MESSAGE").text());
if(result=="SUCCESS") {
$("#popupUserOrgData").val($.URLDecode(xmldata.find("ORGDATA1").text()));
$("#popupUserAddrData").val($.URLDecode(xmldata.find("ADDRBOOKDATA").text()));
var orgdata = JSON.parse($.URLDecode(xmldata.find("ORGDATA1").text()));
var organizationObj;
var setting1 = {
data: {
simpleData: {
enable: true
}
},
callback: {
onClick: addrbookShareAddOrg
}
};
var orgNodes = orgdata;
organizationObj = $.fn.zTree.init($("#popup_orgtree_box"), setting1, orgNodes);
var list_html = "";
$("#addrbookShareList").html("");
var tempDeptsToShareArr = tempDeptsToShare.split(",");
for(var i=0; i