Commit f1a599f0 by Takumi Imai

Merge branch 'feature/1.0_check_web_dev' into feature/1.0_check_web_dev_imai

parents 9013b5bd 739e1686
...@@ -11,1330 +11,1318 @@ ...@@ -11,1330 +11,1318 @@
* *
* @since cms:1.4.3.2&1.4.3.3 web:1.0 * @since cms:1.4.3.2&1.4.3.3 web:1.0
*/ */
var COMMON = {}; var COMMON = {};
CONSTANT.PAGE_NAME = { COMMON.loginCheckPageList = [CONSTANT.PAGE_NAME.DEFAULT, CONSTANT.PAGE_NAME.DASHBOARD, CONSTANT.PAGE_NAME.REPORT_LIST, CONSTANT.PAGE_NAME.REPORT_FORM,
DASHBOARD: 'dashboard', CONSTANT.PAGE_NAME.MESSAGE_DETAIL, CONSTANT.PAGE_NAME.MESSAGE_LIST, CONSTANT.PAGE_NAME.SEND_MESSAGE, CONSTANT.PAGE_NAME.SETTING,
OPERATION_LIST: 'workList', CONSTANT.PAGE_NAME.PICKUP, CONSTANT.PAGE_NAME.PDF_PRINT];
REPORT_LIST: 'reportList',
REPORT_FORM: 'reportForm', COMMON.hasErrorKey = 'AVW_HASERR';
MESSAGE_DETAIL: 'pushMessageDetail', $(document).ready(function() {
MESSAGE_LIST: 'pushMessageList', const checkUrl = location.href.substring(location.href.lastIndexOf('/') + 1 ,location.href.lastIndexOf(".html"));
SEND_MESSAGE: 'sendMessage', if (COMMON.loginCheckPageList.includes(checkUrl)) {
SETTING: 'accountSetting', if (!COMMON.checkLogin(CONSTANT.PAGE_NAME.LOGIN)){
PICKUP: 'pickup', return;
PDF_PRINT: 'pdfPrint', }
DEFAULT: 'index', }
LOGIN: './login.html', })
}; /**
* page transition without outputting a warning message
COMMON.loginCheckPageList = [CONSTANT.PAGE_NAME.DEFAULT, CONSTANT.PAGE_NAME.DASHBOARD, CONSTANT.PAGE_NAME.REPORT_LIST, CONSTANT.PAGE_NAME.REPORT_FORM, * @param {*} url
CONSTANT.PAGE_NAME.MESSAGE_DETAIL, CONSTANT.PAGE_NAME.MESSAGE_LIST, CONSTANT.PAGE_NAME.SEND_MESSAGE, CONSTANT.PAGE_NAME.SETTING, */
CONSTANT.PAGE_NAME.PICKUP, CONSTANT.PAGE_NAME.PDF_PRINT]; COMMON.avwScreenMove = function (url) {
COMMON.showLoading();
COMMON.hasErrorKey = 'AVW_HASERR'; window.onbeforeunload = null;
$(document).ready(function() { window.location = url;
const checkUrl = location.href.substring(location.href.lastIndexOf('/') + 1 ,location.href.lastIndexOf(".html")); };
if (COMMON.loginCheckPageList.includes(checkUrl)) {
if (!COMMON.checkLogin(CONSTANT.PAGE_NAME.LOGIN)){ /**
return; * show loading dialog
} * show msg by key
} *
}) * @param {String} key
/** */
* page transition without outputting a warning message COMMON.showLoading = function () {
* @param {*} url console.log("kdh check showLoading");
*/ $('#loader').css( {
COMMON.avwScreenMove = function (url) { 'width': $(window).width(),
COMMON.showLoading(); 'height': $(window).height()
window.onbeforeunload = null; });
window.location = url; document.getElementById('loader').style.display = 'block';
}; };
/** /**
* show loading dialog * close loading
* show msg by key */
* COMMON.closeLoading = function () {
* @param {String} key setTimeout(function(){
*/ document.getElementById('loader').style.display = 'none';
COMMON.showLoading = function () { }, 1000);
$('#loader').css( { };
'width': $(window).width(),
'height': $(window).height() /**
}); * show confirm modal with yes, no buttons
document.getElementById('loader').style.display = 'block'; * @param {Object} data - Object with {title, message, confirmYes, confirmNo}
}; * @param {callback} confirmCallback - The callback that handles the confirm button clicked
*/
/** COMMON.showConfirmModal = function (data, confirmCallback) {
* close loading if (data) {
*/ let title = '';
COMMON.closeLoading = function () { if (data.title) {
setTimeout(function(){ title = data.title;
document.getElementById('loader').style.display = 'none'; }
}, 1000); $('#confirm-modal .modal-title').text(title);
}; let message = '';
if (data.message) {
/** message = data.message;
* show confirm modal with yes, no buttons }
* @param {Object} data - Object with {title, message, confirmYes, confirmNo} $('#confirm-modal #msgModel').text(message);
* @param {callback} confirmCallback - The callback that handles the confirm button clicked if (data.confirmYes) {
*/ $('#confirm-modal #confirmYes').text(data.confirmYes);
COMMON.showConfirmModal = function (data, confirmCallback) { $('#confirm-modal #confirmYes').removeClass('d-none');
if (data) { $('#confirm-modal #confirmYes').off('click');//remove all old click handlers
let title = ''; $('#confirm-modal #confirmYes').click(function() {
if (data.title) { $('#confirm-modal .close').click();
title = data.title; if (confirmCallback) {
} //timeout for animation modal close
$('#confirm-modal .modal-title').text(title); setTimeout(function() {
let message = ''; confirmCallback();
if (data.message) { }, 500);
message = data.message; }
} });
$('#confirm-modal #msgModel').text(message); } else {
if (data.confirmYes) { $('#confirm-modal #confirmYes').addClass('d-none');
$('#confirm-modal #confirmYes').text(data.confirmYes); }
$('#confirm-modal #confirmYes').removeClass('d-none'); if (data.confirmNo) {
$('#confirm-modal #confirmYes').off('click');//remove all old click handlers $('#confirm-modal #confirmNo').text(data.confirmNo);
$('#confirm-modal #confirmYes').click(function() { $('#confirm-modal #confirmNo').removeClass('d-none');
$('#confirm-modal .close').click(); } else {
if (confirmCallback) { $('#confirm-modal #confirmNo').addClass('d-none');
//timeout for animation modal close }
setTimeout(function() { }
confirmCallback(); $('#showConfirmModalButton').click();
}, 500); };
}
}); /**
} else { * Show confirm modal with defaults: title, yes, no
$('#confirm-modal #confirmYes').addClass('d-none'); * @param {string} messageCode
} * @param {callback} confirmCallback - The callback that handles the confirm button clicked
if (data.confirmNo) { * @param {Object} options - Object with {titleCode, message, confirmYesCode, confirmNoCode}
$('#confirm-modal #confirmNo').text(data.confirmNo); */
$('#confirm-modal #confirmNo').removeClass('d-none'); COMMON.showConfirm = function (messageCode, confirmCallback, options = {}) {
} else { const defaultParams = {
$('#confirm-modal #confirmNo').addClass('d-none'); titleCode: 'confirmation',
} confirmYesCode: 'confirmYes',
} confirmNoCode: 'confirmNo'
$('#showConfirmModalButton').click(); }
}; const params = Object.assign(defaultParams, options);
let message = '';
/** if (messageCode) {
* Show confirm modal with defaults: title, yes, no message = I18N.i18nText(messageCode);
* @param {string} messageCode if (typeof message === 'undefined') {
* @param {callback} confirmCallback - The callback that handles the confirm button clicked //lang of messageCode undefined, use message or messageCode
* @param {Object} options - Object with {titleCode, message, confirmYesCode, confirmNoCode} if (params.message) {
*/ message = params.message;
COMMON.showConfirm = function (messageCode, confirmCallback, options = {}) { } else {
const defaultParams = { message = messageCode;
titleCode: 'confirmation', }
confirmYesCode: 'confirmYes', }
confirmNoCode: 'confirmNo' } else if (params.message) {
} message = params.message;
const params = Object.assign(defaultParams, options); }
let message = ''; let title = I18N.i18nText(params.titleCode);
if (messageCode) { if (params.title) {
message = I18N.i18nText(messageCode); title = params.title;
if (typeof message === 'undefined') { }
//lang of messageCode undefined, use message or messageCode COMMON.showConfirmModal({
if (params.message) { message: message,
message = params.message; title: title,
} else { confirmYes: I18N.i18nText(params.confirmYesCode),
message = messageCode; confirmNo: I18N.i18nText(params.confirmNoCode)
} }, confirmCallback);
} };
} else if (params.message) {
message = params.message; /**
} * show alert message by confirm modal html
let title = I18N.i18nText(params.titleCode); * @param {String} messageCode
if (params.title) { * @param {string} titleCode
title = params.title; * @param {Object} options - Data Options {message, titleCode, confirmNoCode}
} */
COMMON.showConfirmModal({ COMMON.showAlert = function (messageCode, titleCode = 'error', options = {}) {
message: message, const defaultParams = {
title: title, titleCode: titleCode ? titleCode : 'error',
confirmYes: I18N.i18nText(params.confirmYesCode), confirmYesCode: null,
confirmNo: I18N.i18nText(params.confirmNoCode) confirmNoCode: 'close',
}, confirmCallback); }
}; const params = Object.assign(defaultParams, options);
COMMON.showConfirm(messageCode, null, params);
/** };
* show alert message by confirm modal html
* @param {String} messageCode /**
* @param {string} titleCode * close alert
* @param {Object} options - Data Options {message, titleCode, confirmNoCode} */
*/ COMMON.alertClose = function () {
COMMON.showAlert = function (messageCode, titleCode = 'error', options = {}) { $('.alert-overlay').addClass('d-none');
const defaultParams = { $('.alert-area').addClass('d-none');
titleCode: titleCode ? titleCode : 'error', $('body').css('overflow', 'visible');
confirmYesCode: null, };
confirmNoCode: 'close',
} /**
const params = Object.assign(defaultParams, options); * go Url page With Current Params
COMMON.showConfirm(messageCode, null, params); *
}; * ios will remove all web types data when reopen webview
* need add common parameters: app, lang, debug, mobile_flg, isChat, ...
/** *
* close alert * @param {String} url
*/ * @param {Object} params
COMMON.alertClose = function () { */
$('.alert-overlay').addClass('d-none'); COMMON.goUrlWithCurrentParams = function (url, params) {
$('.alert-area').addClass('d-none'); if (!params) {
$('body').css('overflow', 'visible'); location.href = CONSTANT.URL.WEB.BASE + url;
}; }
/** const mixParams = Object.assign(COMMON.getUrlParameter(), params);
* go Url page With Current Params if (url.includes('?')) {
* location.href = url + '&' + new URLSearchParams(mixParams);
* ios will remove all web types data when reopen webview } else {
* need add common parameters: app, lang, debug, mobile_flg, isChat, ... location.href = url + '?' + new URLSearchParams(mixParams);
* }
* @param {String} url };
* @param {Object} params
*/ /**
COMMON.goUrlWithCurrentParams = function (url, params) { * get url parameter
if (!params) { *
location.href = CONSTANT.URL.WEB.BASE + url; */
} COMMON.getUrlParameter = function () {
var ret = {};
const mixParams = Object.assign(COMMON.getUrlParameter(), params); if (location.search) {
if (url.includes('?')) { var param = {};
location.href = url + '&' + new URLSearchParams(mixParams); location.search
} else { .substring(1)
location.href = url + '?' + new URLSearchParams(mixParams); .split('&')
} .forEach(function (val) {
}; var kv = val.split('=');
param[kv[0]] = kv[1];
/** });
* get url parameter ret = param;
* }
*/ console.log({ ret: ret });
COMMON.getUrlParameter = function () { return ret;
var ret = {}; };
if (location.search) {
var param = {}; /**
location.search * get sid in local Storage
.substring(1) *
.split('&') */
.forEach(function (val) { COMMON.getSid = function () {
var kv = val.split('='); return ClientData.userInfo_sid();
param[kv[0]] = kv[1]; };
});
ret = param; /**
} * cms communication
console.log({ ret: ret }); *
return ret; * @param {String} url
}; * @param {Json} param
* @param {boolean} async
/** * @param {Object} callback
* get sid in local Storage * @param {Object} errorCallback
* * @param {number} type
*/ */
COMMON.getSid = function () { COMMON.cmsAjax = function (url, param, async = true, callback, errorCallback, type) {
return ClientData.userInfo_sid(); var sysSettings = new COMMON.sysSetting();
}; if (url) {
$.ajax({
/** type: 'post',
* cms communication url: url,
* data: param,
* @param {String} url dataType: type ? type : 'json',
* @param {Json} param cache: false,
* @param {boolean} async async: async,
* @param {Object} callback crossDomain: true,
* @param {Object} errorCallback beforeSend: function (xhr) {
* @param {number} type xhr.setRequestHeader('X-AGT-AppId', sysSettings.appName);
*/ xhr.setRequestHeader('X-AGT-AppVersion', sysSettings.appVersion);
COMMON.cmsAjax = function (url, param, async = true, callback, errorCallback, type) { },
var sysSettings = new COMMON.sysSetting(); success: function (result) {
if (url) { if (type == 'text') {
$.ajax({ if (callback) callback(result);
type: 'post', return;
url: url, }
data: param, if (result.httpStatus == '200') {
dataType: type ? type : 'json', if (callback) callback(result);
cache: false, } else if (errorCallback) {
async: async, errorCallback(result);
crossDomain: true, } else if (result.httpStatus == '401') {
beforeSend: function (xhr) { COMMON.goUrlWithCurrentParams(CONSTANT.PAGE_NAME.LOGIN);
xhr.setRequestHeader('X-AGT-AppId', sysSettings.appName); } else if (result.httpStatus == '403') {
xhr.setRequestHeader('X-AGT-AppVersion', sysSettings.appVersion); COMMON.closeLoading();
}, COMMON.showAlert('errorOccurred');
success: function (result) { } else {
if (type == 'text') { COMMON.closeLoading();
if (callback) callback(result); COMMON.showAlert(result.message);
return; }
} },
if (result.httpStatus == '200') { error: function (XMLHttpRequest, textStatus, errorThrown) {
if (callback) callback(result); if (errorCallback) {
} else if (errorCallback) { errorCallback(XMLHttpRequest, textStatus, errorThrown);
errorCallback(result); } else {
} else if (result.httpStatus == '401') { COMMON.closeLoading();
COMMON.goUrlWithCurrentParams(CONSTANT.PAGE_NAME.LOGIN); COMMON.showAlert('errorCommunicationFailed');
} else if (result.httpStatus == '403') { }
COMMON.closeLoading(); },
COMMON.showAlert('errorOccurred'); });
} else { } else {
COMMON.closeLoading(); if (errorCallback) {
COMMON.showAlert(result.message); errorCallback();
} } else {
}, COMMON.closeLoading();
error: function (XMLHttpRequest, textStatus, errorThrown) { COMMON.showAlert('errorOccurred');
if (errorCallback) { }
errorCallback(XMLHttpRequest, textStatus, errorThrown); }
} else { };
COMMON.closeLoading();
COMMON.showAlert('errorCommunicationFailed'); /**
} * Check if user is logged in
}, *
}); * @param {boolean} async
} else { */
if (errorCallback) { COMMON.checkAuth = function (async = true) {
errorCallback(); let params = {};
} else { console.log("kdh check");
COMMON.closeLoading(); params.sid = COMMON.getSid;
COMMON.showAlert('errorOccurred'); const url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.API.AUTH_SESSION;
} COMMON.cmsAjax(url, params, async, null, function () {
} COMMON.goUrlWithCurrentParams(CONSTANT.PAGE_NAME.LOGIN);
}; });
};
/**
* Check if user is logged in var ClientData = {
* // Local :userInfo_account path:String
* @param {boolean} async userInfo_accountPath: function (data) {
*/ if (arguments.length > 0) {
COMMON.checkAuth = function (async = true) { COMMON.userSetting().set(CONSTANT.KEYS.userInfo_accountPath, data);
let params = {}; } else {
params.sid = COMMON.getSid; return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_accountPath);
const url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.API.AUTH_SESSION; }
COMMON.cmsAjax(url, params, async, null, function () { },
COMMON.goUrlWithCurrentParams(CONSTANT.PAGE_NAME.LOGIN);
}); // Local :userInfo_loginID:String
}; userInfo_loginId: function (data) {
if (arguments.length > 0) {
var ClientData = { COMMON.userSetting().set(CONSTANT.KEYS.userInfo_loginId, data);
// Local :userInfo_account path:String } else {
userInfo_accountPath: function (data) { return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_loginId);
if (arguments.length > 0) { }
COMMON.userSetting().set(CONSTANT.KEYS.userInfo_accountPath, data); },
} else {
return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_accountPath); // Local :userInfo_Account Information Storage Flag:Char(Y:Available, N:Not Available)
} userInfo_rememberLogin: function (data) {
}, if (arguments.length > 0) {
COMMON.userSetting().set(CONSTANT.KEYS.userInfo_rememberLogin, data);
// Local :userInfo_loginID:String } else {
userInfo_loginId: function (data) { return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_rememberLogin);
if (arguments.length > 0) { }
COMMON.userSetting().set(CONSTANT.KEYS.userInfo_loginId, data); },
} else {
return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_loginId); // Session :userInfo_loginID:String
} userInfo_loginId_session: function (data) {
}, if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.userInfo_loginId, data);
// Local :userInfo_Account Information Storage Flag:Char(Y:Available, N:Not Available) } else {
userInfo_rememberLogin: function (data) { return SessionStorageUtils.get(CONSTANT.KEYS.userInfo_loginId);
if (arguments.length > 0) { }
COMMON.userSetting().set(CONSTANT.KEYS.userInfo_rememberLogin, data); },
} else {
return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_rememberLogin); // Session :userInfo_account path:String
} userInfo_accountPath_session: function (data) {
}, if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.userInfo_accountPath, data);
// Session :userInfo_loginID:String } else {
userInfo_loginId_session: function (data) { return SessionStorageUtils.get(CONSTANT.KEYS.userInfo_accountPath);
if (arguments.length > 0) { }
SessionStorageUtils.set(CONSTANT.KEYS.userInfo_loginId, data); },
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.userInfo_loginId); // Session
} userInfo_userName: function (data) {
}, if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.userInfo_userName, data);
// Session :userInfo_account path:String } else {
userInfo_accountPath_session: function (data) { return SessionStorageUtils.get(CONSTANT.KEYS.userInfo_userName);
if (arguments.length > 0) { }
SessionStorageUtils.set(CONSTANT.KEYS.userInfo_accountPath, data); },
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.userInfo_accountPath); // Local :userInfo_Last login date and time:Datetime
} userInfo_lastLoginTime: function (data) {
}, if (arguments.length > 0) {
COMMON.operateData(arguments, CONSTANT.KEYS.userInfo_lastLoginTime, undefined);
// Session } else {
userInfo_userName: function (data) { return COMMON.operateData(arguments, CONSTANT.KEYS.userInfo_lastLoginTime, undefined);
if (arguments.length > 0) { }
SessionStorageUtils.set(CONSTANT.KEYS.userInfo_userName, data); },
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.userInfo_userName); // Session:userInfo_SessionID:String
} userInfo_sid: function (data) {
}, if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.userInfo_sid, data);
// Local :userInfo_Last login date and time:Datetime // COMMON.userSetting().set(CONSTANT.KEYS.userInfo_sid, data);
userInfo_lastLoginTime: function (data) { } else {
if (arguments.length > 0) { // return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_sid);
COMMON.operateData(arguments, CONSTANT.KEYS.userInfo_lastLoginTime, undefined); if (COMMON.userSession()) {
} else { return SessionStorageUtils.get(CONSTANT.KEYS.userInfo_sid);
return COMMON.operateData(arguments, CONSTANT.KEYS.userInfo_lastLoginTime, undefined); }
} return null;
}, }
},
// Session:userInfo_SessionID:String
userInfo_sid: function (data) { // Local: userInfo_SessionID:String
if (arguments.length > 0) { userInfo_sid_local: function (data) {
SessionStorageUtils.set(CONSTANT.KEYS.userInfo_sid, data); if (arguments.length > 0) {
// COMMON.userSetting().set(CONSTANT.KEYS.userInfo_sid, data); COMMON.userSetting().set(CONSTANT.KEYS.userInfo_sid_local, data);
} else { } else {
// return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_sid); return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_sid_local);
if (COMMON.userSession()) { }
return SessionStorageUtils.get(CONSTANT.KEYS.userInfo_sid); },
}
return null; // Local: Session ID backup
} userInfo_sid_local_bak: function (data) {
}, if (arguments.length > 0) {
COMMON.userSetting().set(CONSTANT.KEYS.userInfo_sid_bak, data);
// Local: userInfo_SessionID:String } else {
userInfo_sid_local: function (data) { return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_sid_bak);
if (arguments.length > 0) { }
COMMON.userSetting().set(CONSTANT.KEYS.userInfo_sid_local, data); },
} else {
return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_sid_local); // Session :Notification information (pushInfo)_Number of new arrivals:Interger
} pushInfo_newMsgNumber: function (data) {
}, if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.pushInfo_newMsgNumber, data);
// Local: Session ID backup } else {
userInfo_sid_local_bak: function (data) { return SessionStorageUtils.get(CONSTANT.KEYS.pushInfo_newMsgNumber);
if (arguments.length > 0) { }
COMMON.userSetting().set(CONSTANT.KEYS.userInfo_sid_bak, data); },
} else {
return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_sid_bak); // apiUrl
} conf_apiUrl: function (data) {
}, if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.conf_apiUrl, data);
// Session :Notification information (pushInfo)_Number of new arrivals:Interger } else {
pushInfo_newMsgNumber: function (data) { return SessionStorageUtils.get(CONSTANT.KEYS.conf_apiUrl);
if (arguments.length > 0) { }
SessionStorageUtils.set(CONSTANT.KEYS.pushInfo_newMsgNumber, data); },
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.pushInfo_newMsgNumber); // api login url
} conf_apiLoginUrl: function (data) {
}, if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.conf_apiLoginUrl, data);
// apiUrl } else {
conf_apiUrl: function (data) { return SessionStorageUtils.get(CONSTANT.KEYS.conf_apiLoginUrl);
if (arguments.length > 0) { }
SessionStorageUtils.set(CONSTANT.KEYS.conf_apiUrl, data); },
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.conf_apiUrl); //check api url
} conf_checkApiUrl: function (data) {
}, if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.conf_checkApiUrl, data);
// api login url } else {
conf_apiLoginUrl: function (data) { return SessionStorageUtils.get(CONSTANT.KEYS.conf_checkApiUrl);
if (arguments.length > 0) { }
SessionStorageUtils.set(CONSTANT.KEYS.conf_apiLoginUrl, data); },
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.conf_apiLoginUrl); // api resorce dl url
} conf_apiResourceDlUrl: function (data) {
}, if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.conf_apiResourceDlUrl, data);
//check api url } else {
conf_checkApiUrl: function (data) { return SessionStorageUtils.get(CONSTANT.KEYS.conf_apiResourceDlUrl);
if (arguments.length > 0) { }
SessionStorageUtils.set(CONSTANT.KEYS.conf_checkApiUrl, data); },
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.conf_checkApiUrl); // Local :userInfo_password_skip_datetime:Datetime
} userInfo_pwdSkipDt: function (data) {
}, if (arguments.length > 0) {
COMMON.operateData(arguments, CONSTANT.KEYS.userInfo_pwdSkipDt, undefined);
// api resorce dl url } else {
conf_apiResourceDlUrl: function (data) { return COMMON.operateData(arguments, CONSTANT.KEYS.userInfo_pwdSkipDt, undefined);
if (arguments.length > 0) { }
SessionStorageUtils.set(CONSTANT.KEYS.conf_apiResourceDlUrl, data); },
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.conf_apiResourceDlUrl); // Session :Business Option (serviceOpt)_ABookCheck:Char(Y:Enable, N:Disable)
} serviceOpt_abook_check: function (data) {
}, if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.serviceOpt_abook_check, data);
// Local :userInfo_password_skip_datetime:Datetime } else {
userInfo_pwdSkipDt: function (data) { return SessionStorageUtils.get(CONSTANT.KEYS.serviceOpt_abook_check);
if (arguments.length > 0) { }
COMMON.operateData(arguments, CONSTANT.KEYS.userInfo_pwdSkipDt, undefined); },
} else {
return COMMON.operateData(arguments, CONSTANT.KEYS.userInfo_pwdSkipDt, undefined); // Session : Tenant Service_Option(serviceOpt)_ChatFunction:Char(Y:Use, N:Unused)
} serviceOpt_chat_function: function (data) {
}, if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.serviceOpt_abook_check, data);
// Session :Business Option (serviceOpt)_ABookCheck:Char(Y:Enable, N:Disable) } else {
serviceOpt_abook_check: function (data) { return SessionStorageUtils.get(CONSTANT.KEYS.serviceOpt_abook_check);
if (arguments.length > 0) { }
SessionStorageUtils.set(CONSTANT.KEYS.serviceOpt_abook_check, data); },
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.serviceOpt_abook_check); // Session :Business Option(serviceOpt)_Forced password change at first login:Integer(0:None, 1:Prompt, 2:Forced)
} serviceOpt_force_pw_change_on_login: function (data) {
}, if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.serviceOpt_force_pw_change_on_login, data);
// Session : Tenant Service_Option(serviceOpt)_ChatFunction:Char(Y:Use, N:Unused) } else {
serviceOpt_chat_function: function (data) { return SessionStorageUtils.get(CONSTANT.KEYS.serviceOpt_force_pw_change_on_login);
if (arguments.length > 0) { }
SessionStorageUtils.set(CONSTANT.KEYS.serviceOpt_abook_check, data); },
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.serviceOpt_abook_check); // Session :Business Option(serviceOpt)_Forced password change at regular login:Integer(0:None, 1:Prompt, 2:Forced)
} serviceOpt_force_pw_change_periodically: function (data) {
}, if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.serviceOpt_force_pw_change_periodically, data);
// Session :Business Option(serviceOpt)_Forced password change at first login:Integer(0:None, 1:Prompt, 2:Forced) } else {
serviceOpt_force_pw_change_on_login: function (data) { return SessionStorageUtils.get(CONSTANT.KEYS.serviceOpt_force_pw_change_periodically);
if (arguments.length > 0) { }
SessionStorageUtils.set(CONSTANT.KEYS.serviceOpt_force_pw_change_on_login, data); },
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.serviceOpt_force_pw_change_on_login); // Session :Business option (serviceOpt)_arbitrary push message:Char(Y:possible, N:not possible)
} serviceOpt_usable_push_message: function (data) {
}, if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.serviceOpt_usable_push_message, data);
// Session :Business Option(serviceOpt)_Forced password change at regular login:Integer(0:None, 1:Prompt, 2:Forced) } else {
serviceOpt_force_pw_change_periodically: function (data) { return SessionStorageUtils.get(CONSTANT.KEYS.serviceOpt_usable_push_message);
if (arguments.length > 0) { }
SessionStorageUtils.set(CONSTANT.KEYS.serviceOpt_force_pw_change_periodically, data); },
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.serviceOpt_force_pw_change_periodically); // Local
} JumpQueue: function (data) {
}, if (arguments.length > 0) {
COMMON.operateData(arguments, CONSTANT.KEYS.JumpQueue, []);
// Session :Business option (serviceOpt)_arbitrary push message:Char(Y:possible, N:not possible) } else {
serviceOpt_usable_push_message: function (data) { return COMMON.operateData(arguments, CONSTANT.KEYS.JumpQueue, []);
if (arguments.length > 0) { }
SessionStorageUtils.set(CONSTANT.KEYS.serviceOpt_usable_push_message, data); },
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.serviceOpt_usable_push_message); // Local
} IsJumpBack: function (data) {
}, if (arguments.length > 0) {
COMMON.operateData(arguments, CONSTANT.KEYS.IsJumpBack, undefined);
// Local } else {
JumpQueue: function (data) { return COMMON.operateData(arguments, CONSTANT.KEYS.IsJumpBack, undefined);
if (arguments.length > 0) { }
COMMON.operateData(arguments, CONSTANT.KEYS.JumpQueue, []); },
} else { };
return COMMON.operateData(arguments, CONSTANT.KEYS.JumpQueue, []);
} /*
}, * Variables
*/
// Local COMMON.userSessionObj = null;
IsJumpBack: function (data) { COMMON.userSettingObj = null;
if (arguments.length > 0) { COMMON.sysSettingObj = null;
COMMON.operateData(arguments, CONSTANT.KEYS.IsJumpBack, undefined);
} else { /*
return COMMON.operateData(arguments, CONSTANT.KEYS.IsJumpBack, undefined); * User Settings Class Definition
} */
}, var UserSetting = function () {
}; this.US_KEY = 'AVWUS';
this.userSetting = this.load();
/* };
* Variables /* get user setting from localStorage */
*/ UserSetting.prototype.load = function () {
COMMON.userSessionObj = null; var storage = window.localStorage;
COMMON.userSettingObj = null; var value = null;
COMMON.sysSettingObj = null; var js = null;
if (storage) {
/* var value = storage.getItem(this.US_KEY);
* User Settings Class Definition if (!value) {
*/ value = '{}'; // empty JSON string
var UserSetting = function () { }
this.US_KEY = 'AVWUS'; js = JSON.parse(value);
this.userSetting = this.load(); }
}; return js;
/* get user setting from localStorage */ };
UserSetting.prototype.load = function () {
var storage = window.localStorage; /**
var value = null; * store user setting
var js = null; * @param {*} key
if (storage) { * @param {*} value
var value = storage.getItem(this.US_KEY); */
if (!value) { UserSetting.prototype.set = function (key, value) {
value = '{}'; // empty JSON string this.userSetting = this.load();
} var values = this.userSetting;
js = JSON.parse(value); if (!values) {
} values = { key: value };
return js; } else {
}; values[key] = value;
}
/** var storage = window.localStorage;
* store user setting if (storage) {
* @param {*} key var jsonStr = JSON.stringify(values);
* @param {*} value storage.setItem(this.US_KEY, jsonStr);
*/ }
UserSetting.prototype.set = function (key, value) { this.userSetting = values;
this.userSetting = this.load(); };
var values = this.userSetting;
if (!values) { /**
values = { key: value }; * grab user setting
} else { * @param {*} key
values[key] = value; * @returns
} */
var storage = window.localStorage; UserSetting.prototype.get = function (key) {
if (storage) { this.userSetting = this.load();
var jsonStr = JSON.stringify(values); var values = this.userSetting;
storage.setItem(this.US_KEY, jsonStr); if (values) {
} return values[key];
this.userSetting = values; }
}; return null;
};
/**
* grab user setting /**
* @param {*} key * show user setting object list
* @returns * @param {*} elmid
*/ */
UserSetting.prototype.get = function (key) { UserSetting.prototype.show = function (elmid) {
this.userSetting = this.load(); var storage = window.localStorage;
var values = this.userSetting; var tags = '<p>';
if (values) { if (storage) {
return values[key]; var value = storage.getItem(this.US_KEY);
} if (value) {
return null; var js = JSON.parse(value);
}; $.each(js, function (k, v) {
tags = tags + '<b>' + k + '</b>:' + v + '<br />';
/** });
* show user setting object list }
* @param {*} elmid tags = tags + '</p>';
*/ $(elmid).html(tags);
UserSetting.prototype.show = function (elmid) { }
var storage = window.localStorage; };
var tags = '<p>'; /* Retrieve a list of user-set keys */
if (storage) { UserSetting.prototype.keys = function () {
var value = storage.getItem(this.US_KEY); var storage = window.localStorage;
if (value) { var keyList = [];
var js = JSON.parse(value); if (storage) {
$.each(js, function (k, v) { var value = storage.getItem(this.US_KEY);
tags = tags + '<b>' + k + '</b>:' + v + '<br />'; if (value) {
}); var js = JSON.parse(value);
} var i = 0;
tags = tags + '</p>'; $.each(js, function (k, v) {
$(elmid).html(tags); keyList[i++] = k;
} });
}; }
/* Retrieve a list of user-set keys */ return keyList;
UserSetting.prototype.keys = function () { }
var storage = window.localStorage; return null;
var keyList = []; };
if (storage) {
var value = storage.getItem(this.US_KEY); /**
if (value) { * Delete user settings
var js = JSON.parse(value); * @param {*} key
var i = 0; */
$.each(js, function (k, v) { UserSetting.prototype.remove = function (key) {
keyList[i++] = k; var storage = window.localStorage;
}); if (storage) {
} var value = storage.getItem(this.US_KEY);
return keyList; if (value) {
} var js = JSON.parse(value);
return null; if (js) {
}; delete js[key];
storage.setItem(this.US_KEY, JSON.stringify(js));
/** }
* Delete user settings }
* @param {*} key }
*/ };
UserSetting.prototype.remove = function (key) { /* Delete all user settings */
var storage = window.localStorage; UserSetting.prototype.removeAll = function () {
if (storage) { var storage = window.localStorage;
var value = storage.getItem(this.US_KEY); if (storage) {
if (value) { storage.remove(this.US_KEY);
var js = JSON.parse(value); }
if (js) { };
delete js[key];
storage.setItem(this.US_KEY, JSON.stringify(js)); /*
} * User Session Class Definition
} */
} var UserSession = function () {
}; this.available = false;
/* Delete all user settings */ };
UserSetting.prototype.removeAll = function () {
var storage = window.localStorage; /**
if (storage) { * Initialize User Session
storage.remove(this.US_KEY); * @param {*} option
} */
}; UserSession.prototype.init = function (option) {
this.available = false;
/* if (option == 'restore') {
* User Session Class Definition var value = null;
*/ try {
var UserSession = function () { value = this._get('init');
this.available = false; } catch (e) {
}; value = null;
} finally {
/** if (value) {
* Initialize User Session this.available = true;
* @param {*} option }
*/ }
UserSession.prototype.init = function (option) { } else {
this.available = false; this.set('init', new Date().toLocaleString());
if (option == 'restore') { this.available = true;
var value = null; }
try { };
value = this._get('init');
} catch (e) { /**
value = null; * store key, value item to user session
} finally { * @param {*} key
if (value) { * @param {*} value
this.available = true; */
} UserSession.prototype.set = function (key, value) {
} var storage = window.sessionStorage;
} else { if (storage) {
this.set('init', new Date().toLocaleString()); if (this.available == false) {
this.available = true; if (key == 'init') {
} storage.setItem('AVWS_' + key, value);
}; } else {
throw new Error('Session destoryed.');
/** }
* store key, value item to user session } else {
* @param {*} key storage.setItem('AVWS_' + key, value);
* @param {*} value }
*/ }
UserSession.prototype.set = function (key, value) { };
var storage = window.sessionStorage;
if (storage) { /**
if (this.available == false) { * get session item value
if (key == 'init') { * @param {*} key
storage.setItem('AVWS_' + key, value); * @returns
} else { */
throw new Error('Session destoryed.'); UserSession.prototype.get = function (key) {
} var value = null;
} else { if (this.available) {
storage.setItem('AVWS_' + key, value); value = this._get(key);
} } else {
} throw new Error('Session Destroyed.');
}; }
return value;
/** };
* get session item value
* @param {*} key /**
* @returns * get item value from session storage
*/ * @param {*} key
UserSession.prototype.get = function (key) { * @returns
var value = null; */
if (this.available) { UserSession.prototype._get = function (key) {
value = this._get(key); var storage = window.sessionStorage;
} else { var value = null;
throw new Error('Session Destroyed.'); if (storage) {
} value = storage.getItem('AVWS_' + key);
return value; }
}; return value;
};
/** /* destroy user session */
* get item value from session storage UserSession.prototype.destroy = function () {
* @param {*} key var storage = window.sessionStorage;
* @returns if (storage) {
*/ storage.clear();
UserSession.prototype._get = function (key) { this.available = false;
var storage = window.sessionStorage; }
var value = null; };
if (storage) {
value = storage.getItem('AVWS_' + key); /**
} * show user session object list
return value; * @param {*} elmid
}; */
/* destroy user session */ UserSession.prototype.show = function (elmid) {
UserSession.prototype.destroy = function () { var storage = window.sessionStorage;
var storage = window.sessionStorage; var tags = '<p>';
if (storage) { if (storage) {
storage.clear(); for (var i = 0; i < storage.length; i++) {
this.available = false; var key = storage.key(i);
} var value = storage.getItem(key);
}; tags = tags + '<b>' + key + '</b>:' + value + '<br />';
}
/** tags = tags + '</p>';
* show user session object list $(elmid).html(tags);
* @param {*} elmid }
*/ };
UserSession.prototype.show = function (elmid) {
var storage = window.sessionStorage; /* Initialize system */
var tags = '<p>'; $(function () {
if (storage) { // Determine the path where the system configuration files are located
for (var i = 0; i < storage.length; i++) {
var key = storage.key(i); var location = window.location.toString().toLowerCase();
var value = storage.getItem(key);
tags = tags + '<b>' + key + '</b>:' + value + '<br />'; var sysFile = '';
} if (location.indexOf('/abweb') < 0) {
tags = tags + '</p>'; sysFile = '../abweb/common/json/sys/conf.json';
$(elmid).html(tags); } else {
} sysFile = '../common/json/sys/conf.json';
}; }
/* Initialize system */ // Read the system configuration file
$(function () { $.ajax({
// Determine the path where the system configuration files are located url: sysFile,
async: false,
var location = window.location.toString().toLowerCase(); cache: false,
dataType: 'json',
var sysFile = ''; success: function (data) {
if (location.indexOf('/abweb') < 0) { COMMON.sysSettingObj = data;
sysFile = '../abweb/common/json/sys/conf.json'; },
} else { error: function (xmlHttpRequest, txtStatus, errorThrown) {
sysFile = '../common/json/sys/conf.json'; var error = 'Could not load the system configuration file. Please check it.';
} error += '\n' + xmlHttpRequest.status + ' ' + txtStatus + ' ' + errorThrown + ' : ' + sysFile;
alert(error);
// Read the system configuration file },
$.ajax({ });
url: sysFile,
async: false, // Clear error conditions once at load time.
cache: false, COMMON.clearError();
dataType: 'json',
success: function (data) { //#31919 [Investigation] Business meeting support system GoogleChrome does not work with Bitch in/out.
COMMON.sysSettingObj = data; navigator.pointerEnabled = navigator.maxTouchPoints > 0; // Edge 17 touch support workaround
}, document.documentElement.ontouchstart = navigator.maxTouchPoints > 0 ? function () {} : undefined; // Chrome 70 touch support workaround
error: function (xmlHttpRequest, txtStatus, errorThrown) { });
var error = 'Could not load the system configuration file. Please check it.';
error += '\n' + xmlHttpRequest.status + ' ' + txtStatus + ' ' + errorThrown + ' : ' + sysFile; // Hide the locking layout
alert(error); COMMON.unlockLayout = function () {
}, $('#avw-sys-modal').hide();
}); };
// Clear error conditions once at load time. // Show the locking layout
COMMON.clearError(); COMMON.lockLayout = function () {
if (document.getElementById('avw-sys-modal')) {
//#31919 [Investigation] Business meeting support system GoogleChrome does not work with Bitch in/out. $('#avw-sys-modal').show();
navigator.pointerEnabled = navigator.maxTouchPoints > 0; // Edge 17 touch support workaround } else {
document.documentElement.ontouchstart = navigator.maxTouchPoints > 0 ? function () {} : undefined; // Chrome 70 touch support workaround var tags = '<div id="avw-sys-modal"></div>';
}); $('body').prepend(tags);
$('#avw-sys-modal').css({
// Hide the locking layout opacity: 0.7,
COMMON.unlockLayout = function () { position: 'fixed',
$('#avw-sys-modal').hide(); top: '0',
}; left: '0',
width: $(window).width(),
// Show the locking layout height: $(window).height(),
COMMON.lockLayout = function () { background: '#999',
if (document.getElementById('avw-sys-modal')) { 'z-index': 100,
$('#avw-sys-modal').show(); });
} else { // resize error page
var tags = '<div id="avw-sys-modal"></div>'; $(window).resize(function () {
$('body').prepend(tags); $('#avw-sys-modal').css({
$('#avw-sys-modal').css({ width: $(window).width(),
opacity: 0.7, height: $(window).height(),
position: 'fixed', });
top: '0', });
left: '0', }
width: $(window).width(), };
height: $(window).height(),
background: '#999', /* Clear error condition */
'z-index': 100, COMMON.clearError = function () {
}); var session = window.sessionStorage;
// resize error page if (session) {
$(window).resize(function () { session.setItem(COMMON.hasErrorKey, false);
$('#avw-sys-modal').css({ }
width: $(window).width(), };
height: $(window).height(), /* Get error status */
}); COMMON.hasError = function () {
}); var session = window.sessionStorage;
} var isError = false;
}; if (session) {
isError = session.getItem(COMMON.hasErrorKey);
/* Clear error condition */ }
COMMON.clearError = function () { return isError == 'true';
var session = window.sessionStorage; };
if (session) { /* Set to error condition */
session.setItem(COMMON.hasErrorKey, false); COMMON.setErrorState = function () {
} var session = window.sessionStorage;
}; if (session) {
/* Get error status */ session.setItem(COMMON.hasErrorKey, true);
COMMON.hasError = function () { }
var session = window.sessionStorage; };
var isError = false;
if (session) { /* get user session object */
isError = session.getItem(COMMON.hasErrorKey); COMMON.userSession = function () {
} if (!COMMON.userSessionObj) {
return isError == 'true'; var obj = new UserSession();
}; obj.init('restore');
/* Set to error condition */ if (obj.available) {
COMMON.setErrorState = function () { COMMON.userSessionObj = obj;
var session = window.sessionStorage; return COMMON.userSessionObj;
if (session) { } else {
session.setItem(COMMON.hasErrorKey, true); return null;
} }
}; }
return COMMON.userSessionObj;
/* get user session object */ };
COMMON.userSession = function () { /* create user session object */
if (!COMMON.userSessionObj) { COMMON.createUserSession = function () {
var obj = new UserSession(); if (COMMON.userSessionObj) {
obj.init('restore'); COMMON.userSessionObj.destroy();
if (obj.available) { } else {
COMMON.userSessionObj = obj; COMMON.userSessionObj = new UserSession();
return COMMON.userSessionObj; COMMON.userSessionObj.init();
} else { }
return null; return COMMON.userSessionObj;
} };
}
return COMMON.userSessionObj; /* get user setting object */
}; COMMON.userSetting = function () {
/* create user session object */ if (COMMON.userSettingObj == null) {
COMMON.createUserSession = function () { COMMON.userSettingObj = new UserSetting();
if (COMMON.userSessionObj) { }
COMMON.userSessionObj.destroy(); return COMMON.userSettingObj;
} else { };
COMMON.userSessionObj = new UserSession();
COMMON.userSessionObj.init(); /* get system setting object */
} COMMON.sysSetting = function () {
return COMMON.userSessionObj; return COMMON.sysSettingObj;
}; };
/* get user setting object */ /*
COMMON.userSetting = function () { * Operations for session storage [start]
if (COMMON.userSettingObj == null) { */
COMMON.userSettingObj = new UserSetting();
} var SessionStorageUtils = {
return COMMON.userSettingObj; login: function () {
}; if (COMMON.userSession()) {
// Skip this case
/* get system setting object */ } else {
COMMON.sysSetting = function () { COMMON.avwCreateUserSession();
return COMMON.sysSettingObj; }
}; },
get: function (strKey) {
/* return COMMON.userSession().get(strKey);
* Operations for session storage [start] },
*/ set: function (strKey, objValue) {
COMMON.userSession().set(strKey, objValue);
var SessionStorageUtils = { },
login: function () { clear: function () {
if (COMMON.userSession()) { if (COMMON.userSession()) {
// Skip this case COMMON.userSession().destroy();
} else { }
COMMON.avwCreateUserSession(); },
} remove: function (strKey) {
}, COMMON.userSession().set(strKey, null);
get: function (strKey) { },
return COMMON.userSession().get(strKey); };
},
set: function (strKey, objValue) { /*
COMMON.userSession().set(strKey, objValue); * Operations for local storage
}, */
clear: function () { var LocalStorageUtils = {
if (COMMON.userSession()) { getUniqueId: function () {
COMMON.userSession().destroy(); var uniqueId = '';
}
}, if (COMMON.userSetting().get(CONSTANT.KEYS.userInfo_accountPath)) {
remove: function (strKey) { uniqueId += COMMON.userSetting().get(CONSTANT.KEYS.userInfo_accountPath);
COMMON.userSession().set(strKey, null); }
}, if (COMMON.userSetting().get(CONSTANT.KEYS.userInfo_loginId)) {
}; uniqueId += '.' + COMMON.userSetting().get(CONSTANT.KEYS.userInfo_loginId);
}
/* if (uniqueId != '') {
* Operations for local storage uniqueId += '.';
*/ }
var LocalStorageUtils = {
getUniqueId: function () { return uniqueId;
var uniqueId = ''; },
get: function (strKey) {
if (COMMON.userSetting().get(CONSTANT.KEYS.userInfo_accountPath)) { var key = this.getUniqueId() + strKey;
uniqueId += COMMON.userSetting().get(CONSTANT.KEYS.userInfo_accountPath);
} return COMMON.userSetting().get(key);
if (COMMON.userSetting().get(CONSTANT.KEYS.userInfo_loginId)) { },
uniqueId += '.' + COMMON.userSetting().get(CONSTANT.KEYS.userInfo_loginId); set: function (strKey, objValue) {
} var key = this.getUniqueId() + strKey;
if (uniqueId != '') { COMMON.userSetting().set(key, objValue);
uniqueId += '.'; },
} remove: function (strKey) {
var key = this.getUniqueId() + strKey;
return uniqueId; COMMON.userSetting().remove(key);
}, SessionStorageUtils.remove(strKey);
get: function (strKey) { },
var key = this.getUniqueId() + strKey; clear: function () {
var localStorageKeys = COMMON.userSetting().keys();
return COMMON.userSetting().get(key); for (var nIndex = 0; nIndex < localStorageKeys.length; nIndex++) {
}, var strKey = localStorageKeys[nIndex];
set: function (strKey, objValue) {
var key = this.getUniqueId() + strKey; if ((strKey + '').contains(this.getUniqueId())) {
COMMON.userSetting().set(key, objValue); COMMON.userSetting().remove(strKey);
}, }
remove: function (strKey) { }
var key = this.getUniqueId() + strKey; },
COMMON.userSetting().remove(key); existKey: function (strKey) {
SessionStorageUtils.remove(strKey); var keys = COMMON.userSetting().keys();
}, var findKey = this.getUniqueId() + strKey;
clear: function () { var isExisted = false;
var localStorageKeys = COMMON.userSetting().keys(); if (keys != null && keys != undefined) {
for (var nIndex = 0; nIndex < localStorageKeys.length; nIndex++) { for (var nIndex = 0; nIndex < keys.length; nIndex++) {
var strKey = localStorageKeys[nIndex]; if (keys[nIndex] == findKey) {
isExisted = true;
if ((strKey + '').contains(this.getUniqueId())) { break;
COMMON.userSetting().remove(strKey); }
} }
} }
}, return isExisted;
existKey: function (strKey) { },
var keys = COMMON.userSetting().keys(); };
var findKey = this.getUniqueId() + strKey;
var isExisted = false; /**
if (keys != null && keys != undefined) { * String.format function def.
for (var nIndex = 0; nIndex < keys.length; nIndex++) { * @param {*} fmt
if (keys[nIndex] == findKey) { * @returns
isExisted = true; */
break; COMMON.format = function (fmt) {
} for (var i = 1; i < arguments.length; i++) {
} var reg = new RegExp('\\{' + (i - 1) + '\\}', 'g');
} fmt = fmt.replace(reg, arguments[i]);
return isExisted; }
}, return fmt;
}; };
/** /**
* String.format function def. * Get param url
* @param {*} fmt * @param {*} name
* @returns * @param {*} url
*/ * @returns
COMMON.format = function (fmt) { */
for (var i = 1; i < arguments.length; i++) { COMMON.getUrlParam = function (name, url) {
var reg = new RegExp('\\{' + (i - 1) + '\\}', 'g'); if (!url) {
fmt = fmt.replace(reg, arguments[i]); url = window.location.href;
} }
return fmt;
}; name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
var regexS = '[\\?&]' + name + '=([^&#]*)';
/** var regex = new RegExp(regexS);
* Get param url var results = regex.exec(url);
* @param {*} name if (results == null) {
* @param {*} url return '';
* @returns } else {
*/ return results[1];
COMMON.getUrlParam = function (name, url) { }
if (!url) { };
url = window.location.href;
} // Toogle Logout Nortice
COMMON.ToogleLogoutNortice = function () {
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]'); window.onbeforeunload = function (event) {
var regexS = '[\\?&]' + name + '=([^&#]*)'; var message = I18N.i18nText('sysInfoWithoutLogout');
var regex = new RegExp(regexS); var e = event || window.event;
var results = regex.exec(url); if (e) {
if (results == null) { e.returnValue = message;
return ''; }
} else { return message;
return results[1]; };
} };
};
/**
// Toogle Logout Nortice * * Get data from localstorage and sessionstorage synchronization If has any
COMMON.ToogleLogoutNortice = function () { * param (args.length > 0) -> setter If has not param (args.length = 0) ->
window.onbeforeunload = function (event) { * getter . Get from session: + if it existed and key existed in localstorage ->
var message = I18N.i18nText('sysInfoWithoutLogout'); * return result + else: set value from local to sessionstorage -> return value
var e = event || window.event; * of sessionstorage if value is not empty, otherwise, return default result.
if (e) { * @param {*} args
e.returnValue = message; * @param {*} strKey
} * @param {*} returnDefaultData
return message; * @returns
}; */
}; COMMON.operateData = function (args, strKey, returnDefaultData) {
if (args.length > 0) {
/** var data = args[0];
* * Get data from localstorage and sessionstorage synchronization If has any LocalStorageUtils.set(strKey, data);
* param (args.length > 0) -> setter If has not param (args.length = 0) -> SessionStorageUtils.set(strKey, JSON.stringify(data));
* getter . Get from session: + if it existed and key existed in localstorage -> } else {
* return result + else: set value from local to sessionstorage -> return value if (
* of sessionstorage if value is not empty, otherwise, return default result. SessionStorageUtils.get(strKey) != 'undefined' &&
* @param {*} args SessionStorageUtils.get(strKey) != undefined &&
* @param {*} strKey SessionStorageUtils.get(strKey) != '' &&
* @param {*} returnDefaultData SessionStorageUtils.get(strKey) != null &&
* @returns SessionStorageUtils.get(strKey) != 'null'
*/ ) {
COMMON.operateData = function (args, strKey, returnDefaultData) { if (LocalStorageUtils.existKey(strKey) == true) {
if (args.length > 0) { return JSON.parse(SessionStorageUtils.get(strKey));
var data = args[0]; } else {
LocalStorageUtils.set(strKey, data); return returnDefaultData;
SessionStorageUtils.set(strKey, JSON.stringify(data)); }
} else { } else {
if ( if (LocalStorageUtils.existKey(strKey) == true) {
SessionStorageUtils.get(strKey) != 'undefined' && SessionStorageUtils.set(strKey, JSON.stringify(LocalStorageUtils.get(strKey)));
SessionStorageUtils.get(strKey) != undefined && return JSON.parse(SessionStorageUtils.get(strKey));
SessionStorageUtils.get(strKey) != '' && }
SessionStorageUtils.get(strKey) != null && return returnDefaultData;
SessionStorageUtils.get(strKey) != 'null' }
) { }
if (LocalStorageUtils.existKey(strKey) == true) { };
return JSON.parse(SessionStorageUtils.get(strKey));
} else { /**
return returnDefaultData; * UTC current Time (millisecond)
} *
} else { * @returns UTC time
if (LocalStorageUtils.existKey(strKey) == true) { */
SessionStorageUtils.set(strKey, JSON.stringify(LocalStorageUtils.get(strKey))); COMMON.currentTime = function () {
return JSON.parse(SessionStorageUtils.get(strKey)); return Date.now();
} };
return returnDefaultData;
} /**
} * check login information in window.sessionStorage
}; *
* @returns boolean
/** */
* UTC current Time (millisecond) COMMON.checkLogin = function (option) {
* var userSession = COMMON.userSession();
* @returns UTC time if(!userSession) {
*/
COMMON.currentTime = function () { /* エラー画面を表示 */
return Date.now(); var tags = '<div id="avw-auth-error">' +
}; '<div style="display:table; width:100%; height:100%;">' +
'<div style="display:table-cell; text-align:center; vertical-align:middle;">' +
/** '<p><h4>Authentication error</h4>Please use it after login.</p>' +
* check login information in window.sessionStorage '<div><button id="avw-unauth-ok">OK</button></div>' +
* '</div></div></div>';
* @returns boolean $('body').prepend(tags);
*/ $('#avw-auth-error').css({
COMMON.checkLogin = function (option) { 'opacity': 1,
var userSession = COMMON.userSession(); 'position': 'fixed',
if(!userSession) { 'top': '0',
'left': '0',
/* エラー画面を表示 */ 'background': "#ffffff",
var tags = '<div id="avw-auth-error">' + 'width': $(window).width(),
'<div style="display:table; width:100%; height:100%;">' + 'height': $(window).height(),
'<div style="display:table-cell; text-align:center; vertical-align:middle;">' + 'zIndex': '10000'
'<p><h4>Authentication error</h4>Please use it after login.</p>' + });
'<div><button id="avw-unauth-ok">OK</button></div>' + // resize error page
'</div></div></div>'; $(window).resize(function() {
$('body').prepend(tags); $('#avw-auth-error').css( {
$('#avw-auth-error').css({ 'width': $(window).width(),
'opacity': 1, 'height': $(window).height()
'position': 'fixed', });
'top': '0', });
'left': '0',
'background': "#ffffff", var returnPage;
'width': $(window).width(), if(option) {
'height': $(window).height(), returnPage = option
'zIndex': '10000' } else {
}); var sysSetting = COMMON.sysSetting();
// resize error page returnPage = sysSetting.loginPage;
$(window).resize(function() { }
$('#avw-auth-error').css( { /* ログイン画面に戻る */
'width': $(window).width(), $('#avw-unauth-ok').click(function() {
'height': $(window).height() window.location = returnPage;
}); });
}); return false;
}
var returnPage; return true;
if(option) { }
returnPage = option
} else { /*
var sysSetting = COMMON.sysSetting(); * Operations for session storage [ end ]
returnPage = sysSetting.loginPage; */
}
/* ログイン画面に戻る */ // =============================================================================================
$('#avw-unauth-ok').click(function() { // Utils for string, date, number [start]
window.location = returnPage; // =============================================================================================
}); /*
return false; * Convert date to JP format date time [start]
} */
return true;
} /*
* YYYY/MM/DD HH:MM:SS
/* */
* Operations for session storage [ end ] Date.prototype.jpDateTimeString = function () {
*/ var strResult = '';
var strYear = this.getFullYear() + '';
// ============================================================================================= var strMonth = this.getMonth() + 1 + '';
// Utils for string, date, number [start] var strDayInMonth = this.getDate() + '';
// ============================================================================================= var strHour = this.getHours() + '';
/* var strMinute = this.getMinutes() + '';
* Convert date to JP format date time [start] var strSecond = this.getSeconds() + '';
*/
strResult += strYear.padLeft('0', 4) + '/' + strMonth.padLeft('0', 2) + '/' + strDayInMonth.padLeft('0', 2);
/* strResult += ' ' + strHour.padLeft('0', 2) + ':' + strMinute.padLeft('0', 2) + ':' + strSecond.padLeft('0', 2);
* YYYY/MM/DD HH:MM:SS return strResult;
*/ };
Date.prototype.jpDateTimeString = function () { /*
var strResult = ''; * YYYY-MM-DD HH:MM:SS
var strYear = this.getFullYear() + ''; */
var strMonth = this.getMonth() + 1 + ''; Date.prototype.jpDateTimeString1 = function () {
var strDayInMonth = this.getDate() + ''; var strResult = '';
var strHour = this.getHours() + ''; var strYear = this.getFullYear() + '';
var strMinute = this.getMinutes() + ''; var strMonth = this.getMonth() + 1 + '';
var strSecond = this.getSeconds() + ''; var strDayInMonth = this.getDate() + '';
var strHour = this.getHours() + '';
strResult += strYear.padLeft('0', 4) + '/' + strMonth.padLeft('0', 2) + '/' + strDayInMonth.padLeft('0', 2); var strMinute = this.getMinutes() + '';
strResult += ' ' + strHour.padLeft('0', 2) + ':' + strMinute.padLeft('0', 2) + ':' + strSecond.padLeft('0', 2); var strSecond = this.getSeconds() + '';
return strResult;
}; strResult += strYear.padLeft('0', 4) + '-' + strMonth.padLeft('0', 2) + '-' + strDayInMonth.padLeft('0', 2);
/* strResult += ' ' + strHour.padLeft('0', 2) + ':' + strMinute.padLeft('0', 2) + ':' + strSecond.padLeft('0', 2);
* YYYY-MM-DD HH:MM:SS return strResult;
*/ };
Date.prototype.jpDateTimeString1 = function () { /*
var strResult = ''; * yyyy/MM/dd
var strYear = this.getFullYear() + ''; */
var strMonth = this.getMonth() + 1 + ''; Date.prototype.jpDateString = function () {
var strDayInMonth = this.getDate() + ''; var strResult = '';
var strHour = this.getHours() + ''; var strYear = this.getFullYear() + '';
var strMinute = this.getMinutes() + ''; var strMonth = this.getMonth() + 1 + '';
var strSecond = this.getSeconds() + ''; var strDayInMonth = this.getDate() + '';
strResult += strYear.padLeft('0', 4) + '-' + strMonth.padLeft('0', 2) + '-' + strDayInMonth.padLeft('0', 2); strResult += strYear.padLeft('0', 4) + '/' + strMonth.padLeft('0', 2) + '/' + strDayInMonth.padLeft('0', 2);
strResult += ' ' + strHour.padLeft('0', 2) + ':' + strMinute.padLeft('0', 2) + ':' + strSecond.padLeft('0', 2);
return strResult; return strResult;
}; };
/* /*
* yyyy/MM/dd * HH:mm:ss
*/ */
Date.prototype.jpDateString = function () { Date.prototype.jpTimeString = function () {
var strResult = ''; var strResult = '';
var strYear = this.getFullYear() + ''; var strHour = this.getHours() + '';
var strMonth = this.getMonth() + 1 + ''; var strMinute = this.getMinutes() + '';
var strDayInMonth = this.getDate() + ''; var strSecond = this.getSeconds() + '';
strResult += strYear.padLeft('0', 4) + '/' + strMonth.padLeft('0', 2) + '/' + strDayInMonth.padLeft('0', 2); strResult += ' ' + strHour.padLeft('0', 2) + ':' + strMinute.padLeft('0', 2) + ':' + strSecond.padLeft('0', 2);
return strResult;
return strResult; };
}; /*
/* * HH:mm
* HH:mm:ss */
*/ Date.prototype.jpShortTimeString = function () {
Date.prototype.jpTimeString = function () { var strResult = '';
var strResult = ''; var strHour = this.getHours() + '';
var strHour = this.getHours() + ''; var strMinute = this.getMinutes() + '';
var strMinute = this.getMinutes() + ''; var strSecond = this.getSeconds() + '';
var strSecond = this.getSeconds() + '';
strResult += ' ' + strHour.padLeft('0', 2) + ':' + strMinute.padLeft('0', 2);
strResult += ' ' + strHour.padLeft('0', 2) + ':' + strMinute.padLeft('0', 2) + ':' + strSecond.padLeft('0', 2); return strResult;
return strResult; };
}; /*
/* * yyyyMMddHHmmss
* HH:mm */
*/ Date.prototype.toIdString = function () {
Date.prototype.jpShortTimeString = function () { var strResult = '';
var strResult = ''; var strYear = this.getFullYear() + '';
var strHour = this.getHours() + ''; var strMonth = this.getMonth() + 1 + '';
var strMinute = this.getMinutes() + ''; var strDayInMonth = this.getDate() + '';
var strSecond = this.getSeconds() + ''; var strHour = this.getHours() + '';
var strMinute = this.getMinutes() + '';
strResult += ' ' + strHour.padLeft('0', 2) + ':' + strMinute.padLeft('0', 2); var strSecond = this.getSeconds() + '';
return strResult; var strMilisecond = this.getMilliseconds() + '';
};
/* strResult += strYear.padLeft('0', 4) + strMonth.padLeft('0', 2) + strDayInMonth.padLeft('0', 2);
* yyyyMMddHHmmss strResult += strHour.padLeft('0', 2) + strMinute.padLeft('0', 2) + strSecond.padLeft('0', 2) + strMilisecond.padLeft('0', 3);
*/ return strResult;
Date.prototype.toIdString = function () { };
var strResult = '';
var strYear = this.getFullYear() + ''; /**
var strMonth = this.getMonth() + 1 + ''; * Subtract date to get days
var strDayInMonth = this.getDate() + ''; * @param {*} targetDate
var strHour = this.getHours() + ''; * @returns
var strMinute = this.getMinutes() + ''; */
var strSecond = this.getSeconds() + ''; Date.prototype.subtractByDays = function (targetDate) {
var strMilisecond = this.getMilliseconds() + ''; var milis = Math.abs(this - targetDate);
var days = Math.floor(milis / (60 * 60 * 24 * 1000));
strResult += strYear.padLeft('0', 4) + strMonth.padLeft('0', 2) + strDayInMonth.padLeft('0', 2); return days;
strResult += strHour.padLeft('0', 2) + strMinute.padLeft('0', 2) + strSecond.padLeft('0', 2) + strMilisecond.padLeft('0', 3); };
return strResult;
}; /**
* add seconds
/** * @param {*} plusSeconds
* Subtract date to get days * @returns
* @param {*} targetDate */
* @returns Date.prototype.addSeconds = function (plusSeconds) {
*/ var newDate = new Date(this.getTime() + plusSeconds * 1000);
Date.prototype.subtractByDays = function (targetDate) { return newDate;
var milis = Math.abs(this - targetDate); };
var days = Math.floor(milis / (60 * 60 * 24 * 1000));
return days; /**
}; * Subtract date to get days
* @param {*} targetDate
/** * @returns
* add seconds */
* @param {*} plusSeconds Date.prototype.subtractBySeconds = function (targetDate) {
* @returns var milis = Math.abs(this - targetDate);
*/ var days = Math.floor(milis / 1000);
Date.prototype.addSeconds = function (plusSeconds) { return days;
var newDate = new Date(this.getTime() + plusSeconds * 1000); };
return newDate;
}; /*
* Convert date to JP format date time [ end ]
/** */
* Subtract date to get days
* @param {*} targetDate // trimming space from both side of the string
* @returns String.prototype.trim = function () {
*/ return this.replace(/^\s+|\s+$/g, '');
Date.prototype.subtractBySeconds = function (targetDate) { };
var milis = Math.abs(this - targetDate);
var days = Math.floor(milis / 1000); // trimming space from left side of the string
return days; String.prototype.trimLeft = function () {
}; return this.replace(/^\s+/, '');
};
/*
* Convert date to JP format date time [ end ] // trimming space from right side of the string
*/ String.prototype.trimRight = function () {
return this.replace(/\s+$/, '');
// trimming space from both side of the string };
String.prototype.trim = function () {
return this.replace(/^\s+|\s+$/g, ''); /**
}; * String: pads left
* @param {*} padString
// trimming space from left side of the string * @param {*} length
String.prototype.trimLeft = function () { * @returns
return this.replace(/^\s+/, ''); */
}; String.prototype.padLeft = function (padString, length) {
var str = this;
// trimming space from right side of the string while (str.length < length) str = padString + str;
String.prototype.trimRight = function () { return str;
return this.replace(/\s+$/, ''); };
};
/**
/** * String: pads right
* String: pads left * @param {*} padString
* @param {*} padString * @param {*} length
* @param {*} length * @returns
* @returns */
*/ String.prototype.padRight = function (padString, length) {
String.prototype.padLeft = function (padString, length) { var str = this;
var str = this; while (str.length < length) str = str + padString;
while (str.length < length) str = padString + str; return str;
return str; };
};
/**
/** * Check contain string
* String: pads right * @param {*} string
* @param {*} padString * @returns
* @param {*} length */
* @returns String.prototype.contains = function (string) {
*/ if (this.indexOf(string) != -1) {
String.prototype.padRight = function (padString, length) { return true;
var str = this; }
while (str.length < length) str = str + padString; return false;
return str; };
};
/**
/** * Number: pads left
* Check contain string * @param {*} padString
* @param {*} string * @param {*} length
* @returns * @returns
*/ */
String.prototype.contains = function (string) { Number.prototype.padLeft = function (padString, length) {
if (this.indexOf(string) != -1) { var str = this + '';
return true; return str.padLeft(padString, length);
} };
return false;
}; /**
* Number: pads right
/** * @param {*} padString
* Number: pads left * @param {*} length
* @param {*} padString * @returns
* @param {*} length */
* @returns Number.prototype.padRight = function (padString, length) {
*/ var str = this + '';
Number.prototype.padLeft = function (padString, length) { return str.padRight(padString, length);
var str = this + ''; };
return str.padLeft(padString, length); // Clear data of array
}; Array.prototype.clear = function () {
this.splice(0, this.length);
/** };
* Number: pads right
* @param {*} padString // Function to set position of object to center
* @param {*} length jQuery.fn.center = function () {
* @returns this.css('position', 'fixed');
*/
Number.prototype.padRight = function (padString, length) { this.css('top', ($(window).height() - this.height()) / 2 + 'px');
var str = this + ''; this.css('left', ($(window).width() - this.width()) / 2 + 'px');
return str.padRight(padString, length);
}; return this;
// Clear data of array };
Array.prototype.clear = function () {
this.splice(0, this.length); \ No newline at end of file
};
// Function to set position of object to center
jQuery.fn.center = function () {
this.css('position', 'fixed');
this.css('top', ($(window).height() - this.height()) / 2 + 'px');
this.css('left', ($(window).width() - this.width()) / 2 + 'px');
return this;
};
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<title lang="pickup"></title> <title class="lang" lang="pickup"></title>
<!-- favicons --> <!-- favicons -->
<link href="../common/img/favicon.ico" rel="icon"> <link href="../common/img/favicon.ico" rel="icon">
<link href="../common/img/apple-touch-icon.png" rel="apple-touch-icon"> <link href="../common/img/apple-touch-icon.png" rel="apple-touch-icon">
......
...@@ -12,12 +12,19 @@ ...@@ -12,12 +12,19 @@
RL.init = function () { RL.init = function () {
//Check if user is logged in //Check if user is logged in
COMMON.showLoading(); COMMON.showLoading();
console.log("kdh check closeLoading RL.init1");
COMMON.checkAuth(false); COMMON.checkAuth(false);
console.log("kdh check closeLoading RL.init2");
console.log('ReportList init start'); console.log('ReportList init start');
console.log("kdh check closeLoading RL.init3");
RL.checkQuickReport(); RL.checkQuickReport();
console.log("kdh check closeLoading RL.init4");
RL.loadCommon(); RL.loadCommon();
console.log("kdh check closeLoading RL.init5");
RL.initTaskReportList(); RL.initTaskReportList();
console.log("kdh check closeLoading RL.init6");
COMMON.closeLoading(); COMMON.closeLoading();
console.log("kdh check closeLoading RL.init7");
}; };
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment