forked from pkp/ojs
-
Notifications
You must be signed in to change notification settings - Fork 0
For review: Enable inline display of HTML article galleys #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ctgraham
wants to merge
2
commits into
stable-3_1_2
Choose a base branch
from
html-article-galley-inline-312
base: stable-3_1_2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
plugins/generic/htmlArticleGalley/HtmlArticleGalleySettingsForm.inc.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * @file plugins/generic/htmlArticleGalley/HtmlArticleGalleySettingsForm.inc.php | ||
| * | ||
| * Copyright (c) 2014-2019 Simon Fraser University | ||
| * Copyright (c) 2003-2019 John Willinsky | ||
| * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING. | ||
| * | ||
| * @class HtmlArticleGalleySettingsForm | ||
| * @ingroup plugins_generic_htmlArticleGalley | ||
| * | ||
| * @brief Form for journal managers to modify how HTML Article Galleys are presented | ||
| */ | ||
|
|
||
| import('lib.pkp.classes.form.Form'); | ||
|
|
||
| class HtmlArticleGalleySettingsForm extends Form { | ||
|
|
||
| /** @var int */ | ||
| var $_journalId; | ||
|
|
||
| /** @var object */ | ||
| var $_plugin; | ||
|
|
||
| /** | ||
| * Constructor | ||
| * @param $plugin HtmlArticleGalleyPlugin | ||
| * @param $journalId int | ||
| */ | ||
| function __construct($plugin, $journalId) { | ||
| $this->_journalId = $journalId; | ||
| $this->_plugin = $plugin; | ||
|
|
||
| parent::__construct($plugin->getTemplateResource('settingsForm.tpl')); | ||
|
|
||
| $this->addCheck(new FormValidatorPost($this)); | ||
| $this->addCheck(new FormValidatorCSRF($this)); | ||
| } | ||
|
|
||
| /** | ||
| * Initialize form data. | ||
| */ | ||
| function initData() { | ||
| $this->_data = array( | ||
| 'htmlArticleGalleyDisplayType' => $this->_plugin->getSetting($this->_journalId, 'htmlArticleGalleyDisplayType'), | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Assign form data to user-submitted data. | ||
| */ | ||
| function readInputData() { | ||
| $this->readUserVars(array('htmlArticleGalleyDisplayType')); | ||
| } | ||
|
|
||
| /** | ||
| * @copydoc Form::fetch() | ||
| */ | ||
| function fetch($request, $template = null, $display = false) { | ||
| $templateMgr = TemplateManager::getManager($request); | ||
| $templateMgr->assign('pluginName', $this->_plugin->getName()); | ||
| return parent::fetch($request, $template, $display); | ||
| } | ||
|
|
||
| /** | ||
| * Save settings. | ||
| */ | ||
| function execute(...$functionArgs) { | ||
| $this->_plugin->updateSetting($this->_journalId, 'htmlArticleGalleyDisplayType', $this->getData('htmlArticleGalleyDisplayType'), 'int'); | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
plugins/generic/htmlArticleGalley/templates/displayInline.tpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| {** | ||
| * templates/frontend/pages/article.tpl | ||
| * | ||
| * Copyright (c) 2014-2019 Simon Fraser University | ||
| * Copyright (c) 2003-2019 John Willinsky | ||
| * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING. | ||
| * | ||
| * @brief Display the page to view an article with all of it's details. | ||
| * | ||
| * @uses $article Article This article | ||
| * @uses $issue Issue The issue this article is assigned to | ||
| * @uses $section Section The journal section this article is assigned to | ||
| * @uses $journal Journal The journal currently being viewed. | ||
| * @uses $primaryGalleys array List of article galleys that are not supplementary or dependent | ||
| * @uses $supplementaryGalleys array List of article galleys that are supplementary | ||
| * @uses $htmlArticleGalley string The HTML content of the Article Galley | ||
| *} | ||
| {include file="frontend/components/header.tpl" pageTitleTranslated=$article->getLocalizedTitle()|escape} | ||
|
|
||
| <div class="page page_article"> | ||
| {if $section} | ||
| {include file="frontend/components/breadcrumbs_article.tpl" currentTitle=$section->getLocalizedTitle()} | ||
| {else} | ||
| {include file="frontend/components/breadcrumbs_article.tpl" currentTitleKey="article.article"} | ||
| {/if} | ||
|
|
||
| {* Show article inline *} | ||
| {$htmlArticleGalley} | ||
|
|
||
| {call_hook name="Templates::Article::Footer::PageFooter"} | ||
|
|
||
| </div><!-- .page --> | ||
|
|
||
| {include file="frontend/components/footer.tpl"} |
29 changes: 29 additions & 0 deletions
29
plugins/generic/htmlArticleGalley/templates/settingsForm.tpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| {** | ||
| * plugins/generic/htmlArticleGalley/settingsForm.tpl | ||
| * | ||
| * Copyright (c) 2014-2019 Simon Fraser University | ||
| * Copyright (c) 2003-2019 John Willinsky | ||
| * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING. | ||
| * | ||
| * HTML Article Galley plugin settings | ||
| * | ||
| *} | ||
| <script> | ||
| $(function() {ldelim} | ||
| // Attach the form handler. | ||
| $('#hagSettingsForm').pkpHandler('$.pkp.controllers.form.AjaxFormHandler'); | ||
| {rdelim}); | ||
| </script> | ||
|
|
||
| <form class="pkp_form" id="hagSettingsForm" method="post" action="{url router=$smarty.const.ROUTE_COMPONENT op="manage" category="generic" plugin=$pluginName verb="settings" save=true}"> | ||
| {csrf} | ||
| {include file="controllers/notification/inPlaceNotification.tpl" notificationId="hagSettingsFormNotification"} | ||
|
|
||
| {fbvFormArea id="htmlArticleGalleySettingsFormArea" title="plugins.generic.htmlArticleGalley.manager.settings.title"} | ||
| {fbvFormSection for="htmlArticleGalleyDisplayType" list=true description="plugins.generic.htmlArticleGalley.manager.settings.description"} | ||
| {fbvElement type="checkbox" id="htmlArticleGalleyDisplayType" value=HTML_ARTICLE_GALLEY_DISPLAY_INLINE checked=$htmlArticleGalleyDisplayType label="plugins.generic.htmlArticleGalley.manager.settings.htmlArticleGalleyDisplayType"} | ||
| {/fbvFormSection} | ||
| {/fbvFormArea} | ||
|
|
||
| {fbvFormButtons} | ||
| </form> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
abstract out journalId to a contextId