Skip to content

Commit

Permalink
Removing unused code for ordering in views
Browse files Browse the repository at this point in the history
# Executive summary
This patch removes some unused (javascript/PHP) code in the following views

* Banners
* Banners-Client
* Categories
* Articles
* Users
* Menu Items

# Backwards compatibility
Full b/c, no problems are expected

# Translation impact
none

# Testing instructions
* Install a fresh Joomla! with testing data.
* Log into to backend and go to listed views above and check if ordering works when you click on the table headers and when using the select to chose ordering
* Apply Patch
* Go to listed views above and check if ordering works when you click on the table headers and when using the select to chose ordering
* Nothing should have changed
  • Loading branch information
rdeutz committed Feb 6, 2015
1 parent 47df598 commit 2e81544
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 119 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,13 @@
$canOrder = $user->authorise('core.edit.state', 'com_banners.category');
$archived = $this->state->get('filter.state') == 2 ? true : false;
$trashed = $this->state->get('filter.state') == -2 ? true : false;
$params = (isset($this->state->params)) ? $this->state->params : new JObject;
$saveOrder = $listOrder == 'a.ordering';

if ($saveOrder)
{
$saveOrderingUrl = 'index.php?option=com_banners&task=banners.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'articleList', 'adminForm', strtolower($listDirn), $saveOrderingUrl);
}

$sortFields = $this->getSortFields();
JFactory::getDocument()->addScriptDeclaration('
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != "' . $listOrder . '")
{
dirn = "asc";
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, "");
};
');
?>

<form action="<?php echo JRoute::_('index.php?option=com_banners&view=banners'); ?>" method="post" name="adminForm" id="adminForm">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,6 @@
$params = (isset($this->state->params)) ? $this->state->params : new JObject;
$archived = $this->state->get('filter.state') == 2 ? true : false;
$trashed = $this->state->get('filter.state') == -2 ? true : false;
$sortFields = $this->getSortFields();

JFactory::getDocument()->addScriptDeclaration('
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != "' . $listOrder . '")
{
dirn = "asc";
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, "");
};
');
?>

<form action="<?php echo JRoute::_('index.php?option=com_banners&view=clients'); ?>" method="post" name="adminForm" id="adminForm">
Expand Down Expand Up @@ -92,7 +73,6 @@
</tfoot>
<tbody>
<?php foreach ($this->items as $i => $item) :
$ordering = ($listOrder == 'ordering');
$canCreate = $user->authorise('core.create', 'com_banners');
$canEdit = $user->authorise('core.edit', 'com_banners');
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id') || $item->checked_out == 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,6 @@
$saveOrderingUrl = 'index.php?option=com_categories&task=categories.saveOrderAjax&tmpl=component';
JHtml::_('sortablelist.sortable', 'categoryList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true);
}

$sortFields = $this->getSortFields();

JFactory::getDocument()->addScriptDeclaration('
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != "' . $listOrder . '")
{
dirn = "asc";
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, "");
};
');

?>

<form action="<?php echo JRoute::_('index.php?option=com_categories&view=categories'); ?>" method="post" name="adminForm" id="adminForm">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,27 +30,7 @@
JHtml::_('sortablelist.sortable', 'articleList', 'adminForm', strtolower($listDirn), $saveOrderingUrl);
}

$sortFields = $this->getSortFields();
$assoc = JLanguageAssociations::isEnabled();

JFactory::getDocument()->addScriptDeclaration('
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != "' . $listOrder . '")
{
dirn = "asc";
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, "");
};
');

?>

<form action="<?php echo JRoute::_('index.php?option=com_content&view=articles'); ?>" method="post" name="adminForm" id="adminForm">
Expand Down
19 changes: 0 additions & 19 deletions administrator/components/com_menus/views/items/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,7 @@
JHtml::_('sortablelist.sortable', 'itemList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true);
}

$sortFields = $this->getSortFields();
$assoc = JLanguageAssociations::isEnabled();

JFactory::getDocument()->addScriptDeclaration('
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != "' . $listOrder . '")
{
dirn = "asc";
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, "");
};
');
?>
<?php // Set up the filter bar. ?>
<form action="<?php echo JRoute::_('index.php?option=com_menus&view=items');?>" method="post" name="adminForm" id="adminForm">
Expand Down
19 changes: 0 additions & 19 deletions administrator/components/com_users/views/users/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,6 @@
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
$loggeduser = JFactory::getUser();
$sortFields = $this->getSortFields();

JFactory::getDocument()->addScriptDeclaration('
Joomla.orderTable = function()
{
table = document.getElementById("sortTable");
direction = document.getElementById("directionTable");
order = table.options[table.selectedIndex].value;
if (order != "' . $listOrder . '")
{
dirn = "asc";
}
else
{
dirn = direction.options[direction.selectedIndex].value;
}
Joomla.tableOrdering(order, dirn, "");
};
');
?>
<form action="<?php echo JRoute::_('index.php?option=com_users&view=users');?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
Expand Down

0 comments on commit 2e81544

Please sign in to comment.