OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Images not showing up in the HTML

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Images not showing up in the HTML

Postby leossa » Wed Aug 08, 2007 11:42 am

Hello,

i'm having problems with my ojs journal, where the images from my in editing article are not showing up.
Apparently the problem appeared after we have migrated our database server.
The pages at the Archives section still opens fine.
On the editor's in editing section, at Layout, after clicking at the View Proof link the page shows but the images are not been dispĺayed.

Need a hand on this, please.

leossa
leossa
 
Posts: 11
Joined: Thu Jun 28, 2007 4:25 pm

Re: Images not showing up in the HTML

Postby asmecher » Wed Aug 08, 2007 1:55 pm

Hi leossa,

You may be encountering bug #2714; please try applying the patch at http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=2714 to see if that corrects the problem.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm

Re: Images not showing up in the HTML

Postby leossa » Wed Aug 08, 2007 3:40 pm

Hi,
thanks for answering.
Unfortunately, I applied the patch, but the problem still persists. Anymore ideas?

leossa
leossa
 
Posts: 11
Joined: Thu Jun 28, 2007 4:25 pm

Re: Images not showing up in the HTML

Postby asmecher » Wed Aug 08, 2007 4:04 pm

Hi leossa,

Are the articles you're having trouble with scheduled against an issue? That is, on the submission's Editing page, is there an issue chosen for the article to be published in?

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm

Re: Images not showing up in the HTML

Postby leossa » Fri Aug 10, 2007 10:22 am

asmecher wrote:Hi leossa,

Are the articles you're having trouble with scheduled against an issue? That is, on the submission's Editing page, is there an issue chosen for the article to be published in?

Regards,
Alec Smecher
Public Knowledge Project Team


Hi Smecher,
I don't know if it is actually this you are talking about but there are some issues at the Editing page which have a section like showed bellow:

Scheduling

Schedule for publication in [To Be Assigned]
leossa
 
Posts: 11
Joined: Thu Jun 28, 2007 4:25 pm

Re: Images not showing up in the HTML

Postby leossa » Fri Aug 10, 2007 10:29 am

leossa wrote:
asmecher wrote:Hi leossa,

Are the articles you're having trouble with scheduled against an issue? That is, on the submission's Editing page, is there an issue chosen for the article to be published in?

Regards,
Alec Smecher
Public Knowledge Project Team


Hi Smecher,
I don't know if it is actually this you are talking about but there are some issues at the Editing page which have a section like showed bellow:

Scheduling

Schedule for publication in [To Be Assigned]


Just to add, when I try the layout proof the images doesnt show up, but when I program it to be published, at the site of publication of future numbers the article appears with all the images correctly.
leossa
 
Posts: 11
Joined: Thu Jun 28, 2007 4:25 pm

Re: Images not showing up in the HTML

Postby asmecher » Fri Aug 10, 2007 10:43 am

Hi leossa,

This does sound like bug #2714; are you sure the patch applied successfully?

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm

Re: Images not showing up in the HTML

Postby leossa » Fri Aug 10, 2007 12:00 pm

asmecher wrote:Hi leossa,

This does sound like bug #2714; are you sure the patch applied successfully?

Regards,
Alec Smecher
Public Knowledge Project Team


Hi asmecher,
As it describes in the bugzilla, it really looks like it's in fact that bug. I applied the patch and everything went fine, except for the function validate(..) which didnt work and I had to correct manually.
leossa
 
Posts: 11
Joined: Thu Jun 28, 2007 4:25 pm

Re: Images not showing up in the HTML

Postby leossa » Fri Aug 10, 2007 12:00 pm

I don't know if I did it correctly. Here is the output of the patch:

