first commit
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
PLG_QUANTUMMANAGERMEDIA="System - Redirect Media (com_media) call to Quantum Manager"
|
||||
PLG_QUANTUMMANAGERMEDIA_XML_DESCRIPTION="The plugin replaces the call of the standard manager with the Quantum Manager."
|
||||
|
||||
PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIA_LABEL="Replace Media Field"
|
||||
PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIA_DESC="Replace media type fields or not. Media fields in subforms are not processed yet."
|
||||
PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIAADMINISTRATORCOMPONENTS_LABEL="Where to Replace"
|
||||
PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIAADMINISTRATORCOMPONENTS_DESC="Select the components where you want to replace media type fields. This only works in Administrator Control Panel."
|
||||
PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIAPREVIEW_LABEL="Show Preview"
|
||||
PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIAPATH_LABEL="Default Path"
|
||||
PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIAPATH_DESC="The default path for fast loading. You can use variables from Quantum Manager."
|
||||
|
||||
PLG_QUANTUMMANAGERMEDIA_MODAL_LABEL="Modal Window Override"
|
||||
PLG_QUANTUMMANAGERMEDIA_MODAL_DESC="Use wide modal windows everywhere in Administrator Control Panel."
|
||||
PLG_QUANTUMMANAGERMEDIA_WINDOW_ALT="Image description"
|
||||
PLG_QUANTUMMANAGERMEDIA_WINDOW_WIDTH="Width (in pixels)"
|
||||
PLG_QUANTUMMANAGERMEDIA_WINDOW_HEIGHT="Height (in pixels)"
|
||||
PLG_QUANTUMMANAGERMEDIA_WINDOW_HSPACE="Horizontal margin"
|
||||
PLG_QUANTUMMANAGERMEDIA_WINDOW_VSPACES="Vertical margin"
|
||||
PLG_QUANTUMMANAGERMEDIA_WINDOW_ALIGN="Alignment"
|
||||
PLG_QUANTUMMANAGERMEDIA_WINDOW_CLASS="CSS Class"
|
||||
@@ -0,0 +1,2 @@
|
||||
PLG_QUANTUMMANAGERMEDIA="System - Redirect Media (com_media) call to Quantum Manager"
|
||||
PLG_QUANTUMMANAGERMEDIA_XML_DESCRIPTION="The plugin replaces the call of the standard manager with the Quantum Manager"
|
||||
@@ -0,0 +1,20 @@
|
||||
PLG_QUANTUMMANAGERMEDIA="Система - Замена вызова медиа-менеджера (com_media) на Quantum Manager"
|
||||
PLG_QUANTUMMANAGERMEDIA_XML_DESCRIPTION="Плагин заменяет вызов стандратного менеджера на Quantum Manager."
|
||||
|
||||
PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIA_LABEL="Заменять поле media"
|
||||
PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIA_DESC="Заменять поля типа media или нет. Поля media в сабформах пока не обрабатываются."
|
||||
PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIAADMINISTRATORCOMPONENTS_LABEL="Где заменять"
|
||||
PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIAADMINISTRATORCOMPONENTS_DESC="В каких компонентах можно заменять поля типа media. Работает только в панели управления."
|
||||
PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIAPREVIEW_LABEL="Показывать превью"
|
||||
PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIAPATH_LABEL="Путь по умолчанию"
|
||||
PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIAPATH_DESC="Путь по умолчанию для быстрой загрузки. Можно использовать переменные из Quantum Manager."
|
||||
|
||||
PLG_QUANTUMMANAGERMEDIA_MODAL_LABEL="Переопределение модальных окон"
|
||||
PLG_QUANTUMMANAGERMEDIA_MODAL_DESC="Применить большие модальные окна во всей панели управления."
|
||||
PLG_QUANTUMMANAGERMEDIA_WINDOW_ALT="Описание изображения"
|
||||
PLG_QUANTUMMANAGERMEDIA_WINDOW_WIDTH="Ширина (в пикселях)"
|
||||
PLG_QUANTUMMANAGERMEDIA_WINDOW_HEIGHT="Высота (в пикселях)"
|
||||
PLG_QUANTUMMANAGERMEDIA_WINDOW_HSPACE="Горизонтальный отступ"
|
||||
PLG_QUANTUMMANAGERMEDIA_WINDOW_VSPACES="Вертикальный отступ"
|
||||
PLG_QUANTUMMANAGERMEDIA_WINDOW_ALIGN="Выравнивание"
|
||||
PLG_QUANTUMMANAGERMEDIA_WINDOW_CLASS="CSS класс"
|
||||
@@ -0,0 +1,2 @@
|
||||
PLG_QUANTUMMANAGERMEDIA="Система - Замена вызова медиа-менеджера (com_media) на Quantum Manager"
|
||||
PLG_QUANTUMMANAGERMEDIA_XML_DESCRIPTION="Плагин заменяет вызов стандратного менеджера на Quantum Manager."
|
||||
427
plugins/system/quantummanagermedia/quantummanagermedia.php
Normal file
427
plugins/system/quantummanagermedia/quantummanagermedia.php
Normal file
@@ -0,0 +1,427 @@
|
||||
<?php
|
||||
/**
|
||||
* @package quantummanagermedia
|
||||
* @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\Application\CMSApplication;
|
||||
use Joomla\CMS\Factory;
|
||||
use Joomla\CMS\Form\Form;
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\Layout\FileLayout;
|
||||
use Joomla\CMS\Plugin\CMSPlugin;
|
||||
use Joomla\Database\DatabaseDriver;
|
||||
|
||||
/**
|
||||
* Quantummanagermedia plugin.
|
||||
*
|
||||
* @package quantummanagermedia
|
||||
* @since 1.0
|
||||
*/
|
||||
class plgSystemQuantummanagermedia extends CMSPlugin
|
||||
{
|
||||
|
||||
/**
|
||||
* Application object
|
||||
*
|
||||
* @var CMSApplication
|
||||
* @since 1.0
|
||||
*/
|
||||
protected $app;
|
||||
|
||||
|
||||
/**
|
||||
* Database object
|
||||
*
|
||||
* @var DatabaseDriver
|
||||
* @since 1.0
|
||||
*/
|
||||
protected $db;
|
||||
|
||||
|
||||
/**
|
||||
* Affects constructor behavior. If true, language files will be loaded automatically.
|
||||
*
|
||||
* @var boolean
|
||||
* @since 1.0
|
||||
*/
|
||||
protected $autoloadLanguage = true;
|
||||
|
||||
|
||||
protected $install_quantummanager = false;
|
||||
|
||||
|
||||
public function __construct(&$subject, $config = array())
|
||||
{
|
||||
parent::__construct($subject, $config);
|
||||
|
||||
if(file_exists(JPATH_SITE . '/administrator/components/com_quantummanager/quantummanager.php'))
|
||||
{
|
||||
$this->install_quantummanager = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function onAfterRoute()
|
||||
{
|
||||
if(!$this->install_quantummanager)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->accessCheck())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
(
|
||||
$this->app->input->get('option') === 'com_media' &&
|
||||
$this->app->input->get('view') === 'images'
|
||||
) ||
|
||||
$this->app->input->getString('qm', '0') === '1'
|
||||
)
|
||||
{
|
||||
$data = $this->app->input->getArray();
|
||||
$data['option'] = 'com_ajax';
|
||||
$data['plugin'] = 'quantummanagermedia';
|
||||
$data['format'] = 'html';
|
||||
$data['tmpl'] = 'component';
|
||||
unset($data['qm']);
|
||||
|
||||
$this->app->redirect('index.php?' . http_build_query($data));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function onBeforeRender()
|
||||
{
|
||||
if(!$this->install_quantummanager)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->accessCheck())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$data = $this->app->input->getArray();
|
||||
|
||||
HTMLHelper::_('stylesheet', 'com_quantummanager/modalhelper.css', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds addition meta title
|
||||
*
|
||||
* @param JForm $form The form to be altered.
|
||||
* @param mixed $data The associated data for the form.
|
||||
*
|
||||
* @return boolean
|
||||
*
|
||||
* @since 1.0
|
||||
*/
|
||||
public function onContentPrepareForm($form, $data)
|
||||
{
|
||||
|
||||
if(!$this->install_quantummanager)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$component = $this->app->input->get('option');
|
||||
$view = $this->app->input->get('view');
|
||||
$enableMedia = (int) $this->params->get('enablemedia', 1);
|
||||
$enablemediapath = $this->params->get('enablemediapath', '');
|
||||
$path = '';
|
||||
|
||||
JLoader::register('QuantummanagerHelper', JPATH_SITE . '/administrator/components/com_quantummanager/helpers/quantummanager.php');
|
||||
|
||||
$scopes = QuantummanagerHelper::getAllScope();
|
||||
$scope_images = new stdClass();
|
||||
foreach ($scopes as $scope)
|
||||
{
|
||||
if ($scope->id === 'images')
|
||||
{
|
||||
$path = QuantummanagerHelper::preparePath($scope->path, false, $scope->id);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($enablemediapath))
|
||||
{
|
||||
$path = 'images/' . $enablemediapath;
|
||||
}
|
||||
|
||||
$enablemediapreview = !(int) $this->params->get('enablemediapreview', 1);
|
||||
|
||||
if ($this->accessCheck() && $enableMedia)
|
||||
{
|
||||
$enableMediaComponents = $this->params->get('enablemediaadministratorcomponents', ['com_content.article', 'com_content.form']);
|
||||
|
||||
if (!is_array($enableMediaComponents))
|
||||
{
|
||||
$enableMediaComponents = ['com_content.article', 'com_content.form'];
|
||||
}
|
||||
|
||||
if (in_array($component . '.' . $view, $enableMediaComponents, true))
|
||||
{
|
||||
Form::addFieldPath(JPATH_ROOT . '/libraries/lib_fields/fields/quantumuploadimage');
|
||||
|
||||
if ($component !== 'com_content')
|
||||
{
|
||||
foreach ($form->getFieldsets() as $fieldset)
|
||||
{
|
||||
foreach ($form->getFieldset($fieldset->name) as $field)
|
||||
{
|
||||
$type = $field->__get('type');
|
||||
$name = $field->__get('fieldname');
|
||||
$group = $field->__get('group');
|
||||
|
||||
if (strtolower($type) === 'media')
|
||||
{
|
||||
$form->setFieldAttribute($name, 'type', 'quantumuploadimage', $group);
|
||||
$form->setFieldAttribute($name, 'addfieldpath', '/libraries/lib_fields/fields/quantumuploadimage', $group);
|
||||
$form->setFieldAttribute($name, 'directory', $path, $group);
|
||||
$form->setFieldAttribute($name, 'dropAreaHidden', $enablemediapreview, $group);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$xml = $form->getXml();
|
||||
$this->fixForComContent($xml);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->app->isClient('administrator'))
|
||||
{
|
||||
$this->addCssForButtonImage();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function onAjaxQuantummanagermedia()
|
||||
{
|
||||
if(!$this->install_quantummanager)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->accessCheck())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
JLoader::register('QuantummanagerHelper', JPATH_ROOT . '/administrator/components/com_quantummanager/helpers/quantummanager.php');
|
||||
QuantummanagerHelper::loadlang();
|
||||
$layout = new FileLayout('default', JPATH_ROOT . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, [
|
||||
'plugins', 'system', 'quantummanagermedia', 'tmpl'
|
||||
]));
|
||||
echo $layout->render();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $base
|
||||
* @param SimpleXMLElement $node
|
||||
*/
|
||||
protected function fixForComContent(SimpleXMLElement &$node)
|
||||
{
|
||||
$childNodes = $node->children();
|
||||
$enablemediapath = $this->params->get('enablemediapath', '');
|
||||
$enablemediapreview = (int) $this->params->get('enablemediapreview', 1);
|
||||
$path = '';
|
||||
|
||||
JLoader::register('QuantummanagerHelper', JPATH_SITE . '/administrator/components/com_quantummanager/helpers/quantummanager.php');
|
||||
|
||||
$scopes = QuantummanagerHelper::getAllScope();
|
||||
$scope_images = new stdClass();
|
||||
foreach ($scopes as $scope)
|
||||
{
|
||||
if ($scope->id === 'images')
|
||||
{
|
||||
$path = QuantummanagerHelper::preparePath($scope->path, false, $scope->id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($enablemediapath))
|
||||
{
|
||||
$path = 'images/' . $enablemediapath;
|
||||
}
|
||||
|
||||
|
||||
if ($node->getName() === 'field')
|
||||
{
|
||||
foreach ($node->attributes() as $a => $b)
|
||||
{
|
||||
if (
|
||||
((string) $a === 'type' && (string) $b === 'media')
|
||||
//|| ((string) $a === 'type' && (string) $b === 'accessiblemedia')
|
||||
)
|
||||
{
|
||||
$node['addfieldpath'] = '/libraries/lib_fields/fields/quantumuploadimage';
|
||||
$node['type'] = 'quantumuploadimage';
|
||||
$node['directory'] = $path;
|
||||
$node['dropAreaHidden'] = !$enablemediapreview;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($childNodes) > 0)
|
||||
{
|
||||
foreach ($childNodes as $chNode)
|
||||
{
|
||||
$this->fixForComContent($chNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function addCssForButtonImage()
|
||||
{
|
||||
if (
|
||||
($this->app->getDocument() === null) ||
|
||||
$this->app->getDocument()->getType() !== 'html'
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Factory::getLanguage()->load('plg_editors-xtd_image', JPATH_ADMINISTRATOR);
|
||||
$label = Text::_('PLG_IMAGE_BUTTON_IMAGE');
|
||||
Factory::getDocument()->addStyleDeclaration(<<<EOT
|
||||
@media screen and (min-width: 1540px) {
|
||||
.mce-window[aria-label="{$label}"] {
|
||||
top: 10% !important;
|
||||
left: calc((100% - 1400px)/2) !important;
|
||||
width: 1400px !important;
|
||||
height: 80% !important;
|
||||
}
|
||||
|
||||
.mce-window[aria-label="{$label}"] .mce-reset
|
||||
{
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.mce-window[aria-label="{$label}"] .mce-window-body {
|
||||
width: 100% !important;
|
||||
height: calc(100% - 96px) !important;
|
||||
}
|
||||
|
||||
.mce-window[aria-label="{$label}"] .mce-foot {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.mce-window[aria-label="{$label}"] .mce-foot .mce-container-body {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.mce-window[aria-label="{$label}"] .mce-foot .mce-container-body .mce-widget {
|
||||
left: auto !important;
|
||||
right: 18px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1540px) {
|
||||
.mce-window[aria-label="{$label}"] {
|
||||
left: 2% !important;
|
||||
right: 0 !important;
|
||||
width: 95% !important;
|
||||
}
|
||||
|
||||
.mce-window[aria-label="{$label}"] .mce-reset
|
||||
{
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
}
|
||||
|
||||
.mce-window[aria-label="{$label}"] .mce-window-body {
|
||||
width: 100% !important;
|
||||
height: calc(100% - 96px) !important;
|
||||
}
|
||||
|
||||
.mce-window[aria-label="{$label}"] .mce-foot {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.mce-window[aria-label="{$label}"] .mce-foot .mce-container-body {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.mce-window[aria-label="{$label}"] .mce-foot .mce-container-body .mce-widget {
|
||||
left: auto !important;
|
||||
right: 18px !important;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-height: 700px) {
|
||||
|
||||
.mce-window[aria-label="{$label}"] {
|
||||
top: 2% !important;
|
||||
height: 95% !important;
|
||||
}
|
||||
|
||||
.mce-window[aria-label="{$label}"] .mce-window-body {
|
||||
height: calc(100% - 96px) !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
EOT
|
||||
);
|
||||
|
||||
Factory::getDocument()->addScriptDeclaration("window.QuantumwindowPluginMediaLang = { label: '" . $label . "'};");
|
||||
HTMLHelper::_('script', 'plg_system_quantummanagermedia/largeforimagebutton.js', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
81
plugins/system/quantummanagermedia/quantummanagermedia.xml
Normal file
81
plugins/system/quantummanagermedia/quantummanagermedia.xml
Normal file
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<extension type="plugin" version="3.8" group="system" method="upgrade">
|
||||
<name>PLG_QUANTUMMANAGERMEDIA</name>
|
||||
<creationDate>03.05.2019</creationDate>
|
||||
<author>Tsymbal</author>
|
||||
<authorEmail>cymbal@delo-design.ru</authorEmail>
|
||||
<authorUrl>https://www.norrnext.com</authorUrl>
|
||||
<copyright>Copyright © 2020 Delo Design & NorrNext. All rights reserved.</copyright>
|
||||
<license>GNU General Public License version 3 or later; see license.txt</license>
|
||||
<version>1.6</version>
|
||||
<description>PLG_QUANTUMMANAGERMEDIA_XML_DESCRIPTION</description>
|
||||
|
||||
<scriptfile>script.php</scriptfile>
|
||||
|
||||
<languages folder="language">
|
||||
<language tag="en-GB">en-GB/en-GB.plg_system_quantummanagermedia.ini</language>
|
||||
<language tag="en-GB">en-GB/en-GB.plg_system_quantummanagermedia.sys.ini</language>
|
||||
<language tag="ru-RU">ru-RU/ru-RU.plg_system_quantummanagermedia.ini</language>
|
||||
<language tag="ru-RU">ru-RU/ru-RU.plg_system_quantummanagermedia.sys.ini</language>
|
||||
</languages>
|
||||
|
||||
<media folder="media" destination="plg_system_quantummanagermedia">
|
||||
<folder>css</folder>
|
||||
<folder>js</folder>
|
||||
</media>
|
||||
|
||||
<files>
|
||||
<filename plugin="quantummanagermedia">quantummanagermedia.php</filename>
|
||||
<folder>language</folder>
|
||||
<folder>tmpl</folder>
|
||||
</files>
|
||||
|
||||
<config>
|
||||
<fields name="params">
|
||||
<fieldset name="basic">
|
||||
<field name="enablemedia"
|
||||
type="radio"
|
||||
label="PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIA_LABEL"
|
||||
description="PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIA_DESC"
|
||||
class="btn-group"
|
||||
default="1">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field
|
||||
addfieldpath="/libraries/lib_fields/fields/listcomponents"
|
||||
name="enablemediaadministratorcomponents"
|
||||
type="listcomponents"
|
||||
client="administrator"
|
||||
multiple="true"
|
||||
label="PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIAADMINISTRATORCOMPONENTS_LABEL"
|
||||
description="PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIAADMINISTRATORCOMPONENTS_DESC"
|
||||
default="com_content.article"
|
||||
showon="enablemedia:1">
|
||||
<option
|
||||
value=""
|
||||
/>
|
||||
</field>
|
||||
<field name="enablemediapreview"
|
||||
type="radio"
|
||||
label="PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIAPREVIEW_LABEL"
|
||||
class="btn-group"
|
||||
default="1"
|
||||
showon="enablemedia:1">
|
||||
<option value="1">JYES</option>
|
||||
<option value="0">JNO</option>
|
||||
</field>
|
||||
<field addfieldpath="/administrator/components/com_quantummanager/fields"
|
||||
name="enablemediapath"
|
||||
type="quantumconfigpath"
|
||||
prefix="images/"
|
||||
label="PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIAPATH_LABEL"
|
||||
description="PLG_QUANTUMMANAGERMEDIA_CONFIG_ENABLEMEDIAPATH_DESC"
|
||||
class="btn-group"
|
||||
default=""
|
||||
showon="enablemedia:1"/>
|
||||
</fieldset>
|
||||
</fields>
|
||||
</config>
|
||||
|
||||
</extension>
|
||||
40
plugins/system/quantummanagermedia/script.php
Normal file
40
plugins/system/quantummanagermedia/script.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* @package quantummanagermedia
|
||||
* @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\Factory;
|
||||
use Joomla\CMS\Version;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
/**
|
||||
* Quantummanagermedia script file.
|
||||
*
|
||||
* @package A package name
|
||||
* @since 1.0
|
||||
*/
|
||||
class plgSystemQuantummanagermediaInstallerScript
|
||||
{
|
||||
|
||||
/**
|
||||
* Called after any type of action
|
||||
*
|
||||
* @param string $route Which action is happening (install|uninstall|discover_install|update)
|
||||
* @param JAdapterInstance $adapter The object responsible for running this script
|
||||
*
|
||||
* @return boolean True on success
|
||||
*/
|
||||
public function postflight($route, $adapter)
|
||||
{
|
||||
$db = Factory::getDbo();
|
||||
$query = $db->getQuery(true);
|
||||
$query->update('#__extensions')->set('enabled=1')->where('type=' . $db->q('plugin'))->where('element=' . $db->q('quantummanagermedia'));
|
||||
$db->setQuery($query)->execute();
|
||||
}
|
||||
|
||||
}
|
||||
178
plugins/system/quantummanagermedia/tmpl/default.php
Normal file
178
plugins/system/quantummanagermedia/tmpl/default.php
Normal file
@@ -0,0 +1,178 @@
|
||||
<?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', 'plg_system_quantummanagermedia/modal.css', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
|
||||
if($app->input->get('e_name', '') !== '')
|
||||
{
|
||||
|
||||
HTMLHelper::_('jquery.framework');
|
||||
|
||||
HTMLHelper::_('script', 'plg_system_quantummanagermedia/modaleditor.js', [
|
||||
'version' => filemtime(__FILE__),
|
||||
'relative' => true
|
||||
]);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
HTMLHelper::_('script', 'plg_system_quantummanagermedia/modalfield.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' => [
|
||||
'label' => '',
|
||||
'directory' => $folderRoot,
|
||||
'position' => 'container-left',
|
||||
],
|
||||
'quantumtoolbar' => [
|
||||
'label' => '',
|
||||
'position' => 'container-center-top',
|
||||
'buttons' => 'all',
|
||||
'buttonsBun' => '',
|
||||
'cssClass' => 'qm-padding-small-left qm-padding-small-right qm-padding-small-top qm-padding-small-bottom',
|
||||
],
|
||||
'quantumupload' => [
|
||||
'label' => '',
|
||||
'position' => 'container-center-top',
|
||||
'maxsize' => QuantummanagerHelper::getParamsComponentValue('maxsize', '10'),
|
||||
'dropAreaHidden' => QuantummanagerHelper::getParamsComponentValue('dropareahidden', '0'),
|
||||
'directory' => $folderRoot,
|
||||
'cssClass' => 'qm-padding-small-left qm-padding-small-right qm-padding-small-bottom',
|
||||
],
|
||||
'quantumviewfiles' => [
|
||||
'label' => '',
|
||||
'position' => 'container-center-center',
|
||||
'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' => [
|
||||
'label' => '',
|
||||
'position' => 'bottom'
|
||||
],
|
||||
];
|
||||
|
||||
if((int)QuantummanagerHelper::getParamsComponentValue('unsplash', '1'))
|
||||
{
|
||||
$fields['quantumunsplash'] = [
|
||||
'position' => 'bottom'
|
||||
];
|
||||
}
|
||||
|
||||
/*
|
||||
if((int)QuantummanagerHelper::getParamsComponentValue('pexels', '1'))
|
||||
{
|
||||
$fields['quantumpexels'] = [
|
||||
'label' => '',
|
||||
'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_ACTION_SELECT'); ?>',
|
||||
'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'); ?>'
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user