Пример #1
0
 function sharingSettings()
 {
     $this->validate();
     $journal = Request::getJournal();
     if ($journal) {
         $this->setupTemplate(true);
         $templateMgr =& TemplateManager::getManager();
         $rtDao =& DAORegistry::getDAO('RTDAO');
         $rt = $rtDao->getJournalRTByJournal($journal);
         $templateMgr->assign('sharingEnabled', $rt->getSharingEnabled());
         $templateMgr->assign('sharingUserName', $rt->getSharingUserName());
         $templateMgr->assign('sharingButtonStyle', $rt->getSharingButtonStyle());
         $templateMgr->assign('sharingButtonStyleOptions', array_keys(SharingRT::getBtnStyles()));
         $templateMgr->assign('sharingDropDownMenu', $rt->getSharingDropDownMenu());
         $templateMgr->assign('sharingBrand', $rt->getSharingBrand());
         $templateMgr->assign('sharingDropDown', $rt->getSharingDropDown());
         $templateMgr->assign('sharingLanguage', $rt->getSharingLanguage());
         $templateMgr->assign('sharingLanguageOptions', SharingRT::getLanguages());
         $templateMgr->assign('sharingLogo', $rt->getSharingLogo());
         $templateMgr->assign('sharingLogoBackground', $rt->getSharingLogoBackground());
         $templateMgr->assign('sharingLogoColor', $rt->getSharingLogoColor());
         $templateMgr->assign('helpTopicId', 'journal.managementPages.readingTools.addthisSettings');
         $templateMgr->display('rtadmin/addthis.tpl');
     } else {
         Request::redirect(null, Request::getRequestedPage());
     }
 }
Пример #2
0
 function sharingSettings($args, $request)
 {
     $this->validate();
     $journal = $request->getJournal();
     if ($journal) {
         $this->setupTemplate($request, true);
         $templateMgr = TemplateManager::getManager($request);
         $rtDao = DAORegistry::getDAO('RTDAO');
         $rt = $rtDao->getJournalRTByJournal($journal);
         $templateMgr->assign('sharingEnabled', $rt->getSharingEnabled());
         $templateMgr->assign('sharingUserName', $rt->getSharingUserName());
         $templateMgr->assign('sharingButtonStyle', $rt->getSharingButtonStyle());
         $templateMgr->assign('sharingButtonStyleOptions', array_keys(SharingRT::getBtnStyles()));
         $templateMgr->assign('sharingDropDownMenu', $rt->getSharingDropDownMenu());
         $templateMgr->assign('sharingBrand', $rt->getSharingBrand());
         $templateMgr->assign('sharingDropDown', $rt->getSharingDropDown());
         $templateMgr->assign('sharingLanguage', $rt->getSharingLanguage());
         $templateMgr->assign('sharingLanguageOptions', SharingRT::getLanguages());
         $templateMgr->assign('sharingLogo', $rt->getSharingLogo());
         $templateMgr->assign('sharingLogoBackground', $rt->getSharingLogoBackground());
         $templateMgr->assign('sharingLogoColor', $rt->getSharingLogoColor());
         $templateMgr->display('rtadmin/addthis.tpl');
     } else {
         $request->redirect(null, $request->getRequestedPage());
     }
 }
Пример #3
0
 /**
  * determine the correct language for the sharing button. Attempt to use the user's local
  * setting if it is one that AddThis supports. If not, use the language the administrator
  * has chosen.
  *
  * @return string
  * @param $default string
  */
 function sharingLocale($default)
 {
     //getLocal() returns a string like 'en_US'
     $locale = Locale::getLocale();
     $lang = substr($locale, 0, 2);
     $languages = SharingRT::getLanguages();
     if (isset($languages[$lang])) {
         return $lang;
     }
     return $default;
 }
