$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};
<title>|, join(" ", @_), qq|</title>
<link href="style.css" type="text/css" rel="stylesheet" />
<script src="//code.jquery.com/jquery-1.11.2.js"></script>
+<script src="filters.js"></script>
</head>
<body>
|;
my ($authid) = @_;
foreach my $type ( keys %{ $authors->{$authid} } ) {
foreach my $category ( keys %{ $authors->{$authid}->{$type} } ) {
+ next if $category =~ m/^_/;
foreach my $biblionumber ( @{ $authors->{$authid}->{$type}->{$category} } ) {
$years->{ $biblio_year->{ $biblionumber } }->{ $type . '-' . $category }++;
}
var type_cat_count = |, encode_json($type_cat_count), q|;
-function toc_count_update(type_cat) {
- var selector = '#toc-count-'+type_cat.replace(/\./g,'-');
- var e = $(selector);
- if ( ! e ) {
- console.error(selector, 'not found');
- return;
- }
- var old_val = e.text();
- var new_val = type_cat_count[type_cat];
-
- if ( old_val != new_val ) {
- e.text(new_val);
- console.debug( selector, 'old', old_val, 'new', new_val);
- }
-}
-
-function year_show(year) {
- $('.y'+year).show();
- console.debug('show', year);
- for(var type_cat in years[year]) {
- if ( ( type_cat_count[ type_cat ] += years[year][type_cat] ) == years[year][type_cat]) {
- $('a[name="'+type_cat+'"]').show();
- console.debug(type_cat, 'show');
- }
- toc_count_update(type_cat);
- }
-}
-
-function year_hide(year) {
- $('.y'+year).hide();
- console.debug('hide', year);
- for(var type_cat in years[year]) {
- if ( ( type_cat_count[ type_cat ] -= years[year][type_cat] ) == 0 ) {
- $('a[name="'+type_cat+'"]').hide();
- console.debug(type_cat, 'hide');
- }
- toc_count_update(type_cat);
- }
-}
-
-function toggle_year(year, el) {
- if ( el.checked ) {
- year_show(year);
- } else {
- year_hide(year);
- }
-}
-
-function all_years( turn_on ) {
- $('input[name=year_selection]').each( function(i,el) {
- if ( turn_on ) {
- if ( ! el.checked ) {
- el.checked = true;
- year_show( el.value );
- }
- } else {
- if ( el.checked ) {
- el.checked = false;
- year_hide( el.value );
- }
- }
- } );
-}
-
-$(document).ready( function() {
- console.info('ready');
-
- $('input[name=year_selection]').each( function(i, el) {
- var year = el.value;
- console.debug( 'on load', year, el.checked );
- if (! el.checked) year_hide(year);
- });
-
-});
</script>
|;
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);