Commit 3e6d7f8e by Masaru Abe

リファクタリング

parent 8a2f2848
...@@ -4,41 +4,23 @@ var CONTENTSEARCH = {}; ...@@ -4,41 +4,23 @@ var CONTENTSEARCH = {};
//Start Declare Variables //Start Declare Variables
//----Constant-----------// //----Constant-----------//
var DEFAULT_DISP_NUMBER_RECORD_FROM = 1; CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM = 1;
var DEFAULT_DISP_NUMBER_RECORD_TO = 15; //CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_TO = 15;
var DEFAULT_SORT_TYPE = '1'; CONTENTSEARCH.DEFAULT_SORT_TYPE = '1';
var DEFAULT_SORT_ORDER = '1'; CONTENTSEARCH.DEFAULT_SORT_ORDER = '1';
var DEFAULT_SEARCH_DIVISION = 0; //CONTENTSEARCH.DEFAULT_SEARCH_DIVISION = 0;
//var DEFAULT_IMG_OPTION_MEMO = 'img/list/icon_sticker.png'; CONTENTSEARCH.iNumberOfNextRecord = 15;
//var DEFAULT_IMG_OPTION_MARKING = 'img/list/icon_pen.png';
//var DEFAULT_IMG_CONTENT_EDIT = 'img/common/band_updated.png';
//var DEFAULT_IMG_CONTENT_NEW = 'img/common/band_new.png';
var iNumberOfNextRecord = 15;
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Create new Array for function No.12.
//Thumbnail array //Thumbnail array
var thumbnailArr = []; CONTENTSEARCH.thumbnailArr = [];
//Content type array. //Content type array.
var contentTypeArr = []; CONTENTSEARCH.contentTypeArr = [];
CONTENTSEARCH.contentIdArray = [];
//var ThumbnailForOtherType = {
// Thumbnail_ImageType : 'img/image_type.png', CONTENTSEARCH.totalPage;
// Thumbnail_VideoType : 'img/iPad_video.png', CONTENTSEARCH.chkSearchTextEmpty = false;
// Thumbnail_MusicType : 'img/thumb_default_sound.png', CONTENTSEARCH.noRecordFlg = false;
// Thumbnail_OthersType : 'img/thumb_default_other.png', CONTENTSEARCH.home_isMove = false;
// Thumbnail_NoFileType : 'img/thumb_default_none.png',
// Thumbnail_HtmlType : 'img/thumb_default_html.png',
// Thumbnail_LinkType : 'img/thumb_default_link.png',
//};
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Create new Array for function No.12.
var contentIdArray = [];
//var resourceVersionArr = [];
//var metaVersionArr = [];
var totalPage;
var chkSearchTextEmpty = false;
var noRecordFlg = false;
var home_isMove = false;
$(document).ready(function(){ $(document).ready(function(){
...@@ -56,61 +38,61 @@ $(document).ready(function(){ ...@@ -56,61 +38,61 @@ $(document).ready(function(){
//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(); CONTENTSEARCH.formatDisplayMoreRecord();
//remove hover effect when is touch device //remove hover effect when is touch device
removeHoverCss(); CONTENTSEARCH.removeHoverCss();
//InitScreen //InitScreen
initialScreen(); CONTENTSEARCH.initialScreen();
//Render Grid //Render Grid
renderGridView(); CONTENTSEARCH.renderGridView();
//Go To Details Page //Go To Details Page
$('canvas').live('click', canvasClickFunction); $('canvas').live('click', CONTENTSEARCH.canvasClickFunction);
//$('canvas').live('touchstart', canvasClickFunction); //$('canvas').live('touchstart', CONTENTSEARCH.canvasClickFunction);
$('canvas').live('touchend', canvasClickFunction); $('canvas').live('touchend', CONTENTSEARCH.canvasClickFunction);
$('canvas').live('touchmove', function () { home_isMove = true; }); $('canvas').live('touchmove', function () { CONTENTSEARCH.home_isMove = true; });
//Open dialog //Open dialog
$('.dialog').live('click', titleClickFunction); $('.dialog').live('click', CONTENTSEARCH.titleClickFunction);
//$('.dialog').live('touchstart', titleClickFunction); //$('.dialog').live('touchstart', CONTENTSEARCH.titleClickFunction);
$('.dialog').live('touchend', titleClickFunction); $('.dialog').live('touchend', CONTENTSEARCH.titleClickFunction);
$('.dialog').live('touchmove', function () { home_isMove = true; }); $('.dialog').live('touchmove', function () { CONTENTSEARCH.home_isMove = true; });
//Show Next Record //Show Next Record
$('a#control-nextrecord').click(showNextRecordFunction); $('a#control-nextrecord').click(CONTENTSEARCH.showNextRecordFunction);
//Sort Title //Sort Title
$('#control-sort-title').click(sortByTitleFunction); $('#control-sort-title').click(CONTENTSEARCH.sortByTitleFunction);
//Sort by title kana //Sort by title kana
$('#control-sort-titlekana').click(sortByTitleKanaFunction); $('#control-sort-titlekana').click(CONTENTSEARCH.sortByTitleKanaFunction);
//sort by release date //sort by release date
$('#control-sort-releasedate').click(sortByReleaseDateFunction); $('#control-sort-releasedate').click(CONTENTSEARCH.sortByReleaseDateFunction);
//Go To Details Page //Go To Details Page
$('.button-details').live('click', readSubmenuFunction); $('.button-details').live('click', CONTENTSEARCH.readSubmenuFunction);
//$('.button-details').live('touchstart', readSubmenuFunction); //$('.button-details').live('touchstart', CONTENTSEARCH.readSubmenuFunction);
$('.button-details').live('touchend', readSubmenuFunction); $('.button-details').live('touchend', CONTENTSEARCH.readSubmenuFunction);
$('.button-details').live('touchmove', function () { 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 () { home_isMove = true; }); $('.button-share').live('touchmove', function () { CONTENTSEARCH.home_isMove = true; });
$('#main-search').click(searchEventButtonFunction); $('#main-search').click(CONTENTSEARCH.searchEventButtonFunction);
$('#txtSearch').keydown(mainSearchKeyDownFunction); $('#txtSearch').keydown(CONTENTSEARCH.mainSearchKeyDownFunction);
$('#main-search-content').click(mainSearchContentClickFunction); $('#main-search-content').click(CONTENTSEARCH.mainSearchContentClickFunction);
$('#main-search-tag').click(mainSearchTagClickFunction); $('#main-search-tag').click(CONTENTSEARCH.mainSearchTagClickFunction);
$('#main-search-body').click(mainSearchBodyClickFunction); $('#main-search-body').click(CONTENTSEARCH.mainSearchBodyClickFunction);
$('#control-nextrecord').css('visibility', 'hidden'); $('#control-nextrecord').css('visibility', 'hidden');
...@@ -145,26 +127,26 @@ $(document).ready(function(){ ...@@ -145,26 +127,26 @@ $(document).ready(function(){
}); });
function mainSearchBodyClickFunction(){ 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');
}; };
function mainSearchTagClickFunction(){ 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');
}; };
function mainSearchContentClickFunction(){ 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');
}; };
function mainSearchKeyDownFunction(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();
...@@ -172,12 +154,12 @@ function mainSearchKeyDownFunction(e){ ...@@ -172,12 +154,12 @@ function mainSearchKeyDownFunction(e){
}; };
//Call API //Call API
function abapi(name, param, method, callback){ CONTENTSEARCH.abapi = function(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(){ CONTENTSEARCH.initialScreen = function(){
var searchText = ClientData.searchCond_searchText(); var searchText = ClientData.searchCond_searchText();
var searchDivision = ClientData.searchCond_searchDivision(); var searchDivision = ClientData.searchCond_searchDivision();
...@@ -201,11 +183,11 @@ function initialScreen(){ ...@@ -201,11 +183,11 @@ function initialScreen(){
$('#main-body').attr('checked','checked'); $('#main-body').attr('checked','checked');
} }
handleLanguage(); CONTENTSEARCH.handleLanguage();
}; };
///Render Content ///Render Content
function renderContent(id, text, division, type, order, from, to, cateid, grpid){ CONTENTSEARCH.renderContent = function(id, text, division, type, order, from, to, cateid, grpid){
var params = { var params = {
sid: id, sid: id,
searchText: text, searchText: text,
...@@ -218,7 +200,7 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid) ...@@ -218,7 +200,7 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid)
groupId: grpid groupId: grpid
}; };
abapi('webContentList', params, 'POST', function (data) { CONTENTSEARCH.abapi('webContentList', params, 'POST', function (data) {
$.each(data.contentList, function (i, post) { $.each(data.contentList, function (i, post) {
var outputDate =""; var outputDate ="";
...@@ -262,7 +244,7 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid) ...@@ -262,7 +244,7 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid)
$('#content-grid').append(htmlTemp); $('#content-grid').append(htmlTemp);
getNextRecordNumForList(); CONTENTSEARCH.getNextRecordNumForList();
//assign thumbnail to array //assign thumbnail to array
var formatThumbnail = post.contentThumbnail; var formatThumbnail = post.contentThumbnail;
...@@ -270,18 +252,18 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid) ...@@ -270,18 +252,18 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid)
formatThumbnail = COMMON.formatStringBase64(formatThumbnail); formatThumbnail = COMMON.formatStringBase64(formatThumbnail);
} }
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. //Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type to array to manage.
//assign content type to array //assign content type to array
contentTypeArr.push({ contentId: post.contentId, contentType: post.contentType }); CONTENTSEARCH.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. //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
messageLevel[post.contentId] = { alertMessageLevel:post.alertMessageLevel, alertMessage:post.alertMessage}; 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.
checkUserHasReadContent(post.contentId, post.resourceVersion, post.metaVersion); CONTENTSEARCH.checkUserHasReadContent(post.contentId, post.resourceVersion, post.metaVersion);
//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 });
...@@ -290,17 +272,17 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid) ...@@ -290,17 +272,17 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid)
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
checkContentMarkingMemoOption(post.contentId); CONTENTSEARCH.checkContentMarkingMemoOption(post.contentId);
//renderViewDate //renderViewDate
var viewdate = renderViewDate(post.contentId); var viewdate = CONTENTSEARCH.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(); CONTENTSEARCH.getNextRecordNumForList();
if(data.totalRecord < data.recordTo){ if(data.totalRecord < data.recordTo){
ClientData.searchCond_recordTo(data.totalRecord); ClientData.searchCond_recordTo(data.totalRecord);
...@@ -309,18 +291,18 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid) ...@@ -309,18 +291,18 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid)
} }
ClientData.searchCond_recordFrom(data.recordFrom); ClientData.searchCond_recordFrom(data.recordFrom);
totalPage = data.totalRecord; CONTENTSEARCH.totalPage = data.totalRecord;
//Render Page number //Render Page number
if(totalPage == 0){ if(CONTENTSEARCH.totalPage == 0){
reRenderPageNumber(totalPage, totalPage); CONTENTSEARCH.reRenderPageNumber(CONTENTSEARCH.totalPage, CONTENTSEARCH.totalPage);
} }
else{ else{
reRenderPageNumber(ClientData.searchCond_recordTo(), totalPage); CONTENTSEARCH.reRenderPageNumber(ClientData.searchCond_recordTo(), CONTENTSEARCH.totalPage);
} }
//Toggle scroll to top Control //Toggle scroll to top Control
handleBackToTop(); CONTENTSEARCH.handleBackToTop();
//changeLanguage(ClientData.userInfo_language()); //changeLanguage(ClientData.userInfo_language());
I18N.i18nReplaceText(); I18N.i18nReplaceText();
...@@ -328,32 +310,31 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid) ...@@ -328,32 +310,31 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid)
}; };
//Handle Back To Top Button //Handle Back To Top Button
function handleBackToTop(){ CONTENTSEARCH.handleBackToTop = function(){
if(ClientData.searchCond_recordTo() >= 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(totalPage == 0){ if(CONTENTSEARCH.totalPage == 0){
$('#control-nextrecord').css('visibility','hidden'); $('#control-nextrecord').css('visibility','hidden');
displayResultNoRecord(); CONTENTSEARCH.displayResultNoRecord();
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');
enableSort(); CONTENTSEARCH.enableSort();
noRecordFlg = false; CONTENTSEARCH.noRecordFlg = false;
} }
}; };
//Handle language //Handle language
function handleLanguage(){ CONTENTSEARCH.handleLanguage = function(){
//if(ClientData.userInfo_language() == COMMON.Consts.ConstLanguage_En || ClientData.userInfo_language() == COMMON.Consts.ConstLanguage_Ko)
if (getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko) if (getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko)
{ {
$('#control-sort-titlekana').css('display','none'); $('#control-sort-titlekana').css('display','none');
...@@ -365,21 +346,9 @@ function handleLanguage(){ ...@@ -365,21 +346,9 @@ function handleLanguage(){
var typeSort = ClientData.searchCond_sortType(); var typeSort = ClientData.searchCond_sortType();
var orderSort = ClientData.searchCond_sortOrder(); var orderSort = ClientData.searchCond_sortOrder();
// if (typeSort == 2) {
// if (orderSort == COMMON.Consts.ConstOrderSetting_Asc) {
// $('#titlekana-sorttype').html('');
// $('#titlekana-sorttype').html('▲');
// $('#titlekana-sorttype').css('width', '12px');
// }
// else {
// $('#titlekana-sorttype').html('');
// $('#titlekana-sorttype').html('▼');
// $('#titlekana-sorttype').css('width', '12px');
// }
// }
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(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{
...@@ -390,12 +359,12 @@ function handleLanguage(){ ...@@ -390,12 +359,12 @@ function handleLanguage(){
}; };
//Initial Screen //Initial Screen
function renderGridView(){ CONTENTSEARCH.renderGridView = function(){
var fromPage = DEFAULT_DISP_NUMBER_RECORD_FROM; var fromPage = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
var toPage = returnNumberDispRecordForList(); var toPage = CONTENTSEARCH.returnNumberDispRecordForList();
var sortType = DEFAULT_SORT_TYPE; var sortType = CONTENTSEARCH.DEFAULT_SORT_TYPE;
var sortOrder = 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();
...@@ -418,25 +387,25 @@ function renderGridView(){ ...@@ -418,25 +387,25 @@ function renderGridView(){
var groupId = ClientData.searchCond_groupId(); var groupId = ClientData.searchCond_groupId();
//Handle display sort //Handle display sort
handleSortDisp(); CONTENTSEARCH.handleSortDisp();
//Language Handle //Language Handle
handleLanguage(); CONTENTSEARCH.handleLanguage();
//Refresh GridView //Refresh GridView
refreshGrid(); CONTENTSEARCH.refreshGrid();
if(searchText == '' || searchText == null){ if(searchText == '' || searchText == null){
displayResultNoRecord(); CONTENTSEARCH.displayResultNoRecord();
chkSearchTextEmpty = true; CONTENTSEARCH.chkSearchTextEmpty = true;
noRecordFlg = true; CONTENTSEARCH.noRecordFlg = true;
reRenderPageNumber(0, 0); CONTENTSEARCH.reRenderPageNumber(0, 0);
} }
else { else {
$('#msgSearchNotExist').hide(); $('#msgSearchNotExist').hide();
chkSearchTextEmpty = false; CONTENTSEARCH.chkSearchTextEmpty = false;
//Render Gridview //Render Gridview
renderContent(sid, searchText, searchDivision, sortType, sortOrder, fromPage, toPage, genreId, groupId); CONTENTSEARCH.renderContent(sid, searchText, searchDivision, sortType, sortOrder, fromPage, toPage, genreId, groupId);
$('#control-nextrecord').css('visibility','visible'); $('#control-nextrecord').css('visibility','visible');
} }
...@@ -444,13 +413,13 @@ function renderGridView(){ ...@@ -444,13 +413,13 @@ function renderGridView(){
}; };
//Canvas Click function //Canvas Click function
function canvasClickFunction(e){ CONTENTSEARCH.canvasClickFunction = function(e){
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
} }
if (home_isMove == true) { if (CONTENTSEARCH.home_isMove == true) {
home_isMove = false; CONTENTSEARCH.home_isMove = false;
return; return;
} }
...@@ -462,20 +431,20 @@ function canvasClickFunction(e){ ...@@ -462,20 +431,20 @@ function canvasClickFunction(e){
ClientData.contentInfo_contentId(outputId); ClientData.contentInfo_contentId(outputId);
// Get image of selected image // Get image of selected image
var base64String = 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. //Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type of content.
var contentType = 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. //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){ if(ClientData.ReadingContentIds().length > 0){
contentIdArray = ClientData.ReadingContentIds(); CONTENTSEARCH.contentIdArray = ClientData.ReadingContentIds();
for(var nIndex = 0; nIndex < contentIdArray.length; nIndex++){ for(var nIndex = 0; nIndex < CONTENTSEARCH.contentIdArray.length; nIndex++){
if(contentIdArray[nIndex].contentid == outputId){ if(CONTENTSEARCH.contentIdArray[nIndex].contentid == outputId){
checkflag = true; checkflag = true;
break; break;
} }
...@@ -485,11 +454,11 @@ function canvasClickFunction(e){ ...@@ -485,11 +454,11 @@ function canvasClickFunction(e){
} }
if(!checkflag){ if(!checkflag){
contentIdArray.push({contentid: outputId, viewdate: '', originviewdate: ''}); CONTENTSEARCH.contentIdArray.push({contentid: outputId, viewdate: '', originviewdate: ''});
} }
} }
else{ else{
contentIdArray.push({contentid: outputId, viewdate: '', originviewdate: ''}); CONTENTSEARCH.contentIdArray.push({contentid: outputId, viewdate: '', originviewdate: ''});
} }
//Renew ReadingContentID //Renew ReadingContentID
...@@ -497,7 +466,7 @@ function canvasClickFunction(e){ ...@@ -497,7 +466,7 @@ function canvasClickFunction(e){
ClientData.ReadingContentIds(newArray); ClientData.ReadingContentIds(newArray);
//Set data for readingcontentid //Set data for readingcontentid
ClientData.ReadingContentIds(contentIdArray); ClientData.ReadingContentIds(CONTENTSEARCH.contentIdArray);
//Set ResouceVersion for content //Set ResouceVersion for content
COMMON.setResourceVersionData(outputId); COMMON.setResourceVersionData(outputId);
...@@ -509,14 +478,14 @@ function canvasClickFunction(e){ ...@@ -509,14 +478,14 @@ function canvasClickFunction(e){
$('#dlgSubMenu').hide(); $('#dlgSubMenu').hide();
//Delete 'new' icon //Delete 'new' icon
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
function reRenderPageNumber(dispRecord, dispTotal){ CONTENTSEARCH.reRenderPageNumber = function(dispRecord, dispTotal){
if( dispTotal ){ if( dispTotal ){
$('#dispPage').html(dispRecord); $('#dispPage').html(dispRecord);
...@@ -533,7 +502,7 @@ function reRenderPageNumber(dispRecord, dispTotal){ ...@@ -533,7 +502,7 @@ function reRenderPageNumber(dispRecord, dispTotal){
}; };
//Show Next Record Function //Show Next Record Function
function showNextRecordFunction(){ 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();
...@@ -543,26 +512,26 @@ function showNextRecordFunction(){ ...@@ -543,26 +512,26 @@ function showNextRecordFunction(){
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 = CONTENTSEARCH.totalPage;
if(fromPage == null || fromPage == 'undefined'){ if(fromPage == null || fromPage == 'undefined'){
fromPage = DEFAULT_DISP_NUMBER_RECORD_FROM; fromPage = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
} }
if(toPage == null || toPage == 'undefined'){ if(toPage == null || toPage == 'undefined'){
toPage = returnNumberDispRecordForList(); toPage = CONTENTSEARCH.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 < CONTENTSEARCH.iNumberOfNextRecord)
{ {
toPage = eval(fromPage) + eval(iRecordNumber); toPage = eval(fromPage) + eval(iRecordNumber);
} }
else else
{ {
toPage = eval(fromPage) + (eval(iNumberOfNextRecord) - 1); toPage = eval(fromPage) + (eval(CONTENTSEARCH.iNumberOfNextRecord) - 1);
} }
ClientData.searchCond_recordFrom(fromPage); ClientData.searchCond_recordFrom(fromPage);
...@@ -570,21 +539,17 @@ function showNextRecordFunction(){ ...@@ -570,21 +539,17 @@ function showNextRecordFunction(){
if(fromPage <= totalrecord) if(fromPage <= totalrecord)
{ {
renderContent(sid, searchText, searchDivision, sortType, sortOrder, fromPage, toPage, genreId, groupId); CONTENTSEARCH.renderContent(sid, searchText, searchDivision, sortType, sortOrder, fromPage, toPage, genreId, groupId);
} }
}; };
//Sort By Title Function //Sort By Title Function
function sortByTitleFunction(){ CONTENTSEARCH.sortByTitleFunction = function(){
// $(this).addClass('active_tops');
// $('#control-sort-titlekana').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 = 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();
...@@ -593,43 +558,28 @@ function sortByTitleFunction(){ ...@@ -593,43 +558,28 @@ function sortByTitleFunction(){
{ {
if(sortType == '1'){ if(sortType == '1'){
sortOrder = COMMON.Consts.ConstOrderSetting_Desc; sortOrder = COMMON.Consts.ConstOrderSetting_Desc;
// $('#title-sorttype').html('');
// $('#title-sorttype').html('▼');
// $('#title-sorttype').css('width', '12px');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
} }
else{ else{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
// $('#title-sorttype').html('');
// $('#title-sorttype').html('▲');
// $('#title-sorttype').css('width', '12px');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
} }
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
else else
{ {
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
// $('#title-sorttype').html('');
// $('#title-sorttype').html('▲');
// $('#title-sorttype').css('width', '12px');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
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'){ if(recordFrom == null || recordFrom == 'undefined'){
recordFrom = 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 = returnNumberDispRecordForList(); recordTo = CONTENTSEARCH.returnNumberDispRecordForList();
ClientData.searchCond_recordFrom(recordTo); ClientData.searchCond_recordFrom(recordTo);
} }
...@@ -637,26 +587,21 @@ function sortByTitleFunction(){ ...@@ -637,26 +587,21 @@ function sortByTitleFunction(){
ClientData.searchCond_sortType(sortType); ClientData.searchCond_sortType(sortType);
//refresh Gridview //refresh Gridview
refreshGrid(); CONTENTSEARCH.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); CONTENTSEARCH.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(){ CONTENTSEARCH.sortByTitleKanaFunction = function(){
// $(this).addClass('active_tops');
// $('#control-sort-title').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 = 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();
...@@ -664,51 +609,36 @@ function sortByTitleKanaFunction(){ ...@@ -664,51 +609,36 @@ function sortByTitleKanaFunction(){
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;
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#titlekana-sorttype').html('▼');
// $('#titlekana-sorttype').css('width', '12px');
// $('#rDate-sorttype').html('');
} }
else{ else{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#titlekana-sorttype').html('▲');
// $('#titlekana-sorttype').css('width', '12px');
// $('#rDate-sorttype').html('');
} }
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
else else
{ {
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#titlekana-sorttype').html('▲');
// $('#titlekana-sorttype').css('width', '12px');
// $('#rDate-sorttype').html('');
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'){ if(recordFrom == null || recordFrom == 'undefined'){
recordFrom = 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 = returnNumberDispRecordForList(); recordTo = CONTENTSEARCH.returnNumberDispRecordForList();
ClientData.searchCond_recordFrom(recordTo); ClientData.searchCond_recordFrom(recordTo);
} }
sortType = '2'; sortType = '2';
//refresh gridview //refresh gridview
refreshGrid(); CONTENTSEARCH.refreshGrid();
//refresh add more record //refresh add more record
...@@ -716,20 +646,16 @@ function sortByTitleKanaFunction(){ ...@@ -716,20 +646,16 @@ function sortByTitleKanaFunction(){
ClientData.searchCond_sortType(sortType); ClientData.searchCond_sortType(sortType);
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, recordFrom, recordTo, genreId, groupId);
}; };
//Sort By Release Date //Sort By Release Date
function sortByReleaseDateFunction(){ CONTENTSEARCH.sortByReleaseDateFunction = function(){
// $(this).addClass('active_tops');
// $('#control-sort-title').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 = 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();
...@@ -737,135 +663,77 @@ function sortByReleaseDateFunction(){ ...@@ -737,135 +663,77 @@ function sortByReleaseDateFunction(){
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;
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
// $('#rDate-sorttype').html('▼');
// $('#rDate-sorttype').css('width', '12px');
} }
else{ else{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
// $('#rDate-sorttype').html('▲');
// $('#rDate-sorttype').css('width', '12px');
} }
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
else else
{ {
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
// $('#rDate-sorttype').html('▲');
// $('#rDate-sorttype').css('width', '12px');
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 = 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 = returnNumberDispRecordForList(); recordTo = CONTENTSEARCH.returnNumberDispRecordForList();
ClientData.searchCond_recordFrom(recordTo); ClientData.searchCond_recordFrom(recordTo);
} }
sortType = '3'; sortType = '3';
//refresh gridview //refresh gridview
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);
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, recordFrom, recordTo, genreId, groupId);
}; };
//Get Thumnail base on contentid //Get Thumnail base on contentid
function returnThumbnail(contentid){ CONTENTSEARCH.returnThumbnail = function(contentid){
for(var i = 0; i < thumbnailArr.length; i++){ for(var i = 0; i < CONTENTSEARCH.thumbnailArr.length; i++){
if(thumbnailArr[i].contentId == contentid){ if(CONTENTSEARCH.thumbnailArr[i].contentId == contentid){
return 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. //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
function returnContentType(contentid){ CONTENTSEARCH.returnContentType = function(contentid){
//Array Length //Array Length
var iArrCnt = 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 (contentTypeArr[i].contentId == contentid) { if (CONTENTSEARCH.contentTypeArr[i].contentId == contentid) {
return contentTypeArr[i].contentType; return CONTENTSEARCH.contentTypeArr[i].contentType;
} }
} }
}; };
////Get resource Id of content
//function downloadResourceById(contentId){
// var params = {
// sid: ClientData.userInfo_sid(),
// contentId: contentId,
// getType: '2',
// };
//
// var resourceUrl;
//
// abapi('webGetContent', params, 'GET', function (data) {
// var resourceId;
//
// $.each(data.contentData , function(i, n){
// if(typeof n == "object"){
// resourceId = n.resourceId;
// }
// });
//
// //Get resource
// resourceUrl = getResourceByIdFromAPI(resourceId);
//
// window.open(resourceUrl, "_blank");
// // redraw content remove new icon
// drawEditImage(contentId);
//
// });
//};
////Download resource
//function getResourceByIdFromAPI(resourceId){
// return getURL("webResourceDownload") + "/?sid=" + ClientData.userInfo_sid() + "&resourceId=" + resourceId + "&isDownload=true";
//};
///* get url */
//function getURL(apiName) {
// var sysSettings = avwSysSetting();
// var url = sysSettings.apiResourceDlUrl;
// url = AVWEB.format(url, ClientData.userInfo_accountPath()) + '/' + apiName;
// return url;
//};
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Create new function to return content type of content. //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 //Dialog Read Button CLick
function readSubmenuFunction(e){ CONTENTSEARCH.readSubmenuFunction = function(e){
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
} }
if (home_isMove == true) { if (CONTENTSEARCH.home_isMove == true) {
home_isMove = false; CONTENTSEARCH.home_isMove = false;
return; return;
} }
var contentId = $(this).attr('contentid'); var contentId = $(this).attr('contentid');
...@@ -873,7 +741,7 @@ function readSubmenuFunction(e){ ...@@ -873,7 +741,7 @@ function readSubmenuFunction(e){
checkLimitContent(contentId, checkLimitContent(contentId,
function() function()
{ {
readSubmenuFunction_callback(contentId); CONTENTSEARCH.readSubmenuFunction_callback(contentId);
}, },
function(){ function(){
} }
...@@ -882,9 +750,9 @@ function readSubmenuFunction(e){ ...@@ -882,9 +750,9 @@ function readSubmenuFunction(e){
}; };
// read content callback // read content callback
function readSubmenuFunction_callback(contentId) CONTENTSEARCH.readSubmenuFunction_callback = function(contentId)
{ {
var contentThumbnail = 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();
...@@ -895,7 +763,7 @@ function readSubmenuFunction_callback(contentId) ...@@ -895,7 +763,7 @@ function readSubmenuFunction_callback(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. //Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type of content.
var contentType = 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. //End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type of content.
...@@ -903,14 +771,14 @@ function readSubmenuFunction_callback(contentId) ...@@ -903,14 +771,14 @@ function readSubmenuFunction_callback(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(); CONTENTSEARCH.contentIdArray = ClientData.ReadingContentIds();
for(var nIndex = 0; nIndex < contentIdArray.length; nIndex++){ for(var nIndex = 0; nIndex < CONTENTSEARCH.contentIdArray.length; nIndex++){
if(contentIdArray[nIndex].contentid == contentId){ if(CONTENTSEARCH.contentIdArray[nIndex].contentid == contentId){
checkflag = true; checkflag = true;
if(contentIdArray[nIndex].viewdate == null || contentIdArray[nIndex].viewdate == 'undefined' || contentIdArray[nIndex].viewdate == ''){ if(CONTENTSEARCH.contentIdArray[nIndex].viewdate == null || CONTENTSEARCH.contentIdArray[nIndex].viewdate == 'undefined' || CONTENTSEARCH.contentIdArray[nIndex].viewdate == ''){
contentIdArray[nIndex].viewdate = outputDate; CONTENTSEARCH.contentIdArray[nIndex].viewdate = outputDate;
contentIdArray[nIndex].originviewdate = date; CONTENTSEARCH.contentIdArray[nIndex].originviewdate = date;
} }
break; break;
} }
...@@ -920,11 +788,11 @@ function readSubmenuFunction_callback(contentId) ...@@ -920,11 +788,11 @@ function readSubmenuFunction_callback(contentId)
} }
if(!checkflag){ if(!checkflag){
contentIdArray.push({contentid: contentId, viewdate: outputDate, originviewdate: date}); CONTENTSEARCH.contentIdArray.push({contentid: contentId, viewdate: outputDate, originviewdate: date});
} }
} }
else{ else{
contentIdArray.push({contentid: contentId, viewdate: outputDate, originviewdate: date}); CONTENTSEARCH.contentIdArray.push({contentid: contentId, viewdate: outputDate, originviewdate: date});
} }
//Renew ReadingContentID //Renew ReadingContentID
...@@ -938,7 +806,7 @@ function readSubmenuFunction_callback(contentId) ...@@ -938,7 +806,7 @@ function readSubmenuFunction_callback(contentId)
COMMON.setMetaVersionData(contentId); COMMON.setMetaVersionData(contentId);
//Set data for readingcontentid //Set data for readingcontentid
ClientData.ReadingContentIds(contentIdArray); ClientData.ReadingContentIds(CONTENTSEARCH.contentIdArray);
ClientData.IsRefresh(false); ClientData.IsRefresh(false);
...@@ -948,13 +816,13 @@ function readSubmenuFunction_callback(contentId) ...@@ -948,13 +816,13 @@ function readSubmenuFunction_callback(contentId)
//Download content //Download content
HEADER.downloadResourceById(contentId); HEADER.downloadResourceById(contentId);
// redraw content remove new icon // redraw content remove new icon
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
drawEditImage(contentId); CONTENTSEARCH.drawEditImage(contentId);
} }
else{ else{
//Go to Conten view page //Go to Conten view page
...@@ -964,7 +832,7 @@ function readSubmenuFunction_callback(contentId) ...@@ -964,7 +832,7 @@ function readSubmenuFunction_callback(contentId)
}; };
//Check if Content Has marking or memo //Check if Content Has marking or memo
function checkContentMarkingMemoOption(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){
...@@ -1001,10 +869,10 @@ function checkContentMarkingMemoOption(contentId){ ...@@ -1001,10 +869,10 @@ function checkContentMarkingMemoOption(contentId){
}; };
//Check if User has read content //Check if User has read content
function checkUserHasReadContent(contId, resourceVer, metaVer) { CONTENTSEARCH.checkUserHasReadContent = function(contId, resourceVer, metaVer) {
var imgThumb = new Image(); var imgThumb = new Image();
//imgThumb.src = returnThumbnail(contId); //imgThumb.src = CONTENTSEARCH.returnThumbnail(contId);
var imgIconNew = new Image(); var imgIconNew = new Image();
//imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW; //imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
...@@ -1021,14 +889,14 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) { ...@@ -1021,14 +889,14 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) {
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. //Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType and Thumbnail of content.
var contentThumbnail = returnThumbnail(contId); var contentThumbnail = CONTENTSEARCH.returnThumbnail(contId);
var contentType = 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. //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 == null || readArr <= 0 || readArr == 'undefined') {
imgThumb.onload = function () { imgThumb.onload = function () {
var resizeImg = 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]);
...@@ -1058,7 +926,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) { ...@@ -1058,7 +926,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) {
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 = 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');
...@@ -1083,7 +951,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) { ...@@ -1083,7 +951,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) {
} }
else { else {
imgThumb.onload = function () { imgThumb.onload = function () {
var resizeImg = 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]);
...@@ -1120,7 +988,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) { ...@@ -1120,7 +988,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) {
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 = 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]);
...@@ -1158,7 +1026,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) { ...@@ -1158,7 +1026,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) {
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 = 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]);
...@@ -1192,15 +1060,15 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) { ...@@ -1192,15 +1060,15 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) {
}; };
//draw Edit Image //draw Edit Image
function drawEditImage(id) { CONTENTSEARCH.drawEditImage = function(id) {
var img = new Image(); var img = new Image();
var imgSrc = returnThumbnail(id); var imgSrc = CONTENTSEARCH.returnThumbnail(id);
if(imgSrc != null){ if(imgSrc != null){
} }
else{ else{
var contentType = returnContentType(id); var contentType = CONTENTSEARCH.returnContentType(id);
var src = HEADER.getThumbnailForOtherType(contentType); var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){ if( src != '' ){
...@@ -1214,7 +1082,7 @@ function drawEditImage(id) { ...@@ -1214,7 +1082,7 @@ function drawEditImage(id) {
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 = 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');
...@@ -1225,12 +1093,12 @@ function drawEditImage(id) { ...@@ -1225,12 +1093,12 @@ function drawEditImage(id) {
}; };
//Search Function //Search Function
function searchEventButtonFunction(){ CONTENTSEARCH.searchEventButtonFunction = function(){
var fromPage = DEFAULT_DISP_NUMBER_RECORD_FROM; var fromPage = CONTENTSEARCH.DEFAULT_DISP_NUMBER_RECORD_FROM;
var toPage = returnNumberDispRecordForList(); var toPage = CONTENTSEARCH.returnNumberDispRecordForList();
var sortType = DEFAULT_SORT_TYPE; var sortType = CONTENTSEARCH.DEFAULT_SORT_TYPE;
var sortOrder = DEFAULT_SORT_ORDER; var sortOrder = CONTENTSEARCH.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');
...@@ -1259,30 +1127,30 @@ function searchEventButtonFunction(){ ...@@ -1259,30 +1127,30 @@ function searchEventButtonFunction(){
ClientData.searchCond_searchText(searchText); ClientData.searchCond_searchText(searchText);
ClientData.searchCond_searchDivision(searchDivision); ClientData.searchCond_searchDivision(searchDivision);
//refresh grid //refresh grid
refreshGrid(); CONTENTSEARCH.refreshGrid();
//Handle display sort //Handle display sort
handleSortDisp(); CONTENTSEARCH.handleSortDisp();
if(searchText == '' || searchText == null){ if(searchText == '' || searchText == null){
displayResultNoRecord(); CONTENTSEARCH.displayResultNoRecord();
chkSearchTextEmpty = true; CONTENTSEARCH.chkSearchTextEmpty = true;
noRecordFlg = true; CONTENTSEARCH.noRecordFlg = true;
reRenderPageNumber(0, 0); CONTENTSEARCH.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; CONTENTSEARCH.chkSearchTextEmpty = false;
renderContent(sid, searchText, searchDivision, sortType, sortOrder, fromPage, toPage, genreId, groupId); CONTENTSEARCH.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){ CONTENTSEARCH.renderViewDate = function(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){
...@@ -1292,10 +1160,7 @@ function renderViewDate(id){ ...@@ -1292,10 +1160,7 @@ function renderViewDate(id){
}; };
//handle display sort direction //handle display sort direction
function handleSortDisp(){ CONTENTSEARCH.handleSortDisp = function(){
// $('#control-sort-title').removeClass('active_tops');
// $('#control-sort-titlekana').removeClass('active_tops');
// $('#control-sort-releasedate').removeClass('active_tops');
var typeSort; var typeSort;
var orderSort; var orderSort;
...@@ -1312,99 +1177,45 @@ function handleSortDisp(){ ...@@ -1312,99 +1177,45 @@ function handleSortDisp(){
orderSort = ClientData.searchCond_sortOrder(); orderSort = ClientData.searchCond_sortOrder();
if(typeSort == 1){ if(typeSort == 1){
// if(orderSort == COMMON.Consts.ConstOrderSetting_Asc){ HEADER.setStatusSort('#control-sort-title',orderSort == COMMON.Consts.ConstOrderSetting_Asc);
// $('#title-sorttype').html('');
// $('#title-sorttype').html('▲');
// $('#title-sorttype').css('width', '12px');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
// }
// else{
// $('#title-sorttype').html('');
// $('#title-sorttype').html('▼');
// $('#title-sorttype').css('width', '12px');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
// }
//
// $('#control-sort-title').addClass('active_tops');
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);
// if(orderSort == COMMON.Consts.ConstOrderSetting_Asc){
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#titlekana-sorttype').html('▲');
// $('#titlekana-sorttype').css('width', '12px');
// $('#rDate-sorttype').html('');
// }
// else{
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#titlekana-sorttype').html('▼');
// $('#titlekana-sorttype').css('width', '12px');
// $('#rDate-sorttype').html('');
// }
//
// $('#control-sort-titlekana').addClass('active_tops');
HEADER.setStatusSort('#control-sort-titlekana',orderSort == COMMON.Consts.ConstOrderSetting_Asc);
} }
else if(typeSort == 3){ else if(typeSort == 3){
// if(orderSort == COMMON.Consts.ConstOrderSetting_Asc){
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
// $('#rDate-sorttype').html('▲');
// $('#rDate-sorttype').css('width', '12px');
// }
// else{
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
// $('#rDate-sorttype').html('▼');
// $('#rDate-sorttype').css('width', '12px');
// }
//
// $('#control-sort-releasedate').addClass('active_tops');
HEADER.setStatusSort('#control-sort-releasedate',orderSort == COMMON.Consts.ConstOrderSetting_Asc); HEADER.setStatusSort('#control-sort-releasedate',orderSort == COMMON.Consts.ConstOrderSetting_Asc);
} }
} }
} }
}; };
//function Open SubMenu Dialog //function Open SubMenu Dialog
function titleClickFunction(e){ CONTENTSEARCH.titleClickFunction = function(e){
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
} }
if (home_isMove == true) { if (CONTENTSEARCH.home_isMove == true) {
home_isMove = false; CONTENTSEARCH.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 = CONTENTSEARCH.returnThumbnail(contentid);
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. //Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type of content.
var contentType = 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. //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){ if(ClientData.ReadingContentIds().length > 0){
contentIdArray = ClientData.ReadingContentIds(); CONTENTSEARCH.contentIdArray = ClientData.ReadingContentIds();
for(var nIndex = 0; nIndex < contentIdArray.length; nIndex++){ for(var nIndex = 0; nIndex < CONTENTSEARCH.contentIdArray.length; nIndex++){
if(contentIdArray[nIndex].contentid == contentid){ if(CONTENTSEARCH.contentIdArray[nIndex].contentid == contentid){
checkflag = true; checkflag = true;
break; break;
} }
...@@ -1414,11 +1225,11 @@ function titleClickFunction(e){ ...@@ -1414,11 +1225,11 @@ function titleClickFunction(e){
} }
if(!checkflag){ if(!checkflag){
contentIdArray.push({contentid: contentid, viewdate: '', originviewdate: ''}); CONTENTSEARCH.contentIdArray.push({contentid: contentid, viewdate: '', originviewdate: ''});
} }
} }
else{ else{
contentIdArray.push({contentid: contentid, viewdate: '', originviewdate: ''}); CONTENTSEARCH.contentIdArray.push({contentid: contentid, viewdate: '', originviewdate: ''});
} }
//Renew ReadingContentID //Renew ReadingContentID
...@@ -1426,7 +1237,7 @@ function titleClickFunction(e){ ...@@ -1426,7 +1237,7 @@ function titleClickFunction(e){
ClientData.ReadingContentIds(newArray); ClientData.ReadingContentIds(newArray);
//Set data for readingcontentid //Set data for readingcontentid
ClientData.ReadingContentIds(contentIdArray); ClientData.ReadingContentIds(CONTENTSEARCH.contentIdArray);
//Set ResouceVersion for content //Set ResouceVersion for content
COMMON.setResourceVersionData(contentid); COMMON.setResourceVersionData(contentid);
...@@ -1438,14 +1249,14 @@ function titleClickFunction(e){ ...@@ -1438,14 +1249,14 @@ function titleClickFunction(e){
$('#dlgSubMenu').hide(); $('#dlgSubMenu').hide();
//Delete 'new' icon //Delete 'new' icon
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
function returnNumberDispRecordForList() { CONTENTSEARCH.returnNumberDispRecordForList = function() {
var toPage = 0; var toPage = 0;
var sysSettings = avwSysSetting(); var sysSettings = avwSysSetting();
toPage = sysSettings.bookListCount; toPage = sysSettings.bookListCount;
...@@ -1453,53 +1264,53 @@ function returnNumberDispRecordForList() { ...@@ -1453,53 +1264,53 @@ function returnNumberDispRecordForList() {
}; };
//Get number record disp next for list //Get number record disp next for list
function getNextRecordNumForList(){ CONTENTSEARCH.getNextRecordNumForList = function(){
iNumberOfNextRecord = returnNumberDispRecordForList(); CONTENTSEARCH.iNumberOfNextRecord = CONTENTSEARCH.returnNumberDispRecordForList();
}; };
//refresh sort order //refresh sort order
function refreshSortTypeOrder(){ //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
function refreshGrid(){ 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
function formatDisplayMoreRecord(){ CONTENTSEARCH.formatDisplayMoreRecord = function(){
I18N.i18nReplaceText(); I18N.i18nReplaceText();
//changeLanguage(ClientData.userInfo_language()); //changeLanguage(ClientData.userInfo_language());
$('#control-nextrecord').html(AVWEB.format(I18N.i18nText('dspViewMore'), returnNumberDispRecordForList())); $('#control-nextrecord').html(AVWEB.format(I18N.i18nText('dspViewMore'), CONTENTSEARCH.returnNumberDispRecordForList()));
}; };
function changeLanguageCallBackFunction(){ //CONTENTSEARCH.changeLanguageCallBackFunction = function(){
handleLanguage(); // CONTENTSEARCH.handleLanguage();
//
formatDisplayMoreRecord(); // CONTENTSEARCH.formatDisplayMoreRecord();
//
if(chkSearchTextEmpty){ // if(CONTENTSEARCH.chkSearchTextEmpty){
displayResultNoRecord(); // displayResultNoRecord();
} else // } else
{ // {
if(!noRecordFlg) // if(!CONTENTSEARCH.noRecordFlg)
{ // {
$('#control-nextrecord').css('visibility','visible'); // $('#control-nextrecord').css('visibility','visible');
} // }
enableSort(); // enableSort();
} // }
//
document.title = I18N.i18nText('txtSearchResult') + ' | ' + I18N.i18nText('sysAppTitle'); // document.title = I18N.i18nText('txtSearchResult') + ' | ' + I18N.i18nText('sysAppTitle');
}; //};
function displayResultNoRecord(){ 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' });
...@@ -1517,7 +1328,7 @@ function displayResultNoRecord(){ ...@@ -1517,7 +1328,7 @@ function displayResultNoRecord(){
} }
}; };
function enableSort(){ CONTENTSEARCH.enableSort = function(){
$('.control_sort_on').show(); $('.control_sort_on').show();
$('.control_sort_off').hide(); $('.control_sort_off').hide();
if(getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko){ if(getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko){
...@@ -1526,29 +1337,9 @@ function enableSort(){ ...@@ -1526,29 +1337,9 @@ function enableSort(){
} }
}; };
//function truncate(strInput, length){ CONTENTSEARCH.resizeResourceThumbnail = function(mg, width, height) {
// if (strInput.length <= length)
// {
// return strInput;
// }
// else
// {
// return strInput.substring(0, length) + "...";
// }
//};
function resizeResourceThumbnail(mg, width, height) {
var newWidth; var newWidth;
var newHeight; var newHeight;
/*if(mg.width > mg.height) {
newWidth = width;
newHeight = (mg.height * width)/mg.width;
}
else {
newHeight = height;
newWidth = (mg.width * height)/mg.height;
}*/
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);
...@@ -1559,7 +1350,7 @@ function resizeResourceThumbnail(mg, width, height) { ...@@ -1559,7 +1350,7 @@ function resizeResourceThumbnail(mg, width, height) {
}; };
function removeHoverCss(){ CONTENTSEARCH.removeHoverCss = function(){
if(COMMON.isTouchDevice()){ if(COMMON.isTouchDevice()){
$('#control-sort-title').removeClass('nottouchdevice'); $('#control-sort-title').removeClass('nottouchdevice');
...@@ -1575,8 +1366,8 @@ CONTENTSEARCH.showContentShareDlgFunction = function(e) { ...@@ -1575,8 +1366,8 @@ CONTENTSEARCH.showContentShareDlgFunction = function(e) {
e.preventDefault(); e.preventDefault();
} }
if (home_isMove == true) { if (CONTENTSEARCH.home_isMove == true) {
home_isMove = false; CONTENTSEARCH.home_isMove = false;
return; return;
} }
......
...@@ -3,43 +3,26 @@ ...@@ -3,43 +3,26 @@
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;
var DEFAULT_SORT_TYPE = '4'; HISTORY.DEFAULT_SORT_TYPE = '4';
var DEFAULT_SORT_ORDER = '2'; HISTORY.DEFAULT_SORT_ORDER = '2';
var DEFAULT_SEARCH_DIVISION = 0; HISTORY.DEFAULT_SEARCH_DIVISION = 0;
//var DEFAULT_IMG_OPTION_MEMO = 'img/list/icon_sticker.png'; //var iNumberOfNextRecord = 15;
//var DEFAULT_IMG_OPTION_MARKING = 'img/list/icon_pen.png';
//var DEFAULT_IMG_CONTENT_EDIT = 'img/common/band_updated.png';
//var DEFAULT_IMG_CONTENT_NEW = 'img/common/band_new.png';
var iNumberOfNextRecord = 15;
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Create new Array for function No.12.
//Thumbnail array //Thumbnail array
var thumbnailArr = []; HISTORY.thumbnailArr = [];
//Content type array. //Content type array.
var contentTypeArr = []; HISTORY.contentTypeArr = [];
HISTORY.contentIdArray = [];
//var ThumbnailForOtherType = {
// Thumbnail_ImageType : 'img/image_type.png', HISTORY.totalPage;
// Thumbnail_VideoType : 'img/iPad_video.png', HISTORY.contentViewData = [];
// Thumbnail_MusicType : 'img/thumb_default_sound.png', HISTORY.noRecordFlg = false;
// Thumbnail_OthersType : 'img/thumb_default_other.png', HISTORY.home_isMove = false;
// Thumbnail_NoFileType : 'img/thumb_default_none.png', HISTORY.history_contentTitleKana = [];
// Thumbnail_HtmlType : 'img/thumb_default_html.png'
//};
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Create new Array for function No.12.
var contentIdArray = [];
//var resourceVersionArr = [];
//var metaVersionArr = [];
var totalPage;
var contentViewData = [];
var noRecordFlg = false;
var home_isMove = false;
var history_contentTitleKana = [];
$(document).ready(function(){ $(document).ready(function(){
...@@ -56,49 +39,49 @@ $(document).ready(function(){ ...@@ -56,49 +39,49 @@ $(document).ready(function(){
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{
syncReadingContent(); HISTORY.syncReadingContent();
} }
//remove hover effect when is touch device //remove hover effect when is touch device
removeHoverCss(); HISTORY.removeHoverCss();
//Render Grid //Render Grid
renderGridView(); HISTORY.renderGridView();
//Go To Details Page //Go To Details Page
$('canvas').live('click', canvasClickFunction); $('canvas').live('click', HISTORY.canvasClickFunction);
//$('canvas').live('touchstart', canvasClickFunction); //$('canvas').live('touchstart', HISTORY.canvasClickFunction);
$('canvas').live('touchend', canvasClickFunction); $('canvas').live('touchend', HISTORY.canvasClickFunction);
$('canvas').live('touchmove', function () { home_isMove = true; }); $('canvas').live('touchmove', function () { HISTORY.home_isMove = true; });
//Open dialog //Open dialog
$('.dialog').live('click', titleClickFunction); $('.dialog').live('click', HISTORY.titleClickFunction);
//$('.dialog').live('touchstart', titleClickFunction); //$('.dialog').live('touchstart', HISTORY.titleClickFunction);
$('.dialog').live('touchend', titleClickFunction); $('.dialog').live('touchend', HISTORY.titleClickFunction);
$('.dialog').live('touchmove', function () { home_isMove = true; }); $('.dialog').live('touchmove', function () { HISTORY.home_isMove = true; });
//Sort Title //Sort Title
$('#control-sort-title').click(sortByTitleFunction); $('#control-sort-title').click(HISTORY.sortByTitleFunction);
//Sort by title kana //Sort by title kana
$('#control-sort-titlekana').click(sortByTitleKanaFunction); $('#control-sort-titlekana').click(HISTORY.sortByTitleKanaFunction);
//sort by release date //sort by release date
$('#control-sort-releasedate').click(sortByReleaseDateFunction); $('#control-sort-releasedate').click(HISTORY.sortByReleaseDateFunction);
$('#control-sort-viewdate').click(sortByViewDateFunction); $('#control-sort-viewdate').click(HISTORY.sortByViewDateFunction);
//Go To Details Page //Go To Details Page
$('.button-details').live('click', readSubmenuFunction); $('.button-details').live('click', HISTORY.readSubmenuFunction);
//$('.button-details').live('touchstart', readSubmenuFunction); //$('.button-details').live('touchstart', HISTORY.readSubmenuFunction);
$('.button-details').live('touchend', readSubmenuFunction); $('.button-details').live('touchend', HISTORY.readSubmenuFunction);
$('.button-details').live('touchmove', function () { 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 () { home_isMove = true; }); $('.button-share').live('touchmove', function () { HISTORY.home_isMove = true; });
$(window).resize(function () { $(window).resize(function () {
if ($("#contentDetail").css("display") != "none") { if ($("#contentDetail").css("display") != "none") {
...@@ -132,12 +115,12 @@ $(document).ready(function(){ ...@@ -132,12 +115,12 @@ $(document).ready(function(){
}); });
//Call API //Call API
function abapi(name, param, method, callback){ //HISTORY.abapi = function(name, param, method, callback){
avwCmsApiSync(ClientData.userInfo_accountPath(), name, method, param, callback, null); // avwCmsApiSync(ClientData.userInfo_accountPath(), name, method, param, callback, null);
}; //};
///Render Content ///Render Content
function renderContent(id, text, division, type, order, from, to, cateid, grpid) { HISTORY.renderContent = function(id, text, division, type, order, from, to, cateid, grpid) {
var params = { var params = {
sid: id, sid: id,
searchText: text, searchText: text,
...@@ -160,7 +143,7 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid) ...@@ -160,7 +143,7 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid)
var outputDate = COMMON.formatDeliveryDate(post.contentDeliveryDate); var outputDate = COMMON.formatDeliveryDate(post.contentDeliveryDate);
//renderViewDate //renderViewDate
var viewdate = renderViewDate(post.contentId); var viewdate = HISTORY.renderViewDate(post.contentId);
if (viewdate != null && viewdate != 'undefined' && viewdate != '') { if (viewdate != null && viewdate != 'undefined' && viewdate != '') {
var htmlTemp = '<section class="sectionhistory">' var htmlTemp = '<section class="sectionhistory">'
...@@ -201,7 +184,7 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid) ...@@ -201,7 +184,7 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid)
for (var i = 0; i < data.contentList.length; i++) { for (var i = 0; i < data.contentList.length; i++) {
post = data.contentList[i]; post = data.contentList[i];
var viewdate = renderViewDate(post.contentId); var viewdate = HISTORY.renderViewDate(post.contentId);
// save alert message level // save alert message level
messageLevel[post.contentId] = { alertMessageLevel:post.alertMessageLevel, alertMessage:post.alertMessage}; messageLevel[post.contentId] = { alertMessageLevel:post.alertMessageLevel, alertMessage:post.alertMessage};
...@@ -214,15 +197,15 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid) ...@@ -214,15 +197,15 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid)
formatThumbnail = COMMON.formatStringBase64(formatThumbnail); formatThumbnail = COMMON.formatStringBase64(formatThumbnail);
} }
thumbnailArr.push({ contentId: post.contentId, thumbnail: formatThumbnail}); HISTORY.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. //Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type to array to manage.
//assign content type to array //assign content type to array
contentTypeArr.push({ contentId: post.contentId, contentType: post.contentType }); 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. //End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Assign content type to array to manage.
//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); HISTORY.checkUserHasReadContent(post.contentId, post.resourceVersion, post.metaVersion);
//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 });
...@@ -231,13 +214,13 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid) ...@@ -231,13 +214,13 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid)
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
checkContentMarkingMemoOption(post.contentId); HISTORY.checkContentMarkingMemoOption(post.contentId);
$('#lblVdate' + post.contentId).html(viewdate); $('#lblVdate' + post.contentId).html(viewdate);
addReadContentToArray(post.contentId, post.resourceVersion, post.metaVersion, post.contentThumbnail, post.contentTitle, returnContentTitleKana(post.contentId), post.contentDeliveryDate,post.contentType, post.readerShare ); HISTORY.addReadContentToArray(post.contentId, post.resourceVersion, post.metaVersion, post.contentThumbnail, post.contentTitle, HISTORY.returnContentTitleKana(post.contentId), post.contentDeliveryDate,post.contentType, post.readerShare );
//showContentThumbnail(); //HISTORY.showContentThumbnail();
} }
} }
...@@ -247,15 +230,15 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid) ...@@ -247,15 +230,15 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid)
if (data.recordTo) { if (data.recordTo) {
ClientData.searchCond_recordTo(data.recordTo); ClientData.searchCond_recordTo(data.recordTo);
} }
totalPage = data.totalRecord; HISTORY.totalPage = data.totalRecord;
//Render Page number //Render Page number
reRenderPageNumber(totalPage, totalPage); HISTORY.reRenderPageNumber(HISTORY.totalPage, HISTORY.totalPage);
}, null); }, null);
}; };
//Handle language //Handle language
function handleLanguage(){ 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 || ClientData.userInfo_language() == COMMON.Consts.ConstLanguage_Ko)
if (getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko) if (getCurrentLanguage() == COMMON.Consts.ConstLanguage_En || getCurrentLanguage() == COMMON.Consts.ConstLanguage_Ko)
...@@ -273,7 +256,7 @@ function handleLanguage(){ ...@@ -273,7 +256,7 @@ function handleLanguage(){
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(noRecordFlg){ if(HISTORY.noRecordFlg){
$('#label-sort-titlekana').css('display','block'); $('#label-sort-titlekana').css('display','block');
$('#separate').css('display','block'); $('#separate').css('display','block');
...@@ -289,14 +272,14 @@ function handleLanguage(){ ...@@ -289,14 +272,14 @@ function handleLanguage(){
}; };
//Initial Screen //Initial Screen
function renderGridView(){ HISTORY.renderGridView = function(){
var fromPage = ''; var fromPage = '';
var toPage = ''; var toPage = '';
var sortType = DEFAULT_SORT_TYPE; var sortType = HISTORY.DEFAULT_SORT_TYPE;
var sortOrder = DEFAULT_SORT_ORDER; var sortOrder = HISTORY.DEFAULT_SORT_ORDER;
var searchText = ''; var searchText = '';
var searchDivision = DEFAULT_SEARCH_DIVISION; var searchDivision = HISTORY.DEFAULT_SEARCH_DIVISION;
var genreId = ''; var genreId = '';
var groupId = ''; var groupId = '';
var sid = ClientData.userInfo_sid(); var sid = ClientData.userInfo_sid();
...@@ -312,36 +295,36 @@ function renderGridView(){ ...@@ -312,36 +295,36 @@ function renderGridView(){
ClientData.searchCond_searchDivision(searchDivision); ClientData.searchCond_searchDivision(searchDivision);
//Handle display sort //Handle display sort
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
refreshGrid(); HISTORY.refreshGrid();
if(ClientData.ReadingContentIds() == null || ClientData.ReadingContentIds() == 'undefined' || ClientData.ReadingContentIds().length == 0){ if(ClientData.ReadingContentIds() == null || ClientData.ReadingContentIds() == 'undefined' || ClientData.ReadingContentIds().length == 0){
displayResultNoRecord(); HISTORY.displayResultNoRecord();
noRecordFlg = true; HISTORY.noRecordFlg = true;
reRenderPageNumber(0,0); HISTORY.reRenderPageNumber(0,0);
} }
else{ else{
//Render Gridview //Render Gridview
renderContent(sid, searchText, searchDivision, 3, sortOrder, fromPage, toPage, genreId, groupId); HISTORY.renderContent(sid, searchText, searchDivision, 3, sortOrder, fromPage, toPage, genreId, groupId);
sortByViewDateDesc(); HISTORY.sortByViewDateDesc();
} }
//Language Handle //Language Handle
handleLanguage(); HISTORY.handleLanguage();
}; };
//Canvas Click function //Canvas Click function
function canvasClickFunction(e){ HISTORY.canvasClickFunction = function(e){
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
} }
if (home_isMove == true) { if (HISTORY.home_isMove == true) {
home_isMove = false; HISTORY.home_isMove = false;
return; return;
} }
...@@ -352,20 +335,20 @@ function canvasClickFunction(e){ ...@@ -352,20 +335,20 @@ function canvasClickFunction(e){
ClientData.contentInfo_contentId(outputId); ClientData.contentInfo_contentId(outputId);
// Get image of selected image // Get image of selected image
var base64String = 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. //Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType of content.
var contentType = 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. //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 //Store Content id that user has read
if(ClientData.ReadingContentIds().length > 0){ if(ClientData.ReadingContentIds().length > 0){
contentIdArray = ClientData.ReadingContentIds(); HISTORY.contentIdArray = ClientData.ReadingContentIds();
for(var nIndex = 0; nIndex < contentIdArray.length; nIndex++){ for(var nIndex = 0; nIndex < HISTORY.contentIdArray.length; nIndex++){
if(contentIdArray[nIndex].contentid == outputId){ if(HISTORY.contentIdArray[nIndex].contentid == outputId){
checkflag = true; checkflag = true;
break; break;
} }
...@@ -375,11 +358,11 @@ function canvasClickFunction(e){ ...@@ -375,11 +358,11 @@ function canvasClickFunction(e){
} }
if(!checkflag){ if(!checkflag){
contentIdArray.push({contentid: outputId, viewdate: '', originviewdate: ''}); HISTORY.contentIdArray.push({contentid: outputId, viewdate: '', originviewdate: ''});
} }
} }
else{ else{
contentIdArray.push({contentid: outputId, viewdate: '', originviewdate: ''}); HISTORY.contentIdArray.push({contentid: outputId, viewdate: '', originviewdate: ''});
} }
//Renew ReadingContentID //Renew ReadingContentID
...@@ -387,7 +370,7 @@ function canvasClickFunction(e){ ...@@ -387,7 +370,7 @@ function canvasClickFunction(e){
ClientData.ReadingContentIds(newArray); ClientData.ReadingContentIds(newArray);
//Set data for readingcontentid //Set data for readingcontentid
ClientData.ReadingContentIds(contentIdArray); ClientData.ReadingContentIds(HISTORY.contentIdArray);
//Set ResouceVersion for content //Set ResouceVersion for content
COMMON.setResourceVersionData(outputId); COMMON.setResourceVersionData(outputId);
...@@ -396,18 +379,18 @@ function canvasClickFunction(e){ ...@@ -396,18 +379,18 @@ function canvasClickFunction(e){
COMMON.setMetaVersionData(outputId); COMMON.setMetaVersionData(outputId);
//Delete 'new' icon //Delete 'new' icon
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
function reRenderPageNumber(dispRecord, dispTotal){ HISTORY.reRenderPageNumber = function(dispRecord, dispTotal){
if( contentViewData.length ){ if( HISTORY.contentViewData.length ){
$('#dispPage').html(contentViewData.length); $('#dispPage').html(HISTORY.contentViewData.length);
$('#totalPage').html(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');
...@@ -420,7 +403,7 @@ function reRenderPageNumber(dispRecord, dispTotal){ ...@@ -420,7 +403,7 @@ function reRenderPageNumber(dispRecord, dispTotal){
}; };
//Sort By Title Function //Sort By Title Function
function sortByTitleFunction(){ HISTORY.sortByTitleFunction = function(){
var sortOrder = ClientData.searchCond_sortOrder(); var sortOrder = ClientData.searchCond_sortOrder();
var sortType = ClientData.searchCond_sortType(); var sortType = ClientData.searchCond_sortType();
...@@ -434,11 +417,11 @@ function sortByTitleFunction(){ ...@@ -434,11 +417,11 @@ function sortByTitleFunction(){
{ {
if(sortType == '1'){ if(sortType == '1'){
sortOrder = COMMON.Consts.ConstOrderSetting_Desc; sortOrder = COMMON.Consts.ConstOrderSetting_Desc;
sortByTitleDesc(); HISTORY.sortByTitleDesc();
} }
else{ else{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
sortByTitleAsc(); HISTORY.sortByTitleAsc();
} }
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
...@@ -446,7 +429,7 @@ function sortByTitleFunction(){ ...@@ -446,7 +429,7 @@ function sortByTitleFunction(){
{ {
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
sortByTitleAsc(); HISTORY.sortByTitleAsc();
} }
HEADER.setStatusSort('#control-sort-title',sortOrder == COMMON.Consts.ConstOrderSetting_Asc); HEADER.setStatusSort('#control-sort-title',sortOrder == COMMON.Consts.ConstOrderSetting_Asc);
...@@ -455,13 +438,13 @@ function sortByTitleFunction(){ ...@@ -455,13 +438,13 @@ function sortByTitleFunction(){
ClientData.searchCond_sortType(sortType); ClientData.searchCond_sortType(sortType);
//refresh Gridview //refresh Gridview
//refreshGrid(); //HISTORY.refreshGrid();
//renderContent(sid, '', ClientData.searchCond_searchDivision(), sortType, sortOrder, recordFrom, recordTo, genreId, groupId); //HISTORY.renderContent(sid, '', ClientData.searchCond_searchDivision(), sortType, sortOrder, recordFrom, recordTo, genreId, groupId);
}; };
//Sort By Title Kana function //Sort By Title Kana function
function sortByTitleKanaFunction(){ HISTORY.sortByTitleKanaFunction = function(){
var sortOrder = ClientData.searchCond_sortOrder(); var sortOrder = ClientData.searchCond_sortOrder();
var sortType = ClientData.searchCond_sortType(); var sortType = ClientData.searchCond_sortType();
...@@ -475,11 +458,11 @@ function sortByTitleKanaFunction(){ ...@@ -475,11 +458,11 @@ function sortByTitleKanaFunction(){
{ {
if(sortType == '2'){ if(sortType == '2'){
sortOrder = COMMON.Consts.ConstOrderSetting_Desc; sortOrder = COMMON.Consts.ConstOrderSetting_Desc;
sortByTitleKanaDesc(); HISTORY.sortByTitleKanaDesc();
} }
else{ else{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
sortByTitleKanaAsc(); HISTORY.sortByTitleKanaAsc();
} }
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
...@@ -487,22 +470,22 @@ function sortByTitleKanaFunction(){ ...@@ -487,22 +470,22 @@ function sortByTitleKanaFunction(){
{ {
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
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 //refresh gridview
//refreshGrid(); //HISTORY.refreshGrid();
ClientData.searchCond_sortType(sortType); ClientData.searchCond_sortType(sortType);
//renderContent(sid, '', ClientData.searchCond_searchDivision(), sortType, sortOrder, null, null, genreId, groupId); //HISTORY.renderContent(sid, '', ClientData.searchCond_searchDivision(), sortType, sortOrder, null, null, genreId, groupId);
}; };
//Sort By Release Date //Sort By Release Date
function sortByReleaseDateFunction(){ HISTORY.sortByReleaseDateFunction = function(){
var sortOrder = ClientData.searchCond_sortOrder(); var sortOrder = ClientData.searchCond_sortOrder();
var sortType = ClientData.searchCond_sortType(); var sortType = ClientData.searchCond_sortType();
...@@ -516,11 +499,11 @@ function sortByReleaseDateFunction(){ ...@@ -516,11 +499,11 @@ function sortByReleaseDateFunction(){
{ {
if(sortType == '3'){ if(sortType == '3'){
sortOrder = COMMON.Consts.ConstOrderSetting_Desc; sortOrder = COMMON.Consts.ConstOrderSetting_Desc;
sortByPublishDateDesc(); HISTORY.sortByPublishDateDesc();
} }
else{ else{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
sortByPublishDateAsc(); HISTORY.sortByPublishDateAsc();
} }
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
...@@ -528,18 +511,18 @@ function sortByReleaseDateFunction(){ ...@@ -528,18 +511,18 @@ function sortByReleaseDateFunction(){
{ {
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
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);
//renderContent(sid, '', ClientData.searchCond_searchDivision(), sortType, sortOrder, recordFrom, recordTo, genreId, groupId); //HISTORY.renderContent(sid, '', ClientData.searchCond_searchDivision(), sortType, sortOrder, recordFrom, recordTo, genreId, groupId);
}; };
//Sort By View Date //Sort By View Date
function sortByViewDateFunction(){ HISTORY.sortByViewDateFunction = function(){
var sortOrder = ClientData.searchCond_sortOrder(); var sortOrder = ClientData.searchCond_sortOrder();
var sortType = ClientData.searchCond_sortType(); var sortType = ClientData.searchCond_sortType();
...@@ -548,18 +531,18 @@ function sortByViewDateFunction(){ ...@@ -548,18 +531,18 @@ function sortByViewDateFunction(){
{ {
if(sortType == '4'){ if(sortType == '4'){
sortOrder = COMMON.Consts.ConstOrderSetting_Desc; sortOrder = COMMON.Consts.ConstOrderSetting_Desc;
sortByViewDateDesc(); HISTORY.sortByViewDateDesc();
} }
else{ else{
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
sortByViewDateAsc(); HISTORY.sortByViewDateAsc();
} }
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
else else
{ {
sortOrder = COMMON.Consts.ConstOrderSetting_Asc; sortOrder = COMMON.Consts.ConstOrderSetting_Asc;
sortByViewDateAsc(); HISTORY.sortByViewDateAsc();
ClientData.searchCond_sortOrder(sortOrder); ClientData.searchCond_sortOrder(sortOrder);
} }
...@@ -572,36 +555,36 @@ function sortByViewDateFunction(){ ...@@ -572,36 +555,36 @@ function sortByViewDateFunction(){
}; };
//Get Thumnail base on contentid //Get Thumnail base on contentid
function returnThumbnail(contentid){ HISTORY.returnThumbnail = function(contentid){
for(var i = 0; i < thumbnailArr.length; i++){ for(var i = 0; i < HISTORY.thumbnailArr.length; i++){
if(thumbnailArr[i].contentId == contentid){ if(HISTORY.thumbnailArr[i].contentId == contentid){
return 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. //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
function returnContentType(contentid){ HISTORY.returnContentType = function(contentid){
//Array Length //Array Length
var iArrCnt = 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 (contentTypeArr[i].contentId == contentid) { if (HISTORY.contentTypeArr[i].contentId == contentid) {
return contentTypeArr[i].contentType; return HISTORY.contentTypeArr[i].contentType;
} }
} }
}; };
//Dialog Read Button CLick //Dialog Read Button CLick
function readSubmenuFunction(e){ HISTORY.readSubmenuFunction = function(e){
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
} }
if (home_isMove == true) { if (HISTORY.home_isMove == true) {
home_isMove = false; HISTORY.home_isMove = false;
return; return;
} }
...@@ -611,7 +594,7 @@ function readSubmenuFunction(e){ ...@@ -611,7 +594,7 @@ function readSubmenuFunction(e){
checkLimitContent(contentId, checkLimitContent(contentId,
function() function()
{ {
readSubmenuFunction_callback(contentId); HISTORY.readSubmenuFunction_callback(contentId);
}, },
function(){ function(){
} }
...@@ -620,9 +603,9 @@ function readSubmenuFunction(e){ ...@@ -620,9 +603,9 @@ function readSubmenuFunction(e){
}; };
// read content callback // read content callback
function readSubmenuFunction_callback(contentId) HISTORY.readSubmenuFunction_callback = function(contentId)
{ {
var contentThumbnail = 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();
...@@ -633,21 +616,21 @@ function readSubmenuFunction_callback(contentId) ...@@ -633,21 +616,21 @@ function readSubmenuFunction_callback(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. //Start Function : No.12 -- Editor : Le Long -- Date : 08/01/2013 -- Summary : Store contentType to storage.
var contentType = 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. //End Function : No.12 -- Editor : Le Long -- Date : 08/01/2013 -- Summary : Store contentType to storage.
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(); HISTORY.contentIdArray = ClientData.ReadingContentIds();
for(var nIndex = 0; nIndex < contentIdArray.length; nIndex++){ for(var nIndex = 0; nIndex < HISTORY.contentIdArray.length; nIndex++){
if(contentIdArray[nIndex].contentid == contentId){ if(HISTORY.contentIdArray[nIndex].contentid == contentId){
checkflag = true; checkflag = true;
if(contentIdArray[nIndex].viewdate == null || contentIdArray[nIndex].viewdate == 'undefined' || contentIdArray[nIndex].viewdate == ''){ if(HISTORY.contentIdArray[nIndex].viewdate == null || HISTORY.contentIdArray[nIndex].viewdate == 'undefined' || HISTORY.contentIdArray[nIndex].viewdate == ''){
contentIdArray[nIndex].viewdate = outputDate; HISTORY.contentIdArray[nIndex].viewdate = outputDate;
contentIdArray[nIndex].originviewdate = date; HISTORY.contentIdArray[nIndex].originviewdate = date;
} }
break; break;
} }
...@@ -657,11 +640,11 @@ function readSubmenuFunction_callback(contentId) ...@@ -657,11 +640,11 @@ function readSubmenuFunction_callback(contentId)
} }
if(!checkflag){ if(!checkflag){
contentIdArray.push({contentid: contentId, viewdate: outputDate, originviewdate: date}); HISTORY.contentIdArray.push({contentid: contentId, viewdate: outputDate, originviewdate: date});
} }
} }
else{ else{
contentIdArray.push({contentid: contentId, viewdate: outputDate, originviewdate: date}); HISTORY.contentIdArray.push({contentid: contentId, viewdate: outputDate, originviewdate: date});
} }
//Renew ReadingContentID //Renew ReadingContentID
...@@ -675,7 +658,7 @@ function readSubmenuFunction_callback(contentId) ...@@ -675,7 +658,7 @@ function readSubmenuFunction_callback(contentId)
COMMON.setMetaVersionData(contentId); COMMON.setMetaVersionData(contentId);
//Set data for readingcontentid //Set data for readingcontentid
ClientData.ReadingContentIds(contentIdArray); ClientData.ReadingContentIds(HISTORY.contentIdArray);
ClientData.IsRefresh(false); ClientData.IsRefresh(false);
...@@ -687,13 +670,13 @@ function readSubmenuFunction_callback(contentId) ...@@ -687,13 +670,13 @@ function readSubmenuFunction_callback(contentId)
//Download content //Download content
HEADER.downloadResourceById(contentId); HEADER.downloadResourceById(contentId);
// redraw content remove new icon // redraw content remove new icon
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
drawEditImage(contentId); HISTORY.drawEditImage(contentId);
} }
else{ else{
//Go to Conten view page //Go to Conten view page
...@@ -705,7 +688,7 @@ function readSubmenuFunction_callback(contentId) ...@@ -705,7 +688,7 @@ function readSubmenuFunction_callback(contentId)
//Check if Content Has marking or memo //Check if Content Has marking or memo
function checkContentMarkingMemoOption(contentId){ HISTORY.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');
...@@ -741,10 +724,10 @@ function checkContentMarkingMemoOption(contentId){ ...@@ -741,10 +724,10 @@ function checkContentMarkingMemoOption(contentId){
}; };
//Check if User has read content //Check if User has read content
function checkUserHasReadContent(contId, resourceVer, metaVer){ HISTORY.checkUserHasReadContent = function(contId, resourceVer, metaVer){
var imgThumb = new Image(); var imgThumb = new Image();
//imgThumb.src = returnThumbnail(contId); //imgThumb.src = HISTORY.returnThumbnail(contId);
var imgIconNew = new Image(); var imgIconNew = new Image();
//imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW; //imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
...@@ -761,17 +744,17 @@ function checkUserHasReadContent(contId, resourceVer, metaVer){ ...@@ -761,17 +744,17 @@ function checkUserHasReadContent(contId, resourceVer, metaVer){
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. //Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType and Thumbnail of content.
var contentThumbnail = returnThumbnail(contId); var contentThumbnail = HISTORY.returnThumbnail(contId);
var contentType = 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. //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 == null || readArr <= 0 || readArr == 'undefined'){
imgThumb.onload = function(){ imgThumb.onload = function(){
var resizeImg = 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);
showContentThumbnail(contId); HISTORY.showContentThumbnail(contId);
}; };
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW; imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
}; };
...@@ -796,9 +779,9 @@ function checkUserHasReadContent(contId, resourceVer, metaVer){ ...@@ -796,9 +779,9 @@ function checkUserHasReadContent(contId, resourceVer, metaVer){
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 = 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]);
showContentThumbnail(contId); HISTORY.showContentThumbnail(contId);
}; };
//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){
...@@ -818,9 +801,9 @@ function checkUserHasReadContent(contId, resourceVer, metaVer){ ...@@ -818,9 +801,9 @@ function checkUserHasReadContent(contId, resourceVer, metaVer){
} }
else{ else{
imgThumb.onload = function(){ imgThumb.onload = function(){
var resizeImg = 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]);
showContentThumbnail(contId); HISTORY.showContentThumbnail(contId);
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);
}; };
...@@ -852,9 +835,9 @@ function checkUserHasReadContent(contId, resourceVer, metaVer){ ...@@ -852,9 +835,9 @@ function checkUserHasReadContent(contId, resourceVer, metaVer){
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 = 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]);
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);
}; };
...@@ -886,9 +869,9 @@ function checkUserHasReadContent(contId, resourceVer, metaVer){ ...@@ -886,9 +869,9 @@ function checkUserHasReadContent(contId, resourceVer, metaVer){
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 = 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]);
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);
}; };
...@@ -917,15 +900,15 @@ function checkUserHasReadContent(contId, resourceVer, metaVer){ ...@@ -917,15 +900,15 @@ function checkUserHasReadContent(contId, resourceVer, metaVer){
}; };
//draw Edit Image //draw Edit Image
function drawEditImage(id) { HISTORY.drawEditImage = function(id) {
var img = new Image(); var img = new Image();
var imgSrc = returnThumbnail(id); var imgSrc = HISTORY.returnThumbnail(id);
if(imgSrc != null){ if(imgSrc != null){
} }
else{ else{
var contentType = returnContentType(id); var contentType = HISTORY.returnContentType(id);
var src = HEADER.getThumbnailForOtherType(contentType); var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){ if( src != '' ){
...@@ -940,7 +923,7 @@ function drawEditImage(id) { ...@@ -940,7 +923,7 @@ function drawEditImage(id) {
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 = 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');
...@@ -951,7 +934,7 @@ function drawEditImage(id) { ...@@ -951,7 +934,7 @@ function drawEditImage(id) {
}; };
//Render User view date //Render User view date
function renderViewDate(id){ HISTORY.renderViewDate = function(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){
...@@ -960,7 +943,7 @@ function renderViewDate(id){ ...@@ -960,7 +943,7 @@ function renderViewDate(id){
} }
}; };
function returnOriginalViewDate(id){ HISTORY.returnOriginalViewDate = function(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].originviewdate; return ClientData.ReadingContentIds()[i].originviewdate;
...@@ -969,7 +952,7 @@ function returnOriginalViewDate(id){ ...@@ -969,7 +952,7 @@ function returnOriginalViewDate(id){
}; };
//handle display sort direction //handle display sort direction
function handleSortDisp(){ 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');
...@@ -992,88 +975,15 @@ function handleSortDisp(){ ...@@ -992,88 +975,15 @@ function handleSortDisp(){
orderSort = ClientData.searchCond_sortOrder(); orderSort = ClientData.searchCond_sortOrder();
if(typeSort == 1){ if(typeSort == 1){
// if(orderSort == COMMON.Consts.ConstOrderSetting_Asc){
// $('#title-sorttype').html('');
// $('#title-sorttype').html('▲');
// $('#title-sorttype').css('width', '12px');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
// $('#vDate-sorttype').html('');
// }
// else{
// $('#title-sorttype').html('');
// $('#title-sorttype').html('▼');
// $('#title-sorttype').css('width', '12px');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
// $('#vDate-sorttype').html('');
// }
//$('#control-sort-title').addClass('active_tops');
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){
// if(orderSort == COMMON.Consts.ConstOrderSetting_Asc){
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#titlekana-sorttype').html('▲');
// $('#titlekana-sorttype').css('width', '12px');
// $('#rDate-sorttype').html('');
// $('#vDate-sorttype').html('');
// }
// else{
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#titlekana-sorttype').html('▼');
// $('#titlekana-sorttype').css('width', '12px');
// $('#rDate-sorttype').html('');
// $('#vDate-sorttype').html('');
// }
//$('#control-sort-titlekana').addClass('active_tops');
HEADER.setStatusSort('#control-sort-titlekana',orderSort == COMMON.Consts.ConstOrderSetting_Asc); HEADER.setStatusSort('#control-sort-titlekana',orderSort == COMMON.Consts.ConstOrderSetting_Asc);
} }
else if(typeSort == 3){ else if(typeSort == 3){
// if(orderSort == COMMON.Consts.ConstOrderSetting_Asc){
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
// $('#rDate-sorttype').html('▲');
// $('#rDate-sorttype').css('width', '12px');
// $('#vDate-sorttype').html('');
// }
// else{
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
// $('#rDate-sorttype').html('▼');
// $('#rDate-sorttype').css('width', '12px');
// $('#vDate-sorttype').html('');
// }
//$('#control-sort-releasedate').addClass('active_tops');
HEADER.setStatusSort('#control-sort-releasedate',orderSort == COMMON.Consts.ConstOrderSetting_Asc); HEADER.setStatusSort('#control-sort-releasedate',orderSort == COMMON.Consts.ConstOrderSetting_Asc);
} }
else{ else{
// if(orderSort == COMMON.Consts.ConstOrderSetting_Asc){
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
// $('#rDate-sorttype').html('');
// $('#vDate-sorttype').html('▲');
// $('#vDate-sorttype').css('width', '12px');
//
// }
// else{
// $('#title-sorttype').html('');
// $('#titlekana-sorttype').html('');
// $('#rDate-sorttype').html('');
// $('#rDate-sorttype').html('');
// $('#vDate-sorttype').html('▼');
// $('#vDate-sorttype').css('width', '12px');
// }
//$('#control-sort-viewdate').addClass('active_tops');
HEADER.setStatusSort('#control-sort-viewdate',orderSort == COMMON.Consts.ConstOrderSetting_Asc); HEADER.setStatusSort('#control-sort-viewdate',orderSort == COMMON.Consts.ConstOrderSetting_Asc);
} }
} }
...@@ -1081,32 +991,32 @@ function handleSortDisp(){ ...@@ -1081,32 +991,32 @@ function handleSortDisp(){
}; };
//function Open SubMenu Dialog //function Open SubMenu Dialog
function titleClickFunction(e){ HISTORY.titleClickFunction = function(e){
if (e) { if (e) {
e.preventDefault(); e.preventDefault();
} }
if (home_isMove == true) { if (HISTORY.home_isMove == true) {
home_isMove = false; HISTORY.home_isMove = false;
return; return;
} }
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 = HISTORY.returnThumbnail(contentid);
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. //Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType of content.
var contentType = 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. //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 //Store Content id that user has read
if(ClientData.ReadingContentIds().length > 0){ if(ClientData.ReadingContentIds().length > 0){
contentIdArray = ClientData.ReadingContentIds(); HISTORY.contentIdArray = ClientData.ReadingContentIds();
for(var nIndex = 0; nIndex < contentIdArray.length; nIndex++){ for(var nIndex = 0; nIndex < HISTORY.contentIdArray.length; nIndex++){
if(contentIdArray[nIndex].contentid == contentid){ if(HISTORY.contentIdArray[nIndex].contentid == contentid){
checkflag = true; checkflag = true;
break; break;
} }
...@@ -1116,11 +1026,11 @@ function titleClickFunction(e){ ...@@ -1116,11 +1026,11 @@ function titleClickFunction(e){
} }
if(!checkflag){ if(!checkflag){
contentIdArray.push({contentid: contentid, viewdate: '', originviewdate: ''}); HISTORY.contentIdArray.push({contentid: contentid, viewdate: '', originviewdate: ''});
} }
} }
else{ else{
contentIdArray.push({contentid: contentid, viewdate: '', originviewdate: ''}); HISTORY.contentIdArray.push({contentid: contentid, viewdate: '', originviewdate: ''});
} }
//Renew ReadingContentID //Renew ReadingContentID
...@@ -1128,7 +1038,7 @@ function titleClickFunction(e){ ...@@ -1128,7 +1038,7 @@ function titleClickFunction(e){
ClientData.ReadingContentIds(newArray); ClientData.ReadingContentIds(newArray);
//Set data for readingcontentid //Set data for readingcontentid
ClientData.ReadingContentIds(contentIdArray); ClientData.ReadingContentIds(HISTORY.contentIdArray);
//Set ResouceVersion for content //Set ResouceVersion for content
COMMON.setResourceVersionData(contentid); COMMON.setResourceVersionData(contentid);
...@@ -1137,30 +1047,30 @@ function titleClickFunction(e){ ...@@ -1137,30 +1047,30 @@ function titleClickFunction(e){
COMMON.setMetaVersionData(contentid); COMMON.setMetaVersionData(contentid);
//Delete 'new' icon //Delete 'new' icon
drawEditImage(contentid); HISTORY.drawEditImage(contentid);
//Open content Detail //Open content Detail
DETAIL.openContentDetail(); DETAIL.openContentDetail();
}; };
//refresh sort order //refresh sort order
function refreshSortTypeOrder(){ //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
function refreshGrid(){ HISTORY.refreshGrid = function(){
//$('#content-grid').html(''); //$('#content-grid').html('');
$('#content-grid').empty(); $('#content-grid').empty();
$('.pageNumControl').css('visibility','hidden'); $('.pageNumControl').css('visibility','hidden');
}; };
function sortByViewDateAsc(){ HISTORY.sortByViewDateAsc = function(){
var sortArr = 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++){
...@@ -1173,10 +1083,10 @@ function sortByViewDateAsc(){ ...@@ -1173,10 +1083,10 @@ function sortByViewDateAsc(){
} }
var resultArr = sortArr; var resultArr = sortArr;
renderContentAfterSort(resultArr); HISTORY.renderContentAfterSort(resultArr);
}; };
function formatDate(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();
...@@ -1190,8 +1100,8 @@ function formatDate(originDate){ ...@@ -1190,8 +1100,8 @@ function formatDate(originDate){
return newDate; return newDate;
}; };
function sortByViewDateDesc(){ HISTORY.sortByViewDateDesc = function(){
var sortArr = 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++){
...@@ -1205,14 +1115,14 @@ function sortByViewDateDesc(){ ...@@ -1205,14 +1115,14 @@ function sortByViewDateDesc(){
} }
var resultArr = sortArr; var resultArr = sortArr;
renderContentAfterSort(resultArr); HISTORY.renderContentAfterSort(resultArr);
}; };
function addReadContentToArray(strContentId, strResourceVersion, strMetaVersion, strThumbnail, strTitle, strTitleKana, strDelivDate,contentType, readerShare){ HISTORY.addReadContentToArray = function(strContentId, strResourceVersion, strMetaVersion, strThumbnail, strTitle, strTitleKana, strDelivDate,contentType, readerShare){
if (contentViewData.length > 0) { if (HISTORY.contentViewData.length > 0) {
var flag; var flag;
for(var j = 0; j < contentViewData.length; j++){ for(var j = 0; j < HISTORY.contentViewData.length; j++){
if(contentViewData[j].contentid == strContentId){ if(HISTORY.contentViewData[j].contentid == strContentId){
flag = true; flag = true;
break; break;
} }
...@@ -1222,22 +1132,22 @@ function addReadContentToArray(strContentId, strResourceVersion, strMetaVersion, ...@@ -1222,22 +1132,22 @@ function addReadContentToArray(strContentId, strResourceVersion, strMetaVersion,
} }
if(!flag){ if(!flag){
contentViewData.push({contentid: strContentId, originviewdate: formatDate(returnOriginalViewDate(strContentId)), contenttitle: strTitle, contenttitlekana: strTitleKana, deliverydate: strDelivDate, resourceversion: strResourceVersion, metaversion: strMetaVersion, thumbnail: COMMON.formatStringBase64(strThumbnail),contenttype:contentType, readerShare:readerShare }); 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 });
} }
}else{ }else{
contentViewData.push({contentid: strContentId, originviewdate: formatDate(returnOriginalViewDate(strContentId)), contenttitle: strTitle, contenttitlekana: strTitleKana, deliverydate: strDelivDate, resourceversion: strResourceVersion, metaversion: strMetaVersion, thumbnail: COMMON.formatStringBase64(strThumbnail),contenttype:contentType, readerShare:readerShare }); 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 });
} }
}; };
function showContentThumbnail(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');
}); });
}; };
function syncReadingContent(){ 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();
...@@ -1245,7 +1155,7 @@ function syncReadingContent(){ ...@@ -1245,7 +1155,7 @@ function syncReadingContent(){
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 (!IsExistContent(readContent.contentid)) { if (!HISTORY.IsExistContent(readContent.contentid)) {
readArr.splice(i, 1); readArr.splice(i, 1);
metaArr.splice(i, 1); metaArr.splice(i, 1);
resourceArr.splice(i, 1); resourceArr.splice(i, 1);
...@@ -1264,11 +1174,11 @@ function syncReadingContent(){ ...@@ -1264,11 +1174,11 @@ function syncReadingContent(){
/* /*
Get content title kana if it existed Get content title kana if it existed
*/ */
function getContentNameKana(strContentId) { HISTORY.getContentNameKana = function(strContentId) {
var strContentNameKana = null; var strContentNameKana = null;
for (var nIndex = 0; nIndex < history_contentTitleKana.length; nIndex++) { for (var nIndex = 0; nIndex < HISTORY.history_contentTitleKana.length; nIndex++) {
if (history_contentTitleKana[nIndex].contentId == strContentId) { if (HISTORY.history_contentTitleKana[nIndex].contentId == strContentId) {
strContentNameKana = history_contentTitleKana[nIndex].contentNameKana; strContentNameKana = HISTORY.history_contentTitleKana[nIndex].contentNameKana;
break; break;
} }
} }
...@@ -1278,7 +1188,7 @@ function getContentNameKana(strContentId) { ...@@ -1278,7 +1188,7 @@ function getContentNameKana(strContentId) {
/* /*
Check content whether existed or not Check content whether existed or not
*/ */
function IsExistContent(strContentId) { HISTORY.IsExistContent = function(strContentId) {
var isExisted = true; var isExisted = true;
var params = { var params = {
sid: ClientData.userInfo_sid(), sid: ClientData.userInfo_sid(),
...@@ -1288,7 +1198,7 @@ function IsExistContent(strContentId) { ...@@ -1288,7 +1198,7 @@ function IsExistContent(strContentId) {
avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", 'GET', params, avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", 'GET', params,
function (data) { function (data) {
isExisted = true; isExisted = true;
history_contentTitleKana.push({ contentId: strContentId, contentNameKana: data.contentData.contentNameKana }); HISTORY.history_contentTitleKana.push({ contentId: strContentId, contentNameKana: data.contentData.contentNameKana });
}, },
function (xmlHttpRequest, txtStatus, errorThrown) { function (xmlHttpRequest, txtStatus, errorThrown) {
if (xmlHttpRequest.status == 404) { if (xmlHttpRequest.status == 404) {
...@@ -1303,12 +1213,12 @@ function IsExistContent(strContentId) { ...@@ -1303,12 +1213,12 @@ function IsExistContent(strContentId) {
return isExisted; return isExisted;
}; };
function changeLanguageCallBackFunction(){ //HISTORY.changeLanguageCallBackFunction = function(){
handleLanguage(); // HISTORY.handleLanguage();
document.title = I18N.i18nText('dspViewHistory') + ' | ' + I18N.i18nText('sysAppTitle'); // document.title = I18N.i18nText('dspViewHistory') + ' | ' + I18N.i18nText('sysAppTitle');
}; //};
function displayResultNoRecord(){ 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');
...@@ -1317,25 +1227,14 @@ function displayResultNoRecord(){ ...@@ -1317,25 +1227,14 @@ function displayResultNoRecord(){
$('#off-default').addClass('descending_sort'); $('#off-default').addClass('descending_sort');
}; };
function enableSort(){ //HISTORY.enableSort = function(){
$('.control_sort_on').show(); // $('.control_sort_on').show();
$('.control_sort_off').hide(); // $('.control_sort_off').hide();
};
//function truncate(strInput, length){
// if (strInput.length <= length)
// {
// return strInput;
// }
// else
// {
// return strInput.substring(0, length) + "...";
// }
//}; //};
function sortByTitleAsc(){ HISTORY.sortByTitleAsc = function(){
var sortArr = 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++){
...@@ -1348,11 +1247,11 @@ function sortByTitleAsc(){ ...@@ -1348,11 +1247,11 @@ function sortByTitleAsc(){
} }
var resultArr = sortArr; var resultArr = sortArr;
renderContentAfterSort(resultArr); HISTORY.renderContentAfterSort(resultArr);
}; };
function sortByTitleDesc(){ HISTORY.sortByTitleDesc = function(){
var sortArr = 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--){
...@@ -1364,17 +1263,17 @@ function sortByTitleDesc(){ ...@@ -1364,17 +1263,17 @@ function sortByTitleDesc(){
} }
} }
var resultArr = contentViewData; var resultArr = HISTORY.contentViewData;
renderContentAfterSort(resultArr); HISTORY.renderContentAfterSort(resultArr);
}; };
function sortByPublishDateAsc(){ HISTORY.sortByPublishDateAsc = function(){
var sortArr = 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(formatOriginalPublishDate(sortArr[j-1].deliverydate) > 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;
...@@ -1383,15 +1282,15 @@ function sortByPublishDateAsc(){ ...@@ -1383,15 +1282,15 @@ function sortByPublishDateAsc(){
} }
var resultArr = sortArr; var resultArr = sortArr;
renderContentAfterSort(resultArr); HISTORY.renderContentAfterSort(resultArr);
}; };
function sortByPublishDateDesc(){ HISTORY.sortByPublishDateDesc = function(){
var sortArr = 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(formatOriginalPublishDate(sortArr[j].deliverydate) > 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;
...@@ -1400,11 +1299,11 @@ function sortByPublishDateDesc(){ ...@@ -1400,11 +1299,11 @@ function sortByPublishDateDesc(){
} }
var resultArr = sortArr; var resultArr = sortArr;
renderContentAfterSort(resultArr); HISTORY.renderContentAfterSort(resultArr);
}; };
function sortByTitleKanaAsc(){ HISTORY.sortByTitleKanaAsc = function(){
var sortArr = 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++){
...@@ -1417,11 +1316,11 @@ function sortByTitleKanaAsc(){ ...@@ -1417,11 +1316,11 @@ function sortByTitleKanaAsc(){
} }
var resultArr = sortArr; var resultArr = sortArr;
renderContentAfterSort(resultArr); HISTORY.renderContentAfterSort(resultArr);
}; };
function sortByTitleKanaDesc(){ HISTORY.sortByTitleKanaDesc = function(){
var sortArr = 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--){
...@@ -1434,12 +1333,12 @@ function sortByTitleKanaDesc(){ ...@@ -1434,12 +1333,12 @@ function sortByTitleKanaDesc(){
} }
var resultArr = sortArr; var resultArr = sortArr;
renderContentAfterSort(resultArr); HISTORY.renderContentAfterSort(resultArr);
}; };
function renderContentAfterSort(contentSortArr){ HISTORY.renderContentAfterSort = function(contentSortArr){
refreshGrid(); HISTORY.refreshGrid();
//var htmlTemp = ""; //var htmlTemp = "";
for(var i = 0; i < contentSortArr.length; i++) { for(var i = 0; i < contentSortArr.length; i++) {
post = contentSortArr[i]; post = contentSortArr[i];
...@@ -1485,23 +1384,23 @@ function renderContentAfterSort(contentSortArr){ ...@@ -1485,23 +1384,23 @@ function renderContentAfterSort(contentSortArr){
for (var i = 0; i < contentSortArr.length; i++) { for (var i = 0; i < contentSortArr.length; i++) {
post = contentSortArr[i]; post = contentSortArr[i];
var viewdate = renderViewDate(post.contentid); var viewdate = HISTORY.renderViewDate(post.contentid);
reRenderPageNumber(totalPage, totalPage); HISTORY.reRenderPageNumber(HISTORY.totalPage, HISTORY.totalPage);
//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); HISTORY.checkUserHasReadContent(post.contentid, post.resourceversion, post.metaversion);
//Check if content has marking or memo //Check if content has marking or memo
checkContentMarkingMemoOption(post.contentid); HISTORY.checkContentMarkingMemoOption(post.contentid);
$('#lblVdate' + post.contentid).html(viewdate); $('#lblVdate' + post.contentid).html(viewdate);
showContentThumbnail(); HISTORY.showContentThumbnail();
} }
}; };
function formatOriginalPublishDate(date){ HISTORY.formatOriginalPublishDate = function(date){
var day = date.date; var day = date.date;
var month = date.month + 1; var month = date.month + 1;
...@@ -1514,11 +1413,11 @@ function formatOriginalPublishDate(date){ ...@@ -1514,11 +1413,11 @@ function formatOriginalPublishDate(date){
return resultDate; return resultDate;
}; };
function returnContentTitleKana(id) { HISTORY.returnContentTitleKana = function(id) {
var titleKana; var titleKana;
// Get title kana from existed contents // Get title kana from existed contents
titleKana = getContentNameKana(id); titleKana = HISTORY.getContentNameKana(id);
if (titleKana != null) { if (titleKana != null) {
// Skip this case // Skip this case
...@@ -1542,18 +1441,9 @@ function returnContentTitleKana(id) { ...@@ -1542,18 +1441,9 @@ function returnContentTitleKana(id) {
return titleKana; return titleKana;
}; };
function resizeResourceThumbnail(mg, width, height) { HISTORY.resizeResourceThumbnail = function(mg, width, height) {
var newWidth; var newWidth;
var newHeight; var newHeight;
/*if(mg.width > mg.height) {
newWidth = width;
newHeight = (mg.height * width)/mg.width;
}
else {
newHeight = height;
newWidth = (mg.width * height)/mg.height;
}*/
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);
...@@ -1564,7 +1454,7 @@ function resizeResourceThumbnail(mg, width, height) { ...@@ -1564,7 +1454,7 @@ function resizeResourceThumbnail(mg, width, height) {
}; };
function removeHoverCss(){ HISTORY.removeHoverCss = function(){
if(COMMON.isTouchDevice()){ if(COMMON.isTouchDevice()){
$('#control-sort-title').removeClass('nottouchdevice'); $('#control-sort-title').removeClass('nottouchdevice');
...@@ -1581,8 +1471,8 @@ HISTORY.showContentShareDlgFunction = function(e) { ...@@ -1581,8 +1471,8 @@ HISTORY.showContentShareDlgFunction = function(e) {
e.preventDefault(); e.preventDefault();
} }
if (home_isMove == true) { if (HISTORY.home_isMove == true) {
home_isMove = false; HISTORY.home_isMove = false;
return; return;
} }
......
...@@ -5,7 +5,7 @@ var HOME = {}; ...@@ -5,7 +5,7 @@ var HOME = {};
//Start Declare Variables //Start Declare Variables
//----Constant-----------// //----Constant-----------//
HOME.DEFAULT_DISP_NUMBER_RECORD_FROM = 1; HOME.DEFAULT_DISP_NUMBER_RECORD_FROM = 1;
HOME.DEFAULT_DISP_NUMBER_RECORD_TO = 15; //HOME.DEFAULT_DISP_NUMBER_RECORD_TO = 15;
HOME.DEFAULT_SORT_TYPE = 3; HOME.DEFAULT_SORT_TYPE = 3;
HOME.DEFAULT_SORT_ORDER = 2; HOME.DEFAULT_SORT_ORDER = 2;
HOME.DEFAULT_SEARCH_DIVISION = 0; HOME.DEFAULT_SEARCH_DIVISION = 0;
......
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