This commit is contained in:
2024-05-20 15:37:46 +03:00
commit 00b7dbd0b7
10404 changed files with 3285853 additions and 0 deletions

View File

@@ -0,0 +1,112 @@
<?php
namespace Nextend\SmartSlider3\Widget\Group;
use Nextend\Framework\Form\ContainerInterface;
use Nextend\Framework\Form\Element\CheckboxOnOff;
use Nextend\Framework\Form\Element\Group\GroupCheckboxOnOff;
use Nextend\Framework\Form\Form;
use Nextend\Framework\Pattern\OrderableTrait;
use Nextend\SmartSlider3\Widget\AbstractWidget;
use Nextend\SmartSlider3\Widget\WidgetGroupFactory;
abstract class AbstractWidgetGroup {
use OrderableTrait;
/** @var AbstractWidget[] */
private $widgets = array();
protected $showOnMobileDefault = 0;
public function __construct() {
WidgetGroupFactory::addGroup($this);
}
public abstract function getName();
public abstract function getLabel();
/**
* @param $name
* @param AbstractWidget $widget
*/
public function addWidget($name, $widget) {
$this->widgets[$name] = $widget;
}
/**
* @return AbstractWidget[]
*/
public function getWidgets() {
return $this->widgets;
}
/**
* @param $name
*
* @return AbstractWidget
*/
public function getWidget($name) {
return $this->widgets[$name];
}
/**
* @param ContainerInterface $container
*/
abstract public function renderFields($container);
/**
* @param Form $form
*/
protected function compatibility($form) {
$name = $this->getName();
/**
* Convert to the new control form with the enable field
*/
if (!$form->has('widget-' . $name . '-enabled')) {
if ($form->get('widget' . $name, 'disabled') !== 'disabled') {
$form->set('widget-' . $name . '-enabled', 1);
} else {
$form->set('widget-' . $name . '-enabled', 0);
}
}
$widgets = $this->getWidgets();
$widgetPreset = $form->get('widget' . $name);
if (!isset($widgets[$widgetPreset])) {
$widgetPreset = key($widgets);
$form->set('widget' . $name, $widgetPreset);
}
$widget = $widgets[$widgetPreset];
$form->fillDefault($widget->getDefaults());
}
protected function addHideOnFeature($key, $row) {
$groupShowOn = new GroupCheckboxOnOff($row, $key, n2_('Hide on'));
new CheckboxOnOff($groupShowOn, $key . 'mobileportrait', false, 'ssi_16 ssi_16--mobileportrait', $this->showOnMobileDefault, array(
'invert' => true,
'checkboxTip' => n2_('Mobile')
));
new CheckboxOnOff($groupShowOn, $key . 'tabletportrait', false, 'ssi_16 ssi_16--tabletportrait', 1, array(
'invert' => true,
'checkboxTip' => n2_('Tablet')
));
new CheckboxOnOff($groupShowOn, $key . 'desktopportrait', false, 'ssi_16 ssi_16--desktopportrait', 1, array(
'invert' => true,
'checkboxTip' => n2_('Desktop')
));
}
}

View File

@@ -0,0 +1,80 @@
<?php
namespace Nextend\SmartSlider3\Widget\Group;
use Nextend\Framework\Form\Container\ContainerTab;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Pattern\PluggableTrait;
use Nextend\SmartSlider3\Form\Element\ControlTypePicker;
use Nextend\SmartSlider3\Widget\Arrow\ArrowImage\ArrowImage;
class Arrow extends AbstractWidgetGroup {
use PluggableTrait;
public $ordering = 1;
public function __construct() {
parent::__construct();
new ArrowImage($this, 'imageSmallRectangle', array(
'widget-arrow-desktop-image-width' => 26,
'widget-arrow-tablet-image-width' => 26,
'widget-arrow-previous' => '$ss$/plugins/widgetarrow/image/image/previous/full.svg',
'widget-arrow-next' => '$ss$/plugins/widgetarrow/image/image/next/full.svg',
'widget-arrow-style' => '{"data":[{"backgroundcolor":"000000ab","padding":"2|*|2|*|2|*|2|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"3","extra":""},{"backgroundcolor":"FF9139FF"}]}'
));
new ArrowImage($this, 'imageEmpty', array(
'widget-arrow-previous' => '$ss$/plugins/widgetarrow/image/image/previous/thin-horizontal.svg',
'widget-arrow-next' => '$ss$/plugins/widgetarrow/image/image/next/thin-horizontal.svg',
'widget-arrow-style' => ''
));
$this->makePluggable('SliderWidgetArrow');
}
public function getName() {
return 'arrow';
}
public function getLabel() {
return n2_('Arrows');
}
/**
* @param ContainerTab $container
*/
public function renderFields($container) {
$form = $container->getForm();
$this->compatibility($form);
/**
* Used for field removal: /controls/widget-arrow
*/
$table = new ContainerTable($container, 'widget-arrow', n2_('Arrow'));
new OnOff($table->getFieldsetLabel(), 'widget-arrow-enabled', false, 0, array(
'relatedFieldsOn' => array(
'table-rows-widget-arrow'
)
));
$row1 = $table->createRow('widget-arrow-1');
$ajaxUrl = $form->createAjaxUrl(array("slider/renderwidgetarrow"));
new ControlTypePicker($row1, 'widgetarrow', $table, $ajaxUrl, $this, 'imageEmpty');
$row2 = $table->createRow('widget-arrow-2');
new OnOff($row2, 'widget-arrow-display-hover', n2_('Shows on hover'), 0);
$this->addHideOnFeature('widget-arrow-display-', $row2);
}
}

