Commit e5f32add by Masaru Abe

変更なし

parent f697fe2e
{ {
"sysErrorCallApi01":"システムエラーが発生しました。<br />ご利用のブラウザを開き直して、再度ログイン頂くか、時間をおいてアクセスしてください。", "sysErrorCallApi01":"システムエラーが発生しました。<br />ご利用のブラウザを開き直して、再度ログイン頂くか、時間をおいてアクセスしてください。",
"sysInfoScrLock01":"長時間操作されなかったため、画面をロックしています。<br />画面をクリックしてロックを解除してください。", "sysInfoScrLock01":"長時間操作されなかったため、画面をロックしています。<br />画面をクリックしてロックを解除してください。",
"sysInfoWithoutLogout":"ログアウトせずに終了しようとしています。\n※【注意】ログアウトを行わないと一定時間利用がロックされてしまいます。", "sysInfoWithoutLogout":"ログアウトせずに終了しようとしています。\n※【注意】ログアウトを行わないと一定時間利用がロックされてしまいます。",
"txtUsrCap":"ユーザ情報", "txtUsrCap":"ユーザ情報",
"txtLastLoginTime":"最終ログイン時間:", "txtLastLoginTime":"最終ログイン時間:",
"txtOpt":"オプション", "txtOpt":"オプション",
"txtOpt001":"初期表示", "txtOpt001":"初期表示",
"txtHondana":"本棚", "txtHondana":"本棚",
"txtList":"リスト", "txtList":"リスト",
"txtOpt002":"動画・音楽を繰り返し再生する", "txtOpt002":"動画・音楽を繰り返し再生する",
"txtOpt003":"マーキング", "txtOpt003":"マーキング",
"dspOptReset":"初期設定に戻る", "dspOptReset":"初期設定に戻る",
"txtBkResCap":"サーバにバックアップ/リストア", "txtBkResCap":"サーバにバックアップ/リストア",
"txtOptBkCfm":"ログアウト時に、バックアップを確認する", "txtOptBkCfm":"ログアウト時に、バックアップを確認する",
"dspOptBk":"バックアップ", "dspOptBk":"バックアップ",
"dspOptRes":"リストア", "dspOptRes":"リストア",
"dspSave":"保存", "dspSave":"保存",
"txtBkMsg":"サーバにデータをバックアップしますか?", "txtBkMsg":"サーバにデータをバックアップしますか?",
"txtResMsg":"サーバからデータをリストアしますか?", "txtResMsg":"サーバからデータをリストアしますか?",
"msgPwdEmpty":"パスワードを入力してください", "msgPwdEmpty":"パスワードを入力してください",
"msgPwdOldWrong":"現在のパスワードに誤りがあります", "msgPwdOldWrong":"現在のパスワードに誤りがあります",
"msgPwdNotMatch":"変更パスワードが一致していません。", "msgPwdNotMatch":"変更パスワードが一致していません。",
"msgLoginErrWrong":"ログインできません。入力情報を確認してください。(エラーコード:{0})", "msgLoginErrWrong":"ログインできません。入力情報を確認してください。(エラーコード:{0})",
"dspPubDt2":"発行日:", "dspPubDt2":"発行日:",
"txtPage":"ページ:", "txtPage":"ページ:",
"dspDelete":"削除", "dspDelete":"削除",
"dspShioriDelConf":"選択されたしおりを削除しますか?", "dspShioriDelConf":"選択されたしおりを削除しますか?",
"dspRegDt":"登録日", "dspRegDt":"登録日",
"dspLogin":"ログイン", "dspLogin":"ログイン",
"dspSkip":"スキップ", "dspSkip":"スキップ",
"dspPwdUpd":"パスワード変更", "dspPwdUpd":"パスワード変更",
"txtLoginAccPath":"アカウント文字列(企業ID):", "txtLoginAccPath":"アカウント文字列(企業ID):",
"txtLoginId":"ユーザID:", "txtLoginId":"ユーザID:",
"txtLoginPwd":"パスワード:", "txtLoginPwd":"パスワード:",
"txtLoginPwdRbr":"企業IDとユーザIDを記憶する", "txtLoginPwdRbr":"企業IDとユーザIDを記憶する",
"txtPwdCurr":"現在パスワード", "txtPwdCurr":"現在パスワード",
"txtPwdNew":"変更パスワード", "txtPwdNew":"変更パスワード",
"txtPwdNewRe":"(再)変更パスワード", "txtPwdNewRe":"(再)変更パスワード",
"txtPwdRemind":"※スキップを選択すると、30日間はこのメッセージが表示されません", "txtPwdRemind":"※スキップを選択すると、30日間はこのメッセージが表示されません",
"txtSearch":"検索", "txtSearch":"検索",
"dspShiori":"しおり", "dspShiori":"しおり",
"dspSetting":"設定", "dspSetting":"設定",
"dspLogout":"ログアウト", "dspLogout":"ログアウト",
"txtRead":"読む", "txtRead":"読む",
"txtSort":"並べ替え", "txtSort":"並べ替え",
"dspTitleNm":"タイトル", "dspTitleNm":"タイトル",
"dspTitleNmKn":"タイトル(カナ)", "dspTitleNmKn":"タイトル(カナ)",
"txtPubDt":"公開日", "txtPubDt":"公開日",
"txtRecordNum":"件", "txtRecordNum":"件",
"txtRecordTotal":"件 表示", "txtRecordTotal":"件 表示",
"dspViewMore":">> 次へ", "dspViewMore":">> 次へ",
"txtGen":"ジャンル", "txtGen":"ジャンル",
"txtGr":"グループ", "txtGr":"グループ",
"txtViewDt":"閲覧日", "txtViewDt":"閲覧日",
"txtDetailPage":"詳細画面", "txtDetailPage":"詳細画面",
"txtCtnNm":"コンテンツ名", "txtCtnNm":"コンテンツ名",
"txtTag":"タグ", "txtTag":"タグ",
"txtContTxt":"本文", "txtContTxt":"本文",
"txtLogoutBkMsg":"ログアウトする前にバックアップしますか?", "txtLogoutBkMsg":"ログアウトする前にバックアップしますか?",
"txtLogoutOptBkCfm":"今回の行動を記憶する。", "txtLogoutOptBkCfm":"今回の行動を記憶する。",
"dspBkOK":"バックアップしてログアウト", "dspBkOK":"バックアップしてログアウト",
"dspBkCancel":"バックアップせずにログアウト", "dspBkCancel":"バックアップせずにログアウト",
"txtSearchResult":"検索結果", "txtSearchResult":"検索結果",
"dspHome":"ホーム", "dspHome":"ホーム",
"txtLoginUser":"(Ver.20130521_01):", "txtLoginUser":"(Ver.20130521_01):",
"txtAll":"すべて", "txtAll":"すべて",
"txtMkgSize":"太さ", "txtMkgSize":"太さ",
"txtMkgS":"小", "txtMkgS":"小",
"txtMkgM":"中", "txtMkgM":"中",
"txtMkgB":"大", "txtMkgB":"大",
"txtMkgSB":"特大", "txtMkgSB":"特大",
"dspOK":"OK", "dspOK":"OK",
"dspCancel":"キャンセル", "dspCancel":"キャンセル",
"txtMkToolBar":"マーキング", "txtMkToolBar":"マーキング",
"dspPgClear":"このページクリア", "dspPgClear":"このページクリア",
"txtColor":"色", "txtColor":"色",
"txtIndex":"インデックス", "txtIndex":"インデックス",
"txtShioriCtnLs":"しおり一覧", "txtShioriCtnLs":"しおり一覧",
"txtTextCopy":"テキストコピー", "txtTextCopy":"テキストコピー",
"txtNoTextCopy":"テキストがありません。", "txtNoTextCopy":"テキストがありません。",
"txtNoSearchResult":"検索結果がありません。", "txtNoSearchResult":"検索結果がありません。",
"msgShioriNotExists":"しおりがありません", "msgShioriNotExists":"しおりがありません",
"msgPwdChangeOK":"パスワードを変更しました。", "msgPwdChangeOK":"パスワードを変更しました。",
"msgPwdChangeNG":"パスワード変更に失敗しました。再入力してください。※注意:新規パスワードには英字および数字両方を含める必要があります。", "msgPwdChangeNG":"パスワード変更に失敗しました。再入力してください。※注意:新規パスワードには英字および数字両方を含める必要があります。",
"msgSearchNotExist":"条件に該当するコンテンツがありません。", "msgSearchNotExist":"条件に該当するコンテンツがありません。",
"txtTooltipBack":"戻る", "txtTooltipBack":"戻る",
"txtTooltipBookmark":"しおり追加・削除", "txtTooltipBookmark":"しおり追加・削除",
"txtTooltipShowMemo":"メモ表示・非表示", "txtTooltipShowMemo":"メモ表示・非表示",
"txtTooltipAddMemo":"メモ追加", "txtTooltipAddMemo":"メモ追加",
"txtTooltipShowMarking":"マーキング表示・非表示", "txtTooltipShowMarking":"マーキング表示・非表示",
"txtTooltipShowMarkingTool":"マーキングツールバーを表示・非表示", "txtTooltipShowMarkingTool":"マーキングツールバーを表示・非表示",
"msgShioriDeleted":"ページが削除しました。", "msgShioriDeleted":"ページが削除しました。",
"dspViewHistory":"履歴", "dspViewHistory":"履歴",
"msgLoginEmpty":"ログイン情報を入力してください", "msgLoginEmpty":"ログイン情報を入力してください",
"msgSaveOk":"保存しました", "msgSaveOk":"保存しました",
"msgPlaceHolder":"キーワードを入力してください", "msgPlaceHolder":"キーワードを入力してください",
"txtOpt004":"※コンテンツを開いた時に表示する", "txtOpt004":"※コンテンツを開いた時に表示する",
"txtRestoreTitle":"リストア確認", "txtRestoreTitle":"リストア確認",
"txtBackupTitle":"バックアップ確認", "txtBackupTitle":"バックアップ確認",
"txtResMsgNotice":"※リストアすると、現時点のローカルのデータでサーバのバックアップデータを上書きします。リストア後、元の状態に復元できませんので、ご注意ください", "txtResMsgNotice":"※リストアすると、現時点のローカルのデータでサーバのバックアップデータを上書きします。リストア後、元の状態に復元できませんので、ご注意ください",
"dspChange":"変更", "dspChange":"変更",
"msgNoIndex":"インデックスがありません", "msgNoIndex":"インデックスがありません",
"msgBackupSuccess":"バックアップが正常に終了しました", "msgBackupSuccess":"バックアップが正常に終了しました",
"msgBackupFailed":"バックアップに失敗しました", "msgBackupFailed":"バックアップに失敗しました",
"msgRestoreSuccess":"リストアが正常に終了しました", "msgRestoreSuccess":"リストアが正常に終了しました",
"msgRestoreFailed":"リストアに失敗しました", "msgRestoreFailed":"リストアに失敗しました",
"txtDeleteConfirmTitle":"しおり削除確認", "txtDeleteConfirmTitle":"しおり削除確認",
"msgHistoryNotExist":"閲覧履歴はありません。", "msgHistoryNotExist":"閲覧履歴はありません。",
"msgChangePassword":"パスワード変更", "msgChangePassword":"パスワード変更",
"txtMemoEdit":"編集", "txtMemoEdit":"編集",
"txtMemoCopy":"コピー", "txtMemoCopy":"コピー",
"msgPageImgErr":"選択されたコンテンツは表示することができませんでした。このコンテンツは削除された可能性があります。", "msgPageImgErr":"選択されたコンテンツは表示することができませんでした。このコンテンツは削除された可能性があります。",
"sysAppTitle":"VISUAMALL Smart Catalog Web App", "sysAppTitle":"VISUAMALL Smart Catalog Web App",
"sysLockScrPwdInput":"パスワードを入力してください", "sysLockScrPwdInput":"パスワードを入力してください",
"txtOpt005":"タブ・ブラウザ終了・F5時のアラートが表示する", "txtOpt005":"タブ・ブラウザ終了・F5時のアラートが表示する",
"txtMemoMenu":"メモ編集", "txtMemoMenu":"メモ編集",
"txtMemoNew":"新規", "txtMemoNew":"新規",
"txtMemoPaste":"貼り付け", "txtMemoPaste":"貼り付け",
"txtMemoClear":"クリア", "txtMemoClear":"クリア",
"txtMemo":"メモ", "txtMemo":"メモ",
"msgBGMPlayConfirm":"コンテンツBGMが自動再生されます。", "msgBGMPlayConfirm":"コンテンツBGMが自動再生されます。",
"msgPWDNeedChange":"パスワードの変更が必要です。設定変更画面に戻って変更してください。", "msgPWDNeedChange":"パスワードの変更が必要です。設定変更画面に戻って変更してください。",
"msgBGMPagePlayConfirm":"ページBGMが自動再生されます。" "msgBGMPagePlayConfirm":"ページBGMが自動再生されます。"
} }
{ {
"apiUrl" : "https://221.111.54.26/sc/{0}/abvapi", "apiUrl" : "https://221.111.54.26/sc/{0}/abvapi",
"apiLoginUrl" : "https://221.111.54.26/sc/nuabvapi", "apiLoginUrl" : "https://221.111.54.26/sc/nuabvapi",
"apiResourceDlUrl" : "https://221.111.54.26/scdl/{0}/dl", "apiResourceDlUrl" : "https://221.111.54.26/scdl/{0}/dl",
"bookShelfCount": 15, "bookShelfCount": 15,
"bookListCount" : 15, "bookListCount" : 15,
"debug" : true, "debug" : true,
"loginPage" : "index.html", "loginPage" : "index.html",
"appName" : "ABookWebCL", "appName" : "ABookWebCL",
"appVersion" : "0.0.1" "appVersion" : "0.0.1"
} }
/// <reference path="../common/js/avweb.js" /> /// <reference path="../common/js/avweb.js" />
/// <reference path="../common/js/screenLock.js" /> /// <reference path="../common/js/screenLock.js" />
/// <reference path="../common/js/common.js" /> /// <reference path="../common/js/common.js" />
/// <reference path="../common/js/i18n.js" /> /// <reference path="../common/js/i18n.js" />
/// <reference path="../common/js/jquery-1.8.1.min.js" /> /// <reference path="../common/js/jquery-1.8.1.min.js" />
/// <reference path="../common/js/jquery-ui-1.8.23.custom.min.js" /> /// <reference path="../common/js/jquery-ui-1.8.23.custom.min.js" />
/// <reference path="../common/js/jquery.toastmessage.js" /> /// <reference path="../common/js/jquery.toastmessage.js" />
/// <reference path="../common/js/pageViewer.js" /> /// <reference path="../common/js/pageViewer.js" />
/// <reference path="header.js" /> /// <reference path="header.js" />
//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;
var DEFAULT_SORT_TYPE = '1'; var DEFAULT_SORT_TYPE = '1';
var DEFAULT_SORT_ORDER = '1'; var DEFAULT_SORT_ORDER = '1';
var DEFAULT_SEARCH_DIVISION = 0; var DEFAULT_SEARCH_DIVISION = 0;
var DEFAULT_IMG_OPTION_MEMO = 'img/list/pic_1.png'; var DEFAULT_IMG_OPTION_MEMO = 'img/list/pic_1.png';
var DEFAULT_IMG_OPTION_MARKING = 'img/list/pic_2.png'; var DEFAULT_IMG_OPTION_MARKING = 'img/list/pic_2.png';
var DEFAULT_IMG_CONTENT_EDIT = 'img/list/updatebook.png'; var DEFAULT_IMG_CONTENT_EDIT = 'img/list/updatebook.png';
var DEFAULT_IMG_CONTENT_NEW = 'img/list/newbook.png'; var DEFAULT_IMG_CONTENT_NEW = 'img/list/newbook.png';
var iNumberOfNextRecord = 15; var iNumberOfNextRecord = 15;
var arrayTemp = []; var arrayTemp = [];
var contentIdArray = []; var contentIdArray = [];
var resourceVersionArr = []; var resourceVersionArr = [];
var metaVersionArr = []; var metaVersionArr = [];
var totalPage; var totalPage;
var chkSearchTextEmpty = false; var chkSearchTextEmpty = false;
var noRecordFlg = false; var noRecordFlg = false;
var home_isMove = false; var home_isMove = false;
$(document).ready(function(){ $(document).ready(function(){
if (!avwCheckLogin(ScreenIds.Login)){ if (!avwCheckLogin(ScreenIds.Login)){
return; return;
} }
LockScreen(); LockScreen();
document.title = i18nText('txtSearchResult') + ' | ' + i18nText('sysAppTitle'); document.title = i18nText('txtSearchResult') + ' | ' + i18nText('sysAppTitle');
// Set bookmark screen // Set bookmark screen
ClientData.BookmarkScreen(ScreenIds.ContentSearch); ClientData.BookmarkScreen(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
formatDisplayMoreRecord(); formatDisplayMoreRecord();
//remove hover effect when is touch device //remove hover effect when is touch device
removeHoverCss(); removeHoverCss();
//InitScreen //InitScreen
initialScreen(); initialScreen();
//Render Grid //Render Grid
renderGridView(); renderGridView();
//Go To Details Page //Go To Details Page
$('canvas').live('click', canvasClickFunction); $('canvas').live('click', canvasClickFunction);
//$('canvas').live('touchstart', canvasClickFunction); //$('canvas').live('touchstart', canvasClickFunction);
$('canvas').live('touchend', canvasClickFunction); $('canvas').live('touchend', canvasClickFunction);
$('canvas').live('touchmove', function () { home_isMove = true; }); $('canvas').live('touchmove', function () { home_isMove = true; });
//Open dialog //Open dialog
$('.dialog').live('click', titleClickFunction); $('.dialog').live('click', titleClickFunction);
//$('.dialog').live('touchstart', titleClickFunction); //$('.dialog').live('touchstart', titleClickFunction);
$('.dialog').live('touchend', titleClickFunction); $('.dialog').live('touchend', titleClickFunction);
$('.dialog').live('touchmove', function () { home_isMove = true; }); $('.dialog').live('touchmove', function () { home_isMove = true; });
//Show Next Record //Show Next Record
$('a#control-nextrecord').click(showNextRecordFunction); $('a#control-nextrecord').click(showNextRecordFunction);
//Sort Title //Sort Title
$('#control-sort-title').click(sortByTitleFunction); $('#control-sort-title').click(sortByTitleFunction);
//Sort by title kana //Sort by title kana
$('#control-sort-titlekana').click(sortByTitleKanaFunction); $('#control-sort-titlekana').click(sortByTitleKanaFunction);
//sort by release date //sort by release date
$('#control-sort-releasedate').click(sortByReleaseDateFunction); $('#control-sort-releasedate').click(sortByReleaseDateFunction);
//Go To Details Page //Go To Details Page
$('.button-details').live('click', readSubmenuFunction); $('.button-details').live('click', readSubmenuFunction);
//$('.button-details').live('touchstart', readSubmenuFunction); //$('.button-details').live('touchstart', readSubmenuFunction);
$('.button-details').live('touchend', readSubmenuFunction); $('.button-details').live('touchend', readSubmenuFunction);
$('.button-details').live('touchmove', function () { home_isMove = true; }); $('.button-details').live('touchmove', function () { home_isMove = true; });
$('#main-search').click(searchEventButtonFunction); $('#main-search').click(searchEventButtonFunction);
$('#txtSearch').keydown(mainSearchKeyDownFunction); $('#txtSearch').keydown(mainSearchKeyDownFunction);
$('#main-search-content').click(mainSearchContentClickFunction); $('#main-search-content').click(mainSearchContentClickFunction);
$('#main-search-tag').click(mainSearchTagClickFunction); $('#main-search-tag').click(mainSearchTagClickFunction);
$('#main-search-body').click(mainSearchBodyClickFunction); $('#main-search-body').click(mainSearchBodyClickFunction);
$('#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
checkForceChangePassword(); checkForceChangePassword();
} }
}); });
function mainSearchBodyClickFunction(){ function mainSearchBodyClickFunction(){
$('#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');
}; };
function mainSearchTagClickFunction(){ function mainSearchTagClickFunction(){
$('#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');
}; };
function mainSearchContentClickFunction(){ function mainSearchContentClickFunction(){
$('#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');
}; };
function mainSearchKeyDownFunction(e){ function mainSearchKeyDownFunction(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
function abapi(name, param, method, callback){ function abapi(name, param, method, callback){
avwCmsApi(ClientData.userInfo_accountPath(), name, method, param, callback, null); avwCmsApi(ClientData.userInfo_accountPath(), name, method, param, callback, null);
}; };
//Initial screen //Initial screen
function initialScreen(){ function initialScreen(){
var searchText = ClientData.searchCond_searchText(); var searchText = ClientData.searchCond_searchText();
var searchDivision = ClientData.searchCond_searchDivision(); var searchDivision = ClientData.searchCond_searchDivision();
$('#txtSearch').val(searchText); $('#txtSearch').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 else
{ {
$('#main-content').attr('checked',false); $('#main-content').attr('checked',false);
$('#main-tag').attr('checked',false); $('#main-tag').attr('checked',false);
$('#main-body').attr('checked','checked'); $('#main-body').attr('checked','checked');
} }
handleLanguage(); handleLanguage();
}; };
///Render Content ///Render Content
function renderContent(id, text, division, type, order, from, to, cateid, grpid){ function renderContent(id, text, division, type, order, from, to, cateid, grpid){
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
}; };
abapi('webContentList', params, 'POST', function (data) { abapi('webContentList', params, 'POST', function (data) {
$.each(data.contentList, function (i, post) { $.each(data.contentList, function (i, post) {
var outputDate = formatDeliveryDate(post.contentDeliveryDate); var outputDate = formatDeliveryDate(post.contentDeliveryDate);
$('#content-grid').append( $('#content-grid').append(
'<section>' '<section>'
+' <div class="cnt_section">' +' <div class="cnt_section">'
+' <a class="img">' +' <a class="img">'
+' <canvas height="105px" width="150px" id="content-thumbnail'+post.contentId+'" contentid="'+post.contentId+'" style="display:none; padding-top:12px;">' +' <canvas height="105px" width="150px" id="content-thumbnail'+post.contentId+'" contentid="'+post.contentId+'" style="display:none; padding-top:12px;">'
+ ' </canvas>' + ' </canvas>'
+ ' <img id="loadingIcon' + post.contentId + '" src="./img/data_loading.gif" height="25px" width="25px" style="padding-top: 46px; padding-left: 66px"/>' + ' <img id="loadingIcon' + post.contentId + '" src="./img/data_loading.gif" height="25px" width="25px" style="padding-top: 46px; padding-left: 66px"/>'
+ ' </a>' + ' </a>'
+' <div class="text">' +' <div class="text">'
+' <a id="title'+post.contentId+'" class="dialog name" contentid="'+post.contentId+'">'+ truncate(htmlEncode(post.contentTitle), 25)+'</a>' +' <a id="title'+post.contentId+'" class="dialog name" contentid="'+post.contentId+'">'+ truncate(htmlEncode(post.contentTitle), 25)+'</a>'
+' <div class="info">' +' <div class="info">'
+' <ul class="date">' +' <ul class="date">'
+' <li><span class="lang" lang="txtPubDt"> </span> : '+outputDate+'</li>' +' <li><span class="lang" lang="txtPubDt"> </span> : '+outputDate+'</li>'
+' <li><span class="lang" lang="txtViewDt"> </span>:<span id="lblVdate'+post.contentId+'"> </span></li>' +' <li><span class="lang" lang="txtViewDt"> </span>:<span id="lblVdate'+post.contentId+'"> </span></li>'
+' </ul>' +' </ul>'
+' <ul class="pic">' +' <ul class="pic">'
+' <li><img src="'+DEFAULT_IMG_OPTION_MEMO+'" id="imgMemo'+post.contentId+'" class="sticker" /></li>' +' <li><img src="'+DEFAULT_IMG_OPTION_MEMO+'" id="imgMemo'+post.contentId+'" class="sticker" /></li>'
+' <li><img src="'+DEFAULT_IMG_OPTION_MARKING+'" id="imgBookMark'+post.contentId+'" class="pen" /></li>' +' <li><img src="'+DEFAULT_IMG_OPTION_MARKING+'" id="imgBookMark'+post.contentId+'" class="pen" /></li>'
+' <li><a class="read lang button-details" contentid="' + post.contentId + '" lang="txtRead">読む</a></li>' +' <li><a class="read lang button-details" contentid="' + post.contentId + '" lang="txtRead">読む</a></li>'
+' </ul>' +' </ul>'
+' </div>' +' </div>'
+' </div>' +' </div>'
+' </div>' +' </div>'
+'</section>' +'</section>'
); );
//assign thumbnail to array //assign thumbnail to array
arrayTemp.push({ contentId: post.contentId, thumbnail: formatStringBase64(post.contentThumbnail) }); arrayTemp.push({ contentId: post.contentId, thumbnail: formatStringBase64(post.contentThumbnail) });
//Check if user has read this content or not. //Check if user has read this content or not.
checkUserHasReadContent(post.contentId, post.resourceVersion, post.metaVersion); checkUserHasReadContent(post.contentId, post.resourceVersion, post.metaVersion);
//assign version to array //assign version to array
resourceVersionArr.push({ contentid: post.contentId, resourceversion: post.resourceVersion }); resourceVersionArr.push({ contentid: post.contentId, resourceversion: post.resourceVersion });
//assign meta version to array //assign meta version to array
metaVersionArr.push({ contentid: post.contentId, metaversion: post.metaVersion }); metaVersionArr.push({ contentid: post.contentId, metaversion: post.metaVersion });
//Check if content has marking or memo //Check if content has marking or memo
checkContentMarkingMemoOption(post.contentId); checkContentMarkingMemoOption(post.contentId);
//renderViewDate //renderViewDate
var viewdate = renderViewDate(post.contentId); var viewdate = renderViewDate(post.contentId);
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
getNextRecordNumForList(); 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);
totalPage = data.totalRecord; totalPage = data.totalRecord;
//Render Page number //Render Page number
if(totalPage == 0){ if(totalPage == 0){
reRenderPageNumber(totalPage, totalPage); reRenderPageNumber(totalPage, totalPage);
} }
else{ else{
reRenderPageNumber(ClientData.searchCond_recordTo(), totalPage); reRenderPageNumber(ClientData.searchCond_recordTo(), totalPage);
} }
//Toggle scroll to top Control //Toggle scroll to top Control
handleBackToTop(); handleBackToTop();
//changeLanguage(ClientData.userInfo_language()); //changeLanguage(ClientData.userInfo_language());
i18nReplaceText(); i18nReplaceText();
}); });
}; };
//Handle Back To Top Button //Handle Back To Top Button
function handleBackToTop(){ function handleBackToTop(){
if(ClientData.searchCond_recordTo() >= totalPage){ if(ClientData.searchCond_recordTo() >= totalPage){
$('#control-nextrecord').css('visibility','hidden'); $('#control-nextrecord').css('visibility','hidden');
} }
else{ else{
$('#control-nextrecord').css('visibility','visible'); $('#control-nextrecord').css('visibility','visible');
} }
if(totalPage == 0){ if(totalPage == 0){
$('#control-nextrecord').css('visibility','hidden'); $('#control-nextrecord').css('visibility','hidden');
displayResultNoRecord(); displayResultNoRecord();
noRecordFlg = true; noRecordFlg = true;
} }
else { else {
$('#msgSearchNotExist').hide(); $('#msgSearchNotExist').hide();
$('#content-grid').removeClass('lang'); $('#content-grid').removeClass('lang');
$('#content-grid').removeAttr('lang'); $('#content-grid').removeAttr('lang');
enableSort(); enableSort();
noRecordFlg = false; noRecordFlg = false;
} }
}; };
//Handle language //Handle language
function handleLanguage(){ function handleLanguage(){
//if(ClientData.userInfo_language() == Consts.ConstLanguage_En || ClientData.userInfo_language() == Consts.ConstLanguage_Ko) //if(ClientData.userInfo_language() == Consts.ConstLanguage_En || ClientData.userInfo_language() == Consts.ConstLanguage_Ko)
if (getCurrentLanguage() == Consts.ConstLanguage_En || getCurrentLanguage() == Consts.ConstLanguage_Ko) if (getCurrentLanguage() == Consts.ConstLanguage_En || getCurrentLanguage() == Consts.ConstLanguage_Ko)
{ {
$('#control-sort-titlekana').css('display','none'); $('#control-sort-titlekana').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();
if (typeSort == 2) { if (typeSort == 2) {
if (orderSort == Consts.ConstOrderSetting_Asc) { if (orderSort == Consts.ConstOrderSetting_Asc) {
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#titlekana-sorttype').html('▲'); $('#titlekana-sorttype').html('▲');
$('#titlekana-sorttype').css('width', '12px'); $('#titlekana-sorttype').css('width', '12px');
} }
else { else {
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#titlekana-sorttype').html('▼'); $('#titlekana-sorttype').html('▼');
$('#titlekana-sorttype').css('width', '12px'); $('#titlekana-sorttype').css('width', '12px');
} }
} }
} }
if(noRecordFlg){ if(noRecordFlg){
$('#label-sort-titlekana').css('display','block'); $('#label-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
function renderGridView(){ function renderGridView(){
var fromPage = DEFAULT_DISP_NUMBER_RECORD_FROM; var fromPage = DEFAULT_DISP_NUMBER_RECORD_FROM;
var toPage = returnNumberDispRecordForList(); var toPage = returnNumberDispRecordForList();
var sortType = DEFAULT_SORT_TYPE; var sortType = DEFAULT_SORT_TYPE;
var sortOrder = DEFAULT_SORT_ORDER; var sortOrder = 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); ClientData.searchCond_recordFrom(fromPage);
ClientData.searchCond_recordTo(toPage); 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);
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
handleSortDisp(); handleSortDisp();
//Language Handle //Language Handle
handleLanguage(); handleLanguage();
//Refresh GridView //Refresh GridView
refreshGrid(); refreshGrid();
if(searchText == '' || searchText == null){ if(searchText == '' || searchText == null){
displayResultNoRecord(); displayResultNoRecord();
chkSearchTextEmpty = true; chkSearchTextEmpty = true;
noRecordFlg = true; noRecordFlg = true;
reRenderPageNumber(0, 0); reRenderPageNumber(0, 0);
} }
else { else {
$('#msgSearchNotExist').hide(); $('#msgSearchNotExist').hide();
chkSearchTextEmpty = false; chkSearchTextEmpty = false;
//Render Gridview //Render Gridview
renderContent(sid, searchText, searchDivision, sortType, sortOrder, fromPage, toPage, genreId, groupId); renderContent(sid, searchText, searchDivision, sortType, sortOrder, fromPage, toPage, genreId, groupId);
$('#control-nextrecord').css('visibility','visible'); $('#control-nextrecord').css('visibility','visible');
} }
}; };
//Canvas Click function //Canvas Click function
function canvasClickFunction(e){ function canvasClickFunction(e){
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
} }
if (home_isMove == true) { if (home_isMove == true) {
home_isMove = false; home_isMove = false;
return; return;
} }
var contentId = $(this).attr('id'); var contentId = $(this).attr('id');
var outputId = contentId.substring(17); var outputId = contentId.substring(17);
var checkflag = false; var checkflag = false;
// Set content id for screen: content detail // Set content id for screen: content detail
ClientData.contentInfo_contentId(outputId); ClientData.contentInfo_contentId(outputId);
// Get image of selected image // Get image of selected image
var base64String = returnThumbnail(outputId); var base64String = returnThumbnail(outputId);
ClientData.contentInfo_contentThumbnail(base64String); ClientData.contentInfo_contentThumbnail(base64String);
//Store Content id that user has read //Store Content id that user has read
if(ClientData.ReadingContentIds().length > 0){ if(ClientData.ReadingContentIds().length > 0){
contentIdArray = ClientData.ReadingContentIds(); contentIdArray = ClientData.ReadingContentIds();
for(var nIndex = 0; nIndex < contentIdArray.length; nIndex++){ for(var nIndex = 0; nIndex < contentIdArray.length; nIndex++){
if(contentIdArray[nIndex].contentid == outputId){ if(contentIdArray[nIndex].contentid == outputId){
checkflag = true; checkflag = true;
break; break;
} }
else{ else{
checkflag = false; checkflag = false;
} }
} }
if(!checkflag){ if(!checkflag){
contentIdArray.push({contentid: outputId, viewdate: '', originviewdate: ''}); contentIdArray.push({contentid: outputId, viewdate: '', originviewdate: ''});
} }
} }
else{ else{
contentIdArray.push({contentid: outputId, viewdate: '', originviewdate: ''}); 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(contentIdArray); ClientData.ReadingContentIds(contentIdArray);
//Set ResouceVersion for content //Set ResouceVersion for content
setResourceVersionData(outputId); setResourceVersionData(outputId);
//Set MetaVersion for content //Set MetaVersion for content
setMetaVersionData(outputId); setMetaVersionData(outputId);
//Close Submenu //Close Submenu
$('#dlgSubMenu').hide(); $('#dlgSubMenu').hide();
//Delete 'new' icon //Delete 'new' icon
drawEditImage(outputId); drawEditImage(outputId);
//Open content Detail //Open content Detail
openContentDetail(); openContentDetail();
}; };
//Re-render page from and total record //Re-render page from and total record
function reRenderPageNumber(dispRecord, dispTotal){ function reRenderPageNumber(dispRecord, dispTotal){
$('#dispPage').html(dispRecord); $('#dispPage').html(dispRecord);
$('#totalPage').html(dispTotal); $('#totalPage').html(dispTotal);
$('.pageNumControl').css('visibility','visible'); $('.pageNumControl').css('visibility','visible');
}; };
//Show Next Record Function //Show Next Record Function
function showNextRecordFunction(){ function showNextRecordFunction(){
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();
var searchDivision = ClientData.searchCond_searchDivision(); var searchDivision = ClientData.searchCond_searchDivision();
var genreId = ClientData.searchCond_genreId(); var genreId = ClientData.searchCond_genreId();
var groupId = ClientData.searchCond_groupId(); var groupId = ClientData.searchCond_groupId();
var sid = ClientData.userInfo_sid(); var sid = ClientData.userInfo_sid();
var totalrecord = totalPage; var totalrecord = totalPage;
if(fromPage == null || fromPage == 'undefined'){ if(fromPage == null || fromPage == 'undefined'){
fromPage = DEFAULT_DISP_NUMBER_RECORD_FROM; fromPage = DEFAULT_DISP_NUMBER_RECORD_FROM;
} }
if(toPage == null || toPage == 'undefined'){ if(toPage == null || toPage == 'undefined'){
toPage = returnNumberDispRecordForList(); toPage = returnNumberDispRecordForList();
} }
fromPage = eval(toPage) + 1; fromPage = eval(toPage) + 1;
var iRecordNumber = eval(totalrecord) - eval(fromPage); var iRecordNumber = eval(totalrecord) - eval(fromPage);
if(iRecordNumber < iNumberOfNextRecord) if(iRecordNumber < iNumberOfNextRecord)
{ {
toPage = eval(fromPage) + eval(iRecordNumber); toPage = eval(fromPage) + eval(iRecordNumber);
} }
else else
{ {
toPage = eval(fromPage) + (eval(iNumberOfNextRecord) - 1); toPage = eval(fromPage) + (eval(iNumberOfNextRecord) - 1);
} }
ClientData.searchCond_recordFrom(fromPage); ClientData.searchCond_recordFrom(fromPage);
ClientData.searchCond_recordTo(toPage); ClientData.searchCond_recordTo(toPage);
if(fromPage <= totalrecord) if(fromPage <= totalrecord)
{ {
renderContent(sid, searchText, searchDivision, sortType, sortOrder, fromPage, toPage, genreId, groupId); renderContent(sid, searchText, searchDivision, sortType, sortOrder, fromPage, toPage, genreId, groupId);
} }
}; };
//Sort By Title Function //Sort By Title Function
function sortByTitleFunction(){ function sortByTitleFunction(){
$(this).addClass('active_tops'); $(this).addClass('active_tops');
$('#control-sort-titlekana').removeClass('active_tops'); $('#control-sort-titlekana').removeClass('active_tops');
$('#control-sort-releasedate').removeClass('active_tops'); $('#control-sort-releasedate').removeClass('active_tops');
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 = DEFAULT_DISP_NUMBER_RECORD_FROM; var recordFrom = 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 == Consts.ConstOrderSetting_Asc) if(sortOrder == Consts.ConstOrderSetting_Asc)
{ {
if(sortType == '1'){ if(sortType == '1'){
sortOrder = Consts.ConstOrderSetting_Desc; sortOrder = Consts.ConstOrderSetting_Desc;
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#title-sorttype').html('▼'); $('#title-sorttype').html('▼');
$('#title-sorttype').css('width', '12px'); $('#title-sorttype').css('width', '12px');
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#rDate-sorttype').html(''); $('#rDate-sorttype').html('');
} }
else{ else{
sortOrder = Consts.ConstOrderSetting_Asc; sortOrder = Consts.ConstOrderSetting_Asc;
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#title-sorttype').html('▲'); $('#title-sorttype').html('▲');
$('#title-sorttype').css('width', '12px'); $('#title-sorttype').css('width', '12px');
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#rDate-sorttype').html(''); $('#rDate-sorttype').html('');
} }
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
else else
{ {
sortOrder = Consts.ConstOrderSetting_Asc; sortOrder = Consts.ConstOrderSetting_Asc;
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#title-sorttype').html('▲'); $('#title-sorttype').html('▲');
$('#title-sorttype').css('width', '12px'); $('#title-sorttype').css('width', '12px');
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#rDate-sorttype').html(''); $('#rDate-sorttype').html('');
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
if(recordFrom == null || recordFrom == 'undefined'){ if(recordFrom == null || recordFrom == 'undefined'){
recordFrom = DEFAULT_DISP_NUMBER_RECORD_FROM; recordFrom = DEFAULT_DISP_NUMBER_RECORD_FROM;
ClientData.searchCond_recordFrom(recordFrom); ClientData.searchCond_recordFrom(recordFrom);
} }
if(recordTo == null || recordTo == 'undefined'){ if(recordTo == null || recordTo == 'undefined'){
recordTo = returnNumberDispRecordForList(); recordTo = returnNumberDispRecordForList();
ClientData.searchCond_recordFrom(recordTo); ClientData.searchCond_recordFrom(recordTo);
} }
sortType = '1'; sortType = '1';
ClientData.searchCond_sortType(sortType); ClientData.searchCond_sortType(sortType);
//refresh Gridview //refresh Gridview
refreshGrid(); refreshGrid();
//refresh add more record //refresh add more record
$('#control-nextrecord').css('visibility','hidden'); $('#control-nextrecord').css('visibility','hidden');
renderContent(sid, ClientData.searchCond_searchText(), ClientData.searchCond_searchDivision(), sortType, sortOrder, recordFrom, recordTo, genreId, groupId); renderContent(sid, ClientData.searchCond_searchText(), ClientData.searchCond_searchDivision(), sortType, sortOrder, recordFrom, recordTo, genreId, groupId);
}; };
//Sort By Title Kana function //Sort By Title Kana function
function sortByTitleKanaFunction(){ function sortByTitleKanaFunction(){
$(this).addClass('active_tops'); $(this).addClass('active_tops');
$('#control-sort-title').removeClass('active_tops'); $('#control-sort-title').removeClass('active_tops');
$('#control-sort-releasedate').removeClass('active_tops'); $('#control-sort-releasedate').removeClass('active_tops');
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 = DEFAULT_DISP_NUMBER_RECORD_FROM; var recordFrom = 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 == Consts.ConstOrderSetting_Asc) if(sortOrder == Consts.ConstOrderSetting_Asc)
{ {
if(sortType == '2'){ if(sortType == '2'){
sortOrder = Consts.ConstOrderSetting_Desc; sortOrder = Consts.ConstOrderSetting_Desc;
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#titlekana-sorttype').html('▼'); $('#titlekana-sorttype').html('▼');
$('#titlekana-sorttype').css('width', '12px'); $('#titlekana-sorttype').css('width', '12px');
$('#rDate-sorttype').html(''); $('#rDate-sorttype').html('');
} }
else{ else{
sortOrder = Consts.ConstOrderSetting_Asc; sortOrder = Consts.ConstOrderSetting_Asc;
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#titlekana-sorttype').html('▲'); $('#titlekana-sorttype').html('▲');
$('#titlekana-sorttype').css('width', '12px'); $('#titlekana-sorttype').css('width', '12px');
$('#rDate-sorttype').html(''); $('#rDate-sorttype').html('');
} }
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
else else
{ {
sortOrder = Consts.ConstOrderSetting_Asc; sortOrder = Consts.ConstOrderSetting_Asc;
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#titlekana-sorttype').html('▲'); $('#titlekana-sorttype').html('▲');
$('#titlekana-sorttype').css('width', '12px'); $('#titlekana-sorttype').css('width', '12px');
$('#rDate-sorttype').html(''); $('#rDate-sorttype').html('');
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
if(recordFrom == null || recordFrom == 'undefined'){ if(recordFrom == null || recordFrom == 'undefined'){
recordFrom = DEFAULT_DISP_NUMBER_RECORD_FROM; recordFrom = DEFAULT_DISP_NUMBER_RECORD_FROM;
ClientData.searchCond_recordFrom(recordFrom); ClientData.searchCond_recordFrom(recordFrom);
} }
if(recordTo == null || recordTo == 'undefined'){ if(recordTo == null || recordTo == 'undefined'){
recordTo = returnNumberDispRecordForList(); recordTo = returnNumberDispRecordForList();
ClientData.searchCond_recordFrom(recordTo); ClientData.searchCond_recordFrom(recordTo);
} }
sortType = '2'; sortType = '2';
//refresh gridview //refresh gridview
refreshGrid(); 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);
renderContent(sid, ClientData.searchCond_searchText(), ClientData.searchCond_searchDivision(), sortType, sortOrder, recordFrom, recordTo, genreId, groupId); renderContent(sid, ClientData.searchCond_searchText(), ClientData.searchCond_searchDivision(), sortType, sortOrder, recordFrom, recordTo, genreId, groupId);
}; };
//Sort By Release Date //Sort By Release Date
function sortByReleaseDateFunction(){ function sortByReleaseDateFunction(){
$(this).addClass('active_tops'); $(this).addClass('active_tops');
$('#control-sort-title').removeClass('active_tops'); $('#control-sort-title').removeClass('active_tops');
$('#control-sort-titlekana').removeClass('active_tops'); $('#control-sort-titlekana').removeClass('active_tops');
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 = DEFAULT_DISP_NUMBER_RECORD_FROM; var recordFrom = 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 == Consts.ConstOrderSetting_Asc) if(sortOrder == Consts.ConstOrderSetting_Asc)
{ {
if(sortType == '3'){ if(sortType == '3'){
sortOrder = Consts.ConstOrderSetting_Desc; sortOrder = Consts.ConstOrderSetting_Desc;
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#rDate-sorttype').html(''); $('#rDate-sorttype').html('');
$('#rDate-sorttype').html('▼'); $('#rDate-sorttype').html('▼');
$('#rDate-sorttype').css('width', '12px'); $('#rDate-sorttype').css('width', '12px');
} }
else{ else{
sortOrder = Consts.ConstOrderSetting_Asc; sortOrder = Consts.ConstOrderSetting_Asc;
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#rDate-sorttype').html(''); $('#rDate-sorttype').html('');
$('#rDate-sorttype').html('▲'); $('#rDate-sorttype').html('▲');
$('#rDate-sorttype').css('width', '12px'); $('#rDate-sorttype').css('width', '12px');
} }
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
else else
{ {
sortOrder = Consts.ConstOrderSetting_Asc; sortOrder = Consts.ConstOrderSetting_Asc;
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#rDate-sorttype').html(''); $('#rDate-sorttype').html('');
$('#rDate-sorttype').html('▲'); $('#rDate-sorttype').html('▲');
$('#rDate-sorttype').css('width', '12px'); $('#rDate-sorttype').css('width', '12px');
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
if(recordFrom == null || recordFrom == 'undefined'){ if(recordFrom == null || recordFrom == 'undefined'){
recordFrom = DEFAULT_DISP_NUMBER_RECORD_FROM; recordFrom = DEFAULT_DISP_NUMBER_RECORD_FROM;
ClientData.searchCond_recordFrom(recordFrom); ClientData.searchCond_recordFrom(recordFrom);
} }
if(recordTo == null || recordTo == 'undefined'){ if(recordTo == null || recordTo == 'undefined'){
recordTo = returnNumberDispRecordForList(); recordTo = returnNumberDispRecordForList();
ClientData.searchCond_recordFrom(recordTo); ClientData.searchCond_recordFrom(recordTo);
} }
sortType = '3'; sortType = '3';
//refresh gridview //refresh gridview
refreshGrid(); 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);
renderContent(sid, ClientData.searchCond_searchText(), ClientData.searchCond_searchDivision(), sortType, sortOrder, recordFrom, recordTo, genreId, groupId); renderContent(sid, ClientData.searchCond_searchText(), ClientData.searchCond_searchDivision(), sortType, sortOrder, recordFrom, recordTo, genreId, groupId);
}; };
//Get Thumnail base on contentid //Get Thumnail base on contentid
function returnThumbnail(contentid){ function returnThumbnail(contentid){
for(var i = 0; i < arrayTemp.length; i++){ for(var i = 0; i < arrayTemp.length; i++){
if(arrayTemp[i].contentId == contentid){ if(arrayTemp[i].contentId == contentid){
return arrayTemp[i].thumbnail; return arrayTemp[i].thumbnail;
} }
} }
}; };
//Dialog Read Button CLick //Dialog Read Button CLick
function readSubmenuFunction(e){ function readSubmenuFunction(e){
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
} }
if (home_isMove == true) { if (home_isMove == true) {
home_isMove = false; home_isMove = false;
return; return;
} }
var contentId = $(this).attr('contentid'); var contentId = $(this).attr('contentid');
var contentThumbnail = returnThumbnail(contentId); var contentThumbnail = 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 = formatNormalDate(day, month, date.getFullYear()); var outputDate = formatNormalDate(day, month, date.getFullYear());
ClientData.contentInfo_contentId(contentId); ClientData.contentInfo_contentId(contentId);
ClientData.contentInfo_contentThumbnail(contentThumbnail); ClientData.contentInfo_contentThumbnail(contentThumbnail);
var checkflag = false; var checkflag = false;
//Store Content id that user has read //Store Content id that user has read
if(ClientData.ReadingContentIds().length > 0){ if(ClientData.ReadingContentIds().length > 0){
contentIdArray = ClientData.ReadingContentIds(); contentIdArray = ClientData.ReadingContentIds();
for(var nIndex = 0; nIndex < contentIdArray.length; nIndex++){ for(var nIndex = 0; nIndex < contentIdArray.length; nIndex++){
if(contentIdArray[nIndex].contentid == contentId){ if(contentIdArray[nIndex].contentid == contentId){
checkflag = true; checkflag = true;
if(contentIdArray[nIndex].viewdate == null || contentIdArray[nIndex].viewdate == 'undefined' || contentIdArray[nIndex].viewdate == ''){ if(contentIdArray[nIndex].viewdate == null || contentIdArray[nIndex].viewdate == 'undefined' || contentIdArray[nIndex].viewdate == ''){
contentIdArray[nIndex].viewdate = outputDate; contentIdArray[nIndex].viewdate = outputDate;
contentIdArray[nIndex].originviewdate = date; contentIdArray[nIndex].originviewdate = date;
} }
break; break;
} }
else{ else{
checkflag = false; checkflag = false;
} }
} }
if(!checkflag){ if(!checkflag){
contentIdArray.push({contentid: contentId, viewdate: outputDate, originviewdate: date}); contentIdArray.push({contentid: contentId, viewdate: outputDate, originviewdate: date});
} }
} }
else{ else{
contentIdArray.push({contentid: contentId, viewdate: outputDate, originviewdate: date}); 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
setResourceVersionData(contentId); setResourceVersionData(contentId);
//Set MetaVersion for content //Set MetaVersion for content
setMetaVersionData(contentId); setMetaVersionData(contentId);
//Set data for readingcontentid //Set data for readingcontentid
ClientData.ReadingContentIds(contentIdArray); ClientData.ReadingContentIds(contentIdArray);
ClientData.IsRefresh(false); ClientData.IsRefresh(false);
avwScreenMove(ScreenIds.ContentView); avwScreenMove(ScreenIds.ContentView);
}; };
//Check if Content Has marking or memo //Check if Content Has marking or memo
function checkContentMarkingMemoOption(contentId){ function checkContentMarkingMemoOption(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
function checkUserHasReadContent(contId, resourceVer, metaVer){ function checkUserHasReadContent(contId, resourceVer, metaVer){
var imgThumb = new Image(); var imgThumb = new Image();
//imgThumb.src = returnThumbnail(contId); //imgThumb.src = returnThumbnail(contId);
var imgIconNew = new Image(); var imgIconNew = new Image();
//imgIconNew.src = DEFAULT_IMG_CONTENT_NEW; //imgIconNew.src = DEFAULT_IMG_CONTENT_NEW;
var imgIconEdit = new Image(); var imgIconEdit = new Image();
//imgIconEdit.src = DEFAULT_IMG_CONTENT_EDIT; //imgIconEdit.src = 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();
if(readArr == null || readArr <= 0 || readArr == 'undefined'){ if(readArr == null || readArr <= 0 || readArr == 'undefined'){
imgThumb.onload = function(){ imgThumb.onload = function(){
var resizeImg = resizeResourceThumbnail(imgThumb, c.width, c.height); var resizeImg = 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);
$("#loadingIcon" + contId).fadeOut('slow', function () { $("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow'); $('#content-thumbnail' + contId).fadeIn('slow');
}); });
}; };
imgIconNew.src = DEFAULT_IMG_CONTENT_NEW; imgIconNew.src = DEFAULT_IMG_CONTENT_NEW;
}; };
imgThumb.src = returnThumbnail(contId); imgThumb.src = returnThumbnail(contId);
} }
else{ else{
//Check if user has read this content or not //Check if user has read this content or not
for (var nIndex1 = 0; nIndex1 < ClientData.ReadingContentIds().length; nIndex1++) { for (var nIndex1 = 0; nIndex1 < ClientData.ReadingContentIds().length; nIndex1++) {
if(ClientData.ReadingContentIds()[nIndex1].contentid == contId){ if(ClientData.ReadingContentIds()[nIndex1].contentid == contId){
imgThumb.onload = function(){ imgThumb.onload = function(){
var resizeImg = resizeResourceThumbnail(imgThumb, c.width, c.height); var resizeImg = 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]);
$("#loadingIcon" + contId).fadeOut('slow', function () { $("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow'); $('#content-thumbnail' + contId).fadeIn('slow');
}); });
}; };
imgThumb.src = returnThumbnail(contId); imgThumb.src = returnThumbnail(contId);
readFlg = true; readFlg = true;
break; break;
} }
else{ else{
imgThumb.onload = function(){ imgThumb.onload = function(){
var resizeImg = resizeResourceThumbnail(imgThumb, c.width, c.height); var resizeImg = 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);
$("#loadingIcon" + contId).fadeOut('slow', function () { $("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow'); $('#content-thumbnail' + contId).fadeIn('slow');
}); });
}; };
imgIconNew.src = DEFAULT_IMG_CONTENT_NEW; imgIconNew.src = DEFAULT_IMG_CONTENT_NEW;
}; };
imgThumb.src = returnThumbnail(contId); imgThumb.src = returnThumbnail(contId);
} }
} }
} }
//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 = resizeResourceThumbnail(imgThumb, c.width, c.height); var resizeImg = 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]);
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);
$("#loadingIcon" + contId).fadeOut('slow', function () { $("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow'); $('#content-thumbnail' + contId).fadeIn('slow');
}); });
}; };
imgIconEdit.src = DEFAULT_IMG_CONTENT_EDIT; imgIconEdit.src = DEFAULT_IMG_CONTENT_EDIT;
}; };
imgThumb.src = returnThumbnail(contId); imgThumb.src = returnThumbnail(contId);
break; break;
} }
} }
} }
} }
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 = resizeResourceThumbnail(imgThumb, c.width, c.height); var resizeImg = 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]);
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);
$("#loadingIcon" + contId).fadeOut('slow', function () { $("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow'); $('#content-thumbnail' + contId).fadeIn('slow');
}); });
}; };
imgIconEdit.src = DEFAULT_IMG_CONTENT_EDIT; imgIconEdit.src = DEFAULT_IMG_CONTENT_EDIT;
}; };
imgThumb.src = returnThumbnail(contId); imgThumb.src = returnThumbnail(contId);
break; break;
} }
} }
} }
} }
readFlg = false; readFlg = false;
} }
}; };
//draw Edit Image //draw Edit Image
function drawEditImage(id){ function drawEditImage(id){
var img = new Image(); var img = new Image();
img.src = returnThumbnail(id); img.src = returnThumbnail(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');
img.onload = function(){ img.onload = function(){
var resizeImg = resizeResourceThumbnail(img, c.width, c.height); var resizeImg = resizeResourceThumbnail(img, c.width, c.height);
ctx.drawImage(img, c.width / 2 - resizeImg[0] / 2, 0, resizeImg[0], resizeImg[1]); ctx.drawImage(img, c.width / 2 - resizeImg[0] / 2, 0, resizeImg[0], resizeImg[1]);
$("#loadingIcon" + id).fadeOut('slow', function () { $("#loadingIcon" + id).fadeOut('slow', function () {
$('#content-thumbnail' + id).fadeIn('slow'); $('#content-thumbnail' + id).fadeIn('slow');
}); });
}; };
}; };
//Search Function //Search Function
function searchEventButtonFunction(){ function searchEventButtonFunction(){
var fromPage = DEFAULT_DISP_NUMBER_RECORD_FROM; var fromPage = DEFAULT_DISP_NUMBER_RECORD_FROM;
var toPage = returnNumberDispRecordForList(); var toPage = returnNumberDispRecordForList();
var sortType = DEFAULT_SORT_TYPE; var sortType = DEFAULT_SORT_TYPE;
var sortOrder = DEFAULT_SORT_ORDER; var sortOrder = DEFAULT_SORT_ORDER;
var searchText = $('#txtSearch').val(); var searchText = $('#txtSearch').val();
var searchDivision; var searchDivision;
var content = $('#main-content').attr('checked'); var content = $('#main-content').attr('checked');
var tag = $('#main-tag').attr('checked'); var tag = $('#main-tag').attr('checked');
var body = $('#main-body').attr('checked'); var body = $('#main-body').attr('checked');
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();
} }
var genreId = ClientData.searchCond_genreId(); var genreId = ClientData.searchCond_genreId();
var groupId = ClientData.searchCond_groupId(); var groupId = ClientData.searchCond_groupId();
var sid = ClientData.userInfo_sid(); var sid = ClientData.userInfo_sid();
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
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
refreshGrid(); refreshGrid();
//Handle display sort //Handle display sort
handleSortDisp(); handleSortDisp();
if(searchText == '' || searchText == null){ if(searchText == '' || searchText == null){
displayResultNoRecord(); displayResultNoRecord();
chkSearchTextEmpty = true; chkSearchTextEmpty = true;
noRecordFlg = true; noRecordFlg = true;
reRenderPageNumber(0, 0); reRenderPageNumber(0, 0);
} }
else { else {
$('#msgSearchNotExist').hide(); $('#msgSearchNotExist').hide();
$('#control-nextrecord').css('visibility','hidden'); $('#control-nextrecord').css('visibility','hidden');
//Render Gridview //Render Gridview
chkSearchTextEmpty = false; chkSearchTextEmpty = false;
renderContent(sid, searchText, searchDivision, sortType, sortOrder, fromPage, toPage, genreId, groupId); renderContent(sid, searchText, searchDivision, sortType, sortOrder, fromPage, toPage, genreId, groupId);
//$('#control-nextrecord').css('visibility','visible'); //$('#control-nextrecord').css('visibility','visible');
} }
}; };
//Render User view date //Render User view date
function renderViewDate(id){ function renderViewDate(id){
for(var i = 0; i < ClientData.ReadingContentIds().length; i++){ for(var i = 0; i < ClientData.ReadingContentIds().length; i++){
if(ClientData.ReadingContentIds()[i].contentid == id){ if(ClientData.ReadingContentIds()[i].contentid == id){
return ClientData.ReadingContentIds()[i].viewdate; return ClientData.ReadingContentIds()[i].viewdate;
} }
} }
}; };
//set resource version data //set resource version data
function setResourceVersionData(conId){ function setResourceVersionData(conId){
var tempResourceArr; var tempResourceArr;
var tempResource; var tempResource;
//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();
} }
for(var i = 0; i < resourceVersionArr.length; i++){ for(var i = 0; i < resourceVersionArr.length; i++){
if(resourceVersionArr[i].contentid == conId){ if(resourceVersionArr[i].contentid == conId){
tempResource = resourceVersionArr[i].resourceversion; tempResource = resourceVersionArr[i].resourceversion;
break; break;
} }
} }
if(tempResourceArr.length > 0){ if(tempResourceArr.length > 0){
for(var j = 0; j < tempResourceArr.length; j++){ for(var j = 0; j < tempResourceArr.length; j++){
if(tempResourceArr[j].contentid == conId){ if(tempResourceArr[j].contentid == conId){
tempResourceArr[j].resourceversion = tempResource; tempResourceArr[j].resourceversion = tempResource;
flag = true; flag = true;
break; break;
} }
else{ else{
flag = false; flag = false;
} }
} }
if(!flag){ if(!flag){
tempResourceArr.push({contentid: conId, resourceversion: tempResource}); tempResourceArr.push({contentid: conId, resourceversion: tempResource});
} }
}else{ }else{
tempResourceArr.push({contentid: conId, resourceversion: tempResource}); tempResourceArr.push({contentid: conId, resourceversion: tempResource});
} }
ClientData.ResourceVersion(tempResourceArr); ClientData.ResourceVersion(tempResourceArr);
}; };
//set meta Version Data //set meta Version Data
function setMetaVersionData(conId){ function setMetaVersionData(conId){
var tempMetaArr; var tempMetaArr;
var tempMeta; var tempMeta;
//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();
} }
for(var i = 0; i < metaVersionArr.length; i++){ for(var i = 0; i < metaVersionArr.length; i++){
if(metaVersionArr[i].contentid == conId){ if(metaVersionArr[i].contentid == conId){
tempMeta = metaVersionArr[i].metaversion; tempMeta = metaVersionArr[i].metaversion;
break; break;
} }
} }
if(tempMetaArr.length > 0){ if(tempMetaArr.length > 0){
for(var j = 0; j < tempMetaArr.length; j++){ for(var j = 0; j < tempMetaArr.length; j++){
if(tempMetaArr[j].contentid == conId){ if(tempMetaArr[j].contentid == conId){
tempMetaArr[j].metaversion = tempMeta; tempMetaArr[j].metaversion = tempMeta;
flag = true; flag = true;
break; break;
} }
else{ else{
flag = false; flag = false;
} }
} }
if(!flag){ if(!flag){
tempMetaArr.push({contentid: conId, metaversion: tempMeta}); tempMetaArr.push({contentid: conId, metaversion: tempMeta});
} }
}else{ }else{
tempMetaArr.push({contentid: conId, metaversion: tempMeta}); tempMetaArr.push({contentid: conId, metaversion: tempMeta});
} }
ClientData.MetaVersion(tempMetaArr); ClientData.MetaVersion(tempMetaArr);
}; };
//handle display sort direction //handle display sort direction
function handleSortDisp(){ function handleSortDisp(){
$('#control-sort-title').removeClass('active_tops'); $('#control-sort-title').removeClass('active_tops');
$('#control-sort-titlekana').removeClass('active_tops'); $('#control-sort-titlekana').removeClass('active_tops');
$('#control-sort-releasedate').removeClass('active_tops'); $('#control-sort-releasedate').removeClass('active_tops');
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){
if(orderSort == Consts.ConstOrderSetting_Asc){ if(orderSort == Consts.ConstOrderSetting_Asc){
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#title-sorttype').html('▲'); $('#title-sorttype').html('▲');
$('#title-sorttype').css('width', '12px'); $('#title-sorttype').css('width', '12px');
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#rDate-sorttype').html(''); $('#rDate-sorttype').html('');
} }
else{ else{
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#title-sorttype').html('▼'); $('#title-sorttype').html('▼');
$('#title-sorttype').css('width', '12px'); $('#title-sorttype').css('width', '12px');
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#rDate-sorttype').html(''); $('#rDate-sorttype').html('');
} }
$('#control-sort-title').addClass('active_tops'); $('#control-sort-title').addClass('active_tops');
} }
else if(typeSort == 2){ else if(typeSort == 2){
if(orderSort == Consts.ConstOrderSetting_Asc){ if(orderSort == Consts.ConstOrderSetting_Asc){
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#titlekana-sorttype').html('▲'); $('#titlekana-sorttype').html('▲');
$('#titlekana-sorttype').css('width', '12px'); $('#titlekana-sorttype').css('width', '12px');
$('#rDate-sorttype').html(''); $('#rDate-sorttype').html('');
} }
else{ else{
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#titlekana-sorttype').html('▼'); $('#titlekana-sorttype').html('▼');
$('#titlekana-sorttype').css('width', '12px'); $('#titlekana-sorttype').css('width', '12px');
$('#rDate-sorttype').html(''); $('#rDate-sorttype').html('');
} }
$('#control-sort-titlekana').addClass('active_tops'); $('#control-sort-titlekana').addClass('active_tops');
} }
else if(typeSort == 3){ else if(typeSort == 3){
if(orderSort == Consts.ConstOrderSetting_Asc){ if(orderSort == Consts.ConstOrderSetting_Asc){
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#rDate-sorttype').html(''); $('#rDate-sorttype').html('');
$('#rDate-sorttype').html('▲'); $('#rDate-sorttype').html('▲');
$('#rDate-sorttype').css('width', '12px'); $('#rDate-sorttype').css('width', '12px');
} }
else{ else{
$('#title-sorttype').html(''); $('#title-sorttype').html('');
$('#titlekana-sorttype').html(''); $('#titlekana-sorttype').html('');
$('#rDate-sorttype').html(''); $('#rDate-sorttype').html('');
$('#rDate-sorttype').html('▼'); $('#rDate-sorttype').html('▼');
$('#rDate-sorttype').css('width', '12px'); $('#rDate-sorttype').css('width', '12px');
} }
$('#control-sort-releasedate').addClass('active_tops'); $('#control-sort-releasedate').addClass('active_tops');
} }
} }
} }
}; };
//convert delivery Date //convert delivery Date
function formatDeliveryDate(date){ function formatDeliveryDate(date){
var day = date.date; var day = date.date;
var month = eval(date.month) + 1; var month = eval(date.month) + 1;
var year = eval(date.year) + 1900; var year = eval(date.year) + 1900;
var outputDate = year + '/' + ((''+month).length<2 ? '0' : '') + month + '/' + ((''+day).length<2 ? '0' : '') + day; var outputDate = year + '/' + ((''+month).length<2 ? '0' : '') + month + '/' + ((''+day).length<2 ? '0' : '') + day;
return outputDate; return outputDate;
}; };
//convert view Date //convert view Date
function formatNormalDate(day, month, year){ function formatNormalDate(day, month, year){
var outputDate = year + '/' + ((''+month).length<2 ? '0' : '') + month + '/' + ((''+day).length<2 ? '0' : '') + day; var outputDate = year + '/' + ((''+month).length<2 ? '0' : '') + month + '/' + ((''+day).length<2 ? '0' : '') + day;
return outputDate; return outputDate;
}; };
//format Image string //format Image string
function formatStringBase64(imgStr){ function formatStringBase64(imgStr){
var outputString = 'data:image/jpeg;base64,'+imgStr; var outputString = 'data:image/jpeg;base64,'+imgStr;
return outputString; return outputString;
}; };
//function Open SubMenu Dialog //function Open SubMenu Dialog
function titleClickFunction(e){ function titleClickFunction(e){
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
} }
if (home_isMove == true) { if (home_isMove == true) {
home_isMove = false; home_isMove = false;
return; return;
} }
var checkflag = false; var checkflag = false;
var contentid = $(this).attr('contentid'); var contentid = $(this).attr('contentid');
// Get image of selected image // Get image of selected image
var base64String = returnThumbnail(contentid); var base64String = returnThumbnail(contentid);
ClientData.contentInfo_contentThumbnail(base64String); ClientData.contentInfo_contentThumbnail(base64String);
ClientData.contentInfo_contentId(contentid); ClientData.contentInfo_contentId(contentid);
//Store Content id that user has read //Store Content id that user has read
if(ClientData.ReadingContentIds().length > 0){ if(ClientData.ReadingContentIds().length > 0){
contentIdArray = ClientData.ReadingContentIds(); contentIdArray = ClientData.ReadingContentIds();
for(var nIndex = 0; nIndex < contentIdArray.length; nIndex++){ for(var nIndex = 0; nIndex < contentIdArray.length; nIndex++){
if(contentIdArray[nIndex].contentid == contentid){ if(contentIdArray[nIndex].contentid == contentid){
checkflag = true; checkflag = true;
break; break;
} }
else{ else{
checkflag = false; checkflag = false;
} }
} }
if(!checkflag){ if(!checkflag){
contentIdArray.push({contentid: contentid, viewdate: '', originviewdate: ''}); contentIdArray.push({contentid: contentid, viewdate: '', originviewdate: ''});
} }
} }
else{ else{
contentIdArray.push({contentid: contentid, viewdate: '', originviewdate: ''}); 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(contentIdArray); ClientData.ReadingContentIds(contentIdArray);
//Set ResouceVersion for content //Set ResouceVersion for content
setResourceVersionData(contentid); setResourceVersionData(contentid);
//Set MetaVersion for content //Set MetaVersion for content
setMetaVersionData(contentid); setMetaVersionData(contentid);
//Close Submenu //Close Submenu
$('#dlgSubMenu').hide(); $('#dlgSubMenu').hide();
//Delete 'new' icon //Delete 'new' icon
drawEditImage(contentid); drawEditImage(contentid);
//Open content Detail //Open content Detail
openContentDetail(); openContentDetail();
}; };
//Get Number Disp Record For List //Get Number Disp Record For List
function returnNumberDispRecordForList() { function returnNumberDispRecordForList() {
var toPage = 0; var toPage = 0;
var sysSettings = avwSysSetting(); var sysSettings = avwSysSetting();
toPage = sysSettings.bookListCount; toPage = sysSettings.bookListCount;
return toPage; return toPage;
}; };
//Get number record disp next for list //Get number record disp next for list
function getNextRecordNumForList(){ function getNextRecordNumForList(){
iNumberOfNextRecord = returnNumberDispRecordForList(); iNumberOfNextRecord = returnNumberDispRecordForList();
}; };
//refresh sort order //refresh sort order
function refreshSortTypeOrder(){ function refreshSortTypeOrder(){
$('#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
function refreshGrid(){ function refreshGrid(){
$('#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
function formatDisplayMoreRecord(){ function formatDisplayMoreRecord(){
i18nReplaceText(); i18nReplaceText();
//changeLanguage(ClientData.userInfo_language()); //changeLanguage(ClientData.userInfo_language());
$('#control-nextrecord').html(format(i18nText('dspViewMore'), returnNumberDispRecordForList())); $('#control-nextrecord').html(format(i18nText('dspViewMore'), returnNumberDispRecordForList()));
}; };
function changeLanguageCallBackFunction(){ function changeLanguageCallBackFunction(){
handleLanguage(); handleLanguage();
formatDisplayMoreRecord(); formatDisplayMoreRecord();
if(chkSearchTextEmpty){ if(chkSearchTextEmpty){
displayResultNoRecord(); displayResultNoRecord();
} else { } else {
$('#control-nextrecord').css('visibility','visible'); $('#control-nextrecord').css('visibility','visible');
enableSort(); enableSort();
} }
document.title = i18nText('txtSearchResult') + ' | ' + i18nText('sysAppTitle'); document.title = i18nText('txtSearchResult') + ' | ' + i18nText('sysAppTitle');
}; };
function displayResultNoRecord(){ function displayResultNoRecord(){
i18nReplaceText(); i18nReplaceText();
//$('#content-grid').html(i18nText('msgSearchNotExist')); //$('#content-grid').html(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(getCurrentLanguage() == Consts.ConstLanguage_En || getCurrentLanguage() == Consts.ConstLanguage_Ko){ if(getCurrentLanguage() == Consts.ConstLanguage_En || getCurrentLanguage() == Consts.ConstLanguage_Ko){
$('#label-sort-titlekana').hide(); $('#label-sort-titlekana').hide();
$('#separate').hide(); $('#separate').hide();
} }
}; };
function enableSort(){ function enableSort(){
$('.control_sort_on').show(); $('.control_sort_on').show();
$('.control_sort_off').hide(); $('.control_sort_off').hide();
if(getCurrentLanguage() == Consts.ConstLanguage_En || getCurrentLanguage() == Consts.ConstLanguage_Ko){ if(getCurrentLanguage() == Consts.ConstLanguage_En || getCurrentLanguage() == Consts.ConstLanguage_Ko){
$('#control-sort-titlekana').hide(); $('#control-sort-titlekana').hide();
$('#separate').hide(); $('#separate').hide();
} }
}; };
function truncate(strInput, length){ function truncate(strInput, length){
if (strInput.length <= length) if (strInput.length <= length)
{ {
return strInput; return strInput;
} }
else else
{ {
return strInput.substring(0, length) + "..."; return strInput.substring(0, length) + "...";
} }
}; };
function resizeResourceThumbnail(mg, width, height) { function resizeResourceThumbnail(mg, width, height) {
var newWidth; var newWidth;
var newHeight; var newHeight;
if(mg.width > mg.height) { if(mg.width > mg.height) {
newWidth = width; newWidth = width;
newHeight = (mg.height * width)/mg.width; newHeight = (mg.height * width)/mg.width;
} }
else { else {
newHeight = height; newHeight = height;
newWidth = (mg.width * height)/mg.height; newWidth = (mg.width * height)/mg.height;
} }
var result = [newWidth, newHeight]; var result = [newWidth, newHeight];
return result; return result;
}; };
function removeHoverCss(){ function removeHoverCss(){
if(isTouchDevice()){ if(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');
} }
}; };
\ No newline at end of file
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