aboutsummaryrefslogtreecommitdiffstats
path: root/admin/plugins_list.php
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2011-04-12 00:30:28 +0000
committermistic100 <mistic@piwigo.org>2011-04-12 00:30:28 +0000
commitf5c5a1b9b2c9fe711193ec6c3ac79fd06239a182 (patch)
tree5e9df0d6bdc814fb8ce272d05f81506dc289d000 /admin/plugins_list.php
parentb5592c8228b2decb2e799b2550f83ac963c61e09 (diff)
new plugins manager, update TipTip in v1.3
git-svn-id: http://piwigo.org/svn/trunk@10305 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/plugins_list.php')
-rw-r--r--admin/plugins_list.php47
1 files changed, 42 insertions, 5 deletions
diff --git a/admin/plugins_list.php b/admin/plugins_list.php
index 4ec64ec29..3f38356b5 100644
--- a/admin/plugins_list.php
+++ b/admin/plugins_list.php
@@ -30,8 +30,13 @@ include_once(PHPWG_ROOT_PATH.'admin/include/plugins.class.php');
$template->set_filenames(array('plugins' => 'plugins_list.tpl'));
-$base_url = get_root_url().'admin.php?page='.$page['page'];
-$action_url = $base_url.'&amp;plugin='.'%s'.'&amp;pwg_token='.get_pwg_token();
+// TODO : use a session parameter
+$plugin_order = isset($_GET['plugin_order']) ? $_GET['plugin_order'] : 'state';
+$plugin_display = isset($_GET['plugin_display']) ? $_GET['plugin_display'] : 'compact';
+
+$base_url = get_root_url().'admin.php?page='.$page['page'].'&amp;plugin_order='.$plugin_order.'&amp;plugin_display='.$plugin_display;
+$pwg_token = get_pwg_token();
+$action_url = $base_url.'&amp;plugin='.'%s'.'&amp;pwg_token='.$pwg_token;
$plugins = new plugins();
@@ -70,6 +75,7 @@ $plugins->sort_fs_plugins('name');
$plugins->get_merged_extensions();
$plugins->get_incompatible_plugins();
$merged_plugins = false;
+$tpl_plugins = array();
foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
{
@@ -81,6 +87,7 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
}
$tpl_plugin = array(
+ 'ID' => $plugin_id,
'NAME' => $fs_plugin['name'],
'VISIT_URL' => $fs_plugin['uri'],
'VERSION' => $fs_plugin['version'],
@@ -108,7 +115,7 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
$merged_plugins = true;
}
- $template->append('plugins', $tpl_plugin);
+ array_push($tpl_plugins, $tpl_plugin);
}
$template->append('plugin_states', 'active');
@@ -128,8 +135,8 @@ if (count($missing_plugin_ids) > 0)
{
foreach($missing_plugin_ids as $plugin_id)
{
- $template->append(
- 'plugins',
+ array_push(
+ $tpl_plugins,
array(
'NAME' => $plugin_id,
'VERSION' => $plugins->db_plugins_by_id[$plugin_id]['version'],
@@ -142,5 +149,35 @@ if (count($missing_plugin_ids) > 0)
$template->append('plugin_states', 'missing');
}
+// sort plugins : state or name
+if ($plugin_order == 'name')
+{
+ function cmp($a, $b)
+ {
+ return strcasecmp($a['NAME'], $b['NAME']);
+ }
+}
+else
+{
+ function cmp($a, $b)
+ {
+ $s = array('merged' => 0, 'missing' => 1, 'active' => 2, 'inactive' => 3);
+
+ if($a['STATE'] == $b['STATE'])
+ return strcasecmp($a['NAME'], $b['NAME']);
+ else
+ return $s[$a['STATE']] >= $s[$b['STATE']];
+ }
+ $plugin_order = 'state';
+}
+
+usort($tpl_plugins, 'cmp');
+$template->assign(array(
+ 'plugin_order' => $plugin_order,
+ 'plugin_display' => $plugin_display,
+ 'plugins' => $tpl_plugins,
+ 'PWG_TOKEN' => $pwg_token,
+));
+
$template->assign_var_from_handle('ADMIN_CONTENT', 'plugins');
?> \ No newline at end of file