OJS - Initiate QuickSubmitPlugin without Form

I am working on a Plugin that will take some parsed xml meta data that has article information and have it complete an initial Submission (unpublished) without having to go through the Submission process - similar to what is done by the QuickSubmitPlugin. However; I don’t want to have to use the Form. This would be the first step to eventually have this process done automatically via an FTP server.

Back to the issue…

I would like to instantiate a QuickSubmitPlugin or QuickSubmitForm and just pass in the relevant data needed to execute the submission; for example: section/author information/gallery file/. I am aware that the initialization of the Submission takes place within the QuickSubmitForm in the initData() function, and then gets executed with a call to execute() upon submitting the QuickSubmitForm (saveSubmit).

I tried looking into the QuickSubmitPlugin to see if there are any examples of initiating the Plugin without having to use the Form; however the test files only have Web Driver related functional tests, and not actually instantiating any new objects directly.

Below is a breakdown of what I have setup already:

/* plugins/importexport/MyPlugin */

class MyPlugin extends ImportExportPlugin {
    /*  register, getName, usage, etc.  */
    public function executeCLI($scriptName, &$args) {
        / *  takes in xml file, parses the file into an associate array ($data) */
       $data = {
               'articleTitle' : 'some title',
               'authors' : {
                        0 : { 'fname' : Jane, 'lname' : Doe }
                        1 : { 'fname' : Test, 'lname' : User }
               }
               'abstract' : 'lorem ipsum ... '
              /*etc*/
       }
       // stuck here -> new QuickSubmitForm($this, $request)??
       // how would $request be setup??
       // is this even necessary??  alternative ways??
   }
}

I am on OJS 3.3.

I’m a new developer in the OJS platform and also becoming familiar with the Laravel MVC architecture. Any guidance would be appreciated!

Hi @asiam

If you’re planning on running this via the CLI, then maybe the Quick Submit plugin is not the way to go. The QuickSubmitForm needs the $request object (which is built by the web request and therefore does not exist in the context of the CLI) to pull in all of the form data via methods like readInputData as part of the metadata implementation classes associated with a submission object.

If you’re working with parsed XML and galley files you may want to build something that works off of the importexport plugin framework. Those plugins are designed to run from the CLI. An example of one of these is our BePress import plugin that is here

It expects a directory structure containing an XML file and some galleys and then iterates through that and builds the submissions in the OJS installation.

Best
Jason

1 Like

Thank you so much @jnugent. I’ll be be looking into this.