source: extensions/stripped-galleria/template/thumbnails.tpl @ 17962

Last change on this file since 17962 was 17962, checked in by Zaphod, 12 years ago

version 1.4.2

File size: 3.9 KB
Line 
1{if !empty($thumbnails)}
2{combine_script id='jquery.ajaxmanager' path='themes/default/js/plugins/jquery.ajaxmanager.js' load='footer'}
3{combine_script id='thumbnails.loader' path='themes/default/js/thumbnails.loader.js' require='jquery.ajaxmanager' load='footer'}
4{php}
5        global $stripped, $strippedgalleria, $page;
6        $this->assign( 'stripped', $stripped );
7        $this->assign( 'strippedgalleria', $strippedgalleria );
8        $this->assign( 'get_root_url', get_root_url() );
9        $this->assign( 'catid', @$page['category']['id'] );
10        $this->assign( 'section', @$page['section'] );
11        $this->assign( 'tagids',  @implode(',', @$page['tag_ids']) );
12{/php}
13<div id="gallery"></div>
14{footer_script}
15{literal}
16        var data = [
17                {/literal}{foreach from=$thumbnails item=thumbnail name=thumb}
18                {assign var=d_thumb value=$pwg->derivative($stripped.thumbSize, $thumbnail.src_image)}
19                {assign var=d_image value=$pwg->derivative($stripped.imageSize, $thumbnail.src_image)}
20                {if ($stripped.hdSize == 'original')}
21                        {assign var=d_hd value=$thumbnail.src_image}
22                {else}
23                        {assign var=d_hd value=$pwg->derivative($stripped.hdSize, $thumbnail.src_image)}
24                {/if}
25                {literal}
26                {
27                        thumb: '{/literal}{$d_thumb->get_url()}{literal}',
28                        image: '{/literal}{$d_image->get_url()}{literal}',
29                        big: '{/literal}{if (($thumbnail.HD_ACCESS) && ($strippedgalleria.lightbox == 'hd'))}{$d_hd->get_url()}{else}{$d_image->get_url()}{/if}{literal}',
30                        title: '{/literal}{$thumbnail.NAME|strip_tags:false|replace:'\'':'&#39;'|replace:'"':'&quot;'|nl2br|regex_replace:"/[\r\n]/":""}{literal}',
31                        description: '{/literal}{$thumbnail.FILE_DESC|strip_tags:false|replace:'\'':'&#39;'|replace:'"':'&quot;'|nl2br|regex_replace:"/[\r\n]/":""}{literal}',
32                        piwigo_id: {/literal}{$thumbnail.id}{literal},
33                        hd_access: {/literal}{if ($thumbnail.HD_ACCESS)}true{else}false{/if}{literal}
34                }{/literal}{if (!$smarty.foreach.thumb.last)},{/if}
35                {/foreach}{literal}
36                ];
37                        var Htotal=jQuery(window).height()-1;
38                        var Hheader=jQuery("#content").position().top;
39                        var Hfooter=jQuery("#footer").height();
40                        var Hgallery = Htotal - Hheader - Hfooter - 2;
41            jQuery("#gallery").galleria({
42                                dataSource: data,
43                                height: Hgallery,
44                                lightbox:{/literal}{if ($strippedgalleria.lightbox != 'none')}true{else}false{/if}{literal},
45                                clicknext:{/literal}{if ($strippedgalleria.clicknext)}true{else}false{/if}{literal},
46                                transition:'{/literal}{$strippedgalleria.transition}{literal}',
47                                showCounter:false,
48                                imageTimeout:600000,
49                                maxScaleRatio:1,
50                                extend:function() {
51                                        this.attachKeyboard({
52                                                left: this.prev,
53                                                right: this.next
54                                        });
55                                        this.bind("image", function(e) {
56                                                var gid = e.index;
57                                                var pid = this.getData(gid).piwigo_id;
58                                                var hdaccess = this.getData(gid).hd_access;
59                                                if (hdaccess) {
60                                                        jQuery("#downloadlink").show();
61                                                        jQuery("#downloadlink").prop("href","action.php?id="+pid+"&part=e&download");
62                                                } else {
63                                                        jQuery("#downloadlink").hide();
64                                                }
65                                                jQuery.post("{/literal}{$get_root_url}{literal}themes/stripped-galleria/save_history.php", {
66                                                        imgid: "img-"+pid,
67                                                        catid: "{/literal}{$catid}{literal}",
68                                                        section: "{/literal}{$section}{literal}",
69                                                        tagids: "{/literal}{$tagids}{literal}"
70                                                });
71                                    });
72                                        this.bind("lightbox_image", function() {
73                                                var image=jQuery("img",".galleria-lightbox-content");
74                                                image.css("width","100%");
75                                                image.css("height","100%");
76                                                var gid=parseInt(jQuery(".galleria-lightbox-counter").text())-1;
77                                                var pid = this.getData(gid).piwigo_id;
78                                                jQuery.post("{/literal}{$get_root_url}{literal}themes/stripped-galleria/save_history.php", {
79                                                        imgid: "img-"+pid,
80                                                        catid: "{/literal}{$catid}{literal}",
81                                                        section: "{/literal}{$section}{literal}",
82                                                        tagids: "{/literal}{$tagids}{literal}"
83                                                });
84                                    });
85                                }
86            });
87{/literal}
88{/footer_script}
89{/if}
Note: See TracBrowser for help on using the repository browser.