/**
  * Create a new layout file (layout version, galley, or supp file) with the uploaded file.
  */
 function uploadLayoutFile()
 {
     $articleId = Request::getUserVar('articleId');
     list($journal, $submission) = SubmissionLayoutHandler::validate($articleId, true);
     switch (Request::getUserVar('layoutFileType')) {
         case 'submission':
             LayoutEditorAction::uploadLayoutVersion($submission);
             Request::redirect(null, null, 'submission', $articleId);
             break;
         case 'galley':
             import('submission.form.ArticleGalleyForm');
             $galleyForm =& new ArticleGalleyForm($articleId);
             $galleyId = $galleyForm->execute('layoutFile');
             Request::redirect(null, null, 'editGalley', array($articleId, $galleyId));
             break;
         case 'supp':
             import('submission.form.SuppFileForm');
             $suppFileForm =& new SuppFileForm($submission);
             $suppFileForm->setData('title', Locale::translate('common.untitled'));
             $suppFileId = $suppFileForm->execute('layoutFile');
             Request::redirect(null, null, 'editSuppFile', array($articleId, $suppFileId));
             break;
         default:
             // Invalid upload type.
             Request::redirect(null, 'layoutEditor');
     }
 }
 /**
  * Create a new layout file (layout version, galley, or supp file) with the uploaded file.
  */
 function uploadLayoutFile($args, $request)
 {
     $articleId = $request->getUserVar('articleId');
     $submissionLayoutHandler = new SubmissionLayoutHandler();
     $submissionLayoutHandler->validate($articleId);
     $submission =& $submissionLayoutHandler->submission;
     switch ($request->getUserVar('layoutFileType')) {
         case 'submission':
             LayoutEditorAction::uploadLayoutVersion($submission);
             $request->redirect(null, null, 'submission', $articleId);
             break;
         case 'galley':
             import('classes.submission.form.ArticleGalleyForm');
             $galleyForm = new ArticleGalleyForm($articleId);
             $galleyId = $galleyForm->execute('layoutFile');
             $request->redirect(null, null, 'editGalley', array($articleId, $galleyId));
             break;
         case 'supp':
             import('classes.submission.form.SuppFileForm');
             $journal =& $request->getJournal();
             $suppFileForm = new SuppFileForm($submission, $journal);
             $suppFileForm->setData('title', array($submission->getLocale() => Locale::translate('common.untitled')));
             $suppFileId = $suppFileForm->execute('layoutFile');
             $request->redirect(null, null, 'editSuppFile', array($articleId, $suppFileId));
             break;
         default:
             // Invalid upload type.
             $request->redirect(null, 'layoutEditor');
     }
 }