Dear Devin,

> Is is possible to treat the DEMOART_FILE’s as the Main file [...]

Not 100% equally AFAIK. As a quick and dirty workaround, if you only want to 
visually 
represent "DEMOART_FILE" files in the same way as "Main" files are, you could 
modify the
bfe_fulltext.py BibFormat element to consider the "DEMOART_FILE" doctype as 
such:
https://github.com/inveniosoftware/invenio/blob/maint-1.2/modules/bibformat/lib/elements/bfe_fulltext.py#L304

This would change the display in several (but not all) parts of the Invenio 
interface. 
These two doctypes would internally still be considered as different ones 
though.
It is probably not the best idea to modify that file.

> [...] how would I actually change the DEMOART_FILE to Main?

The bibdocfile CLI `--set-doctype’ option should let you change the 
"DEMOART_FILE" doctype
to "Main" a posteriori:
https://documents.classe.cornell.edu/help/admin/howto-fulltext

I doubt that you want to change it manually for all submitted files, so I guess 
you will 
want to update the submission interface such that files are uploaded initially 
with the 
"Main" doctype instead. See below.

> How would I update the submission interface so that the first file uploaded 
> when creating the record is considered the Main file?

The answer will depend on how your submission workflow is set up. Let me first 
give some 
pointers to background information and concepts used in Invenio submission 
workflows (in 
the v1.x series).

The interesting concept to clarify here is the "doctype". It is an attribute of 
each file 
managed by Invenio, which lets you categorize uploaded documents according to 
your own 
needs. You could for example have a "Video" doctype, a "Slides" one, etc. If I 
remember 
correctly the only "hard-coded" convention regarding the doctype is that files 
with the 
"Main" doctype are displayed more prominently in the Invenio interface (via the 
bfe_fulltext.py and bfe_fulltext_mini.py BibFormat elements). The "Main" 
doctype is the
one you are interested in here.
https://documents.classe.cornell.edu/help/admin/websubmit-admin-guide#terminologydocumenttype

DEMOART_FILE is a doctype. Not the most meaningful one, right? Why is it so? 

That behavior is inherited from older versions of Invenio. Without getting into 
the 
details, it is important to note that by default doctypes correspond to the 
name of the 
HTML input element used to select the file on the WebSubmit submission form. So 
if you 
build your submission workflows on the basis of the demo submissions installed 
with 
Invenio, you will most probably end up with such unwanted doctypes for files in 
your 
repository.

How to change that?

There are different roads, depending on the way your submission is set up. 
Let’s consider 
the most basic scenario, where the file is uploaded with a WebSubmit "File 
Input" element, 
which translates to a basic HTML <input type="file" name="DEMOART_FILE" /> 
element, and 
the file is later attached via BibConvert configuration file. That scenario is 
described 
in details at:
https://documents.classe.cornell.edu/help/admin/websubmit-admin-guide#5.1

One could think of changing the name of the WebSubmit Input File element  to 
"Main", since 
the name of the element is being used as doctype. It is however more flexible 
to set an 
appropriate doctype when attaching the file via BibUpload, using the `FFT’ tag 
in the 
BibConvert template (point number 6 in the above guide):

    FFT::REPL(EOL,)---<datafield tag="FFT" ind1=" " ind2=" "><subfield 
code="a"><:curdir::curdir:>/files/DEMO_FILE/<:DEMO_FILE::DEMO_FILE:></subfield><subfield
 code="n">My File</subfield><subfield code="t">Main</subfield></datafield>

In this example the file uploaded via DEMO_FILE will be assigned a "Main" 
doctype, given 
the value specified in the subfield code "t":
https://documents.classe.cornell.edu/help/admin/bibupload-admin-guide#3.6

That is how one can customize the doctype of a submission configured in that 
way.

In case your file is uploaded via the "Move_Files_To_Storage" WebSubmit 
function instead 
of a BibConvert template, you would not have the possibility to configure the 
doctype 
without renaming the file input element (*):
https://documents.classe.cornell.edu/help/admin/websubmit-admin-guide#5.2
(* that might no longer be the case, as I can see a `paths_and_doctypes' 
parameter has 
been added to the "Move_Files_To_Storage" WebSubmit function:
https://github.com/inveniosoftware/invenio/blob/maint-1.2/modules/websubmit/lib/functions/Move_Files_to_Storage.py#L93
 )

In case your submission is set up using the "Create_Upload_Files_Interface" 
WebSubmit 
function (section 5.3 in the above guide) or the "Upload_File" WebSubmit 
element (section 
5.4), you would simply have to define which doctype are allowed to choose from 
when 
uploading the file (defaults to the one configured if only one choice is 
available).

You can see that the configurability of doctypes is tightly tied to the way 
your WebSubmit
workflows are designed. The WebSubmit documentation describes the pros and cons 
of these
different patterns. If I remember correctly each demo submission installed with 
Invenio 
showcases a different way of handling files. 

Voilà, that is all I can remember. I hope it already helps. Someone more 
actively involved 
in the project might take you a step further if necessary, and/or correct any 
inaccuracies
in my explanations.

Best regards
—-
Jérôme Zbinden

Reply via email to