Commit a500c463 by Masaru Abe

ダウンロード対応

parent 23d466c4
......@@ -233,7 +233,9 @@
<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="txtDetailPage" id="dialog-detail">詳細画面へ</a><br />
<a href="#" id="dialog-download" style="display: none">ダウンロード</a>
</p>
</section>
<div id="dlgOverlay"> </div>
</div>
......
......@@ -1079,8 +1079,8 @@ HEADER.downloadResourceById = function(contentId){
AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", "get", params,
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;
......@@ -1090,8 +1090,12 @@ HEADER.downloadResourceById = function(contentId){
else {
window.open(resourceUrl); //open url to download file on orther browser
}
} else {
alert("ダウンロード出来ません。");
}
},
function (xhr, b, c) { });
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,6 +703,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
......@@ -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