diff --git a/e107_plugins/gallery/admin_gallery.php b/e107_plugins/gallery/admin_gallery.php index 79b37d1b6..6935eabce 100644 --- a/e107_plugins/gallery/admin_gallery.php +++ b/e107_plugins/gallery/admin_gallery.php @@ -14,20 +14,24 @@ * $Author: e107coders $ */ +// TODO: lan +// TODO: prefs for prettyPhoto library, e.g. theme settings + $eplug_admin = true; require_once("../../class2.php"); -if (!getperms("P") || !e107::isInstalled('gallery')) +if(!getperms("P") || !e107::isInstalled('gallery')) { e107::redirect('admin'); - exit() ; + exit(); } - $e_sub_cat = 'gallery'; - +$e_sub_cat = 'gallery'; + class plugin_gallery_admin extends e_admin_dispatcher { + /** * Format: 'MODE' => 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: @@ -36,19 +40,19 @@ class plugin_gallery_admin extends e_admin_dispatcher * - $modes (first key == mode, corresponding 'index' key == action) * @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 @@ -62,10 +66,10 @@ class plugin_gallery_admin extends e_admin_dispatcher * @var array */ protected $adminMenu = array( - // 'main/list' => array('caption'=> LAN_CATEGORY, 'perm' => 'P'), - // 'main/create' => array('caption'=> LAN_CREATE, 'perm' => 'P'), + // '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') ); @@ -76,8 +80,8 @@ class plugin_gallery_admin extends e_admin_dispatcher * @var array */ protected $adminMenuAliases = array( - /// 'main/edit' => 'main/list', - // 'cat/edit' => 'cat/list' + /// 'main/edit' => 'main/list', + // 'cat/edit' => 'cat/list' ); /** @@ -85,137 +89,152 @@ class plugin_gallery_admin extends e_admin_dispatcher * @var string */ protected $menuTitle = 'Gallery'; - + 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 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 $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_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'), + + 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') - ); - - + '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') + ); + public function beforeCreate($new_data) { - $replace = array("_"," ","'",'"',"."); //FIXME Improve - $new_data['media_cat_category'] = strtolower(str_replace($replace,"",$new_data['media_cat_title'])); + $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"; - + $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 $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')), + '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')), + 'orderby' => array( + 'title' => 'Order images by', + 'tab' => 0, + 'type' => 'dropdown', + 'data' => 'str', + 'writeParms' => array( + 'optArray' => array( + 'media_id ASC' => 'Media ID ASC', + 'media_id DESC' => 'Media ID DESC', + 'media_name ASC' => 'Media Name ASC', + 'media_name DESC' => 'Media Name DESC', + 'media_caption ASC' => 'Media Caption ASC', + 'media_caption DESC' => 'Media Caption DESC', + ), + ), + ), ); - - + 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' => '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; + $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"; - + $message = "Gallery is active. Simply import and assign images to the gallery categories using the Media Manager"; + $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) + + 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 @@ -224,47 +243,37 @@ class gallery_cat_admin_form_ui extends e_admin_form_ui { 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..10ef046fb 100644 --- a/e107_plugins/gallery/controllers/index.php +++ b/e107_plugins/gallery/controllers/index.php @@ -66,24 +66,11 @@ class plugin_gallery_index_controller extends eControllerFront 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'); } diff --git a/e107_plugins/gallery/css/gallery.css b/e107_plugins/gallery/css/gallery.css new file mode 100644 index 000000000..c3f9231c7 --- /dev/null +++ b/e107_plugins/gallery/css/gallery.css @@ -0,0 +1,55 @@ + + + +/* IMAGE LIST */ + +ul.gallery > li > div > h5 { text-align: center } +ul.gallery-cat > li > div > h3 { text-align: center } + +/* CATEGORY LIST */ + + + +.lb-dataContainer { padding-top:10px; font-size: 110%;} + +.lb-caption { } + + +/* SLIDESHOW */ + +#gallery-slideshow-wrapper { display:block; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; width: 664px; height: 146px; overflow: hidden; background: #000000; margin-left:auto;margin-right:auto } + +#gallery-slideshow-content { width: 3500px; } + +#gallery-slideshow-content .slide { float: left; width: 679px; padding:12px; height: 146px; white-space:nowrap } + +.gallery-slideshow-controls { clear:both; width: 664px; margin-left:auto; margin-right:auto; padding-top:5px; padding-bottom:10px; } + +.gallery-slide-item { margin-right:8px; display: inline-block; } + +.gallery-slideshow-thumb { -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; } + +.gallery-slideshow-thumb:hover { } + +.gallery-slide-jumper-container { text-align:center; padding-left:250px;} + +.gallery-slide-jumper { padding:3px;} + +.gallery-slide-jumper-selected { font-weight:bold } + + +/* Fix for Bootstrap2 margin-left issue when wrapping */ +.row-fluid .gallery div.span6:nth-child(2n + 3) { margin-left : 0px; } +.row-fluid .gallery div.span4:nth-child(3n + 4) { margin-left : 0px; } +.row-fluid .gallery div.span3:nth-child(4n + 5) { margin-left : 0px; } +.row-fluid .gallery div.span2:nth-child(6n + 7) { margin-left : 0px; } + +.row-fluid .gallery-cat div.span6:nth-child(2n + 3) { margin-left : 0px; } +.row-fluid .gallery-cat div.span4:nth-child(3n + 4) { margin-left : 0px; } +.row-fluid .gallery-cat div.span3:nth-child(4n + 5) { margin-left : 0px; } +.row-fluid .gallery-cat div.span2:nth-child(6n + 7) { margin-left : 0px; } + +/* 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..bc92835f0 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,5 @@ 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 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..7a9805c7d 100644 --- a/e107_plugins/gallery/e_shortcode.php +++ b/e107_plugins/gallery/e_shortcode.php @@ -30,24 +30,8 @@ class gallery_shortcodes extends e_shortcode $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 = <<4000 scrollHorz 12 + media_id DESC diff --git a/e107_plugins/gallery/slideshow_menu.php b/e107_plugins/gallery/slideshow_menu.php index 9870a9126..d74c4a3bd 100644 --- a/e107_plugins/gallery/slideshow_menu.php +++ b/e107_plugins/gallery/slideshow_menu.php @@ -5,96 +5,32 @@ * * Gallery Template */ -if (!defined('e107_INIT')) { exit; } + +if(!defined('e107_INIT')) +{ + exit; +} e107::plugLan('gallery', 'front'); $gp = e107::getPlugPref('gallery'); +e107::library('load', 'jquery.cycle'); +e107::library('load', 'jquery.prettyPhoto'); - e107::js('gallery', 'jslib/prettyPhoto/js/jquery.prettyPhoto.js','jquery'); +e107::css('gallery', 'css/gallery.css'); +e107::js('gallery', 'js/gallery.js'); +e107::js('gallery', 'js/gallery.cycle.js'); - e107::css('gallery', 'jslib/prettyPhoto/css/prettyPhoto.css','jquery'); - - - 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 = << varset($gp['slideshow_effect'], 'scrollHorz'), + 'speed' => varset($gp['slideshow_duration'], 1000), + 'timeout' => varset($gp['slideshow_freq'], 4000), +); +e107::js('settings', array('gallery' => $settings)); $text = e107::getParser()->parseTemplate("{GALLERY_SLIDESHOW}"); -e107::getRender()->tablerender("Gallery",$text,'gallery_slideshow'); +e107::getRender()->tablerender("Gallery", $text, 'gallery_slideshow'); unset($text); unset($gp); - -?>