Commit a2495381 by Kang Donghun

#50169 コード整理、画面遷移検討

parent 7284ccb8
/**
* common js of app(web).
* The following is written.
* 1.language
* 2.loading
* 3.alert
* 4.url
* 5.cms communication
* 6.check if user is logged in
*
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var CHK_Common = {};
CHK_Common.lang;
/**
* get lang code in local storage
* web gets lang form local storage
* but app gets lnag from session storage
*/
CHK_Common.setLangCodeWeb = function () {
let lang = CHK_Common.getLangWeb();
if (lang.split('-')[0] == CHK_CONSTANT.LANG.English) {
lang = CHK_CONSTANT.LANG.ENGLISH;
} else if (lang.split('-')[0] == CHK_CONSTANT.LANG.KOREA) {
lang = CHK_CONSTANT.LANG.KOREA;
} else {
lang = CHK_CONSTANT.LANG.JAPAN;
}
CHK_Common.lang = lang;
};
/**
* get lang in local storage
*
* @returns String pageLang
*/
CHK_Common.getLangWeb = function () {
if (!CHK_Common.lang) {
let pageLang;
if (localStorage[CHK_CONSTANT.LANG.SAVE_NAME]) {
pageLang = localStorage[CHK_CONSTANT.LANG.SAVE_NAME];
} else {
pageLang = (window.navigator.languages && window.navigator.languages[0]) || window.navigator.language || window.navigator.userLanguage || window.navigator.browserLanguage;
localStorage[CHK_CONSTANT.LANG.SAVE_NAME] = pageLang;
}
return pageLang;
} else {
return CHK_Common.lang;
}
return pageLang;
};
/**
* change lang of html
*/
CHK_Common.updateLang = function () {
$('.multi-lang').each(function () {
const key = $(this).attr('data-msg');
if (key) {
if ($(this).prop('tagName').toLowerCase() == 'input' && ($(this).attr('type') == 'text' || $(this).attr('type') == 'search')) {
const attr = $(this).attr('placeholder');
if (typeof attr !== 'undefined' && attr !== false) {
$(this).attr('placeholder', CHK_Common.getMsg(key));
} else {
$(this).val(CHK_Common.getMsg(key));
}
} else {
$(this).html(CHK_Common.getMsg(key));
}
}
});
};
/**
* get any lang msg from CHK_Common.msgMap
*
* @param String key
* @returns String msg
*/
CHK_Common.getMsg = function (key) {
const msg = CHK_CONSTANT.MSG_MAP[key];
if (!msg) {
return '';
}
return msg[CHK_Common.lang];
};
/**
* show loading dialog
* show msg by key
*
* @param {String} key
*/
CHK_Common.showLoading = function () {
$('#check_loading').dialog({
dialogClass: 'noTitleDialog ui-dialog-titlebar dialogNoBorder', //cssを追加する必要がある
autoOpen: false,
resizable: false,
modal: true,
width: '100%',
title: ' ',
open: function (e) {
$(e.target).parent().css('background-color', 'rgba(128,128,128)');
$(e.target).parent().css('position', 'absolute');
$(e.target).parent().css('left', '50%');
$(e.target).parent().css('top', '25vh');
$(e.target).parent().css('transform', 'translateX(-50%)');
$(e.target).parent().css('-webkit- transform', 'translateY(-50%) translateX(-50%)');
$(e.target).parent().children('.ui-dialog-buttonpane').css('background-color', 'rgba(128,128,128)').css('border', 'none');
},
close: function () {},
});
$('#check_loading').dialog('open');
};
/**
* close loading
*/
CHK_Common.closeLoading = function () {
if ($('#check_loading').hasClass('ui-dialog-content')) {
$('#check_loading').dialog('close');
}
};
/**
* show alert
*
* @param {String} msgCode
*/
CHK_Common.displayAlert = function (msgCode, title) {
$('#alertMsg').html(CHK_Common.getMsg(msgCode));
$('.alert-overlay').removeClass('d-none');
$('.alert-area').removeClass('d-none');
const positionY = $(document).scrollTop() + screen.height / 8;
const height = screen.height / 4;
$('.alert-overlay').css('height', screen.height);
$('.alert-area').css('top', positionY);
$('.alert-area').css('min-height', height);
$('body').css('overflow', 'hidden');
};
/**
* close alert
*/
CHK_Common.alertClose = function () {
$('.alert-overlay').addClass('d-none');
$('.alert-area').addClass('d-none');
$('body').css('overflow', 'visible');
};
/**
* go Url page With Current Params
*
* ios will remove all web types data when reopen webview
* need add common parameters: app, lang, debug, mobile_flg, isChat, ...
*
* @param {String} url
* @param {Object} params
*/
CHK_Common.goUrlWithCurrentParams = function (url, params) {
if (!params) {
location.href = CHK_CONSTANT.URL.BASE_WEB + url;
}
const mixParams = Object.assign(CHK_Common.getUrlParameter(), params);
if (url.includes('?')) {
location.href = url + '&' + new URLSearchParams(mixParams);
} else {
location.href = url + '?' + new URLSearchParams(mixParams);
}
};
/**
* get url parameter
*
*/
CHK_Common.getUrlParameter = function () {
var ret = {};
if (location.search) {
var param = {};
location.search
.substring(1)
.split('&')
.forEach(function (val) {
var kv = val.split('=');
param[kv[0]] = kv[1];
});
ret = param;
}
console.log({ ret: ret });
return ret;
};
/**
* get sid in local Storage
*
* @returns sid
*/
CHK_Common.getSid = function () {
return ClientData.userInfo_sid();
};
/**
* cms communication
*
* @param {String} url
* @param {Json} param
* @param {boolean} async
* @param {Object} callback
* @param {Object} errorCallback
*/
CHK_Common.cmsAjax = function (url, param, async = true, type, dataType, callback, errorCallback) {
var sysSettings = AVWEB.avwSysSetting();
if (url) {
$.ajax({
type: type,
url: url,
data: param,
dataType: dataType,
cache: false,
async: async,
crossDomain: true,
beforeSend: function(xhr) {
xhr.setRequestHeader('X-AGT-AppId', sysSettings.appName);
xhr.setRequestHeader('X-AGT-AppVersion', sysSettings.appVersion);
},
success: function (result) {
if (result.status == '200') {
if (callback) callback(result);
} else if (result.status == '401') {
CHK_Common.goUrlWithCurrentParams(CHK_CONSTANT.PAGE_NAME.LOGIN);
} else if (errorCallback) {
errorCallback();
} else {
CHK_Common.closeLoading();
CHK_Common.displayAlert(result.message);
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
if (errorCallback) {
errorCallback();
} else {
CHK_Common.closeLoading();
CHK_Common.displayAlert('errorCommunicationFailed');
}
},
});
} else {
if (errorCallback) {
errorCallback();
} else {
CHK_Common.closeLoading();
CHK_Common.displayAlert('errorOccurred');
}
}
};
/**
* Communicate with cms and post
*
* @param {String} url
* @param {Object} params
* @param {String} method
*/
CHK_Common.postCommunication = function (url, params, method = 'post') {
const form = document.createElement('form');
form.method = method;
form.action = url;
for (const key in params) {
if (params.hasOwnProperty(key)) {
const hiddenField = document.createElement('input');
hiddenField.type = 'hidden';
hiddenField.name = key;
hiddenField.value = params[key];
form.appendChild(hiddenField);
}
}
document.body.appendChild(form);
form.submit();
};
/**
* Check if user is logged in
*
* @param {boolean} async
*/
CHK_Common.checkAuth = function (async = true) {
let params = {};
params.sid = CHK_Common.getSid;
var urlPath = ClientData.userInfo_accountPath();
const url = CHK_CONSTANT.URL.BASE_CMS + urlPath + CHK_CONSTANT.URL.BASE_CHECKAPI + CHK_CONSTANT.URL.AUTH_SESSION;
CHK_Common.cmsAjax(url, params, async, CONSTANT.API_TYPE.GET, CONSTANT.DATA_TYPE.TEXT, function () {
CHK_Common.goUrlWithCurrentParams(CHK_CONSTANT.PAGE_NAME.LOGIN);
});
};
......@@ -47,7 +47,7 @@ CHK_Footer.inactiveAllBottomNav = function() {
*/
CHK_Footer.goIndexPage = function(tabId) {
sessionStorage.activeTab = tabId;
CHK_Common.goUrlWithCurrentParams(DAFAULT_PAGE);
COMMON.goUrlWithCurrentParams(DAFAULT_PAGE);
}
/**
......@@ -55,7 +55,7 @@ CHK_Footer.goIndexPage = function(tabId) {
*/
CHK_Footer.isIndexPage = function() {
if (typeof location === 'object' && typeof location.pathname === 'string') {
if (location.pathname.includes(CHK_CONSTANT.PAGE_NAME.DEFAULT) == true) {
if (location.pathname.includes(CONSTANT.PAGE_NAME.DEFAULT) == true) {
return true;
}
}
......@@ -76,26 +76,26 @@ CHK_Footer.activeInitBottomNav = function(bottomNav) {
* Go page of dashboard
*/
CHK_Footer.goDashboard = function() {
sessionStorage.activeTab = CHK_CONSTANT.PAGE_TAB.DASHBOARD;
sessionStorage.activeTab = CONSTANT.PAGE_TAB.DASHBOARD;
CHK_Footer.activeInitBottomNav('dashboardBottomNav');
if (CHK_Footer.isIndexPage()) {
CHK_TOP.showPage(CHK_CONSTANT.PAGE_NAME.DASHBOARD);
TOP.showPage(CONSTANT.PAGE_NAME.DASHBOARD);
return;
}
CHK_Footer.goIndexPage(CHK_CONSTANT.PAGE_NAME.DASHBOARD);
CHK_Footer.goIndexPage(CONSTANT.PAGE_NAME.DASHBOARD);
}
/**
* Go page of operationList
*/
CHK_Footer.goOperationList = function() {
sessionStorage.activeTab = CHK_CONSTANT.PAGE_TAB.OPERATION_LIST;
sessionStorage.activeTab = CONSTANT.PAGE_TAB.OPERATION_LIST;
CHK_Footer.activeInitBottomNav('operationListBottomNav');
if (CHK_Footer.isIndexPage()) {
CHK_TOP.showPage(CHK_CONSTANT.PAGE_NAME.OPERATION_LIST);
TOP.showPage(CONSTANT.PAGE_NAME.OPERATION_LIST);
return;
}
CHK_Footer.goIndexPage(CHK_CONSTANT.PAGE_NAME.OPERATION_LIST);
CHK_Footer.goIndexPage(CONSTANT.PAGE_NAME.OPERATION_LIST);
}
/**
......@@ -103,10 +103,10 @@ CHK_Footer.goOperationList = function() {
* If it is no active tab, go to page in settings.
*/
CHK_Footer.initFooter = function() {
$("#footer").load(CHK_CONSTANT.PAGE_NAME.FOOTER, function() {
$("#footer").load(CONSTANT.PAGE_NAME.FOOTER, function() {
if (typeof sessionStorage != 'undefined' && typeof sessionStorage.activeTab != 'undefined') {
if (sessionStorage.activeTab == CHK_CONSTANT.PAGE_TAB.DASHBOARD) {
if (sessionStorage.activeTab == CONSTANT.PAGE_TAB.DASHBOARD) {
CHK_Footer.goDashboard();
} else {
CHK_Footer.goOperationList();
......
/**
* common js of app(web).
* The following is written.
* 1.language
* 2.loading
* 3.alert
* 4.url
* 5.cms communication
* 6.check if user is logged in
*
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var COMMON = {};
COMMON.hasErrorKey = 'AVW_HASERR';
COMMON.lang;
/**
* get lang code in local storage
* web gets lang form local storage
* but app gets lnag from session storage
*/
COMMON.setLangCodeWeb = function () {
let lang = COMMON.getLangWeb();
if (lang.split('-')[0] == CONSTANT.LANG.English) {
lang = CONSTANT.LANG.ENGLISH;
} else if (lang.split('-')[0] == CONSTANT.LANG.KOREA) {
lang = CONSTANT.LANG.KOREA;
} else {
lang = CONSTANT.LANG.JAPAN;
}
COMMON.lang = lang;
};
/**
* get lang in local storage
*
* @returns String pageLang
*/
COMMON.getLangWeb = function () {
if (!COMMON.lang) {
let pageLang;
if (localStorage[CONSTANT.LANG.SAVE_NAME]) {
pageLang = localStorage[CONSTANT.LANG.SAVE_NAME];
} else {
pageLang = (window.navigator.languages && window.navigator.languages[0]) || window.navigator.language || window.navigator.userLanguage || window.navigator.browserLanguage;
localStorage[CONSTANT.LANG.SAVE_NAME] = pageLang;
}
return pageLang;
} else {
return COMMON.lang;
}
return pageLang;
};
/**
* change lang of html
*/
COMMON.updateLang = function () {
$('.multi-lang').each(function () {
const key = $(this).attr('data-msg');
if (key) {
if ($(this).prop('tagName').toLowerCase() == 'input' && ($(this).attr('type') == 'text' || $(this).attr('type') == 'search')) {
const attr = $(this).attr('placeholder');
if (typeof attr !== 'undefined' && attr !== false) {
$(this).attr('placeholder', COMMON.getMsg(key));
} else {
$(this).val(COMMON.getMsg(key));
}
} else {
$(this).html(COMMON.getMsg(key));
}
}
});
};
/**
* get any lang msg from COMMON.msgMap
*
* @param String key
* @returns String msg
*/
COMMON.getMsg = function (key) {
const msg = CONSTANT.MSG_MAP[key];
if (!msg) {
return '';
}
return msg[COMMON.lang];
};
/* page transition without outputting a warning message */
COMMON.avwScreenMove = function(url) {
window.onbeforeunload = null;
window.location = url;
};
/**
* show loading dialog
* show msg by key
*
* @param {String} key
*/
COMMON.showLoading = function () {
$('#check_loading').dialog({
dialogClass: 'noTitleDialog ui-dialog-titlebar dialogNoBorder', //cssを追加する必要がある
autoOpen: false,
resizable: false,
modal: true,
width: '100%',
title: ' ',
open: function (e) {
$(e.target).parent().css('background-color', 'rgba(128,128,128)');
$(e.target).parent().css('position', 'absolute');
$(e.target).parent().css('left', '50%');
$(e.target).parent().css('top', '25vh');
$(e.target).parent().css('transform', 'translateX(-50%)');
$(e.target).parent().css('-webkit- transform', 'translateY(-50%) translateX(-50%)');
$(e.target).parent().children('.ui-dialog-buttonpane').css('background-color', 'rgba(128,128,128)').css('border', 'none');
},
close: function () {},
});
$('#check_loading').dialog('open');
};
/**
* close loading
*/
COMMON.closeLoading = function () {
if ($('#check_loading').hasClass('ui-dialog-content')) {
$('#check_loading').dialog('close');
}
};
/**
* show alert
*
* @param {String} msgCode
*/
COMMON.displayAlert = function (msgCode, title) {
$('#alertMsg').html(COMMON.getMsg(msgCode));
$('.alert-overlay').removeClass('d-none');
$('.alert-area').removeClass('d-none');
const positionY = $(document).scrollTop() + screen.height / 8;
const height = screen.height / 4;
$('.alert-overlay').css('height', screen.height);
$('.alert-area').css('top', positionY);
$('.alert-area').css('min-height', height);
$('body').css('overflow', 'hidden');
};
/**
* close alert
*/
COMMON.alertClose = function () {
$('.alert-overlay').addClass('d-none');
$('.alert-area').addClass('d-none');
$('body').css('overflow', 'visible');
};
/**
* go Url page With Current Params
*
* ios will remove all web types data when reopen webview
* need add common parameters: app, lang, debug, mobile_flg, isChat, ...
*
* @param {String} url
* @param {Object} params
*/
COMMON.goUrlWithCurrentParams = function (url, params) {
if (!params) {
location.href = CONSTANT.URL.BASE_WEB + url;
}
const mixParams = Object.assign(COMMON.getUrlParameter(), params);
if (url.includes('?')) {
location.href = url + '&' + new URLSearchParams(mixParams);
} else {
location.href = url + '?' + new URLSearchParams(mixParams);
}
};
/**
* get url parameter
*
*/
COMMON.getUrlParameter = function () {
var ret = {};
if (location.search) {
var param = {};
location.search
.substring(1)
.split('&')
.forEach(function (val) {
var kv = val.split('=');
param[kv[0]] = kv[1];
});
ret = param;
}
console.log({ ret: ret });
return ret;
};
/**
* get sid in local Storage
*
* @returns sid
*/
COMMON.getSid = function () {
return ClientData.userInfo_sid();
};
/**
* cms communication
*
* @param {String} url
* @param {Json} param
* @param {boolean} async
* @param {Object} callback
* @param {Object} errorCallback
*/
COMMON.cmsAjax = function (url, param, async = true, type, dataType, callback, errorCallback) {
var sysSettings = new COMMON.sysSetting();
if (url) {
$.ajax({
type: type,
url: url,
data: param,
dataType: dataType,
cache: false,
async: async,
crossDomain: true,
beforeSend: function(xhr) {
xhr.setRequestHeader('X-AGT-AppId', sysSettings.appName);
xhr.setRequestHeader('X-AGT-AppVersion', sysSettings.appVersion);
},
success: function (result) {
if (result.status == 'success') {
if (callback) callback(result);
} else if (result.status == 'fail') {
if (errorCallback) {
errorCallback();
} else {
COMMON.closeLoading();
COMMON.displayAlert(result.message);
COMMON.goUrlWithCurrentParams(CONSTANT.PAGE_NAME.LOGIN);
}
}
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log("kdh check XMLHttpRequest = " + XMLHttpRequest);
console.log("kdh check textStatus = " + textStatus);
console.log("kdh check errorThrown = " + errorThrown);
if (errorCallback) {
errorCallback();
} else {
COMMON.closeLoading();
COMMON.displayAlert('errorCommunicationFailed');
}
},
});
} else {
if (errorCallback) {
errorCallback();
} else {
COMMON.closeLoading();
COMMON.displayAlert('errorOccurred');
}
}
};
/**
* Communicate with cms and post
*
* @param {String} url
* @param {Object} params
* @param {String} method
*/
COMMON.postCommunication = function (url, params, method = 'post') {
const form = document.createElement('form');
form.method = method;
form.action = url;
for (const key in params) {
if (params.hasOwnProperty(key)) {
const hiddenField = document.createElement('input');
hiddenField.type = 'hidden';
hiddenField.name = key;
hiddenField.value = params[key];
form.appendChild(hiddenField);
}
}
document.body.appendChild(form);
form.submit();
};
/**
* Check if user is logged in
*
* @param {boolean} async
*/
COMMON.checkAuth = function (async = true) {
let params = {};
params.sid = COMMON.getSid;
var urlPath = ClientData.userInfo_accountPath();
const url = CONSTANT.URL.BASE_CMS + urlPath + CONSTANT.URL.BASE_CHECKAPI + CONSTANT.URL.AUTH_SESSION;
COMMON.cmsAjax(url, params, async, CONSTANT.API_TYPE.GET, CONSTANT.DATA_TYPE.JSON, null, function () {
COMMON.goUrlWithCurrentParams(CONSTANT.PAGE_NAME.LOGIN);
});
};
var ClientData = {
// Local :ユーザ情報(userInfo)_アカウントパス:String
userInfo_accountPath : function(data) {
if (arguments.length > 0) {
COMMON.userSetting().set(CONSTANT.KEYS.userInfo_accountPath, data);
} else {
return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_accountPath);
}
},
// Local :ユーザ情報(userInfo)_ログインID:String
userInfo_loginId : function(data) {
if (arguments.length > 0) {
COMMON.userSetting().set(CONSTANT.KEYS.userInfo_loginId, data);
} else {
return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_loginId);
}
},
// Local :ユーザ情報(userInfo)_アカウント情報記憶フラグ:Char(Y:可能, N:不可)
userInfo_rememberLogin : function(data) {
if (arguments.length > 0) {
COMMON.userSetting().set(CONSTANT.KEYS.userInfo_rememberLogin, data);
} else {
return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_rememberLogin);
}
},
// Session :ユーザ情報(userInfo)_ログインID:String
userInfo_loginId_session : function(data) {
if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.userInfo_loginId, data);
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.userInfo_loginId);
}
},
// Session :ユーザ情報(userInfo)_アカウントパス:String
userInfo_accountPath_session : function(data) {
if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.userInfo_accountPath, data);
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.userInfo_accountPath);
}
},
// Session
userInfo_userName : function(data) {
if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.userInfo_userName, data);
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.userInfo_userName);
}
},
// Local :ユーザ情報(userInfo)_最終ログイン日時:Datetime
userInfo_lastLoginTime : function(data) {
if (arguments.length > 0) {
COMMON.operateData(arguments, CONSTANT.KEYS.userInfo_lastLoginTime, undefined);
} else {
return COMMON.operateData(arguments, CONSTANT.KEYS.userInfo_lastLoginTime, undefined);
}
},
// Session:ユーザ情報(userInfo)_セッションID:String
userInfo_sid : function(data) {
if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.userInfo_sid, data);
// COMMON.userSetting().set(CONSTANT.KEYS.userInfo_sid, data);
} else {
// return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_sid);
if (COMMON.userSession()) {
return SessionStorageUtils.get(CONSTANT.KEYS.userInfo_sid);
}
return null;
}
},
// Local: ユーザ情報(userInfo)_セッションID:String
userInfo_sid_local : function(data) {
if (arguments.length > 0) {
COMMON.userSetting().set(CONSTANT.KEYS.userInfo_sid, data);
} else {
return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_sid);
}
},
// Local: セッションIDのバックアップ
userInfo_sid_local_bak : function(data) {
if (arguments.length > 0) {
COMMON.userSetting().set(CONSTANT.KEYS.userInfo_sid_bak, data);
} else {
return COMMON.userSetting().get(CONSTANT.KEYS.userInfo_sid_bak);
}
},
// Session :通知情報(pushInfo)_新着件数:Interger
pushInfo_newMsgNumber : function(data) {
if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.pushInfo_newMsgNumber, data);
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.pushInfo_newMsgNumber);
}
},
conf_apiUrl : function(data) {
if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.conf_apiUrl, data);
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.conf_apiUrl);
}
},
conf_apiLoginUrl : function(data) {
if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.conf_apiLoginUrl, data);
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.conf_apiLoginUrl);
}
},
conf_apiResourceDlUrl : function(data) {
if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.conf_apiResourceDlUrl, data);
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.conf_apiResourceDlUrl);
}
},
// Local :ユーザ情報(userInfo)_パスワードスキップ日時:Datetime
userInfo_pwdSkipDt : function(data) {
if (arguments.length > 0) {
COMMON.operateData(arguments, CONSTANT.KEYS.userInfo_pwdSkipDt, undefined);
} else {
return COMMON.operateData(arguments, CONSTANT.KEYS.userInfo_pwdSkipDt, undefined);
}
},
// Session :事業者オプション(serviceOpt)_ABookCheck:Char(Y:有効, N:無効)
serviceOpt_abook_check : function(data) {
if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.serviceOpt_abook_check, data);
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.serviceOpt_abook_check);
}
},
// Session :事業者オプション(serviceOpt)_初回ログイン時パスワード強制変更:Integer(0:なし, 1:催促, 2:強制)
serviceOpt_force_pw_change_on_login : function(data) {
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 :事業者オプション(serviceOpt)_定期ログイン時パスワード強制変更:Integer(0:なし, 1:催促, 2:強制)
serviceOpt_force_pw_change_periodically : function(data) {
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);
}
},
// Session :事業者オプション(serviceOpt)_任意のプッシュメッセージ:Char(Y:可能, N:不可)
serviceOpt_usable_push_message : function(data) {
if (arguments.length > 0) {
SessionStorageUtils.set(CONSTANT.KEYS.serviceOpt_usable_push_message, data);
} else {
return SessionStorageUtils.get(CONSTANT.KEYS.serviceOpt_usable_push_message);
}
},
// Local
JumpQueue : function(data) {
if (arguments.length > 0) {
COMMON.operateData(arguments, CONSTANT.KEYS.JumpQueue, []);
} else {
return COMMON.operateData(arguments, CONSTANT.KEYS.JumpQueue, []);
}
},
// Local
IsJumpBack : function(data) {
if (arguments.length > 0) {
COMMON.operateData(arguments, CONSTANT.KEYS.IsJumpBack, undefined);
} else {
return COMMON.operateData(arguments, CONSTANT.KEYS.IsJumpBack, undefined);
}
}
};
/*
* Variables
*/
COMMON.userSessionObj = null;
COMMON.userSettingObj = null;
COMMON.sysSettingObj = null;
/*
* User Settings Class Definition
*/
var UserSetting = function() {
this.US_KEY="AVWUS";
this.userSetting = this.load();
};
/* get user setting from localStorage */
UserSetting.prototype.load = function () {
var storage = window.localStorage;
var value = null;
var js = null;
if (storage) {
var value = storage.getItem(this.US_KEY);
if (!value) {
value = "{}"; // 空JSON文字列
}
js = JSON.parse(value);
}
return js;
};
/* store user setting */
UserSetting.prototype.set = function(key, value) {
//if(!this.userSetting) {
this.userSetting = this.load();
//}
var values = this.userSetting;
if(!values) {
values = { key: value };
} else {
values[key] = value;
}
var storage = window.localStorage;
if(storage) {
var jsonStr = JSON.stringify(values);
storage.setItem(this.US_KEY, jsonStr);
}
this.userSetting = values;
};
/* grab user setting */
UserSetting.prototype.get = function(key) {
//if(!this.userSetting) {
this.userSetting = this.load();
//}
var values = this.userSetting;
if(values) {
return values[key];
}
return null;
};
/* show user setting object list */
UserSetting.prototype.show = function(elmid) {
var storage = window.localStorage;
var tags = "<p>";
if(storage) {
var value = storage.getItem(this.US_KEY);
if(value) {
var js = JSON.parse(value);
$.each(js, function(k, v) {
tags = tags + "<b>" + k + "</b>:" + v + "<br />";
});
}
tags = tags + "</p>";
$(elmid).html(tags);
}
};
/* ユーザ設定のキーリストを取得 */
UserSetting.prototype.keys = function() {
var storage = window.localStorage;
var keyList = [];
if(storage) {
var value = storage.getItem(this.US_KEY);
if(value) {
var js = JSON.parse(value);
var i = 0;
$.each(js, function(k, v) {
keyList[i++] = k;
});
}
return keyList;
}
return null;
};
/* ユーザ設定を削除 */
UserSetting.prototype.remove = function(key) {
var storage = window.localStorage;
if(storage) {
var value = storage.getItem(this.US_KEY);
if(value) {
var js = JSON.parse(value);
if(js) {
delete js[key];
storage.setItem(this.US_KEY, JSON.stringify(js));
}
}
}
};
/* ユーザ設定をすべて削除 */
UserSetting.prototype.removeAll = function() {
var storage = window.localStorage;
if(storage) {
storage.remove(this.US_KEY);
}
};
/*
* User Session Class Definition
*/
var UserSession = function() {
this.available = false;
};
/* Initialize User Session */
UserSession.prototype.init = function(option) {
this.available = false;
if(option == 'restore') {
var value = null;
try {
value = this._get('init');
} catch(e) {
value = null;
} finally {
if(value) {
this.available = true;
}
}
} else {
this.set("init", new Date().toLocaleString());
this.available = true;
}
};
/* store key, value item to user session */
UserSession.prototype.set = function(key, value) {
var storage = window.sessionStorage;
if(storage) {
if(this.available == false) {
if(key == "init") {
storage.setItem("AVWS_" + key, value);
} else {
throw new Error("Session destoryed.");
}
} else {
storage.setItem("AVWS_" + key, value);
}
}
};
/* get session item value */
UserSession.prototype.get = function(key) {
var value = null;
if(this.available) {
value = this._get(key);
} else {
throw new Error("Session Destroyed.");
}
return value;
};
/* get item value from session storage */
UserSession.prototype._get = function(key) {
var storage = window.sessionStorage;
var value = null;
if(storage) {
value = storage.getItem("AVWS_" + key);
}
return value;
};
/* destroy user session */
UserSession.prototype.destroy = function() {
var storage = window.sessionStorage;
if(storage) {
storage.clear();
this.available = false;
}
};
/* show user session object list */
UserSession.prototype.show = function(elmid) {
var storage = window.sessionStorage;
var tags = "<p>";
if(storage) {
for(var i = 0; i < storage.length; i++) {
var key = storage.key(i);
var value = storage.getItem(key);
tags = tags + "<b>" + key + "</b>:" + value + "<br />";
}
tags = tags + "</p>";
$(elmid).html(tags);
}
};
/* Initialize system */
$(function () {
// システム設定ファイルの配置先パスの決定
var location = window.location.toString().toLowerCase();
var sysFile = '';
if (location.indexOf('/abvw') < 0) {
sysFile = '../abvw/common/json/sys/conf.json';
} else {
sysFile = '../common/json/sys/conf.json';
}
// システム設定ファイルを読み込む
$.ajax({
url: sysFile,
async: false,
cache: false,
dataType: 'json',
success: function (data) {
COMMON.sysSettingObj = data;
},
error: function (xmlHttpRequest, txtStatus, errorThrown) {
var error = 'Could not load the system configuration file. Please check it.';
error += '\n' + xmlHttpRequest.status + ' ' + txtStatus + ' ' + errorThrown + ' : ' + sysFile;
alert(error);
}
});
// ロード時に一旦エラー状態をクリアしておく
COMMON.clearError();
//#31919 【調査】商談支援システム GoogleChromeでビッチイン・アウトが効かない
navigator.pointerEnabled = navigator.maxTouchPoints > 0; // Edge 17 touch support workaround
document.documentElement.ontouchstart = navigator.maxTouchPoints > 0 ? function(){} : undefined; // Chrome 70 touch support workaround
});
// Hide the locking layout
COMMON.unlockLayout = function() {
$('#avw-sys-modal').hide();
};
// Show the locking layout
COMMON.lockLayout = function() {
if (document.getElementById('avw-sys-modal')) {
$('#avw-sys-modal').show();
} else {
var tags = '<div id="avw-sys-modal"></div>';
$('body').prepend(tags);
$('#avw-sys-modal').css({
'opacity' : 0.7,
'position' : 'fixed',
'top' : '0',
'left' : '0',
'width' : $(window).width(),
'height' : $(window).height(),
'background' : '#999',
'z-index' : 100
});
// resize error page
$(window).resize(function() {
$('#avw-sys-modal').css({
'width' : $(window).width(),
'height' : $(window).height()
});
});
}
};
/* show system error message */
COMMON.showSystemError = function(textId) {
if(COMMON.hasError()) {
// すでにエラー状態であればエラーを表示しない
return;
} else {
// エラー状態にセット
COMMON.setErrorState();
}
if( !textId ){
textId = 'sysErrorCallApi01';
}
// create DOM element for showing error message
var errMes = I18N.i18nText(textId);
var tags = '<div id="avw-sys-error"></div>';
//$('body').prepend(tags);
$('body').append(tags);
$('#avw-sys-error').css({
'opacity': 0.7,
'position': 'fixed',
'top': '0',
'left': '0',
'width': $(window).width(),
'height': $(window).height(),
'background': '#999',
'z-index': 90000
});
// resize error page
$(window).resize(function() {
$('#avw-sys-error').css( {
'width': $(window).width(),
'height': $(window).height()
});
});
// show error messages
$().toastmessage({ position: 'middle-center' });
$().toastmessage('showToast', {
type: 'error',
sticky: true,
text: errMes,
close: function() {
if( !HEADER.webLogoutEvent() ){
//ログアウト出来なかった
SessionStorageUtils.clear();
//カスタムURI起動対応のため sidのバックアップは消さない
COMMON.userSetting().remove(CONSTANT.KEYS.userInfo_sid);
COMMON.avwScreenMove(CONSTANT.PAGE_NAME.LOGIN);
}
}
});
/*
$().toastmessage('showToast', {
type: 'error',
sticky: true,
text: errMes,
close: function() { isShowErrorMessage = false; }
});
*/
};
/* エラー状態をクリア */
COMMON.clearError = function() {
var session = window.sessionStorage;
if(session) {
session.setItem(COMMON.hasErrorKey, false);
}
};
/* エラー状態を取得 */
COMMON.hasError = function() {
var session = window.sessionStorage;
var isError = false;
if(session) {
isError = session.getItem(COMMON.hasErrorKey);
}
return (isError == 'true');
};
/* エラー状態にセット */
COMMON.setErrorState = function() {
var session = window.sessionStorage;
if(session) {
session.setItem(COMMON.hasErrorKey, true);
}
};
///* get user environment object */
//function avwUserEnv() {
// if(COMMON.avwUserEnvObj == null) {
// COMMON.avwUserEnvObj = new UserEnvironment();
// }
// return COMMON.avwUserEnvObj;
//};
/* get user session object */
COMMON.userSession = function() {
if(!COMMON.userSessionObj) {
var obj = new UserSession();
obj.init('restore');
if(obj.available) {
COMMON.userSessionObj = obj;
return COMMON.userSessionObj;
} else {
return null;
}
}
return COMMON.userSessionObj;
};
/* create user session object */
COMMON.createUserSession = function() {
if(COMMON.userSessionObj) {
COMMON.userSessionObj.destroy();
} else {
COMMON.userSessionObj = new UserSession();
COMMON.userSessionObj.init();
}
return COMMON.userSessionObj;
};
/* get user setting object */
COMMON.userSetting = function() {
if(COMMON.userSettingObj == null) {
COMMON.userSettingObj = new UserSetting();
}
return COMMON.userSettingObj;
};
/* get system setting object */
COMMON.sysSetting = function() {
return COMMON.sysSettingObj;
};
/*
* Operations for session storage [start]
*/
var SessionStorageUtils = {
login : function() {
if (COMMON.userSession()) {
// Skip this case
} else {
COMMON.avwCreateUserSession();
}
},
get : function(strKey) {
return COMMON.userSession().get(strKey);
},
set : function(strKey, objValue) {
COMMON.userSession().set(strKey, objValue);
},
clear : function() {
if (COMMON.userSession()) {
COMMON.userSession().destroy();
}
},
remove : function(strKey) {
COMMON.userSession().set(strKey, null);
}
};
/*
* Operations for local storage
*/
var LocalStorageUtils = {
getUniqueId : function() {
var uniqueId = "";
if (COMMON.userSetting().get(CONSTANT.KEYS.userInfo_accountPath)) {
uniqueId += COMMON.userSetting().get(CONSTANT.KEYS.userInfo_accountPath);
}
if (COMMON.userSetting().get(CONSTANT.KEYS.userInfo_loginId)) {
uniqueId += "." + COMMON.userSetting().get(CONSTANT.KEYS.userInfo_loginId);
}
if (uniqueId != "") {
uniqueId += ".";
}
return uniqueId;
},
get : function(strKey) {
var key = this.getUniqueId() + strKey;
return COMMON.userSetting().get(key);
},
set : function(strKey, objValue) {
var key = this.getUniqueId() + strKey;
COMMON.userSetting().set(key, objValue);
},
remove : function(strKey) {
var key = this.getUniqueId() + strKey;
COMMON.userSetting().remove(key);
SessionStorageUtils.remove(strKey);
},
clear : function() {
var localStorageKeys = COMMON.userSetting().keys();
for ( var nIndex = 0; nIndex < localStorageKeys.length; nIndex++) {
var strKey = localStorageKeys[nIndex];
if ((strKey + "").contains(this.getUniqueId())) {
COMMON.userSetting().remove(strKey);
}
}
},
existKey : function(strKey) {
var keys = COMMON.userSetting().keys();
var findKey = this.getUniqueId() + strKey;
var isExisted = false;
if (keys != null && keys != undefined) {
for ( var nIndex = 0; nIndex < keys.length; nIndex++) {
if (keys[nIndex] == findKey) {
isExisted = true;
break;
}
}
}
return isExisted;
}
};
/* String.format function def. */
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 fmt;
};
// Get param url
COMMON.getUrlParam = function(name, url) {
if (!url) {
url = window.location.href;
}
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(url);
if (results == null) {
return "";
} else {
// alert("results[0]:" + results[0]);
// alert("results[1]:" + results[1]);
return results[1];
}
};
COMMON.ToogleLogoutNortice = function() {
window.onbeforeunload = function(event) {
var message = I18N.i18nText('sysInfoWithoutLogout');
var e = event || window.event;
if(e) {
e.returnValue = message;
}
return message;
};
};
/*
* Get data from localstorage and sessionstorage synchronization If has any
* param (args.length > 0) -> setter If has not param (args.length = 0) ->
* getter . Get from session: + if it existed and key existed in localstorage ->
* return result + else: set value from local to sessionstorage -> return value
* of sessionstorage if value is not empty, otherwise, return default result.
*
*/
COMMON.operateData = function(args, strKey, returnDefaultData) {
if (args.length > 0) {
var data = args[0];
LocalStorageUtils.set(strKey, data);
SessionStorageUtils.set(strKey, JSON.stringify(data));
} else {
if (SessionStorageUtils.get(strKey) != 'undefined' && SessionStorageUtils.get(strKey) != undefined && SessionStorageUtils.get(strKey) != '' && SessionStorageUtils.get(strKey) != null
&& SessionStorageUtils.get(strKey) != 'null') {
if (LocalStorageUtils.existKey(strKey) == true) {
return JSON.parse(SessionStorageUtils.get(strKey));
} else {
return returnDefaultData;
}
} else {
if (LocalStorageUtils.existKey(strKey) == true) {
SessionStorageUtils.set(strKey, JSON.stringify(LocalStorageUtils.get(strKey)));
return JSON.parse(SessionStorageUtils.get(strKey));
}
return returnDefaultData;
}
}
};
/*
* Operations for session storage [ end ]
*/
// =============================================================================================
// Utils for string, date, number [start]
// =============================================================================================
/*
* Convert date to JP format date time [start]
*/
/*
* YYYY/MM/DD HH:MM:SS
*/
Date.prototype.jpDateTimeString = function() {
var strResult = "";
var strYear = this.getFullYear() + "";
var strMonth = (this.getMonth() + 1) + "";
var strDayInMonth = this.getDate() + "";
var strHour = this.getHours() + "";
var strMinute = this.getMinutes() + "";
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;
};
/*
* YYYY-MM-DD HH:MM:SS
*/
Date.prototype.jpDateTimeString1 = function() {
var strResult = "";
var strYear = this.getFullYear() + "";
var strMonth = (this.getMonth() + 1) + "";
var strDayInMonth = this.getDate() + "";
var strHour = this.getHours() + "";
var strMinute = this.getMinutes() + "";
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;
};
/*
* yyyy/MM/dd
*/
Date.prototype.jpDateString = function() {
var strResult = "";
var strYear = this.getFullYear() + "";
var strMonth = (this.getMonth() + 1) + "";
var strDayInMonth = this.getDate() + "";
strResult += strYear.padLeft("0", 4) + "/" + strMonth.padLeft("0", 2) + "/" + strDayInMonth.padLeft("0", 2);
return strResult;
};
/*
* HH:mm:ss
*/
Date.prototype.jpTimeString = function() {
var strResult = "";
var strHour = this.getHours() + "";
var strMinute = this.getMinutes() + "";
var strSecond = this.getSeconds() + "";
strResult += " " + strHour.padLeft("0", 2) + ":" + strMinute.padLeft("0", 2) + ":" + strSecond.padLeft("0", 2);
return strResult;
};
/*
* HH:mm
*/
Date.prototype.jpShortTimeString = function() {
var strResult = "";
var strHour = this.getHours() + "";
var strMinute = this.getMinutes() + "";
var strSecond = this.getSeconds() + "";
strResult += " " + strHour.padLeft("0", 2) + ":" + strMinute.padLeft("0", 2);
return strResult;
};
/*
* yyyyMMddHHmmss
*/
Date.prototype.toIdString = function() {
var strResult = "";
var strYear = this.getFullYear() + "";
var strMonth = (this.getMonth() + 1) + "";
var strDayInMonth = this.getDate() + "";
var strHour = this.getHours() + "";
var strMinute = this.getMinutes() + "";
var strSecond = this.getSeconds() + "";
var strMilisecond = this.getMilliseconds() + "";
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) + strMilisecond.padLeft("0", 3);
return strResult;
};
// Subtract date to get days
Date.prototype.subtractByDays = function(targetDate) {
var milis = Math.abs(this - targetDate);
var days = Math.floor(milis / (60 * 60 * 24 * 1000));
return days;
};
Date.prototype.addSeconds = function(plusSeconds) {
var newDate = new Date(this.getTime() + plusSeconds * 1000);
return newDate;
};
// Subtract date to get days
Date.prototype.subtractBySeconds = function(targetDate) {
var milis = Math.abs(this - targetDate);
var days = Math.floor(milis / 1000);
return days;
};
/*
* Convert date to JP format date time [ end ]
*/
// trimming space from both side of the string
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, "");
};
// trimming space from left side of the string
String.prototype.trimLeft = function() {
return this.replace(/^\s+/, "");
};
// trimming space from right side of the string
String.prototype.trimRight = function() {
return this.replace(/\s+$/, "");
};
// String: pads left
String.prototype.padLeft = function(padString, length) {
var str = this;
while (str.length < length)
str = padString + str;
return str;
};
// String: pads right
String.prototype.padRight = function(padString, length) {
var str = this;
while (str.length < length)
str = str + padString;
return str;
};
// Check contain string
String.prototype.contains = function(string) {
if (this.indexOf(string) != -1) {
return true;
}
return false;
};
// Number: pads left
Number.prototype.padLeft = function(padString, length) {
var str = this + "";
return str.padLeft(padString, length);
};
// Number: pads right
Number.prototype.padRight = function(padString, length) {
var str = this + "";
return str.padRight(padString, length);
};
// Clear data of array
Array.prototype.clear = function() {
this.splice(0, this.length);
};
/* CMS API Call */
COMMON.callCmsApi = function(url, accountPath, apiName, type, params, async, success, error) {
// アプリケーション設定取得
var sysSettings = COMMON.sysSetting();
// url 構築
var apiUrl;
if(!url) {
apiUrl = ClientData.conf_apiUrl(); //sysSettings.apiUrl;
} else {
apiUrl = url;
}
if(accountPath) {
apiUrl = COMMON.format(apiUrl, accountPath);
}
apiUrl = apiUrl + '/' + apiName + '/';
//----------------------------------------------------------------------------------
// for IE: 暫定的に対応 (これをすることでIE9でもCrossDomainリクエストが可能だがアクセスのたびに警告が出る)
$.support.cors = true;
//----------------------------------------------------------------------------------
// ajax によるAPIの実行(json)
$.ajax( {
async: (async) ? async : false,
type: (type) ? type : 'get',
url: apiUrl,
cache: false,
dataType: 'json',
data: params,
crossDomain: true,
beforeSend: function(xhr) {
/*
* ABook viewer for WEB 用のリクエストヘッダに、以下のヘッダを付加する
* X-AGT-AppId: ABookWebCL
* X-AGT-AppVersion: 0.0.1
*/
xhr.setRequestHeader('X-AGT-AppId', sysSettings.appName);
xhr.setRequestHeader('X-AGT-AppVersion', sysSettings.appVersion);
},
success: function(data) {
if(success) {
success(data);
}
},
error: function(xmlHttpRequest, txtStatus, errorThrown) {
/* call custom error process */
if(error) {
error(xmlHttpRequest, txtStatus, errorThrown);
} else {
if(xmlHttpRequest.status == 403) {
COMMON.showSystemError('sysErrorCallApi02');
}
else {
COMMON.showSystemError();
}
}
}
});
};
/*
* String utilities [ end ]
*/
// =============================================================================================
// Utils for string, date, number [ end ]
// =============================================================================================
var ValidationUtil = {
// 必須: Text
CheckRequiredForText : function(value) {
if (value == null || value == '') {
return false;
}
return true;
},
// get byte count
GetByteCount : function(value) {
var escapedStr = encodeURI(value);
if (escapedStr.indexOf("%") != -1) {
var count = escapedStr.split("%").length - 1;
if (count == 0)
count++; // perverse case; can't happen with real UTF-8
var tmp = escapedStr.length - (count * 3);
count = count + tmp;
} else {
count = escapedStr.length;
}
return count;
},
// 最小文字数
CheckMinLengthForByte : function(value, len) {
if (this.GetByteCount(value) < len)
return false;
return true;
},
// 最大文字数
CheckMaxLengthForByte : function(value, len) {
if (this.GetByteCount(value) > len)
return false;
return true;
},
// 半数字
IsNumber : function(value) {
var reg = new RegExp("^[0-9]+$");
return reg.test(value);
},
// 半英字
IsAlphabet : function(value) {
var reg = new RegExp("^[a-zA-Z]+$");
return reg.test(value);
},
// 半記号
IsSymbol : function(value) {
var reg = new RegExp(
"\u005b\u005e\u0027\u0060\u0027\u007e\u0027\u0021\u0027\u0040\u0027\u0023\u0027\u0024\u0027\u0025\u0027\u005e\u0027\u0026\u0027\u002a\u0027\u0028\u0027\u0029\u0027\u005f\u0027\u002b\u0027\u003d\u0027\u007b\u0027\u007d\u0027\u007c\u0027\u003a\u0027\u0022\u0027\u003b\u0027\u0027\u0027\u003c\u0027\u003e\u0027\u003f\u0027\u002f\u0027\u002e\u0027\u002c\u005c\u002d\u005b\u005c\u005d\u005c\u005c\u005d");
return !reg.test(value);
},
// メール
CheckEmailValid : function(value) {
// Check if string is a valid email address
var reg = new RegExp("^[0-9a-zA-Z]+@[0-9a-zA-Z]+[\\.]{1}[0-9a-zA-Z]+[\\.]?[0-9a-zA-Z]+$");
return reg.test(value);
},
// Password
CheckPasswordValid : function(value) {
// Check if string is a valid email address
var reg = new RegExp("^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[#+-\\./:_]).{1,47}$");
return reg.test(value);
},
// Alphabet + Nunber + Symbol
IsAlphabetOrNumberOrSymbol : function(value) {
// Check if string is alphabet or number or symbol
var reg = new RegExp(
"\u005b\u005e\u0061\u002d\u007a\u0041\u002d\u005a\u0030\u002d\u0039\u0027\u0060\u0027\u007e\u0027\u0021\u0027\u0040\u0027\u0023\u0027\u0024\u0027\u0025\u0027\u005e\u0027\u0026\u0027\u002a\u0027\u0028\u0027\u0029\u0027\u005f\u0027\u002b\u0027\u003d\u0027\u007b\u0027\u007d\u0027\u007c\u0027\u003a\u0027\u0022\u0027\u003b\u0027\u0027\u0027\u003c\u0027\u003e\u0027\u003f\u0027\u002f\u0027\u002e\u0027\u002c\u005c\u002d\u005b\u005c\u005d\u005c\u005c\u005d");
return !reg.test(value);
},
// Get the total of types in array
CheckNumberOfTypeInString : function(value) {
var list = new Array();
var c;
for ( var i = 0; i < value.length; i++) {
c = value[i];
for ( var j = i + 1; j < value.length; j++) {
if (value[j] == c) {
value = value.slice(0, j) + value.slice(j + 1, value.len);
j = j - 1;
}
}
list[i] = c;
}
var count = list.length;
return count
},
// Special character: *
IsCharacterSpecial : function(value) {
for ( var i = 0; i < value.length; i++) {
if (value[i] == '*')
return true;
}
return false;
},
// 半記号
IsPasswordSymbol : function(value) {
var reg = new RegExp("\u005b\u005e\u0027\u0023\u0027\u002b\u005c\u002d\u0027\u002e\u0027\u002f\u0027\u003a\u0027\u005f\u005d");
return !reg.test(value);
},
// 半記号
IsPasswordAlphabetOrNumerOrSymbol : function(value) {
var reg = new RegExp("\u005b\u005e\u0061\u002d\u007a\u0041\u002d\u005a\u0030\u002d\u0039\u0027\u0023\u0027\u002b\u005c\u002d\u0027\u002e\u0027\u002f\u0027\u003a\u0027\u005f\u005d");
return !reg.test(value);
},
HasSeqChar : function(value, num) {
var count = 0;
var prev = 0;
for (var i = 0; i < str.length(); i++) {
var c = str.charAt(i);
if (i > 0 && prev == c) {
count++;
if (count == num - 1) {
return true;
}
}
else {
count = 0;
}
prev = c;
}
return false;
},
ContainSameSeqChar : function(str1, str2, num) {
if (str2.length < num || str1.length < num) {
return false;
}
for (var i = 0; i <= str2.length - num; i++) {
var target = str2.substring(i, i + num);
if (str1.contains(target)) {
return true;
}
}
return false;
}
};
\ No newline at end of file
......@@ -3,9 +3,9 @@
*
* @since 1.4.3.2 & 1.4.3.3
*/
const CHK_CONSTANT = {};
const CONSTANT = {};
CHK_CONSTANT.SORT_TYPE = {
CONSTANT.SORT_TYPE = {
NAME: 0,
START_DATE_DESC: 1,
START_DATE_ASC: 2,
......@@ -13,39 +13,39 @@ CHK_CONSTANT.SORT_TYPE = {
LAST_EDIT_DATE: 4,
};
CHK_CONSTANT.PAGE_NAME = {
CONSTANT.PAGE_NAME = {
DASHBOARD: 'dashboard',
OPERATION_LIST: 'operationList',
FOOTER: 'main-footer.html',
DEFAULT: 'index.html',
LOGIN: 'login.html',
LOGIN: './login.html',
};
CHK_CONSTANT.PAGE_TAB = {
CONSTANT.PAGE_TAB = {
DASHBOARD: 'dashboard',
OPERATION_LIST: 'operationList',
};
CHK_CONSTANT.OPERATION_TYPE = {
CONSTANT.OPERATION_TYPE = {
LIST: '0',
DRAWING: '1',
VTOUR: '2',
PDF: '3',
};
CHK_CONSTANT.REPORT_TYPE = {
CONSTANT.REPORT_TYPE = {
REPORTONLY: '0',
INSPECT: '1',
WITHREPLY: '2',
WORKFLOW: '3',
};
CHK_CONSTANT.ADD_REPORT_FLG = {
CONSTANT.ADD_REPORT_FLG = {
UNABLE: '0',
ABLE: '1',
};
CHK_CONSTANT.URL = {
CONSTANT.URL = {
// BASE_CMS: 'https://' + location.host + '/checkapi/web/',
BASE_CMS: 'http://localhost:8080/acms/',
BASE_CHECKAPI: '/checkapi/web/',
......@@ -64,14 +64,51 @@ CONSTANT.DATA_TYPE = {
JSON: 'json',
}
CHK_CONSTANT.LANG = {
CONSTANT.LANG = {
SAVE_NAME: 'lang',
JAPAN: 'ja',
KOREA: 'ko',
ENGLISH: 'en',
};
CHK_CONSTANT.MSG_MAP = {
CONSTANT.KEYS = {
userInfo_loginId : 'loginId',
// Local :ユーザ情報(userInfo)_アカウントパス:String
userInfo_accountPath : 'accountPath',
// Local :ユーザ情報(userInfo)_アカウント情報記憶フラグ:Char(Y:可能, N:不可)
userInfo_rememberLogin : 'rememberLogin',
// Local :ユーザ情報(userInfo)_最終ログイン日時:Datetime
userInfo_lastLoginTime : 'lastLoginTime',
// Local :ユーザ情報(userInfo)_パスワードスキップ日時:Datetime
userInfo_pwdSkipDt : 'pwdSkipDt',
// Local :ユーザオプション(userOpt)_動画繰り返しフラグ:Interger(0: 繰り返しなし, 1: 繰り返しあり)
// Session/local:ユーザ情報(userInfo)_セッションID:String
userInfo_sid : 'sid',
userInfo_sid_preview : 'sidPreview',
// Session :事業者オプション(serviceOpt)_初回ログイン時パスワード強制変更:Integer(0:なし, 1:催促, 2:強制)
serviceOpt_force_pw_change_on_login : 'force_pw_change_on_login',
// Session :事業者オプション(serviceOpt)_定期ログイン時パスワード強制変更:Integer(0:なし, 1:催促, 2:強制)
serviceOpt_force_pw_change_periodically : 'force_pw_change_periodically',
// Session:事業者オプション(serviceOpt)_メモ・マーキングデータバックアップ使用:Char(Y:可能, N:不可)
userInfo_userName : 'userInfo_userName',
// Local:セッションID:String
userInfo_sid_bak : 'sid_bak',
// Session :通知情報(pushInfo)_新着件数:Interger
pushInfo_newMsgNumber : 'pushInfo_newMsgNumber',
conf_apiUrl : 'conf_apiUrl',
conf_apiLoginUrl : 'conf_apiLoginUrl',
conf_apiResourceDlUrl : 'conf_apiResourceDlUrl',
// Session :ABookCheck:Char(Y:有効, N:無効)
serviceOpt_abook_check : 'abook_check',
// Session :事業者オプション(serviceOpt)_任意のプッシュメッセージ:Char(Y:可能, N:不可)
serviceOpt_usable_push_message : 'usable_push_message',
// Local
IsJumpBack : 'IsJumpBack',
// Local:
JumpQueue : 'JumpQueue',
}
CONSTANT.MSG_MAP = {
all: { ja: '全て', ko: '전체', en: 'All' },
dateError: { ja: '開始日は終了日の前に設定してください。', ko: '잘못된 검색일입니다.', en: 'Please enter correct search date.' },
operationListTitle: { ja: 'トップページ|A Book Check', ko: '톱 페이지|A Book Check', en: 'Top Page|A Book Check' },
......
/**
* Common js for footer.
* ※Code is written mainly for dashboard and operationList.
*
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var FOOTER = {};
/**
* Change specific footer bottom to active.
*
* @param {String} bottomNavId
*/
FOOTER.activeBottomNav = function (bottomNavId) {
let elm = $('#' + bottomNavId);
if (typeof elm !== 'object') {
console.log('FOOTER.activeBottomNav:elm !== object:' + bottomNavId);
return;
}
elm.removeClass('text-secondary');
elm.addClass('text-primary');
let img = elm.find('img')[0];
if (img && img.getAttribute('data-src')) {
img.src = img.getAttribute('data-src');
}
};
/**
* change inactive all footer bottom
*/
FOOTER.inactiveAllBottomNav = function () {
let navs = document.getElementsByClassName('bottom-nav');
for (i = 0; i < navs.length; i++) {
navs[i].className = navs[i].className.replace('text-primary', 'text-secondary');
let img = navs[i].querySelector('img');
if (img && img.getAttribute('data-inactive-src')) {
img.src = img.getAttribute('data-inactive-src');
}
}
};
/**
* Go page of index.html.
* Store tab id in session for want to show display.
*
* @param {String} tabId
*/
FOOTER.goIndexPage = function (tabId) {
sessionStorage.activeTab = tabId;
COMMON.goUrlWithCurrentParams(DAFAULT_PAGE);
};
/**
* is the url index.html?
*/
FOOTER.isIndexPage = function () {
if (typeof location === 'object' && typeof location.pathname === 'string') {
if (location.pathname.includes(CONSTANT.PAGE_NAME.DEFAULT) == true) {
return true;
}
}
return false;
};
/**
* Initialize with any navigation
*
* @param {String} bottomNav
*/
FOOTER.activeInitBottomNav = function (bottomNav) {
FOOTER.inactiveAllBottomNav();
FOOTER.activeBottomNav(bottomNav);
};
/**
* Go page of dashboard
*/
FOOTER.goDashboard = function () {
sessionStorage.activeTab = CONSTANT.PAGE_TAB.DASHBOARD;
FOOTER.activeInitBottomNav('dashboardBottomNav');
if (FOOTER.isIndexPage()) {
TOP.showPage(CONSTANT.PAGE_NAME.DASHBOARD);
return;
}
FOOTER.goIndexPage(CONSTANT.PAGE_NAME.DASHBOARD);
};
/**
* Go page of operationList
*/
FOOTER.goOperationList = function () {
sessionStorage.activeTab = CONSTANT.PAGE_TAB.OPERATION_LIST;
FOOTER.activeInitBottomNav('operationListBottomNav');
if (FOOTER.isIndexPage()) {
TOP.showPage(CONSTANT.PAGE_NAME.OPERATION_LIST);
return;
}
FOOTER.goIndexPage(CONSTANT.PAGE_NAME.OPERATION_LIST);
};
/**
* Go to active tab when footer was loaded.
* If it is no active tab, go to page in settings.
*/
FOOTER.initFooter = function () {
$('#footer').load(CONSTANT.PAGE_NAME.FOOTER, function () {
if (typeof sessionStorage != 'undefined' && typeof sessionStorage.activeTab != 'undefined') {
if (sessionStorage.activeTab == CONSTANT.PAGE_TAB.DASHBOARD) {
FOOTER.goDashboard();
} else {
FOOTER.goOperationList();
}
return;
}
FOOTER.goOperationList();
// CHK.loadDashboardSetting(function() {
// if (CHK.dashboardSetting.dashboardHome) {
// FOOTER.goDashboard();
// } else {
// FOOTER.goOperationList();
// }
// });
});
};
/**
* ABook Viewer for WEB
* Common Library
* Copyright (C) Agentec Co, Ltd. All rights reserved.
*/
//グローバルの名前空間用のオブジェクトを用意する
var AVWEB = {};
AVWEB.hasErrorKey = 'AVW_HASERR';
/*
* User Environment Check Class
*/
var UserEnvironment = function() {
this.appName = navigator.appName;
this.userAgent = navigator.userAgent;
this.os = checkOS(this.userAgent);
this.browser = checkBrowser(this.userAgent);
/* windows os check */
this.isWindows = function() {
return (this.os == "windows");
};
/* mac os check */
this.isMac = function() {
return (this.os == "mac");
};
/* ipad check */
this.isIpad = function() {
return (this.os == "ipad");
};
/* iphone check */
this.isIphone = function() {
return (this.os == "iphone");
};
/* android check */
this.isAndroid = function() {
return (this.os == "android");
};
/* iOS check */
this.isIos = function() {
if(this.os == "ipad" || this.os == "iphone"){
return true;
} else {
return false;
}
};
/* mobile check */
this.isMobile = function() {
if(this.os == "ipad" || this.os == "iphone" || this.os == "android"){
return true;
} else {
return false;
}
};
/** check operating system */
function checkOS(userAgent) {
if(userAgent.toLowerCase().indexOf("windows") >= 0) {
return "windows";
}
if(userAgent.toLowerCase().indexOf("mac") >= 0) {
if(userAgent.toLowerCase().indexOf("ipad") >= 0) {
return "ipad";
}
if(userAgent.toLowerCase().indexOf("iphone") >= 0) {
return "iphone";
}
return "mac";
}
if(userAgent.toLowerCase().indexOf("android") >= 0) {
return "android";
}
return "unknown";
};
/** check user browser */
function checkBrowser(userAgent) {
if(userAgent.toLowerCase().indexOf("msie") >= 0) {
return "msie";
}
if(userAgent.toLowerCase().indexOf("trident") >= 0) {
return "msie";
}
if(userAgent.toLowerCase().indexOf("firefox") >= 0) {
return "firefox";
}
if(userAgent.toLowerCase().indexOf("safari") >= 0) {
if(userAgent.toLowerCase().indexOf("chrome") >= 0) {
return "chrome";
}
return "safari";
}
if(userAgent.toLowerCase().indexOf("opera") >= 0) {
return "opera";
}
return "unknown";
};
};
/*
* User Settings Class Definition
*/
var UserSetting = function() {
this.US_KEY="AVWUS";
this.userSetting = this.load();
};
/* get user setting from localStorage */
UserSetting.prototype.load = function () {
var storage = window.localStorage;
var value = null;
var js = null;
if (storage) {
var value = storage.getItem(this.US_KEY);
if (!value) {
value = "{}"; // 空JSON文字列
}
js = JSON.parse(value);
}
return js;
};
/* store user setting */
UserSetting.prototype.set = function(key, value) {
//if(!this.userSetting) {
this.userSetting = this.load();
//}
var values = this.userSetting;
if(!values) {
values = { key: value };
} else {
values[key] = value;
}
var storage = window.localStorage;
if(storage) {
var jsonStr = JSON.stringify(values);
storage.setItem(this.US_KEY, jsonStr);
}
this.userSetting = values;
};
/* grab user setting */
UserSetting.prototype.get = function(key) {
//if(!this.userSetting) {
this.userSetting = this.load();
//}
var values = this.userSetting;
if(values) {
return values[key];
}
return null;
};
/* show user setting object list */
UserSetting.prototype.show = function(elmid) {
var storage = window.localStorage;
var tags = "<p>";
if(storage) {
var value = storage.getItem(this.US_KEY);
if(value) {
var js = JSON.parse(value);
$.each(js, function(k, v) {
tags = tags + "<b>" + k + "</b>:" + v + "<br />";
});
}
tags = tags + "</p>";
$(elmid).html(tags);
}
};
/* ユーザ設定のキーリストを取得 */
UserSetting.prototype.keys = function() {
var storage = window.localStorage;
var keyList = [];
if(storage) {
var value = storage.getItem(this.US_KEY);
if(value) {
var js = JSON.parse(value);
var i = 0;
$.each(js, function(k, v) {
keyList[i++] = k;
});
}
return keyList;
}
return null;
};
/* ユーザ設定を削除 */
UserSetting.prototype.remove = function(key) {
var storage = window.localStorage;
if(storage) {
var value = storage.getItem(this.US_KEY);
if(value) {
var js = JSON.parse(value);
if(js) {
delete js[key];
storage.setItem(this.US_KEY, JSON.stringify(js));
}
}
}
};
/* ユーザ設定をすべて削除 */
UserSetting.prototype.removeAll = function() {
var storage = window.localStorage;
if(storage) {
storage.remove(this.US_KEY);
}
};
/*
* User Session Class Definition
*/
var UserSession = function() {
this.available = false;
};
/* Initialize User Session */
UserSession.prototype.init = function(option) {
this.available = false;
if(option == 'restore') {
var value = null;
try {
value = this._get('init');
} catch(e) {
value = null;
} finally {
if(value) {
this.available = true;
}
}
} else {
this.set("init", new Date().toLocaleString());
this.available = true;
}
};
/* store key, value item to user session */
UserSession.prototype.set = function(key, value) {
var storage = window.sessionStorage;
if(storage) {
if(this.available == false) {
if(key == "init") {
storage.setItem("AVWS_" + key, value);
} else {
throw new Error("Session destoryed.");
}
} else {
storage.setItem("AVWS_" + key, value);
}
}
};
/* get session item value */
UserSession.prototype.get = function(key) {
var value = null;
if(this.available) {
value = this._get(key);
} else {
throw new Error("Session Destroyed.");
}
return value;
};
/* get item value from session storage */
UserSession.prototype._get = function(key) {
var storage = window.sessionStorage;
var value = null;
if(storage) {
value = storage.getItem("AVWS_" + key);
}
return value;
};
/* destroy user session */
UserSession.prototype.destroy = function() {
var storage = window.sessionStorage;
if(storage) {
storage.clear();
this.available = false;
}
};
/* show user session object list */
UserSession.prototype.show = function(elmid) {
var storage = window.sessionStorage;
var tags = "<p>";
if(storage) {
for(var i = 0; i < storage.length; i++) {
var key = storage.key(i);
var value = storage.getItem(key);
tags = tags + "<b>" + key + "</b>:" + value + "<br />";
}
tags = tags + "</p>";
$(elmid).html(tags);
}
};
/*
* Variables
*/
AVWEB.avwUserSessionObj = null;
AVWEB.avwUserSettingObj = null;
//AVWEB.avwUserEnvObj = null;
AVWEB.avwSysSettingObj = null;
/* Initialize system */
$(function () {
// システム設定ファイルの配置先パスの決定
var location = window.location.toString().toLowerCase();
var sysFile = '';
if (location.indexOf('/abvw') < 0) {
sysFile = '../abvw/common/json/sys/conf.json';
} else {
sysFile = '../common/json/sys/conf.json';
}
// システム設定ファイルを読み込む
$.ajax({
url: sysFile,
async: false,
cache: false,
dataType: 'json',
success: function (data) {
AVWEB.avwSysSettingObj = data;
},
error: function (xmlHttpRequest, txtStatus, errorThrown) {
var error = 'Could not load the system configuration file. Please check it.';
error += '\n' + xmlHttpRequest.status + ' ' + txtStatus + ' ' + errorThrown + ' : ' + sysFile;
alert(error);
}
});
// ロード時に一旦エラー状態をクリアしておく
AVWEB.avwClearError();
//#31919 【調査】商談支援システム GoogleChromeでビッチイン・アウトが効かない
navigator.pointerEnabled = navigator.maxTouchPoints > 0; // Edge 17 touch support workaround
document.documentElement.ontouchstart = navigator.maxTouchPoints > 0 ? function(){} : undefined; // Chrome 70 touch support workaround
});
/* get system setting object */
AVWEB.avwSysSetting = function() {
return AVWEB.avwSysSettingObj;
};
///* get user environment object */
//function avwUserEnv() {
// if(AVWEB.avwUserEnvObj == null) {
// AVWEB.avwUserEnvObj = new UserEnvironment();
// }
// return AVWEB.avwUserEnvObj;
//};
/* get user session object */
AVWEB.avwUserSession = function() {
if(!AVWEB.avwUserSessionObj) {
var obj = new UserSession();
obj.init('restore');
if(obj.available) {
AVWEB.avwUserSessionObj = obj;
return AVWEB.avwUserSessionObj;
} else {
return null;
}
}
return AVWEB.avwUserSessionObj;
};
/* create user session object */
AVWEB.avwCreateUserSession = function() {
if(AVWEB.avwUserSessionObj) {
AVWEB.avwUserSessionObj.destroy();
} else {
AVWEB.avwUserSessionObj = new UserSession();
AVWEB.avwUserSessionObj.init();
}
return AVWEB.avwUserSessionObj;
};
/* check Login or not */
AVWEB.avwCheckLogin = function(option) {
var userSession = AVWEB.avwUserSession();
if(!userSession) {
/* エラー画面を表示 */
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>' +
'<div><button id="avw-unauth-ok">OK</button></div>' +
'</div></div></div>';
$('body').prepend(tags);
$('#avw-auth-error').css({
'opacity': 1,
'position': 'fixed',
'top': '0',
'left': '0',
'width': $(window).width(),
'height': $(window).height(),
'zIndex': '10000'
});
// resize error page
$(window).resize(function() {
$('#avw-auth-error').css( {
'width': $(window).width(),
'height': $(window).height()
});
});
var returnPage;
if(option) {
returnPage = option
} else {
var sysSetting = AVWEB.avwSysSetting();
returnPage = sysSetting.loginPage;
}
/* ログイン画面に戻る */
$('#avw-unauth-ok').click(function() {
window.location = returnPage;
});
return false;
}
return true;
};
/* get user setting object */
AVWEB.avwUserSetting = function() {
if(AVWEB.avwUserSettingObj == null) {
AVWEB.avwUserSettingObj = new UserSetting();
}
return AVWEB.avwUserSettingObj;
};
/* CMS API Call(async. call) */
AVWEB.avwCmsApi = function(accountPath, apiName, type, params, success, error) {
//var sysSettings = AVWEB.avwSysSetting();
AVWEB._callCmsApi(ClientData.conf_apiUrl(), accountPath, apiName, type, params, true, success, error);
};
/* CMS API Call(sync. call) */
AVWEB.avwCmsApiSync = function(accountPath, apiName, type, params, success, error) {
//var sysSettings = AVWEB.avwSysSetting();
AVWEB._callCmsApi(ClientData.conf_apiUrl(), accountPath, apiName, type, params, false, success, error);
};
/* CMS API Call(async. call) */
AVWEB.avwCmsApiWithUrl = function(url, accountPath, apiName, type, params, success, error) {
AVWEB._callCmsApi(url, accountPath, apiName, type, params, true, success, error);
};
/* CMS API Call(sync. call) */
AVWEB.avwCmsApiSyncWithUrl = function(url, accountPath, apiName, type, params, success, error) {
AVWEB._callCmsApi(url, accountPath, apiName, type, params, false, success, error);
};
/* CMS API Call */
AVWEB._callCmsApi = function(url, accountPath, apiName, type, params, async, success, error) {
// アプリケーション設定取得
var sysSettings = AVWEB.avwSysSetting();
// url 構築
var apiUrl;
if(!url) {
apiUrl = ClientData.conf_apiUrl(); //sysSettings.apiUrl;
} else {
apiUrl = url;
}
if(accountPath) {
apiUrl = AVWEB.format(apiUrl, accountPath);
}
apiUrl = apiUrl + '/' + apiName + '/';
//オーサリングプレビュー対応
if(COMMON.isAuthoringPreview() && CONTENTVIEW_GENERAL.pid != ''){
params.pid = CONTENTVIEW_GENERAL.pid;
}
//----------------------------------------------------------------------------------
// for IE: 暫定的に対応 (これをすることでIE9でもCrossDomainリクエストが可能だがアクセスのたびに警告が出る)
$.support.cors = true;
//----------------------------------------------------------------------------------
// ajax によるAPIの実行(json)
$.ajax( {
async: (async) ? async : false,
type: (type) ? type : 'get',
url: apiUrl,
cache: false,
dataType: 'json',
data: params,
crossDomain: true,
beforeSend: function(xhr) {
/*
* ABook viewer for WEB 用のリクエストヘッダに、以下のヘッダを付加する
* X-AGT-AppId: ABookWebCL
* X-AGT-AppVersion: 0.0.1
*/
xhr.setRequestHeader('X-AGT-AppId', sysSettings.appName);
xhr.setRequestHeader('X-AGT-AppVersion', sysSettings.appVersion);
},
success: function(data) {
if(success) {
success(data);
}
},
error: function(xmlHttpRequest, txtStatus, errorThrown) {
/* call custom error process */
if(error) {
error(xmlHttpRequest, txtStatus, errorThrown);
} else {
if(xmlHttpRequest.status == 403) {
AVWEB.showSystemError('sysErrorCallApi02');
}
else {
AVWEB.showSystemError();
}
}
}
});
};
/* CMS API Call */
AVWEB._callCmsApiWhen = function(accountPath, apiName, type, params ) {
// アプリケーション設定取得
var sysSettings = AVWEB.avwSysSetting();
// url 構築
var apiUrl = ClientData.conf_apiUrl();
if(accountPath) {
apiUrl = AVWEB.format(apiUrl, accountPath);
}
apiUrl = apiUrl + '/' + apiName + '/';
//オーサリングプレビュー対応
if(COMMON.isAuthoringPreview() && CONTENTVIEW_GENERAL.pid != ''){
params.pid = CONTENTVIEW_GENERAL.pid;
}
//----------------------------------------------------------------------------------
// for IE: 暫定的に対応 (これをすることでIE9でもCrossDomainリクエストが可能だがアクセスのたびに警告が出る)
$.support.cors = true;
//----------------------------------------------------------------------------------
// ajax によるAPIの実行(json)
var ajaxObj = $.ajax( {
async: true,
type: (type) ? type : 'get',
url: apiUrl,
cache: false,
dataType: 'json',
data: params,
crossDomain: true,
beforeSend: function(xhr) {
/*
* ABook viewer for WEB 用のリクエストヘッダに、以下のヘッダを付加する
* X-AGT-AppId: ABookWebCL
* X-AGT-AppVersion: 0.0.1
*/
xhr.setRequestHeader('X-AGT-AppId', sysSettings.appName);
xhr.setRequestHeader('X-AGT-AppVersion', sysSettings.appVersion);
}
});
return ajaxObj;
};
/*
* Create Image Data Scheme URI
*/
var ImageDataScheme = function () {
// バイナリデータを文字列に変換
this.convBinaryToString = function (filestream) {
var bytes = [];
for (var i = 0; i < filestream.length; i++) {
bytes[i] = filestream.charCodeAt(i) & 0xff;
}
return String.fromCharCode.apply(String, bytes);
};
// 画像のバイト文字列をdataスキームURIに変換
this.convImageToDataScheme = function (binaryData, ie) {
var b64Data;
var imgHeader;
var imgType = 'png';
if (ie) {
// binary to base64 for ie
b64Data = this.base64encodeForIE(binaryData);
} else {
// binary to base64 for FF, Chrome, Safari
var bin = this.convBinaryToString(binaryData);
b64Data = btoa(bin);
imgHeader = bin.substring(0, 9);
imgType = this.checkImageType(imgHeader);
}
return 'data:image/' + imgType + ';base64,' + b64Data;
};
// 画像タイプ(種類をチェック)
this.checkImageType = function (header) {
if (header.match(/^\x89PNG/)) {
return 'png';
} else if (header.match(/^GIF87a/) || header.match(/^GIF89a/)) {
return 'gif';
} else if (header.match(/^\xff\xd8/)) {
return 'jpeg';
} else {
// デフォルトはPNG画像として扱う
return 'png';
}
};
// バイナリデータをBase64文字列に変換する(IE専用)
this.base64encodeForIE = function (binaryData) {
// 新規XMLデータを作成
var xml = new ActiveXObject("Microsoft.XMLDOM");
xml.loadXML('<?xml version="1.0" ?> <root/>');
xml.documentElement.setAttribute("xmlns:dt", "urn:schemas-microsoft-com:datatypes");
// バイナリデータを格納するためのノードを作成
var node = xml.createElement("file-node");
node.dataType = "bin.base64";
// バイナリデータを格納
node.nodeTypedValue = binaryData;
xml.documentElement.appendChild(node);
// そのノードからBASE64エンコード済み文字列を取り出す
var base64encoded_text = node.text;
return base64encoded_text;
};
};
/* Grab Content Page Image Function
* <parameters>
* accountPath: accountPath
* params: request parameters (data type: json, see below)
* { 'sid': sid, contentId: 'contentId', pageNo: 'pageNo' }
* success: function(string: this is image binary encoded string)
* error: function(XMLHttpRequest, XMLHttpRequest.status, XMLHttpRequest.statusText)
*/
AVWEB.avwGrabContentPageImage = function(accountPath, params, success, error) {
// API実行準備
var sysSettings = AVWEB.avwSysSetting();
var apiName = 'webContentPageImage'; // API名
//url 構築
var apiUrl;
apiUrl = ClientData.conf_apiUrl(); //sysSettings.apiUrl;
if(accountPath) {
apiUrl = AVWEB.format(apiUrl, accountPath)
}
apiUrl = apiUrl + '/' + apiName + '/';
// 送信パラメータの構築
var requestParams = 'contentId=' + params.contentId + '&sid=' + params.sid + '&pageNo=' + params.pageNo;
//オーサリングプレビュー対応
if(COMMON.isAuthoringPreview() && CONTENTVIEW_GENERAL.pid != ''){
requestParams = requestParams + '&pid=' + CONTENTVIEW_GENERAL.pid;
}
apiUrl += '?' + requestParams + '&isBase64=true';
if( ClientData.isStreamingMode() ){
apiUrl += '&isStreaming=true';
}
// バイナリ形式で画像イメージを取得し、Base64にエンコードする
var xmlHttp;
var ie = false;
//if(window.ActiveXObject) {
// xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
// ie = true;
//} else {
//xmlHttp = new XMLHttpRequest();
//}
//IE10以降はXMLHttpRequestを優先して使う
try{
xmlHttp = new XMLHttpRequest();
}catch(e){
try{
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
ie = true;
}catch(e){
AVWEB.showSystemError();
return;
}
}
xmlHttp.open('get', apiUrl);
xmlHttp.setRequestHeader('X-AGT-AppId', sysSettings.appName);
xmlHttp.setRequestHeader('X-AGT-AppVersion', sysSettings.appVersion);
/*
if(xmlHttp.overrideMimeType) {
// for FF, Chrome, Safari
xmlHttp.overrideMimeType('text/plain; charset=x-user-defined');
}
*/
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
/*
//base64 encode
var ids = new ImageDataScheme();
var src; // Image Data URI
if(ie) {
// for IE
src = ids.convImageToDataScheme(xmlHttp.responseBody, ie);
} else {
// for FF, Chrome, Safari
src = ids.convImageToDataScheme(xmlHttp.responseText, ie);
}
*/
var src; // Image Data URI
/*
if(ie) {
// for IE
src = 'data:image/png;base64,' + xmlHttp.responseBody;
} else {
// for FF, Chrome, Safari
src = 'data:image/png;base64,' + xmlHttp.responseText;
}
*/
src = 'data:image/png;base64,' + xmlHttp.responseText;
if (success) {
success(src);
}
} else {
if (error) {
error(xmlHttp, xmlHttp.status, xmlHttp.statusText);
} else {
AVWEB.avwLog(xmlHttp.status + ' ' + xmlHttp.statusText);
}
}
}
};
xmlHttp.send();
};
/*
* file upload function: call uploadBackupFile API
* <params>
* [
* { name: 'sid', content: 'content' }
* { name: 'deviceType', content: '4' }
* { name: 'formFile', fileName: 'filename', contentType: 'text-plain' }
* ]
*/
AVWEB.avwUploadBackupFile = function(accountPath, params, async, success, error) {
/* API実行準備*/
var sysSettings = AVWEB.avwSysSetting();
var apiName = 'uploadBackupFile'; // API名
//url 構築
var apiUrl;
apiUrl = ClientData.conf_apiUrl(); //sysSettings.apiUrl;
if(accountPath) {
apiUrl = AVWEB.format(apiUrl, accountPath)
}
apiUrl = apiUrl + '/' + apiName + '/';
/* POST(multipart/form-data)送信準備 */
var body = '';
var boundary = '';
// boundaryを構築
var date = new Date();
boundary = '------------------------' + date.getMilliseconds()
+ (date.getMonth() + 1)
+ date.getMinutes()
+ date.getFullYear()
+ date.getDay()
+ date.getHours()
+ date.getSeconds();
// bodyを構築
for(var i = 0; i < params.length; i++) {
var item = params[i];
body += '--' + boundary + '\r\n';
body += 'Content-Disposition: form-data; name="' + item.name + '"';
if(item.fileName) {
body += '; filename="' + item.fileName + '"\r\n';
} else {
body += '\r\n';
}
if(item.contentType) {
body += 'Content-Type="' + item.contentType + '"\r\n';
}
body += '\r\n';
body += item.content + '\r\n';
}
body += '--' + boundary + '--\r\n';
// ajax によるAPIの実行(json)
$.ajax( {
async: (async) ? async : false,
type: 'post',
url: apiUrl,
data: body,
beforeSend: function(xhr) {
/*
* ABook viewer for WEB 用のリクエストヘッダに、以下のヘッダを付加する
* X-AGT-AppId: ABookWebCL
* X-AGT-AppVersion: 0.0.1
*/
xhr.setRequestHeader('X-AGT-AppId', sysSettings.appName);
xhr.setRequestHeader('X-AGT-AppVersion', sysSettings.appVersion);
/*
* uploadBackupFileは multipart/form-data でPOST送信する
*/
xhr.setRequestHeader('Content-Type', 'multipart/form-data; boundary=' + boundary);
//xhr.setRequestHeader('Content-Length', AVWEB.getByte(body));
},
success: function(data) {
if(success) {
success(data);
}
},
error: function(xmlHttpRequest, txtStatus, errorThrown) {
/* call custom error process */
if(error) {
error(xmlHttpRequest, txtStatus, errorThrown);
} else {
AVWEB.showSystemError();
}
}
});
};
/* show system error message */
AVWEB.showSystemError = function(textId) {
if(AVWEB.avwHasError()) {
// すでにエラー状態であればエラーを表示しない
return;
} else {
// エラー状態にセット
AVWEB.avwSetErrorState();
}
if( !textId ){
textId = 'sysErrorCallApi01';
}
// create DOM element for showing error message
var errMes = I18N.i18nText(textId);
var tags = '<div id="avw-sys-error"></div>';
//$('body').prepend(tags);
$('body').append(tags);
$('#avw-sys-error').css({
'opacity': 0.7,
'position': 'fixed',
'top': '0',
'left': '0',
'width': $(window).width(),
'height': $(window).height(),
'background': '#999',
'z-index': 90000
});
// resize error page
$(window).resize(function() {
$('#avw-sys-error').css( {
'width': $(window).width(),
'height': $(window).height()
});
});
// show error messages
$().toastmessage({ position: 'middle-center' });
$().toastmessage('showToast', {
type: 'error',
sticky: true,
text: errMes,
close: function() {
if( ClientData.isStreamingMode() == false && COMMON.isAuthoringPreview() == false){
//ストリーミングでなければログアウト時と同じ後始末処理をしてログイン画面に戻す
if( !HEADER.webLogoutEvent() ){
//ログアウト出来なかった
SessionStorageUtils.clear();
//カスタムURI起動対応のため sidのバックアップは消さない
AVWEB.avwUserSetting().remove(COMMON.Keys.userInfo_sid);
//AVWEB.avwUserSetting().remove(COMMON.Keys.userInfo_sid_bak);
AVWEB.avwScreenMove(COMMON.ScreenIds.Login);
}
} else if(COMMON.isAuthoringPreview()) {
//オーサリングプレビューモードの場合は閉じる
window.open('', '_self', '');
window.close();
}
}
});
/*
$().toastmessage('showToast', {
type: 'error',
sticky: true,
text: errMes,
close: function() { isShowErrorMessage = false; }
});
*/
};
/* エラー状態を取得 */
AVWEB.avwHasError = function() {
var session = window.sessionStorage;
var isError = false;
if(session) {
isError = session.getItem(AVWEB.hasErrorKey);
}
return (isError == 'true');
};
/* エラー状態にセット */
AVWEB.avwSetErrorState = function() {
var session = window.sessionStorage;
if(session) {
session.setItem(AVWEB.hasErrorKey, true);
}
};
/* エラー状態をクリア */
AVWEB.avwClearError = function() {
var session = window.sessionStorage;
if(session) {
session.setItem(AVWEB.hasErrorKey, false);
}
};
/* ブラウザunload時に警告メッセージの出力設定を行う関数 */
AVWEB.avwSetLogoutNortice = function() {
window.onbeforeunload = function(event) {
if(ClientData.isGetitsMode() || ClientData.isCheckViewMode()){
COMMON.SetEndLog(CONTENTVIEW_GENERAL.contentID);
COMMON.RegisterLog();
} else if (ClientData.isStreamingMode() == false) {
// ストリーミング以外ではメッセージ表示
// FFでは、https://bugzilla.mozilla.org/show_bug.cgi?id=588292 によりメッセージが出力されない
var message = I18N.i18nText('sysInfoWithoutLogout');
var e = event || window.event;
if(e) {
e.returnValue = message;
}
return message;
}
};
};
/* 警告メッセージを出力しないでページ遷移を行う関数 */
AVWEB.avwScreenMove = function(url) {
window.onbeforeunload = null;
window.location = url;
};
/* Debug Log */
AVWEB.avwLog = function(msg) {
if(AVWEB.avwSysSetting().debug) {
console.log(msg);
}
};
/* get bytes of text */
AVWEB.getByte = function(text) {
var count = 0;
var n;
for(var i=0; i<text.length; i++) {
n = escape(text.charAt(i));
if (n.length < 4) {
count++;
}
else {
count+=2;
}
}
return count;
};
AVWEB.getApiUrl = function(accountPath) {
// url 構築
//var sysSettings = AVWEB.avwSysSetting();
var apiUrl = ClientData.conf_apiUrl(); //sysSettings.apiUrl;
if(accountPath) {
apiUrl = AVWEB.format(apiUrl, accountPath);
}
return apiUrl;
};
/** shop配下のアクションを呼ぶURLを作成 */
AVWEB.getShopApiUrl = function(accountPath) {
// Shop url 構築
var apiUrl = ClientData.conf_apiUrl(); //sysSettings.apiUrl;
if(accountPath) {
apiUrl = AVWEB.format(apiUrl, accountPath);
}
return apiUrl.substring(0, apiUrl.length - 6) + "shop";
};
/** checkapi配下のアクションを呼ぶURLを作成 */
AVWEB.getCheckApiUrl = function(accountPath) {
// checkapi url 構築
var apiUrl = ClientData.conf_apiUrl(); //sysSettings.apiUrl;
if(accountPath) {
apiUrl = AVWEB.format(apiUrl, accountPath);
}
return apiUrl.substring(0, apiUrl.length - 6) + "checkapi";
};
/* get url */
AVWEB.getURL = function(apiName) {
//var sysSettings = AVWEB.avwSysSetting();
var isStreaming = "false";
if(ClientData.isStreamingMode()){
isStreaming = "true";
}
var url = ClientData.conf_apiResourceDlUrl(); //sysSettings.apiResourceDlUrl;
url = AVWEB.format(url, ClientData.userInfo_accountPath()) + '/' + apiName + '/?isStreaming=' + isStreaming;
//オーサリングプレビュー対応
if(COMMON.isAuthoringPreview() && CONTENTVIEW_GENERAL.pid != ''){
url = url + '&pid=' + CONTENTVIEW_GENERAL.pid;
}
return url;
};
/* String.format function def. */
AVWEB.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 fmt;
};
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -16,20 +16,20 @@
<script src="/abvw/common/js/jquery/jquery-3.6.0.min.js?__UPDATEID__"></script>
<script src="/abvw/common/js/jquery/jquery-ui.min.js?__UPDATEID__"></script>
<script src="/abvw/common/js/web/common.js?__UPDATEID__"></script>
<script src="/abvw/common/js/web/avweb.js?__UPDATEID__"></script>
<script src="/abvw/common/js/appCommon/constant.js?__UPDATEID__"></script>
<script src="/abvw/common/js/appCommon/check-common.js?__UPDATEID__"></script>
<!-- <script src="/abvw/common/js/web/common.js?__UPDATEID__"></script>
<script src="/abvw/common/js/web/avweb.js?__UPDATEID__"></script> -->
<script src="/abvw/common/js/constant.js?__UPDATEID__"></script>
<script src="/abvw/common/js/common.js?__UPDATEID__"></script>
<script src="/abvw/js/operationList/operationList.js?__UPDATEID__"></script>
<script src="/abvw/js/topPage/topPage.js?__UPDATEID__"></script>
<script src="/abvw/js/dashboardSetting/check-dashboard-setting.js?__UPDATEID__"></script>
<script src="/abvw/js/dashboard/check-dashboard.js?__UPDATEID__"></script>
<script src="/abvw/common/js/appCommon/check-footer.js?__UPDATEID__"></script>
<script src="/abvw/common/js/footer.js?__UPDATEID__"></script>
<script src="/abvw/common/js/appCommon/app.js?__UPDATEID__" defer></script>
</head>
<body onload="CHK_TOP.init();" style="position: relative; margin-top: 53px;">
<body onload="TOP.init();" style="position: relative; margin-top: 53px;">
<!--作業一覧画面-->
<section id="operationList" class="page-content" style="display: none;">
......@@ -38,7 +38,7 @@
<header style="position: fixed; width: 100%; top: 0px; left: 0; z-index: 999;">
<nav class="navbar navbar-dark bg-primary">
<div>
<a class="navbar-brand category-btn lht-0 d-none" onclick="CHK_OL.openCategory();" id="operationGroupMasterButton">
<a class="navbar-brand category-btn lht-0 d-none" onclick="OL.openCategory();" id="operationGroupMasterButton">
<i class="fa fa-folder fs-12 p-1" id="category-toggle-button"></i>
<span class="d-none d-md-inline fs-10 multi-lang" data-msg="buttonCategory"></span>
</a>
......@@ -53,7 +53,7 @@
<nav id="category-menu" class="drawer-menu">
<div class="d-flex justifyfont-weight-bold fs-13 p-3 mb-0 multi-lang" data-msg="buttonCategory"></h2>
<a class="category-content-between border-bottom">
<h2 class="text-nowrap -btn p-3" onclick="CHK_OL.openCategory();" href="#"><i class="fa fa-times"></i></a>
<h2 class="text-nowrap -btn p-3" onclick="OL.openCategory();" href="#"><i class="fa fa-times"></i></a>
</div>
</nav>
</section>
......@@ -74,7 +74,7 @@
<div class="form-group has-search input-group">
<input type="text" class="form-control multi-lang" data-msg="placeholderOperationName" placeholder="placeholderOperationName" id="searchTaskName">
<div class="input-group-append">
<i class="fas fa-search input-group-text" onclick="CHK_OL.search();"></i>
<i class="fas fa-search input-group-text" onclick="OL.search();"></i>
</div>
</div>
</div>
......@@ -124,12 +124,12 @@
<span class="d-none d-md-inline text-dark fs-10 align-middle multi-lang" data-msg="labelSort"></span>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item sort-type multi-lang" data-msg="labelSortName" data-sort="0" onclick="CHK_OL.changeSortType(this);"></a>
<a class="dropdown-item sort-type active multi-lang" data-msg="labelSortNew" data-sort="1" id="defaultSort" onclick="CHK_OL.changeSortType(this);"></a>
<a class="dropdown-item sort-type multi-lang" data-msg="labelSortOld" data-sort="2" onclick="CHK_OL.changeSortType(this);"></a>
<a class="dropdown-item sort-type multi-lang" data-msg="labelSortOpen" data-sort="4" onclick="CHK_OL.changeSortType(this);"></a>
<a class="dropdown-item sort-type multi-lang" data-msg="labelSortName" data-sort="0" onclick="OL.changeSortType(this);"></a>
<a class="dropdown-item sort-type active multi-lang" data-msg="labelSortNew" data-sort="1" id="defaultSort" onclick="OL.changeSortType(this);"></a>
<a class="dropdown-item sort-type multi-lang" data-msg="labelSortOld" data-sort="2" onclick="OL.changeSortType(this);"></a>
<a class="dropdown-item sort-type multi-lang" data-msg="labelSortOpen" data-sort="4" onclick="OL.changeSortType(this);"></a>
</div>
<a href="javascript:CHK_OL.resetSearch();" class="text-decoration-none py-2 lht-0 d-inline-block ml-3">
<a href="javascript:OL.resetSearch();" class="text-decoration-none py-2 lht-0 d-inline-block ml-3">
<img class="icon" src="/abvw/img/operationList/icon_clear.svg">
<span class="d-none d-md-inline text-dark fs-10 align-middle multi-lang" data-msg="labelReset" lnag="labelReset"></span>
</a>
......@@ -190,7 +190,7 @@
<!--アラート-->
<div class="alert-overlay d-none"></div>
<div class="alert-area d-none">
<i class="text-right fas fa-times fa-2x loading-close" onclick="CHK_Common.alertClose();"></i>
<i class="text-right fas fa-times fa-2x loading-close" onclick="COMMON.alertClose();"></i>
<div class="fs-13 mt-4 text-left" style="padding: 15px;" id="alertMsg"></div>
</div>
......
......@@ -11,28 +11,19 @@
<title></title>
<link rel="stylesheet" type="text/css" href="/abvw/common/css/web/common.css?__UPDATEID__1" />
<!-- <link rel="stylesheet" type="text/css" href="./abvw/common/css/jquery-ui.css?__UPDATEID__" /> -->
<link rel="stylesheet" type="text/css" href="/abvw/common/css/jquery/jquery-ui.min.css?__UPDATEID__1" />
<link rel="stylesheet" type="text/css" href="/abvw/common/css/jquery/jquery-ui.structure.min.css?__UPDATEID__1" />
<link rel="stylesheet" type="text/css" href="/abvw/common/css/jquery/jquery-ui.theme.min.css?__UPDATEID__1" />
<!-- <link rel="stylesheet" type="text/css" href="./abvw/common/css/jquery.toastmessage.css?__UPDATEID__" /> -->
<link rel="stylesheet" type="text/css" href="/abvw/css/login/login.css?__UPDATEID__1" />
<link rel="stylesheet" type="text/css" href="/abvw/css/login/login_validation.css?__UPDATEID__1" />
<!-- <link rel="stylesheet" type="text/css" href="./abvw/css/layout/limit_access.css?__UPDATEID__" /> -->
<link rel="stylesheet" type="text/css" href="/abvw/common/css/web/common.css?__UPDATEID__" />
<link rel="stylesheet" type="text/css" href="/abvw/common/css/jquery/jquery-ui.min.css?__UPDATEID__" />
<link rel="stylesheet" type="text/css" href="/abvw/common/css/jquery/jquery-ui.structure.min.css?__UPDATEID__" />
<link rel="stylesheet" type="text/css" href="/abvw/common/css/jquery/jquery-ui.theme.min.css?__UPDATEID__" />
<link rel="stylesheet" type="text/css" href="/abvw/css/login/login.css?__UPDATEID__" />
<link rel="stylesheet" type="text/css" href="/abvw/css/login/login_validation.css?__UPDATEID__" />
<script type="text/javascript" src="/abvw/common/js/jquery/jquery-3.6.0.min.js?__UPDATEID__1"></script>
<script type="text/javascript" src="/abvw/common/js/jquery/jquery-ui.min.js?__UPDATEID__1"></script>
<!-- <script type="text/javascript" src="./abvw/common/js/jquery-1.8.1.min.js?__UPDATEID__"></script>-->
<!-- <script type="text/javascript" src="./abvw/common/js/jquery-ui-1.8.23.custom.min.js?__UPDATEID__"></script> -->
<!-- <script type="text/javascript" src="./abvw/common/js/jquery.toastmessage.js?__UPDATEID__"></script> -->
<!-- <script type="text/javascript" src="./abvw/common/js/screenLock.js?__UPDATEID__" ></script> -->
<script type="text/javascript" src="/abvw/common/js/web/thickbox.js?__UPDATEID__1"></script>
<script type="text/javascript" src="/abvw/common/js/web/avweb.js?__UPDATEID__1"></script>
<script type="text/javascript" src="/abvw/common/js/web/i18n.js?__UPDATEID__1"></script>
<script type="text/javascript" src="/abvw/common/js/web/common.js?__UPDATEID__1"></script>
<!-- <script type="text/javascript" src="./abvw/js/Limit_Access_Content.js?__UPDATEID__"></script> -->
<script type="text/javascript" src="/abvw/js/login/login.js?__UPDATEID__1"></script>
<script type="text/javascript" src="/abvw/common/js/jquery/jquery-3.6.0.min.js?__UPDATEID__"></script>
<script type="text/javascript" src="/abvw/common/js/jquery/jquery-ui.min.js?__UPDATEID__"></script>
<script type="text/javascript" src="/abvw/common/js/web/i18n.js?__UPDATEID__"></script>
<script type="text/javascript" src="/abvw/common/js/constant.js?__UPDATEID__"></script>
<script type="text/javascript" src="/abvw/common/js/common.js?__UPDATEID__"></script>
<script type="text/javascript" src="/abvw/js/login/login.js?__UPDATEID__"></script>
<!--[if gte IE 9]>
<style type="text/css">
......
......@@ -40,7 +40,7 @@ LOGIN.saveLoginInfo = function() {
I18N.changeLanguage(lang);
// Set flag コンテンツデータチェックフラグ = true to sync local with server
ClientData.common_contentDataChkFlg(true);
// ClientData.common_contentDataChkFlg(true);
var accountPath, loginId, password;
var chkRemember = $('#chkRemember').attr('checked');
......@@ -76,9 +76,9 @@ LOGIN.saveLoginInfo = function() {
LOGIN.checkValidation = function() {
// 暗号化モードならチェック無し
if (ClientData.serviceOpt_encryption() == 'Y') {
return true;
}
// if (ClientData.serviceOpt_encryption() == 'Y') {
// return true;
// }
var accountPath = $('#txtAccPath').val();
var loginId = $('#txtAccId').val();
......@@ -171,7 +171,7 @@ LOGIN.processLogin = function() {
// Get url to login
var apiLoginUrl = ClientData.conf_apiLoginUrl(); // sysSettings.apiLoginUrl;
AVWEB.avwCmsApiWithUrl(apiLoginUrl, null, 'webClientLogin', 'GET', params, function(data) {
COMMON.callCmsApi(apiLoginUrl, null, 'webClientLogin', 'GET', params, true, function(data) {
LOGIN.userinfo_sid = data.sid;
LOGIN.userInfo_userName = data.userName;
LOGIN.optionList = data.serviceOptionList;
......@@ -186,9 +186,9 @@ LOGIN.processLogin = function() {
$('#main-error-message').css('display', 'none');
if (ClientData.serviceOpt_encryption() == 'Y') {
data.requirePasswordChange = 0;
}
// if (ClientData.serviceOpt_encryption() == 'Y') {
// data.requirePasswordChange = 0;
// }
console.log("data.requirePasswordChange:" + data.requirePasswordChange);
console.log("ClientData.serviceOpt_abook_check:" + ClientData.serviceOpt_abook_check());
......@@ -198,7 +198,7 @@ LOGIN.processLogin = function() {
ClientData.userInfo_sid(ClientData.userInfo_sid_local());
// ホームへ移動
AVWEB.avwScreenMove("index.html");
COMMON.avwScreenMove("index.html");
} else if (data.requirePasswordChange == 1) {
......@@ -227,7 +227,7 @@ LOGIN.processLogin = function() {
ClientData.userInfo_sid(ClientData.userInfo_sid_local());
// ホームへ移動
AVWEB.avwScreenMove("index.html");
COMMON.avwScreenMove("index.html");
} else if (numDay > 30) {
LOGIN.OpenChangePasswordDialog();
$('#btnSkip').show();
......@@ -238,7 +238,7 @@ LOGIN.processLogin = function() {
ClientData.userInfo_sid(ClientData.userInfo_sid_local());
// ホームへ移動
AVWEB.avwScreenMove("index.html");
COMMON.avwScreenMove("index.html");
}
} else if (data.requirePasswordChange == 2) {
......@@ -261,7 +261,7 @@ LOGIN.processLogin = function() {
ClientData.userInfo_sid(ClientData.userInfo_sid_local());
// ホームへ移動
AVWEB.avwScreenMove("index.html");
COMMON.avwScreenMove("index.html");
} else if (numDay > 30) {
LOGIN.OpenChangePasswordDialog();
......@@ -279,12 +279,12 @@ LOGIN.processLogin = function() {
} else { // No need to change password
ClientData.userInfo_sid(ClientData.userInfo_sid_local());
// ホームへ移動
AVWEB.avwScreenMove("index.html");
COMMON.avwScreenMove("index.html");
}
}
} else {
LOGIN.login_errorMessage = data.errorMessage;
$('#main-error-message').html(AVWEB.format(I18N.i18nText('msgLoginErrWrong'), data.errorMessage).toString());
$('#main-error-message').html(COMMON.format(I18N.i18nText('msgLoginErrWrong'), data.errorMessage).toString());
$('#main-error-message').show();
}
......@@ -294,9 +294,9 @@ LOGIN.processLogin = function() {
if (xhr.responseText && xhr.status != 0) {
LOGIN.login_errorMessage = JSON.parse(xhr.responseText).errorMessage;
$('#main-error-message').html(AVWEB.format(I18N.i18nText('msgLoginErrWrong'), JSON.parse(xhr.responseText).errorMessage).toString());
$('#main-error-message').html(COMMON.format(I18N.i18nText('msgLoginErrWrong'), JSON.parse(xhr.responseText).errorMessage).toString());
} else {
$('#main-error-message').html(AVWEB.format(I18N.i18nText('msgLoginErrWrong'), 'E001'));
$('#main-error-message').html(COMMON.format(I18N.i18nText('msgLoginErrWrong'), 'E001'));
}
$('#main-error-message').show();
});
......@@ -327,9 +327,9 @@ LOGIN.changePasswordProcess = function() {
if (ClientData.serviceOpt_abook_check() == 'Y') {
// ホームへ移動
AVWEB.avwScreenMove("index.html");
COMMON.avwScreenMove("index.html");
} else {
$('#main-error-message').html(AVWEB.format(I18N.i18nText('msgLoginErrWrong'), 'E001'));
$('#main-error-message').html(COMMON.format(I18N.i18nText('msgLoginErrWrong'), 'E001'));
$('#main-error-message').show();
}
......@@ -343,38 +343,38 @@ LOGIN.changePasswordProcess = function() {
$('#dialog-error-message').show();
} else {
// Show systemerror
AVWEB.showSystemError();
COMMON.showSystemError();
}
});
};
// Change Language Japanese
LOGIN.changeLanguageJa = function() {
I18N.changeLanguage(COMMON.Consts.ConstLanguage_Ja);
I18N.changeLanguage(CONSTANT.LANG.JAPAN);
document.title = I18N.i18nText('dspLogin') + ' | ' + I18N.i18nText('sysAppTitle');
// ClientData.userInfo_language(COMMON.Consts.ConstLanguage_Ja);
if (LOGIN.login_errorMessage != "") {
$('#main-error-message').html(AVWEB.format(I18N.i18nText('msgLoginErrWrong'), LOGIN.login_errorMessage).toString());
$('#main-error-message').html(COMMON.format(I18N.i18nText('msgLoginErrWrong'), LOGIN.login_errorMessage).toString());
}
};
// Change Language Korean
LOGIN.changeLanguageKo = function() {
I18N.changeLanguage(COMMON.Consts.ConstLanguage_Ko);
I18N.changeLanguage(CONSTANT.LANG.KOREA);
document.title = I18N.i18nText('dspLogin') + ' | ' + I18N.i18nText('sysAppTitle');
// ClientData.userInfo_language(COMMON.Consts.ConstLanguage_Ko);
if (LOGIN.login_errorMessage != "") {
$('#main-error-message').html(AVWEB.format(I18N.i18nText('msgLoginErrWrong'), LOGIN.login_errorMessage).toString());
$('#main-error-message').html(COMMON.format(I18N.i18nText('msgLoginErrWrong'), LOGIN.login_errorMessage).toString());
}
};
// Change Language English
LOGIN.changeLanguageEn = function() {
I18N.changeLanguage(COMMON.Consts.ConstLanguage_En);
I18N.changeLanguage(CONSTANT.LANG.ENGLISH);
document.title = I18N.i18nText('dspLogin') + ' | ' + I18N.i18nText('sysAppTitle');
// ClientData.userInfo_language(COMMON.Consts.ConstLanguage_En);
if (LOGIN.login_errorMessage != "") {
$('#main-error-message').html(AVWEB.format(I18N.i18nText('msgLoginErrWrong'), LOGIN.login_errorMessage).toString());
$('#main-error-message').html(COMMON.format(I18N.i18nText('msgLoginErrWrong'), LOGIN.login_errorMessage).toString());
}
};
......@@ -401,9 +401,9 @@ LOGIN.skipPassFunction = function() {
if (ClientData.serviceOpt_abook_check() == 'Y') {
// ホームへ移動
AVWEB.avwScreenMove("index.html");
COMMON.avwScreenMove("index.html");
} else {
$('#main-error-message').html(AVWEB.format(I18N.i18nText('msgLoginErrWrong'), 'E001'));
$('#main-error-message').html(COMMON.format(I18N.i18nText('msgLoginErrWrong'), 'E001'));
$('#main-error-message').show();
}
......@@ -431,10 +431,6 @@ LOGIN.saveServiceUserOption = function() {
ClientData.serviceOpt_force_pw_change_periodically(option.value);
} else if (option.serviceOptionId == 21) {
ClientData.serviceOpt_force_pw_change_on_login(option.value);
} else if (option.serviceOptionId == 71) {
ClientData.serviceOpt_usable_readinglog_gps(option.value);
} else if (option.serviceOptionId == 72) {
ClientData.serviceOpt_usable_readinglog_object(option.value);
} else if (option.serviceOptionId == 49) {
ClientData.serviceOpt_usable_push_message(option.value);
} else if (option.serviceOptionId == 161) {
......@@ -513,7 +509,7 @@ LOGIN.showAlertScreen = function(errMes, scrMove) {
$('.toast-item-close').live('click', function() {
COMMON.unlockLayout();
if (scrMove) {
AVWEB.avwScreenMove(scrMove);
COMMON.avwScreenMove(scrMove);
}
});
};
......@@ -523,20 +519,13 @@ LOGIN.ready = function() {
// セッションストレージクリア
SessionStorageUtils.clear();
AVWEB.avwUserSessionObj = null;
COMMON.userSessionObj = null;
// create new session
AVWEB.avwCreateUserSession();
COMMON.createUserSession();
I18N.initi18n();
var sysSettings = AVWEB.avwSysSetting(); // get info in conf.json
var sysSettings = COMMON.sysSetting(); // get info in conf.json
// モード初期化
ClientData.isGetitsMode(false);
ClientData.isStreamingMode(false);
ClientData.isCheckViewMode(false);
ClientData.isCheckMode(false);
ClientData.storeUrl("");
// getitsサーバー設定確認
if (sysSettings.apiUrl == "") {
......@@ -546,10 +535,7 @@ LOGIN.ready = function() {
var storeUrl = COMMON.getUrlParam('storeUrl', '');
if (siteUrl != "" && urlPath != "") {
// getitsモード有効
ClientData.isGetitsMode(true);
ClientData.siteUrl(siteUrl);
// ClientData.siteUrl(siteUrl);
// api接続先設定
ClientData.conf_apiUrl(siteUrl + "{0}/abvapi");
ClientData.conf_apiLoginUrl(siteUrl + "nuabvapi");
......@@ -559,8 +545,6 @@ LOGIN.ready = function() {
ClientData.userInfo_accountPath_session(urlPath);
ClientData.userInfo_loginId("");
ClientData.userInfo_loginId_session("");
// ストア遷移用のURL
ClientData.storeUrl(storeUrl);
}
......
......@@ -5,15 +5,15 @@
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var CHK_OL = {};
var OL = {};
CHK_OL.operationList; //Operation json data
CHK_OL.operationGroupMaster; //category(operationGroupMaster) json data
CHK_OL.isOperationGroupMaster = 0; //0: category(operationGroupMaster) not exist 1: category(operationGroupMaster) exist
CHK_OL.operationSearchCriteria;
OL.operationList; //Operation json data
OL.operationGroupMaster; //category(operationGroupMaster) json data
OL.isOperationGroupMaster = 0; //0: category(operationGroupMaster) not exist 1: category(operationGroupMaster) exist
OL.operationSearchCriteria;
CHK_OL.sortIndex;
CHK_OL.operationGroupMasterId;
OL.sortIndex;
OL.operationGroupMasterId;
/**
* process on page load.
......@@ -21,17 +21,17 @@ CHK_OL.operationGroupMasterId;
* 2.show operationList.
* 3.show category(operationGroupMaster).
*/
CHK_OL.init = function () {
OL.init = function () {
console.log('OperationList start');
//get all data of operation list scene
CHK_OL.getAllDataWeb();
OL.getAllDataWeb();
//show operation list
CHK_OL.createOperationList(CHK_OL.operationList);
OL.createOperationList(OL.operationList);
//show category(operationGroupMaster)
CHK_OL.createCategory();
OL.createCategory();
};
/**
......@@ -45,22 +45,22 @@ CHK_OL.init = function () {
* @param {String} searchEndDate
* @param {Number} operationGroupMasterId
*/
CHK_OL.getAllDataWeb = function (searchKeyword, sortIndex, searchStartDate, searchEndDate, operationGroupMasterId) {
OL.getAllDataWeb = function (searchKeyword, sortIndex, searchStartDate, searchEndDate, operationGroupMasterId) {
let param = {};
param.sid = CHK_Common.getSid();
param.sid = COMMON.getSid();
param.operationGroupMasterId = searchKeyword;
param.sort = sortIndex;
param.startDate = searchStartDate;
param.endDate = searchEndDate;
param.operationGroupMasterId = operationGroupMasterId;
const url = CHK_CONSTANT.URL.BASE_CMS + ClientData.userInfo_accountPath() + CHK_CONSTANT.URL.BASE_CHECKAPI + CHK_CONSTANT.URL.ALL_OPERATION_LIST;
CHK_Common.cmsAjax(url, param, false, CONSTANT.API_TYPE.GET, CONSTANT.DATA_TYPE.JSON,function (json) {
CHK_OL.operationList = json.operationList;
CHK_OL.operationGroupMaster = json.operationGroupMasterList;
CHK_OL.isOperationGroupMaster = json.isOperationGroupMaster;
CHK_OL.operationSearchCriteria = json.operationSearchCriteria;
CHK_OL.setSearchInfoWeb();
const url = CONSTANT.URL.BASE_CMS + ClientData.userInfo_accountPath() + CONSTANT.URL.BASE_CHECKAPI + CONSTANT.URL.ALL_OPERATION_LIST;
COMMON.cmsAjax(url, param, false, CONSTANT.API_TYPE.GET, CONSTANT.DATA_TYPE.JSON, function (json) {
OL.operationList = json.operationList;
OL.operationGroupMaster = json.operationGroupMasterList;
OL.isOperationGroupMaster = json.isOperationGroupMaster;
OL.operationSearchCriteria = json.operationSearchCriteria;
OL.setSearchInfoWeb();
console.log('json.operationList', JSON.stringify(json.operationList));
});
};
......@@ -68,20 +68,20 @@ CHK_OL.getAllDataWeb = function (searchKeyword, sortIndex, searchStartDate, sear
/**
* set search criteria when Initial display.
*/
CHK_OL.setSearchInfoWeb = function () {
CHK_OL.sortIndex = CHK_OL.operationSearchCriteria.sort;
$('#searchTaskName').val(CHK_OL.operationSearchCriteria.operationName);
$('#searchStartDate').val(CHK_OL.operationSearchCriteria.startDate);
$('#searchEndDate').val(CHK_OL.operationSearchCriteria.endDate);
CHK_OL.operationGroupMasterId = CHK_OL.operationSearchCriteria.operationGroupMasterId;
OL.setSearchInfoWeb = function () {
OL.sortIndex = OL.operationSearchCriteria.sort;
$('#searchTaskName').val(OL.operationSearchCriteria.operationName);
$('#searchStartDate').val(OL.operationSearchCriteria.startDate);
$('#searchEndDate').val(OL.operationSearchCriteria.endDate);
OL.operationGroupMasterId = OL.operationSearchCriteria.operationGroupMasterId;
};
/**
* create operation list
*/
CHK_OL.createOperationList = function (operationList) {
OL.createOperationList = function (operationList) {
//Initialization
CHK_OL.initActiveSortIndex();
OL.initActiveSortIndex();
$('#operationTable').empty();
if (!operationList) {
......@@ -95,7 +95,7 @@ CHK_OL.createOperationList = function (operationList) {
const operationNameTd = $(
"<td class='operationId_" +
operationList[i].operationId +
"'><a href=\"javascript:CHK_OL.sendOperation('goOperation', '" +
"'><a href=\"javascript:OL.sendOperation('goOperation', '" +
operationList[i].operationId +
"', '" +
operationList[i].operationType +
......@@ -104,13 +104,13 @@ CHK_OL.createOperationList = function (operationList) {
"');\" class='d-block text-black text-decoration-none mb-1'>" +
operationList[i].operationName +
"</a><div class='fa-sm mobile_operation_date'><i class='far fa-clock fa-blue' style='color:blue;margin-right:10px'></i>" +
CHK_OL.setOperationDate(operationList[i].operationStartDate) +
OL.setOperationDate(operationList[i].operationStartDate) +
' ~ ' +
CHK_OL.setOperationDate(operationList[i].operationEndDate) +
OL.setOperationDate(operationList[i].operationEndDate) +
'</div></td>',
);
const operationStartDateTd = $('<td/>', { class: 'operationStartDate' }).text(CHK_OL.setOperationDate(operationList[i].operationStartDate));
const operationEndDateTd = $('<td/>', { class: 'operationEndDate' }).text(CHK_OL.setOperationDate(operationList[i].operationEndDate));
const operationStartDateTd = $('<td/>', { class: 'operationStartDate' }).text(OL.setOperationDate(operationList[i].operationStartDate));
const operationEndDateTd = $('<td/>', { class: 'operationEndDate' }).text(OL.setOperationDate(operationList[i].operationEndDate));
operationTR.append(operationNameTd);
operationTR.append(operationStartDateTd);
......@@ -125,14 +125,14 @@ CHK_OL.createOperationList = function (operationList) {
*
* @param {Number} sortIndex
*/
CHK_OL.initActiveSortIndex = function (sortIndex) {
if (!sortIndex && !CHK_OL.sortIndex) {
CHK_OL.sortIndex = CHK_CONSTANT.SORT_TYPE.START_DATE_DESC;
OL.initActiveSortIndex = function (sortIndex) {
if (!sortIndex && !OL.sortIndex) {
OL.sortIndex = CONSTANT.SORT_TYPE.START_DATE_DESC;
}
$('.sort-type').each(function () {
const sortType = $(this).data('sort');
if (sortType == CHK_OL.sortIndex) {
if (sortType == OL.sortIndex) {
$('.sort-type').removeClass('active');
$(this).addClass('active');
}
......@@ -145,7 +145,7 @@ CHK_OL.initActiveSortIndex = function (sortIndex) {
* @param {String} date
* @returns operationDate
*/
CHK_OL.setOperationDate = function (date) {
OL.setOperationDate = function (date) {
const operationDate = date.replace(/-/g, '/').substring(0, 10);
return operationDate;
};
......@@ -153,35 +153,35 @@ CHK_OL.setOperationDate = function (date) {
/**
* create category(operationGroupMaster).
*/
CHK_OL.createCategory = function () {
if (!CHK_OL.isOperationGroupMaster) {
OL.createCategory = function () {
if (!OL.isOperationGroupMaster) {
return;
}
CHK_OL.initCategory();
CHK_OL.createBreadcrumbList();
CHK_OL.createCategoryList();
CHK_OL.acdMenu();
OL.initCategory();
OL.createBreadcrumbList();
OL.createCategoryList();
OL.acdMenu();
};
/**
* Initial processing of category(operationGroupMaster).
*/
CHK_OL.initCategory = function () {
if (!CHK_OL.isOperationGroupMaster) {
OL.initCategory = function () {
if (!OL.isOperationGroupMaster) {
return;
}
$('#operationGroupMasterButton').removeClass('d-none');
$(window).resize(function () {
CHK_OL.setCategoryHeight();
OL.setCategoryHeight();
});
};
/**
* change height category(operationGroupMaster)
*/
CHK_OL.setCategoryHeight = function () {
OL.setCategoryHeight = function () {
const CATEGORY_HEIGHT = $('footer').offset().top - $('#category-menu').offset().top;
console.log(CATEGORY_HEIGHT);
$('#category-menu').css('overflow', 'scroll');
......@@ -192,21 +192,21 @@ CHK_OL.setCategoryHeight = function () {
/**
* create Breadcrumb List
*/
CHK_OL.createBreadcrumbList = function () {
if (!CHK_OL.isOperationGroupMaster) {
OL.createBreadcrumbList = function () {
if (!OL.isOperationGroupMaster) {
return;
}
$('#groupMasterPath').empty();
if (typeof CHK_OL.operationGroupMasterId == 'undefined' || CHK_OL.operationGroupMasterId == 0) {
$('#groupMasterPath').append('<li class="breadcrumb-item"><a href="#" class="text-decoration-none text-dark">' + CHK_Common.getMsg('all') + '</a></li>');
if (typeof OL.operationGroupMasterId == 'undefined' || OL.operationGroupMasterId == 0) {
$('#groupMasterPath').append('<li class="breadcrumb-item"><a href="#" class="text-decoration-none text-dark">' + COMMON.getMsg('all') + '</a></li>');
} else {
const groupMaster = CHK_OL.operationGroupMaster.filter(it => it.operationGroupMasterId == CHK_OL.operationGroupMasterId)[0];
const groupMaster = OL.operationGroupMaster.filter(it => it.operationGroupMasterId == OL.operationGroupMasterId)[0];
const groupMasterPathIdlist = groupMaster.treePath.split('/');
groupMasterPathIdlist.forEach(function (parentId) {
const pathOperationGroupMaster = CHK_OL.operationGroupMaster.filter(it => it.operationGroupMasterId == parentId)[0];
const pathOperationGroupMaster = OL.operationGroupMaster.filter(it => it.operationGroupMasterId == parentId)[0];
$('#groupMasterPath').append(
'<li class="breadcrumb-item"><a onclick="CHK_OL.changeOperationGroupMaster(' +
'<li class="breadcrumb-item"><a onclick="OL.changeOperationGroupMaster(' +
pathOperationGroupMaster.operationGroupMasterId +
');" class="text-decoration-none text-dark">' +
pathOperationGroupMaster.operationGroupMasterName +
......@@ -219,67 +219,65 @@ CHK_OL.createBreadcrumbList = function () {
/**
* create category(operationGroupMaster) structure
*/
CHK_OL.createCategoryList = function () {
if (!CHK_OL.isOperationGroupMaster) {
OL.createCategoryList = function () {
if (!OL.isOperationGroupMaster) {
return;
}
//Create a side menu category structure
$('.group-category-list').remove();
CHK_OL.operationGroupMaster.sort(function (a, b) {
OL.operationGroupMaster.sort(function (a, b) {
if (a.operationGroupMasterLevel < b.operationGroupMasterLevel) return -1;
if (a.operationGroupMasterLevel > b.operationGroupMasterLevel) return 1;
return 1;
});
//common
const noCategory = $(
"<dl id='groupMasterId_0' class='group-category-list'><dt><a onclick='CHK_OL.changeOperationGroupMaster(0);'>" + CHK_Common.getMsg(CHK_CONSTANT.MSG_MAP.all) + '</a></dt></dl>',
);
const noCategory = $("<dl id='groupMasterId_0' class='group-category-list'><dt><a onclick='OL.changeOperationGroupMaster(0);'>" + COMMON.getMsg(CONSTANT.MSG_MAP.all) + '</a></dt></dl>');
$('#category-menu').append(noCategory);
//create category(operationGroupMaster) structure
for (let i = 0; i < CHK_OL.operationGroupMaster.length; i++) {
if (CHK_OL.operationGroupMaster[i].operationGroupMasterLevel == 0) {
for (let i = 0; i < OL.operationGroupMaster.length; i++) {
if (OL.operationGroupMaster[i].operationGroupMasterLevel == 0) {
const categoryParent = $(
'<dl id=groupMasterId_' +
CHK_OL.operationGroupMaster[i].operationGroupMasterId +
" class='group-category-list' style='overflow-x:auto;'><dt class='menu-ttl'><a onclick='CHK_OL.changeOperationGroupMaster(" +
CHK_OL.operationGroupMaster[i].operationGroupMasterId +
OL.operationGroupMaster[i].operationGroupMasterId +
" class='group-category-list' style='overflow-x:auto;'><dt class='menu-ttl'><a onclick='OL.changeOperationGroupMaster(" +
OL.operationGroupMaster[i].operationGroupMasterId +
");'>" +
CHK_OL.operationGroupMaster[i].operationGroupMasterName +
OL.operationGroupMaster[i].operationGroupMasterName +
'</a></dt></dl>',
);
$('#category-menu').append(categoryParent);
} else {
if ($('#groupMasterId_' + CHK_OL.operationGroupMaster[i].parentOperationGroupMasterId + '>ul').length > 0) {
if ($('#groupMasterId_' + OL.operationGroupMaster[i].parentOperationGroupMasterId + '>ul').length > 0) {
const categoryChild = $(
"<li id='groupMasterId_" +
CHK_OL.operationGroupMaster[i].operationGroupMasterId +
OL.operationGroupMaster[i].operationGroupMasterId +
"' class=''><p class='category-li group-level-" +
CHK_OL.operationGroupMaster[i].operationGroupMasterLevel +
"'><a class='category-a' onclick='CHK_OL.changeOperationGroupMaster(" +
CHK_OL.operationGroupMaster[i].operationGroupMasterId +
OL.operationGroupMaster[i].operationGroupMasterLevel +
"'><a class='category-a' onclick='OL.changeOperationGroupMaster(" +
OL.operationGroupMaster[i].operationGroupMasterId +
");'>" +
CHK_OL.operationGroupMaster[i].operationGroupMasterName +
OL.operationGroupMaster[i].operationGroupMasterName +
'</a></p></li>',
);
$('#groupMasterId_' + CHK_OL.operationGroupMaster[i].parentOperationGroupMasterId + ' >ul').append(categoryChild);
$('#groupMasterId_' + OL.operationGroupMaster[i].parentOperationGroupMasterId + ' >ul').append(categoryChild);
} else {
const groupParents = '#groupMasterId_' + CHK_OL.operationGroupMaster[i].parentOperationGroupMasterId;
const groupParents = '#groupMasterId_' + OL.operationGroupMaster[i].parentOperationGroupMasterId;
$(groupParents + ' > p').addClass('sub-menu-ttl');
const categoryChild = $(
"<ul style='display:none;' class=''><li class='' id='groupMasterId_" +
CHK_OL.operationGroupMaster[i].operationGroupMasterId +
OL.operationGroupMaster[i].operationGroupMasterId +
"' class=''><p class='category-li group-level-" +
CHK_OL.operationGroupMaster[i].operationGroupMasterLevel +
"'><a class='category-a' onclick='CHK_OL.changeOperationGroupMaster(" +
CHK_OL.operationGroupMaster[i].operationGroupMasterId +
OL.operationGroupMaster[i].operationGroupMasterLevel +
"'><a class='category-a' onclick='OL.changeOperationGroupMaster(" +
OL.operationGroupMaster[i].operationGroupMasterId +
");'>" +
CHK_OL.operationGroupMaster[i].operationGroupMasterName +
OL.operationGroupMaster[i].operationGroupMasterName +
'</a></p></li></ul>',
);
$('#groupMasterId_' + CHK_OL.operationGroupMaster[i].parentOperationGroupMasterId).append(categoryChild);
$('#groupMasterId_' + OL.operationGroupMaster[i].parentOperationGroupMasterId).append(categoryChild);
}
}
}
......@@ -288,7 +286,7 @@ CHK_OL.createCategoryList = function () {
/**
* Open/close category(operationGroupMaster) drawer menu
*/
CHK_OL.acdMenu = function () {
OL.acdMenu = function () {
//Hide accordion contents by default
$('.drawer-menu dd').css('display', 'none');
$('.drawer-menu2 ul').css('display', 'none');
......@@ -312,12 +310,12 @@ CHK_OL.acdMenu = function () {
*
* @param {Object} sortType
*/
CHK_OL.changeSortType = function (sortType) {
OL.changeSortType = function (sortType) {
$('.sort-type').removeClass('active');
$(sortType).addClass('active');
CHK_OL.sortIndex = $(sortType).attr('data-sort');
CHK_OL.sortOperationList(sortType);
CHK_OL.createOperationList(CHK_OL.operationList);
OL.sortIndex = $(sortType).attr('data-sort');
OL.sortOperationList(sortType);
OL.createOperationList(OL.operationList);
};
/**
......@@ -325,39 +323,39 @@ CHK_OL.changeSortType = function (sortType) {
*
* @param {Number} sortType
*/
CHK_OL.sortOperationList = function (sortType) {
OL.sortOperationList = function (sortType) {
switch (sortType) {
case CHK_CONSTANT.SORT_TYPE.NAME:
CHK_OL.operationList.sort(function (a, b) {
case CONSTANT.SORT_TYPE.NAME:
OL.operationList.sort(function (a, b) {
if (a.operationName > b.operationName) return 1;
if (a.operationName < b.operationName) return -1;
return 0;
});
break;
case CHK_CONSTANT.SORT_TYPE.START_DATE_DESC:
CHK_OL.operationList.sort(function (a, b) {
case CONSTANT.SORT_TYPE.START_DATE_DESC:
OL.operationList.sort(function (a, b) {
if (setOperationDate(a.operationStartDate) < setOperationDate(b.operationStartDate)) return 1;
if (setOperationDate(a.operationStartDate) > setOperationDate(b.operationStartDate)) return -1;
return 0;
});
break;
case CHK_CONSTANT.SORT_TYPE.START_DATE_ASC:
CHK_OL.operationList.sort(function (a, b) {
case CONSTANT.SORT_TYPE.START_DATE_ASC:
OL.operationList.sort(function (a, b) {
if (setOperationDate(a.operationStartDate) > setOperationDate(b.operationStartDate)) return 1;
if (setOperationDate(a.operationStartDate) < setOperationDate(b.operationStartDate)) return -1;
return 0;
});
break;
case CHK_CONSTANT.SORT_TYPE.TYPE:
CHK_OL.operationList.sort(function (a, b) {
case CONSTANT.SORT_TYPE.TYPE:
OL.operationList.sort(function (a, b) {
if (a.operationType < b.operationType) return 1;
if (a.operationType > b.operationType) return -1;
return 0;
});
break;
case CHK_CONSTANT.SORT_TYPE.LAST_EDIT_DATE:
case CONSTANT.SORT_TYPE.LAST_EDIT_DATE:
const defaultDate = '1900-01-01 09:00:00';
CHK_OL.operationList.sort(function (a, b) {
OL.operationList.sort(function (a, b) {
if (!a.operationOpenDate) {
a.operationOpenDate = defaultDate;
}
......@@ -375,40 +373,40 @@ CHK_OL.sortOperationList = function (sortType) {
/**
* search operarionList
*/
CHK_OL.search = function () {
CHK_Common.showLoading();
OL.search = function () {
COMMON.showLoading();
const searchKeyword = $('#searchTaskName').val();
const searchStartDate = $('#searchStartDate').val();
const searchEndDate = $('#searchEndDate').val();
if (searchStartDate && searchEndDate && searchStartDate > searchEndDate) {
CHK_Common.closeLoading();
CHK_Common.displayAlert('dateError');
COMMON.closeLoading();
COMMON.displayAlert('dateError');
return;
}
CHK_OL.getAllDataWeb(searchKeyword, CHK_OL.sortIndex, searchStartDate, searchEndDate, CHK_OL.operationGroupMasterId);
CHK_OL.createOperationList(CHK_OL.operationList);
CHK_Common.closeLoading();
OL.getAllDataWeb(searchKeyword, OL.sortIndex, searchStartDate, searchEndDate, OL.operationGroupMasterId);
OL.createOperationList(OL.operationList);
COMMON.closeLoading();
};
/**
* change the operationList by select the category(OperationGroupMaster)
* @param {Number} operationGroupMasterId
*/
CHK_OL.changeOperationGroupMaster = function (operationGroupMasterId) {
OL.changeOperationGroupMaster = function (operationGroupMasterId) {
if ($('#category-menu').hasClass('open')) {
$('#category-toggle-button').click();
$('body').css('overflow', 'visible');
}
CHK_OL.operationGroupMasterId = operationGroupMasterId;
CHK_OL.search();
OL.operationGroupMasterId = operationGroupMasterId;
OL.search();
};
/**
* open the category(OperationGroupMaster)
*/
CHK_OL.openCategory = function () {
OL.openCategory = function () {
window.scrollTo(0, 0);
if ($('#category-menu').hasClass('open')) {
$('body').css('overflow', 'visible');
......@@ -420,11 +418,11 @@ CHK_OL.openCategory = function () {
/**
* reset search
*/
CHK_OL.resetSearch = function () {
OL.resetSearch = function () {
$('#searchTaskName').val('');
$('#searchStartDate').val('');
$('#searchEndDate').val('');
CHK_OL.changeSortType($('#defaultSort'));
OL.changeSortType($('#defaultSort'));
};
/**
......@@ -432,24 +430,24 @@ CHK_OL.resetSearch = function () {
*
* @param {String} operationId
*/
CHK_OL.sendOperation = function (operationId, operationType, reportType) {
OL.sendOperation = function (operationId, operationType, reportType) {
//save operation logs. needed for sorting
let saveParams = {};
saveParams.sid = CHK_Common.getSid();
saveParams.cmd = CHK_CONSTANT.ACT_CMD.saveOperationLog;
saveParams.sid = COMMON.getSid();
saveParams.cmd = CONSTANT.ACT_CMD.saveOperationLog;
saveParams.deviceType = 4;
saveParams.operationType = operationType;
saveParams.reportType = reportType;
const date = new Date();
saveParams.viewingStartDate = date.toLocaleString();
CHK_Common.sendABookCheckApi(saveParam, false);
COMMON.sendABookCheckApi(saveParam, false);
//Transition to the report form or operation list screen
let postParams = {};
postParams.sid = CHK_Common.getSid();
postParams.cmd = CHK_CONSTANT.ACT_CMD.goOperation;
postParams.sid = COMMON.getSid();
postParams.cmd = CONSTANT.ACT_CMD.goOperation;
postParams.operationId = operationId;
const url = CHK_Common.getUrlWeb(postParams.cmd);
const url = COMMON.getUrlWeb(postParams.cmd);
postCommunication(url, postParams);
};
......@@ -5,28 +5,25 @@
* @since cms:1.4.3.2&1.4.3.3 web:1.0
*/
var CHK_TOP = {};
var TOP = {};
$(document).ready(function () {
//setting lang info
CHK_Common.setLangCodeWeb();
COMMON.setLangCodeWeb();
//Check if user is logged in
CHK_Common.checkAuth(false);
COMMON.checkAuth(false);
//setting msg of html
CHK_Common.updateLang();
COMMON.updateLang();
});
/**
* show page
*/
CHK_TOP.init = function() {
CHK_Common.showLoading();
CHK_Footer.initFooter();//app should get data after initFooter
CHK_Common.closeLoading();
TOP.init = function () {
COMMON.showLoading();
FOOTER.initFooter(); //app should get data after initFooter
COMMON.closeLoading();
};
/**
......@@ -34,12 +31,12 @@ CHK_TOP.init = function() {
*
* @param {String} pageId
*/
CHK_TOP.showPage = function(pageId) {
TOP.showPage = function(pageId) {
//get data
if (pageId == CHK_CONSTANT.PAGE_NAME.OPERATION_LIST) {
CHK_OL.init();
} else if (pageId == CHK_CONSTANT.PAGE_NAME.DASHBOARD) {
if (pageId == CONSTANT.PAGE_NAME.OPERATION_LIST) {
OL.init();
} else if (pageId == CONSTANT.PAGE_NAME.DASHBOARD) {
CHK_Dashboard.init();
}
......
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