Commit a20cfa02 by Masaru Abe

ダウンロード対応

parent a500c463
......@@ -46,6 +46,7 @@
<script type="text/javascript" src="./common/js/avweb.js?__UPDATEID__"></script>
<script type="text/javascript" src="./common/js/i18n.js?__UPDATEID__"></script>
<script type="text/javascript" src="./common/js/common.js?__UPDATEID__"></script>
<script type="text/javascript" src="./common/js/uuid.js?__UPDATEID__"></script>
<script type="text/javascript" src="./common/js/screenLock.js?__UPDATEID__" ></script>
<script type="text/javascript" src="./js/header.js?__UPDATEID__" ></script>
<script type="text/javascript" src="./js/Limit_Access_Content.js?__UPDATEID__"></script>
......
......@@ -179,8 +179,17 @@ a.delete:hover:not(:target) {
position: relative;
left: -18px;
}
.cnt_section .text ul.pic li a.read_open {
margin-top: 30px;
}
.cnt_section .text ul.pic li a.read_download {
margin-top: 60px;
}
.cnt_section .text ul.pic li a.read {
margin-top: 42px;
/*margin-top: 42px;*/
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
border-radius: 6px;
......
......@@ -49,6 +49,7 @@
<script type="text/javascript" src="./common/js/i18n.js?__UPDATEID__"></script>
<script type="text/javascript" src="./common/js/avweb.js?__UPDATEID__"></script>
<script type="text/javascript" src="./common/js/common.js?__UPDATEID__"></script>
<script type="text/javascript" src="./common/js/uuid.js?__UPDATEID__"></script>
<script type="text/javascript" src="./js/Limit_Access_Content.js?__UPDATEID__"></script>
<script type="text/javascript" src="./js/history.js?__UPDATEID__"></script>
<script type="text/javascript" src="./js/header.js?__UPDATEID__"></script>
......
......@@ -5,6 +5,7 @@ var BOOKMARK = {};
BOOKMARK.contentTypes = {};
BOOKMARK.contentName = {};
BOOKMARK.download = {};
BOOKMARK.pathImgContentNone = './img/page-none.png';
//Contains non-exist content
......@@ -630,7 +631,15 @@ BOOKMARK.insertRow = function(contentid, pageThumbnail, pageTitle, pageText, pag
newRow += '<li class="pageno"><label id="Label2" class="lang" lang="txtPage">' + I18N.i18nText('txtPage') + '</label><label id="Label3">' + pageNo + '</label></li>';
newRow += "<li><a class='read lang' name='dspRead' value='{\"contentid\":\"" + contentid + "\", \"pageNo\":\"" + pageNo + "\", \"contentType\":\"" + contentType + "\" }' lang='txtRead'>" + I18N.i18nText('txtRead') + "</a></li>";
newRow +='<li>';
newRow += "<a class='read read_open lang' name='dspRead' value='{\"contentid\":\"" + contentid + "\", \"pageNo\":\"" + pageNo + "\", \"contentType\":\"" + contentType + "\" }' lang='txtRead'>" + I18N.i18nText('txtRead') + "</a>";
console.log("BOOKMARK.download[contentid]:" + BOOKMARK.download[contentid]);
if( BOOKMARK.download[contentid] == '1' ){
newRow += "<a class='read read_download' name='dspDownload' value=''>ダウンロード</a>";
}
newRow +='</li>';
newRow +='</ul>';
newRow +='</div>';
newRow +='</div>';
......@@ -868,7 +877,8 @@ BOOKMARK.IsExistContent = function(strContentId) {
var params = {
sid: ClientData.userInfo_sid(),
getType: '1',
contentId: strContentId
contentId: strContentId,
authCode: ClientData.authCode()
};
AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", 'GET', params,
function (data) {
......@@ -878,9 +888,12 @@ BOOKMARK.IsExistContent = function(strContentId) {
result["isExisted"] = isExisted;
result["contentType"] = contentType;
console.log("API BOOKMARK.download:" + strContentId + ":" + data.download);
// save content type
BOOKMARK.contentTypes[strContentId] = contentType;
BOOKMARK.contentName[strContentId] = data.contentData.contentName;
BOOKMARK.download[strContentId] = data.download;
// save alert message level
LIMIT_ACCESS_CONTENT.messageLevel[strContentId] = { alertMessageLevel: data.contentData.alertMessageLevel, alertMessage: data.contentData.alertMessage };
......
......@@ -83,6 +83,11 @@ $(document).ready(function(){
$('.button-share').live('touchend', HISTORY.showContentShareDlgFunction);
$('.button-share').live('touchmove', function () { HISTORY.home_isMove = true; });
//ダイハツ対応
$('.button-download').live('click', HISTORY.downloadFunction);
$('.button-download').live('touchend', HISTORY.downloadFunction);
$('.button-download').live('touchmove', function () {});
$(window).resize(function () {
if ($("#contentDetail").css("display") != "none") {
// Refresh panel of detail to center.
......@@ -167,7 +172,7 @@ HISTORY.renderContent = function(id, text, division, type, order, from, to, cate
+ ' <ul class="pic">'
+ ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MEMO + '" id="imgMemo' + post.contentId + '" class="sticker" /></li>'
+ ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MARKING + '" id="imgBookMark' + post.contentId + '" class="pen" /></li>'
+ ' <li><ul class="iconList">{share}<li><a class="read lang button-details" contentid="' + post.contentId + '" lang="txtRead">'+I18N.i18nText("txtRead")+'</a></li></ul></li>'
+ ' <li><ul class="iconList">{share}{download}<li><a class="read lang button-details" contentid="' + post.contentId + '" lang="txtRead">'+I18N.i18nText("txtRead")+'</a></li></ul></li>'
+ ' </ul>'
+ ' </div>'
+ ' </div>'
......@@ -178,6 +183,15 @@ HISTORY.renderContent = function(id, text, division, type, order, from, to, cate
shareHtml ='<li><a class="read lang button-share" contentid="' + post.contentId + '" lang="txtShare">'+I18N.i18nText("txtShare")+'</a></li>';
}
htmlTemp = htmlTemp.replace(/\{share\}/g, shareHtml);
//ダイハツ対応
console.log("post.download:" + post.download);
var downloadHtml = "";
if( post.download == '1' ){
downloadHtml ='<li><a class="read button-download" contentid="' + post.contentId + '" >ダウンロード</a></li>';
}
htmlTemp = htmlTemp.replace(/\{download\}/g, downloadHtml);
$('#content-grid').append(htmlTemp);
}
}
......@@ -219,7 +233,7 @@ HISTORY.renderContent = function(id, text, division, type, order, from, to, cate
$('#lblVdate' + post.contentId).html(viewdate);
HISTORY.addReadContentToArray(post.contentId, post.resourceVersion, post.metaVersion, post.contentThumbnail, post.contentTitle, HISTORY.returnContentTitleKana(post.contentId), post.contentDeliveryDate,post.contentType, post.readerShare );
HISTORY.addReadContentToArray(post.contentId, post.resourceVersion, post.metaVersion, post.contentThumbnail, post.contentTitle, HISTORY.returnContentTitleKana(post.contentId), post.contentDeliveryDate,post.contentType, post.readerShare, post.download );
//HISTORY.showContentThumbnail();
}
......@@ -1121,7 +1135,7 @@ HISTORY.sortByViewDateDesc = function(){
HISTORY.renderContentAfterSort(resultArr);
};
HISTORY.addReadContentToArray = function(strContentId, strResourceVersion, strMetaVersion, strThumbnail, strTitle, strTitleKana, strDelivDate,contentType, readerShare){
HISTORY.addReadContentToArray = function(strContentId, strResourceVersion, strMetaVersion, strThumbnail, strTitle, strTitleKana, strDelivDate,contentType, readerShare, download){
if (HISTORY.contentViewData.length > 0) {
var flag;
for(var j = 0; j < HISTORY.contentViewData.length; j++){
......@@ -1135,11 +1149,11 @@ HISTORY.addReadContentToArray = function(strContentId, strResourceVersion, strMe
}
if(!flag){
HISTORY.contentViewData.push({contentid: strContentId, originviewdate: HISTORY.formatDate(HISTORY.returnOriginalViewDate(strContentId)), contenttitle: strTitle, contenttitlekana: strTitleKana, deliverydate: strDelivDate, resourceversion: strResourceVersion, metaversion: strMetaVersion, thumbnail: COMMON.formatStringBase64(strThumbnail),contenttype:contentType, readerShare:readerShare });
HISTORY.contentViewData.push({contentid: strContentId, originviewdate: HISTORY.formatDate(HISTORY.returnOriginalViewDate(strContentId)), contenttitle: strTitle, contenttitlekana: strTitleKana, deliverydate: strDelivDate, resourceversion: strResourceVersion, metaversion: strMetaVersion, thumbnail: COMMON.formatStringBase64(strThumbnail),contenttype:contentType, readerShare:readerShare, download:download });
}
}else{
HISTORY.contentViewData.push({contentid: strContentId, originviewdate: HISTORY.formatDate(HISTORY.returnOriginalViewDate(strContentId)), contenttitle: strTitle, contenttitlekana: strTitleKana, deliverydate: strDelivDate, resourceversion: strResourceVersion, metaversion: strMetaVersion, thumbnail: COMMON.formatStringBase64(strThumbnail),contenttype:contentType, readerShare:readerShare });
HISTORY.contentViewData.push({contentid: strContentId, originviewdate: HISTORY.formatDate(HISTORY.returnOriginalViewDate(strContentId)), contenttitle: strTitle, contenttitlekana: strTitleKana, deliverydate: strDelivDate, resourceversion: strResourceVersion, metaversion: strMetaVersion, thumbnail: COMMON.formatStringBase64(strThumbnail),contenttype:contentType, readerShare:readerShare, download:download });
}
};
......@@ -1369,7 +1383,7 @@ HISTORY.renderContentAfterSort = function(contentSortArr){
+ ' <ul class="pic">'
+ ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MEMO + '" id="imgMemo' + post.contentid + '" class="sticker" /></li>'
+ ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MARKING + '" id="imgBookMark' + post.contentid + '" class="pen" /></li>'
+ ' <li><ul class="iconList">{share}<li><a class="read lang button-details" contentid="' + post.contentid + '" lang="txtRead">'+I18N.i18nText("txtRead")+'</a></li></ul></li>'
+ ' <li><ul class="iconList">{share}{download}<li><a class="read lang button-details" contentid="' + post.contentid + '" lang="txtRead">'+I18N.i18nText("txtRead")+'</a></li></ul></li>'
+ ' </ul>'
+ ' </div>'
+ ' </div>'
......@@ -1381,6 +1395,15 @@ HISTORY.renderContentAfterSort = function(contentSortArr){
shareHtml ='<li><a class="read lang button-share" contentid="' + post.contentid + '" lang="txtShare">'+I18N.i18nText("txtShare")+'</a></li>';
}
htmlTemp = htmlTemp.replace(/\{share\}/g, shareHtml);
//ダイハツ対応
console.log("post.download2:" + post.download);
var downloadHtml = "";
if( post.download == '1' ){
downloadHtml ='<li><a class="read button-download" contentid="' + post.contentId + '" >ダウンロード</a></li>';
}
htmlTemp = htmlTemp.replace(/\{download\}/g, downloadHtml);
$('#content-grid').append(htmlTemp);
}
......@@ -1534,4 +1557,16 @@ HISTORY.cssInit = function(){
});
};
HISTORY.downloadFunction = function(e) {
if (e) {
e.preventDefault();
}
var contentId = $(this).attr('contentid');
//Download content
HEADER.downloadResourceById(contentId);
};
......@@ -140,6 +140,43 @@ $(document).ready(function () {
$('#dlgSubMenu').hover(HOME.subMenuHoverFunction, HOME.subMenuHoverOffFunction);
// グループ認証関連
$('#dlgAuthCode').hide();
$('#login-username').click(HOME.showDlgAuthCode);
$('#dlgAuthCode-ok').click(HOME.authCodeOkFunction);
$('#dlgAuthCode-cancel').click(HOME.authCodeCancelFunction);
if( ClientData.authCode() != "" ){
//グループ名表示
$('#authGroupBox').show();
$('#authGroupName').html(ClientData.authGroupName());
$('#authGroupButton').click(HOME.authCodeClear);
} else {
$('#authGroupBox').hide();
}
//Button details on dialog click event
$('#dialog-download').click(HOME.downloadSubmenuFunction);
$('.button-download').live('click', HOME.downloadSubmenuFunction);
$('.button-download').live('touchend', HOME.downloadSubmenuFunction);
$('.button-download').live('touchmove', function () { HOME.home_isMove = true; });
/*
$(document).on({
'click touchend': function(ev){
console.log("click touchend button-download");
HOME.downloadSubmenuFunction(ev);
},
'touchstart touchmove': function(){
HOME.home_isMove = true;
//これを入れないと次にダイアログを開くと表示位置が大きくズレる
return false;
}
}, '.button-download' );
*/
if (COMMON.isTouchDevice() == true) {
var avwUserEnvObj = new UserEnvironment();
if (avwUserEnvObj.os == 'ipad') {
......@@ -230,23 +267,6 @@ $(document).ready(function () {
});
/* グループ認証関連 */
$('#dlgAuthCode').hide();
$('#login-username').click(HOME.showDlgAuthCode);
$('#dlgAuthCode-ok').click(HOME.authCodeOkFunction);
$('#dlgAuthCode-cancel').click(HOME.authCodeCancelFunction);
if( ClientData.authCode() != "" ){
//グループ名表示
$('#authGroupBox').show();
$('#authGroupName').html(ClientData.authGroupName());
$('#authGroupButton').click(HOME.authCodeClear);
} else {
$('#authGroupBox').hide();
}
//Button details on dialog click event
$('#dialog-download').click(HOME.downloadSubmenuFunction);
});
......@@ -703,10 +723,9 @@ HOME.openSubMenuDialogFunction = function(e) {
var array = [e.clientX, e.clientY];
var contentid = $(this).attr('contentid');
//ダイハツ対応
var download = $(this).attr('download');
alert("download:" + download);
if (!HOME.isShowBookShelf) {
// Get image of selected image
var base64String = HOME.returnThumbnail(contentid);
......@@ -1761,13 +1780,13 @@ HOME.renderContent = function(id, text, division, type, order, from, to, cateid,
+ ' </a>'
+ ' <div class="info">'
+ ' <ul class="date">'
+ ' <li><span class="lang" lang="txtPubDt"> </span> : ' + outputDate + '</li>'
+ ' <li><span class="lang" lang="txtPubDt"> </span>' + outputDate + '</li>'
+ ' <li><span class="lang" lang="txtViewDt"> </span>:<span id="lblVdate' + post.contentId + '"> </span></li>'
+ ' </ul>'
+ ' <ul class="pic">'
+ ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MEMO + '" id="imgMemo' + post.contentId + '" class="sticker" /></li>'
+ ' <li><img src="' + COMMON.DEFAULT_IMG_OPTION_MARKING + '" id="imgBookMark' + post.contentId + '" class="pen" /></li>'
+ ' <li><ul class="iconList">{share}<li><a class="read lang button-details" contentid="' + post.contentId + '" lang="txtRead">読む</a></li></ul></li>'
+ ' <li><ul class="iconList">{share}{download}<li><a class="read lang button-details" contentid="' + post.contentId + '" lang="txtRead">読む</a></li></ul></li>'
+ ' </ul>'
+ ' </div>'
+ ' </div>'
......@@ -1780,6 +1799,13 @@ HOME.renderContent = function(id, text, division, type, order, from, to, cateid,
}
gridHtml = gridHtml.replace(/\{share\}/g, shareHtml);
//ダイハツ対応
var downloadHtml = "";
if( post.download == '1' ){
downloadHtml ='<li><a class="read button-download" contentid="' + post.contentId + '" >ダウンロード</a></li>';
}
gridHtml = gridHtml.replace(/\{download\}/g, downloadHtml);
$('#content-grid').append(gridHtml);
HOME.getNextRecordNumForList();
......
......@@ -469,7 +469,7 @@ SETTINGS.restoreMarkingData = function()
}
);
return result;
}
};
// Cancel for restore
......
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