first commit
This commit is contained in:
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file pages/about/AboutContextHandler.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2003-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class AboutContextHandler
|
||||
*
|
||||
* @ingroup pages_about
|
||||
*
|
||||
* @brief Handle requests for context-level about functions.
|
||||
*/
|
||||
|
||||
namespace PKP\pages\about;
|
||||
|
||||
use APP\core\Application;
|
||||
use APP\facades\Repo;
|
||||
use APP\handler\Handler;
|
||||
use APP\template\TemplateManager;
|
||||
use PKP\security\authorization\ContextRequiredPolicy;
|
||||
use PKP\security\Role;
|
||||
|
||||
class AboutContextHandler extends Handler
|
||||
{
|
||||
/**
|
||||
* @see PKPHandler::authorize()
|
||||
*/
|
||||
public function authorize($request, &$args, $roleAssignments)
|
||||
{
|
||||
$context = $request->getContext();
|
||||
if (!$context || !$context->getData('restrictSiteAccess')) {
|
||||
$templateMgr = TemplateManager::getManager($request);
|
||||
$templateMgr->setCacheability(TemplateManager::CACHEABILITY_PUBLIC);
|
||||
}
|
||||
|
||||
$this->addPolicy(new ContextRequiredPolicy($request));
|
||||
return parent::authorize($request, $args, $roleAssignments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display about page.
|
||||
*
|
||||
* @param array $args
|
||||
* @param \PKP\core\PKPRequest $request
|
||||
*/
|
||||
public function index($args, $request)
|
||||
{
|
||||
$templateMgr = TemplateManager::getManager($request);
|
||||
$this->setupTemplate($request);
|
||||
$templateMgr->display('frontend/pages/about.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display editorialTeam page.
|
||||
*
|
||||
* @param array $args
|
||||
* @param \PKP\core\PKPRequest $request
|
||||
*/
|
||||
public function editorialTeam($args, $request)
|
||||
{
|
||||
$templateMgr = TemplateManager::getManager($request);
|
||||
$this->setupTemplate($request);
|
||||
$templateMgr->display('frontend/pages/editorialTeam.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display submissions page.
|
||||
*
|
||||
* @param array $args
|
||||
* @param \PKP\core\PKPRequest $request
|
||||
*/
|
||||
public function submissions($args, $request)
|
||||
{
|
||||
$templateMgr = TemplateManager::getManager($request);
|
||||
$context = $request->getContext();
|
||||
$this->setupTemplate($request);
|
||||
|
||||
|
||||
$templateMgr->assign('submissionChecklist', $context->getLocalizedData('submissionChecklist'));
|
||||
|
||||
// Get sections for this context
|
||||
$canSubmitAll = false;
|
||||
$userRoles = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_USER_ROLES);
|
||||
if ($userRoles && !empty(array_intersect([Role::ROLE_ID_SITE_ADMIN, Role::ROLE_ID_MANAGER, Role::ROLE_ID_SUB_EDITOR], $userRoles))) {
|
||||
$canSubmitAll = true;
|
||||
}
|
||||
|
||||
$sections = Repo::section()
|
||||
->getCollector()
|
||||
->filterByContextIds([$context->getId()])
|
||||
->excludeEditorOnly(!$canSubmitAll)
|
||||
->getMany()
|
||||
->all();
|
||||
|
||||
$templateMgr->assign('sections', $sections);
|
||||
$templateMgr->display('frontend/pages/submissions.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display contact page.
|
||||
*
|
||||
* @param array $args
|
||||
* @param \PKP\core\PKPRequest $request
|
||||
*/
|
||||
public function contact($args, $request)
|
||||
{
|
||||
$templateMgr = TemplateManager::getManager($request);
|
||||
$this->setupTemplate($request);
|
||||
$context = $request->getContext();
|
||||
$templateMgr->assign([
|
||||
'mailingAddress' => $context->getData('mailingAddress'),
|
||||
'contactPhone' => $context->getData('contactPhone'),
|
||||
'contactEmail' => $context->getData('contactEmail'),
|
||||
'contactName' => $context->getData('contactName'),
|
||||
'supportName' => $context->getData('supportName'),
|
||||
'supportPhone' => $context->getData('supportPhone'),
|
||||
'supportEmail' => $context->getData('supportEmail'),
|
||||
'contactTitle' => $context->getLocalizedData('contactTitle'),
|
||||
'contactAffiliation' => $context->getLocalizedData('contactAffiliation'),
|
||||
]);
|
||||
$templateMgr->display('frontend/pages/contact.tpl');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @file pages/about/AboutSiteHandler.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2003-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @class AboutSiteHandler
|
||||
*
|
||||
* @ingroup pages_about
|
||||
*
|
||||
* @brief Handle requests for site-wide about functions.
|
||||
*/
|
||||
|
||||
namespace PKP\pages\about;
|
||||
|
||||
use APP\core\Application;
|
||||
use APP\handler\Handler;
|
||||
use APP\template\TemplateManager;
|
||||
use PKP\config\Config;
|
||||
use PKP\core\PKPApplication;
|
||||
use PKP\db\DAORegistry;
|
||||
use PKP\site\VersionDAO;
|
||||
|
||||
class AboutSiteHandler extends Handler
|
||||
{
|
||||
/**
|
||||
* Display aboutThisPublishingSystem page.
|
||||
*
|
||||
* @param array $args
|
||||
* @param \PKP\core\PKPRequest $request
|
||||
*/
|
||||
public function aboutThisPublishingSystem($args, $request)
|
||||
{
|
||||
$versionDao = DAORegistry::getDAO('VersionDAO'); /** @var VersionDAO $versionDao */
|
||||
$version = $versionDao->getCurrentVersion();
|
||||
|
||||
$templateMgr = TemplateManager::getManager($request);
|
||||
$templateMgr->assign([
|
||||
'appVersion' => $version->getVersionString(false),
|
||||
'contactUrl' => $request->getDispatcher()->url(
|
||||
Application::get()->getRequest(),
|
||||
PKPApplication::ROUTE_PAGE,
|
||||
null,
|
||||
'about',
|
||||
'contact'
|
||||
),
|
||||
]);
|
||||
|
||||
$templateMgr->display('frontend/pages/aboutThisPublishingSystem.tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display privacy policy page.
|
||||
*
|
||||
* @param array $args
|
||||
* @param \PKP\core\PKPRequest $request
|
||||
*/
|
||||
public function privacy($args, $request)
|
||||
{
|
||||
$templateMgr = TemplateManager::getManager($request);
|
||||
$this->setupTemplate($request);
|
||||
$context = $request->getContext();
|
||||
$enableSiteWidePrivacyStatement = Config::getVar('general', 'sitewide_privacy_statement');
|
||||
if (!$enableSiteWidePrivacyStatement && $context) {
|
||||
$privacyStatement = $context->getLocalizedData('privacyStatement');
|
||||
} else {
|
||||
$privacyStatement = $request->getSite()->getLocalizedData('privacyStatement');
|
||||
}
|
||||
if (!$privacyStatement) {
|
||||
$dispatcher = $this->getDispatcher();
|
||||
$dispatcher->handle404();
|
||||
}
|
||||
$templateMgr->assign('privacyStatement', $privacyStatement);
|
||||
|
||||
$templateMgr->display('frontend/pages/privacy.tpl');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @defgroup pages_about About page
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file pages/about/index.php
|
||||
*
|
||||
* Copyright (c) 2014-2021 Simon Fraser University
|
||||
* Copyright (c) 2003-2021 John Willinsky
|
||||
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
|
||||
*
|
||||
* @ingroup pages_about
|
||||
*
|
||||
* @brief Handle requests for about the context functions.
|
||||
*
|
||||
*/
|
||||
|
||||
switch ($op) {
|
||||
case 'index':
|
||||
case 'editorialTeam':
|
||||
case 'submissions':
|
||||
case 'contact':
|
||||
return new \PKP\pages\about\AboutContextHandler();
|
||||
case 'privacy':
|
||||
case 'aboutThisPublishingSystem':
|
||||
return new \PKP\pages\about\AboutSiteHandler();
|
||||
}
|
||||
Reference in New Issue
Block a user