aboutsummaryrefslogtreecommitdiffstats
path: root/themes/default/template
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2015-12-07 10:54:18 +0100
committerplegall <plg@piwigo.org>2015-12-07 10:54:18 +0100
commitc3b748ecbfd1a359f6e95e7fd691ac5c11c3c4de (patch)
treecd8710c9a1684fde5616f9332b8a4a90ce09348f /themes/default/template
parent8e098d502a8f0e413b9c085db27d6a62a6c0909f (diff)
feature #379 multiple format, step 2: download formats
* if formats are available, replace the download link on picture.php by a switchBox with all formats * register format in the history table for future statistics
Diffstat (limited to 'themes/default/template')
-rw-r--r--themes/default/template/picture.tpl32
1 files changed, 31 insertions, 1 deletions
diff --git a/themes/default/template/picture.tpl b/themes/default/template/picture.tpl
index 733cefcf8..331de8384 100644
--- a/themes/default/template/picture.tpl
+++ b/themes/default/template/picture.tpl
@@ -65,9 +65,39 @@ function changeImgSrc(url,typeSave,typeMap)
</a>
{/if}{/strip}
{strip}{if isset($current.U_DOWNLOAD)}
- <a href="{$current.U_DOWNLOAD}" title="{'Download this file'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
+ <a id="downloadSwitchLink" href="{$current.U_DOWNLOAD}" title="{'Download this file'|@translate}" class="pwg-state-default pwg-button" rel="nofollow">
<span class="pwg-icon pwg-icon-save"></span><span class="pwg-button-text">{'Download'|@translate}</span>
</a>
+
+{if !empty($current.formats)}
+{footer_script require='jquery'}{literal}
+jQuery().ready(function() {
+ jQuery("#downloadSwitchLink").click(function() {
+ var elt = jQuery("#downloadSwitchBox");
+
+ elt.css("left", Math.min( jQuery(this).offset().left, jQuery(window).width() - elt.outerWidth(true) - 5))
+ .css("top", jQuery(this).offset().top + jQuery(this).outerHeight(true))
+ .toggle();
+
+ return false;
+ });
+
+ jQuery("#downloadSwitchBox").on("mouseleave click", function() {
+ jQuery(this).hide();
+ });
+});
+{/literal}{/footer_script}
+
+<div id="downloadSwitchBox" class="switchBox">
+ <div class="switchBoxTitle">{'Download'|translate} - {'Formats'|translate}</div>
+ <ul>
+ <li><a href="{$current.U_DOWNLOAD}" rel="nofollow">{'Original'|@translate}</a></li>
+ {foreach from=$current.formats item=format}
+ <li><a href="{$format.download_url}" rel="nofollow">{$format.ext|upper}<span class="downloadformatDetails"> ({$format.filesize})</span></a></li>
+ {/foreach}
+ </ul>
+</div>
+{/if} {* has formats *}
{/if}{/strip}
{if isset($PLUGIN_PICTURE_BUTTONS)}{foreach from=$PLUGIN_PICTURE_BUTTONS item=button}{$button}{/foreach}{/if}
{if isset($PLUGIN_PICTURE_ACTIONS)}{$PLUGIN_PICTURE_ACTIONS}{/if}