Commit a500c463 by Masaru Abe

ダウンロード対応

parent 23d466c4
......@@ -232,8 +232,10 @@
</article>
<section id="dlgSubMenu">
<p class="dop_info">
<a href="#" class="lang" lang="txtRead" id="dialog-read">読む</a><br />
<a href="#" class="lang" lang="txtDetailPage" id="dialog-detail">詳細画面へ</a></p>
<a href="#" class="lang" lang="txtRead" id="dialog-read">読む</a><br />
<a href="#" class="lang" lang="txtDetailPage" id="dialog-detail">詳細画面へ</a><br />
<a href="#" id="dialog-download" style="display: none">ダウンロード</a>
</p>
</section>
<div id="dlgOverlay"> </div>
</div>
......
......@@ -1077,21 +1077,25 @@ HEADER.downloadResourceById = function(contentId){
getType: '2'
};
AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", "get", params,
function (data) {
//Get resourceurl
var resourceUrl = HEADER.getResourceByIdFromAPI(data.contentData.content.resourceId);
// open url to download file
if (HEADER.isSafariNotOnIpad()) {
window.onbeforeunload = null;
window.open(resourceUrl, "_self"); // open url to download file on safari not for ipad
var toogleTime = setTimeout(function () { COMMON.ToogleLogoutNortice() }, 200);
}
else {
window.open(resourceUrl); //open url to download file on orther browser
}
},
function (xhr, b, c) { });
function (data) {
//Get resourceurl
if( data.contentData.content ){
var resourceUrl = HEADER.getResourceByIdFromAPI(data.contentData.content.resourceId);
// open url to download file
if (HEADER.isSafariNotOnIpad()) {
window.onbeforeunload = null;
window.open(resourceUrl, "_self"); // open url to download file on safari not for ipad
var toogleTime = setTimeout(function () { COMMON.ToogleLogoutNortice() }, 200);
}
else {
window.open(resourceUrl); //open url to download file on orther browser
}
} else {
alert("ダウンロード出来ません。");
}
},
function (xhr, b, c) { }
);
};
//Download resource
......
......@@ -245,6 +245,9 @@ $(document).ready(function () {
$('#authGroupBox').hide();
}
//Button details on dialog click event
$('#dialog-download').click(HOME.downloadSubmenuFunction);
});
//グループ認証ここかか
......@@ -700,7 +703,10 @@ 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);
......@@ -755,26 +761,33 @@ HOME.openSubMenuDialogFunction = function(e) {
DETAIL.openContentDetail();
}
else if (HOME.isShowBookShelf) {
$('#dialog-read').attr('contentid', contentid);
$('#dialog-detail').attr('contentid', contentid);
//$("#dlgSubMenu").dialog({position: array, width: 130, height: 90});
$("#dlgSubMenu").show();
HOME.allowTimerCloseSubMenu = false;
$("#dlgSubMenu").position({ my: "left bottom",
at: "left-10 top",
of: this,
collision: "fit"
});
//}
//else if (HOME.isShowBookShelf) {
// $('#dialog-read').attr('contentid', contentid);
// $('#dialog-detail').attr('contentid', contentid);
// //$("#dlgSubMenu").dialog({position: array, width: 130, height: 90});
// $("#dlgSubMenu").show();
// HOME.allowTimerCloseSubMenu = false;
// $("#dlgSubMenu").position({ my: "left bottom",
// at: "left-10 top",
// of: this,
// collision: "fit"
// });
}
else {
$('#dialog-read').attr('contentid', contentid);
$('#dialog-detail').attr('contentid', contentid);
//$("#dlgSubMenu").dialog({position: array, width: 130, height: 90});
$('#dialog-download').attr('contentid', contentid);
if( download == "1" ){
$('#dialog-download').show();
} else {
$('#dialog-download').hide();
}
$("#dlgSubMenu").show();
HOME.allowTimerCloseSubMenu = false;
$("#dlgSubMenu").position({ my: "left bottom",
$("#dlgSubMenu").position({
my: "left bottom",
at: "left-10 top",
of: this,
collision: "fit"
......@@ -1720,7 +1733,7 @@ HOME.renderContent = function(id, text, division, type, order, from, to, cateid,
+ ' </div>'
+ ' <img id="loadingIcon' + post.contentId + '" src="./img/data_loading.gif" height="25px" width="25px" style="padding: 86px; "/>'
+ ' </div>'
+ ' <a id="title' + post.contentId + '" class="dialog name lang" lang="lblTitle" contentid="' + post.contentId + '">'
+ ' <a id="title' + post.contentId + '" class="dialog name lang" lang="lblTitle" contentid="' + post.contentId + '" download="' + post.download + '" >'
+ ' <img src="' + HEADER.getIconTypeContent(post.contentType)+'" width="20" height="20">'
+ COMMON.truncate(COMMON.htmlEncode(post.contentTitle), 20)
+ ' </a>'
......@@ -2724,4 +2737,27 @@ HOME.showContentView = function(){
};
//Dialog Read Button CLick
HOME.downloadSubmenuFunction = function(e) {
if (e) {
e.preventDefault();
}
HOME.allowTimerCloseSubMenu = false;
if (HOME.home_isMove == true) {
HOME.home_isMove = false;
return;
}
// hide dialog sub menu
$('#dlgSubMenu').hide();
var contentId = $(this).attr('contentid');
//Download content
HEADER.downloadResourceById(contentId);
};
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