package EPrints::Plugin::Screen::EPMC::REF2014; @ISA = ( 'EPrints::Plugin::Screen::EPMC' ); use strict; sub new { my( $class, %params ) = @_; my $self = $class->SUPER::new( %params ); $self->{actions} = [qw( enable disable )]; $self->{disable} = 0; # always enabled, even in lib/plugins $self->{package_name} = "ref2014"; return $self; } =item $screen->action_enable( [ SKIP_RELOAD ] ) Enable the L for the current repository. If SKIP_RELOAD is true will not reload the repository configuration. =cut sub action_enable { my( $self, $skip_reload ) = @_; $self->SUPER::action_enable( $skip_reload ); my $repo = $self->{repository}; # First check that this subject tree doesn't already exist... my $ds = $repo->dataset( 'subject' ); my $test_subject_id = $ds->dataobj( 'ref2014_uoas' ); if( !defined $test_subject_id ) { my $filename = $repo->config( 'archiveroot' ).'/cfg/subjects_uoa'; if( -e $filename ) { my $plugin = $repo->plugin( 'Import::FlatSubjects' ); my $list = $plugin->input_file( dataset => $repo->dataset( 'subject' ), filename=>$filename ); $repo->dataset( 'subject' )->reindex( $repo ); } # else # { # print STDERR "\nError: '$filename' does not exist..."; # } } $self->reload_config if !$skip_reload; } =item $screen->action_disable( [ SKIP_RELOAD ] ) Disable the L for the current repository. If SKIP_RELOAD is true will not reload the repository configuration. =cut sub action_disable { my( $self, $skip_reload ) = @_; $self->SUPER::action_disable( $skip_reload ); $self->reload_config if !$skip_reload; } 1;