###################################################################### # # 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; use strict; my $session = new EPrints::Session; exit( 0 ) unless( defined $session ); my $ds = $session->get_repository->get_dataset( "archive" ); my $page=$session->make_doc_fragment(); $page->appendChild( $session->html_phrase( "cgi/latest:intro" ) ); my $citation = $session->get_repository->get_conf( "latest_citation" ); my $seensome = 0; for( my $d=0; $d<7; ++$d ) { my $t = time-60*60*24*$d; my $search = new EPrints::Search( filters => [ { meta_fields=>[ 'metadata_visibility' ], value=>'show', match=>'EX', describe=>0, }, ], custom_order => "-datestamp", session => $session, dataset => $ds, ); my $date = EPrints::Time::get_iso_date( $t ); $search->add_field( $ds->get_field( "datestamp" ), $date ); my $list = $search->perform_search(); if( $list->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 ); my $type = $session->get_citation_type( $ds, $citation ); my $container; if( $type eq "table_row" ) { $container = $session->make_element( "table", class=>"ep_latest_list" ); } else { $container = $session->make_element( "div", class=>"ep_latest_list" ); } $page->appendChild( $container ); my $n = 1; $search->map( sub{ my( $session, $dataset, $item, $info ) = @_; my $row = $item->render_citation_link( $citation, n => [$n++, "INTEGER"] ); if( $type eq "table_row" ) { $container->appendChild( $row ); } else { my $div = $session->make_element( "div", class=>"ep_latest_result" ); $div->appendChild( $row ); $container->appendChild( $div ); } } ); $page->appendChild( $session->render_ruler() ); } $search->dispose(); } unless( $seensome ) { $page->appendChild( $session->html_phrase( "cgi/latest:none" ) ); } $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;