Skip to content

Commit

Permalink
Code style
Browse files Browse the repository at this point in the history
  • Loading branch information
NunoLopesPT committed Aug 11, 2017
1 parent 2f989f8 commit 82289a9
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 7 deletions.
17 changes: 17 additions & 0 deletions administrator/components/com_installer/Controller/Updatesites.php
Expand Up @@ -6,6 +6,7 @@
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

namespace Joomla\Component\Installer\Administrator\Controller;

defined('_JEXEC') or die;
Expand Down Expand Up @@ -57,4 +58,20 @@ public function rebuild()

$this->setRedirect(\JRoute::_('index.php?option=com_installer&view=updatesites', false));
}

/**
* Method to get a model object, loading it if required.
*
* @param string $name The model name. Optional.
* @param string $prefix The class prefix. Optional.
* @param array $config Configuration array for model. Optional.
*
* @return \Joomla\CMS\Model\Model The model.
*
* @since __DEPLOY_VERSION__
*/
public function getModel($name = 'Updatesite', $prefix = 'Administrator', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
}
}
Expand Up @@ -39,7 +39,7 @@ class Updatesite extends Admin
*/
public function getForm($data = array(), $loadData = true)
{
\JForm::addFieldPath('JPATH_ADMINISTRATOR/components/com_users/models/fields');
\JForm::addFieldPath(JPATH_ADMINISTRATOR . '/components/com_users/models/fields');

// Get the form.
$form = $this->loadForm('com_installer.updatesite', 'updatesite', array('control' => 'jform', 'load_data' => $loadData));
Expand Down
6 changes: 5 additions & 1 deletion administrator/components/com_installer/Model/Updatesites.php
Expand Up @@ -39,6 +39,7 @@ public function __construct($config = array(), MvcFactoryInterface $factory = nu
'client_id',
'client', 'client_translated',
'status',
's.ordering', 'ordering',
'type', 'type_translated',
'folder', 'folder_translated',
'update_site_id',
Expand Down Expand Up @@ -429,9 +430,12 @@ protected function getListQuery()
$query = $this->getDbo()->getQuery(true)
->select(
array(
's.update_site_id',
's.checked_out',
's.checked_out_time',
's.name AS update_site_name',
's.ordering',
's.type AS update_site_type',
's.update_site_id',
's.location',
's.enabled',
'e.extension_id',
Expand Down
Expand Up @@ -90,6 +90,11 @@ protected function addToolbar()
ToolbarHelper::divider();
}

if ($canDo->get('core.edit.state'))
{
\JToolbarHelper::checkin('updatesites.checkin');
}

if ($canDo->get('core.admin') || $canDo->get('core.options'))
{
ToolbarHelper::custom('updatesites.rebuild', 'refresh.png', 'refresh_f2.png', 'JTOOLBAR_REBUILD', false);
Expand Down
Expand Up @@ -21,7 +21,7 @@
name="location"
type="text"
label="COM_INSTALLER_UPDATESITE_EDIT_UPDATESITE_URL"
description="Add your updatesite"
description="COM_INSTALLER_UPDATESITE_EDIT_DESCRIPTION"
size="40"
class="input-xxlarge"
default=""
Expand Down
Expand Up @@ -10,9 +10,19 @@
defined('_JEXEC') or die;

JHtml::_('behavior.multiselect');
JHtml::_('behavior.tabstate');

$user = JFactory::getUser();
$userId = $user->get('id');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$saveOrder = $listOrder == 's.ordering';

if ($saveOrder)
{
$saveOrderingUrl = 'index.php?option=com_installer&task=updatesites.saveOrderAjax&tmpl=component' . JSession::getFormToken() . '=1';
\JHtml::_('draggablelist.draggable');
}
?>
<div id="installer-manage" class="clearfix">
<form action="<?php echo JRoute::_('index.php?option=com_installer&view=updatesites'); ?>" method="post" name="adminForm" id="adminForm">
Expand All @@ -31,6 +41,9 @@
<table class="table table-striped">
<thead>
<tr>
<th style="width:1%" class="nowrap text-center hidden-sm-down">
<?php echo JHtml::_('searchtools.sort', '', 's.ordering', $listDirn, $listOrder, null, 'asc', 'JGRID_HEADING_ORDERING', 'icon-menu-2'); ?>
</th>
<th style="width:1%" class="text-center">
<?php echo JHtml::_('grid.checkall'); ?>
</th>
Expand Down Expand Up @@ -64,9 +77,34 @@
</td>
</tr>
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) : ?>
<tr class="row<?php echo $i % 2; if ($item->enabled == 2) echo ' protected'; ?>">
<tbody <?php if ($saveOrder) :?> class="js-draggable" data-url="<?php echo $saveOrderingUrl; ?>" data-direction="<?php echo strtolower($listDirn); ?>" data-nested="true"<?php endif; ?>>
<?php foreach ($this->items as $i => $item) :
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;
$canEdit = $user->authorise('core.edit', 'com_installer');
$canChange = $user->authorise('core.edit.state', 'com_installer') && $canCheckin;
?>
<tr class="row<?php echo $i % 2; if ($item->enabled == 2) echo ' protected'; ?>" data-dragable-group="0">
<td class="order nowrap text-center hidden-sm-down">
<?php
$iconClass = '';

if (!$canChange)
{
$iconClass = ' inactive';
}
elseif (!$saveOrder)
{
$iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::_('tooltipText', 'JORDERINGDISABLED');
}
?>
<span class="sortable-handler <?php echo $iconClass ?>">
<span class="icon-menu" aria-hidden="true"></span>
</span>
<?php if ($canChange && $saveOrder) : ?>
<input type="text" style="display:none" name="order[]" size="5"
value="<?php echo $item->ordering; ?>" class="width-20 text-area-order">
<?php endif; ?>
</td>
<td class="text-center">
<?php echo JHtml::_('grid.id', $i, $item->update_site_id); ?>
</td>
Expand All @@ -79,7 +117,16 @@
</td>
<td>
<label for="cb<?php echo $i; ?>">
<?php echo JText::_($item->update_site_name); ?>
<?php if ($item->checked_out) : ?>
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'updatesites.', $canCheckin); ?>
<?php endif; ?>
<?php if ($canEdit) : ?>
<?php $editIcon = $item->checked_out ? '' : '<span class="fa fa-pencil-square mr-2" aria-hidden="true"></span>'; ?>
<a class="hasTooltip" href="<?php echo JRoute::_('index.php?option=com_installer&task=updatesite.edit&update_site_id=' . (int) $item->update_site_id); ?>" title="<?php echo JText::_('JACTION_EDIT'); ?> <?php echo $this->escape(addslashes($item->name)); ?>">
<?php echo $editIcon; ?><?php echo $this->escape($item->name); ?></a>
<?php else : ?>
<?php echo $this->escape($item->name); ?>
<?php endif; ?>
<br>
<span class="small break-word">
<a href="<?php echo $item->location; ?>" target="_blank" rel="noopener noreferrer"><?php echo $this->escape($item->location); ?></a>
Expand Down
4 changes: 4 additions & 0 deletions administrator/language/en-GB/en-GB.com_installer.ini
Expand Up @@ -184,6 +184,9 @@ COM_INSTALLER_N_EXTENSIONS_PUBLISHED="%d extensions enabled."
COM_INSTALLER_N_EXTENSIONS_PUBLISHED_1="%d extension enabled."
COM_INSTALLER_N_EXTENSIONS_UNPUBLISHED="%d extensions disabled."
COM_INSTALLER_N_EXTENSIONS_UNPUBLISHED_1="%d extension disabled."
COM_INSTALLER_N_ITEMS_CHECKED_IN_0="No update sites checked in."
COM_INSTALLER_N_ITEMS_CHECKED_IN_1="%d update sites checked in."
COM_INSTALLER_N_ITEMS_CHECKED_IN_MORE="%d update sites checked in."
COM_INSTALLER_N_ITEMS_PUBLISHED="%d update sites enabled."
COM_INSTALLER_N_ITEMS_PUBLISHED_1="%d update site enabled."
COM_INSTALLER_N_ITEMS_UNPUBLISHED="%d update sites disabled."
Expand Down Expand Up @@ -253,6 +256,7 @@ COM_INSTALLER_UPDATESITE_DISABLE="Disable update site"
COM_INSTALLER_UPDATESITE_DISABLED="Disabled update site"
COM_INSTALLER_UPDATESITE_ENABLE="Enable update site"
COM_INSTALLER_UPDATESITE_ENABLED="Enabled update site"
COM_INSTALLER_UPDATESITE_EDIT_DESCRIPTION="Add your updatesite"
COM_INSTALLER_UPDATESITE_EDIT_DETAILS="Edit Update Site Location"
COM_INSTALLER_UPDATESITE_EDIT_TITLE="Edit Update Site"
COM_INSTALLER_UPDATESITE_EDIT_UPDATESITE_URL="Location URL"
Expand Down

0 comments on commit 82289a9

Please sign in to comment.