Пример #4
0
 /**
  * View Article.
  * @param $args array
  * @param $request Request
  */
 function view($args, &$request)
 {
     $router =& $request->getRouter();
     $articleId = isset($args[0]) ? $args[0] : 0;
     $galleyId = isset($args[1]) ? $args[1] : 0;
     $this->validate($request, $articleId, $galleyId);
     $journal =& $this->journal;
     $issue =& $this->issue;
     $article =& $this->article;
     $this->setupTemplate();
     $rtDao =& DAORegistry::getDAO('RTDAO');
     $journalRt = $rtDao->getJournalRTByJournal($journal);
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $section =& $sectionDao->getSection($article->getSectionId(), $journal->getJournalid(), true);
     $version = null;
     if ($journalRt->getVersion() != null && $journalRt->getDefineTerms()) {
         // Determine the "Define Terms" context ID.
         $version = $rtDao->getVersion($journalRt->getVersion(), $journalRt->getJournalId(), true);
         if ($version) {
             foreach ($version->getContexts() as $context) {
                 if ($context->getDefineTerms()) {
                     $defineTermsContextId = $context->getContextId();
                     break;
                 }
             }
         }
     }
     $commentDao =& DAORegistry::getDAO('CommentDAO');
     $enableComments = $journal->getSetting('enableComments');
     if ($article->getEnableComments() && ($enableComments == COMMENTS_AUTHENTICATED || $enableComments == COMMENTS_UNAUTHENTICATED || $enableComments == COMMENTS_ANONYMOUS)) {
         $comments =& $commentDao->getRootCommentsByArticleId($article->getId());
     }
     $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
     if ($journal->getSetting('enablePublicGalleyId')) {
         $galley =& $galleyDao->getGalleyByBestGalleyId($galleyId, $article->getId());
     } else {
         $galley =& $galleyDao->getGalley($galleyId, $article->getId());
     }
     if ($galley && !$galley->isHtmlGalley() && !$galley->isPdfGalley()) {
         if ($galley->isInlineable()) {
             $this->viewFile(array($galley->getArticleId(), $galley->getId()), $request);
         } else {
             $this->download(array($galley->getArticleId(), $galley->getId()), $request);
         }
     }
     $templateMgr =& TemplateManager::getManager();
     if (!$galley) {
         // Get the subscription status if displaying the abstract;
         // if access is open, we can display links to the full text.
         import('issue.IssueAction');
         // The issue may not exist, if this is an editorial user
         // and scheduling hasn't been completed yet for the article.
         if ($issue) {
             $templateMgr->assign('subscriptionRequired', IssueAction::subscriptionRequired($issue));
         }
         $templateMgr->assign('subscribedUser', IssueAction::subscribedUser($journal, isset($issue) ? $issue->getId() : null, isset($article) ? $article->getId() : null));
         $templateMgr->assign('subscribedDomain', IssueAction::subscribedDomain($journal, isset($issue) ? $issue->getId() : null, isset($article) ? $article->getId() : null));
         $templateMgr->assign('showGalleyLinks', $journal->getSetting('showGalleyLinks'));
         import('payment.ojs.OJSPaymentManager');
         $paymentManager =& OJSPaymentManager::getManager();
         if ($paymentManager->onlyPdfEnabled()) {
             $templateMgr->assign('restrictOnlyPdf', true);
         }
         if ($paymentManager->purchaseArticleEnabled()) {
             $templateMgr->assign('purchaseArticleEnabled', true);
         }
         // Article cover page.
         $locale = Locale::getLocale();
         if (isset($article) && $article->getLocalizedFileName() && $article->getLocalizedShowCoverPage() && !$article->getLocalizedHideCoverPageAbstract($locale)) {
             import('file.PublicFileManager');
             $publicFileManager = new PublicFileManager();
             $coverPagePath = $request->getBaseUrl() . '/';
             $coverPagePath .= $publicFileManager->getJournalFilesPath($journal->getId()) . '/';
             $templateMgr->assign('coverPagePath', $coverPagePath);
             $templateMgr->assign('coverPageFileName', $article->getLocalizedFileName());
             $templateMgr->assign('width', $article->getLocalizedWidth());
             $templateMgr->assign('height', $article->getLocalized());
             $templateMgr->assign('coverPageAltText', $article->getLocalizedCoverPageAltText());
         }
         // Increment the published article's abstract views count
         if (!$request->isBot()) {
             $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
             $publishedArticleDao->incrementViewsByArticleId($article->getId());
         }
     } else {
         if (!$request->isBot()) {
             // Increment the galley's views count
             $galleyDao->incrementViews($galley->getId());
         }
         // Use the article's CSS file, if set.
         if ($galley->isHTMLGalley() && ($styleFile =& $galley->getStyleFile())) {
             $templateMgr->addStyleSheet($router->url($request, null, 'article', 'viewFile', array($article->getId(), $galley->getBestGalleyId($journal), $styleFile->getFileId())));
         }
     }
     // Add font sizer js and css if not already in header
     $additionalHeadData = $templateMgr->get_template_vars('additionalHeadData');
     if (strpos(strtolower($additionalHeadData), 'sizer.js') === false) {
         $additionalHeadData .= $templateMgr->fetch('common/sizer.tpl');
         $templateMgr->assign('additionalHeadData', $additionalHeadData);
     }
     $templateMgr->assign_by_ref('issue', $issue);
     $templateMgr->assign_by_ref('article', $article);
     $templateMgr->assign_by_ref('galley', $galley);
     $templateMgr->assign_by_ref('section', $section);
     $templateMgr->assign_by_ref('journalRt', $journalRt);
     $templateMgr->assign_by_ref('version', $version);
     $templateMgr->assign_by_ref('journal', $journal);
     $templateMgr->assign('articleId', $articleId);
     $templateMgr->assign('postingAllowed', $article->getEnableComments() && ($enableComments == COMMENTS_UNAUTHENTICATED || ($enableComments == COMMENTS_AUTHENTICATED || $enableComments == COMMENTS_ANONYMOUS) && Validation::isLoggedIn()));
     $templateMgr->assign('enableComments', $enableComments);
     $templateMgr->assign('postingLoginRequired', $enableComments != COMMENTS_ANONYMOUS && !Validation::isLoggedIn());
     $templateMgr->assign('galleyId', $galleyId);
     $templateMgr->assign('defineTermsContextId', isset($defineTermsContextId) ? $defineTermsContextId : null);
     $templateMgr->assign('comments', isset($comments) ? $comments : null);
     $templateMgr->assign('sharingEnabled', $journalRt->getSharingEnabled());
     if ($journalRt->getSharingEnabled()) {
         $templateMgr->assign('sharingRequestURL', $request->getRequestURL());
         $templateMgr->assign('sharingArticleTitle', $article->getArticleTitle());
         $templateMgr->assign_by_ref('sharingUserName', $journalRt->getSharingUserName());
         $templateMgr->assign_by_ref('sharingButtonStyle', $journalRt->getSharingButtonStyle());
         $templateMgr->assign_by_ref('sharingDropDownMenu', $journalRt->getSharingDropDownMenu());
         $templateMgr->assign_by_ref('sharingBrand', $journalRt->getSharingBrand());
         $templateMgr->assign_by_ref('sharingDropDown', $journalRt->getSharingDropDown());
         $templateMgr->assign_by_ref('sharingLanguage', $journalRt->getSharingLanguage());
         $templateMgr->assign_by_ref('sharingLogo', $journalRt->getSharingLogo());
         $templateMgr->assign_by_ref('sharingLogoBackground', $journalRt->getSharingLogoBackground());
         $templateMgr->assign_by_ref('sharingLogoColor', $journalRt->getSharingLogoColor());
         list($btnUrl, $btnWidth, $btnHeight) = SharingRT::sharingButtonImage($journalRt);
         $templateMgr->assign('sharingButtonUrl', $btnUrl);
         $templateMgr->assign('sharingButtonWidth', $btnWidth);
         $templateMgr->assign('sharingButtonHeight', $btnHeight);
     }
     $templateMgr->assign('articleSearchByOptions', array('' => 'search.allFields', ARTICLE_SEARCH_AUTHOR => 'search.author', ARTICLE_SEARCH_TITLE => 'article.title', ARTICLE_SEARCH_ABSTRACT => 'search.abstract', ARTICLE_SEARCH_INDEX_TERMS => 'search.indexTerms', ARTICLE_SEARCH_GALLEY_FILE => 'search.fullText'));
     $templateMgr->display('article/article.tpl');
 }
