Skip to content

Commit

Permalink
Merge pull request #5 from pkp/main
Browse files Browse the repository at this point in the history
upstream
  • Loading branch information
withanage authored May 13, 2021
2 parents 83ec9f6 + a5df9b0 commit 73fd968
Show file tree
Hide file tree
Showing 172 changed files with 2,852 additions and 979 deletions.
11 changes: 5 additions & 6 deletions api/v1/_submissions/BackendSubmissionsHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

import('lib.pkp.api.v1._submissions.PKPBackendSubmissionsHandler');

use \APP\submission\SubmissionDAO;
use \APP\submission\Submission;

class BackendSubmissionsHandler extends PKPBackendSubmissionsHandler
{
/**
Expand Down Expand Up @@ -77,12 +80,8 @@ public function addAppSubmissionsParams($hookName, $args)

$originalParams = $slimRequest->getQueryParams();

// Bring in orderby constants
import('lib.pkp.classes.submission.PKPSubmissionDAO');
import('classes.submission.SubmissionDAO');

// Add allowed order by options for OMP
if (isset($originalParams['orderBy']) && in_array($originalParams['orderBy'], [ORDERBY_DATE_PUBLISHED, ORDERBY_SERIES_POSITION])) {
if (isset($originalParams['orderBy']) && in_array($originalParams['orderBy'], [SubmissionDAO::ORDERBY_DATE_PUBLISHED, SubmissionDAO::ORDERBY_SERIES_POSITION])) {
$params['orderBy'] = $originalParams['orderBy'];
}

Expand Down Expand Up @@ -229,7 +228,7 @@ public function addToCatalog($slimRequest, $response, $args)
return $response->withStatus(400)->withJsonError('api.submissions.400.submissionsNotFound');
}
$publication = $submission->getCurrentPublication();
if ($publication->getData('status') === STATUS_PUBLISHED) {
if ($publication->getData('status') === Submission::STATUS_PUBLISHED) {
continue;
}
$errors = Services::get('publication')->validatePublish($publication, $submission, $allowedLocales, $primaryLocale);
Expand Down
9 changes: 4 additions & 5 deletions classes/codelist/ONIXCodelistItemDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@

import('classes.codelist.ONIXCodelistItem');

use \PKP\db\XMLDAO;
use \PKP\xslt\XSLTransformer;
use PKP\db\XMLDAO;
use PKP\xslt\XSLTransformer;
use PKP\file\TemporaryFileManager;
use PKP\file\FileManager;

class ONIXCodelistItemDAO extends DAO
{
Expand Down Expand Up @@ -70,9 +72,6 @@ public function _cacheMiss($cache, $id)
import('classes.codelist.ONIXParserDOMHandler');
$handler = new ONIXParserDOMHandler($listName);

import('lib.pkp.classes.file.FileManager');
import('lib.pkp.classes.file.TemporaryFileManager');

$temporaryFileManager = new TemporaryFileManager();
$fileManager = new FileManager();

Expand Down
5 changes: 2 additions & 3 deletions classes/components/forms/catalog/AddEntryForm.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

use PKP\components\forms\FieldSelectSubmissions;
use PKP\components\forms\FormComponent;

import('classes.submission.Submission'); // load STATUS_ constants
use PKP\submission\PKPSubmission;

define('FORM_ADD_ENTRY', 'addEntry');

Expand All @@ -39,7 +38,7 @@ public function __construct($action, $apiUrl, $locales)
'apiUrl' => $apiUrl,
'getParams' => [
'stageIds' => [WORKFLOW_STAGE_ID_EDITING, WORKFLOW_STAGE_ID_PRODUCTION],
'status' => [STATUS_QUEUED, STATUS_SCHEDULED],
'status' => [PKPSubmission::STATUS_QUEUED, PKPSubmission::STATUS_SCHEDULED],
],
]));
}
Expand Down
24 changes: 14 additions & 10 deletions classes/components/listPanels/CatalogListPanel.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@

namespace APP\components\listPanels;

// Bring in orderby constants
import('lib.pkp.classes.submission.PKPSubmissionDAO');
use \PKP\submission\PKPSubmissionDAO;
use \PKP\submission\PKPSubmission;

use \APP\core\Application;
use \APP\i18n\AppLocale;
use \APP\template\TemplateManager;

class CatalogListPanel extends \PKP\components\listPanels\ListPanel
{
Expand All @@ -36,21 +40,21 @@ class CatalogListPanel extends \PKP\components\listPanels\ListPanel
*/
public function getConfig()
{
\AppLocale::requireComponents(LOCALE_COMPONENT_APP_SUBMISSION);
AppLocale::requireComponents(LOCALE_COMPONENT_APP_SUBMISSION);

$request = \Application::get()->getRequest();
$request = Application::get()->getRequest();
$context = $request->getContext();

[$catalogSortBy, $catalogSortDir] = explode('-', $context->getData('catalogSortOption'));
$catalogSortBy = empty($catalogSortBy) ? ORDERBY_DATE_PUBLISHED : $catalogSortBy;
$catalogSortBy = empty($catalogSortBy) ? PKPSubmissionDAO::ORDERBY_DATE_PUBLISHED : $catalogSortBy;
$catalogSortDir = $catalogSortDir == SORT_DIRECTION_ASC ? 'ASC' : 'DESC';
$config['catalogSortBy'] = $catalogSortBy;
$config['catalogSortDir'] = $catalogSortDir;

$this->getParams = array_merge(
$this->getParams,
[
'status' => STATUS_PUBLISHED,
'status' => PKPSubmission::STATUS_PUBLISHED,
'orderByFeatured' => true,
'orderBy' => $catalogSortBy,
'orderDirection' => $catalogSortDir,
Expand Down Expand Up @@ -131,7 +135,7 @@ public function getConfig()
'submissions'
);
$supportedFormLocales = $context->getSupportedFormLocales();
$localeNames = \AppLocale::getAllLocales();
$localeNames = AppLocale::getAllLocales();
$locales = array_map(function ($localeKey) use ($localeNames) {
return ['key' => $localeKey, 'label' => $localeNames[$localeKey]];
}, $supportedFormLocales);
Expand All @@ -140,9 +144,9 @@ public function getConfig()

$templateMgr = \TemplateManager::getManager($request);
$templateMgr->setConstants([
'ASSOC_TYPE_PRESS',
'ASSOC_TYPE_CATEGORY',
'ASSOC_TYPE_SERIES',
'ASSOC_TYPE_PRESS' => ASSOC_TYPE_PRESS,
'ASSOC_TYPE_CATEGORY' => ASSOC_TYPE_CATEGORY,
'ASSOC_TYPE_SERIES' => ASSOC_TYPE_SERIES,
]);

$templateMgr->setLocaleKeys([
Expand Down
3 changes: 1 addition & 2 deletions classes/core/Application.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ public static function getContextAssocType()
*/
public static function getPaymentManager($context)
{
import('classes.payment.omp.OMPPaymentManager');
return new \OMPPaymentManager($context);
return new \APP\payment\omp\OMPPaymentManager($context);
}
}
2 changes: 1 addition & 1 deletion classes/core/Services.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Services extends \PKP\core\PKPServices
*/
protected function init()
{
$this->container->register(new \APP\Services\OMPServiceProvider());
$this->container->register(new \APP\services\OMPServiceProvider());
}
}

Expand Down
26 changes: 11 additions & 15 deletions classes/file/LibraryFileManager.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,13 @@
* @brief Wrapper class for uploading files to a site/context' library directory.
*/

import('lib.pkp.classes.file.PKPLibraryFileManager');
namespace APP\file;

use PKP\file\PKPLibraryFileManager;
use PKP\context\LibraryFile;

class LibraryFileManager extends PKPLibraryFileManager
{
/**
* Constructor
*
* @param $contextId int
*/
public function __construct($contextId)
{
parent::__construct($contextId);
}


/**
* Get the file suffix for the given file type
*
Expand All @@ -47,7 +39,7 @@ public function getFileSuffixFromType($type)
public function &getTypeSuffixMap()
{
static $map = [
LIBRARY_FILE_TYPE_CONTRACT => 'CON',
LibraryFile::LIBRARY_FILE_TYPE_CONTRACT => 'CON',
];
$parent = parent::getTypeSuffixMap();
$map = array_merge($map, $parent);
Expand All @@ -62,7 +54,7 @@ public function &getTypeSuffixMap()
public function &getTypeTitleKeyMap()
{
static $map = [
LIBRARY_FILE_TYPE_CONTRACT => 'settings.libraryFiles.category.contracts',
LibraryFile::LIBRARY_FILE_TYPE_CONTRACT => 'settings.libraryFiles.category.contracts',
];
$parent = parent::getTypeTitleKeyMap();
$map = array_merge($map, $parent);
Expand All @@ -77,10 +69,14 @@ public function &getTypeTitleKeyMap()
public function &getTypeNameMap()
{
static $map = [
LIBRARY_FILE_TYPE_CONTRACT => 'contacts',
LibraryFile::LIBRARY_FILE_TYPE_CONTRACT => 'contacts',
];
$parent = parent::getTypeNameMap();
$map = array_merge($map, $parent);
return $map;
}
}

if (!PKP_STRICT_MODE) {
class_alias('\APP\file\LibraryFileManager', '\LibraryFileManager');
}
8 changes: 7 additions & 1 deletion classes/file/PublicFileManager.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
* @brief Wrapper class for uploading files to a site/press' public directory.
*/

namespace APP\file;

import('lib.pkp.classes.file.PKPPublicFileManager');
use PKP\file\PKPPublicFileManager;
use PKP\config\Config;

class PublicFileManager extends PKPPublicFileManager
{
Expand All @@ -26,3 +28,7 @@ public function getContextFilesPath($contextId)
return Config::getVar('files', 'public_files_dir') . '/presses/' . (int) $contextId;
}
}

if (!PKP_STRICT_MODE) {
class_alias('\APP\file\PublicFileManager', '\PublicFileManager');
}
8 changes: 7 additions & 1 deletion classes/handler/Handler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@
* @brief Base request handler application class
*/

import('lib.pkp.classes.handler.PKPHandler');
namespace APP\handler;

use PKP\handler\PKPHandler;

class Handler extends PKPHandler
{
}

if (!PKP_STRICT_MODE) {
class_alias('\APP\handler\Handler', '\Handler');
}
7 changes: 6 additions & 1 deletion classes/install/Install.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
* - Update the config file with installation parameters.
*/

namespace APP\install;

// Default installation data
define('INSTALLER_DEFAULT_CONTACT', 'common.omp');
define('INSTALLER_DEFAULT_MIN_PASSWORD_LENGTH', 6);

import('lib.pkp.classes.install.PKPInstall');
use PKP\install\PKPInstall;

class Install extends PKPInstall
{
Expand Down Expand Up @@ -71,3 +72,7 @@ public function createData()
return $createData;
}
}

if (!PKP_STRICT_MODE) {
class_alias('\APP\install\Install', '\Install');
}
25 changes: 17 additions & 8 deletions classes/install/Upgrade.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@
* @brief Perform system upgrade.
*/

namespace APP\install;

use Illuminate\Support\Facades\DB;

use \PKP\identity\Identity;
use \PKP\submission\SubmissionFile;
use PKP\identity\Identity;
use PKP\submission\SubmissionFile;
use PKP\file\FileManager;
use PKP\install\Installer;
use PKP\db\DAORegistry;
use PKP\core\PKPString;

import('lib.pkp.classes.install.Installer');
use APP\core\Application;
use APP\i18n\AppLocale;
use APP\file\PublicFileManager;

class Upgrade extends Installer
{
Expand Down Expand Up @@ -65,7 +73,6 @@ public function fixFilenames($upgrade, $params, $dryrun = false)
$siteDao = DAORegistry::getDAO('SiteDAO'); /* @var $siteDao SiteDAO */
$site = $siteDao->getSite();
$adminEmail = $site->getLocalizedContactEmail();
import('lib.pkp.classes.file.FileManager');
$fileManager = new FileManager();

$contexts = $pressDao->getAll();
Expand Down Expand Up @@ -605,7 +612,7 @@ public function migrateStaticPagesToNavigationMenuItems()

import('plugins.generic.staticPages.classes.StaticPagesDAO');

$staticPagesDao = new StaticPagesDAO();
$staticPagesDao = new \StaticPagesDAO();

$contexts = $contextDao->getAll();
while ($context = $contexts->next()) {
Expand Down Expand Up @@ -774,9 +781,6 @@ public function changeUserRolesAndStageAssignmentsForStagePermitSubmissionEdit()
*/
public function migrateSubmissionCoverImages()
{
import('lib.pkp.classes.file.FileManager');
import('classes.file.PublicFileManager');

$fileManager = new \FileManager();
$publicFileManager = new \PublicFileManager();
$contexts = [];
Expand Down Expand Up @@ -899,3 +903,8 @@ public function _fileStageToPath($fileStage)
return $fileStagePathMap[$fileStage];
}
}

if (!PKP_STRICT_MODE) {
class_alias('\APP\install\Upgrade', '\Upgrade');
}

2 changes: 1 addition & 1 deletion classes/log/MonographFileEmailLogDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @brief Extension to EmailLogDAO for monograph file specific log entries.
*/

namespace PKP\log;
namespace APP\log;

use \PKP\log\EmailLogDAO;
use \PKP\log\MonographFileEmailLogEntry;
Expand Down
2 changes: 1 addition & 1 deletion classes/log/SubmissionEventLogEntry.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @brief Describes an entry in the submission history log.
*/

use APP\log;
namespace APP\log;

use \PKP\log\PKPSubmissionEventLogEntry;

Expand Down
3 changes: 1 addition & 2 deletions classes/mail/MonographMailTemplate.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
* This allows for submission-specific functionality like logging, etc.
*/

import('lib.pkp.classes.mail.SubmissionMailTemplate');
import('lib.pkp.classes.log.SubmissionEmailLogEntry'); // Bring in log constants
use \PKP\mail\SubmissionMailTemplate;

class MonographMailTemplate extends SubmissionMailTemplate
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

/**
* @file classes/migration/upgrade/3_4_0/I6807_SetLastModified.inc.php
* @file classes/migration/upgrade/v3_4_0/I6807_SetLastModified.inc.php
*
* Copyright (c) 2014-2021 Simon Fraser University
* Copyright (c) 2000-2021 John Willinsky
Expand All @@ -11,6 +11,8 @@
* @brief Update last modification dates where they are not yet set.
*/

namespace APP\migration\upgrade\v3_4_0;

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;

Expand All @@ -33,3 +35,7 @@ public function down()
// We don't have the data to downgrade and downgrades are unwanted here anyway.
}
}

if (!PKP_STRICT_MODE) {
class_alias('\APP\migration\upgrade\v3_4_0\I6807_SetLastModified', '\I6807_SetLastModified');
}
3 changes: 1 addition & 2 deletions classes/monograph/Author.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
* @brief Monograph author metadata class.
*/


import('lib.pkp.classes.submission.PKPAuthor');
use \PKP\submission\PKPAuthor;

class Author extends PKPAuthor
{
Expand Down
Loading

0 comments on commit 73fd968

Please sign in to comment.