package EPrints::Plugin::Screen::EPMC::Containers; @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} = "containers"; 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 $auto_js_written = 0; foreach my $langid ( @{$repo->config( "languages" )} ) { my $base_target_dir = $repo->config( "htdocs_path" )."/$langid"; my @static_dirs = $repo->get_static_dirs( $langid ); my $fn; eval { $fn = EPrints::Update::Static::update_auto_js( $repo, $base_target_dir, \@static_dirs ); }; if (defined $fn && $fn =~ m/auto.js$/) { $auto_js_written = 1; } } if ( 0 == $auto_js_written ) { $self->{processor}->add_message( "warning", $repo->html_phrase( "Plugin/Screen/EPMC/Containers:regen_warning")); } $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;