Пример #5
0
 /**
  * View Article.
  * @param $args array
  * @param $request Request
  */
 function view($args, $request)
 {
     $articleId = isset($args[0]) ? $args[0] : 0;
     $galleyId = isset($args[1]) ? $args[1] : 0;
     $fileId = isset($args[2]) ? $args[2] : 0;
     if ($this->userCanViewGalley($request, $articleId, $galleyId)) {
         $journal = $this->journal;
         $issue = $this->issue;
         $article = $this->article;
         $this->setupTemplate($request);
         $rtDao = DAORegistry::getDAO('RTDAO');
         $journalRt = $rtDao->getJournalRTByJournal($journal);
         $sectionDao = DAORegistry::getDAO('SectionDAO');
         $section = $sectionDao->getById($article->getSectionId(), $journal->getId(), true);
         $version = null;
         if ($journalRt->getVersion() != null && $journalRt->getDefineTerms()) {
             // Determine the "Define Terms" context ID.
             $version = $rtDao->getVersion($journalRt->getVersion(), $journalRt->getJournalId(), true);
             if ($version) {
                 foreach ($version->getContexts() as $context) {
                     if ($context->getDefineTerms()) {
                         $defineTermsContextId = $context->getContextId();
                         break;
                     }
                 }
             }
         }
         $galleyDao = DAORegistry::getDAO('ArticleGalleyDAO');
         if ($journal->getSetting('enablePublicGalleyId')) {
             $galley = $galleyDao->getByBestGalleyId($galleyId, $article->getId());
         }
         if (!isset($galley)) {
             $galley = $galleyDao->getById($galleyId, $article->getId());
         }
         if (isset($galley)) {
             if ($galley->getRemoteURL()) {
                 $request->redirectUrl($galley->getRemoteURL());
             }
         }
         $templateMgr = TemplateManager::getManager($request);
         $templateMgr->addJavaScript('js/relatedItems.js');
         if (!$galley) {
             // Get the subscription status if displaying the abstract;
             // if access is open, we can display links to the full text.
             import('classes.issue.IssueAction');
             // The issue may not exist, if this is an editorial user
             // and scheduling hasn't been completed yet for the article.
             $issueAction = new IssueAction();
             if ($issue) {
                 $templateMgr->assign('subscriptionRequired', $issueAction->subscriptionRequired($issue));
             }
             $templateMgr->assign('subscribedUser', $issueAction->subscribedUser($journal, isset($issue) ? $issue->getId() : null, isset($article) ? $article->getId() : null));
             $templateMgr->assign('subscribedDomain', $issueAction->subscribedDomain($journal, isset($issue) ? $issue->getId() : null, isset($article) ? $article->getId() : null));
             $templateMgr->assign('showGalleyLinks', $journal->getSetting('showGalleyLinks'));
             import('classes.payment.ojs.OJSPaymentManager');
             $paymentManager = new OJSPaymentManager($request);
             if ($paymentManager->onlyPdfEnabled()) {
                 $templateMgr->assign('restrictOnlyPdf', true);
             }
             if ($paymentManager->purchaseArticleEnabled()) {
                 $templateMgr->assign('purchaseArticleEnabled', true);
             }
             // Article cover page.
             if (isset($article) && $article->getLocalizedFileName() && $article->getLocalizedShowCoverPage() && !$article->getLocalizedHideCoverPageAbstract()) {
                 import('classes.file.PublicFileManager');
                 $publicFileManager = new PublicFileManager();
                 $coverPagePath = $request->getBaseUrl() . '/';
                 $coverPagePath .= $publicFileManager->getJournalFilesPath($journal->getId()) . '/';
                 $templateMgr->assign('coverPagePath', $coverPagePath);
                 $templateMgr->assign('coverPageFileName', $article->getLocalizedFileName());
                 $templateMgr->assign('width', $article->getLocalizedWidth());
                 $templateMgr->assign('height', $article->getLocalizedHeight());
                 $templateMgr->assign('coverPageAltText', $article->getLocalizedCoverPageAltText());
             }
             // References list.
             // FIXME: We only display the edited raw citations right now. We also want
             // to allow for generated citations to be displayed here (including a way for
             // the reader to choose any of the installed citation styles for output), see #5938.
             $citationDao = DAORegistry::getDAO('CitationDAO');
             /* @var $citationDao CitationDAO */
             $citationFactory = $citationDao->getObjectsByAssocId(ASSOC_TYPE_ARTICLE, $article->getId());
             $templateMgr->assign('citationFactory', $citationFactory);
         }
         $templateMgr->assign('issue', $issue);
         $templateMgr->assign('article', $article);
         $templateMgr->assign('galley', $galley);
         $templateMgr->assign('section', $section);
         $templateMgr->assign('journalRt', $journalRt);
         $templateMgr->assign('version', $version);
         $templateMgr->assign('journal', $journal);
         $templateMgr->assign('articleId', $articleId);
         $templateMgr->assign('galleyId', $galleyId);
         $templateMgr->assign('fileId', $fileId);
         $templateMgr->assign('defineTermsContextId', isset($defineTermsContextId) ? $defineTermsContextId : null);
         $templateMgr->assign('sharingEnabled', $journalRt->getSharingEnabled());
         $templateMgr->assign('ccLicenseBadge', Application::getCCLicenseBadge($article->getLicenseURL()));
         if ($journalRt->getSharingEnabled()) {
             $templateMgr->assign('sharingRequestURL', $request->getRequestURL());
             $templateMgr->assign('sharingArticleTitle', $article->getLocalizedTitle());
             $templateMgr->assign('sharingUserName', $journalRt->getSharingUserName());
             $templateMgr->assign('sharingButtonStyle', $journalRt->getSharingButtonStyle());
             $templateMgr->assign('sharingDropDownMenu', $journalRt->getSharingDropDownMenu());
             $templateMgr->assign('sharingBrand', $journalRt->getSharingBrand());
             $templateMgr->assign('sharingDropDown', $journalRt->getSharingDropDown());
             $templateMgr->assign('sharingLanguage', $journalRt->getSharingLanguage());
             $templateMgr->assign('sharingLogo', $journalRt->getSharingLogo());
             $templateMgr->assign('sharingLogoBackground', $journalRt->getSharingLogoBackground());
             $templateMgr->assign('sharingLogoColor', $journalRt->getSharingLogoColor());
             list($btnUrl, $btnWidth, $btnHeight) = SharingRT::sharingButtonImage($journalRt);
             $templateMgr->assign('sharingButtonUrl', $btnUrl);
             $templateMgr->assign('sharingButtonWidth', $btnWidth);
             $templateMgr->assign('sharingButtonHeight', $btnHeight);
         }
         $templateMgr->assign('articleSearchByOptions', array('query' => 'search.allFields', 'authors' => 'search.author', 'title' => 'article.title', 'abstract' => 'search.abstract', 'indexTerms' => 'search.indexTerms', 'galleyFullText' => 'search.fullText'));
         // consider public identifiers
         $pubIdPlugins = PluginRegistry::loadCategory('pubIds', true);
         $templateMgr->assign('pubIdPlugins', $pubIdPlugins);
         // load Article galley plugins
         PluginRegistry::loadCategory('viewableFiles', true);
         $templateMgr->display('article/article.tpl');
     }
 }
