$type_stats->{$type}++;
- if ( $type =~ m/(edt|trl|com|ctb)/ ) {
- push @{ $authors->{$authid}->{sec}->{ $category } }, $row->{biblionumber};
- push @{ $authors->{$authid}->{$1}->{ $category } }, $row->{biblionumber};
- } elsif ( $type =~ m/aut/ ) {
- if ( ! $have_100 ) {
- $have_edt = grep { exists $_->{4} && $_->{4} =~ m/edt/ } @{ $data->{700} } if ! defined $have_edt;
- if ( $have_edt ) {
- $skip->{ have_700_edt }->{ $row->{biblionumber} }++;
+ my @types = split(/\s+/, $type);
+
+ foreach my $type ( @types ) {
+ $type_stats->{_count_each_type}->{$type}++;
+
+ if ( $type =~ m/(edt|trl|com|ctb)/ ) {
+ 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};
+
+ } elsif ( $type =~ m/aut/ ) {
+ if ( ! $have_100 ) {
+ $have_edt = grep { exists $_->{4} && $_->{4} =~ m/edt/ } @{ $data->{700} } if ! defined $have_edt;
+ if ( $have_edt ) {
+ $skip->{ have_700_edt }->{ $row->{biblionumber} }++;
+ } else {
+ push @{ $authors->{$authid}->{aut}->{ $category } }, $row->{biblionumber};
+ }
} else {
push @{ $authors->{$authid}->{aut}->{ $category } }, $row->{biblionumber};
}
} else {
- push @{ $authors->{$authid}->{aut}->{ $category } }, $row->{biblionumber};
+# warn "# SKIP ", $row->{biblionumber}, ' no 700$4 in ', dump($data);
+ $skip->{ 'no_700$4' }->{ $row->{biblionumber} }++;
}
- } else {
-# warn "# SKIP ", $row->{biblionumber}, ' no 700$4 in ', dump($data);
- $skip->{ 'no_700$4' }->{ $row->{biblionumber} }++;
}
}
delete $data->{700};
return unless exists $authors->{$authid}->{$type};
- print $fh qq|<h2>$label</h2>\n|;
+ print $fh qq|<a name="$type"><h2>$label</h2></a>\n|;
foreach my $category ( sort keys %{ $authors->{$authid}->{$type} } ) {
my $label = $category_label->{$category} || 'Bez kategorije';
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 = @_;
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} } ) {
$type_cat_count->{ $type_cat } += $years->{$year}->{$type_cat};
+ my ($type,$cat) = split(/-/, $type_cat);
+ $type_cat_count->{_toc}->{$type}->{$cat}++;
+ $type_cat_count->{_toc_count}->{$type} += $years->{$year}->{$type_cat};
}
}
$('a[name="'+type_cat+'"]').show();
console.debug(type_cat, 'show');
}
+ $('#toc-count-'+type_cat.replace('.','-')).text( type_cat_count[ type_cat ] );
}
}
$('a[name="'+type_cat+'"]').hide();
console.debug(type_cat, 'hide');
}
+ $('#toc-count-'+type_cat.replace('.','-')).text( type_cat_count[ type_cat ] );
}
}
});
</script>
+
|;
+
+ # TOC
+ print $fh qq|<ul id="toc">\n|;
+ my $i = 0;
+ while ( $i < $#toc_type_label ) {
+ my $type = $toc_type_label[$i++] || die "type";
+ my $label = $toc_type_label[$i++] || die "label";
+ next unless exists $type_cat_count->{_toc}->{$type};
+ print $fh qq| <li id="toc-$type"><a href="#$type">$label</a> <tt id="toc-count-$type">$type_cat_count->{_toc_count}->{$type}</tt></li>\n <ul>\n|;
+ foreach my $category ( sort keys %{ $type_cat_count->{_toc}->{$type} } ) {
+ my $label = $category_label->{$category} || 'Bez kategorije';
+ my $count = $type_cat_count->{ $type . '-' . $category };
+ my $cat_html = $category;
+ $cat_html =~ s/\./-/g;
+ print $fh qq| <li id="toc-$category"><a href="#$type-$category">$label</a> <tt id="toc-count-$type-$cat_html">$count</tt></li>\n|;
+ }
+ print $fh qq| </ul>\n|;
+ }
+ print $fh qq|</ul>\n|;
+
}
+
foreach my $row ( sort { $a->{full_name} cmp $b->{full_name} } @authors ) {
my $first = substr( $row->{full_name}, 0, 1 );
html_year_selection $fh => $row->{authid};
- author_html( $fh, $row->{authid}, 'aut' => 'Primarno autorstvo' );
- author_html( $fh, $row->{authid}, 'sec' => 'Uredništva, prijevodi, kritička izdanja' );
+ my $i = 0;
+ while ( $i < $#toc_type_label ) {
+ my $type = $toc_type_label[$i++] || die "type";
+ my $label = $toc_type_label[$i++] || die "label";
+ author_html( $fh, $row->{authid}, $type => $label );
+ }
print $fh html_end;
close($fh);
sub department_html {
my ( $fh, $department, $type, $label ) = @_;
- print $fh qq|<h2>$label</h2>\n|;
+ print $fh qq|<a name="$type"><h2>$label</h2></a>\n|;
foreach my $category ( sort keys %{ $department_category_author->{$department} } ) {
department_html( $fh, $department, 'aut', 'Primarno autorstvo' );
- department_html( $fh, $department, 'sec', 'Sekundarno 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' );
print $fh html_end;
close($fh);