Stable release of v3.2.0-beta1

Move beta to main repo. Fix #1053 so that the right and left tabs display correctly in Joomla 4&5.
This commit is contained in:
2024-03-02 22:10:30 +02:00
parent 3c91a5cdbb
commit d1e1a56671
1786 changed files with 73608 additions and 37437 deletions

View File

@ -12,7 +12,7 @@ Joomla.submitbutton = function(task)
{
if (task == ''){
return false;
} else {
} else {
var action = task.split('.');
if (action[1] == 'cancel' || action[1] == 'close' || document.formvalidator.isValid(document.getElementById("adminForm"))){
Joomla.submitform(task, document.getElementById("adminForm"));

View File

@ -12,76 +12,75 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
JHtml::_('behavior.formvalidator');
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('behavior.keepalive');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
Html::addIncludePath(JPATH_COMPONENT.'/helpers/html');
Html::_('behavior.formvalidator');
Html::_('formbehavior.chosen', 'select');
Html::_('behavior.keepalive');
$componentParams = $this->params; // will be removed just use $this->params instead
?>
<script type="text/javascript">
// waiting spinner
var outerDiv = jQuery('body');
jQuery('<div id="loading"></div>')
.css("background", "rgba(255, 255, 255, .8) url('components/com_componentbuilder/assets/images/import.gif') 50% 15% no-repeat")
.css("top", outerDiv.position().top - jQuery(window).scrollTop())
.css("left", outerDiv.position().left - jQuery(window).scrollLeft())
.css("width", outerDiv.width())
.css("height", outerDiv.height())
.css("position", "fixed")
.css("opacity", "0.80")
.css("-ms-filter", "progid:DXImageTransform.Microsoft.Alpha(Opacity = 80)")
.css("filter", "alpha(opacity = 80)")
.css("display", "none")
.appendTo(outerDiv);
jQuery('#loading').show();
var outerDiv = document.querySelector('body');
var loadingDiv = document.createElement('div');
loadingDiv.id = 'loading';
loadingDiv.style.cssText = "background: rgba(255, 255, 255, .8) url('components/com_componentbuilder/assets/images/import.gif') 50% 15% no-repeat; top: " + (outerDiv.getBoundingClientRect().top + window.pageYOffset) + "px; left: " + (outerDiv.getBoundingClientRect().left + window.pageXOffset) + "px; width: " + outerDiv.offsetWidth + "px; height: " + outerDiv.offsetHeight + "px; position: fixed; opacity: 0.80; -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80); filter: alpha(opacity=80); display: none;";
outerDiv.appendChild(loadingDiv);
loadingDiv.style.display = 'block';
// when page is ready remove and show
jQuery(window).load(function() {
jQuery('#componentbuilder_loader').fadeIn('fast');
jQuery('#loading').hide();
window.addEventListener('load', function() {
var componentLoader = document.getElementById('componentbuilder_loader');
if (componentLoader) componentLoader.style.display = 'block';
loadingDiv.style.display = 'none';
});
</script>
<div id="componentbuilder_loader" style="display: none;">
<form action="<?php echo JRoute::_('index.php?option=com_componentbuilder&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<form action="<?php echo Route::_('index.php?option=com_componentbuilder&layout=edit&id='. (int) $this->item->id . $this->referral); ?>" method="post" name="adminForm" id="adminForm" class="form-validate" enctype="multipart/form-data">
<div class="form-horizontal">
<?php echo JHtml::_('bootstrap.startTabSet', 'class_methodTab', array('active' => 'details')); ?>
<?php echo Html::_('bootstrap.startTabSet', 'class_methodTab', ['active' => 'details', 'recall' => true]); ?>
<?php echo JHtml::_('bootstrap.addTab', 'class_methodTab', 'details', JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_DETAILS', true)); ?>
<?php echo Html::_('bootstrap.addTab', 'class_methodTab', 'details', Text::_('COM_COMPONENTBUILDER_CLASS_METHOD_DETAILS', true)); ?>
<div class="row-fluid form-horizontal-desktop">
<div class="span6">
<?php echo JLayoutHelper::render('class_method.details_left', $this); ?>
<?php echo LayoutHelper::render('class_method.details_left', $this); ?>
</div>
<div class="span6">
<?php echo JLayoutHelper::render('class_method.details_right', $this); ?>
<?php echo LayoutHelper::render('class_method.details_right', $this); ?>
</div>
</div>
<div class="row-fluid form-horizontal-desktop">
<div class="span12">
<?php echo JLayoutHelper::render('class_method.details_fullwidth', $this); ?>
<?php echo LayoutHelper::render('class_method.details_fullwidth', $this); ?>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo Html::_('bootstrap.endTab'); ?>
<?php $this->ignore_fieldsets = array('details','metadata','vdmmetadata','accesscontrol'); ?>
<?php $this->tab_name = 'class_methodTab'; ?>
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
<?php echo LayoutHelper::render('joomla.edit.params', $this); ?>
<?php if ($this->canDo->get('class_method.edit.created_by') || $this->canDo->get('class_method.edit.created') || $this->canDo->get('class_method.edit.state') || ($this->canDo->get('class_method.delete') && $this->canDo->get('class_method.edit.state'))) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'class_methodTab', 'publishing', JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_PUBLISHING', true)); ?>
<?php echo Html::_('bootstrap.addTab', 'class_methodTab', 'publishing', Text::_('COM_COMPONENTBUILDER_CLASS_METHOD_PUBLISHING', true)); ?>
<div class="row-fluid form-horizontal-desktop">
<div class="span6">
<?php echo JLayoutHelper::render('class_method.publishing', $this); ?>
<?php echo LayoutHelper::render('class_method.publishing', $this); ?>
</div>
<div class="span6">
<?php echo JLayoutHelper::render('class_method.publlshing', $this); ?>
<?php echo LayoutHelper::render('class_method.publlshing', $this); ?>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo Html::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php if ($this->canDo->get('core.admin')) : ?>
<?php echo JHtml::_('bootstrap.addTab', 'class_methodTab', 'permissions', JText::_('COM_COMPONENTBUILDER_CLASS_METHOD_PERMISSION', true)); ?>
<?php echo Html::_('bootstrap.addTab', 'class_methodTab', 'permissions', Text::_('COM_COMPONENTBUILDER_CLASS_METHOD_PERMISSION', true)); ?>
<div class="row-fluid form-horizontal-desktop">
<div class="span12">
<fieldset class="adminform">
@ -96,14 +95,14 @@ $componentParams = $this->params; // will be removed just use $this->params inst
</fieldset>
</div>
</div>
<?php echo JHtml::_('bootstrap.endTab'); ?>
<?php echo Html::_('bootstrap.endTab'); ?>
<?php endif; ?>
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
<?php echo Html::_('bootstrap.endTabSet'); ?>
<div>
<input type="hidden" name="task" value="class_method.edit" />
<?php echo JHtml::_('form.token'); ?>
<?php echo Html::_('form.token'); ?>
</div>
</div>
</form>
@ -130,13 +129,13 @@ jQuery('#adminForm').on('change', '#jform_extension_type',function (e)
<?php
$app = JFactory::getApplication();
$app = Factory::getApplication();
?>
function JRouter(link) {
<?php
if ($app->isClient('site'))
{
echo 'var url = "'.JURI::root().'";';
echo 'var url = "'. \Joomla\CMS\Uri\Uri::root() . '";';
}
else
{

View File

@ -12,7 +12,19 @@
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Factory;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Form\FormHelper;
use Joomla\CMS\Session\Session;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Toolbar\Toolbar;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\HTML\HTMLHelper as Html;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\MVC\View\HtmlView;
use Joomla\CMS\Plugin\PluginHelper;
use Joomla\CMS\Toolbar\ToolbarHelper;
use VDM\Joomla\Utilities\StringHelper;
/**
* Class_method Html View class
@ -26,7 +38,7 @@ class ComponentbuilderViewClass_method extends HtmlView
public function display($tpl = null)
{
// set params
$this->params = JComponentHelper::getParams('com_componentbuilder');
$this->params = ComponentHelper::getParams('com_componentbuilder');
// Assign the variables
$this->form = $this->get('Form');
$this->item = $this->get('Item');
@ -35,7 +47,7 @@ class ComponentbuilderViewClass_method extends HtmlView
// get action permissions
$this->canDo = ComponentbuilderHelper::getActions('class_method', $this->item);
// get input
$jinput = JFactory::getApplication()->input;
$jinput = Factory::getApplication()->input;
$this->ref = $jinput->get('ref', 0, 'word');
$this->refid = $jinput->get('refid', 0, 'int');
$return = $jinput->get('return', null, 'base64');
@ -60,7 +72,7 @@ class ComponentbuilderViewClass_method extends HtmlView
// Set the toolbar
$this->addToolBar();
// Check for errors.
if (count($errors = $this->get('Errors')))
{
@ -80,34 +92,34 @@ class ComponentbuilderViewClass_method extends HtmlView
*/
protected function addToolBar()
{
JFactory::getApplication()->input->set('hidemainmenu', true);
$user = JFactory::getUser();
Factory::getApplication()->input->set('hidemainmenu', true);
$user = Factory::getUser();
$userId = $user->id;
$isNew = $this->item->id == 0;
JToolbarHelper::title( JText::_($isNew ? 'COM_COMPONENTBUILDER_CLASS_METHOD_NEW' : 'COM_COMPONENTBUILDER_CLASS_METHOD_EDIT'), 'pencil-2 article-add');
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_CLASS_METHOD_NEW' : 'COM_COMPONENTBUILDER_CLASS_METHOD_EDIT'), 'pencil-2 article-add');
// Built the actions for new and existing records.
if (ComponentbuilderHelper::checkString($this->referral))
if (StringHelper::check($this->referral))
{
if ($this->canDo->get('class_method.create') && $isNew)
{
// We can create the record.
JToolBarHelper::save('class_method.save', 'JTOOLBAR_SAVE');
ToolbarHelper::save('class_method.save', 'JTOOLBAR_SAVE');
}
elseif ($this->canDo->get('class_method.edit'))
{
// We can save the record.
JToolBarHelper::save('class_method.save', 'JTOOLBAR_SAVE');
ToolbarHelper::save('class_method.save', 'JTOOLBAR_SAVE');
}
if ($isNew)
{
// Do not creat but cancel.
JToolBarHelper::cancel('class_method.cancel', 'JTOOLBAR_CANCEL');
ToolbarHelper::cancel('class_method.cancel', 'JTOOLBAR_CANCEL');
}
else
{
// We can close it.
JToolBarHelper::cancel('class_method.cancel', 'JTOOLBAR_CLOSE');
ToolbarHelper::cancel('class_method.cancel', 'JTOOLBAR_CLOSE');
}
}
else
@ -117,44 +129,44 @@ class ComponentbuilderViewClass_method extends HtmlView
// For new records, check the create permission.
if ($this->canDo->get('class_method.create'))
{
JToolBarHelper::apply('class_method.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('class_method.save', 'JTOOLBAR_SAVE');
JToolBarHelper::custom('class_method.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
ToolbarHelper::apply('class_method.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('class_method.save', 'JTOOLBAR_SAVE');
ToolbarHelper::custom('class_method.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
};
JToolBarHelper::cancel('class_method.cancel', 'JTOOLBAR_CANCEL');
ToolbarHelper::cancel('class_method.cancel', 'JTOOLBAR_CANCEL');
}
else
{
if ($this->canDo->get('class_method.edit'))
{
// We can save the new record
JToolBarHelper::apply('class_method.apply', 'JTOOLBAR_APPLY');
JToolBarHelper::save('class_method.save', 'JTOOLBAR_SAVE');
ToolbarHelper::apply('class_method.apply', 'JTOOLBAR_APPLY');
ToolbarHelper::save('class_method.save', 'JTOOLBAR_SAVE');
// We can save this record, but check the create permission to see
// if we can return to make a new one.
if ($this->canDo->get('class_method.create'))
{
JToolBarHelper::custom('class_method.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
ToolbarHelper::custom('class_method.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
}
}
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('class_method.version'));
if ($this->state->params->get('save_history', 1) && $this->canDo->get('class_method.edit') && $canVersion)
{
JToolbarHelper::versions('com_componentbuilder.class_method', $this->item->id);
ToolbarHelper::versions('com_componentbuilder.class_method', $this->item->id);
}
if ($this->canDo->get('class_method.create'))
{
JToolBarHelper::custom('class_method.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
ToolbarHelper::custom('class_method.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
}
JToolBarHelper::cancel('class_method.cancel', 'JTOOLBAR_CLOSE');
ToolbarHelper::cancel('class_method.cancel', 'JTOOLBAR_CLOSE');
}
}
JToolbarHelper::divider();
ToolbarHelper::divider();
// set help url for this view if found
$this->help_url = ComponentbuilderHelper::getHelpUrl('class_method');
if (ComponentbuilderHelper::checkString($this->help_url))
if (StringHelper::check($this->help_url))
{
JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
ToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $this->help_url);
}
}
@ -169,11 +181,11 @@ class ComponentbuilderViewClass_method extends HtmlView
{
if(strlen($var) > 30)
{
// use the helper htmlEscape method instead and shorten the string
return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true, 30);
// use the helper htmlEscape method instead and shorten the string
return StringHelper::html($var, $this->_charset, true, 30);
}
// use the helper htmlEscape method instead.
return ComponentbuilderHelper::htmlEscape($var, $this->_charset);
return StringHelper::html($var, $this->_charset);
}
/**
@ -184,32 +196,38 @@ class ComponentbuilderViewClass_method extends HtmlView
protected function setDocument()
{
$isNew = ($this->item->id < 1);
if (!isset($this->document))
{
$this->document = JFactory::getDocument();
}
$this->document->setTitle(JText::_($isNew ? 'COM_COMPONENTBUILDER_CLASS_METHOD_NEW' : 'COM_COMPONENTBUILDER_CLASS_METHOD_EDIT'));
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/class_method.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_CLASS_METHOD_NEW' : 'COM_COMPONENTBUILDER_CLASS_METHOD_EDIT'));
Html::_('stylesheet', "administrator/components/com_componentbuilder/assets/css/class_method.css", ['version' => 'auto']);
// Add Ajax Token
$this->document->addScriptDeclaration("var token = '".JSession::getFormToken()."';");
$this->document->addScript(JURI::root() . $this->script, (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->document->addScript(JURI::root() . "administrator/components/com_componentbuilder/views/class_method/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
$this->getDocument()->addScriptDeclaration("var token = '" . Session::getFormToken() . "';");
Html::_('script', $this->script, ['version' => 'auto']);
Html::_('script', "administrator/components/com_componentbuilder/views/class_method/submitbutton.js", ['version' => 'auto']);
// add the Uikit v2 style sheets
$this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/uikit.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 JavaScripts
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/uikit.min.js' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/uikit.min.js', ['version' => 'auto']);
// add the Uikit v2 extra style sheets
$this->document->addStyleSheet( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css' , (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
Html::_('stylesheet', 'media/com_componentbuilder/uikit-v2/css/components/notify.gradient.min.css', ['version' => 'auto']);
// add Uikit v2 extra JavaScripts
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
$this->document->addScript( JURI::root(true) .'/media/com_componentbuilder/uikit-v2/js/components/notify.min.js', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript', (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('type' => 'text/javascript', 'async' => 'async') : true);
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/lightbox.min.js', ['version' => 'auto']);
Html::_('script', 'media/com_componentbuilder/uikit-v2/js/components/notify.min.js', ['version' => 'auto']);
// add var key
$this->document->addScriptDeclaration("var vastDevMod = '" . $this->get('VDM') . "';");
// add return_here
$this->document->addScriptDeclaration("var return_here = '" . urlencode(base64_encode((string) JUri::getInstance())) . "';");
JText::script('view not acceptable. Error');
Text::script('view not acceptable. Error');
}
/**
* Get the Document (helper method toward Joomla 4 and 5)
*/
public function getDocument()
{
$this->document ??= JFactory::getDocument();
return $this->document;
}
}