diff options
author | patdenice <patdenice@piwigo.org> | 2009-02-13 20:49:03 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2009-02-13 20:49:03 +0000 |
commit | 290f2c1d39d1c47d48ba4e6a6d347459975e8b0f (patch) | |
tree | e330eef287b07298d5acf37c9829beeacc16fb85 /admin | |
parent | 83d87c3d02844bd6fab391923e04913f35d99359 (diff) |
- Show number of downloads in plugins list.
- Allow to sort plugins by number of downloads.
- Fix plugin revision URL (no more revision_view in PEM).
git-svn-id: http://piwigo.org/svn/trunk@3143 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | admin/include/plugins.class.php | 10 | ||||
-rw-r--r-- | admin/plugins_new.php | 21 | ||||
-rw-r--r-- | admin/plugins_update.php | 29 | ||||
-rw-r--r-- | admin/template/goto/default-layout.css | 1 | ||||
-rw-r--r-- | admin/template/goto/plugins_new.tpl | 4 | ||||
-rw-r--r-- | admin/template/goto/plugins_update.tpl | 4 |
6 files changed, 45 insertions, 24 deletions
diff --git a/admin/include/plugins.class.php b/admin/include/plugins.class.php index d746298df..caff5ef26 100644 --- a/admin/include/plugins.class.php +++ b/admin/include/plugins.class.php @@ -304,6 +304,7 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id="' . $plugin_id . '"'; $url = PEM_URL . '/api/get_revision_list.php?category_id=12&format=php&last_revision_only=true'; $url .= '&version=' . implode(',', $versions_to_check); $url .= '&lang=' . substr($user['language'], 0, 2); + $url .= '&get_nb_downloads=true'; if (!empty($plugins_to_check)) { @@ -345,6 +346,9 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id="' . $plugin_id . '"'; case 'author': uasort($this->server_plugins, array($this, 'extension_author_compare')); break; + case 'downloads': + usort($this->server_plugins, array($this, 'extension_downloads_compare')); + break; } } @@ -508,6 +512,12 @@ DELETE FROM ' . PLUGINS_TABLE . ' WHERE id="' . $plugin_id . '"'; else return $r; } + function extension_downloads_compare($a, $b) + { + if ($a['extension_nb_downloads'] < $b['extension_nb_downloads']) return 1; + else return -1; + } + function sort_plugins_by_state() { uasort($this->fs_plugins, 'name_compare'); diff --git a/admin/plugins_new.php b/admin/plugins_new.php index 5a0d70190..56b09d097 100644 --- a/admin/plugins_new.php +++ b/admin/plugins_new.php @@ -83,7 +83,8 @@ $template->assign('order_options', $link.'date' => l10n('Post date'), $link.'revision' => l10n('plugins_revisions'), $link.'name' => l10n('Name'), - $link.'author' => l10n('Author'))); + $link.'author' => l10n('Author'), + $link.'downloads' => l10n('Number of downloads'))); $template->assign('order_selected', $link.$order); // +-----------------------------------------------------------------------+ @@ -97,10 +98,15 @@ if ($plugins->get_server_plugins(true)) { list($date, ) = explode(' ', $plugin['revision_date']); - $ver_desc = sprintf(l10n('plugins_description'), - $plugin['revision_name'], - $date, - $plugin['revision_description']); + $ext_desc = '<i>'.l10n('Downloads').':</i> '.$plugin['extension_nb_downloads']."\r\n" + ."\r\n" + .$plugin['extension_description']; + + $rev_desc = '<i>'.l10n('Version').':</i> '.$plugin['revision_name']."\r\n" + .'<i>'.l10n('Released on').':</i> '.$date."\r\n" + .'<i>'.l10n('Downloads').':</i> '.$plugin['revision_nb_downloads']."\r\n" + ."\r\n" + .$plugin['revision_description']; $url_auto_install = htmlentities($base_url) . '&revision=' . $plugin['revision_id'] @@ -109,11 +115,10 @@ if ($plugins->get_server_plugins(true)) $template->append('plugins', array( 'EXT_NAME' => $plugin['extension_name'], 'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$plugin['extension_id'], - 'EXT_DESC' => $plugin['extension_description'], + 'EXT_DESC' => $ext_desc, 'VERSION' => $plugin['revision_name'], - 'VERSION_URL' => PEM_URL.'/revision_view.php?rid='.$plugin['revision_id'], 'DATE' => $date, - 'VER_DESC' => $ver_desc, + 'VER_DESC' => $rev_desc, 'AUTHOR' => $plugin['author_name'], 'URL_INSTALL' => $url_auto_install, 'URL_DOWNLOAD' => $plugin['download_url'] . '&origin=piwigo_download')); diff --git a/admin/plugins_update.php b/admin/plugins_update.php index b92ed836d..e6d6705fe 100644 --- a/admin/plugins_update.php +++ b/admin/plugins_update.php @@ -86,7 +86,7 @@ if (isset($_GET['upgradestatus']) and isset($_GET['plugin'])) default: array_push($page['errors'], - sprintf(l10n('plugins_extract_error'), $_GET['installstatus']), + sprintf(l10n('plugins_extract_error'), $_GET['upgradestatus']), l10n('plugins_check_chmod')); } } @@ -108,19 +108,25 @@ if ($plugins->get_server_plugins()) list($date, ) = explode(' ', $plugin_info['revision_date']); - $ver_desc = sprintf(l10n('plugins_description'), - $plugin_info['revision_name'], - $date, - $plugin_info['revision_description']); + $ext_desc = '<i>'.l10n('Downloads').':</i> '.$plugin_info['extension_nb_downloads']."\r\n" + ."\r\n" + .$plugin_info['extension_description']; + + $rev_desc = '<i>'.l10n('Version').':</i> '.$plugin_info['revision_name']."\r\n" + .'<i>'.l10n('Released on').':</i> '.$date."\r\n" + .'<i>'.l10n('Downloads').':</i> '.$plugin_info['revision_nb_downloads']."\r\n" + ."\r\n" + .$plugin_info['revision_description']; if ($plugins->plugin_version_compare($fs_plugin['version'], $plugin_info['revision_name'])) { // Plugin is up to date $template->append('plugins_uptodate', array( - 'URL' => $fs_plugin['uri'], + 'URL' => PEM_URL.'/extension_view.php?eid='.$plugin_info['extension_id'], 'NAME' => $fs_plugin['name'], - 'EXT_DESC' => $plugin_info['extension_description'], - 'VERSION' => $fs_plugin['version'])); + 'EXT_DESC' => $ext_desc, + 'VERSION' => $fs_plugin['version'], + 'VER_DESC' => $rev_desc)); } else { @@ -131,12 +137,11 @@ if ($plugins->get_server_plugins()) $template->append('plugins_not_uptodate', array( 'EXT_NAME' => $fs_plugin['name'], - 'EXT_URL' => $fs_plugin['uri'], - 'EXT_DESC' => $plugin_info['extension_description'], + 'EXT_URL' => PEM_URL.'/extension_view.php?eid='.$plugin_info['extension_id'], + 'EXT_DESC' => $ext_desc, 'VERSION' => $fs_plugin['version'], - 'VERSION_URL' => PEM_URL.'/revision_view.php?rid='.$plugin_info['revision_id'], 'NEW_VERSION' => $plugin_info['revision_name'], - 'NEW_VER_DESC' => $ver_desc, + 'NEW_VER_DESC' => $rev_desc, 'URL_UPDATE' => $url_auto_update, 'URL_DOWNLOAD' => $plugin_info['download_url'] . '&origin=piwigo_download')); } diff --git a/admin/template/goto/default-layout.css b/admin/template/goto/default-layout.css index 87f411dd3..08f3bab3f 100644 --- a/admin/template/goto/default-layout.css +++ b/admin/template/goto/default-layout.css @@ -38,6 +38,7 @@ TABLE#detailedStats { } /* Plugins tables */ +TABLE.plugins { min-width: 400px; } TABLE.plugins A { border: 0; } TABLE.plugins TR TD { padding: 4px 10px; } TABLE.plugins TR TD.pluginState { padding: 4px 16px; } diff --git a/admin/template/goto/plugins_new.tpl b/admin/template/goto/plugins_new.tpl index bd6339566..9fe0a0c33 100644 --- a/admin/template/goto/plugins_new.tpl +++ b/admin/template/goto/plugins_new.tpl @@ -15,7 +15,7 @@ jQuery().ready(function(){ldelim} <div class="titrePage"> <span class="sort"> {'Sort order'|@translate} : - <select onchange="document.location = this.options[this.selectedIndex].value;" style="width:150px"> + <select onchange="document.location = this.options[this.selectedIndex].value;"> {html_options options=$order_options selected=$order_selected} </select> </span> @@ -37,7 +37,7 @@ jQuery().ready(function(){ldelim} {foreach from=$plugins item=plugin name=plugins_loop} <tr class="{if $smarty.foreach.plugins_loop.index is odd}row1{else}row2{/if}"> <td><a href="{$plugin.EXT_URL}" onclick="window.open(this.href); return false;" class="cluetip" title="{$plugin.EXT_NAME}|{$plugin.EXT_DESC|htmlspecialchars|nl2br}">{$plugin.EXT_NAME}</a></td> - <td style="text-align:center;"><a href="{$plugin.VERSION_URL}" onclick="window.open(this.href); return false;" class="cluetip" title="{$plugin.EXT_NAME}|{$plugin.VER_DESC|htmlspecialchars|nl2br}">{$plugin.VERSION}</a></td> + <td style="text-align:center;"><a href="{$plugin.EXT_URL}" onclick="window.open(this.href); return false;" class="cluetip" title="{$plugin.EXT_NAME}|{$plugin.VER_DESC|htmlspecialchars|nl2br}">{$plugin.VERSION}</a></td> <td>{$plugin.DATE}</td> <td>{$plugin.AUTHOR}</td> <td style="text-align:center;"><a href="{$plugin.URL_INSTALL}" onclick="return confirm('{'plugins_confirm_install'|@translate|@escape:javascript}');">{'plugins_auto_install'|@translate}</a> diff --git a/admin/template/goto/plugins_update.tpl b/admin/template/goto/plugins_update.tpl index c7bdc2865..cae800f85 100644 --- a/admin/template/goto/plugins_update.tpl +++ b/admin/template/goto/plugins_update.tpl @@ -32,7 +32,7 @@ jQuery().ready(function(){ldelim} <tr class="{if $smarty.foreach.plugins_loop.index is odd}row1{else}row2{/if}"> <td><a href="{$plugin.EXT_URL}" onclick="window.open(this.href); return false;" class="cluetip" title="{$plugin.EXT_NAME}|{$plugin.EXT_DESC|htmlspecialchars|nl2br}">{$plugin.EXT_NAME}</a></td> <td style="text-align:center;">{$plugin.VERSION}</td> - <td style="text-align:center;"><a href="{$plugin.VERSION_URL}" onclick="window.open(this.href); return false;" class="cluetip" title="{$plugin.EXT_NAME}|{$plugin.NEW_VER_DESC|htmlspecialchars|nl2br}">{$plugin.NEW_VERSION}</a></td> + <td style="text-align:center;"><a href="{$plugin.EXT_URL}" onclick="window.open(this.href); return false;" class="cluetip" title="{$plugin.EXT_NAME}|{$plugin.NEW_VER_DESC|htmlspecialchars|nl2br}">{$plugin.NEW_VERSION}</a></td> <td style="text-align:center;"><a href="{$plugin.URL_UPDATE}" onclick="return confirm('{'plugins_confirm_upgrade'|@translate|@escape:javascript}');">{'plugins_auto_update'|@translate}</a> / <a href="{$plugin.URL_DOWNLOAD}">{'plugins_download'|@translate}</a></td> </tr> @@ -54,7 +54,7 @@ jQuery().ready(function(){ldelim} {foreach from=$plugins_uptodate item=plugin name=plugins_loop} <tr class="{if $smarty.foreach.plugins_loop.index is odd}row1{else}row2{/if}"> <td><a href="{$plugin.URL}" onclick="window.open(this.href); return false;" class="cluetip" title="{$plugin.NAME}|{$plugin.EXT_DESC|htmlspecialchars|nl2br}">{$plugin.NAME}</a></td> - <td style="text-align:center;">{$plugin.VERSION}</td> + <td style="text-align:center;"><a href="{$plugin.URL}" onclick="window.open(this.href); return false;" class="cluetip" title="{$plugin.NAME}|{$plugin.VER_DESC|htmlspecialchars|nl2br}">{$plugin.VERSION}</a></td> </tr> {/foreach} </table> |