EPrints Technical Mailing List Archive

Message: #04469


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

[EP-tech] Re: Edit 'Latest Additions' page


Hi Mike

See line 73 of the cgi/latest script -- there's a block that looks like this:


else
{
my $dow = (localtime(time-$d*86400))[6];
$day = $session->html_phrase( "cgi/latest:day_".$dow );
}

If you look at the documentation for localtime ( http://perldoc.perl.org/functions/localtime.html ), you'll see that it returns an array of 'bits' of the date (with the weekday at index 6, which is what is collected above).

Something like this should work:

my $date_string = EPrints::Time::human_time($time-$d*86400);

OR

my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time-$d*86400);
my $date_string = join('/', ($mday, $mon, $year)); #or however you want to build your date string.

...then replicate the line that passes this value to a phrase (you should probably create a new one).

(note that I've just typed these code fragments into my email, so they may not even compile)

As a best practice, you should copy the script and modify in a different file (call it latest-6-months or something), and then link to it from your repository.

--
Adam Field
Business Relationship Manager and Community Lead
EPrints Services

I am currently not working in the UK.  Due to timezone differences (GMT -9) email responses may take longer.


On 10 Jul 2015, at 04:42, Michael Street <mstreet@yorku.ca> wrote:

Hi,

Thanks for the help everyone.  Is it possible to have it show the full date of the submission as the section title, rather than just the day?  We're going back 6 months so a proper date is needed.

Thanks,
Mike.


-----eprints-tech-bounces@ecs.soton.ac.uk wrote: -----
To: "'eprints-tech@ecs.soton.ac.uk'" <eprints-tech@ecs.soton.ac.uk>
From: John Salter
Sent by: eprints-tech-bounces@ecs.soton.ac.uk
Date: 07/07/2015 05:08AM
Subject: [EP-tech] Re: Edit 'Latest Additions' page

Hi Mike,

The code that is called is ~/cgi/latest

 

Instead of editing the copy there, make a copy:

~/archives/ARCHIVEID/cgi/latest

 

Look for the line:

my $date = time() - 86400 * 7; # 7 days

you can change that to suit.

You’ll also need to change the line that starts:

for( my $d=0; $d<7; ++$d )

- which steps through the number of days and creates a section for each one.

 

There is also the ~/cgi/latest_tool script.

This reads the ‘latest_tool_modes’ from the archive config, which my default is in ~/archives/ARCHIVEID/cfg/cfg.d/latest_tool.pl

You can do some useful things with this – as it allows you to specify a specific citation style to use, and to create a named mode that can be a filtered subset of items – e.g. you could create a subject- or division-specific ‘latest’ list – and create a citation style that embeds Altmetrics in it.

 

Cheers,

John

 

 

 

 

From: eprints-tech-bounces@ecs.soton.ac.uk [mailto:eprints-tech-bounces@ecs.soton.ac.uk] On Behalf Of Michael Street
Sent: 06 July 2015 21:55
To: eprints-tech@ecs.soton.ac.uk
Subject: [EP-tech] Edit 'Latest Additions' page

 

Hi,

 

Can someone point me to where I can edit the 'Latest Additions' to configure it go back further in time?


Thanks,

Mike

*** 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/
*** EPrints developers Forum: http://forum.eprints.org/