Error when submitting an article

Application Version - OJS 3.2.1.0
PHP 7.2.24
Ubuntu 18.04.6
Apache2 2.4.29

When I try to summit any article the site freezes when I hit the step 4 confirmation box ok button
image
I can hit cancel button but the finish submission button wont work anymore
The console show me the following message:
Handler.js?v=3.2.1.0:506 Uncaught ReferenceError: pkp is not defined
at proxyConstructor.$.pkp.classes.Handler.bindGlobal (Handler.js?v=3.2.1.0:506)
at proxyConstructor.$.pkp.controllers.modal.ModalHandler [as constructor] (ModalHandler.js?v=3.2.1.0:73)
at proxyConstructor.$.pkp.classes.ObjectProxy.parent (ObjectProxy.js?v=3.2.1.0:112)
at proxyConstructor.$.pkp.controllers.modal.ConfirmationModalHandler [as constructor] (ConfirmationModalHandler.js?v=3.2.1.0:41)
at proxyConstructor.$.pkp.classes.ObjectProxy.parent (ObjectProxy.js?v=3.2.1.0:112)
at proxyConstructor.$.pkp.controllers.modal.ButtonConfirmationModalHandler [as constructor] (ButtonConfirmationModalHandler.js?v=3.2.1.0:37)
at proxyConstructor.$.pkp.classes.ObjectProxy.parent (ObjectProxy.js?v=3.2.1.0:112)
at new proxyConstructor (Helper.js?v=3.2.1.0:283)
at Function.$.pkp.classes.Helper.objectFactory (Helper.js?v=3.2.1.0:209)
at HTMLDivElement. (jquery.pkp.js?v=3.2.1.0:37)
image

I am behind a reverse proxy also in apache2

Hi @carvalhoek,

Is your web server able to serve up js/pkp.min.js to the browser?

Regards,
Alec Smecher
Public Knowledge Project Team

Well i solved it… but new errors occurred, it turned out that this issue was a problem with my reverse proxy because the js/pkp.min.js was being searched in the wrong path and i solved it with mod substitute
image
but for some reason it won’t change in this case
image
image

the correct path for it would be /reapadmin/plugins/generic

@asmecher so I’ve failed in finding a solution, can you give me any hint?

Hi @carvalhoek,

I’m not sure I can give much guidance, since your set-up will be pretty specific – but the URLs to those JS files are built in lib/pkp/js/controllers/SiteHandler.js (which is compiled into the minified Javascript for OJS – js/pkp.min.js – if you have minification enabled). I see a similarly-built URL in lib/pkp/js/controllers/UploaderHandler.js for lib/pkp/lib/vendor/moxiecode/plupload/js/Moxie.swf and lib/pkp/lib/vendor/moxiecode/plupload/js/Moxie.xap so I suspect the file uploader may also suffer similar issues.

Because the URLs are built on the client side, not the server side, mod_substitute never gets the chance to work on them. One thing you could do without much work is move the URL construction into the server side, i.e. into Smarty templates where the Javascript gets bound to the markup, so that the full URLs to the problem files are provided as parameters to the Javascript handler. If you’re willing to work on a pull request to make that change, we could merge it into a future release and you wouldn’t need to worry about preserving the modification.

For the TinyMCE example, it would mean editing lib/pkp/templates/common/header.tpl to add the new parameter to SiteHandler. Then call on that new parameter in SiteHandler.js instead of building the URL in Javascript.

This should get your mod_substitute rules to apply to those TinyMCE plugins. Just don’t forget to recompile the JS if you’re using minification, or disable minification to work with the individual .js files directly.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi

Application Version - ojs-3.3.0-5
PHP 7.4.3
Ubuntu 20.04.2 LTS
Apache2 2.4.41

l have the same problem, but I didn’t find the files lib/pkp/templates/common/header.tpl

image

and SiteHandler.js

How can l resolve this issue?

Hi @esolchaga,

This is an older post. Please create a new post with your issue. Feel free to link back to this post if it is relevant to the issue you are encountering.

Best regards,

Roger
PKP Team