I am developing a plugin and would like to create a galley after finishing step ‘3. Enter Metadata’ in the submission process. For this I use the hook ‘Publication::edit’ and have already found a way to store a galley in the database. Here is the code I currently use:
This works fine, but now I want to add an html file that will be displayed in the galley. Is there a function or another way to add a file via the code? So a file should be set e.g. a html which is then displayed in the galley like in the picture below. The file is to be loaded from a path on the PC and set accordingly in the database so that the ‘submission_filde_id’ field in the ‘publications_galleys’ table is filled. I am very glad about any help!
Curious what specific version you’re testing your plugin with? If you haven’t checked it out already, our plugin development guide might come in handy as well.
I’m testing my plugin currently with OJS in version 3.4.0.0. Yes I have looked at the plugin guide but unfortunately I have not found a solution to the above mentioned issue with it.
Hi @rcgillis I just forked the main branch of the ojs repository 23 days ago (GitHub - tnier01/ojs: Open Journal Systems) and am using this as my current OJS version. Here is also a screenshot of my system information:
Hi @tnier01, that’s great! The main branch can go through some unstable periods, and is just about to go through one now, because we’re in the early dev cycle of the next major version. You may find it frustrating to work on the branch but you’re welcome to do so. (There are stable-3_3_0 and stable-3_3_1 branches that are less volatile at the moment.)
I want to add an html file that will be displayed in the galley
Can you describe in more detail what problems you’re facing? We don’t handle HTML files any differently in the galley settings: a file is uploaded, it gets a submissionFileId, and that ID is attached to a galley. It should be the same as a PDF or any other file.
If you want to upload CSS/JS/image assets along with the HTML file, you’ll want to use the dependent files stage. Our docs have more details about the submission file stages.
On a separate note: what is your use case for this? If you want to quickly import back content, you may want to check out our native import/export tools (see sample issue import) or the QuickSubmit plugin (in the plugin gallery, but only compatible up to 3.3.0-5). If you’re aiming for something more like preprints, where authors upload their only galleys and just get approved by moderators, you may want to use our Open Preprint Server instead of OJS.
Hi @NateWr, first of all thanks for the detailed hints. I would continue to work on the main branch for now, my frustration is not very high yet.
In the meantime I managed to create a submission file. Thanks a lot for the hint with the documentation. I had already tried it as described there before, but when I used SUBMISSION_FILE_SUBMISSION for the fileStage the validation threw errors. Here the errors are shown:
Since I use the hook Publication::edit and the submission file should be created with the confirmation Save and continue at the end of step 3. Enter Metadata in the submission process, it should be the correct file stage or? whereas others did not work either. Anyway, I was able to solve the problem by using an integer for the fileStage, in my case 2. Is that the right way to do it (then it wouldn’t quite match the documentation)? Is there a documentation where also the corresponding integers for the different fileStages are listed?
The general idea behind this is that I would like to create a galley that contains an interactive html-file as additional presentation of the article, which contains values specified by the users during step 3. Enter Metadata in the submission process. Therefore the galley and the corresponding html file should be included/created at the end of this step. The way I have solved it now is to use the hook Publication::edit to read out the required input of the users during step 3. Enter Metadata, to adapt an html-file to this input, to upload it as file and submission file and finally to save and publish it in form of a galley. Does this sound like the right way to go for my idea? Or are there other ways? Ultimately, this galley should always be present when the plugin is activated, if the users want it for the respective article. Whereby the content of the galley depends on the input that the users make during step 3. Enter Metadata.
Hi @tnier01, the SUBMISSION_FILE_SUBMISSION is a PHP constant that is equal to 2. So that’s why it’s working when you use the integer. However, you should use the constant to protect yourself in case the value changes.
If you’re on the main branch, you can use the following:
Does this sound like the right way to go for my idea? Or are there other ways?
It sounds like that will work, however beware that the Publication::edit hook will fire any time the publication is edited, not just in step 3. So you’ll need to be careful about when you are performing the action to make.
An alternate hook that you can use is submissionsubmitstep3form::execute. This will fire whenever the step 3 form is successfully completed.