use Text::Unaccent;
use Carp qw(confess);
use utf8;
+use JSON;
use lib '/srv/koha_ffzg';
use C4::Context;
my $xslfilename = 'compact.xsl';
my $azvo_group_title = {
-'znanstveno nastavni' => qr/(profesor|docent|znanstveni)/i,
+'znanstveno nastavni' => qr/(profes|docent|znanstveni savjetnik|znanstveni suradnik)/i,
'lektori i predavači' => qr/(lektor|predavač)/i,
'asistenti i novaci' => qr/(asistent|novak)/i,
};
my $department_groups = {
-'AAA_humanističke' => qr/(anglistiku|arheologiju|antropologiju|filozofiju|fonetiku|germanistiku|hungarologiju|indologiju|slavenske|filologiju|komparativnu|kroatistiku|lingvistiku|povijest|romanistiku|talijanistiku)/i,
-'AAB_društvene' => qr/(informacijske|pedagogiju|psihologiju|sociologiju)/i,
+'AAB_humanističke' => qr/(anglistiku|arheologiju|antropologiju|filozofiju|fonetiku|germanistiku|hungarologiju|indologiju|slavenske|filologiju|komparativnu|kroatistiku|lingvistiku|povijest|romanistiku|talijanistiku)/i,
+'AAC_društvene' => qr/(informacijske|pedagogiju|psihologiju|sociologiju)/i,
};
my $auth_header;
}
}
push @{ $data->{$tag} }, $sf_data if $sf_data;
- }
- }
+ }
+ }
- if ( $data->{year} < 2008 ) {
+ if ( ! defined $data->{year} ) {
+ warn "MISSING year in ", $row->{biblionumber};
+=for remove-year-limit
+ } elsif ( $data->{year} < 2008 ) {
push @{ $skip->{year_lt_2008} }, $row->{biblionumber};
next;
} elsif ( $data->{year} > 2013 ) {
push @{ $skip->{year_gt_2013} }, $row->{biblionumber};
next;
+=cut
}
# warn "# ", $row->{biblionumber}, " data ",dump($data);
<meta charset="UTF-8">
<title>|, join(" ", @_), qq|</title>
<link href="style.css" type="text/css" rel="stylesheet" />
+<script src="//code.jquery.com/jquery-1.11.2.js"></script>
</head>
<body>
|;
sub li_biblio {
my ($biblionumber) = @_;
- return qq|<li>|,
+ return qq|<li class="y|, $biblio_year->{$biblionumber}, qq|">|,
qq|<a href="https://koha.ffzg.hr/cgi-bin/koha/opac-detail.pl?biblionumber=$biblionumber">$biblionumber</a>|,
biblioitem_html($biblionumber),
qq|<a href="https://koha.ffzg.hr:8443/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=$biblionumber">edit</a>|,
foreach my $category ( sort keys %{ $authors->{$authid}->{$type} } ) {
my $label = $category_label->{$category} || 'Bez kategorije';
- print $fh qq|<h3>$label</h3>\n<ul>\n|;
- foreach my $biblionumber ( @{ $authors->{$authid}->{$type}->{$category} } ) {
+ print $fh qq|<a name="$type-$category"><h3>$label</h3></a>\n<ul>\n|;
+ foreach my $biblionumber ( sort {
+ $biblio_year->{$b} <=> $biblio_year->{$a} || $a <=> $b
+ } @{ $authors->{$authid}->{$type}->{$category} } ) {
print $fh li_biblio( $biblionumber );
}
print $fh qq|</ul>\n|;
}
}
+sub count_author_years {
+ my ($authid) = @_;
+ my $years;
+ foreach my $type ( keys %{ $authors->{$authid} } ) {
+ foreach my $category ( keys %{ $authors->{$authid}->{$type} } ) {
+ foreach my $biblionumber ( @{ $authors->{$authid}->{$type}->{$category} } ) {
+ $years->{ $biblio_year->{ $biblionumber } }->{ $type . '-' . $category }++;
+ }
+ }
+ }
+ return $years;
+}
+
foreach my $row ( sort { $a->{full_name} cmp $b->{full_name} } @authors ) {
my $first = substr( $row->{full_name}, 0, 1 );
my $path = "html/$row->{authid}";
open(my $fh, '>:encoding(utf-8)', "$path.new");
print $fh html_title($row->{full_name}, "bibliografija");
- print $fh qq|<h1>$row->{full_name} - bibliografija za razdoblje 2008-2013</h1>|;
+ print $fh qq|<h1>$row->{full_name} - bibliografija</h1>|;
+
+ my $years = count_author_years( $row->{authid} );
+ print $fh qq|<span id="years">Godine:|;
+ my $type_cat_count = {};
+ 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>$year</label> \n|;
+ foreach my $type_cat ( keys %{ $years->{$year} } ) {
+ $type_cat_count->{ $type_cat } += $years->{$year}->{$type_cat};
+ }
+ }
+ print $fh qq|</span>|;
+
+ print $fh q|
+<script>
+
+var years = |, encode_json($years), q|;
+
+var type_cat_count = |, encode_json($type_cat_count), q|;
+
+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');
+ }
+ }
+}
+
+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');
+ }
+ }
+}
+
+function toggle_year(year, el) {
+ if ( el.checked ) {
+ year_show(year);
+ } else {
+ year_hide(year);
+ }
+}
+
+$(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>
+ |;
author_html( $fh, $row->{authid}, 'aut' => 'Primarno autorstvo' );
author_html( $fh, $row->{authid}, 'sec' => 'Uredništva, prijevodi, krička izdanja' );
push @categories, keys %{ $authors->{$authid}->{sec} };
foreach my $category ( sort @categories ) {
push @{ $department_category_author->{$department}->{$category} }, $authid;
- push @{ $department_category_author->{'AAZ_ukupno'}->{$category} }, $authid if $department_in_sum->{$department};
+ push @{ $department_category_author->{'AAA_ukupno'}->{$category} }, $authid if $department_in_sum->{$department};
if ( my $group = $department_in_group->{ $department } ) {
push @{ $department_category_author->{$group}->{$category} }, $authid;
} else {