/** * Update a format * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function updateFormat($args, $request) { $submission = $this->getSubmission(); $representationDao = Application::getRepresentationDAO(); $representation = $representationDao->getById($request->getUserVar('representationId'), $submission->getId()); import('controllers.grid.articleGalleys.form.ArticleGalleyForm'); $articleGalleyForm = new ArticleGalleyForm($request, $submission, $representation); $articleGalleyForm->readInputData(); if ($articleGalleyForm->validate($request)) { $articleGalleyForm->execute($request); return DAO::getDataChangedEvent(); } return new JSONMessage(true, $articleGalleyForm->fetch($request)); }
/** * Update a issue * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function update($args, $request) { $submission = $this->getAuthorizedContextObject(ASSOC_TYPE_SUBMISSION); $articleGalley = $this->getAuthorizedContextObject(ASSOC_TYPE_GALLEY); import('controllers.grid.articleGalleys.form.ArticleGalleyForm'); $articleGalleyForm = new ArticleGalleyForm($request, $submission, $articleGalley); $articleGalleyForm->readInputData(); if ($articleGalleyForm->validate($request)) { $galleyId = $articleGalleyForm->execute($request); return DAO::getDataChangedEvent($galleyId); } else { return new JSONMessage(false); } }
/** * Save changes to a galley. * @param $args array ($articleId, $galleyId) */ function saveGalley($args) { $articleId = isset($args[0]) ? (int) $args[0] : 0; $galleyId = isset($args[1]) ? (int) $args[1] : 0; $submissionLayoutHandler = new SubmissionLayoutHandler(); $submissionLayoutHandler->validate($articleId); $this->setupTemplate(true, $articleId, 'editing'); import('classes.submission.form.ArticleGalleyForm'); $submitForm = new ArticleGalleyForm($articleId, $galleyId); $submitForm->readInputData(); if ($submitForm->validate()) { $submitForm->execute(); // Send a notification to associated users import('lib.pkp.classes.notification.NotificationManager'); $notificationManager = new NotificationManager(); $articleDao =& DAORegistry::getDAO('ArticleDAO'); $article =& $articleDao->getArticle($articleId); $notificationUsers = $article->getAssociatedUserIds(true, false); foreach ($notificationUsers as $userRole) { $url = Request::url(null, $userRole['role'], 'submissionEditing', $article->getId(), null, 'layout'); $notificationManager->createNotification($userRole['id'], 'notification.type.galleyModified', $article->getLocalizedTitle(), $url, 1, NOTIFICATION_TYPE_GALLEY_MODIFIED); } if (Request::getUserVar('uploadImage')) { $submitForm->uploadImage(); Request::redirect(null, null, 'editGalley', array($articleId, $galleyId)); } else { if (($deleteImage = Request::getUserVar('deleteImage')) && count($deleteImage) == 1) { list($imageId) = array_keys($deleteImage); $submitForm->deleteImage($imageId); Request::redirect(null, null, 'editGalley', array($articleId, $galleyId)); } } Request::redirect(null, null, 'submission', $articleId); } else { $submitForm->display(); } }
/** * Save changes to a galley. * @param $args array ($articleId, $galleyId) * @param $request Request */ function saveGalley($args, $request) { $articleId = (int) array_shift($args); $galleyId = (int) array_shift($args); $this->validate($articleId, SECTION_EDITOR_ACCESS_EDIT); $this->setupTemplate(true, $articleId, 'editing'); $submission =& $this->submission; import('classes.submission.form.ArticleGalleyForm'); $submitForm = new ArticleGalleyForm($articleId, $galleyId); $submitForm->readInputData(); if ($submitForm->validate()) { $submitForm->execute(); // Send a notification to associated users import('classes.notification.NotificationManager'); $notificationManager = new NotificationManager(); $articleDao =& DAORegistry::getDAO('ArticleDAO'); $article =& $articleDao->getArticle($articleId); $notificationUsers = $article->getAssociatedUserIds(true, false); foreach ($notificationUsers as $userRole) { $notificationManager->createNotification($request, $userRole['id'], NOTIFICATION_TYPE_GALLEY_MODIFIED, $article->getJournalId(), ASSOC_TYPE_ARTICLE, $article->getId()); } if ($request->getUserVar('uploadImage')) { $submitForm->uploadImage(); $request->redirect(null, null, 'editGalley', array($articleId, $galleyId)); } else { if (($deleteImage = $request->getUserVar('deleteImage')) && count($deleteImage) == 1) { list($imageId) = array_keys($deleteImage); $submitForm->deleteImage($imageId); $request->redirect(null, null, 'editGalley', array($articleId, $galleyId)); } } $request->redirect(null, null, 'submissionEditing', $articleId); } else { $submitForm->display(); } }
/** * Save a galley * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function updateGalley($args, $request) { $galley = $this->getGalley(); import('controllers.grid.articleGalleys.form.ArticleGalleyForm'); $galleyForm = new ArticleGalleyForm($request, $this->getSubmission(), $galley); $galleyForm->readInputData(); if ($galleyForm->validate($request)) { $galley = $galleyForm->execute($request); return DAO::getDataChangedEvent($galley->getId()); } return new JSONMessage(true, $galleyForm->fetch()); }
/** * Save a galley * @param $args array * @param $request PKPRequest * @return JSONMessage JSON object */ function updateGalley($args, $request) { $galley = $this->getGalley(); import('controllers.grid.articleGalleys.form.ArticleGalleyForm'); $galleyForm = new ArticleGalleyForm($request, $this->getSubmission(), $galley); $galleyForm->readInputData(); if ($galleyForm->validate($request)) { $galley = $galleyForm->execute($request); $notificationMgr = new NotificationManager(); $notificationMgr->updateNotification($request, array(NOTIFICATION_TYPE_ASSIGN_PRODUCTIONUSER, NOTIFICATION_TYPE_AWAITING_REPRESENTATIONS), null, ASSOC_TYPE_SUBMISSION, $galley->getSubmissionId()); return DAO::getDataChangedEvent($galley->getId()); } return new JSONMessage(true, $galleyForm->fetch()); }