Commit 875a5fdc by Masaru Abe

パフォーマンス対応

parent 8cf3f138
...@@ -3029,12 +3029,13 @@ COMMON.setResourceVersionData = function(conId) { ...@@ -3029,12 +3029,13 @@ COMMON.setResourceVersionData = function(conId) {
//check if insert new or edit //check if insert new or edit
var flag = false; var flag = false;
if (ClientData.ResourceVersion().length <= 0 || ClientData.ResourceVersion() == null || ClientData.ResourceVersion() == 'undefined') { //if (ClientData.ResourceVersion().length <= 0 || ClientData.ResourceVersion() == null || ClientData.ResourceVersion() == 'undefined') {
tempResourceArr = []; // tempResourceArr = [];
} //}
else { //else {
// tempResourceArr = ClientData.ResourceVersion();
//}
tempResourceArr = ClientData.ResourceVersion(); tempResourceArr = ClientData.ResourceVersion();
}
for (var i = 0; i < COMMON.resourceVersionArr.length; i++) { for (var i = 0; i < COMMON.resourceVersionArr.length; i++) {
if (COMMON.resourceVersionArr[i].contentid == conId) { if (COMMON.resourceVersionArr[i].contentid == conId) {
...@@ -3050,9 +3051,9 @@ COMMON.setResourceVersionData = function(conId) { ...@@ -3050,9 +3051,9 @@ COMMON.setResourceVersionData = function(conId) {
flag = true; flag = true;
break; break;
} }
else { //else {
flag = false; // flag = false;
} //}
} }
if (!flag) { if (!flag) {
...@@ -3074,12 +3075,13 @@ COMMON.setMetaVersionData = function(conId) { ...@@ -3074,12 +3075,13 @@ COMMON.setMetaVersionData = function(conId) {
//check if insert new or edit //check if insert new or edit
var flag = false; var flag = false;
if (ClientData.MetaVersion().length <= 0 || ClientData.MetaVersion() == null || ClientData.MetaVersion() == 'undefined') { //if (ClientData.MetaVersion().length <= 0 || ClientData.MetaVersion() == null || ClientData.MetaVersion() == 'undefined') {
tempMetaArr = []; // tempMetaArr = [];
} //}
else { //else {
// tempMetaArr = ClientData.MetaVersion();
//}
tempMetaArr = ClientData.MetaVersion(); tempMetaArr = ClientData.MetaVersion();
}
for (var i = 0; i < COMMON.metaVersionArr.length; i++) { for (var i = 0; i < COMMON.metaVersionArr.length; i++) {
if (COMMON.metaVersionArr[i].contentid == conId) { if (COMMON.metaVersionArr[i].contentid == conId) {
...@@ -3095,9 +3097,9 @@ COMMON.setMetaVersionData = function(conId) { ...@@ -3095,9 +3097,9 @@ COMMON.setMetaVersionData = function(conId) {
flag = true; flag = true;
break; break;
} }
else { //else {
flag = false; // flag = false;
} //}
} }
if (!flag) { if (!flag) {
......
...@@ -8,21 +8,22 @@ BOOKMARK.contentName = {}; ...@@ -8,21 +8,22 @@ BOOKMARK.contentName = {};
BOOKMARK.download = {}; BOOKMARK.download = {};
BOOKMARK.pathImgContentNone = './img/page-none.png'; BOOKMARK.pathImgContentNone = './img/page-none.png';
//Contains non-exist content // Contains non-exist content
BOOKMARK.bookmark_errorContent = []; BOOKMARK.bookmark_errorContent = [];
// Contain contents // Contain contents
BOOKMARK.collection_contents = []; BOOKMARK.collection_contents = [];
//ソート条件復帰 // ソート条件復帰
BOOKMARK.searchDivision = 1; BOOKMARK.searchDivision = 1;
BOOKMARK.sortType = 2; BOOKMARK.sortType = 2;
//スクロール復帰 // スクロール復帰
BOOKMARK.scrollTop = 0; BOOKMARK.scrollTop = 0;
// Init function of page // Init function of page
$(document).ready(function () { $(document).ready(function() {
if (!AVWEB.avwCheckLogin(COMMON.ScreenIds.Login)) return; if (!AVWEB.avwCheckLogin(COMMON.ScreenIds.Login))
return;
COMMON.LockScreen(); COMMON.LockScreen();
...@@ -31,7 +32,7 @@ $(document).ready(function () { ...@@ -31,7 +32,7 @@ $(document).ready(function () {
// Set bookmark screen // Set bookmark screen
ClientData.BookmarkScreen(COMMON.ScreenIds.BookmarkList); ClientData.BookmarkScreen(COMMON.ScreenIds.BookmarkList);
//Check if Force Change password // Check if Force Change password
if (ClientData.requirePasswordChange() != 1) { if (ClientData.requirePasswordChange() != 1) {
// Synchronize bookmarks with server // Synchronize bookmarks with server
...@@ -41,53 +42,49 @@ $(document).ready(function () { ...@@ -41,53 +42,49 @@ $(document).ready(function () {
BOOKMARK.bookmark_collectAllPages(); BOOKMARK.bookmark_collectAllPages();
$("#dspDelete").click(BOOKMARK.dspDelete_Click); $("#dspDelete").click(BOOKMARK.dspDelete_Click);
$("#dspDelete1").click(BOOKMARK.dspDelete1_Click); $("#dspDelete1").click(BOOKMARK.dspDelete1_Click);
$("#dspCancel").click(BOOKMARK.dspCancel_Click); $("#dspCancel").click(BOOKMARK.dspCancel_Click);
$("#dspConfirmOK").click(BOOKMARK.dspConfirmOK_Click); $("#dspConfirmOK").click(BOOKMARK.dspConfirmOK_Click);
BOOKMARK.ClearGrid(); BOOKMARK.ClearGrid();
//if (ClientData.BookMarkData().length == 0) { // if (ClientData.BookMarkData().length == 0) {
if(BOOKMARK.collection_contents.length == 0){ if (BOOKMARK.collection_contents.length == 0) {
// Show error // Show error
$("#msgShioriNotExists").show(); $("#msgShioriNotExists").show();
$("#dspDelete").hide(); $("#dspDelete").hide();
$("#dspDelete1").hide(); $("#dspDelete1").hide();
} } else {
else {
$("#msgShioriNotExists").hide(); $("#msgShioriNotExists").hide();
$("#dspDelete").show(); $("#dspDelete").show();
$("#dspDelete1").show(); $("#dspDelete1").show();
} }
// Show book in local storage // Show book in local storage
//BOOKMARK.ShowBookmark(); // BOOKMARK.ShowBookmark();
$("a[name='dspRead']").unbind('click'); $("a[name='dspRead']").unbind('click');
$("a[name='dspRead']").click(BOOKMARK.dspRead_Click); $("a[name='dspRead']").click(BOOKMARK.dspRead_Click);
//ダイハツ対応 // ダイハツ対応
$("a[name='dspDownload']").unbind('click'); $("a[name='dspDownload']").unbind('click');
$("a[name='dspDownload']").click(BOOKMARK.downloadFunction); $("a[name='dspDownload']").click(BOOKMARK.downloadFunction);
BOOKMARK.HideSorting(); BOOKMARK.HideSorting();
// Default sort is タイトル名, default is asc // Default sort is タイトル名, default is asc
ClientData.sortOpt_searchDivision(BOOKMARK.searchDivision); ClientData.sortOpt_searchDivision(BOOKMARK.searchDivision);
ClientData.sortOpt_sortType(BOOKMARK.sortType); ClientData.sortOpt_sortType(BOOKMARK.sortType);
BOOKMARK.dspTitleNm_Click(); BOOKMARK.dspTitleNm_Click();
} } else {
else {
HEADER.checkForceChangePassword(); HEADER.checkForceChangePassword();
} }
if (COMMON.isAnonymousLogin()) { if (COMMON.isAnonymousLogin()) {
//プッシュメッセージ隠す // プッシュメッセージ隠す
$('#dspPushMessage').hide(); $('#dspPushMessage').hide();
} }
//ダイアログ関連 // ダイアログ関連
$("#dspTitleNm").click(BOOKMARK.dspTitleNm_Click); $("#dspTitleNm").click(BOOKMARK.dspTitleNm_Click);
$("#dspTitleNmKn").click(BOOKMARK.dspTitleNmKn_Click); $("#dspTitleNmKn").click(BOOKMARK.dspTitleNmKn_Click);
$("#dspPubDt").click(BOOKMARK.dspPubDt_Click); $("#dspPubDt").click(BOOKMARK.dspPubDt_Click);
...@@ -96,15 +93,14 @@ $(document).ready(function () { ...@@ -96,15 +93,14 @@ $(document).ready(function () {
if (I18N.getCurrentLanguage() != COMMON.Consts.ConstLanguage_Ja) { if (I18N.getCurrentLanguage() != COMMON.Consts.ConstLanguage_Ja) {
$("#dspTitleNmKn").hide(); $("#dspTitleNmKn").hide();
$("#dspTitleNmKn_Seperate").hide(); $("#dspTitleNmKn_Seperate").hide();
} } else {
else {
$("#dspTitleNmKn").show(); $("#dspTitleNmKn").show();
$("#dspTitleNmKn_Seperate").show(); $("#dspTitleNmKn_Seperate").show();
} }
//ビューア、共有表示パーツ読み込み // ビューア、共有表示パーツ読み込み
$("#viewer").load("./inc_contentview.html?__UPDATEID__", function (myData, myStatus, xhr){ $("#viewer").load("./inc_contentview.html?__UPDATEID__", function(myData, myStatus, xhr) {
//読み込み完了時の処理 // 読み込み完了時の処理
I18N.i18nReplaceText(); I18N.i18nReplaceText();
}); });
...@@ -120,14 +116,13 @@ BOOKMARK.refreshView = function() { ...@@ -120,14 +116,13 @@ BOOKMARK.refreshView = function() {
BOOKMARK.ClearGrid(); BOOKMARK.ClearGrid();
//if (ClientData.BookMarkData().length == 0) { // if (ClientData.BookMarkData().length == 0) {
if(BOOKMARK.collection_contents.length == 0){ if (BOOKMARK.collection_contents.length == 0) {
// Show error // Show error
$("#msgShioriNotExists").show(); $("#msgShioriNotExists").show();
$("#dspDelete").hide(); $("#dspDelete").hide();
$("#dspDelete1").hide(); $("#dspDelete1").hide();
} } else {
else {
$("#msgShioriNotExists").hide(); $("#msgShioriNotExists").hide();
$("#dspDelete").show(); $("#dspDelete").show();
$("#dspDelete1").show(); $("#dspDelete1").show();
...@@ -135,17 +130,17 @@ BOOKMARK.refreshView = function() { ...@@ -135,17 +130,17 @@ BOOKMARK.refreshView = function() {
// Default sort is タイトル名, default is asc // Default sort is タイトル名, default is asc
ClientData.sortOpt_searchDivision(BOOKMARK.searchDivision); ClientData.sortOpt_searchDivision(BOOKMARK.searchDivision);
//前と同じ状態にするので逆転させる // 前と同じ状態にするので逆転させる
if( BOOKMARK.sortType == 1 ){ if (BOOKMARK.sortType == 1) {
BOOKMARK.sortType = 2; BOOKMARK.sortType = 2;
} else { } else {
BOOKMARK.sortType = 1; BOOKMARK.sortType = 1;
} }
ClientData.sortOpt_sortType(BOOKMARK.sortType); ClientData.sortOpt_sortType(BOOKMARK.sortType);
if( BOOKMARK.searchDivision == 1 ){ if (BOOKMARK.searchDivision == 1) {
BOOKMARK.dspTitleNm_Click(); BOOKMARK.dspTitleNm_Click();
} else if( BOOKMARK.searchDivision == 2 ){ } else if (BOOKMARK.searchDivision == 2) {
BOOKMARK.dspTitleNmKn_Click(); BOOKMARK.dspTitleNmKn_Click();
} else { } else {
BOOKMARK.dspPubDt_Click(); BOOKMARK.dspPubDt_Click();
...@@ -153,12 +148,11 @@ BOOKMARK.refreshView = function() { ...@@ -153,12 +148,11 @@ BOOKMARK.refreshView = function() {
}; };
/* /*
---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
Event groups [start] * Event groups [start]
---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
BOOKMARK.dspTitleNm_Click = function() { BOOKMARK.dspTitleNm_Click = function() {
...@@ -167,13 +161,11 @@ BOOKMARK.dspTitleNm_Click = function() { ...@@ -167,13 +161,11 @@ BOOKMARK.dspTitleNm_Click = function() {
if (ClientData.sortOpt_sortType() == 1) { // ASC if (ClientData.sortOpt_sortType() == 1) { // ASC
isAsc = false; isAsc = false;
BOOKMARK.sortType = 2; BOOKMARK.sortType = 2;
} } else {
else {
isAsc = true; isAsc = true;
BOOKMARK.sortType = 1; BOOKMARK.sortType = 1;
} }
} } else {
else {
BOOKMARK.searchDivision = 1; BOOKMARK.searchDivision = 1;
BOOKMARK.sortType = 1; BOOKMARK.sortType = 1;
ClientData.sortOpt_searchDivision(1); ClientData.sortOpt_searchDivision(1);
...@@ -183,7 +175,7 @@ BOOKMARK.dspTitleNm_Click = function() { ...@@ -183,7 +175,7 @@ BOOKMARK.dspTitleNm_Click = function() {
BOOKMARK.SortTitleName(isAsc); BOOKMARK.SortTitleName(isAsc);
//changeStatusSort(this, isAsc); // changeStatusSort(this, isAsc);
HEADER.setStatusSort('#dspTitleNm', isAsc); HEADER.setStatusSort('#dspTitleNm', isAsc);
}; };
...@@ -193,13 +185,11 @@ BOOKMARK.dspTitleNmKn_Click = function() { ...@@ -193,13 +185,11 @@ BOOKMARK.dspTitleNmKn_Click = function() {
if (ClientData.sortOpt_sortType() == 1) { // ASC if (ClientData.sortOpt_sortType() == 1) { // ASC
isAsc = false; isAsc = false;
BOOKMARK.sortType = 2; BOOKMARK.sortType = 2;
} } else {
else {
isAsc = true; isAsc = true;
BOOKMARK.sortType = 1; BOOKMARK.sortType = 1;
} }
} } else {
else {
BOOKMARK.searchDivision = 2; BOOKMARK.searchDivision = 2;
BOOKMARK.sortType = 1; BOOKMARK.sortType = 1;
ClientData.sortOpt_searchDivision(2); // Kana ClientData.sortOpt_searchDivision(2); // Kana
...@@ -209,7 +199,7 @@ BOOKMARK.dspTitleNmKn_Click = function() { ...@@ -209,7 +199,7 @@ BOOKMARK.dspTitleNmKn_Click = function() {
BOOKMARK.SortTitleNameKana(isAsc); BOOKMARK.SortTitleNameKana(isAsc);
//changeStatusSort(this, isAsc); // changeStatusSort(this, isAsc);
HEADER.setStatusSort('#dspTitleNmKn', isAsc); HEADER.setStatusSort('#dspTitleNmKn', isAsc);
}; };
...@@ -219,13 +209,11 @@ BOOKMARK.dspPubDt_Click = function() { ...@@ -219,13 +209,11 @@ BOOKMARK.dspPubDt_Click = function() {
if (ClientData.sortOpt_sortType() == 1) { // ASC if (ClientData.sortOpt_sortType() == 1) { // ASC
isAsc = false; isAsc = false;
BOOKMARK.sortType = 2; BOOKMARK.sortType = 2;
} } else {
else {
isAsc = true; isAsc = true;
BOOKMARK.sortType = 1; BOOKMARK.sortType = 1;
} }
} } else {
else {
BOOKMARK.sortType = 1; BOOKMARK.sortType = 1;
ClientData.sortOpt_searchDivision(3); // Kana ClientData.sortOpt_searchDivision(3); // Kana
isAsc = true; isAsc = true;
...@@ -234,7 +222,7 @@ BOOKMARK.dspPubDt_Click = function() { ...@@ -234,7 +222,7 @@ BOOKMARK.dspPubDt_Click = function() {
BOOKMARK.SortPubDate(isAsc); BOOKMARK.SortPubDate(isAsc);
//changeStatusSort(this, isAsc); // changeStatusSort(this, isAsc);
HEADER.setStatusSort('#dspPubDt', isAsc); HEADER.setStatusSort('#dspPubDt', isAsc);
}; };
...@@ -243,14 +231,10 @@ BOOKMARK.dspRead_Click = function() { ...@@ -243,14 +231,10 @@ BOOKMARK.dspRead_Click = function() {
var jsondata = $(this).attr("value"); var jsondata = $(this).attr("value");
var data = JSON.parse(jsondata); var data = JSON.parse(jsondata);
LIMIT_ACCESS_CONTENT.checkLimitContent( LIMIT_ACCESS_CONTENT.checkLimitContent(data.contentid, function() {
data.contentid,
function (){
BOOKMARK.dspRead_Click_callback(data); BOOKMARK.dspRead_Click_callback(data);
}, }, function() {
function(){ });
}
);
}; };
// //
BOOKMARK.dspRead_Click_callback = function(data) { BOOKMARK.dspRead_Click_callback = function(data) {
...@@ -259,9 +243,9 @@ BOOKMARK.dspRead_Click_callback = function(data) { ...@@ -259,9 +243,9 @@ BOOKMARK.dspRead_Click_callback = function(data) {
ClientData.bookmark_pageNo(data.pageNo); ClientData.bookmark_pageNo(data.pageNo);
ClientData.contentInfo_contentType(data.contentType); ClientData.contentInfo_contentType(data.contentType);
ClientData.IsRefresh(false); ClientData.IsRefresh(false);
//AVWEB.avwScreenMove(COMMON.ScreenIds.ContentView); // AVWEB.avwScreenMove(COMMON.ScreenIds.ContentView);
//表示 // 表示
BOOKMARK.showContentView(); BOOKMARK.showContentView();
}; };
...@@ -269,7 +253,7 @@ BOOKMARK.dspRead_Click_callback = function(data) { ...@@ -269,7 +253,7 @@ BOOKMARK.dspRead_Click_callback = function(data) {
// Cancel dialog of deleting // Cancel dialog of deleting
BOOKMARK.dspCancel_Click = function() { BOOKMARK.dspCancel_Click = function() {
// Close dialog // Close dialog
//$('#dlgConfirm').dialog('close'); // $('#dlgConfirm').dialog('close');
$("#delete_shiori").hide(); $("#delete_shiori").hide();
COMMON.unlockLayout(); COMMON.unlockLayout();
}; };
...@@ -281,7 +265,7 @@ BOOKMARK.dspConfirmOK_Click = function() { ...@@ -281,7 +265,7 @@ BOOKMARK.dspConfirmOK_Click = function() {
// Get selected bookmarks // Get selected bookmarks
var arrSelectedBookmarks = $("input[name='chkDelete']:checked"); var arrSelectedBookmarks = $("input[name='chkDelete']:checked");
$.each(arrSelectedBookmarks, function () { $.each(arrSelectedBookmarks, function() {
// Delete selected items on layout // Delete selected items on layout
var contentid = JSON.parse(this.value).contentid; var contentid = JSON.parse(this.value).contentid;
...@@ -292,7 +276,7 @@ BOOKMARK.dspConfirmOK_Click = function() { ...@@ -292,7 +276,7 @@ BOOKMARK.dspConfirmOK_Click = function() {
// Remove from ClientData // Remove from ClientData
var bm = ClientData.BookMarkData(); var bm = ClientData.BookMarkData();
for (var nIndex = bm.length - 1; nIndex >= 0; nIndex--) { for ( var nIndex = bm.length - 1; nIndex >= 0; nIndex--) {
if (bm[nIndex].contentid == contentid && bm[nIndex].pageNo == pageNo) { if (bm[nIndex].contentid == contentid && bm[nIndex].pageNo == pageNo) {
bm.splice(nIndex, 1); bm.splice(nIndex, 1);
ClientData.isChangedBookmark(true); ClientData.isChangedBookmark(true);
...@@ -333,7 +317,7 @@ BOOKMARK.ShowBookmark = function(showList) { ...@@ -333,7 +317,7 @@ BOOKMARK.ShowBookmark = function(showList) {
if (AVWEB.avwHasError()) { if (AVWEB.avwHasError()) {
return; return;
} }
else {
var hasMemo = false; var hasMemo = false;
var hasMarking = false; var hasMarking = false;
var contentid = ""; var contentid = "";
...@@ -343,8 +327,8 @@ BOOKMARK.ShowBookmark = function(showList) { ...@@ -343,8 +327,8 @@ BOOKMARK.ShowBookmark = function(showList) {
$("#dspDelete").show(); $("#dspDelete").show();
$("#dspDelete1").show(); $("#dspDelete1").show();
} }
//TotalThread = ClientData.BookMarkData().length; // TotalThread = ClientData.BookMarkData().length;
for (var nIndex = showList.length - 1; nIndex >= 0; nIndex--) { for ( var nIndex = showList.length - 1; nIndex >= 0; nIndex--) {
hasMarking = false; hasMarking = false;
hasMemo = false; hasMemo = false;
...@@ -352,19 +336,17 @@ BOOKMARK.ShowBookmark = function(showList) { ...@@ -352,19 +336,17 @@ BOOKMARK.ShowBookmark = function(showList) {
pageNo = showList[nIndex].pageNo; pageNo = showList[nIndex].pageNo;
// Check if contentid has marking // Check if contentid has marking
for (var nIndex1 = 0; nIndex1 < ClientData.MarkingData().length; nIndex1++) { for ( var nIndex1 = 0; nIndex1 < ClientData.MarkingData().length; nIndex1++) {
if (ClientData.MarkingData()[nIndex1].contentid == contentid if (ClientData.MarkingData()[nIndex1].contentid == contentid && ClientData.MarkingData()[nIndex1].pageNo == pageNo) {
&& ClientData.MarkingData()[nIndex1].pageNo == pageNo) {
hasMarking = true; hasMarking = true;
} }
} }
// Check if contentid has memo // Check if contentid has memo
for (var nIndex1 = 0; nIndex1 < ClientData.MemoData().length; nIndex1++) { for ( var nIndex1 = 0; nIndex1 < ClientData.MemoData().length; nIndex1++) {
if (ClientData.MemoData()[nIndex1].contentid == contentid if (ClientData.MemoData()[nIndex1].contentid == contentid && ClientData.MemoData()[nIndex1].pageNo == pageNo) {
&& ClientData.MemoData()[nIndex1].pageNo == pageNo) {
hasMemo = true; hasMemo = true;
} }
} }
...@@ -374,17 +356,17 @@ BOOKMARK.ShowBookmark = function(showList) { ...@@ -374,17 +356,17 @@ BOOKMARK.ShowBookmark = function(showList) {
var contentTitleKana = ""; var contentTitleKana = "";
var contentType = ""; var contentType = "";
// Search current page if collection that get details before // Search current page if collection that get details before
for (var nIndex2 = 0; nIndex2 < BOOKMARK.collection_contents.length; nIndex2++) { for ( var nIndex2 = 0; nIndex2 < BOOKMARK.collection_contents.length; nIndex2++) {
if (BOOKMARK.collection_contents[nIndex2].contentid == contentid) { if (BOOKMARK.collection_contents[nIndex2].contentid == contentid) {
contentTitle = BOOKMARK.collection_contents[nIndex2].contentTitle; contentTitle = BOOKMARK.collection_contents[nIndex2].contentTitle;
contentTitleKana = BOOKMARK.collection_contents[nIndex2].contentTitleKana; contentTitleKana = BOOKMARK.collection_contents[nIndex2].contentTitleKana;
contentType = BOOKMARK.collection_contents[nIndex2].contentType; contentType = BOOKMARK.collection_contents[nIndex2].contentType;
// Search in pages // Search in pages
for (var nIndex3 = 0; nIndex3 < BOOKMARK.collection_contents[nIndex2].pages.length; nIndex3++) { for ( var nIndex3 = 0; nIndex3 < BOOKMARK.collection_contents[nIndex2].pages.length; nIndex3++) {
if (pageNo == BOOKMARK.collection_contents[nIndex2].pages[nIndex3].pageNo) { if (pageNo == BOOKMARK.collection_contents[nIndex2].pages[nIndex3].pageNo) {
pageDetail = BOOKMARK.collection_contents[nIndex2].pages[nIndex3]; pageDetail = BOOKMARK.collection_contents[nIndex2].pages[nIndex3];
if(contentType != COMMON.ContentTypeKeys.Type_PDF){ if (contentType != COMMON.ContentTypeKeys.Type_PDF) {
pageDetail.pageText = ""; pageDetail.pageText = "";
} }
break; break;
...@@ -401,10 +383,8 @@ BOOKMARK.ShowBookmark = function(showList) { ...@@ -401,10 +383,8 @@ BOOKMARK.ShowBookmark = function(showList) {
var pageThumbnail = (pageDetail.pageThumbnail != BOOKMARK.pathImgContentNone) ? ("data:image/jpeg;base64," + pageDetail.pageThumbnail) : BOOKMARK.pathImgContentNone; var pageThumbnail = (pageDetail.pageThumbnail != BOOKMARK.pathImgContentNone) ? ("data:image/jpeg;base64," + pageDetail.pageThumbnail) : BOOKMARK.pathImgContentNone;
BOOKMARK.insertRow(contentid, pageThumbnail, COMMON.htmlEncode(contentTitle), BOOKMARK.insertRow(contentid, pageThumbnail, COMMON.htmlEncode(contentTitle), pageDetail.pageText, pageDetail.pageNo, hasMemo, hasMarking, nIndex, contentType);
pageDetail.pageText, pageDetail.pageNo, hasMemo, hasMarking, nIndex, contentType); } else {
}
else {
// Not existed -> Show error // Not existed -> Show error
BOOKMARK.insertRowError(contentid, COMMON.htmlEncode(contentTitle), pageDetail.pageNo); BOOKMARK.insertRowError(contentid, COMMON.htmlEncode(contentTitle), pageDetail.pageNo);
} }
...@@ -413,10 +393,10 @@ BOOKMARK.ShowBookmark = function(showList) { ...@@ -413,10 +393,10 @@ BOOKMARK.ShowBookmark = function(showList) {
} }
$("a[name='dspRead']").unbind('click'); $("a[name='dspRead']").unbind('click');
$("a[name='dspRead']").click(BOOKMARK.dspRead_Click); $("a[name='dspRead']").click(BOOKMARK.dspRead_Click);
//ダイハツ対応 // ダイハツ対応
$("a[name='dspDownload']").unbind('click'); $("a[name='dspDownload']").unbind('click');
$("a[name='dspDownload']").click(BOOKMARK.downloadFunction); $("a[name='dspDownload']").click(BOOKMARK.downloadFunction);
}
}; };
// Hide all sorting symbol // Hide all sorting symbol
BOOKMARK.HideSorting = function() { BOOKMARK.HideSorting = function() {
...@@ -437,20 +417,18 @@ BOOKMARK.SortTitleName = function(isAsc) { ...@@ -437,20 +417,18 @@ BOOKMARK.SortTitleName = function(isAsc) {
if (arrSource.length > 0) { if (arrSource.length > 0) {
strTemp = ""; strTemp = "";
// Lookup min item // Lookup min item
for (var nIndex = 0; nIndex < arrSource.length; nIndex++) { for ( var nIndex = 0; nIndex < arrSource.length; nIndex++) {
if (strTemp == "") { if (strTemp == "") {
strTemp = arrSource[nIndex].contentTitle; strTemp = arrSource[nIndex].contentTitle;
nTempIndex = nIndex; nTempIndex = nIndex;
} } else {
else {
// ASC // ASC
if (isAsc) { if (isAsc) {
if (arrSource[nIndex].contentTitle < strTemp) { if (arrSource[nIndex].contentTitle < strTemp) {
strTemp = arrSource[nIndex].contentTitle; strTemp = arrSource[nIndex].contentTitle;
nTempIndex = nIndex; nTempIndex = nIndex;
} }
} } else {
else {
if (arrSource[nIndex].contentTitle > strTemp) { if (arrSource[nIndex].contentTitle > strTemp) {
strTemp = arrSource[nIndex].contentTitle; strTemp = arrSource[nIndex].contentTitle;
nTempIndex = nIndex; nTempIndex = nIndex;
...@@ -461,8 +439,8 @@ BOOKMARK.SortTitleName = function(isAsc) { ...@@ -461,8 +439,8 @@ BOOKMARK.SortTitleName = function(isAsc) {
// Add to target array // Add to target array
arrTarget.push(arrSource[nTempIndex]); arrTarget.push(arrSource[nTempIndex]);
//表示対象なら表示用リストにプッシュ // 表示対象なら表示用リストにプッシュ
for (var nIndex2 = 0; nIndex2 < BOOKMARK.collection_contents.length; nIndex2++) { for ( var nIndex2 = 0; nIndex2 < BOOKMARK.collection_contents.length; nIndex2++) {
if (BOOKMARK.collection_contents[nIndex2].contentid == arrSource[nTempIndex].contentid) { if (BOOKMARK.collection_contents[nIndex2].contentid == arrSource[nTempIndex].contentid) {
arrShowList.push(arrSource[nTempIndex]); arrShowList.push(arrSource[nTempIndex]);
break; break;
...@@ -471,8 +449,7 @@ BOOKMARK.SortTitleName = function(isAsc) { ...@@ -471,8 +449,7 @@ BOOKMARK.SortTitleName = function(isAsc) {
// Remove min item from source array // Remove min item from source array
arrSource.splice(nTempIndex, 1); arrSource.splice(nTempIndex, 1);
} } else {
else {
isStop = true; isStop = true;
} }
} }
...@@ -484,7 +461,7 @@ BOOKMARK.SortTitleName = function(isAsc) { ...@@ -484,7 +461,7 @@ BOOKMARK.SortTitleName = function(isAsc) {
BOOKMARK.ClearGrid = function() { BOOKMARK.ClearGrid = function() {
var arrSelectedBookmarks = $("input[name='chkDelete']"); var arrSelectedBookmarks = $("input[name='chkDelete']");
$.each(arrSelectedBookmarks, function () { $.each(arrSelectedBookmarks, function() {
$(this).parent().parent().parent().remove(); $(this).parent().parent().parent().remove();
}); });
...@@ -504,20 +481,18 @@ BOOKMARK.SortTitleNameKana = function(isAsc) { ...@@ -504,20 +481,18 @@ BOOKMARK.SortTitleNameKana = function(isAsc) {
if (arrSource.length > 0) { if (arrSource.length > 0) {
strTemp = ""; strTemp = "";
// Lookup min item // Lookup min item
for (var nIndex = 0; nIndex < arrSource.length; nIndex++) { for ( var nIndex = 0; nIndex < arrSource.length; nIndex++) {
if (strTemp == "") { if (strTemp == "") {
strTemp = arrSource[nIndex].contentTitleKana; strTemp = arrSource[nIndex].contentTitleKana;
nTempIndex = nIndex; nTempIndex = nIndex;
} } else {
else {
// ASC // ASC
if (isAsc) { if (isAsc) {
if (arrSource[nIndex].contentTitleKana < strTemp) { if (arrSource[nIndex].contentTitleKana < strTemp) {
strTemp = arrSource[nIndex].contentTitleKana; strTemp = arrSource[nIndex].contentTitleKana;
nTempIndex = nIndex; nTempIndex = nIndex;
} }
} } else {
else {
if (arrSource[nIndex].contentTitleKana > strTemp) { if (arrSource[nIndex].contentTitleKana > strTemp) {
strTemp = arrSource[nIndex].contentTitleKana; strTemp = arrSource[nIndex].contentTitleKana;
nTempIndex = nIndex; nTempIndex = nIndex;
...@@ -528,8 +503,8 @@ BOOKMARK.SortTitleNameKana = function(isAsc) { ...@@ -528,8 +503,8 @@ BOOKMARK.SortTitleNameKana = function(isAsc) {
// Add to target array // Add to target array
arrTarget.push(arrSource[nTempIndex]); arrTarget.push(arrSource[nTempIndex]);
//表示対象なら表示用リストにプッシュ // 表示対象なら表示用リストにプッシュ
for (var nIndex2 = 0; nIndex2 < BOOKMARK.collection_contents.length; nIndex2++) { for ( var nIndex2 = 0; nIndex2 < BOOKMARK.collection_contents.length; nIndex2++) {
if (BOOKMARK.collection_contents[nIndex2].contentid == arrSource[nTempIndex].contentid) { if (BOOKMARK.collection_contents[nIndex2].contentid == arrSource[nTempIndex].contentid) {
arrShowList.push(arrSource[nTempIndex]); arrShowList.push(arrSource[nTempIndex]);
break; break;
...@@ -538,8 +513,7 @@ BOOKMARK.SortTitleNameKana = function(isAsc) { ...@@ -538,8 +513,7 @@ BOOKMARK.SortTitleNameKana = function(isAsc) {
// Remove min item from source array // Remove min item from source array
arrSource.splice(nTempIndex, 1); arrSource.splice(nTempIndex, 1);
} } else {
else {
isStop = true; isStop = true;
} }
} }
...@@ -562,20 +536,18 @@ BOOKMARK.SortPubDate = function(isAsc) { ...@@ -562,20 +536,18 @@ BOOKMARK.SortPubDate = function(isAsc) {
if (arrSource.length > 0) { if (arrSource.length > 0) {
dateTemp = undefined; dateTemp = undefined;
// Lookup min item // Lookup min item
for (var nIndex = 0; nIndex < arrSource.length; nIndex++) { for ( var nIndex = 0; nIndex < arrSource.length; nIndex++) {
if (dateTemp == undefined) { if (dateTemp == undefined) {
dateTemp = arrSource[nIndex].registerDate; dateTemp = arrSource[nIndex].registerDate;
nTempIndex = nIndex; nTempIndex = nIndex;
} } else {
else {
// ASC // ASC
if (isAsc) { if (isAsc) {
if (arrSource[nIndex].registerDate < dateTemp) { if (arrSource[nIndex].registerDate < dateTemp) {
dateTemp = arrSource[nIndex].registerDate; dateTemp = arrSource[nIndex].registerDate;
nTempIndex = nIndex; nTempIndex = nIndex;
} }
} } else {
else {
if (arrSource[nIndex].registerDate > dateTemp) { if (arrSource[nIndex].registerDate > dateTemp) {
dateTemp = arrSource[nIndex].registerDate; dateTemp = arrSource[nIndex].registerDate;
nTempIndex = nIndex; nTempIndex = nIndex;
...@@ -586,8 +558,8 @@ BOOKMARK.SortPubDate = function(isAsc) { ...@@ -586,8 +558,8 @@ BOOKMARK.SortPubDate = function(isAsc) {
// Add to target array // Add to target array
arrTarget.push(arrSource[nTempIndex]); arrTarget.push(arrSource[nTempIndex]);
//表示対象なら表示用リストにプッシュ // 表示対象なら表示用リストにプッシュ
for (var nIndex2 = 0; nIndex2 < BOOKMARK.collection_contents.length; nIndex2++) { for ( var nIndex2 = 0; nIndex2 < BOOKMARK.collection_contents.length; nIndex2++) {
if (BOOKMARK.collection_contents[nIndex2].contentid == arrSource[nTempIndex].contentid) { if (BOOKMARK.collection_contents[nIndex2].contentid == arrSource[nTempIndex].contentid) {
arrShowList.push(arrSource[nTempIndex]); arrShowList.push(arrSource[nTempIndex]);
break; break;
...@@ -596,8 +568,7 @@ BOOKMARK.SortPubDate = function(isAsc) { ...@@ -596,8 +568,7 @@ BOOKMARK.SortPubDate = function(isAsc) {
// Remove min item from source array // Remove min item from source array
arrSource.splice(nTempIndex, 1); arrSource.splice(nTempIndex, 1);
} } else {
else {
isStop = true; isStop = true;
} }
} }
...@@ -606,12 +577,12 @@ BOOKMARK.SortPubDate = function(isAsc) { ...@@ -606,12 +577,12 @@ BOOKMARK.SortPubDate = function(isAsc) {
BOOKMARK.ShowBookmark(arrShowList); BOOKMARK.ShowBookmark(arrShowList);
}; };
/* /*
Update information of specified bookmark * Update information of specified bookmark
*/ */
BOOKMARK.UpdateBookmark = function(contentid, pageNo, contentTitle, contentTitleKana) { BOOKMARK.UpdateBookmark = function(contentid, pageNo, contentTitle, contentTitleKana) {
var arrBookmarks = ClientData.BookMarkData(); var arrBookmarks = ClientData.BookMarkData();
for (var nIndex = 0; nIndex < arrBookmarks.length; nIndex++) { for ( var nIndex = 0; nIndex < arrBookmarks.length; nIndex++) {
if (contentid == arrBookmarks[nIndex].contentid && pageNo == arrBookmarks[nIndex].pageNo) { if (contentid == arrBookmarks[nIndex].contentid && pageNo == arrBookmarks[nIndex].pageNo) {
if (contentTitle != null && contentTitle != undefined) { if (contentTitle != null && contentTitle != undefined) {
arrBookmarks[nIndex].contentTitle = contentTitle; arrBookmarks[nIndex].contentTitle = contentTitle;
...@@ -626,10 +597,9 @@ BOOKMARK.UpdateBookmark = function(contentid, pageNo, contentTitle, contentTitle ...@@ -626,10 +597,9 @@ BOOKMARK.UpdateBookmark = function(contentid, pageNo, contentTitle, contentTitle
ClientData.BookMarkData(arrBookmarks); ClientData.BookMarkData(arrBookmarks);
}; };
/* /*
Insert error row * Insert error row
*/ */
BOOKMARK.insertRowError = function(contentid, pageTitle, pageNo) { BOOKMARK.insertRowError = function(contentid, pageTitle, pageNo) {
var newRow = ""; var newRow = "";
...@@ -638,7 +608,7 @@ BOOKMARK.insertRowError = function(contentid, pageTitle, pageNo) { ...@@ -638,7 +608,7 @@ BOOKMARK.insertRowError = function(contentid, pageTitle, pageNo) {
newRow += " <div class='cnt_section'>"; newRow += " <div class='cnt_section'>";
newRow += '<span class="check">'; newRow += '<span class="check">';
newRow += "<input type='checkbox' name='chkDelete' value='{\"contentid\":" + contentid + ", \"pageNo\":" + pageNo +"}' />"; newRow += "<input type='checkbox' name='chkDelete' value='{\"contentid\":" + contentid + ", \"pageNo\":" + pageNo + "}' />";
newRow += '</span>'; newRow += '</span>';
newRow += " <div class='text'>"; newRow += " <div class='text'>";
...@@ -663,33 +633,32 @@ BOOKMARK.insertRow = function(contentid, pageThumbnail, pageTitle, pageText, pag ...@@ -663,33 +633,32 @@ BOOKMARK.insertRow = function(contentid, pageThumbnail, pageTitle, pageText, pag
newRow += "<section class='sectionBookmark'>"; newRow += "<section class='sectionBookmark'>";
newRow +='<div class="cnt_section">'; newRow += '<div class="cnt_section">';
newRow +='<span class="check">'; newRow += '<span class="check">';
newRow += "<input type='checkbox' name='chkDelete' value='{\"contentid\":" + contentid + ", \"pageNo\":" + pageNo + ", \"index\": " + index + "}'/>"; newRow += "<input type='checkbox' name='chkDelete' value='{\"contentid\":" + contentid + ", \"pageNo\":" + pageNo + ", \"index\": " + index + "}'/>";
newRow +='</span>'; newRow += '</span>';
newRow +='<a class="img" href="#">'; newRow += '<a class="img" href="#">';
newRow +='<img id="pageImg' + contentid + '" src="' + pageThumbnail + '" width="160" height="120" style="display:none;">'; newRow += '<img id="pageImg' + contentid + '" src="' + pageThumbnail + '" width="160" height="120" style="display:none;">';
newRow +='<img id="loadingIcon' + contentid + "_" + pageNo + '" src="./img/data_loading.gif" height="25px" width="25px" style="padding: 46px; "/>'; newRow += '<img id="loadingIcon' + contentid + "_" + pageNo + '" src="./img/data_loading.gif" height="25px" width="25px" style="padding: 46px; "/>';
newRow +='</a>'; newRow += '</a>';
newRow +='<div class="text">'; newRow += '<div class="text">';
newRow += '<a class="name" href="#">' + COMMON.truncate(pageTitle, 20) + '</a>'; newRow += '<a class="name" href="#">' + COMMON.truncate(pageTitle, 20) + '</a>';
newRow +='<div class="info">'; newRow += '<div class="info">';
newRow += '<ul class="date">'; newRow += '<ul class="date">';
var contentText = COMMON.htmlEncode(COMMON.getLines(pageText, 3)); var contentText = COMMON.htmlEncode(COMMON.getLines(pageText, 3));
newRow += '<li><label id="Label1">' + COMMON.truncate(contentText, 60) + '</label></li>'; newRow += '<li><label id="Label1">' + COMMON.truncate(contentText, 60) + '</label></li>';
newRow +='</ul>'; newRow += '</ul>';
newRow += '<ul class="pic">'; newRow += '<ul class="pic">';
// Resize Image
//Resize Image
var imgTemp = new Image(); var imgTemp = new Image();
imgTemp.onload = function () { imgTemp.onload = function() {
if (imgTemp.width > imgTemp.height) { if (imgTemp.width > imgTemp.height) {
...@@ -698,15 +667,14 @@ BOOKMARK.insertRow = function(contentid, pageThumbnail, pageTitle, pageText, pag ...@@ -698,15 +667,14 @@ BOOKMARK.insertRow = function(contentid, pageThumbnail, pageTitle, pageText, pag
$("img#pageImg" + contentid).attr('width', '120'); $("img#pageImg" + contentid).attr('width', '120');
var realHeight = (120 * imgTemp.height) / imgTemp.width; var realHeight = (120 * imgTemp.height) / imgTemp.width;
$("img#pageImg" + contentid).css('padding-top', (120 - realHeight) / 2 + 'px'); $("img#pageImg" + contentid).css('padding-top', (120 - realHeight) / 2 + 'px');
} } else {
else {
$("img#pageImg" + contentid).attr('width', ''); $("img#pageImg" + contentid).attr('width', '');
$("img#pageImg" + contentid).removeAttr('width'); $("img#pageImg" + contentid).removeAttr('width');
$("img#pageImg" + contentid).attr('height', '120'); $("img#pageImg" + contentid).attr('height', '120');
$("img#pageImg" + contentid).css('padding-top', '0px'); $("img#pageImg" + contentid).css('padding-top', '0px');
} }
$("#loadingIcon" + contentid + "_" + pageNo).fadeOut('slow', function () { $("#loadingIcon" + contentid + "_" + pageNo).fadeOut('slow', function() {
$("img#pageImg" + contentid).fadeIn('slow'); $("img#pageImg" + contentid).fadeIn('slow');
}); });
}; };
...@@ -715,61 +683,63 @@ BOOKMARK.insertRow = function(contentid, pageThumbnail, pageTitle, pageText, pag ...@@ -715,61 +683,63 @@ BOOKMARK.insertRow = function(contentid, pageThumbnail, pageTitle, pageText, pag
if (hasMemo) { if (hasMemo) {
newRow += '<li><a href="javascript:void(0);" style="cursor: default;">' + imgMemo + '</a></li>'; newRow += '<li><a href="javascript:void(0);" style="cursor: default;">' + imgMemo + '</a></li>';
} } else {
else {
newRow += '<li><a href="javascript:void(0);" style="cursor: default;">' + imgMemoHide + '</a></li>'; newRow += '<li><a href="javascript:void(0);" style="cursor: default;">' + imgMemoHide + '</a></li>';
} }
if (hasMarking) { if (hasMarking) {
newRow += '<li><a href="javascript:void(0);" style="cursor: default;">' + imgMarking + '</a></li>'; newRow += '<li><a href="javascript:void(0);" style="cursor: default;">' + imgMarking + '</a></li>';
} } else {
else {
newRow += '<li><a href="javascript:void(0);" style="cursor: default;">' + imgMarkingHide + '</a></li>'; newRow += '<li><a href="javascript:void(0);" style="cursor: default;">' + imgMarkingHide + '</a></li>';
} }
newRow += '<li class="pageno"><label id="Label2" class="lang" lang="txtPage">' + I18N.i18nText('txtPage') + '</label><label id="Label3">' + pageNo + '</label></li>'; newRow += '<li class="pageno"><label id="Label2" class="lang" lang="txtPage">' + I18N.i18nText('txtPage') + '</label><label id="Label3">' + pageNo + '</label></li>';
newRow +='<li>'; newRow += '<li>';
newRow += "<a class='read read_open lang' name='dspRead' value='{\"contentid\":\"" + contentid + "\", \"pageNo\":\"" + pageNo + "\", \"contentType\":\"" + contentType + "\" }' lang='txtRead'>" + I18N.i18nText('txtRead') + "</a>"; newRow += "<a class='read read_open lang' name='dspRead' value='{\"contentid\":\"" + contentid + "\", \"pageNo\":\"" + pageNo + "\", \"contentType\":\"" + contentType + "\" }' lang='txtRead'>"
+ I18N.i18nText('txtRead') + "</a>";
if( BOOKMARK.download[contentid] == '1' ){ if (BOOKMARK.download[contentid] == '1') {
newRow += "<a class='read read_download' name='dspDownload' contentid='" + contentid + "'>ダウンロード</a>"; newRow += "<a class='read read_download' name='dspDownload' contentid='" + contentid + "'>ダウンロード</a>";
} }
newRow +='</li>'; newRow += '</li>';
newRow +='</ul>'; newRow += '</ul>';
newRow +='</div>'; newRow += '</div>';
newRow +='</div>'; newRow += '</div>';
newRow +='</div>'; newRow += '</div>';
newRow += "</section>"; newRow += "</section>";
$('#pnlTop').after(newRow); $('#pnlTop').after(newRow);
}; };
/* /*
---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
Event groups [ end ] * Event groups [ end ]
---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
/* /*
Get all detail pages of content in bookmark * Get all detail pages of content in bookmark
*/ */
BOOKMARK.bookmark_collectAllPages = function() { BOOKMARK.bookmark_collectAllPages = function() {
var arrBookMarks = ClientData.BookMarkData(); var arrBookMarks = ClientData.BookMarkData();
for (var nIndex = 0; nIndex < BOOKMARK.collection_contents.length; nIndex++) { for ( var nIndex = 0; nIndex < BOOKMARK.collection_contents.length; nIndex++) {
var contentid = BOOKMARK.collection_contents[nIndex].contentid; var contentid = BOOKMARK.collection_contents[nIndex].contentid;
var pages = []; var pages = [];
// Collect all pages of current content // Collect all pages of current content
for (var nIndex1 = 0; nIndex1 < arrBookMarks.length; nIndex1++) { for ( var nIndex1 = 0; nIndex1 < arrBookMarks.length; nIndex1++) {
// Found content // Found content
if (arrBookMarks[nIndex1].contentid == contentid) { if (arrBookMarks[nIndex1].contentid == contentid) {
pages.push({ pageNo: arrBookMarks[nIndex1].pageNo, pageText: "", pageThumbnail: "", existed: false }); pages.push({
pageNo : arrBookMarks[nIndex1].pageNo,
pageText : "",
pageThumbnail : "",
existed : false
});
} }
} }
// Add collected pages to content // Add collected pages to content
...@@ -779,60 +749,59 @@ BOOKMARK.bookmark_collectAllPages = function() { ...@@ -779,60 +749,59 @@ BOOKMARK.bookmark_collectAllPages = function() {
var strPageNos = BOOKMARK.buildPageNos(BOOKMARK.collection_contents[nIndex].pages); var strPageNos = BOOKMARK.buildPageNos(BOOKMARK.collection_contents[nIndex].pages);
// Call api to get all details of pages 1 time // Call api to get all details of pages 1 time
AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webContentPage", "GET", AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webContentPage", "GET", {
{ contentId: contentid, sid: ClientData.userInfo_sid(), pageNos: strPageNos, thumbnailFlg: 1 }, contentId : contentid,
function (data) { sid : ClientData.userInfo_sid(),
pageNos : strPageNos,
thumbnailFlg : 1
}, function(data) {
BOOKMARK.collection_contents[nIndex].contentTitle = data.contentTitle; BOOKMARK.collection_contents[nIndex].contentTitle = data.contentTitle;
BOOKMARK.collection_contents[nIndex].contentTitleKana = data.contentTitleKana; BOOKMARK.collection_contents[nIndex].contentTitleKana = data.contentTitleKana;
for (var nIndex2 = 0; nIndex2 < BOOKMARK.collection_contents[nIndex].pages.length; nIndex2++) { for ( var nIndex2 = 0; nIndex2 < BOOKMARK.collection_contents[nIndex].pages.length; nIndex2++) {
var comparePageNo = BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageNo; var comparePageNo = BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageNo;
for (var nIndex3 = 0; nIndex3 < data.pages.length; nIndex3++) { for ( var nIndex3 = 0; nIndex3 < data.pages.length; nIndex3++) {
if (data.pages[nIndex2] && comparePageNo == data.pages[nIndex2].pageNo) { if (data.pages[nIndex2] && comparePageNo == data.pages[nIndex2].pageNo) {
// Set flag to determine page existed // Set flag to determine page existed
BOOKMARK.collection_contents[nIndex].pages[nIndex2].existed = true; BOOKMARK.collection_contents[nIndex].pages[nIndex2].existed = true;
// Store detail of page // Store detail of page
BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageText = data.pages[nIndex2].pageText; BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageText = data.pages[nIndex2].pageText;
BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageThumbnail = data.pages[nIndex2].pageThumbnail; BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageThumbnail = data.pages[nIndex2].pageThumbnail;
} } else if (BOOKMARK.contentTypes[contentid] == "none" && data.pages.length > 0) {
else if (BOOKMARK.contentTypes[contentid] == "none" && data.pages.length > 0) {
BOOKMARK.collection_contents[nIndex].pages[nIndex2].existed = true; BOOKMARK.collection_contents[nIndex].pages[nIndex2].existed = true;
// Store detail of page // Store detail of page
BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageText = ''; //data.pages[0].pageText; BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageText = ''; // data.pages[0].pageText;
BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageThumbnail = BOOKMARK.pathImgContentNone; //data.pages[nIndex2].pageThumbnail; BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageThumbnail = BOOKMARK.pathImgContentNone; // data.pages[nIndex2].pageThumbnail;
} }
} }
} }
}, }, function() { // when server response error
function () { // when server response error
if (BOOKMARK.contentTypes[contentid] == "none") { if (BOOKMARK.contentTypes[contentid] == "none") {
BOOKMARK.collection_contents[nIndex].contentTitle = BOOKMARK.contentName[contentid]; BOOKMARK.collection_contents[nIndex].contentTitle = BOOKMARK.contentName[contentid];
for (var nIndex2 = 0; nIndex2 < BOOKMARK.collection_contents[nIndex].pages.length; nIndex2++) { 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].existed = true;
BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageThumbnail = BOOKMARK.pathImgContentNone; BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageThumbnail = BOOKMARK.pathImgContentNone;
BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageText = ''; BOOKMARK.collection_contents[nIndex].pages[nIndex2].pageText = '';
} }
} }
} });
);
} }
}; };
/* /*
Build pageNos * Build pageNos
*/ */
BOOKMARK.buildPageNos = function(pages) { BOOKMARK.buildPageNos = function(pages) {
var strResult = ""; var strResult = "";
for (var nIndex = 0; nIndex < pages.length; nIndex++) { for ( var nIndex = 0; nIndex < pages.length; nIndex++) {
if (strResult == "") { if (strResult == "") {
strResult = "" + pages[nIndex].pageNo; strResult = "" + pages[nIndex].pageNo;
} } else {
else {
strResult += "," + pages[nIndex].pageNo; strResult += "," + pages[nIndex].pageNo;
} }
} }
...@@ -840,12 +809,12 @@ BOOKMARK.buildPageNos = function(pages) { ...@@ -840,12 +809,12 @@ BOOKMARK.buildPageNos = function(pages) {
}; };
/* /*
Check a content is error or not * Check a content is error or not
*/ */
BOOKMARK.IsErrorContent = function(strContentId) { BOOKMARK.IsErrorContent = function(strContentId) {
var isError = false; var isError = false;
for (var nIndex = 0; nIndex < BOOKMARK.bookmark_errorContent.length; nIndex++) { for ( var nIndex = 0; nIndex < BOOKMARK.bookmark_errorContent.length; nIndex++) {
if (strContentId == BOOKMARK.bookmark_errorContent[nIndex].contentid) { if (strContentId == BOOKMARK.bookmark_errorContent[nIndex].contentid) {
isError = true; isError = true;
break; break;
...@@ -855,12 +824,12 @@ BOOKMARK.IsErrorContent = function(strContentId) { ...@@ -855,12 +824,12 @@ BOOKMARK.IsErrorContent = function(strContentId) {
}; };
/* /*
Check a content is checked + ok * Check a content is checked + ok
*/ */
BOOKMARK.IsOKCheckedContent = function(strContentId) { BOOKMARK.IsOKCheckedContent = function(strContentId) {
var isOK = false; var isOK = false;
for (var nIndex = 0; nIndex < BOOKMARK.collection_contents.length; nIndex++) { for ( var nIndex = 0; nIndex < BOOKMARK.collection_contents.length; nIndex++) {
if (strContentId == BOOKMARK.collection_contents[nIndex].contentid) { if (strContentId == BOOKMARK.collection_contents[nIndex].contentid) {
isOK = true; isOK = true;
break; break;
...@@ -872,29 +841,34 @@ BOOKMARK.IsOKCheckedContent = function(strContentId) { ...@@ -872,29 +841,34 @@ BOOKMARK.IsOKCheckedContent = function(strContentId) {
// Add OK checked content // Add OK checked content
BOOKMARK.AddContent = function(strContentId, contentType) { BOOKMARK.AddContent = function(strContentId, contentType) {
var isFound = false; var isFound = false;
for (var nIndex = 0; nIndex < BOOKMARK.collection_contents.length; nIndex++) { for ( var nIndex = 0; nIndex < BOOKMARK.collection_contents.length; nIndex++) {
if (BOOKMARK.collection_contents[nIndex].contentid == strContentId) { if (BOOKMARK.collection_contents[nIndex].contentid == strContentId) {
isFound = true; isFound = true;
break; break;
} }
} }
// Add to bufer if it does not exist // Add to bufer if it does not exist
if(!isFound) { if (!isFound) {
BOOKMARK.collection_contents.push({ 'contentid': strContentId, 'contentType': contentType, 'contentTitle': "", 'contentTitleKana': "", 'pages': [] }); BOOKMARK.collection_contents.push({
'contentid' : strContentId,
'contentType' : contentType,
'contentTitle' : "",
'contentTitleKana' : "",
'pages' : []
});
} }
}; };
/* /*
event of changing language * event of changing language
*/ */
function changeLanguageCallBackFunction() { function changeLanguageCallBackFunction() {
if (I18N.getCurrentLanguage() != COMMON.Consts.ConstLanguage_Ja) { if (I18N.getCurrentLanguage() != COMMON.Consts.ConstLanguage_Ja) {
$("#dspTitleNmKn").hide(); $("#dspTitleNmKn").hide();
$("#dspTitleNmKn_Seperate").hide(); $("#dspTitleNmKn_Seperate").hide();
$("#txtTitleNmKnAsc").hide(); $("#txtTitleNmKnAsc").hide();
$("#txtTitleNmKnDesc").hide(); $("#txtTitleNmKnDesc").hide();
} } else {
else {
$("#dspTitleNmKn").show(); $("#dspTitleNmKn").show();
$("#dspTitleNmKn_Seperate").show(); $("#dspTitleNmKn_Seperate").show();
if (ClientData.sortOpt_searchDivision() == 2) { // Kana if (ClientData.sortOpt_searchDivision() == 2) { // Kana
...@@ -904,13 +878,10 @@ function changeLanguageCallBackFunction() { ...@@ -904,13 +878,10 @@ function changeLanguageCallBackFunction() {
document.title = I18N.i18nText('dspShiori') + ' | ' + I18N.i18nText('sysAppTitle'); document.title = I18N.i18nText('dspShiori') + ' | ' + I18N.i18nText('sysAppTitle');
}; };
/* /*
Synchronize bookmark with server * Synchronize bookmark with server . Check existence of content -> Delete
. Check existence of content * absence content in local
-> Delete absence content in local * . Check existence of pages -> Delete absence pages in local
*/
. Check existence of pages
-> Delete absence pages in local
*/
BOOKMARK.SyncContent = function() { BOOKMARK.SyncContent = function() {
// Reset error contents // Reset error contents
...@@ -922,7 +893,7 @@ BOOKMARK.SyncContent = function() { ...@@ -922,7 +893,7 @@ BOOKMARK.SyncContent = function() {
// Get bookmarks from local storage // Get bookmarks from local storage
var arrBookmarks = ClientData.BookMarkData(); var arrBookmarks = ClientData.BookMarkData();
for (var nIndex = arrBookmarks.length - 1; nIndex >= 0; nIndex--) { for ( var nIndex = arrBookmarks.length - 1; nIndex >= 0; nIndex--) {
var oneBookMark = arrBookmarks[nIndex]; var oneBookMark = arrBookmarks[nIndex];
// ================================== // ==================================
...@@ -936,10 +907,11 @@ BOOKMARK.SyncContent = function() { ...@@ -936,10 +907,11 @@ BOOKMARK.SyncContent = function() {
// System error excepting 404 // System error excepting 404
AVWEB.showSystemError(); AVWEB.showSystemError();
return; return;
} } else {
else {
// Add to list of error content // Add to list of error content
BOOKMARK.bookmark_errorContent.push({ contentid: oneBookMark.contentid }); BOOKMARK.bookmark_errorContent.push({
contentid : oneBookMark.contentid
});
// Remove bookmark // Remove bookmark
arrBookmarks.splice(nIndex, 1); arrBookmarks.splice(nIndex, 1);
ClientData.isChangedBookmark(true); ClientData.isChangedBookmark(true);
...@@ -951,13 +923,12 @@ BOOKMARK.SyncContent = function() { ...@@ -951,13 +923,12 @@ BOOKMARK.SyncContent = function() {
else { else {
// Add nromal content // Add nromal content
var result = BOOKMARK.IsExistContentAuthGroup(oneBookMark.contentid); var result = BOOKMARK.IsExistContentAuthGroup(oneBookMark.contentid);
if( result["isExisted"] == true ){ if (result["isExisted"] == true) {
BOOKMARK.AddContent(oneBookMark.contentid, result["contentType"]); BOOKMARK.AddContent(oneBookMark.contentid, result["contentType"]);
} }
} }
} }
} } else {
else {
arrBookmarks.splice(nIndex, 1); arrBookmarks.splice(nIndex, 1);
ClientData.isChangedBookmark(true); ClientData.isChangedBookmark(true);
} }
...@@ -969,22 +940,21 @@ BOOKMARK.SyncContent = function() { ...@@ -969,22 +940,21 @@ BOOKMARK.SyncContent = function() {
}; };
/* /*
Check content whether existed or not * Check content whether existed or not
*/ */
BOOKMARK.IsExistContent = function(strContentId) { BOOKMARK.IsExistContent = function(strContentId) {
var isExisted = false; var isExisted = false;
var contentType = ''; var contentType = '';
var result = []; var result = [];
var params = { var params = {
sid: ClientData.userInfo_sid(), sid : ClientData.userInfo_sid(),
getType: '1', getType : '1',
contentId: strContentId, contentId : strContentId,
authCode: "0" authCode : "0"
}; };
result["isExisted"] = isExisted; result["isExisted"] = isExisted;
AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", 'GET', params, AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", 'GET', params, function(data) {
function (data) {
isExisted = true; isExisted = true;
contentType = data.contentData.contentType; contentType = data.contentData.contentType;
...@@ -992,20 +962,21 @@ BOOKMARK.IsExistContent = function(strContentId) { ...@@ -992,20 +962,21 @@ BOOKMARK.IsExistContent = function(strContentId) {
result["contentType"] = contentType; result["contentType"] = contentType;
// save content type // save content type
//BOOKMARK.contentTypes[strContentId] = contentType; // BOOKMARK.contentTypes[strContentId] = contentType;
//BOOKMARK.contentName[strContentId] = data.contentData.contentName; // BOOKMARK.contentName[strContentId] = data.contentData.contentName;
//BOOKMARK.download[strContentId] = data.download; // BOOKMARK.download[strContentId] = data.download;
// save alert message level // save alert message level
//LIMIT_ACCESS_CONTENT.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) {
function (xmlHttpRequest, txtStatus, errorThrown) {
if (xmlHttpRequest.status == 404) { if (xmlHttpRequest.status == 404) {
isExisted = false; isExisted = false;
} } else {
else {
// Show system error // Show system error
isExisted = true; // Mark this flag to prevent bookmarks from deleting isExisted = true; // Mark this flag to prevent bookmarks from
// deleting
AVWEB.showSystemError(); AVWEB.showSystemError();
} }
}); });
...@@ -1014,22 +985,21 @@ BOOKMARK.IsExistContent = function(strContentId) { ...@@ -1014,22 +985,21 @@ BOOKMARK.IsExistContent = function(strContentId) {
}; };
/* /*
Check content whether existed or not * Check content whether existed or not
*/ */
BOOKMARK.IsExistContentAuthGroup = function(strContentId) { BOOKMARK.IsExistContentAuthGroup = function(strContentId) {
var isExisted = false; var isExisted = false;
var contentType = ''; var contentType = '';
var result = []; var result = [];
var params = { var params = {
sid: ClientData.userInfo_sid(), sid : ClientData.userInfo_sid(),
getType: '1', getType : '1',
contentId: strContentId, contentId : strContentId,
authCode: ClientData.authCode() authCode : ClientData.authCode()
}; };
result["isExisted"] = isExisted; result["isExisted"] = isExisted;
AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", 'GET', params, AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", 'GET', params, function(data) {
function (data) {
isExisted = true; isExisted = true;
contentType = data.contentData.contentType; contentType = data.contentData.contentType;
...@@ -1041,14 +1011,15 @@ BOOKMARK.IsExistContentAuthGroup = function(strContentId) { ...@@ -1041,14 +1011,15 @@ BOOKMARK.IsExistContentAuthGroup = function(strContentId) {
BOOKMARK.contentName[strContentId] = data.contentData.contentName; BOOKMARK.contentName[strContentId] = data.contentData.contentName;
BOOKMARK.download[strContentId] = data.download; BOOKMARK.download[strContentId] = data.download;
// save alert message level // save alert message level
LIMIT_ACCESS_CONTENT.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) {
function (xmlHttpRequest, txtStatus, errorThrown) {
if (xmlHttpRequest.status == 404) { if (xmlHttpRequest.status == 404) {
isExisted = false; isExisted = false;
} } else {
else {
// Show system error // Show system error
isExisted = true; // Mark this flag to prevent bookmarks from deleting isExisted = true; // Mark this flag to prevent bookmarks from deleting
AVWEB.showSystemError(); AVWEB.showSystemError();
...@@ -1058,32 +1029,31 @@ BOOKMARK.IsExistContentAuthGroup = function(strContentId) { ...@@ -1058,32 +1029,31 @@ BOOKMARK.IsExistContentAuthGroup = function(strContentId) {
return result; return result;
}; };
/* /*
---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
Setting dialog [ end ] * Setting dialog [ end ]
---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
BOOKMARK.showContentView = function(){ BOOKMARK.showContentView = function() {
//TOPに戻す // TOPに戻す
var y = 0; var y = 0;
if( document.documentElement.scrollTop ){ if (document.documentElement.scrollTop) {
y = document.documentElement.scrollTop; y = document.documentElement.scrollTop;
} }
if( document.body.scrollTop ){ if (document.body.scrollTop) {
if( y == undefined || y == 0){ if (y == undefined || y == 0) {
y = document.body.scrollTop; y = document.body.scrollTop;
} }
} }
if( y == undefined || y == null){ if (y == undefined || y == null) {
y = 0; y = 0;
} }
BOOKMARK.scrollTop = y; BOOKMARK.scrollTop = y;
window.scrollTo(0,0); window.scrollTo(0, 0);
//試験 // 試験
$("#header-ws").hide(); $("#header-ws").hide();
$("#ws-body").hide(); $("#ws-body").hide();
$("#topcontrol").hide(); $("#topcontrol").hide();
...@@ -1096,24 +1066,24 @@ BOOKMARK.showContentView = function(){ ...@@ -1096,24 +1066,24 @@ BOOKMARK.showContentView = function(){
}; };
BOOKMARK.cssInit = function(){ BOOKMARK.cssInit = function() {
$('html').css({ $('html').css({
'overflow-y':'scroll' 'overflow-y' : 'scroll'
}); });
$('html,body').css({ $('html,body').css({
'height':'100%', 'height' : '100%',
'margin': '0', 'margin' : '0',
'padding': '0' 'padding' : '0'
}); });
$('html>body').css({ $('html>body').css({
'font-size':'16px', 'font-size' : '16px',
'font-size':'68.75%' 'font-size' : '68.75%'
}); });
$('body').css({ $('body').css({
'font-family':'Verdana, helvetica, arial, sans-serif', 'font-family' : 'Verdana, helvetica, arial, sans-serif',
'font-size':'68.75%', 'font-size' : '68.75%',
'background':'#fff', 'background' : '#fff',
'color':'#333' 'color' : '#333'
}); });
}; };
...@@ -1123,9 +1093,7 @@ BOOKMARK.downloadFunction = function(e) { ...@@ -1123,9 +1093,7 @@ BOOKMARK.downloadFunction = function(e) {
} }
var contentId = $(this).attr('contentid'); var contentId = $(this).attr('contentid');
//Download content // Download content
HEADER.downloadResourceById(contentId); HEADER.downloadResourceById(contentId);
}; };
//名前空間用のオブジェクトを用意する //名前空間用のオブジェクトを用意する
var CONTENTSEARCH = {}; var CONTENTSEARCH = {};
//Start Declare Variables // Start Declare Variables
//----Constant-----------// // ----Constant-----------//
CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM = 1; CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM = 0;
//CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_TO = 15; // CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_TO = 15;
CONTENTSEARCH.DEFAULT_SORT_TYPE = '1'; CONTENTSEARCH.DEFAULT_SORT_TYPE = '1';
CONTENTSEARCH.DEFAULT_SORT_ORDER = '1'; CONTENTSEARCH.DEFAULT_SORT_ORDER = '1';
//CONTENTSEARCH.DEFAULT_SEARCH_DIVISION = 0; // CONTENTSEARCH.DEFAULT_SEARCH_DIVISION = 0;
CONTENTSEARCH.iNumberOfNextRecord = 15; CONTENTSEARCH.iNumberOfNextRecord = 15;
//Thumbnail array // Thumbnail array
CONTENTSEARCH.thumbnailArr = []; CONTENTSEARCH.thumbnailArr = [];
//Content type array. // Content type array.
CONTENTSEARCH.contentTypeArr = []; CONTENTSEARCH.contentTypeArr = [];
CONTENTSEARCH.contentIdArray = []; CONTENTSEARCH.contentIdArray = [];
...@@ -22,12 +21,12 @@ CONTENTSEARCH.chkSearchTextEmpty = false; ...@@ -22,12 +21,12 @@ CONTENTSEARCH.chkSearchTextEmpty = false;
CONTENTSEARCH.noRecordFlg = false; CONTENTSEARCH.noRecordFlg = false;
CONTENTSEARCH.home_isMove = false; CONTENTSEARCH.home_isMove = false;
//スクロール復帰 // スクロール復帰
CONTENTSEARCH.scrollTop = 0; CONTENTSEARCH.scrollTop = 0;
$(document).ready(function(){ $(document).ready(function() {
if (!AVWEB.avwCheckLogin(COMMON.ScreenIds.Login)){ if (!AVWEB.avwCheckLogin(COMMON.ScreenIds.Login)) {
return; return;
} }
...@@ -38,58 +37,69 @@ $(document).ready(function(){ ...@@ -38,58 +37,69 @@ $(document).ready(function(){
// Set bookmark screen // Set bookmark screen
ClientData.BookmarkScreen(COMMON.ScreenIds.ContentSearch); ClientData.BookmarkScreen(COMMON.ScreenIds.ContentSearch);
//Check if Force Change password // Check if Force Change password
if(ClientData.requirePasswordChange() != 1){ if (ClientData.requirePasswordChange() != 1) {
//Format text display more record // Format text display more record
CONTENTSEARCH.formatDisplayMoreRecord(); CONTENTSEARCH.formatDisplayMoreRecord();
//remove hover effect when is touch device // remove hover effect when is touch device
CONTENTSEARCH.removeHoverCss(); CONTENTSEARCH.removeHoverCss();
//InitScreen // InitScreen
CONTENTSEARCH.initialScreen(); CONTENTSEARCH.initialScreen();
//Render Grid // Render Grid
CONTENTSEARCH.renderGridView(); CONTENTSEARCH.renderGridView();
//Go To Details Page // Go To Details Page
$('#main-ws canvas').live('click', CONTENTSEARCH.canvasClickFunction); $('#main-ws canvas').live('click', CONTENTSEARCH.canvasClickFunction);
$('#main-ws canvas').live('touchend', CONTENTSEARCH.canvasClickFunction); $('#main-ws canvas').live('touchend', CONTENTSEARCH.canvasClickFunction);
$('#main-ws canvas').live('touchmove', function () { CONTENTSEARCH.home_isMove = true; }); $('#main-ws canvas').live('touchmove', function() {
CONTENTSEARCH.home_isMove = true;
});
//Open dialog // Open dialog
$('.dialog').live('click', CONTENTSEARCH.titleClickFunction); $('.dialog').live('click', CONTENTSEARCH.titleClickFunction);
//$('.dialog').live('touchstart', CONTENTSEARCH.titleClickFunction); // $('.dialog').live('touchstart', CONTENTSEARCH.titleClickFunction);
$('.dialog').live('touchend', CONTENTSEARCH.titleClickFunction); $('.dialog').live('touchend', CONTENTSEARCH.titleClickFunction);
$('.dialog').live('touchmove', function () { CONTENTSEARCH.home_isMove = true; }); $('.dialog').live('touchmove', function() {
CONTENTSEARCH.home_isMove = true;
});
//Show Next Record // Show Next Record
$('a#control-nextrecord').click(CONTENTSEARCH.showNextRecordFunction); $('a#control-nextrecord').click(CONTENTSEARCH.showNextRecordFunction);
//Sort Title // Sort Title
$('#control-sort-title').click(CONTENTSEARCH.sortByTitleFunction); $('#control-sort-title').click(CONTENTSEARCH.sortByTitleFunction);
//Sort by title kana // Sort by title kana
$('#control-sort-titlekana').click(CONTENTSEARCH.sortByTitleKanaFunction); $('#control-sort-titlekana').click(CONTENTSEARCH.sortByTitleKanaFunction);
//sort by release date // sort by release date
$('#control-sort-releasedate').click(CONTENTSEARCH.sortByReleaseDateFunction); $('#control-sort-releasedate').click(CONTENTSEARCH.sortByReleaseDateFunction);
//Go To Details Page // Go To Details Page
$('.button-details').live('click', CONTENTSEARCH.readSubmenuFunction); $('.button-details').live('click', CONTENTSEARCH.readSubmenuFunction);
//$('.button-details').live('touchstart', CONTENTSEARCH.readSubmenuFunction); // $('.button-details').live('touchstart',
// CONTENTSEARCH.readSubmenuFunction);
$('.button-details').live('touchend', CONTENTSEARCH.readSubmenuFunction); $('.button-details').live('touchend', CONTENTSEARCH.readSubmenuFunction);
$('.button-details').live('touchmove', function () { CONTENTSEARCH.home_isMove = true; }); $('.button-details').live('touchmove', function() {
CONTENTSEARCH.home_isMove = true;
});
//Show Share Dialog // Show Share Dialog
$('.button-share').live('click', CONTENTSEARCH.showContentShareDlgFunction); $('.button-share').live('click', CONTENTSEARCH.showContentShareDlgFunction);
$('.button-share').live('touchend', CONTENTSEARCH.showContentShareDlgFunction); $('.button-share').live('touchend', CONTENTSEARCH.showContentShareDlgFunction);
$('.button-share').live('touchmove', function () { CONTENTSEARCH.home_isMove = true; }); $('.button-share').live('touchmove', function() {
CONTENTSEARCH.home_isMove = true;
});
//ダイハツ // ダイハツ
$('.button-download').live('click', CONTENTSEARCH.downloadSubmenuFunction); $('.button-download').live('click', CONTENTSEARCH.downloadSubmenuFunction);
$('.button-download').live('touchend', CONTENTSEARCH.downloadSubmenuFunction); $('.button-download').live('touchend', CONTENTSEARCH.downloadSubmenuFunction);
$('.button-download').live('touchmove', function () { CONTENTSEARCH.home_isMove = true; }); $('.button-download').live('touchmove', function() {
CONTENTSEARCH.home_isMove = true;
});
$('#main-search').click(CONTENTSEARCH.searchEventButtonFunction); $('#main-search').click(CONTENTSEARCH.searchEventButtonFunction);
...@@ -103,167 +113,150 @@ $(document).ready(function(){ ...@@ -103,167 +113,150 @@ $(document).ready(function(){
$('#control-nextrecord').css('visibility', 'hidden'); $('#control-nextrecord').css('visibility', 'hidden');
$(window).resize(function () { $(window).resize(function() {
if ($("#contentDetail").css("display") != "none") { if ($("#contentDetail").css("display") != "none") {
// Refresh panel of detail to center. // Refresh panel of detail to center.
$("#contentDetail").center(); $("#contentDetail").center();
if ($("#contentDetail").height() > $(window).height()){ if ($("#contentDetail").height() > $(window).height()) {
$("#contentDetail").css('top', '0'); $("#contentDetail").css('top', '0');
} }
} }
}); });
}else{ } else {
//Check if Force Change password // Check if Force Change password
HEADER.checkForceChangePassword(); HEADER.checkForceChangePassword();
} }
if (COMMON.isAnonymousLogin()) { if (COMMON.isAnonymousLogin()) {
//プッシュメッセージ隠す // プッシュメッセージ隠す
$('#dspPushMessage').hide(); $('#dspPushMessage').hide();
} }
//詳細、共有表示パーツ読み込み // 詳細、共有表示パーツ読み込み
$("#inc_detail").load("./inc_detail.html?__UPDATEID__", function (myData, myStatus, xhr){ $("#inc_detail").load("./inc_detail.html?__UPDATEID__", function(myData, myStatus, xhr) {
//読み込み完了時の処理 // 読み込み完了時の処理
I18N.i18nReplaceText(); I18N.i18nReplaceText();
$('.datepicker').pickadate({ $('.datepicker').pickadate({
format: 'yyyy-mm-dd' format : 'yyyy-mm-dd'
}); });
}); });
//ビューア、共有表示パーツ読み込み // ビューア、共有表示パーツ読み込み
$("#viewer").load("./inc_contentview.html?__UPDATEID__", function (myData, myStatus, xhr){ $("#viewer").load("./inc_contentview.html?__UPDATEID__", function(myData, myStatus, xhr) {
//読み込み完了時の処理 // 読み込み完了時の処理
I18N.i18nReplaceText(); I18N.i18nReplaceText();
}); });
}); });
CONTENTSEARCH.mainSearchBodyClickFunction = function() {
CONTENTSEARCH.mainSearchBodyClickFunction = function(){ $('#main-body').attr('checked', 'checked');
$('#main-body').attr('checked','checked');
$('#main-tag').removeAttr('checked'); $('#main-tag').removeAttr('checked');
$('#main-content').removeAttr('checked'); $('#main-content').removeAttr('checked');
}; };
CONTENTSEARCH.mainSearchTagClickFunction = function(){ CONTENTSEARCH.mainSearchTagClickFunction = function() {
$('#main-tag').attr('checked','checked'); $('#main-tag').attr('checked', 'checked');
$('#main-body').removeAttr('checked'); $('#main-body').removeAttr('checked');
$('#main-content').removeAttr('checked'); $('#main-content').removeAttr('checked');
}; };
CONTENTSEARCH.mainSearchContentClickFunction = function(){ CONTENTSEARCH.mainSearchContentClickFunction = function() {
$('#main-content').attr('checked','checked'); $('#main-content').attr('checked', 'checked');
$('#main-tag').removeAttr('checked'); $('#main-tag').removeAttr('checked');
$('#main-body').removeAttr('checked'); $('#main-body').removeAttr('checked');
}; };
CONTENTSEARCH.mainSearchKeyDownFunction = function(e) {
CONTENTSEARCH.mainSearchKeyDownFunction = function(e){
var code = (e.keyCode ? e.keyCode : e.which); var code = (e.keyCode ? e.keyCode : e.which);
if(code == 13) { //Enter keycode if (code == 13) { // Enter keycode
$('#main-search').click(); $('#main-search').click();
} }
}; };
//Call API // Call API
CONTENTSEARCH.abapi = function(name, param, method, callback){ CONTENTSEARCH.abapi = function(name, param, method, callback) {
AVWEB.avwCmsApi(ClientData.userInfo_accountPath(), name, method, param, callback, null); AVWEB.avwCmsApi(ClientData.userInfo_accountPath(), name, method, param, callback, null);
}; };
//Initial screen // Initial screen
CONTENTSEARCH.initialScreen = function(){ CONTENTSEARCH.initialScreen = function() {
var searchText = ClientData.searchCond_searchText(); var searchText = ClientData.searchCond_searchText();
var searchDivision = ClientData.searchCond_searchDivision(); var searchDivision = ClientData.searchCond_searchDivision();
$('#txtSearchWs').val(searchText); $('#txtSearchWs').val(searchText);
//ClientData.searchCond_searchText(''); // ClientData.searchCond_searchText('');
if(searchDivision == 1){ if (searchDivision == 1) {
$('#main-tag').attr('checked',false); $('#main-tag').attr('checked', false);
$('#main-body').attr('checked',false); $('#main-body').attr('checked', false);
$('#main-content').attr('checked','checked'); $('#main-content').attr('checked', 'checked');
} } else if (searchDivision == 2) {
else if(searchDivision == 2){ $('#main-content').attr('checked', false);
$('#main-content').attr('checked',false); $('#main-body').attr('checked', false);
$('#main-body').attr('checked',false); $('#main-tag').attr('checked', 'checked');
$('#main-tag').attr('checked','checked'); } else {
} $('#main-content').attr('checked', false);
else $('#main-tag').attr('checked', false);
{ $('#main-body').attr('checked', 'checked');
$('#main-content').attr('checked',false);
$('#main-tag').attr('checked',false);
$('#main-body').attr('checked','checked');
} }
CONTENTSEARCH.handleLanguage(); CONTENTSEARCH.handleLanguage();
}; };
///Render Content // /Render Content
CONTENTSEARCH.renderContent = function(id, text, division, type, order, from, to, cateid, grpid){ CONTENTSEARCH.renderContent = function(id, text, division, type, order, from, to, cateid, grpid) {
//console.log("CONTENTSEARCH.renderContent"); // console.log("CONTENTSEARCH.renderContent");
var params = { var params = {
sid: id, sid : id,
searchText: text, searchText : text,
searchDivision: division, searchDivision : division,
sortType: type, sortType : type,
sortOrder: order, sortOrder : order,
recordFrom: from, recordFrom : from,
recordTo: to, recordTo : to,
genreId: cateid, genreId : cateid,
groupId: grpid, groupId : grpid,
authCode: ClientData.authCode() authCode : ClientData.authCode()
}; };
CONTENTSEARCH.abapi('webContentList', params, 'POST', function (data) { CONTENTSEARCH.abapi('webContentList', params, 'POST', function(data) {
$.each(data.contentList, function (i, post) {
var versionArr = ClientData.ResourceVersion();
var outputDate =""; var metaArr = ClientData.MetaVersion();
if(post.contentDeliveryDate!=null&&post.contentDeliveryDate!=undefined&&post.contentDeliveryDate!='undefined') var readArr = ClientData.ReadingContentIds();
{
outputDate=COMMON.formatDeliveryDate(post.contentDeliveryDate); $.each(data.contentList, function(i, post) {
}
var outputDate = "";
var htmlTemp ='<section class="sectionsearchlist">' if (post.contentDeliveryDate != null && post.contentDeliveryDate != undefined && post.contentDeliveryDate != 'undefined') {
+ ' <div class="cnt_section_list">' outputDate = COMMON.formatDeliveryDate(post.contentDeliveryDate);
+ ' <a class="img">' }
+ ' <canvas height="110" width="150" id="content-thumbnail' + post.contentId + '" contentid="' + post.contentId + '" style="display:none;">'
+ ' </canvas>' var htmlTemp = '<section class="sectionsearchlist">' + ' <div class="cnt_section_list">' + ' <a class="img">' + ' <canvas height="110" width="150" id="content-thumbnail'
+ ' <img id="loadingIcon' + post.contentId + '" src="./img/data_loading.gif" height="25px" width="25px" style="padding: 46px; "/>' + post.contentId + '" contentid="' + post.contentId + '" style="display:none;">' + ' </canvas>' + ' <img id="loadingIcon' + post.contentId
+ ' </a>' + '" src="./img/data_loading.gif" height="25px" width="25px" style="padding: 46px; "/>' + ' </a>' + ' <div class="text">' + ' <a id="title' + post.contentId
+ ' <div class="text">' + '" class="name dialog" contentid="' + post.contentId + '">' + ' <img class="listIcon" src="' + HEADER.getIconTypeContent(post.contentType)
+ ' <a id="title' + post.contentId + '" class="name dialog" contentid="' + post.contentId + '">' + '" width="20" height="20">' + COMMON.truncate(COMMON.htmlEncode(post.contentTitle), 20) + ' </a>' + ' <div class="info">' + ' <ul class="date">'
+ ' <img class="listIcon" src="' + HEADER.getIconTypeContent(post.contentType)+'" width="20" height="20">' + ' <li><span class="lang" lang="txtPubDt"> </span> : ' + outputDate + '</li>' + ' <li><span class="lang" lang="txtViewDt"> </span>:<span id="lblVdate' + post.contentId
+ COMMON.truncate(COMMON.htmlEncode(post.contentTitle), 20) + '"> </span></li>' + ' </ul>' + ' <ul class="pic">' + ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MEMO + '" id="imgMemo' + post.contentId
+ ' </a>' + '" class="sticker" /></li>' + ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MARKING + '" id="imgBookMark' + post.contentId + '" class="pen" /></li>'
+ ' <div class="info">' + ' <li><ul class="iconList">{share}{download}<li><a class="read lang button-details" contentid="' + post.contentId + '" lang="txtRead">読む</a></li></ul></li>' + ' </ul>'
+ ' <ul class="date">' + ' </div>' + ' </div>' + ' </div>' + '</section>';
+ ' <li><span class="lang" lang="txtPubDt"> </span> : ' + outputDate + '</li>'
+ ' <li><span class="lang" lang="txtViewDt"> </span>:<span id="lblVdate' + post.contentId + '"> </span></li>'
+ ' </ul>'
+ ' <ul class="pic">'
+ ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MEMO + '" id="imgMemo' + post.contentId + '" class="sticker" /></li>'
+ ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MARKING + '" id="imgBookMark' + post.contentId + '" class="pen" /></li>'
+ ' <li><ul class="iconList">{share}{download}<li><a class="read lang button-details" contentid="' + post.contentId + '" lang="txtRead">読む</a></li></ul></li>'
+ ' </ul>'
+ ' </div>'
+ ' </div>'
+ ' </div>'
+ '</section>';
var shareHtml = ""; var shareHtml = "";
if( post.readerShare == '1' ){ if (post.readerShare == '1') {
shareHtml ='<li><a class="read lang button-share" contentid="' + post.contentId + '" lang="txtShare">共有</a></li>'; shareHtml = '<li><a class="read lang button-share" contentid="' + post.contentId + '" lang="txtShare">共有</a></li>';
} }
htmlTemp = htmlTemp.replace(/\{share\}/g, shareHtml); htmlTemp = htmlTemp.replace(/\{share\}/g, shareHtml);
//ダイハツ対応 // ダイハツ対応
//console.log("downloadHtml:" + post.download); // console.log("downloadHtml:" + post.download);
var downloadHtml = ""; var downloadHtml = "";
if( post.download == '1' ){ if (post.download == '1') {
downloadHtml ='<li><a class="read button-download" contentid="' + post.contentId + '" >ダウンロード</a></li>'; downloadHtml = '<li><a class="read button-download" contentid="' + post.contentId + '" >ダウンロード</a></li>';
} }
htmlTemp = htmlTemp.replace(/\{download\}/g, downloadHtml); htmlTemp = htmlTemp.replace(/\{download\}/g, downloadHtml);
...@@ -271,84 +264,95 @@ CONTENTSEARCH.renderContent = function(id, text, division, type, order, from, to ...@@ -271,84 +264,95 @@ CONTENTSEARCH.renderContent = function(id, text, division, type, order, from, to
CONTENTSEARCH.getNextRecordNumForList(); CONTENTSEARCH.getNextRecordNumForList();
//assign thumbnail to array // assign thumbnail to array
var formatThumbnail = post.contentThumbnail; var formatThumbnail = post.contentThumbnail;
if((formatThumbnail != null) && (formatThumbnail != 'undefined') && (formatThumbnail != '')){ if ((formatThumbnail != null) && (formatThumbnail != 'undefined') && (formatThumbnail != '')) {
formatThumbnail = COMMON.formatStringBase64(formatThumbnail); formatThumbnail = COMMON.formatStringBase64(formatThumbnail);
} }
CONTENTSEARCH.thumbnailArr.push({ contentId: post.contentId, thumbnail: formatThumbnail}); CONTENTSEARCH.thumbnailArr.push({
contentId : post.contentId,
thumbnail : formatThumbnail
});
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type to array to manage. CONTENTSEARCH.contentTypeArr.push({
//assign content type to array contentId : post.contentId,
CONTENTSEARCH.contentTypeArr.push({ contentId: post.contentId, contentType: post.contentType }); contentType : post.contentType
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type to array to manage. });
// save alert message level // save alert message level
LIMIT_ACCESS_CONTENT.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. // Check if user has read this content or not.
CONTENTSEARCH.checkUserHasReadContent(post.contentId, post.resourceVersion, post.metaVersion); CONTENTSEARCH.checkUserHasReadContent(post.contentId, post.resourceVersion, post.metaVersion, versionArr, metaArr, readArr);
//assign version to array // assign version to array
COMMON.resourceVersionArr.push({ contentid: post.contentId, resourceversion: post.resourceVersion }); COMMON.resourceVersionArr.push({
contentid : post.contentId,
resourceversion : post.resourceVersion
});
//assign meta version to array // assign meta version to array
COMMON.metaVersionArr.push({ contentid: post.contentId, metaversion: post.metaVersion }); COMMON.metaVersionArr.push({
contentid : post.contentId,
metaversion : post.metaVersion
});
//Check if content has marking or memo // Check if content has marking or memo
CONTENTSEARCH.checkContentMarkingMemoOption(post.contentId); CONTENTSEARCH.checkContentMarkingMemoOption(post.contentId);
//renderViewDate // renderViewDate
var viewdate = CONTENTSEARCH.renderViewDate(post.contentId); var viewdate = CONTENTSEARCH.renderViewDate(post.contentId, readArr);
if (viewdate != null || viewdate != 'undefined') { if (viewdate != null || viewdate != 'undefined') {
$('#lblVdate' + post.contentId).html(viewdate); $('#lblVdate' + post.contentId).html(viewdate);
} }
}); });
//Get Next record number for list // Get Next record number for list
CONTENTSEARCH.getNextRecordNumForList(); CONTENTSEARCH.getNextRecordNumForList();
if(data.totalRecord < data.recordTo){ // if (data.totalRecord < data.recordTo) {
ClientData.searchCond_recordTo(data.totalRecord); // ClientData.searchCond_recordTo(data.totalRecord);
}else{ // } else {
ClientData.searchCond_recordTo(data.recordTo); // ClientData.searchCond_recordTo(data.recordTo);
} // }
// ClientData.searchCond_recordFrom(data.recordFrom);
ClientData.searchCond_recordFrom(data.recordFrom); ClientData.searchCond_recordFrom(data.recordFrom);
ClientData.searchCond_recordTo(data.recordTo);
CONTENTSEARCH.totalPage = data.totalRecord; CONTENTSEARCH.totalPage = data.totalRecord;
//Render Page number // Render Page number
if(CONTENTSEARCH.totalPage == 0){ if (CONTENTSEARCH.totalPage == 0) {
CONTENTSEARCH.reRenderPageNumber(CONTENTSEARCH.totalPage, CONTENTSEARCH.totalPage); CONTENTSEARCH.reRenderPageNumber(CONTENTSEARCH.totalPage, CONTENTSEARCH.totalPage);
} } else {
else{
CONTENTSEARCH.reRenderPageNumber(ClientData.searchCond_recordTo(), CONTENTSEARCH.totalPage); CONTENTSEARCH.reRenderPageNumber(ClientData.searchCond_recordTo(), CONTENTSEARCH.totalPage);
} }
//Toggle scroll to top Control // Toggle scroll to top Control
CONTENTSEARCH.handleBackToTop(); CONTENTSEARCH.handleBackToTop();
//I18N.changeLanguage(ClientData.userInfo_language()); // I18N.changeLanguage(ClientData.userInfo_language());
I18N.i18nReplaceText(); I18N.i18nReplaceText();
}); });
}; };
//Handle Back To Top Button // Handle Back To Top Button
CONTENTSEARCH.handleBackToTop = function(){ CONTENTSEARCH.handleBackToTop = function() {
if(ClientData.searchCond_recordTo() >= CONTENTSEARCH.totalPage){ if (ClientData.searchCond_recordTo() >= CONTENTSEARCH.totalPage) {
$('#control-nextrecord').css('visibility','hidden'); $('#control-nextrecord').css('visibility', 'hidden');
} } else {
else{ $('#control-nextrecord').css('visibility', 'visible');
$('#control-nextrecord').css('visibility','visible');
} }
if(CONTENTSEARCH.totalPage == 0){ if (CONTENTSEARCH.totalPage == 0) {
$('#control-nextrecord').css('visibility','hidden'); $('#control-nextrecord').css('visibility', 'hidden');
CONTENTSEARCH.displayResultNoRecord(); CONTENTSEARCH.displayResultNoRecord();
CONTENTSEARCH.noRecordFlg = true; CONTENTSEARCH.noRecordFlg = true;
} } else {
else {
$('#msgSearchNotExist').hide(); $('#msgSearchNotExist').hide();
$('#content-grid').removeClass('lang'); $('#content-grid').removeClass('lang');
$('#content-grid').removeAttr('lang'); $('#content-grid').removeAttr('lang');
...@@ -357,87 +361,75 @@ CONTENTSEARCH.handleBackToTop = function(){ ...@@ -357,87 +361,75 @@ CONTENTSEARCH.handleBackToTop = function(){
} }
}; };
//Handle language // Handle language
CONTENTSEARCH.handleLanguage = function(){ CONTENTSEARCH.handleLanguage = function() {
if (I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || I18N.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').css('display','none'); $('#separate').css('display', 'none');
$('#separate').css('display','none');
$("#titlekana-sorttype").html(''); $("#titlekana-sorttype").html('');
} } else {
else {
if (ClientData.searchCond_sortOrder() != null && ClientData.searchCond_sortOrder() != 'undefined' || ClientData.searchCond_sortType() != '') { if (ClientData.searchCond_sortOrder() != null && ClientData.searchCond_sortOrder() != 'undefined' || ClientData.searchCond_sortType() != '') {
var typeSort = ClientData.searchCond_sortType(); var typeSort = ClientData.searchCond_sortType();
var orderSort = ClientData.searchCond_sortOrder(); var orderSort = ClientData.searchCond_sortOrder();
HEADER.setStatusSort('#'+$('#menu_sort li.current a').attr('id'),orderSort == COMMON.Consts.ConstOrderSetting_Asc); HEADER.setStatusSort('#' + $('#menu_sort li.current a').attr('id'), orderSort == COMMON.Consts.ConstOrderSetting_Asc);
} }
if(CONTENTSEARCH.noRecordFlg){ if (CONTENTSEARCH.noRecordFlg) {
$('#control-sort-titlekana').css('display','block'); $('#control-sort-titlekana').css('display', 'block');
$('#separate').css('display','block'); $('#separate').css('display', 'block');
}else{ } else {
$('#control-sort-titlekana').css('display','block'); $('#control-sort-titlekana').css('display', 'block');
$('#separate').css('display','block'); $('#separate').css('display', 'block');
} }
} }
}; };
//Initial Screen // Initial Screen
CONTENTSEARCH.renderGridView = function(){ CONTENTSEARCH.renderGridView = function() {
var fromPage = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM; //var fromPage = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
var toPage = CONTENTSEARCH.returnNumberDispRecordForList(); //var toPage = CONTENTSEARCH.returnNumberDispRecordForList();
var sortType = CONTENTSEARCH.DEFAULT_SORT_TYPE; var sortType = CONTENTSEARCH.DEFAULT_SORT_TYPE;
var sortOrder = CONTENTSEARCH.DEFAULT_SORT_ORDER; var sortOrder = CONTENTSEARCH.DEFAULT_SORT_ORDER;
var searchText = ClientData.searchCond_searchText(); var searchText = ClientData.searchCond_searchText();
var searchDivision = ClientData.searchCond_searchDivision(); var searchDivision = ClientData.searchCond_searchDivision();
var sid = ClientData.userInfo_sid(); var sid = ClientData.userInfo_sid();
ClientData.searchCond_recordFrom(fromPage); var offsetPage = 0; //CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
var limitPage = CONTENTSEARCH.returnNumberDispRecordForList();
ClientData.searchCond_recordTo(toPage); ClientData.searchCond_recordFrom(0);
ClientData.searchCond_recordTo(0);
ClientData.searchCond_sortType(sortType); ClientData.searchCond_sortType(sortType);
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
ClientData.searchCond_searchDivision(searchDivision); ClientData.searchCond_searchDivision(searchDivision);
ClientData.searchCond_genreId(''); ClientData.searchCond_genreId('');
ClientData.searchCond_groupId(''); ClientData.searchCond_groupId('');
var genreId = ClientData.searchCond_genreId(); var genreId = ClientData.searchCond_genreId();
var groupId = ClientData.searchCond_groupId(); var groupId = ClientData.searchCond_groupId();
//Handle display sort // Handle display sort
CONTENTSEARCH.handleSortDisp(); CONTENTSEARCH.handleSortDisp();
//Language Handle // Language Handle
CONTENTSEARCH.handleLanguage(); CONTENTSEARCH.handleLanguage();
//Refresh GridView // Refresh GridView
CONTENTSEARCH.refreshGrid(); CONTENTSEARCH.refreshGrid();
//if(searchText == '' || searchText == null){
// CONTENTSEARCH.displayResultNoRecord();
// CONTENTSEARCH.chkSearchTextEmpty = true;
// CONTENTSEARCH.noRecordFlg = true;
// CONTENTSEARCH.reRenderPageNumber(0, 0);
//}
//else {
$('#msgSearchNotExist').hide(); $('#msgSearchNotExist').hide();
CONTENTSEARCH.chkSearchTextEmpty = false; CONTENTSEARCH.chkSearchTextEmpty = false;
//Render Gridview // Render Gridview
CONTENTSEARCH.renderContent(sid, searchText, searchDivision, sortType, sortOrder, fromPage, toPage, genreId, groupId); CONTENTSEARCH.renderContent(sid, searchText, searchDivision, sortType, sortOrder, offsetPage, limitPage, genreId, groupId);
$('#control-nextrecord').css('visibility','visible'); $('#control-nextrecord').css('visibility', 'visible');
//}
}; };
//Canvas Click function // Canvas Click function
CONTENTSEARCH.canvasClickFunction = function(e){ CONTENTSEARCH.canvasClickFunction = function(e) {
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
...@@ -458,77 +450,79 @@ CONTENTSEARCH.canvasClickFunction = function(e){ ...@@ -458,77 +450,79 @@ CONTENTSEARCH.canvasClickFunction = function(e){
var base64String = CONTENTSEARCH.returnThumbnail(outputId); var base64String = CONTENTSEARCH.returnThumbnail(outputId);
ClientData.contentInfo_contentThumbnail(base64String); ClientData.contentInfo_contentThumbnail(base64String);
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type of content.
var contentType = CONTENTSEARCH.returnContentType(outputId); var contentType = CONTENTSEARCH.returnContentType(outputId);
ClientData.contentInfo_contentType(contentType); ClientData.contentInfo_contentType(contentType);
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type of content.
//Store Content id that user has read // Store Content id that user has read
if(ClientData.ReadingContentIds().length > 0){
CONTENTSEARCH.contentIdArray = ClientData.ReadingContentIds(); CONTENTSEARCH.contentIdArray = ClientData.ReadingContentIds();
if (CONTENTSEARCH.contentIdArray.length > 0) {
for(var nIndex = 0; nIndex < CONTENTSEARCH.contentIdArray.length; nIndex++){ for ( var nIndex = 0; nIndex < CONTENTSEARCH.contentIdArray.length; nIndex++) {
if(CONTENTSEARCH.contentIdArray[nIndex].contentid == outputId){ if (CONTENTSEARCH.contentIdArray[nIndex].contentid == outputId) {
checkflag = true; checkflag = true;
break; break;
} }
else{
checkflag = false;
}
} }
if(!checkflag){ if (!checkflag) {
CONTENTSEARCH.contentIdArray.push({contentid: outputId, viewdate: '', originviewdate: ''}); CONTENTSEARCH.contentIdArray.push({
} contentid : outputId,
viewdate : '',
originviewdate : ''
});
} }
else{ } else {
CONTENTSEARCH.contentIdArray.push({contentid: outputId, viewdate: '', originviewdate: ''}); CONTENTSEARCH.contentIdArray.push({
contentid : outputId,
viewdate : '',
originviewdate : ''
});
} }
//Renew ReadingContentID // Renew ReadingContentID
var newArray = []; var newArray = [];
ClientData.ReadingContentIds(newArray); ClientData.ReadingContentIds(newArray);
//Set data for readingcontentid // Set data for readingcontentid
ClientData.ReadingContentIds(CONTENTSEARCH.contentIdArray); ClientData.ReadingContentIds(CONTENTSEARCH.contentIdArray);
//Set ResouceVersion for content // Set ResouceVersion for content
COMMON.setResourceVersionData(outputId); COMMON.setResourceVersionData(outputId);
//Set MetaVersion for content // Set MetaVersion for content
COMMON.setMetaVersionData(outputId); COMMON.setMetaVersionData(outputId);
//Close Submenu // Close Submenu
$('#dlgSubMenu').hide(); $('#dlgSubMenu').hide();
//Delete 'new' icon // Delete 'new' icon
CONTENTSEARCH.drawEditImage(outputId); CONTENTSEARCH.drawEditImage(outputId);
//Open content Detail // Open content Detail
DETAIL.openContentDetail(); DETAIL.openContentDetail();
}; };
//Re-render page from and total record // Re-render page from and total record
CONTENTSEARCH.reRenderPageNumber = function(dispRecord, dispTotal){ CONTENTSEARCH.reRenderPageNumber = function(dispRecord, dispTotal) {
if( dispTotal ){ if (dispTotal) {
$('#dispPage').html(dispRecord); $('#dispPage').html(dispRecord);
$('#totalPage').html(dispTotal); $('#totalPage').html(dispTotal);
$('#dispPage').css('visibility','visible'); $('#dispPage').css('visibility', 'visible');
$('#totalPage').css('visibility','visible'); $('#totalPage').css('visibility', 'visible');
$('.pageNumControl').css('visibility','visible'); $('.pageNumControl').css('visibility', 'visible');
} else { } else {
$('#dispPage').css('visibility','hidden'); $('#dispPage').css('visibility', 'hidden');
$('#totalPage').css('visibility','hidden'); $('#totalPage').css('visibility', 'hidden');
$('.pageNumControl').css('visibility','hidden'); $('.pageNumControl').css('visibility', 'hidden');
} }
}; };
//Show Next Record Function // Show Next Record Function
CONTENTSEARCH.showNextRecordFunction = function(){ CONTENTSEARCH.showNextRecordFunction = function() {
var fromPage = ClientData.searchCond_recordFrom(); //var fromPage = ClientData.searchCond_recordFrom();
var toPage = ClientData.searchCond_recordTo(); //var toPage = ClientData.searchCond_recordTo();
var sortType = ClientData.searchCond_sortType(); var sortType = ClientData.searchCond_sortType();
var sortOrder = ClientData.searchCond_sortOrder(); var sortOrder = ClientData.searchCond_sortOrder();
var searchText = ClientData.searchCond_searchText(); var searchText = ClientData.searchCond_searchText();
...@@ -538,221 +532,204 @@ CONTENTSEARCH.showNextRecordFunction = function(){ ...@@ -538,221 +532,204 @@ CONTENTSEARCH.showNextRecordFunction = function(){
var sid = ClientData.userInfo_sid(); var sid = ClientData.userInfo_sid();
var totalrecord = CONTENTSEARCH.totalPage; var totalrecord = CONTENTSEARCH.totalPage;
if(fromPage == null || fromPage == 'undefined'){ // if (fromPage == null || fromPage == 'undefined') {
fromPage = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM; // fromPage = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
} // }
// if (toPage == null || toPage == 'undefined') {
if(toPage == null || toPage == 'undefined'){ // toPage = CONTENTSEARCH.returnNumberDispRecordForList();
toPage = CONTENTSEARCH.returnNumberDispRecordForList(); // }
}
fromPage = eval(toPage) + 1;
var iRecordNumber = eval(totalrecord) - eval(fromPage);
if(iRecordNumber < CONTENTSEARCH.iNumberOfNextRecord) var offsetPage = ClientData.searchCond_recordTo();
{ if (offsetPage == null || offsetPage == 'undefined') {
toPage = eval(fromPage) + eval(iRecordNumber); offsetPage = 0;
}
else
{
toPage = eval(fromPage) + (eval(CONTENTSEARCH.iNumberOfNextRecord) - 1);
} }
var limitPage = CONTENTSEARCH.returnNumberDispRecordForList();
ClientData.searchCond_recordFrom(fromPage); // fromPage = eval(toPage) + 1;
ClientData.searchCond_recordTo(toPage); // var iRecordNumber = eval(totalrecord) - eval(fromPage);
// if (iRecordNumber < CONTENTSEARCH.iNumberOfNextRecord) {
// toPage = eval(fromPage) + eval(iRecordNumber);
// } else {
// toPage = eval(fromPage) + (eval(CONTENTSEARCH.iNumberOfNextRecord) - 1);
// }
// ClientData.searchCond_recordFrom(fromPage);
// ClientData.searchCond_recordTo(toPage);
if(fromPage <= totalrecord) if (offsetPage <= totalrecord) {
{ CONTENTSEARCH.renderContent(sid, searchText, searchDivision, sortType, sortOrder, offsetPage, limitPage, genreId, groupId);
CONTENTSEARCH.renderContent(sid, searchText, searchDivision, sortType, sortOrder, fromPage, toPage, genreId, groupId);
} }
}; };
//Sort By Title Function // Sort By Title Function
CONTENTSEARCH.sortByTitleFunction = function(){ CONTENTSEARCH.sortByTitleFunction = function() {
var sortOrder = ClientData.searchCond_sortOrder(); var sortOrder = ClientData.searchCond_sortOrder();
var sortType = ClientData.searchCond_sortType(); var sortType = ClientData.searchCond_sortType();
var sid = ClientData.userInfo_sid(); var sid = ClientData.userInfo_sid();
var recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM; //var recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
var recordTo = ClientData.searchCond_recordTo(); //var recordTo = ClientData.searchCond_recordTo();
var genreId = ClientData.searchCond_genreId(); var genreId = ClientData.searchCond_genreId();
var groupId = ClientData.searchCond_groupId(); var groupId = ClientData.searchCond_groupId();
if(sortOrder == COMMON.Consts.ConstOrderSetting_Asc) var offset = 0;
{ var limit = CONTENTSEARCH.returnNumberDispRecordForList();
if(sortType == '1'){
if (sortOrder == COMMON.Consts.ConstOrderSetting_Asc) {
if (sortType == '1') {
sortOrder = COMMON.Consts.ConstOrderSetting_Desc; sortOrder = COMMON.Consts.ConstOrderSetting_Desc;
} } else {
else{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
} }
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} } else {
else
{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
HEADER.setStatusSort('#control-sort-title',sortOrder == COMMON.Consts.ConstOrderSetting_Asc); HEADER.setStatusSort('#control-sort-title', sortOrder == COMMON.Consts.ConstOrderSetting_Asc);
if(recordFrom == null || recordFrom == 'undefined'){
recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
ClientData.searchCond_recordFrom(recordFrom);
}
if(recordTo == null || recordTo == 'undefined'){
recordTo = CONTENTSEARCH.returnNumberDispRecordForList(); // if (recordFrom == null || recordFrom == 'undefined') {
ClientData.searchCond_recordFrom(recordTo); // recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
} // ClientData.searchCond_recordFrom(recordFrom);
// }
// if (recordTo == null || recordTo == 'undefined') {
// recordTo = CONTENTSEARCH.returnNumberDispRecordForList();
// ClientData.searchCond_recordFrom(recordTo);
// }
sortType = '1'; sortType = '1';
ClientData.searchCond_sortType(sortType); ClientData.searchCond_sortType(sortType);
//refresh Gridview // refresh Gridview
CONTENTSEARCH.refreshGrid(); CONTENTSEARCH.refreshGrid();
//refresh add more record // refresh add more record
$('#control-nextrecord').css('visibility','hidden'); $('#control-nextrecord').css('visibility', 'hidden');
CONTENTSEARCH.renderContent(sid, ClientData.searchCond_searchText(), ClientData.searchCond_searchDivision(), sortType, sortOrder, recordFrom, recordTo, genreId, groupId); CONTENTSEARCH.renderContent(sid, ClientData.searchCond_searchText(), ClientData.searchCond_searchDivision(), sortType, sortOrder, offset, limit, genreId, groupId);
}; };
//Sort By Title Kana function // Sort By Title Kana function
CONTENTSEARCH.sortByTitleKanaFunction = function(){ CONTENTSEARCH.sortByTitleKanaFunction = function() {
var sortOrder = ClientData.searchCond_sortOrder(); var sortOrder = ClientData.searchCond_sortOrder();
var sortType = ClientData.searchCond_sortType(); var sortType = ClientData.searchCond_sortType();
var sid = ClientData.userInfo_sid(); var sid = ClientData.userInfo_sid();
var recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM; //var recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
var recordTo = ClientData.searchCond_recordTo(); //var recordTo = ClientData.searchCond_recordTo();
var genreId = ClientData.searchCond_genreId(); var genreId = ClientData.searchCond_genreId();
var groupId = ClientData.searchCond_groupId(); var groupId = ClientData.searchCond_groupId();
if(sortOrder == COMMON.Consts.ConstOrderSetting_Asc) var offset = 0;
{ var limit = CONTENTSEARCH.returnNumberDispRecordForList();
if(sortType == '2'){
if (sortOrder == COMMON.Consts.ConstOrderSetting_Asc) {
if (sortType == '2') {
sortOrder = COMMON.Consts.ConstOrderSetting_Desc; sortOrder = COMMON.Consts.ConstOrderSetting_Desc;
} } else {
else{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
} }
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} } else {
else
{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
HEADER.setStatusSort('#control-sort-titlekana',sortOrder == COMMON.Consts.ConstOrderSetting_Asc); HEADER.setStatusSort('#control-sort-titlekana', sortOrder == COMMON.Consts.ConstOrderSetting_Asc);
if(recordFrom == null || recordFrom == 'undefined'){
recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
ClientData.searchCond_recordFrom(recordFrom);
}
if(recordTo == null || recordTo == 'undefined'){
recordTo = CONTENTSEARCH.returnNumberDispRecordForList(); // if (recordFrom == null || recordFrom == 'undefined') {
// recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
ClientData.searchCond_recordFrom(recordTo); // ClientData.searchCond_recordFrom(recordFrom);
} // }
// if (recordTo == null || recordTo == 'undefined') {
// recordTo = CONTENTSEARCH.returnNumberDispRecordForList();
// ClientData.searchCond_recordFrom(recordTo);
// }
sortType = '2'; sortType = '2';
//refresh gridview // refresh gridview
CONTENTSEARCH.refreshGrid(); CONTENTSEARCH.refreshGrid();
// refresh add more record
//refresh add more record $('#control-nextrecord').css('visibility', 'hidden');
$('#control-nextrecord').css('visibility','hidden');
ClientData.searchCond_sortType(sortType); ClientData.searchCond_sortType(sortType);
CONTENTSEARCH.renderContent(sid, ClientData.searchCond_searchText(), ClientData.searchCond_searchDivision(), sortType, sortOrder, recordFrom, recordTo, genreId, groupId); CONTENTSEARCH.renderContent(sid, ClientData.searchCond_searchText(), ClientData.searchCond_searchDivision(), sortType, sortOrder, offset, limit, genreId, groupId);
}; };
//Sort By Release Date // Sort By Release Date
CONTENTSEARCH.sortByReleaseDateFunction = function(){ CONTENTSEARCH.sortByReleaseDateFunction = function() {
var sortOrder = ClientData.searchCond_sortOrder(); var sortOrder = ClientData.searchCond_sortOrder();
var sortType = ClientData.searchCond_sortType(); var sortType = ClientData.searchCond_sortType();
var sid = ClientData.userInfo_sid(); var sid = ClientData.userInfo_sid();
var recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM; //var recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
var recordTo = ClientData.searchCond_recordTo(); //var recordTo = ClientData.searchCond_recordTo();
var genreId = ClientData.searchCond_genreId(); var genreId = ClientData.searchCond_genreId();
var groupId = ClientData.searchCond_groupId(); var groupId = ClientData.searchCond_groupId();
if(sortOrder == COMMON.Consts.ConstOrderSetting_Asc) var offset = 0;
{ var limit = CONTENTSEARCH.returnNumberDispRecordForList();
if(sortType == '3'){
if (sortOrder == COMMON.Consts.ConstOrderSetting_Asc) {
if (sortType == '3') {
sortOrder = COMMON.Consts.ConstOrderSetting_Desc; sortOrder = COMMON.Consts.ConstOrderSetting_Desc;
} } else {
else{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
} }
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} } else {
else
{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
HEADER.setStatusSort('#control-sort-releasedate',sortOrder == COMMON.Consts.ConstOrderSetting_Asc); HEADER.setStatusSort('#control-sort-releasedate', sortOrder == COMMON.Consts.ConstOrderSetting_Asc);
if(recordFrom == null || recordFrom == 'undefined'){ // if (recordFrom == null || recordFrom == 'undefined') {
recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM; // recordFrom = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
ClientData.searchCond_recordFrom(recordFrom); // ClientData.searchCond_recordFrom(recordFrom);
} // }
// if (recordTo == null || recordTo == 'undefined') {
if(recordTo == null || recordTo == 'undefined'){ // recordTo = CONTENTSEARCH.returnNumberDispRecordForList();
// ClientData.searchCond_recordFrom(recordTo);
recordTo = CONTENTSEARCH.returnNumberDispRecordForList(); // }
ClientData.searchCond_recordFrom(recordTo);
}
sortType = '3'; sortType = '3';
//refresh gridview // refresh gridview
CONTENTSEARCH.refreshGrid(); CONTENTSEARCH.refreshGrid();
//refresh add more record // refresh add more record
$('#control-nextrecord').css('visibility','hidden'); $('#control-nextrecord').css('visibility', 'hidden');
ClientData.searchCond_sortType(sortType); ClientData.searchCond_sortType(sortType);
CONTENTSEARCH.renderContent(sid, ClientData.searchCond_searchText(), ClientData.searchCond_searchDivision(), sortType, sortOrder, recordFrom, recordTo, genreId, groupId); CONTENTSEARCH.renderContent(sid, ClientData.searchCond_searchText(), ClientData.searchCond_searchDivision(), sortType, sortOrder, offset, limit, genreId, groupId);
}; };
//Get Thumnail base on contentid // Get Thumnail base on contentid
CONTENTSEARCH.returnThumbnail = function(contentid){ CONTENTSEARCH.returnThumbnail = function(contentid) {
for(var i = 0; i < CONTENTSEARCH.thumbnailArr.length; i++){ for ( var i = 0; i < CONTENTSEARCH.thumbnailArr.length; i++) {
if(CONTENTSEARCH.thumbnailArr[i].contentId == contentid){ if (CONTENTSEARCH.thumbnailArr[i].contentId == contentid) {
return CONTENTSEARCH.thumbnailArr[i].thumbnail; return CONTENTSEARCH.thumbnailArr[i].thumbnail;
} }
} }
}; };
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Create new function to return content type of content. // Get content type base on contentid
//Get content type base on contentid CONTENTSEARCH.returnContentType = function(contentid) {
CONTENTSEARCH.returnContentType = function(contentid){ // Array Length
//Array Length
var iArrCnt = CONTENTSEARCH.contentTypeArr.length; var iArrCnt = CONTENTSEARCH.contentTypeArr.length;
//Get contentType in array by contentId // Get contentType in array by contentId
for(var i = 0; i < iArrCnt; i++){ for ( var i = 0; i < iArrCnt; i++) {
if (CONTENTSEARCH.contentTypeArr[i].contentId == contentid) { if (CONTENTSEARCH.contentTypeArr[i].contentId == contentid) {
return CONTENTSEARCH.contentTypeArr[i].contentType; return CONTENTSEARCH.contentTypeArr[i].contentType;
} }
} }
}; };
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Create new function to return content type of content. // Dialog Read Button CLick
CONTENTSEARCH.readSubmenuFunction = function(e) {
//Dialog Read Button CLick
CONTENTSEARCH.readSubmenuFunction = function(e){
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
} }
...@@ -762,23 +739,18 @@ CONTENTSEARCH.readSubmenuFunction = function(e){ ...@@ -762,23 +739,18 @@ CONTENTSEARCH.readSubmenuFunction = function(e){
} }
var contentId = $(this).attr('contentid'); var contentId = $(this).attr('contentid');
// check limit of content // check limit of content
LIMIT_ACCESS_CONTENT.checkLimitContent(contentId, LIMIT_ACCESS_CONTENT.checkLimitContent(contentId, function() {
function()
{
CONTENTSEARCH.readSubmenuFunction_callback(contentId); CONTENTSEARCH.readSubmenuFunction_callback(contentId);
}, }, function() {
function(){ });
}
);
}; };
// read content callback // read content callback
CONTENTSEARCH.readSubmenuFunction_callback = function(contentId) CONTENTSEARCH.readSubmenuFunction_callback = function(contentId) {
{
var contentThumbnail = CONTENTSEARCH.returnThumbnail(contentId); var contentThumbnail = CONTENTSEARCH.returnThumbnail(contentId);
var date = new Date(); var date = new Date();
var month = date.getMonth()+1; var month = date.getMonth() + 1;
var day = date.getDate(); var day = date.getDate();
var outputDate = COMMON.formatNormalDate(day, month, date.getFullYear()); var outputDate = COMMON.formatNormalDate(day, month, date.getFullYear());
...@@ -786,126 +758,113 @@ CONTENTSEARCH.readSubmenuFunction_callback = function(contentId) ...@@ -786,126 +758,113 @@ CONTENTSEARCH.readSubmenuFunction_callback = function(contentId)
ClientData.contentInfo_contentId(contentId); ClientData.contentInfo_contentId(contentId);
ClientData.contentInfo_contentThumbnail(contentThumbnail); ClientData.contentInfo_contentThumbnail(contentThumbnail);
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type of content.
var contentType = CONTENTSEARCH.returnContentType(contentId); var contentType = CONTENTSEARCH.returnContentType(contentId);
ClientData.contentInfo_contentType(contentType); ClientData.contentInfo_contentType(contentType);
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type of content.
var checkflag = false; var checkflag = false;
//Store Content id that user has read
if(ClientData.ReadingContentIds().length > 0){
CONTENTSEARCH.contentIdArray = ClientData.ReadingContentIds(); CONTENTSEARCH.contentIdArray = ClientData.ReadingContentIds();
// Store Content id that user has read
if (CONTENTSEARCH.contentIdArray.length > 0) {
for(var nIndex = 0; nIndex < CONTENTSEARCH.contentIdArray.length; nIndex++){ for ( var nIndex = 0; nIndex < CONTENTSEARCH.contentIdArray.length; nIndex++) {
if(CONTENTSEARCH.contentIdArray[nIndex].contentid == contentId){ if (CONTENTSEARCH.contentIdArray[nIndex].contentid == contentId) {
checkflag = true; checkflag = true;
if(CONTENTSEARCH.contentIdArray[nIndex].viewdate == null || CONTENTSEARCH.contentIdArray[nIndex].viewdate == 'undefined' || CONTENTSEARCH.contentIdArray[nIndex].viewdate == ''){ if (CONTENTSEARCH.contentIdArray[nIndex].viewdate == null || CONTENTSEARCH.contentIdArray[nIndex].viewdate == 'undefined' || CONTENTSEARCH.contentIdArray[nIndex].viewdate == '') {
CONTENTSEARCH.contentIdArray[nIndex].viewdate = outputDate; CONTENTSEARCH.contentIdArray[nIndex].viewdate = outputDate;
CONTENTSEARCH.contentIdArray[nIndex].originviewdate = date; CONTENTSEARCH.contentIdArray[nIndex].originviewdate = date;
} }
break; break;
} }
else{
checkflag = false;
}
} }
if(!checkflag){ if (!checkflag) {
CONTENTSEARCH.contentIdArray.push({contentid: contentId, viewdate: outputDate, originviewdate: date}); CONTENTSEARCH.contentIdArray.push({
} contentid : contentId,
viewdate : outputDate,
originviewdate : date
});
} }
else{ } else {
CONTENTSEARCH.contentIdArray.push({contentid: contentId, viewdate: outputDate, originviewdate: date}); CONTENTSEARCH.contentIdArray.push({
contentid : contentId,
viewdate : outputDate,
originviewdate : date
});
} }
//Renew ReadingContentID // Renew ReadingContentID
var newArray = []; var newArray = [];
ClientData.ReadingContentIds(newArray); ClientData.ReadingContentIds(newArray);
//Set ResouceVersion for content // Set ResouceVersion for content
COMMON.setResourceVersionData(contentId); COMMON.setResourceVersionData(contentId);
//Set MetaVersion for content // Set MetaVersion for content
COMMON.setMetaVersionData(contentId); COMMON.setMetaVersionData(contentId);
//Set data for readingcontentid // Set data for readingcontentid
ClientData.ReadingContentIds(CONTENTSEARCH.contentIdArray); ClientData.ReadingContentIds(CONTENTSEARCH.contentIdArray);
ClientData.IsRefresh(false); ClientData.IsRefresh(false);
//Start Function : No.12 -- Editor : Le Long -- Date : 08/02/2013 -- Summary : Check content type other for download. // For testing without other Type.
//For testing without other Type. if (contentType == COMMON.ContentTypeKeys.Type_Others) {
if(contentType == COMMON.ContentTypeKeys.Type_Others){ // Download content
//Download content
HEADER.downloadResourceById(contentId); HEADER.downloadResourceById(contentId);
// redraw content remove new icon // redraw content remove new icon
CONTENTSEARCH.drawEditImage(contentId); CONTENTSEARCH.drawEditImage(contentId);
} } else if (contentType == COMMON.ContentTypeKeys.Type_Link) {
else if( contentType == COMMON.ContentTypeKeys.Type_Link ){ // link content
//link content
HEADER.viewLinkContentById(contentId); HEADER.viewLinkContentById(contentId);
// redraw content remove new icon // redraw content remove new icon
CONTENTSEARCH.drawEditImage(contentId); CONTENTSEARCH.drawEditImage(contentId);
} } else {
else{ // Go to Conten view page
//Go to Conten view page // AVWEB.avwScreenMove(COMMON.ScreenIds.ContentView);
//AVWEB.avwScreenMove(COMMON.ScreenIds.ContentView);
CONTENTSEARCH.drawEditImage(contentId); CONTENTSEARCH.drawEditImage(contentId);
CONTENTSEARCH.showContentView(); CONTENTSEARCH.showContentView();
} }
//End Function : No.12 -- Editor : Le Long -- Date : 08/02/2013 -- Summary : Check content type other for download.
}; };
//Check if Content Has marking or memo // Check if Content Has marking or memo
CONTENTSEARCH.checkContentMarkingMemoOption = function(contentId){ CONTENTSEARCH.checkContentMarkingMemoOption = function(contentId) {
//Check if contentid has marking // Check if contentid has marking
if(ClientData.MarkingData().length == 0){ if (ClientData.MarkingData().length == 0) {
$('#imgBookMark'+contentId).css('visibility','hidden'); $('#imgBookMark' + contentId).css('visibility', 'hidden');
} } else {
else{ for ( var nIndex1 = 0; nIndex1 < ClientData.MarkingData().length; nIndex1++) {
for (var nIndex1 = 0; nIndex1 < ClientData.MarkingData().length; nIndex1++) {
if (ClientData.MarkingData()[nIndex1].contentid == contentId) { if (ClientData.MarkingData()[nIndex1].contentid == contentId) {
$('#imgBookMark'+contentId).css('visibility','visible'); $('#imgBookMark' + contentId).css('visibility', 'visible');
break; break;
} } else {
else{ $('#imgBookMark' + contentId).css('visibility', 'hidden');
$('#imgBookMark'+contentId).css('visibility','hidden');
} }
} }
} }
if(ClientData.MemoData().length == 0){ if (ClientData.MemoData().length == 0) {
$('#imgMemo'+contentId).css('visibility','hidden'); $('#imgMemo' + contentId).css('visibility', 'hidden');
} } else {
else{
// Check if contentid has memo // Check if contentid has memo
for (var nIndex1 = 0; nIndex1 < ClientData.MemoData().length; nIndex1++) { for ( var nIndex1 = 0; nIndex1 < ClientData.MemoData().length; nIndex1++) {
if (ClientData.MemoData()[nIndex1].contentid == contentId) { if (ClientData.MemoData()[nIndex1].contentid == contentId) {
$('#imgMemo'+contentId).css('visibility','visible'); $('#imgMemo' + contentId).css('visibility', 'visible');
break; break;
} } else {
else $('#imgMemo' + contentId).css('visibility', 'hidden');
{
$('#imgMemo'+contentId).css('visibility','hidden');
} }
} }
} }
}; };
//Check if User has read content // Check if User has read content
CONTENTSEARCH.checkUserHasReadContent = function(contId, resourceVer, metaVer) { CONTENTSEARCH.checkUserHasReadContent = function(contId, resourceVer, metaVer, versionArr, metaArr, readArr) {
var imgThumb = new Image(); var imgThumb = new Image();
//imgThumb.src = CONTENTSEARCH.returnThumbnail(contId);
var imgIconNew = new Image(); var imgIconNew = new Image();
//imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
var imgIconEdit = new Image(); var imgIconEdit = new Image();
//imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
var c = document.getElementById('content-thumbnail' + contId); var c = document.getElementById('content-thumbnail' + contId);
var ctx = c.getContext('2d'); var ctx = c.getContext('2d');
...@@ -915,131 +874,122 @@ CONTENTSEARCH.checkUserHasReadContent = function(contId, resourceVer, metaVer) { ...@@ -915,131 +874,122 @@ CONTENTSEARCH.checkUserHasReadContent = function(contId, resourceVer, metaVer) {
var metaArr = ClientData.MetaVersion(); var metaArr = ClientData.MetaVersion();
var readArr = ClientData.ReadingContentIds(); var readArr = ClientData.ReadingContentIds();
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType and Thumbnail of content.
var contentThumbnail = CONTENTSEARCH.returnThumbnail(contId); var contentThumbnail = CONTENTSEARCH.returnThumbnail(contId);
var contentType = CONTENTSEARCH.returnContentType(contId); var contentType = CONTENTSEARCH.returnContentType(contId);
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType and Thumbnail of content.
if (readArr <= 0) {
if (readArr == null || readArr <= 0 || readArr == 'undefined') { imgThumb.onload = function() {
imgThumb.onload = function () {
var resizeImg = CONTENTSEARCH.resizeResourceThumbnail(imgThumb, c.width, c.height); var resizeImg = CONTENTSEARCH.resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]); ctx.drawImage(imgThumb, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]);
imgIconNew.onload = function () { imgIconNew.onload = function() {
ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]); ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]);
$("#loadingIcon" + contId).fadeOut('slow', function () { $("#loadingIcon" + contId).fadeOut('slow', function() {
$('#content-thumbnail' + contId).fadeIn('slow'); $('#content-thumbnail' + contId).fadeIn('slow');
}); });
}; };
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW; imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
}; };
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail. if (contentThumbnail == '' || contentThumbnail == null) {
if(contentThumbnail == '' || contentThumbnail == null){ if (!COMMON.isPdfContent(contentType)) {
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType); var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){ if (src != '') {
imgThumb.src = src; imgThumb.src = src;
} }
} }
}else{ } else {
imgThumb.src = contentThumbnail; imgThumb.src = contentThumbnail;
} }
} else {
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail. // Check if user has read this content or not
} for ( var nIndex1 = 0; nIndex1 < readArr.length; nIndex1++) {
else { if (readArr[nIndex1].contentid == contId) {
//Check if user has read this content or not imgThumb.onload = function() {
for (var nIndex1 = 0; nIndex1 < ClientData.ReadingContentIds().length; nIndex1++) {
if (ClientData.ReadingContentIds()[nIndex1].contentid == contId) {
imgThumb.onload = function () {
var resizeImg = CONTENTSEARCH.resizeResourceThumbnail(imgThumb, c.width, c.height); var resizeImg = CONTENTSEARCH.resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]); ctx.drawImage(imgThumb, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]);
$("#loadingIcon" + contId).fadeOut('slow', function () { $("#loadingIcon" + contId).fadeOut('slow', function() {
$('#content-thumbnail' + contId).fadeIn('slow'); $('#content-thumbnail' + contId).fadeIn('slow');
}); });
}; };
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){ if (contentThumbnail == '' || contentThumbnail == null) {
if(!COMMON.isPdfContent(contentType)){ if (!COMMON.isPdfContent(contentType)) {
var src = HEADER.getThumbnailForOtherType(contentType); var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){ if (src != '') {
imgThumb.src = src; imgThumb.src = src;
} }
} }
}else{ } else {
imgThumb.src = contentThumbnail; imgThumb.src = contentThumbnail;
} }
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
readFlg = true; readFlg = true;
break; break;
} } else {
else { // imgThumb.onload = function() {
imgThumb.onload = function () { // var resizeImg = CONTENTSEARCH.resizeResourceThumbnail(imgThumb, c.width, c.height);
var resizeImg = CONTENTSEARCH.resizeResourceThumbnail(imgThumb, c.width, c.height); // ctx.drawImage(imgThumb, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]);
ctx.drawImage(imgThumb, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]); // imgIconNew.onload = function() {
imgIconNew.onload = function () { // ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]);
ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]); // $("#loadingIcon" + contId).fadeOut('slow', function() {
$("#loadingIcon" + contId).fadeOut('slow', function () { // $('#content-thumbnail' + contId).fadeIn('slow');
$('#content-thumbnail' + contId).fadeIn('slow'); // });
}); // };
}; // imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW; // };
}; //
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail. // if (contentThumbnail == '' || contentThumbnail == null) {
// if (!COMMON.isPdfContent(contentType)) {
if(contentThumbnail == '' || contentThumbnail == null){ // var src = HEADER.getThumbnailForOtherType(contentType);
if(!COMMON.isPdfContent(contentType)){ // if (src != '') {
var src = HEADER.getThumbnailForOtherType(contentType); // imgThumb.src = src;
if( src != '' ){ // }
imgThumb.src = src; // }
} // } else {
} // imgThumb.src = contentThumbnail;
}else{ // }
imgThumb.src = contentThumbnail;
}
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
} }
} }
} }
//Check if resource version has change // Check if resource version has change
if (readFlg) { if (readFlg) {
if (versionArr == null || versionArr <= 0 || versionArr == 'undefined') { if (versionArr == null || versionArr <= 0 || versionArr == 'undefined') {
} } else {
else { for ( var nIndex2 = 0; nIndex2 < versionArr.length; nIndex2++) {
for (var nIndex2 = 0; nIndex2 < versionArr.length; nIndex2++) {
if (versionArr[nIndex2].contentid == contId) { if (versionArr[nIndex2].contentid == contId) {
if (versionArr[nIndex2].resourceversion != resourceVer) { if (versionArr[nIndex2].resourceversion != resourceVer) {
imgThumb.onload = function () { imgThumb.onload = function() {
var resizeImg = CONTENTSEARCH.resizeResourceThumbnail(imgThumb, c.width, c.height); var resizeImg = CONTENTSEARCH.resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]); ctx.drawImage(imgThumb, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]);
imgIconEdit.onload = function () { imgIconEdit.onload = function() {
ctx.drawImage(imgIconEdit, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]); ctx.drawImage(imgIconEdit, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]);
$("#loadingIcon" + contId).fadeOut('slow', function () { $("#loadingIcon" + contId).fadeOut('slow', function() {
$('#content-thumbnail' + contId).fadeIn('slow'); $('#content-thumbnail' + contId).fadeIn('slow');
}); });
}; };
imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT; imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
}; };
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail. // Start Function : No.12 -- Editor : Le Long -- Date :
// 07/31/2013 -- Summary : Check contentType to set
// thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){ if (contentThumbnail == '' || contentThumbnail == null) {
if(!COMMON.isPdfContent(contentType)){ if (!COMMON.isPdfContent(contentType)) {
var src = HEADER.getThumbnailForOtherType(contentType); var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){ if (src != '') {
imgThumb.src = src; imgThumb.src = src;
} }
} }
}else{ } else {
imgThumb.src = contentThumbnail; imgThumb.src = contentThumbnail;
} }
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail. // End Function : No.12 -- Editor : Le Long -- Date :
// 07/31/2013 -- Summary : Check contentType to set
// thumbnail.
break; break;
} }
} }
...@@ -1047,71 +997,96 @@ CONTENTSEARCH.checkUserHasReadContent = function(contId, resourceVer, metaVer) { ...@@ -1047,71 +997,96 @@ CONTENTSEARCH.checkUserHasReadContent = function(contId, resourceVer, metaVer) {
} }
if (metaArr == null || metaArr <= 0 || metaArr == 'undefined') { if (metaArr == null || metaArr <= 0 || metaArr == 'undefined') {
} } else {
else { for ( var nIndex2 = 0; nIndex2 < metaArr.length; nIndex2++) {
for (var nIndex2 = 0; nIndex2 < metaArr.length; nIndex2++) {
if (metaArr[nIndex2].contentid == contId) { if (metaArr[nIndex2].contentid == contId) {
if (metaArr[nIndex2].metaversion != metaVer) { if (metaArr[nIndex2].metaversion != metaVer) {
imgThumb.onload = function () { imgThumb.onload = function() {
var resizeImg = CONTENTSEARCH.resizeResourceThumbnail(imgThumb, c.width, c.height); var resizeImg = CONTENTSEARCH.resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]); ctx.drawImage(imgThumb, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]);
imgIconEdit.onload = function () { imgIconEdit.onload = function() {
ctx.drawImage(imgIconEdit, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]); ctx.drawImage(imgIconEdit, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]);
$("#loadingIcon" + contId).fadeOut('slow', function () { $("#loadingIcon" + contId).fadeOut('slow', function() {
$('#content-thumbnail' + contId).fadeIn('slow'); $('#content-thumbnail' + contId).fadeIn('slow');
}); });
}; };
imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT; imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
}; };
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail. // Start Function : No.12 -- Editor : Le Long -- Date :
// 07/31/2013 -- Summary : Check contentType to set
// thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){ if (contentThumbnail == '' || contentThumbnail == null) {
if(!COMMON.isPdfContent(contentType)){ if (!COMMON.isPdfContent(contentType)) {
var src = HEADER.getThumbnailForOtherType(contentType); var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){ if (src != '') {
imgThumb.src = src; imgThumb.src = src;
} }
} }
}else{ } else {
imgThumb.src = contentThumbnail; imgThumb.src = contentThumbnail;
} }
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail. // End Function : No.12 -- Editor : Le Long -- Date :
// 07/31/2013 -- Summary : Check contentType to set
// thumbnail.
break; break;
} }
} }
} }
} }
readFlg = false; //readFlg = false;
} else {
imgThumb.onload = function() {
var resizeImg = CONTENTSEARCH.resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]);
imgIconNew.onload = function() {
ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]);
$("#loadingIcon" + contId).fadeOut('slow', function() {
$('#content-thumbnail' + contId).fadeIn('slow');
});
};
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
};
if (contentThumbnail == '' || contentThumbnail == null) {
if (!COMMON.isPdfContent(contentType)) {
var src = HEADER.getThumbnailForOtherType(contentType);
if (src != '') {
imgThumb.src = src;
}
}
} else {
imgThumb.src = contentThumbnail;
}
} }
}; };
//draw Edit Image // draw Edit Image
CONTENTSEARCH.drawEditImage = function(id) { CONTENTSEARCH.drawEditImage = function(id) {
var img = new Image(); var img = new Image();
var imgSrc = CONTENTSEARCH.returnThumbnail(id); var imgSrc = CONTENTSEARCH.returnThumbnail(id);
if(imgSrc != null){ if (imgSrc != null) {
} } else {
else{
var contentType = CONTENTSEARCH.returnContentType(id); var contentType = CONTENTSEARCH.returnContentType(id);
var src = HEADER.getThumbnailForOtherType(contentType); var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){ if (src != '') {
imgSrc = src; imgSrc = src;
} }
} }
var c = document.getElementById('content-thumbnail' + id); var c = document.getElementById('content-thumbnail' + id);
//use getContext to use the canvas for drawing // use getContext to use the canvas for drawing
var ctx = c.getContext('2d'); var ctx = c.getContext('2d');
ctx.clearRect(0, 0, c.width, c.height); ctx.clearRect(0, 0, c.width, c.height);
img.onload = function () { img.onload = function() {
var resizeImg = CONTENTSEARCH.resizeResourceThumbnail(img, c.width, c.height); var resizeImg = CONTENTSEARCH.resizeResourceThumbnail(img, c.width, c.height);
ctx.drawImage(img, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]); ctx.drawImage(img, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]);
$("#loadingIcon" + id).fadeOut('slow', function () { $("#loadingIcon" + id).fadeOut('slow', function() {
$('#content-thumbnail' + id).fadeIn('slow'); $('#content-thumbnail' + id).fadeIn('slow');
}); });
}; };
...@@ -1119,11 +1094,11 @@ CONTENTSEARCH.drawEditImage = function(id) { ...@@ -1119,11 +1094,11 @@ CONTENTSEARCH.drawEditImage = function(id) {
img.src = imgSrc; img.src = imgSrc;
}; };
//Search Function // Search Function
CONTENTSEARCH.searchEventButtonFunction = function(){ CONTENTSEARCH.searchEventButtonFunction = function() {
var fromPage = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM; //var fromPage = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
var toPage = CONTENTSEARCH.returnNumberDispRecordForList(); //var toPage = CONTENTSEARCH.returnNumberDispRecordForList();
var sortType = CONTENTSEARCH.DEFAULT_SORT_TYPE; var sortType = CONTENTSEARCH.DEFAULT_SORT_TYPE;
var sortOrder = CONTENTSEARCH.DEFAULT_SORT_ORDER; var sortOrder = CONTENTSEARCH.DEFAULT_SORT_ORDER;
var searchText = $('#txtSearchWs').val(); var searchText = $('#txtSearchWs').val();
...@@ -1132,17 +1107,16 @@ CONTENTSEARCH.searchEventButtonFunction = function(){ ...@@ -1132,17 +1107,16 @@ CONTENTSEARCH.searchEventButtonFunction = function(){
var tag = $('#main-tag').attr('checked'); var tag = $('#main-tag').attr('checked');
var body = $('#main-body').attr('checked'); var body = $('#main-body').attr('checked');
var offset = 0;
var limit = CONTENTSEARCH.returnNumberDispRecordForList();
if(content == 'checked') if (content == 'checked') {
{
searchDivision = $('#searchbox-content').val(); searchDivision = $('#searchbox-content').val();
} }
if(tag == 'checked') if (tag == 'checked') {
{
searchDivision = $('#searchbox-tag').val(); searchDivision = $('#searchbox-tag').val();
} }
if(body == 'checked') if (body == 'checked') {
{
searchDivision = $('#searchbox-body').val(); searchDivision = $('#searchbox-body').val();
} }
...@@ -1153,71 +1127,57 @@ CONTENTSEARCH.searchEventButtonFunction = function(){ ...@@ -1153,71 +1127,57 @@ CONTENTSEARCH.searchEventButtonFunction = function(){
ClientData.searchCond_sortType(sortType); ClientData.searchCond_sortType(sortType);
ClientData.searchCond_searchText(searchText); ClientData.searchCond_searchText(searchText);
ClientData.searchCond_searchDivision(searchDivision); ClientData.searchCond_searchDivision(searchDivision);
//refresh grid // refresh grid
CONTENTSEARCH.refreshGrid(); CONTENTSEARCH.refreshGrid();
//Handle display sort // Handle display sort
CONTENTSEARCH.handleSortDisp(); CONTENTSEARCH.handleSortDisp();
//if(searchText == '' || searchText == null){
// CONTENTSEARCH.displayResultNoRecord();
// CONTENTSEARCH.chkSearchTextEmpty = true;
// CONTENTSEARCH.noRecordFlg = true;
// CONTENTSEARCH.reRenderPageNumber(0, 0);
//}
//else {
$('#msgSearchNotExist').hide(); $('#msgSearchNotExist').hide();
$('#control-nextrecord').css('visibility','hidden'); $('#control-nextrecord').css('visibility', 'hidden');
//Render Gridview // Render Gridview
CONTENTSEARCH.chkSearchTextEmpty = false; CONTENTSEARCH.chkSearchTextEmpty = false;
CONTENTSEARCH.renderContent(sid, searchText, searchDivision, sortType, sortOrder, fromPage, toPage, genreId, groupId); CONTENTSEARCH.renderContent(sid, searchText, searchDivision, sortType, sortOrder, offset, limit, genreId, groupId);
//$('#control-nextrecord').css('visibility','visible');
//}
}; };
//Render User view date // Render User view date
CONTENTSEARCH.renderViewDate = function(id){ CONTENTSEARCH.renderViewDate = function(id, readingContentIds) {
for ( var i = 0; i < readingContentIds.length; i++) {
for(var i = 0; i < ClientData.ReadingContentIds().length; i++){ if (readingContentIds[i].contentid == id) {
if(ClientData.ReadingContentIds()[i].contentid == id){ return readingContentIds[i].viewdate;
return ClientData.ReadingContentIds()[i].viewdate;
} }
} }
}; };
//handle display sort direction // handle display sort direction
CONTENTSEARCH.handleSortDisp = function(){ CONTENTSEARCH.handleSortDisp = function() {
var typeSort; var typeSort;
var orderSort; var orderSort;
if(ClientData.searchCond_sortType() == null || ClientData.searchCond_sortType() == 'undefined' || ClientData.searchCond_sortType() == ''){ if (ClientData.searchCond_sortType() == null || ClientData.searchCond_sortType() == 'undefined' || ClientData.searchCond_sortType() == '') {
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#rDate-sorttype').html(''); $('#rDate-sorttype').html('');
} } else {
else{ if (ClientData.searchCond_sortOrder() != null && ClientData.searchCond_sortOrder() != 'undefined' || ClientData.searchCond_sortType() != '') {
if(ClientData.searchCond_sortOrder() != null && ClientData.searchCond_sortOrder() != 'undefined' || ClientData.searchCond_sortType() != ''){
typeSort = ClientData.searchCond_sortType(); typeSort = ClientData.searchCond_sortType();
orderSort = ClientData.searchCond_sortOrder(); orderSort = ClientData.searchCond_sortOrder();
if(typeSort == 1){ if (typeSort == 1) {
HEADER.setStatusSort('#control-sort-title',orderSort == COMMON.Consts.ConstOrderSetting_Asc); HEADER.setStatusSort('#control-sort-title', orderSort == COMMON.Consts.ConstOrderSetting_Asc);
} } else if (typeSort == 2) {
else if(typeSort == 2){ HEADER.setStatusSort('#control-sort-titlekana', orderSort == COMMON.Consts.ConstOrderSetting_Asc);
HEADER.setStatusSort('#control-sort-titlekana',orderSort == COMMON.Consts.ConstOrderSetting_Asc); } else if (typeSort == 3) {
} HEADER.setStatusSort('#control-sort-releasedate', orderSort == COMMON.Consts.ConstOrderSetting_Asc);
else if(typeSort == 3){
HEADER.setStatusSort('#control-sort-releasedate',orderSort == COMMON.Consts.ConstOrderSetting_Asc);
} }
} }
} }
}; };
//function Open SubMenu Dialog // function Open SubMenu Dialog
CONTENTSEARCH.titleClickFunction = function(e){ CONTENTSEARCH.titleClickFunction = function(e) {
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
} }
...@@ -1232,57 +1192,58 @@ CONTENTSEARCH.titleClickFunction = function(e){ ...@@ -1232,57 +1192,58 @@ CONTENTSEARCH.titleClickFunction = function(e){
ClientData.contentInfo_contentThumbnail(base64String); ClientData.contentInfo_contentThumbnail(base64String);
ClientData.contentInfo_contentId(contentid); ClientData.contentInfo_contentId(contentid);
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type of content.
var contentType = CONTENTSEARCH.returnContentType(contentid); var contentType = CONTENTSEARCH.returnContentType(contentid);
ClientData.contentInfo_contentType(contentType); ClientData.contentInfo_contentType(contentType);
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type of content.
//Store Content id that user has read
if(ClientData.ReadingContentIds().length > 0){
CONTENTSEARCH.contentIdArray = ClientData.ReadingContentIds(); CONTENTSEARCH.contentIdArray = ClientData.ReadingContentIds();
if (CONTENTSEARCH.contentIdArray.length > 0) {
for(var nIndex = 0; nIndex < CONTENTSEARCH.contentIdArray.length; nIndex++){ for ( var nIndex = 0; nIndex < CONTENTSEARCH.contentIdArray.length; nIndex++) {
if(CONTENTSEARCH.contentIdArray[nIndex].contentid == contentid){ if (CONTENTSEARCH.contentIdArray[nIndex].contentid == contentid) {
checkflag = true; checkflag = true;
break; break;
} }
else{
checkflag = false;
}
} }
if(!checkflag){ if (!checkflag) {
CONTENTSEARCH.contentIdArray.push({contentid: contentid, viewdate: '', originviewdate: ''}); CONTENTSEARCH.contentIdArray.push({
} contentid : contentid,
viewdate : '',
originviewdate : ''
});
} }
else{ } else {
CONTENTSEARCH.contentIdArray.push({contentid: contentid, viewdate: '', originviewdate: ''}); CONTENTSEARCH.contentIdArray.push({
contentid : contentid,
viewdate : '',
originviewdate : ''
});
} }
//Renew ReadingContentID // Renew ReadingContentID
var newArray = []; var newArray = [];
ClientData.ReadingContentIds(newArray); ClientData.ReadingContentIds(newArray);
//Set data for readingcontentid // Set data for readingcontentid
ClientData.ReadingContentIds(CONTENTSEARCH.contentIdArray); ClientData.ReadingContentIds(CONTENTSEARCH.contentIdArray);
//Set ResouceVersion for content // Set ResouceVersion for content
COMMON.setResourceVersionData(contentid); COMMON.setResourceVersionData(contentid);
//Set MetaVersion for content // Set MetaVersion for content
COMMON.setMetaVersionData(contentid); COMMON.setMetaVersionData(contentid);
//Close Submenu // Close Submenu
$('#dlgSubMenu').hide(); $('#dlgSubMenu').hide();
//Delete 'new' icon // Delete 'new' icon
CONTENTSEARCH.drawEditImage(contentid); CONTENTSEARCH.drawEditImage(contentid);
//Open content Detail // Open content Detail
DETAIL.openContentDetail(); DETAIL.openContentDetail();
}; };
//Get Number Disp Record For List // Get Number Disp Record For List
CONTENTSEARCH.returnNumberDispRecordForList = function() { CONTENTSEARCH.returnNumberDispRecordForList = function() {
var toPage = 0; var toPage = 0;
var sysSettings = AVWEB.avwSysSetting(); var sysSettings = AVWEB.avwSysSetting();
...@@ -1290,35 +1251,35 @@ CONTENTSEARCH.returnNumberDispRecordForList = function() { ...@@ -1290,35 +1251,35 @@ CONTENTSEARCH.returnNumberDispRecordForList = function() {
return toPage; return toPage;
}; };
//Get number record disp next for list // Get number record disp next for list
CONTENTSEARCH.getNextRecordNumForList = function(){ CONTENTSEARCH.getNextRecordNumForList = function() {
CONTENTSEARCH.iNumberOfNextRecord = CONTENTSEARCH.returnNumberDispRecordForList(); CONTENTSEARCH.iNumberOfNextRecord = CONTENTSEARCH.returnNumberDispRecordForList();
}; };
//refresh sort order // refresh sort order
//CONTENTSEARCH.refreshSortTypeOrder = function(){ // CONTENTSEARCH.refreshSortTypeOrder = function(){
// $('#title-sorttype').html(''); // $('#title-sorttype').html('');
// $('#titlekana-sorttype').html(''); // $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html(''); // $('#rDate-sorttype').html('');
// $('#rDate-sorttype').html(''); // $('#rDate-sorttype').html('');
//}; // };
//refresh GridView // refresh GridView
CONTENTSEARCH.refreshGrid = function(){ CONTENTSEARCH.refreshGrid = function() {
$('#control-nextrecord').css('visibility','hidden'); $('#control-nextrecord').css('visibility', 'hidden');
$('#content-grid').html(''); $('#content-grid').html('');
$('.pageNumControl').css('visibility','hidden'); $('.pageNumControl').css('visibility', 'hidden');
}; };
//format text display more record // format text display more record
CONTENTSEARCH.formatDisplayMoreRecord = function(){ CONTENTSEARCH.formatDisplayMoreRecord = function() {
I18N.i18nReplaceText(); I18N.i18nReplaceText();
//I18N.changeLanguage(ClientData.userInfo_language()); // I18N.changeLanguage(ClientData.userInfo_language());
$('#control-nextrecord').html(AVWEB.format(I18N.i18nText('dspViewMore'), CONTENTSEARCH.returnNumberDispRecordForList())); $('#control-nextrecord').html(AVWEB.format(I18N.i18nText('dspViewMore'), CONTENTSEARCH.returnNumberDispRecordForList()));
}; };
//CONTENTSEARCH.changeLanguageCallBackFunction = function(){ // CONTENTSEARCH.changeLanguageCallBackFunction = function(){
// CONTENTSEARCH.handleLanguage(); // CONTENTSEARCH.handleLanguage();
// //
// CONTENTSEARCH.formatDisplayMoreRecord(); // CONTENTSEARCH.formatDisplayMoreRecord();
...@@ -1334,31 +1295,37 @@ CONTENTSEARCH.formatDisplayMoreRecord = function(){ ...@@ -1334,31 +1295,37 @@ CONTENTSEARCH.formatDisplayMoreRecord = function(){
// enableSort(); // enableSort();
// } // }
// //
// document.title = I18N.i18nText('txtSearchResult') + ' | ' + I18N.i18nText('sysAppTitle'); // document.title = I18N.i18nText('txtSearchResult') + ' | ' +
//}; // I18N.i18nText('sysAppTitle');
// };
CONTENTSEARCH.displayResultNoRecord = function(){ CONTENTSEARCH.displayResultNoRecord = function() {
I18N.i18nReplaceText(); I18N.i18nReplaceText();
//$('#content-grid').html(I18N.i18nText('msgSearchNotExist')); // $('#content-grid').html(I18N.i18nText('msgSearchNotExist'));
//$('#content-grid').css({ 'text-align': 'left', 'margin-top': '20px', 'clear': 'both' }); // $('#content-grid').css({ 'text-align': 'left', 'margin-top': '20px',
// 'clear': 'both' });
$('#content-grid').html(''); $('#content-grid').html('');
$('#msgSearchNotExist').show(); $('#msgSearchNotExist').show();
$('#msgSearchNotExist').css({ 'text-align': 'left', 'margin-top': '20px', 'clear': 'both' }); $('#msgSearchNotExist').css({
'text-align' : 'left',
'margin-top' : '20px',
'clear' : 'both'
});
$('#control-nextrecord').css('visibility','hidden'); $('#control-nextrecord').css('visibility', 'hidden');
$('.control_sort_on').hide(); $('.control_sort_on').hide();
$('.control_sort_off').show(); $('.control_sort_off').show();
if(I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko){ if (I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko) {
/*$('#control-sort-titlekana').hide();*/ /* $('#control-sort-titlekana').hide(); */
$('#separate').hide(); $('#separate').hide();
$('#control-sort-titlekana').hide(); $('#control-sort-titlekana').hide();
} }
}; };
CONTENTSEARCH.enableSort = function(){ CONTENTSEARCH.enableSort = function() {
$('.control_sort_on').show(); $('.control_sort_on').show();
$('.control_sort_off').hide(); $('.control_sort_off').hide();
if(I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko){ if (I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko) {
$('#control-sort-titlekana').hide(); $('#control-sort-titlekana').hide();
$('#separate').hide(); $('#separate').hide();
} }
...@@ -1367,26 +1334,26 @@ CONTENTSEARCH.enableSort = function(){ ...@@ -1367,26 +1334,26 @@ CONTENTSEARCH.enableSort = function(){
CONTENTSEARCH.resizeResourceThumbnail = function(mg, width, height) { CONTENTSEARCH.resizeResourceThumbnail = function(mg, width, height) {
var newWidth; var newWidth;
var newHeight; var newHeight;
var delta=Math.min(width/mg.width,height/mg.height); var delta = Math.min(width / mg.width, height / mg.height);
newHeight=parseInt(delta*mg.height); newHeight = parseInt(delta * mg.height);
newWidth=parseInt(delta*mg.width); newWidth = parseInt(delta * mg.width);
var result = [newWidth, newHeight]; var result = [ newWidth, newHeight ];
return result; return result;
}; };
CONTENTSEARCH.removeHoverCss = function(){ CONTENTSEARCH.removeHoverCss = function() {
if(COMMON.isTouchDevice()){ if (COMMON.isTouchDevice()) {
$('#control-sort-title').removeClass('nottouchdevice'); $('#control-sort-title').removeClass('nottouchdevice');
$('#control-sort-titlekana').removeClass('nottouchdevice'); $('#control-sort-titlekana').removeClass('nottouchdevice');
$('#control-sort-releasedate').removeClass('nottouchdevice'); $('#control-sort-releasedate').removeClass('nottouchdevice');
} }
}; };
//Dialog Read Button CLick // Dialog Read Button CLick
CONTENTSEARCH.showContentShareDlgFunction = function(e) { CONTENTSEARCH.showContentShareDlgFunction = function(e) {
if (e) { if (e) {
...@@ -1400,40 +1367,36 @@ CONTENTSEARCH.showContentShareDlgFunction = function(e) { ...@@ -1400,40 +1367,36 @@ CONTENTSEARCH.showContentShareDlgFunction = function(e) {
var contentId = $(this).attr('contentid'); var contentId = $(this).attr('contentid');
// check limit of content // check limit of content
LIMIT_ACCESS_CONTENT.checkLimitContent(contentId, LIMIT_ACCESS_CONTENT.checkLimitContent(contentId, function() {
function()
{
SHARE.contentId = contentId; SHARE.contentId = contentId;
SHARE.contentTitle = ""; SHARE.contentTitle = "";
SHARE.openContentShare(); SHARE.openContentShare();
}, }, function() {
function(){ // console.log("checkLimitContent_bbb");
//console.log("checkLimitContent_bbb"); });
}
);
}; };
CONTENTSEARCH.showContentView = function(){ CONTENTSEARCH.showContentView = function() {
//TOPに戻す // TOPに戻す
var y = 0; var y = 0;
if( document.documentElement.scrollTop ){ if (document.documentElement.scrollTop) {
y = document.documentElement.scrollTop; y = document.documentElement.scrollTop;
} }
if( document.body.scrollTop ){ if (document.body.scrollTop) {
if( y == undefined || y == 0){ if (y == undefined || y == 0) {
y = document.body.scrollTop; y = document.body.scrollTop;
} }
} }
if( y == undefined || y == null){ if (y == undefined || y == null) {
y = 0; y = 0;
} }
CONTENTSEARCH.scrollTop = y; CONTENTSEARCH.scrollTop = y;
window.scrollTo(0,0); window.scrollTo(0, 0);
//試験 // 試験
$("#header-ws").hide(); $("#header-ws").hide();
$("#ws-body").hide(); $("#ws-body").hide();
$("#topcontrol").hide(); $("#topcontrol").hide();
...@@ -1446,28 +1409,28 @@ CONTENTSEARCH.showContentView = function(){ ...@@ -1446,28 +1409,28 @@ CONTENTSEARCH.showContentView = function(){
}; };
CONTENTSEARCH.cssInit = function(){ CONTENTSEARCH.cssInit = function() {
$('html').css({ $('html').css({
'overflow-y':'scroll' 'overflow-y' : 'scroll'
}); });
$('html,body').css({ $('html,body').css({
'height':'100%', 'height' : '100%',
'margin': '0', 'margin' : '0',
'padding': '0' 'padding' : '0'
}); });
$('html>body').css({ $('html>body').css({
'font-size':'16px', 'font-size' : '16px',
'font-size':'68.75%' 'font-size' : '68.75%'
}); });
$('body').css({ $('body').css({
'font-family':'Verdana, helvetica, arial, sans-serif', 'font-family' : 'Verdana, helvetica, arial, sans-serif',
'font-size':'68.75%', 'font-size' : '68.75%',
'background':'#fff', 'background' : '#fff',
'color':'#333' 'color' : '#333'
}); });
}; };
//ダウンロードButton CLick // ダウンロードButton CLick
CONTENTSEARCH.downloadSubmenuFunction = function(e) { CONTENTSEARCH.downloadSubmenuFunction = function(e) {
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
...@@ -1480,8 +1443,7 @@ CONTENTSEARCH.downloadSubmenuFunction = function(e) { ...@@ -1480,8 +1443,7 @@ CONTENTSEARCH.downloadSubmenuFunction = function(e) {
var contentId = $(this).attr('contentid'); var contentId = $(this).attr('contentid');
//Download content // Download content
HEADER.downloadResourceById(contentId); HEADER.downloadResourceById(contentId);
}; };
//名前空間用のオブジェクトを用意する //名前空間用のオブジェクトを用意する
var HISTORY = {}; var HISTORY = {};
//Start Declare Variables // Start Declare Variables
//----Constant-----------// // ----Constant-----------//
//var DEFAULT_DISP_NUMBER_RECORD_FROM = 1; // var DEFAULT_DISP_NUMBER_RECORD_FROM = 1;
//var DEFAULT_DISP_NUMBER_RECORD_TO = 15; // var DEFAULT_DISP_NUMBER_RECORD_TO = 15;
HISTORY.DEFAULT_SORT_TYPE = '4'; HISTORY.DEFAULT_SORT_TYPE = '4';
HISTORY.DEFAULT_SORT_ORDER = '2'; HISTORY.DEFAULT_SORT_ORDER = '2';
HISTORY.DEFAULT_SEARCH_DIVISION = 0; HISTORY.DEFAULT_SEARCH_DIVISION = 0;
//var iNumberOfNextRecord = 15; // var iNumberOfNextRecord = 15;
//Thumbnail array // Thumbnail array
HISTORY.thumbnailArr = []; HISTORY.thumbnailArr = [];
//Content type array. // Content type array.
HISTORY.contentTypeArr = []; HISTORY.contentTypeArr = [];
HISTORY.contentIdArray = []; HISTORY.contentIdArray = [];
...@@ -23,12 +22,12 @@ HISTORY.contentViewData = []; ...@@ -23,12 +22,12 @@ HISTORY.contentViewData = [];
HISTORY.noRecordFlg = false; HISTORY.noRecordFlg = false;
HISTORY.home_isMove = false; HISTORY.home_isMove = false;
HISTORY.history_contentTitleKana = []; HISTORY.history_contentTitleKana = [];
//スクロール復帰 // スクロール復帰
HISTORY.scrollTop = 0; HISTORY.scrollTop = 0;
$(document).ready(function(){ $(document).ready(function() {
if (!AVWEB.avwCheckLogin(COMMON.ScreenIds.Login)){ if (!AVWEB.avwCheckLogin(COMMON.ScreenIds.Login)) {
return; return;
} }
...@@ -38,214 +37,277 @@ $(document).ready(function(){ ...@@ -38,214 +37,277 @@ $(document).ready(function(){
ClientData.BookmarkScreen(COMMON.ScreenIds.History); ClientData.BookmarkScreen(COMMON.ScreenIds.History);
if(ClientData.requirePasswordChange() != 1){ if (ClientData.requirePasswordChange() != 1) {
if(ClientData.ReadingContentIds() == null || ClientData.ReadingContentIds() == 'undefined' || ClientData.ReadingContentIds().length == 0){ //if (ClientData.ReadingContentIds() == null || ClientData.ReadingContentIds() == 'undefined' || ClientData.ReadingContentIds().length == 0) {
}else{ //} else {
HISTORY.syncReadingContent(); // HISTORY.syncReadingContent();
} //}
//remove hover effect when is touch device // remove hover effect when is touch device
HISTORY.removeHoverCss(); HISTORY.removeHoverCss();
//Render Grid // Render Grid
HISTORY.renderGridView(); HISTORY.renderGridView();
//Go To Details Page HISTORY.makeContentIds();
// Go To Details Page
$('#main-ws canvas').live('click', HISTORY.canvasClickFunction); $('#main-ws canvas').live('click', HISTORY.canvasClickFunction);
$('#main-ws canvas').live('touchend', HISTORY.canvasClickFunction); $('#main-ws canvas').live('touchend', HISTORY.canvasClickFunction);
$('#main-ws canvas').live('touchmove', function () { HISTORY.home_isMove = true; }); $('#main-ws canvas').live('touchmove', function() {
HISTORY.home_isMove = true;
});
//Open dialog // Open dialog
$('.dialog').live('click', HISTORY.titleClickFunction); $('.dialog').live('click', HISTORY.titleClickFunction);
//$('.dialog').live('touchstart', HISTORY.titleClickFunction); // $('.dialog').live('touchstart', HISTORY.titleClickFunction);
$('.dialog').live('touchend', HISTORY.titleClickFunction); $('.dialog').live('touchend', HISTORY.titleClickFunction);
$('.dialog').live('touchmove', function () { HISTORY.home_isMove = true; }); $('.dialog').live('touchmove', function() {
HISTORY.home_isMove = true;
});
//Sort Title // Sort Title
$('#control-sort-title').click(HISTORY.sortByTitleFunction); $('#control-sort-title').click(HISTORY.sortByTitleFunction);
//Sort by title kana // Sort by title kana
$('#control-sort-titlekana').click(HISTORY.sortByTitleKanaFunction); $('#control-sort-titlekana').click(HISTORY.sortByTitleKanaFunction);
//sort by release date // sort by release date
$('#control-sort-releasedate').click(HISTORY.sortByReleaseDateFunction); $('#control-sort-releasedate').click(HISTORY.sortByReleaseDateFunction);
$('#control-sort-viewdate').click(HISTORY.sortByViewDateFunction); $('#control-sort-viewdate').click(HISTORY.sortByViewDateFunction);
//Go To Details Page // Go To Details Page
$('.button-details').live('click', HISTORY.readSubmenuFunction); $('.button-details').live('click', HISTORY.readSubmenuFunction);
//$('.button-details').live('touchstart', HISTORY.readSubmenuFunction); // $('.button-details').live('touchstart', HISTORY.readSubmenuFunction);
$('.button-details').live('touchend', HISTORY.readSubmenuFunction); $('.button-details').live('touchend', HISTORY.readSubmenuFunction);
$('.button-details').live('touchmove', function () { HISTORY.home_isMove = true; }); $('.button-details').live('touchmove', function() {
HISTORY.home_isMove = true;
});
//Show Share Dialog // Show Share Dialog
$('.button-share').live('click', HISTORY.showContentShareDlgFunction); $('.button-share').live('click', HISTORY.showContentShareDlgFunction);
$('.button-share').live('touchend', HISTORY.showContentShareDlgFunction); $('.button-share').live('touchend', HISTORY.showContentShareDlgFunction);
$('.button-share').live('touchmove', function () { HISTORY.home_isMove = true; }); $('.button-share').live('touchmove', function() {
HISTORY.home_isMove = true;
});
//ダイハツ対応 // ダイハツ対応
$('.button-download').live('click', HISTORY.downloadFunction); $('.button-download').live('click', HISTORY.downloadFunction);
$('.button-download').live('touchend', HISTORY.downloadFunction); $('.button-download').live('touchend', HISTORY.downloadFunction);
$('.button-download').live('touchmove', function () {}); $('.button-download').live('touchmove', function() {
});
$(window).resize(function () { $(window).resize(function() {
if ($("#contentDetail").css("display") != "none") { if ($("#contentDetail").css("display") != "none") {
// Refresh panel of detail to center. // Refresh panel of detail to center.
$("#contentDetail").center(); $("#contentDetail").center();
if ($("#contentDetail").height() > $(window).height()){ if ($("#contentDetail").height() > $(window).height()) {
$("#contentDetail").css('top', '0'); $("#contentDetail").css('top', '0');
} }
} }
}); });
} } else {
else{ // Check if Force Change password
//Check if Force Change password
HEADER.checkForceChangePassword(); HEADER.checkForceChangePassword();
} }
if (COMMON.isAnonymousLogin()) { if (COMMON.isAnonymousLogin()) {
//プッシュメッセージ隠す // プッシュメッセージ隠す
$('#dspPushMessage').hide(); $('#dspPushMessage').hide();
} }
//詳細、共有表示パーツ読み込み // 詳細、共有表示パーツ読み込み
$("#inc_detail").load("./inc_detail.html?__UPDATEID__", function (myData, myStatus, xhr){ $("#inc_detail").load("./inc_detail.html?__UPDATEID__", function(myData, myStatus, xhr) {
//読み込み完了時の処理 // 読み込み完了時の処理
I18N.i18nReplaceText(); I18N.i18nReplaceText();
$('.datepicker').pickadate({ $('.datepicker').pickadate({
format: 'yyyy-mm-dd' format : 'yyyy-mm-dd'
}); });
}); });
//ビューア、共有表示パーツ読み込み // ビューア、共有表示パーツ読み込み
$("#viewer").load("./inc_contentview.html?__UPDATEID__", function (myData, myStatus, xhr){ $("#viewer").load("./inc_contentview.html?__UPDATEID__", function(myData, myStatus, xhr) {
//読み込み完了時の処理 // 読み込み完了時の処理
I18N.i18nReplaceText(); I18N.i18nReplaceText();
}); });
}); });
//Call API // Call API
//HISTORY.abapi = function(name, param, method, callback){ // HISTORY.abapi = function(name, param, method, callback){
// AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), name, method, param, callback, null); // AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), name, method, param,
//}; // callback, null);
// };
///Render Content HISTORY.makeContentIds = function(){
HISTORY.renderContent = function(id, text, division, type, order, from, to, cateid, grpid) {
var params = {
sid: id,
searchText: text,
searchDivision: division,
sortType: type,
sortOrder: order,
//recordFrom: from,
//recordTo: to,
categoryId: cateid,
groupId: grpid,
authCode: ClientData.authCode()
};
AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), 'webContentList', 'POST', params, //並び替え
function (data) { var sortArr = ClientData.ReadingContentIds();
if(sortArr.length <= 0 ){
$('#content-grid').html(''); return "-1";
//var htmlTemp = "";
for (var i = 0; i < data.contentList.length; i++) {
post = data.contentList[i];
var outputDate = COMMON.formatDeliveryDate(post.contentDeliveryDate);
//renderViewDate
var viewdate = HISTORY.renderViewDate(post.contentId);
if (viewdate != null && viewdate != 'undefined' && viewdate != '') {
var htmlTemp = '<section class="sectionhistory">'
+ ' <div class="cnt_section_list">'
+ ' <a class="img">'
+ ' <canvas height="110" width="150" id="content-thumbnail' + post.contentId + '" contentid="' + post.contentId + '" style="display:none;">'
+ ' </canvas>'
+ ' <img id="imgloading' + post.contentId + '" src="./img/data_loading.gif" height="25px" width="25px" style="padding: 46px; "/>'
+ ' </a>'
+ ' <div class="text">'
+ ' <a id="title' + post.contentId + '" class="name dialog" contentid="' + post.contentId + '">'
+ ' <img class="listIcon" src="' + HEADER.getIconTypeContent(post.contentType)+'" width="20" height="20">'
+ COMMON.truncate(COMMON.htmlEncode(post.contentTitle), 20)
+ ' </a>'
+ ' <div class="info">'
+ ' <ul class="date">'
+ ' <li><span class="lang" lang="txtPubDt"> </span> : ' + outputDate + '</li>'
+ ' <li><span class="lang" lang="txtViewDt"> </span>:<span id="lblVdate' + post.contentId + '"> </span></li>'
+ ' </ul>'
+ ' <ul class="pic">'
+ ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MEMO + '" id="imgMemo' + post.contentId + '" class="sticker" /></li>'
+ ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MARKING + '" id="imgBookMark' + post.contentId + '" class="pen" /></li>'
+ ' <li><ul class="iconList">{share}{download}<li><a class="read lang button-details" contentid="' + post.contentId + '" lang="txtRead">'+I18N.i18nText("txtRead")+'</a></li></ul></li>'
+ ' </ul>'
+ ' </div>'
+ ' </div>'
+ ' </div>'
+ '</section>';
var shareHtml = "";
if( post.readerShare == '1' ){
shareHtml ='<li><a class="read lang button-share" contentid="' + post.contentId + '" lang="txtShare">'+I18N.i18nText("txtShare")+'</a></li>';
} }
htmlTemp = htmlTemp.replace(/\{share\}/g, shareHtml);
//ダイハツ対応 var temp;
//console.log("post.download:" + post.download); for ( var i = 0; i < sortArr.length; i++) {
var downloadHtml = ""; for ( var j = sortArr.length - 1; j > i; j--) {
if( post.download == '1' ){ if (sortArr[j].originviewdate > sortArr[j - 1].originviewdate) {
downloadHtml ='<li><a class="read button-download" contentid="' + post.contentId + '" >ダウンロード</a></li>'; temp = sortArr[j];
sortArr[j] = sortArr[j - 1];
sortArr[j - 1] = temp;
}
}
} }
htmlTemp = htmlTemp.replace(/\{download\}/g, downloadHtml);
//効率化 var contentIds = "";
//$('#content-grid').append(htmlTemp); var cnt = 0;
for ( var i = 0; i < sortArr.length; i++) {
//console.log("contentId:" + sortArr[i].contentid + " viewdate:" + sortArr[i].originviewdate)
if(sortArr[i].originviewdate != null && sortArr[i].originviewdate != ''){
cnt = cnt + 1;
if(cnt == 1){
contentIds = sortArr[i].contentid;
} else {
contentIds = contentIds + "," + sortArr[i].contentid;
} }
if(cnt == 50){
break;
} }
}
}
return contentIds;
};
// /Render Content
HISTORY.renderContent = function(id, text, division, type, order) {
var contentIds = HISTORY.makeContentIds();
var params = {
sid : id,
searchText : text,
searchDivision : division,
sortType : type,
sortOrder : order,
recordFrom: 0,
recordTo: 99999,
categoryId : '',
groupId : '',
authCode : ClientData.authCode(),
contentIds : contentIds
};
for (var i = 0; i < data.contentList.length; i++) { AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), 'webContentList', 'POST', params, function(data) {
$('#content-grid').html('');
// var htmlTemp = "";
// for ( var i = 0; i < data.contentList.length; i++) {
// post = data.contentList[i];
//
// var outputDate = COMMON.formatDeliveryDate(post.contentDeliveryDate);
// // renderViewDate
// var viewdate = HISTORY.renderViewDate(post.contentId);
//
// if (viewdate != null && viewdate != 'undefined' && viewdate != '') {
//
// var htmlTemp = '<section class="sectionhistory">'
// + ' <div class="cnt_section_list">'
// + ' <a class="img">'
// + ' <canvas height="110" width="150" id="content-thumbnail' + post.contentId + '" contentid="' + post.contentId + '" style="display:none;">'
// + ' </canvas>'
// + ' <img id="imgloading' + post.contentId + '" src="./img/data_loading.gif" height="25px" width="25px" style="padding: 46px; "/>'
// + ' </a>'
// + ' <div class="text">'
// + ' <a id="title' + post.contentId + '" class="name dialog" contentid="' + post.contentId + '">'
// + ' <img class="listIcon" src="' + HEADER.getIconTypeContent(post.contentType) + '" width="20" height="20">' + COMMON.truncate(COMMON.htmlEncode(post.contentTitle), 20)
// + ' </a>'
// + ' <div class="info">'
// + ' <ul class="date">'
// + ' <li><span class="lang" lang="txtPubDt"> </span> : ' + outputDate + '</li>'
// + ' <li><span class="lang" lang="txtViewDt"> </span>:<span id="lblVdate' + post.contentId + '"> </span></li>'
// + ' </ul>'
// + ' <ul class="pic">'
// + ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MEMO + '" id="imgMemo' + post.contentId + '" class="sticker" /></li>'
// + ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MARKING + '" id="imgBookMark' + post.contentId + '" class="pen" /></li>'
// + ' <li><ul class="iconList">{share}{download}<li><a class="read lang button-details" contentid="' + post.contentId + '" lang="txtRead">' + I18N.i18nText("txtRead") + '</a></li></ul></li>'
// + ' </ul>'
// + ' </div>'
// + ' </div>'
// + ' </div>'
// + '</section>';
// var shareHtml = "";
// if (post.readerShare == '1') {
// shareHtml = '<li><a class="read lang button-share" contentid="' + post.contentId + '" lang="txtShare">' + I18N.i18nText("txtShare") + '</a></li>';
// }
// htmlTemp = htmlTemp.replace(/\{share\}/g, shareHtml);
//
// // ダイハツ対応
// // console.log("post.download:" + post.download);
// var downloadHtml = "";
// if (post.download == '1') {
// downloadHtml = '<li><a class="read button-download" contentid="' + post.contentId + '" >ダウンロード</a></li>';
// }
// htmlTemp = htmlTemp.replace(/\{download\}/g, downloadHtml);
//
// // 効率化
// // $('#content-grid').append(htmlTemp);
// }
// }
var readingContentIds = ClientData.ReadingContentIds();
for ( var i = 0; i < data.contentList.length; i++) {
post = data.contentList[i]; post = data.contentList[i];
var viewdate = HISTORY.renderViewDate(post.contentId); var viewdate = HISTORY.renderViewDate(post.contentId, readingContentIds);
// save alert message level // save alert message level
LIMIT_ACCESS_CONTENT.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 != '') { if (viewdate != null && viewdate != 'undefined' && viewdate != '') {
//assign thumbnail to array // assign thumbnail to array
var formatThumbnail = post.contentThumbnail; var formatThumbnail = post.contentThumbnail;
if((formatThumbnail != null) && (formatThumbnail != 'undefined') && (formatThumbnail != '')){ if ((formatThumbnail != null) && (formatThumbnail != 'undefined') && (formatThumbnail != '')) {
formatThumbnail = COMMON.formatStringBase64(formatThumbnail); formatThumbnail = COMMON.formatStringBase64(formatThumbnail);
} }
HISTORY.thumbnailArr.push({ contentId: post.contentId, thumbnail: formatThumbnail}); HISTORY.thumbnailArr.push({
contentId : post.contentId,
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type to array to manage. thumbnail : formatThumbnail
//assign content type to array });
HISTORY.contentTypeArr.push({ contentId: post.contentId, contentType: post.contentType });
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type to array to manage.
//効率化 HISTORY.contentTypeArr.push({
//Check if user has read this content or not. contentId : post.contentId,
//HISTORY.checkUserHasReadContent(post.contentId, post.resourceVersion, post.metaVersion); contentType : post.contentType
});
//assign version to array // assign version to array
COMMON.resourceVersionArr.push({ contentid: post.contentId, resourceversion: post.resourceVersion }); COMMON.resourceVersionArr.push({
contentid : post.contentId,
resourceversion : post.resourceVersion
});
//assign meta version to array // assign meta version to array
COMMON.metaVersionArr.push({ contentid: post.contentId, metaversion: post.metaVersion }); COMMON.metaVersionArr.push({
contentid : post.contentId,
metaversion : post.metaVersion
});
//Check if content has marking or memo // Check if content has marking or memo
HISTORY.checkContentMarkingMemoOption(post.contentId); HISTORY.checkContentMarkingMemoOption(post.contentId);
//効率化 // 効率化
//$('#lblVdate' + post.contentId).html(viewdate); // $('#lblVdate' + post.contentId).html(viewdate);
//HISTORY.addReadContentToArray(post.contentId, post.resourceVersion, post.metaVersion, post.contentThumbnail, post.contentTitle, HISTORY.returnContentTitleKana(post.contentId),
// post.contentDeliveryDate, post.contentType, post.readerShare, post.download);
HISTORY.addReadContentToArray(post.contentId, post.resourceVersion, post.metaVersion, post.contentThumbnail, post.contentTitle, HISTORY.returnContentTitleKana(post.contentId), post.contentDeliveryDate,post.contentType, post.readerShare, post.download ); var originalViewDate = HISTORY.formatDate(HISTORY.returnOriginalViewDate(post.contentId,readingContentIds));
HISTORY.addReadContentToArray(post.contentId, post.resourceVersion, post.metaVersion, post.contentThumbnail, post.contentTitle, post.contentNameKana,
post.contentDeliveryDate, post.contentType, post.readerShare, post.download, originalViewDate);
//HISTORY.showContentThumbnail();
} }
} }
...@@ -256,51 +318,50 @@ HISTORY.renderContent = function(id, text, division, type, order, from, to, cate ...@@ -256,51 +318,50 @@ HISTORY.renderContent = function(id, text, division, type, order, from, to, cate
ClientData.searchCond_recordTo(data.recordTo); ClientData.searchCond_recordTo(data.recordTo);
} }
HISTORY.totalPage = data.totalRecord; HISTORY.totalPage = data.totalRecord;
//Render Page number // Render Page number
HISTORY.reRenderPageNumber(HISTORY.totalPage, HISTORY.totalPage); HISTORY.reRenderPageNumber(HISTORY.totalPage, HISTORY.totalPage);
}, null); }, null);
}; };
//Handle language // Handle language
HISTORY.handleLanguage = function(){ HISTORY.handleLanguage = function() {
//if(ClientData.userInfo_language() == COMMON.Consts.ConstLanguage_En || ClientData.userInfo_language() == COMMON.Consts.ConstLanguage_Ko) // if(ClientData.userInfo_language() == COMMON.Consts.ConstLanguage_En ||
if (I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || I18N.getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko) // ClientData.userInfo_language() == 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').css('display', 'none');
$('#control-sort-titlekana-off').css('display','none'); $('#control-sort-titlekana-off').css('display', 'none');
$('#label-sort-titlekana').css('display','none'); $('#label-sort-titlekana').css('display', 'none');
$('#separate').css('display','none'); $('#separate').css('display', 'none');
$("#titlekana-sorttype").html(''); $("#titlekana-sorttype").html('');
} } else {
else {
if (ClientData.searchCond_sortOrder() != null && ClientData.searchCond_sortOrder() != 'undefined' || ClientData.searchCond_sortType() != '') { if (ClientData.searchCond_sortOrder() != null && ClientData.searchCond_sortOrder() != 'undefined' || ClientData.searchCond_sortType() != '') {
var typeSort = ClientData.searchCond_sortType(); var typeSort = ClientData.searchCond_sortType();
var orderSort = ClientData.searchCond_sortOrder(); var orderSort = ClientData.searchCond_sortOrder();
HEADER.setStatusSort('#'+$('#menu_sort li.current a').attr('id'),orderSort == COMMON.Consts.ConstOrderSetting_Asc); HEADER.setStatusSort('#' + $('#menu_sort li.current a').attr('id'), orderSort == COMMON.Consts.ConstOrderSetting_Asc);
} }
if(HISTORY.noRecordFlg){ if (HISTORY.noRecordFlg) {
$('#label-sort-titlekana').css('display','block'); $('#label-sort-titlekana').css('display', 'block');
$('#separate').css('display','block'); $('#separate').css('display', 'block');
$('#control-sort-titlekana-off').css('display','block'); $('#control-sort-titlekana-off').css('display', 'block');
$('#content-grid').html("<div id='msgHistoryNotExist'>" + I18N.i18nText('msgHistoryNotExist') + "</div>"); $('#content-grid').html("<div id='msgHistoryNotExist'>" + I18N.i18nText('msgHistoryNotExist') + "</div>");
}else{ } else {
$('#control-sort-titlekana').css('display','block'); $('#control-sort-titlekana').css('display', 'block');
$('#separate').css('display','block'); $('#separate').css('display', 'block');
} }
} }
}; };
//Initial Screen // Initial Screen
HISTORY.renderGridView = function(){ HISTORY.renderGridView = function() {
var fromPage = ''; //var fromPage = '';
var toPage = ''; //var toPage = '';
var sortType = HISTORY.DEFAULT_SORT_TYPE; var sortType = HISTORY.DEFAULT_SORT_TYPE;
var sortOrder = HISTORY.DEFAULT_SORT_ORDER; var sortOrder = HISTORY.DEFAULT_SORT_ORDER;
var searchText = ''; var searchText = '';
...@@ -309,42 +370,38 @@ HISTORY.renderGridView = function(){ ...@@ -309,42 +370,38 @@ HISTORY.renderGridView = function(){
var groupId = ''; var groupId = '';
var sid = ClientData.userInfo_sid(); var sid = ClientData.userInfo_sid();
ClientData.searchCond_recordFrom(fromPage); ClientData.searchCond_recordFrom(0);
ClientData.searchCond_recordTo(0);
ClientData.searchCond_recordTo(toPage);
ClientData.searchCond_sortType(sortType); ClientData.searchCond_sortType(sortType);
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
ClientData.searchCond_searchDivision(searchDivision); ClientData.searchCond_searchDivision(searchDivision);
//Handle display sort // Handle display sort
HISTORY.handleSortDisp(); HISTORY.handleSortDisp();
//Display user name // Display user name
$('#login-username').html(ClientData.userInfo_loginId_session()); $('#login-username').html(ClientData.userInfo_loginId_session());
//Refresh GridView // Refresh GridView
HISTORY.refreshGrid(); HISTORY.refreshGrid();
if(ClientData.ReadingContentIds() == null || ClientData.ReadingContentIds() == 'undefined' || ClientData.ReadingContentIds().length == 0){ var readingContentIds = ClientData.ReadingContentIds();
if (readingContentIds.length == 0) {
HISTORY.displayResultNoRecord(); HISTORY.displayResultNoRecord();
HISTORY.noRecordFlg = true; HISTORY.noRecordFlg = true;
HISTORY.reRenderPageNumber(0,0); HISTORY.reRenderPageNumber(0, 0);
} } else {
else{ // Render Gridview
//Render Gridview HISTORY.renderContent(sid, searchText, searchDivision, 3, sortOrder);
HISTORY.renderContent(sid, searchText, searchDivision, 3, sortOrder, fromPage, toPage, genreId, groupId);
HISTORY.sortByViewDateDesc(); HISTORY.sortByViewDateDesc();
} }
//Language Handle // Language Handle
HISTORY.handleLanguage(); HISTORY.handleLanguage();
}; };
//Canvas Click function // Canvas Click function
HISTORY.canvasClickFunction = function(e){ HISTORY.canvasClickFunction = function(e) {
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
} }
...@@ -363,72 +420,74 @@ HISTORY.canvasClickFunction = function(e){ ...@@ -363,72 +420,74 @@ HISTORY.canvasClickFunction = function(e){
var base64String = HISTORY.returnThumbnail(outputId); var base64String = HISTORY.returnThumbnail(outputId);
ClientData.contentInfo_contentThumbnail(base64String); ClientData.contentInfo_contentThumbnail(base64String);
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType of content.
var contentType = HISTORY.returnContentType(outputId); var contentType = HISTORY.returnContentType(outputId);
ClientData.contentInfo_contentType(contentType); ClientData.contentInfo_contentType(contentType);
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType of content.
//Store Content id that user has read var checkflag = false;
if(ClientData.ReadingContentIds().length > 0){
HISTORY.contentIdArray = ClientData.ReadingContentIds(); HISTORY.contentIdArray = ClientData.ReadingContentIds();
if (HISTORY.contentIdArray.length > 0) {
for(var nIndex = 0; nIndex < HISTORY.contentIdArray.length; nIndex++){ for ( var nIndex = 0; nIndex < HISTORY.contentIdArray.length; nIndex++) {
if(HISTORY.contentIdArray[nIndex].contentid == outputId){ if (HISTORY.contentIdArray[nIndex].contentid == outputId) {
checkflag = true; checkflag = true;
break; break;
} }
else{
checkflag = false;
}
} }
if(!checkflag){ if (!checkflag) {
HISTORY.contentIdArray.push({contentid: outputId, viewdate: '', originviewdate: ''}); HISTORY.contentIdArray.push({
} contentid : outputId,
viewdate : '',
originviewdate : ''
});
} }
else{ } else {
HISTORY.contentIdArray.push({contentid: outputId, viewdate: '', originviewdate: ''}); HISTORY.contentIdArray.push({
contentid : outputId,
viewdate : '',
originviewdate : ''
});
} }
//Renew ReadingContentID // Renew ReadingContentID
var newArray = []; var newArray = [];
ClientData.ReadingContentIds(newArray); ClientData.ReadingContentIds(newArray);
//Set data for readingcontentid // Set data for readingcontentid
ClientData.ReadingContentIds(HISTORY.contentIdArray); ClientData.ReadingContentIds(HISTORY.contentIdArray);
//Set ResouceVersion for content // Set ResouceVersion for content
COMMON.setResourceVersionData(outputId); COMMON.setResourceVersionData(outputId);
//Set MetaVersion for content // Set MetaVersion for content
COMMON.setMetaVersionData(outputId); COMMON.setMetaVersionData(outputId);
//Delete 'new' icon // Delete 'new' icon
HISTORY.drawEditImage(outputId); HISTORY.drawEditImage(outputId);
//Open content Detail // Open content Detail
DETAIL.openContentDetail(); DETAIL.openContentDetail();
}; };
//Re-render page from and total record // Re-render page from and total record
HISTORY.reRenderPageNumber = function(dispRecord, dispTotal){ HISTORY.reRenderPageNumber = function(dispRecord, dispTotal) {
if( HISTORY.contentViewData.length ){ if (HISTORY.contentViewData.length) {
$('#dispPage').html(HISTORY.contentViewData.length); $('#dispPage').html(HISTORY.contentViewData.length);
$('#totalPage').html(HISTORY.contentViewData.length); $('#totalPage').html(HISTORY.contentViewData.length);
$('#dispPage').css('visibility','visible'); $('#dispPage').css('visibility', 'visible');
$('#totalPage').css('visibility','visible'); $('#totalPage').css('visibility', 'visible');
$('.pageNumControl').css('visibility','visible'); $('.pageNumControl').css('visibility', 'visible');
} else { } else {
$('#dispPage').css('visibility','hidden'); $('#dispPage').css('visibility', 'hidden');
$('#totalPage').css('visibility','hidden'); $('#totalPage').css('visibility', 'hidden');
$('.pageNumControl').css('visibility','hidden'); $('.pageNumControl').css('visibility', 'hidden');
} }
}; };
//Sort By Title Function // Sort By Title Function
HISTORY.sortByTitleFunction = function(){ HISTORY.sortByTitleFunction = function() {
var sortOrder = ClientData.searchCond_sortOrder(); var sortOrder = ClientData.searchCond_sortOrder();
var sortType = ClientData.searchCond_sortType(); var sortType = ClientData.searchCond_sortType();
...@@ -438,38 +497,30 @@ HISTORY.sortByTitleFunction = function(){ ...@@ -438,38 +497,30 @@ HISTORY.sortByTitleFunction = function(){
var genreId = ClientData.searchCond_genreId(); var genreId = ClientData.searchCond_genreId();
var groupId = ClientData.searchCond_groupId(); var groupId = ClientData.searchCond_groupId();
if(sortOrder == COMMON.Consts.ConstOrderSetting_Asc) if (sortOrder == COMMON.Consts.ConstOrderSetting_Asc) {
{ if (sortType == '1') {
if(sortType == '1'){
sortOrder = COMMON.Consts.ConstOrderSetting_Desc; sortOrder = COMMON.Consts.ConstOrderSetting_Desc;
HISTORY.sortByTitleDesc(); HISTORY.sortByTitleDesc();
} } else {
else{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
HISTORY.sortByTitleAsc(); HISTORY.sortByTitleAsc();
} }
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} } else {
else
{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
HISTORY.sortByTitleAsc(); HISTORY.sortByTitleAsc();
} }
HEADER.setStatusSort('#control-sort-title',sortOrder == COMMON.Consts.ConstOrderSetting_Asc); HEADER.setStatusSort('#control-sort-title', sortOrder == COMMON.Consts.ConstOrderSetting_Asc);
sortType = '1'; sortType = '1';
ClientData.searchCond_sortType(sortType); ClientData.searchCond_sortType(sortType);
//refresh Gridview
//HISTORY.refreshGrid();
//HISTORY.renderContent(sid, '', ClientData.searchCond_searchDivision(), sortType, sortOrder, recordFrom, recordTo, genreId, groupId);
}; };
//Sort By Title Kana function // Sort By Title Kana function
HISTORY.sortByTitleKanaFunction = function(){ HISTORY.sortByTitleKanaFunction = function() {
var sortOrder = ClientData.searchCond_sortOrder(); var sortOrder = ClientData.searchCond_sortOrder();
var sortType = ClientData.searchCond_sortType(); var sortType = ClientData.searchCond_sortType();
...@@ -479,38 +530,31 @@ HISTORY.sortByTitleKanaFunction = function(){ ...@@ -479,38 +530,31 @@ HISTORY.sortByTitleKanaFunction = function(){
var genreId = ClientData.searchCond_genreId(); var genreId = ClientData.searchCond_genreId();
var groupId = ClientData.searchCond_groupId(); var groupId = ClientData.searchCond_groupId();
if(sortOrder == COMMON.Consts.ConstOrderSetting_Asc) if (sortOrder == COMMON.Consts.ConstOrderSetting_Asc) {
{ if (sortType == '2') {
if(sortType == '2'){
sortOrder = COMMON.Consts.ConstOrderSetting_Desc; sortOrder = COMMON.Consts.ConstOrderSetting_Desc;
HISTORY.sortByTitleKanaDesc(); HISTORY.sortByTitleKanaDesc();
} } else {
else{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
HISTORY.sortByTitleKanaAsc(); HISTORY.sortByTitleKanaAsc();
} }
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} } else {
else
{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
HISTORY.sortByTitleKanaAsc(); HISTORY.sortByTitleKanaAsc();
} }
HEADER.setStatusSort('#control-sort-titlekana',sortOrder == COMMON.Consts.ConstOrderSetting_Asc); HEADER.setStatusSort('#control-sort-titlekana', sortOrder == COMMON.Consts.ConstOrderSetting_Asc);
sortType = '2'; sortType = '2';
//refresh gridview
//HISTORY.refreshGrid();
ClientData.searchCond_sortType(sortType); ClientData.searchCond_sortType(sortType);
//HISTORY.renderContent(sid, '', ClientData.searchCond_searchDivision(), sortType, sortOrder, null, null, genreId, groupId);
}; };
//Sort By Release Date // Sort By Release Date
HISTORY.sortByReleaseDateFunction = function(){ HISTORY.sortByReleaseDateFunction = function() {
var sortOrder = ClientData.searchCond_sortOrder(); var sortOrder = ClientData.searchCond_sortOrder();
var sortType = ClientData.searchCond_sortType(); var sortType = ClientData.searchCond_sortType();
...@@ -520,91 +564,78 @@ HISTORY.sortByReleaseDateFunction = function(){ ...@@ -520,91 +564,78 @@ HISTORY.sortByReleaseDateFunction = function(){
var genreId = ClientData.searchCond_genreId(); var genreId = ClientData.searchCond_genreId();
var groupId = ClientData.searchCond_groupId(); var groupId = ClientData.searchCond_groupId();
if(sortOrder == COMMON.Consts.ConstOrderSetting_Asc) if (sortOrder == COMMON.Consts.ConstOrderSetting_Asc) {
{ if (sortType == '3') {
if(sortType == '3'){
sortOrder = COMMON.Consts.ConstOrderSetting_Desc; sortOrder = COMMON.Consts.ConstOrderSetting_Desc;
HISTORY.sortByPublishDateDesc(); HISTORY.sortByPublishDateDesc();
} } else {
else{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
HISTORY.sortByPublishDateAsc(); HISTORY.sortByPublishDateAsc();
} }
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} } else {
else
{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
HISTORY.sortByPublishDateAsc(); HISTORY.sortByPublishDateAsc();
} }
HEADER.setStatusSort('#control-sort-releasedate',sortOrder == COMMON.Consts.ConstOrderSetting_Asc); HEADER.setStatusSort('#control-sort-releasedate', sortOrder == COMMON.Consts.ConstOrderSetting_Asc);
sortType = '3'; sortType = '3';
ClientData.searchCond_sortType(sortType); ClientData.searchCond_sortType(sortType);
//HISTORY.renderContent(sid, '', ClientData.searchCond_searchDivision(), sortType, sortOrder, recordFrom, recordTo, genreId, groupId);
}; };
//Sort By View Date // Sort By View Date
HISTORY.sortByViewDateFunction = function(){ HISTORY.sortByViewDateFunction = function() {
var sortOrder = ClientData.searchCond_sortOrder(); var sortOrder = ClientData.searchCond_sortOrder();
var sortType = ClientData.searchCond_sortType(); var sortType = ClientData.searchCond_sortType();
if(sortOrder == COMMON.Consts.ConstOrderSetting_Asc) if (sortOrder == COMMON.Consts.ConstOrderSetting_Asc) {
{ if (sortType == '4') {
if(sortType == '4'){
sortOrder = COMMON.Consts.ConstOrderSetting_Desc; sortOrder = COMMON.Consts.ConstOrderSetting_Desc;
HISTORY.sortByViewDateDesc(); HISTORY.sortByViewDateDesc();
} } else {
else{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
HISTORY.sortByViewDateAsc(); HISTORY.sortByViewDateAsc();
} }
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} } else {
else
{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
HISTORY.sortByViewDateAsc(); HISTORY.sortByViewDateAsc();
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
HEADER.setStatusSort('#control-sort-viewdate',sortOrder == COMMON.Consts.ConstOrderSetting_Asc); HEADER.setStatusSort('#control-sort-viewdate', sortOrder == COMMON.Consts.ConstOrderSetting_Asc);
sortType = '4'; sortType = '4';
ClientData.searchCond_sortType(sortType); ClientData.searchCond_sortType(sortType);
}; };
//Get Thumnail base on contentid // Get Thumnail base on contentid
HISTORY.returnThumbnail = function(contentid){ HISTORY.returnThumbnail = function(contentid) {
for ( var i = 0; i < HISTORY.thumbnailArr.length; i++) {
for(var i = 0; i < HISTORY.thumbnailArr.length; i++){ if (HISTORY.thumbnailArr[i].contentId == contentid) {
if(HISTORY.thumbnailArr[i].contentId == contentid){
return HISTORY.thumbnailArr[i].thumbnail; return HISTORY.thumbnailArr[i].thumbnail;
} }
} }
}; };
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Create new function to return content type of content. HISTORY.returnContentType = function(contentid) {
//Get content type base on contentid // Array Length
HISTORY.returnContentType = function(contentid){
//Array Length
var iArrCnt = HISTORY.contentTypeArr.length; var iArrCnt = HISTORY.contentTypeArr.length;
//Get contentType in array by contentId // Get contentType in array by contentId
for(var i = 0; i < iArrCnt; i++){ for ( var i = 0; i < iArrCnt; i++) {
if (HISTORY.contentTypeArr[i].contentId == contentid) { if (HISTORY.contentTypeArr[i].contentId == contentid) {
return HISTORY.contentTypeArr[i].contentType; return HISTORY.contentTypeArr[i].contentType;
} }
} }
}; };
//Dialog Read Button CLick // Dialog Read Button CLick
HISTORY.readSubmenuFunction = function(e){ HISTORY.readSubmenuFunction = function(e) {
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
} }
...@@ -616,22 +647,18 @@ HISTORY.readSubmenuFunction = function(e){ ...@@ -616,22 +647,18 @@ HISTORY.readSubmenuFunction = function(e){
var contentId = $(this).attr('contentid'); var contentId = $(this).attr('contentid');
// check limit of content // check limit of content
LIMIT_ACCESS_CONTENT.checkLimitContent(contentId, LIMIT_ACCESS_CONTENT.checkLimitContent(contentId, function() {
function()
{
HISTORY.readSubmenuFunction_callback(contentId); HISTORY.readSubmenuFunction_callback(contentId);
}, }, function() {
function(){ });
}
);
}; };
// read content callback // read content callback
HISTORY.readSubmenuFunction_callback = function(contentId){ HISTORY.readSubmenuFunction_callback = function(contentId) {
var contentThumbnail = HISTORY.returnThumbnail(contentId); var contentThumbnail = HISTORY.returnThumbnail(contentId);
var date = new Date(); var date = new Date();
var month = date.getMonth()+1; var month = date.getMonth() + 1;
var day = date.getDate(); var day = date.getDate();
var outputDate = COMMON.formatNormalDate(day, month, date.getFullYear()); var outputDate = COMMON.formatNormalDate(day, month, date.getFullYear());
...@@ -639,307 +666,306 @@ HISTORY.readSubmenuFunction_callback = function(contentId){ ...@@ -639,307 +666,306 @@ HISTORY.readSubmenuFunction_callback = function(contentId){
ClientData.contentInfo_contentId(contentId); ClientData.contentInfo_contentId(contentId);
ClientData.contentInfo_contentThumbnail(contentThumbnail); ClientData.contentInfo_contentThumbnail(contentThumbnail);
//Start Function : No.12 -- Editor : Le Long -- Date : 08/01/2013 -- Summary : Store contentType to storage.
var contentType = HISTORY.returnContentType(contentId); var contentType = HISTORY.returnContentType(contentId);
ClientData.contentInfo_contentType(contentType); ClientData.contentInfo_contentType(contentType);
//End Function : No.12 -- Editor : Le Long -- Date : 08/01/2013 -- Summary : Store contentType to storage.
var checkflag = false;
//Store Content id that user has read var checkflag = false;
if(ClientData.ReadingContentIds().length > 0){
HISTORY.contentIdArray = ClientData.ReadingContentIds(); HISTORY.contentIdArray = ClientData.ReadingContentIds();
// Store Content id that user has read
if (HISTORY.contentIdArray.length > 0) {
for(var nIndex = 0; nIndex < HISTORY.contentIdArray.length; nIndex++){ for ( var nIndex = 0; nIndex < HISTORY.contentIdArray.length; nIndex++) {
if(HISTORY.contentIdArray[nIndex].contentid == contentId){ if (HISTORY.contentIdArray[nIndex].contentid == contentId) {
checkflag = true; checkflag = true;
if(HISTORY.contentIdArray[nIndex].viewdate == null || HISTORY.contentIdArray[nIndex].viewdate == 'undefined' || HISTORY.contentIdArray[nIndex].viewdate == ''){ if (HISTORY.contentIdArray[nIndex].viewdate == null || HISTORY.contentIdArray[nIndex].viewdate == 'undefined' || HISTORY.contentIdArray[nIndex].viewdate == '') {
HISTORY.contentIdArray[nIndex].viewdate = outputDate; HISTORY.contentIdArray[nIndex].viewdate = outputDate;
HISTORY.contentIdArray[nIndex].originviewdate = date; HISTORY.contentIdArray[nIndex].originviewdate = date;
} }
break; break;
} }
else{
checkflag = false;
}
} }
if(!checkflag){ if (!checkflag) {
HISTORY.contentIdArray.push({contentid: contentId, viewdate: outputDate, originviewdate: date}); HISTORY.contentIdArray.push({
} contentid : contentId,
viewdate : outputDate,
originviewdate : date
});
} }
else{ } else {
HISTORY.contentIdArray.push({contentid: contentId, viewdate: outputDate, originviewdate: date}); HISTORY.contentIdArray.push({
contentid : contentId,
viewdate : outputDate,
originviewdate : date
});
} }
//Renew ReadingContentID // Renew ReadingContentID
var newArray = []; var newArray = [];
ClientData.ReadingContentIds(newArray); ClientData.ReadingContentIds(newArray);
//Set ResouceVersion for content // Set ResouceVersion for content
COMMON.setResourceVersionData(contentId); COMMON.setResourceVersionData(contentId);
//Set MetaVersion for content // Set MetaVersion for content
COMMON.setMetaVersionData(contentId); COMMON.setMetaVersionData(contentId);
//Set data for readingcontentid // Set data for readingcontentid
ClientData.ReadingContentIds(HISTORY.contentIdArray); ClientData.ReadingContentIds(HISTORY.contentIdArray);
ClientData.IsRefresh(false); ClientData.IsRefresh(false);
//Start Function : No.12 -- Editor : Le Long -- Date : 08/02/2013 -- Summary : Check content type other for download. if (contentType == COMMON.ContentTypeKeys.Type_Others) {
//For testing without other Type. // Download content
//contentType = COMMON.ContentTypeKeys.Type_Others;
if(contentType == COMMON.ContentTypeKeys.Type_Others){
//Download content
HEADER.downloadResourceById(contentId); HEADER.downloadResourceById(contentId);
// redraw content remove new icon // redraw content remove new icon
HISTORY.drawEditImage(contentId); HISTORY.drawEditImage(contentId);
} } else if (contentType == COMMON.ContentTypeKeys.Type_Link) {
else if( contentType == COMMON.ContentTypeKeys.Type_Link ){ // link content
//link content
HEADER.viewLinkContentById(contentId); HEADER.viewLinkContentById(contentId);
// redraw content remove new icon // redraw content remove new icon
HISTORY.drawEditImage(contentId); HISTORY.drawEditImage(contentId);
} } else {
else{ // Go to Conten view page
//Go to Conten view page // AVWEB.avwScreenMove(COMMON.ScreenIds.ContentView);
//AVWEB.avwScreenMove(COMMON.ScreenIds.ContentView);
HISTORY.drawEditImage(contentId); HISTORY.drawEditImage(contentId);
HISTORY.showContentView(); HISTORY.showContentView();
} }
//End Function : No.12 -- Editor : Le Long -- Date : 08/02/2013 -- Summary : Check content type other for download.
}; };
// Check if Content Has marking or memo
HISTORY.checkContentMarkingMemoOption = function(contentId) {
//Check if Content Has marking or memo // Check if contentid has marking
HISTORY.checkContentMarkingMemoOption = function(contentId){ if (ClientData.MarkingData().length == 0) {
//Check if contentid has marking $('#imgBookMark' + contentId).css('visibility', 'hidden');
if(ClientData.MarkingData().length == 0){ } else {
$('#imgBookMark'+contentId).css('visibility','hidden'); for ( var nIndex1 = 0; nIndex1 < ClientData.MarkingData().length; nIndex1++) {
}
else{
for (var nIndex1 = 0; nIndex1 < ClientData.MarkingData().length; nIndex1++) {
if (ClientData.MarkingData()[nIndex1].contentid == contentId) { if (ClientData.MarkingData()[nIndex1].contentid == contentId) {
$('#imgBookMark'+contentId).css('visibility','visible'); $('#imgBookMark' + contentId).css('visibility', 'visible');
break; break;
} } else {
else{ $('#imgBookMark' + contentId).css('visibility', 'hidden');
$('#imgBookMark'+contentId).css('visibility','hidden');
} }
} }
} }
if(ClientData.MemoData().length == 0){ if (ClientData.MemoData().length == 0) {
$('#imgMemo'+contentId).css('visibility','hidden'); $('#imgMemo' + contentId).css('visibility', 'hidden');
} } else {
else{
// Check if contentid has memo // Check if contentid has memo
for (var nIndex1 = 0; nIndex1 < ClientData.MemoData().length; nIndex1++) { for ( var nIndex1 = 0; nIndex1 < ClientData.MemoData().length; nIndex1++) {
if (ClientData.MemoData()[nIndex1].contentid == contentId) { if (ClientData.MemoData()[nIndex1].contentid == contentId) {
$('#imgMemo'+contentId).css('visibility','visible'); $('#imgMemo' + contentId).css('visibility', 'visible');
break; break;
} } else {
else $('#imgMemo' + contentId).css('visibility', 'hidden');
{
$('#imgMemo'+contentId).css('visibility','hidden');
} }
} }
} }
}; };
//Check if User has read content // Check if User has read content
HISTORY.checkUserHasReadContent = function(contId, resourceVer, metaVer){ HISTORY.checkUserHasReadContent = function(contId, resourceVer, metaVer, versionArr, metaArr, readArr) {
var imgThumb = new Image(); var imgThumb = new Image();
//imgThumb.src = HISTORY.returnThumbnail(contId);
var imgIconNew = new Image(); var imgIconNew = new Image();
//imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
var imgIconEdit = new Image(); var imgIconEdit = new Image();
//imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
var c = document.getElementById('content-thumbnail'+contId); var c = document.getElementById('content-thumbnail' + contId);
var ctx = c.getContext('2d'); var ctx = c.getContext('2d');
var readFlg = false; var readFlg = false;
var versionArr = ClientData.ResourceVersion(); //var versionArr = ClientData.ResourceVersion();
var metaArr = ClientData.MetaVersion(); //var metaArr = ClientData.MetaVersion();
var readArr = ClientData.ReadingContentIds(); //var readArr = ClientData.ReadingContentIds();
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType and Thumbnail of content.
var contentThumbnail = HISTORY.returnThumbnail(contId); var contentThumbnail = HISTORY.returnThumbnail(contId);
var contentType = HISTORY.returnContentType(contId); var contentType = HISTORY.returnContentType(contId);
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType and Thumbnail of content.
if(readArr == null || readArr <= 0 || readArr == 'undefined'){ if (readArr <= 0) {
imgThumb.onload = function(){ imgThumb.onload = function() {
var resizeImg = HISTORY.resizeResourceThumbnail(imgThumb, c.width, c.height); var resizeImg = HISTORY.resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, c.width/2 - resizeImg[0]/2, 0, resizeImg[0], resizeImg[1]); ctx.drawImage(imgThumb, c.width / 2 - resizeImg[0] / 2, 0, resizeImg[0], resizeImg[1]);
imgIconNew.onload = function(){ imgIconNew.onload = function() {
ctx.drawImage(imgIconNew, c.width/2 - resizeImg[0]/2, 0); ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, 0);
HISTORY.showContentThumbnail(contId); HISTORY.showContentThumbnail(contId);
}; };
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW; imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
}; };
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail. if (contentThumbnail == '' || contentThumbnail == null) {
if(contentThumbnail == '' || contentThumbnail == null){ if (!COMMON.isPdfContent(contentType)) {
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType); var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){ if (src != '') {
imgThumb.src = src; imgThumb.src = src;
} }
} }
}else{ } else {
imgThumb.src = contentThumbnail; imgThumb.src = contentThumbnail;
} }
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail. } else {
// Check if user has read this content or not
} for ( var nIndex1 = 0; nIndex1 < readArr.length; nIndex1++) {
else{ if (readArr[nIndex1].contentid == contId) {
//Check if user has read this content or not imgThumb.onload = function() {
for (var nIndex1 = 0; nIndex1 < ClientData.ReadingContentIds().length; nIndex1++) {
if(ClientData.ReadingContentIds()[nIndex1].contentid == contId){
imgThumb.onload = function(){
var resizeImg = HISTORY.resizeResourceThumbnail(imgThumb, c.width, c.height); var resizeImg = HISTORY.resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, c.width/2 - resizeImg[0]/2, 0, resizeImg[0], resizeImg[1]); ctx.drawImage(imgThumb, c.width / 2 - resizeImg[0] / 2, 0, resizeImg[0], resizeImg[1]);
HISTORY.showContentThumbnail(contId); HISTORY.showContentThumbnail(contId);
}; };
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail. if (contentThumbnail == '' || contentThumbnail == null) {
if(contentThumbnail == '' || contentThumbnail == null){ if (!COMMON.isPdfContent(contentType)) {
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType); var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){ if (src != '') {
imgThumb.src = src; imgThumb.src = src;
} }
} }
}else{ } else {
imgThumb.src = contentThumbnail; imgThumb.src = contentThumbnail;
} }
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
readFlg = true; readFlg = true;
break; break;
} } else {
else{ // imgThumb.onload = function() {
imgThumb.onload = function(){ // var resizeImg = HISTORY.resizeResourceThumbnail(imgThumb, c.width, c.height);
// ctx.drawImage(imgThumb, c.width / 2 - resizeImg[0] / 2, 0, resizeImg[0], resizeImg[1]);
// HISTORY.showContentThumbnail(contId);
// imgIconNew.onload = function() {
// ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, 0);
// };
// imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
// };
// // Start Function : No.12 -- Editor : Le Long -- Date :
// // 07/31/2013 -- Summary : Check contentType to set thumbnail.
// if (contentThumbnail == '' || contentThumbnail == null) {
// if (!COMMON.isPdfContent(contentType)) {
// var src = HEADER.getThumbnailForOtherType(contentType);
// if (src != '') {
// imgThumb.src = src;
// }
// }
// } else {
// imgThumb.src = contentThumbnail;
// }
}
}
}
// Check if resource version has change
if (readFlg) {
if (versionArr == null || versionArr <= 0 || versionArr == 'undefined') {
} else {
for ( var nIndex2 = 0; nIndex2 < versionArr.length; nIndex2++) {
if (versionArr[nIndex2].contentid == contId) {
if (versionArr[nIndex2].resourceversion != resourceVer) {
imgThumb.onload = function() {
var resizeImg = HISTORY.resizeResourceThumbnail(imgThumb, c.width, c.height); var resizeImg = HISTORY.resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, c.width/2 - resizeImg[0]/2, 0, resizeImg[0], resizeImg[1]); ctx.drawImage(imgThumb, c.width / 2 - resizeImg[0] / 2, 0, resizeImg[0], resizeImg[1]);
HISTORY.showContentThumbnail(contId); HISTORY.showContentThumbnail(contId);
imgIconNew.onload = function(){ imgIconEdit.onload = function() {
ctx.drawImage(imgIconNew, c.width/2 - resizeImg[0]/2, 0); ctx.drawImage(imgIconEdit, c.width / 2 - resizeImg[0] / 2, 0);
}; };
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW; imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
}; };
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail. // Start Function : No.12 -- Editor : Le Long -- Date :
if(contentThumbnail == '' || contentThumbnail == null){ // 07/31/2013 -- Summary : Check contentType to set
if(!COMMON.isPdfContent(contentType)){ // thumbnail.
if (contentThumbnail == '' || contentThumbnail == null) {
if (!COMMON.isPdfContent(contentType)) {
var src = HEADER.getThumbnailForOtherType(contentType); var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){ if (src != '') {
imgThumb.src = src; imgThumb.src = src;
} }
} }
}else{ } else {
imgThumb.src = contentThumbnail; imgThumb.src = contentThumbnail;
} }
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail. // End Function : No.12 -- Editor : Le Long -- Date :
// 07/31/2013 -- Summary : Check contentType to set
// thumbnail.
break;
} }
} }
} }
//Check if resource version has change
if(readFlg){
if(versionArr == null || versionArr <= 0 || versionArr == 'undefined'){
} }
else{
for(var nIndex2 = 0; nIndex2 < versionArr.length; nIndex2++){ if (metaArr == null || metaArr <= 0 || metaArr == 'undefined') {
if(versionArr[nIndex2].contentid == contId){ } else {
if(versionArr[nIndex2].resourceversion != resourceVer){ for ( var nIndex2 = 0; nIndex2 < metaArr.length; nIndex2++) {
imgThumb.onload = function(){ if (metaArr[nIndex2].contentid == contId) {
if (metaArr[nIndex2].metaversion != metaVer) {
imgThumb.onload = function() {
var resizeImg = HISTORY.resizeResourceThumbnail(imgThumb, c.width, c.height); var resizeImg = HISTORY.resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, c.width/2 - resizeImg[0]/2, 0, resizeImg[0], resizeImg[1]); ctx.drawImage(imgThumb, c.width / 2 - resizeImg[0] / 2, 0, resizeImg[0], resizeImg[1]);
HISTORY.showContentThumbnail(contId); HISTORY.showContentThumbnail(contId);
imgIconEdit.onload = function(){ imgIconEdit.onload = function() {
ctx.drawImage(imgIconEdit, c.width/2 - resizeImg[0]/2, 0); ctx.drawImage(imgIconEdit, c.width / 2 - resizeImg[0] / 2, 0);
}; };
imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT; imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
}; };
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail. // Start Function : No.12 -- Editor : Le Long -- Date :
if(contentThumbnail == '' || contentThumbnail == null){ // 07/31/2013 -- Summary : Check contentType to set
if(!COMMON.isPdfContent(contentType)){ // thumbnail.
if (contentThumbnail == '' || contentThumbnail == null) {
if (!COMMON.isPdfContent(contentType)) {
var src = HEADER.getThumbnailForOtherType(contentType); var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){ if (src != '') {
imgThumb.src = src; imgThumb.src = src;
} }
} }
}else{ } else {
imgThumb.src = contentThumbnail; imgThumb.src = contentThumbnail;
} }
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail. // End Function : No.12 -- Editor : Le Long -- Date :
// 07/31/2013 -- Summary : Check contentType to set
// thumbnail.
break; break;
} }
} }
} }
} }
//readFlg = false;
} else {
if(metaArr == null || metaArr <= 0 || metaArr == 'undefined'){ imgThumb.onload = function() {
}
else{
for(var nIndex2 = 0; nIndex2 < metaArr.length; nIndex2++){
if(metaArr[nIndex2].contentid == contId){
if(metaArr[nIndex2].metaversion != metaVer){
imgThumb.onload = function(){
var resizeImg = HISTORY.resizeResourceThumbnail(imgThumb, c.width, c.height); var resizeImg = HISTORY.resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, c.width/2 - resizeImg[0]/2, 0, resizeImg[0], resizeImg[1]); ctx.drawImage(imgThumb, c.width / 2 - resizeImg[0] / 2, 0, resizeImg[0], resizeImg[1]);
HISTORY.showContentThumbnail(contId); HISTORY.showContentThumbnail(contId);
imgIconEdit.onload = function(){ imgIconNew.onload = function() {
ctx.drawImage(imgIconEdit, c.width/2 - resizeImg[0]/2, 0); ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, 0);
}; };
imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT; imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
}; };
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail. if (contentThumbnail == '' || contentThumbnail == null) {
if(contentThumbnail == '' || contentThumbnail == null){ if (!COMMON.isPdfContent(contentType)) {
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType); var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){ if (src != '') {
imgThumb.src = src; imgThumb.src = src;
} }
} }
}else{ } else {
imgThumb.src = contentThumbnail; imgThumb.src = contentThumbnail;
} }
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
break;
}
}
}
}
readFlg = false;
} }
}; };
//draw Edit Image // draw Edit Image
HISTORY.drawEditImage = function(id) { HISTORY.drawEditImage = function(id) {
var img = new Image(); var img = new Image();
var imgSrc = HISTORY.returnThumbnail(id); var imgSrc = HISTORY.returnThumbnail(id);
if(imgSrc != null){ if (imgSrc != null) {
} } else {
else{
var contentType = HISTORY.returnContentType(id); var contentType = HISTORY.returnContentType(id);
var src = HEADER.getThumbnailForOtherType(contentType); var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){ if (src != '') {
imgSrc = src; imgSrc = src;
} }
...@@ -947,13 +973,13 @@ HISTORY.drawEditImage = function(id) { ...@@ -947,13 +973,13 @@ HISTORY.drawEditImage = function(id) {
var c = document.getElementById('content-thumbnail' + id); var c = document.getElementById('content-thumbnail' + id);
//use getContext to use the canvas for drawing // use getContext to use the canvas for drawing
var ctx = c.getContext('2d'); var ctx = c.getContext('2d');
ctx.clearRect(0, 0, c.width, c.height); ctx.clearRect(0, 0, c.width, c.height);
img.onload = function () { img.onload = function() {
var resizeImg = HISTORY.resizeResourceThumbnail(img, c.width, c.height); var resizeImg = HISTORY.resizeResourceThumbnail(img, c.width, c.height);
ctx.drawImage(img, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]); ctx.drawImage(img, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]);
$("#loadingIcon" + id).fadeOut('slow', function () { $("#loadingIcon" + id).fadeOut('slow', function() {
$('#content-thumbnail' + id).fadeIn('slow'); $('#content-thumbnail' + id).fadeIn('slow');
}); });
}; };
...@@ -961,26 +987,26 @@ HISTORY.drawEditImage = function(id) { ...@@ -961,26 +987,26 @@ HISTORY.drawEditImage = function(id) {
img.src = imgSrc; img.src = imgSrc;
}; };
//Render User view date // Render User view date
HISTORY.renderViewDate = function(id){ HISTORY.renderViewDate = function(id, readingContentIds) {
for(var i = 0; i < ClientData.ReadingContentIds().length; i++){ for ( var i = 0; i < readingContentIds.length; i++) {
if(ClientData.ReadingContentIds()[i].contentid == id){ if (readingContentIds[i].contentid == id) {
return ClientData.ReadingContentIds()[i].viewdate; return readingContentIds[i].viewdate;
} }
} }
}; };
HISTORY.returnOriginalViewDate = function(id){ HISTORY.returnOriginalViewDate = function(id, readingContentIds) {
for(var i = 0; i < ClientData.ReadingContentIds().length; i++){ for ( var i = 0; i < readingContentIds.length; i++) {
if(ClientData.ReadingContentIds()[i].contentid == id){ if (readingContentIds[i].contentid == id) {
return ClientData.ReadingContentIds()[i].originviewdate; return readingContentIds[i].originviewdate;
} }
} }
}; };
//handle display sort direction // handle display sort direction
HISTORY.handleSortDisp = function(){ HISTORY.handleSortDisp = function() {
$('#control-sort-title').removeClass('active_tops'); $('#control-sort-title').removeClass('active_tops');
$('#control-sort-titlekana').removeClass('active_tops'); $('#control-sort-titlekana').removeClass('active_tops');
...@@ -990,36 +1016,32 @@ HISTORY.handleSortDisp = function(){ ...@@ -990,36 +1016,32 @@ HISTORY.handleSortDisp = function(){
var typeSort; var typeSort;
var orderSort; var orderSort;
if(ClientData.searchCond_sortType() == null || ClientData.searchCond_sortType() == 'undefined' || ClientData.searchCond_sortType() == ''){ if (ClientData.searchCond_sortType() == null || ClientData.searchCond_sortType() == 'undefined' || ClientData.searchCond_sortType() == '') {
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#rDate-sorttype').html(''); $('#rDate-sorttype').html('');
$('#vDate-sorttype').html(''); $('#vDate-sorttype').html('');
} } else {
else{ if (ClientData.searchCond_sortOrder() != null && ClientData.searchCond_sortOrder() != 'undefined' && ClientData.searchCond_sortType() != '') {
if(ClientData.searchCond_sortOrder() != null && ClientData.searchCond_sortOrder() != 'undefined' && ClientData.searchCond_sortType() != ''){
typeSort = ClientData.searchCond_sortType(); typeSort = ClientData.searchCond_sortType();
orderSort = ClientData.searchCond_sortOrder(); orderSort = ClientData.searchCond_sortOrder();
if(typeSort == 1){ if (typeSort == 1) {
HEADER.setStatusSort('#control-sort-title',orderSort == COMMON.Consts.ConstOrderSetting_Asc); HEADER.setStatusSort('#control-sort-title', orderSort == COMMON.Consts.ConstOrderSetting_Asc);
} } else if (typeSort == 2) {
else if(typeSort == 2){ HEADER.setStatusSort('#control-sort-titlekana', orderSort == COMMON.Consts.ConstOrderSetting_Asc);
HEADER.setStatusSort('#control-sort-titlekana',orderSort == COMMON.Consts.ConstOrderSetting_Asc); } else if (typeSort == 3) {
} HEADER.setStatusSort('#control-sort-releasedate', orderSort == COMMON.Consts.ConstOrderSetting_Asc);
else if(typeSort == 3){ } else {
HEADER.setStatusSort('#control-sort-releasedate',orderSort == COMMON.Consts.ConstOrderSetting_Asc); HEADER.setStatusSort('#control-sort-viewdate', orderSort == COMMON.Consts.ConstOrderSetting_Asc);
}
else{
HEADER.setStatusSort('#control-sort-viewdate',orderSort == COMMON.Consts.ConstOrderSetting_Asc);
} }
} }
} }
}; };
//function Open SubMenu Dialog // function Open SubMenu Dialog
HISTORY.titleClickFunction = function(e){ HISTORY.titleClickFunction = function(e) {
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
} }
...@@ -1034,77 +1056,78 @@ HISTORY.titleClickFunction = function(e){ ...@@ -1034,77 +1056,78 @@ HISTORY.titleClickFunction = function(e){
ClientData.contentInfo_contentThumbnail(base64String); ClientData.contentInfo_contentThumbnail(base64String);
ClientData.contentInfo_contentId(contentid); ClientData.contentInfo_contentId(contentid);
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType of content.
var contentType = HISTORY.returnContentType(contentid); var contentType = HISTORY.returnContentType(contentid);
ClientData.contentInfo_contentType(contentType); ClientData.contentInfo_contentType(contentType);
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType of content.
//Store Content id that user has read var checkflag = false;
if(ClientData.ReadingContentIds().length > 0){
HISTORY.contentIdArray = ClientData.ReadingContentIds(); HISTORY.contentIdArray = ClientData.ReadingContentIds();
if (HISTORY.contentIdArray.length > 0) {
for(var nIndex = 0; nIndex < HISTORY.contentIdArray.length; nIndex++){ for ( var nIndex = 0; nIndex < HISTORY.contentIdArray.length; nIndex++) {
if(HISTORY.contentIdArray[nIndex].contentid == contentid){ if (HISTORY.contentIdArray[nIndex].contentid == contentid) {
checkflag = true; checkflag = true;
break; break;
} }
else{
checkflag = false;
}
} }
if(!checkflag){ if (!checkflag) {
HISTORY.contentIdArray.push({contentid: contentid, viewdate: '', originviewdate: ''}); HISTORY.contentIdArray.push({
} contentid : contentid,
viewdate : '',
originviewdate : ''
});
} }
else{ } else {
HISTORY.contentIdArray.push({contentid: contentid, viewdate: '', originviewdate: ''}); HISTORY.contentIdArray.push({
contentid : contentid,
viewdate : '',
originviewdate : ''
});
} }
//Renew ReadingContentID // Renew ReadingContentID
var newArray = []; var newArray = [];
ClientData.ReadingContentIds(newArray); ClientData.ReadingContentIds(newArray);
//Set data for readingcontentid // Set data for readingcontentid
ClientData.ReadingContentIds(HISTORY.contentIdArray); ClientData.ReadingContentIds(HISTORY.contentIdArray);
//Set ResouceVersion for content // Set ResouceVersion for content
COMMON.setResourceVersionData(contentid); COMMON.setResourceVersionData(contentid);
//Set MetaVersion for content // Set MetaVersion for content
COMMON.setMetaVersionData(contentid); COMMON.setMetaVersionData(contentid);
//Delete 'new' icon // Delete 'new' icon
HISTORY.drawEditImage(contentid); HISTORY.drawEditImage(contentid);
//Open content Detail // Open content Detail
DETAIL.openContentDetail(); DETAIL.openContentDetail();
}; };
//refresh sort order // refresh sort order
//HISTORY.refreshSortTypeOrder = function(){ // HISTORY.refreshSortTypeOrder = function(){
// $('#title-sorttype').html(''); // $('#title-sorttype').html('');
// $('#titlekana-sorttype').html(''); // $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html(''); // $('#rDate-sorttype').html('');
// $('#rDate-sorttype').html(''); // $('#rDate-sorttype').html('');
// $('#vDate-sorttype').html(''); // $('#vDate-sorttype').html('');
//}; // };
//refresh GridView // refresh GridView
HISTORY.refreshGrid = function(){ HISTORY.refreshGrid = function() {
//$('#content-grid').html(''); // $('#content-grid').html('');
$('#content-grid').empty(); $('#content-grid').empty();
$('.pageNumControl').css('visibility','hidden'); $('.pageNumControl').css('visibility', 'hidden');
}; };
HISTORY.sortByViewDateAsc = function(){ HISTORY.sortByViewDateAsc = function() {
var sortArr = HISTORY.contentViewData; var sortArr = HISTORY.contentViewData;
var t; var t;
for(var i = 0; i < sortArr.length; i++){ for ( var i = 0; i < sortArr.length; i++) {
for(var j = 1; j < sortArr.length - i; j++){ for ( var j = 1; j < sortArr.length - i; j++) {
if(sortArr[j-1].originviewdate > sortArr[j].originviewdate){ if (sortArr[j - 1].originviewdate > sortArr[j].originviewdate) {
t = sortArr[j-1]; t = sortArr[j - 1];
sortArr[j-1] = sortArr[j]; sortArr[j - 1] = sortArr[j];
sortArr[j] = t; sortArr[j] = t;
} }
} }
...@@ -1114,7 +1137,7 @@ HISTORY.sortByViewDateAsc = function(){ ...@@ -1114,7 +1137,7 @@ HISTORY.sortByViewDateAsc = function(){
HISTORY.renderContentAfterSort(resultArr); HISTORY.renderContentAfterSort(resultArr);
}; };
HISTORY.formatDate = function(originDate){ HISTORY.formatDate = function(originDate) {
var sourceDate = new Date(originDate); var sourceDate = new Date(originDate);
var year = sourceDate.getFullYear() + 1; var year = sourceDate.getFullYear() + 1;
var month = sourceDate.getMonth(); var month = sourceDate.getMonth();
...@@ -1128,16 +1151,14 @@ HISTORY.formatDate = function(originDate){ ...@@ -1128,16 +1151,14 @@ HISTORY.formatDate = function(originDate){
return newDate; return newDate;
}; };
HISTORY.sortByViewDateDesc = function(){ HISTORY.sortByViewDateDesc = function() {
//console.log("HISTORY.sortByViewDateDesc");
var sortArr = HISTORY.contentViewData; var sortArr = HISTORY.contentViewData;
var temp; var temp;
for(var i = 0; i < sortArr.length; i++){ for ( var i = 0; i < sortArr.length; i++) {
for(var j = sortArr.length - 1; j > i; j--){ for ( var j = sortArr.length - 1; j > i; j--) {
if(sortArr[j].originviewdate > sortArr[j - 1].originviewdate){ if (sortArr[j].originviewdate > sortArr[j - 1].originviewdate) {
temp = sortArr[j]; temp = sortArr[j];
sortArr[j] = sortArr[j - 1]; sortArr[j] = sortArr[j - 1];
sortArr[j - 1] = temp; sortArr[j - 1] = temp;
...@@ -1149,41 +1170,64 @@ HISTORY.sortByViewDateDesc = function(){ ...@@ -1149,41 +1170,64 @@ HISTORY.sortByViewDateDesc = function(){
HISTORY.renderContentAfterSort(resultArr); HISTORY.renderContentAfterSort(resultArr);
}; };
HISTORY.addReadContentToArray = function(strContentId, strResourceVersion, strMetaVersion, strThumbnail, strTitle, strTitleKana, strDelivDate,contentType, readerShare, download){ HISTORY.addReadContentToArray = function(strContentId, strResourceVersion, strMetaVersion, strThumbnail, strTitle, strTitleKana, strDelivDate, contentType, readerShare, download, originalViewDate ) {
if (HISTORY.contentViewData.length > 0) { if (HISTORY.contentViewData.length > 0) {
var flag; var flag;
for(var j = 0; j < HISTORY.contentViewData.length; j++){ for ( var j = 0; j < HISTORY.contentViewData.length; j++) {
if(HISTORY.contentViewData[j].contentid == strContentId){ if (HISTORY.contentViewData[j].contentid == strContentId) {
flag = true; flag = true;
break; break;
} } else {
else{
flag = false; flag = false;
} }
} }
if(!flag){ if (!flag) {
HISTORY.contentViewData.push({contentid: strContentId, originviewdate: HISTORY.formatDate(HISTORY.returnOriginalViewDate(strContentId)), contenttitle: strTitle, contenttitlekana: strTitleKana, deliverydate: strDelivDate, resourceversion: strResourceVersion, metaversion: strMetaVersion, thumbnail: COMMON.formatStringBase64(strThumbnail),contenttype:contentType, readerShare:readerShare, download:download }); HISTORY.contentViewData.push({
contentid : strContentId,
originviewdate : originalViewDate,
contenttitle : strTitle,
contenttitlekana : strTitleKana,
deliverydate : strDelivDate,
resourceversion : strResourceVersion,
metaversion : strMetaVersion,
thumbnail : COMMON.formatStringBase64(strThumbnail),
contenttype : contentType,
readerShare : readerShare,
download : download
});
} }
}else{ } else {
HISTORY.contentViewData.push({contentid: strContentId, originviewdate: HISTORY.formatDate(HISTORY.returnOriginalViewDate(strContentId)), contenttitle: strTitle, contenttitlekana: strTitleKana, deliverydate: strDelivDate, resourceversion: strResourceVersion, metaversion: strMetaVersion, thumbnail: COMMON.formatStringBase64(strThumbnail),contenttype:contentType, readerShare:readerShare, download:download }); HISTORY.contentViewData.push({
contentid : strContentId,
originviewdate : originalViewDate,
contenttitle : strTitle,
contenttitlekana : strTitleKana,
deliverydate : strDelivDate,
resourceversion : strResourceVersion,
metaversion : strMetaVersion,
thumbnail : COMMON.formatStringBase64(strThumbnail),
contenttype : contentType,
readerShare : readerShare,
download : download
});
} }
}; };
HISTORY.showContentThumbnail = function(conid) { HISTORY.showContentThumbnail = function(conid) {
$('img#imgloading'+conid).fadeOut('slow',function(){ $('img#imgloading' + conid).fadeOut('slow', function() {
$('canvas#content-thumbnail'+conid).fadeIn('slow'); $('canvas#content-thumbnail' + conid).fadeIn('slow');
}); });
}; };
HISTORY.syncReadingContent = function(){ HISTORY.syncReadingContent = function() {
var readArr = ClientData.ReadingContentIds(); var readArr = ClientData.ReadingContentIds();
var metaArr = ClientData.MetaVersion(); var metaArr = ClientData.MetaVersion();
var resourceArr = ClientData.ResourceVersion(); var resourceArr = ClientData.ResourceVersion();
for (var i = readArr.length - 1; i >= 0; i--) { for ( var i = readArr.length - 1; i >= 0; i--) {
var readContent = readArr[i]; var readContent = readArr[i];
if (!HISTORY.IsExistContent(readContent.contentid)) { if (!HISTORY.IsExistContent(readContent.contentid)) {
...@@ -1203,11 +1247,11 @@ HISTORY.syncReadingContent = function(){ ...@@ -1203,11 +1247,11 @@ HISTORY.syncReadingContent = function(){
}; };
/* /*
Get content title kana if it existed * Get content title kana if it existed
*/ */
HISTORY.getContentNameKana = function(strContentId) { HISTORY.getContentNameKana = function(strContentId) {
var strContentNameKana = null; var strContentNameKana = null;
for (var nIndex = 0; nIndex < HISTORY.history_contentTitleKana.length; nIndex++) { for ( var nIndex = 0; nIndex < HISTORY.history_contentTitleKana.length; nIndex++) {
if (HISTORY.history_contentTitleKana[nIndex].contentId == strContentId) { if (HISTORY.history_contentTitleKana[nIndex].contentId == strContentId) {
strContentNameKana = HISTORY.history_contentTitleKana[nIndex].contentNameKana; strContentNameKana = HISTORY.history_contentTitleKana[nIndex].contentNameKana;
break; break;
...@@ -1217,67 +1261,69 @@ HISTORY.getContentNameKana = function(strContentId) { ...@@ -1217,67 +1261,69 @@ HISTORY.getContentNameKana = function(strContentId) {
}; };
/* /*
Check content whether existed or not * Check content whether existed or not
*/ */
HISTORY.IsExistContent = function(strContentId) { HISTORY.IsExistContent = function(strContentId) {
if( strContentId == null || strContentId == "" ){ if (strContentId == null || strContentId == "") {
return false; return false;
} }
var isExisted = true; var isExisted = true;
var params = { var params = {
sid: ClientData.userInfo_sid(), sid : ClientData.userInfo_sid(),
getType: '1', getType : '1',
contentId: strContentId, contentId : strContentId,
authCode: "0" authCode : "0"
}; };
AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", 'GET', params, AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", 'GET', params, function(data) {
function (data) {
isExisted = true; isExisted = true;
HISTORY.history_contentTitleKana.push({ contentId: strContentId, contentNameKana: data.contentData.contentNameKana }); HISTORY.history_contentTitleKana.push({
}, contentId : strContentId,
function (xmlHttpRequest, txtStatus, errorThrown) { contentNameKana : data.contentData.contentNameKana
});
}, function(xmlHttpRequest, txtStatus, errorThrown) {
if (xmlHttpRequest.status == 404) { if (xmlHttpRequest.status == 404) {
isExisted = false; isExisted = false;
} } else {
else {
// Show system error // Show system error
isExisted = true; // Mark this flag to prevent bookmarks from deleting isExisted = true; // Mark this flag to prevent bookmarks from
// deleting
AVWEB.showSystemError(); AVWEB.showSystemError();
} }
}); });
return isExisted; return isExisted;
}; };
//HISTORY.changeLanguageCallBackFunction = function(){ // HISTORY.changeLanguageCallBackFunction = function(){
// HISTORY.handleLanguage(); // HISTORY.handleLanguage();
// document.title = I18N.i18nText('dspViewHistory') + ' | ' + I18N.i18nText('sysAppTitle'); // document.title = I18N.i18nText('dspViewHistory') + ' | ' +
//}; // I18N.i18nText('sysAppTitle');
// };
HISTORY.displayResultNoRecord = function(){ HISTORY.displayResultNoRecord = function() {
I18N.i18nReplaceText(); I18N.i18nReplaceText();
$('#content-grid').html("<div id='msgHistoryNotExist'>" + I18N.i18nText('msgHistoryNotExist') + "</div>"); $('#content-grid').html("<div id='msgHistoryNotExist'>" + I18N.i18nText('msgHistoryNotExist') + "</div>");
$('#control-nextrecord').css('visibility','hidden'); $('#control-nextrecord').css('visibility', 'hidden');
$('.control_sort_on').hide(); $('.control_sort_on').hide();
$('.control_sort_off').show(); $('.control_sort_off').show();
$('#off-default').addClass('descending_sort'); $('#off-default').addClass('descending_sort');
}; };
//HISTORY.enableSort = function(){ // HISTORY.enableSort = function(){
// $('.control_sort_on').show(); // $('.control_sort_on').show();
// $('.control_sort_off').hide(); // $('.control_sort_off').hide();
//}; // };
HISTORY.sortByTitleAsc = function(){ HISTORY.sortByTitleAsc = function() {
var sortArr = HISTORY.contentViewData; var sortArr = HISTORY.contentViewData;
var t; var t;
for(var i = 0; i < sortArr.length; i++){ for ( var i = 0; i < sortArr.length; i++) {
for(var j = 1; j < sortArr.length - i; j++){ for ( var j = 1; j < sortArr.length - i; j++) {
if(sortArr[j-1].contenttitle.toUpperCase() > sortArr[j].contenttitle.toUpperCase()){ if (sortArr[j - 1].contenttitle.toUpperCase() > sortArr[j].contenttitle.toUpperCase()) {
t = sortArr[j-1]; t = sortArr[j - 1];
sortArr[j-1] = sortArr[j]; sortArr[j - 1] = sortArr[j];
sortArr[j] = t; sortArr[j] = t;
} }
} }
...@@ -1287,12 +1333,12 @@ HISTORY.sortByTitleAsc = function(){ ...@@ -1287,12 +1333,12 @@ HISTORY.sortByTitleAsc = function(){
HISTORY.renderContentAfterSort(resultArr); HISTORY.renderContentAfterSort(resultArr);
}; };
HISTORY.sortByTitleDesc = function(){ HISTORY.sortByTitleDesc = function() {
var sortArr = HISTORY.contentViewData; var sortArr = HISTORY.contentViewData;
var temp; var temp;
for(var i = 0; i < sortArr.length; i++){ for ( var i = 0; i < sortArr.length; i++) {
for(var j = sortArr.length - 1; j > i; j--){ for ( var j = sortArr.length - 1; j > i; j--) {
if(sortArr[j].contenttitle.toUpperCase() > sortArr[j - 1].contenttitle.toUpperCase()){ if (sortArr[j].contenttitle.toUpperCase() > sortArr[j - 1].contenttitle.toUpperCase()) {
temp = sortArr[j]; temp = sortArr[j];
sortArr[j] = sortArr[j - 1]; sortArr[j] = sortArr[j - 1];
sortArr[j - 1] = temp; sortArr[j - 1] = temp;
...@@ -1304,15 +1350,15 @@ HISTORY.sortByTitleDesc = function(){ ...@@ -1304,15 +1350,15 @@ HISTORY.sortByTitleDesc = function(){
HISTORY.renderContentAfterSort(resultArr); HISTORY.renderContentAfterSort(resultArr);
}; };
HISTORY.sortByPublishDateAsc = function(){ HISTORY.sortByPublishDateAsc = function() {
var sortArr = HISTORY.contentViewData; var sortArr = HISTORY.contentViewData;
var t; var t;
for(var i = 0; i < sortArr.length; i++){ for ( var i = 0; i < sortArr.length; i++) {
for(var j = 1; j < sortArr.length - i; j++){ for ( var j = 1; j < sortArr.length - i; j++) {
if(HISTORY.formatOriginalPublishDate(sortArr[j-1].deliverydate) > HISTORY.formatOriginalPublishDate(sortArr[j].deliverydate)){ if (HISTORY.formatOriginalPublishDate(sortArr[j - 1].deliverydate) > HISTORY.formatOriginalPublishDate(sortArr[j].deliverydate)) {
t = sortArr[j-1]; t = sortArr[j - 1];
sortArr[j-1] = sortArr[j]; sortArr[j - 1] = sortArr[j];
sortArr[j] = t; sortArr[j] = t;
} }
} }
...@@ -1322,12 +1368,12 @@ HISTORY.sortByPublishDateAsc = function(){ ...@@ -1322,12 +1368,12 @@ HISTORY.sortByPublishDateAsc = function(){
HISTORY.renderContentAfterSort(resultArr); HISTORY.renderContentAfterSort(resultArr);
}; };
HISTORY.sortByPublishDateDesc = function(){ HISTORY.sortByPublishDateDesc = function() {
var sortArr = HISTORY.contentViewData; var sortArr = HISTORY.contentViewData;
var temp; var temp;
for(var i = 0; i < sortArr.length; i++){ for ( var i = 0; i < sortArr.length; i++) {
for(var j = sortArr.length - 1; j > i; j--){ for ( var j = sortArr.length - 1; j > i; j--) {
if(HISTORY.formatOriginalPublishDate(sortArr[j].deliverydate) > HISTORY.formatOriginalPublishDate(sortArr[j - 1].deliverydate)){ if (HISTORY.formatOriginalPublishDate(sortArr[j].deliverydate) > HISTORY.formatOriginalPublishDate(sortArr[j - 1].deliverydate)) {
temp = sortArr[j]; temp = sortArr[j];
sortArr[j] = sortArr[j - 1]; sortArr[j] = sortArr[j - 1];
sortArr[j - 1] = temp; sortArr[j - 1] = temp;
...@@ -1339,14 +1385,14 @@ HISTORY.sortByPublishDateDesc = function(){ ...@@ -1339,14 +1385,14 @@ HISTORY.sortByPublishDateDesc = function(){
HISTORY.renderContentAfterSort(resultArr); HISTORY.renderContentAfterSort(resultArr);
}; };
HISTORY.sortByTitleKanaAsc = function(){ HISTORY.sortByTitleKanaAsc = function() {
var sortArr = HISTORY.contentViewData; var sortArr = HISTORY.contentViewData;
var t; var t;
for(var i = 0; i < sortArr.length; i++){ for ( var i = 0; i < sortArr.length; i++) {
for(var j = 1; j < sortArr.length - i; j++){ for ( var j = 1; j < sortArr.length - i; j++) {
if(sortArr[j-1].contenttitlekana > sortArr[j].contenttitlekana){ if (sortArr[j - 1].contenttitlekana > sortArr[j].contenttitlekana) {
t = sortArr[j-1]; t = sortArr[j - 1];
sortArr[j-1] = sortArr[j]; sortArr[j - 1] = sortArr[j];
sortArr[j] = t; sortArr[j] = t;
} }
} }
...@@ -1356,12 +1402,12 @@ HISTORY.sortByTitleKanaAsc = function(){ ...@@ -1356,12 +1402,12 @@ HISTORY.sortByTitleKanaAsc = function(){
HISTORY.renderContentAfterSort(resultArr); HISTORY.renderContentAfterSort(resultArr);
}; };
HISTORY.sortByTitleKanaDesc = function(){ HISTORY.sortByTitleKanaDesc = function() {
var sortArr = HISTORY.contentViewData; var sortArr = HISTORY.contentViewData;
var temp; var temp;
for(var i = 0; i < sortArr.length; i++){ for ( var i = 0; i < sortArr.length; i++) {
for(var j = sortArr.length - 1; j > i; j--){ for ( var j = sortArr.length - 1; j > i; j--) {
if(sortArr[j].contenttitlekana > sortArr[j - 1].contenttitlekana){ if (sortArr[j].contenttitlekana > sortArr[j - 1].contenttitlekana) {
temp = sortArr[j]; temp = sortArr[j];
sortArr[j] = sortArr[j - 1]; sortArr[j] = sortArr[j - 1];
sortArr[j - 1] = temp; sortArr[j - 1] = temp;
...@@ -1373,14 +1419,18 @@ HISTORY.sortByTitleKanaDesc = function(){ ...@@ -1373,14 +1419,18 @@ HISTORY.sortByTitleKanaDesc = function(){
HISTORY.renderContentAfterSort(resultArr); HISTORY.renderContentAfterSort(resultArr);
}; };
HISTORY.renderContentAfterSort = function(contentSortArr) {
HISTORY.renderContentAfterSort = function(contentSortArr){ // console.log("HISTORY.renderContentAfterSort");
//console.log("HISTORY.renderContentAfterSort");
HISTORY.refreshGrid(); HISTORY.refreshGrid();
//var htmlTemp = "";
for(var i = 0; i < contentSortArr.length; i++) { var versionArr = ClientData.ResourceVersion();
var metaArr = ClientData.MetaVersion();
var readArr = ClientData.ReadingContentIds();
// var htmlTemp = "";
for ( var i = 0; i < contentSortArr.length; i++) {
post = contentSortArr[i]; post = contentSortArr[i];
var outputDeliveryDate = COMMON.formatDeliveryDate(post.deliverydate); var outputDeliveryDate = COMMON.formatDeliveryDate(post.deliverydate);
...@@ -1394,18 +1444,17 @@ HISTORY.renderContentAfterSort = function(contentSortArr){ ...@@ -1394,18 +1444,17 @@ HISTORY.renderContentAfterSort = function(contentSortArr){
+ ' </a>' + ' </a>'
+ ' <div class="text">' + ' <div class="text">'
+ ' <a id="title' + post.contentid + '" class="name dialog" contentid="' + post.contentid + '">' + ' <a id="title' + post.contentid + '" class="name dialog" contentid="' + post.contentid + '">'
+ ' <img class="listIcon" src="' + HEADER.getIconTypeContent(post.contenttype)+'" width="20" height="20">' + ' <img class="listIcon" src="' + HEADER.getIconTypeContent(post.contenttype) + '" width="20" height="20">' + COMMON.truncate(COMMON.htmlEncode(post.contenttitle), 20)
+ COMMON.truncate(COMMON.htmlEncode(post.contenttitle), 20)
+ ' </a>' + ' </a>'
+ ' <div class="info">' + ' <div class="info">'
+ ' <ul class="date">' + ' <ul class="date">'
+ ' <li><span class="lang" lang="txtPubDt">'+I18N.i18nText("txtPubDt")+'</span> : ' + outputDeliveryDate + '</li>' + ' <li><span class="lang" lang="txtPubDt">' + I18N.i18nText("txtPubDt") + '</span> : ' + outputDeliveryDate + '</li>'
+ ' <li><span class="lang" lang="txtViewDt">'+I18N.i18nText("txtViewDt")+'</span>:<span id="lblVdate' + post.contentid + '"> </span></li>' + ' <li><span class="lang" lang="txtViewDt">' + I18N.i18nText("txtViewDt") + '</span>:<span id="lblVdate' + post.contentid + '"> </span></li>'
+ ' </ul>' + ' </ul>'
+ ' <ul class="pic">' + ' <ul class="pic">'
+ ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MEMO + '" id="imgMemo' + post.contentid + '" class="sticker" /></li>' + ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MEMO + '" id="imgMemo' + post.contentid + '" class="sticker" /></li>'
+ ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MARKING + '" id="imgBookMark' + post.contentid + '" class="pen" /></li>' + ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MARKING + '" id="imgBookMark' + post.contentid + '" class="pen" /></li>'
+ ' <li><ul class="iconList">{share}{download}<li><a class="read lang button-details" contentid="' + post.contentid + '" lang="txtRead">'+I18N.i18nText("txtRead")+'</a></li></ul></li>' + ' <li><ul class="iconList">{share}{download}<li><a class="read lang button-details" contentid="' + post.contentid + '" lang="txtRead">' + I18N.i18nText("txtRead") + '</a></li></ul></li>'
+ ' </ul>' + ' </ul>'
+ ' </div>' + ' </div>'
+ ' </div>' + ' </div>'
...@@ -1413,43 +1462,48 @@ HISTORY.renderContentAfterSort = function(contentSortArr){ ...@@ -1413,43 +1462,48 @@ HISTORY.renderContentAfterSort = function(contentSortArr){
+ '</section>'; + '</section>';
var shareHtml = ""; var shareHtml = "";
if( post.readerShare == '1' ){ if (post.readerShare == '1') {
shareHtml ='<li><a class="read lang button-share" contentid="' + post.contentid + '" lang="txtShare">'+I18N.i18nText("txtShare")+'</a></li>'; shareHtml = '<li><a class="read lang button-share" contentid="' + post.contentid + '" lang="txtShare">' + I18N.i18nText("txtShare") + '</a></li>';
} }
htmlTemp = htmlTemp.replace(/\{share\}/g, shareHtml); htmlTemp = htmlTemp.replace(/\{share\}/g, shareHtml);
//ダイハツ対応 // ダイハツ対応
//console.log("post.download2:" + post.download); // console.log("post.download2:" + post.download);
var downloadHtml = ""; var downloadHtml = "";
if( post.download == '1' ){ if (post.download == '1') {
downloadHtml ='<li><a class="read button-download" contentid="' + post.contentid + '" >ダウンロード</a></li>'; downloadHtml = '<li><a class="read button-download" contentid="' + post.contentid + '" >ダウンロード</a></li>';
} }
htmlTemp = htmlTemp.replace(/\{download\}/g, downloadHtml); htmlTemp = htmlTemp.replace(/\{download\}/g, downloadHtml);
$('#content-grid').append(htmlTemp); $('#content-grid').append(htmlTemp);
} var viewdate = HISTORY.renderViewDate(post.contentid, readArr);
$('#lblVdate' + post.contentid).html(viewdate);
for (var i = 0; i < contentSortArr.length; i++) {
post = contentSortArr[i];
var viewdate = HISTORY.renderViewDate(post.contentid);
HISTORY.reRenderPageNumber(HISTORY.totalPage, HISTORY.totalPage);
//Check if user has read this content or not.
HISTORY.checkUserHasReadContent(post.contentid, post.resourceversion, post.metaversion);
//Check if content has marking or memo // Check if user has read this content or not.
HISTORY.checkUserHasReadContent(post.contentid, post.resourceversion, post.metaversion, versionArr, metaArr, readArr);
// Check if content has marking or memo
HISTORY.checkContentMarkingMemoOption(post.contentid); HISTORY.checkContentMarkingMemoOption(post.contentid);
$('#lblVdate' + post.contentid).html(viewdate); }
HISTORY.showContentThumbnail(); // for ( var i = 0; i < contentSortArr.length; i++) {
// post = contentSortArr[i];
// var viewdate = HISTORY.renderViewDate(post.contentid, readArr);
// HISTORY.reRenderPageNumber(HISTORY.totalPage, HISTORY.totalPage);
// // Check if user has read this content or not.
// HISTORY.checkUserHasReadContent(post.contentid, post.resourceversion, post.metaversion, versionArr, metaArr, readArr);
// // Check if content has marking or memo
// HISTORY.checkContentMarkingMemoOption(post.contentid);
// $('#lblVdate' + post.contentid).html(viewdate);
// HISTORY.showContentThumbnail();
// }
HISTORY.reRenderPageNumber(HISTORY.totalPage, HISTORY.totalPage);
}
}; };
HISTORY.formatOriginalPublishDate = function(date){ HISTORY.formatOriginalPublishDate = function(date) {
var day = date.date; var day = date.date;
var month = date.month + 1; var month = date.month + 1;
...@@ -1462,51 +1516,48 @@ HISTORY.formatOriginalPublishDate = function(date){ ...@@ -1462,51 +1516,48 @@ HISTORY.formatOriginalPublishDate = function(date){
return resultDate; return resultDate;
}; };
HISTORY.returnContentTitleKana = function(id) { //HISTORY.returnContentTitleKana = function(id) {
var titleKana; // var titleKana;
//
// Get title kana from existed contents // // Get title kana from existed contents
titleKana = HISTORY.getContentNameKana(id); // titleKana = HISTORY.getContentNameKana(id);
//
if (titleKana != null) { // if (titleKana != null) {
// Skip this case // // Skip this case
} // } else {
else { // var params = {
var params = { // contentId : id,
contentId: id, // sid : ClientData.userInfo_sid(),
sid: ClientData.userInfo_sid(), // getType : 1,
getType: 1, // authCode : ClientData.authCode()
authCode: ClientData.authCode() // };
}; //
// // Get all pages of content
// AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", 'GET', params, function(data) {
// Get all pages of content // // Success
AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", 'GET', params, // titleKana = data.contentData.contentNameKana;
function (data) { // }, null);
// Success //
titleKana = data.contentData.contentNameKana; // }
}, null); // return titleKana;
//};
}
return titleKana;
};
HISTORY.resizeResourceThumbnail = function(mg, width, height) { HISTORY.resizeResourceThumbnail = function(mg, width, height) {
var newWidth; var newWidth;
var newHeight; var newHeight;
var delta=Math.min(width/mg.width,height/mg.height); var delta = Math.min(width / mg.width, height / mg.height);
newHeight=parseInt(delta*mg.height); newHeight = parseInt(delta * mg.height);
newWidth=parseInt(delta*mg.width); newWidth = parseInt(delta * mg.width);
var result = [newWidth, newHeight]; var result = [ newWidth, newHeight ];
return result; return result;
}; };
HISTORY.removeHoverCss = function(){ HISTORY.removeHoverCss = function() {
if(COMMON.isTouchDevice()){ if (COMMON.isTouchDevice()) {
$('#control-sort-title').removeClass('nottouchdevice'); $('#control-sort-title').removeClass('nottouchdevice');
$('#control-sort-titlekana').removeClass('nottouchdevice'); $('#control-sort-titlekana').removeClass('nottouchdevice');
$('#control-sort-releasedate').removeClass('nottouchdevice'); $('#control-sort-releasedate').removeClass('nottouchdevice');
...@@ -1514,7 +1565,7 @@ HISTORY.removeHoverCss = function(){ ...@@ -1514,7 +1565,7 @@ HISTORY.removeHoverCss = function(){
} }
}; };
//Dialog Read Button CLick // Dialog Read Button CLick
HISTORY.showContentShareDlgFunction = function(e) { HISTORY.showContentShareDlgFunction = function(e) {
if (e) { if (e) {
...@@ -1528,38 +1579,34 @@ HISTORY.showContentShareDlgFunction = function(e) { ...@@ -1528,38 +1579,34 @@ HISTORY.showContentShareDlgFunction = function(e) {
var contentId = $(this).attr('contentid'); var contentId = $(this).attr('contentid');
// check limit of content // check limit of content
LIMIT_ACCESS_CONTENT.checkLimitContent(contentId, LIMIT_ACCESS_CONTENT.checkLimitContent(contentId, function() {
function()
{
SHARE.contentId = contentId; SHARE.contentId = contentId;
SHARE.contentTitle = ""; SHARE.contentTitle = "";
SHARE.openContentShare(); SHARE.openContentShare();
}, }, function() {
function(){ // console.log("checkLimitContent_bbb");
//console.log("checkLimitContent_bbb"); });
}
);
}; };
HISTORY.showContentView = function(){ HISTORY.showContentView = function() {
var y = 0; var y = 0;
if( document.documentElement.scrollTop ){ if (document.documentElement.scrollTop) {
y = document.documentElement.scrollTop; y = document.documentElement.scrollTop;
} }
if( document.body.scrollTop ){ if (document.body.scrollTop) {
if( y == undefined || y == 0){ if (y == undefined || y == 0) {
y = document.body.scrollTop; y = document.body.scrollTop;
} }
} }
if( y == undefined || y == null){ if (y == undefined || y == null) {
y = 0; y = 0;
} }
//console.log("scrollTop:" + y); // console.log("scrollTop:" + y);
HISTORY.scrollTop = y; HISTORY.scrollTop = y;
window.scrollTo(0,0); window.scrollTo(0, 0);
$("#header-ws").hide(); $("#header-ws").hide();
$("#ws-body").hide(); $("#ws-body").hide();
...@@ -1573,24 +1620,24 @@ HISTORY.showContentView = function(){ ...@@ -1573,24 +1620,24 @@ HISTORY.showContentView = function(){
}; };
HISTORY.cssInit = function(){ HISTORY.cssInit = function() {
$('html').css({ $('html').css({
'overflow-y':'scroll' 'overflow-y' : 'scroll'
}); });
$('html,body').css({ $('html,body').css({
'height':'100%', 'height' : '100%',
'margin': '0', 'margin' : '0',
'padding': '0' 'padding' : '0'
}); });
$('html>body').css({ $('html>body').css({
'font-size':'16px', 'font-size' : '16px',
'font-size':'68.75%' 'font-size' : '68.75%'
}); });
$('body').css({ $('body').css({
'font-family':'Verdana, helvetica, arial, sans-serif', 'font-family' : 'Verdana, helvetica, arial, sans-serif',
'font-size':'68.75%', 'font-size' : '68.75%',
'background':'#fff', 'background' : '#fff',
'color':'#333' 'color' : '#333'
}); });
}; };
...@@ -1600,10 +1647,7 @@ HISTORY.downloadFunction = function(e) { ...@@ -1600,10 +1647,7 @@ HISTORY.downloadFunction = function(e) {
} }
var contentId = $(this).attr('contentid'); var contentId = $(this).attr('contentid');
//Download content // Download content
HEADER.downloadResourceById(contentId); HEADER.downloadResourceById(contentId);
}; };
This source diff could not be displayed because it is too large. You can view the blob instead.
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