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
Building a DataSet
(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!
==Build a screen to move an object to the archive== Now that our we have our dataset we should move things into it. We do this by building a screen plugin which can set the eprint_status field to "dark_archive". Some simple code is bellow. Some obvious expansions to this code would be to change the allow_move_dark_archive method so that it uses roles to check if a user is allowed to move items into the dark archive. You may also want to add an icon for the plugin. As in previous excercises you will need to add the appropriate phrases. <pre> package EPrints::Plugin::Screen::EPrint::MoveToDarkArchive; @ISA = ( 'EPrints::Plugin::Screen::EPrint' ); use strict; sub new { my( $class, %params ) = @_; my $self = $class->SUPER::new(%params); # $self->{priv} = # no specific priv - one per action $self->{actions} = [qw/ move_dark_archive /]; $self->{appears} = [ { place => "eprint_editor_actions", action => "move_dark_archive", position => 400, }, { place => "eprint_item_actions", action => "move_dark_archive", position => 400, }, ]; #$self->{action_icon} = { move_dark_archive => "action_approve.png" }; #un-comment this line to use image button rather than text button return $self; } sub obtain_lock { my( $self ) = @_; return $self->could_obtain_eprint_lock; } sub about_to_render { my( $self ) = @_; $self->EPrints::Plugin::Screen::EPrint::View::about_to_render; } sub allow_move_dark_archive { my( $self ) = @_; return 0 unless $self->could_obtain_eprint_lock; return 1; } sub action_move_dark_archive { my( $self ) = @_; $self->{processor}->{eprint}->remove_static; $self->{processor}->{eprint}->set_value("eprint_status", "dark_archive"); $self->{processor}->{eprint}->commit; $self->add_result_message( 1 ); } sub add_result_message { my( $self, $ok ) = @_; if( $ok ) { $self->{processor}->add_message( "message", $self->html_phrase( "status_changed", status=>$self->{processor}->{eprint}->render_value( "eprint_status" ) ) ); } else { $self->{processor}->add_message( "error", $self->html_phrase( "cant_move", id => $self->{session}->make_text( $self->{processor}->{eprintid} ) ) ); } $self->{processor}->{screenid} = "EPrint::View"; } 1; </pre>
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)