1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-06 06:38:00 +02:00

Moved harcoded texts to LAN files. Use "Images per page" pref instead of hardcoded amount.

This commit is contained in:
Lóna Lore
2016-03-29 14:17:29 +02:00
parent c54cc47832
commit 111454bb87
10 changed files with 663 additions and 409 deletions

View File

@@ -14,18 +14,21 @@
* $Author: e107coders $ * $Author: e107coders $
*/ */
// TODO: lan
// TODO: prefs for prettyPhoto library, e.g. theme settings // TODO: prefs for prettyPhoto library, e.g. theme settings
$eplug_admin = true; $eplug_admin = true;
require_once("../../class2.php"); require_once("../../class2.php");
if(!getperms("P") || !e107::isInstalled('gallery')) if(!getperms("P") || !e107::isInstalled('gallery'))
{ {
e107::redirect('admin'); e107::redirect('admin');
exit(); exit();
} }
// [PLUGINS]/gallery/languages/[LANGUAGE]/[LANGUAGE]_admin.php
e107::lan('gallery', true, true);
$e_sub_cat = 'gallery'; $e_sub_cat = 'gallery';
@@ -55,40 +58,20 @@ class plugin_gallery_admin extends e_admin_dispatcher
) )
); );
/* Both are optional
protected $defaultMode = null;
protected $defaultAction = null;
*/
/** /**
* Format: 'MODE/ACTION' => array('caption' => 'Menu link title'[, 'url' => '{e_PLUGIN}release/admin_config.php', 'perm' => '0']); * Format: 'MODE/ACTION' => array('caption' => 'Menu link title'[, 'url' => '{e_PLUGIN}release/admin_config.php', 'perm' => '0']);
* Additionally, any valid e107::getNav()->admin() key-value pair could be added to the above array * Additionally, any valid e107::getNav()->admin() key-value pair could be added to the above array
* @var array * @var array
*/ */
protected $adminMenu = array( 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/prefs' => array('caption' => LAN_PREFS, 'perm' => 'P') 'main/prefs' => array('caption' => LAN_PREFS, 'perm' => 'P')
); );
/**
* Optional, mode/action aliases, related with 'selected' menu CSS class
* Format: 'MODE/ACTION' => 'MODE ALIAS/ACTION ALIAS';
* This will mark active main/list menu item, when current page is main/edit
* @var array
*/
protected $adminMenuAliases = array(
/// 'main/edit' => 'main/list',
// 'cat/edit' => 'cat/list'
);
/** /**
* Navigation menu title * Navigation menu title
* @var string * @var string
*/ */
protected $menuTitle = 'Gallery'; protected $menuTitle = LAN_PLUGIN_GALLERY_TITLE;
function init() function init()
{ {
@@ -103,30 +86,106 @@ class plugin_gallery_admin extends e_admin_dispatcher
class gallery_cat_admin_ui extends e_admin_ui class gallery_cat_admin_ui extends e_admin_ui
{ {
protected $pluginTitle = 'Gallery Categories'; protected $pluginTitle = LAN_PLUGIN_GALLERY_TITLE;
protected $pluginName = 'gallery'; protected $pluginName = 'gallery';
protected $table = "core_media_cat"; protected $table = "core_media_cat";
protected $pid = "media_cat_id"; protected $pid = "media_cat_id";
protected $perPage = 10; //no limit protected $perPage = 10; // No limit.
protected $listOrder = 'media_cat_order'; protected $listOrder = 'media_cat_order';
protected $listQry = "SELECT * FROM `#core_media_cat` WHERE media_cat_owner = 'gallery' "; // without any Order or Limit. protected $listQry = "SELECT * FROM `#core_media_cat` WHERE media_cat_owner = 'gallery' "; // Without any Order or Limit.
// protected $listQry = "SELECT * FROM #core_media "; // without any Order or Limit.
// protected $editQry = "SELECT * FROM #faq_info WHERE faq_info_id = {ID}";
protected $fields = array( protected $fields = array(
'checkboxes' => array('title' => '', 'type' => null, 'width' => '5%', 'forced' => true, 'thclass' => 'center', 'class' => 'center'), 'checkboxes' => array(
// 'media_cat_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE, 'readonly'=>TRUE), 'title' => '',
'media_cat_image' => array('title' => LAN_IMAGE, 'type' => 'image', 'data' => 'str', 'width' => '100px', 'thclass' => 'center', 'class' => 'center', 'readParms' => 'thumb=60&thumb_urlraw=0&thumb_aw=60', 'readonly' => false, 'batch' => false, 'filter' => false), 'type' => null,
'media_cat_owner' => array('title' => "Owner", 'type' => 'hidden', 'nolist' => true, 'width' => 'auto', 'thclass' => 'left', 'readonly' => false, 'writeParms' => 'value=gallery'), 'width' => '5%',
'media_cat_category' => array('title' => LAN_CATEGORY, 'type' => 'hidden', 'nolist' => true, 'width' => 'auto', 'thclass' => 'left', 'readonly' => true), 'forced' => true,
'media_cat_title' => array('title' => LAN_TITLE, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left', 'readonly' => false), 'thclass' => 'center',
'media_cat_sef' => array('title' => LAN_SEFURL, 'type' => 'text', 'inline' => true, 'width' => 'auto', 'thclass' => 'left'), 'class' => 'center',
'media_cat_diz' => array('title' => LAN_DESCRIPTION, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=150&bb=1', 'readonly' => false), // Display name ),
'media_cat_class' => array('title' => LAN_VISIBILITY, 'type' => 'userclass', 'width' => 'auto', 'data' => 'int', 'filter' => true, 'batch' => true), /*
'media_cat_order' => array('title' => LAN_ORDER, 'type' => 'text', 'width' => 'auto', 'thclass' => 'center', 'class' => 'center'), 'media_cat_id' => array(
'options' => array('title' => LAN_OPTIONS, 'type' => null, 'width' => '5%', 'forced' => true, 'thclass' => 'center last', 'class' => 'right') 'title' => LAN_ID,
'type' => 'number',
'width' => '5%',
'forced' => true,
'readonly' => true,
),
*/
'media_cat_image' => array(
'title' => LAN_IMAGE,
'type' => 'image',
'data' => 'str',
'width' => '100px',
'thclass' => 'center',
'class' => 'center',
'readParms' => 'thumb=60&thumb_urlraw=0&thumb_aw=60',
'readonly' => false,
'batch' => false,
'filter' => false,
),
'media_cat_owner' => array(
'title' => LAN_OWNER,
'type' => 'hidden',
'nolist' => true,
'width' => 'auto',
'thclass' => 'left',
'readonly' => false,
'writeParms' => 'value=gallery',
),
'media_cat_category' => array(
'title' => LAN_CATEGORY,
'type' => 'hidden',
'nolist' => true,
'width' => 'auto',
'thclass' => 'left',
'readonly' => true,
),
'media_cat_title' => array(
'title' => LAN_TITLE,
'type' => 'text',
'width' => 'auto',
'thclass' => 'left',
'readonly' => false,
),
'media_cat_sef' => array(
'title' => LAN_SEFURL,
'type' => 'text',
'inline' => true,
'width' => 'auto',
'thclass' => 'left',
),
'media_cat_diz' => array(
'title' => LAN_DESCRIPTION,
'type' => 'bbarea',
'width' => '30%',
'readParms' => 'expand=...&truncate=150&bb=1',
'readonly' => false,
),
'media_cat_class' => array(
'title' => LAN_VISIBILITY,
'type' => 'userclass',
'width' => 'auto',
'data' => 'int',
'filter' => true,
'batch' => true,
),
'media_cat_order' => array(
'title' => LAN_ORDER,
'type' => 'text',
'width' => 'auto',
'thclass' => 'center',
'class' => 'center',
),
'options' => array(
'title' => LAN_OPTIONS,
'type' => null,
'width' => '5%',
'forced' => true,
'thclass' => 'center last',
'class' => 'right',
),
); );
@@ -141,45 +200,163 @@ class gallery_cat_admin_ui extends e_admin_ui
function galleryPage() function galleryPage()
{ {
$mes = e107::getMessage(); $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>"; $tp = e107::getParser();
$x = LAN_PLUGIN_GALLERY_TITLE;
$y = "<a href='" . e_ADMIN . "image.php'>" . LAN_MEDIAMANAGER . "</a>";
$message = $tp->lanVars(LAN_GALLERY_ADMIN_01, array($x, $y), true);
$mes->addInfo($message); $mes->addInfo($message);
} }
protected $preftabs = array(LAN_GALLERY_ADMIN_02, LAN_GALLERY_ADMIN_03);
protected $preftabs = array('General', 'Slideshow Menu');
protected $prefs = array( protected $prefs = array(
'popup_w' => array('title' => 'Image Max. Width', 'tab' => 0, 'type' => 'text', 'data' => 'int', 'help' => 'Images will be auto-resized if greater than the width given here'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')), 'popup_w' => array(
'popup_h' => array('title' => 'Image Max. Height', 'tab' => 0, 'type' => 'text', 'data' => 'int', 'help' => 'Images will be auto-resized if greater than the height given here'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')), 'title' => LAN_GALLERY_ADMIN_04,
'tab' => 0,
'downloadable' => array('title' => 'Show "download" link', 'tab' => 0, 'type' => 'boolean', 'data' => 'int', 'help' => 'A download option will be shown next to the popup caption'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')), 'type' => 'text',
'data' => 'int',
'slideshow_category' => array('title' => 'Slideshow category', 'tab' => 1, 'type' => 'dropdown', 'data' => 'str', 'help' => 'Images from this category will be used in the sliding menu.'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')), 'help' => LAN_GALLERY_ADMIN_05,
// 'slideshow_thumb_w' => array('title'=> 'Thumbnail Width', 'type' => 'number', 'data' => 'integer', 'help'=>'Width in px'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')), // 'validate' => 'regex',
// 'slideshow_thumb_h' => array('title'=> 'Thumbnail Height', 'type' => 'number', 'data' => 'integer', 'help'=>'Height in px'), // 'validate' => 'regex', 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')), // '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', 'tab' => 1, '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')), 'popup_h' => array(
'slideshow_auto' => array('title' => 'Slide auto-start', 'type' => 'boolean', 'tab' => 1, 'data' => 'integer', 'help' => 'When enabled image-rotation begins automatically when the page is loaded.'), 'title' => LAN_GALLERY_ADMIN_06,
'slideshow_freq' => array('title' => 'Slide frequency', 'type' => 'number', 'tab' => 1, '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')), 'tab' => 0,
// '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.'), // 'type' => 'text',
'slideshow_effect' => array('title' => 'Slide effect', 'type' => 'dropdown', 'tab' => 1, 'data' => 'str', 'help' => 'Type of effect. '), // 'data' => 'int',
// 'slideshow_transition' => array('title'=> 'Slide transition', 'type' => 'dropdown', 'data' => 'str', 'help'=>'Type of transition. ') // 'help' => LAN_GALLERY_ADMIN_07,
'perpage' => array('title' => 'Images per page', 'tab' => 0, 'type' => 'number', 'data' => 'int', 'help' => 'Number of images to be shown per page'), // 'rule' => '#^[\d]+$#i', 'help' => 'allowed characters are a-zA-Z and underscore')), // 'validate' => 'regex',
// 'rule' => '#^[\d]+$#i',
// 'help' => 'allowed characters are a-zA-Z and underscore',
),
'downloadable' => array(
'title' => LAN_GALLERY_ADMIN_08,
'tab' => 0,
'type' => 'boolean',
'data' => 'int',
'help' => LAN_GALLERY_ADMIN_09,
// 'validate' => 'regex',
// 'rule' => '#^[\d]+$#i',
// 'help' => 'allowed characters are a-zA-Z and underscore',
),
'slideshow_category' => array(
'title' => LAN_GALLERY_ADMIN_10,
'tab' => 1,
'type' => 'dropdown',
'data' => 'str',
'help' => LAN_GALLERY_ADMIN_11,
// 'validate' => 'regex',
// 'rule' => '#^[\d]+$#i',
// 'help' => 'allowed characters are a-zA-Z and underscore',
),
/*
'slideshow_thumb_w' => array(
'title' => 'Thumbnail Width',
'type' => 'number',
'data' => 'integer',
'help' => 'Width in px',
// 'validate' => 'regex',
// 'rule' => '#^[\d]+$#i',
// 'help' => 'allowed characters are a-zA-Z and underscore',
),
*/
/*
'slideshow_thumb_h' => array(
'title' => 'Thumbnail Height',
'type' => 'number',
'data' => 'integer',
'help' => 'Height in px',
// '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' => LAN_GALLERY_ADMIN_12,
'type' => 'number',
'tab' => 1,
'data' => 'integer',
'help' => LAN_GALLERY_ADMIN_13,
// 'validate' => 'regex',
// 'rule' => '#^[\d]+$#i',
// 'help' => 'allowed characters are a-zA-Z and underscore',
),
'slideshow_auto' => array(
'title' => LAN_GALLERY_ADMIN_14,
'type' => 'boolean',
'tab' => 1,
'data' => 'integer',
'help' => LAN_GALLERY_ADMIN_15,
),
'slideshow_freq' => array(
'title' => LAN_GALLERY_ADMIN_16,
'type' => 'number',
'tab' => 1,
'data' => 'integer',
'help' => LAN_GALLERY_ADMIN_17,
// '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' => LAN_GALLERY_ADMIN_18,
'type' => 'dropdown',
'tab' => 1,
'data' => 'str',
'help' => LAN_GALLERY_ADMIN_19
),
/*
'slideshow_transition' => array(
'title' => 'Slide transition',
'type' => 'dropdown',
'data' => 'str',
'help' => 'Type of transition.',
),
*/
'perpage' => array(
'title' => LAN_GALLERY_ADMIN_20,
'tab' => 0,
'type' => 'number',
'data' => 'int',
'help' => LAN_GALLERY_ADMIN_21,
// 'rule' => '#^[\d]+$#i',
// 'help' => 'allowed characters are a-zA-Z and underscore',
),
'orderby' => array( 'orderby' => array(
'title' => 'Order images by', 'title' => LAN_GALLERY_ADMIN_22,
'tab' => 0, 'tab' => 0,
'type' => 'dropdown', 'type' => 'dropdown',
'data' => 'str', 'data' => 'str',
'writeParms' => array( 'writeParms' => array(
'optArray' => array( 'optArray' => array(
'media_id ASC' => 'Media ID ASC', 'media_id ASC' => LAN_GALLERY_ADMIN_23,
'media_id DESC' => 'Media ID DESC', 'media_id DESC' => LAN_GALLERY_ADMIN_24,
'media_name ASC' => 'Media Name ASC', 'media_name ASC' => LAN_GALLERY_ADMIN_25,
'media_name DESC' => 'Media Name DESC', 'media_name DESC' => LAN_GALLERY_ADMIN_26,
'media_caption ASC' => 'Media Caption ASC', 'media_caption ASC' => LAN_GALLERY_ADMIN_27,
'media_caption DESC' => 'Media Caption DESC', 'media_caption DESC' => LAN_GALLERY_ADMIN_28,
), ),
), ),
), ),
@@ -189,20 +366,14 @@ class gallery_cat_admin_ui extends e_admin_ui
function init() function init()
{ {
$effects = array( $effects = array(
'scrollHorz' => 'slide left', 'scrollHorz' => LAN_GALLERY_ADMIN_29,
'scrollVert' => 'slide down', 'scrollVert' => LAN_GALLERY_ADMIN_30,
// 'turnDown' => 'turn Down', 'fade' => LAN_GALLERY_ADMIN_31,
// 'turnUp' => 'turn Up',
// 'curtainX' => 'curtainX',
// 'curtainY' => 'curtainY',
'fade' => 'fade',
// 'zoom' => 'zoom'
); );
$this->prefs['slideshow_effect']['writeParms'] = $effects; $this->prefs['slideshow_effect']['writeParms'] = $effects;
$this->prefs['slideshow_effect']['readParms'] = $effects; $this->prefs['slideshow_effect']['readParms'] = $effects;
//
// $transitions = array('sinoidal'=>'sinoidal','spring'=>'spring'); // $transitions = array('sinoidal'=>'sinoidal','spring'=>'spring');
// $this->prefs['slideshow_transition']['writeParms'] = $transitions; // $this->prefs['slideshow_transition']['writeParms'] = $transitions;
@@ -220,12 +391,15 @@ class gallery_cat_admin_ui extends e_admin_ui
$this->prefs['slideshow_category']['readParms'] = $cats; $this->prefs['slideshow_category']['readParms'] = $cats;
$mes = e107::getMessage(); $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>"; $tp = e107::getParser();
$x = LAN_PLUGIN_GALLERY_TITLE;
$y = "<a href='" . e_ADMIN . "image.php'>" . LAN_MEDIAMANAGER . "</a>";
$message = $tp->lanVars(LAN_GALLERY_ADMIN_01, array($x, $y), true);
$mes->addInfo($message); $mes->addInfo($message);
} }
} }
@@ -233,7 +407,6 @@ class gallery_cat_admin_form_ui extends e_admin_form_ui
{ {
// Override the default Options field. // Override the default Options field.
public function gallery_category_parent($curVal, $mode) public function gallery_category_parent($curVal, $mode)
{ {
// TODO - catlist combo without current cat ID in write mode, parents only for batch/filter // TODO - catlist combo without current cat ID in write mode, parents only for batch/filter

View File

@@ -20,16 +20,15 @@
* @version $Id$ * @version $Id$
* Ultra-simple Image-Gallery * Ultra-simple Image-Gallery
*/ */
/* /*
* THIS SCRIPT IS HIGHLY EXPERIMENTAL. USE AT OWN RISK. * THIS SCRIPT IS HIGHLY EXPERIMENTAL. USE AT OWN RISK.
* *
*/ */
class plugin_gallery_index_controller extends eControllerFront class plugin_gallery_index_controller extends eControllerFront
{ {
/** /**
* Plugin name - used to check if plugin is installed * Plugin name - used to check if plugin is installed
* Set this only if plugin requires installation * Set this only if plugin requires installation
@@ -90,7 +89,7 @@ class plugin_gallery_index_controller extends eControllerFront
{ {
$template = e107::getTemplate('gallery'); $template = e107::getTemplate('gallery');
$template = array_change_key_case($template); $template = array_change_key_case($template);
$sc = e107::getScBatch('gallery',TRUE); $sc = e107::getScBatch('gallery', true);
$text = ""; $text = "";
@@ -99,19 +98,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);
} }
@@ -125,6 +124,8 @@ class plugin_gallery_index_controller extends eControllerFront
public function actionList() public function actionList()
{ {
$plugPrefs = e107::getPlugConfig('gallery')->getPref();
$request = $this->getRequest(); $request = $this->getRequest();
// use only filtered variables // use only filtered variables
@@ -154,7 +155,7 @@ 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); $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. if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootsrap3 to bootstrap2 compat.
{ {
@@ -162,11 +163,10 @@ class plugin_gallery_index_controller extends eControllerFront
} }
$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 = varset($plugPrefs['perpage'], 12);
$sc->curCat = $cid; $sc->curCat = $cid;
$sc->from = $request->getRequestParam('frm', 0); $sc->from = $request->getRequestParam('frm', 0);
$plugPrefs = e107::getPlugConfig('gallery')->getPref();
$orderBy = varset($plugPrefs['orderby'], 'media_id DESC'); $orderBy = varset($plugPrefs['orderby'], 'media_id DESC');
$list = e107::getMedia()->getImages($cid, $sc->from, $sc->amount, null, $orderBy); $list = e107::getMedia()->getImages($cid, $sc->from, $sc->amount, null, $orderBy);
@@ -180,16 +180,16 @@ 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
@@ -199,7 +199,6 @@ class plugin_gallery_index_controller extends eControllerFront
->addBody($text); ->addBody($text);
} }
} }
} }

View File

@@ -6,7 +6,14 @@
* Featurebox shortcode batch class - shortcodes available site-wide. ie. equivalent to multiple .sc files. * Featurebox shortcode batch class - shortcodes available site-wide. ie. equivalent to multiple .sc files.
*/ */
if (!defined('e107_INIT')) { exit; } if(!defined('e107_INIT'))
{
exit;
}
// [PLUGINS]/gallery/languages/[LANGUAGE]/[LANGUAGE]_front.php
e107::lan('gallery', false, true);
class gallery_shortcodes extends e_shortcode class gallery_shortcodes extends e_shortcode
{ {
@@ -16,9 +23,9 @@ class gallery_shortcodes extends e_shortcode
public $from = 0; public $from = 0;
public $curCat = null; public $curCat = null;
public $sliderCat = 1; public $sliderCat = 1;
public $slideMode = FALSE; public $slideMode = false;
public $slideCount = 1; public $slideCount = 1;
private $downloadable = FALSE; private $downloadable = false;
private $attFull = null; private $attFull = null;
function init() function init()
@@ -80,9 +87,9 @@ class gallery_shortcodes extends e_shortcode
$w = vartrue($parms['w']) ? $parms['w'] : $tp->thumbWidth(); // 190; // 160; $w = vartrue($parms['w']) ? $parms['w'] : $tp->thumbWidth(); // 190; // 160;
$h = vartrue($parms['h']) ? $parms['h'] : $tp->thumbHeight(); // 130; $h = vartrue($parms['h']) ? $parms['h'] : $tp->thumbHeight(); // 130;
$class = ($this->slideMode == TRUE) ? 'gallery-slideshow-thumb img-responsive img-rounded' : varset($parms['class'],'gallery-thumb img-responsive'); $class = ($this->slideMode == true) ? 'gallery-slideshow-thumb img-responsive img-rounded' : varset($parms['class'], 'gallery-thumb img-responsive');
// $rel = ($this->slideMode == TRUE) ? 'lightbox.SlideGallery' : 'lightbox.Gallery'; // $rel = ($this->slideMode == TRUE) ? 'lightbox.SlideGallery' : 'lightbox.Gallery';
$rel = ($this->slideMode == TRUE) ? 'prettyPhoto[slide]' : 'prettyPhoto[gal]'; $rel = ($this->slideMode == true) ? 'prettyPhoto[slide]' : 'prettyPhoto[gal]';
//$att = array('aw'=>$w, 'ah'=>$h, 'x'=>1, 'crop'=>1); //$att = array('aw'=>$w, 'ah'=>$h, 'x'=>1, 'crop'=>1);
$caption = $tp->toAttribute($this->var['media_caption']); $caption = $tp->toAttribute($this->var['media_caption']);
@@ -96,12 +103,21 @@ class gallery_shortcodes extends e_shortcode
$srcFull = $tp->replaceConstants($this->var['media_url'], 'full'); $srcFull = $tp->replaceConstants($this->var['media_url'], 'full');
} }
if(isset($parms['thumburl'])) return $srcFull; if(isset($parms['thumburl']))
elseif(isset($parms['thumbsrc'])) return $tp->thumbUrl($this->var['media_url'],$att); {
elseif(isset($parms['imageurl'])) return $tp->replaceConstants($this->var['media_url'], 'full'); return $srcFull;
}
elseif(isset($parms['thumbsrc']))
{
return $tp->thumbUrl($this->var['media_url'], $att);
}
elseif(isset($parms['imageurl']))
{
return $tp->replaceConstants($this->var['media_url'], 'full');
}
$description = ($this->downloadable) ? " <a class='btn btn-xs btn-default btn-mini e-tip' title='Right-click > Save Link As' href='".$srcFull."'>Download</a>" : ""; $description = ($this->downloadable) ? " <a class='btn btn-xs btn-default btn-mini e-tip' title='" . LAN_GALLERY_FRONT_01 . "' href='" . $srcFull . "'>" . LAN_DOWNLOAD . "</a>" : "";
$description .= $tp->toAttribute($this->var['media_description']); $description .= $tp->toAttribute($this->var['media_description']);
$text = "<a class='" . $class . "' title=\"" . $description . "\" href='" . $srcFull . "' data-gal='{$rel}' >"; $text = "<a class='" . $class . "' title=\"" . $description . "\" href='" . $srcFull . "' data-gal='{$rel}' >";
@@ -116,7 +132,10 @@ class gallery_shortcodes extends e_shortcode
{ {
$tp = e107::getParser(); $tp = e107::getParser();
$url = e107::getUrl()->create('gallery/index/list', $this->var); $url = e107::getUrl()->create('gallery/index/list', $this->var);
if($parm == 'title') return $tp->toHtml($this->var['media_cat_title'], false, 'TITLE'); if($parm == 'title')
{
return $tp->toHtml($this->var['media_cat_title'], false, 'TITLE');
}
$text = "<a href='" . $url . "'>"; $text = "<a href='" . $url . "'>";
$text .= $tp->toHtml($this->var['media_cat_title'], false, 'TITLE'); $text .= $tp->toHtml($this->var['media_cat_title'], false, 'TITLE');
$text .= "</a>"; $text .= "</a>";
@@ -149,7 +168,10 @@ class gallery_shortcodes extends e_shortcode
$url = e107::getUrl()->create('gallery/index/list', $this->var); $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 = "<a class='thumbnail' href='" . $url . "'>";
$text .= "<img class='img-responsive' data-src='holder.js/" . $w . "x" . $h . "' src='" . e107::getParser()->thumbUrl($this->var['media_cat_image'], $att) . "' alt='' />"; $text .= "<img class='img-responsive' data-src='holder.js/" . $w . "x" . $h . "' src='" . e107::getParser()->thumbUrl($this->var['media_cat_image'], $att) . "' alt='' />";
@@ -183,9 +205,6 @@ class gallery_shortcodes extends e_shortcode
*/ */
function sc_gallery_portfolio($parms = '') function sc_gallery_portfolio($parms = '')
{ {
$plugPrefs = e107::getPlugConfig('gallery')->getPref();
$orderBy = varset($plugPrefs['orderby'], 'media_id DESC');
$ns = e107::getRender(); $ns = e107::getRender();
$parm = eHelper::scParams($parms); $parm = eHelper::scParams($parms);
$cat = (!empty($parm['category'])) ? $parm['category'] : vartrue(e107::getPlugPref('gallery', 'slideshow_category'), 1); //TODO Separate pref? $cat = (!empty($parm['category'])) ? $parm['category'] : vartrue(e107::getPlugPref('gallery', 'slideshow_category'), 1); //TODO Separate pref?
@@ -193,6 +212,9 @@ class gallery_shortcodes extends e_shortcode
$tmpl = e107::getTemplate('gallery', 'gallery'); $tmpl = e107::getTemplate('gallery', 'gallery');
$limit = vartrue($parm['limit'], 6); $limit = vartrue($parm['limit'], 6);
$plugPrefs = e107::getPlugConfig('gallery')->getPref();
$orderBy = varset($plugPrefs['orderby'], 'media_id DESC');
$list = e107::getMedia()->getImages('gallery_image|gallery_' . $cat . '|gallery_image_' . $cat, 0, $limit, null, $orderBy); $list = e107::getMedia()->getImages('gallery_image|gallery_' . $cat . '|gallery_image_' . $cat, 0, $limit, null, $orderBy);
if(count($list) < 1 && vartrue($parm['placeholder'])) if(count($list) < 1 && vartrue($parm['placeholder']))
@@ -218,7 +240,6 @@ class gallery_shortcodes extends e_shortcode
} }
/** /**
* All possible parameters * All possible parameters
* {GALLERY_SLIDES=4|limit=16&template=MY_SLIDESHOW_SLIDE_ITEM} * {GALLERY_SLIDES=4|limit=16&template=MY_SLIDESHOW_SLIDE_ITEM}
@@ -232,7 +253,7 @@ class gallery_shortcodes extends e_shortcode
$orderBy = varset($plugPrefs['orderby'], 'media_id DESC'); $orderBy = varset($plugPrefs['orderby'], 'media_id DESC');
$tp = e107::getParser(); $tp = e107::getParser();
$this->slideMode = TRUE; $this->slideMode = true;
$parms = eHelper::scDualParams($parm); $parms = eHelper::scDualParams($parm);
$amount = $parms[1] ? intval($parms[1]) : 3; // vartrue(e107::getPlugPref('gallery','slideshow_perslide'),3); $amount = $parms[1] ? intval($parms[1]) : 3; // vartrue(e107::getPlugPref('gallery','slideshow_perslide'),3);
$parms = $parms[2]; $parms = $parms[2];
@@ -253,7 +274,7 @@ class gallery_shortcodes extends e_shortcode
->addVars($cat); ->addVars($cat);
$inner .= ($count == 1) ? "\n\n<!-- SLIDE " . $count . " -->\n<div class='slide' id='gallery-item-" . $this->slideCount . "'>\n" : ""; $inner .= ($count == 1) ? "\n\n<!-- SLIDE " . $count . " -->\n<div class='slide' id='gallery-item-" . $this->slideCount . "'>\n" : "";
$inner .= "\n\t".$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)
@@ -272,11 +293,13 @@ class gallery_shortcodes extends e_shortcode
} }
function sc_gallery_jumper($parm) function sc_gallery_jumper($parm)
{ {
// echo "SlideCount=".$this->slideCount; // echo "SlideCount=".$this->slideCount;
if($this->slideCount ==1 && deftrue('E107_DBG_BASIC')){ return "gallery-jumper must be loaded after Gallery-Slides"; } if($this->slideCount == 1 && deftrue('E107_DBG_BASIC'))
{
return "gallery-jumper must be loaded after Gallery-Slides";
}
$text = ''; $text = '';
for($i = 1; $i < ($this->slideCount); $i++) for($i = 1; $i < ($this->slideCount); $i++)
@@ -289,4 +312,3 @@ class gallery_shortcodes extends e_shortcode
} }
} }
?>

View File

@@ -29,6 +29,9 @@ if (!e107::isInstalled('gallery'))
exit; exit;
} }
// [PLUGINS]/gallery/languages/[LANGUAGE]/[LANGUAGE]_front.php
e107::lan('gallery', false, true);
e107::library('load', 'jquery.prettyPhoto'); e107::library('load', 'jquery.prettyPhoto');
e107::css('gallery', 'css/gallery.css'); e107::css('gallery', 'css/gallery.css');
e107::js('gallery', 'js/gallery.js'); e107::js('gallery', 'js/gallery.js');
@@ -38,6 +41,7 @@ require_once(HEADERF);
class gallery class gallery
{ {
private $catList = array(); private $catList = array();
function __construct() function __construct()
@@ -58,7 +62,7 @@ class gallery
{ {
$template = e107::getTemplate('gallery'); $template = e107::getTemplate('gallery');
$template = array_change_key_case($template); $template = array_change_key_case($template);
$sc = e107::getScBatch('gallery',TRUE); $sc = e107::getScBatch('gallery', true);
$text = ""; $text = "";
@@ -68,15 +72,15 @@ class gallery
} }
$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);
} }
@@ -84,11 +88,12 @@ class gallery
function showImages($cat) function showImages($cat)
{ {
$plugPrefs = e107::getPlugConfig('gallery')->getPref();
$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); $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. if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootsrap3 to bootstrap2 compat.
{ {
@@ -96,11 +101,9 @@ class gallery
} }
$sc->total = e107::getMedia()->countImages($cat); $sc->total = e107::getMedia()->countImages($cat);
$sc->amount = 12; // TODO Add Pref. amount per page. $sc->amount = varset($plugPrefs['perpage'], 12);
$sc->curCat = $cat; $sc->curCat = $cat;
$sc->from = ($_GET['frm']) ? intval($_GET['frm']) : 0; $sc->from = ($_GET['frm']) ? intval($_GET['frm']) : 0;
$plugPrefs = e107::getPlugConfig('gallery')->getPref();
$orderBy = varset($plugPrefs['orderby'], 'media_id DESC'); $orderBy = varset($plugPrefs['orderby'], 'media_id DESC');
$list = e107::getMedia()->getImages($cat, $sc->from, $sc->amount, null, $orderBy); $list = e107::getMedia()->getImages($cat, $sc->from, $sc->amount, null, $orderBy);
@@ -111,12 +114,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);
@@ -129,6 +132,3 @@ new gallery;
require_once(FOOTERF); require_once(FOOTERF);
exit; exit;
?>

View File

@@ -0,0 +1,38 @@
<?php
/**
* @file
* Language file for "gallery" plugin.
*/
define("LAN_GALLERY_ADMIN_01", "[x] is active. Simply import and assign images to the gallery categories using the [y]");
define("LAN_GALLERY_ADMIN_02", "General");
define("LAN_GALLERY_ADMIN_03", "Slideshow Menu");
define("LAN_GALLERY_ADMIN_04", "Image Max. Width");
define("LAN_GALLERY_ADMIN_05", "Images will be auto-resized if greater than the width given here");
define("LAN_GALLERY_ADMIN_06", "Image Max. Height");
define("LAN_GALLERY_ADMIN_07", "Images will be auto-resized if greater than the height given here");
define("LAN_GALLERY_ADMIN_08", "Show \"download\" link");
define("LAN_GALLERY_ADMIN_09", "A download option will be shown next to the popup caption");
define("LAN_GALLERY_ADMIN_10", "Slideshow category");
define("LAN_GALLERY_ADMIN_11", "Images from this category will be used in the sliding menu.");
define("LAN_GALLERY_ADMIN_12", "Slide duration");
define("LAN_GALLERY_ADMIN_13", "The duration (in seconds) of a full jump.");
define("LAN_GALLERY_ADMIN_14", "Slide auto-start");
define("LAN_GALLERY_ADMIN_15", "When enabled image-rotation begins automatically when the page is loaded.");
define("LAN_GALLERY_ADMIN_16", "Slide frequency");
define("LAN_GALLERY_ADMIN_17", "When auto-start is enabled, this dictates how long a slides stays put before the next jump.");
define("LAN_GALLERY_ADMIN_18", "Slide effect");
define("LAN_GALLERY_ADMIN_19", "Type of effect.");
define("LAN_GALLERY_ADMIN_20", "Images per page");
define("LAN_GALLERY_ADMIN_21", "Number of images to be shown per page");
define("LAN_GALLERY_ADMIN_22", "Order images by");
define("LAN_GALLERY_ADMIN_23", "Media ID ASC");
define("LAN_GALLERY_ADMIN_24", "Media ID DESC");
define("LAN_GALLERY_ADMIN_25", "Media Name ASC");
define("LAN_GALLERY_ADMIN_26", "Media Name DESC");
define("LAN_GALLERY_ADMIN_27", "Media Caption ASC");
define("LAN_GALLERY_ADMIN_28", "Media Caption DESC");
define("LAN_GALLERY_ADMIN_29", "slide left");
define("LAN_GALLERY_ADMIN_30", "slide down");
define("LAN_GALLERY_ADMIN_31", "fade");

View File

@@ -0,0 +1,8 @@
<?php
/**
* @file
* Language file for "gallery" plugin.
*/
define("LAN_GALLERY_FRONT_01", "Right-click > Save Link As");

View File

@@ -1,10 +1,14 @@
<?php <?php
/*
* Copyright (c) e107 Inc 2008-2012 - e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt) /**
* $Id$ * @file
* * Language file for "gallery" plugin.
* Gallery Global Language
*/ */
define("LAN_PLUGIN_GALLERY_TITLE", "Gallery"); define("LAN_PLUGIN_GALLERY_TITLE", "Gallery");
define("LAN_PLUGIN_GALLERY_DIZ", "A simple image gallery"); define("LAN_PLUGIN_GALLERY_DIZ", "A simple image gallery");
define("LAN_PLUGIN_GALLERY_SEF_01", "Gallery SEF");
define("LAN_PLUGIN_GALLERY_SEF_02", "SEF URLs enabled.");
define("LAN_PLUGIN_GALLERY_SEF_03", "SEF URLs disabled.");
define("LAN_PLUGIN_GALLERY_SEF_04", "Gallery default");

View File

@@ -31,6 +31,6 @@ $settings = array(
e107::js('settings', array('gallery' => $settings)); e107::js('settings', array('gallery' => $settings));
$text = e107::getParser()->parseTemplate("{GALLERY_SLIDESHOW}"); $text = e107::getParser()->parseTemplate("{GALLERY_SLIDESHOW}");
e107::getRender()->tablerender("Gallery", $text, 'gallery_slideshow'); e107::getRender()->tablerender(LAN_PLUGIN_GALLERY_TITLE, $text, 'gallery_slideshow');
unset($text); unset($text);
unset($gp); unset($gp);

View File

@@ -1,12 +1,17 @@
<?php <?php
/* /*
* Copyright (C) e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt) * Copyright (C) e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id$ * $Id$
* *
* System routing config * System routing config
*/ */
class plugin_gallery_rewrite_url extends eUrlConfig class plugin_gallery_rewrite_url extends eUrlConfig
{ {
public function config() public function config()
{ {
return array( return array(
@@ -41,9 +46,9 @@ class plugin_gallery_rewrite_url extends eUrlConfig
// static may be used for performance - XXX LANS // static may be used for performance - XXX LANS
static $admin = array( static $admin = array(
'labels' => array( 'labels' => array(
'name' => 'Gallery', // Module name 'name' => LAN_PLUGIN_GALLERY_TITLE, // Module name
'label' => 'Gallery SEF', // Current profile name 'label' => LAN_PLUGIN_GALLERY_SEF_01, // Current profile name
'description' => 'SEF URLs enabled.', 'description' => LAN_PLUGIN_GALLERY_SEF_02,
'examples' => array('{SITEURL}gallery/my-gallery-title'), // 'examples' => array('{SITEURL}gallery/my-gallery-title'), //
), ),
'form' => array(), // Under construction - additional configuration options 'form' => array(), // Under construction - additional configuration options

View File

@@ -1,12 +1,17 @@
<?php <?php
/* /*
* Copyright (C) e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt) * Copyright (C) e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id$ * $Id$
* *
* System routing config * System routing config
*/ */
class plugin_gallery_url extends eUrlConfig class plugin_gallery_url extends eUrlConfig
{ {
public function config() public function config()
{ {
return array( return array(
@@ -37,9 +42,9 @@ class plugin_gallery_url extends eUrlConfig
// static may be used for performance - XXX LANS // static may be used for performance - XXX LANS
static $admin = array( static $admin = array(
'labels' => array( 'labels' => array(
'name' => 'Gallery', // Module name 'name' => LAN_PLUGIN_GALLERY_TITLE, // Module name
'label' => 'Gallery default', // Current profile name 'label' => LAN_PLUGIN_GALLERY_SEF_04, // Current profile name
'description' => 'SEF URLs disabled.', // 'description' => LAN_PLUGIN_GALLERY_SEF_03,
'examples' => array("{e_PLUGIN_ABS}gallery/?cat=gallery_1") 'examples' => array("{e_PLUGIN_ABS}gallery/?cat=gallery_1")
), ),
'form' => array(), // Under construction - additional configuration options 'form' => array(), // Under construction - additional configuration options