pkp / ots

PKP XML Parsing Service
GNU General Public License v3.0
32 stars 19 forks source link

Stabilize substance editor endpoints upstream #84

Closed axfelix closed 7 years ago

axfelix commented 8 years ago

We have a Substance editor freeze from April 2016 which can be deployed alongside the stack and accessible via URLs of the form http://pkp-xml-demo.lib.sfu.ca/manager/editor/id/12345. We need to make these endpoints work for the upstream Substance framework editor called Texture (https://github.com/substance/texture), and implement sensible behaviour around saving changes to articles edited in Substance, as well as re-posting them to OTS as XML, particular in the context of the OJS3 plugin.

The current build of texture has a single "Save" icon:

substance-save

Re-processing an article through our stack from the XML stage onward isn't very costly -- the only libraries fired after that point in the workflow which take more than a couple seconds are the ePub transformation and Named Entity Recognition. Do we resubmit the article to the stack every time the Save icon is pressed? Would that also dismiss the editor and return to the job status page (or, if accessing the editor via OJS3, the submission status page)? Need to think about this.

kaschioudi commented 8 years ago

substance editor integration required a new XML Store to handle read from server and write on save. (cf https://github.com/kaschioudi/texture/blob/xmlps/examples/XMLPSXMLStore.js)

After XML Store creation, update jats-editor package.js script to load the new XML Store (https://github.com/kaschioudi/texture/blob/9b67abbf5b1060335aba3e33bdff0c2fccee2f04/examples/jats-editor/package.js#L4).

Then execute npm run bundle to generate app.js and app.cs files. These files need to be copied into public/texture folder.

kaschioudi commented 8 years ago

@axfelix : At this stage the editor loads document.xml correctly and updated xml is sent to the server on document save. Thereafter a new job is successfully launched. However, from my tests, the new job doesn't produce new document.xml. I saw that you made some changes back in July changing conversionStage from JOB_CONVERSION_STAGE_XML_MERGE to JOB_CONVERSION_STAGE_BIBTEXREFERENCES. Am I missing something?

axfelix commented 8 years ago

I suspect that I accidentally broke the re-submitting a job at the XML stage as some part of these commits:

https://github.com/pkp/xmlps/commit/0dfeb4f20575a63c3465d918fc133ff8781c7b6c https://github.com/pkp/xmlps/commit/b08f811047441b33a066f76f2274c5ff70e2bdcc https://github.com/pkp/xmlps/commit/8a07c2aa07ba9e85f0ea9b1854b6d6518f7c3ce2

It's probably a small thing, I'll try to look into it soon.

axfelix commented 8 years ago

Hm, just tested on master and it seems like resubmitting an XML file as a new job still works -- it doesn't produce a new document.xml because it assumes if you're submitting XML you're already past that stage. it produces HTML, ePub, PDF, and zips them all.

Was I misunderstanding the issue?

kaschioudi commented 8 years ago

yes, everything works fine. However because document.xml is missing the "Revise" link is broken. Meaning no substance editor integration for jobs triggered on save.

axfelix commented 8 years ago

Ah, I see. So we need to either rethink that interaction ... or just automatically populate the XML stage with the posted document.

kaschioudi commented 8 years ago

also, I just noticed that images are not being displayed. in the console, you can see error log: http://domain.com/manager/editor/id/media/image1.png 404 (Not Found)

should this should been look into at this stage?

axfelix commented 8 years ago

Yup -- we'll want to address that. Any chance we can figure out some kind of URL rewrite solution so they can be retrieved from the links that substance expects them at?

kaschioudi commented 8 years ago

I will go through the editor's source code to find out why the media path is missing job ids. Urls should be http://domain.com/manager/editor/id/**jobid**/media/image1.png .

Once this is addressed we could add a new route to respond to those requests. However, that also implies that these media files must be available on the server (extracted from html.zip archive) for all submissions.

axfelix commented 7 years ago

Closing; working.