I have restarted looking into some projects involving plugins: one is the possibility to move a submission from one journal to another on a multi-journal site.
So far, I am in the planning phase, with most of the background work panned out.
However, I am still not sure how to call up a modal form from a plugin: i somewhat seem to understand this involves linkaction, which redirects to an AJAX modal form.
The LinkAction's URL is handled by the LoadComponentHandler hook:
This is setup via hooks callback:
And implemented as a hander file in the plugin:
The LinkAction constructor is documented here:
Available LinkActionRequests can be found here:
We are generally moving away from using the âgridsâ in order to use vue.js instead, so the initial logic of examining the âgridRowâ is short lived (and may already be obsolete for Submissions, depending on your version of OJS).
Can you describe where within the workflow you picture this action appearing in the interface?
wow⊠i am going through it slowly⊠it seems that I was somewhat on the right linesâŠ
I am playing around with the interface so far, but my simpler and most consistent choice would be to include a link on the submission main page, in the submission header.
The following is a small edit of the submission header tpl: i would need to override this once the plugin is ready.
Once the user clicks on this, I would open up a modal, with a list of Journals to choose from, and its respective sections.
{**
* templates/workflow/submissionHeader.tpl
*
* Copyright (c) 2014-2018 Simon Fraser University
* Copyright (c) 2003-2018 John Willinsky
* Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
*
* Include the submission progress bar
*}
<div class="pkp_page_title">
<div>
<div style="width: 75%; float: left;">
<h1 class="pkp_submission_title">
<span class="pkp_screen_reader">{translate key="submission.submissionTitle"}</span>
{$submission->getLocalizedTitle()}
</h1>
<div class="pkp_submission_author">
<span class="pkp_screen_reader">{translate key="user.role.author_s"}</span>
{$submission->getAuthorString()}
</div>
</div>
<div style="width: 24%; float: right">
Choose Journal
</div>
<div style="clear: both"> </div>
</div>
In 3.1.1 stable, this file (lib/pkp/templates/workflow/submissionHeader.tpl) includes several linkAction directives:
If you add a new <li> within the ul.pkp_submission_actions, I think youâll get exactly what you want. (And no worries about grids vs. vue.js!)
To add content to the display from a plugin, use the TemplateManager::display hook, as:
Then, create a callback function which examines which template is being displayed, and if you want to modify that template, register an output filter:
The output filter searches and replaces within the output to modify the content, and then de-registers the output filter:
But what content are you adding? It will be similar to the output of the line: <li>{include file="linkAction/linkAction.tpl" action=$submissionEntryAction}</li>
The variable $submissionEntryAction currently gets assigned here:
The example uses a SubmissionEntryLinkAction. Iâm not sure if there is a way to directly use a Modal or AjaxModal for form this kind of interaction, or if you need to create a new subclass of the LinkAction to implement this. @NateWr or @asmecher might have advice and an example there.
Alternately, this might also make sense as a new editorial action:
Were you trying to check if ($template === 'workflow/submissionHeader.tpl')?
I think the TemplateManager::display hook will actually be called on workflow/workflow.tpl, with submissionHeader.tpl processed as an include.
I havenât actually tested to confirm, but Iâm pretty sure if you hook TemplateManager::display, conditionally select the template workflow/workflow.tpl, and search for /<div[^>]+class="pkp_submission_actions"[^>]+>/, youâll get the div you are looking for.
You are correct: i had tried checking for âworkflow/submission.tplâ, but realised that it is not called directly. I did try checking against âworkflow/workflow.tplâ, and this does initiate the callback, however, the param[1] does not contain the matching submissionheader html: