[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] ScreenProcessor.pm and Admin Screen Messages



Hi john,

I'll take a look today and attempt to use that method instead. I've tried
to understand pins since I first started looking at EPrints last year, but
never been able to fully understand them. Which is frustrating because they
aren't a particularly difficult thing.

I would have looked yesterday, but I managed to totally break my test
server and I spent the day trying not to have a heart attack due to panic
(it's all fixed now).

Thanks,
James

On Tue, Aug 13, 2019 at 12:39 PM John Salter via Eprints-tech <
eprints-tech at ecs.soton.ac.uk> wrote:

> All good :o)
>
> Although I probably should have said 'use a phrase' - and linked to a
> phrase where the link URL is inserted via a pin e.g.
>
> <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprints%2Feprints%2Fblob%2F3.3%2Flib%2Flang%2Fen%2Fphrases%2Fsystem.xml%23L3393-L3395&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C15684680b25f441f4e0e08d7216b550e%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=6UawwHVMys%2Bgnr46kk5GRUAdVlEnNOwAqz39xQL698g%3D&amp;reserved=0>
>
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprints%2Feprints%2Fblob%2F2d42b2be54004bf3db6881a6d893d39c7a7f909f%2Flib%2Flang%2Fen%2Fphrases%2Fsystem.xml%23L3392-L3394&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C15684680b25f441f4e0e08d7216b550e%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=t6FOC6pADHPl9Bs5HRs3t6nXEcbK3qDE1oIppBawwdU%3D&amp;reserved=0
> <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprints%2Feprints%2Fblob%2F2d42b2be54004bf3db6881a6d893d39c7a7f909f%2Flib%2Flang%2Fen%2Fphrases%2Fsystem.xml%23L3392-L3394&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C15684680b25f441f4e0e08d7216b550e%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=t6FOC6pADHPl9Bs5HRs3t6nXEcbK3qDE1oIppBawwdU%3D&amp;reserved=0>
>  and
>
> https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprints%2Feprints%2Fblob%2F2d42b2be54004bf3db6881a6d893d39c7a7f909f%2Fperl_lib%2FEPrints%2FPlugin%2FScreen%2FEPrint%2FRemoveWithEmail.pm%23L129-L130&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C15684680b25f441f4e0e08d7216b550e%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=vGfhBlOgmUy6kgz%2F6Nu0DwzVa%2BsCTzL0gdUqGdqQkDw%3D&amp;reserved=0
> <https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Feprints%2Feprints%2Fblob%2F2d42b2be54004bf3db6881a6d893d39c7a7f909f%2Fperl_lib%2FEPrints%2FPlugin%2FScreen%2FEPrint%2FRemoveWithEmail.pm%23L129-L130&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C15684680b25f441f4e0e08d7216b550e%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=vGfhBlOgmUy6kgz%2F6Nu0DwzVa%2BsCTzL0gdUqGdqQkDw%3D&amp;reserved=0>
>
> Cheers,
> John
> ------------------------------
> *From:* eprints-tech-bounces at ecs.soton.ac.uk <
> eprints-tech-bounces at ecs.soton.ac.uk> on behalf of James Kerwin via
> Eprints-tech <eprints-tech at ecs.soton.ac.uk>
> *Sent:* 13 August 2019 09:32
> *To:* John Salter <J.Salter at leeds.ac.uk>
> *Cc:* eprints-tech at ecs.soton.ac.uk <eprints-tech at ecs.soton.ac.uk>
> *Subject:* Re: [EP-tech] ScreenProcessor.pm and Admin Screen Messages
>
> Ahhh thanks John.
>
> I'm such a fool! I already had the code I needed from something I did the
> other month. I just thought I needed to do something different because I
> was trying to add $frag to add_message rather than just returning it to be
> added to $page.
>
> There are probably a few unnecessary Perl variables here and I need to
> replace certain things with their actual parts, but it works:
>
> my $repo = $self->{session};
>
> my $frag = $repo->xml->create_document_fragment;
>
>
> my $chunk = $self->{session}->make_element( "div", id => "ep_messages" );
>
> my $searchlink = $self->{session}->make_element( "a", class=>
> "search_link", href=>$uri, target=>"_blank" );
>
> $searchlink->appendChild($repo->make_text("bleep bloop blop"));
>
>
> $chunk->appendChild( $searchlink );
>
> $frag->appendChild( $chunk );
>
>
> $self->{processor}->add_message(
>
> "message", $frag);
>
> [image: image.png]
>
> What a relief that I don't need to go change scary things!
>
> Thanks,
> James
>
> On Tue, Aug 13, 2019 at 8:16 AM John Salter <J.Salter at leeds.ac.uk> wrote:
>
> Hi James,
> I think you've got all the right parts - you just need to join them all
> together:
> - create the link
> - create the text
> - append the text to the link
> - append the link to the message
>
> Cheers,
> John
> ------------------------------
> *From:* eprints-tech-bounces at ecs.soton.ac.uk <
> eprints-tech-bounces at ecs.soton.ac.uk> on behalf of James Kerwin via
> Eprints-tech <eprints-tech at ecs.soton.ac.uk>
> *Sent:* 12 August 2019 14:57:39
> *To:* eprints-tech at ecs.soton.ac.uk <eprints-tech at ecs.soton.ac.uk>
> *Subject:* [EP-tech] ScreenProcessor.pm and Admin Screen Messages
>
> Hi All,
>
> I have a button on the admin screen that does something when clicked. Then
> at the top of the screen a message appears upon completion to provide a url
> for the user to follow (or that is the plan). It usually present a plain
> text message, but I want a clickable link. At the moment users would need
> to copy the message text and paste it into the address bar.
>
> At the moment I can have either text or a link that can't be seen or
> clicked, but shows up when you inspect the page.
>
> [image: image.png]
>
> Here is my code that I've adapted (only the bit in bold is really
> relevant):
>
> sub add_result_message
>
> {
>
>         my( $self, $ok ) = @_;
>
>
>         if( $ok )
>
>         {
>
>                 #$self->{processor}->add_message( "message",
>
>                         #$self->html_phrase( "aam_link" ) );
>
> #$self->{processor}->add_message(
>
> #"message",
>
> #$self->{repository}->make_text( "Please go to https://eur03.safelinks.protection.outlook.com/?url=www.google.co.uk&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C15684680b25f441f4e0e08d7216b550e%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=12nGQcU%2B07H%2FG342WaIALC3Yzp%2FB7woLqc9dNmBvhGQ%3D&amp;reserved=0
> <https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.google.co.uk&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C15684680b25f441f4e0e08d7216b550e%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=xXyj0JFAx7HQWlRjdRefk6ofB8WK7yMKmK9DzWXMsXQ%3D&amp;reserved=0>
> to access the AAM Updates.")
>
> #);
>
> #my $messagelink =
>
> *my $uri = "https://eur03.safelinks.protection.outlook.com/?url=www.google.co.uk&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C15684680b25f441f4e0e08d7216b550e%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=12nGQcU%2B07H%2FG342WaIALC3Yzp%2FB7woLqc9dNmBvhGQ%3D&amp;reserved=0
> <https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.google.co.uk&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C15684680b25f441f4e0e08d7216b550e%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=xXyj0JFAx7HQWlRjdRefk6ofB8WK7yMKmK9DzWXMsXQ%3D&amp;reserved=0>";*
>
> *$self->{processor}->add_message( "message",*
>
> *$self->{repository}->make_text( *
>
> *$self->{session}->render_link( $uri ))*
>
> );
>
>         }
>
>
> Is there a way that I can alter this to show a clickable text link or am I
> going to need to go further down the EPrints Rabbit Hole? My alternative
> approach is to alter render_messages in ScreenProcessor.pm, but I don't
> really want to do that and I also don't know how to make a local archive
> copy of this file either as it's a few levels up from the plugins directory.
>
> Any suggestions or alternative approaches are very welcome.
>
> Thanks,
> James
>
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C15684680b25f441f4e0e08d7216b550e%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=Xr06LJ4xpIjTdtjsphJ49HAMr0ug4hFaBbN36DXcqJY%3D&amp;reserved=0
> *** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C15684680b25f441f4e0e08d7216b550e%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=znN%2FLjihWe%2BIvy84NAqxkJoH6nb2DrWzZm7BgZMUSFE%3D&amp;reserved=0
> *** EPrints developers Forum: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fforum.eprints.org%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C15684680b25f441f4e0e08d7216b550e%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=eYEcpEd1edrW%2FOwCZUJd3zmWfgETzffQBZ%2FMFu4ZNP0%3D&amp;reserved=0
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20190815/f85661bc/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 17378 bytes
Desc: not available
Url : http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20190815/f85661bc/attachment-0002.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 20494 bytes
Desc: not available
Url : http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20190815/f85661bc/attachment-0003.png