View File

@@ -0,0 +1,108 @@
<?php
namespace Nextend\SmartSlider3\Widget\Group;
use Nextend\Framework\Data\Data;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Parser\Common;
use Nextend\Framework\Pattern\PluggableTrait;
use Nextend\SmartSlider3\Form\Element\ControlTypePicker;
use Nextend\SmartSlider3\Widget\Autoplay\AutoplayImage\AutoplayImage;
class Autoplay extends AbstractWidgetGroup {
use PluggableTrait;
public $ordering = 3;
protected $showOnMobileDefault = 1;
public function __construct() {
parent::__construct();
new AutoplayImage($this, 'image');
$this->makePluggable('SliderWidgetAutoplay');
}
public function getName() {
return 'autoplay';
}
public function getLabel() {
return n2_('Autoplay');
}
public function renderFields($container) {
$form = $container->getForm();
$this->compatibility($form);
$autoplayFinish = $form->get('autoplayfinish');
if (!$form->has('autoplayLoop') && !empty($autoplayFinish)) {
$this->upgradeData($form);
}
$table = new ContainerTable($container, 'widget-autoplay', n2_('Button'));
new OnOff($table->getFieldsetLabel(), 'widget-autoplay-enabled', false, 0, array(
'relatedFieldsOn' => array(
'table-rows-widget-autoplay'
)
));
$row1 = $table->createRow('widget-bullet-1');
$url = $form->createAjaxUrl(array("slider/renderwidgetautoplay"));
new ControlTypePicker($row1, 'widgetautoplay', $table, $url, $this, 'image');
$row2 = $table->createRow('widget-bullet-2');
new OnOff($row2, 'widget-autoplay-display-hover', n2_('Shows on hover'), 0);
$this->addHideOnFeature('widget-autoplay-display-', $row2);
}
/**
* For compatibility with legacy autoplay values.
*
* @param Data $data
*/
protected function upgradeData($data) {
if (!$data->has('autoplayLoop')) {
list($interval, $intervalModifier, $intervalSlide) = (array)Common::parse($data->get('autoplayfinish', '1|*|loop|*|current'));
if ($interval <= 0) {
// 0|*|slide|*|current -> In old versions it brought to the Next slide.
if ($interval <= 0 && $intervalModifier === 'slide' && $intervalSlide === 'next') {
$data->set('autoplayfinish', '1|*|slide|*|current');
$data->set('autoplayLoop', 0);
}
// 0|*|loop/slide/slideindex|*|current -> Infinite loop
// 0|*|loop|*|next -> Infinite loop
if ($intervalSlide === 'current' || ($intervalModifier === 'loop' && $intervalSlide === 'next')) {
$data->set('autoplayfinish', '1|*|loop|*|current');
$data->set('autoplayLoop', 1);
}
// 0|*|slideindex|*|next -> In old versions it always brought to the 2nd slide.
if ($intervalModifier === 'slideindex' && $intervalSlide === 'next') {
$data->set('autoplayfinish', '2|*|slideindex|*|current');
$data->set('autoplayLoop', '0');
}
} else {
//next is not allowed for "slide" and "slideindex" interval modifiers
if ($intervalModifier === 'slide' || $intervalModifier === 'slideindex') {
$data->set('autoplayfinish', $interval . '|*|' . $intervalModifier . '|*|current');
}
// turn off Loop, and work with the original settings
$data->set('autoplayLoop', '0');
}
}
}
}

View File

