Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
*6964* display object metadata on the article abstract page
  • Loading branch information
bozana authored and asmecher committed May 22, 2014
1 parent c731875 commit 1320a0b
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 18 deletions.
74 changes: 73 additions & 1 deletion plugins/generic/objectsForReview/ObjectsForReviewPlugin.inc.php
Expand Up @@ -93,6 +93,12 @@ function register($category, $path) {
HookRegistry::register('Templates::Author::Submit::Step5::AdditionalItems', array($this, 'displayAuthorObjectsForReview'));

}

// Display object metadata on article abstract page
if ($this->getSetting($journal->getId(), 'displayAbstract')) {
HookRegistry::register ('TemplateManager::display', array(&$this, 'handleTemplateDisplay'));
HookRegistry::register ('Templates::Article::MoreInfo', array(&$this, 'displayAbstract'));
}
}
}
return $success;
Expand Down Expand Up @@ -375,6 +381,7 @@ function displayLink($hookName, $params) {
if ($this->getEnabled()) {
$smarty =& $params[1];
$output =& $params[2];
$journal =& Request::getJournal();
$templateMgr = TemplateManager::getManager();
if ($hookName == 'Templates::Editor::Index::AdditionalItems') { // On editor's home page
$output .= '<h3>' . __('plugins.generic.objectsForReview.editor.objectsForReview') . '</h3>
Expand All @@ -384,7 +391,7 @@ function displayLink($hookName, $params) {
</ul>';
} elseif ($hookName == 'Templates::Author::Index::AdditionalItems') { // On author's home page
$output .= '<br /><div class="separator"></div><h3>' . __('plugins.generic.objectsForReview.author.objectsForReview') . '</h3><ul class="plain"><li>&#187; <a href="' . Request::url(null, 'author', 'objectsForReview', 'all') . '">' . __('plugins.generic.objectsForReview.author.myObjectsForReview') . '</a></li></ul><br />';
} elseif ($hookName == 'Templates::Common::Header::Navbar::CurrentJournal') { // In the main nav bar
} elseif ($hookName == 'Templates::Common::Header::Navbar::CurrentJournal' && $this->getSetting($journal->getId(), 'displayListing')) { // In the main nav bar
$output .= '<li><a href="' . Request::url(null, 'objectsForReview') . '" target="_parent">' . __('plugins.generic.objectsForReview.public.headerLink') . '</a></li>';
}
}
Expand Down Expand Up @@ -462,6 +469,71 @@ function saveSubmitHandler($hookName, $params) {
}
}

/**
* Add the plug-in stylesheets before displaying the article template.
*/
function handleTemplateDisplay($hookName, $args) {
$templateMgr =& $args[0];
$template =& $args[1];

switch ($template) {
case 'article/article.tpl':
$templateMgr = TemplateManager::getManager();
$templateMgr->addStyleSheet(Request::getBaseUrl() . '/' . $this->getStyleSheet());
break;
}
return false;
}

/**
* Display object metadata on the article abstract pages.
*/
function displayAbstract($hookName, $params) {
$smarty =& $params[1];
$output =& $params[2];

// Get the journal and the article
$journal =& Request::getJournal();
$journalId = $journal->getId();
$article = $smarty->get_template_vars('article');
$pubObject = $smarty->get_template_vars('pubObject');
// Only consider the abstract page
if ($article && is_a($pubObject, 'Article')) {
// Get the assignemnts for this article
$objectsForReview = array();
$ofrDao =& DAORegistry::getDAO('ObjectForReviewDAO');
$ofrAssignmentDao =& DAORegistry::getDAO('ObjectForReviewAssignmentDAO');
$objectForReviewAssignments =& $ofrAssignmentDao->getAllBySubmissionId($article->getId());
foreach ($objectForReviewAssignments as $objectForReviewAssignment) {
$objectForReview = $ofrDao->getById($objectForReviewAssignment->getObjectId(), $journalId);
$objectsForReview[] = $objectForReview;
}

if (!empty($objectsForReview)) {
// Get metadata for the review type
$reviewObjectTypeDao =& DAORegistry::getDAO('ReviewObjectTypeDAO');
$allTypes =& $reviewObjectTypeDao->getTypeIdsAlphabetizedByContext($journalId);
$reviewObjectMetadataDao =& DAORegistry::getDAO('ReviewObjectMetadataDAO');
$allReviewObjectsMetadata = array();
foreach ($allTypes as $type) {
$typeId = $type['typeId'];
$typeMetadata = $reviewObjectMetadataDao->getArrayByReviewObjectTypeId($typeId);
$allReviewObjectsMetadata[$typeId] = $typeMetadata;
}

$publicFileManager = new PublicFileManager();
$coverPagePath = Request::getBaseUrl() . '/';
$coverPagePath .= $publicFileManager->getJournalFilesPath($journalId) . '/';
$smarty->assign('coverPagePath', $coverPagePath);

$smarty->assign('objectsForReview', $objectsForReview);
$smarty->assign('allReviewObjectsMetadata', $allReviewObjectsMetadata);
$smarty->assign('multipleOptionsTypes', ReviewObjectMetadata::getMultipleOptionsTypes());
$smarty->assign('ofrListing', true);
$output .= $smarty->fetch($this->getTemplatePath() . '/' . 'articleObjectsForReview.tpl');
}
}
}

//
// Private helper methods
Expand Down
Expand Up @@ -89,8 +89,8 @@ function initData() {
$plugin =& $this->plugin;
$this->_data = array(
'mode' => $plugin->getSetting($journalId, 'mode'),
'coverPageIssue' => $plugin->getSetting($journalId, 'coverPageIssue'),
'coverPageAbstract' => $plugin->getSetting($journalId, 'coverPageAbstract'),
'displayAbstract' => $plugin->getSetting($journalId, 'displayAbstract'),
'displayListing' => $plugin->getSetting($journalId, 'displayListing'),
'dueWeeks' => $plugin->getSetting($journalId, 'dueWeeks'),
'enableDueReminderBefore' => $plugin->getSetting($journalId, 'enableDueReminderBefore'),
'numDaysBeforeDueReminder' => $plugin->getSetting($journalId, 'numDaysBeforeDueReminder'),
Expand All @@ -107,8 +107,8 @@ function readInputData() {
$this->readUserVars(
array(
'mode',
'coverPageIssue',
'coverPageAbstract',
'displayAbstract',
'displayListing',
'dueWeeks',
'enableDueReminderBefore',
'numDaysBeforeDueReminder',
Expand All @@ -131,8 +131,8 @@ function execute() {
$plugin =& $this->plugin;
$journalId = $this->journalId;
$plugin->updateSetting($journalId, 'mode', $this->getData('mode'), 'int');
$plugin->updateSetting($journalId, 'coverPageIssue', $this->getData('coverPageIssue'), 'bool');
$plugin->updateSetting($journalId, 'coverPageAbstract', $this->getData('coverPageAbstract'), 'bool');
$plugin->updateSetting($journalId, 'displayAbstract', $this->getData('displayAbstract'), 'bool');
$plugin->updateSetting($journalId, 'displayListing', $this->getData('displayListing'), 'bool');
$plugin->updateSetting($journalId, 'dueWeeks', $this->getData('dueWeeks'), 'int');
$plugin->updateSetting($journalId, 'enableDueReminderBefore', $this->getData('enableDueReminderBefore'), 'bool');
$plugin->updateSetting($journalId, 'numDaysBeforeDueReminder', $this->getData('numDaysBeforeDueReminder'), 'int');
Expand Down
9 changes: 6 additions & 3 deletions plugins/generic/objectsForReview/locale/en_US/locale.xml
Expand Up @@ -73,9 +73,9 @@
<message key="plugins.generic.objectsForReview.settings.modeFull">Mode 1: List available objects for review, manage object reviewers, and publish object metadata.</message>
<message key="plugins.generic.objectsForReview.settings.modeMetadata">Mode 2: Only publish object metadata.</message>
<message key="plugins.generic.objectsForReview.settings.description"><![CDATA[<h5>Mode 1</h5><p>The following workflow is supported:</p><ul><li>Editor adds objects available for review.</li><li>Authors interested in reviewing an object can request to write a review, notifying the Editor.</li><li>Editor can accept or deny the review request, notifying the Author.</li><li>For the accepted review request a due date is set for the review.</li><li>The Editor can mail a copy of the object to the Author. The due date for the review is set anew.</li><li>Author submits review via the standard online submission process.</li><li>Object metadata is published as part of the object review submission.</li></ul><p>This plugin supports journals with multiple editors. When an Editor adds a new object for review, he or she becomes the primary editor and correspondence contact for the object.</p><h5>Mode 2</h5><p>The following workflow is supported:</p><ul><li>Editor adds objects for review.</li><li>Editor matches submissions (reviews) to each object.</li><li>Object metadata is published as part of the object review submission.</li></ul>]]></message>
<message key="plugins.generic.objectsForReview.settings.coverImages">Cover Images</message>
<message key="plugins.generic.objectsForReview.settings.coverPageIssue">Display cover images for object reviews in issue table of contents.</message>
<message key="plugins.generic.objectsForReview.settings.coverPageAbstract">Display cover images for object reviews on article abstract pages.</message>
<message key="plugins.generic.objectsForReview.settings.displayMetadata">Display Object Metadata</message>
<message key="plugins.generic.objectsForReview.settings.displayAbstract">Display object metadata on the article abstract pages.</message>
<message key="plugins.generic.objectsForReview.settings.displayListing">Publish the list of all available objects for review using the navigation item "Objects For Review".</message>
<message key="plugins.generic.objectsForReview.settings.objectsForReviewDue">Object Reviews Due</message>
<message key="plugins.generic.objectsForReview.settings.dueWeeks1">Reviews are due</message>
<message key="plugins.generic.objectsForReview.settings.dueWeeks2">week(s) after the object has been assigned to the author.</message>
Expand Down Expand Up @@ -200,6 +200,9 @@
<message key="plugins.generic.objectsForReview.public.objectsForReview">Objects For Review</message>
<message key="plugins.generic.objectsForReview.public.objectForReview">Object For Review</message>
<message key="plugins.generic.objectsForReview.public.objectsForReviewInstructions"><![CDATA[<p>To request an object for review:</p><ul><li><a href="{$registerUrl}" target="_parent">Register</a> as an author with this journal.</li><li><a href="{$loginAuthorUrl}" target="_parent">Log in</a> as an author.</li><li>Click on the request link that corresponds to the object of interest.</li></ul>]]></message>

<!-- Article Abstract Page -->
<message key="plugins.generic.objectsForReview.public.articleObjectsForReview">Objects reviewed in this article</message>


<!-- Author -->
Expand Down
Expand Up @@ -198,6 +198,8 @@ function authorize(&$request, &$args, $roleAssignments) {
$mode = $ofrPlugin->getSetting($journal->getId(), 'mode');
if ($mode != OFR_MODE_FULL) return false;

if (!$ofrPlugin->getSetting($journal->getId(), 'displayListing')) return false;

return parent::authorize($request, $args, $roleAssignments);
}

Expand Down
@@ -0,0 +1,25 @@
{**
* @file plugins/generic/objectsForReview/templates/articleObjectsForReview.tpl
*
* Copyright (c) 2013-2014 Simon Fraser University Library
* Copyright (c) 2003-2014 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* Display objects reviewed by the article.
*
*}

<div class="separator"></div>
<div id="ojectsForReviewListing">
<h3>{translate key="plugins.generic.objectsForReview.public.articleObjectsForReview"}</h3>
{foreach from=$objectsForReview item=objectForReview name=objectsForReview}
<div class="objectForReviewListing" style="clear:left;">

{include file="../plugins/generic/objectsForReview/templates/objectForReviewMetadata.tpl"}

<div{if not $smarty.foreach.objectsForReview.last} class="separator"{/if} style="clear:both;"></div>

</div>
{/foreach}
</div>

Expand Up @@ -54,20 +54,18 @@
</table>
</div>
{*
<div class="separator"></div>
<div id="objectsForReviewSettingsCoverImages">
<h4>{translate key="plugins.generic.objectsForReview.settings.coverImages"}</h4>
<div id="displayObjectMetadata">
<h4>{translate key="plugins.generic.objectsForReview.settings.displayMetadata"}</h4>
<p>
<input type="checkbox" name="coverPageIssue" id="coverPageIssue" value="1" {if $coverPageIssue} checked="checked"{/if} />&nbsp;
{fieldLabel name="coverPageIssue" key="plugins.generic.objectsForReview.settings.coverPageIssue"}
<input type="checkbox" name="displayAbstract" id="displayAbstract" value="1" {if $displayAbstract} checked="checked"{/if} />&nbsp;
{fieldLabel name="displayAbstract" key="plugins.generic.objectsForReview.settings.displayAbstract"}
</p>
<p>
<input type="checkbox" name="coverPageAbstract" id="coverPageAbstract" value="1" {if $coverPageAbstract} checked="checked"{/if} />&nbsp;
{fieldLabel name="coverPageAbstract" key="plugins.generic.objectsForReview.settings.coverPageAbstract"}
<input type="checkbox" name="displayListing" id="displayListing" value="1" {if $displayListing} checked="checked"{/if} />&nbsp;
{fieldLabel name="displayAbstract" key="plugins.generic.objectsForReview.settings.displayListing"}
</p>
</div>
*}
<div class="separator"></div>
<div id="objectsForReviewSettingsDue">
Expand Down

0 comments on commit 1320a0b

Please sign in to comment.