$type_stats->{$type}++;
- my @types = split(/\s+/, $type);
+ my @types = split(/[\s\/]+/, $type);
foreach my $type ( @types ) {
+ my $type = substr($type,0,3);
$type_stats->{_count_each_type}->{$type}++;
if ( $type =~ m/(edt|trl|com|ctb)/ ) {
- push @{ $authors->{$authid}->{sec}->{ $category } }, $row->{biblionumber};
+ push @{ $authors->{$authid}->{__sec}->{ $category } }, $row->{biblionumber};
push @{ $authors->{$authid}->{$type}->{ $category } }, $row->{biblionumber};
$type =~ s/(com|ctb)/_ostalo/;
push @{ $authors->{$authid}->{$type}->{ $category } }, $row->{biblionumber};
}
}
+my @toc_type_label = (
+'aut' => 'Primarno autorstvo',
+'edt' => 'Uredništva',
+'trl' => 'Prijevodi',
+'_ostalo' => 'Ostalo',
+);
+
sub count_author_years {
my $years = shift;
my ($authid) = @_;
foreach my $type ( keys %{ $authors->{$authid} } ) {
+ next if $type =~ m/^_/;
foreach my $category ( keys %{ $authors->{$authid}->{$type} } ) {
- foreach my $biblionumber ( @{ $authors->{$authid}->{$type}->{$category} } ) {
+ foreach my $biblionumber ( unique_biblionumber @{ $authors->{$authid}->{$type}->{$category} } ) {
$years->{ $biblio_year->{ $biblionumber } }->{ $type . '-' . $category }++;
}
}
return $years;
}
-my @toc_type_label = (
-'aut' => 'Primarno autorstvo',
-'edt' => 'Uredništva',
-'trl' => 'Prijevodi',
-'_ostalo' => 'Ostalo',
-);
-
sub html_year_selection {
my $fh = shift;
my @authids = @_;
+ debug 'html_year_selection authids=', [ @authids ];
+
print $fh qq|<span id="years">Godine:\n|;
my $type_cat_count = {};
my $years;
$years = count_author_years( $years, $authid );
}
+ debug 'years' => $years;
+
foreach my $year ( sort { $b <=> $a } keys %$years ) {
print $fh qq|<label><input name="year_selection" value="$year" type=checkbox onClick="toggle_year($year, this)" checked="checked">$year</label> \n|;
foreach my $type_cat ( keys %{ $years->{$year} } ) {
|;
+ debug 'type_cat_count' => $type_cat_count;
+
# TOC
print $fh qq|<ul id="toc">\n|;
my $i = 0;
foreach my $department ( sort keys %$auth_department ) {
foreach my $authid ( sort @{ $auth_department->{$department} } ) {
my @categories = keys %{ $authors->{$authid}->{aut} };
- push @categories, keys %{ $authors->{$authid}->{sec} };
+ push @categories, keys %{ $authors->{$authid}->{__sec} };
foreach my $category ( sort @categories ) {
push @{ $department_category_author->{$department}->{$category} }, $authid;
push @{ $department_category_author->{'AAA_ukupno'}->{$category} }, $authid if $department_in_sum->{$department};
}
html_year_selection $fh => @authids;
- department_html( $fh, $department, 'aut', 'Primarno autorstvo' );
-
-# department_html( $fh, $department, 'sec', 'Sekundarno autorstvo' );
- department_html( $fh, $department, 'edt', 'Uredništva' );
- department_html( $fh, $department, 'trl', 'Prijevodi' );
- department_html( $fh, $department, '_ostalo', 'Ostalo' );
+ my $i = 0;
+ while ( $i < $#toc_type_label ) {
+ my $type = $toc_type_label[$i++] || die "type";
+ my $label = $toc_type_label[$i++] || die "label";
+ department_html( $fh, $department, $type, $label );
+ }
print $fh html_end;
close($fh);