Commit 91216eee by Masaru Abe

リファクタリング

parent 0c50228a
......@@ -8,6 +8,9 @@
//グローバルの名前空間用のオブジェクトを用意する
var COMMON = {};
COMMON.resourceVersionArr = [];
COMMON.metaVersionArr = [];
COMMON.DEFAULT_IMG_OPTION_MEMO = 'img/list/icon_sticker.png';
COMMON.DEFAULT_IMG_OPTION_MARKING = 'img/list/icon_pen.png';
COMMON.DEFAULT_IMG_CONTENT_EDIT = 'img/common/band_updated.png';
......@@ -210,6 +213,9 @@ COMMON.Keys = {
serviceOpt_reader_usable_readinglog_gps: 'reader_usable_readinglog_gps',
// Session :事業者オプション(serviceOpt)_getits向け詳細ログ使用可:Char(Y:可能, N:不可)
serviceOpt_reader_readinglog_object: 'reader_readinglog_object',
// Session :事業者オプション(serviceOpt)_コンテンツ共有モード:Interger(0:なし , 1:ABook, 2:getits)
serviceOpt_content_share: 'content_share',
// Session :共通(common)_コンテンツID:Integer
common_contentId: 'common_contentId',
// Local :共通(common)_コンテンツID:Integer
......@@ -1222,6 +1228,16 @@ var ClientData = {
}
},
// Session :事業者オプション(serviceOpt)_コンテンツ共有モード:Interger(0:なし , 1:ABook, 2:getits)
serviceOpt_content_share: function (data) {
if (arguments.length > 0) {
SessionStorageUtils.set(COMMON.Keys.serviceOpt_content_share, data);
} else {
return SessionStorageUtils.get(COMMON.Keys.serviceOpt_content_share);
}
},
// Session :事業者オプション(serviceOpt)_カタログエディション:Char(Y:可能, N:不可)
serviceOpt_catalog_edition: function (data) {
if (arguments.length > 0) {
......@@ -2199,10 +2215,10 @@ COMMON.unlockFunction = function(inputPass) {
var serviceOptionList = data.serviceOptionList;
$.each(serviceOptionList, function (i, option) {
if (option.serviceName == 'web_screen_lock') {
if (option.serviceOptionId == 60) {
ClientData.serviceOpt_web_screen_lock(option.value);
}
else if (option.serviceName == 'web_screen_lock_wait') {
else if (option.serviceOptionId == 61) {
ClientData.serviceOpt_web_screen_lock_wait(option.value);
}
});
......@@ -2850,3 +2866,130 @@ COMMON.isIE10 = function() {
}
return false;
};
//Check content type is pdf content
COMMON.isPdfContent = function(contentType){
if(!(contentType == COMMON.ContentTypeKeys.Type_PDF)){
return false;
}
else{
return true;
}
};
//set resource version data
COMMON.setResourceVersionData = function(conId) {
var tempResourceArr;
var tempResource;
//check if insert new or edit
var flag = false;
if (ClientData.ResourceVersion().length <= 0 || ClientData.ResourceVersion() == null || ClientData.ResourceVersion() == 'undefined') {
tempResourceArr = [];
}
else {
tempResourceArr = ClientData.ResourceVersion();
}
for (var i = 0; i < COMMON.resourceVersionArr.length; i++) {
if (COMMON.resourceVersionArr[i].contentid == conId) {
tempResource = COMMON.resourceVersionArr[i].resourceversion;
break;
}
}
if (tempResourceArr.length > 0) {
for (var j = 0; j < tempResourceArr.length; j++) {
if (tempResourceArr[j].contentid == conId) {
tempResourceArr[j].resourceversion = tempResource;
flag = true;
break;
}
else {
flag = false;
}
}
if (!flag) {
tempResourceArr.push({ contentid: conId, resourceversion: tempResource });
}
} else {
tempResourceArr.push({ contentid: conId, resourceversion: tempResource });
}
ClientData.ResourceVersion(tempResourceArr);
};
//set meta Version Data
COMMON.setMetaVersionData = function(conId) {
var tempMetaArr;
var tempMeta;
//check if insert new or edit
var flag = false;
if (ClientData.MetaVersion().length <= 0 || ClientData.MetaVersion() == null || ClientData.MetaVersion() == 'undefined') {
tempMetaArr = [];
}
else {
tempMetaArr = ClientData.MetaVersion();
}
for (var i = 0; i < COMMON.metaVersionArr.length; i++) {
if (COMMON.metaVersionArr[i].contentid == conId) {
tempMeta = COMMON.metaVersionArr[i].metaversion;
break;
}
}
if (tempMetaArr.length > 0) {
for (var j = 0; j < tempMetaArr.length; j++) {
if (tempMetaArr[j].contentid == conId) {
tempMetaArr[j].metaversion = tempMeta;
flag = true;
break;
}
else {
flag = false;
}
}
if (!flag) {
tempMetaArr.push({ contentid: conId, metaversion: tempMeta });
}
} else {
tempMetaArr.push({ contentid: conId, metaversion: tempMeta });
}
ClientData.MetaVersion(tempMetaArr);
};
//convert delivery Date
COMMON.formatDeliveryDate = function(date) {
var day = date.date;
var month = eval(date.month) + 1;
var year = eval(date.year) + 1900;
var outputDate = year + '/' + (('' + month).length < 2 ? '0' : '') + month + '/' + (('' + day).length < 2 ? '0' : '') + day;
return outputDate;
};
//convert view Date
COMMON.formatNormalDate = function(day, month, year) {
var outputDate = year + '/' + (('' + month).length < 2 ? '0' : '') + month + '/' + (('' + day).length < 2 ? '0' : '') + day;
return outputDate;
};
//format Image string
COMMON.formatStringBase64 = function(imgStr) {
var outputString = 'data:image/jpeg;base64,' + imgStr;
return outputString;
};
......@@ -30,8 +30,8 @@ var contentTypeArr = [];
//};
//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 resourceVersionArr = [];
//var metaVersionArr = [];
var totalPage;
var chkSearchTextEmpty = false;
var noRecordFlg = false;
......@@ -207,7 +207,7 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid)
var outputDate ="";
if(post.contentDeliveryDate!=null&&post.contentDeliveryDate!=undefined&&post.contentDeliveryDate!='undefined')
{
outputDate=formatDeliveryDate(post.contentDeliveryDate);
outputDate=COMMON.formatDeliveryDate(post.contentDeliveryDate);
}
/* $('#content-grid').append(
......@@ -271,7 +271,7 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid)
//assign thumbnail to array
var formatThumbnail = post.contentThumbnail;
if((formatThumbnail != null) && (formatThumbnail != 'undefined') && (formatThumbnail != '')){
formatThumbnail = formatStringBase64(formatThumbnail);
formatThumbnail = COMMON.formatStringBase64(formatThumbnail);
}
thumbnailArr.push({ contentId: post.contentId, thumbnail: formatThumbnail});
......@@ -288,10 +288,10 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid)
checkUserHasReadContent(post.contentId, post.resourceVersion, post.metaVersion);
//assign version to array
resourceVersionArr.push({ contentid: post.contentId, resourceversion: post.resourceVersion });
COMMON.resourceVersionArr.push({ contentid: post.contentId, resourceversion: post.resourceVersion });
//assign meta version to array
metaVersionArr.push({ contentid: post.contentId, metaversion: post.metaVersion });
COMMON.metaVersionArr.push({ contentid: post.contentId, metaversion: post.metaVersion });
//Check if content has marking or memo
checkContentMarkingMemoOption(post.contentId);
......@@ -504,10 +504,10 @@ function canvasClickFunction(e){
ClientData.ReadingContentIds(contentIdArray);
//Set ResouceVersion for content
setResourceVersionData(outputId);
COMMON.setResourceVersionData(outputId);
//Set MetaVersion for content
setMetaVersionData(outputId);
COMMON.setMetaVersionData(outputId);
//Close Submenu
$('#dlgSubMenu').hide();
......@@ -516,7 +516,7 @@ function canvasClickFunction(e){
drawEditImage(outputId);
//Open content Detail
openContentDetail();
DETAIL.openContentDetail();
};
//Re-render page from and total record
......@@ -818,15 +818,6 @@ function returnContentType(contentid){
}
};
//Check content type is pdf content
function isPdfContent(contentType){
if(!(contentType == COMMON.ContentTypeKeys.Type_PDF)){
return false;
}
else{
return true;
}
};
////Get resource Id of content
//function downloadResourceById(contentId){
// var params = {
......@@ -902,7 +893,7 @@ function readSubmenuFunction_callback(contentId)
var month = date.getMonth()+1;
var day = date.getDate();
var outputDate = formatNormalDate(day, month, date.getFullYear());
var outputDate = COMMON.formatNormalDate(day, month, date.getFullYear());
ClientData.contentInfo_contentId(contentId);
ClientData.contentInfo_contentThumbnail(contentThumbnail);
......@@ -945,10 +936,10 @@ function readSubmenuFunction_callback(contentId)
ClientData.ReadingContentIds(newArray);
//Set ResouceVersion for content
setResourceVersionData(contentId);
COMMON.setResourceVersionData(contentId);
//Set MetaVersion for content
setMetaVersionData(contentId);
COMMON.setMetaVersionData(contentId);
//Set data for readingcontentid
ClientData.ReadingContentIds(contentIdArray);
......@@ -1054,7 +1045,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) {
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
if(!isPdfContent(contentType)){
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){
imgThumb.src = src;
......@@ -1080,7 +1071,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) {
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
if(!isPdfContent(contentType)){
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){
imgThumb.src = src;
......@@ -1109,7 +1100,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) {
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
if(!isPdfContent(contentType)){
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){
imgThumb.src = src;
......@@ -1147,7 +1138,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) {
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
if(!isPdfContent(contentType)){
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){
imgThumb.src = src;
......@@ -1184,7 +1175,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer) {
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
if(!isPdfContent(contentType)){
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){
imgThumb.src = src;
......@@ -1304,95 +1295,6 @@ function renderViewDate(id){
}
};
//set resource version data
function setResourceVersionData(conId){
var tempResourceArr;
var tempResource;
//check if insert new or edit
var flag = false;
if(ClientData.ResourceVersion().length <= 0 || ClientData.ResourceVersion() == null || ClientData.ResourceVersion() == 'undefined'){
tempResourceArr = [];
}
else{
tempResourceArr = ClientData.ResourceVersion();
}
for(var i = 0; i < resourceVersionArr.length; i++){
if(resourceVersionArr[i].contentid == conId){
tempResource = resourceVersionArr[i].resourceversion;
break;
}
}
if(tempResourceArr.length > 0){
for(var j = 0; j < tempResourceArr.length; j++){
if(tempResourceArr[j].contentid == conId){
tempResourceArr[j].resourceversion = tempResource;
flag = true;
break;
}
else{
flag = false;
}
}
if(!flag){
tempResourceArr.push({contentid: conId, resourceversion: tempResource});
}
}else{
tempResourceArr.push({contentid: conId, resourceversion: tempResource});
}
ClientData.ResourceVersion(tempResourceArr);
};
//set meta Version Data
function setMetaVersionData(conId){
var tempMetaArr;
var tempMeta;
//check if insert new or edit
var flag = false;
if(ClientData.MetaVersion().length <= 0 || ClientData.MetaVersion() == null || ClientData.MetaVersion() == 'undefined'){
tempMetaArr = [];
}
else{
tempMetaArr = ClientData.MetaVersion();
}
for(var i = 0; i < metaVersionArr.length; i++){
if(metaVersionArr[i].contentid == conId){
tempMeta = metaVersionArr[i].metaversion;
break;
}
}
if(tempMetaArr.length > 0){
for(var j = 0; j < tempMetaArr.length; j++){
if(tempMetaArr[j].contentid == conId){
tempMetaArr[j].metaversion = tempMeta;
flag = true;
break;
}
else{
flag = false;
}
}
if(!flag){
tempMetaArr.push({contentid: conId, metaversion: tempMeta});
}
}else{
tempMetaArr.push({contentid: conId, metaversion: tempMeta});
}
ClientData.MetaVersion(tempMetaArr);
};
//handle display sort direction
function handleSortDisp(){
// $('#control-sort-title').removeClass('active_tops');
......@@ -1480,33 +1382,6 @@ function handleSortDisp(){
}
};
//convert delivery Date
function formatDeliveryDate(date){
var day = date.date;
var month = eval(date.month) + 1;
var year = eval(date.year) + 1900;
var outputDate = year + '/' + ((''+month).length<2 ? '0' : '') + month + '/' + ((''+day).length<2 ? '0' : '') + day;
return outputDate;
};
//convert view Date
function formatNormalDate(day, month, year){
var outputDate = year + '/' + ((''+month).length<2 ? '0' : '') + month + '/' + ((''+day).length<2 ? '0' : '') + day;
return outputDate;
};
//format Image string
function formatStringBase64(imgStr){
var outputString = 'data:image/jpeg;base64,'+imgStr;
return outputString;
};
//function Open SubMenu Dialog
function titleClickFunction(e){
if (e) {
......@@ -1558,10 +1433,10 @@ function titleClickFunction(e){
ClientData.ReadingContentIds(contentIdArray);
//Set ResouceVersion for content
setResourceVersionData(contentid);
COMMON.setResourceVersionData(contentid);
//Set MetaVersion for content
setMetaVersionData(contentid);
COMMON.setMetaVersionData(contentid);
//Close Submenu
$('#dlgSubMenu').hide();
......@@ -1570,7 +1445,7 @@ function titleClickFunction(e){
drawEditImage(contentid);
//Open content Detail
openContentDetail();
DETAIL.openContentDetail();
};
//Get Number Disp Record For List
......
/// コンテンツ詳細画面
var resourceIdDetail="";
//名前空間用のオブジェクトを用意する
var DETAIL = {};
var displayData = {
DETAIL.displayData = {
contentID: "",
contentTitle: "",
contentDetail: "",
......@@ -14,226 +15,188 @@ var displayData = {
// Init function of page
$(document).ready(function () {
//alert(ClientData.contentInfo_contentId());
//if (!avwCheckLogin(COMMON.ScreenIds.Login)) return;
//openContentDetail();
});
// Show content detail
function openContentDetail() {
if(!isPdfContent(ClientData.contentInfo_contentType())){
// $("#book_data").css('border-right','0');
// $("#book_data").css('float','none');
// $("#book_data").css('background-color','white');
// $("#book_data").css('margin-left','auto');
// $("#book_data").css('margin-right', 'auto');
DETAIL.openContentDetail = function() {
if(!COMMON.isPdfContent(ClientData.contentInfo_contentType())){
$('#sectionContentDetail').removeClass().addClass('sectiondetailnopdf');
}else
{
// $("#book_data").css('border-right','2px solid #CCC');
// $("#book_data").css('float','left');
// $("#book_data").css('background-color', '#f7f7f7');
}
else {
$('#sectionContentDetail').removeClass().addClass('sectiondetail');
}
displayData = {
contentID: "",
contentTitle: "",
contentDetail: "",
contentThumbnail: "",
deliveryDate: (new Date()),
pages: []
};
DETAIL.displayData = {
contentID: "",
contentTitle: "",
contentDetail: "",
contentThumbnail: "",
deliveryDate: (new Date()),
pages: []
};
// Clear childs
$('#book_list').html('');
// Clear childs
$('#book_list').html('');
// Clear display info
//$("#imgContentThumbnail").css('padding-top', "60px");
$("#imgContentThumbnail").attr('src', "img/data_loading.gif");
resetLoadingImageSize();
$("#imgContentThumbnail").attr('src', "img/data_loading.gif");
DETAIL.resetLoadingImageSize();
$("#txtContentTitle").text('');
$("#txtPubDt2_Dsp").text('');
$("#txtContentDetail").text('');
$("#txtContentTitle").text('');
$("#txtPubDt2_Dsp").text('');
$("#txtContentDetail").text('');
$("#contentDetailClose").click(contentDetailClose_Click);
$("#contentDetailClose").click(DETAIL.contentDetailClose_Click);
//$("#contentdetail_dspBack").click(contentdetail_dspBack_Click);
$("#contentdetail_dspRead").click(contentdetail_dspRead_Click);
$("#contentdetail_dspRead").click(DETAIL.contentdetail_dspRead_Click);
COMMON.lockLayout();
$("#contentDetail").css('z-index', 101);
$("#sectionContentDetail").show();
$("#contentDetail").show();
$("#contentDetail").center();
if ($("#contentDetail").height() > $(window).height()){
COMMON.lockLayout();
$("#contentDetail").css('z-index', 101);
$("#sectionContentDetail").show();
$("#contentDetail").show();
$("#contentDetail").center();
if ($("#contentDetail").height() > $(window).height()){
$("#contentDetail").css('top', '0');
}
// Get contentid, thumbnail from list screen
displayData.contentID = ClientData.contentInfo_contentId();
displayData.contentThumbnail = ClientData.contentInfo_contentThumbnail();
// Get content detail
avwCmsApi(ClientData.userInfo_accountPath(), "webGetContent", "GET", { contentId: displayData.contentID, sid: ClientData.userInfo_sid(), getType: 1 },
function (data) {
var contentType = ClientData.contentInfo_contentType();
// Get content detail
displayData.contentTitle = data.contentData.contentName;
displayData.contentDetail = data.contentData.contentDetail;
displayData.deliveryDate = COMMON.convertToDate(data.contentData.deliveryStartDate);
//Start Function : No.12 -- Editor : Viet Nguyen -- Date : 08/01/2013 -- Summary : Create new function to return content type of content.
if(!isPdfContent(contentType)){
ShowContentNotPDF(displayData.contentTitle,displayData.contentDetail,displayData.contentThumbnail,displayData.deliveryDate);
}else{
// Get pages
avwCmsApiSync(ClientData.userInfo_accountPath(), "webContentPage", "GET", { contentId: ClientData.contentInfo_contentId(), sid: ClientData.userInfo_sid(), thumbnailFlg: 1, pageNos: '1,2,3,4,5,6'},
function (data) {
// Get pages
for (var nIndex = 0; nIndex < data.pages.length; nIndex++) {
if (nIndex < 6) {
displayData.pages.push({ pageNo: data.pages[nIndex].pageNo, pageText: data.pages[nIndex].pageText, pageThumbnail: ("data:image/jpeg;base64," + data.pages[nIndex].pageThumbnail) });
}
}
// Show to screen
ShowContent(displayData.contentID, COMMON.truncate(displayData.contentTitle, 20), displayData.contentDetail, ClientData.contentInfo_contentThumbnail(), displayData.deliveryDate, displayData.pages);
},
null
);
}
//End Function : No.12 -- Editor : Viet Nguyen -- Date : 08/01/2013 -- Summary : Create new function to return content type of content.
},
null
);
// Get contentid, thumbnail from list screen
DETAIL.displayData.contentID = ClientData.contentInfo_contentId();
DETAIL.displayData.contentThumbnail = ClientData.contentInfo_contentThumbnail();
// Get content detail
avwCmsApi(ClientData.userInfo_accountPath(), "webGetContent", "GET", { contentId: DETAIL.displayData.contentID, sid: ClientData.userInfo_sid(), getType: 1 },
function (data) {
var contentType = ClientData.contentInfo_contentType();
// Get content detail
DETAIL.displayData.contentTitle = data.contentData.contentName;
DETAIL.displayData.contentDetail = data.contentData.contentDetail;
DETAIL.displayData.deliveryDate = COMMON.convertToDate(data.contentData.deliveryStartDate);
//Start Function : No.12 -- Editor : Viet Nguyen -- Date : 08/01/2013 -- Summary : Create new function to return content type of content.
if(!COMMON.isPdfContent(contentType)){
DETAIL.showContentNotPDF(DETAIL.displayData.contentTitle,DETAIL.displayData.contentDetail,DETAIL.displayData.contentThumbnail,DETAIL.displayData.deliveryDate);
}
else{
// Get pages
avwCmsApiSync(ClientData.userInfo_accountPath(), "webContentPage", "GET", { contentId: ClientData.contentInfo_contentId(), sid: ClientData.userInfo_sid(), thumbnailFlg: 1, pageNos: '1,2,3,4,5,6'},
function (data) {
// Get pages
for (var nIndex = 0; nIndex < data.pages.length; nIndex++) {
if (nIndex < 6) {
DETAIL.displayData.pages.push({ pageNo: data.pages[nIndex].pageNo, pageText: data.pages[nIndex].pageText, pageThumbnail: ("data:image/jpeg;base64," + data.pages[nIndex].pageThumbnail) });
}
}
// Show to screen
DETAIL.showContent(DETAIL.displayData.contentID, COMMON.truncate(DETAIL.displayData.contentTitle, 20), DETAIL.displayData.contentDetail, ClientData.contentInfo_contentThumbnail(), DETAIL.displayData.deliveryDate, DETAIL.displayData.pages);
},
null
);
}
//End Function : No.12 -- Editor : Viet Nguyen -- Date : 08/01/2013 -- Summary : Create new function to return content type of content.
},
null
);
};
// Close content detail
function contentDetailClose_Click(e) {
e.preventDefault();
COMMON.unlockLayout();
$("#contentDetail").hide();
$("#sectionContentDetail").hide();
DETAIL.contentDetailClose_Click = function(e) {
e.preventDefault();
COMMON.unlockLayout();
$("#contentDetail").hide();
$("#sectionContentDetail").hide();
};
/*
----------------------------------------------------------------------------
Event groups [start]
----------------------------------------------------------------------------
*/
function contentdetail_dspRead_Click(e) {
e.preventDefault();
var outputId = ClientData.contentInfo_contentId();
checkLimitContent(outputId,
function () {
contentdetail_dspRead_Click_callback(outputId);
},
function(){
},
1
);
DETAIL.contentdetail_dspRead_Click = function(e) {
e.preventDefault();
var outputId = ClientData.contentInfo_contentId();
checkLimitContent(outputId,
function () {
DETAIL.contentdetail_dspRead_Click_callback(outputId);
},
function(){
},
1
);
};
function contentdetail_dspRead_Click_callback(outputId) {
var date = new Date();
var month = date.getMonth() + 1;
var day = date.getDate();
var outputDate = formatNormalDate(day, month, date.getFullYear());
var contentIdArray = [];
var checkflag = false;
//Store Content id that user has read
if (ClientData.ReadingContentIds().length > 0) {
contentIdArray = ClientData.ReadingContentIds();
for (var nIndex = 0; nIndex < contentIdArray.length; nIndex++) {
if (contentIdArray[nIndex].contentid == outputId) {
checkflag = true;
if (contentIdArray[nIndex].viewdate == '' || contentIdArray[nIndex].viewdate == null || contentIdArray[nIndex].viewdate == 'undefined') {
contentIdArray[nIndex].viewdate = outputDate;
contentIdArray[nIndex].originviewdate = date;
}
break;
}
else {
checkflag = false;
}
}
DETAIL.contentdetail_dspRead_Click_callback = function(outputId) {
if (!checkflag) {
contentIdArray.push({ contentid: outputId, viewdate: outputDate, originviewdate: date });
}
}
else {
contentIdArray.push({ contentid: outputId, viewdate: outputDate, originviewdate: date });
}
//Renew ReadingContentID
var newArray = [];
ClientData.ReadingContentIds(newArray);
//Set data for readingcontentid
ClientData.ReadingContentIds(contentIdArray);
//Set ResouceVersion for content
setResourceVersionData(outputId);
//Set MetaVersion for content
setMetaVersionData(outputId);
var date = new Date();
var month = date.getMonth() + 1;
var day = date.getDate();
var outputDate = COMMON.formatNormalDate(day, month, date.getFullYear());
var contentIdArray = [];
var checkflag = false;
// Redirect to screen: contentview
//$('body,html').animate({ scrollTop: 0 }, 0);
ClientData.IsRefresh(false);
if (ClientData.contentInfo_contentType() == COMMON.ContentTypeKeys.Type_Others) {
// Get content detail
HEADER.downloadResourceById(ClientData.contentInfo_contentId());
}
else if(ClientData.contentInfo_contentType() == COMMON.ContentTypeKeys.Type_Link){
// Get content detail
HEADER.viewLinkContentById(ClientData.contentInfo_contentId());
}
else {
avwScreenMove(COMMON.ScreenIds.ContentView);
}
//Store Content id that user has read
if (ClientData.ReadingContentIds().length > 0) {
contentIdArray = ClientData.ReadingContentIds();
for (var nIndex = 0; nIndex < contentIdArray.length; nIndex++) {
if (contentIdArray[nIndex].contentid == outputId) {
checkflag = true;
if (contentIdArray[nIndex].viewdate == '' || contentIdArray[nIndex].viewdate == null || contentIdArray[nIndex].viewdate == 'undefined') {
contentIdArray[nIndex].viewdate = outputDate;
contentIdArray[nIndex].originviewdate = date;
}
break;
}
else {
checkflag = false;
}
}
if (!checkflag) {
contentIdArray.push({ contentid: outputId, viewdate: outputDate, originviewdate: date });
}
}
else {
contentIdArray.push({ contentid: outputId, viewdate: outputDate, originviewdate: date });
}
//Renew ReadingContentID
var newArray = [];
ClientData.ReadingContentIds(newArray);
//Set data for readingcontentid
ClientData.ReadingContentIds(contentIdArray);
//Set ResouceVersion for content
COMMON.setResourceVersionData(outputId);
//Set MetaVersion for content
COMMON.setMetaVersionData(outputId);
// Redirect to screen: contentview
//$('body,html').animate({ scrollTop: 0 }, 0);
ClientData.IsRefresh(false);
if (ClientData.contentInfo_contentType() == COMMON.ContentTypeKeys.Type_Others) {
// Get content detail
HEADER.downloadResourceById(ClientData.contentInfo_contentId());
}
else if(ClientData.contentInfo_contentType() == COMMON.ContentTypeKeys.Type_Link){
// Get content detail
HEADER.viewLinkContentById(ClientData.contentInfo_contentId());
}
else {
avwScreenMove(COMMON.ScreenIds.ContentView);
}
};
//Start Function : No.12 -- Editor : Viet Nguyen -- Date : 08/01/2013 -- Summary : Create new function to return content type of content.
///* get url */
//function getURL(apiName) {
// var sysSettings = avwSysSetting();
// var url = sysSettings.apiResourceDlUrl;
// url = AVWEB.format(url, ClientData.userInfo_accountPath()) + '/' + apiName;
// return url;
//};
//Check content type is pdf content
function isPdfContent(contentType){
if(!(contentType == COMMON.ContentTypeKeys.Type_PDF)){
return false;
}
else{
return true;
}
};
function ShowContentNotPDF(contentTitle, contentDetail, contentThumbnail, deliveryDate) {
DETAIL.showContentNotPDF = function(contentTitle, contentDetail, contentThumbnail, deliveryDate) {
$("#txtPubDt2_Dsp").text(deliveryDate.jpDateString() + " " + deliveryDate.jpShortTimeString());
$("#txtContentDetail").text(contentDetail);
$("#txtContentTitle").text(contentTitle);
......@@ -241,7 +204,7 @@ function ShowContentNotPDF(contentTitle, contentDetail, contentThumbnail, delive
var tempContentType = ClientData.contentInfo_contentType();
if(contentThumbnail == '' || contentThumbnail == null || contentThumbnail == 'undefined'){
if(!isPdfContent(tempContentType)){
if(!COMMON.isPdfContent(tempContentType)){
var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){
contentThumbnail = src;
......@@ -280,7 +243,7 @@ function ShowContentNotPDF(contentTitle, contentDetail, contentThumbnail, delive
//End Function : No.12 -- Editor : Viet Nguyen -- Date : 08/01/2013 -- Summary : Create new function to return content type of content.
// Show detail content
function ShowContent(contentID, contentTitle, contentDetail, contentThumbnail, deliveryDate, pages) {
DETAIL.showContent = function(contentID, contentTitle, contentDetail, contentThumbnail, deliveryDate, pages) {
$("#txtPubDt2_Dsp").text(deliveryDate.jpDateString() + " " + deliveryDate.jpShortTimeString());
$("#txtContentDetail").text(contentDetail);
$("#txtContentTitle").text(contentTitle);
......@@ -315,12 +278,11 @@ function ShowContent(contentID, contentTitle, contentDetail, contentThumbnail, d
// Show pages
for (var nIndex = 0; nIndex < pages.length; nIndex++) {
//insertRow(imgSample, pages[nIndex].pageText, pages[nIndex].pageNo);
insertRow(pages[nIndex].pageThumbnail, COMMON.truncate(COMMON.getLines(pages[nIndex].pageText, 3), 45), pages[nIndex].pageNo); //55
DETAIL.insertRow(pages[nIndex].pageThumbnail, COMMON.truncate(COMMON.getLines(pages[nIndex].pageText, 3), 45), pages[nIndex].pageNo); //55
}
};
function insertRow(pageThumbnail, pageText, pageNo) {
DETAIL.insertRow = function(pageThumbnail, pageText, pageNo) {
var newRow = "";
newRow += "<ul>";
newRow += '<li class="list_img"><img src="' + pageThumbnail + '" alt="" width="90" /></li>';
......@@ -352,162 +314,24 @@ function insertRow(pageThumbnail, pageText, pageNo) {
imgTemp.src = pageThumbnail;
};
function insertRow1(pageThumbnail, pageText, pageNo) {
var newRow = "";
newRow += "<tr>";
newRow += "<td id='left'>";
newRow += '<img src="' + pageThumbnail;
newRow += '" id="imgPageThumbnail" alt="" width="50" height="50"/>';
newRow += "</td>";
newRow += "<td>";
newRow += '<div><label id="Label1">' + pageText + '</label></div>';
newRow += '<div><label id="Label2" class="lang" lang="txtPage">ページ:</label><label id="Label3">' + pageNo + '</label></div>';
newRow += "</td>";
newRow += "</tr>";
$('#contentdetail_grid tr:last').after(newRow);
//changeLanguage(ClientData.userInfo_language());
I18N.i18nReplaceText();
};
//set resource version data
function setResourceVersionData(conId){
var tempResourceArr;
var tempResource;
//check if insert new or edit
var flag = false;
if(ClientData.ResourceVersion().length <= 0 || ClientData.ResourceVersion() == null || ClientData.ResourceVersion() == 'undefined'){
tempResourceArr = [];
}
else{
tempResourceArr = ClientData.ResourceVersion();
}
for(var i = 0; i < resourceVersionArr.length; i++){
if(resourceVersionArr[i].contentid == conId){
tempResource = resourceVersionArr[i].resourceversion;
break;
}
}
if(tempResourceArr.length > 0){
for(var j = 0; j < tempResourceArr.length; j++){
if(tempResourceArr[j].contentid == conId){
tempResourceArr[j].resourceversion = tempResource;
flag = true;
break;
}
else{
flag = false;
}
}
if(!flag){
tempResourceArr.push({contentid: conId, resourceversion: tempResource});
}
}else{
tempResourceArr.push({contentid: conId, resourceversion: tempResource});
}
ClientData.ResourceVersion(tempResourceArr);
};
//set meta Version Data
function setMetaVersionData(conId){
var tempMetaArr;
var tempMeta;
//check if insert new or edit
var flag = false;
if(ClientData.MetaVersion().length <= 0 || ClientData.MetaVersion() == null || ClientData.MetaVersion() == 'undefined'){
tempMetaArr = [];
}
else{
tempMetaArr = ClientData.MetaVersion();
}
for(var i = 0; i < metaVersionArr.length; i++){
if(metaVersionArr[i].contentid == conId){
tempMeta = metaVersionArr[i].metaversion;
break;
}
}
if(tempMetaArr.length > 0){
for(var j = 0; j < tempMetaArr.length; j++){
if(tempMetaArr[j].contentid == conId){
tempMetaArr[j].metaversion = tempMeta;
flag = true;
break;
}
else{
flag = false;
}
}
if(!flag){
tempMetaArr.push({contentid: conId, metaversion: tempMeta});
}
}else{
tempMetaArr.push({contentid: conId, metaversion: tempMeta});
}
ClientData.MetaVersion(tempMetaArr);
};
function formatNormalDate(day, month, year) {
var outputDate = year + '/' + (('' + month).length < 2 ? '0' : '') + month + '/' + (('' + day).length < 2 ? '0' : '') + day;
return outputDate;
};
//function contentdetail_dspBack_Click() {
//parent.history.back();
//$(this).parent().parent().parent().parent().parent().parent().parent().hide();
//$(this).parent().parent().parent().parent().parent().parent().parent().dialog('close');
//}
/*
----------------------------------------------------------------------------
Event groups [ end ]
----------------------------------------------------------------------------
*/
/*
----------------------------------------------------------------------------
Setting dialog [start]
----------------------------------------------------------------------------
*/
$(function () {
});
/*
----------------------------------------------------------------------------
Setting dialog [ end ]
----------------------------------------------------------------------------
*/
//function truncate(strInput, length){
// if (strInput.length <= length)
// {
// return strInput;
// }
// else
// {
// return strInput.substring(0, length) + "...";
// }
//};
function resetLoadingImageSize(){
DETAIL.resetLoadingImageSize = function(){
$("#imgContentThumbnail").attr('height','25px');
$("#imgContentThumbnail").attr('width','25px');
};
......@@ -32,8 +32,8 @@ var contentTypeArr = [];
//};
//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 resourceVersionArr = [];
//var metaVersionArr = [];
var totalPage;
var contentViewData = [];
var noRecordFlg = false;
......@@ -143,7 +143,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 outputDate = formatDeliveryDate(post.contentDeliveryDate);
var outputDate = COMMON.formatDeliveryDate(post.contentDeliveryDate);
//renderViewDate
var viewdate = renderViewDate(post.contentId);
......@@ -221,7 +221,7 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid)
//assign thumbnail to array
var formatThumbnail = post.contentThumbnail;
if((formatThumbnail != null) && (formatThumbnail != 'undefined') && (formatThumbnail != '')){
formatThumbnail = formatStringBase64(formatThumbnail);
formatThumbnail = COMMON.formatStringBase64(formatThumbnail);
}
thumbnailArr.push({ contentId: post.contentId, thumbnail: formatThumbnail});
......@@ -235,10 +235,10 @@ function renderContent(id, text, division, type, order, from, to, cateid, grpid)
checkUserHasReadContent(post.contentId, post.resourceVersion, post.metaVersion);
//assign version to array
resourceVersionArr.push({ contentid: post.contentId, resourceversion: post.resourceVersion });
COMMON.resourceVersionArr.push({ contentid: post.contentId, resourceversion: post.resourceVersion });
//assign meta version to array
metaVersionArr.push({ contentid: post.contentId, metaversion: post.metaVersion });
COMMON.metaVersionArr.push({ contentid: post.contentId, metaversion: post.metaVersion });
//Check if content has marking or memo
checkContentMarkingMemoOption(post.contentId);
......@@ -414,16 +414,16 @@ function canvasClickFunction(e){
ClientData.ReadingContentIds(contentIdArray);
//Set ResouceVersion for content
setResourceVersionData(outputId);
COMMON.setResourceVersionData(outputId);
//Set MetaVersion for content
setMetaVersionData(outputId);
COMMON.setMetaVersionData(outputId);
//Delete 'new' icon
drawEditImage(outputId);
//Open content Detail
openContentDetail();
DETAIL.openContentDetail();
};
//Re-render page from and total record
......@@ -714,16 +714,6 @@ function returnContentType(contentid){
}
};
//Check content type is pdf content
function isPdfContent(contentType){
if(!(contentType == COMMON.ContentTypeKeys.Type_PDF)){
return false;
}
else{
return true;
}
};
////Get resource Id of content
//function downloadResourceById(contentId){
// var params = {
......@@ -800,7 +790,7 @@ function readSubmenuFunction_callback(contentId)
var month = date.getMonth()+1;
var day = date.getDate();
var outputDate = formatNormalDate(day, month, date.getFullYear());
var outputDate = COMMON.formatNormalDate(day, month, date.getFullYear());
ClientData.contentInfo_contentId(contentId);
ClientData.contentInfo_contentThumbnail(contentThumbnail);
......@@ -842,10 +832,10 @@ function readSubmenuFunction_callback(contentId)
ClientData.ReadingContentIds(newArray);
//Set ResouceVersion for content
setResourceVersionData(contentId);
COMMON.setResourceVersionData(contentId);
//Set MetaVersion for content
setMetaVersionData(contentId);
COMMON.setMetaVersionData(contentId);
//Set data for readingcontentid
ClientData.ReadingContentIds(contentIdArray);
......@@ -951,7 +941,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer){
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
if(!isPdfContent(contentType)){
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){
imgThumb.src = src;
......@@ -975,7 +965,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer){
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
if(!isPdfContent(contentType)){
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){
imgThumb.src = src;
......@@ -1001,7 +991,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer){
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
if(!isPdfContent(contentType)){
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){
imgThumb.src = src;
......@@ -1035,7 +1025,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer){
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
if(!isPdfContent(contentType)){
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){
imgThumb.src = src;
......@@ -1069,7 +1059,7 @@ function checkUserHasReadContent(contId, resourceVer, metaVer){
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
if(!isPdfContent(contentType)){
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){
imgThumb.src = src;
......@@ -1253,33 +1243,6 @@ function handleSortDisp(){
}
};
//convert delivery Date
function formatDeliveryDate(date){
var day = date.date;
var month = eval(date.month) + 1;
var year = eval(date.year) + 1900;
var outputDate = year + '/' + ((''+month).length<2 ? '0' : '') + month + '/' + ((''+day).length<2 ? '0' : '') + day;
return outputDate;
};
//convert view Date
function formatNormalDate(day, month, year){
var outputDate = year + '/' + ((''+month).length<2 ? '0' : '') + month + '/' + ((''+day).length<2 ? '0' : '') + day;
return outputDate;
};
//format Image string
function formatStringBase64(imgStr){
var outputString = 'data:image/jpeg;base64,'+imgStr;
return outputString;
};
//function Open SubMenu Dialog
function titleClickFunction(e){
if (e) {
......@@ -1331,16 +1294,16 @@ function titleClickFunction(e){
ClientData.ReadingContentIds(contentIdArray);
//Set ResouceVersion for content
setResourceVersionData(contentid);
COMMON.setResourceVersionData(contentid);
//Set MetaVersion for content
setMetaVersionData(contentid);
COMMON.setMetaVersionData(contentid);
//Delete 'new' icon
drawEditImage(contentid);
//Open content Detail
openContentDetail();
DETAIL.openContentDetail();
};
//refresh sort order
......@@ -1422,11 +1385,11 @@ 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: formatStringBase64(strThumbnail),contenttype:contentType });
contentViewData.push({contentid: strContentId, originviewdate: formatDate(returnOriginalViewDate(strContentId)), contenttitle: strTitle, contenttitlekana: strTitleKana, deliverydate: strDelivDate, resourceversion: strResourceVersion, metaversion: strMetaVersion, thumbnail: COMMON.formatStringBase64(strThumbnail),contenttype:contentType });
}
}else{
contentViewData.push({contentid: strContentId, originviewdate: formatDate(returnOriginalViewDate(strContentId)), contenttitle: strTitle, contenttitlekana: strTitleKana, deliverydate: strDelivDate, resourceversion: strResourceVersion, metaversion: strMetaVersion, thumbnail: formatStringBase64(strThumbnail),contenttype:contentType });
contentViewData.push({contentid: strContentId, originviewdate: formatDate(returnOriginalViewDate(strContentId)), contenttitle: strTitle, contenttitlekana: strTitleKana, deliverydate: strDelivDate, resourceversion: strResourceVersion, metaversion: strMetaVersion, thumbnail: COMMON.formatStringBase64(strThumbnail),contenttype:contentType });
}
};
......@@ -1644,7 +1607,7 @@ function renderContentAfterSort(contentSortArr){
for(var i = 0; i < contentSortArr.length; i++) {
post = contentSortArr[i];
var outputDeliveryDate = formatDeliveryDate(post.deliverydate);
var outputDeliveryDate = COMMON.formatDeliveryDate(post.deliverydate);
/*htmlTemp += '<section class="sectionhistory">'
+ ' <div class="cnt_section">'
+ ' <a class="img">'
......
......@@ -20,8 +20,8 @@ HOME.thumbnailArr = [];
HOME.contentTypeArr = [];
HOME.contentIdArray = [];
HOME.resourceVersionArr = [];
HOME.metaVersionArr = [];
//HOME.resourceVersionArr = [];
//HOME.metaVersionArr = [];
HOME.errorPage = [];
HOME.errorContent = [];
HOME.dataGroup;
......@@ -460,7 +460,7 @@ HOME.canvasClickFunction_callback = function(outputId)
var date = new Date();
var month = date.getMonth() + 1;
var day = date.getDate();
var outputDate = HOME.formatNormalDate(day, month, date.getFullYear());
var outputDate = COMMON.formatNormalDate(day, month, date.getFullYear());
var checkflag = false;
var base64String = HOME.returnThumbnail(outputId);
......@@ -509,10 +509,10 @@ HOME.canvasClickFunction_callback = function(outputId)
ClientData.ReadingContentIds(HOME.contentIdArray);
//Set ResouceVersion for content
HOME.setResourceVersionData(outputId);
COMMON.setResourceVersionData(outputId);
//Set MetaVersion for content
HOME.setMetaVersionData(outputId);
COMMON.setMetaVersionData(outputId);
//Close Submenu
$('#dlgSubMenu').hide();
......@@ -521,7 +521,7 @@ HOME.canvasClickFunction_callback = function(outputId)
HOME.drawEditImage(outputId);
//Open content Detail
openContentDetail();
DETAIL.openContentDetail();
}
else {
......@@ -559,10 +559,10 @@ HOME.canvasClickFunction_callback = function(outputId)
ClientData.ReadingContentIds(HOME.contentIdArray);
//Set ResouceVersion for content
HOME.setResourceVersionData(outputId);
COMMON.setResourceVersionData(outputId);
//Set MetaVersion for content
HOME.setMetaVersionData(outputId);
COMMON.setMetaVersionData(outputId);
//$('body,html').animate({ scrollTop: 0 }, 0);
ClientData.IsRefresh(false);
......@@ -620,10 +620,10 @@ HOME.canvasClickFunction_callback = function(outputId)
ClientData.ReadingContentIds(HOME.contentIdArray);
//Set ResouceVersion for content
HOME.setResourceVersionData(outputId);
COMMON.setResourceVersionData(outputId);
//Set MetaVersion for content
HOME.setMetaVersionData(outputId);
COMMON.setMetaVersionData(outputId);
//Close Submenu
$('#dlgSubMenu').hide();
......@@ -632,7 +632,7 @@ HOME.canvasClickFunction_callback = function(outputId)
HOME.drawEditImage(outputId);
//Open content Detail
openContentDetail();
DETAIL.openContentDetail();
}
else {
......@@ -670,10 +670,10 @@ HOME.canvasClickFunction_callback = function(outputId)
ClientData.ReadingContentIds(HOME.contentIdArray);
//Set ResouceVersion for content
HOME.setResourceVersionData(outputId);
COMMON.setResourceVersionData(outputId);
//Set MetaVersion for content
HOME.setMetaVersionData(outputId);
COMMON.setMetaVersionData(outputId);
//$('body,html').animate({ scrollTop: 0 }, 0);
ClientData.IsRefresh(false);
......@@ -757,10 +757,10 @@ HOME.openSubMenuDialogFunction = function(e) {
ClientData.ReadingContentIds(HOME.contentIdArray);
//Set ResouceVersion for content
HOME.setResourceVersionData(contentid);
COMMON.setResourceVersionData(contentid);
//Set MetaVersion for content
HOME.setMetaVersionData(contentid);
COMMON.setMetaVersionData(contentid);
//Close Submenu
$('#dlgSubMenu').hide();
......@@ -768,7 +768,7 @@ HOME.openSubMenuDialogFunction = function(e) {
//Delete 'new' icon
HOME.drawEditImage(contentid);
openContentDetail();
DETAIL.openContentDetail();
}
else if (HOME.isShowBookShelf) {
......@@ -838,10 +838,10 @@ HOME.openSubMenuDialogFunction = function(e) {
ClientData.ReadingContentIds(HOME.contentIdArray);
//Set ResouceVersion for content
HOME.setResourceVersionData(contentid);
COMMON.setResourceVersionData(contentid);
//Set MetaVersion for content
HOME.setMetaVersionData(contentid);
COMMON.setMetaVersionData(contentid);
//Close Submenu
$('#dlgSubMenu').hide();
......@@ -849,7 +849,7 @@ HOME.openSubMenuDialogFunction = function(e) {
//Delete 'new' icon
HOME.drawEditImage(contentid);
openContentDetail();
DETAIL.openContentDetail();
}
else if (HOME.isShowBookShelf) {
......@@ -1363,10 +1363,10 @@ HOME.detailsSubmenuFunction = function(e) {
ClientData.ReadingContentIds(HOME.contentIdArray);
//Set ResouceVersion for content
HOME.setResourceVersionData(contentId);
COMMON.setResourceVersionData(contentId);
//Set MetaVersion for content
HOME.setMetaVersionData(contentId);
COMMON.setMetaVersionData(contentId);
// Close popup menu
$('#dlgSubMenu').hide();
......@@ -1375,7 +1375,7 @@ HOME.detailsSubmenuFunction = function(e) {
HOME.drawEditImage(contentId);
// Show detail
openContentDetail();
DETAIL.openContentDetail();
};
//Dialog Read Button CLick
......@@ -1415,7 +1415,7 @@ HOME.readSubmenuFunction_callback = function(contentId)
var month = date.getMonth() + 1;
var day = date.getDate();
var outputDate = HOME.formatNormalDate(day, month, date.getFullYear());
var outputDate = COMMON.formatNormalDate(day, month, date.getFullYear());
ClientData.contentInfo_contentId(contentId);
ClientData.contentInfo_contentThumbnail(contentThumbnail);
......@@ -1458,10 +1458,10 @@ HOME.readSubmenuFunction_callback = function(contentId)
ClientData.ReadingContentIds(newArray);
//Set ResouceVersion for content
HOME.setResourceVersionData(contentId);
COMMON.setResourceVersionData(contentId);
//Set MetaVersion for content
HOME.setMetaVersionData(contentId);
COMMON.setMetaVersionData(contentId);
//Set data for readingcontentid
ClientData.ReadingContentIds(HOME.contentIdArray);
......@@ -1778,7 +1778,7 @@ HOME.renderContent = function(id, text, division, type, order, from, to, cateid,
$.each(data.contentList, function (i, post) {
var outputDate = HOME.formatDeliveryDate(post.contentDeliveryDate);
var outputDate = COMMON.formatDeliveryDate(post.contentDeliveryDate);
if (HOME.isShowBookShelf == null) {
if (ClientData.sortOpt_viewMode() == COMMON.Consts.ConstDisplayMode_BookShelf) {
......@@ -1904,7 +1904,7 @@ HOME.renderContent = function(id, text, division, type, order, from, to, cateid,
//assign thumbnail to array
var formatThumbnail = post.contentThumbnail;
if((formatThumbnail != null) && (formatThumbnail != 'undefined') && (formatThumbnail != '')){
formatThumbnail = HOME.formatStringBase64(formatThumbnail);
formatThumbnail = COMMON.formatStringBase64(formatThumbnail);
}
HOME.thumbnailArr.push({ contentId: post.contentId, thumbnail: formatThumbnail});
......@@ -1920,10 +1920,10 @@ HOME.renderContent = function(id, text, division, type, order, from, to, cateid,
//Check if user has read this content or not.
HOME.checkUserHasReadContent(post.contentId, post.resourceVersion, post.metaVersion);
//assign version to array
HOME.resourceVersionArr.push({ contentid: post.contentId, resourceversion: post.resourceVersion });
COMMON.resourceVersionArr.push({ contentid: post.contentId, resourceversion: post.resourceVersion });
//assign meta version to array
HOME.metaVersionArr.push({ contentid: post.contentId, metaversion: post.metaVersion });
COMMON.metaVersionArr.push({ contentid: post.contentId, metaversion: post.metaVersion });
//Check if content has marking or memo
HOME.checkContentMarkingMemoOption(post.contentId);
......@@ -2043,16 +2043,6 @@ HOME.returnContentType = function(contentid){
}
};
//Check content type is pdf content
HOME.isPdfContent = function(contentType){
if(!(contentType == COMMON.ContentTypeKeys.Type_PDF)){
return false;
}
else{
return true;
}
};
//function createIframeForDownload(url){
//};
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Create new function to return content type of content.
......@@ -2137,7 +2127,7 @@ HOME.checkUserHasReadContent = function(contId, resourceVer, metaVer) {
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
if(!HOME.isPdfContent(contentType)){
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){
imgThumb.src = src;
......@@ -2163,7 +2153,7 @@ HOME.checkUserHasReadContent = function(contId, resourceVer, metaVer) {
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
if(!HOME.isPdfContent(contentType)){
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){
imgThumb.src = src;
......@@ -2192,7 +2182,7 @@ HOME.checkUserHasReadContent = function(contId, resourceVer, metaVer) {
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
if(!HOME.isPdfContent(contentType)){
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){
imgThumb.src = src;
......@@ -2230,7 +2220,7 @@ HOME.checkUserHasReadContent = function(contId, resourceVer, metaVer) {
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
if(!HOME.isPdfContent(contentType)){
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){
imgThumb.src = src;
......@@ -2267,7 +2257,7 @@ HOME.checkUserHasReadContent = function(contId, resourceVer, metaVer) {
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
if(!HOME.isPdfContent(contentType)){
if(!COMMON.isPdfContent(contentType)){
var src = HEADER.getThumbnailForOtherType(contentType);
if( src != '' ){
imgThumb.src = src;
......@@ -2330,95 +2320,6 @@ HOME.renderViewDate = function(id) {
}
};
//set resource version data
HOME.setResourceVersionData = function(conId) {
var tempResourceArr;
var tempResource;
//check if insert new or edit
var flag = false;
if (ClientData.ResourceVersion().length <= 0 || ClientData.ResourceVersion() == null || ClientData.ResourceVersion() == 'undefined') {
tempResourceArr = [];
}
else {
tempResourceArr = ClientData.ResourceVersion();
}
for (var i = 0; i < HOME.resourceVersionArr.length; i++) {
if (HOME.resourceVersionArr[i].contentid == conId) {
tempResource = HOME.resourceVersionArr[i].resourceversion;
break;
}
}
if (tempResourceArr.length > 0) {
for (var j = 0; j < tempResourceArr.length; j++) {
if (tempResourceArr[j].contentid == conId) {
tempResourceArr[j].resourceversion = tempResource;
flag = true;
break;
}
else {
flag = false;
}
}
if (!flag) {
tempResourceArr.push({ contentid: conId, resourceversion: tempResource });
}
} else {
tempResourceArr.push({ contentid: conId, resourceversion: tempResource });
}
ClientData.ResourceVersion(tempResourceArr);
};
//set meta Version Data
HOME.setMetaVersionData = function(conId) {
var tempMetaArr;
var tempMeta;
//check if insert new or edit
var flag = false;
if (ClientData.MetaVersion().length <= 0 || ClientData.MetaVersion() == null || ClientData.MetaVersion() == 'undefined') {
tempMetaArr = [];
}
else {
tempMetaArr = ClientData.MetaVersion();
}
for (var i = 0; i < HOME.metaVersionArr.length; i++) {
if (HOME.metaVersionArr[i].contentid == conId) {
tempMeta = HOME.metaVersionArr[i].metaversion;
break;
}
}
if (tempMetaArr.length > 0) {
for (var j = 0; j < tempMetaArr.length; j++) {
if (tempMetaArr[j].contentid == conId) {
tempMetaArr[j].metaversion = tempMeta;
flag = true;
break;
}
else {
flag = false;
}
}
if (!flag) {
tempMetaArr.push({ contentid: conId, metaversion: tempMeta });
}
} else {
tempMetaArr.push({ contentid: conId, metaversion: tempMeta });
}
ClientData.MetaVersion(tempMetaArr);
};
//handle display sort direction
HOME.handleSortDisp = function() {
$('#control-sort-title').removeClass('active_tops');
......@@ -2452,33 +2353,6 @@ HOME.handleSortDisp = function() {
}
};
//convert delivery Date
HOME.formatDeliveryDate = function(date) {
var day = date.date;
var month = eval(date.month) + 1;
var year = eval(date.year) + 1900;
var outputDate = year + '/' + (('' + month).length < 2 ? '0' : '') + month + '/' + (('' + day).length < 2 ? '0' : '') + day;
return outputDate;
};
//convert view Date
HOME.formatNormalDate = function(day, month, year) {
var outputDate = year + '/' + (('' + month).length < 2 ? '0' : '') + month + '/' + (('' + day).length < 2 ? '0' : '') + day;
return outputDate;
};
//format Image string
HOME.formatStringBase64 = function(imgStr) {
var outputString = 'data:image/jpeg;base64,' + imgStr;
return outputString;
};
//Get Number Disp Record For List
HOME.returnNumberDispRecordForBookShelf = function() {
var toPage = 0;
......
......@@ -443,51 +443,49 @@ LOGIN.saveServiceUserOption = function(){
$.each(LOGIN.optionList, function (i, option) {
if (option.serviceName == 'force_pw_change_periodically') {
if (option.serviceOptionId == 22) {
ClientData.serviceOpt_force_pw_change_periodically(option.value);
}
else if (option.serviceName == 'force_pw_change_on_login') {
else if (option.serviceOptionId == 21) {
ClientData.serviceOpt_force_pw_change_on_login(option.value);
}
// No.8: do not use serviceOpt_force_login_periodically
// else if (option.serviceName == 'force_login_periodically') {
// ClientData.serviceOpt_force_login_periodically(option.value);
// }
else if (option.serviceName == 'marking') {
else if (option.serviceOptionId == 33) {
ClientData.serviceOpt_marking(option.value);
}
else if (option.serviceName == 'user_data_backup') {
else if (option.serviceOptionId == 28) {
ClientData.serviceOpt_user_data_backup(option.value);
}
else if (option.serviceName == 'web_screen_lock') {
else if (option.serviceOptionId == 60) {
ClientData.serviceOpt_web_screen_lock(option.value);
}
else if (option.serviceName == 'web_screen_lock_wait') {
else if (option.serviceOptionId == 61) {
ClientData.serviceOpt_web_screen_lock_wait(option.value);
}
else if( option.serviceName == 'catalog_edition' ) {
else if( option.serviceOptionId == 70) {
ClientData.serviceOpt_catalog_edition(option.value);
}
else if( option.serviceName == 'hibiyakadan_catalog' ) {
else if( option.serviceOptionId == 77) {
ClientData.serviceOpt_hibiyakadan_catalog(option.value);
}
else if( option.serviceName == 'usable_readinglog_gps' ) {
else if( option.serviceOptionId == 71) {
ClientData.serviceOpt_usable_readinglog_gps(option.value);
}
else if( option.serviceName == 'usable_readinglog_object' ) {
else if( option.serviceOptionId == 72) {
ClientData.serviceOpt_usable_readinglog_object(option.value);
}
else if( option.serviceName == 'reader_usable_readinglog_gps' ) {
else if( option.serviceOptionId == 83) {
ClientData.serviceOpt_reader_usable_readinglog_gps(option.value);
}
else if( option.serviceName == 'reader_readinglog_object' ) {
else if( option.serviceOptionId == 84) {
ClientData.serviceOpt_reader_readinglog_object(option.value);
}
else if( option.serviceName == 'daihatsu' ) {
else if( option.serviceOptionId == 87) {
ClientData.serviceOpt_daihatsu(option.value);
}
else if( option.serviceOptionId == 78) {
ClientData.serviceOpt_content_share(option.value);
}
});
};
......@@ -496,19 +494,19 @@ LOGIN.getServiceOptionList = function(){
$.each(LOGIN.optionList, function(i, option){
if(option.serviceName == 'force_pw_change_periodically'){
if(option.serviceOptionId == 22){
LOGIN.force_pw_change_periodically = option.value;
}
else if(option.serviceName == 'force_pw_change_on_login'){
else if(option.serviceOptionId == 21){
LOGIN.force_pw_change_on_login = option.value;
}
else if(option.serviceName == 'force_login_periodically'){
else if(option.serviceOptionId == 23){
LOGIN.force_login_periodically = option.value;
}
else if(option.serviceName == 'marking'){
else if(option.serviceOptionId == 33){
LOGIN.marking = option.value;
}
else if(option.serviceName == 'user_data_backup'){
else if(option.serviceOptionId == 28){
LOGIN.user_data_backup = option.value;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment