diff --git a/e107_handlers/media_class.php b/e107_handlers/media_class.php index 8987fbf13..9d6752a68 100644 --- a/e107_handlers/media_class.php +++ b/e107_handlers/media_class.php @@ -437,7 +437,7 @@ class e_media * @param $search * @return array */ - public function getImages($cat='', $from=0, $amount=null,$search=null) + public function getImages($cat='', $from=0, $amount=null, $search=null, $orderby=null) { $inc = array(); $searchinc = array(); @@ -490,8 +490,15 @@ class e_media { $query .= " AND ( ".implode(" OR ",$searchinc)." ) " ; } - - $query .= " ORDER BY media_id DESC"; + + if($orderby) + { + $query .= " ORDER BY " . $orderby; + } + else + { + $query .= " ORDER BY media_id DESC"; + } if($amount == 'all') { diff --git a/e107_languages/English/English.php b/e107_languages/English/English.php index c435a05cb..05ff48cd0 100644 --- a/e107_languages/English/English.php +++ b/e107_languages/English/English.php @@ -116,6 +116,8 @@ define("LAN_EMAIL","Email address"); define("LAN_WROTE", "wrote"); // as in John wrote.." "; define("LAN_RE_ORDER", "Re-order"); define("LAN_RELATED", "Related"); +define("LAN_CLOSE", "Close"); +define("LAN_EXPAND", "Expand"); define("LAN_ENTER_USRNAME_EMAIL", "Please enter your username or email"); // admin php hover field admin name define("LAN_PWD_REQUIRED", "Password is required"); // admin php hover field admin password diff --git a/e107_plugins/gallery/admin_gallery.php b/e107_plugins/gallery/admin_gallery.php index 79b37d1b6..ac533c22d 100644 --- a/e107_plugins/gallery/admin_gallery.php +++ b/e107_plugins/gallery/admin_gallery.php @@ -1,270 +1,657 @@ array('controller' =>'CONTROLLER_CLASS'[, 'index' => 'list', 'path' => 'CONTROLLER SCRIPT PATH', 'ui' => 'UI CLASS NAME child of e_admin_ui', 'uipath' => 'UI SCRIPT PATH']); - * Note - default mode/action is autodetected in this order: - * - $defaultMode/$defaultAction (owned by dispatcher - see below) - * - $adminMenu (first key if admin menu array is not empty) - * - $modes (first key == mode, corresponding 'index' key == action) + * Required (set by child class). + * + * Controller map array in format. + * @code + * 'MODE' => array( + * 'controller' =>'CONTROLLER_CLASS_NAME', + * 'path' => 'CONTROLLER SCRIPT PATH', + * 'ui' => 'UI_CLASS', // extend of 'comments_admin_form_ui' + * 'uipath' => 'path/to/ui/', + * ); + * @endcode + * * @var array */ - protected $modes = array ( - 'main' => array ( - 'controller' => 'gallery_cat_admin_ui', - 'path' => null, - 'ui' => 'gallery_cat_admin_form_ui', - 'uipath' => null + protected $modes = array( + 'main' => array( + 'controller' => 'gallery_cat_admin_ui', + 'path' => null, + 'ui' => 'gallery_cat_admin_form_ui', + 'uipath' => null ), - 'cat' => array ( - 'controller' => 'gallery_cat_ui', - 'path' => null, - 'ui' => 'gallery_cat_form_ui', - 'uipath' => null - ) + 'cat' => array( + 'controller' => 'gallery_cat_ui', + 'path' => null, + 'ui' => 'gallery_cat_form_ui', + 'uipath' => null + ) ); - /* 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']); - * Additionally, any valid e107::getNav()->admin() key-value pair could be added to the above array + * Optional (set by child class). + * + * Required for admin menu render. Format: + * @code + * 'mode/action' => array( + * 'caption' => 'Link title', + * 'perm' => '0', + * 'url' => '{e_PLUGIN}plugname/admin_config.php', + * ... + * ); + * @endcode + * + * Note that 'perm' and 'userclass' restrictions are inherited from the $modes, $access and $perm, so you don't + * have to set that vars if you don't need any additional 'visual' control. + * + * All valid key-value pair (see e107::getNav()->admin function) are accepted. + * * @var 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') - ); - - - /** - * 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' + 'main/prefs' => array('caption' => LAN_PREFS, 'perm' => 'P') ); /** - * Navigation menu title + * Optional (set by child class). + * * @var string */ - protected $menuTitle = 'Gallery'; - + protected $menuTitle = LAN_PLUGIN_GALLERY_TITLE; + + /** + * Initial function. + */ function init() { if(E107_DEBUG_LEVEL > 0) { - $this->adminMenu['main/list'] = array('caption'=> LAN_CATEGORY, 'perm' => 'P'); - } + $this->adminMenu['main/list'] = array( + 'caption' => LAN_CATEGORY, + 'perm' => 'P', + ); + } } + } +/** + * Class gallery_cat_admin_ui. + */ class gallery_cat_admin_ui extends e_admin_ui -{ - protected $pluginTitle = 'Gallery Categories'; - protected $pluginName = 'gallery'; - protected $table = "core_media_cat"; - protected $pid = "media_cat_id"; - protected $perPage = 10; //no limit - 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 "; // without any Order or Limit. - // protected $editQry = "SELECT * FROM #faq_info WHERE faq_info_id = {ID}"; - - protected $fields = array( - 'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'), - // 'media_cat_id' => array('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'=> "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), // 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' ), - 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '5%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'right') - ); - - + /** + * Could be LAN constant (multi-language support). + * + * @var string plugin name + */ + protected $pluginTitle = LAN_PLUGIN_GALLERY_TITLE; - public function beforeCreate($new_data) - { + /** + * Plugin name. + * + * @var string + */ + protected $pluginName = 'gallery'; - $replace = array("_"," ","'",'"',"."); //FIXME Improve - $new_data['media_cat_category'] = strtolower(str_replace($replace,"",$new_data['media_cat_title'])); - return $new_data; - } - - function galleryPage() - { - $mes = e107::getMessage(); - $message = "Gallery is active. Simply import and assign images to the gallery categories using the Media Manager"; - - $mes->addInfo($message); - } - - - protected $preftabs = array('General', 'Slideshow Menu'); - - 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_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')), - - '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')), - - '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')), - // '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'=> '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')), - '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.'), - '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')), - // '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', 'tab'=>1,'data' => 'str', 'help'=>'Type of effect. '), // - // 'slideshow_transition' => array('title'=> 'Slide transition', 'type' => 'dropdown', 'data' => 'str', 'help'=>'Type of transition. ') // - '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')), + /** + * Plugin table. + * + * @var string + */ + protected $table = "core_media_cat"; + + /** + * Primary key in plugin table. + * + * @var string + */ + protected $pid = "media_cat_id"; + + /** + * Default (db) limit value. + * + * @var integer + */ + protected $perPage = 10; + + /** + * SQL order, false to disable order, null is default order. + * + * @var string + */ + protected $listOrder = 'media_cat_order'; + + /** + * SQL query for listing. Without any Order or Limit. + * + * @var string + */ + protected $listQry = "SELECT * FROM `#core_media_cat` WHERE media_cat_owner = 'gallery' "; + + /** + * UI field data. + * + * @var array + */ + protected $fields = array( + 'checkboxes' => array( + 'title' => '', + 'type' => null, + 'width' => '5%', + 'forced' => true, + 'thclass' => 'center', + 'class' => 'center', + ), + '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', + ), ); - - + /** + * Referenced from $prefs property per field - 'tab => xxx' where xxx is the tab key (identifier). + * + * Example: + * @code + * array( + * '0' => 'Tab label', + * '1' => 'Another label', + * ); + * @endcode + * + * @var array + * Edit/create form tabs. + */ + protected $preftabs = array( + LAN_GALLERY_ADMIN_02, + LAN_GALLERY_ADMIN_03, + LAN_GALLERY_ADMIN_32, + ); + + /** + * Plugin Preference description array. + * + * @var array + */ + protected $prefs = array( + 'popup_w' => array( + 'title' => LAN_GALLERY_ADMIN_04, + 'tab' => 0, + 'type' => 'text', + 'data' => 'int', + 'help' => LAN_GALLERY_ADMIN_05, + ), + 'popup_h' => array( + 'title' => LAN_GALLERY_ADMIN_06, + 'tab' => 0, + 'type' => 'text', + 'data' => 'int', + 'help' => LAN_GALLERY_ADMIN_07, + ), + 'downloadable' => array( + 'title' => LAN_GALLERY_ADMIN_08, + 'tab' => 0, + 'type' => 'boolean', + 'data' => 'int', + 'help' => LAN_GALLERY_ADMIN_09, + ), + 'slideshow_category' => array( + 'title' => LAN_GALLERY_ADMIN_10, + 'tab' => 1, + 'type' => 'dropdown', + 'data' => 'str', + 'help' => LAN_GALLERY_ADMIN_11, + ), + 'slideshow_duration' => array( + 'title' => LAN_GALLERY_ADMIN_12, + 'type' => 'number', + 'tab' => 1, + 'data' => 'integer', + 'help' => LAN_GALLERY_ADMIN_13, + ), + '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, + ), + 'slideshow_effect' => array( + 'title' => LAN_GALLERY_ADMIN_18, + 'type' => 'dropdown', + 'tab' => 1, + 'data' => 'str', + 'help' => LAN_GALLERY_ADMIN_19 + ), + 'perpage' => array( + 'title' => LAN_GALLERY_ADMIN_20, + 'tab' => 0, + 'type' => 'number', + 'data' => 'int', + 'help' => LAN_GALLERY_ADMIN_21, + ), + 'orderby' => array( + 'title' => LAN_GALLERY_ADMIN_22, + 'tab' => 0, + 'type' => 'dropdown', + 'data' => 'str', + 'writeParms' => array( + 'optArray' => array( + 'media_id ASC' => LAN_GALLERY_ADMIN_23, + 'media_id DESC' => LAN_GALLERY_ADMIN_24, + 'media_name ASC' => LAN_GALLERY_ADMIN_25, + 'media_name DESC' => LAN_GALLERY_ADMIN_26, + 'media_caption ASC' => LAN_GALLERY_ADMIN_27, + 'media_caption DESC' => LAN_GALLERY_ADMIN_28, + ), + ), + ), + 'pp_global' => array( + 'title' => LAN_GALLERY_ADMIN_70, + 'type' => 'boolean', + 'data' => 'int', + 'tab' => 2, + ), + 'pp_hook' => array( + 'title' => LAN_GALLERY_ADMIN_71, + 'type' => 'text', + 'data' => 'str', + 'writeParms' => array( + 'default' => 'data-gal', + ), + 'tab' => 2, + ), + 'pp_animation_speed' => array( + 'title' => LAN_GALLERY_ADMIN_33, + 'type' => 'dropdown', + 'data' => 'str', + 'writeParms' => array( + 'optArray' => array( + 'fast' => LAN_GALLERY_ADMIN_62, + 'slow' => LAN_GALLERY_ADMIN_63, + 'normal' => LAN_GALLERY_ADMIN_64, + ), + ), + 'tab' => 2, + ), + 'pp_slideshow' => array( + 'title' => LAN_GALLERY_ADMIN_34, + 'type' => 'text', + 'data' => 'int', + 'writeParms' => array( + 'default' => 5000, + ), + 'tab' => 2, + ), + 'pp_autoplay_slideshow' => array( + 'title' => LAN_GALLERY_ADMIN_35, + 'type' => 'boolean', + 'data' => 'int', + 'tab' => 2, + ), + 'pp_opacity' => array( + 'title' => LAN_GALLERY_ADMIN_36, + 'help' => LAN_GALLERY_ADMIN_37, + 'type' => 'text', + 'data' => 'float', + 'writeParms' => array( + 'default' => 0.80, + ), + 'tab' => 2, + ), + 'pp_show_title' => array( + 'title' => LAN_GALLERY_ADMIN_38, + 'type' => 'boolean', + 'data' => 'int', + 'tab' => 2, + ), + 'pp_allow_resize' => array( + 'title' => LAN_GALLERY_ADMIN_39, + 'help' => LAN_GALLERY_ADMIN_40, + 'type' => 'boolean', + 'data' => 'int', + 'tab' => 2, + ), + 'pp_default_width' => array( + 'title' => LAN_GALLERY_ADMIN_41, + 'type' => 'text', + 'data' => 'int', + 'writeParms' => array( + 'default' => 500, + ), + 'tab' => 2, + ), + 'pp_default_height' => array( + 'title' => LAN_GALLERY_ADMIN_42, + 'type' => 'text', + 'data' => 'int', + 'writeParms' => array( + 'default' => 344, + ), + 'tab' => 2, + ), + 'pp_counter_separator_label' => array( + 'title' => LAN_GALLERY_ADMIN_43, + 'help' => LAN_GALLERY_ADMIN_44, + 'type' => 'text', + 'data' => 'str', + 'writeParms' => array( + 'default' => '/', + ), + 'tab' => 2, + ), + 'pp_theme' => array( + 'title' => LAN_GALLERY_ADMIN_45, + 'type' => 'dropdown', + 'data' => 'str', + 'writeParms' => array( + 'optArray' => array( + 'pp_default' => LAN_DEFAULT, + 'light_rounded' => LAN_GALLERY_ADMIN_65, + 'dark_rounded' => LAN_GALLERY_ADMIN_66, + 'light_square' => LAN_GALLERY_ADMIN_67, + 'dark_square' => LAN_GALLERY_ADMIN_68, + 'facebook' => LAN_GALLERY_ADMIN_69, + ), + ), + 'tab' => 2, + ), + 'pp_horizontal_padding' => array( + 'title' => LAN_GALLERY_ADMIN_46, + 'help' => LAN_GALLERY_ADMIN_47, + 'type' => 'text', + 'data' => 'int', + 'writeParms' => array( + 'default' => 20, + ), + 'tab' => 2, + ), + 'pp_hideflash' => array( + 'title' => LAN_GALLERY_ADMIN_48, + 'help' => LAN_GALLERY_ADMIN_49, + 'type' => 'boolean', + 'data' => 'int', + 'tab' => 2, + ), + 'pp_wmode' => array( + 'title' => LAN_GALLERY_ADMIN_50, + 'help' => LAN_GALLERY_ADMIN_51, + 'type' => 'text', + 'data' => 'str', + 'writeParms' => array( + 'default' => 'opaque', + ), + 'tab' => 2, + ), + 'pp_autoplay' => array( + 'title' => LAN_GALLERY_ADMIN_52, + 'type' => 'boolean', + 'data' => 'int', + 'tab' => 2, + ), + 'pp_modal' => array( + 'title' => LAN_GALLERY_ADMIN_53, + 'help' => LAN_GALLERY_ADMIN_54, + 'type' => 'boolean', + 'data' => 'int', + 'tab' => 2, + ), + 'pp_deeplinking' => array( + 'title' => LAN_GALLERY_ADMIN_55, + 'help' => LAN_GALLERY_ADMIN_56, + 'type' => 'boolean', + 'data' => 'int', + 'tab' => 2, + ), + 'pp_overlay_gallery' => array( + 'title' => LAN_GALLERY_ADMIN_57, + 'help' => LAN_GALLERY_ADMIN_58, + 'type' => 'boolean', + 'data' => 'int', + 'tab' => 2, + ), + 'pp_keyboard_shortcuts' => array( + 'title' => LAN_GALLERY_ADMIN_59, + 'help' => LAN_GALLERY_ADMIN_60, + 'type' => 'boolean', + 'data' => 'int', + 'tab' => 2, + ), + 'pp_ie6_fallback' => array( + 'title' => LAN_GALLERY_ADMIN_61, + 'type' => 'boolean', + 'data' => 'int', + 'tab' => 2, + ), + ); + + /** + * Initial function. + */ function init() { $effects = array( - 'scrollHorz' => 'slide left', - 'scrollVert' => 'slide down', - // 'turnDown' => 'turn Down', - // 'turnUp' => 'turn Up', - // 'curtainX' => 'curtainX', - // 'curtainY' => 'curtainY', - 'fade' => 'fade', - // 'zoom' => 'zoom' - ); - - - - $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; - + 'scrollHorz' => LAN_GALLERY_ADMIN_29, + 'scrollVert' => LAN_GALLERY_ADMIN_30, + 'fade' => LAN_GALLERY_ADMIN_31, + ); + + $this->prefs['slideshow_effect']['writeParms'] = $effects; + $this->prefs['slideshow_effect']['readParms'] = $effects; + $categories = e107::getMedia()->getCategories('gallery'); $cats = array(); - foreach($categories as $k=>$var) + foreach($categories as $k => $var) { $id = preg_replace("/[^0-9]/", '', $k); - $cats[$id] = $var['media_cat_title']; + $cats[$id] = $var['media_cat_title']; } - - $this->prefs['slideshow_category']['writeParms'] = $cats; - $this->prefs['slideshow_category']['readParms'] = $cats; - + + $this->prefs['slideshow_category']['writeParms'] = $cats; + $this->prefs['slideshow_category']['readParms'] = $cats; + $mes = e107::getMessage(); - $message = "Gallery is active. Simply import and assign images to the gallery categories using the Media Manager"; - + $tp = e107::getParser(); + + $x = LAN_PLUGIN_GALLERY_TITLE; + $y = "" . LAN_MEDIAMANAGER . ""; + + $message = $tp->lanVars(LAN_GALLERY_ADMIN_01, array($x, $y), true); + $mes->addInfo($message); + } + + /** + * User defined pre-create logic, return false to prevent DB query execution. + * + * @param $new_data + * Posted data. + * @param $old_data + * + * @return boolean + */ + public function beforeCreate($new_data, $old_data) + { + $replace = array("_", " ", "'", '"', "."); // FIXME Improve. + $new_data['media_cat_category'] = strtolower(str_replace($replace, "", $new_data['media_cat_title'])); + return $new_data; + } + + function galleryPage() + { + $mes = e107::getMessage(); + $tp = e107::getParser(); + + $x = LAN_PLUGIN_GALLERY_TITLE; + $y = "" . LAN_MEDIAMANAGER . ""; + + $message = $tp->lanVars(LAN_GALLERY_ADMIN_01, array($x, $y), true); $mes->addInfo($message); } - } + class gallery_cat_admin_form_ui extends e_admin_form_ui { - - // Override the default Options field. - - public function gallery_category_parent($curVal,$mode) + + // Override the default Options field. + public function gallery_category_parent($curVal, $mode) { - // TODO - catlist combo without current cat ID in write mode, parents only for batch/filter - // Get UI instance + // TODO - catlist combo without current cat ID in write mode, parents only for batch/filter. + // Get UI instance. $controller = $this->getController(); switch($mode) { case 'read': return e107::getParser()->toHTML($controller->getDownloadCategoryTree($curVal), false, 'TITLE'); - break; - + break; + case 'write': return $this->selectbox('gallery_category_parent', $controller->getDownloadCategoryTree(), $curVal); - break; - + break; + case 'filter': case 'batch': return $controller->getDownloadCategoryTree(); - break; + break; } } + } - - - - - class gallery_main_admin_ui extends e_admin_ui { - - + } + class gallery_main_admin_form_ui extends e_admin_form_ui { - - - + } - - - new plugin_gallery_admin(); - require_once(e_ADMIN."auth.php"); - e107::getAdminUI()->runPage(); //gallery/includes/admin.php is auto-loaded. - require_once(e_ADMIN."footer.php"); - exit; -?> \ No newline at end of file +new plugin_gallery_admin(); +require_once(e_ADMIN . "auth.php"); +e107::getAdminUI()->runPage(); //gallery/includes/admin.php is auto-loaded. +require_once(e_ADMIN . "footer.php"); +exit; diff --git a/e107_plugins/gallery/controllers/index.php b/e107_plugins/gallery/controllers/index.php index efb933c4f..9ccaf7c68 100644 --- a/e107_plugins/gallery/controllers/index.php +++ b/e107_plugins/gallery/controllers/index.php @@ -16,33 +16,34 @@ /** * * @package e107 - * @subpackage frontend + * @subpackage frontend * @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. + */ class plugin_gallery_index_controller extends eControllerFront { + /** * Plugin name - used to check if plugin is installed * Set this only if plugin requires installation * @var string */ protected $plugin = 'gallery'; - + /** * Default controller access * @var integer */ protected $userclass = e_UC_PUBLIC; - + /** * User input filter * Format 'action' => array(var => validationArray) @@ -52,41 +53,23 @@ class plugin_gallery_index_controller extends eControllerFront 'category' => array( 'cat' => array('regex', '/[\w\pL\s\-+.,]+/u'), ), - 'list' => array( + 'list' => array( 'cat' => array('regex', '/[\w\pL\s\-+.,]+/u'), 'frm' => array('int'), ), ); - + /** * @var array */ protected $catList; - + public function init() { e107::plugLan('gallery', 'front'); - e107::js('gallery', 'jslib/prettyPhoto/js/jquery.prettyPhoto.js','jquery'); - e107::css('gallery', 'jslib/prettyPhoto/css/prettyPhoto.css','jquery'); - e107::css('gallery', 'gallery_style.css'); - - $prettyPhoto = <<catList = e107::getMedia()->getCategories('gallery'); } - + public function actionIndex() { if(isset($_GET['cat']) && !empty($_GET['cat'])) @@ -95,59 +78,61 @@ JS; } else { - $this->_forward('category'); + $this->_forward('category'); } } - + public function actionCategory() { - $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 = 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']); + $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); - } - - $text .= e107::getParser()->parseTemplate($template['cat_end'],TRUE, $sc); - + $sc->setVars($val); + $text .= e107::getParser()->parseTemplate($template['cat_item'], true); + } + + $text .= e107::getParser()->parseTemplate($template['cat_end'], true, $sc); + 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); } - else + else { $this->addTitle(LAN_PLUGIN_GALLERY_TITLE)->addBody($text); } - + } - + public function actionList() { + $plugPrefs = e107::getPlugConfig('gallery')->getPref(); + $request = $this->getRequest(); - + // use only filtered variables $cid = $request->getRequestParam('cat'); - + if($cid && !isset($this->catList[$cid])) { // get ID by SEF $_cid = null; - foreach ($this->catList as $id => $row) + foreach($this->catList as $id => $row) { if($cid === $row['media_cat_sef']) { @@ -157,59 +142,60 @@ JS; } $cid = $_cid; } - + if(empty($cid) || !isset($this->catList[$cid])) { $this->_forward('category'); return; } - - $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. + + $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']); + $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. + + $sc->total = e107::getMedia()->countImages($cid); + $sc->amount = varset($plugPrefs['perpage'], 12); $sc->curCat = $cid; - $sc->from = $request->getRequestParam('frm', 0); - - $list = e107::getMedia()->getImages($cid,$sc->from,$sc->amount); - $catname = $tp->toHtml($this->catList[$cid]['media_cat_title'],false,'defs'); + $sc->from = $request->getRequestParam('frm', 0); + + $orderBy = varset($plugPrefs['orderby'], 'media_id DESC'); + + $list = e107::getMedia()->getImages($cid, $sc->from, $sc->amount, null, $orderBy); + $catname = $tp->toHtml($this->catList[$cid]['media_cat_title'], false, 'defs'); $cat = $this->catList[$cid]; - - $inner = ""; - + + $inner = ""; + foreach($list as $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 .= $inner; - $text .= $tp->parseTemplate($template['list_end'],TRUE, $sc); - + + $text = $tp->parseTemplate($template['list_start'], true, $sc); + $text .= $inner; + $text .= $tp->parseTemplate($template['list_end'], true, $sc); + 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); } else { $this->addTitle($catname) - ->addTitle(LAN_PLUGIN_GALLERY_TITLE) - ->addBody($text); + ->addTitle(LAN_PLUGIN_GALLERY_TITLE) + ->addBody($text); } - - + } } \ No newline at end of file diff --git a/e107_plugins/gallery/gallery_style.css b/e107_plugins/gallery/css/gallery.css similarity index 89% rename from e107_plugins/gallery/gallery_style.css rename to e107_plugins/gallery/css/gallery.css index 758f786e6..c3f9231c7 100644 --- a/e107_plugins/gallery/gallery_style.css +++ b/e107_plugins/gallery/css/gallery.css @@ -48,3 +48,8 @@ ul.gallery-cat > li > div > h3 { text-align: center } .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; } + +/* Work-around for indent issue. see: https://github.com/twitter/bootstrap/issues/4890 */ +.thumbnails .span2:nth-child(6n+1) { + margin-left:0; +} diff --git a/e107_plugins/gallery/e_header.php b/e107_plugins/gallery/e_header.php index c068d567a..46c02e2e8 100644 --- a/e107_plugins/gallery/e_header.php +++ b/e107_plugins/gallery/e_header.php @@ -5,13 +5,11 @@ * * Featurebox shortcode batch class - shortcodes available site-wide. ie. equivalent to multiple .sc files. */ -if (!defined('e107_INIT')) { exit; } - -//e107::js('gallery', 'jslib/lightbox/js/lightbox.js','jquery'); -//e107::css('gallery', 'jslib/lightbox/css/lightbox.css','jquery'); - -// See: http://www.no-margin-for-errors.com/projects/prettyPhoto-jquery-lightbox-clone +if(!defined('e107_INIT')) +{ + exit; +} if(USER_AREA) { @@ -20,43 +18,14 @@ if(USER_AREA) /* Gallery CSS */ .thumbnails .span2:nth-child(6n+1) { margin-left:0; -}",'jquery'); - - -/* -e107::js('gallery', 'jslib/prettyPhoto/js/jquery.prettyPhoto.js','jquery'); - -e107::css('gallery', 'jslib/prettyPhoto/css/prettyPhoto.css','jquery'); - - -e107::css('gallery', 'gallery_style.css'); - - - - - -$prettyPhoto = << \ No newline at end of file +$plugPrefs = e107::getPlugConfig('gallery')->getPref(); + +if(vartrue($plugPrefs['pp_global'], false)) +{ + e107_require_once(e_PLUGIN . 'gallery/includes/gallery_load.php'); + // Load prettyPhoto settings and files. + gallery_load_prettyphoto(); +} diff --git a/e107_plugins/gallery/e_library.php b/e107_plugins/gallery/e_library.php new file mode 100644 index 000000000..4eb394c39 --- /dev/null +++ b/e107_plugins/gallery/e_library.php @@ -0,0 +1,162 @@ +1.3-beta2)' + * // Only load a version equal to or later than 1.3-beta3: + * 'example (>=1.3-beta3)', + * // Only load a version earlier than 1.5: + * 'example (<1.5)', + * // Only load a version equal to or earlier than 1.4: + * 'example (<=1.4)', + * // Combinations of the above are allowed as well: + * 'example (>=1.3-beta2, <1.5)', + * ); + * @endcode + * - variants: (optional) An associative array of available library variants. For example, the top-level 'files' + * property may refer to a default variant that is compressed. If the library also ships with a minified and + * uncompressed/source variant, those can be defined here. Each key should describe the variant type, e.g. + * 'minified' or 'source'. Each value is an associative array of top-level properties that are entirely + * overridden by the variant, most often just 'files'. Additionally, each variant can contain following + * properties: + * - variant_callback: (optional) The name of a function that detects the variant and returns TRUE or FALSE, + * depending on whether the variant is available or not. The first argument is always $library, an array + * containing all library information as described here. The second argument is always a string containing the + * variant name. There are two ways to declare the variant callback's additional arguments, either as a single + * $options parameter or as multiple parameters, which correspond to the two ways to specify the argument + * values (see 'variant_arguments'). If omitted, the variant is expected to always be available. + * - variant_arguments: A list of arguments to pass to the variant callback. Variant arguments can be declared + * either as an associative array whose keys are the argument names or as an indexed array without specifying + * keys. If declared as an associative array, the arguments get passed to the variant callback as a single + * $options parameter whose keys are the argument names (i.e. $options is identical to the specified array). + * If declared as an indexed array, the array values get passed to the variant callback as separate arguments + * in the order they were declared. + * Variants can be version-specific (see 'versions'). + * - versions: (optional) An associative array of supported library versions. Naturally, libraries evolve over + * time and so do their APIs. In case a library changes between versions, different 'files' may need to be + * loaded, different 'variants' may become available, or e107 plugins need to load different integration files + * adapted to the new version. Each key is a version *string* (PHP does not support floats as keys). Each value + * is an associative array of top-level properties that are entirely overridden by the version. + * - integration_files: (optional) Sets of files to load for the plugin, using the same notion as the top-level + * 'files' property. Each specified file should contain the path to the file relative to the plugin it belongs + * to. + * Additional top-level properties can be registered as needed. + */ + function config() + { + $libraries['jquery.prettyPhoto'] = array( + // Only used in administrative UI of Libraries API. + 'name' => 'prettyPhoto', + 'vendor_url' => 'http://www.no-margin-for-errors.com', + 'download_url' => 'https://github.com/scaron/prettyphoto', + 'version_arguments' => array( + 'file' => 'js/jquery.prettyPhoto.js', + // Version: 3.1.6 + 'pattern' => '/Version: (\d+\.+\d+\.+\d+)/', + 'lines' => 5, + ), + 'files' => array( + 'js' => array( + 'js/jquery.prettyPhoto.js' => array( + 'type' => 'footer', + ), + ), + 'css' => array( + 'css/prettyPhoto.css', + ), + ), + ); + + $libraries['jquery.cycle'] = array( + // Only used in administrative UI of Libraries API. + 'name' => 'jQuery Cycle Plugin', + 'vendor_url' => 'http://jquery.malsup.com/cycle/', + 'download_url' => 'http://jquery.malsup.com/cycle/', + 'version_arguments' => array( + 'file' => 'jquery.cycle.all.js', + // Version: 2.9999.5 + 'pattern' => '/Version: (\d+\.+\d+\.+\d+)/', + 'lines' => 5, + ), + 'files' => array( + 'js' => array( + 'jquery.cycle.all.js' => array( + 'type' => 'footer', + ), + ), + ), + ); + + return $libraries; + } + +} diff --git a/e107_plugins/gallery/e_shortcode.php b/e107_plugins/gallery/e_shortcode.php index 05fa63fec..9f66df6c2 100644 --- a/e107_plugins/gallery/e_shortcode.php +++ b/e107_plugins/gallery/e_shortcode.php @@ -6,79 +6,71 @@ * 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 { - - public $total = 0; - public $amount = 3; - public $from = 0; - public $curCat = null; - public $sliderCat = 1; - public $slideMode = FALSE; - public $slideCount = 1; - private $downloadable = FALSE; - private $attFull = null; - + + public $total = 0; + public $amount = 3; + public $from = 0; + public $curCat = null; + public $sliderCat = 1; + public $slideMode = false; + public $slideCount = 1; + private $attFull = null; + function init() { - $this->downloadable = e107::getPlugPref('gallery','downloadable'); - $prefW = e107::getPlugPref('gallery','pop_w'); - $prefH = e107::getPlugPref('gallery','pop_h'); - $pop_w = vartrue($prefW, 1024); - $pop_h = vartrue($prefH, 768); - $this->attFull = array('w'=>$pop_w, 'h'=>$pop_h, 'x'=>1, 'crop'=>0); // 'w='.$pop_w.'&h='.$pop_h.'&x=1'; - - e107::js('gallery', 'jslib/prettyPhoto/js/jquery.prettyPhoto.js','jquery'); - e107::css('gallery', 'jslib/prettyPhoto/css/prettyPhoto.css','jquery'); - - - $prettyPhoto = <<attFull = array('w' => $pop_w, 'h' => $pop_h, 'x' => 1, 'crop' => 0); // 'w='.$pop_w.'&h='.$pop_h.'&x=1'; } - - function sc_gallery_caption($parm='') + + function sc_gallery_caption($parm = '') { + e107_require_once(e_PLUGIN . 'gallery/includes/gallery_load.php'); + // Load prettyPhoto settings and files. + gallery_load_prettyphoto(); + + $plugPrefs = e107::getPlugConfig('gallery')->getPref(); + $hook = varset($plugPrefs['pp_hook'], 'data-gal'); $tp = e107::getParser(); - $text = "attFull)."' data-gal='prettyPhoto[slide]' >"; // Erase rel"lightbox.Gallery2" - Write "prettyPhoto[slide]" + $text = "attFull) . "' " . $hook . "='prettyPhoto[slide]' >"; // Erase rel"lightbox.Gallery2" - Write "prettyPhoto[slide]" $text .= $this->var['media_caption']; $text .= ""; return $text; } - - function sc_gallery_description($parm='') + + function sc_gallery_description($parm = '') { $tp = e107::getParser(); return $tp->toHTML($this->var['media_description'], true, 'BODY'); } - - function sc_gallery_breadcrumb($parm='') + + function sc_gallery_breadcrumb($parm = '') { $breadcrumb = array(); - - $breadcrumb[] = array('text'=> LAN_PLUGIN_GALLERY_TITLE, 'url'=> e107::getUrl()->create('gallery', $this->var)); - + + $breadcrumb[] = array('text' => LAN_PLUGIN_GALLERY_TITLE, 'url' => e107::getUrl()->create('gallery', $this->var)); + if(vartrue($this->curCat)) { - $breadcrumb[] = array('text'=> $this->sc_gallery_cat_title('title'), 'url'=> e107::getUrl()->create('gallery/index/list', $this->var)); + $breadcrumb[] = array('text' => $this->sc_gallery_cat_title('title'), 'url' => e107::getUrl()->create('gallery/index/list', $this->var)); } - + return e107::getForm()->breadcrumb($breadcrumb); } - + /** * All possible parameters * {GALLERY_THUMB=w=200&h=200&thumburl&thumbsrc&imageurl&orig} @@ -88,153 +80,170 @@ JS; * imageurl - full path to the destination image (no proxy) * actualPreview - large preview will use the original path to the image (no proxy) */ - function sc_gallery_thumb($parm='') + function sc_gallery_thumb($parm = '') { - $tp = e107::getParser(); - $parms = eHelper::scParams($parm); + e107_require_once(e_PLUGIN . 'gallery/includes/gallery_load.php'); + // Load prettyPhoto settings and files. + gallery_load_prettyphoto(); - $w = vartrue($parms['w']) ? $parms['w'] : $tp->thumbWidth(); // 190; // 160; - $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'); - // $rel = ($this->slideMode == TRUE) ? 'lightbox.SlideGallery' : 'lightbox.Gallery'; - $rel = ($this->slideMode == TRUE) ? 'prettyPhoto[slide]' : 'prettyPhoto[gal]'; + $plugPrefs = e107::getPlugConfig('gallery')->getPref(); + $hook = varset($plugPrefs['pp_hook'], 'data-gal'); + + $tp = e107::getParser(); + $parms = eHelper::scParams($parm); + + $w = vartrue($parms['w']) ? $parms['w'] : $tp->thumbWidth(); // 190; // 160; + $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'); + $rel = ($this->slideMode == true) ? 'prettyPhoto[pp_gal]' : 'prettyPhoto[pp_gal]'; //$att = array('aw'=>$w, 'ah'=>$h, 'x'=>1, 'crop'=>1); - $caption = $tp->toAttribute($this->var['media_caption']) ; - $att = array('w'=>$w, 'h'=>$h, 'class'=>$class, 'alt'=>$caption, 'x'=>1, 'crop'=>1); + $caption = $tp->toAttribute($this->var['media_caption']); + $att = array('w' => $w, 'h' => $h, 'class' => $class, 'alt' => $caption, 'x' => 1, 'crop' => 1); + - $srcFull = $tp->thumbUrl($this->var['media_url'], $this->attFull); - if(vartrue($parms['actualPreview'])) + if(vartrue($parms['actualPreview'])) { $srcFull = $tp->replaceConstants($this->var['media_url'], 'full'); } - - if(isset($parms['thumburl'])) 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) ? " Download" : ""; - $description .= $tp->toAttribute($this->var['media_description']); - - $text = ""; + if(isset($parms['thumburl'])) + { + 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'); + } - $text .= $tp->toImage($this->var['media_url'],$att); + $description = $tp->toAttribute($this->var['media_description']); + + $text = ""; + $text .= $tp->toImage($this->var['media_url'], $att); $text .= ""; - return $text; + return $text; } - - function sc_gallery_cat_title($parm='') + + function sc_gallery_cat_title($parm = '') { $tp = e107::getParser(); - $url = e107::getUrl()->create('gallery/index/list', $this->var); - if($parm == 'title') return $tp->toHtml($this->var['media_cat_title'], false, 'TITLE'); - $text = ""; + $url = e107::getUrl()->create('gallery/index/list', $this->var); + if($parm == 'title') + { + return $tp->toHtml($this->var['media_cat_title'], false, 'TITLE'); + } + $text = ""; $text .= $tp->toHtml($this->var['media_cat_title'], false, 'TITLE'); $text .= ""; - return $text; + return $text; } - - function sc_gallery_cat_url($parm='') + + function sc_gallery_cat_url($parm = '') { - return e107::getUrl()->create('gallery/index/list', $this->var); + return e107::getUrl()->create('gallery/index/list', $this->var); } - - function sc_gallery_cat_description($parm='') + + function sc_gallery_cat_description($parm = '') { $tp = e107::getParser(); return $tp->toHTML($this->var['media_cat_diz'], true, 'BODY'); } - + function sc_gallery_baseurl() { - return e107::getUrl()->create('gallery'); + return e107::getUrl()->create('gallery'); } - - function sc_gallery_cat_thumb($parm='') + + function sc_gallery_cat_thumb($parm = '') { $parms = eHelper::scParams($parm); - - $w = vartrue($parms['w']) ? $parms['w'] : 300; // 260; - $h = vartrue($parms['h']) ? $parms['h'] : 200; // 180; - $att = 'aw='.$w.'&ah='.$h.'&x=1'; // 'aw=190&ah=150'; - + + $w = vartrue($parms['w']) ? $parms['w'] : 300; // 260; + $h = vartrue($parms['h']) ? $parms['h'] : 200; // 180; + $att = 'aw=' . $w . '&ah=' . $h . '&x=1'; // 'aw=190&ah=150'; + $url = e107::getUrl()->create('gallery/index/list', $this->var); - - if(isset($parms['thumbsrc'])) return e107::getParser()->thumbUrl($this->var['media_cat_image'],$att); - - $text = ""; - $text .= ""; + + if(isset($parms['thumbsrc'])) + { + return e107::getParser()->thumbUrl($this->var['media_cat_image'], $att); + } + + $text = ""; + $text .= ""; $text .= ""; - return $text; + return $text; } - - function sc_gallery_nextprev($parm='') + + function sc_gallery_nextprev($parm = '') { // we passs both fields, the router will convert one of them to 'cat' variable, based on the current URL config - $url = 'route::gallery/index/list?media_cat_category='.$this->curCat.'--AMP--media_cat_sef='.$this->var['media_cat_sef'].'--AMP--frm=--FROM--::full=1'; - $parm = 'total='.$this->total.'&amount='.$this->amount.'¤t='.$this->from.'&url='.rawurlencode($url); // .'&url='.$url; - $text = e107::getParser()->parseTemplate("{NEXTPREV=".$parm."}"); - return $text; + $url = 'route::gallery/index/list?media_cat_category=' . $this->curCat . '--AMP--media_cat_sef=' . $this->var['media_cat_sef'] . '--AMP--frm=--FROM--::full=1'; + $parm = 'total=' . $this->total . '&amount=' . $this->amount . '¤t=' . $this->from . '&url=' . rawurlencode($url); // .'&url='.$url; + $text = e107::getParser()->parseTemplate("{NEXTPREV=" . $parm . "}"); + return $text; } - - function sc_gallery_slideshow($parm='') - { - $this->sliderCat = ($parm) ? $parm : vartrue(e107::getPlugPref('gallery','slideshow_category'),1); - $tmpl = e107::getTemplate('gallery','gallery'); + function sc_gallery_slideshow($parm = '') + { + $this->sliderCat = ($parm) ? $parm : vartrue(e107::getPlugPref('gallery', 'slideshow_category'), 1); + + $tmpl = e107::getTemplate('gallery', 'gallery'); $template = array_change_key_case($tmpl); - + return e107::getParser()->parseTemplate($template['slideshow_wrapper']); } - + /** - * Display a Grid of thumbnails - useful for home pages. - * Amount per row differs according to device, so they are not set here, only the amount. + * Display a Grid of thumbnails - useful for home pages. + * Amount per row differs according to device, so they are not set here, only the amount. * @example {GALLERY_PORTFOLIO: placeholder=1&category=2} */ - function sc_gallery_portfolio($parms='') + function sc_gallery_portfolio($parms = '') { + $ns = e107::getRender(); + $parm = eHelper::scParams($parms); + $cat = (!empty($parm['category'])) ? $parm['category'] : vartrue(e107::getPlugPref('gallery', 'slideshow_category'), 1); //TODO Separate pref? + $tmpl = e107::getTemplate('gallery', 'gallery'); + $limit = vartrue($parm['limit'], 6); + $plugPrefs = e107::getPlugConfig('gallery')->getPref(); + $orderBy = varset($plugPrefs['orderby'], 'media_id DESC'); - $ns = e107::getRender(); - $parm = eHelper::scParams($parms); - $cat = (!empty($parm['category'])) ? $parm['category'] : vartrue(e107::getPlugPref('gallery','slideshow_category'), 1); //TODO Separate pref? - - $tmpl = e107::getTemplate('gallery','gallery'); - $limit = vartrue($parm['limit'], 6); - - $list = e107::getMedia()->getImages('gallery_image|gallery_'.$cat.'|gallery_image_'.$cat, 0, $limit); + $list = e107::getMedia()->getImages('gallery_image|gallery_' . $cat . '|gallery_image_' . $cat, 0, $limit, null, $orderBy); if(count($list) < 1 && vartrue($parm['placeholder'])) { $list = array(); - for ($i=0; $i < $limit; $i++) + for($i = 0; $i < $limit; $i++) { - $list[] = array('media_url'=>''); - } + $list[] = array('media_url' => ''); + } } - + //NOTE: Using tablerender() allows the theme developer to set the number of columns etc using col-xx-xx $text = ''; foreach($list as $val) { $this->var = $val; - $text .= $ns->tablerender('', $this->sc_gallery_thumb('class=gallery_thumb img-responsive img-home-portfolio'),'gallery_portfolio',true); + $text .= $ns->tablerender('', $this->sc_gallery_thumb('class=gallery_thumb img-responsive img-home-portfolio'), 'gallery_portfolio', true); } return $text; } - - - + + /** * All possible parameters * {GALLERY_SLIDES=4|limit=16&template=MY_SLIDESHOW_SLIDE_ITEM} @@ -244,40 +253,43 @@ JS; */ function sc_gallery_slides($parm) { - $tp = e107::getParser(); - $this->slideMode = TRUE; - $parms = eHelper::scDualParams($parm); - $amount = $parms[1] ? intval($parms[1]) : 3; // vartrue(e107::getPlugPref('gallery','slideshow_perslide'),3); - $parms = $parms[2]; - $limit = (integer) vartrue($parms['limit'], 16); - $list = e107::getMedia()->getImages('gallery_image|gallery_'.$this->sliderCat.'|gallery_image_'.$this->sliderCat,0,$limit); - $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]; + $plugPrefs = e107::getPlugConfig('gallery')->getPref(); + $orderBy = varset($plugPrefs['orderby'], 'media_id DESC'); + + $tp = e107::getParser(); + $this->slideMode = true; + $parms = eHelper::scDualParams($parm); + $amount = $parms[1] ? intval($parms[1]) : 3; // vartrue(e107::getPlugPref('gallery','slideshow_perslide'),3); + $parms = $parms[2]; + $limit = (integer) vartrue($parms['limit'], 16); + $list = e107::getMedia()->getImages('gallery_image|gallery_' . $this->sliderCat . '|gallery_image_' . $this->sliderCat, 0, $limit, null, $orderBy); + $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]; $count = 1; $inner = ''; foreach($list as $row) { $this->setVars($row) - ->addVars($cat); - - $inner .= ($count == 1) ? "\n\n\n" : ""; @@ -285,21 +297,22 @@ JS; } - function sc_gallery_jumper($parm) { // echo "SlideCount=".$this->slideCount; - if($this->slideCount ==1 && deftrue('E107_DBG_BASIC')){ return "gallery-jumper must be loaded after Gallery-Slides"; } - - $text = ''; - for($i=1; $i < ($this->slideCount); $i++) + if($this->slideCount == 1 && deftrue('E107_DBG_BASIC')) { - $val = ($parm == 'space') ? " " : $i; - $text .= ''.$val.''; + return "gallery-jumper must be loaded after Gallery-Slides"; } - - return $text; - + + $text = ''; + for($i = 1; $i < ($this->slideCount); $i++) + { + $val = ($parm == 'space') ? " " : $i; + $text .= '' . $val . ''; + } + + return $text; + } } -?> \ No newline at end of file diff --git a/e107_plugins/gallery/gallery.php b/e107_plugins/gallery/gallery.php index 51df7a93f..16b0bb46d 100644 --- a/e107_plugins/gallery/gallery.php +++ b/e107_plugins/gallery/gallery.php @@ -1,150 +1,126 @@ catList = e107::getMedia()->getCategories('gallery'); - + if((vartrue($_GET['cat'])) && isset($this->catList[$_GET['cat']])) { - $this->showImages($_GET['cat']); + $this->showImages($_GET['cat']); } else { - $this->listCategories(); + $this->listCategories(); } } - + function listCategories() { - $template = e107::getTemplate('gallery'); - $template = array_change_key_case($template); - $sc = e107::getScBatch('gallery',TRUE); - - $text = ""; - + $template = e107::getTemplate('gallery'); + $template = array_change_key_case($template); + $sc = e107::getScBatch('gallery', true); + + $text = ""; + if(defset('BOOTSTRAP') === true || defset('BOOTSTRAP') === 2) // Convert bootstrap3 to bootstrap2 compat. { - $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) { - $sc->setVars($val); - $text .= e107::getParser()->parseTemplate($template['cat_item'],TRUE, $sc); - } - - $text .= e107::getParser()->parseTemplate($template['cat_end'],TRUE, $sc); - + $sc->setVars($val); + $text .= e107::getParser()->parseTemplate($template['cat_item'], true, $sc); + } + + $text .= e107::getParser()->parseTemplate($template['cat_end'], true, $sc); + e107::getRender()->tablerender(LAN_PLUGIN_GALLERY_TITLE, $text); } - + function showImages($cat) { - $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. + $plugPrefs = e107::getPlugConfig('gallery')->getPref(); + $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']); + $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. + + $sc->total = e107::getMedia()->countImages($cat); + $sc->amount = varset($plugPrefs['perpage'], 12); $sc->curCat = $cat; - $sc->from = ($_GET['frm']) ? intval($_GET['frm']) : 0; - - $list = e107::getMedia()->getImages($cat,$sc->from,$sc->amount); - $catname = $tp->toHtml($this->catList[$cat]['media_cat_title'],false,'defs'); - - $inner = ""; - + $sc->from = ($_GET['frm']) ? intval($_GET['frm']) : 0; + $orderBy = varset($plugPrefs['orderby'], 'media_id DESC'); + + $list = e107::getMedia()->getImages($cat, $sc->from, $sc->amount, null, $orderBy); + $catname = $tp->toHtml($this->catList[$cat]['media_cat_title'], false, 'defs'); + + $inner = ""; + foreach($list as $row) { - $sc->setVars($row); - $inner .= $tp->parseTemplate($template['list_item'],TRUE, $sc); + $sc->setVars($row); + $inner .= $tp->parseTemplate($template['list_item'], true, $sc); } - - $text = $tp->parseTemplate($template['list_start'],TRUE, $sc); - $text .= $inner; - $text .= $tp->parseTemplate($template['list_end'],TRUE, $sc); - - e107::getRender()->tablerender(LAN_PLUGIN_GALLERY_TITLE, $mes->render().$text); - + + $text = $tp->parseTemplate($template['list_start'], true, $sc); + $text .= $inner; + $text .= $tp->parseTemplate($template['list_end'], true, $sc); + + e107::getRender()->tablerender(LAN_PLUGIN_GALLERY_TITLE, $mes->render() . $text); + } - + } @@ -152,6 +128,3 @@ new gallery; require_once(FOOTERF); exit; - - -?> \ No newline at end of file diff --git a/e107_plugins/gallery/gallery_setup.php b/e107_plugins/gallery/gallery_setup.php index 652a90e3d..f0c7d6673 100644 --- a/e107_plugins/gallery/gallery_setup.php +++ b/e107_plugins/gallery/gallery_setup.php @@ -1,53 +1,78 @@ add("custom install 'pre' function.", E_MESSAGE_SUCCESS); + } + /** + * This function is called after plugin table has been created by the + * [PLUGIN]_sql.php file. + * + * @param array $var + */ function install_post($var) { - $sql = e107::getDb(); - $mes = eMessage::getInstance(); - // $mes->add("custom install 'post' function.", E_MESSAGE_SUCCESS); + } function uninstall_pre($var) { - $sql = e107::getDb(); - $mes = eMessage::getInstance(); - // $mes->add("custom uninstall 'pre' function.", E_MESSAGE_SUCCESS); + } - - // IMPORTANT : This function below is for modifying the CONTENT of the tables only, NOT the table-structure. - // To Modify the table-structure, simply modify your {plugin}_sql.php file and an update will be detected automatically. - /* - * @var $needed - true when only a check for a required update is being performed. - * Return: Reason the upgrade is required, otherwise set it to return FALSE. - */ - function upgrade_post($needed) + function uninstall_options() { - } + + function uninstall_post($var) + { + } + + /** + * Trigger an upgrade alert or not. + * + * @param array $var + * + * @return bool + * True to trigger an upgrade alert, and false to not. + */ + function upgrade_required($var) + { + return false; + } + + function upgrade_pre($var) + { + } + + function upgrade_post($var) + { + + } + } diff --git a/e107_plugins/gallery/includes/gallery_load.php b/e107_plugins/gallery/includes/gallery_load.php new file mode 100644 index 000000000..615c1d388 --- /dev/null +++ b/e107_plugins/gallery/includes/gallery_load.php @@ -0,0 +1,77 @@ +getPref(); + $template = e107::getTemplate('gallery'); + + // Load prettyPhoto library. + e107::library('load', 'jquery.prettyPhoto'); + + $settings = array( + 'prettyphoto' => array( + 'hook' => $tp->toText(varset($plugPref['pp_hook'], 'data-gal')), + 'animation_speed' => $tp->toText(varset($plugPref['pp_animation_speed'], 'fast')), + 'slideshow' => (int) varset($plugPref['pp_slideshow'], 5000), + 'autoplay_slideshow' => (bool) varset($plugPref['pp_autoplay_slideshow'], false), + 'opacity' => (float) varset($plugPref['pp_opacity'], 0.80), + 'show_title' => (bool) varset($plugPref['pp_show_title'], true), + 'allow_resize' => (bool) varset($plugPref['pp_allow_resize'], true), + 'default_width' => (int) varset($plugPref['pp_default_width'], 500), + 'default_height' => (int) varset($plugPref['pp_default_height'], 344), + 'counter_separator_label' => $tp->toText(varset($plugPref['pp_counter_separator_label'], '/')), + 'theme' => $tp->toText(varset($plugPref['pp_theme'], 'pp_default')), + 'horizontal_padding' => (int) varset($plugPref['pp_horizontal_padding'], 20), + 'hideflash' => (bool) varset($plugPref['pp_hideflash'], false), + 'wmode' => $tp->toText(varset($plugPref['pp_wmode'], 'opaque')), + 'autoplay' => (bool) varset($plugPref['pp_autoplay'], true), + 'modal' => (bool) varset($plugPref['pp_modal'], false), + 'deeplinking' => (bool) varset($plugPref['pp_deeplinking'], false), + 'overlay_gallery' => (bool) varset($plugPref['pp_overlay_gallery'], true), + 'keyboard_shortcuts' => (bool) varset($plugPref['pp_keyboard_shortcuts'], true), + 'ie6_fallback' => (bool) varset($plugPref['pp_ie6_fallback'], true), + 'markup' => $template['prettyphoto']['content'], + 'gallery_markup' => $template['prettyphoto']['gallery_item'], + 'image_markup' => $template['prettyphoto']['image_item'], + 'flash_markup' => $template['prettyphoto']['flash_item'], + 'quicktime_markup' => $template['prettyphoto']['quicktime_item'], + 'iframe_markup' => $template['prettyphoto']['iframe_item'], + 'inline_markup' => $template['prettyphoto']['inline_item'], + 'custom_markup' => $template['prettyphoto']['custom_item'], + 'social_tools' => $template['prettyphoto']['social_item'], + ), + ); + + if(vartrue($plugPref['downloadable'], false)) + { + $settings['prettyphoto']['image_markup'] .= ''; + $settings['prettyphoto']['image_markup'] .= '' . LAN_DOWNLOAD . ''; + $settings['prettyphoto']['image_markup'] .= ''; + } + + e107::js('settings', array('gallery' => $settings)); + e107::js('gallery', 'js/gallery.js'); + + $gallery_load_prettyphoto['loaded'] = true; + } +} diff --git a/e107_plugins/gallery/js/gallery.cycle.js b/e107_plugins/gallery/js/gallery.cycle.js new file mode 100644 index 000000000..079cfbb64 --- /dev/null +++ b/e107_plugins/gallery/js/gallery.cycle.js @@ -0,0 +1,49 @@ +var e107 = e107 || {'settings': {}, 'behaviors': {}}; + +(function ($) +{ + + /** + * Behavior to initialize gallery slideshow. + * + * @type {{attach: Function}} + */ + e107.behaviors.galleryCycle = { + attach: function (context, settings) + { + $(context).find("#gallery-slideshow-content").once('gallery-slideshow-content').each(function () + { + $(this).cycle({ + fx: settings.gallery.fx, + next: '.gal-next', + prev: '.gal-prev', + speed: settings.gallery.speed, // speed of the transition (any valid fx speed value) + timeout: settings.gallery.timeout, + slideExpr: '.slide', + pause: 1, // pause on hover - TODO pref + activePagerClass: '.gallery-slide-jumper-selected', + before: function (currSlideElement, nextSlideElement, options, forwardFlag) + { + var nx = $(nextSlideElement).attr('id').split('item-'); + var th = $(currSlideElement).attr('id').split('item-'); + $('#gallery-jumper-' + th[1]).removeClass('gallery-slide-jumper-selected'); + $('#gallery-jumper-' + nx[1]).addClass('gallery-slide-jumper-selected'); + } + }); + }); + + $(context).find(".gallery-slide-jumper").once('gallery-slide-jumper').each(function () + { + $(this).click(function () + { + var nid = $(this).attr('id'); + var id = nid.split('-jumper-'); + var go = parseInt(id[1]) - 1; + $('#gallery-slideshow-content').cycle(go); + return false; + }); + }); + } + }; + +})(jQuery); diff --git a/e107_plugins/gallery/js/gallery.js b/e107_plugins/gallery/js/gallery.js new file mode 100644 index 000000000..0a32e65d6 --- /dev/null +++ b/e107_plugins/gallery/js/gallery.js @@ -0,0 +1,58 @@ +var e107 = e107 || {'settings': {}, 'behaviors': {}}; + +(function ($) +{ + + /** + * Behavior to initialize prettyPhoto on gallery elements. + * + * @type {{attach: Function}} + */ + e107.behaviors.gallery = { + attach: function (context, settings) + { + var pPhoto = settings.gallery.prettyphoto || {}; + var pPhook = pPhoto.hook || 'data-gal'; + + $(context).find("a[" + pPhook + "^='prettyPhoto']").once('gallery-prettyPhoto').prettyPhoto( + { + hook: pPhook, + animation_speed: pPhoto.animation_speed, // fast/slow/normal + slideshow: pPhoto.slideshow, // false OR interval time in ms + autoplay_slideshow: pPhoto.autoplay_slideshow, // true/false + opacity: pPhoto.opacity, // Value between 0 and 1 + show_title: pPhoto.show_title, // true/false + allow_resize: pPhoto.allow_resize, // Resize the photos bigger than viewport. true/false + default_width: pPhoto.default_width, + default_height: pPhoto.default_height, + counter_separator_label: pPhoto.counter_separator_label, // The separator for the gallery counter 1 "of" 2 + theme: pPhoto.theme, // light_rounded / dark_rounded / light_square / dark_square / facebook + horizontal_padding: pPhoto.horizontal_padding, // The padding on each side of the picture + hideflash: pPhoto.hideflash, // Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto + wmode: pPhoto.wmode, // Set the flash wmode attribute + autoplay: pPhoto.autoplay, // Automatically start videos: true/false + modal: pPhoto.modal, // If set to true, only the close button will close the window + deeplinking: pPhoto.deeplinking, // Allow prettyPhoto to update the url to enable deeplinking. + overlay_gallery: pPhoto.overlay_gallery, // If set to true, a gallery will overlay the fullscreen image on mouse over + keyboard_shortcuts: pPhoto.keyboard_shortcuts, // Set to false if you open forms inside prettyPhoto + ie6_fallback: pPhoto.ie6_fallback, // true/false + markup: pPhoto.markup, + gallery_markup: pPhoto.gallery_markup, + image_markup: pPhoto.image_markup, + flash_markup: pPhoto.flash_markup, + quicktime_markup: pPhoto.quicktime_markup, + iframe_markup: pPhoto.iframe_markup, + inline_markup: pPhoto.inline_markup, + custom_markup: pPhoto.custom_markup, + social_tools: pPhoto.social_tools, + changepicturecallback: function () + { + var $ppContent = $(".pp_content"); + $ppContent.css("height", $ppContent.height() + jQuery(".download-btn").outerHeight() + 10); + } + } + ); + } + }; + +})(jQuery); diff --git a/e107_plugins/gallery/languages/English/English_admin.php b/e107_plugins/gallery/languages/English/English_admin.php new file mode 100644 index 000000000..65fd10074 --- /dev/null +++ b/e107_plugins/gallery/languages/English/English_admin.php @@ -0,0 +1,82 @@ + Save Link As"); diff --git a/e107_plugins/gallery/languages/English/English_global.php b/e107_plugins/gallery/languages/English/English_global.php index b906b82d1..3506818a2 100644 --- a/e107_plugins/gallery/languages/English/English_global.php +++ b/e107_plugins/gallery/languages/English/English_global.php @@ -1,10 +1,14 @@ - + A simple image gallery content @@ -23,5 +23,27 @@ 4000 scrollHorz 12 + media_id DESC + 1 + data-gal + fast + 5000 + 0 + 0.80 + 1 + 1 + 500 + 344 + / + pp_default + 20 + 0 + opaque + 1 + 0 + 0 + 0 + 1 + 1 diff --git a/e107_plugins/gallery/slideshow_menu.php b/e107_plugins/gallery/slideshow_menu.php index 9870a9126..8e833f477 100644 --- a/e107_plugins/gallery/slideshow_menu.php +++ b/e107_plugins/gallery/slideshow_menu.php @@ -1,100 +1,44 @@ varset($gp['slideshow_effect'], 'scrollHorz'), + 'speed' => varset($gp['slideshow_duration'], 1000), + 'timeout' => varset($gp['slideshow_freq'], 4000), +); - e107::css('gallery', 'gallery_style.css'); - - // Work-around for indent issue. see: https://github.com/twitter/bootstrap/issues/4890 - e107::css('inline', " - -.thumbnails .span2:nth-child(6n+1) { -margin-left:0; -}",'jquery'); - - - - $prettyPhoto = << $settings)); $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($gp); - -?> diff --git a/e107_plugins/gallery/templates/gallery_template.php b/e107_plugins/gallery/templates/gallery_template.php index 337870fc5..6f4c988a3 100644 --- a/e107_plugins/gallery/templates/gallery_template.php +++ b/e107_plugins/gallery/templates/gallery_template.php @@ -1,83 +1,181 @@ - '; - -$GALLERY_TEMPLATE['list_item'] = ' -
-
- {GALLERY_THUMB=w=300&h=200} -
{GALLERY_CAPTION}
+$GALLERY_TEMPLATE['list_start'] = '{GALLERY_BREADCRUMB} +'; +'; -$GALLERY_TEMPLATE['list_end'] = - "
-
- - +$GALLERY_TEMPLATE['list_end'] = ' +
+
+ + -"; - -// Bootstrap3 Compatible. +
+'; +// Bootstrap3 Compatible. $GALLERY_TEMPLATE['cat_caption'] = LAN_PLUGIN_GALLERY_TITLE; -$GALLERY_TEMPLATE['cat_start'] = - '{GALLERY_BREADCRUMB} -