mirror of
https://github.com/e107inc/e107.git
synced 2025-05-18 01:49:50 +02: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()
|
public function actionCategory()
|
||||||
{
|
{
|
||||||
$template = e107::getTemplate('gallery');
|
$template = e107::getTemplate('gallery');
|
||||||
|
$template = array_change_key_case($template);
|
||||||
$sc = e107::getScBatch('gallery',TRUE);
|
$sc = e107::getScBatch('gallery',TRUE);
|
||||||
|
|
||||||
$text = "";
|
$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)
|
foreach($this->catList as $val)
|
||||||
{
|
{
|
||||||
$sc->setVars($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()
|
public function actionList()
|
||||||
@ -131,8 +145,14 @@ class plugin_gallery_index_controller extends eControllerFront
|
|||||||
|
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$template = e107::getTemplate('gallery');
|
$template = e107::getTemplate('gallery');
|
||||||
|
$template = array_change_key_case($template);
|
||||||
$sc = e107::getScBatch('gallery',TRUE);
|
$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->total = e107::getMedia()->countImages($cid);
|
||||||
$sc->amount = e107::getPlugPref('gallery','perpage', 12); // TODO Add Pref. amount per page.
|
$sc->amount = e107::getPlugPref('gallery','perpage', 12); // TODO Add Pref. amount per page.
|
||||||
$sc->curCat = $cid;
|
$sc->curCat = $cid;
|
||||||
@ -149,16 +169,26 @@ class plugin_gallery_index_controller extends eControllerFront
|
|||||||
$sc->setVars($row)
|
$sc->setVars($row)
|
||||||
->addVars($cat);
|
->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 .= $inner;
|
||||||
$text .= $tp->parseTemplate($template['LIST_END'],TRUE, $sc);
|
$text .= $tp->parseTemplate($template['list_end'],TRUE, $sc);
|
||||||
|
|
||||||
|
if(isset($template['list_caption']))
|
||||||
|
{
|
||||||
|
$title = $tp->parseTemplate($template['list_caption'],TRUE, $sc);
|
||||||
|
$this->addTitle($title)->addBody($text);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$this->addTitle($catname)
|
$this->addTitle($catname)
|
||||||
->addTitle(LAN_PLUGIN_GALLERY_TITLE)
|
->addTitle(LAN_PLUGIN_GALLERY_TITLE)
|
||||||
->addBody($text);
|
->addBody($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -143,7 +143,7 @@ class gallery_shortcodes extends e_shortcode
|
|||||||
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 = "<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>";
|
$text .= "</a>";
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
@ -161,8 +161,10 @@ class gallery_shortcodes extends e_shortcode
|
|||||||
{
|
{
|
||||||
$this->sliderCat = ($parm) ? $parm : vartrue(e107::getPlugPref('gallery','slideshow_category'),1);
|
$this->sliderCat = ($parm) ? $parm : vartrue(e107::getPlugPref('gallery','slideshow_category'),1);
|
||||||
|
|
||||||
$template = e107::getTemplate('gallery','gallery','SLIDESHOW_WRAPPER');
|
$tmpl = e107::getTemplate('gallery','gallery');
|
||||||
return e107::getParser()->parseTemplate($template);
|
$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];
|
$parms = $parms[2];
|
||||||
$limit = (integer) vartrue($parms['limit'], 16);
|
$limit = (integer) vartrue($parms['limit'], 16);
|
||||||
$list = e107::getMedia()->getImages('gallery_'.$this->sliderCat.'|gallery_image_'.$this->sliderCat,0,$limit);
|
$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');
|
$catList = e107::getMedia()->getCategories('gallery');
|
||||||
$cat = $catList['gallery_'.$this->sliderCat];
|
$cat = $catList['gallery_'.$this->sliderCat];
|
||||||
|
|
||||||
|
@ -53,20 +53,26 @@ class gallery
|
|||||||
function listCategories()
|
function listCategories()
|
||||||
{
|
{
|
||||||
$template = e107::getTemplate('gallery');
|
$template = e107::getTemplate('gallery');
|
||||||
|
$template = array_change_key_case($template);
|
||||||
$sc = e107::getScBatch('gallery',TRUE);
|
$sc = e107::getScBatch('gallery',TRUE);
|
||||||
|
|
||||||
$text = "";
|
$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)
|
foreach($this->catList as $val)
|
||||||
{
|
{
|
||||||
$sc->setVars($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);
|
e107::getRender()->tablerender(LAN_PLUGIN_GALLERY_TITLE, $text);
|
||||||
}
|
}
|
||||||
@ -77,8 +83,14 @@ class gallery
|
|||||||
$mes = e107::getMessage();
|
$mes = e107::getMessage();
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$template = e107::getTemplate('gallery');
|
$template = e107::getTemplate('gallery');
|
||||||
|
$template = array_change_key_case($template);
|
||||||
$sc = e107::getScBatch('gallery',TRUE);
|
$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->total = e107::getMedia()->countImages($cat);
|
||||||
$sc->amount = 12; // TODO Add Pref. amount per page.
|
$sc->amount = 12; // TODO Add Pref. amount per page.
|
||||||
$sc->curCat = $cat;
|
$sc->curCat = $cat;
|
||||||
@ -92,12 +104,12 @@ class gallery
|
|||||||
foreach($list as $row)
|
foreach($list as $row)
|
||||||
{
|
{
|
||||||
$sc->setVars($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 .= $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);
|
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 }
|
.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; }
|
||||||
|
@ -7,12 +7,60 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
$GALLERY_TEMPLATE['LIST_START'] =
|
$GALLERY_TEMPLATE['list_caption'] = LAN_PLUGIN_GALLERY_TITLE;
|
||||||
|
|
||||||
|
$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}
|
'{GALLERY_BREADCRUMB}
|
||||||
<ul class="thumbnails gallery">';
|
<ul class="thumbnails gallery">';
|
||||||
|
|
||||||
|
|
||||||
$GALLERY_TEMPLATE['LIST_ITEM'] = '
|
$GALLERY_TEMPLATE['list_item'] = '
|
||||||
<li class="span2">
|
<li class="span2">
|
||||||
<div class="thumbnail">
|
<div class="thumbnail">
|
||||||
{GALLERY_THUMB}
|
{GALLERY_THUMB}
|
||||||
@ -20,7 +68,7 @@ $GALLERY_TEMPLATE['LIST_ITEM'] = '
|
|||||||
</div>
|
</div>
|
||||||
</li>';
|
</li>';
|
||||||
|
|
||||||
$GALLERY_TEMPLATE['LIST_END'] =
|
$GALLERY_TEMPLATE['list_end'] =
|
||||||
"</ul>
|
"</ul>
|
||||||
<div class='center' >
|
<div class='center' >
|
||||||
<div class='gallery-list-nextprev'>{GALLERY_NEXTPREV}</div>
|
<div class='gallery-list-nextprev'>{GALLERY_NEXTPREV}</div>
|
||||||
@ -28,13 +76,12 @@ $GALLERY_TEMPLATE['LIST_END'] =
|
|||||||
</div>
|
</div>
|
||||||
";
|
";
|
||||||
|
|
||||||
|
$GALLERY_TEMPLATE['cat_start'] =
|
||||||
$GALLERY_TEMPLATE['CAT_START'] =
|
|
||||||
'{GALLERY_BREADCRUMB}
|
'{GALLERY_BREADCRUMB}
|
||||||
<ul class="thumbnails gallery-cat">';
|
<ul class="thumbnails gallery-cat">';
|
||||||
|
|
||||||
|
|
||||||
$GALLERY_TEMPLATE['CAT_ITEM'] = '
|
$GALLERY_TEMPLATE['cat_item'] = '
|
||||||
<li class="span3">
|
<li class="span3">
|
||||||
<div >
|
<div >
|
||||||
{GALLERY_CAT_THUMB}
|
{GALLERY_CAT_THUMB}
|
||||||
@ -42,23 +89,18 @@ $GALLERY_TEMPLATE['CAT_ITEM'] = '
|
|||||||
</div>
|
</div>
|
||||||
</li>';
|
</li>';
|
||||||
|
|
||||||
/*
|
|
||||||
$GALLERY_TEMPLATE['CAT_ITEM'] =
|
$GALLERY_TEMPLATE['cat_end'] =
|
||||||
"<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'] =
|
|
||||||
"</ul>
|
"</ul>
|
||||||
";
|
";
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
// {GALLERY_SLIDESHOW=X} X = Gallery Category. Default: 1 (ie. 'gallery_1') Overrides preference in admin.
|
// {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.
|
||||||
// {GALLERY_JUMPER=space} will remove numbers and just leave spaces.
|
// {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-wrapper">
|
||||||
<div id="gallery-slideshow-content">
|
<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