Added the feature to add custom Joomla fields to your components, requested in gh-247. Added plugin events to the dynamic get area. Added the script to remove field build in relation to component when component gets uninstalled. Improved the getForm method in the model to allow the passing of options to the form. Made further improvements to the implementation of the return parameter across the component redirecting behavior. Made some changes to the list layout views using the field relations area.

This commit is contained in:
2018-08-23 03:37:42 +02:00
parent 5a8124fa29
commit fdc66fe4c7
96 changed files with 4102 additions and 2851 deletions

View File

@@ -82,4 +82,30 @@ if ($this->saveOrder)
<?php endif; ?>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
</form>
<script type="text/javascript">
// layouts footer script
jQuery.fn.selText = function() {
var obj = this[0];
if (jQuery.browser.msie) {
var range = obj.offsetParent.createTextRange();
range.moveToElementText(obj);
range.select();
} else if (jQuery.browser.mozilla || $.browser.opera) {
var selection = obj.ownerDocument.defaultView.getSelection();
var range = obj.ownerDocument.createRange();
range.selectNodeContents(obj);
selection.removeAllRanges();
selection.addRange(range);
} else if (jQuery.browser.safari) {
var selection = obj.ownerDocument.defaultView.getSelection();
selection.setBaseAndExtent(obj, 0, obj, 1);
}
return this;
}
// make sure the code bocks are active
jQuery("code").click(function() {
jQuery(this).selText().addClass("selected");
});
</script>

View File

@@ -61,22 +61,26 @@ $edit = "index.php?option=com_componentbuilder&view=layouts&task=layout.edit";
<?php endif; ?>
</td>
<td class="nowrap">
<div class="name">
<?php if ($canDo->get('core.edit')): ?>
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->name); ?></a>
<?php if ($item->checked_out): ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'layouts.', $canCheckin); ?>
<?php endif; ?>
<?php else: ?>
<?php echo $this->escape($item->name); ?>
<div>
<?php if ($canDo->get('core.edit')): ?>
<a href="<?php echo $edit; ?>&id=<?php echo $item->id; ?>"><?php echo $this->escape($item->name); ?></a>
<?php if ($item->checked_out): ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $userChkOut->name, $item->checked_out_time, 'layouts.', $canCheckin); ?>
<?php endif; ?>
<?php else: ?>
<?php echo $this->escape($item->name); ?>
<?php endif; ?><br />
<code>&lt;?php echo JLayoutHelper::render('<?php echo ComponentbuilderHelper::safeString($item->alias); ?>', [?]); ?&gt;</code>
</div>
</td>
<td class="hidden-phone">
<?php echo $this->escape($item->alias); ?>
</td>
<td class="hidden-phone">
<?php echo $this->escape($item->description); ?>
<div><em>
<?php echo $this->escape($item->description); ?></em>
<ul style="list-style: none">
<li><?php echo JText::_("COM_COMPONENTBUILDER_CUSTOM_PHP"); ?>: <b>
<?php echo JText::_($item->add_php_view); ?></b></li>
</ul>
</div>
</td>
<td class="nowrap">
<div class="name">

View File

@@ -14,5 +14,5 @@ defined('_JEXEC') or die('Restricted access');
?>
<tr>
<td colspan="8"><?php echo $this->pagination->getListFooter(); ?></td>
<td colspan="7"><?php echo $this->pagination->getListFooter(); ?></td>
</tr>

View File

@@ -30,13 +30,10 @@ defined('_JEXEC') or die('Restricted access');
</th>
<?php endif; ?>
<th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_LAYOUT_NAME_LABEL', 'name', $this->listDirn, $this->listOrder); ?>
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_LAYOUTS_NAMES', 'name', $this->listDirn, $this->listOrder); ?>
</th>
<th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_LAYOUT_ALIAS_LABEL', 'alias', $this->listDirn, $this->listOrder); ?>
</th>
<th class="nowrap hidden-phone" >
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_LAYOUT_DESCRIPTION_LABEL', 'description', $this->listDirn, $this->listOrder); ?>
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_LAYOUTS_DETAILS', 'description', $this->listDirn, $this->listOrder); ?>
</th>
<th class="nowrap" >
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_LAYOUT_DYNAMIC_GET_LABEL', 'dynamic_get_name', $this->listDirn, $this->listOrder); ?>

View File

@@ -209,6 +209,28 @@ class ComponentbuilderViewLayouts extends JViewLegacy
JHtml::_('select.options', $this->dynamic_getNameOptions, 'value', 'text')
);
}
}
// Set Add Php View Selection
$this->add_php_viewOptions = $this->getTheAdd_php_viewSelections();
if ($this->add_php_viewOptions)
{
// Add Php View Filter
JHtmlSidebar::addFilter(
'- Select '.JText::_('COM_COMPONENTBUILDER_LAYOUT_ADD_PHP_VIEW_LABEL').' -',
'filter_add_php_view',
JHtml::_('select.options', $this->add_php_viewOptions, 'value', 'text', $this->state->get('filter.add_php_view'))
);
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
// Add Php View Batch Selection
JHtmlBatch_::addListSelection(
'- Keep Original '.JText::_('COM_COMPONENTBUILDER_LAYOUT_ADD_PHP_VIEW_LABEL').' -',
'batch[add_php_view]',
JHtml::_('select.options', $this->add_php_viewOptions, 'value', 'text')
);
}
}
}
@@ -256,10 +278,45 @@ class ComponentbuilderViewLayouts extends JViewLegacy
'a.sorting' => JText::_('JGRID_HEADING_ORDERING'),
'a.published' => JText::_('JSTATUS'),
'a.name' => JText::_('COM_COMPONENTBUILDER_LAYOUT_NAME_LABEL'),
'a.alias' => JText::_('COM_COMPONENTBUILDER_LAYOUT_ALIAS_LABEL'),
'a.description' => JText::_('COM_COMPONENTBUILDER_LAYOUT_DESCRIPTION_LABEL'),
'g.name' => JText::_('COM_COMPONENTBUILDER_LAYOUT_DYNAMIC_GET_LABEL'),
'a.id' => JText::_('JGRID_HEADING_ID')
);
}
protected function getTheAdd_php_viewSelections()
{
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the text.
$query->select($db->quoteName('add_php_view'));
$query->from($db->quoteName('#__componentbuilder_layout'));
$query->order($db->quoteName('add_php_view') . ' ASC');
// Reset the query using our newly populated query object.
$db->setQuery($query);
$results = $db->loadColumn();
if ($results)
{
// get model
$model = $this->getModel();
$results = array_unique($results);
$_filter = array();
foreach ($results as $add_php_view)
{
// Translate the add_php_view selection
$text = $model->selectionTranslation($add_php_view,'add_php_view');
// Now add the add_php_view and its text to the options array
$_filter[] = JHtml::_('select.option', $add_php_view, JText::_($text));
}
return $_filter;
}
return false;
}
}