Commit f4b02a86 by Takumi Imai

#49772 ログインチェック追加

parent e3409ed3
...@@ -121,6 +121,9 @@ DASHBOARD.initHtmlItem = function (item) { ...@@ -121,6 +121,9 @@ DASHBOARD.initHtmlItem = function (item) {
/** Initialization dashboard screen */ /** Initialization dashboard screen */
DASHBOARD.init = function () { DASHBOARD.init = function () {
//Check if user is logged in
COMMON.checkAuth(false);
sessionStorage.activeHomePage = CONSTANT.PAGE_TAB.DASHBOARD; sessionStorage.activeHomePage = CONSTANT.PAGE_TAB.DASHBOARD;
DASHBOARD.loadCommon(); DASHBOARD.loadCommon();
DashboardSetting.getSettingData(function (settings) { DashboardSetting.getSettingData(function (settings) {
......
...@@ -2,33 +2,36 @@ ...@@ -2,33 +2,36 @@
var PP = {}; var PP = {};
PP.init = function() { PP.init = function () {
console.log("PP.init"); //Check if user is logged in
COMMON.checkAuth(false);
console.log('PP.init');
PP.loadCommon(); PP.loadCommon();
PP.initPdfList(); PP.initPdfList();
}; };
PP.loadCommon = function() { PP.loadCommon = function () {
$("#includedHeader").load("../html/common/header.html" , function() { $('#includedHeader').load('../html/common/header.html', function () {
I18N.initi18n(); I18N.initi18n();
HEADER.init(); HEADER.init();
}); });
$("#includedConfirmModal").load("../html/common/confirmModal.html", function() { $('#includedConfirmModal').load('../html/common/confirmModal.html', function () {
I18N.initi18n(); I18N.initi18n();
}); });
} };
PP.initPdfList = function() { PP.initPdfList = function () {
if (sessionStorage.OL_operationId) { if (sessionStorage.OL_operationId) {
let params = {}; let params = {};
params.sid = COMMON.getSid(); params.sid = COMMON.getSid();
params.operationId = sessionStorage.OL_operationId; params.operationId = sessionStorage.OL_operationId;
params.returnUrl = CONSTANT.URL.WEB.BASE + CONSTANT.URL.WEB.OPERATION_LIST; params.returnUrl = CONSTANT.URL.WEB.BASE + CONSTANT.URL.WEB.OPERATION_LIST;
let url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.HTML.BASE + CONSTANT.URL.CMS.HTML.QUICK_REPORT_PRINT; let url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.HTML.BASE + CONSTANT.URL.CMS.HTML.QUICK_REPORT_PRINT;
$("#pdfPrint").load(url, params); $('#pdfPrint').load(url, params);
} else { } else {
COMMON.displayAlert("error"); COMMON.displayAlert('error');
COMMON.avwScreenMove("reportList.html"); COMMON.avwScreenMove('reportList.html');
} }
} };
\ No newline at end of file
...@@ -7,18 +7,20 @@ PushMessageDetail.baseApiUrl = COMMON.format(ClientData.conf_checkApiUrl(), Clie ...@@ -7,18 +7,20 @@ PushMessageDetail.baseApiUrl = COMMON.format(ClientData.conf_checkApiUrl(), Clie
*/ */
PushMessageDetail.dummyMessageDetailJson = { PushMessageDetail.dummyMessageDetailJson = {
pushMessageId: 1, pushMessageId: 1,
pushMessage: "内容が入ります。内容が入ります。内容が入ります。内容が入ります。", pushMessage: '内容が入ります。内容が入ります。内容が入ります。内容が入ります。',
pushSendDate: "2022/07/06 14:14", pushSendDate: '2022/07/06 14:14',
operationName: "絞り検索", operationName: '絞り検索',
pushSendLoginId: "agentec" pushSendLoginId: 'agentec',
} };
/** /**
* init when html loaded * init when html loaded
*/ */
PushMessageDetail.init = function() { PushMessageDetail.init = function () {
//Check if user is logged in
COMMON.checkAuth(false);
//load common html //load common html
TEMPLATE.loadHearder("#includedHeader"); TEMPLATE.loadHearder('#includedHeader');
const navs = [ const navs = [
{ {
titleLang: 'dashboard', titleLang: 'dashboard',
...@@ -32,44 +34,50 @@ PushMessageDetail.init = function() { ...@@ -32,44 +34,50 @@ PushMessageDetail.init = function() {
titleLang: 'messageDetail', titleLang: 'messageDetail',
}, },
]; ];
TEMPLATE.loadMainNavsTitle("#includedMainTitle", "messageDetail", navs, null); TEMPLATE.loadMainNavsTitle('#includedMainTitle', 'messageDetail', navs, null);
//request message detail data //request message detail data
let urlParam = COMMON.getUrlParameter(); let urlParam = COMMON.getUrlParameter();
if (typeof urlParam !== 'object' || typeof urlParam.pushMessageId === 'undefined') { if (typeof urlParam !== 'object' || typeof urlParam.pushMessageId === 'undefined') {
return; return;
} }
PushMessageDetail.getMessageDetail(urlParam.pushMessageId, function(message) { PushMessageDetail.getMessageDetail(urlParam.pushMessageId, function (message) {
PushMessageDetail.showMessage(message); PushMessageDetail.showMessage(message);
}); });
} };
/** /**
* request message data * request message data
* @param {string} pushMessageId * @param {string} pushMessageId
* @param {object} callback * @param {object} callback
*/ */
PushMessageDetail.getMessageDetail = function(pushMessageId, callback) { PushMessageDetail.getMessageDetail = function (pushMessageId, callback) {
let param = { let param = {
sid: COMMON.getSid(), sid: COMMON.getSid(),
pushMessageId: pushMessageId pushMessageId: pushMessageId,
}; };
const url = PushMessageDetail.baseApiUrl; const url = PushMessageDetail.baseApiUrl;
COMMON.cmsAjax(url, param, true, function (json) { COMMON.cmsAjax(
if (callback && json && json.pushMessage) { url,
callback(json.pushMessage); param,
} true,
}, function() { function (json) {
console.log('PushMessageDetail.getMessageDetail error'); if (callback && json && json.pushMessage) {
}); callback(json.pushMessage);
} }
},
function () {
console.log('PushMessageDetail.getMessageDetail error');
},
);
};
/** /**
* Show message data * Show message data
* @param {object} message * @param {object} message
*/ */
PushMessageDetail.showMessage = function(message) { PushMessageDetail.showMessage = function (message) {
$('#content').text(message.pushMessage); $('#content').text(message.pushMessage);
$('#sendDate').text(message.pushSendDate); $('#sendDate').text(message.pushSendDate);
$('#operationName').text(message.operationName); $('#operationName').text(message.operationName);
$('#sender').text(message.pushSendLoginId); $('#sender').text(message.pushSendLoginId);
} };
...@@ -8,8 +8,10 @@ PushMessageList.baseApiUrl = COMMON.format(ClientData.conf_checkApiUrl(), Client ...@@ -8,8 +8,10 @@ PushMessageList.baseApiUrl = COMMON.format(ClientData.conf_checkApiUrl(), Client
/** /**
* Init when html onload * Init when html onload
*/ */
PushMessageList.init = function() { PushMessageList.init = function () {
TEMPLATE.loadHearder("#includedHeader"); //Check if user is logged in
COMMON.checkAuth(false);
TEMPLATE.loadHearder('#includedHeader');
const navs = [ const navs = [
{ {
titleLang: 'dashboard', titleLang: 'dashboard',
...@@ -19,44 +21,50 @@ PushMessageList.init = function() { ...@@ -19,44 +21,50 @@ PushMessageList.init = function() {
titleLang: 'messageListTitle', titleLang: 'messageListTitle',
}, },
]; ];
TEMPLATE.loadMainNavsTitle("#includedMainTitle", "messageListTitle", navs, null); TEMPLATE.loadMainNavsTitle('#includedMainTitle', 'messageListTitle', navs, null);
PushMessageList.getMessageList(function(messageList) { PushMessageList.getMessageList(function (messageList) {
PushMessageList.generateMessageListHtml(messageList.pushMessageList); PushMessageList.generateMessageListHtml(messageList.pushMessageList);
}); });
} };
/** /**
* get Message List from CMS * get Message List from CMS
* @param {function} callback * @param {function} callback
*/ */
PushMessageList.getMessageList = function (callback) { PushMessageList.getMessageList = function (callback) {
let param = { let param = {
sid: COMMON.getSid(), sid: COMMON.getSid(),
}; };
const url = PushMessageList.baseApiUrl; const url = PushMessageList.baseApiUrl;
COMMON.cmsAjax(url, param, true, function (json) { COMMON.cmsAjax(
if (callback) { url,
callback(json); param,
} true,
}, function() { function (json) {
console.log('PushMessageList.getMessageList error'); if (callback) {
}); callback(json);
}
},
function () {
console.log('PushMessageList.getMessageList error');
},
);
}; };
/** /**
* handle click message event * handle click message event
* @param {string} pushMessageId * @param {string} pushMessageId
*/ */
PushMessageList.clickMessage = function(pushMessageId) { PushMessageList.clickMessage = function (pushMessageId) {
COMMON.goUrlWithCurrentParams('pushMessageDetail.html', {pushMessageId: pushMessageId}); COMMON.goUrlWithCurrentParams('pushMessageDetail.html', { pushMessageId: pushMessageId });
} };
/** /**
* generate message list html * generate message list html
* @param {array} messageList * @param {array} messageList
* @returns * @returns
*/ */
PushMessageList.generateMessageListHtml = function(messageList) { PushMessageList.generateMessageListHtml = function (messageList) {
if (typeof messageList === 'undefined' || messageList.length < 1) { if (typeof messageList === 'undefined' || messageList.length < 1) {
//show not found //show not found
$('#messageList .not-found').removeClass('d-none'); $('#messageList .not-found').removeClass('d-none');
...@@ -69,42 +77,45 @@ PushMessageList.generateMessageListHtml = function(messageList) { ...@@ -69,42 +77,45 @@ PushMessageList.generateMessageListHtml = function(messageList) {
var mTitle = message.pushMessage; var mTitle = message.pushMessage;
var mDate = message.pushSendDate; var mDate = message.pushSendDate;
var mSubtitle = message.operationName; var mSubtitle = message.operationName;
var messageLi = $('<li class="card mb-2" id="pushMessageId_' + messageId + '"/>'); var messageLi = $('<li class="card mb-2" id="pushMessageId_' + messageId + '"/>');
if (message.readingFlg) { if (message.readingFlg) {
messageLi.addClass('read'); messageLi.addClass('read');
} else { } else {
messageLi.addClass('unread'); messageLi.addClass('unread');
} }
var messageA = $('<a class="d-block px-3 py-2 text-decoration-none text-dark"/>'); var messageA = $('<a class="d-block px-3 py-2 text-decoration-none text-dark"/>');
messageA.attr('href', "javascript:PushMessageList.clickMessage('" + messageId +"');"); messageA.attr('href', "javascript:PushMessageList.clickMessage('" + messageId + "');");
var titleDiv = $('<div class="fs-12 text-truncate">' + mTitle + '</div>'); var titleDiv = $('<div class="fs-12 text-truncate">' + mTitle + '</div>');
var subTitleMainDiv = $('<div class="d-flex justify-content-between align-items-center"></div>'); var subTitleMainDiv = $('<div class="d-flex justify-content-between align-items-center"></div>');
var subTitleDiv = $('<div class="fs-10 text-truncate">' + mSubtitle + '</div>'); var subTitleDiv = $('<div class="fs-10 text-truncate">' + mSubtitle + '</div>');
var dateDiv = $('<div class="fs-8 text-secondary text-nowrap">' + mDate + '</div>'); var dateDiv = $('<div class="fs-8 text-secondary text-nowrap">' + mDate + '</div>');
subTitleMainDiv.append(subTitleDiv); subTitleMainDiv.append(subTitleDiv);
subTitleMainDiv.append(dateDiv); subTitleMainDiv.append(dateDiv);
messageA.append(titleDiv); messageA.append(titleDiv);
messageA.append(subTitleMainDiv); messageA.append(subTitleMainDiv);
messageLi.append(messageA); messageLi.append(messageA);
$('#messageList').append(messageLi); $('#messageList').append(messageLi);
} }
}; };
/** /**
* dummy message list JSON for test * dummy message list JSON for test
*/ */
PushMessageList.dummyMessageListJson = { PushMessageList.dummyMessageListJson = {
pushMessageList: [{ pushMessageList: [
pushMessageId: 1, {
pushMessage: 'メッセージ内容が入ります。', pushMessageId: 1,
pushSendDate: '2022/07/06 14:14', pushMessage: 'メッセージ内容が入ります。',
operationName: '作業名が入ります。', pushSendDate: '2022/07/06 14:14',
readingFlg: 0, operationName: '作業名が入ります。',
}, { readingFlg: 0,
pushMessageId: 2, },
pushMessage: 'メッセージ内容が入ります。メッセージ内容が入ります。メッセージ内容が入ります。メッセージ内容が入ります。', {
pushSendDate: 'xxxxxxxxxxxxxxxxxxxxxxxxxx', pushMessageId: 2,
operationName: '作業名が入ります。作業名が入ります。作業名が入ります。作業名が入ります。作業名が入ります。作業名が入ります。', pushMessage: 'メッセージ内容が入ります。メッセージ内容が入ります。メッセージ内容が入ります。メッセージ内容が入ります。',
readingFlg: 1, pushSendDate: 'xxxxxxxxxxxxxxxxxxxxxxxxxx',
}] operationName: '作業名が入ります。作業名が入ります。作業名が入ります。作業名が入ります。作業名が入ります。作業名が入ります。',
readingFlg: 1,
},
],
}; };
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
var RF = {}; var RF = {};
RF.init = function () { RF.init = function () {
//Check if user is logged in
COMMON.checkAuth(false);
RF.loadCommon(); RF.loadCommon();
RF.initFormView(); RF.initFormView();
......
...@@ -2,39 +2,39 @@ ...@@ -2,39 +2,39 @@
var RL = {}; var RL = {};
RL.init = function() { RL.init = function () {
console.log("ReportList init start"); //Check if user is logged in
// COMMON.checkAuth(true); COMMON.checkAuth(false);
console.log('ReportList init start');
RL.loadCommon(); RL.loadCommon();
RL.initTaskReportList(); RL.initTaskReportList();
}; };
RL.loadCommon = function() { RL.loadCommon = function () {
$("#includedHeader").load("../html/common/header.html" , function() { $('#includedHeader').load('../html/common/header.html', function () {
I18N.initi18n(); I18N.initi18n();
HEADER.init(); HEADER.init();
}); });
$("#includedConfirmModal").load("../html/common/confirmModal.html", function() { $('#includedConfirmModal').load('../html/common/confirmModal.html', function () {
I18N.initi18n(); I18N.initi18n();
}); });
} };
RL.initTaskReportList = function() { RL.initTaskReportList = function () {
if (sessionStorage.OL_operationId) { if (sessionStorage.OL_operationId) {
let params = {}; let params = {};
params.sid = COMMON.getSid(); params.sid = COMMON.getSid();
params.operationId = sessionStorage.OL_operationId; params.operationId = sessionStorage.OL_operationId;
params.returnUrl = CONSTANT.URL.WEB.BASE + CONSTANT.URL.WEB.OPERATION_LIST; params.returnUrl = CONSTANT.URL.WEB.BASE + CONSTANT.URL.WEB.OPERATION_LIST;
let url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.HTML.BASE + CONSTANT.URL.CMS.HTML.TASK_REPORT_LIST; let url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.HTML.BASE + CONSTANT.URL.CMS.HTML.TASK_REPORT_LIST;
$("#reportList").load(url, params); $('#reportList').load(url, params);
} else { } else {
COMMON.displayAlert("error"); COMMON.displayAlert('error');
COMMON.avwScreenMove("index.html"); COMMON.avwScreenMove('index.html');
} }
} };
RL.goPdfPrint = function() {
COMMON.avwScreenMove("pdfPrint.html");
}
RL.goPdfPrint = function () {
COMMON.avwScreenMove('pdfPrint.html');
};
...@@ -12,49 +12,49 @@ SendMessage.contentMaxLength = 207; ...@@ -12,49 +12,49 @@ SendMessage.contentMaxLength = 207;
* Get input content * Get input content
* @returns string * @returns string
*/ */
SendMessage.getCurrentMessageContent = function() { SendMessage.getCurrentMessageContent = function () {
return $('#messageContent').val(); return $('#messageContent').val();
} };
/** /**
* Get operation id selected * Get operation id selected
* @returns string * @returns string
*/ */
SendMessage.getCurrentOperationId = function() { SendMessage.getCurrentOperationId = function () {
return $('#operationSelected').attr('data-operation-id'); return $('#operationSelected').attr('data-operation-id');
} };
/** /**
* Get send type selected * Get send type selected
* @returns string * @returns string
*/ */
SendMessage.getCurrentSendType = function() { SendMessage.getCurrentSendType = function () {
return $('input[name="sendType"]:checked').val(); return $('input[name="sendType"]:checked').val();
} };
/** /**
* Check data required when send message request to cms * Check data required when send message request to cms
* @returns boolean * @returns boolean
*/ */
SendMessage.checkValidation = function() { SendMessage.checkValidation = function () {
const message = SendMessage.getCurrentMessageContent(); const message = SendMessage.getCurrentMessageContent();
if (!ValidationUtil.CheckRequiredForText(message)) { if (!ValidationUtil.CheckRequiredForText(message)) {
alert(I18N.i18nText('msgContentRequired')); alert(I18N.i18nText('msgContentRequired'));
return false; return false;
} }
if (!ValidationUtil.CheckMaxLengthForByte(message, SendMessage.contentMaxLength)) { if (!ValidationUtil.CheckMaxLengthForByte(message, SendMessage.contentMaxLength)) {
alert(COMMON.format(I18N.i18nText('msgContentInvalidLength'), SendMessage.contentMaxLength)); alert(COMMON.format(I18N.i18nText('msgContentInvalidLength'), SendMessage.contentMaxLength));
return false; return false;
} }
const operationId = SendMessage.getCurrentOperationId(); const operationId = SendMessage.getCurrentOperationId();
if (!ValidationUtil.IsNumber(operationId)) { if (!ValidationUtil.IsNumber(operationId)) {
alert(I18N.i18nText('msgOperationRequired')); alert(I18N.i18nText('msgOperationRequired'));
return false; return false;
} }
const sendType = SendMessage.getCurrentSendType(); const sendType = SendMessage.getCurrentSendType();
if (!ValidationUtil.IsNumber(sendType)) { if (!ValidationUtil.IsNumber(sendType)) {
alert(I18N.i18nText('msgSendTypeRequired')); alert(I18N.i18nText('msgSendTypeRequired'));
return false; return false;
} }
return true; return true;
}; };
...@@ -62,7 +62,7 @@ SendMessage.checkValidation = function() { ...@@ -62,7 +62,7 @@ SendMessage.checkValidation = function() {
/** /**
* handle click event of send button * handle click event of send button
*/ */
SendMessage.onClickSend = function() { SendMessage.onClickSend = function () {
if (!SendMessage.checkValidation()) { if (!SendMessage.checkValidation()) {
return; return;
} }
...@@ -74,39 +74,44 @@ SendMessage.onClickSend = function() { ...@@ -74,39 +74,44 @@ SendMessage.onClickSend = function() {
/** /**
* post message data to cms * post message data to cms
* @param {string} message * @param {string} message
* @param {long} operationId * @param {long} operationId
* @param {int} sendType - 0: Group, 1: All * @param {int} sendType - 0: Group, 1: All
*/ */
SendMessage.postMessage = function(message, operationId, sendType) { SendMessage.postMessage = function (message, operationId, sendType) {
let param = { let param = {
sid: COMMON.getSid(), sid: COMMON.getSid(),
message: message, message: message,
operationId: operationId, operationId: operationId,
sendType: sendType sendType: sendType,
}; };
COMMON.cmsAjax(SendMessage.baseApiUrl, param, false, function (json) { COMMON.cmsAjax(
SendMessage.baseApiUrl,
}, function() { param,
console.log('SendMessage.postMessage error'); false,
function (json) {},
}); function () {
console.log('SendMessage.postMessage error');
},
);
}; };
SendMessage.operationSelectedCallback = function(operationId, operationName) { SendMessage.operationSelectedCallback = function (operationId, operationName) {
$('#operationSelected').attr('data-operation-id', operationId); $('#operationSelected').attr('data-operation-id', operationId);
$('#operationSelected').text(operationName); $('#operationSelected').text(operationName);
} };
SendMessage.templateSelectedCallback = function(template) { SendMessage.templateSelectedCallback = function (template) {
$('#messageContent').val(template); $('#messageContent').val(template);
} };
/** /**
* init data, action when screen onload * init data, action when screen onload
*/ */
SendMessage.init = function () { SendMessage.init = function () {
TEMPLATE.loadHearder("#includedHeader"); //Check if user is logged in
COMMON.checkAuth(false);
TEMPLATE.loadHearder('#includedHeader');
const navs = [ const navs = [
{ {
titleLang: 'dashboard', titleLang: 'dashboard',
...@@ -116,7 +121,7 @@ SendMessage.init = function () { ...@@ -116,7 +121,7 @@ SendMessage.init = function () {
titleLang: 'sendMessageTitle', titleLang: 'sendMessageTitle',
}, },
]; ];
TEMPLATE.loadMainNavsTitle("#includedMainTitle", "sendMessageTitle", navs, null); TEMPLATE.loadMainNavsTitle('#includedMainTitle', 'sendMessageTitle', navs, null);
TEMPLATE.loadOperationSelect('#includeOperationSelect', SendMessage.operationSelectedCallback); TEMPLATE.loadOperationSelect('#includeOperationSelect', SendMessage.operationSelectedCallback);
TEMPLATE.loadNotificationSelect('#includeTemplateModal', SendMessage.templateSelectedCallback); TEMPLATE.loadNotificationSelect('#includeTemplateModal', SendMessage.templateSelectedCallback);
$('#messageContent').attr('maxlength', SendMessage.contentMaxLength); $('#messageContent').attr('maxlength', SendMessage.contentMaxLength);
...@@ -124,4 +129,4 @@ SendMessage.init = function () { ...@@ -124,4 +129,4 @@ SendMessage.init = function () {
I18N.initi18n(); I18N.initi18n();
$("label[for='sendTypeGroup']").append(I18N.i18nText('labelSendTypeGroup')); $("label[for='sendTypeGroup']").append(I18N.i18nText('labelSendTypeGroup'));
$("label[for='sendTypeAll']").append(I18N.i18nText('labelSendTypeAll')); $("label[for='sendTypeAll']").append(I18N.i18nText('labelSendTypeAll'));
}; };
\ No newline at end of file
...@@ -4,27 +4,27 @@ var SETTINGS = {}; ...@@ -4,27 +4,27 @@ var SETTINGS = {};
// Init function of page // Init function of page
$(document).ready(function () { $(document).ready(function () {
//Check if user is logged in
COMMON.checkAuth(false); COMMON.checkAuth(false);
SETTINGS.initScreen(); SETTINGS.initScreen();
$("#dspPwdUpd1").click(SETTINGS.dspPwdUpd1_Click); $('#dspPwdUpd1').click(SETTINGS.dspPwdUpd1_Click);
}); });
// Process changing password // Process changing password
SETTINGS.dspPwdUpd1_Click = function(e) { SETTINGS.dspPwdUpd1_Click = function (e) {
e.preventDefault(); e.preventDefault();
var isOK = true; var isOK = true;
var msgError = $('#main-error-message'); var msgError = $('#main-error-message');
// Check validation // Check validation
if (!ValidationUtil.CheckRequiredForText(SETTINGS.getCurrentPassword())) { if (!ValidationUtil.CheckRequiredForText(SETTINGS.getCurrentPassword())) {
isOK = false; isOK = false;
msgError.html(COMMON.format(I18N.i18nText('msgEssential'), I18N.i18nText('txtPwdCurr')).toString()); msgError.html(COMMON.format(I18N.i18nText('msgEssential'), I18N.i18nText('txtPwdCurr')).toString());
msgError.show(); msgError.show();
} } else {
else {
if (!ValidationUtil.CheckRequiredForText(SETTINGS.getNewPassword())) { if (!ValidationUtil.CheckRequiredForText(SETTINGS.getNewPassword())) {
isOK = false; isOK = false;
msgError.html(COMMON.format(I18N.i18nText('msgEssential'), I18N.i18nText('txtPwdNew')).toString()); msgError.html(COMMON.format(I18N.i18nText('msgEssential'), I18N.i18nText('txtPwdNew')).toString());
msgError.show(); msgError.show();
} else if (!ValidationUtil.CheckRequiredForText(SETTINGS.getNewPasswordRe())) { } else if (!ValidationUtil.CheckRequiredForText(SETTINGS.getNewPasswordRe())) {
isOK = false; isOK = false;
msgError.html(COMMON.format(I18N.i18nText('msgEssential'), I18N.i18nText('txtPwdNewRe')).toString()); msgError.html(COMMON.format(I18N.i18nText('msgEssential'), I18N.i18nText('txtPwdNewRe')).toString());
...@@ -38,7 +38,6 @@ SETTINGS.dspPwdUpd1_Click = function(e) { ...@@ -38,7 +38,6 @@ SETTINGS.dspPwdUpd1_Click = function(e) {
} }
} }
if (isOK) { if (isOK) {
// Check min length // Check min length
if (!ValidationUtil.CheckMinLengthForByte(SETTINGS.getNewPassword(), 6)) { if (!ValidationUtil.CheckMinLengthForByte(SETTINGS.getNewPassword(), 6)) {
isOK = false; isOK = false;
...@@ -53,58 +52,53 @@ SETTINGS.dspPwdUpd1_Click = function(e) { ...@@ -53,58 +52,53 @@ SETTINGS.dspPwdUpd1_Click = function(e) {
} }
// Check at least 3 consecutive characters // Check at least 3 consecutive characters
if (ValidationUtil.HasSeqChar(SETTINGS.getNewPassword(), 3)) { if (ValidationUtil.HasSeqChar(SETTINGS.getNewPassword(), 3)) {
isOK = false; isOK = false;
msgError.html(I18N.i18nText('msgHasSeqChar')); msgError.html(I18N.i18nText('msgHasSeqChar'));
msgError.show(); msgError.show();
} }
// Check 4 same characters in before password // Check 4 same characters in before password
if (ValidationUtil.ContainSameSeqChar(SETTINGS.getCurrentPassword(), SETTINGS.getNewPassword(), 4)) { if (ValidationUtil.ContainSameSeqChar(SETTINGS.getCurrentPassword(), SETTINGS.getNewPassword(), 4)) {
isOK = false; isOK = false;
msgError.html(I18N.i18nText('msgContainSameSeqChar')); msgError.html(I18N.i18nText('msgContainSameSeqChar'));
msgError.show(); msgError.show();
} }
} }
// Do changing password // Do changing password
if (isOK) { if (isOK) {
var params = { var params = {
sid: ClientData.userInfo_sid(), sid: ClientData.userInfo_sid(),
loginId: ClientData.userInfo_loginId_session(), loginId: ClientData.userInfo_loginId_session(),
password: SETTINGS.getCurrentPassword(), password: SETTINGS.getCurrentPassword(),
newPassword: SETTINGS.getNewPassword(), newPassword: SETTINGS.getNewPassword(),
language: I18N.getCurrentLanguage(), language: I18N.getCurrentLanguage(),
appId: 4 appId: 4,
}; };
const url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.API.PASSWORD_CHANGE; const url = COMMON.format(ClientData.conf_checkApiUrl(), ClientData.userInfo_accountPath()) + CONSTANT.URL.CMS.API.PASSWORD_CHANGE;
COMMON.cmsAjax(url, params, false, COMMON.cmsAjax(url, params, false, SETTINGS.avwCmsApi_passwordChange_success, SETTINGS.avwCmsApi_passwordChange_fail);
SETTINGS.avwCmsApi_passwordChange_success, } else {
SETTINGS.avwCmsApi_passwordChange_fail);
}
else {
//alert('error'); //alert('error');
} }
}; };
SETTINGS.avwCmsApi_passwordChange_success = function(data) { SETTINGS.avwCmsApi_passwordChange_success = function (data) {
// OK // OK
var msgError = $('#main-error-message'); var msgError = $('#main-error-message');
if (data.httpStatus != CONSTANT.HTTP_STATUS.OK) { if (data.httpStatus != CONSTANT.HTTP_STATUS.OK) {
msgError.html(I18N.i18nText('msgPwdChangeNG')); msgError.html(I18N.i18nText('msgPwdChangeNG'));
msgError.show(); msgError.show();
} } else {
else {
msgError.html(''); msgError.html('');
$("#txtPwdCur").val(""); $('#txtPwdCur').val('');
$("#txtPwdNew").val(""); $('#txtPwdNew').val('');
$("#txtPwdNewRe").val(""); $('#txtPwdNewRe').val('');
/* show messages */ /* show messages */
COMMON.displayAlert('msgPwdChangeOK'); COMMON.displayAlert('msgPwdChangeOK');
} }
}; };
SETTINGS.avwCmsApi_passwordChange_fail = function(xhr, b, c) { SETTINGS.avwCmsApi_passwordChange_fail = function (xhr, b, c) {
/* show error messages */ /* show error messages */
var msgError = $('#main-error-message'); var msgError = $('#main-error-message');
if (xhr.errorMessage && xhr.httpStatus != 0) { if (xhr.errorMessage && xhr.httpStatus != 0) {
...@@ -115,7 +109,6 @@ SETTINGS.avwCmsApi_passwordChange_fail = function(xhr, b, c) { ...@@ -115,7 +109,6 @@ SETTINGS.avwCmsApi_passwordChange_fail = function(xhr, b, c) {
msgError.show(); msgError.show();
}; };
/* /*
---------------------------------------------------------------------------- ----------------------------------------------------------------------------
Event groups [ end ] Event groups [ end ]
...@@ -123,33 +116,32 @@ Event groups [ end ] ...@@ -123,33 +116,32 @@ Event groups [ end ]
*/ */
// Get input current password // Get input current password
SETTINGS.getCurrentPassword = function() { SETTINGS.getCurrentPassword = function () {
return $("#txtPwdCur").val(); return $('#txtPwdCur').val();
}; };
// Get input new password // Get input new password
SETTINGS.getNewPassword = function() { SETTINGS.getNewPassword = function () {
return $("#txtPwdNew").val(); return $('#txtPwdNew').val();
}; };
// Get input new password // Get input new password
SETTINGS.getNewPasswordRe = function() { SETTINGS.getNewPasswordRe = function () {
return $("#txtPwdNewRe").val(); return $('#txtPwdNewRe').val();
}; };
// Initalize screen // Initalize screen
SETTINGS.initScreen = function() { SETTINGS.initScreen = function () {
$("#includedHeader").load("../html/common/header.html" , function() { $('#includedHeader').load('../html/common/header.html', function () {
I18N.initi18n(); I18N.initi18n();
HEADER.init(); HEADER.init();
}); });
$("#includedConfirmModal").load("../html/common/confirmModal.html", function() { $('#includedConfirmModal').load('../html/common/confirmModal.html', function () {
I18N.initi18n(); I18N.initi18n();
}); });
// Login ID // Login ID
$("#txtLoginId").text(ClientData.userInfo_loginId_session()); $('#txtLoginId').text(ClientData.userInfo_loginId_session());
// Account Path // Account Path
$("#txtLoginAccPath").text(ClientData.userInfo_accountPath_session()); $('#txtLoginAccPath').text(ClientData.userInfo_accountPath_session());
// Recent login date // Recent login date
$("#txtLastLoginTime").text(ClientData.userInfo_lastLoginTime()); $('#txtLastLoginTime').text(ClientData.userInfo_lastLoginTime());
}; };
/** /**
* template js * template js
* @since cms:1.4.3.2&1.4.3.3 web:1.0 * @since cms:1.4.3.2&1.4.3.3 web:1.0
*/ */
var TEMPLATE = {}; var TEMPLATE = {};
/** template load header */ /** template load header */
TEMPLATE.loadHearder = function(elmentId) { TEMPLATE.loadHearder = function (elmentId) {
$(elmentId).load("../html/common/header.html" , function() { $(elmentId).load('../html/common/header.html', function () {
$("#iconHomeDashboard").removeClass('active'); $('#iconHomeDashboard').removeClass('active');
$("#iconHomeWorkList").removeClass('active'); $('#iconHomeWorkList').removeClass('active');
if(sessionStorage.activeHomePage == CONSTANT.PAGE_NAME.OPERATION_LIST) if (sessionStorage.activeHomePage == CONSTANT.PAGE_NAME.OPERATION_LIST) {
{ $('#iconHomeWorkList').addClass('active');
$("#iconHomeWorkList").addClass('active'); } else {
} $('#iconHomeDashboard').addClass('active');
else
{
$("#iconHomeDashboard").addClass('active');
} }
I18N.initi18n(); I18N.initi18n();
}); });
} };
/** /**
* template load dashboard setting * template load dashboard setting
* @param {string} elmentId - element to load setting html * @param {string} elmentId - element to load setting html
* @param {*} changeCallback - callback when setting changed * @param {*} changeCallback - callback when setting changed
*/ */
TEMPLATE.loadDashboardSetting = function(elmentId, changeCallback) { TEMPLATE.loadDashboardSetting = function (elmentId, changeCallback) {
$(elmentId).load("dashboardSetting.html", function() { $(elmentId).load('dashboardSetting.html', function () {
DashboardSetting.init(changeCallback); DashboardSetting.init(changeCallback);
I18N.initi18n(); I18N.initi18n();
}); });
} };
/** Template load confirm model */ /** Template load confirm model */
TEMPLATE.loadConfirmModal = function(elmentId) { TEMPLATE.loadConfirmModal = function (elmentId) {
$(elmentId).load("../html/common/confirmModal.html", function() { $(elmentId).load('../html/common/confirmModal.html', function () {
I18N.initi18n(); I18N.initi18n();
}); });
} };
/** Template load operation select */ /** Template load operation select */
TEMPLATE.loadOperationSelect = function(elmentId, selectCallback) { TEMPLATE.loadOperationSelect = function (elmentId, selectCallback) {
$(elmentId).load("operationSelect.html", function() { $(elmentId).load('operationSelect.html', function () {
OperationSelect.init(selectCallback); OperationSelect.init(selectCallback);
I18N.initi18n(); I18N.initi18n();
}); });
} };
/** /**
* show confirm model * show confirm model
*/ */
TEMPLATE.showModalConfirm = function () { TEMPLATE.showModalConfirm = function () {
$("#showConfirm").click(function(){ $('#showConfirm').click(function () {
$("#confirm-modal").modal(); $('#confirm-modal').modal();
}); });
}; };
/** Template load notification content*/ /** Template load notification content*/
TEMPLATE.loadNotificationSelect = function(elmentId, selectCallback) { TEMPLATE.loadNotificationSelect = function (elmentId, selectCallback) {
$(elmentId).load("notificationContent.html", function() { $(elmentId).load('notificationContent.html', function () {
NotificationSelect.init(selectCallback); NotificationSelect.init(selectCallback);
I18N.initi18n(); I18N.initi18n();
}); });
} };
/** /**
* load main navs title html to a element by id * load main navs title html to a element by id
...@@ -71,15 +68,15 @@ TEMPLATE.loadNotificationSelect = function(elmentId, selectCallback) { ...@@ -71,15 +68,15 @@ TEMPLATE.loadNotificationSelect = function(elmentId, selectCallback) {
* @param {string} titleLang - lang of title * @param {string} titleLang - lang of title
* @param {Array} navs - array nav items (titleLang, href) * @param {Array} navs - array nav items (titleLang, href)
*/ */
TEMPLATE.loadMainNavsTitle = function(elmentId, titleLang, navs, completeCallback) { TEMPLATE.loadMainNavsTitle = function (elmentId, titleLang, navs, completeCallback) {
var titleHtmlPath = '../common/mainTitle.html'; var titleHtmlPath = '../common/html/mainTitle.html';
if (navs) { if (navs) {
titleHtmlPath = '../common/mainNavTitle.html'; titleHtmlPath = '../common/html/mainNavTitle.html';
} }
$(elmentId).load(titleHtmlPath , function(data) { $(elmentId).load(titleHtmlPath, function (data) {
$(elmentId).replaceWith(data); $(elmentId).replaceWith(data);
if (titleLang) { if (titleLang) {
$('#mainTitleHeader').attr("lang", titleLang); $('#mainTitleHeader').attr('lang', titleLang);
} }
if (navs) { if (navs) {
var olElm = $('#mainTitleNavs ol'); var olElm = $('#mainTitleNavs ol');
...@@ -109,4 +106,4 @@ TEMPLATE.loadNotificationSelect = function(elmentId, selectCallback) { ...@@ -109,4 +106,4 @@ TEMPLATE.loadNotificationSelect = function(elmentId, selectCallback) {
completeCallback(); completeCallback();
} }
}); });
} };
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