mirror of
https://github.com/e107inc/e107.git
synced 2025-08-07 07:06:30 +02:00
Use Library Manager to load libraries. Use JS behaviors. Add "Order images by" pref.
This commit is contained in:
@@ -14,6 +14,9 @@
|
|||||||
* $Author: e107coders $
|
* $Author: e107coders $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// TODO: lan
|
||||||
|
// TODO: prefs for prettyPhoto library, e.g. theme settings
|
||||||
|
|
||||||
$eplug_admin = true;
|
$eplug_admin = true;
|
||||||
|
|
||||||
require_once("../../class2.php");
|
require_once("../../class2.php");
|
||||||
@@ -28,6 +31,7 @@ if (!getperms("P") || !e107::isInstalled('gallery'))
|
|||||||
|
|
||||||
class plugin_gallery_admin extends e_admin_dispatcher
|
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']);
|
* 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:
|
* Note - default mode/action is autodetected in this order:
|
||||||
@@ -98,6 +102,7 @@ class plugin_gallery_admin extends e_admin_dispatcher
|
|||||||
|
|
||||||
class gallery_cat_admin_ui extends e_admin_ui
|
class gallery_cat_admin_ui extends e_admin_ui
|
||||||
{
|
{
|
||||||
|
|
||||||
protected $pluginTitle = 'Gallery Categories';
|
protected $pluginTitle = 'Gallery Categories';
|
||||||
protected $pluginName = 'gallery';
|
protected $pluginName = 'gallery';
|
||||||
protected $table = "core_media_cat";
|
protected $table = "core_media_cat";
|
||||||
@@ -111,21 +116,20 @@ class gallery_cat_admin_ui extends e_admin_ui
|
|||||||
// protected $editQry = "SELECT * FROM #faq_info WHERE faq_info_id = {ID}";
|
// protected $editQry = "SELECT * FROM #faq_info WHERE faq_info_id = {ID}";
|
||||||
|
|
||||||
protected $fields = array(
|
protected $fields = array(
|
||||||
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
|
'checkboxes' => array('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_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_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_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_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_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_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_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_class' => array('title' => LAN_VISIBILITY, 'type' => 'userclass', 'width' => 'auto', 'data' => 'int', 'filter' => true, 'batch' => true),
|
||||||
'media_cat_order' => array('title' => LAN_ORDER, 'type' => 'text', 'width' => 'auto', 'thclass' => 'center', 'class' => 'center'),
|
'media_cat_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')
|
'options' => array('title' => LAN_OPTIONS, 'type' => null, 'width' => '5%', 'forced' => true, 'thclass' => 'center last', 'class' => 'right')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function beforeCreate($new_data)
|
public function beforeCreate($new_data)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -163,10 +167,25 @@ class gallery_cat_admin_ui extends e_admin_ui
|
|||||||
'slideshow_effect' => array('title' => 'Slide effect', 'type' => 'dropdown', 'tab' => 1, 'data' => 'str', 'help' => 'Type of effect. '), //
|
'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. ') //
|
// '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')),
|
'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()
|
function init()
|
||||||
{
|
{
|
||||||
$effects = array(
|
$effects = array(
|
||||||
@@ -181,7 +200,6 @@ class gallery_cat_admin_ui extends e_admin_ui
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->prefs['slideshow_effect']['writeParms'] = $effects;
|
$this->prefs['slideshow_effect']['writeParms'] = $effects;
|
||||||
$this->prefs['slideshow_effect']['readParms'] = $effects;
|
$this->prefs['slideshow_effect']['readParms'] = $effects;
|
||||||
//
|
//
|
||||||
@@ -210,6 +228,7 @@ class gallery_cat_admin_ui extends e_admin_ui
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class gallery_cat_admin_form_ui extends e_admin_form_ui
|
class gallery_cat_admin_form_ui extends e_admin_form_ui
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -239,24 +258,17 @@ class gallery_cat_admin_form_ui extends e_admin_form_ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class gallery_main_admin_ui extends e_admin_ui
|
class gallery_main_admin_ui extends e_admin_ui
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class gallery_main_admin_form_ui extends e_admin_form_ui
|
class gallery_main_admin_form_ui extends e_admin_form_ui
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -265,6 +277,3 @@ class gallery_main_admin_form_ui extends e_admin_form_ui
|
|||||||
e107::getAdminUI()->runPage(); //gallery/includes/admin.php is auto-loaded.
|
e107::getAdminUI()->runPage(); //gallery/includes/admin.php is auto-loaded.
|
||||||
require_once(e_ADMIN . "footer.php");
|
require_once(e_ADMIN . "footer.php");
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
@@ -66,24 +66,11 @@ class plugin_gallery_index_controller extends eControllerFront
|
|||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
e107::plugLan('gallery', 'front');
|
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 = <<<JS
|
e107::library('load', 'jquery.prettyPhoto');
|
||||||
$(document).ready(function(){
|
e107::css('gallery', 'css/gallery.css');
|
||||||
$("a[data-gal^='prettyPhoto']").prettyPhoto(
|
e107::js('gallery', 'js/gallery.js');
|
||||||
{
|
|
||||||
hook: 'data-gal',
|
|
||||||
theme: 'pp_default',
|
|
||||||
overlay_gallery: false,
|
|
||||||
deeplinking: false
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
JS;
|
|
||||||
|
|
||||||
e107::js('footer-inline',$prettyPhoto,'jquery');
|
|
||||||
$this->catList = e107::getMedia()->getCategories('gallery');
|
$this->catList = e107::getMedia()->getCategories('gallery');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
55
e107_plugins/gallery/css/gallery.css
Normal file
55
e107_plugins/gallery/css/gallery.css
Normal file
@@ -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;
|
||||||
|
}
|
@@ -5,13 +5,11 @@
|
|||||||
*
|
*
|
||||||
* Featurebox shortcode batch class - shortcodes available site-wide. ie. equivalent to multiple .sc files.
|
* Featurebox shortcode batch class - shortcodes available site-wide. ie. equivalent to multiple .sc files.
|
||||||
*/
|
*/
|
||||||
if (!defined('e107_INIT')) { exit; }
|
|
||||||
|
|
||||||
//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)
|
if(USER_AREA)
|
||||||
{
|
{
|
||||||
@@ -21,42 +19,4 @@ if(USER_AREA)
|
|||||||
.thumbnails .span2:nth-child(6n+1) {
|
.thumbnails .span2:nth-child(6n+1) {
|
||||||
margin-left:0;
|
margin-left:0;
|
||||||
}", 'jquery');
|
}", '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 = <<<JS
|
|
||||||
$(document).ready(function(){
|
|
||||||
$("a[data-gal^='prettyPhoto']").prettyPhoto(
|
|
||||||
{
|
|
||||||
hook: 'data-gal',
|
|
||||||
theme: 'pp_default',
|
|
||||||
overlay_gallery: false,
|
|
||||||
deeplinking: false
|
|
||||||
}
|
}
|
||||||
);
|
|
||||||
});
|
|
||||||
JS;
|
|
||||||
|
|
||||||
e107::js('footer-inline',$prettyPhoto,'jquery');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
unset($gp);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
162
e107_plugins/gallery/e_library.php
Normal file
162
e107_plugins/gallery/e_library.php
Normal file
@@ -0,0 +1,162 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* Provides information about external libraries.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class PLUGIN_library.
|
||||||
|
*/
|
||||||
|
class gallery_library
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return information about external libraries.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* An associative array whose keys are internal names of libraries and whose values are describing each library.
|
||||||
|
* Each key is the directory name below the '{e_WEB}/lib' directory, in which the library may be found. Each
|
||||||
|
* value is an associative array containing:
|
||||||
|
* - name: The official, human-readable name of the library.
|
||||||
|
* - vendor_url: The URL of the homepage of the library.
|
||||||
|
* - download_url: The URL of a web page on which the library can be obtained.
|
||||||
|
* - path: (optional) A relative path from the directory of the library to the actual library. Only required if
|
||||||
|
* the extracted download package contains the actual library files in a sub-directory.
|
||||||
|
* - library_path: (optional) The absolute path to the library directory. This should not be declared normally, as
|
||||||
|
* it is automatically detected, to allow for multiple possible library locations. A valid use-case is an
|
||||||
|
* external library, in which case the full URL to the library should be specified here.
|
||||||
|
* - version: (optional) The version of the library. This should not be declared normally, as it is automatically
|
||||||
|
* detected (see 'version_callback' below) to allow for version changes of libraries without code changes of
|
||||||
|
* implementing plugins and to support different versions of a library simultaneously. A valid use-case is an
|
||||||
|
* external library whose version cannot be determined programmatically. Either 'version' or 'version_callback'
|
||||||
|
* (or 'version_arguments' in case libraryGetVersion() is being used as a version callback) must be declared.
|
||||||
|
* - version_callback: (optional) The name of a function that detects and returns the full version string of the
|
||||||
|
* library. The first argument is always $library, an array containing all library information as described here.
|
||||||
|
* There are two ways to declare the version 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
|
||||||
|
* 'version_arguments'). Defaults to libraryGetVersion(). Unless 'version' is declared or libraryGetVersion()
|
||||||
|
* is being used as a version callback, 'version_callback' must be declared. In the latter case, however,
|
||||||
|
* 'version_arguments' must be declared in the specified way.
|
||||||
|
* - version_arguments: (optional) A list of arguments to pass to the version callback. Version 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 version 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 version callback as separate
|
||||||
|
* arguments in the order they were declared. The default version callback libraryGetVersion() expects a
|
||||||
|
* single, associative array with named keys:
|
||||||
|
* - file: The filename to parse for the version, relative to the path specified as the 'library_path' property
|
||||||
|
* (see above). For example: 'docs/changelog.txt'.
|
||||||
|
* - pattern: A string containing a regular expression (PCRE) to match the library version. For example:
|
||||||
|
* '@version\s+([0-9a-zA-Z\.-]+)@'. Note that the returned version is not the match of the entire pattern
|
||||||
|
* (i.e. '@version 1.2.3' in the above example) but the match of the first sub-pattern (i.e. '1.2.3' in the
|
||||||
|
* above example).
|
||||||
|
* - lines: (optional) The maximum number of lines to search the pattern in. Defaults to 20.
|
||||||
|
* - cols: (optional) The maximum number of characters per line to take into account. Defaults to 200. In case
|
||||||
|
* of minified or compressed files, this prevents reading the entire file into memory.
|
||||||
|
* Defaults to an empty array. 'version_arguments' must be specified unless 'version' is declared or the
|
||||||
|
* specified 'version_callback' does not require any arguments. The latter might be the case with a
|
||||||
|
* library-specific version callback, for example.
|
||||||
|
* - files: An associative array of library files to load. Supported keys are:
|
||||||
|
* - js: A list of JavaScript files to load.
|
||||||
|
* - css: A list of CSS files to load.
|
||||||
|
* - php: A list of PHP files to load.
|
||||||
|
* - dependencies: An array of libraries this library depends on. Similar to declaring plugin dependencies, the
|
||||||
|
* dependency declaration may contain information on the supported version. Examples of supported declarations:
|
||||||
|
* @code
|
||||||
|
* $library['dependencies'] = array(
|
||||||
|
* // Load the 'example' library, regardless of the version available:
|
||||||
|
* 'example',
|
||||||
|
* // Only load the 'example' library, if version 1.2 is available:
|
||||||
|
* 'example (1.2)',
|
||||||
|
* // Only load a version later than 1.3-beta2 of the 'example' library:
|
||||||
|
* 'example (>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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -30,24 +30,8 @@ class gallery_shortcodes extends e_shortcode
|
|||||||
$pop_h = vartrue($prefH, 768);
|
$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';
|
$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::library('load', 'jquery.prettyPhoto');
|
||||||
e107::css('gallery', 'jslib/prettyPhoto/css/prettyPhoto.css','jquery');
|
e107::js('gallery', 'js/gallery.js');
|
||||||
|
|
||||||
|
|
||||||
$prettyPhoto = <<<JS
|
|
||||||
$(document).ready(function(){
|
|
||||||
$("a[data-gal^='prettyPhoto']").prettyPhoto(
|
|
||||||
{
|
|
||||||
hook: 'data-gal',
|
|
||||||
theme: 'pp_default',
|
|
||||||
overlay_gallery: false,
|
|
||||||
deeplinking: false
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
JS;
|
|
||||||
|
|
||||||
e107::js('footer-inline',$prettyPhoto,'jquery');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function sc_gallery_caption($parm='')
|
function sc_gallery_caption($parm='')
|
||||||
|
@@ -21,47 +21,21 @@
|
|||||||
* Ultra-simple Image-Gallery
|
* Ultra-simple Image-Gallery
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
require_once("../../class2.php");
|
require_once("../../class2.php");
|
||||||
|
|
||||||
if (!e107::isInstalled('gallery'))
|
if (!e107::isInstalled('gallery'))
|
||||||
{
|
{
|
||||||
e107::redirect();
|
e107::redirect();
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e107::library('load', 'jquery.prettyPhoto');
|
||||||
e107::js('gallery', 'jslib/prettyPhoto/js/jquery.prettyPhoto.js','jquery');
|
e107::css('gallery', 'css/gallery.css');
|
||||||
e107::css('gallery', 'jslib/prettyPhoto/css/prettyPhoto.css','jquery');
|
e107::js('gallery', 'js/gallery.js');
|
||||||
e107::css('gallery', 'gallery_style.css');
|
|
||||||
|
|
||||||
// Work-around for indent issue. see: https://github.com/twitter/bootstrap/issues/4890
|
|
||||||
e107::css('inline', "
|
|
||||||
/* Gallery CSS */
|
|
||||||
.thumbnails .span2:nth-child(6n+1) {
|
|
||||||
margin-left:0;
|
|
||||||
}",'jquery');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$prettyPhoto = <<<JS
|
|
||||||
$(document).ready(function(){
|
|
||||||
$("a[data-gal^='prettyPhoto']").prettyPhoto(
|
|
||||||
{
|
|
||||||
hook: 'data-gal',
|
|
||||||
theme: 'pp_default', /* pp_default , light_rounded , dark_rounded , light_square , dark_square ,facebook */
|
|
||||||
overlay_gallery: false,
|
|
||||||
deeplinking: false
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
JS;
|
|
||||||
|
|
||||||
e107::js('inline',$prettyPhoto,'jquery');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
require_once(HEADERF);
|
require_once(HEADERF);
|
||||||
|
|
||||||
|
|
||||||
class gallery
|
class gallery
|
||||||
{
|
{
|
||||||
private $catList = array();
|
private $catList = array();
|
||||||
|
49
e107_plugins/gallery/js/gallery.cycle.js
Normal file
49
e107_plugins/gallery/js/gallery.cycle.js
Normal file
@@ -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);
|
28
e107_plugins/gallery/js/gallery.js
Normal file
28
e107_plugins/gallery/js/gallery.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||||
|
|
||||||
|
(function ($)
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Behavior to initialize prettyPhoto on gallery elements.
|
||||||
|
*
|
||||||
|
* @type {{attach: Function}}
|
||||||
|
*/
|
||||||
|
e107.behaviors.gallery = {
|
||||||
|
attach: function (context, settings)
|
||||||
|
{
|
||||||
|
$(context).find("a[data-gal^='prettyPhoto']").once('gallery-prettyPhoto').each(function ()
|
||||||
|
{
|
||||||
|
$(this).prettyPhoto(
|
||||||
|
{
|
||||||
|
hook: 'data-gal',
|
||||||
|
theme: 'pp_default', /* pp_default , light_rounded , dark_rounded , light_square , dark_square ,facebook */
|
||||||
|
overlay_gallery: false,
|
||||||
|
deeplinking: false
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
})(jQuery);
|
@@ -23,5 +23,6 @@
|
|||||||
<pref name="slideshow_freq">4000</pref>
|
<pref name="slideshow_freq">4000</pref>
|
||||||
<pref name="slideshow_effect">scrollHorz</pref>
|
<pref name="slideshow_effect">scrollHorz</pref>
|
||||||
<pref name="perpage">12</pref>
|
<pref name="perpage">12</pref>
|
||||||
|
<pref name="orderby">media_id DESC</pref>
|
||||||
</pluginPrefs>
|
</pluginPrefs>
|
||||||
</e107Plugin>
|
</e107Plugin>
|
||||||
|
@@ -5,96 +5,32 @@
|
|||||||
*
|
*
|
||||||
* Gallery Template
|
* Gallery Template
|
||||||
*/
|
*/
|
||||||
if (!defined('e107_INIT')) { exit; }
|
|
||||||
|
if(!defined('e107_INIT'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
e107::plugLan('gallery', 'front');
|
e107::plugLan('gallery', 'front');
|
||||||
|
|
||||||
$gp = e107::getPlugPref('gallery');
|
$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');
|
$settings = array(
|
||||||
|
'fx' => varset($gp['slideshow_effect'], 'scrollHorz'),
|
||||||
|
'speed' => varset($gp['slideshow_duration'], 1000),
|
||||||
e107::css('gallery', 'gallery_style.css');
|
'timeout' => varset($gp['slideshow_freq'], 4000),
|
||||||
|
|
||||||
// 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 = <<<JS
|
|
||||||
$(document).ready(function(){
|
|
||||||
$("a[data-gal^='prettyPhoto']").prettyPhoto(
|
|
||||||
{
|
|
||||||
hook: 'data-gal',
|
|
||||||
theme: 'pp_default',
|
|
||||||
overlay_gallery: false,
|
|
||||||
deeplinking: false
|
|
||||||
}
|
|
||||||
);
|
);
|
||||||
});
|
|
||||||
JS;
|
|
||||||
|
|
||||||
e107::js('footer-inline',$prettyPhoto,'jquery');
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
e107::js('gallery', 'jslib/jquery.cycle.all.js','jquery');
|
|
||||||
e107::js('footer-inline',"
|
|
||||||
|
|
||||||
$(document).ready(function()
|
|
||||||
{
|
|
||||||
|
|
||||||
$('#gallery-slideshow-content').cycle({
|
|
||||||
fx: '".varset($gp['slideshow_effect'],'scrollHorz')."',
|
|
||||||
next: '.gal-next',
|
|
||||||
prev: '.gal-prev',
|
|
||||||
speed: ".varset($gp['slideshow_duration'],1000).", // speed of the transition (any valid fx speed value)
|
|
||||||
timeout: ".varset($gp['slideshow_freq'],4000).",
|
|
||||||
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');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('.gallery-slide-jumper').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;
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#img.lb-close').on('live', function(e) {
|
|
||||||
$(this).attr('src','".e_PLUGIN."gallery/jslib/lightbox/images/close.png');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
");
|
|
||||||
|
|
||||||
|
e107::js('settings', array('gallery' => $settings));
|
||||||
|
|
||||||
$text = e107::getParser()->parseTemplate("{GALLERY_SLIDESHOW}");
|
$text = e107::getParser()->parseTemplate("{GALLERY_SLIDESHOW}");
|
||||||
e107::getRender()->tablerender("Gallery", $text, 'gallery_slideshow');
|
e107::getRender()->tablerender("Gallery", $text, 'gallery_slideshow');
|
||||||
unset($text);
|
unset($text);
|
||||||
unset($gp);
|
unset($gp);
|
||||||
|
|
||||||
?>
|
|
||||||
|
Reference in New Issue
Block a user