Where Plugins Appear

From EPrints Documentation
Jump to: navigation, search

When you create a screen plugin in EPrints there are a set of locations where the plugin can appear.

You can set the location at which a screen is rendered in the new method of your plugin:

        $self->{appears} = [
                {
                        place => "item_tools",
                        position => 100,
                }
        ];

Note that this is an array so it is possible to render your screen in multiple places. You can also initiate a specific action if the button is clicked in a specific area. In the example below when the link in the key_tools area (top bar next to manage deposits) then the "create" action of our screen plugin is called.

        $self->{appears} = [
                {
                        place => "key_tools",
                        action => "create",
                        position => 100,
                },
                {
                        place => "item_tools",
                        position => 100,
                }
        ];

The position key of the hash tells EPrints what order to render the various screens in the place specified. For example if 10 plugins wish to render in the key_tools area the order they appear is calculated by comparing their position values. Lowest numbers are ordered first. In the event of two position numbers being the same behaviour is strictly undefined. In practice the first plugin loaded will generally have priority. For all screens shipped with EPrints the default positions are always in multiples of 100 where the first plugin in a list is number 100. Note that it is possible for the value of position to be negative but it is not recommend that you do this. In general aim to make your position numbers end in a zero, it helps people who have very obscure set ups.

Customising where an existing plugin appears

You can overwrite or add the place a installed plugin appears in cfg.d. You can see an example in plugins.pl. Note you can also use this to customise plugins you have written.

Places

A "place" is really just a string. You can create your own arbitrary "place" and assign plugins to render there. You then render that place. There are a few different functions for rendering a place which dictate how this happens.

$plugin->render_action_list( "my_place" ); - render the plugins which "appear" in the "place" my_place as an unordered list of links

$plugin->render_action_list_bar( "my_place" ); - render the plugins which "appear" in the "place" my_place as a table of buttons

$plugin->render_action_list_icons( "my_place" ); - render the plugins which "appear" in the "place" my_place as a table of icons if the plugin has an icon defined or a button if an icon is not defined

Some of the available list of default locations in eprints: (note: you can render these in your own code using the methods above)

admin_actions - the misc tab of the action screen
admin_actions_config - the config tab of the admin screen
admin_actions_editorial - the editorial tab of the admin screen
admin_actions_system - the system tab of the admin screen
dataobj_actions
dataobj_tools
dataobj_view_actions
dataobj_view_tabs
eprint_actions
eprint_actions_bar_archive
eprint_actions_bar_buffer
eprint_actions_bar_deletion
eprint_actions_bar_inbox
eprint_editor_actions
eprint_item_actions - the icons on the right hand size of an item in manage deposits 
eprint_review_actions
eprint_summary_page_actions - actions rendered on the bottom of the eprint abstract page
eprint_view_tabs
import_item_actions
inputform_upload_method
item_tools - the tools which appear at the top of the manage deposits screen (next to New EPrint)
key_tools - the menu along the top of the page where manage deposits and such like appears
other_tools - tools after key_tools which rendered into a pull down menu.
lock_tools
saved_search_actions
summary_right - on the right hand side of an abstract page (default location for Screen::EPrint::Box plugins)
summary_left - left hand side of abstract page
summary_top - top of abstract page
summary_bottom - bottom of abstract page
upload_methods
user_actions - the area on a users profile page where "modify profile" appears