Skip to content

Commit

Permalink
*8148* use new file assoc type constants from pkp-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
jnugent committed Mar 8, 2013
1 parent 91d86f4 commit f71466c
Show file tree
Hide file tree
Showing 32 changed files with 53 additions and 55 deletions.
2 changes: 0 additions & 2 deletions classes/core/Application.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
define('ASSOC_TYPE_PRESS', 0x0000200);
define('ASSOC_TYPE_MONOGRAPH', ASSOC_TYPE_SUBMISSION);
define('ASSOC_TYPE_PRODUCTION_ASSIGNMENT', 0x0000202);
define('ASSOC_TYPE_MONOGRAPH_FILE', 0x0000203);
define('ASSOC_TYPE_REVIEW_RESPONSE', 0x0000204);
define('ASSOC_TYPE_REVIEW_ASSIGNMENT', 0x0000205);
define('ASSOC_TYPE_MONOGRAPH_EMAIL_LOG_ENTRY', 0x0000206);
Expand All @@ -33,7 +32,6 @@
define('ASSOC_TYPE_REVIEW_ROUND', 0x000020B);
define('ASSOC_TYPE_CATEGORY', 0x000020D);
define('ASSOC_TYPE_SERIES', 0x000020E);
define('ASSOC_TYPE_MONOGRAPH_FILES', 0x000020F);
define('ASSOC_TYPE_PUBLISHED_MONOGRAPH', 0x0000210);

