Commit 3e6d7f8e by Masaru Abe

リファクタリング

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