aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
Diffstat (limited to 'admin')
-rw-r--r--admin/plugins_new.php18
-rw-r--r--admin/themes/default/template/plugins_new.tpl28
2 files changed, 32 insertions, 14 deletions
diff --git a/admin/plugins_new.php b/admin/plugins_new.php
index d1ecfcf64..710ce8eec 100644
--- a/admin/plugins_new.php
+++ b/admin/plugins_new.php
@@ -30,8 +30,7 @@ include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php');
$template->set_filenames(array('plugins' => 'plugins_new.tpl'));
-$order = isset($_GET['order']) ? $_GET['order'] : 'date';
-$base_url = get_root_url().'admin.php?page='.$page['page'].'&order='.$order;
+$base_url = get_root_url().'admin.php?page='.$page['page'];
$plugins = new plugins();
@@ -86,22 +85,20 @@ if (isset($_GET['installstatus']))
$plugins->set_tabsheet($page['page']);
//---------------------------------------------------------------Order options
-$link = get_root_url().'admin.php?page='.$page['page'].'&order=';
$template->assign('order_options',
array(
- $link.'date' => l10n('Post date'),
- $link.'revision' => l10n('Last revisions'),
- $link.'name' => l10n('Name'),
- $link.'author' => l10n('Author'),
- $link.'downloads' => l10n('Number of downloads')));
-$template->assign('order_selected', $link.$order);
+ 'date' => l10n('Post date'),
+ 'revision' => l10n('Last revisions'),
+ 'name' => l10n('Name'),
+ 'author' => l10n('Author'),
+ 'downloads' => l10n('Number of downloads')));
// +-----------------------------------------------------------------------+
// | start template output |
// +-----------------------------------------------------------------------+
if ($plugins->get_server_plugins(true))
{
- $plugins->sort_server_plugins($order);
+ $plugins->sort_server_plugins('date');
foreach($plugins->server_plugins as $plugin)
{
@@ -121,6 +118,7 @@ if ($plugins->get_server_plugins(true))
'SMALL_DESC' => trim($small_desc, " \r\n"),
'BIG_DESC' => $ext_desc,
'VERSION' => $plugin['revision_name'],
+ 'REVISION_DATE' => preg_replace('/[^0-9]/', '', $plugin['revision_date']),
'AUTHOR' => $plugin['author_name'],
'DOWNLOADS' => $plugin['extension_nb_downloads'],
'URL_INSTALL' => $url_auto_install,
diff --git a/admin/themes/default/template/plugins_new.tpl b/admin/themes/default/template/plugins_new.tpl
index 425c8338a..f4ac1ab45 100644
--- a/admin/themes/default/template/plugins_new.tpl
+++ b/admin/themes/default/template/plugins_new.tpl
@@ -1,4 +1,16 @@
-{footer_script require='jquery.effects.blind'}{literal}
+{combine_script id='jquery.sort' path='themes/default/js/plugins/jquery.sort.js'}
+
+{footer_script require='jquery.effects.blind,jquery.sort'}{literal}
+var sortOrder = 'date';
+var sortPlugins = (function(a, b) {
+ if (sortOrder == 'downloads' || sortOrder == 'revision' || sortOrder == 'date')
+ return parseInt($(a).find('input[name="'+sortOrder+'"]').val())
+ < parseInt($(b).find('input[name="'+sortOrder+'"]').val()) ? 1 : -1;
+ else
+ return $(a).find('input[name="'+sortOrder+'"]').val().toLowerCase()
+ > $(b).find('input[name="'+sortOrder+'"]').val().toLowerCase() ? 1 : -1;
+});
+
jQuery(document).ready(function(){
jQuery("td[id^='desc_']").click(function() {
id = this.id.split('_');
@@ -13,15 +25,18 @@ jQuery(document).ready(function(){
jQuery(this).toggleClass('bigdesc');
return false;
});
+
+ jQuery('select[name="selectOrder"]').change(function() {
+ sortOrder = this.value;
+ $('.pluginBox').sortElements(sortPlugins);
+ });
});
{/literal}{/footer_script}
<div class="titrePage">
<span class="sort">
{'Sort order'|@translate} :
- <select onchange="document.location = this.options[this.selectedIndex].value;">
- {html_options options=$order_options selected=$order_selected}
- </select>
+{html_options name="selectOrder" options=$order_options selected=$order_selected}
</span>
<h2>{'Plugins'|@translate}</h2>
</div>
@@ -32,6 +47,11 @@ jQuery(document).ready(function(){
<legend></legend>
{foreach from=$plugins item=plugin name=plugins_loop}
<div class="pluginBox" id="plugin_{$plugin.ID}">
+<input type="hidden" name="date" value="{$plugin.ID}">
+<input type="hidden" name="name" value="{$plugin.EXT_NAME}">
+<input type="hidden" name="revision" value="{$plugin.REVISION_DATE}">
+<input type="hidden" name="downloads" value="{$plugin.DOWNLOADS}">
+<input type="hidden" name="author" value="{$plugin.AUTHOR}">
<table>
<tr>
<td class="pluginBoxNameCell">{$plugin.EXT_NAME}</td>