mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 14:17:49 +02:00
Gallery preferences and fixes.
This commit is contained in:
@@ -16,16 +16,24 @@ e107::getJS()->headerFile("https://ajax.googleapis.com/ajax/libs/scriptaculous/1
|
|||||||
e107::getJs()->headerPlugin('gallery', 'jslib/carousel.js');
|
e107::getJs()->headerPlugin('gallery', 'jslib/carousel.js');
|
||||||
e107::getJs()->pluginCSS('gallery', 'gallery_style.css');
|
e107::getJs()->pluginCSS('gallery', 'gallery_style.css');
|
||||||
|
|
||||||
|
$gp = e107::getPlugPref('gallery');
|
||||||
|
|
||||||
e107::getJs()->footerInline("
|
e107::getJs()->footerInline("
|
||||||
new Carousel('carousel-wrapper', $$('#carousel-content .slide'), $$('a.carousel-control', 'a.carousel-jumper' ),
|
new Carousel('gallery-slideshow-wrapper', $$('#gallery-slideshow-content .slide'), $$('a.carousel-control', 'a.carousel-jumper' ),
|
||||||
{
|
{
|
||||||
auto: true,
|
duration: ".varset($gp['slideshow_duration'],1).",
|
||||||
circular: true
|
auto: ".varset($gp['slideshow_auto'],0).",
|
||||||
|
frequency: ".varset($gp['slideshow_freq'],3).",
|
||||||
|
circular: ".varset($gp['slideshow_circular'],1).",
|
||||||
|
wheel: true,
|
||||||
|
visibleSlides: 1,
|
||||||
|
effect: '".varset($gp['slideshow_effect'],'scroll')."',
|
||||||
|
transition: '".varset($gp['slideshow_transition'],'sinoidal')."'
|
||||||
|
|
||||||
});
|
});
|
||||||
");
|
");
|
||||||
|
|
||||||
|
unset($gp);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
@@ -64,14 +64,15 @@ class gallery_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
function sc_gallery_slideshow($parm='')
|
function sc_gallery_slideshow($parm='')
|
||||||
{
|
{
|
||||||
if($parm){ $this->sliderCat = intval($parm); }
|
$this->sliderCat = ($parm) ? intval($parm) : vartrue(e107::getPlugPref('gallery','slideshow_category'),1);
|
||||||
|
|
||||||
$template = e107::getTemplate('gallery','gallery','SLIDESHOW_WRAPPER');
|
$template = e107::getTemplate('gallery','gallery','SLIDESHOW_WRAPPER');
|
||||||
return e107::getParser()->parseTemplate($template);
|
return e107::getParser()->parseTemplate($template);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_gallery_slides($parm)
|
function sc_gallery_slides($parm)
|
||||||
{
|
{
|
||||||
$amount = ($parm) ? intval($parm) : 3;
|
$amount = ($parm) ? intval($parm) : vartrue(e107::getPlugPref('gallery','slideshow_perslide'),3);
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$list = e107::getMedia()->getImages('gallery_'.$this->sliderCat);
|
$list = e107::getMedia()->getImages('gallery_'.$this->sliderCat);
|
||||||
$item_template = e107::getTemplate('gallery','gallery','SLIDESHOW_SLIDE_ITEM');
|
$item_template = e107::getTemplate('gallery','gallery','SLIDESHOW_SLIDE_ITEM');
|
||||||
@@ -80,10 +81,11 @@ class gallery_shortcodes extends e_shortcode
|
|||||||
foreach($list as $row)
|
foreach($list as $row)
|
||||||
{
|
{
|
||||||
$this->setParserVars($row);
|
$this->setParserVars($row);
|
||||||
|
|
||||||
$inner .= ($count == 1) ? "\n\n<!-- SLIDE ".$count." -->\n<div class='slide'>\n" : "";
|
$inner .= ($count == 1) ? "\n\n<!-- SLIDE ".$count." -->\n<div class='slide'>\n" : "";
|
||||||
$inner .= "\n".$tp->parseTemplate($item_template,TRUE)."\n";
|
$inner .= "\n\t".$tp->parseTemplate($item_template,TRUE)."\n";
|
||||||
$inner .= ($count == $amount) ? "\n</div>\n\n" : "";
|
$inner .= ($count == $amount) ? "\n</div>\n\n" : "";
|
||||||
|
|
||||||
if($count == $amount)
|
if($count == $amount)
|
||||||
{
|
{
|
||||||
$count = 1;
|
$count = 1;
|
||||||
@@ -91,11 +93,11 @@ class gallery_shortcodes extends e_shortcode
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$inner .= ($count != $amount) ? "</div>" : "";
|
$inner .= ($count != 1) ? "</div><!-- END SLIDES -->" : "";
|
||||||
|
|
||||||
return $inner;
|
return $inner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,9 +31,9 @@
|
|||||||
.lb-caption { }
|
.lb-caption { }
|
||||||
|
|
||||||
|
|
||||||
/* CAROUSEL */
|
/* SLIDESHOW */
|
||||||
#carousel-wrapper { width: 610px; height: 170px; overflow: hidden; background: black; margin-top:10px; margin-left:auto;margin-right:auto }
|
#gallery-slideshow-wrapper { width: 610px; height: 170px; overflow: hidden; background: #000000; margin-left:auto;margin-right:auto }
|
||||||
#carousel-content { width: 2500px; }
|
#gallery-slideshow-content { width: 2500px; }
|
||||||
#carousel-content .slide { float: left; width: 600px; padding:10px; height: 160px; }
|
#gallery-slideshow-content .slide { float: left; width: 600px; padding:10px; height: 160px; }
|
||||||
.controls { width: 610px; margin-left:auto;margin-right:auto; margin-bottom:10px; }
|
.gallery-slideshow-controls { clear:both; width: 610px; margin-left:auto; margin-right:auto; padding-bottom:10px; }
|
||||||
.gallery-slide-item { margin-right:5px; }
|
.gallery-slide-item { margin-right:5px; }
|
||||||
|
@@ -55,7 +55,8 @@ class plugin_gallery_admin extends e_admin_dispatcher
|
|||||||
protected $adminMenu = array(
|
protected $adminMenu = array(
|
||||||
// 'main/list' => array('caption'=> LAN_CATEGORY, 'perm' => 'P'),
|
// 'main/list' => array('caption'=> LAN_CATEGORY, 'perm' => 'P'),
|
||||||
// 'main/create' => array('caption'=> LAN_CREATE, 'perm' => 'P'),
|
// 'main/create' => array('caption'=> LAN_CREATE, 'perm' => 'P'),
|
||||||
'main/gallery' => array('caption'=> 'Info', 'perm' => 'P')//, 'url'=>'{e_ADMIN}image.php'
|
//'main/gallery' => array('caption'=> 'Info', 'perm' => 'P'),//, 'url'=>'{e_ADMIN}image.php'
|
||||||
|
'main/prefs' => array('caption'=> LAN_PREFS, 'perm' => 'P')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -75,6 +76,8 @@ class plugin_gallery_admin extends e_admin_dispatcher
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $menuTitle = 'Gallery';
|
protected $menuTitle = 'Gallery';
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -120,6 +123,48 @@ class gallery_cat_admin_ui extends e_admin_ui
|
|||||||
|
|
||||||
$mes->addInfo($message);
|
$mes->addInfo($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected $prefs = array(
|
||||||
|
'slideshow_category' => array('title'=> 'Slideshow category', 'type' => 'dropdown', 'data' => 'integer', 'help'=>'The category of images which should be used.'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
|
||||||
|
'slideshow_perslide' => array('title'=> 'Images per slide', 'type' => 'number', 'data' => 'integer', 'help'=>'Number of images to show per slide.'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
|
||||||
|
'slideshow_duration' => array('title'=> 'Slide duration', 'type' => 'number', 'data' => 'integer', 'help'=>'The duration (in seconds) of a full jump.'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
|
||||||
|
'slideshow_auto' => array('title'=> 'Slide auto-start', 'type'=>'boolean', 'data' => 'integer','help' => 'When enabled image-rotation begins automatically when the page is loaded.'),
|
||||||
|
'slideshow_freq' => array('title'=> 'Slide frequency', 'type' => 'number', 'data' => 'integer', 'help'=>'When auto-start is enabled, this dictates how long a slides stays put before the next jump. '), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')),
|
||||||
|
'slideshow_circular' => array('title'=> 'Slide circular-mode', 'type' => 'boolean', 'data' => 'integer', 'help'=>'By default when the first/last slide is reached, calling prev/next does nothing. If you want the effect to continue enable this option.'), //
|
||||||
|
'slideshow_effect' => array('title'=> 'Slide Effect', 'type' => 'dropdown', 'data' => 'str', 'help'=>'Type of effect. '), //
|
||||||
|
'slideshow_transition' => array('title'=> 'Slide Transition', 'type' => 'dropdown', 'data' => 'str', 'help'=>'Type of transition. ') //
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function init()
|
||||||
|
{
|
||||||
|
$effects = array('scroll'=>'scroll','fade'=>'fade');
|
||||||
|
$this->prefs['slideshow_effect']['writeParms'] = $effects;
|
||||||
|
$this->prefs['slideshow_effect']['readParms'] = $effects;
|
||||||
|
|
||||||
|
$transitions = array('sinoidal'=>'sinoidal','spring'=>'spring');
|
||||||
|
$this->prefs['slideshow_transition']['writeParms'] = $transitions;
|
||||||
|
$this->prefs['slideshow_transition']['readParms'] = $transitions;
|
||||||
|
|
||||||
|
$categories = e107::getMedia()->getCategories('gallery');
|
||||||
|
$cats = array();
|
||||||
|
foreach($categories as $k=>$var)
|
||||||
|
{
|
||||||
|
list($tmp,$id) = explode("_",$k);
|
||||||
|
$cats[$id] = $var['media_cat_title'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->prefs['slideshow_category']['writeParms'] = $cats;
|
||||||
|
$this->prefs['slideshow_category']['readParms'] = $cats;
|
||||||
|
|
||||||
|
$mes = e107::getMessage();
|
||||||
|
$message = "<b>Gallery</b> is active. Simply import and assign images to the gallery categories using the <a href='".e_ADMIN."image.php'>Media Manager</a>";
|
||||||
|
|
||||||
|
$mes->addInfo($message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,4 +15,14 @@
|
|||||||
</siteLinks>
|
</siteLinks>
|
||||||
<mainPrefs>
|
<mainPrefs>
|
||||||
</mainPrefs>
|
</mainPrefs>
|
||||||
|
<pluginPrefs>
|
||||||
|
<pref name="slideshow_category">1</pref>
|
||||||
|
<pref name="slideshow_perslide">3</pref>
|
||||||
|
<pref name="slideshow_duration">1</pref>
|
||||||
|
<pref name="slideshow_auto">1</pref>
|
||||||
|
<pref name="slideshow_freq">3</pref>
|
||||||
|
<pref name="slideshow_circular">1</pref>
|
||||||
|
<pref name="slideshow_effect">scroll</pref>
|
||||||
|
<pref name="slideshow_transition">sinoidal</pref>
|
||||||
|
</pluginPrefs>
|
||||||
</e107Plugin>
|
</e107Plugin>
|
||||||
|
14
e107_plugins/gallery/slideshow_menu.php
Normal file
14
e107_plugins/gallery/slideshow_menu.php
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2012 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 $
|
||||||
|
*
|
||||||
|
* Gallery Template
|
||||||
|
*/
|
||||||
|
if (!defined('e107_INIT')) { exit; }
|
||||||
|
|
||||||
|
$text = e107::getParser()->parseTemplate("{GALLERY_SLIDESHOW}");
|
||||||
|
e107::getRender()->tablerender("Gallery",$text,'gallery_slideshow');
|
||||||
|
unset($text);
|
||||||
|
|
||||||
|
?>
|
@@ -44,15 +44,15 @@ $GALLERY_TEMPLATE['CAT_END'] =
|
|||||||
</div>
|
</div>
|
||||||
";
|
";
|
||||||
|
|
||||||
// {GALLERY_SLIDESHOW=X} X = Gallery Category. Default: 1 (ie. 'gallery_1')
|
// {GALLERY_SLIDESHOW=X} X = Gallery Category. Default: 1 (ie. 'gallery_1') Overrides preference in admin.
|
||||||
// {GALLERY_SLIDES=X} X = number of items per slide.
|
// {GALLERY_SLIDES=X} X = number of items per slide. (Overrides preference in admin.)
|
||||||
$GALLERY_TEMPLATE['SLIDESHOW_WRAPPER'] = '
|
$GALLERY_TEMPLATE['SLIDESHOW_WRAPPER'] = '
|
||||||
<div id="carousel-wrapper">
|
<div id="gallery-slideshow-wrapper">
|
||||||
<div id="carousel-content">
|
<div id="gallery-slideshow-content">
|
||||||
{GALLERY_SLIDES=3}
|
{GALLERY_SLIDES}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="controls">
|
<div class="gallery-slideshow-controls">
|
||||||
<a href="javascript:" class="carousel-control ico-next" rel="next" style="float: right">Next ›</a>
|
<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>
|
<a href="javascript:" class="carousel-control ico-prev" rel="prev">‹ Previous</a>
|
||||||
</div>
|
</div>
|
||||||
|
Reference in New Issue
Block a user