mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 14:46:56 +02:00
Carousel/Slideshow support added. Use: {GALLERY_SLIDESHOW=X} X = Gallery Category No.
This commit is contained in:
27
e107_plugins/gallery/e_header.php
Normal file
27
e107_plugins/gallery/e_header.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id: e_shortcode.php 12438 2011-12-05 15:12:56Z secretr $
|
||||
*
|
||||
* Featurebox shortcode batch class - shortcodes available site-wide. ie. equivalent to multiple .sc files.
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
e107::getJS()->headerFile("http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js",1);
|
||||
e107::getJs()->headerPlugin('gallery', 'jslib/lightbox/js/lightbox.js');
|
||||
e107::getJs()->pluginCSS('gallery', 'jslib/lightbox/css/lightbox.css');
|
||||
|
||||
e107::getJS()->headerFile("https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js",1);
|
||||
e107::getJS()->headerFile("https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js?load=effects",1);
|
||||
e107::getJs()->headerPlugin('gallery', 'jslib/carousel-min.js');
|
||||
e107::getJs()->pluginCSS('gallery', 'gallery_style.css');
|
||||
|
||||
e107::getJs()->footerInline("
|
||||
new Carousel('carousel-wrapper', $$('#carousel-content .slide'), $$('a.carousel-control', 'a.carousel-jumper'));
|
||||
");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
104
e107_plugins/gallery/e_shortcode.php
Normal file
104
e107_plugins/gallery/e_shortcode.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (c) e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id: e_shortcode.php 12438 2011-12-05 15:12:56Z secretr $
|
||||
*
|
||||
* Featurebox shortcode batch class - shortcodes available site-wide. ie. equivalent to multiple .sc files.
|
||||
*/
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
class gallery_shortcodes extends e_shortcode
|
||||
{
|
||||
|
||||
public $total = 0;
|
||||
public $amount = 3;
|
||||
public $from = 0;
|
||||
public $curCat = null;
|
||||
public $sliderCat = 1;
|
||||
|
||||
function sc_gallery_caption($parm='')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$text = "<a title='".$tp->toAttribute($this->var['media_caption'])."' href='".e107::getParser()->replaceConstants($this->var['media_url'],'abs')."' rel='lightbox[Gallery2]' >";
|
||||
$text .= $this->var['media_caption'];
|
||||
$text .= "</a>";
|
||||
return $text;
|
||||
}
|
||||
|
||||
function sc_gallery_thumb($parm='')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$att = ($parm) ?$parm : 'aw=190&ah=150';
|
||||
$text = "<a title='".$tp->toAttribute($this->var['media_caption'])."' href='".e107::getParser()->replaceConstants($this->var['media_url'],'abs')."' rel='lightbox[Gallery]' >";
|
||||
$text .= "<img src='".e107::getParser()->thumbUrl($this->var['media_url'],$att)."' alt='' />";
|
||||
$text .= "</a>";
|
||||
return $text;
|
||||
}
|
||||
|
||||
function sc_gallery_cat_title($parm='')
|
||||
{
|
||||
$tp = e107::getParser();
|
||||
$text = "<a href='".e_SELF."?cat=".$this->var['media_cat_category']."'>";
|
||||
$text .= $tp->toHtml($this->var['media_cat_title']);
|
||||
$text .= "</a>";
|
||||
return $text;
|
||||
}
|
||||
|
||||
function sc_gallery_cat_thumb($parm='')
|
||||
{
|
||||
$att = ($parm) ?$parm : 'aw=190&ah=150';
|
||||
$text = "<a href='".e_SELF."?cat=".$this->var['media_cat_category']."'>";
|
||||
$text .= "<img src='".e107::getParser()->thumbUrl($this->var['media_cat_image'],$att)."' alt='' />";
|
||||
$text .= "</a>";
|
||||
return $text;
|
||||
}
|
||||
|
||||
function sc_gallery_nextprev($parm='')
|
||||
{
|
||||
$url = e_SELF."?cat=".$this->curCat."--AMP--frm=--FROM--";
|
||||
$parm = 'total='.$this->total.'&amount='.$this->amount.'¤t='.$this->from.'&url='.$url; // .'&url='.$url;
|
||||
$text .= e107::getParser()->parseTemplate("{NEXTPREV=".$parm."}");
|
||||
return $text;
|
||||
}
|
||||
|
||||
function sc_gallery_slideshow($parm='')
|
||||
{
|
||||
if($parm){ $this->sliderCat = intval($parm); }
|
||||
$template = e107::getTemplate('gallery','gallery','SLIDESHOW_WRAPPER');
|
||||
return e107::getParser()->parseTemplate($template);
|
||||
}
|
||||
|
||||
function sc_gallery_slides($parm)
|
||||
{
|
||||
$amount = ($parm) ? intval($parm) : 3;
|
||||
$tp = e107::getParser();
|
||||
$list = e107::getMedia()->getImages('gallery_'.$this->sliderCat);
|
||||
$item_template = e107::getTemplate('gallery','gallery','SLIDESHOW_SLIDE_ITEM');
|
||||
|
||||
$count = 1;
|
||||
foreach($list as $row)
|
||||
{
|
||||
$this->setParserVars($row);
|
||||
$inner .= ($count == 1) ? "\n\n<!-- SLIDE ".$count." -->\n<div class='slide'>\n" : "";
|
||||
$inner .= "\n".$tp->parseTemplate($item_template,TRUE)."\n";
|
||||
$inner .= ($count == $amount) ? "\n</div>\n\n" : "";
|
||||
|
||||
if($count == $amount)
|
||||
{
|
||||
$count = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
$inner .= ($count != $amount) ? "</div>" : "";
|
||||
|
||||
return $inner;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
?>
|
@@ -32,25 +32,12 @@ if (!getperms("P") || !plugInstalled('gallery'))
|
||||
exit;
|
||||
}
|
||||
|
||||
e107::getJS()->headerFile("http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js",1);
|
||||
e107::getJs()->headerPlugin('gallery', 'jslib/lightbox/js/lightbox.js');
|
||||
e107::getJs()->pluginCSS('gallery', 'jslib/lightbox/css/lightbox.css');
|
||||
e107::getJs()->pluginCSS('gallery', 'gallery_style.css');
|
||||
//e107::getJS()->headerFile("http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js",1);
|
||||
//e107::getJs()->headerPlugin('gallery', 'jslib/lightbox/js/lightbox.js');
|
||||
//e107::getJs()->pluginCSS('gallery', 'jslib/lightbox/css/lightbox.css');
|
||||
//e107::getJs()->pluginCSS('gallery', 'gallery_style.css');
|
||||
|
||||
//e107::getJs()->headerPlugin('gallery', 'jslib/shadowbox/shadowbox.js');
|
||||
//e107::getJs()->pluginCSS('gallery', 'jslib/shadowbox/shadowbox.css');
|
||||
|
||||
// e107::getJs()->headerInline('Shadowbox.init();');
|
||||
/*
|
||||
e107::getJs()->headerInline('
|
||||
Shadowbox.init({
|
||||
handleOversize: "drag",
|
||||
overlayOpacity: 0.9,
|
||||
viewportPadding: 50
|
||||
});
|
||||
');
|
||||
|
||||
*/
|
||||
|
||||
|
||||
require_once(HEADERF);
|
||||
@@ -108,7 +95,6 @@ class gallery
|
||||
foreach($list as $row)
|
||||
{
|
||||
$sc->setParserVars($row);
|
||||
// echo "THIS=".$sc->getScVar['gallery_caption'];
|
||||
$inner .= $tp->parseTemplate($template['LIST_ITEM'],TRUE);
|
||||
}
|
||||
|
||||
|
@@ -29,3 +29,11 @@
|
||||
.lb-dataContainer { padding-top:10px; font-size: 110%;}
|
||||
|
||||
.lb-caption { }
|
||||
|
||||
|
||||
/* CAROUSEL */
|
||||
#carousel-wrapper { width: 610px; height: 170px; overflow: hidden; background: black; margin-top:10px; margin-left:auto;margin-right:auto }
|
||||
#carousel-content { width: 2500px; }
|
||||
#carousel-content .slide { float: left; width: 600px; padding:10px; height: 160px; }
|
||||
.controls { width: 610px; margin-left:auto;margin-right:auto; margin-bottom:10px; }
|
||||
.gallery-slide-item { margin-right:5px; }
|
||||
|
25
e107_plugins/gallery/jslib/carousel-min.js
vendored
Normal file
25
e107_plugins/gallery/jslib/carousel-min.js
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
Copyright (c) 2009 Victor Stanciu - http://www.victorstanciu.ro
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('1C=19.1a(1D,{1b:7(c,d,e,f){4.o=t;4.h=$(c);4.8=d;4.k=e;4.5=F.G({p:1,1c:t,1d:3,q:1,1e:\'H-1E\',1f:\'H-1F\',I:\'H-1G\',J:\'H-1H\',r:t,v:K,w:\'1g\',S:\'T\'},f||{});6(4.5.w==\'L\'){4.5.r=K}4.8.1I(7(a,b){a.M=b});6(4.k){4.k.N(\'U\',\'V\',4.V.z(4))}6(4.5.v){4.h.U(\'1J\',4.v.1h(4)).U(\'1K\',4.v.1h(4))}6(4.5.1c){4.A()}6(4.5.1i){9 g=4.8.1L($(4.5.1i));6(g>(4.5.q-1)&&4.5.q>1){6(g>4.8.i-(4.5.q+1)){g=4.8.i-4.5.q}}4.l(4.8[g])}},V:7(a){4.B();9 b=a.1M(\'a\');6(!b.W(4.5.I)){6(b.W(4.5.1e)){1N("4."+b.1j+"()")}s 6(b.W(4.5.1f)){4.l(b.1j);6(4.5.J){4.k.N(\'1k\',4.5.J);b.1l(4.5.J)}}}4.X();a.B()},l:7(a){6(4.5.Y&&(Z 4.5.Y==\'7\')){4.5.Y()}4.10=4.m?4.m:4.8[0];4.m=$(a);9 b=4.h.1m();9 c=4.m.1m();6(4.o){4.o.1O()}1n(4.5.w){O\'L\':4.o=11 n.1o(4.h,{1p:1.0,1q:0,p:4.5.p,12:(7(){4.h.C=c[0]-b[0];4.h.D=c[1]-b[1];11 n.1o(4.h,{1p:0,1q:1.0,p:4.5.p,12:(7(){6(4.k){4.P()}6(4.5.u&&(Z 4.5.u==\'7\')){4.5.u()}}).z(4)})}).z(4)});Q;O\'1g\':1r:9 d;1n(4.5.S){O\'1s\':d=n.1t.1s;Q;O\'T\':1r:d=n.1t.T;Q}4.o=11 n.13(4.h,{p:4.5.p,x:(c[0]-b[0]),y:(c[1]-b[1]),S:d,12:(7(){6(4.k){4.P()}6(4.5.u&&(Z 4.5.u==\'7\')){4.5.u()}4.o=t}).z(4)});Q}R t},1u:7(){6(4.m){9 a=4.m.M;9 b=(a==0)?(4.5.r?4.8.i-1:0):a-1}s{9 b=(4.5.r?4.8.i-1:0)}6(b==(4.8.i-1)&&4.5.r&&4.5.w!=\'L\'){4.h.C=(4.8.i-1)*4.8.14().1P();4.h.D=(4.8.i-1)*4.8.14().1Q();b=4.8.i-2}4.l(4.8[b])},15:7(){6(4.m){9 a=4.m.M;9 b=(4.8.i-1==a)?(4.5.r?0:a):a+1}s{9 b=1}6(b==0&&4.5.r&&4.5.w!=\'L\'){4.h.C=0;4.h.D=0;b=1}6(b>4.8.i-(4.5.q+1)){b=4.8.i-4.5.q}4.l(4.8[b])},14:7(){4.l(4.8[0])},1R:7(){4.l(4.8[4.8.i-1])},1S:7(){6(4.10){4.l(4.8[4.10.M])}s{R t}},B:7(){6(4.E){1v(4.E)}},A:7(){4.16()},1T:7(){4.B();4.P()},1U:7(b){6(b){9 c=b.1V||b.1W;6(!c||(!4.8.1X(c)&&!4.8.1Y(7(a){R c.1Z(a)}))){4.A()}}s{4.A()}},16:7(){6(4.E!=20){1v(4.E);4.15()}4.E=21(4.16.z(4),4.5.1d*22)},v:7(a){a.23=K;a.B();9 b=0;6(!a){a=24.25}6(a.1w){b=a.1w/26}s 6(a.1x){b=-a.1x/3}6(!4.o){4.X();6(b>0){4.1u()}s{4.15()}}R 27.28(b)},X:7(){4.k.N(\'1l\',4.5.I)},P:7(){4.k.N(\'1k\',4.5.I)}});n.13=19.1a();F.G(F.G(n.13.1y,n.29.1y),{1b:7(a){4.j=$(a);9 b=F.G({x:0,y:0,1z:\'1A\'},2a[1]||{});4.A(b)},2b:7(){6(4.5.2c&&!4.j.1B){4.j.2d();4.j.1B=K;4.j.2e(4.j.2f)}4.17=4.j.C;4.18=4.j.D;6(4.5.1z==\'1A\'){4.5.x-=4.17;4.5.y-=4.18}},2g:7(a){4.j.C=4.5.x*a+4.17;4.j.D=4.5.y*a+4.18}});',62,141,'||||this|options|if|function|slides|var||||||||scroller|length|element|controls|moveTo|current|Effect|scrolling|duration|visibleSlides|circular|else|false|afterMove|wheel|effect|||bind|start|stop|scrollLeft|scrollTop|timer|Object|extend|carousel|disabledClassName|selectedClassName|true|fade|_index|invoke|case|activateControls|break|return|transition|sinoidal|observe|click|hasClassName|deactivateControls|beforeMove|typeof|previous|new|afterFinish|SmoothScroll|first|next|periodicallyUpdate|originalLeft|originalTop|Class|create|initialize|auto|frequency|controlClassName|jumperClassName|scroll|bindAsEventListener|initial|rel|removeClassName|addClassName|cumulativeOffset|switch|Opacity|from|to|default|spring|Transitions|prev|clearTimeout|wheelDelta|detail|prototype|mode|absolute|_ext|Carousel|Abstract|control|jumper|disabled|selected|each|mousewheel|DOMMouseScroll|indexOf|findElement|eval|cancel|getWidth|getHeight|last|toggle|pause|resume|relatedTarget|toElement|include|any|descendantOf|null|setTimeout|1000|cancelBubble|window|event|120|Math|round|Base|arguments|setup|continuous|cleanWhitespace|appendChild|firstChild|update'.split('|'),0,{}))
|
@@ -8,7 +8,10 @@
|
||||
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
|
||||
/*
|
||||
// SEE e_shortcode.php instead.
|
||||
|
||||
|
||||
class gallery_shortcodes extends e_shortcode
|
||||
{
|
||||
|
||||
@@ -64,3 +67,4 @@ class gallery_shortcodes extends e_shortcode
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
@@ -43,6 +43,23 @@ $GALLERY_TEMPLATE['CAT_END'] =
|
||||
<div class='gallery-cat-end'>
|
||||
</div>
|
||||
";
|
||||
|
||||
// {GALLERY_SLIDESHOW=X} X = Gallery Category. Default: 1 (ie. 'gallery_1')
|
||||
// {GALLERY_SLIDES=X} X = number of items per slide.
|
||||
$GALLERY_TEMPLATE['SLIDESHOW_WRAPPER'] = '
|
||||
<div id="carousel-wrapper">
|
||||
<div id="carousel-content">
|
||||
{GALLERY_SLIDES=3}
|
||||
</div>
|
||||
</div>
|
||||
<div class="controls">
|
||||
<a href="javascript:" class="carousel-control ico-next" rel="next" style="float: right">Next ›</a>
|
||||
<a href="javascript:" class="carousel-control ico-prev" rel="prev">‹ Previous</a>
|
||||
</div>
|
||||
';
|
||||
|
||||
$GALLERY_TEMPLATE['SLIDESHOW_SLIDE_ITEM'] = '<span class="gallery-slide-item">{GALLERY_THUMB}</span>';
|
||||
|
||||
|
||||
|
||||
?>
|
Reference in New Issue
Block a user