| | ###################################################################### |
---|
| | # |
---|
| | # Show EPrints modified or added in the past 7 days |
---|
| | # |
---|
| | ###################################################################### |
---|
| | # |
---|
| | # This file is part of GNU EPrints 2. |
---|
| | # |
---|
| | # Copyright (c) 2000-2004 University of Southampton, UK. SO17 1BJ. |
---|
| | # |
---|
| | # EPrints 2 is free software; you can redistribute it and/or modify |
---|
| | # it under the terms of the GNU General Public License as published by |
---|
| | # the Free Software Foundation; either version 2 of the License, or |
---|
| | # (at your option) any later version. |
---|
| | # |
---|
| | # EPrints 2 is distributed in the hope that it will be useful, |
---|
| | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| | # GNU General Public License for more details. |
---|
| | # |
---|
| | # You should have received a copy of the GNU General Public License |
---|
| | # along with EPrints 2; if not, write to the Free Software |
---|
| | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| | # |
---|
| | ###################################################################### |
---|
| | |
---|
| | use EPrints::Session; |
---|
| | use EPrints::EPrint; |
---|
| | use EPrints::SearchExpression; |
---|
| | |
---|
| | use strict; |
---|
| | my $session = new EPrints::Session; |
---|
| | exit( 0 ) unless( defined $session ); |
---|
| | |
---|
| | my $ds = $session->get_archive()->get_dataset( "archive" ); |
---|
| | my $page=$session->make_doc_fragment(); |
---|
| | |
---|
| | $page->appendChild( $session->html_phrase( "cgi/latest:intro" ) ); |
---|
| | |
---|
| | my $citation = $session->get_archive->get_conf( "latest_citation" ); |
---|
| | |
---|
| | my $seensome = 0; |
---|
| | for( my $d=0; $d<7; ++$d ) |
---|
| | { |
---|
| | my $t = time-60*60*24*$d; |
---|
| | my $searchexp = new EPrints::SearchExpression( |
---|
| | session => $session, |
---|
| | dataset => $ds ); |
---|
| | |
---|
| | |
---|
| | my $date = EPrints::Utils::get_datestamp( $t ); |
---|
| | $searchexp->add_field( $ds->get_field( "datestamp" ), $date ); |
---|
| | |
---|
| | $searchexp->perform_search(); |
---|
| | |
---|
| | if( $searchexp->count() ) |
---|
| | { |
---|
| | $seensome = 1; |
---|
| | |
---|
| | my $day; |
---|
| | if( $d == 0 ) |
---|
| | { |
---|
| | $day = $session->html_phrase( "cgi/latest:today" ); |
---|
| | } |
---|
| | elsif( $d == 1 ) |
---|
| | { |
---|
| | $day = $session->html_phrase( "cgi/latest:yesterday" ); |
---|
| | } |
---|
| | else |
---|
| | { |
---|
| | my $dow = (localtime($t))[6]; |
---|
| | $day = $session->html_phrase( "cgi/latest:day_".$dow ); |
---|
| | } |
---|
| | |
---|
| | my $h2= $session->make_element( "h2" ); |
---|
| | $h2->appendChild( $day ); |
---|
| | $page->appendChild( $h2 ); |
---|
| | |
---|
| | $searchexp->map( sub{ |
---|
| | my( $session, $dataset, $item, $info ) = @_; |
---|
| | |
---|
| | my $p = $session->make_element( "p" ); |
---|
| | $p->appendChild( $item->render_citation_link( $citation ) ); |
---|
| | $page->appendChild( $p ); |
---|
| | } ); |
---|
| | |
---|
| | } |
---|
| | $searchexp->dispose(); |
---|
| | } |
---|
| | unless( $seensome ) |
---|
| | { |
---|
| | $page->appendChild( $session->html_phrase( "cgi/latest:none" ) ); |
---|
| | } |
---|
| | |
---|
| | $page->appendChild( $session->render_ruler() ); |
---|
| | |
---|
| | $page->appendChild( $session->html_phrase( "general:frontpage_link" ) ); |
---|
| | |
---|
| | my $title = $session->html_phrase( "cgi/latest:title" ); |
---|
| | $session->build_page( $title, $page, "latest" ); |
---|
| | $session->send_page(); |
---|
| | |
---|
| | $session->terminate; |
---|
| | |
---|