define('CONTEXT_PRESS', 1);
Expand Down
2 changes: 1 addition & 1 deletion classes/file/MonographFileManager.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function recordView(&$monographFile) {
if (is_a($user, 'User')) {
$viewsDao =& DAORegistry::getDAO('ViewsDAO');
$viewsDao->recordView(
ASSOC_TYPE_MONOGRAPH_FILE, $monographFile->getFileIdAndRevision(),
ASSOC_TYPE_SUBMISSION_FILE, $monographFile->getFileIdAndRevision(),
$user->getId()
);
}
Expand Down
2 changes: 1 addition & 1 deletion classes/log/MonographEventLogDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function MonographEventLogDAO() {
*/
function newDataObject() {
$returner = new MonographEventLogEntry();
$returner->setAssocType(ASSOC_TYPE_MONOGRAPH_FILE);
$returner->setAssocType(ASSOC_TYPE_SUBMISSION_FILE);
return $returner;
}

Expand Down
4 changes: 2 additions & 2 deletions classes/log/MonographFileEmailLogDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function MonographFileEmailLogDAO() {
*/
function newDataObject() {
$returner = new MonographFileEmailLogEntry();
$returner->setAssocType(ASSOC_TYPE_MONOGRAPH_FILE);
$returner->setAssocType(ASSOC_TYPE_SUBMISSION_FILE);
return $returner;
}

Expand All @@ -42,7 +42,7 @@ function newDataObject() {
* @return DAOResultFactory
*/
function getByEventType($fileId, $eventType, $userId = null) {
return parent::getByEventType(ASSOC_TYPE_MONOGRAPH_FILE, $fileId, $eventType, $userId);
return parent::getByEventType(ASSOC_TYPE_SUBMISSION_FILE, $fileId, $eventType, $userId);
}
}

Expand Down
4 changes: 2 additions & 2 deletions classes/log/MonographFileEventLogDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function MonographFileEventLogDAO() {
*/
function newDataObject() {
$returner = new MonographFileEventLogEntry();
$returner->setAssocType(ASSOC_TYPE_MONOGRAPH_FILE);
$returner->setAssocType(ASSOC_TYPE_SUBMISSION_FILE);
return $returner;
}

Expand All @@ -40,7 +40,7 @@ function newDataObject() {
* @return DAOResultFactory
*/
function &getByFileId($fileId) {
$returner =& $this->getByAssoc(ASSOC_TYPE_MONOGRAPH_FILE, $fileId);
$returner =& $this->getByAssoc(ASSOC_TYPE_SUBMISSION_FILE, $fileId);
return $returner;
}
}
Expand Down
2 changes: 1 addition & 1 deletion classes/log/MonographFileLog.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function logEvent(&$request, &$monographFile, $eventType, $messageKey, $params =
$user =& $request->getUser();
if ($user) $entry->setUserId($user->getId());

$entry->setAssocType(ASSOC_TYPE_MONOGRAPH_FILE);
$entry->setAssocType(ASSOC_TYPE_SUBMISSION_FILE);
$entry->setAssocId($monographFile->getFileId());

// Set explicit parts of the log entry
Expand Down
4 changes: 2 additions & 2 deletions classes/monograph/MonographFileDAODelegate.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ function _updateDependentObjects($monographFile, $previousFile) {
// Update file views that refer to this file.
$viewsDao = DAORegistry::getDAO('ViewsDAO'); /* @var $viewsDao ViewsDAO */
$viewsDao->moveViews(
ASSOC_TYPE_MONOGRAPH_FILE,
ASSOC_TYPE_SUBMISSION_FILE,
$previousFile->getFileIdAndRevision(), $monographFile->getFileIdAndRevision()
);
}
Expand All @@ -344,7 +344,7 @@ function _deleteDependentObjects($monographFile) {
// Delete file views that refer to this file.
$viewsDao = DAORegistry::getDAO('ViewsDAO'); /* @var $viewsDao ViewsDAO */
$viewsDao->deleteViews(
ASSOC_TYPE_MONOGRAPH_FILE, $monographFile->getFileIdAndRevision()
ASSOC_TYPE_SUBMISSION_FILE, $monographFile->getFileIdAndRevision()
);
}
}
Expand Down
14 changes: 7 additions & 7 deletions classes/monograph/MonographFileSignoffDAO.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function MonographFileSignoffDAO() {
* @see SignoffDAO::getById
*/
function getById($signoffId) {
return parent::getById($signoffId, ASSOC_TYPE_MONOGRAPH_FILE);
return parent::getById($signoffId, ASSOC_TYPE_SUBMISSION_FILE);
}

/**
Expand All @@ -50,7 +50,7 @@ function build($symbolic, $monographFileId, $userId = null,
$userGroupId = null, $fileId = null, $fileRevision = null) {
return parent::build(
$symbolic,
ASSOC_TYPE_MONOGRAPH_FILE, $monographFileId,
ASSOC_TYPE_SUBMISSION_FILE, $monographFileId,
$userId, $userGroupId,
$fileId, $fileRevision
);
Expand All @@ -65,15 +65,15 @@ function build($symbolic, $monographFileId, $userId = null,
* @return boolean
*/
function signoffExists($symbolic, $monographFileId, $userId = null, $userGroupId = null) {
return parent::signoffExists($symbolic, ASSOC_TYPE_MONOGRAPH_FILE, $userId, $userGroupId);
return parent::signoffExists($symbolic, ASSOC_TYPE_SUBMISSION_FILE, $userId, $userGroupId);
}

/**
* @see SignoffDAO::newDataObject
*/
function newDataObject() {
$signoff = parent::newDataObject();
$signoff->setAssocType(ASSOC_TYPE_MONOGRAPH_FILE);
$signoff->setAssocType(ASSOC_TYPE_SUBMISSION_FILE);
return $signoff;
}

Expand All @@ -93,7 +93,7 @@ function getBySymbolic($symbolic, $monographFileId, $userId = null,
$userGroupId = null, $fileId = null, $fileRevision = null) {
return parent::getBySymbolic(
$symbolic,
ASSOC_TYPE_MONOGRAPH_FILE, $monographFileId,
ASSOC_TYPE_SUBMISSION_FILE, $monographFileId,
$userId, $userGroupId,
$fileId, $fileRevision
);
Expand All @@ -109,7 +109,7 @@ function getBySymbolic($symbolic, $monographFileId, $userId = null,
* @return DAOResultFactory
*/
function getAllBySymbolic($symbolic, $monographFileId = null, $userId = null, $userGroupId = null) {
return parent::getAllBySymbolic($symbolic, ASSOC_TYPE_MONOGRAPH_FILE, $monographFileId, $userId, $userGroupId);
return parent::getAllBySymbolic($symbolic, ASSOC_TYPE_SUBMISSION_FILE, $monographFileId, $userId, $userGroupId);
}

/**
Expand All @@ -123,7 +123,7 @@ function getAllBySymbolic($symbolic, $monographFileId = null, $userId = null, $u
*/
function getAllByMonograph($monographId, $symbolic = null, $userId = null, $userGroupId = null, $notCompletedOnly = false) {
$sql = 'SELECT s.* FROM signoffs s, monograph_files mf WHERE s.assoc_type = ? AND s.assoc_id = mf.file_id AND mf.monograph_id = ?';
$params = array(ASSOC_TYPE_MONOGRAPH_FILE, (int) $monographId);
$params = array(ASSOC_TYPE_SUBMISSION_FILE, (int) $monographId);

if ($symbolic) {
$sql .= ' AND s.symbolic = ?';
Expand Down
2 changes: 1 addition & 1 deletion classes/notification/NotificationManager.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function getNotificationUrl(&$request, &$notification) {
case NOTIFICATION_TYPE_COPYEDIT_ASSIGNMENT:
$signoffDao = DAORegistry::getDAO('SignoffDAO'); /* @var $signoffDao SignoffDAO */
$signoff = $signoffDao->getById($notification->getAssocId());
assert(is_a($signoff, 'Signoff') && $signoff->getAssocType() == ASSOC_TYPE_MONOGRAPH_FILE);
assert(is_a($signoff, 'Signoff') && $signoff->getAssocType() == ASSOC_TYPE_SUBMISSION_FILE);

$submissionFileDao = DAORegistry::getDAO('SubmissionFileDAO'); /* @var $submissionFileDao SubmissionFileDAO */
$monographFile = $submissionFileDao->getLatestRevision($signoff->getAssocId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function AuditorRequestNotificationManagerDelegate($notificationType) {
function getNotificationMessage(&$request, &$notification) {
$signoffDao =& DAORegistry::getDAO('SignoffDAO'); /* @var $signoffDao SignoffDAO */
$signoff = $signoffDao->getById($notification->getAssocId());
assert($signoff->getAssocType() == ASSOC_TYPE_MONOGRAPH_FILE);
assert($signoff->getAssocType() == ASSOC_TYPE_SUBMISSION_FILE);

$submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO');
$monographFile =& $submissionFileDao->getLatestRevision($signoff->getAssocId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function CopyeditAssignmentNotificationManager($notificationType) {
function getNotificationMessage(&$request, &$notification) {
$signoffDao =& DAORegistry::getDAO('SignoffDAO'); /* @var $signoffDao SignoffDAO */
$signoff = $signoffDao->getById($notification->getAssocId());
assert($signoff->getAssocType() == ASSOC_TYPE_MONOGRAPH_FILE);
assert($signoff->getAssocType() == ASSOC_TYPE_SUBMISSION_FILE);

$submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO');
$monographFile =& $submissionFileDao->getLatestRevision($signoff->getAssocId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function effect() {
if (!is_a($monographFile, 'MonographFile')) return AUTHORIZATION_DENY;

$signoffDao =& DAORegistry::getDAO('SignoffDAO');
$signoffsFactory =& $signoffDao->getAllByAssocType(ASSOC_TYPE_MONOGRAPH_FILE, $monographFile->getFileId(), null, $user->getId());
$signoffsFactory =& $signoffDao->getAllByAssocType(ASSOC_TYPE_SUBMISSION_FILE, $monographFile->getFileId(), null, $user->getId());

if ($signoffsFactory->wasEmpty()) {
return AUTHORIZATION_DENY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ function effect() {
// Check if the monograph file belongs to the monograph.
if ($monographFile->getMonographId() == $monograph->getId()) {
// We add this monograph file to the context monograph files array.
$monographFilesArray = $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH_FILES);
$monographFilesArray = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILES);
if (is_null($monographFilesArray)) {
$monographFilesArray = array();
}
array_push($monographFilesArray, $monographFile);
$this->addAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH_FILES, $monographFilesArray);
$this->addAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILES, $monographFilesArray);

// Save the monograph to the authorization context.
$this->addAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH_FILE, $monographFile);
$this->addAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE, $monographFile);
return AUTHORIZATION_PERMIT;
} else {
return AUTHORIZATION_DENY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function effect() {
$signoff =& $newSignoff;
unset($newSignoff);
break;
case ASSOC_TYPE_MONOGRAPH_FILE:
case ASSOC_TYPE_SUBMISSION_FILE:
// Get the monograph file
$monographFile =& $monographFileDao->getLatestRevision($signoff->getAssocId());
if (!is_a($monographFile, 'MonographFile')) return AUTHORIZATION_DENY;
Expand Down
8 changes: 4 additions & 4 deletions controllers/api/file/FileApiHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function authorize(&$request, &$args, $roleAssignments) {
* @param $request Request
*/
function downloadFile($args, &$request) {
$monographFile =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH_FILE);
$monographFile =& $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE);
assert($monographFile); // Should have been validated already
import('classes.file.MonographFileManager');
$press =& $request->getPress();
Expand Down Expand Up @@ -126,7 +126,7 @@ function downloadLibraryFile($args, &$request) {
* @param $request Request
*/
function viewFile($args, &$request) {
$monographFile =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH_FILE);
$monographFile =& $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE);
assert($monographFile); // Should have been validated already
import('classes.file.MonographFileManager');
$press =& $request->getPress();
Expand All @@ -141,7 +141,7 @@ function viewFile($args, &$request) {
*/
function downloadAllFiles($args, &$request) {
// Retrieve the authorized objects.
$monographFiles = $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH_FILES);
$monographFiles = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILES);
$monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH);

// Find out the paths of all files in this grid.
Expand Down Expand Up @@ -180,7 +180,7 @@ function downloadAllFiles($args, &$request) {
* @return string
*/
function recordDownload($args, &$request) {
$monographFiles = $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH_FILES);
$monographFiles = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILES);
$fileId = null;

foreach ($monographFiles as $monographFile) {
Expand Down
6 changes: 3 additions & 3 deletions controllers/api/file/ManageFileApiHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function authorize(&$request, &$args, $roleAssignments) {
* @return string a serialized JSON object
*/
function deleteFile($args, &$request) {
$monographFile =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH_FILE);
$monographFile =& $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE);
$monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH);
$stageId =& $request->getUserVar('stageId');
if ($stageId) {
Expand All @@ -63,15 +63,15 @@ function deleteFile($args, &$request) {
assert($monographFile && $monograph); // Should have been validated already

$noteDao =& DAORegistry::getDAO('NoteDAO');
$notes =& $noteDao->getByAssoc(ASSOC_TYPE_MONOGRAPH_FILE, $monographFile->getFileId());
$notes =& $noteDao->getByAssoc(ASSOC_TYPE_SUBMISSION_FILE, $monographFile->getFileId());
while ($note =& $notes->next()) {
$noteDao->deleteById($note->getId());
unset($note);
}

// Delete all signoffs related with this file.
$signoffDao = DAORegistry::getDAO('SignoffDAO'); /* @var $signoffDao SignoffDAO */
$signoffFactory =& $signoffDao->getAllByAssocType(ASSOC_TYPE_MONOGRAPH_FILE, $monographFile->getFileId());
$signoffFactory =& $signoffDao->getAllByAssocType(ASSOC_TYPE_SUBMISSION_FILE, $monographFile->getFileId());
$signoffs = $signoffFactory->toArray();
$notificationMgr = new NotificationManager();

Expand Down
2 changes: 1 addition & 1 deletion controllers/grid/files/SignoffOnSignoffGridColumn.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function _getSignoffStatus(&$row) {
// Find out whether someone in the user group already downloaded
// (=viewed) the file.
$viewed = $viewed ||
$viewsDao->getLastViewDate(ASSOC_TYPE_MONOGRAPH_FILE, $fileIdAndRevision, $userId);
$viewsDao->getLastViewDate(ASSOC_TYPE_SUBMISSION_FILE, $fileIdAndRevision, $userId);
}
unset($signoff);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function _getSignoffStatus(&$row) {
foreach ($userIds as $userId) {
$signoffs =& $signoffDao->getAllBySymbolic(
$this->getSymbolic(),
ASSOC_TYPE_MONOGRAPH_FILE, $monographFile->getFileId(),
ASSOC_TYPE_SUBMISSION_FILE, $monographFile->getFileId(),
$userId
);

Expand All @@ -148,7 +148,7 @@ function _getSignoffStatus(&$row) {
// no users means a blank column (should not happen).

$lastViewed = $viewsDao->getLastViewDate(
ASSOC_TYPE_MONOGRAPH_FILE, $monographFile->getFileIdAndRevision(),
ASSOC_TYPE_SUBMISSION_FILE, $monographFile->getFileIdAndRevision(),
$userId
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function _getSignoffStatus(&$row) {
// (=viewed) the file.
// no users means a blank column (should not happen).
$lastViewed = $viewsDao->getLastViewDate(
ASSOC_TYPE_MONOGRAPH_FILE, $monographFile->getFileIdAndRevision(),
ASSOC_TYPE_SUBMISSION_FILE, $monographFile->getFileIdAndRevision(),
$signoff->getUserId()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ function initialize(&$request) {
* @return string Serialized JSON object
*/
function approveCopyedit($args, &$request) {
$monographFile =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH_FILE);
$monographFile =& $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION_FILE);
$monograph =& $this->getAuthorizedContextObject(ASSOC_TYPE_MONOGRAPH);

if ($monographFile->getViewable()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function signOffFile($args, &$request) {
// to this file revision.
$signoffDao =& DAORegistry::getDAO('SignoffDAO'); /* @var $signoffDao SignoffDAO */
$signoff =& $signoffDao->build(
$this->getSymbolic(), ASSOC_TYPE_MONOGRAPH_FILE, $submissionFile->getFileId(), $user->getId()
$this->getSymbolic(), ASSOC_TYPE_SUBMISSION_FILE, $submissionFile->getFileId(), $user->getId()
);
$signoff->setDateCompleted(Core::getCurrentDate());
$signoffDao->updateObject($signoff);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ function deleteSignoff($args, &$request) {
if($signoff && !$signoff->getDateCompleted()) {

$signoffUserId = $signoff->getUserId();
if ($signoff->getAssocType() == ASSOC_TYPE_MONOGRAPH_FILE) {
if ($signoff->getAssocType() == ASSOC_TYPE_SUBMISSION_FILE) {
$fileId = $signoff->getAssocId();
}
$submissionFileDao =& DAORegistry::getDAO('SubmissionFileDAO');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ function getTemplateVarsFromRowColumn(&$row, $column) {
case ASSOC_TYPE_MONOGRAPH:
$monographId = $notification->getAssocId();
break;
case ASSOC_TYPE_MONOGRAPH_FILE:
case ASSOC_TYPE_SUBMISSION_FILE:
$fileId = $notification->getAssocId();
break;
case ASSOC_TYPE_SIGNOFF:
$signoffDao = DAORegistry::getDAO('SignoffDAO'); /* @var $signoffDao SignoffDAO */
$signoff = $signoffDao->getById($notification->getAssocId());
if ($signoff->getAssocType() == ASSOC_TYPE_MONOGRAPH) {
$monographId = $signoff->getAssocId();
} elseif ($signoff->getAssocType() == ASSOC_TYPE_MONOGRAPH_FILE) {
} elseif ($signoff->getAssocType() == ASSOC_TYPE_SUBMISSION_FILE) {
$fileId = $signoff->getAssocId();
} else {
// Don't know of SIGNOFFs with other ASSOC types for TASKS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ function deleteParticipant($args, &$request) {
while($signoff =& $signoffsFactory->next()) {
if (($signoff->getSymbolic() != 'SIGNOFF_COPYEDITING' &&
$signoff->getSymbolic() != 'SIGNOFF_PROOFING') ||
$signoff->getAssocType() != ASSOC_TYPE_MONOGRAPH_FILE ||
$signoff->getAssocType() != ASSOC_TYPE_SUBMISSION_FILE ||
$signoff->getDateCompleted()) continue;
$monographFileId = $signoff->getAssocId();
$monographFile =& $submissionFileDao->getLatestRevision($monographFileId, null, $stageAssignment->getSubmissionId());
Expand Down
Loading

0 comments on commit f71466c

Please sign in to comment.