Jump to content
Wiki Home
EPrints Home
Bazaar
Files
Main menu
Main menu
move to sidebar
hide
Navigation
Front Page
EPrints 3 Manual
EPrints Training Course
EPrints Glossary
Installing EPrints
How-to Configure EPrints
EPrints 3.2+ API
EPrints 3 Reference
EPrints Plugins
Wiki
All categories
Recent changes
Main Page
Help
EPrints Documentation
Search
Search
Appearance
Log in
Request account
Personal tools
Log in
Request account
Pages for logged out editors
learn more
Contributions
Talk
Editing
How to make a Screen for the Admin Section
Page
Discussion
British English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
[[Category:Howto]] [[Category:Plugins]] [[Category:User Roles]] Known to work for EPrints 3.2+ == The basic structure == To make a Screen plugin, you create a Perl Module in <code>[eprints]/archives/<ARCHIVE_ID>/cfg/plugins/EPrints/Plugin/Screen/</code> with the following basic structure <pre> package EPrints::Plugin::Screen::Mypackage; use EPrints::Plugin::Screen; @ISA = ( 'EPrints::Plugin::Screen' ); use strict; sub new { my( $class, %params ) = @_; my $self = $class->SUPER::new(%params); $self->{priv} = undef; $self->{appears} = [ { place => "admin_actions_editorial", # see notes below position => 1450, }, ]; return $self; } sub can_be_viewed { my( $self ) = @_; return $self->allow( "my/conf/value" ); } sub render { my( $self ) = @_; my $session = $self->{session}; my $user = $session->current_user; my $p = $session->make_doc_fragment; # create page contents: my $h = $session->make_element( "h3" ); $h->appendChild($session->make_text( "Look up organisations known to OA-RJ" )); $p->appendChild($h); return $p } </pre> In theory, one should be able to have multiple bits of functionality (view a little, view a lot, edit, etc), simply by testing for different values of <code>$self->allow( "my/conf/value" )</code> == The locations == Where the link for the page appears is defined by <code>$self->{appears}->[''n'']->{place}</code> (in the <code>new</code> function.) We are defining a screen that appears in the "admin" area, and there are 4 tabs defined within the admin screen: * admin_actions_editorial * admin_actions_system * admin_actions_config * admin_actions_misc Other places the link can appear are * unknown to me == Making the page appear == There are three steps to making a page appear: 1. The screen plugin should test for ''view-ability'' <pre> # in EPrints::Plugin::Screen::Mypackage sub can_be_viewed { my( $self ) = @_; return $self->allow( "my/conf/value" ); } </pre> 2 The ''User'' DataObject needs to list the privilege under a role: <pre> # In EPrints::DataObj::User foo_bar => [ "my/view/value", ], foo_baz => [ "my/view/value", "my/conf/value", ], </pre> 3 The user_roles.pl file needs to make the role available to the user-type: <pre> # in [eprints]/archive/<ARCHIVE_ID>/cfg/cfg/user_roles.pl $c->{user_roles}->{user} = [qw{ // truncated foo_bar }], $c->{user_roles}->{admin} = [qw{ // truncated foo_baz }], </pre> Return to the main [[Screen_Plugins]] page. == See Also == * [[Listings of User Roles and Privileges]] - A reference to role and privileges and what they allow a user to do. * [[User_roles.pl|user_roles.pl]] - Describe the configuration file and how it may be edited/extended to modify/add new roles and privileges.
Summary:
Please note that all contributions to EPrints Documentation may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
EPrints Documentation:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)