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

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

version 1.3.2

File size: 3.7 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{assign var='h1' value=60}
12{assign var='h2' value=$h1+10}
13{assign var='h3' value=$h1+20}
14<style type="text/css">{literal}
15        .galleria-image {height:{/literal}{$h1}{literal}px;}
16        .galleria-thumbnails-container {height:{/literal}{$h2}{literal}px;}
17        .galleria-stage {bottom: {/literal}{$h3}{literal}px;}
18{/literal}</style>
19<div id="gallery"></div>
20{footer_script}
21{literal}
22        var data = [
23                {/literal}{foreach from=$thumbnails item=thumbnail name=thumb}{literal}
24                {
25                        thumb: '{/literal}{$thumbnail.TN_SRC}{literal}',
26                        image: '{/literal}{$thumbnail.FILE_PATH}{literal}',
27                        big: '{/literal}{if (($thumbnail.FILE_HAS_HD) && ($strippedgalleria.lightbox == 'hd'))}{$thumbnail.HD_PATH}{else}{$thumbnail.FILE_PATH}{/if}{literal}',
28                        title: '{/literal}{$thumbnail.NAME|strip_tags:false|replace:'\'':'&#39;'|replace:'"':'&quot;'|nl2br|regex_replace:"/[\r\n]/":""}{literal}',
29                        description: '{/literal}{$thumbnail.FILE_DESC|strip_tags:false|replace:'\'':'&#39;'|replace:'"':'&quot;'|nl2br|regex_replace:"/[\r\n]/":""}{literal}',
30                        piwigo_id: {/literal}{$thumbnail.ID}{literal},
31                        piwigo_hashd: {/literal}{if ($thumbnail.FILE_HAS_HD)}true{else}false{/if}{literal}
32                }{/literal}{if (!$smarty.foreach.thumb.last)},{/if}
33                {/foreach}{literal}
34                ];
35                        var Htotal=jQuery(window).height()-1;
36                        var Hheader=jQuery("#content").position().top;
37                        var Hfooter=jQuery("#footer").height();
38                        var Hgallery = Htotal - Hheader - Hfooter - 2;
39            jQuery("#gallery").galleria({
40                                dataSource: data,
41                                height: Hgallery,
42                                lightbox:{/literal}{if ($strippedgalleria.lightbox != 'none')}true{else}false{/if}{literal},
43                                clicknext:{/literal}{if ($strippedgalleria.clicknext)}true{else}false{/if}{literal},
44                                transition:'{/literal}{$strippedgalleria.transition}{literal}',
45                                showCounter:false,
46                                imageTimeout:600000,
47                                maxScaleRatio:1,
48                                extend:function() {
49                                        this.attachKeyboard({
50                                                left: this.prev,
51                                                right: this.next
52                                        });
53                                        this.bind("image", function(e) {
54                                                var gid = e.index;
55                                                var pid = this.getData(gid).piwigo_id;
56                                                var hashd = this.getData(gid).piwigo_hashd;
57                                                if (hashd) {
58                                                        jQuery("#downloadlink").show();
59                                                        jQuery("#downloadlink").prop("href","action.php?id="+pid+"&part=h");
60                                                } else {
61                                                        jQuery("#downloadlink").hide();
62                                                }
63                                                jQuery.post("{/literal}{$get_root_url}{literal}themes/stripped-galleria/save_history.php", {
64                                                        imgid: "img-"+pid,
65                                                        catid: "{/literal}{$catid}{literal}",
66                                                        section: "{/literal}{$section}{literal}",
67                                                        tagids: "{/literal}{$tagids}{literal}"
68                                                });
69                                    });
70                                        this.bind("lightbox_image", function() {
71                                                var image=jQuery("img",".galleria-lightbox-content");
72                                                image.css("width","100%");
73                                                image.css("height","100%");
74                                                var gid=parseInt(jQuery(".galleria-lightbox-counter").text())-1;
75                                                var pid = this.getData(gid).piwigo_id;
76                                                var hashd = this.getData(gid).piwigo_hashd;
77                                                jQuery.post("{/literal}{$get_root_url}{literal}themes/stripped-galleria/save_history.php", {
78                                                        imgid: "img-"+pid,
79                                                        catid: "{/literal}{$catid}{literal}",
80                                                        section: "{/literal}{$section}{literal}",
81                                                        tagids: "{/literal}{$tagids}{literal}"
82                                                });
83                                    });
84                                }
85            });
86{/literal}
87{/footer_script}
88{/if}
Note: See TracBrowser for help on using the repository browser.