patching file classes/article/ArticleDAO.inc.php
patching file classes/issue/IssueAction.inc.php
patching file classes/issue/IssueDAO.inc.php
Hunk #1 succeeded at 423 (offset -7 lines).
patching file pages/article/ArticleHandler.inc.php
Hunk #2 FAILED at 319.
Hunk #3 succeeded at 358 (offset -8 lines).
Hunk #4 succeeded at 367 (offset -8 lines).
1 out of 4 hunks FAILED -- saving rejects to file pages/article/ArticleHandler.inc.php.rej
patching file pages/rt/RTHandler.inc.php
Hunk #1 succeeded at 252 (offset -10 lines).
patching file templates/article/article.tpl
Hunk #1 succeeded at 33 (offset -5 lines).
Hunk #2 succeeded at 58 (offset -5 lines).
patching file templates/rt/captureCite.tpl
patching file templates/rt/citeProCite.tpl
patching file templates/rt/citeReferenceManager.tpl
patching file templates/rt/metadata.tpl
Hunk #1 succeeded at 132 (offset -10 lines).
patching file templates/rt/printerFriendly.tpl
Hunk #1 succeeded at 33 (offset -4 lines).
patching file templates/rt/rt.tpl
patch unexpectedly ends in middle of line
Hunk #1 succeeded at 31 with fuzz 2 (offset -4 lines).
leossa
 
Posts: 11
Joined: Thu Jun 28, 2007 4:25 pm

Re: Images not showing up in the HTML

Postby leossa » Tue Aug 14, 2007 11:22 am

Hi,
here is my procedure followed by my original ArticleHandler.inc.php file:

$ patch -p0 < correction.patch

and so I got the output:

Code: Select all
patching file classes/article/ArticleDAO.inc.php
patching file classes/issue/IssueAction.inc.php
patching file classes/issue/IssueDAO.inc.php
Hunk #1 succeeded at 423 (offset -7 lines).
patching file pages/article/ArticleHandler.inc.php
Hunk #2 FAILED at 319.
Hunk #3 succeeded at 358 (offset -8 lines).
Hunk #4 succeeded at 367 (offset -8 lines).
1 out of 4 hunks FAILED -- saving rejects to file pages/article/ArticleHandler.inc.php.rej
patching file pages/rt/RTHandler.inc.php
Hunk #1 succeeded at 252 (offset -10 lines).
patching file templates/article/article.tpl
Hunk #1 succeeded at 33 (offset -5 lines).
Hunk #2 succeeded at 58 (offset -5 lines).
patching file templates/rt/captureCite.tpl
patching file templates/rt/citeProCite.tpl
patching file templates/rt/citeReferenceManager.tpl
patching file templates/rt/metadata.tpl
Hunk #1 succeeded at 132 (offset -10 lines).
patching file templates/rt/printerFriendly.tpl
Hunk #1 succeeded at 33 (offset -4 lines).
patching file templates/rt/rt.tpl
Hunk #1 succeeded at 31 (offset -4 lines).


Code: Select all
<?php

/**
 * ArticleHandler.inc.php
 *
 * Copyright (c) 2003-2006 John Willinsky
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * @package pages.article
 *
 * Handle requests for article functions.
 *
 * $Id: ArticleHandler.inc.php,v 1.55 2006/06/12 23:26:08 alec Exp $
 */

import('rt.ojs.RTDAO');
import('rt.ojs.JournalRT');

class ArticleHandler extends Handler {

   /**
    * View Article.
    */
   function view($args) {
      $articleId = isset($args[0]) ? $args[0] : 0;
      $galleyId = isset($args[1]) ? (int) $args[1] : 0;

      list($journal, $issue, $article) = ArticleHandler::validate($articleId, $galleyId);

      $rtDao = &DAORegistry::getDAO('RTDAO');
      $journalRt = $rtDao->getJournalRTByJournal($journal);

      $galleyDao = &DAORegistry::getDAO('ArticleGalleyDAO');
      $galley = &$galleyDao->getGalley($galleyId, $article->getArticleId());

      if (!$journalRt->getEnabled()) {
         if (!$galley || $galley->isHtmlGalley()) return ArticleHandler::viewArticle($args);
         else if ($galley->isPdfGalley()) return ArticleHandler::viewPDFInterstitial($args, $galley);
         else if ($galley->isInlineable()) {
            import('file.ArticleFileManager');
            $articleFileManager = &new ArticleFileManager($article->getArticleId());
            $articleFileManager->viewFile($galley->getFileId());
         } else return ArticleHandler::viewDownloadInterstitial($args, $galley);
      }

      if (!$article) {
         Request::redirect(null, Request::getRequestedPage());
         return;
      }

      $templateMgr = &TemplateManager::getManager();
      $templateMgr->assign('articleId', $articleId);
      $templateMgr->assign_by_ref('article', $article);
      $templateMgr->assign('galleyId', $galleyId);
      $templateMgr->assign_by_ref('galley', $galley);

      $templateMgr->display('article/view.tpl');
   }

