EPrints Technical Mailing List Archive

Message: #08470


< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First

Re: [EP-tech] Static Page - Log In


Hi James,

I think the way to do this is unfortunately a bit of a hack you want to create a simple Screen Plugin like the one below:

package EPrints::Plugin::Screen::PrivateNotice;
use EPrints::Plugin::Screen;
@ISA = ( 'EPrints::Plugin::Screen' );
use strict;
sub new
{
        my( $class, %params ) = @_;

        my $self = $class->SUPER::new(%params);
        return $self;
}
sub can_be_viewed
{
        my( $self ) = @_;
        return $self->allow( "general" );
}
sub render_title
{
        my( $self ) = @_;
        my $name = "User";
        return $self->html_phrase( "title" );
}
sub render
{
        my( $self ) = @_;
        return $self->html_phrase( "content" );
}
1;

Then create a cgi page called private_notice:

use EPrints;
use strict;
my $eprints = EPrints->new;
my $repository = $eprints->current_repository();
exit( 0 ) unless( defined $repository );
EPrints::ScreenProcessor->process(
    session => $repository,
    screenid => "PrivateNotice",
);
exit( 0 );

Then create the phrases in a local phrase file.  I think they will be under  Plugin/Screen/PrivateNotice:title and Plugin/Screen/PrivateNotice:content.  The reason for the cgi page as well as the screen plugin is to give a more user-friendly URL but you could just link to the Screen plugin URL.  You could create additional private notice pages by extending the Screen plugin with just something like:

package EPrints::Plugin::Screen::NewPrivateNotice;
use EPrints::Plugin::Screen::PrivateNotice;
@ISA = ( 'EPrints::Plugin::Screen::PrivateNotice' );
use strict;
sub new
{
        my( $class, %params ) = @_;

        my $self = $class->SUPER::new(%params);
        return $self;
}

and then setting some more local phrases for title and content for this Screen Plugin.

Regards

David Newman

On 25/01/2021 09:17, James Kerwin via Eprints-tech wrote:
CAUTION: This e-mail originated outside the University of Southampton.
Hi All,

Hope we're all happy and healthy.

I've been given a task and one option to complete it is to display information on a static page in EPrints. Due to the potentially sensitive nature of the data I was wondering if it's possible to have a static page in EPrints that requires the user to be logged in to EPrints to see it?

I've had a quick look around and looked at all my ".xpage" files and I have no examples. I feel like it isn't possible, but thought it would be best to ask.

If it isn't possible I have some other approaches to take. They will just take longer and my brain is already a bit scrambled after working out the LibCal API.

Thanks,
James

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/

Virus-free. www.avg.com