Commit 0f78c21c by Masaru Abe

バックアップ対応

parent 38bf701c
......@@ -162,6 +162,8 @@ COMMON.Keys = {
// Local
MemoData: 'MemoData',
// Local
ContentStatusData: 'ContentStatusData',
// Local
ResourceVersion: 'ResourceVersion',
// Local
MetaVersion: 'MetaVersion',
......@@ -178,6 +180,8 @@ COMMON.Keys = {
isChangedMarkingData: 'isChangedMarkingData',
// Local: isChangedBookmark: boolean (true: changed, false: not change)
isChangedBookmark: 'isChangedBookmark',
// Local: isChangedContentStatus: boolean (true: changed, false: not change)
isChangedContentStatus: 'isChangedContentStatus',
// Session:パスワード要変更(requirePasswordChange):String (0:不要, 1:初回, 2:定期変更)
requirePasswordChange: 'requirePasswordChange',
......@@ -346,6 +350,8 @@ COMMON.Keys = {
userOpt_bkMemoFlag: 'userOpt_bkMemoFlag',
// Local :ユーザオプション(userOpt)_バックアップデフォルト_しおり:Interger
userOpt_bkShioriFlag: 'userOpt_bkShioriFlag',
// Local :ユーザオプション(userOpt)_バックアップデフォルト_コンテンツ状態:Interger
userOpt_bkContentStatusFlag: 'userOpt_bkContentStatusFlag',
// Local :ユーザオプション(userOpt)_ビューのアニメーション種類:Interger
userOpt_pageTransition: 'userOpt_pageTransition',
// Local :ユーザオプション(userOpt)_アニメーション時間:Float
......@@ -404,6 +410,13 @@ function MarkingEntity() {
this.markingid = "";
this.registerDate = new Date();
};
//Entity for ContentStatus
function ContentStatusEntity() {
this.contentId = "";
this.status = 0;
};
// Entity for log
function LogEntity() {
this.contentid = "";
......@@ -548,6 +561,24 @@ COMMON.getDataBookmark = function(jsonString) {
ClientData.BookMarkData(arrBookmark);
};
COMMON.getDataContentStatus = function(jsonString) {
var data = jsonString.data;
var arr = ClientData.ContentStatusData();
arr.clear();
ClientData.ContentStatusData(arr);
var arrContentStatus = [];
for (var nIndex1 = 0; nIndex1 < data.length; nIndex1++) {
var obj = new ContentStatusEntity();
obj.contentId = data[nIndex1].contentId;
obj.status = data[nIndex1].status;
// Add object to client
arrContentStatus.push(obj);
}
ClientData.ContentStatusData(arrContentStatus);
};
/*
Get data from localstorage and sessionstorage synchronization
If has any param (args.length > 0) -> setter
......@@ -700,7 +731,15 @@ var ClientData = {
return COMMON.operateData(arguments, COMMON.Keys.MarkingData, []);
}
},
// Local: ContentStatus collection
ContentStatusData: function (data) {
if (arguments.length > 0) {
COMMON.operateData(arguments, COMMON.Keys.ContentStatusData, []);
}
else {
return COMMON.operateData(arguments, COMMON.Keys.ContentStatusData, []);
}
},
// Local: content log collection
ContentLogData: function (data) {
if (arguments.length > 0) {
......@@ -830,6 +869,16 @@ var ClientData = {
}
},
// Local: isChangedContentStatus: boolean (true: changed, false: not change)
isChangedContentStatus: function (data) {
if (arguments.length > 0) {
COMMON.operateData(arguments, COMMON.Keys.isChangedContentStatus, undefined);
}
else {
return COMMON.operateData(arguments, COMMON.Keys.isChangedContentStatus, undefined);
}
},
// Local :共通(common)_コンテンツID:Integer
common_preContentId: function (data) {
if (arguments.length > 0) {
......@@ -1071,6 +1120,17 @@ var ClientData = {
}
},
// Local :ユーザオプション(userOpt)_バックアップデフォルト_コンテンツ状態:Interger
userOpt_bkContentStatusFlag: function (data) {
if (arguments.length > 0) {
COMMON.operateData(arguments, COMMON.Keys.userOpt_bkContentStatuFlag, undefined);
}
else {
return COMMON.operateData(arguments, COMMON.Keys.userOpt_bkContentStatuFlag, undefined);
}
},
// Local :ユーザオプション(userOpt)_ビューのアニメーション種類:Interger
userOpt_pageTransition: function (data) {
if (arguments.length > 0) {
......
......@@ -156,5 +156,6 @@
"txtUrlValidDate": "URL有効期間",
"txtMaxDownloadCount": "最大DL回数",
"msgShareUrlPassword": "パスワードを設定する場合、以下に入力して下さい。",
"msgStreamingOpenError": "ストリーミングでは閲覧出来ないコンテンツです。"
"msgStreamingOpenError": "ストリーミングでは閲覧出来ないコンテンツです。",
"txtBkContentStatus": "コンテンツ状態"
}
......@@ -10,6 +10,7 @@
<input type="checkbox" name="chkBkAllMarking" id="chkBkAllMarking" class="chkbx" checked="checked" /><label for="chkBkAllMarking" lang="txtBkMarking" class="lang"><!--マーキング--></label>
<input type="checkbox" name="chkBkAllMemo" id="chkBkAllMemo" class="chkbx" checked="checked" /><label for="chkBkAllMemo" lang="txtBkMemo" class="lang"><!--メモ--></label>
<input type="checkbox" name="chkBkAllShiori" id="chkBkAllShiori" class="chkbx" checked="checked" /><label for="chkBkAllShiori" lang="txtBkShiori" class="lang"><!--しおり--></label>
<input type="checkbox" name="chkBkAllContentStatus" id="chkBkAllContentStatus" class="chkbx" checked="checked" /><label for="chkBkAllContentStatus" lang="txtBkContentStatus" class="lang"><!--コンテンツ状態--></label>
</p>
<!--</label>-->
</p>
......
......@@ -976,10 +976,10 @@ BOOKMARK.IsExistContent = function(strContentId) {
result["contentType"] = contentType;
// save content type
//BOOKMARK.contentTypes[strContentId] = contentType;
//BOOKMARK.contentName[strContentId] = data.contentData.contentName;
BOOKMARK.contentTypes[strContentId] = contentType;
BOOKMARK.contentName[strContentId] = data.contentData.contentName;
// save alert message level
//LIMIT_ACCESS_CONTENT.messageLevel[strContentId] = { alertMessageLevel: data.contentData.alertMessageLevel, alertMessage: data.contentData.alertMessage };
LIMIT_ACCESS_CONTENT.messageLevel[strContentId] = { alertMessageLevel: data.contentData.alertMessageLevel, alertMessage: data.contentData.alertMessage };
},
function (xmlHttpRequest, txtStatus, errorThrown) {
......
......@@ -1096,7 +1096,11 @@ CONTENTSEARCH.drawEditImage = function(id) {
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');
});
});
//バックアップデータのステータス更新
HEADER.setContentStatus(id,0);
};
img.src = imgSrc;
......
......@@ -368,8 +368,20 @@ HEADER.logoutFunction = function() {
$('#chkBkAllMarking').attr('disabled', 'disabled').removeAttr('checked');
}
if (ClientData.isChangedBookmark() == true || ClientData.isChangedMarkingData() == true || ClientData.isChangedMemo() == true) {
if (ClientData.isChangedContentStatus())
{
if (ClientData.userOpt_bkContentStatusFlag() == 0) {
$("#chkBkAllContentStatus").removeAttr('checked');
}
else {
$("#chkBkAllContentStatus").attr('checked', 'checked');
}
}
else {
$('#chkBkAllContentStatus').attr('disabled', 'disabled').removeAttr('checked');
}
if (ClientData.isChangedBookmark() == true || ClientData.isChangedMarkingData() == true || ClientData.isChangedMemo() == true || ClientData.isChangedContentStatus() == true) {
// In case: user_data_backup = "Y" -> backup
if (ClientData.serviceOpt_user_data_backup() == "Y") {
......@@ -395,8 +407,9 @@ HEADER.logoutFunction = function() {
var isBackupMarking=ClientData.userOpt_bkMakingFlag() == 1;
var isBackupMemo=ClientData.userOpt_bkMemoFlag() == 1;
var isBackupBookmark = ClientData.userOpt_bkShioriFlag() == 1;
var isBackupContentStatus = ClientData.userOpt_bkContentStatusFlag() == 1;
HEADER.DoBackup(isBackupMarking, isBackupMemo, isBackupBookmark, true);
HEADER.DoBackup(isBackupMarking, isBackupMemo, isBackupBookmark, isContentStatus, true);
}
else if (ClientData.userOpt_logoutMode() == 1) { // Logout without backup
// Do nothing
......@@ -483,6 +496,7 @@ HEADER.confirmWithBackupFunction = function(e) {
var isBackupMarking=$("#chkBkAllMarking").attr('checked') == 'checked';
var isBackupMemo = $("#chkBkAllMemo").attr('checked') == 'checked';
var isBackupBookmark = $("#chkBkAllShiori").attr('checked') == 'checked';
var isBackupContentStatus = $("#chkBkAllContentStatus").attr('checked') == 'checked';
var remember = $('#chkRememberBackup').attr('checked');
COMMON.unlockLayout();
......@@ -497,84 +511,32 @@ HEADER.confirmWithBackupFunction = function(e) {
ClientData.userOpt_bkMakingFlag(isBackupMarking);
ClientData.userOpt_bkMemoFlag(isBackupMemo);
ClientData.userOpt_bkShioriFlag(isBackupBookmark);
ClientData.userOpt_bkContentStatusFlag(isBackupContentStatus);
HEADER.DoBackup(isBackupMarking, isBackupMemo, isBackupBookmark, true);
HEADER.DoBackup(isBackupMarking, isBackupMemo, isBackupBookmark, isBackupContentStatus, true);
}
else{
ClientData.userOpt_bkConfirmFlg(1); // Show dialog in next time
HEADER.DoBackup(isBackupMarking, isBackupMemo, isBackupBookmark, true);
HEADER.DoBackup(isBackupMarking, isBackupMemo, isBackupBookmark, isBackupContentStatus, true);
}
ClientData.userOpt_logoutMode(0); // In next time, if choose: [do not show dialog], will backup and logout
//HEADER.webLogoutEvent();
};
//Confirm Back Up Ok
HEADER.DoBackup = function(isBackupMarking, isBackupMemo, isBackupBookmark,isLogout,funcCallback) {
HEADER.DoBackup = function(isBackupMarking, isBackupMemo, isBackupBookmark, isBackupContentStatus, isLogout,funcCallback) {
// ----------------------------
// Process backup here
// ----------------------------
//Bakup memo/marking/bookmark
// var params = [
// { name: 'sid', content: ClientData.userInfo_sid() },
// { name: 'deviceType', content: '4' },
// { name: 'formFile', content: JSON.stringify(buildBackupData()), fileName: 'webBackupData.json', contentType: 'text-plain' }
// ];
// AVWEB.avwUploadBackupFile(ClientData.userInfo_accountPath(), params, false,
// function (data) {
// if (JSON.parse(data).result == "success") {
// ClientData.isChangedBookmark(false);
// ClientData.isChangedMarkingData(false);
// ClientData.isChangedMemo(false);
// //alert(I18N.i18nText('msgBackupSuccess'));
//
// // Show message: msgBackupSuccess
// $().toastmessage({ position: 'middle-center' });
// $().toastmessage('showToast', {
// type: 'success',
// sticky: true,
// text: I18N.i18nText('msgBackupSuccess'),
// });
// $('.toast-position-middle-center').css('width', '500px');
// $('.toast-position-middle-center').css('margin-left', '-250px');
// $('.toast-item-close').live('click', HEADER.webLogoutEvent);
// }
// else {
// //alert(I18N.i18nText('msgBackupFailed'));
// // Show error message: msgBackupFailed
// $().toastmessage({ position: 'middle-center' });
// $().toastmessage('showToast', {
// type: 'error',
// sticky: true,
// text: I18N.i18nText('msgBackupFailed')
// });
// $('.toast-position-middle-center').css('width', '500px');
// $('.toast-position-middle-center').css('margin-left', '-250px');
// $('.toast-item-close').live('click', HEADER.webLogoutEvent);
// }
// },
// function (a, b, c) {
// //alert(I18N.i18nText('msgBackupFailed'));
// // Show error message: msgBackupFailed
// $().toastmessage({ position: 'middle-center' });
// $().toastmessage('showToast', {
// type: 'error',
// sticky: true,
// text: I18N.i18nText('msgBackupFailed')
// });
// $('.toast-position-middle-center').css('width', '500px');
// $('.toast-position-middle-center').css('margin-left', '-250px');
// $('.toast-item-close').live('click', HEADER.webLogoutEvent);
// });
// Backup for No.17
// if (!isBackupMarking && !isBackupMemo && !isBackupBookmark)
// return;
// check if data is changed and has option backup
if ((ClientData.isChangedBookmark() == true && isBackupBookmark) || (ClientData.isChangedMarkingData() == true && isBackupMarking) || (ClientData.isChangedMemo() == true && isBackupMemo)) {
if ((ClientData.isChangedBookmark() == true && isBackupBookmark) ||
(ClientData.isChangedMarkingData() == true && isBackupMarking) ||
(ClientData.isChangedMemo() == true && isBackupMemo) ||
(ClientData.isChangedContentStatus() == true && isBackupContentStatus)
) {
if (isLogout) {
COMMON.lockLayout();
......@@ -597,6 +559,7 @@ HEADER.DoBackup = function(isBackupMarking, isBackupMemo, isBackupBookmark,isLog
var isBackupMarkingOK = true;
var isBackupMemoOK = true;
var isBackupBookmarkOK = true;
var isBackupContentStatusOK = true;
if (isBackupMarking && ClientData.isChangedMarkingData() == true) {
isBackupMarkingOK = HEADER.sendSignalBackupStart(2); // start backup type marking
......@@ -633,7 +596,6 @@ HEADER.DoBackup = function(isBackupMarking, isBackupMemo, isBackupBookmark,isLog
}
// Backup Memo
if (isBackupMemo && ClientData.isChangedMemo() == true) {
isBackupMemoOK = HEADER.sendSignalBackupStart(1); // start backup type memo
if (isBackupMemoOK) {
......@@ -650,6 +612,31 @@ HEADER.DoBackup = function(isBackupMarking, isBackupMemo, isBackupBookmark,isLog
}
}
// Backup ContentStatus
if (isBackupContentStatus && ClientData.isChangedContentStatus() == true) {
isBackupContentStatusOK = HEADER.sendSignalBackupStart(8); // start backup type ContentStatus
if (isBackupContentStatusOK) {
//READステータス追加
if(ClientData.ReadingContentIds().length > 0){
for(var nIndex = 0; nIndex < ClientData.ReadingContentIds().length; nIndex++){
HEADER.setContentStatus(ClientData.ReadingContentIds()[nIndex].contentid, 0 );
}
}
isBackupContentStatusOK = HEADER.backupFile(JSON.stringify({ "type": 4, "data": ClientData.ContentStatusData() }), 'ContentStatus.json', 8);
if (isBackupContentStatusOK) {
ClientData.isChangedContentStatus(false);
$('#divResultMessage').append("<div class='toast-item-image-success toast-item-message'>" + I18N.i18nText('txtBkContentStatus') + " " + I18N.i18nText('msgBackupSuccess') + "</div>");
}
// finish backup ContentStatus if start backup ContentStatus ok
HEADER.sendSignalBackupFinish(8);
}
if (!isBackupContentStatusOK) {
$('#divResultMessage').append("<div class='toast-item-image-error toast-item-message'>" + I18N.i18nText('txtBkContentStatus') + " " + I18N.i18nText('msgBackupFailed') + "</div>");
}
}
// hide item loading
$('#divResultMessage .toast-item-loading').hide();
......@@ -685,14 +672,20 @@ HEADER.backupFile = function(data, file,type) {
//{name: 'fileType', content: type },
{ name: 'formFile', content: data, fileName: file, contentType: 'text-plain' }
];
AVWEB.avwUploadBackupFile(ClientData.userInfo_accountPath(), params, false,
function (data)
{
if (JSON.parse(data).result == "success")
{
result = true;
}
}, function (a, b, c) { });
AVWEB.avwUploadBackupFile(
ClientData.userInfo_accountPath(),
params,
false,
function (data)
{
if (JSON.parse(data).result == "success")
{
result = true;
}
},
function (a, b, c)
{ }
);
return result;
};
......@@ -1188,3 +1181,53 @@ HEADER.getThumbnailForOtherType = function(contentType){
return src;
};
HEADER.setContentStatus = function(contentId, status) {
var arr = ClientData.ContentStatusData();
var arrContentStatus = [];
var updateFlg = false;
for (var nIndex1 = 0; nIndex1 < arr.length; nIndex1++) {
var obj = new ContentStatusEntity();
obj.contentId = arr[nIndex1].contentId;
obj.status = arr[nIndex1].status;
if(obj.contentId == contentId){
if(obj.status != status){
//バックアップ対象フラグセット
ClientData.isChangedContentStatus(true);
obj.status = status;
}
updateFlg = true;
}
// Add object to client
arrContentStatus.push(obj);
}
if(updateFlg == false ){
var obj = new ContentStatusEntity();
obj.contentId = contentId;
obj.status = status;
// Add object to client
arrContentStatus.push(obj);
//バックアップ対象フラグセット
ClientData.isChangedContentStatus(true);
}
//初期化したほうが良い?
var newArray = [];
ClientData.ContentStatusData(newArray);
ClientData.ContentStatusData(arrContentStatus);
};
HEADER.getContentStatus = function(contentId) {
var arr = ClientData.ContentStatusData();
for (var nIndex1 = 0; nIndex1 < arr.length; nIndex1++) {
//console.log("arr[nIndex1].contentId:" + arr[nIndex1].contentId + " status:" + arr[nIndex1].status );
if(arr[nIndex1].contentId == contentId){
return arr[nIndex1].status;
}
}
return null;
};
......@@ -761,15 +761,33 @@ HISTORY.checkUserHasReadContent = function(contId, resourceVer, metaVer){
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.
//コンテンツ状態バックアップ対応
var bkContentStatus = HEADER.getContentStatus(contId);
var contentStatus = null;
if( bkContentStatus == 0){
contentStatus = 0; //READ
} else if( bkContentStatus == 1 || bkContentStatus == 2 || bkContentStatus == 3 ){
contentStatus = 1; //NEW
} else if(bkContentStatus == 5){
contentStatus = 2; //UPDATE
}
if(readArr == null || readArr <= 0 || readArr == 'undefined'){
imgThumb.onload = function(){
var resizeImg = HISTORY.resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, c.width/2 - resizeImg[0]/2, 0, resizeImg[0], resizeImg[1]);
imgIconNew.onload = function(){
ctx.drawImage(imgIconNew, c.width/2 - resizeImg[0]/2, 0);
if(contentStatus == null || contentStatus == 1){
imgIconNew.onload = function(){
ctx.drawImage(imgIconNew, c.width/2 - resizeImg[0]/2, 0);
HISTORY.showContentThumbnail(contId);
};
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
} else {
HISTORY.showContentThumbnail(contId);
};
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
}
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
......@@ -794,7 +812,22 @@ HISTORY.checkUserHasReadContent = function(contId, resourceVer, metaVer){
imgThumb.onload = function(){
var resizeImg = HISTORY.resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, c.width/2 - resizeImg[0]/2, 0, resizeImg[0], resizeImg[1]);
HISTORY.showContentThumbnail(contId);
if(contentStatus == 1){
imgIconNew.onload = function(){
ctx.drawImage(imgIconNew, c.width/2 - resizeImg[0]/2, 0);
HISTORY.showContentThumbnail(contId);
};
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
} else if(contentStatus == 2){
imgIconEdit.onload = function(){
ctx.drawImage(imgIconEdit, c.width/2 - resizeImg[0]/2, 0);
HISTORY.showContentThumbnail(contId);
};
imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
} else {
HISTORY.showContentThumbnail(contId);
}
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
......@@ -813,14 +846,20 @@ HISTORY.checkUserHasReadContent = function(contId, resourceVer, metaVer){
break;
}
else{
imgThumb.onload = function(){
imgThumb.onload = function(){
var resizeImg = HISTORY.resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, c.width/2 - resizeImg[0]/2, 0, resizeImg[0], resizeImg[1]);
HISTORY.showContentThumbnail(contId);
imgIconNew.onload = function(){
ctx.drawImage(imgIconNew, c.width/2 - resizeImg[0]/2, 0);
};
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
if(contentStatus == null || contentStatus == 1){
HISTORY.showContentThumbnail(contId);
imgIconNew.onload = function(){
ctx.drawImage(imgIconNew, c.width/2 - resizeImg[0]/2, 0);
};
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
} else {
HISTORY.showContentThumbnail(contId);
}
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
......@@ -850,11 +889,20 @@ HISTORY.checkUserHasReadContent = function(contId, resourceVer, metaVer){
imgThumb.onload = function(){
var resizeImg = HISTORY.resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, c.width/2 - resizeImg[0]/2, 0, resizeImg[0], resizeImg[1]);
HISTORY.showContentThumbnail(contId);
imgIconEdit.onload = function(){
ctx.drawImage(imgIconEdit, c.width/2 - resizeImg[0]/2, 0);
};
imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
if(contentStatus == 1){
HISTORY.showContentThumbnail(contId);
imgIconNew.onload = function(){
ctx.drawImage(imgIconNew, c.width/2 - resizeImg[0]/2, 0);
};
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
} else {
HISTORY.showContentThumbnail(contId);
imgIconEdit.onload = function(){
ctx.drawImage(imgIconEdit, c.width/2 - resizeImg[0]/2, 0);
};
imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
}
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
......@@ -884,11 +932,20 @@ HISTORY.checkUserHasReadContent = function(contId, resourceVer, metaVer){
imgThumb.onload = function(){
var resizeImg = HISTORY.resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, c.width/2 - resizeImg[0]/2, 0, resizeImg[0], resizeImg[1]);
HISTORY.showContentThumbnail(contId);
imgIconEdit.onload = function(){
ctx.drawImage(imgIconEdit, c.width/2 - resizeImg[0]/2, 0);
};
imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
if(contentStatus == 1){
HISTORY.showContentThumbnail(contId);
imgIconNew.onload = function(){
ctx.drawImage(imgIconNew, c.width/2 - resizeImg[0]/2, 0);
};
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
} else {
HISTORY.showContentThumbnail(contId);
imgIconEdit.onload = function(){
ctx.drawImage(imgIconEdit, c.width/2 - resizeImg[0]/2, 0);
};
imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
}
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
......@@ -940,7 +997,11 @@ HISTORY.drawEditImage = function(id) {
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');
});
});
//バックアップデータのステータス更新
HEADER.setContentStatus(id,0);
};
img.src = imgSrc;
......
......@@ -1911,19 +1911,38 @@ HOME.checkUserHasReadContent = function(contId, resourceVer, metaVer) {
var contentType = HOME.returnContentType(contId);
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Declare variable handle contentType and Thumbnail of content.
//コンテンツ状態バックアップ対応
var bkContentStatus = HEADER.getContentStatus(contId);
console.log("contId:" + contId + " bkStatus:" + bkContentStatus);
var contentStatus = null;
if( bkContentStatus == 0){
contentStatus = 0; //READ
} else if( bkContentStatus == 1 || bkContentStatus == 2 || bkContentStatus == 3 ){
contentStatus = 1; //NEW
} else if(bkContentStatus == 5){
contentStatus = 2; //UPDATE
}
if (readArr == null || readArr <= 0 || readArr == 'undefined') {
imgThumb.onload = function () {
var resizeImg = HOME.resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]);
imgIconNew.onload = function () {
ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]);
$("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow');
});
};
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
};
if(contentStatus == null || contentStatus == 1){
imgIconNew.onload = function () {
ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]);
$("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow');
});
};
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
} else {
$("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow');
});
}
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
if(contentThumbnail == '' || contentThumbnail == null){
......@@ -1946,9 +1965,29 @@ HOME.checkUserHasReadContent = function(contId, resourceVer, metaVer) {
imgThumb.onload = function () {
var resizeImg = HOME.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');
});
if(contentStatus == 1){
imgIconNew.onload = function () {
ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]);
$("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow');
});
};
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
} else if(contentStatus == 2){
imgIconEdit.onload = function () {
ctx.drawImage(imgIconEdit, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]);
$("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow');
});
};
imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
} else {
$("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow');
});
}
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
......@@ -1971,13 +2010,21 @@ HOME.checkUserHasReadContent = function(contId, resourceVer, metaVer) {
imgThumb.onload = function () {
var resizeImg = HOME.resizeResourceThumbnail(imgThumb, c.width, c.height);
ctx.drawImage(imgThumb, (c.width / 2) - (resizeImg[0] / 2) + 4, c.height - resizeImg[1] + 4, resizeImg[0], resizeImg[1]);
imgIconNew.onload = function () {
ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]);
$("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow');
});
};
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
if(contentStatus == null || contentStatus == 1){
imgIconNew.onload = function () {
ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]);
$("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow');
});
};
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
} else {
$("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow');
});
}
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
......@@ -1991,7 +2038,7 @@ HOME.checkUserHasReadContent = function(contId, resourceVer, metaVer) {
}else{
imgThumb.src = contentThumbnail;
}
break;
//End Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
}
}
......@@ -2008,14 +2055,24 @@ HOME.checkUserHasReadContent = function(contId, resourceVer, metaVer) {
imgThumb.onload = function () {
var resizeImg = HOME.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]);
$("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow');
});
};
imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
if(contentStatus == 1){
imgIconNew.onload = function () {
ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]);
$("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow');
});
};
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
} else {
imgIconEdit.onload = function () {
ctx.drawImage(imgIconEdit, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]);
$("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow');
});
};
imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
}
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
......@@ -2046,13 +2103,24 @@ HOME.checkUserHasReadContent = function(contId, resourceVer, metaVer) {
imgThumb.onload = function () {
var resizeImg = HOME.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]);
$("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow');
});
};
imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
if(contentStatus == 1){
imgIconNew.onload = function () {
ctx.drawImage(imgIconNew, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]);
$("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow');
});
};
imgIconNew.src = COMMON.DEFAULT_IMG_CONTENT_NEW;
} else {
imgIconEdit.onload = function () {
ctx.drawImage(imgIconEdit, c.width / 2 - resizeImg[0] / 2, c.height - resizeImg[1]);
$("#loadingIcon" + contId).fadeOut('slow', function () {
$('#content-thumbnail' + contId).fadeIn('slow');
});
};
imgIconEdit.src = COMMON.DEFAULT_IMG_CONTENT_EDIT;
}
};
//Start Function : No.12 -- Editor : Le Long -- Date : 07/31/2013 -- Summary : Check contentType to set thumbnail.
......@@ -2104,10 +2172,15 @@ HOME.drawEditImage = function(id) {
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');
});
});
//バックアップデータのステータス更新
HEADER.setContentStatus(id,0);
};
img.src = imgSrc;
};
//Render User view date
......
......@@ -40,7 +40,8 @@ $(document).ready(function () {
// Check to hide/show backup button
if (ClientData.isChangedBookmark() == true
|| ClientData.isChangedMarkingData() == true
|| ClientData.isChangedMemo() == true) {
|| ClientData.isChangedMemo() == true
|| ClientData.isChangedContentStatus() == true) {
$("#dspOptBk").show();
// check disabled button backup
......@@ -75,8 +76,9 @@ $(document).ready(function () {
var isExistMarking = SETTINGS.IsExistBackupFile('Marking.json', 2);
var isExistContentMemo = SETTINGS.IsExistBackupFile('ContentMemo.json', 1);
var isExistBookmark = SETTINGS.IsExistBackupFile('Bookmark.json', 4);
var isExistContentStatus = SETTINGS.IsExistBackupFile('ContentStatus.json', 8);
if (isExistMarking || isExistContentMemo || isExistBookmark) {
if (isExistMarking || isExistContentMemo || isExistBookmark || isExistContentStatus) {
$("#dspOptRes").css('visibility', '');
if (!isExistMarking) {
......@@ -100,6 +102,13 @@ $(document).ready(function () {
$('#chkopResShiori').removeAttr('disabled');
}
if (!isExistContentStatus) {
$('#chkopResContentStatus').attr('disabled', 'disabled').removeAttr('checked');
}
else {
$('#chkopResContentStatus').removeAttr('disabled');
}
// check disabled button restore
HEADER.checkDisabledButton('#dlgConfirmRestore .option_backup input', '#dspOptRes_OK');
......@@ -267,15 +276,16 @@ SETTINGS.dspOptBk_OK_Click = function(e) {
var isBackupMarking = $('#chkopBkMarking').attr('checked') == 'checked';
var isBackupMemo = $('#chkopBkMemo').attr('checked') == 'checked';
var isBackupBookmark = $('#chkopBkShiori').attr('checked') == 'checked';
var isBackupContentStatus = $('#chkopBkContentStatus').attr('checked') == 'checked';
if (!isBackupMarking && !isBackupMemo && !isBackupBookmark)
if (!isBackupMarking && !isBackupMemo && !isBackupBookmark && !isBackupContentStatus)
{
SETTINGS.closeBackup();
return;
}
// call backup file at header
HEADER.DoBackup(isBackupMarking, isBackupMemo, isBackupBookmark, false,
HEADER.DoBackup(isBackupMarking, isBackupMemo, isBackupBookmark, isBackupContentStatus, false,
function () {
// Check to hide/show backup button
......@@ -291,7 +301,10 @@ SETTINGS.dspOptBk_OK_Click = function(e) {
if (isBackupBookmark && !ClientData.isChangedBookmark()) {
$('#chkopResShiori').removeAttr('disabled');
}
if (isBackupContentStatus && !ClientData.isChangedContentStatus()) {
$('#chkopResContentStatus').removeAttr('disabled');
}
SETTINGS.closeBackup();
});
......@@ -299,7 +312,7 @@ SETTINGS.dspOptBk_OK_Click = function(e) {
// set status button backup and checkbox option
SETTINGS.setStatusButtonBackup = function() {
if (ClientData.isChangedBookmark() == true || ClientData.isChangedMarkingData() == true || ClientData.isChangedMemo() == true) {
if (ClientData.isChangedBookmark() == true || ClientData.isChangedMarkingData() == true || ClientData.isChangedMemo() == true || ClientData.isChangedContentStatus() == true) {
if (ClientData.isChangedBookmark() != true) {
$('#chkopBkShiori').attr('disabled', 'disabled').removeAttr('checked');
......@@ -310,6 +323,10 @@ SETTINGS.setStatusButtonBackup = function() {
if (ClientData.isChangedMemo() != true) {
$('#chkopBkMemo').attr('disabled', 'disabled').removeAttr('checked');
}
if (ClientData.isChangedContentStatus() != true) {
$('#chkopBkContentStatus').attr('disabled', 'disabled').removeAttr('checked');
}
$("#dspOptBk").show();
}
else {
......@@ -341,9 +358,10 @@ SETTINGS.dspOptRes_OK_Click = function(e) {
var isRestoreMarking = $('#chkopResMarking').attr('checked') == 'checked';
var isRestoreMemo = $('#chkopResMemo').attr('checked') == 'checked';
var isRestoreBookmark = $('#chkopResShiori').attr('checked') == 'checked';
if (!isRestoreMarking && !isRestoreMemo && !isRestoreBookmark) {
var isRestoreContentStatus = $('#chkopResContentStatus').attr('checked') == 'checked';
if (!isRestoreMarking && !isRestoreMemo && !isRestoreBookmark && !isRestoreContentStatus) {
SETTINGS.closeRestore();
return;
return;
}
$().toastmessage({ position: 'middle-center' });
......@@ -391,6 +409,20 @@ SETTINGS.dspOptRes_OK_Click = function(e) {
}
}
if (isRestoreContentStatus) {
// restore ContentStatus data
var res = SETTINGS.restoreContentStatus();
if (!res) {
$('#divResultMessage').append("<div class='toast-item-image-error toast-item-message'>" + I18N.i18nText('txtBkContentStatus') + " " + I18N.i18nText('msgRestoreFailed') + "</div>");
}
else {
$('#divResultMessage').append("<div class='toast-item-image-success toast-item-message'>" + I18N.i18nText('txtBkContentStatus') + " " + I18N.i18nText('msgRestoreSuccess') + "</div>");
}
}
// set status button backup
//SETTINGS.setStatusButtonBackup();
......@@ -471,6 +503,28 @@ SETTINGS.restoreMarkingData = function()
return result;
};
/*
* Call api to restore ContentStatus data
*/
SETTINGS.restoreContentStatus = function()
{
var result = false;
AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "getBackupFile", "post",
{ sid: ClientData.userInfo_sid(), filename: "ContentStatus.json" }, // deviceType: '4',
function (data) {
if (data) {
COMMON.getDataContentStatus(data);
ClientData.isChangedContentStatus(false);
result = true;
}
}
,
function (xhr, b, c) {
}
);
return result;
};
// Cancel for restore
SETTINGS.dspOptRes_Cancel_Click = function(e) {
......@@ -553,6 +607,13 @@ SETTINGS.dspSave_Click = function(e) {
ClientData.userOpt_bkShioriFlag(0);
}
if ($("#chkBkContentStatus").attr('checked') == 'checked') {
ClientData.userOpt_bkContentStatusFlag(1);
}
else {
ClientData.userOpt_bkContentStatusFlag(0);
}
// save config page transition No.4
ClientData.userOpt_pageTransition($('#cboAnimation').val());
......@@ -680,13 +741,18 @@ SETTINGS.dspOptBk_Click = function(e) {
else {
$("#chkopBkMemo").attr('checked', 'checked');
}
if (ClientData.userOpt_bkShioriFlag() == 0) {
$("#chkopBkShiori").removeAttr('checked');
}
else {
$("#chkopBkShiori").attr('checked', 'checked');
}
if (ClientData.userOpt_bkContentStatusFlag() == 0) {
$("#chkopBkContentStatus").removeAttr('checked');
}
else {
$("#chkopBkContentStatus").attr('checked', 'checked');
}
// check content is changed
......@@ -710,6 +776,12 @@ SETTINGS.dspOptBk_Click = function(e) {
else {
$('#chkopBkMarking').removeAttr('disabled');
}
if (!ClientData.isChangedContentStatus()) {
$('#chkopBkContentStatus').attr('disabled', 'disabled').removeAttr('checked');
}
else {
$('#chkopBkContentStatus').removeAttr('disabled');
}
HEADER.setDisabledButton('#dlgConfirmBackup .option_backup input', '#dspOptBk_OK');
......
......@@ -158,6 +158,7 @@
<input type="checkbox" id="chkBkMarking" class="chkbx" checked="checked" /><label id="txtBkMarking" for="chkBkMarking" lang="txtBkMarking" class="lang"><!--マーキング--></label>
<input type="checkbox" id="chkBkMemo" class="chkbx" checked="checked" /><label id="txtBkMemo" for="chkBkMemo" lang="txtBkMemo" class="lang"><!--メモ--></label>
<input type="checkbox" id="chkBkShiori" class="chkbx" checked="checked" /><label id="txtBkShiori" for="chkBkShiori" lang="txtBkShiori" class="lang"><!--しおり--></label>
<input type="checkbox" id="chkBkContentStatus" class="chkbx" checked="checked" /><label id="txtBkContentStatus" for="chkBkContentStatus" lang="txtBkContentStatus" class="lang"><!--コンテンツ状態--></label>
</label>
</p>
<p class="backupbtn"><a class="backup lang" lang="dspOptBk" id="dspOptBk" href="#" style="display:none;"><!--バックアップ--></a><a href="#" id="dspOptRes" lang="dspOptRes" class="lang" style="visibility:hidden;"><!--リストア--></a></p>
......@@ -193,6 +194,25 @@
<div id="inc_backup"></div>
<section class="sectionbackup" id="dlgConfirmBackup">
<h1><label class="title lang" lang="txtBackupTitle">バックアップ確認</label></h1>
<!--<p class="message"><label id="txtBkMsg" lang="txtBkMsg" class="lang">サーバにバックアップしますか?</label></p>-->
<p class="message">
<label lang="txtBkSelectData" class="lang">バックアップするデータを選択してください。</label>
</p>
<p class="message-options">
<!--<label class="option_backup">-->
<p class="option_backup" style="font-size: 13px;margin-left:50px">
<input type="checkbox" name="chkopBkMarking" id="chkopBkMarking" class="chkopbx" checked="checked" /><label for="chkopBkMarking" lang="txtBkMarking" class="lang">マーキング</label>
<input type="checkbox" name="chkopBkMemo" id="chkopBkMemo" class="chkopbx" checked="checked" /><label for="chkopBkMemo" lang="txtBkMemo" class="lang">メモ</label>
<input type="checkbox" name="chkopBkShiori" id="chkopBkShiori" class="chkopbx" checked="checked" /><label for="chkopBkShiori" lang="txtBkShiori" class="lang">しおり</label>
<input type="checkbox" name="chkopBkContentStatus" id="chkopBkContentStatus" class="chkopbx" checked="checked" /><label for="chkopBkContentStatus" lang="txtBkContentStatus" class="lang">コンテンツ状態</label>
</P>
<!--</label>-->
</p>
<p class="backupbtn"><a class="ok lang" href="#" id="dspOptBk_OK" lang="dspOK">OK</a><a class="cancel lang" href="#" lang="dspCancel" id="dspOptBk_Cancel">キャンセル</a></p>
</section>
<section class="sectionrestore" id="dlgConfirmRestore">
<h1 class="title lang" lang="txtRestoreTitle"><!--リストア確認--></h1>
<p class="message">
......@@ -202,9 +222,10 @@
<p class="message-options">
<!--<label class="option_backup">-->
<p class="option_backup" style="font-size: 13px;margin-left:50px">
<input type="checkbox" name="chkopBkMarking" id="chkopBkMarking" class="chkopbx" checked="checked" /><label for="chkopBkMarking" lang="txtBkMarking" class="lang">マーキング</label>
<input type="checkbox" name="chkopBkMemo" id="chkopBkMemo" class="chkopbx" checked="checked" /><label for="chkopBkMemo" lang="txtBkMemo" class="lang">メモ</label>
<input type="checkbox" name="chkopBkShiori" id="chkopBkShiori" class="chkopbx" checked="checked" /><label for="chkopBkShiori" lang="txtBkShiori" class="lang">しおり</label>
<input type="checkbox" name="chkopResMarking" id="chkopResMarking" class="chkopbx" checked="checked" /><label for="chkopResMarking" lang="txtBkMarking" class="lang">マーキング</label>
<input type="checkbox" name="chkopResMemo" id="chkopResMemo" class="chkopbx" checked="checked" /><label for="chkopResMemo" lang="txtBkMemo" class="lang">メモ</label>
<input type="checkbox" name="chkopResShiori" id="chkopResShiori" class="chkopbx" checked="checked" /><label for="chkopResShiori" lang="txtBkShiori" class="lang">しおり</label>
<input type="checkbox" name="chkopResContentStatus" id="chkopResContentStatus" class="chkopbx" checked="checked" /><label for="chkopResContentStatus" lang="txtBkContentStatus" class="lang">コンテンツ状態</label>
</P>
<!--</label>-->
</p>
......
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