How to add the structure of an organisation

From EPrints Documentation
Jump to: navigation, search

This page applies to eprints version 2.* and not to version 3 (ep2)

all the files I discuss are in /opt/eprints2/archives/YOURID/cfg/


1. modify subjects to add your new tree, with a top level with the id "groups" and its parent set to be "ROOT" (similar to the subjects node). This is the top node of your new subjects tree.

2. add the new field to eprints objects (ArchiveMetadataFieldsConfig.pm):

       { name => "groups", type=>"subject", top=>"groups", multiple => 1,
               browse_link => "groups",
               render_input=>\&EPrints::Extras::subject_browser_input },

for reference, that all means

name = id of the field
type = type (hierarchical subject)
multiple = you can select more than one value at once
top = the top node in the tree
render_input = use the clever subject input, rather than just a big pull-down menu
browse_link = link values in this to pages in /view/groups/ (which we'll make in a minute)

Now run erase_archive & create_tables (assuming you've no live data, otherwise it's a bit harder). You may also need to run import_subjects and the other scripts mentioned in the ['creating an archive'] documentation.

3. add a human readable description for it: edit phrases-en.xml

   <ep:phrase ref="eprint_fieldname_groups">Groups</ep:phrase>
   <ep:phrase ref="eprint_fieldhelp_groups">add some relevant help for selecting groups here!</ep:phrase>
   <ep:phrase ref="metapage_title_groups">Groups</ep:phrase>
   <ep:phrase ref="viewname_eprint_groups">Groups</ep:phrase>

(the 3rd one is the title for the page on the input form, also called "groups", the 4th is the name which appears on the /view/ pages)

4. add the field to each type of eprint edit metadata-types.xml each time you find

     <page name="subjects" />
     <field name="subjects" required="yes" />


add below or before, which ever you prefer,

     <page name="groups" />
     <field name="groups" required="yes" />

5. add it to the "abstract" pages: edit ArchiveRenderConfig.pm find:

       # Subjects...
       $table->appendChild( _render_row(
               $session,
               $session->html_phrase( "eprint_fieldname_subjects" ),
               $eprint->render_value( "subjects" ) ) );


add below or above or nearby:


       # Groups...
       $table->appendChild( _render_row(
               $session,
               $session->html_phrase( "eprint_fieldname_groups" ),
               $eprint->render_value( "groups" ) ) );

6. add it to the browse /view/ section: Edit ArchiveConfig.pm Add:

       { id=>"groups", fields=>"groups", order=>"-date_effective/title", hideempty=>1 }

7. Add it to the advanced search screen: Edit ArchiveConfig.pm Look for:

       $c->{search}->{advanced} =
       {
       search_fields => [
               { meta_fields => [ $EPrints::Utils::FULLTEXT ] },
               { meta_fields => [ "title" ] },
               { meta_fields => [ "creators" ] },
               { meta_fields => [ "abstract" ] },
               { meta_fields => [ "keywords" ] },
               { meta_fields => [ "subjects" ] },
               { meta_fields => [ "type" ] },
               { meta_fields => [ "depts" ] },
               { meta_fields => [ "editors" ] },
               { meta_fields => [ "ispublished" ] },
               { meta_fields => [ "refereed" ] },
               { meta_fields => [ "publication" ] },
               { meta_fields => [ "date_effective" ] }
       ],

Add a line to the list (at the point you want the new list to appear) :

               { meta_fields => [ "groups" ] },