   /**
    * Article interstitial page before PDF is shown
    */
   function viewPDFInterstitial($args, $galley = null) {
      $articleId = isset($args[0]) ? $args[0] : 0;
      $galleyId = isset($args[1]) ? (int) $args[1] : 0;
      list($journal, $issue, $article) = ArticleHandler::validate($articleId, $galleyId);

      if (!$galley) {
         $galleyDao = &DAORegistry::getDAO('ArticleGalleyDAO');
         $galley = &$galleyDao->getGalley($galleyId, $article->getArticleId());
      }

      $templateMgr = &TemplateManager::getManager();
      $templateMgr->assign('articleId', $articleId);
      $templateMgr->assign('galleyId', $galleyId);
      $templateMgr->assign_by_ref('galley', $galley);
      $templateMgr->assign_by_ref('article', $article);

      $templateMgr->display('article/pdfInterstitial.tpl');
   }

   /**
    * Article interstitial page before a non-PDF, non-HTML galley is
    * downloaded
    */
   function viewDownloadInterstitial($args, $galley = null) {
      $articleId = isset($args[0]) ? $args[0] : 0;
      $galleyId = isset($args[1]) ? (int) $args[1] : 0;
      list($journal, $issue, $article) = ArticleHandler::validate($articleId, $galleyId);

      if (!$galley) {
         $galleyDao = &DAORegistry::getDAO('ArticleGalleyDAO');
         $galley = &$galleyDao->getGalley($galleyId, $article->getArticleId());
      }
      
      $templateMgr = &TemplateManager::getManager();
      $templateMgr->assign('articleId', $articleId);
      $templateMgr->assign('galleyId', $galleyId);
      $templateMgr->assign_by_ref('galley', $galley);
      $templateMgr->assign_by_ref('article', $article);

      $templateMgr->display('article/interstitial.tpl');
   }

