TIBHannover / ojsGeo

OJS Geoplugin
https://projects.tib.eu/komet/
GNU General Public License v3.0
5 stars 3 forks source link

Fix Plugin for OPS #125

Open nuest opened 1 year ago

nuest commented 1 year ago
nuest commented 1 year ago

(Just recording the results of a previously internal evaluation:)

Submission worked fine, entering metadata worked fine, but there seem to be issues with the integration of the map in the theme. Only the dedicated map page works:

image

The hook names are different and need to be changed.

This requires conditional checking for the base software used and then calling the right hook.

nuest commented 1 year ago

A quick check is documented in this commit in the branch ops: https://github.com/nuest/optimetaGeo/tree/ops

Renaming the hook names works for article views!

image

nuest commented 1 year ago

Other plugins seem to handle this by simply calling multiple handlers: https://github.com/pkp/googleScholar/blob/4bf4dad2be7389898af4458f307413fa2b0c93ff/GoogleScholarPlugin.php#L40 though this requires to call only generic functions, so in our case conditional checking is probably needed.

For example, to fix the HTML metadata in the HEAD, simply doing

HookRegistry::register('PreprintHandler::view', array(&$this, 'extendArticleView'));

does not work

[Mon Jul 31 15:19:11 2023] 127.0.0.1:34456 [500]: GET /index.php/geoprints/preprint/view/1 - Uncaught Error: Call to undefined method Publication::getCurrentPublication() in /home/daniel/git/OPTIMETA/optimetaGeo/OptimetaGeoPlugin.inc.php:160
Stack trace:
#0 /home/daniel/git/OPTIMETA/ops-3.3.0-15/lib/pkp/classes/plugins/HookRegistry.inc.php(107): OptimetaGeoPlugin->extendArticleView()
#1 /home/daniel/git/OPTIMETA/ops-3.3.0-15/pages/preprint/PreprintHandler.inc.php(263): HookRegistry::call()
#2 /home/daniel/git/OPTIMETA/ops-3.3.0-15/lib/pkp/classes/core/PKPRouter.inc.php(397): PreprintHandler->view()
#3 /home/daniel/git/OPTIMETA/ops-3.3.0-15/lib/pkp/classes/core/PKPPageRouter.inc.php(246): PKPRouter->_authorizeInitializeAndCallRequest()
#4 /home/daniel/git/OPTIMETA/ops-3.3.0-15/lib/pkp/classes/core/Dispatcher.inc.php(144): PKPPageRouter->route()
#5 /home/daniel/git/OPTIMETA/ops-3.3.0-15/lib/pkp/classes/core/PKPApplication.inc.php(362): Dispatcher->dispatch()
#6 /home/daniel/git/OPTIMETA/ops-3.3.0-15/index.php(68): PKPApplication->execute()
#7 {main}
  thrown in /home/daniel/git/OPTIMETA/optimetaGeo/OptimetaGeoPlugin.inc.php on line 160
[Mon Jul 31 15:19:11 2023] 127.0.0.1:34456 Closing