Commit 901ed22e authored by Robert Lyon's avatar Robert Lyon Committed by Ghada El-Zoghbi
Browse files

Allowing the listing of new plugins on the admin homepage (Bug #1311428)



Help alert admin users to the fact that there are new core Mahara plugins available in the release upgrade.

Change-Id: I85e52d925d35328e27c8785ccf4ea851cad09cd8
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 4bc13ae9
......@@ -129,6 +129,16 @@ if (!empty($upgrades['core']->install)) {
$upgrades['localpostinst'] = true;
$smarty->assign('install', true);
}
// If we are coming from the upgrade plugins on the 'Admin home' page
if (isset($upgrades['newinstallcount'])) {
unset($upgrades['newinstallcount']);
unset($upgrades['toupgradecount']);
}
foreach ($upgrades as $key => $upgrade) {
if (isset($upgrade->newinstall)) {
unset($upgrades[$key]);
}
}
$js = <<< EOJS
function processNext() {
......
......@@ -33,11 +33,14 @@ $string['nothingtoupgrade'] = 'Nothing to upgrade';
$string['performinginstallation'] = 'Performing installation...';
$string['performingupgrades'] = 'Performing upgrades...';
$string['runupgrade'] = 'Run upgrade';
$string['gotoinstallpage'] = 'Install via extensions page';
$string['successfullyinstalled'] = 'Successfully installed Mahara.';
$string['thefollowingupgradesareready'] = 'The following upgrades are ready:';
$string['thefollowingpluginsareready'] = 'The following new plugins are available:';
$string['registerthismaharasite'] = 'Register this Mahara site';
$string['upgradeloading'] = 'Loading...';
$string['upgrades'] = 'Upgrades';
$string['newplugins'] = 'New plugins';
$string['upgradingplugin'] = 'Upgrading %s';
$string['upgradesuccess'] = 'Successfully upgraded';
$string['upgradesuccesstoversion'] = 'Successfully upgraded to version ';
......
......@@ -34,6 +34,8 @@ function check_upgrades($name=null) {
$pluginstocheck = plugin_types();
$toupgrade = array();
$toupgradecount = 0;
$newinstallcount = 0;
$installing = false;
$disablelogin = false;
......@@ -217,11 +219,18 @@ function check_upgrades($name=null) {
}
if (empty($pluginversion)) {
$newinstall = false;
if (empty($installing) && $pluginkey != $name) {
continue;
$newinstall = true;
}
$plugininfo = new StdClass;
$plugininfo->install = true;
if ($newinstall) {
$plugininfo->from = get_string('notinstalled', 'admin');
$plugininfo->fromrelease = get_string('notinstalled', 'admin');
$plugininfo->newinstall = true;
$newinstallcount ++;
}
$plugininfo->to = $config->version;
$plugininfo->torelease = $config->release;
if (property_exists($config, 'requires_config')) {
......@@ -254,6 +263,7 @@ function check_upgrades($name=null) {
. " ($config->minupgraderelease) first "
. " (you have $pluginversion ($pluginrelease))");
}
$toupgradecount ++;
$plugininfo = new StdClass;
$plugininfo->upgrade = true;
$plugininfo->from = $pluginversion;
......@@ -300,6 +310,8 @@ function check_upgrades($name=null) {
$toupgrade = array();
}
uksort($toupgrade, 'sort_upgrades');
$toupgrade['newinstallcount'] = $newinstallcount;
$toupgrade['toupgradecount'] = $toupgradecount;
return $toupgrade;
}
......
......@@ -11,7 +11,7 @@
</div>
{/if}
{if $upgrades}
{if $upgrades['toupgradecount']}
<div class="message" id="runupgrade">
<h3>{str tag="upgrades" section=admin}</h3>
<div class="fr"><span class="upgrade"><a class="btn" href="upgrade.php">{str tag=runupgrade section=admin}</a></span></div>
......@@ -26,7 +26,7 @@
</thead>
<tbody>
{foreach from=$upgrades key=key item=upgrade}
{if $key != 'disablelogin'}
{if $key != 'disablelogin' && $upgrade->upgrade}
<tr>
<td><strong>{$key}</strong></td>
<td>{$upgrade->fromrelease} ({$upgrade->from})</td>
......@@ -39,6 +39,34 @@
</div>
{/if}
{if $upgrades['newinstallcount']}
<div class="warning" id="runinstall">
<h3>{str tag="newplugins" section=admin}</h3>
<div class="fr"><span class="upgrade"><a class="btn" href="extensions/plugins.php">{str tag=gotoinstallpage section=admin}</a></span></div>
<h4>{str tag=thefollowingpluginsareready section=admin}</h4>
<table id="upgradestable" class="fullwidth">
<thead>
<tr>
<th>{str tag=Plugin section=admin}</th>
<th>{str tag=From}</th>
<th>{str tag=To}</th>
</tr>
</thead>
<tbody>
{foreach from=$upgrades key=key item=upgrade}
{if $key != 'disablelogin' && $upgrade->install}
<tr>
<td><strong>{$key}</strong></td>
<td>{$upgrade->fromrelease}</td>
<td>{$upgrade->torelease} ({$upgrade->to})</td>
</tr>
{/if}
{/foreach}
</tbody>
</table>
</div>
{/if}
<div id="adminhome">
{if $register}
<div class="message" id="register-site">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment