Hey, I understand to I can modify templates. I want to modify the OJS3 issueArchive template in such a way that for each issue in the listing the DOI, the Issue Galley download link appears, and the publication date.
The code for the publication date I could easily copy/paste from another template but none of the snippets for the DOI and the Issue Galley seem to work.
Could you provide some lines of code I could copy/paste to make this work?
We won’t be able to provide copy/paste code – you’ll need some expertise in PHP and potentially Smarty templates to make changes like those you describe. I can identify the files you’ll need to work with, and if you get stuck, I can potentially provide some guidance. Just to be sure I understand, you want to add the DOI and download link to the listing of issues, correct?
Regards,
Alec Smecher
Public Knowledge Project Team
I am using the latest OJS version: 3.0.2.
I have been playing with the three snippets below.
They are doing fine on the issue-toc template:
{* Published date }, { PUb IDs (eg - DOI) }, and { Full-issue galley *}
When the latest issue is displayed on the indexJournal (the frontpage) then
the {* Published date } and the { Full-issue galley } are displayed but not the { PUb IDs (eg - DOI) *}
The indexJournal imports the issue-toc template.
Adding the snippets to the issueArchive template is even less successful.
{* Published date *} is then the only one that displays its content on the issueArchive page.
{* Published date *}
{if $issue->getDatePublished()}
I think your template does not know/have the variable $pubIdPlugins. You will have to assign it to the template, either in the pages/index/IndexHandler.inx.php, for example after this line: https://github.com/pkp/ojs/blob/master/pages/index/IndexHandler.inc.php#L65, or in pages/issue/IssueHandler.inc.php, function _setupIssueTemplate:
in the indexHandler the DOI of the issue appeared on the indexJournal page, the home page of the site. Good!
However, the problem with the issueArchive page persists. This page uses: {include file="frontend/objects/issue_summary.tpl"}
On the issueSummary template I have included the code I have posted 3 days earlier. Only the publication date appears. The DOI and the Issue Galley don’t.
I checked what happens if I paste the {include file="frontend/objects/issue_summary.tpl"}
on the indexJournal f. In this case all elements do appear.
It would then be best to insert those two lines in the function _setupIssueTemplate in pages/issue/IssueHandler.inc.php. Then I think you can also remove it from pages/index/IndexHandler.inx.php.
Dear @bozana adding the two lines to IssueHandler.inc.php had no desired effect but removing them from the IndexHandler.inc.php resulted in a disappearing DOI. So, I did put them back.
I guess it is another inc.php document that rules the issueArchive.tpl
But which?
The two lines seem to address just the ‘Id’ (DOI).
Please not that the Issue Galley doesn’t appear as well on the Archives page.
I was only successful in adding the publication date.
Hmmm… To display the issue galleys on the archive page you would need much more code to add/change. You would have to first get all galleys of all issues and then to check that in the template for each issue.
You would need something like this between these two code lines in IssueHandler, https://github.com/pkp/ojs/blob/master/pages/issue/IssueHandler.inc.php#L134-L135:
$issues = $publishedIssuesIterator->toArray();
$issueGalleyDao = DAORegistry::getDAO(‘IssueGalleyDAO’);
$issuesGalleys = array();
foreach ($issues as $issue) {
$issueGalleys = $issueGalleyDao->getByIssueId($issue->getId());
if (!empty($issueGalleys)) $issuesGalleys[$issue->getId()] = $issueGalleys;
}
$templateMgr->assign(‘issuesGalleys’, $issuesGalleys);
$publishedIssuesIterator = $issueDao->getPublishedIssues($journal->getId(), $rangeInfo);
Note that the last line has to be double in that function.
{/if}
Note that here hasAccess is defined to always be true.
In order to get the correct access permissions, you would need to also get all the follwoing information for each issue: https://github.com/pkp/ojs/blob/master/pages/issue/IssueHandler.inc.php#L296-L335 – similarly to the issuesGalleys in IssueHandler::archive – and then to check them all appropriately in the template file.
Thanks Bozana, it works. Download link for the issue galley appears together with the DOI on the Issue Archive page.
@asmecher@bozana
Both, there are thousands of OJS installations. I can’t believe we are the only ones that like to have the DOI’s and Issue Galley included like above. Is there any reason not to add these lines of code to the IssueHandler and the IndexHandler?