first commit
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
PLG_QUANTUMSPBUILDER="System - Integration of Quantum Manager with SP Builder"
|
||||
PLG_QUANTUMSPBUILDER_XML_DESCRIPTION="Plugin for integrating Quantum Manager with SP Builder."
|
||||
PLG_QUANTUMSPBUILDER_INSERT_FILE="File insert is in process..."
|
||||
@@ -0,0 +1,2 @@
|
||||
PLG_QUANTUMSPBUILDER="System - Integration of Quantum Manager with SP Builder"
|
||||
PLG_QUANTUMSPBUILDER_XML_DESCRIPTION="Plugin for integrating Quantum Manager with SP Builder."
|
||||
@@ -0,0 +1,3 @@
|
||||
PLG_QUANTUMSPBUILDER="Система - Интеграция Quantum Manager с SP Builder"
|
||||
PLG_QUANTUMSPBUILDER_XML_DESCRIPTION="Плагин для интеграции Quantum Manager с SP Builder."
|
||||
PLG_QUANTUMSPBUILDER_INSERT_FILE="Происходит вставка файла..."
|
||||
@@ -0,0 +1,2 @@
|
||||
PLG_QUANTUMSPBUILDER="Система - Интеграция Quantum Manager с SP Builder"
|
||||
PLG_QUANTUMSPBUILDER_XML_DESCRIPTION="Плагин для интеграции Quantum Manager с SP Builder."
|
||||
172
plugins/system/quantumspbuilder/quantumspbuilder.php
Normal file
172
plugins/system/quantumspbuilder/quantumspbuilder.php
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
/**
|
||||
* @package quantummanager
|
||||
*
|
||||
* @author Dmitry Tsymbal <cymbal@delo-design.ru>
|
||||
* @copyright Copyright © 2019 Delo Design & NorrNext. All rights reserved.
|
||||
* @license GNU General Public License version 3 or later; see license.txt
|
||||
* @link https://www.norrnext.com
|
||||
*/
|
||||
|
||||
use Joomla\CMS\Application\CMSApplication;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\FileLayout;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\Database\DatabaseDriver;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Quantumyoothemepro plugin.
|
||||
*
|
||||
* @package quantumyoothemepro
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class plgSystemQuantumspbuilder extends CMSPlugin
|
||||
{
|
||||
/**
|
||||
* Application object
|
||||
*
|
||||
* @var CMSApplication
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* Database object
|
||||
*
|
||||
* @var DatabaseDriver
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
/**
|
||||
* Affects constructor behavior. If true, language files will be loaded automatically.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 1.0.0
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
|
||||
/**
|
||||
* onAfterRender.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function onBeforeCompileHead()
|
||||
{
|
||||
|
||||
$admin = $this->app->isClient('administrator');
|
||||
$option = $this->app->input->getCmd('option', '');
|
||||
$view = $this->app->input->getCmd('view', '');
|
||||
$layout = $this->app->input->getCmd('layout', '');
|
||||
$check = false;
|
||||
|
||||
if($admin)
|
||||
{
|
||||
$check = ($option === 'com_sppagebuilder' && $view === 'page' && $layout === 'edit');
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!$this->accessCheck())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$check = ($option === 'com_sppagebuilder' && $view === 'form' && $layout === 'edit');
|
||||
}
|
||||
|
||||
if($check)
|
||||
{
|
||||
HTMLHelper::_('stylesheet', 'plg_system_quantumspbuilder/spbuilder.css', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
|
||||
HTMLHelper::_('script', 'plg_system_quantumspbuilder/modal.js', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
|
||||
HTMLHelper::_('script', 'com_quantummanager/utils.js', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
|
||||
|
||||
JLoader::register('QuantummanagerHelper', JPATH_SITE . '/administrator/components/com_quantummanager/helpers/quantummanager.php');
|
||||
QuantummanagerHelper::loadLang();
|
||||
|
||||
$insert = htmlspecialchars(Text::_('COM_QUANTUMMANAGER_ACTION_SELECT'), ENT_QUOTES);
|
||||
$cancel = htmlspecialchars(Text::_('COM_QUANTUMMANAGER_ACTION_CANCEL'), ENT_QUOTES);
|
||||
Factory::getDocument()->addScriptDeclaration(<<<EOT
|
||||
window.QuantumSpbuilderLang = {
|
||||
'insert': "{$insert}",
|
||||
'cancel': "{$cancel}",
|
||||
};
|
||||
EOT
|
||||
);
|
||||
}
|
||||
|
||||
if($option === 'com_sppagebuilder' && $view === 'media')
|
||||
{
|
||||
|
||||
HTMLHelper::_('stylesheet', 'plg_system_quantumspbuilder/formain.css', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
|
||||
HTMLHelper::_('script', 'plg_system_quantumspbuilder/formain.js', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function onAjaxQuantumspbuilder()
|
||||
{
|
||||
|
||||
if(!$this->accessCheck())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$layout = new FileLayout('select', JPATH_SITE . '/plugins/system/quantumspbuilder/tmpl');
|
||||
echo $layout->render();
|
||||
}
|
||||
|
||||
|
||||
protected function accessCheck()
|
||||
{
|
||||
|
||||
if ($this->app->isClient('administrator'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// проверяем на включенность параметра
|
||||
JLoader::register('QuantummanagerHelper', JPATH_ADMINISTRATOR . '/components/com_quantummanager/helpers/quantummanager.php');
|
||||
|
||||
if(!(int)QuantummanagerHelper::getParamsComponentValue('front', 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// проверяем что пользователь авторизован
|
||||
if(Factory::getUser()->id === 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
31
plugins/system/quantumspbuilder/quantumspbuilder.xml
Normal file
31
plugins/system/quantumspbuilder/quantumspbuilder.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="plugin" version="3.8" group="system" method="upgrade">
|
||||
<name>PLG_QUANTUMSPBUILDER</name>
|
||||
<creationDate>23.12.2019</creationDate>
|
||||
<author>Tsymbal</author>
|
||||
<authorEmail>cymbal@delo-design.ru</authorEmail>
|
||||
<authorUrl>https://www.norrnext.com</authorUrl>
|
||||
<copyright>Copyright © 2019 Delo Design & NorrNext. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 3 or later; see license.txt</license>
|
||||
<version>1.5</version>
|
||||
<description>PLG_QUANTUMSPBUILDER_XML_DESCRIPTION</description>
|
||||
|
||||
<languages folder="language">
|
||||
<language tag="en-GB">en-GB/en-GB.plg_system_quantumspbuilder.ini</language>
|
||||
<language tag="en-GB">en-GB/en-GB.plg_system_quantumspbuilder.sys.ini</language>
|
||||
<language tag="ru-RU">ru-RU/ru-RU.plg_system_quantumspbuilder.ini</language>
|
||||
<language tag="ru-RU">ru-RU/ru-RU.plg_system_quantumspbuilder.sys.ini</language>
|
||||
</languages>
|
||||
|
||||
<media folder="media" destination="plg_system_quantumspbuilder">
|
||||
<folder>css</folder>
|
||||
<folder>js</folder>
|
||||
</media>
|
||||
|
||||
<files>
|
||||
<filename plugin="quantumspbuilder">quantumspbuilder.php</filename>
|
||||
<folder>language</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
|
||||
</extension>
|
||||
152
plugins/system/quantumspbuilder/tmpl/select.php
Normal file
152
plugins/system/quantumspbuilder/tmpl/select.php
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
/**
|
||||
* @package quantummanager
|
||||
* @author Dmitry Tsymbal <cymbal@delo-design.ru>
|
||||
* @copyright Copyright © 2019 Delo Design & NorrNext. All rights reserved.
|
||||
* @license GNU General Public License version 3 or later; see license.txt
|
||||
* @link https://www.norrnext.com
|
||||
*/
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
|
||||
$app = Factory::getApplication();
|
||||
$folder = $app->input->get('folder', '', 'string');
|
||||
$app->getSession()->clear('quantummanageraddscripts');
|
||||
|
||||
if(!empty($folder))
|
||||
{
|
||||
$app->getSession()->set('quantummanagerroot', 'images/' . $folder);
|
||||
}
|
||||
else
|
||||
{
|
||||
$app->getSession()->clear('quantummanagerroot');
|
||||
}
|
||||
|
||||
$app->getSession()->clear('quantummanageraddscripts');
|
||||
|
||||
HTMLHelper::_('stylesheet', 'com_quantummanager/window.css', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
|
||||
HTMLHelper::_('script', 'plg_system_quantumspbuilder/select.js', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
|
||||
?>
|
||||
|
||||
<?php
|
||||
|
||||
try {
|
||||
JLoader::register('JFormFieldQuantumCombine', JPATH_ROOT . '/administrator/components/com_quantummanager/fields/quantumcombine.php');
|
||||
JLoader::register('QuantummanagerHelper', JPATH_SITE . '/administrator/components/com_quantummanager/helpers/quantummanager.php');
|
||||
$folderRoot = 'root';
|
||||
|
||||
$buttonsBun = [];
|
||||
$fields = [
|
||||
'quantumtreecatalogs' => [
|
||||
'directory' => $folderRoot,
|
||||
'position' => 'left',
|
||||
'cssClass' => 'quantumtreecatalogs-module-muted'
|
||||
],
|
||||
'quantumupload' => [
|
||||
'maxsize' => QuantummanagerHelper::getParamsComponentValue('maxsize', '10'),
|
||||
'dropAreaHidden' => QuantummanagerHelper::getParamsComponentValue('dropareahidden', '0'),
|
||||
'directory' => $folderRoot
|
||||
],
|
||||
'quantumtoolbar' => [
|
||||
'position' => 'top',
|
||||
'buttons' => 'all',
|
||||
'buttonsBun' => '',
|
||||
'cssClass' => 'quantummanager-module-height-1-1 quantumtoolbar-module-muted quantumtoolbar-padding-horizontal',
|
||||
],
|
||||
'quantumviewfiles' => [
|
||||
'directory' => $folderRoot,
|
||||
'view' => 'list-grid',
|
||||
'onlyfiles' => '0',
|
||||
'watermark' => QuantummanagerHelper::getParamsComponentValue('overlay' , 0) > 0 ? '1' : '0',
|
||||
'help' => QuantummanagerHelper::getParamsComponentValue('help' , '1'),
|
||||
'metafile' => QuantummanagerHelper::getParamsComponentValue('metafile' , '1'),
|
||||
],
|
||||
'quantumcropperjs' => [
|
||||
'position' => 'bottom'
|
||||
]
|
||||
/*'quantumcodemirror' => [
|
||||
'position' => 'center'
|
||||
],*/
|
||||
];
|
||||
|
||||
if((int)QuantummanagerHelper::getParamsComponentValue('unsplash', '1'))
|
||||
{
|
||||
$fields['quantumunsplash'] = [
|
||||
'position' => 'bottom'
|
||||
];
|
||||
}
|
||||
|
||||
if((int)QuantummanagerHelper::getParamsComponentValue('pexels', '1'))
|
||||
{
|
||||
$fields['quantumpexels'] = [
|
||||
'position' => 'bottom'
|
||||
];
|
||||
}
|
||||
|
||||
if((int)QuantummanagerHelper::getParamsComponentValue('pixabay', '1'))
|
||||
{
|
||||
$fields['quantumpixabay'] = [
|
||||
'position' => 'bottom'
|
||||
];
|
||||
}
|
||||
|
||||
$actions = QuantummanagerHelper::getActions();
|
||||
if (!$actions->get('core.create'))
|
||||
{
|
||||
$buttonsBun[] = 'viewfilesCreateDirectory';
|
||||
unset($fields['quantumupload']);
|
||||
}
|
||||
|
||||
if (!$actions->get('core.delete'))
|
||||
{
|
||||
unset($fields['quantumcropperjs']);
|
||||
}
|
||||
|
||||
if (!$actions->get('core.delete'))
|
||||
{
|
||||
$buttonsBun[] = 'viewfilesDelete';
|
||||
}
|
||||
|
||||
$optionsForField = [
|
||||
'name' => 'filemanager',
|
||||
'label' => '',
|
||||
'fields' => json_encode($fields)
|
||||
];
|
||||
|
||||
$field = new JFormFieldQuantumCombine();
|
||||
foreach ($optionsForField as $name => $value)
|
||||
{
|
||||
$field->__set($name, $value);
|
||||
}
|
||||
echo $field->getInput();
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo $e->getMessage();
|
||||
}
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
window.QuantumwindowLang = {
|
||||
'buttonInsert': '<?php echo Text::_('COM_QUANTUMMANAGER_WINDOW_INSERT'); ?>',
|
||||
'inputAlt': '<?php echo Text::_('PLG_QUANTUMMANAGERMEDIA_WINDOW_ALT'); ?>',
|
||||
'inputWidth': '<?php echo Text::_('PLG_QUANTUMMANAGERMEDIA_WINDOW_WIDTH'); ?>',
|
||||
'inputHeight': '<?php echo Text::_('PLG_QUANTUMMANAGERMEDIA_WINDOW_HEIGHT'); ?>',
|
||||
'inputHspace': '<?php echo Text::_('PLG_QUANTUMMANAGERMEDIA_WINDOW_HSPACE'); ?>',
|
||||
'inputVspace': '<?php echo Text::_('PLG_QUANTUMMANAGERMEDIA_WINDOW_VSPACES'); ?>',
|
||||
'inputAlign': '<?php echo Text::_('PLG_QUANTUMMANAGERMEDIA_WINDOW_ALIGN'); ?>',
|
||||
'inputCssClass': '<?php echo Text::_('PLG_QUANTUMMANAGERMEDIA_WINDOW_CLASS'); ?>',
|
||||
'insertedFile': '<?php echo Text::_('PLG_QUANTUMSPBUILDER_INSERT_FILE'); ?>',
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user