// 자동 로그아웃 시간
var logout_time = localStorage.getItem('auto_exit_minute');
var debug_mode = localStorage.getItem('debug_mode');
var current_user_info_json = localStorage.getItem('current_user_info');
var drop_flag = false;
;(function($){
//local time
setCustomScrollBar();
bookMarkInfo_set();
main_memo_read();
lib_info_set();
getToday();
setInterval(function(){
getToday();
},10000);
//logo dropdown
var $drop_pop = $('.dropdown_pop');
var $dropdown_content = $('.dropdown_content');
var $close_popup = $('.close_popup');
$drop_pop.on('click', function(e){
e.preventDefault();
$dropdown_content.fadeToggle(100);
$('aside').fadeToggle(1);
if (!$('.dim-layer').get(0)){$('header').append('
');}
$('.dim-layer').fadeToggle(100);
drop_flag = true;
});
$close_popup.on('click', function(e){
e.preventDefault();
$dropdown_content.fadeOut(100);
$('aside').fadeIn(100);
$('.dim-layer').fadeOut(100,function(){
$(this).remove();
})
drop_flag = false;
});
//19.08.06 이현주 추가 - 메뉴 드롭다운 esc로 닫을수 있도록.
window.onkeyup = function(e) {
var key = e.keyCode ? e.keyCode : e.which;
if(key == 27 && drop_flag == true) {
$close_popup.trigger('click');
}
}
// Daterangepicker 한글
moment.locale('ko');
//extend aside to bottom
$(window).load(function(){
//extend_to_right();
extend_to_bottom();
$('.lnb_container').perfectScrollbar('update');
$('#root_container').perfectScrollbar('update');
});
$(window).resize(function(){
//extend_to_right();
extend_to_bottom();
$('.lnb_container').perfectScrollbar('update');
$('#root_container').perfectScrollbar('update');
});
var open_flag = true;
//lnb open/fold
/*
$('#folding_switch').on('click', function(e){
e.preventDefault();
var $this = $(this);
var $new_src;
var $switch_src = $this.attr('src');
var $src_root = $switch_src.substr(0,16);
var $src_rest = $switch_src.substr(-9);
var $aside = $('aside');
var $device_w = innerWidth;
var $right_container = $('#right_container_wrapper');
var $main_cont = $('main .metis_container');
if(open_flag == false){
$aside.animate({marginLeft:'-217px'},400);
$new_src = '/METIS/img/btn_lnb_comm_open.png';
$main_cont.animate({left:'13px'},400);
$right_container.animate({width:$device_w - 13 + 'px'}, 400);
open_flag = true;
} else {
$aside.animate({marginLeft:'0'},400);
$new_src = '/METIS/img/btn_lnb_comm_fold.png';
$main_cont.animate({left:'230px'},400);
$right_container.animate({width:$device_w - 230 + 'px'}, 400);
open_flag = false;
}
$this.attr('src',$new_src);
});
*/
$('#folding_switch').on('click', function(e){
$(this).toggleClass('open');
//열림 처리
if($(this).hasClass('open')){
$('#right_container_wrapper').addClass('open');
$('aside').addClass('open');
$('.aside').removeClass('compact');
$(".main_memo_set").css("display","block");
} else {
//닫힘 처리
$('#right_container_wrapper').removeClass('open');
$('aside').removeClass('open');
$('.aside').addClass('compact');
$(".main_memo_set").css("display","none");
}
});
// 이름 누르면 메뉴 나오는 함수
$('.aside .profile_box .profile_detail_box .user_name > a').on('click', function(e){
$('.aside .profile_box .profile_popup_menu').toggle();
return false;
});
// 메뉴 바깥을 클릭하면 메뉴가 닫히는 함수
$('body').on('click', function(e){
if(e.target.className !== 'user_name'){
$('.aside .profile_box .profile_popup_menu').hide();
}
});
// 좌측 메뉴 서브 메뉴 열고 닫기
$('.lnb .left_menu_toggle_trigger').on('click', function(e){
if($(this).hasClass('active')){
$(this).removeClass('active');
} else {
$('.lnb .left_menu_toggle_trigger').removeClass('active');
$(this).addClass('active');
}
});
// 좌측 메뉴 서브 메뉴 선택 / 해제
$('.lnb .left_toggle_sub_menu').on('click', 'li', function(e){
$('.lnb .left_toggle_sub_menu li').removeClass('active');
//메뉴 선택시 토글 닫기
let toggle_sub_menu = $(this).parent().prev();
if(toggle_sub_menu.hasClass("left_menu_toggle_trigger") == true){
toggle_sub_menu.removeClass("active");
}
$(this).addClass('active');
});
// 검색영역 열고 / 닫기
$('.search_common').on('click','.search-btn , .search-close',function(){
$('.search_inner').stop().fadeToggle(200);
return false;
});
// 검색영역 > 도서관선택 열고 / 닫기
$('.search-select > a').on('click',function(){
$(this).next().stop().slideToggle(100);
return false;
});
//gnb hover event
$('.gnb .gnb_menu li a').hover(function(){
$(this).toggleClass('new_effect');
});
// var $gnb_menu = $('.gnb_menu');
// $gnb_menu.on('mouseenter', 'li', function(e){
// e.preventDefault();
// var $this_img = $(this).find('img');
// var $this_img_src = $this_img.attr('src');
// var $new_src_arr = $this_img_src.split('_click');
// var $new_src = $new_src_arr[0]+$new_src_arr[1];
// $this_img.attr('src',$new_src);
// })
// .on('mouseleave','li',function(e){
// e.preventDefault();
// var $this_img = $(this).find('img');
// var $this_img_src = $this_img.attr('src');
// var $new_src_arr = $this_img_src.split('d_');
// var $new_src = $new_src_arr[0]+'d_click_'+$new_src_arr[1];
// $this_img.attr('src',$new_src);
// });
// 로딩중 화면을 호출하기 위해 ajax시작과 종료 시점 모든 화면에 추가함.
$(document).ajaxStart(function() {
// console.log("["+$('#loading_flag').val()+"]");
// 로그인 시간 연장
//login_time_delay();
if($('#loading_flag').val() == 'false')
{
// console.log('로딩 사용안함');
}
else
{
HoldOn.open({
theme:"custom",
content:'
' ,
backgroundColor:"#000"
});
}
//19.08.13 이현주 추가 - esc 닫기
//19.08.14 버튼으로 변경 위해 주석처리
/* $(document).keydown(function(e) {
var key = e.keyCode ? e.keyCode : e.which;
if (key == 27) {
HoldOn.close();
}
});*/
}).ajaxStop(function() {
HoldOn.close();
//$('#loading_flag').val( "true");
}).ajaxSuccess(function(event, request, settings){
// debug_mode가 Y인 경우만 send와 request정보를 출력한다.
// 변환 방법은 문의 전화번호 부분을 10번 클릭하면 변경된다.
if(debug_mode == "Y")
{
if(request.responseJSON != undefined)
{
console.dir(request.responseJSON);
}else if(request.responseText != undefined){
console.log(request.responseText);
}
}
}).ajaxError(function(event, request, settings){
// debug_mode가 Y인 경우만 send와 request정보를 출력한다.
// 변환 방법은 문의 전화번호 부분을 10번 클릭하면 변경된다.
if(debug_mode == "Y")
{
if(request.responseJSON != undefined)
{
console.dir(request.responseJSON);
}
}
});
var windowHeight = screen.height; //$(window).height();
//console.log("screnn height "+windowHeight);
if(logout_time == null || logout_time == "null" || logout_time == undefined)
{
logout_time = 0;
localStorage.setItem('logout_time',0);
}
else
{
localStorage.setItem('logout_time',(logout_time * 60));
}
loginTimer(logout_time);
commonLocation();
// 19.04.24 jiyeong 잠금대기시간 마우스 클릭 시 연장
if( !logout_time || logout_time == "" || logout_time == 0) // (null == logout_time || undefined == logout_time) == !logout_time
{
return;
}else{
$(document).mousedown(function(){
login_time_delay();
});
}
})(jQuery);
function extend_to_bottom(){
var $aside = $('aside');
$aside.css({height:'100px'}); //shrink first
$aside.children().hide();
var $inner_h = $(window).height();
var $container_h = $('#root_container > .container-fluid').height();
// $inner_h = $inner_h > $container_h ? $inner_h : $container_h;
$aside.children().show();
$aside.css({height:$inner_h - 60});
var lnb_container_height = $inner_h - 200;
// $aside.css({height:$inner_h+'px'});
// var lnb_container_height = $inner_h - 87 - 55 - 34;
$aside.find('.lnb_container').css({height:lnb_container_height});
$('.lnb_container').perfectScrollbar('update');
$('#root_container').perfectScrollbar('update');
// console.debug("extend to bottom");
}
function extend_to_right(){
var $aside = $('aside');
var $aside_left_margin = parseInt($aside.css('margin-left').replace('px',''));
var $main_cont = $('main .metis_container');
var $right_container = $('#right_container_wrapper');
var $device_w = innerWidth;
$main_cont.css('left', 230 + $aside_left_margin);
$right_container.css('width', $device_w - (230 + $aside_left_margin));
}
function setCustomScrollBar(){
$('.lnb_container').perfectScrollbar();
$('.table_container').perfectScrollbar();
$('#root_container').perfectScrollbar();
$('.modal-table-container').perfectScrollbar();
}
function getToday(){
var $localtime = $('.local_time').find('p');
var today = new Date();
var year = today.getFullYear();
var month = today.getMonth()+1;
var day = today.getDate();
var hour = today.getHours();
if(hour < 10)
hour = '0' + hour;
var minute = today.getMinutes();
if(minute < 10)
minute = '0' + minute;
var $today = year + '-' + month + '-' + day + ' ' + hour + ':' + minute;
$localtime.text($today);
}
// 날짜 계산 관련 공통
// 사용방법
// var dateUtil = new DateUtility(new Date());
//$("#labBase").text(dateUtil.Today());
////하루전
//$("#labDate1").text(dateUtil.Day(-1));
////이틀전
//$("#labDate2").text(dateUtil.Day(-2));
function DateUtility(dateUse) { //파라미터 갯수 확인
if (0 === arguments.length) { //없다.
//현재 날짜 사용
dateUse = new Date();
}
//파라미터가 있으면 지정한 날짜를 사용한다.
//복제한 date를 준다.
function CloneDate() {
return new Date(dateUse.valueOf())
}
//지정된 날짜를 리턴한다.
this.Today = function () {
return CloneDate();
};
//날짜에서 nDate만큼 더한 날짜를 리턴한다.
this.Day = function (nDay) {
var date = CloneDate();
date.setDate(date.getDate() + nDay);
return date;
};
//날짜에서 nMonth만큼 더한 월을 구한다.
this.Month = function (nMonth) {
var date = CloneDate();
date.setMonth(date.getMonth() + nMonth);
return date;
};
//날짜에서 year만큼 더한 월을 구한다.
this.Year = function (nYear) {
var date = CloneDate();
date.setFullYear(date.getFullYear() + nYear);
return date;
};
//날짜에서 nMonth만큼 더한 월의 1일을 구한다.
this.Month_First = function (nMonth) {
var date = this.Month(nMonth);
return new Date(date.getYear(), date.getMonth(), 1);
};
//날짜에서 nMonth만큼 더한 월의 마지막날짜를 구한다.
this.Month_Last = function (nMonth) {
var date = this.Month(nMonth);
return new Date(date.getYear(), date.getMonth() + 1, 0);
}
}
// 임시 함수 : 현재 페이지의 모든 모달을 왼쪽 메뉴에 추가해줌
function addModalOpenMenu(){
var modalList = $('.modal');
var prependTarget = $('.lnb_container .ul_book');
modalList.each(function(e){
var curModal = $(this);
var curModalName = 'Modal-' + $(curModal).find('.modal-title').text();
var list = document.createElement('li');
var anchor = document.createElement('a');
$(anchor)
.attr('href', '#')
.attr('data-toggle', 'modal')
.attr('data-target', '#' + curModal.attr('id'))
.append(curModalName);
$(list).append(anchor);
prependTarget.prepend(list);
});
}
function menu_bookmark_popup(){
/*$.ajax({
url : "/METIS/common/BookMark.jsp",
type : "POST",
dataType: "html",
async : false,
data : {},
success : function(data) {
alert("dd22d"+$(".page_info li:last-child").text());
alert($("#bookMark_name_save").val());
$("#bookMark_name_save").val($(".page_info li:last-child").text());
openDivPopupHtml(data);
}
});*/
var last_child = $('.page_info li:last-child').text();
if(last_child == 'Dashboard'){
onlyMessage("홈 화면 즐겨찾기는 '홈으로' 버튼을 이용해주세요.");
return;
}
$("#bookMark_name_save").val($(".page_info li:last-child").text());
openDivPopupId('common_bookmark_view_open_popup');
}
// 캐쉬를 삭제한다.
function delete_cash()
{
var browser = navigator.userAgent.toLowerCase();
var text = "";
if ( -1 != browser.indexOf('chrome') )
text = 'chrome';
if ( -1 != browser.indexOf('trident') )
text = 'ie';
if ( -1 != browser.indexOf('opera') || -1 != browser.indexOf('opr') )
text = 'opera';
if ( -1 != browser.indexOf('firefox') )
text = 'firefox';
if(text == 'chrome')
{
// tab_menu_open('http://113366.com/eco');
// alert("test5");
//window.location('chrome://settings/clearBrowserData');
//window.location = 'chrome://settings/clearBrowserData';
//chrome.tabs.update({ url: 'chrome://chrome/extensions' });
// chrome.tabs.create({url:'chrome://settings/clearBrowserData'});
//window.open("about:preferences");
}
}
function menu_bookmark(){
param = {};
var userkey = localStorage.getItem('current_user_key');
var markurl = location.href;
var markurlarr = markurl.split("/");
markurl = "/"+markurlarr[3]+"/"+markurlarr[4]+"/"+markurlarr[5]+"/"+markurlarr[6]+"/"+markurlarr[7];
markurl = strReplaceAll(markurl, "#", "");
$("#left_single_book_menu").append("" + $('.page_info li:last-child').text() + "");
var USER_KEY = userkey;
var BOOKMARK_CODE = $("#view_code_key").val();
var PUBLISH_FORM_CODE = $(".page_info li:first-child").text();
var BOOKMARK_NAME = $("#bookMark_name_save").val();
var PAGE_TYPE = $("#page_type").val();
if(PUBLISH_FORM_CODE == '단행'){
PUBLISH_FORM_CODE = 'MO';
}
else if(PUBLISH_FORM_CODE == '연속'){
PUBLISH_FORM_CODE = 'SE';
}
else if(PUBLISH_FORM_CODE == '공통자료' || '공통'){
PUBLISH_FORM_CODE = 'CO';
}else{
PUBLISH_FORM_CODE = "X";
}
param.user_key = USER_KEY;
param.access_code = BOOKMARK_CODE;
param.bookmark_name = BOOKMARK_NAME;
if(PAGE_TYPE != null && PAGE_TYPE != undefined){
param.access_parameter = "?page_type="+PAGE_TYPE;
}
//console.dir(param.bookmark_parameter);
//console.dir(param);
$.ajax({
type : "POST",
url : "/METIS/BookMark/insert.do",
dataType: "json",
data : param ,
async : false,
success : function(data)
{
onlyMessage(data.statusDescription);
$("#common_bookmark_view_open_popup").modal('hide');
}
});
bookmark_info_search(userkey);
}
function bookmark_info_search(userkey){
$.ajax({
type : "POST",
url : "/METIS/BookMark/re_search.do",
dataType: "json",
data : {"user_key" : userkey , "division_code":"BM"} ,
success : function(data)
{
var obj = data;
localStorage.setItem('BookMarkInfo', JSON.stringify(obj.accessAndBookMarkList));
bookMarkInfo_set();
}
});
}
function bookMarkInfo_set(){
var bkMarkList_ori = JSON.parse(localStorage.getItem('BookMarkInfo'));
var bkMarkList = [];
if(null == bkMarkList_ori)
{
return;
}
for(var i=0 ; i'
+ ''
+ ''
+ bkMarkList[i].bookmark_name+''
+ '';
$(".left_toggle_sub_menu."+code).append(bklink);
}
var resultArr=[];
$.each(codeArr, function(key, value){
if($.inArray(value, resultArr) === -1) resultArr.push(value);
});
for(var i=0 ; i등록된 즐겨찾기 없음");
}
}
function bookMark_delete(key){
confirmMessage("즐겨찾기를 삭제하시겠습니까?",
function(e, confirm){
if(confirm){
$.ajax({
type : "POST",
url : "/METIS/BookMark/delete.do",
dataType: "json",
data : {"access_key" : key } ,
success : function(data){
onlyMessage(data.statusDescription);
var user_key = localStorage.getItem('current_user_key');
bookmark_info_search(user_key);
}
});
}
});
}
function main_memo_length(texts){
var text = texts.value;
var leng = 1000;
if(text.length > leng){
onlyMessage("메모는 "+leng+"자까지 입력할 수 있습니다.");
text = text.substr(0,leng);
texts.value = text;
return;
}
}
function main_memo_read(){
var user_memo = localStorage.getItem('UserMemoInfo');
if(user_memo=='""'){
user_memo = "";
}
$("#main_memo_textarea").val(user_memo);
/*var user_key = localStorage.getItem('current_user_key');
$.ajax({
type : "POST",
url : "/METIS/UserMemo/select.do",
dataType: "json",
data : {"user_key" : user_key } ,
success : function(data)
{
//onlyMessage(data.statusDescription);
$("#main_memo_textarea").val(data.memo);
}
});*/
}
function main_memo_reset(){
var user_key = localStorage.getItem('current_user_key');
$.ajax({
type : "POST",
url : "/METIS/UserMemo/delete.do",
dataType: "json",
data : {"user_key" : user_key } ,
success : function(data)
{
onlyMessage(data.statusDescription);
localStorage.setItem('UserMemoInfo', "");
main_memo_read();
}
});
}
function main_memo_insert(){
var user_key = localStorage.getItem('current_user_key');
param = {};
param.memo = $("#main_memo_textarea").val();
param.user_key = user_key;
$.ajax({
type : "POST",
url : "/METIS/UserMemo/insertOrUpdate.do",
dataType: "json",
data : param ,
success : function(data)
{
onlyMessage(data.statusDescription);
localStorage.setItem('UserMemoInfo', param.memo);
main_memo_read();
}
});
}
function lib_info_set(){
var lib_name = localStorage.getItem('current_user_lib_name');
var user_name = localStorage.getItem('current_user_name');
var user_email = localStorage.getItem('current_user_email');
var user_id = localStorage.getItem('current_user_id');
if(lib_name == 'null'){
lib_name = '도서관';
}
if(user_name == 'null'){
user_name = '';
}
if(user_email == 'null'){
user_email = '';
}
var obj = $("#lib_name_main");
obj.addClass("overTextClip");
obj.attr("title","[" + localStorage.getItem("current_user_lib_code") + "] " + lib_name);
obj.append(lib_name + " ["+user_id+"]");
$(".user_name span").text(user_name);
$(".email_address span").text(user_email);
}
function tab_menu_open(url){
window.open(url);
}
//내정보 수정 모델창 오픈
function mnUser_dataUpdate_open()
{
openDivPopupId("mnUser_dataUpdate_model",function(){
//내정보수정 콤보박스 셋팅
common_setUserInfo_combo();
//사용자정보조회
excuteSearch();
});
}
var currentUserInfo=[];
var password_searchData=[];
//사용자정보조회
function excuteSearch()
{
var rec_key = localStorage.getItem('current_user_key');
$.ajax({
type: "POST",
url: "/METIS/MnUserMng/getUserDetail.do",
dataType: "JSON",
async : true,
data:{"user_key": rec_key},
success: function(data)
{
if(data.status == "SUCCESS")
{
currentUserInfo = data.mnuserinfo[0];
common_setUserInfo();
}
else
{
onlyMessage(data.statusDescription);
}
}
});
}
function common_setUserInfo_combo(){
// 부서
getComboCodeData("info_division_name_mnUser_dataUpdate","직원부서",""," ");
// 직급
getComboCodeData("info_class_name_mnUser_dataUpdate","직원직급",""," ");
}
function common_setUserInfo()
{
$("#mnUser_dataUpdate [name=info_user_name]").val(currentUserInfo.name);
$("#mnUser_dataUpdate [name=info_user_id]").val(currentUserInfo.id);
$("#mnUser_dataUpdate [name=info_user_password]").val(currentUserInfo.passwd);
$("#mnUser_dataUpdate [name=info_home_zip_code]").val(currentUserInfo.home_zip_code);
$("#mnUser_dataUpdate [name=info_home_address]").val(currentUserInfo.home_address);
$("#mnUser_dataUpdate [name=info_home_tel]").val(currentUserInfo.home_tel);
$('#mnUser_dataUpdate [name=info_business_tel_1]').val(currentUserInfo.business_tel);
$('#mnUser_dataUpdate [name=info_business_tel_2]').val(currentUserInfo.exchange_tel);
$('#mnUser_dataUpdate [name=info_email]').val(currentUserInfo.e_mail);
$('#info_division_name_mnUser_dataUpdate').val(currentUserInfo.division_name);
$('#info_class_name_mnUser_dataUpdate').val(currentUserInfo.class_name);
}
//주소검색 버튼 클릭
function operator_address_search()
{
common_addressSearchPopup("",setOperator_address_search);
}
// 주소검색에서 선택 버튼 클릭시
function setOperator_address_search(division, zip_code, address)
{
$('#mnUser_dataUpdate [name=info_home_zip_code]').val(zip_code);
$('#mnUser_dataUpdate [name=info_home_address]').val(address);
common_addressSearchPopupClose();
}
//내정보저장버튼클릭
function mnUser_dataUpdate_btn()
{
var param = mnUser_updataParam();
$.ajax({
type: "POST",
url: "/METIS/MnUserMng/excuteMnUserInsertOrUpdate.do",
dataType: "JSON",
async : true,
data:param,
success: function(data)
{
if(data.status=="SUCCESS"){
Message_callback(data.statusDescription, function(){
$("#mnUser_dataUpdate_close").click();
$("select option:eq(0)").attr("selected","selected");
$(':text').val('');$(':text').val('');
})
}else{
onlyMessage(data.statusDescription);
}
}
});
}
//정보보기 - 화면옵션
function layoutOptionModalOpen() {
openDivPopupId("layoutModal", function() {
let optionvalue = layout_option_for_allpage;
if (optionvalue != undefined && optionvalue != null && optionvalue != "") {
$('#layoutModalSelect').val(optionvalue);
} else {
$('#layoutModalSelect').val('layout_option_0');
}
});
}
function mnUser_updataParam()
{
//var pwd = $("#mnUser_dataUpdate [name=info_user_password]").val();
var param = {};
param.permition = currentUserInfo.permition;
param.user_key = currentUserInfo.user_key;
param.manage_code = currentUserInfo.manage_code;
param.code_pattern = currentUserInfo.code_pattern;
param.loan_user_access_auth = currentUserInfo.loan_user_access_auth;
param.ori_passwd = currentUserInfo.passwd;
param.remark = currentUserInfo.remark;
param.name = $("#mnUser_dataUpdate [name=info_user_name]").val();
param.id = $("#mnUser_dataUpdate [name=info_user_id]").val();
//param.passwd = pwd.toUpperCase();
param.division_name = $('#info_division_name_mnUser_dataUpdate').val();
param.class_name = $('#info_class_name_mnUser_dataUpdate').val();
param.business_tel = $('#mnUser_dataUpdate [name=info_business_tel_1]').val();
param.exchange_tel = $('#mnUser_dataUpdate [name=info_business_tel_2]').val();
param.e_mail = $('#mnUser_dataUpdate [name=info_email]').val();
param.home_zip_code = $("#mnUser_dataUpdate [name=info_home_zip_code]").val();
param.home_address = $("#mnUser_dataUpdate [name=info_home_address]").val();
param.home_tel = $("#mnUser_dataUpdate [name=info_home_tel]").val();
param.privacy_access_level = currentUserInfo.privacy_access_level;
param.preservation_manager = currentUserInfo.preservation_manager;
param.access_right_type = currentUserInfo.access_right_type;
param.privacy_alarm = currentUserInfo.privacy_alarm;
param.access_right_type = currentUserInfo.access_right_type;
param.auto_exit_minute = currentUserInfo.auto_exit_minute;
param.privacy_print_level = currentUserInfo.privacy_print_level;
param.union_access_level = currentUserInfo.union_access_level;
param.preservation_manager = currentUserInfo.preservation_manager;
param.access_mcombo_level = currentUserInfo.access_mcombo_level;
return param;
}
//패스워드 버튼 클릭
function password_modelOpen()
{
openDivPopupId("password_model");
}
// 저장버튼클릭 - 비밀번호 체크
/** 20.04.16 jiyeong 비밀번호 갱신기간 만료 추가로 인하여 아이디 충돌방지 파라미터 추가
* @param ori_passwdId 현재 비밀번호 ID
* @param passwdId 신규 비밀번호 ID
* @param passwd_confirmId 신규 비밀번호 확인 ID
* @param closeId 팝업 닫기 ID
* @returns
*/
function passwordInfo_check(param)
{
// 좌측 메뉴 - 패스워드변경 접근의 경우
if(!param){
param = {};
param.passwdId = 'passwd';
param.passwd_confirmId = 'passwd_confirm';
param.ori_passwdId = 'ori_passwd';
param.closeId = 'password_update_close';
}
var passwdId = param.passwdId;
var passwdConfirmId = param.passwd_confirmId;
var password_check = passwordNewCheck(passwdId,passwdConfirmId);
if(password_check == 1){
if($('#'+ passwdId).val() != $('#' + passwdConfirmId).val()){
onlyMessage("새 비밀번호와 비밀번호 확인이 일치하지 않습니다.");
$('#'+passwdId).val("");
$('#'+passwdConfirmId).val("");
}else{
updateUserPassword(param);
}
}
}
//
function updateUserPassword(data)
{
var passwdId = data.passwdId;
var passwdConfirmId = data.passwd_confirmId;
var oriPasswdId = data.ori_passwdId;
var closeId = data.closeId;
var pwd = $('#' + passwdId).val();
var param = {};
param.user_key = localStorage.getItem('current_user_key');
param.passwd = pwd.toUpperCase();
param.ori_passwd = $('#' + oriPasswdId).val().toUpperCase();
$.ajax({
type: "POST",
url: "/METIS/MnUserMng/updateUserPassword.do",
dataType: "JSON",
async : true,
data:param,
success: function(data)
{
if(data.status=="SUCCESS"){
Message_callback(data.statusDescription, function(){
$("#"+closeId).click();
$('#'+oriPasswdId).val("");
$('#'+passwdId).val("");
$('#'+passwdConfirmId).val("");
// 20.04.17 jiyeong 변경된 갱신일 로컬스토리지에 반영
var current_user_info = JSON.parse(current_user_info_json);
current_user_info.PW_RENEWAL_DATE = formatDateYYYYMMDD(new Date(),"-");
localStorage.setItem('current_user_info', JSON.stringify(current_user_info));
$("#later_update_btn").click();
})
}else{
onlyMessage(data.statusDescription);
}
}
});
}
/* 정보보기 - 화면옵션 - 저장
* 저장 테이블 : alpas_view_layout_tbl
* 로컬 저장 key : LayoutOptionInfo
*
*/
function layoutOptionSave() {
let selectOption = {};
let optionvalue = $('#layoutModalSelect').val();
let option_save_location = getViewOptionData_value('그리드 설정 DB 저장',CURRENT_MANAGE_CODE);
let modalOptionValue = $('#detailSearchModalSelect').val();
//향후 옵션이 늘어날 것을 고려하여 object 형식으로 저장. 옵션이 추가 시 해당 변수에 key-value 추가 바랍니다.
// 23.06.15 김요한 상세검색 후 검색 창 닫기 옵션 추가
selectOption = {"option" : optionvalue, "modalOption" : modalOptionValue};
if (optionvalue == undefined || optionvalue == null && optionvalue =='') {
onlyMessage("저장할 설정값이 없습니다. 관리자에게 문의 바랍니다.");
return;
}
if (option_save_location != undefined && option_save_location != null && option_save_location != '' && option_save_location == 'Y') {
//DB저장
com_layoutUpdate('layout_option_for_allpage', JSON.stringify(selectOption));
} else {
//local저장
localStorage.setItem('layout_option_for_allpage_local', JSON.stringify(selectOption));
onlyMessage("설정이 저장되었습니다.
동일 PC의 모든 이용자에게 적용됩니다.");
}
}
function loginTimer(duration) {
if(null == duration || undefined == duration || duration == "" || duration == 0)
{
$('.login-count').css("visibility","collapse");
return;
}
var timer = duration * 60;
var minutes, seconds;
loginTimerInterval = setInterval(function(){
minutes = parseInt(timer / 60, 10);
seconds = parseInt(timer % 60, 10);
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds : seconds;
$('#time-min').text(minutes);
$('#time-sec').text(seconds);
var temp_value = localStorage.getItem('logout_time');
if(timer < temp_value)
{
timer = temp_value;
}
if (--timer < 0) {
timer = 0;
clearInterval(loginTimerInterval);
LogOut_excute("", true,"개인정보보호를 위하여 아래의 경우 \r\n자동 로그아웃되니 재로그인하여 주십시오\r\n["+duration+"분이상 미사용등]");
}
localStorage.setItem('logout_time',timer);
}, 1000);
}
function loginTimerReset(duration){
clearInterval(loginTimerInterval);
localStorage.setItem('logout_time',(duration*60));
loginTimer(duration);
}
function commonLocation(){
if (!$('.gnb .page_info').get(0)) {
$('.page_info').clone().appendTo($('.gnb'));
}
$('#right_container_wrapper > .page_info').remove();
}
//로그인 시간 연장
function login_time_delay()
{
loginTimerReset(logout_time);
}
//19.08.16 이현주 추가 - 로딩 멈추는 버튼
function stopLoading(){
confirmMessage("진행중인작업을 중단하고 화면을 새로 불러오시겠습니까?", stop_and_reload);
}
function stop_and_reload (e,flag){
if(flag == true){
window.location.reload();
}
};
// 비밀번호 변경
function passwdChange(){
var user_password_change_input1 = $('#common_user_password_change_input1').val().toUpperCase();
var user_password_change_input2 = $('#common_user_password_change_input2').val().toUpperCase();
if("" == user_password_change_input1 || "" == user_password_change_input2){
onlyMessage("비밀번호를 모두 입력해 주세요");
return;
}else if(user_password_change_input1 != user_password_change_input2){
onlyMessage("비밀번호와 비밀번호 확인항목이 서로 값이 다릅니다");
return;
}else{
// 비밀번호 변경
$.ajax({
type: "POST",
url: "/METIS/MnUserMng/MNchangePassword.do",
dataType: "json",
async : true,
data:{
"user_key" : currentUserInfo.user_key,
"password" : user_password_change_input1,
"ori_passwd" : user_password_change_input2,
"serviceName" : "MNchangePassword.do",
"result_type" : "JSON",
"manage_code" : CURRENT_MANAGE_CODE},
success: function(data){
var obj = data;
if(obj.status == "SUCCESS"){
$('#common_user_password_change_popup').modal('hide');
$('#common_user_password_change_input1').val("");
$('#common_user_password_change_input2').val("");
}
onlyMessage(obj.statusDescription);
}
});
}
}