Commit 058280d6 by Masaru Abe

リファクタリング

parent f7a6fa25
......@@ -2702,6 +2702,9 @@ COMMON.convertToDate = function(input) {
var strTemp = input;
var nIndex;
dateResult = new Date();
try {
// Get year
nIndex = strTemp.indexOf("-");
nYear = Number(strTemp.substr(0, nIndex));
......@@ -2726,14 +2729,19 @@ COMMON.convertToDate = function(input) {
nIndex = strTemp.indexOf(".");
nSecond = Number(strTemp.substr(0, nIndex));
dateResult = new Date();
dateResult.setYear(nYear);
dateResult.setMonth(nMonth-1);
dateResult.setDate(nDay);
dateResult.setHours(nHour);
dateResult.setMinutes(nMinute);
dateResult.setSeconds(nSecond);
} catch(e) {
//
}
return dateResult;
};
/*
......
......@@ -99,7 +99,7 @@ I18N.loadLanguage = function(lang) {
I18N.replaceText(jsonLangData);
// 言語設定、言語データをストレージにキャッシュしておく
storeCurrentLanguage(lang, jsonLangData);
I18N.storeCurrentLanguage(lang, jsonLangData);
},
error: function(xhr, txtStatus, errorThrown) {
var error = 'Could not load a language file ' + langfile + '. please check it.';
......@@ -118,7 +118,7 @@ I18N.replaceText = function(jsonLangData) {
var obj = $('.lang:eq(' + i + ')');
var langId = obj.attr('lang');
if(langId) {
var langText = getLangText(jsonLangData, langId);
var langText = I18N.getLangText(jsonLangData, langId);
var tn = obj.get()[0].localName;
if(tn == 'input') {
if(obj.attr('type') == 'button' || obj.attr('type') == 'submit') {
......@@ -153,14 +153,14 @@ I18N.i18nText = function(key) {
var value = storage.getItem(I18N.avwsys_storagekey);
if(value) {
var json = JSON.parse(value);
return getLangText(json, key);
return I18N.getLangText(json, key);
}
}
return "undefined";
};
/* 言語データのキー値から文字列を取得 */
function getLangText(jsonLangData, key) {
I18N.getLangText = function(jsonLangData, key) {
if(jsonLangData) {
var text = jsonLangData[key];
return text;
......@@ -169,7 +169,7 @@ function getLangText(jsonLangData, key) {
};
/* 言語データの切り替え */
function changeLanguage(lang) {
I18N.changeLanguage = function(lang) {
// 言語の切替を行った場合のみ選択言語をストアする
var storage = window.localStorage;
......@@ -182,7 +182,7 @@ function changeLanguage(lang) {
};
/* 設定言語の保存 */
function storeCurrentLanguage(lang, langData) {
I18N.storeCurrentLanguage = function(lang, langData) {
var ss = window.sessionStorage;
if(ss) {
// language data
......@@ -192,7 +192,7 @@ function storeCurrentLanguage(lang, langData) {
}
};
/* 設定言語の取得 */
function getCurrentLanguage() {
I18N.getCurrentLanguage = function() {
var lang;
var storage = window.sessionStorage;
if(storage) {
......@@ -203,3 +203,4 @@ function getCurrentLanguage() {
}
return lang;
};

var messageLevel = {};
//名前空間用のオブジェクトを用意する
var LIMIT_ACCESS_CONTENT = {};
function checkLimitContent(contentId, funcOk, funcCancel, isNotUnlockScreen) {
LIMIT_ACCESS_CONTENT.messageLevel = {};
var levelContent = parseInt(messageLevel[contentId].alertMessageLevel);
LIMIT_ACCESS_CONTENT.checkLimitContent = function(contentId, funcOk, funcCancel, isNotUnlockScreen) {
var levelContent = parseInt(LIMIT_ACCESS_CONTENT.messageLevel[contentId].alertMessageLevel);
if (levelContent == 1) {
if ($('#limit_level1').length <= 0) {
......@@ -31,7 +34,7 @@ function checkLimitContent(contentId, funcOk, funcCancel, isNotUnlockScreen) {
COMMON.lockLayout();
$('#limit_level1 .message').html(messageLevel[contentId].alertMessage);
$('#limit_level1 .message').html(LIMIT_ACCESS_CONTENT.messageLevel[contentId].alertMessage);
$('#limit_level1').show().center();
$('#limit_level1 .deletebtn .ok').unbind('click').click(
function () {
......
/// しおりリスト画面 - SCRSLS0100
var contentTypes = {};
var contentName = {};
var pathImgContentNone = './img/page-none.png';
//名前空間用のオブジェクトを用意する
var BOOKMARK = {};
BOOKMARK.contentTypes = {};
BOOKMARK.contentName = {};
BOOKMARK.pathImgContentNone = './img/page-none.png';
//Contains non-exist content
BOOKMARK.bookmark_errorContent = [];
// Contain contents
BOOKMARK.collection_contents = [];
// Init function of page
$(document).ready(function () {
......@@ -20,18 +28,18 @@ $(document).ready(function () {
if (ClientData.requirePasswordChange() != 1) {
// Synchronize bookmarks with server
SyncContent();
BOOKMARK.SyncContent();
// Collection all detail of pages
bookmark_collectAllPages();
BOOKMARK.bookmark_collectAllPages();
$("#dspDelete").click(dspDelete_Click);
$("#dspDelete").click(BOOKMARK.dspDelete_Click);
$("#dspDelete1").click(dspDelete1_Click);
$("#dspCancel").click(dspCancel_Click);
$("#dspConfirmOK").click(dspConfirmOK_Click);
$("#dspDelete1").click(BOOKMARK.dspDelete1_Click);
$("#dspCancel").click(BOOKMARK.dspCancel_Click);
$("#dspConfirmOK").click(BOOKMARK.dspConfirmOK_Click);
ClearGrid();
BOOKMARK.ClearGrid();
if (ClientData.BookMarkData().length == 0) {
// Show error
......@@ -46,17 +54,17 @@ $(document).ready(function () {
}
// Show book in local storage
//ShowBookmark();
//BOOKMARK.ShowBookmark();
$("a[name='dspRead']").unbind('click');
$("a[name='dspRead']").click(dspRead_Click);
$("a[name='dspRead']").click(BOOKMARK.dspRead_Click);
HideSorting();
BOOKMARK.HideSorting();
// Default sort is タイトル名, default is asc
ClientData.sortOpt_searchDivision(1);
ClientData.sortOpt_sortType(2);
dspTitleNm_Click();
BOOKMARK.dspTitleNm_Click();
}
else {
HEADER.checkForceChangePassword();
......@@ -67,6 +75,21 @@ $(document).ready(function () {
$('#dspPushMessage').hide();
}
//ダイアログ関連
$("#dspTitleNm").click(BOOKMARK.dspTitleNm_Click);
$("#dspTitleNmKn").click(BOOKMARK.dspTitleNmKn_Click);
$("#dspPubDt").click(BOOKMARK.dspPubDt_Click);
// Check JP language and show title kana
if (I18N.getCurrentLanguage() != COMMON.Consts.ConstLanguage_Ja) {
$("#dspTitleNmKn").hide();
$("#dspTitleNmKn_Seperate").hide();
}
else {
$("#dspTitleNmKn").show();
$("#dspTitleNmKn_Seperate").show();
}
});
/*
......@@ -75,14 +98,7 @@ Event groups [start]
----------------------------------------------------------------------------
*/
// update status sort
//function changeStatusSort(obj, isAsc) {
// $('#sortingDiv .sort li a').removeClass().addClass('lang');
// $('#sortingDiv .sort li').removeClass('current');
// $(obj).addClass(isAsc ? 'ascending_sort' : 'descending_sort').parent().addClass("current");
//};
function dspTitleNm_Click() {
BOOKMARK.dspTitleNm_Click = function() {
var isAsc = false;
if (ClientData.sortOpt_searchDivision() == 1) { // Name
......@@ -101,16 +117,13 @@ function dspTitleNm_Click() {
isAsc = true;
}
SortTitleName(isAsc);
// $("#dspTitleNm").addClass("active_tops");
// $("#dspTitleNmKn").removeClass("active_tops");
// $("#dspPubDt").removeClass("active_tops");
BOOKMARK.SortTitleName(isAsc);
//changeStatusSort(this, isAsc);
HEADER.setStatusSort('#dspTitleNm', isAsc);
};
function dspTitleNmKn_Click() {
BOOKMARK.dspTitleNmKn_Click = function() {
var isAsc = false;
if (ClientData.sortOpt_searchDivision() == 2) { // Kana
if (ClientData.sortOpt_sortType() == 1) { // ASC
......@@ -128,17 +141,13 @@ function dspTitleNmKn_Click() {
isAsc = true;
}
SortTitleNameKana(isAsc);
// $("#dspTitleNm").removeClass("active_tops");
// $("#dspTitleNmKn").addClass("active_tops");
// $("#dspPubDt").removeClass("active_tops");
BOOKMARK.SortTitleNameKana(isAsc);
//changeStatusSort(this, isAsc);
HEADER.setStatusSort('#dspTitleNmKn', isAsc);
};
function dspPubDt_Click() {
BOOKMARK.dspPubDt_Click = function() {
var isAsc = false;
if (ClientData.sortOpt_searchDivision() == 3) { // Publish date
if (ClientData.sortOpt_sortType() == 1) { // ASC
......@@ -156,32 +165,28 @@ function dspPubDt_Click() {
isAsc = true;
}
SortPubDate(isAsc);
// $("#dspTitleNm").removeClass("active_tops");
// $("#dspTitleNmKn").removeClass("active_tops");
// $("#dspPubDt").addClass("active_tops");
BOOKMARK.SortPubDate(isAsc);
//changeStatusSort(this, isAsc);
HEADER.setStatusSort('#dspPubDt', isAsc);
};
// Event of each button [読む]
function dspRead_Click() {
BOOKMARK.dspRead_Click = function() {
var jsondata = $(this).attr("value");
var data = JSON.parse(jsondata);
checkLimitContent(
LIMIT_ACCESS_CONTENT.checkLimitContent(
data.contentid,
function (){
dspRead_Click_callback(data);
BOOKMARK.dspRead_Click_callback(data);
},
function(){
}
);
};
//
function dspRead_Click_callback(data) {
BOOKMARK.dspRead_Click_callback = function(data) {
ClientData.contentInfo_contentId(data.contentid);
ClientData.bookmark_pageNo(data.pageNo);
......@@ -190,16 +195,15 @@ function dspRead_Click_callback(data) {
AVWEB.avwScreenMove(COMMON.ScreenIds.ContentView);
};
// Cancel dialog of deleting
function dspCancel_Click() {
BOOKMARK.dspCancel_Click = function() {
// Close dialog
//$('#dlgConfirm').dialog('close');
$("#delete_shiori").hide();
COMMON.unlockLayout();
};
// Process deleting
function dspConfirmOK_Click() {
BOOKMARK.dspConfirmOK_Click = function() {
// --------------------------------
// Process deleting [start]
// --------------------------------
......@@ -241,11 +245,11 @@ function dspConfirmOK_Click() {
COMMON.unlockLayout();
};
function dspDelete1_Click() {
dspDelete_Click();
BOOKMARK.dspDelete1_Click = function() {
BOOKMARK.dspDelete_Click();
};
function dspDelete_Click() {
BOOKMARK.dspDelete_Click = function() {
if ($("input[name='chkDelete']:checked").length > 0) {
COMMON.lockLayout();
$("#delete_shiori").show();
......@@ -254,7 +258,7 @@ function dspDelete_Click() {
};
// Show detail content
function ShowBookmark() {
BOOKMARK.ShowBookmark = function() {
if (AVWEB.avwHasError()) {
return;
}
......@@ -299,16 +303,16 @@ function ShowBookmark() {
var contentTitleKana = "";
var contentType = "";
// Search current page if collection that get details before
for (var nIndex2 = 0; nIndex2 < collection_contents.length; nIndex2++) {
if (collection_contents[nIndex2].contentid == contentid) {
contentTitle = collection_contents[nIndex2].contentTitle;
contentTitleKana = collection_contents[nIndex2].contentTitleKana;
contentType = collection_contents[nIndex2].contentType;
for (var nIndex2 = 0; nIndex2 < BOOKMARK.collection_contents.length; nIndex2++) {
if (BOOKMARK.collection_contents[nIndex2].contentid == contentid) {
contentTitle = BOOKMARK.collection_contents[nIndex2].contentTitle;
contentTitleKana = BOOKMARK.collection_contents[nIndex2].contentTitleKana;
contentType = BOOKMARK.collection_contents[nIndex2].contentType;
// Search in pages
for (var nIndex3 = 0; nIndex3 < collection_contents[nIndex2].pages.length; nIndex3++) {
if (pageNo == collection_contents[nIndex2].pages[nIndex3].pageNo) {
pageDetail = collection_contents[nIndex2].pages[nIndex3];
for (var nIndex3 = 0; nIndex3 < BOOKMARK.collection_contents[nIndex2].pages.length; nIndex3++) {
if (pageNo == BOOKMARK.collection_contents[nIndex2].pages[nIndex3].pageNo) {
pageDetail = BOOKMARK.collection_contents[nIndex2].pages[nIndex3];
if(contentType != COMMON.ContentTypeKeys.Type_PDF){
pageDetail.pageText = "";
}
......@@ -322,30 +326,30 @@ function ShowBookmark() {
// If bookmark does not exist
if (pageDetail.existed == true) {
// Show normal
UpdateBookmark(contentid, pageDetail.pageNo, contentTitle, contentTitleKana);
BOOKMARK.UpdateBookmark(contentid, pageDetail.pageNo, contentTitle, contentTitleKana);
var pageThumbnail = (pageDetail.pageThumbnail != pathImgContentNone) ? ("data:image/jpeg;base64," + pageDetail.pageThumbnail) : pathImgContentNone;
var pageThumbnail = (pageDetail.pageThumbnail != BOOKMARK.pathImgContentNone) ? ("data:image/jpeg;base64," + pageDetail.pageThumbnail) : BOOKMARK.pathImgContentNone;
insertRow(contentid, pageThumbnail, COMMON.htmlEncode(contentTitle),
BOOKMARK.insertRow(contentid, pageThumbnail, COMMON.htmlEncode(contentTitle),
pageDetail.pageText, pageDetail.pageNo, hasMemo, hasMarking, nIndex, contentType);
}
else {
// Not existed -> Show error
insertRowError(contentid, COMMON.htmlEncode(contentTitle), pageDetail.pageNo);
BOOKMARK.insertRowError(contentid, COMMON.htmlEncode(contentTitle), pageDetail.pageNo);
}
}
}
$("a[name='dspRead']").unbind('click');
$("a[name='dspRead']").click(dspRead_Click);
$("a[name='dspRead']").click(BOOKMARK.dspRead_Click);
}
};
// Hide all sorting symbol
function HideSorting() {
BOOKMARK.HideSorting = function() {
$('#menu_sort li a').removeClass('ascending_sort').removeClass('descending_sort');
};
// Sort by title name
function SortTitleName(isAsc) {
BOOKMARK.SortTitleName = function(isAsc) {
HEADER.setStatusSort('#dspTitleNm', isAsc);
......@@ -388,12 +392,12 @@ function SortTitleName(isAsc) {
isStop = true;
}
}
ClearGrid();
BOOKMARK.ClearGrid();
ClientData.BookMarkData(arrTarget);
ShowBookmark();
BOOKMARK.ShowBookmark();
};
// Clear all rows of grid
function ClearGrid() {
BOOKMARK.ClearGrid = function() {
var arrSelectedBookmarks = $("input[name='chkDelete']");
$.each(arrSelectedBookmarks, function () {
......@@ -402,7 +406,7 @@ function ClearGrid() {
};
// Sort by title name kana
function SortTitleNameKana(isAsc) {
BOOKMARK.SortTitleNameKana = function(isAsc) {
HEADER.setStatusSort('#dspTitleNmKn', isAsc);
......@@ -445,12 +449,12 @@ function SortTitleNameKana(isAsc) {
isStop = true;
}
}
ClearGrid();
BOOKMARK.ClearGrid();
ClientData.BookMarkData(arrTarget);
ShowBookmark();
BOOKMARK.ShowBookmark();
};
// Sort by publish date
function SortPubDate(isAsc) {
BOOKMARK.SortPubDate = function(isAsc) {
HEADER.setStatusSort('#dspPubDt', isAsc);
......@@ -493,14 +497,14 @@ function SortPubDate(isAsc) {
isStop = true;
}
}
ClearGrid();
BOOKMARK.ClearGrid();
ClientData.BookMarkData(arrTarget);
ShowBookmark();
BOOKMARK.ShowBookmark();
};
/*
Update information of specified bookmark
*/
function UpdateBookmark(contentid, pageNo, contentTitle, contentTitleKana) {
BOOKMARK.UpdateBookmark = function(contentid, pageNo, contentTitle, contentTitleKana) {
var arrBookmarks = ClientData.BookMarkData();
for (var nIndex = 0; nIndex < arrBookmarks.length; nIndex++) {
......@@ -522,7 +526,7 @@ function UpdateBookmark(contentid, pageNo, contentTitle, contentTitleKana) {
/*
Insert error row
*/
function insertRowError(contentid, pageTitle, pageNo) {
BOOKMARK.insertRowError = function(contentid, pageTitle, pageNo) {
var newRow = "";
......@@ -546,7 +550,7 @@ function insertRowError(contentid, pageTitle, pageNo) {
};
// Insert row to grid
function insertRow(contentid, pageThumbnail, pageTitle, pageText, pageNo, hasMemo, hasMarking, index, contentType) {
BOOKMARK.insertRow = function(contentid, pageThumbnail, pageTitle, pageText, pageNo, hasMemo, hasMarking, index, contentType) {
var imgMarkingHide = '<img style="visibility:hidden" class="pen" alt="" src="./img/list/icon_pen.png" />';
var imgMemoHide = '<img style="visibility:hidden" class="sticker" alt="" src="./img/list/icon_sticker.png" />';
var imgMarking = '<img class="pen" alt="" src="./img/list/icon_pen.png" />';
......@@ -640,45 +644,14 @@ Event groups [ end ]
----------------------------------------------------------------------------
*/
/*
----------------------------------------------------------------------------
Setting dialog [start]
----------------------------------------------------------------------------
*/
$(function () {
$("#dspTitleNm").click(dspTitleNm_Click);
$("#dspTitleNmKn").click(dspTitleNmKn_Click);
$("#dspPubDt").click(dspPubDt_Click);
// Check JP language and show title kana
if (getCurrentLanguage() != COMMON.Consts.ConstLanguage_Ja) {
$("#dspTitleNmKn").hide();
$("#dspTitleNmKn_Seperate").hide();
}
else {
$("#dspTitleNmKn").show();
$("#dspTitleNmKn_Seperate").show();
}
});
// Contains non-exist content
var bookmark_errorContent = [];
// Contain contents
var collection_contents = [];
/*
Get all detail pages of content in bookmark
*/
function bookmark_collectAllPages() {
BOOKMARK.bookmark_collectAllPages = function() {
var arrBookMarks = ClientData.BookMarkData();
for (var nIndex = 0; nIndex < collection_contents.length; nIndex++) {
for (var nIndex = 0; nIndex < BOOKMARK.collection_contents.length; nIndex++) {
var contentid = collection_contents[nIndex].contentid;
var contentid = BOOKMARK.collection_contents[nIndex].contentid;
var pages = [];
// Collect all pages of current content
......@@ -689,35 +662,35 @@ function bookmark_collectAllPages() {
}
}
// Add collected pages to content
collection_contents[nIndex].pages = pages;
BOOKMARK.collection_contents[nIndex].pages = pages;
// Join pages to request to server
var strPageNos = buildPageNos(collection_contents[nIndex].pages);
var strPageNos = BOOKMARK.buildPageNos(BOOKMARK.collection_contents[nIndex].pages);
// Call api to get all details of pages 1 time
AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webContentPage", "GET",
{ contentId: contentid, sid: ClientData.userInfo_sid(), pageNos: strPageNos, thumbnailFlg: 1 },
function (data) {
collection_contents[nIndex].contentTitle = data.contentTitle;
collection_contents[nIndex].contentTitleKana = data.contentTitleKana;
for (var nIndex2 = 0; nIndex2 < collection_contents[nIndex].pages.length; nIndex2++) {
BOOKMARK.collection_contents[nIndex].contentTitle = data.contentTitle;
BOOKMARK.collection_contents[nIndex].contentTitleKana = data.contentTitleKana;
for (var nIndex2 = 0; nIndex2 < BOOKMARK.collection_contents[nIndex].pages.length; nIndex2++) {
var comparePageNo = collection_contents[nIndex].pages[nIndex2].pageNo;
var comparePageNo = BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageNo;
for (var nIndex3 = 0; nIndex3 < data.pages.length; nIndex3++) {
if (data.pages[nIndex2] && comparePageNo == data.pages[nIndex2].pageNo) {
// Set flag to determine page existed
collection_contents[nIndex].pages[nIndex2].existed = true;
BOOKMARK.collection_contents[nIndex].pages[nIndex2].existed = true;
// Store detail of page
collection_contents[nIndex].pages[nIndex2].pageText = data.pages[nIndex2].pageText;
collection_contents[nIndex].pages[nIndex2].pageThumbnail = data.pages[nIndex2].pageThumbnail;
BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageText = data.pages[nIndex2].pageText;
BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageThumbnail = data.pages[nIndex2].pageThumbnail;
}
else if (contentTypes[contentid] == "none" && data.pages.length > 0) {
collection_contents[nIndex].pages[nIndex2].existed = true;
else if (BOOKMARK.contentTypes[contentid] == "none" && data.pages.length > 0) {
BOOKMARK.collection_contents[nIndex].pages[nIndex2].existed = true;
// Store detail of page
collection_contents[nIndex].pages[nIndex2].pageText = ''; //data.pages[0].pageText;
collection_contents[nIndex].pages[nIndex2].pageThumbnail = pathImgContentNone; //data.pages[nIndex2].pageThumbnail;
BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageText = ''; //data.pages[0].pageText;
BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageThumbnail = BOOKMARK.pathImgContentNone; //data.pages[nIndex2].pageThumbnail;
}
}
......@@ -725,12 +698,12 @@ function bookmark_collectAllPages() {
},
function () { // when server response error
if (contentTypes[contentid] == "none") {
collection_contents[nIndex].contentTitle = contentName[contentid];
for (var nIndex2 = 0; nIndex2 < collection_contents[nIndex].pages.length; nIndex2++) {
collection_contents[nIndex].pages[nIndex2].existed = true;
collection_contents[nIndex].pages[nIndex2].pageThumbnail = pathImgContentNone;
collection_contents[nIndex].pages[nIndex2].pageText = '';
if (BOOKMARK.contentTypes[contentid] == "none") {
BOOKMARK.collection_contents[nIndex].contentTitle = BOOKMARK.contentName[contentid];
for (var nIndex2 = 0; nIndex2 < BOOKMARK.collection_contents[nIndex].pages.length; nIndex2++) {
BOOKMARK.collection_contents[nIndex].pages[nIndex2].existed = true;
BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageThumbnail = BOOKMARK.pathImgContentNone;
BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageText = '';
}
}
......@@ -742,7 +715,7 @@ function bookmark_collectAllPages() {
/*
Build pageNos
*/
function buildPageNos(pages) {
BOOKMARK.buildPageNos = function(pages) {
var strResult = "";
for (var nIndex = 0; nIndex < pages.length; nIndex++) {
if (strResult == "") {
......@@ -758,11 +731,11 @@ function buildPageNos(pages) {
/*
Check a content is error or not
*/
function IsErrorContent(strContentId) {
BOOKMARK.IsErrorContent = function(strContentId) {
var isError = false;
for (var nIndex = 0; nIndex < bookmark_errorContent.length; nIndex++) {
if (strContentId == bookmark_errorContent[nIndex].contentid) {
for (var nIndex = 0; nIndex < BOOKMARK.bookmark_errorContent.length; nIndex++) {
if (strContentId == BOOKMARK.bookmark_errorContent[nIndex].contentid) {
isError = true;
break;
}
......@@ -773,11 +746,11 @@ function IsErrorContent(strContentId) {
/*
Check a content is checked + ok
*/
function IsOKCheckedContent(strContentId) {
BOOKMARK.IsOKCheckedContent = function(strContentId) {
var isOK = false;
for (var nIndex = 0; nIndex < collection_contents.length; nIndex++) {
if (strContentId == collection_contents[nIndex].contentid) {
for (var nIndex = 0; nIndex < BOOKMARK.collection_contents.length; nIndex++) {
if (strContentId == BOOKMARK.collection_contents[nIndex].contentid) {
isOK = true;
break;
}
......@@ -786,17 +759,17 @@ function IsOKCheckedContent(strContentId) {
};
// Add OK checked content
function AddContent(strContentId, contentType) {
BOOKMARK.AddContent = function(strContentId, contentType) {
var isFound = false;
for (var nIndex = 0; nIndex < collection_contents.length; nIndex++) {
if (collection_contents[nIndex].contentid == strContentId) {
for (var nIndex = 0; nIndex < BOOKMARK.collection_contents.length; nIndex++) {
if (BOOKMARK.collection_contents[nIndex].contentid == strContentId) {
isFound = true;
break;
}
}
// Add to bufer if it does not exist
if(!isFound) {
collection_contents.push({ 'contentid': strContentId, 'contentType': contentType, 'contentTitle': "", 'contentTitleKana': "", 'pages': [] });
BOOKMARK.collection_contents.push({ 'contentid': strContentId, 'contentType': contentType, 'contentTitle': "", 'contentTitleKana': "", 'pages': [] });
}
};
......@@ -804,7 +777,7 @@ function AddContent(strContentId, contentType) {
event of changing language
*/
function changeLanguageCallBackFunction() {
if (getCurrentLanguage() != COMMON.Consts.ConstLanguage_Ja) {
if (I18N.getCurrentLanguage() != COMMON.Consts.ConstLanguage_Ja) {
$("#dspTitleNmKn").hide();
$("#dspTitleNmKn_Seperate").hide();
$("#txtTitleNmKnAsc").hide();
......@@ -827,13 +800,13 @@ Synchronize bookmark with server
. Check existence of pages
-> Delete absence pages in local
*/
function SyncContent() {
BOOKMARK.SyncContent = function() {
// Reset error contents
bookmark_errorContent = [];
BOOKMARK.bookmark_errorContent = [];
// Reset ok checked content
collection_contents = [];
BOOKMARK.collection_contents = [];
// Get bookmarks from local storage
var arrBookmarks = ClientData.BookMarkData();
......@@ -844,10 +817,10 @@ function SyncContent() {
// ==================================
// Check existence of content [start]
// ==================================
if (IsErrorContent(oneBookMark.contentid) == false) {
if (BOOKMARK.IsErrorContent(oneBookMark.contentid) == false) {
// If content is ok + checked
if (IsOKCheckedContent(oneBookMark.contentid) == false) {
if (!IsExistContent(oneBookMark.contentid)["isExisted"]) {
if (BOOKMARK.IsOKCheckedContent(oneBookMark.contentid) == false) {
if (!BOOKMARK.IsExistContent(oneBookMark.contentid)["isExisted"]) {
if (AVWEB.avwHasError()) {
// System error excepting 404
AVWEB.showSystemError();
......@@ -855,7 +828,7 @@ function SyncContent() {
}
else {
// Add to list of error content
bookmark_errorContent.push({ contentid: oneBookMark.contentid });
BOOKMARK.bookmark_errorContent.push({ contentid: oneBookMark.contentid });
// Remove bookmark
arrBookmarks.splice(nIndex, 1);
ClientData.isChangedBookmark(true);
......@@ -866,7 +839,7 @@ function SyncContent() {
// ==================================
else {
// Add nromal content
AddContent(oneBookMark.contentid, IsExistContent(oneBookMark.contentid)["contentType"]);
BOOKMARK.AddContent(oneBookMark.contentid, BOOKMARK.IsExistContent(oneBookMark.contentid)["contentType"]);
}
}
}
......@@ -884,7 +857,7 @@ function SyncContent() {
/*
Check content whether existed or not
*/
function IsExistContent(strContentId) {
BOOKMARK.IsExistContent = function(strContentId) {
var isExisted = false;
var contentType = '';
var result = [];
......@@ -902,10 +875,10 @@ function IsExistContent(strContentId) {
result["contentType"] = contentType;
// save content type
contentTypes[strContentId] = contentType;
contentName[strContentId] = data.contentData.contentName;
BOOKMARK.contentTypes[strContentId] = contentType;
BOOKMARK.contentName[strContentId] = data.contentData.contentName;
// save alert message level
messageLevel[strContentId] = { alertMessageLevel: data.contentData.alertMessageLevel, alertMessage: data.contentData.alertMessage };
LIMIT_ACCESS_CONTENT.messageLevel[strContentId] = { alertMessageLevel: data.contentData.alertMessageLevel, alertMessage: data.contentData.alertMessage };
},
function (xmlHttpRequest, txtStatus, errorThrown) {
......@@ -927,14 +900,3 @@ function IsExistContent(strContentId) {
Setting dialog [ end ]
----------------------------------------------------------------------------
*/
//function truncate(strInput, length){
// if (strInput.length <= length)
// {
// return strInput;
// }
// else
// {
// return strInput.substring(0, length) + "...";
// }
//};
......@@ -260,7 +260,7 @@ CONTENTSEARCH.renderContent = function(id, text, division, type, order, from, to
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type to array to manage.
// save alert message level
messageLevel[post.contentId] = { alertMessageLevel:post.alertMessageLevel, alertMessage:post.alertMessage};
LIMIT_ACCESS_CONTENT.messageLevel[post.contentId] = { alertMessageLevel:post.alertMessageLevel, alertMessage:post.alertMessage};
//Check if user has read this content or not.
CONTENTSEARCH.checkUserHasReadContent(post.contentId, post.resourceVersion, post.metaVersion);
......@@ -304,7 +304,7 @@ CONTENTSEARCH.renderContent = function(id, text, division, type, order, from, to
//Toggle scroll to top Control
CONTENTSEARCH.handleBackToTop();
//changeLanguage(ClientData.userInfo_language());
//I18N.changeLanguage(ClientData.userInfo_language());
I18N.i18nReplaceText();
});
};
......@@ -335,7 +335,7 @@ CONTENTSEARCH.handleBackToTop = function(){
//Handle language
CONTENTSEARCH.handleLanguage = function(){
if (getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko)
if (I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko)
{
$('#control-sort-titlekana').css('display','none');
$('#separate').css('display','none');
......@@ -738,7 +738,7 @@ CONTENTSEARCH.readSubmenuFunction = function(e){
}
var contentId = $(this).attr('contentid');
// check limit of content
checkLimitContent(contentId,
LIMIT_ACCESS_CONTENT.checkLimitContent(contentId,
function()
{
CONTENTSEARCH.readSubmenuFunction_callback(contentId);
......@@ -1286,7 +1286,7 @@ CONTENTSEARCH.refreshGrid = function(){
//format text display more record
CONTENTSEARCH.formatDisplayMoreRecord = function(){
I18N.i18nReplaceText();
//changeLanguage(ClientData.userInfo_language());
//I18N.changeLanguage(ClientData.userInfo_language());
$('#control-nextrecord').html(AVWEB.format(I18N.i18nText('dspViewMore'), CONTENTSEARCH.returnNumberDispRecordForList()));
};
......@@ -1321,7 +1321,7 @@ CONTENTSEARCH.displayResultNoRecord = function(){
$('#control-nextrecord').css('visibility','hidden');
$('.control_sort_on').hide();
$('.control_sort_off').show();
if(getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko){
if(I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko){
/*$('#control-sort-titlekana').hide();*/
$('#separate').hide();
$('#control-sort-titlekana').hide();
......@@ -1331,7 +1331,7 @@ CONTENTSEARCH.displayResultNoRecord = function(){
CONTENTSEARCH.enableSort = function(){
$('.control_sort_on').show();
$('.control_sort_off').hide();
if(getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko){
if(I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko){
$('#control-sort-titlekana').hide();
$('#separate').hide();
}
......@@ -1373,7 +1373,7 @@ CONTENTSEARCH.showContentShareDlgFunction = function(e) {
var contentId = $(this).attr('contentid');
// check limit of content
checkLimitContent(contentId,
LIMIT_ACCESS_CONTENT.checkLimitContent(contentId,
function()
{
SHARE.contentId = contentId;
......
......@@ -130,7 +130,7 @@ Event groups [start]
DETAIL.contentdetail_dspRead_Click = function(e) {
e.preventDefault();
var outputId = ClientData.contentInfo_contentId();
checkLimitContent(outputId,
LIMIT_ACCESS_CONTENT.checkLimitContent(outputId,
function () {
DETAIL.contentdetail_dspRead_Click_callback(outputId);
},
......
......@@ -274,7 +274,7 @@ HEADER.homeClickFunction = function(){
//Change Language Japanese function
HEADER.changeLanguageJa = function(){
changeLanguage(COMMON.Consts.ConstLanguage_Ja);
I18N.changeLanguage(COMMON.Consts.ConstLanguage_Ja);
//ClientData.userInfo_language(COMMON.Consts.ConstLanguage_Ja);
//$('#control-sort-titlekana').css('display','inline-block');
//$('#separate').css('display','inline-block');
......@@ -287,7 +287,7 @@ HEADER.changeLanguageJa = function(){
//Change Language English functions
HEADER.changeLanguageEn = function(){
changeLanguage(COMMON.Consts.ConstLanguage_En);
I18N.changeLanguage(COMMON.Consts.ConstLanguage_En);
//ClientData.userInfo_language(COMMON.Consts.ConstLanguage_En);
//$('#control-sort-titlekana').css('display','none');
//$('#separate').css('display','none');
......@@ -300,7 +300,7 @@ HEADER.changeLanguageEn = function(){
//Change Language English function
HEADER.changeLanguageKo = function(){
changeLanguage(COMMON.Consts.ConstLanguage_Ko);
I18N.changeLanguage(COMMON.Consts.ConstLanguage_Ko);
//ClientData.userInfo_language(COMMON.Consts.ConstLanguage_Ko);
//$('#control-sort-titlekana').css('display','none');
//$('#separate').css('display','none');
......
......@@ -187,7 +187,7 @@ HISTORY.renderContent = function(id, text, division, type, order, from, to, cate
var viewdate = HISTORY.renderViewDate(post.contentId);
// save alert message level
messageLevel[post.contentId] = { alertMessageLevel:post.alertMessageLevel, alertMessage:post.alertMessage};
LIMIT_ACCESS_CONTENT.messageLevel[post.contentId] = { alertMessageLevel:post.alertMessageLevel, alertMessage:post.alertMessage};
if (viewdate != null && viewdate != 'undefined' && viewdate != '') {
......@@ -241,7 +241,7 @@ HISTORY.renderContent = function(id, text, division, type, order, from, to, cate
HISTORY.handleLanguage = function(){
//if(ClientData.userInfo_language() == COMMON.Consts.ConstLanguage_En || ClientData.userInfo_language() == COMMON.Consts.ConstLanguage_Ko)
if (getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko)
if (I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko)
{
$('#control-sort-titlekana').css('display','none');
$('#control-sort-titlekana-off').css('display','none');
......@@ -591,7 +591,7 @@ HISTORY.readSubmenuFunction = function(e){
var contentId = $(this).attr('contentid');
// check limit of content
checkLimitContent(contentId,
LIMIT_ACCESS_CONTENT.checkLimitContent(contentId,
function()
{
HISTORY.readSubmenuFunction_callback(contentId);
......@@ -1478,7 +1478,7 @@ HISTORY.showContentShareDlgFunction = function(e) {
var contentId = $(this).attr('contentid');
// check limit of content
checkLimitContent(contentId,
LIMIT_ACCESS_CONTENT.checkLimitContent(contentId,
function()
{
SHARE.contentId = contentId;
......
......@@ -459,7 +459,7 @@ HOME.canvasClickFunction = function(e) {
var contentId = $(this).attr('id');
var outputId = contentId.substring(17);
checkLimitContent(outputId,
LIMIT_ACCESS_CONTENT.checkLimitContent(outputId,
function(){
HOME.canvasClickFunction_callback(outputId);
},
......@@ -1213,7 +1213,7 @@ HOME.readSubmenuFunction = function(e) {
var contentId = $(this).attr('contentid');
// check limit of content
checkLimitContent(contentId,
LIMIT_ACCESS_CONTENT.checkLimitContent(contentId,
function()
{
HOME.readSubmenuFunction_callback(contentId);
......@@ -1553,7 +1553,7 @@ HOME.sortByReleaseDateFunction = function() {
//Handle language
HOME.handleLanguage = function() {
if (getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko) {
if (I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko) {
$('#control-sort-titlekana').css('display', 'none');
$('#separate').css('display', 'none');
$('#titlekana-sorttype').html('');
......@@ -1675,7 +1675,7 @@ HOME.renderContent = function(id, text, division, type, order, from, to, cateid,
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type to array to manage.
// save alert message level
messageLevel[post.contentId] = { alertMessageLevel:post.alertMessageLevel, alertMessage:post.alertMessage};
LIMIT_ACCESS_CONTENT.messageLevel[post.contentId] = { alertMessageLevel:post.alertMessageLevel, alertMessage:post.alertMessage};
//Check if user has read this content or not.
HOME.checkUserHasReadContent(post.contentId, post.resourceVersion, post.metaVersion);
......@@ -1721,7 +1721,7 @@ HOME.renderContent = function(id, text, division, type, order, from, to, cateid,
//Toggle scroll to top Control
HOME.handleBackToTop();
//changeLanguage(ClientData.userInfo_language());
//I18N.changeLanguage(ClientData.userInfo_language());
I18N.i18nReplaceText();
});
};
......@@ -2157,7 +2157,7 @@ HOME.refreshGrid = function() {
//format text display more record
HOME.formatDisplayMoreRecord = function() {
//changeLanguage(ClientData.userInfo_language());
//I18N.changeLanguage(ClientData.userInfo_language());
I18N.i18nReplaceText();
if (HOME.isShowBookShelf) {
......@@ -2560,7 +2560,7 @@ HOME.showContentShareDlgFunction = function(e) {
var contentId = $(this).attr('contentid');
// check limit of content
checkLimitContent(contentId,
LIMIT_ACCESS_CONTENT.checkLimitContent(contentId,
function()
{
SHARE.contentId = contentId;
......
......@@ -40,7 +40,7 @@ LOGIN.initialScreen = function() {
//check Save Login Info
LOGIN.saveLoginInfo = function() {
var lang = getCurrentLanguage();
var lang = I18N.getCurrentLanguage();
//clear session of old user
//SessionStorageUtils.clear();
......@@ -49,7 +49,7 @@ LOGIN.saveLoginInfo = function() {
//AVWEB.avwCreateUserSession();
// load language
changeLanguage(lang);
I18N.changeLanguage(lang);
// Set flag コンテンツデータチェックフラグ = true to sync local with server
ClientData.common_contentDataChkFlg(true);
......@@ -377,7 +377,7 @@ LOGIN.changePasswordProcess = function(){
//Change Language Japanese
LOGIN.changeLanguageJa = function(){
changeLanguage(COMMON.Consts.ConstLanguage_Ja);
I18N.changeLanguage(COMMON.Consts.ConstLanguage_Ja);
document.title = I18N.i18nText('dspLogin') + ' | ' + I18N.i18nText('sysAppTitle');
//ClientData.userInfo_language(COMMON.Consts.ConstLanguage_Ja);
if (LOGIN.login_errorMessage != ""){
......@@ -387,7 +387,7 @@ LOGIN.changeLanguageJa = function(){
//Change Language Korean
LOGIN.changeLanguageKo = function(){
changeLanguage(COMMON.Consts.ConstLanguage_Ko);
I18N.changeLanguage(COMMON.Consts.ConstLanguage_Ko);
document.title = I18N.i18nText('dspLogin') + ' | ' + I18N.i18nText('sysAppTitle');
//ClientData.userInfo_language(COMMON.Consts.ConstLanguage_Ko);
if (LOGIN.login_errorMessage != ""){
......@@ -397,7 +397,7 @@ LOGIN.changeLanguageKo = function(){
//Change Language English
LOGIN.changeLanguageEn = function(){
changeLanguage(COMMON.Consts.ConstLanguage_En);
I18N.changeLanguage(COMMON.Consts.ConstLanguage_En);
document.title = I18N.i18nText('dspLogin') + ' | ' + I18N.i18nText('sysAppTitle');
//ClientData.userInfo_language(COMMON.Consts.ConstLanguage_En);
if (LOGIN.login_errorMessage != ""){
......@@ -851,10 +851,10 @@ LOGIN.showContentViewByOpenUrl = function(strContentId) {
//Go to Conten view page
//アラート表示組み込めるか
messageLevel[data.contentData.contentId] = { alertMessageLevel:data.contentData.alertMessageLevel, alertMessage:data.contentData.alertMessage};
LIMIT_ACCESS_CONTENT.messageLevel[data.contentData.contentId] = { alertMessageLevel:data.contentData.alertMessageLevel, alertMessage:data.contentData.alertMessage};
// check limit of content
checkLimitContent(
LIMIT_ACCESS_CONTENT.checkLimitContent(
data.contentData.contentId,
function()
{
......
......@@ -15,27 +15,27 @@ $(document).ready(function () {
// Set bookmark screen
ClientData.BookmarkScreen(COMMON.ScreenIds.Setting);
InitScreen();
SETTINGS.initScreen();
$("#dspSave").click(dspSave_Click);
$("#dspSave").click(SETTINGS.dspSave_Click);
$("#dspPwdUpd").click(dspPwdUpd_Click);
$("#dspPwdUpd").click(SETTINGS.dspPwdUpd_Click);
$("#dspOptReset").click(dspOptReset_Click);
$("#dspOptReset").click(SETTINGS.dspOptReset_Click);
$("#dspOptBk").click(dspOptBk_Click);
$("#dspOptBk").click(SETTINGS.dspOptBk_Click);
$("#dspOptRes").click(dspOptRes_Click);
$("#dspOptRes").click(SETTINGS.dspOptRes_Click);
$("#dspPwdUpd1").click(dspPwdUpd1_Click);
$("#dspSkip").click(dspSkip_Click);
$("#dspCancel").click(dspCancel_Click);
$("#dspPwdUpd1").click(SETTINGS.dspPwdUpd1_Click);
$("#dspSkip").click(SETTINGS.dspSkip_Click);
$("#dspCancel").click(SETTINGS.dspCancel_Click);
$("#dspOptRes_OK").click(dspOptRes_OK_Click);
$("#dspOptRes_Cancel").click(dspOptRes_Cancel_Click);
$("#dspOptRes_OK").click(SETTINGS.dspOptRes_OK_Click);
$("#dspOptRes_Cancel").click(SETTINGS.dspOptRes_Cancel_Click);
$("#dspOptBk_OK").click(dspOptBk_OK_Click);
$("#dspOptBk_Cancel").click(dspOptBk_Cancel_Click);
$("#dspOptBk_OK").click(SETTINGS.dspOptBk_OK_Click);
$("#dspOptBk_Cancel").click(SETTINGS.dspOptBk_Cancel_Click);
// Check to hide/show backup button
if (ClientData.isChangedBookmark() == true
......@@ -53,7 +53,7 @@ $(document).ready(function () {
// Get flag to determine must change password
AVWEB.avwCmsApi(ClientData.userInfo_accountPath(), "requirePasswordChange", 'GET', { sid: ClientData.userInfo_sid() },
avwCmsApi_requirePasswordChange_success,
SETTINGS.avwCmsApi_requirePasswordChange_success,
null
);
......@@ -72,9 +72,9 @@ $(document).ready(function () {
// check show restore button No.17
var isExistMarking = IsExistBackupFile('Marking.json', 2);
var isExistContentMemo = IsExistBackupFile('ContentMemo.json', 1);
var isExistBookmark = IsExistBackupFile('Bookmark.json', 4);
var isExistMarking = SETTINGS.IsExistBackupFile('Marking.json', 2);
var isExistContentMemo = SETTINGS.IsExistBackupFile('ContentMemo.json', 1);
var isExistBookmark = SETTINGS.IsExistBackupFile('Bookmark.json', 4);
if (isExistMarking || isExistContentMemo || isExistBookmark) {
$("#dspOptRes").css('visibility', '');
......@@ -122,7 +122,7 @@ function changeLanguageCallBackFunction() {
Check backup file exists or not for No.17
*/
function IsExistBackupFile(file,type) {
SETTINGS.IsExistBackupFile = function(file,type) {
var isExisted = false;
var params = { "sid": ClientData.userInfo_sid(), "filename": file, fileType: type }; //, deviceType: '4'
// Get list of files
......@@ -144,7 +144,7 @@ function IsExistBackupFile(file,type) {
};
// Event success
function avwCmsApi_requirePasswordChange_success(data) {
SETTINGS.avwCmsApi_requirePasswordChange_success = function(data) {
ClientData.requirePasswordChange(0);
if (data.requirePasswordChange == 1) {
......@@ -165,7 +165,7 @@ function avwCmsApi_requirePasswordChange_success(data) {
}
else if (numDay > 30) {
// Show dialog to change password
OpenChangePassword();
SETTINGS.openChangePassword();
$("#dspSkip").show();
$("#dspCancel").hide();
......@@ -174,7 +174,7 @@ function avwCmsApi_requirePasswordChange_success(data) {
else {
//alert('pwdSkipDt=null');
OpenChangePassword();
SETTINGS.openChangePassword();
$("#dspSkip").show();
$("#dspCancel").hide();
......@@ -182,7 +182,7 @@ function avwCmsApi_requirePasswordChange_success(data) {
}
else if (ClientData.serviceOpt_force_pw_change_on_login() == 2) { // Force to change password
ClientData.requirePasswordChange(1);
OpenChangePassword();
SETTINGS.openChangePassword();
$("#dspSkip").hide();
$("#dspCancel").hide();
......@@ -212,7 +212,7 @@ function avwCmsApi_requirePasswordChange_success(data) {
}
else if (numDay > 30) {
// Show dialog to change password
OpenChangePassword();
SETTINGS.openChangePassword();
$("#dspSkip").show();
$("#dspCancel").hide();
......@@ -221,7 +221,7 @@ function avwCmsApi_requirePasswordChange_success(data) {
else {
//alert('pwdSkipDt=null');
OpenChangePassword();
SETTINGS.openChangePassword();
$("#dspSkip").show();
$("#dspCancel").hide();
......@@ -231,7 +231,7 @@ function avwCmsApi_requirePasswordChange_success(data) {
}
else if (ClientData.serviceOpt_force_pw_change_periodically() == 2) { // Force to change password
ClientData.requirePasswordChange(1);
OpenChangePassword();
SETTINGS.openChangePassword();
$("#dspSkip").hide();
$("#dspCancel").hide();
......@@ -251,7 +251,7 @@ Event groups [start]
*/
// OK for backup
function dspOptBk_OK_Click(e) {
SETTINGS.dspOptBk_OK_Click = function(e) {
e.preventDefault();
// check button is disabled
......@@ -262,23 +262,6 @@ function dspOptBk_OK_Click(e) {
// Process backup here
// ----------------------------
// Bakup memo/marking/bookmark
// var params = [
// { name: 'sid', content: ClientData.userInfo_sid() },
// { name: 'deviceType', content: '4' },
// { name: 'formFile', content: JSON.stringify(buildBackupData()), fileName: 'webBackupData.json', contentType: 'text-plain' }
// ];
// AVWEB.avwUploadBackupFile(ClientData.userInfo_accountPath(), params, false, avwCmsApi_uploadBackupFile_success,
// function (a, b, c) {
// // Show error message: msgBackupFailed
// $().toastmessage({ position: 'middle-center' });
// $().toastmessage('showToast', {
// type: 'error',
// sticky: true,
// text: I18N.i18nText('msgBackupFailed')
// });
// });
// backup data for No.17
var isBackupMarking = $('#chkopBkMarking').attr('checked') == 'checked';
......@@ -287,7 +270,7 @@ function dspOptBk_OK_Click(e) {
if (!isBackupMarking && !isBackupMemo && !isBackupBookmark)
{
closeBackup();
SETTINGS.closeBackup();
return;
}
......@@ -296,7 +279,7 @@ function dspOptBk_OK_Click(e) {
function () {
// Check to hide/show backup button
setStatusButtonBackup();
SETTINGS.setStatusButtonBackup();
// update check box restore
if (isBackupMarking && !ClientData.isChangedMarkingData()) {
......@@ -309,13 +292,13 @@ function dspOptBk_OK_Click(e) {
$('#chkopResShiori').removeAttr('disabled');
}
closeBackup();
SETTINGS.closeBackup();
});
};
// set status button backup and checkbox option
function setStatusButtonBackup() {
SETTINGS.setStatusButtonBackup = function() {
if (ClientData.isChangedBookmark() == true || ClientData.isChangedMarkingData() == true || ClientData.isChangedMemo() == true) {
if (ClientData.isChangedBookmark() != true) {
......@@ -335,69 +318,23 @@ function setStatusButtonBackup() {
}
};
//function avwCmsApi_uploadBackupFile_success(data) {
// if (JSON.parse(data).result == "success") {
// ClientData.isChangedBookmark(false);
// ClientData.isChangedMarkingData(false);
// ClientData.isChangedMemo(false);
// $("#dspOptBk").hide();
// $("#dspOptRes").css('visibility', '');
// // Show message: msgBackupSuccess
// $().toastmessage({ position: 'middle-center' });
// $().toastmessage('showToast', {
// type: 'success',
// sticky: true,
// text: I18N.i18nText('msgBackupSuccess')
// });
// }
// else {
// // Show error message: msgBackupFailed
// $().toastmessage({ position: 'middle-center' });
// $().toastmessage('showToast', {
// type: 'error',
// sticky: true,
// text: I18N.i18nText('msgBackupFailed')
// });
// }
//};
// Cancel for backup
function dspOptBk_Cancel_Click(e) {
SETTINGS.dspOptBk_Cancel_Click = function(e) {
e.preventDefault();
closeBackup(true);
SETTINGS.closeBackup(true);
};
// OK for restore
function dspOptRes_OK_Click(e) {
SETTINGS.dspOptRes_OK_Click = function(e) {
e.preventDefault();
// ----------------------------
// Process restore
// ----------------------------
// check button is disabled
if ($(this).hasClass('disabled'))
if ($(this).hasClass('disabled')){
return;
// Get list of files
// AVWEB.avwCmsApi(ClientData.userInfo_accountPath(), "getBackupFile", "post",
// { sid: ClientData.userInfo_sid(), deviceType: '4', filename: "webBackupData.json" },
// avwCmsApi_getBackupFile_success,
// function (xhr, b, c) {
// if (xhr.status != 0) {
// // Show error message
// $().toastmessage({ position: 'middle-center' });
// $().toastmessage('showToast', {
// type: 'error',
// sticky: true,
// text: I18N.i18nText('msgRestoreFailed')
// });
// }
// else {
// AVWEB.showSystemError();
// }
// }
// );
}
// Restore data for No.17
......@@ -405,7 +342,7 @@ function dspOptRes_OK_Click(e) {
var isRestoreMemo = $('#chkopResMemo').attr('checked') == 'checked';
var isRestoreBookmark = $('#chkopResShiori').attr('checked') == 'checked';
if (!isRestoreMarking && !isRestoreMemo && !isRestoreBookmark) {
closeRestore();
SETTINGS.closeRestore();
return;
}
......@@ -423,7 +360,7 @@ function dspOptRes_OK_Click(e) {
if (isRestoreMarking) {
// restore Marking Data
var res = restoreMarkingData();
var res = SETTINGS.restoreMarkingData();
if (!res) {
$('#divResultMessage').append("<div class='toast-item-image-error toast-item-message'>" + I18N.i18nText('txtBkMarking') + " " + I18N.i18nText('msgRestoreFailed') + "</div>");
}
......@@ -434,7 +371,7 @@ function dspOptRes_OK_Click(e) {
if (isRestoreMemo) {
// restore Memo data
var res = restoreMemoData();
var res = SETTINGS.restoreMemoData();
if (!res) {
$('#divResultMessage').append("<div class='toast-item-image-error toast-item-message'>" + I18N.i18nText('txtBkMemo') + " " + I18N.i18nText('msgRestoreFailed') + "</div>");
}
......@@ -445,7 +382,7 @@ function dspOptRes_OK_Click(e) {
if (isRestoreBookmark) {
// restore Bookmark data
var res = restoreBookmarkData();
var res = SETTINGS.restoreBookmarkData();
if (!res) {
$('#divResultMessage').append("<div class='toast-item-image-error toast-item-message'>" + I18N.i18nText('txtBkShiori') + " " + I18N.i18nText('msgRestoreFailed') + "</div>");
}
......@@ -455,7 +392,7 @@ function dspOptRes_OK_Click(e) {
}
// set status button backup
//setStatusButtonBackup();
//SETTINGS.setStatusButtonBackup();
// show message result restore
......@@ -466,32 +403,13 @@ function dspOptRes_OK_Click(e) {
$('.toast-item-close').click(function () { $().toastmessage('removeToast', $('#divResultMessage'), null) });
}, 1000);
closeRestore();
SETTINGS.closeRestore();
};
//function avwCmsApi_getBackupFile_success(data) {
// if (data) {
// restoreData(data);
// ClientData.isChangedBookmark(false);
// ClientData.isChangedMarkingData(false);
// ClientData.isChangedMemo(false);
// $("#dspOptBk").hide();
// // Show message: msgRestoreSuccess
// $().toastmessage({ position: 'middle-center' });
// $().toastmessage('showToast', {
// type: 'success',
// sticky: true,
// text: I18N.i18nText('msgRestoreSuccess')
// });
// }
//};
// Restore data for No.17
/*
* Call api to restore bookmark data
*/
function restoreBookmarkData()
SETTINGS.restoreBookmarkData = function()
{
var result = false;
AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "getBackupFile", "post",
......@@ -513,7 +431,7 @@ function restoreBookmarkData()
/*
* Call api to restore memo data
*/
function restoreMemoData() {
SETTINGS.restoreMemoData = function() {
var result = false;
AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "getBackupFile", "post",
{ sid: ClientData.userInfo_sid(), filename: "ContentMemo.json" }, //deviceType: '4',
......@@ -534,7 +452,7 @@ function restoreMemoData() {
/*
* Call api to restore marking data
*/
function restoreMarkingData()
SETTINGS.restoreMarkingData = function()
{
var result = false;
AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "getBackupFile", "post",
......@@ -555,21 +473,21 @@ function restoreMarkingData()
// Cancel for restore
function dspOptRes_Cancel_Click(e) {
SETTINGS.dspOptRes_Cancel_Click = function(e) {
e.preventDefault();
closeRestore(true);
SETTINGS.closeRestore(true);
};
// Cancel to change password
function dspCancel_Click(e) {
SETTINGS.dspCancel_Click = function(e) {
e.preventDefault();
var msgError = $('#dialog-error-message');
msgError.html('');
closeChangePassword(true);
SETTINGS.closeChangePassword(true);
};
// Save setting
function dspSave_Click(e) {
SETTINGS.dspSave_Click = function(e) {
e.preventDefault();
// 最初の画面を選択
......@@ -663,16 +581,16 @@ function dspSave_Click(e) {
};
// Skip to change password
function dspSkip_Click(e) {
SETTINGS.dspSkip_Click = function(e) {
e.preventDefault();
var msgError = $('#dialog-error-message');
msgError.html('');
// Update パスワードスキップ日時
ClientData.userInfo_pwdSkipDt(new Date());
closeChangePassword();
SETTINGS.closeChangePassword();
};
function OpenChangePassword() {
SETTINGS.openChangePassword = function() {
//$("#dlgChangePassword").dialog("open");
//$(".ui-dialog-titlebar").hide();
......@@ -687,14 +605,14 @@ function OpenChangePassword() {
};
function closeChangePassword(skip) {
SETTINGS.closeChangePassword = function(skip) {
//$("#dlgChangePassword").dialog("close");
$("#dlgChangePassword").hide();
COMMON.unlockLayout();
};
// Want to change password
function dspPwdUpd_Click(e) {
SETTINGS.dspPwdUpd_Click = function(e) {
e.preventDefault();
$("#dspCancel").show();
$("#dspSkip").hide();
......@@ -702,11 +620,11 @@ function dspPwdUpd_Click(e) {
//$("#dspPwdUpd1").css('margin', '-27px 97px 0 0');
// Show dialog
OpenChangePassword();
SETTINGS.openChangePassword();
};
// Reset setting
function dspOptReset_Click(e) {
SETTINGS.dspOptReset_Click = function(e) {
e.preventDefault();
// 最初の画面を選択
......@@ -735,7 +653,7 @@ function dspOptReset_Click(e) {
};
// Backup
function dspOptBk_Click(e) {
SETTINGS.dspOptBk_Click = function(e) {
e.preventDefault();
// set options backup No.17
......@@ -787,61 +705,36 @@ function dspOptBk_Click(e) {
HEADER.setDisabledButton('#dlgConfirmBackup .option_backup input', '#dspOptBk_OK');
openBackup();
SETTINGS.openBackup();
};
// Restore
function dspOptRes_Click(e) {
SETTINGS.dspOptRes_Click = function(e) {
e.preventDefault();
openRestore();
SETTINGS.openRestore();
};
// Process changing password
function dspPwdUpd1_Click(e) {
SETTINGS.dspPwdUpd1_Click = function(e) {
e.preventDefault();
var isOK = true;
var msgError = $('#dialog-error-message');
// Check validation
if (!ValidationUtil.CheckRequiredForText(getCurrentPassword())) {
if (!ValidationUtil.CheckRequiredForText(SETTINGS.getCurrentPassword())) {
isOK = false;
//alert(I18N.i18nText('msgPwdEmpty'));
/* show error messages */
// $().toastmessage({ position: 'middle-center' });
// $().toastmessage('showToast', {
// type: 'error',
// sticky: true,
// text: I18N.i18nText('msgPwdEmpty')
//});
msgError.html(I18N.i18nText('msgPwdEmpty'));
msgError.show();
}
else {
if (!ValidationUtil.CheckRequiredForText(getNewPassword())) {
if (!ValidationUtil.CheckRequiredForText(SETTINGS.getNewPassword())) {
isOK = false;
//alert(I18N.i18nText('msgPwdEmpty'));
/* show error messages */
//$().toastmessage({ position: 'middle-center' });
// $().toastmessage('showToast', {
// type: 'error',
// sticky: true,
// text: I18N.i18nText('msgPwdEmpty')
//});
msgError.html(I18N.i18nText('msgPwdEmpty'));
msgError.show();
}
else {
if (getNewPassword() != getNewPasswordRe()) {
if (SETTINGS.getNewPassword() != SETTINGS.getNewPasswordRe()) {
isOK = false;
//alert(I18N.i18nText('msgPwdNotMatch'));
/* show error messages */
//$().toastmessage({ position: 'middle-center' });
// $().toastmessage('showToast', {
// type: 'error',
// sticky: true,
// text: I18N.i18nText('msgPwdNotMatch')
// });
msgError.html(I18N.i18nText('msgPwdNotMatch'));
msgError.show();
}
......@@ -852,30 +745,26 @@ function dspPwdUpd1_Click(e) {
if (isOK) {
// Check max length
if (!ValidationUtil.CheckMaxLengthForByte(getCurrentPassword(), 16)) {
if (!ValidationUtil.CheckMaxLengthForByte(SETTINGS.getCurrentPassword(), 16)) {
isOK = false;
}
if (!ValidationUtil.CheckMaxLengthForByte(getNewPassword(), 16)) {
if (!ValidationUtil.CheckMaxLengthForByte(SETTINGS.getNewPassword(), 16)) {
isOK = false;
}
if (!ValidationUtil.CheckMaxLengthForByte(getNewPasswordRe(), 16)) {
if (!ValidationUtil.CheckMaxLengthForByte(SETTINGS.getNewPasswordRe(), 16)) {
isOK = false;
}
// Data type
if (!ValidationUtil.IsAlphabetOrNumberOrSymbol(getCurrentPassword())) {
if (!ValidationUtil.IsAlphabetOrNumberOrSymbol(SETTINGS.getCurrentPassword())) {
isOK = false;
}
if (!ValidationUtil.IsAlphabetOrNumberOrSymbol(getNewPassword())) {
if (!ValidationUtil.IsAlphabetOrNumberOrSymbol(SETTINGS.getNewPassword())) {
isOK = false;
}
if (!ValidationUtil.IsAlphabetOrNumberOrSymbol(getNewPasswordRe())) {
if (!ValidationUtil.IsAlphabetOrNumberOrSymbol(SETTINGS.getNewPasswordRe())) {
isOK = false;
}
var str = getCurrentPassword() + "";
// if (str.contains("_") || str.contains("‐")) {
// isOK = false;
// }
var str = SETTINGS.getCurrentPassword() + "";
}
......@@ -883,44 +772,35 @@ function dspPwdUpd1_Click(e) {
var params = {
sid: ClientData.userInfo_sid(),
loginId: ClientData.userInfo_loginId_session(),
password: getCurrentPassword(),
newPassword: getNewPassword(),
password: SETTINGS.getCurrentPassword(),
newPassword: SETTINGS.getNewPassword(),
appId: 4
};
if (isOK) {
AVWEB.avwCmsApi(ClientData.userInfo_accountPath(), "passwordChange", "GET", params,
avwCmsApi_passwordChange_success,
avwCmsApi_passwordChange_fail);
SETTINGS.avwCmsApi_passwordChange_success,
SETTINGS.avwCmsApi_passwordChange_fail);
}
else {
//alert('error');
}
};
function avwCmsApi_passwordChange_success(data) {
SETTINGS.avwCmsApi_passwordChange_success = function(data) {
// OK
var msgError = $('#dialog-error-message');
if (data.result != undefined && data.result != null) {
if (data.result != COMMON.Consts.ConstAPI_SUCCESS) {
/* show error messages */
//$().toastmessage({ position: 'middle-center' });
//$().toastmessage('showToast', {
// type: 'error',
// sticky: true,
// text: I18N.i18nText('msgPwdChangeNG')
//});
//alert(I18N.i18nText('msgPwdOldWrong'));
msgError.html(I18N.i18nText('msgPwdChangeNG'));
msgError.show();
}
else {
ClientData.requirePasswordChange(0);
msgError.html('');
closeChangePassword();
SETTINGS.closeChangePassword();
/* show messages */
$().toastmessage({ position: 'middle-center' });
$().toastmessage('showToast', {
......@@ -931,7 +811,7 @@ function avwCmsApi_passwordChange_success(data) {
}
}
};
function avwCmsApi_passwordChange_fail(xhr, b, c) {
SETTINGS.avwCmsApi_passwordChange_fail = function(xhr, b, c) {
if (xhr.responseText && xhr.status != 0) {
/* show error messages */
var msgError = $('#dialog-error-message');
......@@ -961,40 +841,9 @@ $(function () {
$('#dlgChangePassword').hide();
$('#dlgConfirmBackup').hide();
$('#dlgConfirmRestore').hide();
// $('#dlgChangePassword').dialog({
// autoOpen: false,
// title: 'Change password',
// modal: true,
// resizable: false,
// width: 550,
// height: 400
// });
// $('#dlgConfirmBackup').dialog({
// autoOpen: false,
// title: 'Backup',
// modal: true,
// resizable: false,
// width: 550,
// height: 400
// });
// $('#dlgConfirmRestore').dialog({
// autoOpen: false,
// title: 'Restore',
// modal: true,
// resizable: false,
// width: 550,
// height: 450
// });
// LockScreen();
});
function openBackup() {
//$("#dlgConfirmBackup").dialog("open");
//$(".ui-dialog-titlebar").hide();
SETTINGS.openBackup = function() {
COMMON.lockLayout();
$("#dlgConfirmBackup").show();
......@@ -1002,7 +851,7 @@ function openBackup() {
};
function closeBackup(cancel) {
SETTINGS.closeBackup = function(cancel) {
if (cancel != undefined || cancel == true) {
//alert('you cancelled');
}
......@@ -1011,19 +860,14 @@ function closeBackup(cancel) {
COMMON.unlockLayout();
};
function openRestore() {
//$("#dlgConfirmRestore").dialog("open");
//$(".ui-dialog-titlebar").hide();
SETTINGS.openRestore = function() {
// check avaliable restore no.17
COMMON.lockLayout();
$("#dlgConfirmRestore").show();
$("#dlgConfirmRestore").center();
};
function closeRestore(cancel) {
SETTINGS.closeRestore = function(cancel) {
if (cancel != undefined || cancel == true) {
//alert('you cancelled');
}
......@@ -1033,20 +877,20 @@ function closeRestore(cancel) {
};
// Get input current password
function getCurrentPassword() {
SETTINGS.getCurrentPassword = function() {
return $("#txtPwdCur").val();
};
// Get input new password
function getNewPassword() {
SETTINGS.getNewPassword = function() {
return $("#txtPwdNew").val();
};
// Get input new password
function getNewPasswordRe() {
SETTINGS.getNewPasswordRe = function() {
return $("#txtPwdNewRe").val();
};
// Initalize screen
function InitScreen() {
SETTINGS.initScreen = function() {
// ログインID
$("#txtLoginId").text(ClientData.userInfo_loginId_session());
......@@ -1146,12 +990,12 @@ function InitScreen() {
max: 9.9,
step: 0.1,
value: $('#txtValueAnimation').val(),
slide: doChangeAnimationSlidebar
slide: SETTINGS.doChangeAnimationSlidebar
}
);
};
function doChangeAnimationSlidebar(e,obj) {
SETTINGS.doChangeAnimationSlidebar = function(e,obj) {
$('#txtValueAnimation').val(obj.value);
};
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