1
0
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:
CaMer0n
2012-04-25 10:01:24 +00:00
parent 6c14fba8d5
commit e4605efb86
7 changed files with 104 additions and 25 deletions

View File

@@ -16,16 +16,24 @@ e107::getJS()->headerFile("https://ajax.googleapis.com/ajax/libs/scriptaculous/1
e107::getJs()->headerPlugin('gallery', 'jslib/carousel.js');
e107::getJs()->pluginCSS('gallery', 'gallery_style.css');
$gp = e107::getPlugPref('gallery');
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,
circular: true
duration: ".varset($gp['slideshow_duration'],1).",
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);
?>

View File

@@ -64,14 +64,15 @@ class gallery_shortcodes extends e_shortcode
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');
return e107::getParser()->parseTemplate($template);
}
function sc_gallery_slides($parm)
{
$amount = ($parm) ? intval($parm) : 3;
$amount = ($parm) ? intval($parm) : vartrue(e107::getPlugPref('gallery','slideshow_perslide'),3);
$tp = e107::getParser();
$list = e107::getMedia()->getImages('gallery_'.$this->sliderCat);
$item_template = e107::getTemplate('gallery','gallery','SLIDESHOW_SLIDE_ITEM');
@@ -80,8 +81,9 @@ class gallery_shortcodes extends e_shortcode
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 .= "\n\t".$tp->parseTemplate($item_template,TRUE)."\n";
$inner .= ($count == $amount) ? "\n</div>\n\n" : "";
if($count == $amount)
@@ -92,10 +94,10 @@ class gallery_shortcodes extends e_shortcode
{
$count++;
}
}
$inner .= ($count != $amount) ? "</div>" : "";
$inner .= ($count != 1) ? "</div><!-- END SLIDES -->" : "";
return $inner;
}

View File

@@ -31,9 +31,9 @@
.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; }
/* SLIDESHOW */
#gallery-slideshow-wrapper { width: 610px; height: 170px; overflow: hidden; background: #000000; margin-left:auto;margin-right:auto }
#gallery-slideshow-content { width: 2500px; }
#gallery-slideshow-content .slide { float: left; width: 600px; padding:10px; height: 160px; }
.gallery-slideshow-controls { clear:both; width: 610px; margin-left:auto; margin-right:auto; padding-bottom:10px; }
.gallery-slide-item { margin-right:5px; }

View File

@@ -55,7 +55,8 @@ class plugin_gallery_admin extends e_admin_dispatcher
protected $adminMenu = array(
// 'main/list' => array('caption'=> LAN_CATEGORY, '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
*/
protected $menuTitle = 'Gallery';
}
@@ -121,6 +124,48 @@ class gallery_cat_admin_ui extends e_admin_ui
$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);
}
}
class gallery_cat_admin_form_ui extends e_admin_form_ui

View File

@@ -15,4 +15,14 @@
</siteLinks>
<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>

View 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);
?>

View File

@@ -44,15 +44,15 @@ $GALLERY_TEMPLATE['CAT_END'] =
</div>
";
// {GALLERY_SLIDESHOW=X} X = Gallery Category. Default: 1 (ie. 'gallery_1')
// {GALLERY_SLIDES=X} X = number of items per slide.
// {GALLERY_SLIDESHOW=X} X = Gallery Category. Default: 1 (ie. 'gallery_1') Overrides preference in admin.
// {GALLERY_SLIDES=X} X = number of items per slide. (Overrides preference in admin.)
$GALLERY_TEMPLATE['SLIDESHOW_WRAPPER'] = '
<div id="carousel-wrapper">
<div id="carousel-content">
{GALLERY_SLIDES=3}
<div id="gallery-slideshow-wrapper">
<div id="gallery-slideshow-content">
{GALLERY_SLIDES}
</div>
</div>
<div class="controls">
<div class="gallery-slideshow-controls">
<a href="javascript:" class="carousel-control ico-next" rel="next" style="float: right">Next &rsaquo;</a>
<a href="javascript:" class="carousel-control ico-prev" rel="prev">&lsaquo; Previous</a>
</div>