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:
@@ -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">
|
||||
// templates 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>
|
@@ -61,25 +61,35 @@ $edit = "index.php?option=com_componentbuilder&view=templates&task=template.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, 'templates.', $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, 'templates.', $canCheckin); ?>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<?php echo $this->escape($item->name); ?>
|
||||
<?php endif; ?><br />
|
||||
<code><?php echo $this->loadTemplate('<?php echo ComponentbuilderHelper::safeString($item->alias); ?>'); ?></code>
|
||||
</div>
|
||||
</td>
|
||||
<td class="hidden-phone">
|
||||
<?php echo $this->escape($item->alias); ?>
|
||||
<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="hidden-phone">
|
||||
<?php echo $this->escape($item->description); ?>
|
||||
</td>
|
||||
<td class="hidden-phone">
|
||||
<?php echo $this->escape($item->snippet_name); ?>
|
||||
<td class="nowrap">
|
||||
<div class="name">
|
||||
<?php if ($this->user->authorise('dynamic_get.edit', 'com_componentbuilder.dynamic_get.' . (int)$item->dynamic_get)): ?>
|
||||
<a href="index.php?option=com_componentbuilder&view=dynamic_gets&task=dynamic_get.edit&id=<?php echo $item->dynamic_get; ?>&ref=templates"><?php echo $this->escape($item->dynamic_get_name); ?></a>
|
||||
<?php else: ?>
|
||||
<?php echo $this->escape($item->dynamic_get_name); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</td>
|
||||
<td class="center">
|
||||
<?php if ($canDo->get('core.edit.state')) : ?>
|
||||
|
@@ -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>
|
@@ -30,16 +30,13 @@ defined('_JEXEC') or die('Restricted access');
|
||||
</th>
|
||||
<?php endif; ?>
|
||||
<th class="nowrap" >
|
||||
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_TEMPLATE_NAME_LABEL', 'name', $this->listDirn, $this->listOrder); ?>
|
||||
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_TEMPLATES_NAMES', 'name', $this->listDirn, $this->listOrder); ?>
|
||||
</th>
|
||||
<th class="nowrap hidden-phone" >
|
||||
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_TEMPLATE_ALIAS_LABEL', 'alias', $this->listDirn, $this->listOrder); ?>
|
||||
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_TEMPLATES_DETAILS', 'description', $this->listDirn, $this->listOrder); ?>
|
||||
</th>
|
||||
<th class="nowrap hidden-phone" >
|
||||
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_TEMPLATE_DESCRIPTION_LABEL', 'description', $this->listDirn, $this->listOrder); ?>
|
||||
</th>
|
||||
<th class="nowrap hidden-phone" >
|
||||
<?php echo JText::_('COM_COMPONENTBUILDER_TEMPLATE_SNIPPET_LABEL'); ?>
|
||||
<th class="nowrap" >
|
||||
<?php echo JHtml::_('grid.sort', 'COM_COMPONENTBUILDER_TEMPLATE_DYNAMIC_GET_LABEL', 'dynamic_get_name', $this->listDirn, $this->listOrder); ?>
|
||||
</th>
|
||||
<?php if ($this->canState): ?>
|
||||
<th width="10" class="nowrap center" >
|
||||
|
@@ -187,7 +187,51 @@ class ComponentbuilderViewTemplates extends JViewLegacy
|
||||
'batch[access]',
|
||||
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Set Dynamic Get Name Selection
|
||||
$this->dynamic_getNameOptions = JFormHelper::loadFieldType('Dynamicget')->getOptions();
|
||||
if ($this->dynamic_getNameOptions)
|
||||
{
|
||||
// Dynamic Get Name Filter
|
||||
JHtmlSidebar::addFilter(
|
||||
'- Select '.JText::_('COM_COMPONENTBUILDER_TEMPLATE_DYNAMIC_GET_LABEL').' -',
|
||||
'filter_dynamic_get',
|
||||
JHtml::_('select.options', $this->dynamic_getNameOptions, 'value', 'text', $this->state->get('filter.dynamic_get'))
|
||||
);
|
||||
|
||||
if ($this->canBatch && $this->canCreate && $this->canEdit)
|
||||
{
|
||||
// Dynamic Get Name Batch Selection
|
||||
JHtmlBatch_::addListSelection(
|
||||
'- Keep Original '.JText::_('COM_COMPONENTBUILDER_TEMPLATE_DYNAMIC_GET_LABEL').' -',
|
||||
'batch[dynamic_get]',
|
||||
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_TEMPLATE_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_TEMPLATE_ADD_PHP_VIEW_LABEL').' -',
|
||||
'batch[add_php_view]',
|
||||
JHtml::_('select.options', $this->add_php_viewOptions, 'value', 'text')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -234,9 +278,45 @@ class ComponentbuilderViewTemplates extends JViewLegacy
|
||||
'a.sorting' => JText::_('JGRID_HEADING_ORDERING'),
|
||||
'a.published' => JText::_('JSTATUS'),
|
||||
'a.name' => JText::_('COM_COMPONENTBUILDER_TEMPLATE_NAME_LABEL'),
|
||||
'a.alias' => JText::_('COM_COMPONENTBUILDER_TEMPLATE_ALIAS_LABEL'),
|
||||
'a.description' => JText::_('COM_COMPONENTBUILDER_TEMPLATE_DESCRIPTION_LABEL'),
|
||||
'g.name' => JText::_('COM_COMPONENTBUILDER_TEMPLATE_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_template'));
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user