Major code formate to try and set a standared. Added four new fields for JavaScript files

This commit is contained in:
2017-12-15 01:10:47 +02:00
parent c9cad158e6
commit d3cbea5c82
172 changed files with 14538 additions and 14358 deletions

View File

@ -53,8 +53,7 @@ class ComponentbuilderViewSite_views extends JViewLegacy
$this->user = JFactory::getUser();
$this->listOrder = $this->escape($this->state->get('list.ordering'));
$this->listDirn = $this->escape($this->state->get('list.direction'));
$this->saveOrder = $this->listOrder == 'ordering';
// get global action permissions
// get global action permissions
$this->canDo = ComponentbuilderHelper::getActions('site_view');
$this->canEdit = $this->canDo->get('core.edit');
$this->canState = $this->canDo->get('core.edit.state');
@ -67,11 +66,11 @@ class ComponentbuilderViewSite_views extends JViewLegacy
{
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
// load the batch html
if ($this->canCreate && $this->canEdit && $this->canState)
{
$this->batchDisplay = JHtmlBatch_::render();
}
// load the batch html
if ($this->canCreate && $this->canEdit && $this->canState)
{
$this->batchDisplay = JHtmlBatch_::render();
}
}
// Check for errors.
@ -94,61 +93,61 @@ class ComponentbuilderViewSite_views extends JViewLegacy
{
JToolBarHelper::title(JText::_('COM_COMPONENTBUILDER_SITE_VIEWS'), 'palette');
JHtmlSidebar::setAction('index.php?option=com_componentbuilder&view=site_views');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');
if ($this->canCreate)
{
{
JToolBarHelper::addNew('site_view.add');
}
// Only load if there are items
if (ComponentbuilderHelper::checkArray($this->items))
// Only load if there are items
if (ComponentbuilderHelper::checkArray($this->items))
{
if ($this->canEdit)
{
JToolBarHelper::editList('site_view.edit');
}
if ($this->canEdit)
{
JToolBarHelper::editList('site_view.edit');
}
if ($this->canState)
{
JToolBarHelper::publishList('site_views.publish');
JToolBarHelper::unpublishList('site_views.unpublish');
JToolBarHelper::archiveList('site_views.archive');
if ($this->canState)
{
JToolBarHelper::publishList('site_views.publish');
JToolBarHelper::unpublishList('site_views.unpublish');
JToolBarHelper::archiveList('site_views.archive');
if ($this->canDo->get('core.admin'))
{
JToolBarHelper::checkin('site_views.checkin');
}
}
if ($this->canDo->get('core.admin'))
{
JToolBarHelper::checkin('site_views.checkin');
}
}
// Add a batch button
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState)
{
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
// set the batch button name
$title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button
$layout = new JLayoutFile('joomla.toolbar.batch');
// add the button to the page
$dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch');
}
// Add a batch button
if ($this->canBatch && $this->canCreate && $this->canEdit && $this->canState)
{
// Get the toolbar object instance
$bar = JToolBar::getInstance('toolbar');
// set the batch button name
$title = JText::_('JTOOLBAR_BATCH');
// Instantiate a new JLayoutFile instance and render the batch button
$layout = new JLayoutFile('joomla.toolbar.batch');
// add the button to the page
$dhtml = $layout->render(array('title' => $title));
$bar->appendButton('Custom', $dhtml, 'batch');
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
JToolbarHelper::deleteList('', 'site_views.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
JToolbarHelper::trash('site_views.trash');
}
if ($this->state->get('filter.published') == -2 && ($this->canState && $this->canDelete))
{
JToolbarHelper::deleteList('', 'site_views.delete', 'JTOOLBAR_EMPTY_TRASH');
}
elseif ($this->canState && $this->canDelete)
{
JToolbarHelper::trash('site_views.trash');
}
if ($this->canDo->get('core.export') && $this->canDo->get('site_view.export'))
{
JToolBarHelper::custom('site_views.exportData', 'download', '', 'COM_COMPONENTBUILDER_EXPORT_DATA', true);
}
}
}
if ($this->user->authorise('site_view.get_snippets', 'com_componentbuilder'))
{
// add Get Snippets button.
@ -160,35 +159,35 @@ class ComponentbuilderViewSite_views extends JViewLegacy
JToolBarHelper::custom('site_views.importData', 'upload', '', 'COM_COMPONENTBUILDER_IMPORT_DATA', false);
}
// set help url for this view if found
$help_url = ComponentbuilderHelper::getHelpUrl('site_views');
if (ComponentbuilderHelper::checkString($help_url))
{
JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url);
}
// set help url for this view if found
$help_url = ComponentbuilderHelper::getHelpUrl('site_views');
if (ComponentbuilderHelper::checkString($help_url))
{
JToolbarHelper::help('COM_COMPONENTBUILDER_HELP_MANAGER', false, $help_url);
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_componentbuilder');
}
// add the options comp button
if ($this->canDo->get('core.admin') || $this->canDo->get('core.options'))
{
JToolBarHelper::preferences('com_componentbuilder');
}
if ($this->canState)
{
if ($this->canState)
{
JHtmlSidebar::addFilter(
JText::_('JOPTION_SELECT_PUBLISHED'),
'filter_published',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.published'), true)
);
// only load if batch allowed
if ($this->canBatch)
{
JHtmlBatch_::addListSelection(
JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'),
'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
}
// only load if batch allowed
if ($this->canBatch)
{
JHtmlBatch_::addListSelection(
JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_STATE'),
'batch[published]',
JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('all' => false)), 'value', 'text', '', true)
);
}
}
JHtmlSidebar::addFilter(
@ -200,11 +199,11 @@ class ComponentbuilderViewSite_views extends JViewLegacy
if ($this->canBatch && $this->canCreate && $this->canEdit)
{
JHtmlBatch_::addListSelection(
JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'),
'batch[access]',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
JText::_('COM_COMPONENTBUILDER_KEEP_ORIGINAL_ACCESS'),
'batch[access]',
JHtml::_('select.options', JHtml::_('access.assetgroups'), 'value', 'text')
);
}
}
}
/**
@ -222,7 +221,7 @@ class ComponentbuilderViewSite_views extends JViewLegacy
$this->document->addStyleSheet(JURI::root() . "administrator/components/com_componentbuilder/assets/css/site_views.css");
}
/**
/**
* Escapes a value for output in a view script.
*
* @param mixed $var The output to escape.
@ -233,10 +232,10 @@ class ComponentbuilderViewSite_views extends JViewLegacy
{
if(strlen($var) > 50)
{
// use the helper htmlEscape method instead and shorten the string
// use the helper htmlEscape method instead and shorten the string
return ComponentbuilderHelper::htmlEscape($var, $this->_charset, true);
}
// use the helper htmlEscape method instead.
// use the helper htmlEscape method instead.
return ComponentbuilderHelper::htmlEscape($var, $this->_charset);
}
@ -256,5 +255,5 @@ class ComponentbuilderViewSite_views extends JViewLegacy
'a.description' => JText::_('COM_COMPONENTBUILDER_SITE_VIEW_DESCRIPTION_LABEL'),
'a.id' => JText::_('JGRID_HEADING_ID')
);
}
}
}