   /**
    * Article view
    */
   function viewArticle($args) {
      $articleId = isset($args[0]) ? $args[0] : 0;
      $galleyId = isset($args[1]) ? (int) $args[1] : 0;

      list($journal, $issue, $article) = ArticleHandler::validate($articleId, $galleyId);

      $rtDao = &DAORegistry::getDAO('RTDAO');
      $journalRt = $rtDao->getJournalRTByJournal($journal);

      $sectionDao = &DAORegistry::getDAO('SectionDAO');
      $section = &$sectionDao->getSection($article->getSectionId());

      if ($journalRt->getVersion()!=null && $journalRt->getDefineTerms()) {
         // Determine the "Define Terms" context ID.
         $version = $rtDao->getVersion($journalRt->getVersion(), $journalRt->getJournalId());
         if ($version) foreach ($version->getContexts() as $context) {
            if ($context->getDefineTerms()) {
               $defineTermsContextId = $context->getContextId();
               break;
            }
         }
      }

      $commentDao = &DAORegistry::getDAO('CommentDAO');
      $enableComments = $journal->getSetting('enableComments');
      if ($enableComments == COMMENTS_AUTHENTICATED || $enableComments == COMMENTS_UNAUTHENTICATED || $enableComments == COMMENTS_ANONYMOUS) {
         $comments = &$commentDao->getRootCommentsByArticleId($article->getArticleId());
      }

      $articleGalleyDao = &DAORegistry::getDAO('ArticleGalleyDAO');
      $galley = &$articleGalleyDao->getGalley($galleyId, $article->getArticleId());

      $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');
         $templateMgr->assign('subscriptionRequired', IssueAction::subscriptionRequired($issue));
         $templateMgr->assign('subscribedUser', IssueAction::subscribedUser($journal));
         $templateMgr->assign('subscribedDomain', IssueAction::subscribedDomain($journal));

         // Increment the published article's abstract views count
         $publishedArticleDao = &DAORegistry::getDAO('PublishedArticleDAO');
         $publishedArticleDao->incrementViewsByArticleId($article->getArticleId());
      } else {
         // Increment the galley's views count
         $articleGalleyDao->incrementViews($galleyId);

         // Use the article's CSS file, if set.
         if ($galley->isHTMLGalley() && $styleFile =& $galley->getStyleFile()) {
            $templateMgr->addStyleSheet(Request::url(null, 'article', 'viewFile', array(
               $article->getArticleId(),
               $galley->getGalleyId(),
               $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('articleId', $articleId);
      $templateMgr->assign('postingAllowed', (
         $enableComments == COMMENTS_UNAUTHENTICATED ||
         (($enableComments == COMMENTS_AUTHENTICATED ||
         $enableComments == COMMENTS_ANONYMOUS) &&
         Validation::isLoggedIn())
      ));
      $templateMgr->assign('galleyId', $galleyId);
      $templateMgr->assign('defineTermsContextId', isset($defineTermsContextId)?$defineTermsContextId:null);
      $templateMgr->assign('comments', isset($comments)?$comments:null);
      $templateMgr->display('article/article.tpl');   
   }

   /**
    * Article Reading tools
    */
   function viewRST($args) {
      $articleId = isset($args[0]) ? $args[0] : 0;
      $galleyId = isset($args[1]) ? (int) $args[1] : 0;

      list($journal, $issue, $article) = ArticleHandler::validate($articleId, $galleyId);

      $rtDao = &DAORegistry::getDAO('RTDAO');
      $journalRt = $rtDao->getJournalRTByJournal($journal);

      // The RST needs to know whether this galley is HTML or not. Fetch the galley.
      $articleGalleyDao = &DAORegistry::getDAO('ArticleGalleyDAO');
      $galley = &$articleGalleyDao->getGalley($galleyId, $article->getArticleId());
      
      $sectionDao = &DAORegistry::getDAO('SectionDAO');
      $section = &$sectionDao->getSection($article->getSectionId());

      $templateMgr = &TemplateManager::getManager();
      $templateMgr->assign_by_ref('issue', $issue);
      $templateMgr->assign_by_ref('article', $article);
      $templateMgr->assign('articleId', $articleId);
      $templateMgr->assign('galleyId', $galleyId);
      $templateMgr->assign_by_ref('galley', $galley);
      $templateMgr->assign_by_ref('journal', $journal);
      $templateMgr->assign_by_ref('section', $section);

      // Bring in comment constants.
      $commentDao = &DAORegistry::getDAO('CommentDAO');

      $enableComments = $journal->getSetting('enableComments');
      $templateMgr->assign('postingAllowed', (
         $enableComments == COMMENTS_UNAUTHENTICATED ||
         (($enableComments == COMMENTS_AUTHENTICATED ||
         $enableComments == COMMENTS_ANONYMOUS) &&
         Validation::isLoggedIn())
      ));
      $templateMgr->assign('postingDisabled', $enableComments == COMMENTS_DISABLED);

      $templateMgr->assign_by_ref('journalRt', $journalRt);
      if ($journalRt->getEnabled()) {
         $version = $rtDao->getVersion($journalRt->getVersion(), $journalRt->getJournalId());
         if ($version) {
            $templateMgr->assign_by_ref('version', $version);
         }
      }

      $templateMgr->display('rt/rt.tpl');   
   }

   /**
    * View a file (inlines file).
    * @param $args array ($articleId, $galleyId, $fileId [optional])
    */
   function viewFile($args) {
      $articleId = isset($args[0]) ? $args[0] : 0;
      $galleyId = isset($args[1]) ? $args[1] : 0;
      $fileId = isset($args[2]) ? (int) $args[2] : 0;

      list($journal, $issue, $article) = ArticleHandler::validate($articleId, $galleyId);

      $galleyDao = &DAORegistry::getDAO('ArticleGalleyDAO');
      $galley = &$galleyDao->getGalley($galleyId, $article->getArticleId());

      if (!$galley) Request::redirect(null, null, 'view', $articleId);

      if (!$fileId) {
         $galleyDao->incrementViews($galleyId);
         $fileId = $galley->getFileId();
      } else {
         if (!$galley->isDependentFile($fileId)) {
            Request::redirect(null, null, 'view', $articleId);
         }
      }

      // reuse section editor's view file function
      import('submission.sectionEditor.SectionEditorAction');
      SectionEditorAction::viewFile($article->getArticleId(), $fileId);
   }

   /**
    * Downloads the document
    */
   function download($args) {
      $articleId = isset($args[0]) ? $args[0] : 0;
      $galleyId = isset($args[1]) ? (int)$args[1] : 0;
      list($journal, $issue, $article) = ArticleHandler::validate($articleId, $galleyId);

      $galleyDao = &DAORegistry::getDAO('ArticleGalleyDAO');
      $galley = &$galleyDao->getGalley($galleyId, $article->getArticleId());
      $galleyDao->incrementViews($galleyId);

      if ($article && $galley) {
         import('file.ArticleFileManager');
         $articleFileManager = &new ArticleFileManager($article->getArticleId());
         $articleFileManager->downloadFile($galley->getFileId());
      }
   }

   function downloadSuppFile($args) {
      $articleId = isset($args[0]) ? $args[0] : 0;
      $suppId = isset($args[1]) ? $args[1] : 0;
      list($journal, $issue, $article) = ArticleHandler::validate($articleId);

      $suppFileDao = &DAORegistry::getDAO('SuppFileDAO');
      if ($journal->getSetting('enablePublicSuppFileId')) {
         $suppFile = &$suppFileDao->getSuppFileByBestSuppFileId($article->getArticleId(), $suppId);
      } else {
         $suppFile = &$suppFileDao->getSuppFile((int) $suppId, $article->getArticleId());
      }

      if ($article && $suppFile) {
         import('file.ArticleFileManager');
         $articleFileManager = &new ArticleFileManager($article->getArticleId());
         if ($suppFile->isInlineable()) {
            $articleFileManager->viewFile($suppFile->getFileId());
         } else {
            $articleFileManager->downloadFile($suppFile->getFileId());
         }
      }
   }

   /**
    * Validation
    */
   function validate($articleId, $galleyId = null) {

      parent::validate(true);

      $journal = &Request::getJournal();
      $journalId = $journal->getJournalId();
      $journalSettingsDao = &DAORegistry::getDAO('JournalSettingsDAO');

      $publishedArticleDao = &DAORegistry::getDAO('PublishedArticleDAO');

      if ($journal->getSetting('enablePublicArticleId')) {
         $article = &$publishedArticleDao->getPublishedArticleByBestArticleId($journal->getJournalId(), $articleId);
      } else {
         $article = &$publishedArticleDao->getPublishedArticleByArticleId((int) $articleId);
      }

      $issueDao = &DAORegistry::getDAO('IssueDAO');
      if (isset($article)) $issue = &$issueDao->getIssueByArticleId($article->getArticleId());

      // if issue or article do not exist, are not published, or are
      // not parts of the same journal, redirect to index.
      if (isset($issue) && isset($article) && ($issue->getPublished() || Validation::isEditor($journal->getJournalId()) || Validation::isSectionEditor($journal->getJournalId())) && $issue->getJournalId() == $journal->getJournalId()) {

         import('issue.IssueAction');
         $subscriptionRequired = IssueAction::subscriptionRequired($issue);
         
         // Check if login is required for viewing.
         if (!Validation::isLoggedIn() && $journalSettingsDao->getSetting($journalId,'restrictArticleAccess')) {
            Validation::redirectLogin();
         }
   
         // bypass all validation if subscription based on domain or ip is valid
         // or if the user is just requesting the abstract
         if ( (!IssueAction::subscribedDomain($journal) && $subscriptionRequired) &&
              (isset($galleyId) && $galleyId!=0) ) {
            
            // Subscription Access
            $subscribedUser = IssueAction::subscribedUser($journal);
   
            if (!(!$subscriptionRequired || $article->getAccessStatus() || $subscribedUser)) {
               if (!isset($galleyId) || $galleyId) {
                  Request::redirect(null, 'index');   
               }
            }
         }
      } else {
         Request::redirect(null, 'index');
      }
      return array($journal, $issue, $article);
   }

}

?>


Hope it helps. I'm available for providing any further information.

Regards,
leossa
leossa
 
Posts: 11
Joined: Thu Jun 28, 2007 4:25 pm

Re: Images not showing up in the HTML

Postby asmecher » Tue Aug 14, 2007 11:54 am

Hi Leossa,

Could you PM me with temporary Editor access to your system? I'll see what I can turn up.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm


Return to OJS Technical Support

Who is online

Users browsing this forum: No registered users and 4 guests