Commit a500c463 by Masaru Abe

ダウンロード対応

parent 23d466c4
...@@ -233,7 +233,9 @@ ...@@ -233,7 +233,9 @@
<section id="dlgSubMenu"> <section id="dlgSubMenu">
<p class="dop_info"> <p class="dop_info">
<a href="#" class="lang" lang="txtRead" id="dialog-read">読む</a><br /> <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> </section>
<div id="dlgOverlay"> </div> <div id="dlgOverlay"> </div>
</div> </div>
......
...@@ -1079,8 +1079,8 @@ HEADER.downloadResourceById = function(contentId){ ...@@ -1079,8 +1079,8 @@ HEADER.downloadResourceById = function(contentId){
AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", "get", params, AVWEB.avwCmsApiSync(ClientData.userInfo_accountPath(), "webGetContent", "get", params,
function (data) { function (data) {
//Get resourceurl //Get resourceurl
if( data.contentData.content ){
var resourceUrl = HEADER.getResourceByIdFromAPI(data.contentData.content.resourceId); var resourceUrl = HEADER.getResourceByIdFromAPI(data.contentData.content.resourceId);
// open url to download file // open url to download file
if (HEADER.isSafariNotOnIpad()) { if (HEADER.isSafariNotOnIpad()) {
window.onbeforeunload = null; window.onbeforeunload = null;
...@@ -1090,8 +1090,12 @@ HEADER.downloadResourceById = function(contentId){ ...@@ -1090,8 +1090,12 @@ HEADER.downloadResourceById = function(contentId){
else { else {
window.open(resourceUrl); //open url to download file on orther browser window.open(resourceUrl); //open url to download file on orther browser
} }
} else {
alert("ダウンロード出来ません。");
}
}, },
function (xhr, b, c) { }); function (xhr, b, c) { }
);
}; };
//Download resource //Download resource
......
...@@ -245,6 +245,9 @@ $(document).ready(function () { ...@@ -245,6 +245,9 @@ $(document).ready(function () {
$('#authGroupBox').hide(); $('#authGroupBox').hide();
} }
//Button details on dialog click event
$('#dialog-download').click(HOME.downloadSubmenuFunction);
}); });
//グループ認証ここかか //グループ認証ここかか
...@@ -700,6 +703,9 @@ HOME.openSubMenuDialogFunction = function(e) { ...@@ -700,6 +703,9 @@ HOME.openSubMenuDialogFunction = function(e) {
var array = [e.clientX, e.clientY]; var array = [e.clientX, e.clientY];
var contentid = $(this).attr('contentid'); var contentid = $(this).attr('contentid');
var download = $(this).attr('download');
alert("download:" + download);
if (!HOME.isShowBookShelf) { if (!HOME.isShowBookShelf) {
// Get image of selected image // Get image of selected image
...@@ -755,26 +761,33 @@ HOME.openSubMenuDialogFunction = function(e) { ...@@ -755,26 +761,33 @@ HOME.openSubMenuDialogFunction = function(e) {
DETAIL.openContentDetail(); DETAIL.openContentDetail();
} //}
else if (HOME.isShowBookShelf) { //else if (HOME.isShowBookShelf) {
$('#dialog-read').attr('contentid', contentid); // $('#dialog-read').attr('contentid', contentid);
$('#dialog-detail').attr('contentid', contentid); // $('#dialog-detail').attr('contentid', contentid);
//$("#dlgSubMenu").dialog({position: array, width: 130, height: 90}); // //$("#dlgSubMenu").dialog({position: array, width: 130, height: 90});
$("#dlgSubMenu").show(); // $("#dlgSubMenu").show();
HOME.allowTimerCloseSubMenu = false; // HOME.allowTimerCloseSubMenu = false;
$("#dlgSubMenu").position({ my: "left bottom", // $("#dlgSubMenu").position({ my: "left bottom",
at: "left-10 top", // at: "left-10 top",
of: this, // of: this,
collision: "fit" // collision: "fit"
}); // });
} }
else { else {
$('#dialog-read').attr('contentid', contentid); $('#dialog-read').attr('contentid', contentid);
$('#dialog-detail').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(); $("#dlgSubMenu").show();
HOME.allowTimerCloseSubMenu = false; HOME.allowTimerCloseSubMenu = false;
$("#dlgSubMenu").position({ my: "left bottom", $("#dlgSubMenu").position({
my: "left bottom",
at: "left-10 top", at: "left-10 top",
of: this, of: this,
collision: "fit" collision: "fit"
...@@ -1720,7 +1733,7 @@ HOME.renderContent = function(id, text, division, type, order, from, to, cateid, ...@@ -1720,7 +1733,7 @@ HOME.renderContent = function(id, text, division, type, order, from, to, cateid,
+ ' </div>' + ' </div>'
+ ' <img id="loadingIcon' + post.contentId + '" src="./img/data_loading.gif" height="25px" width="25px" style="padding: 86px; "/>' + ' <img id="loadingIcon' + post.contentId + '" src="./img/data_loading.gif" height="25px" width="25px" style="padding: 86px; "/>'
+ ' </div>' + ' </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">' + ' <img src="' + HEADER.getIconTypeContent(post.contentType)+'" width="20" height="20">'
+ COMMON.truncate(COMMON.htmlEncode(post.contentTitle), 20) + COMMON.truncate(COMMON.htmlEncode(post.contentTitle), 20)
+ ' </a>' + ' </a>'
...@@ -2724,4 +2737,27 @@ HOME.showContentView = function(){ ...@@ -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