mirror of
https://github.com/e107inc/e107.git
synced 2025-01-29 10:38:08 +01:00
Gallery made compatible with bootstrap3
This commit is contained in:
parent
c42fe97454
commit
24319d6984
@ -81,24 +81,38 @@ class plugin_gallery_index_controller extends eControllerFront
|
||||
public function actionCategory()
|
||||
{
|
||||
$template = e107::getTemplate('gallery');
|
||||
$template = array_change_key_case($template);
|
||||
$sc = e107::getScBatch('gallery',TRUE);
|
||||
|
||||
$text = "";
|
||||
|
||||
$text = e107::getParser()->parseTemplate($template['CAT_START'],TRUE, $sc);
|
||||
if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootsrap3 to bootstrap2 compat.
|
||||
{
|
||||
$template['cat_start'] = str_replace('row', 'row-fluid', $template['cat_start']);
|
||||
}
|
||||
|
||||
$text = e107::getParser()->parseTemplate($template['cat_start'],TRUE, $sc);
|
||||
|
||||
foreach($this->catList as $val)
|
||||
{
|
||||
$sc->setVars($val);
|
||||
$text .= e107::getParser()->parseTemplate($template['CAT_ITEM'],TRUE);
|
||||
$text .= e107::getParser()->parseTemplate($template['cat_item'],TRUE);
|
||||
}
|
||||
|
||||
$text .= e107::getParser()->parseTemplate($template['CAT_END'],TRUE, $sc);
|
||||
$text .= e107::getParser()->parseTemplate($template['cat_end'],TRUE, $sc);
|
||||
|
||||
if(isset($template['cat_caption']))
|
||||
{
|
||||
$title = e107::getParser()->parseTemplate($template['cat_caption'],TRUE, $sc);
|
||||
|
||||
$this->addTitle($title)->addBody($text);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->addTitle(LAN_PLUGIN_GALLERY_TITLE)->addBody($text);
|
||||
}
|
||||
|
||||
|
||||
// $text = $template['CAT_START'].$text.$template['CAT_END'];
|
||||
$this->addTitle(LAN_PLUGIN_GALLERY_TITLE)
|
||||
->addBody($text);
|
||||
}
|
||||
|
||||
public function actionList()
|
||||
@ -131,7 +145,13 @@ class plugin_gallery_index_controller extends eControllerFront
|
||||
|
||||
$tp = e107::getParser();
|
||||
$template = e107::getTemplate('gallery');
|
||||
$template = array_change_key_case($template);
|
||||
$sc = e107::getScBatch('gallery',TRUE);
|
||||
|
||||
if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootsrap3 to bootstrap2 compat.
|
||||
{
|
||||
$template['list_start'] = str_replace('row', 'row-fluid', $template['list_start']);
|
||||
}
|
||||
|
||||
$sc->total = e107::getMedia()->countImages($cid);
|
||||
$sc->amount = e107::getPlugPref('gallery','perpage', 12); // TODO Add Pref. amount per page.
|
||||
@ -149,16 +169,26 @@ class plugin_gallery_index_controller extends eControllerFront
|
||||
$sc->setVars($row)
|
||||
->addVars($cat);
|
||||
|
||||
$inner .= $tp->parseTemplate($template['LIST_ITEM'],TRUE, $sc);
|
||||
$inner .= $tp->parseTemplate($template['list_item'],TRUE, $sc);
|
||||
}
|
||||
|
||||
$text = $tp->parseTemplate($template['LIST_START'],TRUE, $sc);
|
||||
$text = $tp->parseTemplate($template['list_start'],TRUE, $sc);
|
||||
$text .= $inner;
|
||||
$text .= $tp->parseTemplate($template['LIST_END'],TRUE, $sc);
|
||||
$text .= $tp->parseTemplate($template['list_end'],TRUE, $sc);
|
||||
|
||||
$this->addTitle($catname)
|
||||
if(isset($template['list_caption']))
|
||||
{
|
||||
$title = $tp->parseTemplate($template['list_caption'],TRUE, $sc);
|
||||
$this->addTitle($title)->addBody($text);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->addTitle($catname)
|
||||
->addTitle(LAN_PLUGIN_GALLERY_TITLE)
|
||||
->addBody($text);
|
||||
->addBody($text);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -140,10 +140,10 @@ class gallery_shortcodes extends e_shortcode
|
||||
|
||||
$url = e107::getUrl()->create('gallery/index/list', $this->var);
|
||||
|
||||
if(isset($parms['thumbsrc'])) return e107::getParser()->thumbUrl($this->var['media_cat_image'],$att);
|
||||
if(isset($parms['thumbsrc'])) return e107::getParser()->thumbUrl($this->var['media_cat_image'],$att);
|
||||
|
||||
$text = "<a class='thumbnail' href='".$url."'>";
|
||||
$text .= "<img src='".e107::getParser()->thumbUrl($this->var['media_cat_image'],$att)."' alt='' />";
|
||||
$text .= "<img data-src='holder.js/".$w."x".$h."' src='".e107::getParser()->thumbUrl($this->var['media_cat_image'],$att)."' alt='' />";
|
||||
$text .= "</a>";
|
||||
return $text;
|
||||
}
|
||||
@ -161,8 +161,10 @@ class gallery_shortcodes extends e_shortcode
|
||||
{
|
||||
$this->sliderCat = ($parm) ? $parm : vartrue(e107::getPlugPref('gallery','slideshow_category'),1);
|
||||
|
||||
$template = e107::getTemplate('gallery','gallery','SLIDESHOW_WRAPPER');
|
||||
return e107::getParser()->parseTemplate($template);
|
||||
$tmpl = e107::getTemplate('gallery','gallery');
|
||||
$template = array_change_key_case($tmpl);
|
||||
|
||||
return e107::getParser()->parseTemplate($template['slideshow_wrapper']);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -182,7 +184,10 @@ class gallery_shortcodes extends e_shortcode
|
||||
$parms = $parms[2];
|
||||
$limit = (integer) vartrue($parms['limit'], 16);
|
||||
$list = e107::getMedia()->getImages('gallery_'.$this->sliderCat.'|gallery_image_'.$this->sliderCat,0,$limit);
|
||||
$item_template = e107::getTemplate('gallery','gallery', vartrue($parms['template'], 'SLIDESHOW_SLIDE_ITEM'));
|
||||
$tmpl = e107::getTemplate('gallery','gallery');
|
||||
$tmpl = array_change_key_case($tmpl); // change template key to lowercase (BC fix)
|
||||
$tmpl_key = vartrue($parms['template'],'slideshow_slide_item');
|
||||
$item_template = $tmpl[$tmpl_key]; // e107::getTemplate('gallery','gallery', vartrue($parms['template'], 'SLIDESHOW_SLIDE_ITEM'));
|
||||
$catList = e107::getMedia()->getCategories('gallery');
|
||||
$cat = $catList['gallery_'.$this->sliderCat];
|
||||
|
||||
|
@ -53,20 +53,26 @@ class gallery
|
||||
function listCategories()
|
||||
{
|
||||
$template = e107::getTemplate('gallery');
|
||||
$template = array_change_key_case($template);
|
||||
$sc = e107::getScBatch('gallery',TRUE);
|
||||
|
||||
$text = "";
|
||||
|
||||
if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootsrap3 to bootstrap2 compat.
|
||||
{
|
||||
$template['cat_start'] = str_replace('row', 'row-fluid', $template['cat_start']);
|
||||
}
|
||||
|
||||
$text = e107::getParser()->parseTemplate($template['CAT_START'],TRUE, $sc);
|
||||
|
||||
$text = e107::getParser()->parseTemplate($template['cat_start'],TRUE, $sc);
|
||||
|
||||
foreach($this->catList as $val)
|
||||
{
|
||||
$sc->setVars($val);
|
||||
$text .= e107::getParser()->parseTemplate($template['CAT_ITEM'],TRUE, $sc);
|
||||
$text .= e107::getParser()->parseTemplate($template['cat_item'],TRUE, $sc);
|
||||
}
|
||||
|
||||
$text .= e107::getParser()->parseTemplate($template['CAT_END'],TRUE, $sc);
|
||||
$text .= e107::getParser()->parseTemplate($template['cat_end'],TRUE, $sc);
|
||||
|
||||
e107::getRender()->tablerender(LAN_PLUGIN_GALLERY_TITLE, $text);
|
||||
}
|
||||
@ -77,7 +83,13 @@ class gallery
|
||||
$mes = e107::getMessage();
|
||||
$tp = e107::getParser();
|
||||
$template = e107::getTemplate('gallery');
|
||||
$template = array_change_key_case($template);
|
||||
$sc = e107::getScBatch('gallery',TRUE);
|
||||
|
||||
if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootsrap3 to bootstrap2 compat.
|
||||
{
|
||||
$template['list_start'] = str_replace('row', 'row-fluid', $template['list_start']);
|
||||
}
|
||||
|
||||
$sc->total = e107::getMedia()->countImages($cat);
|
||||
$sc->amount = 12; // TODO Add Pref. amount per page.
|
||||
@ -92,12 +104,12 @@ class gallery
|
||||
foreach($list as $row)
|
||||
{
|
||||
$sc->setVars($row);
|
||||
$inner .= $tp->parseTemplate($template['LIST_ITEM'],TRUE, $sc);
|
||||
$inner .= $tp->parseTemplate($template['list_item'],TRUE, $sc);
|
||||
}
|
||||
|
||||
$text = $tp->parseTemplate($template['LIST_START'],TRUE, $sc);
|
||||
$text = $tp->parseTemplate($template['list_start'],TRUE, $sc);
|
||||
$text .= $inner;
|
||||
$text .= $tp->parseTemplate($template['LIST_END'],TRUE, $sc);
|
||||
$text .= $tp->parseTemplate($template['list_end'],TRUE, $sc);
|
||||
|
||||
e107::getRender()->tablerender(LAN_PLUGIN_GALLERY_TITLE, $mes->render().$text);
|
||||
|
||||
|
@ -38,7 +38,13 @@ ul.gallery-cat > li > div > h3 { text-align: center }
|
||||
.gallery-slide-jumper-selected { font-weight:bold }
|
||||
|
||||
|
||||
/* Fix for Bootstrap2 margin-left issue when wrapping */
|
||||
.row-fluid .gallery div.span6:nth-child(2n + 3) { margin-left : 0px; }
|
||||
.row-fluid .gallery div.span4:nth-child(3n + 4) { margin-left : 0px; }
|
||||
.row-fluid .gallery div.span3:nth-child(4n + 5) { margin-left : 0px; }
|
||||
.row-fluid .gallery div.span2:nth-child(6n + 7) { margin-left : 0px; }
|
||||
|
||||
|
||||
|
||||
|
||||
.row-fluid .gallery-cat div.span6:nth-child(2n + 3) { margin-left : 0px; }
|
||||
.row-fluid .gallery-cat div.span4:nth-child(3n + 4) { margin-left : 0px; }
|
||||
.row-fluid .gallery-cat div.span3:nth-child(4n + 5) { margin-left : 0px; }
|
||||
.row-fluid .gallery-cat div.span2:nth-child(6n + 7) { margin-left : 0px; }
|
||||
|
@ -6,13 +6,61 @@
|
||||
* Gallery Template
|
||||
*/
|
||||
|
||||
|
||||
$GALLERY_TEMPLATE['list_caption'] = LAN_PLUGIN_GALLERY_TITLE;
|
||||
|
||||
$GALLERY_TEMPLATE['LIST_START'] =
|
||||
$GALLERY_TEMPLATE['list_start'] =
|
||||
'{GALLERY_BREADCRUMB}
|
||||
<div class="row gallery">
|
||||
';
|
||||
|
||||
|
||||
$GALLERY_TEMPLATE['list_item'] = '
|
||||
<div class="span2 col-xs-6 col-md-3">
|
||||
<div class="thumbnail">
|
||||
{GALLERY_THUMB=w=300&h=200}
|
||||
<h5>{GALLERY_CAPTION}</h5>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
$GALLERY_TEMPLATE['list_end'] =
|
||||
"</div>
|
||||
<div class='center' >
|
||||
<div class='gallery-list-nextprev'>{GALLERY_NEXTPREV}</div>
|
||||
<div class='gallery-list-back'><a class='btn btn-default' href='{GALLERY_BASEURL}'>Back to Categories</a></div>
|
||||
</div>
|
||||
";
|
||||
|
||||
// Bootstrap3 Compatible.
|
||||
|
||||
$GALLERY_TEMPLATE['cat_caption'] = LAN_PLUGIN_GALLERY_TITLE;
|
||||
|
||||
$GALLERY_TEMPLATE['cat_start'] =
|
||||
'{GALLERY_BREADCRUMB}
|
||||
<div class="row gallery-cat">';
|
||||
|
||||
|
||||
$GALLERY_TEMPLATE['cat_item'] = '
|
||||
<div class="span3 col-xs-6 col-md-3">
|
||||
<div >
|
||||
{GALLERY_CAT_THUMB}
|
||||
<h3>{GALLERY_CAT_TITLE}</h3>
|
||||
</div>
|
||||
</div>';
|
||||
|
||||
|
||||
$GALLERY_TEMPLATE['cat_end'] =
|
||||
"</div>
|
||||
";
|
||||
|
||||
|
||||
/* //Bootstrap2
|
||||
$GALLERY_TEMPLATE['list_start'] =
|
||||
'{GALLERY_BREADCRUMB}
|
||||
<ul class="thumbnails gallery">';
|
||||
|
||||
|
||||
$GALLERY_TEMPLATE['LIST_ITEM'] = '
|
||||
$GALLERY_TEMPLATE['list_item'] = '
|
||||
<li class="span2">
|
||||
<div class="thumbnail">
|
||||
{GALLERY_THUMB}
|
||||
@ -20,21 +68,20 @@ $GALLERY_TEMPLATE['LIST_ITEM'] = '
|
||||
</div>
|
||||
</li>';
|
||||
|
||||
$GALLERY_TEMPLATE['LIST_END'] =
|
||||
$GALLERY_TEMPLATE['list_end'] =
|
||||
"</ul>
|
||||
<div class='center' >
|
||||
<div class='gallery-list-nextprev'>{GALLERY_NEXTPREV}</div>
|
||||
<div class='gallery-list-back'><a class='btn' href='{GALLERY_BASEURL}'>Back to Categories</a></div>
|
||||
</div>
|
||||
";
|
||||
|
||||
|
||||
$GALLERY_TEMPLATE['CAT_START'] =
|
||||
|
||||
$GALLERY_TEMPLATE['cat_start'] =
|
||||
'{GALLERY_BREADCRUMB}
|
||||
<ul class="thumbnails gallery-cat">';
|
||||
|
||||
|
||||
$GALLERY_TEMPLATE['CAT_ITEM'] = '
|
||||
$GALLERY_TEMPLATE['cat_item'] = '
|
||||
<li class="span3">
|
||||
<div >
|
||||
{GALLERY_CAT_THUMB}
|
||||
@ -42,23 +89,18 @@ $GALLERY_TEMPLATE['CAT_ITEM'] = '
|
||||
</div>
|
||||
</li>';
|
||||
|
||||
/*
|
||||
$GALLERY_TEMPLATE['CAT_ITEM'] =
|
||||
"<div class='gallery-cat-item'>
|
||||
<div class='gallery-cat-thumb'>{GALLERY_CAT_THUMB}</div>
|
||||
<div class='gallery-cat-title'><h3>{GALLERY_CAT_TITLE}</h3></div>
|
||||
</div>
|
||||
";
|
||||
*/
|
||||
$GALLERY_TEMPLATE['CAT_END'] =
|
||||
|
||||
$GALLERY_TEMPLATE['cat_end'] =
|
||||
"</ul>
|
||||
";
|
||||
*/
|
||||
|
||||
|
||||
// {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_JUMPER=space} will remove numbers and just leave spaces.
|
||||
|
||||
$GALLERY_TEMPLATE['SLIDESHOW_WRAPPER'] = '
|
||||
$GALLERY_TEMPLATE['slideshow_wrapper'] = '
|
||||
|
||||
<div id="gallery-slideshow-wrapper">
|
||||
<div id="gallery-slideshow-content">
|
||||
@ -75,7 +117,7 @@ $GALLERY_TEMPLATE['SLIDESHOW_WRAPPER'] = '
|
||||
|
||||
';
|
||||
|
||||
$GALLERY_TEMPLATE['SLIDESHOW_SLIDE_ITEM'] = '<span class="gallery-slide-item">{GALLERY_THUMB=w=150&h=120}</span>';
|
||||
$GALLERY_TEMPLATE['slideshow_slide_item'] = '<span class="gallery-slide-item">{GALLERY_THUMB=w=150&h=120}</span>';
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user