Add files with dependent files to submission

Hi all,

I am developing a plugin which will create PDF files from LaTex files. Features are:

  • extract zip file;
  • add these files to the submission in production phase (main.tex as the main file and others as dependent files)
  • convert these extracted LaTex files to a PDF.

This is the link to the plugin: GitHub - GaziYucel/latexConverter

All seems to work well, but not all files are shown on the page of the submission. Only the main file is shown, all dependent files are missing.

The method doing this is in my plugin is here:

I peaked at another plugin which does work in the same OJS installation, namely

The method doing this is here:

I added files with both the plugins and compared the rows in the database, all looks the same. I checked these tables: submission_files, files, submission_file_revisions, submission_file_settings.

What am I missing, have no hair to pull out. Can anyone help me with this. Thank you.

OJS version: .3.0-14
Platform: Debian / Apache / PHP8.1

@Vitaliy @Dulip_Withanage

Hi @gaziyucel,

Just a thought, but are you sure the genre_id you’re using is for a dependent genre? That flag needs to be set on the genre for the files to properly be considered dependent. Check the dependent column in the genres table.

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you @asmecher,
there are 3 genre_ids with the dependent flag: multimedia, image and style. I already tried those. Your reply did give me an idea.

The mimetype of the main file is “text/x-tex” or “application/x-tex”. If I change this to “text/xml”, the dependent files are shown. So showing the files are dependent of the mimetype of the main file. Does this mean that only for certain files, dependent files are allowed?

Regards,
Gazi

Hi @gaziyucel,

Ah! You reminded me – there is a MIME type check to see whether a file supports dependent files. See the supportsDependentFiles function in one of the following places:

  • In OJS 3.3.0-x, see: lib/pkp/classes/services/PKPSubmissionFileService.inc.php
  • In OJS 3.4.0-x, see: lib/pkp/classes/submissionFile/Repository.php

As you’ll see, there’s a hook there called SubmissionFile::supportsDependentFiles that allows plugins to extend the list without modifying the code.

Regards,
Alec Smecher
Public Knowledge Project Team