@@ -0,0 +1,73 @@
<?php
namespace Nextend\SmartSlider3\Widget\Group;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Pattern\PluggableTrait;
use Nextend\SmartSlider3\Form\Element\ControlTypePicker;
use Nextend\SmartSlider3\Widget\Bar\BarHorizontal\BarHorizontal;
class Bar extends AbstractWidgetGroup {
use PluggableTrait;
public $ordering = 5;
protected $showOnMobileDefault = 1;
public function __construct() {
parent::__construct();
new BarHorizontal($this, 'horizontal');
new BarHorizontal($this, 'horizontalFull', array(
'widget-bar-position-offset' => 0,
'widget-bar-style' => '{"data":[{"backgroundcolor":"000000ab","padding":"20|*|20|*|20|*|20|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"0","extra":""}]}',
'widget-bar-full-width' => 1,
'widget-bar-align' => 'left'
));
$this->makePluggable('SliderWidgetBar');
}
public function getName() {
return 'bar';
}
public function getLabel() {
return n2_('Text bar');
}
public function renderFields($container) {
$form = $container->getForm();
$this->compatibility($form);
/**
* Used for field removal: /controls/widget-bar
*/
$table = new ContainerTable($container, 'widget-bar', n2_('Text bar'));
new OnOff($table->getFieldsetLabel(), 'widget-bar-enabled', false, 0, array(
'relatedFieldsOn' => array(
'table-rows-widget-bar'
)
));
$row1 = $table->createRow('widget-bar-1');
$ajaxUrl = $form->createAjaxUrl(array("slider/renderwidgetbar"));
new ControlTypePicker($row1, 'widgetbar', $table, $ajaxUrl, $this, 'horizontal');
$row2 = $table->createRow('widget-bar-2');
new OnOff($row2, 'widget-bar-display-hover', n2_('Shows on hover'), 0);
$this->addHideOnFeature('widget-bar-display-', $row2);
}
}

View File

@@ -0,0 +1,115 @@
<?php
namespace Nextend\SmartSlider3\Widget\Group;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Select;
use Nextend\Framework\Form\Element\Style;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\NumberAutoComplete;
use Nextend\Framework\Pattern\PluggableTrait;
use Nextend\SmartSlider3\Form\Element\ControlTypePicker;
use Nextend\SmartSlider3\Widget\Bullet\BulletTransition\BulletTransition;
class Bullet extends AbstractWidgetGroup {
use PluggableTrait;
public $ordering = 2;
protected $showOnMobileDefault = 1;
public function __construct() {
parent::__construct();
new BulletTransition($this, 'transition');
$this->makePluggable('SliderWidgetBullet');
}
public function getName() {
return 'bullet';
}
public function getLabel() {
return n2_('Bullets');
}
public function renderFields($container) {
$form = $container->getForm();
$this->compatibility($form);
/**
* Used for field removal: /controls/widget-bullet
*/
$table = new ContainerTable($container, 'widget-bullet', n2_('Bullets'));
new OnOff($table->getFieldsetLabel(), 'widget-bullet-enabled', false, 0, array(
'relatedFieldsOn' => array(
'table-rows-widget-bullet'
)
));
$row1 = $table->createRow('widget-bullet-1');
$url = $form->createAjaxUrl(array("slider/renderwidgetbullet"));
new ControlTypePicker($row1, 'widgetbullet', $table, $url, $this);
$row2 = $table->createRow('widget-bullet-2');
new OnOff($row2, 'widget-bullet-thumbnail-show-image', n2_('Image'), 0, array(
'relatedFieldsOn' => array(
'sliderwidget-bullet-thumbnail-width',
'sliderwidget-bullet-thumbnail-height',
'sliderwidget-bullet-thumbnail-style',
'sliderwidget-bullet-thumbnail-side'
)
));
new NumberAutoComplete($row2, 'widget-bullet-thumbnail-width', n2_('Width'), 100, array(
'unit' => 'px',
'values' => array(
60,
100,
150,
200
),
'wide' => 4
));
new NumberAutoComplete($row2, 'widget-bullet-thumbnail-height', n2_('Height'), 60, array(
'unit' => 'px',
'values' => array(
60,
100,
150,
200
),
'wide' => 4
));
new Style($row2, 'widget-bullet-thumbnail-style', n2_('Style'), '{"data":[{"backgroundcolor":"00000080","padding":"3|*|3|*|3|*|3|*|px","boxshadow":"0|*|0|*|0|*|0|*|000000ff","border":"0|*|solid|*|000000ff","borderradius":"3","extra":"margin: 5px;background-size:cover;"}]}', array(
'mode' => 'simple',
'preview' => 'SmartSliderAdminWidgetBulletThumbnail'
));
new Select($row2, 'widget-bullet-thumbnail-side', n2_('Side'), 'before', array(
'options' => array(
'before' => n2_('Before'),
'after' => n2_('After')
)
));
$row3 = $table->createRow('widget-bullet-3');
new OnOff($row3, 'widget-bullet-display-hover', n2_('Shows on hover'), 0);
$this->addHideOnFeature('widget-bullet-display-', $row3);
}
}

