package EPrints::Plugin::Screen::EPMC::Manipulate_Workflow_Ex; @ISA = ( 'EPrints::Plugin::Screen::EPMC' ); use strict; # Make the plug-in 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} = "Manipulate_Workflow_Ex"; 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}; my $filename = $repo->config( "config_path" )."/workflows/eprint/default.xml"; # Gap for the stuff to be defined we need to add my $xml = ' Publisher Details '; EPrints::XML::add_to_xml( $filename, $xml, $self->{package_name} ); #our matching types my @types = ( "map" ); #the stages my @stages = ( "map_stage" ); EPrints::Workflow::add_workflow_flow( $repo, $filename, $self->{package_name}, \@types, \@stages ); my $namedset = EPrints::NamedSet->new( "eprint",repository => $repo ); # Add a new option (string type, offset) $namedset->add_option( "map", $self->{package_name} ); $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 ); my $repo = $self->{repository}; my $filename = $repo->config( "config_path" )."/workflows/eprint/default.xml"; EPrints::XML::remove_package_from_xml( $filename, $self->{package_name} ); my $namedset = EPrints::NamedSet->new( "eprint",repository => $repo ); $namedset->remove_option( "map", $self->{package_name} ); $self->reload_config if !$skip_reload; } 1;