|
$c->{browse_views} = [ |
|
# ... |
|
|
|
{ |
|
id => "person", |
|
menus => [ |
|
{ |
|
fields => [ "creators_id", "editors_id" ], |
|
new_column_at => [ 1, 1 ], |
|
mode => "sections", |
|
allow_null => 0, |
|
open_first_section => 1, |
|
group_range_function => "EPrints::Update::Views::cluster_ranges_30", |
|
grouping_function => "EPrints::Update::Views::group_by_a_to_z", |
|
# returns a HASHREF of { person_id=>count(eprintid), ... } |
|
size_function => sub { |
|
my( $repo, $filters ) = @_; |
|
my $sql = " |
|
SELECT `d`.`person_id`, COUNT(DISTINCT `d`.`eprintid`) FROM |
|
( |
|
SELECT `creators_id` AS `person_id`, `eprintid` |
|
FROM `eprint_creators_id` |
|
WHERE `creators_id` IS NOT NULL AND `creators_id` <> '' |
|
UNION |
|
SELECT `editors_id` AS `person_id`, `eprintid` |
|
FROM `eprint_editors_id` |
|
WHERE `editors_id` IS NOT NULL AND `editors_id` <> '' |
|
) AS `d` |
|
JOIN `eprint` ON `d`.`eprintid` = `eprint`.`eprintid` |
|
WHERE `eprint`.`eprint_status` = 'archive' |
|
AND `eprint`.`metadata_visibility` = 'show' |
|
AND `eprint`.`replacedby` IS NULL |
|
AND NOT EXISTS (SELECT 1 FROM `eprint` AS `e` WHERE `e`.`succeeds` = `eprint`.`eprintid`) |
|
GROUP BY `person_id`"; |
|
my $sth = $repo->get_database->prepare( $sql ); |
|
$repo->get_database->execute( $sth, $sql ); |
|
my %results; |
|
while( my @row = $sth->fetchrow_array ) |
|
{ |
|
my( $p, $n ) = @row; |
|
$results{ $p } = $n; |
|
} |
|
$sth->finish; |
|
return \%results; |
|
}, |
|
}, |
|
], |
|
order => "-date/title", |
|
variations => [ "type", "date;truncate=4,reverse" ], |
|
citation => "view", |
|
max_menu_age => 7 * 24 * 60 * 60, |
|
max_list_age => 7 * 24 * 60 * 60, |
|
}, |
|
|
|
# ... |
|
]; |