Skip to content

Commit

Permalink
Merge event and sidebar update page into one (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
onli committed Mar 20, 2016
1 parent 2c7f40a commit 668363e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
4 changes: 4 additions & 0 deletions docs/NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Version 2.1 ()
------------------------------------------------------------------------

* Merge sidebar and event upgrade pages in one single page
button

* Add colorpicker as possible plugin option item type, set
type to 'color' to use it

Expand Down
18 changes: 18 additions & 0 deletions include/admin/plugins.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,27 @@
serendipity_plugin_api::hook_event('backend_plugins_fetchlist', $foreignPlugins);
$pluginstack = array_merge((array)$foreignPlugins['pluginstack'], $pluginstack);
$errorstack = array_merge((array)$foreignPlugins['errorstack'], $errorstack);
if ($serendipity['GET']['only_group'] == 'UPGRADE') {
// for upgrades, the distinction in sidebar and event-plugins is not useful. We will fetch both and mix the lists

if ($serendipity['GET']['type'] == 'event') {
$serendipity['GET']['type'] = 'sidebar';
} else {
$serendipity['GET']['type'] = 'event';
}
$foreignPluginsTemp = array();
serendipity_plugin_api::hook_event('backend_plugins_fetchlist', $foreignPluginsTemp);
$pluginstack = array_merge((array)$foreignPluginsTemp['pluginstack'], $pluginstack);
$errorstack = array_merge((array)$foreignPluginsTemp['errorstack'], $errorstack);
$foreignPlugins = array_merge($foreignPlugins, $foreignPluginsTemp);
}

$plugins = serendipity_plugin_api::get_installed_plugins();
$classes = serendipity_plugin_api::enum_plugin_classes(($serendipity['GET']['type'] === 'event'));
if ($serendipity['GET']['only_group'] == 'UPGRADE') {
$classes = array_merge($classes, serendipity_plugin_api::enum_plugin_classes(!($serendipity['GET']['type'] === 'event')));
$data['type'] = 'both';
}
usort($classes, 'serendipity_pluginListSort');

$counter = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function introspect(&$propbag)
$propbag->add('description', PLUGIN_EVENT_SPARTACUS_DESC);
$propbag->add('stackable', false);
$propbag->add('author', 'Garvin Hicking');
$propbag->add('version', '2.33');
$propbag->add('version', '2.34');
$propbag->add('requirements', array(
'serendipity' => '1.6',
'smarty' => '2.6.7',
Expand Down Expand Up @@ -1235,8 +1235,13 @@ function event_hook($event, &$bag, &$eventData, $addData = null)
case 'backend_pluginlisting_header':
if (serendipity_db_bool($this->get_config('enable_plugins'))) {
echo '<div id="upgrade_notice" class="clearfix">';
echo ' <a id="upgrade_sidebar" class="button_link" href="?serendipity[adminModule]=plugins&amp;serendipity[adminAction]=addnew&amp;serendipity[only_group]=UPGRADE">'. PLUGIN_EVENT_SPARTACUS_CHECK_SIDEBAR .'</a>';
echo ' <a id="upgrade_event" class="button_link" href="?serendipity[adminModule]=plugins&amp;serendipity[adminAction]=addnew&amp;serendipity[only_group]=UPGRADE&amp;serendipity[type]=event">'. PLUGIN_EVENT_SPARTACUS_CHECK_EVENT .'</a> ';
if (version_compare($serendipity['version'], '2.1-alpha3', '<')) {
echo ' <a id="upgrade_sidebar" class="button_link" href="?serendipity[adminModule]=plugins&amp;serendipity[adminAction]=addnew&amp;serendipity[only_group]=UPGRADE">'. PLUGIN_EVENT_SPARTACUS_CHECK_SIDEBAR .'</a>';
echo ' <a id="upgrade_event" class="button_link" href="?serendipity[adminModule]=plugins&amp;serendipity[adminAction]=addnew&amp;serendipity[only_group]=UPGRADE&amp;serendipity[type]=event">'. PLUGIN_EVENT_SPARTACUS_CHECK_EVENT .'</a> ';

} else {
echo ' <a id="upgrade_plugins" class="button_link" href="?serendipity[adminModule]=plugins&amp;serendipity[adminAction]=addnew&amp;serendipity[only_group]=UPGRADE">'. PLUGIN_EVENT_SPARTACUS_CHECK .'</a>';
}
echo '</div>';
}
break;
Expand Down
2 changes: 1 addition & 1 deletion templates/2k11/admin/plugins.inc.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
{$config}
</form>
{elseif $adminAction == 'addnew'}
<h2>{if $type == 'event'}{$CONST.EVENT_PLUGINS}{else}{$CONST.SIDEBAR_PLUGINS}{/if}{if $only_group != UPGRADE} <span class="plugins_available">({$CONST.PLUGIN_AVAILABLE_COUNT|sprintf:$count_pluginstack})</span>{/if}</h2>
<h2>{if $type == 'event'}{$CONST.EVENT_PLUGINS}{/if}{if $type == 'sidebar'}{$CONST.SIDEBAR_PLUGINS}{/if}{if $type == 'both'}{$CONST.MENU_PLUGINS}{/if}{if $only_group != UPGRADE} <span class="plugins_available">({$CONST.PLUGIN_AVAILABLE_COUNT|sprintf:$count_pluginstack})</span>{/if}</h2>
{foreach $errorstack as $e_idx => $e_name}
<span class="msg_error"><span class="icon-attention-circled"></span> {$CONST.ERROR}: {$e_name}</span>
{/foreach}
Expand Down

2 comments on commit 668363e

@ophian
Copy link
Member

@ophian ophian commented on 668363e Mar 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For which case do you need the version check in spartacus, as long as this plugin isn't additionally hosted in additional_plugins?

@onli
Copy link
Member Author

@onli onli commented on 668363e Mar 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, it is not needed so far. Shouldn't hurt though.

Please sign in to comment.