ajnyga / embedGalley

OJS3 plugin for visualizing JATS XML galleys
GNU General Public License v3.0
8 stars 3 forks source link

Not working in OJS 3.1.1 #1

Closed amatsumiro closed 5 years ago

amatsumiro commented 6 years ago

Hi, I upgraded ojs to version 3.1.1 and this plugin is not working anymore. No errors in log and no errors in browser. Some idea?

ajnyga commented 6 years ago

Hi, I am in a bad place right now but will check this as soon as possible. Something has changed but not sure yet what.

amatsumiro commented 6 years ago

Thank you a lot

GrazingScientist commented 6 years ago

I just installed the plugin for the first time (perhaps I missed something when installing), but the plugin is not working with my OJS 3.1.1 either. However, my log tells me:

PHP Fatal error: Uncaught Error: Class 'XSLTProcessor' not found in /testling/plugins/generic/embedGalley/EmbedGalleyPlugin.inc.php:200\nStack trace:\n#0 /testling/plugins/generic/embedGalley/EmbedGalleyPlugin.inc.php(168): EmbedGalleyPlugin->_parseXml(Object(SubmissionFile))\n#1 /testling/lib/pkp/classes/plugins/HookRegistry.inc.php(107): EmbedGalleyPlugin->embedHtml('Templates::Arti...', Array)\n#2 /testling/lib/pkp/classes/template/PKPTemplateManager.inc.php(1145): HookRegistry::call('Templates::Arti...', Array)\n#3 /testling/cache/t_compile/42362804174f266c598cdb32c3208fc745b92101^%%2D^2D7^2D7EC92F%%article.tpl.php(32): PKPTemplateManager->smartyCallHook(Array, Object(TemplateManager))\n#4 /testling/lib/pkp/lib/vendor/smarty/smarty/libs/Smarty.class.php(1257): include('/srv/www/htdocs...')\n#5 /testling/lib/pkp/classes/template/PKPTemplateManager.inc.php(797): Sma in /testling/plugins/generic/embedGalley/EmbedGalleyPlugin.inc.php on line 200

I looked up the XSLProcessor and although it is called in EmbedGalleyPlugin.inc.php, it is not defined in the plugin. Where is it loaded?

Sorry for the noob questions!

Best Regards,

Adrian

ajnyga commented 6 years ago

It is a php extension. See for example https://stackoverflow.com/questions/7930726/fatal-error-class-xsltprocessor-not-found

ajnyga commented 6 years ago

sorry @amatsumiro for the delay, I returned from a vacation a couple of days ago. I will try to check the plugin with 3.1.1 later today.

GrazingScientist commented 6 years ago

Cool! Thanks for the fast reponse! I installed php7-xsl and now the error is gone! Still, another is appearing:

AH00690: no acceptable variant: /usr/share/apache2/error/HTTP_NOT_FOUND.html.var

Do I have to tell the plugin explicitely which file to use? Or does it recognize JATS Xml by itself?

GrazingScientist commented 6 years ago

Sorry! It works! I was too dumb!

ajnyga commented 6 years ago

it should find the xml galley if one exists.

I am not sure if that other error is plugin related either, have not seen that before.

amatsumiro commented 6 years ago

Hi Adrian.

I guess it is a php modupo. Try to install that module. apt-get install php5-xsl and apt-get install php-xml. Remeber to restart apache after that.

Regards ,

Tarcisio Pereira


