Commit 56a22645 authored by mcrider's avatar mcrider
Browse files

#3977# Behaviour after enabling plugins is inconsistent and lacking in information

parent ff7bf5cb
...@@ -72,8 +72,12 @@ class PluginHandler extends ManagerHandler { ...@@ -72,8 +72,12 @@ class PluginHandler extends ManagerHandler {
parent::validate(); parent::validate();
$plugins =& PluginRegistry::loadCategory($category); $plugins =& PluginRegistry::loadCategory($category);
if (!isset($plugins[$plugin]) || !$plugins[$plugin]->manage($verb, $args)) { if (!isset($plugins[$plugin]) || !$plugins[$plugin]->manage($verb, $args, $message)) {
Request::redirect(null, null, 'plugins', $category); if ($message) {
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('message', $message);
}
PluginHandler::plugins(array($category));
} }
} }
......
...@@ -135,10 +135,14 @@ class AnnouncementFeedPlugin extends GenericPlugin { ...@@ -135,10 +135,14 @@ class AnnouncementFeedPlugin extends GenericPlugin {
return $verbs; return $verbs;
} }
/** /*
* Perform management functions * Execute a management verb on this plugin
* @param $verb string
* @param $args array
* @param $message string Location for the plugin to put a result msg
* @return boolean
*/ */
function manage($verb, $args) { function manage($verb, $args, &$message) {
$returner = true; $returner = true;
$journal =& Request::getJournal(); $journal =& Request::getJournal();
...@@ -155,7 +159,6 @@ class AnnouncementFeedPlugin extends GenericPlugin { ...@@ -155,7 +159,6 @@ class AnnouncementFeedPlugin extends GenericPlugin {
$form->readInputData(); $form->readInputData();
if ($form->validate()) { if ($form->validate()) {
$form->execute(); $form->execute();
Request::redirect(null, null, 'plugins');
} else { } else {
$form->display(); $form->display();
} }
...@@ -166,14 +169,15 @@ class AnnouncementFeedPlugin extends GenericPlugin { ...@@ -166,14 +169,15 @@ class AnnouncementFeedPlugin extends GenericPlugin {
break; break;
case 'enable': case 'enable':
$this->updateSetting($journal->getJournalId(), 'enabled', true); $this->updateSetting($journal->getJournalId(), 'enabled', true);
$message = Locale::translate('plugins.generic.announcementFeed.enabled');
$returner = false; $returner = false;
break; break;
case 'disable': case 'disable':
$this->updateSetting($journal->getJournalId(), 'enabled', false); $this->updateSetting($journal->getJournalId(), 'enabled', false);
$message = Locale::translate('plugins.generic.announcementFeed.disabled');
$returner = false; $returner = false;
break; break;
} }
return $returner; return $returner;
} }
} }
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
<locale name="en_US" full_name="U.S. English"> <locale name="en_US" full_name="U.S. English">
<message key="plugins.generic.announcementfeed.displayName">Announcement Feed Plugin</message> <message key="plugins.generic.announcementfeed.displayName">Announcement Feed Plugin</message>
<message key="plugins.generic.announcementfeed.description">This plugin produces RSS/Atom web syndication feeds for journal announcements.</message> <message key="plugins.generic.announcementfeed.description">This plugin produces RSS/Atom web syndication feeds for journal announcements.</message>
<message key="plugins.generic.announcementfeed.enabled">The Announcement Feed Plugin has been enabled.</message>
<message key="plugins.generic.announcementfeed.disabled">The Announcement Feed Plugin has been disabled.</message>
<message key="plugins.generic.announcementfeed.settings">Settings</message> <message key="plugins.generic.announcementfeed.settings">Settings</message>
<message key="plugins.generic.announcementfeed.settings.all">Display feed links on all journal pages.</message> <message key="plugins.generic.announcementfeed.settings.all">Display feed links on all journal pages.</message>
......
...@@ -156,20 +156,27 @@ class CoinsPlugin extends GenericPlugin { ...@@ -156,20 +156,27 @@ class CoinsPlugin extends GenericPlugin {
return false; return false;
} }
/** /*
* Perform management functions * Execute a management verb on this plugin
* @param $verb string
* @param $args array
* @param $message string Location for the plugin to put a result msg
* @return boolean
*/ */
function manage($verb, $args) { function manage($verb, $args, &$message) {
switch ($verb) { switch ($verb) {
case 'enable': case 'enable':
$this->setEnabled(true); $this->setEnabled(true);
$message = Locale::translate('plugins.generic.coins.enabled');
break; break;
case 'disable': case 'disable':
$this->setEnabled(false); $this->setEnabled(false);
$message = Locale::translate('plugins.generic.coins.disabled');
break; break;
default: default:
Request::redirect(null, 'manager'); Request::redirect(null, 'manager');
} }
return false; return false;
} }
} }
......
...@@ -15,4 +15,6 @@ ...@@ -15,4 +15,6 @@
<locale name="en_US" full_name="U.S. English"> <locale name="en_US" full_name="U.S. English">
<message key="plugins.generic.coins.displayName">COinS Plugin</message> <message key="plugins.generic.coins.displayName">COinS Plugin</message>
<message key="plugins.generic.coins.description">The COinS plugin adds an OpenURL descriptor to article pages (abstract and HTML) that can be used e.g. for extraction to citation tools.</message> <message key="plugins.generic.coins.description">The COinS plugin adds an OpenURL descriptor to article pages (abstract and HTML) that can be used e.g. for extraction to citation tools.</message>
<message key="plugins.generic.coins.enabled">The COinS Plugin has been enabled.</message>
<message key="plugins.generic.coins.disabled">The COinS Plugin has been disabled.</message>
</locale> </locale>
...@@ -180,8 +180,14 @@ class CounterPlugin extends GenericPlugin { ...@@ -180,8 +180,14 @@ class CounterPlugin extends GenericPlugin {
return $verbs; return $verbs;
} }
function manage($verb, $args) { /*
* Execute a management verb on this plugin
* @param $verb string
* @param $args array
* @param $message string Location for the plugin to put a result msg
* @return boolean
*/
function manage($verb, $args, &$message) {
// Non-site admin managers cannot manage Counter plugin. // Non-site admin managers cannot manage Counter plugin.
if (!Validation::isSiteAdmin()) return false; if (!Validation::isSiteAdmin()) return false;
...@@ -190,9 +196,11 @@ class CounterPlugin extends GenericPlugin { ...@@ -190,9 +196,11 @@ class CounterPlugin extends GenericPlugin {
switch ($verb) { switch ($verb) {
case 'enable': case 'enable':
$this->updateSetting(0, 'enabled', true); $this->updateSetting(0, 'enabled', true);
$message = Locale::translate('plugins.generic.counter.enabled');
break; break;
case 'disable': case 'disable':
$this->updateSetting(0, 'enabled', false); $this->updateSetting(0, 'enabled', false);
$message = Locale::translate('plugins.generic.counter.disabled');
break; break;
case 'counter': case 'counter':
if ($isEnabled) Request::redirect(null, 'counter'); if ($isEnabled) Request::redirect(null, 'counter');
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
<locale name="en_US" full_name="U.S. English"> <locale name="en_US" full_name="U.S. English">
<message key="plugins.generic.counter.description"><![CDATA[The COUNTER plugin allows recording and <a href="http://www.projectcounter.org/about.html" target="_new">COUNTER</a>-compliant reporting on site activity.]]></message> <message key="plugins.generic.counter.description"><![CDATA[The COUNTER plugin allows recording and <a href="http://www.projectcounter.org/about.html" target="_new">COUNTER</a>-compliant reporting on site activity.]]></message>
<message key="plugins.generic.counter">COUNTER Statistics</message> <message key="plugins.generic.counter">COUNTER Statistics</message>
<message key="plugins.generic.counter.enabled">The COUNTER Plugin has been enabled.</message>
<message key="plugins.generic.counter.disabled">The COUNTER Plugin has been disabled.</message>
<message key="plugins.generic.counter.clearLog">Clear Log</message> <message key="plugins.generic.counter.clearLog">Clear Log</message>
<message key="plugins.generic.counter.confirmClear">Are you sure you wish to clear the log? This action cannot be undone.</message> <message key="plugins.generic.counter.confirmClear">Are you sure you wish to clear the log? This action cannot be undone.</message>
......
...@@ -112,17 +112,26 @@ class CustomLocalePlugin extends GenericPlugin { ...@@ -112,17 +112,26 @@ class CustomLocalePlugin extends GenericPlugin {
return $verbs; return $verbs;
} }
function manage($verb, $args) { /*
* Execute a management verb on this plugin
* @param $verb string
* @param $args array
* @param $message string Location for the plugin to put a result msg
* @return boolean
*/
function manage($verb, $args, &$message) {
$this->import('CustomLocaleHandler'); $this->import('CustomLocaleHandler');
$returner = true; $returner = true;
switch ($verb) { switch ($verb) {
case 'enable': case 'enable':
$this->setEnabled(true); $this->setEnabled(true);
$message = Locale::translate('plugins.generic.customLocale.enabled');
$returner = false; $returner = false;
break; break;
case 'disable': case 'disable':
$this->setEnabled(false); $this->setEnabled(false);
$message = Locale::translate('plugins.generic.customLocale.disabled');
$returner = false; $returner = false;
break; break;
case 'index': case 'index':
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
<locale name="en_US" full_name="U.S. English"> <locale name="en_US" full_name="U.S. English">
<message key="plugins.generic.customLocale.name">Custom Locale Plugin</message> <message key="plugins.generic.customLocale.name">Custom Locale Plugin</message>
<message key="plugins.generic.customLocale.description">This plugin enables customization of the default user interface text used by OJS.</message> <message key="plugins.generic.customLocale.description">This plugin enables customization of the default user interface text used by OJS.</message>
<message key="plugins.generic.customLocale.enabled">The Custom Locale Plugin has been enabled.</message>
<message key="plugins.generic.customLocale.disabled">The Custom Locale Plugin has been disabled.</message>
<message key="plugins.generic.customLocale.longDescription">This page lists all locales currently installed for the journal.</message> <message key="plugins.generic.customLocale.longDescription">This page lists all locales currently installed for the journal.</message>
<message key="plugins.generic.customLocale.localeDescription">This page lists all files that are available for the selected locale.</message> <message key="plugins.generic.customLocale.localeDescription">This page lists all files that are available for the selected locale.</message>
......
...@@ -187,10 +187,14 @@ class GoogleAnalyticsPlugin extends GenericPlugin { ...@@ -187,10 +187,14 @@ class GoogleAnalyticsPlugin extends GenericPlugin {
return false; return false;
} }
/** /*
* Perform management functions * Execute a management verb on this plugin
* @param $verb string
* @param $args array
* @param $message string Location for the plugin to put a result msg
* @return boolean
*/ */
function manage($verb, $args) { function manage($verb, $args, &$message) {
$templateMgr = &TemplateManager::getManager(); $templateMgr = &TemplateManager::getManager();
$templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl')); $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
$journal = &Request::getJournal(); $journal = &Request::getJournal();
...@@ -199,10 +203,12 @@ class GoogleAnalyticsPlugin extends GenericPlugin { ...@@ -199,10 +203,12 @@ class GoogleAnalyticsPlugin extends GenericPlugin {
switch ($verb) { switch ($verb) {
case 'enable': case 'enable':
$this->setEnabled(true); $this->setEnabled(true);
$message = Locale::translate('plugins.generic.googleAnalytics.enabled');
$returner = false; $returner = false;
break; break;
case 'disable': case 'disable':
$this->setEnabled(false); $this->setEnabled(false);
$message = Locale::translate('plugins.generic.googleAnalytics.disabled');
$returner = false; $returner = false;
break; break;
case 'settings': case 'settings':
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
<!-- Google Analytics --> <!-- Google Analytics -->
<message key="plugins.generic.googleAnalytics.displayName">Google Analytics Plugin</message> <message key="plugins.generic.googleAnalytics.displayName">Google Analytics Plugin</message>
<message key="plugins.generic.googleAnalytics.description"><![CDATA[Integrate OJS with Google Analytics, Google's web site traffic analysis application. Requires that you have already setup a Google Analytics account. Please see the <a href="http://www.google.com/analytics/" title="Google Analytics site">Google Analytics site</a> for more information.]]></message> <message key="plugins.generic.googleAnalytics.description"><![CDATA[Integrate OJS with Google Analytics, Google's web site traffic analysis application. Requires that you have already setup a Google Analytics account. Please see the <a href="http://www.google.com/analytics/" title="Google Analytics site">Google Analytics site</a> for more information.]]></message>
<message key="plugins.generic.googleAnalytics.enabled">The Google Analytics Plugin has been enabled.</message>
<message key="plugins.generic.googleAnalytics.disabled">The Google Analytics Plugin has been disabled.</message>
<!-- Google Analytics Settings Management --> <!-- Google Analytics Settings Management -->
<message key="plugins.generic.googleAnalytics.manager.settings">Settings</message> <message key="plugins.generic.googleAnalytics.manager.settings">Settings</message>
......
...@@ -218,17 +218,25 @@ class OpenAdsPlugin extends GenericPlugin { ...@@ -218,17 +218,25 @@ class OpenAdsPlugin extends GenericPlugin {
return false; return false;
} }
/** /*
* Perform management functions * Execute a management verb on this plugin
* @param $verb string
* @param $args array
* @param $message string Location for the plugin to put a result msg
* @return boolean
*/ */
function manage($verb, $args) { function manage($verb, $args, &$message) {
$templateMgr = &TemplateManager::getManager(); $templateMgr = &TemplateManager::getManager();
$journal = &Request::getJournal(); $journal = &Request::getJournal();
$returner = false; $returner = false;
switch ($verb) { switch ($verb) {
case 'enable': $this->setEnabled(true); break; case 'enable': $this->setEnabled(true);
case 'disable': $this->setEnabled(false); break; $message = Locale::translate('plugins.generic.openAds.enabled');
break;
case 'disable': $this->setEnabled(false);
$message = Locale::translate('plugins.generic.openAds.disabled');
break;
case 'settings': case 'settings':
$this->import('OpenAdsSettingsForm'); $this->import('OpenAdsSettingsForm');
$this->import('OpenAdsConnection'); $this->import('OpenAdsConnection');
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
<message key="plugins.generic.openads">OpenAds Plugin</message> <message key="plugins.generic.openads">OpenAds Plugin</message>
<message key="plugins.generic.openads.settings.description">Use this form to select the OpenAds ad zones that will be displayed in OJS for each potential location.</message> <message key="plugins.generic.openads.settings.description">Use this form to select the OpenAds ad zones that will be displayed in OJS for each potential location.</message>
<message key="plugins.generic.openads.manager.settings">Settings</message> <message key="plugins.generic.openads.manager.settings">Settings</message>
<message key="plugins.generic.openads.enabled">The OpenAds Plugin has been enabled.</message>
<message key="plugins.generic.openads.disabled">The OpenAds Plugin has been disabled.</message>
<message key="plugins.generic.openads.error.configFileNotFound">The configuration file, {$filename}, could not be accessed.</message> <message key="plugins.generic.openads.error.configFileNotFound">The configuration file, {$filename}, could not be accessed.</message>
<message key="plugins.generic.openads.error.missingParameter">At least one of the required OpenAds configuration parameters could not be read from the configuration file. The required parameters are dbhost, dbuser, dbpassword, dbname, url_prefix, and table_prefix.</message> <message key="plugins.generic.openads.error.missingParameter">At least one of the required OpenAds configuration parameters could not be read from the configuration file. The required parameters are dbhost, dbuser, dbpassword, dbname, url_prefix, and table_prefix.</message>
......
...@@ -184,10 +184,14 @@ class PhpMyVisitesPlugin extends GenericPlugin { ...@@ -184,10 +184,14 @@ class PhpMyVisitesPlugin extends GenericPlugin {
return false; return false;
} }
/** /*
* Perform management functions * Execute a management verb on this plugin
* @param $verb string
* @param $args array
* @param $message string Location for the plugin to put a result msg
* @return boolean
*/ */
function manage($verb, $args) { function manage($verb, $args, &$message) {
$templateMgr = &TemplateManager::getManager(); $templateMgr = &TemplateManager::getManager();
$templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl')); $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
$journal = &Request::getJournal(); $journal = &Request::getJournal();
...@@ -196,10 +200,12 @@ class PhpMyVisitesPlugin extends GenericPlugin { ...@@ -196,10 +200,12 @@ class PhpMyVisitesPlugin extends GenericPlugin {
switch ($verb) { switch ($verb) {
case 'enable': case 'enable':
$this->setEnabled(true); $this->setEnabled(true);
$message = Locale::translate('plugins.generic.phpMyVisites.enabled');
$returner = false; $returner = false;
break; break;
case 'disable': case 'disable':
$this->setEnabled(false); $this->setEnabled(false);
$message = Locale::translate('plugins.generic.phpMyVisites.enabled');
$returner = false; $returner = false;
break; break;
case 'settings': case 'settings':
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
<!-- phpMyVisites --> <!-- phpMyVisites -->
<message key="plugins.generic.phpmv.displayName">phpMyVisites Plugin</message> <message key="plugins.generic.phpmv.displayName">phpMyVisites Plugin</message>
<message key="plugins.generic.phpmv.description"><![CDATA[Integrate OJS with phpMyVisites, a free and open source web site traffic analysis application. Requires that phpMyVisites is already installed. Please see the <a href="http://www.phpmyvisites.us/" title="phpMyVisites site">phpMyVisites site</a> for more information.]]></message> <message key="plugins.generic.phpmv.description"><![CDATA[Integrate OJS with phpMyVisites, a free and open source web site traffic analysis application. Requires that phpMyVisites is already installed. Please see the <a href="http://www.phpmyvisites.us/" title="phpMyVisites site">phpMyVisites site</a> for more information.]]></message>
<message key="plugins.generic.phpmv.enabled">The phpMyVisites Plugin has been enabled.</message>
<message key="plugins.generic.phpmv.disabled">The phpMyVisites Plugin has been disabled.</message>
<!-- phpMyVisites Settings Management --> <!-- phpMyVisites Settings Management -->
<message key="plugins.generic.phpmv.manager.settings">Settings</message> <message key="plugins.generic.phpmv.manager.settings">Settings</message>
<message key="plugins.generic.phpmv.manager.phpmvSettings">phpMyVisites Settings</message> <message key="plugins.generic.phpmv.manager.phpmvSettings">phpMyVisites Settings</message>
......
...@@ -201,23 +201,27 @@ class ReferralPlugin extends GenericPlugin { ...@@ -201,23 +201,27 @@ class ReferralPlugin extends GenericPlugin {
return $verbs; return $verbs;
} }
/** /*
* Execute a management verb on this plugin * Execute a management verb on this plugin
* @param $verb string * @param $verb string
* @param $args array * @param $args array
* @param $message string Location for the plugin to put a result msg
* @return boolean * @return boolean
*/ */
function manage($verb, $args) { function manage($verb, $args, &$message) {
$journal =& Request::getJournal(); $journal =& Request::getJournal();
$journalId = $journal?$journal->getJournalId():0; $journalId = $journal?$journal->getJournalId():0;
switch ($verb) { switch ($verb) {
case 'enable': case 'enable':
$this->updateSetting($journalId, 'enabled', true); $this->updateSetting($journalId, 'enabled', true);
$message = Locale::translate('plugins.generic.referral.enabled');
break; break;
case 'disable': case 'disable':
$this->updateSetting($journalId, 'enabled', false); $this->updateSetting($journalId, 'enabled', false);
$message = Locale::translate('plugins.generic.referral.disabled');
break; break;
} }
return false; return false;
} }
} }
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
<locale name="en_US" full_name="U.S. English"> <locale name="en_US" full_name="U.S. English">
<message key="plugins.generic.referral.name">Referral Plugin</message> <message key="plugins.generic.referral.name">Referral Plugin</message>
<message key="plugins.generic.referral.description">The Referral Plugin tracks incoming refback URLs to articles (i.e. when a reader follows an external link to an article), allowing Authors to maintain and potentially publish an automatically-updated list of refbacks to an article.</message> <message key="plugins.generic.referral.description">The Referral Plugin tracks incoming refback URLs to articles (i.e. when a reader follows an external link to an article), allowing Authors to maintain and potentially publish an automatically-updated list of refbacks to an article.</message>
<message key="plugins.generic.referral.enabled">The Referral Plugin has been enabled.</message>
<message key="plugins.generic.referral.disabled">The Referral Plugin has been disabled.</message>
<message key="plugins.generic.referral.editReferral">Edit Refback</message> <message key="plugins.generic.referral.editReferral">Edit Refback</message>
<message key="plugins.generic.referral.createReferral">Create Refback</message> <message key="plugins.generic.referral.createReferral">Create Refback</message>
......
...@@ -15,4 +15,6 @@ ...@@ -15,4 +15,6 @@
<locale name="en_US" full_name="U.S. English"> <locale name="en_US" full_name="U.S. English">
<message key="plugins.generic.roundedcorners.displayName">Rounded Corners</message> <message key="plugins.generic.roundedcorners.displayName">Rounded Corners</message>
<message key="plugins.generic.roundedcorners.description">This Plugin puts a background on each sidebar block and rounds its corners. Changes can be made to the colours used by editing the CSS stylesheet found in the plugin.</message> <message key="plugins.generic.roundedcorners.description">This Plugin puts a background on each sidebar block and rounds its corners. Changes can be made to the colours used by editing the CSS stylesheet found in the plugin.</message>
<message key="plugins.generic.roundedcorners.enabled">The Rounded Corners Plugin has been enabled.</message>
<message key="plugins.generic.roundedcorners.disabled">The Rounded Corners Plugin has been disabled.</message>
</locale> </locale>
...@@ -153,17 +153,27 @@ class SehlPlugin extends GenericPlugin { ...@@ -153,17 +153,27 @@ class SehlPlugin extends GenericPlugin {
)); ));
} }
function manage($verb, $args) { /*
* Execute a management verb on this plugin
* @param $verb string
* @param $args array
* @param $message string Location for the plugin to put a result msg
* @return boolean
*/
function manage($verb, $args, &$message) {
$journal =& Request::getJournal(); $journal =& Request::getJournal();
$journalId = $journal?$journal->getJournalId():0; $journalId = $journal?$journal->getJournalId():0;
switch ($verb) { switch ($verb) {
case 'enable': case 'enable':
$this->updateSetting($journalId, 'enabled', true); $this->updateSetting($journalId, 'enabled', true);
$message = Locale::translate('plugins.generic.sehl.enabled');
break; break;
case 'disable': case 'disable':
$this->updateSetting($journalId, 'enabled', false); $this->updateSetting($journalId, 'enabled', false);
$message = Locale::translate('plugins.generic.sehl.disabled');
break; break;
} }
return false; return false;
} }
} }
......
...@@ -15,4 +15,6 @@ ...@@ -15,4 +15,6 @@
<locale name="en_US" full_name="U.S. English"> <locale name="en_US" full_name="U.S. English">
<message key="plugins.generic.sehl.name">SEHL Plugin</message> <message key="plugins.generic.sehl.name">SEHL Plugin</message>
<message key="plugins.generic.sehl.description">This plugin implements Search Engine HighLighting (SEHL) so that when a search engine locates an HTML article, the sought-after keywords are highlighted.</message> <message key="plugins.generic.sehl.description">This plugin implements Search Engine HighLighting (SEHL) so that when a search engine locates an HTML article, the sought-after keywords are highlighted.</message>
<message key="plugins.generic.sehl.enabled">The SEHL Plugin has been enabled.</message>
<message key="plugins.generic.sehl.disabled">The SEHL Plugin has been disabled.</message>
</locale> </locale>
Supports Markdown
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