1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-29 10:50:25 +02:00

Update gallery template format.

This commit is contained in:
Cameron
2017-01-01 15:19:21 -08:00
parent 43879208a0
commit 85895b825b
4 changed files with 98 additions and 31 deletions

View File

@@ -83,9 +83,39 @@ class plugin_gallery_index_controller extends eControllerFront
} }
} }
public function actionCategory()
private function getTemplate()
{ {
$template = e107::getTemplate('gallery'); $template = e107::getTemplate('gallery');
$oldKeys = array(
'list_start', 'list_item', 'list_caption', 'list_end',
'cat_start', 'cat_item', 'cat_caption', 'cat_end'
);
if(isset($template['list_start']))
{
foreach($oldKeys as $k)
{
list($main,$sub) = explode("_",$k);
$template[$main][$sub] = $template[$k];
unset($template[$k]);
}
}
return $template;
}
public function actionCategory()
{
// print_a("Hi there");
$template = $this->getTemplate();
$template = array_change_key_case($template); $template = array_change_key_case($template);
$sc = e107::getScBatch('gallery', true); $sc = e107::getScBatch('gallery', true);
@@ -96,19 +126,19 @@ class plugin_gallery_index_controller extends eControllerFront
$template['cat_start'] = str_replace('row', 'row-fluid', $template['cat_start']); $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); $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'])) if(isset($template['cat_caption']))
{ {
$title = e107::getParser()->parseTemplate($template['cat_caption'], true, $sc); $title = e107::getParser()->parseTemplate($template['cat']['caption'], true, $sc);
$this->addTitle($title)->addBody($text); $this->addTitle($title)->addBody($text);
} }
@@ -151,7 +181,7 @@ class plugin_gallery_index_controller extends eControllerFront
} }
$tp = e107::getParser(); $tp = e107::getParser();
$template = e107::getTemplate('gallery'); $template = $this->getTemplate();
$template = array_change_key_case($template); $template = array_change_key_case($template);
$sc = e107::getScBatch('gallery', true); $sc = e107::getScBatch('gallery', true);
@@ -178,22 +208,22 @@ 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'])) if(isset($template['list_caption']))
{ {
$title = $tp->parseTemplate($template['list_caption'], true, $sc); $title = $tp->parseTemplate($template['list']['caption'], true, $sc);
$this->addTitle($title)->addBody($text); $this->addTitle($title)->addBody($text);
} }
else else
{ {
$this->addTitle($catname) $this->addTitle(LAN_PLUGIN_GALLERY_TITLE)
->addTitle(LAN_PLUGIN_GALLERY_TITLE) ->addTitle($catname)
->addBody($text); ->addBody($text);
} }

View File

@@ -54,9 +54,41 @@ class gallery
} }
} }
function listCategories()
/**
* Convert legacy template from ['list_start'] etc. to ['list']['start']
* @return array|string
*/
private function getTemplate()
{ {
$template = e107::getTemplate('gallery'); $template = e107::getTemplate('gallery');
$oldKeys = array(
'list_start', 'list_item', 'list_caption', 'list_end',
'cat_start', 'cat_item', 'cat_caption', 'cat_end'
);
if(isset($template['list_start']))
{
foreach($oldKeys as $k)
{
list($main,$sub) = explode("_",$k);
$template[$main][$sub] = $template[$k];
unset($template[$k]);
}
}
return $template;
}
function listCategories()
{
$template = $this->getTemplate();
$template = array_change_key_case($template); $template = array_change_key_case($template);
$sc = e107::getScBatch('gallery', true); $sc = e107::getScBatch('gallery', true);
@@ -65,17 +97,17 @@ class gallery
$template['cat_start'] = str_replace('row', 'row-fluid', $template['cat_start']); $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);
$caption = e107::getParser()->parseTemplate($template['cat_caption'], true, $sc); $caption = e107::getParser()->parseTemplate($template['cat']['caption'], true, $sc);
e107::getRender()->tablerender($caption, $text); e107::getRender()->tablerender($caption, $text);
} }
@@ -86,7 +118,7 @@ class gallery
$plugPrefs = e107::getPlugConfig('gallery')->getPref(); $plugPrefs = e107::getPlugConfig('gallery')->getPref();
$mes = e107::getMessage(); $mes = e107::getMessage();
$tp = e107::getParser(); $tp = e107::getParser();
$template = e107::getTemplate('gallery'); $template = $this->getTemplate();
$template = array_change_key_case($template); $template = array_change_key_case($template);
$sc = e107::getScBatch('gallery', true); $sc = e107::getScBatch('gallery', true);
@@ -109,14 +141,14 @@ 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);
$caption = $tp->parseTemplate($template['list_caption'], true, $sc); $caption = $tp->parseTemplate($template['list']['caption'], true, $sc);
e107::getRender()->tablerender($caption, $mes->render() . $text); e107::getRender()->tablerender($caption, $mes->render() . $text);

View File

@@ -8,13 +8,13 @@
*/ */
$GALLERY_TEMPLATE['list_caption'] = LAN_PLUGIN_GALLERY_TITLE; $GALLERY_TEMPLATE['list']['caption'] = LAN_PLUGIN_GALLERY_TITLE;
$GALLERY_TEMPLATE['list_start'] = '{GALLERY_BREADCRUMB} $GALLERY_TEMPLATE['list']['start'] = '{GALLERY_BREADCRUMB}
<div class="row gallery"> <div class="row gallery">
'; ';
$GALLERY_TEMPLATE['list_item'] = ' $GALLERY_TEMPLATE['list']['item'] = '
<div class="span2 col-xs-6 col-md-3"> <div class="span2 col-xs-6 col-md-3">
<div class="thumbnail"> <div class="thumbnail">
{GALLERY_THUMB=w=300&h=200} {GALLERY_THUMB=w=300&h=200}
@@ -23,7 +23,7 @@ $GALLERY_TEMPLATE['list_item'] = '
</div> </div>
'; ';
$GALLERY_TEMPLATE['list_end'] = ' $GALLERY_TEMPLATE['list']['end'] = '
</div> </div>
<div class="center"> <div class="center">
<div class="gallery-list-nextprev">{GALLERY_NEXTPREV}</div> <div class="gallery-list-nextprev">{GALLERY_NEXTPREV}</div>
@@ -34,13 +34,13 @@ $GALLERY_TEMPLATE['list_end'] = '
'; ';
// Bootstrap3 Compatible. // Bootstrap3 Compatible.
$GALLERY_TEMPLATE['cat_caption'] = LAN_PLUGIN_GALLERY_TITLE; $GALLERY_TEMPLATE['cat']['caption'] = LAN_PLUGIN_GALLERY_TITLE;
$GALLERY_TEMPLATE['cat_start'] = '{GALLERY_BREADCRUMB} $GALLERY_TEMPLATE['cat']['start'] = '{GALLERY_BREADCRUMB}
<div class="row gallery-cat"> <div class="row gallery-cat">
'; ';
$GALLERY_TEMPLATE['cat_item'] = ' $GALLERY_TEMPLATE['cat']['item'] = '
<div class="span3 col-xs-6 col-md-3"> <div class="span3 col-xs-6 col-md-3">
<div> <div>
{GALLERY_CAT_THUMB} {GALLERY_CAT_THUMB}
@@ -49,7 +49,7 @@ $GALLERY_TEMPLATE['cat_item'] = '
</div> </div>
'; ';
$GALLERY_TEMPLATE['cat_end'] = ' $GALLERY_TEMPLATE['cat']['end'] = '
</div> </div>
'; ';
@@ -180,6 +180,11 @@ $GALLERY_TEMPLATE['prettyphoto']['social_item'] = '
</div> </div>
'; ';
/* /*
$GALLERY_TEMPLATE['portfolio']['start'] = '<-- start portfolio -->'; $GALLERY_TEMPLATE['portfolio']['start'] = '<-- start portfolio -->';

View File

@@ -184,7 +184,7 @@ div.bbcode { margin: 15px 0px; clear: both; } /* layout control via bbcodes */
padding: 10px 0; padding: 10px 0;
} }
.e-instant-edit { position: absolute; right: 10px; text-align: right; display: inline-block; z-index:1000; margin-right:10px; } .e-instant-edit { font-size: 10pt; position: absolute; right: 10px; text-align: right; display: inline-block; z-index:1000; margin-right:10px; }