Skip to content

Commit

Permalink
*7385* Upgrade nag message
Browse files Browse the repository at this point in the history
  • Loading branch information
mcrider committed Jun 8, 2012
1 parent 673b7cc commit c31e02d
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config.TEMPLATE.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
; and 10. The more your connection bandwidth allows the better.
citation_checking_max_processes = 3

; Display a message on the site admin and journal manager user home pages if there is an upgrade available
show_upgrade_warning = On

;;;;;;;;;;;;;;;;;;;;;
; Database Settings ;
;;;;;;;;;;;;;;;;;;;;;
Expand Down
3 changes: 3 additions & 0 deletions locale/en_US/locale.xml
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,9 @@ Your server currently supports mbstring: <strong>{$supportsMBString}</strong>]]>
<p>Don't forget to set the "installed" setting in your config.inc.php configuration file back to <em>On</em>.</p>
<p>If you haven't already registered and wish to receive news and updates, <strong>please register at <a href="http://pkp.sfu.ca/ojs/register" target="_new">http://pkp.sfu.ca/ojs/register</a>.</strong> If you have questions or comments, please visit the <a href="http://pkp.sfu.ca/support/forum" target="_new">support forum</a>.</p>]]></message>

<!-- Installation upgrade warnings -->
<message key="site.upgradeAvailable.admin"><![CDATA[There is a new version of OJS available! You are currently using OJS {$currentVersion}. The most recent version is OJS {$latestVersion}. Please visit <a href="http://pkp.sfu.ca/ojs_download" target="_new">this page</a> to download the most recent version and find upgrade instructions.]]></message>
<message key="site.upgradeAvailable.manager"><![CDATA[There is a new version of OJS available! You are currently using OJS {$currentVersion}. The most recent version is OJS {$latestVersion}. Please contact your Site Administrator ({$siteAdminName}, <a href="mailto:{$siteAdminEmail}">{$siteAdminEmail}</a>) to notify them of this new release. More information can be found <a href="http://pkp.sfu.ca/ojs_download" target="_new">here</a>.]]></message>

<!-- Article Logs -->
<message key="log.author.submitted">{$authorName} has entered a new submission, ID {$submissionId}.</message>
Expand Down
14 changes: 14 additions & 0 deletions pages/admin/AdminHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@ function index() {
$this->setupTemplate();

$templateMgr =& TemplateManager::getManager();

// Display a warning message if there is a new version of OJS available
$newVersionAvailable = false;
if (Config::getVar('general', 'show_upgrade_warning')) {
import('lib.pkp.classes.site.VersionCheck');
if($latestVersion = VersionCheck::checkIfNewVersionExists()) {
$newVersionAvailable = true;
$templateMgr->assign('latestVersion', $latestVersion);
$currentVersion =& VersionCheck::getCurrentDBVersion();
$templateMgr->assign('currentVersion', $currentVersion->getVersionString());
}
}

$templateMgr->assign('newVersionAvailable', $newVersionAvailable);
$templateMgr->assign('helpTopicId', 'site.index');
$templateMgr->display('admin/index.tpl');
}
Expand Down
20 changes: 20 additions & 0 deletions pages/manager/ManagerHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,26 @@ function index() {
$this->setupTemplate();
$journal =& Request::getJournal();
$templateMgr =& TemplateManager::getManager();

// Display a warning message if there is a new version of OJS available
$newVersionAvailable = false;
if (Config::getVar('general', 'show_upgrade_warning')) {
import('lib.pkp.classes.site.VersionCheck');
if($latestVersion = VersionCheck::checkIfNewVersionExists()) {
$newVersionAvailable = true;
$templateMgr->assign('latestVersion', $latestVersion);
$currentVersion =& VersionCheck::getCurrentDBVersion();
$templateMgr->assign('currentVersion', $currentVersion->getVersionString());

// Get contact information for site administrator
$roleDao =& DAORegistry::getDAO('RoleDAO');
$siteAdmins =& $roleDao->getUsersByRoleId(ROLE_ID_SITE_ADMIN);
$templateMgr->assign_by_ref('siteAdmin', $siteAdmins->next());
}
}


$templateMgr->assign('newVersionAvailable', $newVersionAvailable);
$templateMgr->assign_by_ref('roleSettings', $this->retrieveRoleAssignmentPreferences($journal->getId()));
$templateMgr->assign('publishingMode', $journal->getSetting('publishingMode'));
$templateMgr->assign('announcementsEnabled', $journal->getSetting('enableAnnouncements'));
Expand Down
5 changes: 5 additions & 0 deletions templates/admin/index.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
{assign var="pageTitle" value="admin.siteAdmin"}
{include file="common/header.tpl"}
{/strip}

{if $newVersionAvailable}
<div class="warningMessage">{translate key="site.upgradeAvailable.admin" currentVersion=$currentVersion latestVersion=$latestVersion}</div>
{/if}

<div id="siteManagement">
<h3>{translate key="admin.siteManagement"}</h3>

Expand Down
5 changes: 5 additions & 0 deletions templates/manager/index.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
{assign var="pageTitle" value="manager.journalManagement"}
{include file="common/header.tpl"}
{/strip}

{if $newVersionAvailable}
<div class="warningMessage">{translate key="site.upgradeAvailable.manager" currentVersion=$currentVersion latestVersion=$latestVersion siteAdminName=$siteAdmin->getFullName() siteAdminEmail=$siteAdmin->getEmail()}</div>
{/if}

<div id="managementPages">
<h3>{translate key="manager.managementPages"}</h3>

Expand Down

0 comments on commit c31e02d

Please sign in to comment.