diff --git a/LICENSE b/LICENSE index 165a91a..9caad08 100644 --- a/LICENSE +++ b/LICENSE @@ -1,19 +1,4 @@ -Copyright (c) 2012-2014 MADE/YOUR/DAY +Copyright (c) 2012-2015 MADE/YOUR/DAY -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +German License: http://rocksolidthemes.com/de/contao/lizenzbedigungen +English License: http://rocksolidthemes.com/en/contao/license diff --git a/README.md b/README.md index 0c4285a..908edf6 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,8 @@ More information: * English: http://rocksolidthemes.com/en/contao/plugins/responsive-slider * German: http://rocksolidthemes.com/de/contao/plugins/responsive-slider + +## License + +* English: http://rocksolidthemes.com/en/contao/license +* German: http://rocksolidthemes.com/de/contao/lizenzbedigungen diff --git a/composer.json b/composer.json index 58dd7dd..514b2a3 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "keywords":["contao","slider","jquery"], "type":"contao-module", "homepage":"http://rocksolidthemes.com/de/contao/plugins/responsive-slider", - "license":"MIT", + "license":"commercial", "authors":[ { "name":"RockSolid Themes", @@ -20,13 +20,14 @@ "require":{ "php":">=5.3", "contao/core":">=3,<4", - "contao-community-alliance/composer-installer":"*" + "contao-community-alliance/composer-plugin":"~2.0" }, "autoload":{ "classmap":["src/"] }, "replace":{ - "contao-legacy/rocksolid-slider":"self.version" + "contao-legacy/rocksolid-slider":"self.version", + "contao-legacy/rocksolid-slider-pro":"self.version" }, "extra":{ "contao":{ diff --git a/config/autoload.php b/config/autoload.php index 1be3beb..f1b5010 100644 --- a/config/autoload.php +++ b/config/autoload.php @@ -16,6 +16,8 @@ 'MadeYourDay\\Contao\\Slider' => 'system/modules/rocksolid-slider/src/MadeYourDay/Contao/Slider.php', 'MadeYourDay\\Contao\\SliderRunonce' => 'system/modules/rocksolid-slider/src/MadeYourDay/Contao/SliderRunonce.php', 'MadeYourDay\\Contao\\Module\\Slider' => 'system/modules/rocksolid-slider/src/MadeYourDay/Contao/Module/Slider.php', + 'MadeYourDay\\Contao\\Module\\SliderNews' => 'system/modules/rocksolid-slider/src/MadeYourDay/Contao/Module/SliderNews.php', + 'MadeYourDay\\Contao\\Module\\SliderEvents' => 'system/modules/rocksolid-slider/src/MadeYourDay/Contao/Module/SliderEvents.php', 'MadeYourDay\\Contao\\Model\\SlideModel' => 'system/modules/rocksolid-slider/src/MadeYourDay/Contao/Model/SlideModel.php', 'MadeYourDay\\Contao\\Model\\SliderModel' => 'system/modules/rocksolid-slider/src/MadeYourDay/Contao/Model/SliderModel.php', 'MadeYourDay\\Contao\\Model\\ContentModel' => 'system/modules/rocksolid-slider/src/MadeYourDay/Contao/Model/ContentModel.php', diff --git a/config/config.php b/config/config.php index 2d0328d..533de5e 100644 --- a/config/config.php +++ b/config/config.php @@ -18,7 +18,12 @@ $GLOBALS['TL_CTE']['includes']['rocksolid_slider'] = 'MadeYourDay\\Contao\\Module\\Slider'; $GLOBALS['BE_MOD']['content']['rocksolid_slider'] = array( - 'tables' => array('tl_rocksolid_slider', 'tl_rocksolid_slide', 'tl_content'), + 'tables' => array( + 'tl_rocksolid_slider', + 'tl_rocksolid_slide', + 'tl_content', + 'tl_rocksolid_slider_license', + ), 'icon' => 'system/modules/rocksolid-slider/assets/img/icon.png', ); diff --git a/dca/tl_content.php b/dca/tl_content.php index 6e51762..7979626 100644 --- a/dca/tl_content.php +++ b/dca/tl_content.php @@ -24,14 +24,36 @@ } -$GLOBALS['TL_DCA']['tl_content']['palettes']['rocksolid_slider'] = '{type_legend},type,headline;{rocksolid_slider_legend},rsts_id,rsts_type,rsts_random,rsts_loop,rsts_centerContent,rsts_skin,rsts_width,rsts_height,rsts_preloadSlides,rsts_gapSize,rsts_duration,rsts_captions,rsts_scaleMode,rsts_imagePosition;{rsts_navigation_legend},rsts_navType,rsts_deepLinkPrefix,rsts_controls,rsts_keyboard;{rsts_autoplay_legend},rsts_autoplay,rsts_autoplayRestart,rsts_autoplayProgress,rsts_pauseAutoplayOnHover,rsts_videoAutoplay;{rsts_carousel_legend},rsts_getPro;{template_legend:hide},rsts_template,size;{protected_legend:hide},protected;{expert_legend:hide},guests,rsts_customSkin,rsts_cssPrefix,cssID,space;{invisible_legend:hide},invisible,start,stop'; +$GLOBALS['TL_DCA']['tl_content']['config']['onload_callback'][] = array('MadeYourDay\\Contao\\Slider', 'contentOnloadCallback'); +$GLOBALS['TL_DCA']['tl_content']['palettes']['__selector__'][] = 'rsts_content_type'; +$GLOBALS['TL_DCA']['tl_content']['palettes']['rocksolid_slider'] = '{type_legend},type,headline,rsts_content_type'; +$GLOBALS['TL_DCA']['tl_content']['palettes']['rocksolid_sliderrsts_default'] = '{type_legend},type,headline,rsts_content_type;{rocksolid_slider_legend},rsts_id,rsts_type,rsts_direction,rsts_random,rsts_loop,rsts_centerContent,rsts_skin,rsts_width,rsts_height,rsts_preloadSlides,rsts_gapSize,rsts_duration,rsts_captions,rsts_scaleMode,rsts_imagePosition;{rsts_navigation_legend},rsts_navType,rsts_deepLinkPrefix,rsts_controls,rsts_keyboard,rsts_invertControls;{rsts_autoplay_legend},rsts_autoplay,rsts_autoplayRestart,rsts_autoplayProgress,rsts_pauseAutoplayOnHover,rsts_videoAutoplay;{rsts_carousel_legend},rsts_slideMaxCount,rsts_prevNextSteps,rsts_slideMinSize,rsts_combineNavItems,rsts_visibleArea,rsts_visibleAreaMax;{template_legend:hide},rsts_template,size;{protected_legend:hide},protected;{expert_legend:hide},guests,rsts_customSkin,rsts_cssPrefix,cssID,space;{invisible_legend:hide},invisible,start,stop'; +$GLOBALS['TL_DCA']['tl_content']['palettes']['rocksolid_sliderrsts_images'] = '{type_legend},type,headline,rsts_content_type;{source_legend:hide},multiSRC;{rocksolid_slider_legend},rsts_type,rsts_direction,rsts_random,rsts_loop,rsts_centerContent,rsts_skin,rsts_width,rsts_height,rsts_preloadSlides,rsts_gapSize,rsts_duration,rsts_captions,rsts_scaleMode,rsts_imagePosition;{rsts_navigation_legend},rsts_navType,rsts_deepLinkPrefix,rsts_controls,rsts_keyboard,rsts_invertControls;{rsts_autoplay_legend},rsts_autoplay,rsts_autoplayRestart,rsts_autoplayProgress,rsts_pauseAutoplayOnHover,rsts_videoAutoplay;{rsts_carousel_legend},rsts_slideMaxCount,rsts_prevNextSteps,rsts_slideMinSize,rsts_combineNavItems,rsts_visibleArea,rsts_visibleAreaMax;{template_legend:hide},rsts_template,size;{protected_legend:hide},protected;{expert_legend:hide},guests,rsts_customSkin,rsts_cssPrefix,cssID,space;{invisible_legend:hide},invisible,start,stop'; + +$GLOBALS['TL_DCA']['tl_content']['fields']['rsts_content_type'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_content_type'], + 'default' => 'rsts_default', + 'exclude' => true, + 'inputType' => 'select', + 'options' => array('rsts_default', 'rsts_images'), + 'reference' => &$GLOBALS['TL_LANG']['tl_module']['rsts_content_types'], + 'eval' => array( + 'mandatory' => true, + 'submitOnChange' => true, + 'tl_class' => 'w50', + ), + 'sql' => "varchar(64) NOT NULL default 'rsts_default'", +); $GLOBALS['TL_DCA']['tl_content']['fields']['rsts_id'] = array( 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_id'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => array('MadeYourDay\\Contao\\Slider', 'getSliderIds'), - 'eval' => array('mandatory' => true), + 'eval' => array( + 'includeBlankOption' => true, + 'mandatory' => true, + ), 'sql' => "int(10) unsigned NOT NULL default '0'", ); $GLOBALS['TL_DCA']['tl_content']['fields']['rsts_template'] = array( @@ -41,18 +63,27 @@ 'inputType' => 'select', 'options_callback' => array('MadeYourDay\\Contao\\Slider', 'getSliderTemplates'), 'eval' => array('tl_class' => 'w50'), - 'sql' => "varchar(32) NOT NULL default ''", + 'sql' => "varchar(32) NOT NULL default 'rsts_default'", ); -// slider type (slide or fade) +// slider type (slide, side-slide or fade) $GLOBALS['TL_DCA']['tl_content']['fields']['rsts_type'] = array( 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_type'], 'exclude' => true, 'inputType' => 'select', - 'options' => array('slide' => 'slide', 'fade' => 'fade'), + 'options' => array('slide' => 'slide', 'side-slide' => 'side-slide', 'fade' => 'fade'), + 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''", ); -// For backwards compatibility +// "x" for horizontal or "y" for vertical $GLOBALS['TL_DCA']['tl_content']['fields']['rsts_direction'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_direction'], + 'exclude' => true, + 'inputType' => 'select', + 'options' => array( + 'x' => $GLOBALS['TL_LANG']['tl_module']['rsts_direction_x'], + 'y' => $GLOBALS['TL_LANG']['tl_module']['rsts_direction_y'], + ), + 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''", ); // if true the slides get shuffled once on initialization @@ -109,6 +140,7 @@ // - a css lenght value: e.g. "100%", "500px", "50em" // - "auto": get the size from the active slide dimensions at runtime // height can be set to auto only if the direction is "x" +// - "normalize": similar to auto but uses the size of the largest slide // - a proportion: keep a fixed proportion for the slides, e.g. "480x270" // this must not set to both dimensions $GLOBALS['TL_DCA']['tl_content']['fields']['rsts_width'] = array( @@ -213,6 +245,14 @@ 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default '1'", ); +// Adds data-rsts-class="rsts-invert-controls" to all slides +$GLOBALS['TL_DCA']['tl_content']['fields']['rsts_invertControls'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_invertControls'], + 'exclude' => true, + 'inputType' => 'checkbox', + 'eval' => array('tl_class' => 'w50'), + 'sql' => "char(1) NOT NULL default ''", +); // image scale mode (fit, crop, scale) // only works if width and height are not set to "auto" $GLOBALS['TL_DCA']['tl_content']['fields']['rsts_scaleMode'] = array( @@ -263,13 +303,55 @@ 'eval' => array('tl_class' => 'w50 m12'), 'sql' => "char(1) NOT NULL default '1'", ); -// get pro version -$GLOBALS['TL_DCA']['tl_module']['fields']['rsts_getPro'] = array( - 'input_field_callback' => function() { - return '
' - . $GLOBALS['TL_LANG']['tl_module']['rsts_getPro'] - . '
'; - }, +// maximum number of visible slides +$GLOBALS['TL_DCA']['tl_content']['fields']['rsts_slideMaxCount'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_slideMaxCount'], + 'exclude' => true, + 'inputType' => 'select', + 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20), + 'eval' => array('tl_class' => 'w50', 'includeBlankOption' => true), + 'sql' => "int(10) unsigned NOT NULL default '0'", +); +// number of slides to navigate by clicking prev or next +$GLOBALS['TL_DCA']['tl_content']['fields']['rsts_prevNextSteps'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_prevNextSteps'], + 'exclude' => true, + 'inputType' => 'select', + 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20), + 'eval' => array('tl_class' => 'w50', 'includeBlankOption' => true), + 'sql' => "int(10) unsigned NOT NULL default '0'", +); +// the size of the area for the visible slide (0 = 0%, 1 = 100%) +$GLOBALS['TL_DCA']['tl_content']['fields']['rsts_visibleArea'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_visibleArea'], + 'exclude' => true, + 'inputType' => 'text', + 'eval' => array('tl_class' => 'w50 clr'), + 'sql' => "double unsigned NOT NULL default '0'", +); +// maximum size of the area for the visible slide in px +$GLOBALS['TL_DCA']['tl_content']['fields']['rsts_visibleAreaMax'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_visibleAreaMax'], + 'exclude' => true, + 'inputType' => 'text', + 'eval' => array('tl_class' => 'w50'), + 'sql' => "double unsigned NOT NULL default '0'", +); +// minimal size of one slide in px +$GLOBALS['TL_DCA']['tl_content']['fields']['rsts_slideMinSize'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_slideMinSize'], + 'exclude' => true, + 'inputType' => 'text', + 'eval' => array('tl_class' => 'w50'), + 'sql' => "int(10) unsigned NOT NULL default '0'", +); +// combine navigation items if multiple slides are visible (default true) +$GLOBALS['TL_DCA']['tl_content']['fields']['rsts_combineNavItems'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_combineNavItems'], + 'exclude' => true, + 'inputType' => 'checkbox', + 'eval' => array('tl_class' => 'w50 m12'), + 'sql' => "char(1) NOT NULL default '1'", ); // custom slider skin (rsts_skin gets ignored if this is set) $GLOBALS['TL_DCA']['tl_content']['fields']['rsts_customSkin'] = array( diff --git a/dca/tl_module.php b/dca/tl_module.php index 1dd2252..e2cdbad 100644 --- a/dca/tl_module.php +++ b/dca/tl_module.php @@ -12,14 +12,45 @@ * @author Martin Auswöger */ -$GLOBALS['TL_DCA']['tl_module']['palettes']['rocksolid_slider'] = '{title_legend},name,headline,type;{config_legend},rsts_id,rsts_type,rsts_random,rsts_loop,rsts_centerContent,rsts_skin,rsts_width,rsts_height,rsts_preloadSlides,rsts_gapSize,rsts_duration,rsts_captions,rsts_scaleMode,rsts_imagePosition;{rsts_navigation_legend},rsts_navType,rsts_deepLinkPrefix,rsts_controls,rsts_keyboard;{rsts_autoplay_legend},rsts_autoplay,rsts_autoplayRestart,rsts_autoplayProgress,rsts_pauseAutoplayOnHover,rsts_videoAutoplay;{rsts_carousel_legend},rsts_getPro;{template_legend:hide},rsts_template,imgSize;{expert_legend:hide},rsts_customSkin,rsts_cssPrefix,cssID,space'; +$GLOBALS['TL_DCA']['tl_module']['config']['onload_callback'][] = array('MadeYourDay\\Contao\\Slider', 'moduleOnloadCallback'); +$GLOBALS['TL_DCA']['tl_module']['palettes']['__selector__'][] = 'rsts_content_type'; +$GLOBALS['TL_DCA']['tl_module']['palettes']['rocksolid_slider'] = '{title_legend},name,headline,type,rsts_content_type'; +$GLOBALS['TL_DCA']['tl_module']['palettes']['rocksolid_sliderrsts_default'] = '{title_legend},name,headline,type,rsts_content_type;{config_legend},rsts_id,rsts_type,rsts_direction,rsts_random,rsts_loop,rsts_centerContent,rsts_skin,rsts_width,rsts_height,rsts_preloadSlides,rsts_gapSize,rsts_duration,rsts_captions,rsts_scaleMode,rsts_imagePosition;{rsts_navigation_legend},rsts_navType,rsts_deepLinkPrefix,rsts_controls,rsts_keyboard,rsts_invertControls;{rsts_autoplay_legend},rsts_autoplay,rsts_autoplayRestart,rsts_autoplayProgress,rsts_pauseAutoplayOnHover,rsts_videoAutoplay;{rsts_carousel_legend},rsts_slideMaxCount,rsts_prevNextSteps,rsts_slideMinSize,rsts_combineNavItems,rsts_visibleArea,rsts_visibleAreaMax;{template_legend:hide},rsts_template,imgSize;{expert_legend:hide},rsts_customSkin,rsts_cssPrefix,cssID,space'; +$GLOBALS['TL_DCA']['tl_module']['palettes']['rocksolid_sliderrsts_news'] = '{title_legend},name,headline,type,rsts_content_type;{rsts_news_legend},news_archives,numberOfItems,news_featured,skipFirst,news_template,news_metaFields;{config_legend},rsts_type,rsts_direction,rsts_random,rsts_loop,rsts_centerContent,rsts_skin,rsts_width,rsts_height,rsts_preloadSlides,rsts_gapSize,rsts_duration,rsts_captions,rsts_scaleMode,rsts_imagePosition;{rsts_navigation_legend},rsts_navType,rsts_deepLinkPrefix,rsts_controls,rsts_keyboard,rsts_invertControls;{rsts_autoplay_legend},rsts_autoplay,rsts_autoplayRestart,rsts_autoplayProgress,rsts_pauseAutoplayOnHover,rsts_videoAutoplay;{rsts_carousel_legend},rsts_slideMaxCount,rsts_prevNextSteps,rsts_slideMinSize,rsts_combineNavItems,rsts_visibleArea,rsts_visibleAreaMax;{template_legend:hide},rsts_template,imgSize;{expert_legend:hide},rsts_customSkin,rsts_cssPrefix,cssID,space'; +$GLOBALS['TL_DCA']['tl_module']['palettes']['rocksolid_sliderrsts_events'] = '{title_legend},name,headline,type,rsts_content_type;{rsts_events_legend},cal_calendar,cal_noSpan,cal_format,cal_ignoreDynamic,cal_order,cal_readerModule,cal_limit,cal_template;{config_legend},rsts_type,rsts_direction,rsts_random,rsts_loop,rsts_centerContent,rsts_skin,rsts_width,rsts_height,rsts_preloadSlides,rsts_gapSize,rsts_duration,rsts_captions,rsts_scaleMode,rsts_imagePosition;{rsts_navigation_legend},rsts_navType,rsts_deepLinkPrefix,rsts_controls,rsts_keyboard,rsts_invertControls;{rsts_autoplay_legend},rsts_autoplay,rsts_autoplayRestart,rsts_autoplayProgress,rsts_pauseAutoplayOnHover,rsts_videoAutoplay;{rsts_carousel_legend},rsts_slideMaxCount,rsts_prevNextSteps,rsts_slideMinSize,rsts_combineNavItems,rsts_visibleArea,rsts_visibleAreaMax;{template_legend:hide},rsts_template,imgSize;{expert_legend:hide},rsts_customSkin,rsts_cssPrefix,cssID,space'; +$GLOBALS['TL_DCA']['tl_module']['palettes']['rocksolid_sliderrsts_images'] = '{title_legend},name,headline,type,rsts_content_type;{rsts_images_legend},multiSRC;{config_legend},rsts_type,rsts_direction,rsts_random,rsts_loop,rsts_centerContent,rsts_skin,rsts_width,rsts_height,rsts_preloadSlides,rsts_gapSize,rsts_duration,rsts_captions,rsts_scaleMode,rsts_imagePosition;{rsts_navigation_legend},rsts_navType,rsts_deepLinkPrefix,rsts_controls,rsts_keyboard,rsts_invertControls;{rsts_autoplay_legend},rsts_autoplay,rsts_autoplayRestart,rsts_autoplayProgress,rsts_pauseAutoplayOnHover,rsts_videoAutoplay;{rsts_carousel_legend},rsts_slideMaxCount,rsts_prevNextSteps,rsts_slideMinSize,rsts_combineNavItems,rsts_visibleArea,rsts_visibleAreaMax;{template_legend:hide},rsts_template,imgSize;{expert_legend:hide},rsts_customSkin,rsts_cssPrefix,cssID,space'; + +$GLOBALS['TL_DCA']['tl_module']['fields']['news_metaFields']['eval']['tl_class'] .= ' clr'; + +$GLOBALS['TL_DCA']['tl_module']['fields']['rsts_content_type'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_content_type'], + 'default' => 'rsts_default', + 'exclude' => true, + 'inputType' => 'select', + 'options' => array( + 'rsts_default', + 'rsts_news', + 'rsts_events', + 'rsts_images', + ), + 'reference' => &$GLOBALS['TL_LANG']['tl_module']['rsts_content_types'], + 'eval' => array( + 'mandatory' => true, + 'submitOnChange' => true, + 'tl_class' => 'w50', + ), + 'sql' => "varchar(64) NOT NULL default 'rsts_default'", +); $GLOBALS['TL_DCA']['tl_module']['fields']['rsts_id'] = array( 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_id'], 'exclude' => true, 'inputType' => 'select', 'options_callback' => array('MadeYourDay\\Contao\\Slider', 'getSliderIds'), - 'eval' => array('mandatory' => true), + 'eval' => array( + 'includeBlankOption' => true, + 'mandatory' => true, + ), 'sql' => "int(10) unsigned NOT NULL default '0'", ); $GLOBALS['TL_DCA']['tl_module']['fields']['rsts_template'] = array( @@ -29,18 +60,27 @@ 'inputType' => 'select', 'options_callback' => array('MadeYourDay\\Contao\\Slider', 'getSliderTemplates'), 'eval' => array('tl_class' => 'w50'), - 'sql' => "varchar(32) NOT NULL default ''", + 'sql' => "varchar(32) NOT NULL default 'rsts_default'", ); -// slider type (slide or fade) +// slider type (slide, side-slide or fade) $GLOBALS['TL_DCA']['tl_module']['fields']['rsts_type'] = array( 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_type'], 'exclude' => true, 'inputType' => 'select', - 'options' => array('slide' => 'slide', 'fade' => 'fade'), + 'options' => array('slide' => 'slide', 'side-slide' => 'side-slide', 'fade' => 'fade'), + 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''", ); -// For backwards compatibility +// "x" for horizontal or "y" for vertical $GLOBALS['TL_DCA']['tl_module']['fields']['rsts_direction'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_direction'], + 'exclude' => true, + 'inputType' => 'select', + 'options' => array( + 'x' => $GLOBALS['TL_LANG']['tl_module']['rsts_direction_x'], + 'y' => $GLOBALS['TL_LANG']['tl_module']['rsts_direction_y'], + ), + 'eval' => array('tl_class' => 'w50'), 'sql' => "varchar(64) NOT NULL default ''", ); // if true the slides get shuffled once on initialization @@ -97,6 +137,7 @@ // - a css lenght value: e.g. "100%", "500px", "50em" // - "auto": get the size from the active slide dimensions at runtime // height can be set to auto only if the direction is "x" +// - "normalize": similar to auto but uses the size of the largest slide // - a proportion: keep a fixed proportion for the slides, e.g. "480x270" // this must not set to both dimensions $GLOBALS['TL_DCA']['tl_module']['fields']['rsts_width'] = array( @@ -201,6 +242,14 @@ 'eval' => array('tl_class' => 'w50'), 'sql' => "char(1) NOT NULL default '1'", ); +// Adds data-rsts-class="rsts-invert-controls" to all slides +$GLOBALS['TL_DCA']['tl_module']['fields']['rsts_invertControls'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_invertControls'], + 'exclude' => true, + 'inputType' => 'checkbox', + 'eval' => array('tl_class' => 'w50'), + 'sql' => "char(1) NOT NULL default ''", +); // image scale mode (fit, crop, scale) // only works if width and height are not set to "auto" $GLOBALS['TL_DCA']['tl_module']['fields']['rsts_scaleMode'] = array( @@ -251,13 +300,55 @@ 'eval' => array('tl_class' => 'w50 m12'), 'sql' => "char(1) NOT NULL default '1'", ); -// get pro version -$GLOBALS['TL_DCA']['tl_module']['fields']['rsts_getPro'] = array( - 'input_field_callback' => function() { - return '
' - . $GLOBALS['TL_LANG']['tl_module']['rsts_getPro'] - . '
'; - }, +// maximum number of visible slides +$GLOBALS['TL_DCA']['tl_module']['fields']['rsts_slideMaxCount'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_slideMaxCount'], + 'exclude' => true, + 'inputType' => 'select', + 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20), + 'eval' => array('tl_class' => 'w50', 'includeBlankOption' => true), + 'sql' => "int(10) unsigned NOT NULL default '0'", +); +// number of slides to navigate by clicking prev or next +$GLOBALS['TL_DCA']['tl_module']['fields']['rsts_prevNextSteps'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_prevNextSteps'], + 'exclude' => true, + 'inputType' => 'select', + 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20), + 'eval' => array('tl_class' => 'w50', 'includeBlankOption' => true), + 'sql' => "int(10) unsigned NOT NULL default '0'", +); +// the size of the area for the visible slide (0 = 0%, 1 = 100%) +$GLOBALS['TL_DCA']['tl_module']['fields']['rsts_visibleArea'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_visibleArea'], + 'exclude' => true, + 'inputType' => 'text', + 'eval' => array('tl_class' => 'w50 clr'), + 'sql' => "double unsigned NOT NULL default '0'", +); +// maximum size of the area for the visible slide in px +$GLOBALS['TL_DCA']['tl_module']['fields']['rsts_visibleAreaMax'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_visibleAreaMax'], + 'exclude' => true, + 'inputType' => 'text', + 'eval' => array('tl_class' => 'w50'), + 'sql' => "double unsigned NOT NULL default '0'", +); +// minimal size of one slide in px +$GLOBALS['TL_DCA']['tl_module']['fields']['rsts_slideMinSize'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_slideMinSize'], + 'exclude' => true, + 'inputType' => 'text', + 'eval' => array('tl_class' => 'w50'), + 'sql' => "int(10) unsigned NOT NULL default '0'", +); +// combine navigation items if multiple slides are visible (default true) +$GLOBALS['TL_DCA']['tl_module']['fields']['rsts_combineNavItems'] = array( + 'label' => &$GLOBALS['TL_LANG']['tl_module']['rsts_combineNavItems'], + 'exclude' => true, + 'inputType' => 'checkbox', + 'eval' => array('tl_class' => 'w50 m12'), + 'sql' => "char(1) NOT NULL default '1'", ); // custom slider skin (rsts_skin gets ignored if this is set) $GLOBALS['TL_DCA']['tl_module']['fields']['rsts_customSkin'] = array( diff --git a/dca/tl_rocksolid_slide.php b/dca/tl_rocksolid_slide.php index aada86c..7cd9180 100644 --- a/dca/tl_rocksolid_slide.php +++ b/dca/tl_rocksolid_slide.php @@ -19,6 +19,9 @@ 'ctable' => array('tl_content'), 'switchToEdit' => true, 'enableVersioning' => true, + 'onload_callback' => array( + array('MadeYourDay\\Contao\\Slider', 'slideOnloadCallback'), + ), 'sql' => array( 'keys' => array( 'id' => 'primary', @@ -90,7 +93,7 @@ ), 'palettes' => array( - 'default' => '{title_legend},title,videoURL,singleSRC,scaleMode,imagePosition,centerContent,invertControls;{background_legend},getPro;{expert_legend},slideClass,sliderClass;{publish_legend},published,start,stop', + 'default' => '{title_legend},title,videoURL,singleSRC,scaleMode,imagePosition,centerContent,invertControls;{background_legend},backgroundImage,backgroundVideos,backgroundImageSize,backgroundScaleMode,backgroundPosition;{expert_legend},slideClass,sliderClass;{publish_legend},published,start,stop', ), 'fields' => array( @@ -183,12 +186,72 @@ 'eval' => array('tl_class' => 'w50 m12'), 'sql' => "char(1) NOT NULL default ''", ), - 'getPro' => array( - 'input_field_callback' => function() { - return '
' - . $GLOBALS['TL_LANG']['tl_rocksolid_slide']['getPro'] - . '
'; - }, + 'backgroundImage' => array( + 'label' => &$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundImage'], + 'exclude' => true, + 'inputType' => 'fileTree', + 'eval' => array( + 'fieldType' => 'radio', + 'files' => true, + 'filesOnly' => true, + ), + 'sql' => version_compare(VERSION, '3.2', '<') ? "varchar(255) NOT NULL default ''" : "binary(16) NULL", + ), + 'backgroundVideos' => array( + 'label' => &$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundVideos'], + 'exclude' => true, + 'inputType' => 'fileTree', + 'eval' => array( + 'multiple' => true, + 'fieldType' => 'checkbox', + 'orderField' => 'backgroundVideosOrder', + 'files' => true, + 'filesOnly' => true, + ), + 'sql' => "blob NULL", + ), + 'backgroundVideosOrder' => array( + 'label' => &$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundVideosOrder'], + 'sql' => "blob NULL", + ), + 'backgroundImageSize' => array( + 'label' => &$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundImageSize'], + 'exclude' => true, + 'inputType' => 'imageSize', + 'options' => version_compare(VERSION, '3.4', '<') ? $GLOBALS['TL_CROP'] : System::getImageSizes(), + 'reference' => &$GLOBALS['TL_LANG']['MSC'], + 'eval' => array( + 'rgxp' => 'digit', + 'nospace' => true, + 'helpwizard' => true, + 'tl_class' => 'w50', + 'includeBlankOption' => true, + ), + 'sql' => "varchar(64) NOT NULL default ''", + ), + 'backgroundScaleMode' => array( + 'label' => &$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundScaleMode'], + 'exclude' => true, + 'inputType' => 'select', + 'options' => array('fit', 'crop', 'scale', 'none'), + 'reference' => &$GLOBALS['TL_LANG']['tl_rocksolid_slide']['scaleModes'], + 'eval' => array( + 'includeBlankOption' => true, + 'tl_class' => 'w50 clr', + ), + 'sql' => "varchar(64) NOT NULL default ''", + ), + 'backgroundPosition' => array( + 'label' => &$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundPosition'], + 'exclude' => true, + 'inputType' => 'select', + 'options' => array('center', 'top', 'right', 'bottom', 'left', 'top-left', 'top-right', 'bottom-left', 'bottom-right'), + 'reference' => &$GLOBALS['TL_LANG']['tl_rocksolid_slide']['imagePositions'], + 'eval' => array( + 'includeBlankOption' => true, + 'tl_class' => 'w50', + ), + 'sql' => "varchar(64) NOT NULL default ''", ), 'slideClass' => array( 'label' => &$GLOBALS['TL_LANG']['tl_rocksolid_slide']['slideClass'], diff --git a/dca/tl_rocksolid_slider.php b/dca/tl_rocksolid_slider.php index 1ffc54f..15ba5f7 100644 --- a/dca/tl_rocksolid_slider.php +++ b/dca/tl_rocksolid_slider.php @@ -37,6 +37,12 @@ 'format' => '%s', ), 'global_operations' => array( + 'license' => array( + 'label' => &$GLOBALS['TL_LANG']['tl_rocksolid_slider']['editLicense'], + 'href' => 'table=tl_rocksolid_slider_license', + 'class' => 'header_icon', + 'icon' => 'system/themes/default/images/settings.gif', + ), 'all' => array( 'label' => &$GLOBALS['TL_LANG']['MSC']['all'], 'href' => 'act=select', diff --git a/dca/tl_rocksolid_slider_license.php b/dca/tl_rocksolid_slider_license.php new file mode 100644 index 0000000..ba61fdf --- /dev/null +++ b/dca/tl_rocksolid_slider_license.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * RockSolid Slider license DCA + * + * @author Martin Auswöger + */ +$GLOBALS['TL_DCA']['tl_rocksolid_slider_license'] = array( + + 'config' => array( + 'dataContainer' => 'File', + 'closed' => true, + ), + + 'palettes' => array( + 'default' => '{license_legend},rocksolid_slider_license', + ), + + 'fields' => array( + 'rocksolid_slider_license' => array( + 'label' => &$GLOBALS['TL_LANG']['tl_rocksolid_slider_license']['rocksolid_slider_license'], + 'inputType' => 'text', + 'eval' => array( + 'tl_class' => 'w50', + ), + 'save_callback' => array( + array('MadeYourDay\\Contao\\Slider', 'licenseSaveCallback'), + ), + ), + ), + +); diff --git a/languages/de/modules.php b/languages/de/modules.php index 3081535..5d40d53 100644 --- a/languages/de/modules.php +++ b/languages/de/modules.php @@ -17,4 +17,4 @@ $GLOBALS['TL_LANG']['FMD']['rocksolid_slider'] = $GLOBALS['TL_LANG']['CTE']['rocksolid_slider'] = - array('RockSolid Slider', 'jQuery Slider für Bilder, Videos und Content-Elemente.'); + array('RockSolid Slider', 'jQuery Slider für Bilder, Videos, News, Events und Content-Elemente.'); diff --git a/languages/de/tl_module.php b/languages/de/tl_module.php index 6bdef7c..71bab41 100644 --- a/languages/de/tl_module.php +++ b/languages/de/tl_module.php @@ -12,13 +12,26 @@ * @author Martin Auswöger */ +$GLOBALS['TL_LANG']['tl_module']['rsts_news_legend'] = 'News-Einstellungen'; +$GLOBALS['TL_LANG']['tl_module']['rsts_events_legend'] = 'Events-Einstellungen'; +$GLOBALS['TL_LANG']['tl_module']['rsts_images_legend'] = 'Bilder'; $GLOBALS['TL_LANG']['tl_module']['rsts_carousel_legend'] = 'Karussell-Einstellungen'; $GLOBALS['TL_LANG']['tl_module']['rsts_autoplay_legend'] = 'Autoplay-Einstellungen'; $GLOBALS['TL_LANG']['tl_module']['rsts_navigation_legend'] = 'Navigations-Einstellungen'; +$GLOBALS['TL_LANG']['tl_module']['rsts_content_type'][0] = 'Slider-Inhaltstyp'; +$GLOBALS['TL_LANG']['tl_module']['rsts_content_type'][1] = 'Wählen Sie die Quelle des Slider-Inhaltes aus.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_content_types']['rsts_default'] = 'Slider'; +$GLOBALS['TL_LANG']['tl_module']['rsts_content_types']['rsts_news'] = 'News-Archiv'; +$GLOBALS['TL_LANG']['tl_module']['rsts_content_types']['rsts_events'] = 'Events'; +$GLOBALS['TL_LANG']['tl_module']['rsts_content_types']['rsts_images'] = 'Bilder'; $GLOBALS['TL_LANG']['tl_module']['rsts_id'][0] = 'Slider'; $GLOBALS['TL_LANG']['tl_module']['rsts_id'][1] = 'Die Inhalte können unter Inhalte › RockSolid Slider verwaltet werden.'; $GLOBALS['TL_LANG']['tl_module']['rsts_type'][0] = 'Animationstyp'; $GLOBALS['TL_LANG']['tl_module']['rsts_type'][1] = 'Bei "slide" bewegen sich die Elemente horizontal oder vertikal. Bei "fade" werden die Elemente überblendet.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_direction'][0] = 'Ausrichtung'; +$GLOBALS['TL_LANG']['tl_module']['rsts_direction'][1] = 'Ausrichtung der Slide-Bewegung (nur für Animationstyp "slide").'; +$GLOBALS['TL_LANG']['tl_module']['rsts_direction_x'] = 'Horizontal'; +$GLOBALS['TL_LANG']['tl_module']['rsts_direction_y'] = 'Vertikal'; $GLOBALS['TL_LANG']['tl_module']['rsts_random'][0] = 'Zufällige Sortierung'; $GLOBALS['TL_LANG']['tl_module']['rsts_random'][1] = 'Wenn aktiviert werden die einzelnen Slides beim Start zufällig sortiert.'; $GLOBALS['TL_LANG']['tl_module']['rsts_loop'][0] = 'Endlosschleife'; @@ -38,9 +51,9 @@ $GLOBALS['TL_LANG']['tl_module']['rsts_skin_options']['light'] = 'Light'; $GLOBALS['TL_LANG']['tl_module']['rsts_skin_options']['custom'] = 'eigener Skin (siehe Experten-Einstellungen)'; $GLOBALS['TL_LANG']['tl_module']['rsts_width'][0] = 'Breite'; -$GLOBALS['TL_LANG']['tl_module']['rsts_width'][1] = 'Mögliche Werte: "css", "auto", eine CSS-Längen-Angabe oder eine Proportion (z.B.: 640x360). Bei "css" wird die Breite aus dem Stylesheet übernommen.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_width'][1] = 'Mögliche Werte: "css", "auto", "normalize", eine CSS-Längen-Angabe oder eine Proportion (z.B.: 640x360). Bei "css" wird die Breite aus dem Stylesheet übernommen.'; $GLOBALS['TL_LANG']['tl_module']['rsts_height'][0] = 'Höhe'; -$GLOBALS['TL_LANG']['tl_module']['rsts_height'][1] = 'Mögliche Werte: "css", "auto", eine CSS-Längen-Angabe oder eine Proportion (z.B.: 640x360). Bei "css" wird die Höhe aus dem Stylesheet übernommen.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_height'][1] = 'Mögliche Werte: "css", "auto", "normalize", eine CSS-Längen-Angabe oder eine Proportion (z.B.: 640x360). Bei "css" wird die Höhe aus dem Stylesheet übernommen.'; $GLOBALS['TL_LANG']['tl_module']['rsts_preloadSlides'][0] = 'Slides vorausladen'; $GLOBALS['TL_LANG']['tl_module']['rsts_preloadSlides'][1] = 'Anzahl der Slides die vorausgeladen werden sollen.'; $GLOBALS['TL_LANG']['tl_module']['rsts_gapSize'][0] = 'Slide-Abstand'; @@ -65,6 +78,8 @@ $GLOBALS['TL_LANG']['tl_module']['rsts_navType_none'] = 'Navigation ausblenden'; $GLOBALS['TL_LANG']['tl_module']['rsts_controls'][0] = 'Weiter und Zurück anzeigen'; $GLOBALS['TL_LANG']['tl_module']['rsts_controls'][1] = 'Aktiviert die Navigationspfeile.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_invertControls'][0] = 'Navigation invertieren'; +$GLOBALS['TL_LANG']['tl_module']['rsts_invertControls'][1] = 'Invertiert die Navigation (nicht auf alle Skins anwendbar).'; $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode'][0] = 'Skalierungsmodus'; $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode'][1] = 'Achtung: Hat keine Auswirkung wenn Höhe oder Breite auf "auto" gesetzt ist.'; $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_fit'] = 'Proportional'; @@ -88,7 +103,18 @@ $GLOBALS['TL_LANG']['tl_module']['rsts_keyboard'][1] = 'Bei aktivierter Tastatur-Navigation kann der Slider mit den Pfeiltasten gesteuert werden.'; $GLOBALS['TL_LANG']['tl_module']['rsts_captions'][0] = 'Titel in Slides anzeigen'; $GLOBALS['TL_LANG']['tl_module']['rsts_captions'][1] = 'Zeigt die Titel der Slides als Überschriften an.'; -$GLOBALS['TL_LANG']['tl_module']['rsts_getPro'] = 'Für dieses Feature wird die Pro-Version des Sliders benötigt, jetzt Pro-Version kaufen.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_slideMaxCount'][0] = 'Anzahl Slides'; +$GLOBALS['TL_LANG']['tl_module']['rsts_slideMaxCount'][1] = 'Die Anzahl der Slides die gleichzeitig sichtbar sein sollen.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_prevNextSteps'][0] = 'Navigationsschritte'; +$GLOBALS['TL_LANG']['tl_module']['rsts_prevNextSteps'][1] = 'Die Anzahl der Slides um die sich der Slider vor oder zurück bewegen soll.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_slideMinSize'][0] = 'Mindestbreite der Slides'; +$GLOBALS['TL_LANG']['tl_module']['rsts_slideMinSize'][1] = 'Die minimale Breite eines Slides in Pixel. Diese Einstellung hat Vorrang gegenüber der eingestellten Slide-Anzahl.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_visibleArea'][0] = 'Sichtbarer Bereich'; +$GLOBALS['TL_LANG']['tl_module']['rsts_visibleArea'][1] = 'Zwischen 1% und 100%. Unter 100% wird der nächste und der vorherige Slide teilweise sichtbar.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_visibleAreaMax'][0] = 'Maximal sichtbarer Bereich'; +$GLOBALS['TL_LANG']['tl_module']['rsts_visibleAreaMax'][1] = 'Der maximal sichtbare Bereich in Pixel. Diese Einstellung hat Vorrang gegenüber des prozentual sichtbaren Bereichs.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_combineNavItems'][0] = 'Navigationspunkte zusammenfassen'; +$GLOBALS['TL_LANG']['tl_module']['rsts_combineNavItems'][1] = 'Fasst die Navigationspunkte zusammen wenn mehr als ein Slide angezeigt wird.'; $GLOBALS['TL_LANG']['tl_module']['rsts_template'][0] = 'Template'; $GLOBALS['TL_LANG']['tl_module']['rsts_template'][1] = 'Slider-Template auswählen.'; $GLOBALS['TL_LANG']['tl_module']['rsts_customSkin'][0] = 'Eigener Slider-Skin'; diff --git a/languages/de/tl_rocksolid_slide.php b/languages/de/tl_rocksolid_slide.php index cdb4bd4..7557417 100644 --- a/languages/de/tl_rocksolid_slide.php +++ b/languages/de/tl_rocksolid_slide.php @@ -66,7 +66,16 @@ $GLOBALS['TL_LANG']['tl_rocksolid_slide']['invertControls'][0] = 'Slider-Navigation invertieren'; $GLOBALS['TL_LANG']['tl_rocksolid_slide']['invertControls'][1] = 'Invertiert die Slider-Navigation für diesen Slide (nicht auf alle Skins anwendbar).'; $GLOBALS['TL_LANG']['tl_rocksolid_slide']['background_legend'] = 'Hintergrund'; -$GLOBALS['TL_LANG']['tl_rocksolid_slide']['getPro'] = 'Für dieses Feature wird die Pro-Version des Sliders benötigt, jetzt Pro-Version kaufen.'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundImage'][0] = 'Hintergrund-Bild'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundImage'][1] = 'Wählen Sie ein Bild aus, dass im Hintergrund des Slides angezeigt werden soll.'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundVideos'][0] = 'Hintergrund-Video'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundVideos'][1] = 'Wählen Sie eine oder mehrere Videodateien aus, um im Hintergrund des Slides ein Video anzuzeigen.'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundImageSize'][0] = 'Hintergrundbild Größe'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundImageSize'][1] = 'Die Größe des Hintergrundbildes in Pixel.'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundScaleMode'][0] = 'Hintergrund-Skalierungsmodus'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundScaleMode'][1] = 'Skalierungsmodus des Hintergrundbildes bzw. des Hintergrundvideos.'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundPosition'][0] = 'Hintergrundposition'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundPosition'][1] = 'Position des Hintergrundbildes oder Videos. Diese Einstellung überschreibt die Moduleinstellungen.'; $GLOBALS['TL_LANG']['tl_rocksolid_slide']['expert_legend'] = 'Experten-Einstellungen'; $GLOBALS['TL_LANG']['tl_rocksolid_slide']['slideClass'][0] = 'CSS-Klasse'; $GLOBALS['TL_LANG']['tl_rocksolid_slide']['slideClass'][1] = 'Eine oder mehrere Klassen für das Slide-Element.'; diff --git a/languages/de/tl_rocksolid_slider.php b/languages/de/tl_rocksolid_slider.php index 9d48992..e581dce 100644 --- a/languages/de/tl_rocksolid_slider.php +++ b/languages/de/tl_rocksolid_slider.php @@ -14,6 +14,8 @@ $GLOBALS['TL_LANG']['tl_rocksolid_slider']['new'][0] = 'Neuer Slider'; $GLOBALS['TL_LANG']['tl_rocksolid_slider']['new'][1] = 'Einen neuen Slider erstellen'; +$GLOBALS['TL_LANG']['tl_rocksolid_slider']['editLicense'][0] = 'Lizenzschlüssel'; +$GLOBALS['TL_LANG']['tl_rocksolid_slider']['editLicense'][1] = 'Den Lizenzschlüssel bearbeiten'; $GLOBALS['TL_LANG']['tl_rocksolid_slider']['edit'][0] = 'Slider bearbeiten'; $GLOBALS['TL_LANG']['tl_rocksolid_slider']['edit'][1] = 'Slider ID %s bearbeiten'; $GLOBALS['TL_LANG']['tl_rocksolid_slider']['editheader'][0] = 'Slider-Einstellungen bearbeiten'; @@ -32,3 +34,6 @@ $GLOBALS['TL_LANG']['tl_rocksolid_slider']['multiSRC'][1] = 'Wählen Sie hier mehrere Bilder aus um einen reinen Bilderslider zu erstellen oder fügen Sie später Inhaltselemente ein.'; $GLOBALS['TL_LANG']['tl_rocksolid_slider']['orderSRC'][0] = 'Bildsortierung'; $GLOBALS['TL_LANG']['tl_rocksolid_slider']['orderSRC'][1] = ''; + +$GLOBALS['TL_LANG']['tl_rocksolid_slider']['proFieldDescription'] = 'Hierfür wird die Pro-Version benötigt. Lizenzschlüssel eingeben.'; +$GLOBALS['TL_LANG']['tl_rocksolid_slider']['proLegendDescription'] = 'Für dieses Feature wird die Pro-Version des Sliders benötigt, jetzt Lizenzschlüssel eingeben oder Pro-Version kaufen.'; diff --git a/languages/de/tl_rocksolid_slider_license.php b/languages/de/tl_rocksolid_slider_license.php new file mode 100644 index 0000000..39b4d36 --- /dev/null +++ b/languages/de/tl_rocksolid_slider_license.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * RockSolid Slider translations + * + * @author Martin Auswöger + */ + +$GLOBALS['TL_LANG']['tl_rocksolid_slider_license']['license_legend'] = 'Lizenzschlüssel bearbeiten'; +$GLOBALS['TL_LANG']['tl_rocksolid_slider_license']['rocksolid_slider_license'][0] = 'Lizenzschlüssel'; +$GLOBALS['TL_LANG']['tl_rocksolid_slider_license']['rocksolid_slider_license'][1] = 'Geben Sie bitte einen gültigen Lizenzschlüssel ein.'; +$GLOBALS['TL_LANG']['tl_rocksolid_slider_license']['invalidLicense'] = 'Der Lizenzschlüssel ist ungültig.'; diff --git a/languages/en/modules.php b/languages/en/modules.php index 5906c46..3482841 100644 --- a/languages/en/modules.php +++ b/languages/en/modules.php @@ -17,4 +17,4 @@ $GLOBALS['TL_LANG']['FMD']['rocksolid_slider'] = $GLOBALS['TL_LANG']['CTE']['rocksolid_slider'] = - array('RockSolid Slider', 'jQuery slider for images, videos and content elements.'); + array('RockSolid Slider', 'jQuery slider for images, videos, news, events and content elements.'); diff --git a/languages/en/tl_module.php b/languages/en/tl_module.php index 4b7fcdc..9d081c1 100644 --- a/languages/en/tl_module.php +++ b/languages/en/tl_module.php @@ -12,13 +12,26 @@ * @author Martin Auswöger */ +$GLOBALS['TL_LANG']['tl_module']['rsts_news_legend'] = 'News Settings'; +$GLOBALS['TL_LANG']['tl_module']['rsts_events_legend'] = 'Event Settings'; +$GLOBALS['TL_LANG']['tl_module']['rsts_images_legend'] = 'Images'; $GLOBALS['TL_LANG']['tl_module']['rsts_carousel_legend'] = 'Carousel Settings'; $GLOBALS['TL_LANG']['tl_module']['rsts_autoplay_legend'] = 'Autoplay Settings'; $GLOBALS['TL_LANG']['tl_module']['rsts_navigation_legend'] = 'Navigation Settings'; +$GLOBALS['TL_LANG']['tl_module']['rsts_content_type'][0] = 'Slider content type'; +$GLOBALS['TL_LANG']['tl_module']['rsts_content_type'][1] = 'Select the type of the contents source.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_content_types']['rsts_default'] = 'Slider'; +$GLOBALS['TL_LANG']['tl_module']['rsts_content_types']['rsts_news'] = 'News archive'; +$GLOBALS['TL_LANG']['tl_module']['rsts_content_types']['rsts_events'] = 'Events'; +$GLOBALS['TL_LANG']['tl_module']['rsts_content_types']['rsts_images'] = 'Images'; $GLOBALS['TL_LANG']['tl_module']['rsts_id'][0] = 'Slider'; $GLOBALS['TL_LANG']['tl_module']['rsts_id'][1] = 'Edit the content at Content › RockSolid Slider.'; $GLOBALS['TL_LANG']['tl_module']['rsts_type'][0] = 'Animation type'; $GLOBALS['TL_LANG']['tl_module']['rsts_type'][1] = '"Slide" moves the elements vertically and horizontally. "Fade" uses a change-over effect.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_direction'][0] = 'Direction'; +$GLOBALS['TL_LANG']['tl_module']['rsts_direction'][1] = 'Direction of the slide animation (only for animation type "slide").'; +$GLOBALS['TL_LANG']['tl_module']['rsts_direction_x'] = 'Horizontal'; +$GLOBALS['TL_LANG']['tl_module']['rsts_direction_y'] = 'Vertical'; $GLOBALS['TL_LANG']['tl_module']['rsts_random'][0] = 'Randomize elements'; $GLOBALS['TL_LANG']['tl_module']['rsts_random'][1] = 'If activated slider elements are randomized at the start.'; $GLOBALS['TL_LANG']['tl_module']['rsts_loop'][0] = 'Loop'; @@ -38,9 +51,9 @@ $GLOBALS['TL_LANG']['tl_module']['rsts_skin_options']['light'] = 'Light'; $GLOBALS['TL_LANG']['tl_module']['rsts_skin_options']['custom'] = 'Individual skin (Expert settings)'; $GLOBALS['TL_LANG']['tl_module']['rsts_width'][0] = 'Width'; -$GLOBALS['TL_LANG']['tl_module']['rsts_width'][1] = 'Possible values: "css", "auto", a css length value or a proportion (e.g. 640x360). The option "css" imports the width from the stylesheet.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_width'][1] = 'Possible values: "css", "auto", "normalize", a css length value or a proportion (e.g. 640x360). The option "css" imports the width from the stylesheet.'; $GLOBALS['TL_LANG']['tl_module']['rsts_height'][0] = 'Height'; -$GLOBALS['TL_LANG']['tl_module']['rsts_height'][1] = 'Possible values: "css", "auto", a css length value or a proportion (e.g. 640x360). The option "css" imports the height from the stylesheet.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_height'][1] = 'Possible values: "css", "auto", "normalize", a css length value or a proportion (e.g. 640x360). The option "css" imports the height from the stylesheet.'; $GLOBALS['TL_LANG']['tl_module']['rsts_preloadSlides'][0] = 'Preload slides'; $GLOBALS['TL_LANG']['tl_module']['rsts_preloadSlides'][1] = 'Number of slides that are preloaded.'; $GLOBALS['TL_LANG']['tl_module']['rsts_gapSize'][0] = 'Slide distance'; @@ -65,6 +78,8 @@ $GLOBALS['TL_LANG']['tl_module']['rsts_navType_none'] = 'Hide navigation'; $GLOBALS['TL_LANG']['tl_module']['rsts_controls'][0] = 'Show next and previous arrows'; $GLOBALS['TL_LANG']['tl_module']['rsts_controls'][1] = 'Activates the next and previous controls.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_invertControls'][0] = 'Invert controls'; +$GLOBALS['TL_LANG']['tl_module']['rsts_invertControls'][1] = 'Inverts the controls (not applicable for all skins).'; $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode'][0] = 'Scale mode'; $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode'][1] = 'Note: Has no effect if either width or height are set to "auto".'; $GLOBALS['TL_LANG']['tl_module']['rsts_scaleMode_fit'] = 'Proportional'; @@ -88,7 +103,18 @@ $GLOBALS['TL_LANG']['tl_module']['rsts_keyboard'][1] = 'If activated the arrow keys can be used to controll the slider.'; $GLOBALS['TL_LANG']['tl_module']['rsts_captions'][0] = 'Show slide title'; $GLOBALS['TL_LANG']['tl_module']['rsts_captions'][1] = 'Displays the title as a headline in the slides.'; -$GLOBALS['TL_LANG']['tl_module']['rsts_getPro'] = 'This feature requires the pro version of the slider, buy pro version now.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_slideMaxCount'][0] = 'Slides count'; +$GLOBALS['TL_LANG']['tl_module']['rsts_slideMaxCount'][1] = 'The Number of slides to display at once.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_prevNextSteps'][0] = 'Navigation steps'; +$GLOBALS['TL_LANG']['tl_module']['rsts_prevNextSteps'][1] = 'The Number of slides by which the slider should move forward or backward.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_slideMinSize'][0] = 'Minimal width of the slides'; +$GLOBALS['TL_LANG']['tl_module']['rsts_slideMinSize'][1] = 'The minimal width of a slide in pixels. This setting takes precedence over the slides count setting.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_visibleArea'][0] = 'Visible area'; +$GLOBALS['TL_LANG']['tl_module']['rsts_visibleArea'][1] = 'Between 1% and 100%. Under 100% the next and previous slides get partially visible.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_visibleAreaMax'][0] = 'Maximum visible area'; +$GLOBALS['TL_LANG']['tl_module']['rsts_visibleAreaMax'][1] = 'The maximum visible area in pixels. This setting takes precedence over the percentage visible area setting.'; +$GLOBALS['TL_LANG']['tl_module']['rsts_combineNavItems'][0] = 'Combine navigation items'; +$GLOBALS['TL_LANG']['tl_module']['rsts_combineNavItems'][1] = 'Combines navigation items if more than one slide is shown.'; $GLOBALS['TL_LANG']['tl_module']['rsts_template'][0] = 'Template'; $GLOBALS['TL_LANG']['tl_module']['rsts_template'][1] = 'Choose the slider template.'; $GLOBALS['TL_LANG']['tl_module']['rsts_customSkin'][0] = 'Individual skin'; diff --git a/languages/en/tl_rocksolid_slide.php b/languages/en/tl_rocksolid_slide.php index fa349c6..d438fda 100644 --- a/languages/en/tl_rocksolid_slide.php +++ b/languages/en/tl_rocksolid_slide.php @@ -66,7 +66,16 @@ $GLOBALS['TL_LANG']['tl_rocksolid_slide']['invertControls'][0] = 'Invert slider controls'; $GLOBALS['TL_LANG']['tl_rocksolid_slide']['invertControls'][1] = 'Inverts the slider controls for this slide (not applicable for all skins).'; $GLOBALS['TL_LANG']['tl_rocksolid_slide']['background_legend'] = 'Background'; -$GLOBALS['TL_LANG']['tl_rocksolid_slide']['getPro'] = 'This feature requires the pro version of the slider, buy pro version now.'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundImage'][0] = 'Background image'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundImage'][1] = 'Choose an image to display it in the background of the slide.'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundVideos'][0] = 'Background video'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundVideos'][1] = 'Choose one or more video files to display a video in the background of the slide.'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundImageSize'][0] = 'Background image size'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundImageSize'][1] = 'The background image size in pixels.'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundScaleMode'][0] = 'Background scale mode'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundScaleMode'][1] = 'Scale mode of the background image or video.'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundPosition'][0] = 'Background position'; +$GLOBALS['TL_LANG']['tl_rocksolid_slide']['backgroundPosition'][1] = 'Position of the background image or video. This setting overwrites the module settings.'; $GLOBALS['TL_LANG']['tl_rocksolid_slide']['expert_legend'] = 'Expert settings'; $GLOBALS['TL_LANG']['tl_rocksolid_slide']['slideClass'][0] = 'CSS class'; $GLOBALS['TL_LANG']['tl_rocksolid_slide']['slideClass'][1] = 'One or more classes for this slide element.'; diff --git a/languages/en/tl_rocksolid_slider.php b/languages/en/tl_rocksolid_slider.php index dfd3b8b..08e6786 100644 --- a/languages/en/tl_rocksolid_slider.php +++ b/languages/en/tl_rocksolid_slider.php @@ -14,6 +14,8 @@ $GLOBALS['TL_LANG']['tl_rocksolid_slider']['new'][0] = 'New slider'; $GLOBALS['TL_LANG']['tl_rocksolid_slider']['new'][1] = 'Create a new slider'; +$GLOBALS['TL_LANG']['tl_rocksolid_slider']['editLicense'][0] = 'License key'; +$GLOBALS['TL_LANG']['tl_rocksolid_slider']['editLicense'][1] = 'Edit the license key'; $GLOBALS['TL_LANG']['tl_rocksolid_slider']['edit'][0] = 'Edit slider'; $GLOBALS['TL_LANG']['tl_rocksolid_slider']['edit'][1] = 'Edit slider ID %s'; $GLOBALS['TL_LANG']['tl_rocksolid_slider']['editheader'][0] = 'Edit slider settings'; @@ -32,3 +34,6 @@ $GLOBALS['TL_LANG']['tl_rocksolid_slider']['multiSRC'][1] = 'You can choose multiple images if you want to display them together in an image only slider.'; $GLOBALS['TL_LANG']['tl_rocksolid_slider']['orderSRC'][0] = 'Image order'; $GLOBALS['TL_LANG']['tl_rocksolid_slider']['orderSRC'][1] = ''; + +$GLOBALS['TL_LANG']['tl_rocksolid_slider']['proFieldDescription'] = 'This requires the pro version. Enter a license key.'; +$GLOBALS['TL_LANG']['tl_rocksolid_slider']['proLegendDescription'] = 'This feature requires the pro version of the slider, enter a license key or buy pro version now.'; diff --git a/languages/en/tl_rocksolid_slider_license.php b/languages/en/tl_rocksolid_slider_license.php new file mode 100644 index 0000000..5e36905 --- /dev/null +++ b/languages/en/tl_rocksolid_slider_license.php @@ -0,0 +1,18 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +/** + * RockSolid Slider translations + * + * @author Martin Auswöger + */ + +$GLOBALS['TL_LANG']['tl_rocksolid_slider_license']['license_legend'] = 'Edit license key'; +$GLOBALS['TL_LANG']['tl_rocksolid_slider_license']['rocksolid_slider_license'][0] = 'License key'; +$GLOBALS['TL_LANG']['tl_rocksolid_slider_license']['rocksolid_slider_license'][1] = 'Please enter a valid license key.'; +$GLOBALS['TL_LANG']['tl_rocksolid_slider_license']['invalidLicense'] = 'The license key is invalid.'; diff --git a/src/MadeYourDay/Contao/Module/Slider.php b/src/MadeYourDay/Contao/Module/Slider.php index c9c81fa..55314b0 100644 --- a/src/MadeYourDay/Contao/Module/Slider.php +++ b/src/MadeYourDay/Contao/Module/Slider.php @@ -42,19 +42,45 @@ public function generate() return $template->parse(); } - // Return if there is no slider id - if (! $this->rsts_id) { - return ''; + if ($this->rsts_content_type === 'rsts_news') { + $newsModule = new SliderNews($this->objModel, $this->strColumn); + $this->newsArticles = $newsModule->getNewsArticles(); + if (!count($this->newsArticles)) { + // Return if there are no news articles + return ''; + } + } + else if ($this->rsts_content_type === 'rsts_events') { + $eventsModule = new SliderEvents($this->objModel, $this->strColumn); + $this->eventItems = $eventsModule->getEventItems(); + if (!count($this->eventItems)) { + // Return if there are no events + return ''; + } + } + else if ($this->rsts_content_type === 'rsts_images' || !$this->rsts_id) { + + $this->multiSRC = deserialize($this->multiSRC); + if (!is_array($this->multiSRC) || !count($this->multiSRC)) { + // Return if there are no images + return ''; + } + } + else { + + $this->slider = SliderModel::findByPk($this->rsts_id); - $this->slider = SliderModel::findByPk($this->rsts_id); + // Return if there is no slider + if (! $this->slider || $this->slider->id !== $this->rsts_id) { + return ''; + } + + $this->multiSRC = deserialize($this->slider->multiSRC); + $this->orderSRC = $this->slider->orderSRC; - // Return if there is no slider - if (! $this->slider || $this->slider->id !== $this->rsts_id) { - return ''; } - $this->multiSRC = deserialize($this->slider->multiSRC); if (version_compare(VERSION, '3.2', '<')) { $this->files = \FilesModel::findMultipleByIds($this->multiSRC); } @@ -112,14 +138,14 @@ protected function compile() } - if ($this->slider->orderSRC) { + if ($this->orderSRC) { // Turn the order string into an array and remove all values if (version_compare(VERSION, '3.2', '<')) { - $order = explode(',', $this->slider->orderSRC); + $order = explode(',', $this->orderSRC); $order = array_map('intval', $order); } else { - $order = deserialize($this->slider->orderSRC); + $order = deserialize($this->orderSRC); } if (!$order || !is_array($order)) { $order = array(); @@ -160,12 +186,31 @@ protected function compile() } $this->Template->images = $images; - $this->Template->slides = $this->parseSlides(SlideModel::findPublishedByPid($this->rsts_id)); + $slides = array(); + if (isset($this->newsArticles)) { + foreach ($this->newsArticles as $newsArticle) { + $slides[] = array( + 'text' => $newsArticle, + ); + } + } + else if (isset($this->eventItems)) { + foreach ($this->eventItems as $eventItem) { + $slides[] = array( + 'text' => $eventItem, + ); + } + } + else if (isset($this->slider->id)) { + $slides = $this->parseSlides(SlideModel::findPublishedByPid($this->slider->id)); + } + + $this->Template->slides = $slides; $options = array(); // strings - foreach (array('type', 'cssPrefix', 'skin', 'width', 'height', 'navType', 'scaleMode', 'imagePosition', 'deepLinkPrefix') as $key) { + foreach (array('type', 'direction', 'cssPrefix', 'skin', 'width', 'height', 'navType', 'scaleMode', 'imagePosition', 'deepLinkPrefix') as $key) { if (! empty($this->arrData['rsts_' . $key])) { $options[$key] = $this->arrData['rsts_' . $key]; } @@ -185,17 +230,24 @@ protected function compile() } // boolean - foreach (array('random', 'loop', 'videoAutoplay', 'autoplayProgress', 'pauseAutoplayOnHover', 'keyboard', 'captions', 'controls') as $key) { + foreach (array('random', 'loop', 'videoAutoplay', 'autoplayProgress', 'pauseAutoplayOnHover', 'keyboard', 'captions', 'controls', 'combineNavItems') as $key) { $options[$key] = (bool) $this->arrData['rsts_' . $key]; } // positive numbers - foreach (array('preloadSlides', 'duration', 'autoplay', 'autoplayRestart') as $key) { + foreach (array('preloadSlides', 'duration', 'autoplay', 'autoplayRestart', 'slideMaxCount', 'slideMinSize', 'prevNextSteps', 'visibleAreaMax') as $key) { if (! empty($this->arrData['rsts_' . $key]) && $this->arrData['rsts_' . $key] > 0) { $options[$key] = $this->arrData['rsts_' . $key] * 1; } } + // percentages + foreach (array('visibleArea') as $key) { + if (!empty($this->arrData['rsts_' . $key])) { + $options[$key] = $this->arrData['rsts_' . $key] / 100; + } + } + // gap size if (isset($this->arrData['rsts_gapSize']) && $this->arrData['rsts_gapSize'] !== '') { if (substr($this->arrData['rsts_gapSize'], -1) === '%') { diff --git a/src/MadeYourDay/Contao/Module/SliderEvents.php b/src/MadeYourDay/Contao/Module/SliderEvents.php new file mode 100644 index 0000000..1f5c469 --- /dev/null +++ b/src/MadeYourDay/Contao/Module/SliderEvents.php @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace MadeYourDay\Contao\Module; + +/** + * Slider Events Module + * + * @author Martin Auswöger + */ +class SliderEvents extends \ModuleEventlist +{ + const TEMPLATE_SEPARATOR = ''; + + /** + * Get an array of events (HTML output) generated by Contao\ModuleEventlist + * + * @return array Events HTML output or an empty array if no events are found. + */ + public function getEventItems() + { + $this->cal_calendar = $this->sortOutProtected(deserialize($this->cal_calendar, true)); + + // Return if there are no calendars + if (!is_array($this->cal_calendar) || empty($this->cal_calendar)) + { + return array(); + } + + // Dummy template object to retrive data from the compile method + $this->Template = new \stdClass; + $this->perPage = 0; + + $parseTemplateHook = array( + 'MadeYourDay\\Contao\\Slider', + 'parseEventsTemplateHook' + ); + // Add the TEMPLATE_SEPARATOR to be able to split the output into single events + $GLOBALS['TL_HOOKS']['parseFrontendTemplate'][] = $parseTemplateHook; + + $this->compile(); + + // Remove the hook + foreach ($GLOBALS['TL_HOOKS']['parseFrontendTemplate'] as $key => $hook) { + if ($hook[0] === $parseTemplateHook[0] && $hook[1] === $parseTemplateHook[1]) { + unset($GLOBALS['TL_HOOKS']['parseFrontendTemplate'][$key]); + } + } + + // Split the output into single event items + $eventItems = explode(static::TEMPLATE_SEPARATOR, $this->Template->events); + + if (count($eventItems) < 2) { + // No events found + return array(); + } + + // Remove output before the first event + array_shift($eventItems); + + return $eventItems; + } +} diff --git a/src/MadeYourDay/Contao/Module/SliderNews.php b/src/MadeYourDay/Contao/Module/SliderNews.php new file mode 100644 index 0000000..5988fd6 --- /dev/null +++ b/src/MadeYourDay/Contao/Module/SliderNews.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace MadeYourDay\Contao\Module; + +/** + * Slider News Module + * + * @author Martin Auswöger + */ +class SliderNews extends \ModuleNewsList +{ + /** + * Get an array of news articles (HTML output) generated by Contao\ModuleNewsList + * + * @return array News HTML output or an empty array if no news are found. + */ + public function getNewsArticles() + { + $this->news_archives = $this->sortOutProtected(deserialize($this->news_archives)); + + // Return if there are no archives + if (!is_array($this->news_archives) || !count($this->news_archives)) { + return array(); + } + + // Dummy template object to retrive data from the compile method + $this->Template = new \stdClass; + $this->perPage = 0; + + $this->compile(); + + if (!is_array($this->Template->articles) || !count($this->Template->articles)) { + return array(); + } + + return $this->Template->articles; + } +} diff --git a/src/MadeYourDay/Contao/Slider.php b/src/MadeYourDay/Contao/Slider.php index ef1ea4a..7e5bd75 100644 --- a/src/MadeYourDay/Contao/Slider.php +++ b/src/MadeYourDay/Contao/Slider.php @@ -8,6 +8,8 @@ namespace MadeYourDay\Contao; +use MadeYourDay\Contao\Module\SliderEvents; + /** * RockSolid Slider DCA * @@ -225,4 +227,173 @@ public function getSliderTemplates() { return $this->getTemplateGroup('rsts_'); } + + /** + * Remove pro fields from DCA + * + * @param string $table + * @param array $fields + * @param array $legends + * @return void + */ + protected function removeProFields($table, $fields = array(), $legends = array()) + { + \System::loadLanguageFile('tl_rocksolid_slider'); + + foreach ($fields as $field) { + $GLOBALS['TL_DCA'][$table]['fields'][$field]['eval']['disabled'] = true; + $GLOBALS['TL_DCA'][$table]['fields'][$field]['eval']['mandatory'] = false; + $GLOBALS['TL_DCA'][$table]['fields'][$field]['label'] = array( + $GLOBALS['TL_DCA'][$table]['fields'][$field]['label'][0], + sprintf($GLOBALS['TL_LANG']['tl_rocksolid_slider']['proFieldDescription'], 'contao/main.php?do=rocksolid_slider&table=tl_rocksolid_slider_license&ref=' . TL_REFERER_ID) . '
' . $GLOBALS['TL_DCA'][$table]['fields'][$field]['label'][1], + ); + } + + foreach ($GLOBALS['TL_DCA'][$table]['palettes'] as $key => $palette) { + foreach ($legends as $legend) { + $GLOBALS['TL_DCA'][$table]['palettes'][$key] = preg_replace('(\\{' . $legend . '\\}[^;]*(;|$))', '{' . $legend . '},rsts_getPro$1', $palette); + } + $GLOBALS['TL_DCA'][$table]['fields']['rsts_getPro'] = array( + 'input_field_callback' => function() { + return '
' + . sprintf($GLOBALS['TL_LANG']['tl_rocksolid_slider']['proLegendDescription'], 'contao/main.php?do=rocksolid_slider&table=tl_rocksolid_slider_license&ref=' . TL_REFERER_ID) + . '
'; + }, + ); + } + } + + /** + * On load callback for tl_rocksolid_slide + * + * @param \DataContainer $dc + * @return void + */ + public function slideOnloadCallback($dc) + { + if (!static::checkLicense()) { + $this->removeProFields($dc->table, array('centerContent'), array('background_legend')); + } + } + + /** + * On load callback for tl_content + * + * @param \DataContainer $dc + * @return void + */ + public function contentOnloadCallback($dc) + { + if (!static::checkLicense()) { + $this->removeProFields($dc->table, array('rsts_content_type', 'rsts_direction', 'rsts_centerContent'), array('rsts_carousel_legend')); + } + + if (!$dc->id) { + return; + } + + $contentElement = \ContentModel::findByPk($dc->id); + + if (!$contentElement || !isset($contentElement->type)) { + return; + } + + if ($contentElement->type === 'rocksolid_slider') { + $GLOBALS['TL_DCA'][$dc->table]['fields']['multiSRC']['eval']['isGallery'] = true; + $GLOBALS['TL_DCA'][$dc->table]['fields']['multiSRC']['eval']['filesOnly'] = true; + $GLOBALS['TL_DCA'][$dc->table]['fields']['multiSRC']['eval']['extensions'] = $GLOBALS['TL_CONFIG']['validImageTypes']; + } + } + + /** + * On load callback for tl_module + * + * @param \DataContainer $dc + * @return void + */ + public function moduleOnloadCallback($dc) + { + if (!static::checkLicense()) { + $this->removeProFields($dc->table, array('rsts_content_type', 'rsts_direction', 'rsts_centerContent'), array('rsts_carousel_legend')); + } + + if (!$dc->id) { + return; + } + + $module = \ModuleModel::findByPk($dc->id); + + if (!$module || !isset($module->type)) { + return; + } + + if ($module->type === 'rocksolid_slider') { + $GLOBALS['TL_DCA'][$dc->table]['fields']['multiSRC']['eval']['isGallery'] = true; + $GLOBALS['TL_DCA'][$dc->table]['fields']['multiSRC']['eval']['filesOnly'] = true; + $GLOBALS['TL_DCA'][$dc->table]['fields']['multiSRC']['eval']['extensions'] = $GLOBALS['TL_CONFIG']['validImageTypes']; + } + } + + /** + * parseFrontendTemplate hook for SliderEvents::getEventItems() + * + * @param string $contents HTML output + * @param string $template Temmplate name + * @return string Modified HTML output + */ + public function parseEventsTemplateHook($contents, $template) + { + // Only modify output of event templates + if (substr($template, 0, 6) === 'event_') { + $contents = SliderEvents::TEMPLATE_SEPARATOR . $contents; + } + + return $contents; + } + + /** + * Check if the license key is valid + * + * @param string $value + * @param \DataContainer $dc + * @return string value + */ + public function licenseSaveCallback($value, $dc) + { + if ($value !== '' && !static::checkLicense($value)) { + throw new \Exception($GLOBALS['TL_LANG']['tl_rocksolid_slider_license']['invalidLicense']); + } + + return $value; + } + + /** + * Checksums of valid license keys + */ + static private $validLicenseChecksums = array( + '85380d820cc50b8542cec3e51d4eac9f', '4732b9a9dd3aae401c98f63294d170a1', '22d538b507a6a0bc095e1a811f4e6f7d', '60f659e658b30dd06902953309f0fb34', '0176edfaa880a282190fd3e165317d10', 'f3d8f0ebfab6534a5a27a62ef95a6529', 'ad82206facc36748c8bc8d91c0586ca3', '8384d476c3a9d6382543d304cfd6c21d', 'f8e8f2da06997ef4c9377563789cc35c', '8ef64e085fa33b4d854b2946def8c869', '5174f9cbb4bac399c12d40660a5e3113', '41b73c9596d5eac961f2d2e96645e004', '1e51b48b566c82563da966f2ee6a7dbc', '822d2eb467c9729ed9c0541fdeae590e', '454e2484c52f396499670928667f43b2', 'e71564d3ebff2ec8636085c379b7e29d', '25bbedcf242e3a0380f59880b6d46d81', '2c1eb7b8a750988d2ec66668ec26d253', '4f2b3524fc8ec25a883cc6329081dccf', 'b9e92376c5e0fae6d335bc2ac699c5e9', 'fe7f4692ee9a6a17b902d2afef1fc384', 'cc067cd4ccd6d4b5af5a665ab59bfd43', '4797c57225b8a98ef2b8c8c97ba6e76f', 'd5ed13cf6bcca1577a7f67207b02cd97', '0b045681ff3eca3a592a7d77961c2fe8', 'dfe6840b260c9b9316febfa7c406da65', '0bf69b1dc131a8bbba1bf5807fb9cfa2', '63d833a0af1ef63d8888125a7639433e', '466331268d08c68e14f3616f8566d099', '6775eb75f3d4b3e6b2450ed15f13aa32', '5657190a80d001785e89a0ca0a40a27c', 'e77567456d818ee70771a7df84612aee', 'ce935bcbf538c212179f53bac0ab507b', '0cd0860142ebc0053337baea065bfb22', '5276e0da003cd2dfed0466088c6538fc', 'c0d482aa84f849dd4d28e0520033319b', 'ba6da4b992141b83865c34fbf6214c68', '482f1d5372ee8567029fea14a09496f7', 'af56c615f0ebc15bd32053a34783f1c9', 'cc1c33a8d5bfbd86f889e0ca3c26de6b', 'e2d95da64963873b96465bcf89f620b2', 'd2319086afa76cc40e79dd4f78bf7178', 'ce5c1dbf30c9e04de201cd5ac8ffd5f3', '2d9d84c1fd29688b898569107bf96472', '2122d3eafd546a065208d9aaa22dc4e0', '239081bf138b3266f20adf9e7b290dec', 'c8e627a9d37345cf069b7a7932c5e806', '66602424a1de4f52949fab44a995d56a', '8c2efdf01db429ebaa9556151099ba33', '4c3e8df2beee8b9a141f582a3cea4dd1', '9fda8bb2036bfbac9b218dec79eeb541', '195cab27a2e0aaeade6fdb25213e06a8', 'c7a25f2a4db2090aba98820f959ab935', '5dbeead3204e47d03a7566ab778dfbf3', '84ec8527df930916bd33c8e11a277e5f', 'da4b029288c2ca045534be801201f69f', '2c77196a51f422fe5a08fbf7b8ec8785', '603a63463eb4b6ef49481dd649d68141', '02cf5192d6b1c89a7433fee4c3d7562d', '0fe2abdb479f42e79f66b3b2eb681cdf', 'a939ca53f988ed92aca3c9406b1e6bdf', '877ff77b1fbd3f88dd4c4544d28382cd', '60362edf52603ad5913c2f83d2dda53d', '846d3be076206ae4f7a9cb96c8473fbf', '95f63730fc688b71551cfe9971bdc60d', + ); + + /** + * Check if the license key is valid + * + * @param string $license license key or null to get the it from the config + * @return bool true if the license key is valid + */ + public static function checkLicense($license = null) + { + if ($license === null) { + $license = \Config::get('rocksolid_slider_license'); + } + + if (!$license) { + return false; + } + + if (in_array(md5($license), static::$validLicenseChecksums, true)) { + return true; + } + + return false; + } } diff --git a/src/MadeYourDay/Contao/SliderRunonce.php b/src/MadeYourDay/Contao/SliderRunonce.php index cbfa918..3190681 100644 --- a/src/MadeYourDay/Contao/SliderRunonce.php +++ b/src/MadeYourDay/Contao/SliderRunonce.php @@ -24,6 +24,19 @@ public static function run() { $database = \Database::getInstance(); + // Copy license key from extension repository + if ( + !\Config::get('rocksolid_slider_license') + && $database->tableExists('tl_repository_installs') + && $database->fieldExists('lickey', 'tl_repository_installs') + && $database->fieldExists('extension', 'tl_repository_installs') + ) { + $result = $database->prepare('SELECT lickey FROM tl_repository_installs WHERE extension = \'rocksolid-slider-pro\'')->execute(); + if ($result && Slider::checkLicense((string)$result->lickey)) { + \Config::persist('rocksolid_slider_license', (string)$result->lickey); + } + } + // Fix the singleSRC data type for Contao 3.1 and below if (version_compare(VERSION, '3.2', '<') && $database->tableExists('tl_rocksolid_slide')) { $fields = $database->listFields('tl_rocksolid_slide'); diff --git a/templates/rsts_default.html5 b/templates/rsts_default.html5 index 8c7f414..20cd54e 100644 --- a/templates/rsts_default.html5 +++ b/templates/rsts_default.html5 @@ -6,7 +6,7 @@ images as $image): ?> -
+
rsts_invertControls)): ?> data-rsts-class="options['cssPrefix']) ? 'rsts-' : $this->options['cssPrefix'] ?>invert-controls"> imgSize ?> alt="alt ?>"> @@ -38,7 +38,10 @@ if (!empty($slide['slideClass'])) { $attributes[] = 'class="' . $slide['slideClass'] . '"'; } - if (!empty($slide['invertControls'])) { + if ( + (!empty($slide['invertControls']) && empty($this->rsts_invertControls)) + || (empty($slide['invertControls']) && !empty($this->rsts_invertControls)) + ) { $slide['sliderClass'] = (empty($slide['sliderClass']) ? '' : $slide['sliderClass'] . ' ') . (empty($this->options['cssPrefix']) ? 'rsts-' : $this->options['cssPrefix']) . 'invert-controls'; @@ -56,6 +59,15 @@ $imageAttributes[] = 'data-rsts-position="' . $slide['imagePosition'] . '"'; } $imageAttributes = implode(' ', $imageAttributes); + + $backgroundAttributes = array('data-rsts-background'); + if (!empty($slide['backgroundScaleMode'])) { + $backgroundAttributes[] = 'data-rsts-scale-mode="' . $slide['backgroundScaleMode'] . '"'; + } + if (!empty($slide['backgroundPosition'])) { + $backgroundAttributes[] = 'data-rsts-position="' . $slide['backgroundPosition'] . '"'; + } + $backgroundAttributes = implode(' ', $backgroundAttributes); ?> @@ -97,6 +109,24 @@ + + poster="src ?>" > + + + + + + + imgSize ?> alt="alt ?>" > + + insert('picture_default', $slide['backgroundImage']->picture); + echo preg_replace('( + + +
@@ -104,5 +134,9 @@
diff --git a/templates/rsts_default.xhtml b/templates/rsts_default.xhtml index 04d3d9c..7a07bf0 100644 --- a/templates/rsts_default.xhtml +++ b/templates/rsts_default.xhtml @@ -6,7 +6,7 @@ images as $image): ?> -
+
rsts_invertControls)): ?> data-rsts-class="options['cssPrefix']) ? 'rsts-' : $this->options['cssPrefix'] ?>invert-controls"> imgSize ?> alt="alt ?>" /> @@ -38,7 +38,10 @@ if (!empty($slide['slideClass'])) { $attributes[] = 'class="' . $slide['slideClass'] . '"'; } - if (!empty($slide['invertControls'])) { + if ( + (!empty($slide['invertControls']) && empty($this->rsts_invertControls)) + || (empty($slide['invertControls']) && !empty($this->rsts_invertControls)) + ) { $slide['sliderClass'] = (empty($slide['sliderClass']) ? '' : $slide['sliderClass'] . ' ') . (empty($this->options['cssPrefix']) ? 'rsts-' : $this->options['cssPrefix']) . 'invert-controls'; @@ -56,6 +59,15 @@ $imageAttributes[] = 'data-rsts-position="' . $slide['imagePosition'] . '"'; } $imageAttributes = implode(' ', $imageAttributes); + + $backgroundAttributes = array('data-rsts-background'); + if (!empty($slide['backgroundScaleMode'])) { + $backgroundAttributes[] = 'data-rsts-scale-mode="' . $slide['backgroundScaleMode'] . '"'; + } + if (!empty($slide['backgroundPosition'])) { + $backgroundAttributes[] = 'data-rsts-position="' . $slide['backgroundPosition'] . '"'; + } + $backgroundAttributes = implode(' ', $backgroundAttributes); ?> @@ -97,6 +109,24 @@ + + poster="src ?>" > + + + + + + + imgSize ?> alt="alt ?>" /> + + insert('picture_default', $slide['backgroundImage']->picture); + echo preg_replace('( + + +
@@ -105,6 +135,10 @@