From: Antti-Jussi Nygård notifications@github.com Sent: Thursday, June 7, 2018 3:12:53 AM To: ajnyga/embedGalley Cc: Tarcisio; Mention Subject: Re: [ajnyga/embedGalley] Not working in OJS 3.1.1 (#1)

it should find the xml galley if one exists.

I am not sure if that other error is plugin related either, have not seen that before.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/ajnyga/embedGalley/issues/1#issuecomment-395304901, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AGZMc4k2YUKxGfhnXOTOdCPOkRISDfpGks5t6MRlgaJpZM4UQcpy.

amatsumiro commented 6 years ago

Hi Im some articles this plugins is not working, ojs 3.1.1-2. Assertion fail. Some articles are PublishedArticle e some just Article. When it's just Article the plugin don't work. What can be done?

ajnyga commented 6 years ago

What do you mean by article not being a published article? I mean all public and published articles should be publishedArticles?

amatsumiro commented 6 years ago

142 function embedHtml($hookName, $params) { 143 $smarty =& $params[1]; 144 145 $article = $smarty->get_template_vars('article'); 146 assert(is_a($article, 'PublishedArticle')); 147 148 $genreDao = DAORegistry::getDAO('GenreDAO'); 149 150 foreach ($article->getLocalizedGalleys() as $galley) { 151 if ($galley && !$galley->getRemoteURL() && in_array($galley->getFileTy pe(), array('application/xml', 'text/xml'))) 152 { 153 $galleyFile = $galley->getFile(); 154 $genre = $genreDao->getById($galleyFile->getGenreId()); 155 if (!$genre->getSupplementary()) { 156 $xmlGalley = $galley; 157 } 158 } 159 } 160 161 // Return false if no XML galleys available 162 if (!$xmlGalley) return false; 163 164 $output =& $params[2]; 165 $request = Application::getRequest(); 166 167 // Parse XML to HTML
168 $html = $this->_parseXml($xmlGalley->getFile()); 169 170 // Parse HTML image url's etc. 171 $html = $this->_parseHtmlContents($request, $html, $xmlGalley); 172 173 // Assign HTML to article template 174 $smarty->assign('html', $html); 175 176 $output .= $smarty->fetch($this->getTemplatePath() . 'articleFooter.tpl'); 177 178 return false; 179 180 }

Assertion fail in line 146. A simple var_dump show me some $article here are instance of Article instead of PublishedArticle.

Take a look, a working article: http://www.revistas.usp.br/linhadagua/article/view/111573 Not working article: http://www.revistas.usp.br/linhadagua/article/view/116997

Regards, Tarcisio Pereira

ajnyga commented 6 years ago

Did you get this working. Seems like both links show an article?

We only have one journal in Journal.fi that uses this, so feedback is welcome.

amatsumiro commented 6 years ago

Hi, Yes.

` function embedHtml($hookName, $params) { $smarty =& $params[1];

    $article = $smarty->get_template_vars('article');

    if (!is_a($article, 'PublishedArticle')){
        $PublishedArticleDAO = DAORegistry::getDAO('PublishedArticleDAO');
        $article = $PublishedArticleDAO->getPublishedArticleById($article->getId());
    }
    if (!isset($article))
        return false;

    $genreDao = DAORegistry::getDAO('GenreDAO');

    foreach ($article->getLocalizedGalleys() as $galley) {
        if ($galley && !$galley->getRemoteURL() && in_array($galley->getFileType(), array('application/xml', 'text/xml')))
        {           
            $galleyFile = $galley->getFile();
            $genre = $genreDao->getById($galleyFile->getGenreId());
            if (!$genre->getSupplementary()) {
                $xmlGalley = $galley;
            }   
        }
    }

    // Return false if no XML galleys available
    if (!$xmlGalley) return false;

    $output =& $params[2];
    $request = Application::getRequest();   

    // Parse XML to HTML        
    $html = $this->_parseXml($xmlGalley->getFile());

    // Parse HTML image url's etc.
    $html = $this->_parseHtmlContents($request, $html, $xmlGalley);

    // Assign HTML to article template
    $smarty->assign('html', $html);

    $output .= $smarty->fetch($this->getTemplatePath() . 'articleFooter.tpl');

    return false;

}`

Not beautiful, but works.

ajnyga commented 6 years ago

Thanks! you could try the new version I just uploaded here: https://github.com/ajnyga/embedGalley/releases

We have one journal using that with OJS 3.1.1.2

amatsumiro commented 6 years ago

Thanks. I'll take a look.

Bewegung79 commented 6 years ago

Hi, I've tried to use this plugin in our site, but it doesn't work. (OJS 3.1.0.1). When I try to visualize an xml file, it just pulls up the browsers default "save as" option. Is there anything I can do from my end? Thanks! Hernán.

ps: I posted the link to our site just so you can look at it (may be there's no compatibility with the theme?). There are no xml published you can see, but I couldn't make it work for published or unplublished articles (I momentarily published an article in order to make sure of this)

ajnyga commented 6 years ago

Hi @Bewegung79,

The current plugin supports only the latest OJS release, which is 3.1.1. There have been some changes in OJS that have affected the plugin I think.

Unfortunately I have not preserved the older releases in this plugin, but you could try the old 3.0.2 branch I have here: https://github.com/ajnyga/embedGalley/tree/stable-3-0-2. Not sure if that will work though.

The plugin should work with any theme as long as the hook that is used exists in the templates.

Bewegung79 commented 6 years ago

Hi @ajnyga , Thanks for your quick response. I tried the 3.0.2 branch you told me, but it proveked OJS installed plugins page to keep loading forever. I've experienced this issue with other not-updated plugins (and other users have also raised this issue previously). So sad you didn't preserve older erleases! Any other suggestions are wellcome. Thanks!

ajnyga commented 6 years ago

do you have a reason not to upgrade OJS?

Bewegung79 commented 6 years ago

Honestly, I'm new to OJS, so I have two: ignorance and fear. :(

ajnyga commented 6 years ago

when you uploaded the plugin folder under plugins/generic/, what was the name of the folder?

Bewegung79 commented 6 years ago

I renamed it to "embedGalley"

ajnyga commented 6 years ago

ok, you could of course check your error log and see what is not compatible. I can remember that some changes have been made during the past two years, but really do not remember what. You could of course take the latest master branch and check the commits for the changes I made: https://github.com/ajnyga/embedGalley/commits/master. We used 3.1.0.1 last january.

ajnyga commented 5 years ago

there is a recent release for 3.1.2 available now so I am not supporting the older versions anymore