View File

@@ -0,0 +1,57 @@
<?php
namespace Nextend\SmartSlider3\Widget\Group;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Pattern\PluggableTrait;
use Nextend\SmartSlider3\Form\Element\ControlTypePicker;
use Nextend\SmartSlider3\Widget\Shadow\ShadowImage\ShadowImage;
class Shadow extends AbstractWidgetGroup {
use PluggableTrait;
public $ordering = 7;
public function __construct() {
parent::__construct();
new ShadowImage($this, 'shadow');
$this->makePluggable('SliderWidgetShadow');
}
public function getName() {
return 'shadow';
}
public function getLabel() {
return n2_('Shadow');
}
public function renderFields($container) {
$form = $container->getForm();
$this->compatibility($form);
$table = new ContainerTable($container, 'widgetshadow', n2_('Shadow'));
new OnOff($table->getFieldsetLabel(), 'widget-shadow-enabled', false, 0, array(
'relatedFieldsOn' => array(
'table-rows-widgetshadow'
)
));
$row1 = $table->createRow('widget-shadow-1');
$url = $form->createAjaxUrl(array("slider/renderwidgetshadow"));
new ControlTypePicker($row1, 'widgetshadow', $table, $url, $this);
$row2 = $table->createRow('widget-shadow-2');
$this->addHideOnFeature('widget-shadow-display-', $row2);
}
}

View File

@@ -0,0 +1,139 @@
<?php
namespace Nextend\SmartSlider3\Widget\Group;
use Nextend\Framework\Form\Container\ContainerTab;
use Nextend\Framework\Form\Container\ContainerTable;
use Nextend\Framework\Form\Element\OnOff;
use Nextend\Framework\Form\Element\Text;
use Nextend\Framework\Form\Element\Text\NumberAutoComplete;
use Nextend\Framework\Pattern\PluggableTrait;
use Nextend\SmartSlider3\Form\Element\ControlTypePicker;
use Nextend\SmartSlider3\Widget\Thumbnail\Basic\ThumbnailBasic;
class Thumbnail extends AbstractWidgetGroup {
use PluggableTrait;
public $ordering = 6;
public function __construct() {
parent::__construct();
new ThumbnailBasic($this, 'default');
$this->makePluggable('SliderWidgetThumbnail');
}
public function getName() {
return 'thumbnail';
}
public function getLabel() {
return n2_('Thumbnails');
}
/**
* @param ContainerTab $container
*/
public function renderFields($container) {
$form = $container->getForm();
$this->compatibility($form);
/**
* Used for field removal: /controls/widget-thumbnail
*/
$table = new ContainerTable($container, 'widget-thumbnail', n2_('Thumbnails'));
new OnOff($table->getFieldsetLabel(), 'widget-thumbnail-enabled', false, 0, array(
'relatedFieldsOn' => array(
'table-rows-widget-thumbnail'
)
));
$row1 = $table->createRow('widget-thumbnail-1');
$row2 = $table->createRow('widget-thumbnail-2');
new NumberAutoComplete($row2, 'widget-thumbnail-width', n2_('Desktop width'), 100, array(
'unit' => 'px',
'values' => array(
60,
100,
150,
200
),
'wide' => 4
));
new NumberAutoComplete($row2, 'widget-thumbnail-height', n2_('Height'), 60, array(
'unit' => 'px',
'values' => array(
60,
100,
150,
200
),
'wide' => 4
));
new NumberAutoComplete($row2, 'widget-thumbnail-tablet-width', n2_('Tablet width'), 100, array(
'unit' => 'px',
'values' => array(
60,
100,
150,
200
),
'wide' => 4
));
new NumberAutoComplete($row2, 'widget-thumbnail-tablet-height', n2_('Height'), 60, array(
'unit' => 'px',
'values' => array(
60,
100,
150,
200
),
'wide' => 4
));
new NumberAutoComplete($row2, 'widget-thumbnail-mobile-width', n2_('Mobile width'), 100, array(
'unit' => 'px',
'values' => array(
60,
100,
150,
200
),
'wide' => 4
));
new NumberAutoComplete($row2, 'widget-thumbnail-mobile-height', n2_('Height'), 60, array(
'unit' => 'px',
'values' => array(
60,
100,
150,
200
),
'wide' => 4
));
$ajaxUrl = $form->createAjaxUrl(array("slider/renderwidgetthumbnail"));
new ControlTypePicker($row1, 'widgetthumbnail', $table, $ajaxUrl, $this, 'default');
$row3 = $table->createRow('widget-thumbnail-3');
new OnOff($row3, 'widget-thumbnail-display-hover', n2_('Shows on hover'), 0);
$this->addHideOnFeature('widget-thumbnail-display-', $row3);
}
}