Пример #6
0
 /**
  * View Article.
  * @param $args array
  * @param $request Request
  */
 function view($args, &$request)
 {
     $router =& $request->getRouter();
     $articleId = isset($args[0]) ? $args[0] : 0;
     $galleyId = isset($args[1]) ? $args[1] : 0;
     $this->validate($request, $articleId, $galleyId);
     $journal =& $this->journal;
     $issue =& $this->issue;
     $article =& $this->article;
     $this->setupTemplate($request);
     $rtDao =& DAORegistry::getDAO('RTDAO');
     $journalRt = $rtDao->getJournalRTByJournal($journal);
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $section =& $sectionDao->getSection($article->getSectionId(), $journal->getId(), true);
     $version = null;
     if ($journalRt->getVersion() != null && $journalRt->getDefineTerms()) {
         // Determine the "Define Terms" context ID.
         $version = $rtDao->getVersion($journalRt->getVersion(), $journalRt->getJournalId(), true);
         if ($version) {
             foreach ($version->getContexts() as $context) {
                 if ($context->getDefineTerms()) {
                     $defineTermsContextId = $context->getContextId();
                     break;
                 }
             }
         }
     }
     $commentDao =& DAORegistry::getDAO('CommentDAO');
     $enableComments = $journal->getSetting('enableComments');
     if ($article->getEnableComments() && ($enableComments == COMMENTS_AUTHENTICATED || $enableComments == COMMENTS_UNAUTHENTICATED || $enableComments == COMMENTS_ANONYMOUS)) {
         $comments =& $commentDao->getRootCommentsBySubmissionId($article->getId());
     }
     $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
     if ($journal->getSetting('enablePublicGalleyId')) {
         $galley =& $galleyDao->getGalleyByBestGalleyId($galleyId, $article->getId());
     } else {
         $galley =& $galleyDao->getGalley($galleyId, $article->getId());
     }
     if ($galley && !$galley->isHtmlGalley() && !$galley->isPdfGalley()) {
         if ($galley->getRemoteURL()) {
             if (!HookRegistry::call('ArticleHandler::viewRemoteGalley', array(&$article, &$galley))) {
                 $request->redirectUrl($galley->getRemoteURL());
             }
         }
         if ($galley->isInlineable()) {
             return $this->viewFile(array($galley->getArticleId(), $galley->getId()), $request);
         } else {
             return $this->download(array($galley->getArticleId(), $galley->getId()), $request);
         }
     }
     $templateMgr =& TemplateManager::getManager($request);
     $templateMgr->addJavaScript('js/relatedItems.js');
     $templateMgr->addJavaScript('js/inlinePdf.js');
     $templateMgr->addJavaScript('js/pdfobject.js');
     if (!$galley) {
         // Get the subscription status if displaying the abstract;
         // if access is open, we can display links to the full text.
         import('classes.issue.IssueAction');
         // The issue may not exist, if this is an editorial user
         // and scheduling hasn't been completed yet for the article.
         if ($issue) {
             $templateMgr->assign('subscriptionRequired', IssueAction::subscriptionRequired($issue));
         }
         $templateMgr->assign('subscribedUser', IssueAction::subscribedUser($journal, isset($issue) ? $issue->getId() : null, isset($article) ? $article->getId() : null));
         $templateMgr->assign('subscribedDomain', IssueAction::subscribedDomain($journal, isset($issue) ? $issue->getId() : null, isset($article) ? $article->getId() : null));
         $templateMgr->assign('showGalleyLinks', $journal->getSetting('showGalleyLinks'));
         import('classes.payment.ojs.OJSPaymentManager');
         $paymentManager = new OJSPaymentManager($request);
         if ($paymentManager->onlyPdfEnabled()) {
             $templateMgr->assign('restrictOnlyPdf', true);
         }
         if ($paymentManager->purchaseArticleEnabled()) {
             $templateMgr->assign('purchaseArticleEnabled', true);
         }
         // Article cover page.
         $locale = AppLocale::getLocale();
         if (isset($article) && $article->getLocalizedFileName() && $article->getLocalizedShowCoverPage() && !$article->getLocalizedHideCoverPageAbstract()) {
             import('classes.file.PublicFileManager');
             $publicFileManager = new PublicFileManager();
             $coverPagePath = $request->getBaseUrl() . '/';
             $coverPagePath .= $publicFileManager->getJournalFilesPath($journal->getId()) . '/';
             $templateMgr->assign('coverPagePath', $coverPagePath);
             $templateMgr->assign('coverPageFileName', $article->getLocalizedFileName());
             $templateMgr->assign('width', $article->getLocalizedWidth());
             $templateMgr->assign('height', $article->getLocalizedHeight());
             $templateMgr->assign('coverPageAltText', $article->getLocalizedCoverPageAltText());
         }
         // References list.
         // FIXME: We only display the edited raw citations right now. We also want
         // to allow for generated citations to be displayed here (including a way for
         // the reader to choose any of the installed citation styles for output), see #5938.
         $citationDao =& DAORegistry::getDAO('CitationDAO');
         /* @var $citationDao CitationDAO */
         $citationFactory =& $citationDao->getObjectsByAssocId(ASSOC_TYPE_ARTICLE, $article->getId());
         $templateMgr->assign('citationFactory', $citationFactory);
     } else {
         // Use the article's CSS file, if set.
         if ($galley->isHTMLGalley() && ($styleFile =& $galley->getStyleFile())) {
             $templateMgr->addStyleSheet($router->url($request, null, 'article', 'viewFile', array($article->getId(), $galley->getBestGalleyId($journal), $styleFile->getFileId())));
         }
     }
     $templateMgr->assign_by_ref('issue', $issue);
     $templateMgr->assign_by_ref('article', $article);
     $templateMgr->assign_by_ref('galley', $galley);
     $templateMgr->assign_by_ref('section', $section);
     $templateMgr->assign_by_ref('journalRt', $journalRt);
     $templateMgr->assign_by_ref('version', $version);
     $templateMgr->assign_by_ref('journal', $journal);
     $templateMgr->assign('articleId', $articleId);
     $templateMgr->assign('postingAllowed', $article->getEnableComments() && ($enableComments == COMMENTS_UNAUTHENTICATED || ($enableComments == COMMENTS_AUTHENTICATED || $enableComments == COMMENTS_ANONYMOUS) && Validation::isLoggedIn()));
     $templateMgr->assign('enableComments', $enableComments);
     $templateMgr->assign('postingLoginRequired', $enableComments != COMMENTS_UNAUTHENTICATED && !Validation::isLoggedIn());
     $templateMgr->assign('galleyId', $galleyId);
     $templateMgr->assign('defineTermsContextId', isset($defineTermsContextId) ? $defineTermsContextId : null);
     $templateMgr->assign('comments', isset($comments) ? $comments : null);
     $templateMgr->assign('sharingEnabled', $journalRt->getSharingEnabled());
     if ($journalRt->getSharingEnabled()) {
         $templateMgr->assign('sharingRequestURL', $request->getRequestURL());
         $templateMgr->assign('sharingArticleTitle', $article->getLocalizedTitle());
         $templateMgr->assign_by_ref('sharingUserName', $journalRt->getSharingUserName());
         $templateMgr->assign_by_ref('sharingButtonStyle', $journalRt->getSharingButtonStyle());
         $templateMgr->assign_by_ref('sharingDropDownMenu', $journalRt->getSharingDropDownMenu());
         $templateMgr->assign_by_ref('sharingBrand', $journalRt->getSharingBrand());
         $templateMgr->assign_by_ref('sharingDropDown', $journalRt->getSharingDropDown());
         $templateMgr->assign_by_ref('sharingLanguage', $journalRt->getSharingLanguage());
         $templateMgr->assign_by_ref('sharingLogo', $journalRt->getSharingLogo());
         $templateMgr->assign_by_ref('sharingLogoBackground', $journalRt->getSharingLogoBackground());
         $templateMgr->assign_by_ref('sharingLogoColor', $journalRt->getSharingLogoColor());
         list($btnUrl, $btnWidth, $btnHeight) = SharingRT::sharingButtonImage($journalRt);
         $templateMgr->assign('sharingButtonUrl', $btnUrl);
         $templateMgr->assign('sharingButtonWidth', $btnWidth);
         $templateMgr->assign('sharingButtonHeight', $btnHeight);
     }
     $templateMgr->assign('articleSearchByOptions', array('query' => 'search.allFields', 'authors' => 'search.author', 'title' => 'article.title', 'abstract' => 'search.abstract', 'indexTerms' => 'search.indexTerms', 'galleyFullText' => 'search.fullText'));
     // consider public identifiers
     $pubIdPlugins =& PluginRegistry::loadCategory('pubIds', true);
     $templateMgr->assign('pubIdPlugins', $pubIdPlugins);
     $templateMgr->display('article/article.tpl');
 }
 /**
  * View Article.
  * @param $args array
  * @param $request Request
  */
 function view($args, &$request)
 {
     $router =& $request->getRouter();
     $articleId = isset($args[0]) ? $args[0] : 0;
     $galleyId = isset($args[1]) ? $args[1] : 0;
     $this->validate($request, $articleId, $galleyId);
     $journal =& $this->journal;
     $issue =& $this->issue;
     $article =& $this->article;
     $this->setupTemplate();
     $rtDao =& DAORegistry::getDAO('RTDAO');
     $journalRt = $rtDao->getJournalRTByJournal($journal);
     $sectionDao =& DAORegistry::getDAO('SectionDAO');
     $section =& $sectionDao->getSection($article->getSectionId(), $journal->getId(), true);
     $version = null;
     if ($journalRt->getVersion() != null && $journalRt->getDefineTerms()) {
         // Determine the "Define Terms" context ID.
         $version = $rtDao->getVersion($journalRt->getVersion(), $journalRt->getJournalId(), true);
         if ($version) {
             foreach ($version->getContexts() as $context) {
                 if ($context->getDefineTerms()) {
                     $defineTermsContextId = $context->getContextId();
                     break;
                 }
             }
         }
     }
     $commentDao =& DAORegistry::getDAO('CommentDAO');
     $enableComments = $journal->getSetting('enableComments');
     if ($article->getEnableComments() && ($enableComments == COMMENTS_AUTHENTICATED || $enableComments == COMMENTS_UNAUTHENTICATED || $enableComments == COMMENTS_ANONYMOUS)) {
         $comments =& $commentDao->getRootCommentsBySubmissionId($article->getId());
     }
     $galleyDao =& DAORegistry::getDAO('ArticleGalleyDAO');
     if ($journal->getSetting('enablePublicGalleyId')) {
         $galley =& $galleyDao->getGalleyByBestGalleyId($galleyId, $article->getId());
     } else {
         $galley =& $galleyDao->getGalley($galleyId, $article->getId());
     }
     if ($galley && !$galley->isHtmlGalley() && !$galley->isPdfGalley()) {
         if ($galley->isInlineable()) {
             $this->viewFile(array($galley->getArticleId(), $galley->getId()), $request);
         } else {
             $this->download(array($galley->getArticleId(), $galley->getId()), $request);
         }
     }
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->addJavaScript('js/articleView.js');
     $templateMgr->addJavaScript('js/pdfobject.js');
     if (!$galley) {
         // Get the subscription status if displaying the abstract;
         // if access is open, we can display links to the full text.
         import('classes.issue.IssueAction');
         // The issue may not exist, if this is an editorial user
         // and scheduling hasn't been completed yet for the article.
         if ($issue) {
             $templateMgr->assign('subscriptionRequired', IssueAction::subscriptionRequired($issue));
         }
         $templateMgr->assign('subscribedUser', IssueAction::subscribedUser($journal, isset($issue) ? $issue->getId() : null, isset($article) ? $article->getId() : null));
         $templateMgr->assign('subscribedDomain', IssueAction::subscribedDomain($journal, isset($issue) ? $issue->getId() : null, isset($article) ? $article->getId() : null));
         $templateMgr->assign('showGalleyLinks', $journal->getSetting('showGalleyLinks'));
         import('classes.payment.ojs.OJSPaymentManager');
         $paymentManager =& OJSPaymentManager::getManager();
         if ($paymentManager->onlyPdfEnabled()) {
             $templateMgr->assign('restrictOnlyPdf', true);
         }
         if ($paymentManager->purchaseArticleEnabled()) {
             $templateMgr->assign('purchaseArticleEnabled', true);
         }
         // Article cover page.
         $locale = AppLocale::getLocale();
         if (isset($article) && $article->getLocalizedFileName() && $article->getLocalizedShowCoverPage() && !$article->getLocalizedHideCoverPageAbstract()) {
             import('classes.file.PublicFileManager');
             $publicFileManager = new PublicFileManager();
             $coverPagePath = $request->getBaseUrl() . '/';
             $coverPagePath .= $publicFileManager->getJournalFilesPath($journal->getId()) . '/';
             $templateMgr->assign('coverPagePath', $coverPagePath);
             $templateMgr->assign('coverPageFileName', $article->getLocalizedFileName());
             $templateMgr->assign('width', $article->getLocalizedWidth());
             $templateMgr->assign('height', $article->getLocalizedHeight());
             $templateMgr->assign('coverPageAltText', $article->getLocalizedCoverPageAltText());
         }
         // References list.
         // FIXME: We only display the edited raw citations right now. We also want
         // to allow for generated citations to be displayed here (including a way for
         // the reader to choose any of the installed citation styles for output), see #5938.
         $citationDao =& DAORegistry::getDAO('CitationDAO');
         /* @var $citationDao CitationDAO */
         $citationFactory =& $citationDao->getObjectsByAssocId(ASSOC_TYPE_ARTICLE, $article->getId());
         $templateMgr->assign('citationFactory', $citationFactory);
         // Increment the published article's abstract views count
         if (!$request->isBot()) {
             $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
             $publishedArticleDao->incrementViewsByArticleId($article->getId());
         }
     } else {
         if (!$request->isBot() && !$galley->isPdfGalley()) {
             // Increment the galley's views count.
             // PDF galley views are counted in viewFile.
             $galleyDao->incrementViews($galley->getId());
         }
         // Use the article's CSS file, if set.
         if ($galley->isHTMLGalley() && ($styleFile =& $galley->getStyleFile())) {
             $templateMgr->addStyleSheet($router->url($request, null, 'article', 'viewFile', array($article->getId(), $galley->getBestGalleyId($journal), $styleFile->getFileId())));
         }
     }
     $templateMgr->assign_by_ref('issue', $issue);
     $templateMgr->assign_by_ref('article', $article);
     $templateMgr->assign_by_ref('galley', $galley);
     $templateMgr->assign_by_ref('section', $section);
     $templateMgr->assign_by_ref('journalRt', $journalRt);
     $templateMgr->assign_by_ref('version', $version);
     $templateMgr->assign_by_ref('journal', $journal);
     $templateMgr->assign('articleId', $articleId);
     $templateMgr->assign('postingAllowed', $article->getEnableComments() && ($enableComments == COMMENTS_UNAUTHENTICATED || ($enableComments == COMMENTS_AUTHENTICATED || $enableComments == COMMENTS_ANONYMOUS) && Validation::isLoggedIn()));
     $templateMgr->assign('enableComments', $enableComments);
     $templateMgr->assign('postingLoginRequired', $enableComments != COMMENTS_UNAUTHENTICATED && !Validation::isLoggedIn());
     $templateMgr->assign('galleyId', $galleyId);
     $templateMgr->assign('defineTermsContextId', isset($defineTermsContextId) ? $defineTermsContextId : null);
     $templateMgr->assign('comments', isset($comments) ? $comments : null);
     $templateMgr->assign('sharingEnabled', $journalRt->getSharingEnabled());
     if ($journalRt->getSharingEnabled()) {
         $templateMgr->assign('sharingRequestURL', $request->getRequestURL());
         $templateMgr->assign('sharingArticleTitle', $article->getArticleTitle());
         $templateMgr->assign_by_ref('sharingUserName', $journalRt->getSharingUserName());
         $templateMgr->assign_by_ref('sharingButtonStyle', $journalRt->getSharingButtonStyle());
         $templateMgr->assign_by_ref('sharingDropDownMenu', $journalRt->getSharingDropDownMenu());
         $templateMgr->assign_by_ref('sharingBrand', $journalRt->getSharingBrand());
         $templateMgr->assign_by_ref('sharingDropDown', $journalRt->getSharingDropDown());
         $templateMgr->assign_by_ref('sharingLanguage', $journalRt->getSharingLanguage());
         $templateMgr->assign_by_ref('sharingLogo', $journalRt->getSharingLogo());
         $templateMgr->assign_by_ref('sharingLogoBackground', $journalRt->getSharingLogoBackground());
         $templateMgr->assign_by_ref('sharingLogoColor', $journalRt->getSharingLogoColor());
         list($btnUrl, $btnWidth, $btnHeight) = SharingRT::sharingButtonImage($journalRt);
         $templateMgr->assign('sharingButtonUrl', $btnUrl);
         $templateMgr->assign('sharingButtonWidth', $btnWidth);
         $templateMgr->assign('sharingButtonHeight', $btnHeight);
     }
     $templateMgr->assign('articleSearchByOptions', array('' => 'search.allFields', ARTICLE_SEARCH_AUTHOR => 'search.author', ARTICLE_SEARCH_TITLE => 'article.title', ARTICLE_SEARCH_ABSTRACT => 'search.abstract', ARTICLE_SEARCH_INDEX_TERMS => 'search.indexTerms', ARTICLE_SEARCH_GALLEY_FILE => 'search.fullText'));
     //Änderungen
     $rpositoryPlugin = new RpositoryPlugin();
     $rpositoryPackagePath = $rpositoryPlugin->getSetting(0, 'path');
     $templateMgr->assign('rpositoryBase', "/" . $rpositoryPackagePath);
     //$templateMgr->assign('rpositoryBase', "/Rpository/src/contrib/");
     $rpositoryDao =& DAORegistry::getDAO('RpositoryDAO');
     $filename = $rpositoryDao->getRPackageFile($articleId);
     $templateMgr->assign('fileName', $filename);
     $templateMgr->assign('tarFile', $filename . '.tar.gz');
     $templateMgr->assign('zipFile', $filename . '.zip');
     $pid = $rpositoryDao->getPID($articleId);
     $templateMgr->assign('pid', $pid);
     $filesList = $rpositoryDao->getPackageFilesList($articleId);
     $templateMgr->assign('filesList', json_decode($filesList));
     $editPlugin = new PaperPackageEdPlugin();
     $userIsEditor = $editPlugin->userIsEditor($articleId);
     $templateMgr->assign('userIsEditor', $userIsEditor);
     $templateMgr->assign('paperPackageEditPlugin', "/index.php/mr2/PaperPackageEdPlugin/view/article=" . $articleId);
     //Änderungen Ende
     $templateMgr->display('article/article.tpl');
 }