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:
@ -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"));
|
||||
|
@ -12,66 +12,72 @@
|
||||
// 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
|
||||
?>
|
||||
<div id="componentbuilder_loader">
|
||||
<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">
|
||||
|
||||
<?php echo JLayoutHelper::render('snippet.details_above', $this); ?>
|
||||
<?php echo LayoutHelper::render('snippet.details_above', $this); ?>
|
||||
<div class="form-horizontal">
|
||||
|
||||
<?php echo JHtml::_('bootstrap.startTabSet', 'snippetTab', array('active' => 'details')); ?>
|
||||
<?php echo Html::_('bootstrap.startTabSet', 'snippetTab', ['active' => 'details', 'recall' => true]); ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'snippetTab', 'details', JText::_('COM_COMPONENTBUILDER_SNIPPET_DETAILS', true)); ?>
|
||||
<?php echo Html::_('bootstrap.addTab', 'snippetTab', 'details', Text::_('COM_COMPONENTBUILDER_SNIPPET_DETAILS', true)); ?>
|
||||
<div class="row-fluid form-horizontal-desktop">
|
||||
<div class="span6">
|
||||
<?php echo JLayoutHelper::render('snippet.details_left', $this); ?>
|
||||
<?php echo LayoutHelper::render('snippet.details_left', $this); ?>
|
||||
</div>
|
||||
<div class="span6">
|
||||
<?php echo JLayoutHelper::render('snippet.details_right', $this); ?>
|
||||
<?php echo LayoutHelper::render('snippet.details_right', $this); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||
<?php echo Html::_('bootstrap.endTab'); ?>
|
||||
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'snippetTab', 'contributor', JText::_('COM_COMPONENTBUILDER_SNIPPET_CONTRIBUTOR', true)); ?>
|
||||
<?php echo Html::_('bootstrap.addTab', 'snippetTab', 'contributor', Text::_('COM_COMPONENTBUILDER_SNIPPET_CONTRIBUTOR', true)); ?>
|
||||
<div class="row-fluid form-horizontal-desktop">
|
||||
<div class="span6">
|
||||
<?php echo JLayoutHelper::render('snippet.contributor_left', $this); ?>
|
||||
<?php echo LayoutHelper::render('snippet.contributor_left', $this); ?>
|
||||
</div>
|
||||
<div class="span6">
|
||||
<?php echo JLayoutHelper::render('snippet.contributor_right', $this); ?>
|
||||
<?php echo LayoutHelper::render('snippet.contributor_right', $this); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row-fluid form-horizontal-desktop">
|
||||
<div class="span12">
|
||||
<?php echo JLayoutHelper::render('snippet.contributor_fullwidth', $this); ?>
|
||||
<?php echo LayoutHelper::render('snippet.contributor_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 = 'snippetTab'; ?>
|
||||
<?php echo JLayoutHelper::render('joomla.edit.params', $this); ?>
|
||||
<?php echo LayoutHelper::render('joomla.edit.params', $this); ?>
|
||||
|
||||
<?php if ($this->canDo->get('core.edit.created_by') || $this->canDo->get('core.edit.created') || $this->canDo->get('core.edit.state') || ($this->canDo->get('core.delete') && $this->canDo->get('core.edit.state'))) : ?>
|
||||
<?php echo JHtml::_('bootstrap.addTab', 'snippetTab', 'publishing', JText::_('COM_COMPONENTBUILDER_SNIPPET_PUBLISHING', true)); ?>
|
||||
<?php echo Html::_('bootstrap.addTab', 'snippetTab', 'publishing', Text::_('COM_COMPONENTBUILDER_SNIPPET_PUBLISHING', true)); ?>
|
||||
<div class="row-fluid form-horizontal-desktop">
|
||||
<div class="span6">
|
||||
<?php echo JLayoutHelper::render('snippet.publishing', $this); ?>
|
||||
<?php echo LayoutHelper::render('snippet.publishing', $this); ?>
|
||||
</div>
|
||||
<div class="span6">
|
||||
<?php echo JLayoutHelper::render('snippet.publlshing', $this); ?>
|
||||
<?php echo LayoutHelper::render('snippet.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', 'snippetTab', 'permissions', JText::_('COM_COMPONENTBUILDER_SNIPPET_PERMISSION', true)); ?>
|
||||
<?php echo Html::_('bootstrap.addTab', 'snippetTab', 'permissions', Text::_('COM_COMPONENTBUILDER_SNIPPET_PERMISSION', true)); ?>
|
||||
<div class="row-fluid form-horizontal-desktop">
|
||||
<div class="span12">
|
||||
<fieldset class="adminform">
|
||||
@ -86,14 +92,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="snippet.edit" />
|
||||
<?php echo JHtml::_('form.token'); ?>
|
||||
<?php echo Html::_('form.token'); ?>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
* Snippet Html View class
|
||||
@ -26,7 +38,7 @@ class ComponentbuilderViewSnippet 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 ComponentbuilderViewSnippet extends HtmlView
|
||||
// get action permissions
|
||||
$this->canDo = ComponentbuilderHelper::getActions('snippet', $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 ComponentbuilderViewSnippet extends HtmlView
|
||||
|
||||
// Set the toolbar
|
||||
$this->addToolBar();
|
||||
|
||||
|
||||
// Check for errors.
|
||||
if (count($errors = $this->get('Errors')))
|
||||
{
|
||||
@ -80,34 +92,34 @@ class ComponentbuilderViewSnippet 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_SNIPPET_NEW' : 'COM_COMPONENTBUILDER_SNIPPET_EDIT'), 'pencil-2 article-add');
|
||||
ToolbarHelper::title( Text::_($isNew ? 'COM_COMPONENTBUILDER_SNIPPET_NEW' : 'COM_COMPONENTBUILDER_SNIPPET_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('core.create') && $isNew)
|
||||
{
|
||||
// We can create the record.
|
||||
JToolBarHelper::save('snippet.save', 'JTOOLBAR_SAVE');
|
||||
ToolbarHelper::save('snippet.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
elseif ($this->canDo->get('core.edit'))
|
||||
{
|
||||
// We can save the record.
|
||||
JToolBarHelper::save('snippet.save', 'JTOOLBAR_SAVE');
|
||||
ToolbarHelper::save('snippet.save', 'JTOOLBAR_SAVE');
|
||||
}
|
||||
if ($isNew)
|
||||
{
|
||||
// Do not creat but cancel.
|
||||
JToolBarHelper::cancel('snippet.cancel', 'JTOOLBAR_CANCEL');
|
||||
ToolbarHelper::cancel('snippet.cancel', 'JTOOLBAR_CANCEL');
|
||||
}
|
||||
else
|
||||
{
|
||||
// We can close it.
|
||||
JToolBarHelper::cancel('snippet.cancel', 'JTOOLBAR_CLOSE');
|
||||
ToolbarHelper::cancel('snippet.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -117,44 +129,44 @@ class ComponentbuilderViewSnippet extends HtmlView
|
||||
// For new records, check the create permission.
|
||||
if ($this->canDo->get('core.create'))
|
||||
{
|
||||
JToolBarHelper::apply('snippet.apply', 'JTOOLBAR_APPLY');
|
||||
JToolBarHelper::save('snippet.save', 'JTOOLBAR_SAVE');
|
||||
JToolBarHelper::custom('snippet.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
|
||||
ToolbarHelper::apply('snippet.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('snippet.save', 'JTOOLBAR_SAVE');
|
||||
ToolbarHelper::custom('snippet.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
|
||||
};
|
||||
JToolBarHelper::cancel('snippet.cancel', 'JTOOLBAR_CANCEL');
|
||||
ToolbarHelper::cancel('snippet.cancel', 'JTOOLBAR_CANCEL');
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($this->canDo->get('core.edit'))
|
||||
{
|
||||
// We can save the new record
|
||||
JToolBarHelper::apply('snippet.apply', 'JTOOLBAR_APPLY');
|
||||
JToolBarHelper::save('snippet.save', 'JTOOLBAR_SAVE');
|
||||
ToolbarHelper::apply('snippet.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('snippet.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('core.create'))
|
||||
{
|
||||
JToolBarHelper::custom('snippet.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
|
||||
ToolbarHelper::custom('snippet.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false);
|
||||
}
|
||||
}
|
||||
$canVersion = ($this->canDo->get('core.version') && $this->canDo->get('snippet.version'));
|
||||
if ($this->state->params->get('save_history', 1) && $this->canDo->get('core.edit') && $canVersion)
|
||||
{
|
||||
JToolbarHelper::versions('com_componentbuilder.snippet', $this->item->id);
|
||||
ToolbarHelper::versions('com_componentbuilder.snippet', $this->item->id);
|
||||
}
|
||||
if ($this->canDo->get('core.create'))
|
||||
{
|
||||
JToolBarHelper::custom('snippet.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
ToolbarHelper::custom('snippet.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false);
|
||||
}
|
||||
JToolBarHelper::cancel('snippet.cancel', 'JTOOLBAR_CLOSE');
|
||||
ToolbarHelper::cancel('snippet.cancel', 'JTOOLBAR_CLOSE');
|
||||
}
|
||||
}
|
||||
JToolbarHelper::divider();
|
||||
ToolbarHelper::divider();
|
||||
// set help url for this view if found
|
||||
$this->help_url = ComponentbuilderHelper::getHelpUrl('snippet');
|
||||
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 ComponentbuilderViewSnippet 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,14 +196,20 @@ class ComponentbuilderViewSnippet 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_SNIPPET_NEW' : 'COM_COMPONENTBUILDER_SNIPPET_EDIT'));
|
||||
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/snippet.css", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/css');
|
||||
$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/snippet/submitbutton.js", (ComponentbuilderHelper::jVersion()->isCompatible('3.8.0')) ? array('version' => 'auto') : 'text/javascript');
|
||||
JText::script('view not acceptable. Error');
|
||||
$this->getDocument()->setTitle(Text::_($isNew ? 'COM_COMPONENTBUILDER_SNIPPET_NEW' : 'COM_COMPONENTBUILDER_SNIPPET_EDIT'));
|
||||
Html::_('stylesheet', "administrator/components/com_componentbuilder/assets/css/snippet.css", ['version' => 'auto']);
|
||||
Html::_('script', $this->script, ['version' => 'auto']);
|
||||
Html::_('script', "administrator/components/com_componentbuilder/views/snippet/submitbutton.js", ['version' => 'auto']);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user