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

Last change on this file since 13104 was 13104, checked in by Zaphod, 12 years ago
File size: 3.3 KB
Line 
1{if !empty($thumbnails)}
2{php}
3        global $stripped, $strippedgalleria, $page;
4        $this->assign( 'stripped', $stripped );
5        $this->assign( 'strippedgalleria', $strippedgalleria );
6        $this->assign( 'get_root_url', get_root_url() );
7        $this->assign( 'catid', @$page['category']['id'] );
8        $this->assign( 'section', @$page['section'] );
9        $this->assign( 'tagids',  @implode(',', @$page['tag_ids']) );
10{/php}
11<div id="gallery"></div>
12{footer_script}
13{literal}
14        var data = [
15                {/literal}{foreach from=$thumbnails item=thumbnail name=thumb}{literal}
16                {
17                        thumb: '{/literal}{$thumbnail.TN_SRC}{literal}',
18                        image: '{/literal}{$thumbnail.FILE_PATH}{literal}',
19                        big: '{/literal}{if (($thumbnail.FILE_HAS_HD) && ($strippedgalleria.lightbox == 'hd'))}{$thumbnail.HD_PATH}{else}{$thumbnail.FILE_PATH}{/if}{literal}',
20                        title: '{/literal}{$thumbnail.NAME|strip_tags:false|replace:'\'':'&#39;'|replace:'"':'&quot;'}{literal}',
21                        description: '{/literal}{$thumbnail.FILE_DESC|strip_tags:false|replace:'\'':'&#39;'|replace:'"':'&quot;'}{literal}',
22                        piwigo_id: {/literal}{$thumbnail.ID}{literal},
23                        piwigo_hashd: {/literal}{if ($thumbnail.FILE_HAS_HD)}true{else}false{/if}{literal}
24                }{/literal}{if (!$smarty.foreach.thumb.last)},{/if}
25                {/foreach}{literal}
26                ];
27                        var Htotal=jQuery(window).height()-1;
28                        var Hheader=jQuery("#content").position().top;
29                        var Hfooter=jQuery("#footer").height();
30                        var Hgallery = Htotal - Hheader - Hfooter - 2;
31            jQuery("#gallery").galleria({
32                                dataSource: data,
33                                height: Hgallery,
34                                lightbox:{/literal}{if ($strippedgalleria.lightbox != 'none')}true{else}false{/if}{literal},
35                                clicknext:{/literal}{if ($strippedgalleria.clicknext)}true{else}false{/if}{literal},
36                                transition:'{/literal}{$strippedgalleria.transition}{literal}',
37                                showCounter:false,
38                                imageTimeout:500000,
39                                maxScaleRatio:1,
40                                extend:function() {
41                                        this.attachKeyboard({
42                                                left: this.prev,
43                                                right: this.next
44                                        });
45                                        this.bind("image", function(e) {
46                                                var gid = e.index;
47                                                var pid = this.getData(gid).piwigo_id;
48                                                var hashd = this.getData(gid).piwigo_hashd;
49                                                if (hashd) {
50                                                        jQuery("#downloadlink").show();
51                                                        jQuery("#downloadlink").prop("href","action.php?id="+pid+"&part=h");
52                                                } else {
53                                                        jQuery("#downloadlink").hide();
54                                                }
55                                                jQuery.post("{/literal}{$get_root_url}{literal}themes/stripped-galleria/save_history.php", {
56                                                        imgid: "img-"+pid,
57                                                        catid: "{/literal}{$catid}{literal}",
58                                                        section: "{/literal}{$section}{literal}",
59                                                        tagids: "{/literal}{$tagids}{literal}"
60                                                });
61                                    });
62                                        this.bind("lightbox_image", function() {
63                                                var image=jQuery("img",".galleria-lightbox-content");
64                                                image.css("width","100%");
65                                                image.css("height","100%");
66                                                var gid=parseInt(jQuery(".galleria-lightbox-counter").text())-1;
67                                                var pid = this.getData(gid).piwigo_id;
68                                                var hashd = this.getData(gid).piwigo_hashd;
69                                                jQuery.post("{/literal}{$get_root_url}{literal}themes/stripped-galleria/save_history.php", {
70                                                        imgid: "img-"+pid,
71                                                        catid: "{/literal}{$catid}{literal}",
72                                                        section: "{/literal}{$section}{literal}",
73                                                        tagids: "{/literal}{$tagids}{literal}"
74                                                });
75                                    });
76                                }
77            });
78{/literal}
79{/footer_script}
80{/if}
Note: See TracBrowser for help on using the repository browser.