X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=html.pl;h=e9194b3d90e278e40c6443d00c34ad00199dbc78;hb=90916f5c0700c5ba54435feacfbe40c1c0a6dffb;hp=cc3a3cecb2c6feeb32bf349f1f574cfc44b482e3;hpb=46c56575ea1e30f99d93502bf48a617b909964fd;p=koha-bibliografija
diff --git a/html.pl b/html.pl
index cc3a3ce..e9194b3 100755
--- a/html.pl
+++ b/html.pl
@@ -128,10 +128,11 @@ my $marcxml;
my $sth_select_authors = $dbh->prepare(q{
select
- biblionumber,
+ biblioitems.biblionumber,
itemtype,
- marcxml
+ metadata as marcxml
from biblioitems
+join biblio_metadata on (biblio_metadata.biblionumber = biblioitems.biblionumber)
where
agerestriction > 0
});
@@ -542,6 +543,7 @@ var type_cat_count = |, encode_json($type_cat_count), q|;
}
+my $authid_fullname;
foreach my $row ( sort { $a->{full_name} cmp $b->{full_name} } @authors ) {
@@ -553,6 +555,8 @@ foreach my $row ( sort { $a->{full_name} cmp $b->{full_name} } @authors ) {
}
print $index qq{
}, $row->{full_name}, "\n";
+ $authid_fullname->{ $row->{authid} } = $row->{full_name};
+
my $path = "html/$row->{authid}";
open(my $fh, '>:encoding(utf-8)', "$path.new");
print $fh html_title($row->{full_name}, "bibliografija");
@@ -579,6 +583,7 @@ rename 'html/index.new', 'html/index.html';
debug 'auth_header' => $auth_header;
+debug 'authid_fullname' => $authid_fullname;
my $department_category_author;
foreach my $department ( sort keys %$auth_department ) {
@@ -620,7 +625,7 @@ sub department_html {
foreach my $bib_num ( @biblionumber ) {
my @li = li_biblio( $bib_num );
my $li_html = join('', @li);
- $li_html =~ s{}{}gs;
+ $li_html =~ s{}{}gs;
print $fh $li_html;
next unless $csv_fh;
@@ -628,8 +633,10 @@ sub department_html {
my $year = $li[1];
my @html;
foreach ( split(/}{} ) {
- $html[$1] = $_;
+ if ( s{^(\d+)">}{} ) {
+ my $nr = $1;
+ s{\s+}{ }gs;
+ $html[$nr] = $_;
} else {
warn "SKIPPED: Can't find col in [$_] from $li[4]" unless m/^<[^>]+>$/;
}
@@ -721,7 +728,7 @@ my @report_labels;
my $label;
my $sub_labels;
-open(my $report, '<:encoding(utf-8)', 'AZVO.txt');
+open(my $report, '<:encoding(utf-8)', 'nAZVO.txt');
while( <$report> ) {
chomp;
if ( /^([^\t]+)\t+(.+)/ ) {
@@ -809,7 +816,7 @@ foreach my $department ( @departments ) {
} # group
-debug 'table', $table;
+#debug 'table', $table;
open(my $fh, '>:encoding(utf-8)', 'html/azvo.new');
open(my $fh2, '>:encoding(utf-8)', 'html/azvo2.new');
@@ -852,5 +859,63 @@ close($fh2);
rename 'html/azvo.new', 'html/azvo.html';
rename 'html/azvo2.new', 'html/azvo2.html';
+my $dep_au_count;
+
+foreach my $department ( @departments ) {
+ foreach my $line ( @report_lines ) {
+ my $label = $line->[0];
+ my @biblionumbers;
+ foreach ( 1 .. $#$line ) {
+ my ( $category, $type ) = @{ $line->[ $_ ] };
+
+ foreach my $authid ( @{ $auth_department->{$department} } ) {
+ next unless exists $authors->{$authid}->{$type}->{$category};
+ my @biblionumbers = @{ $authors->{$authid}->{$type}->{$category} };
+
+ $dep_au_count->{ $department }->{ $authid }->{ $label } += scalar @biblionumbers;
+ }
+ }
+ }
+}
+
+debug 'dep_au_count', $dep_au_count;
+
+mkdir 'html/dep_au' unless -d 'html/dep_au';
+open(my $dep_fh, '>', 'html/dep_au/index.new');
+print $dep_fh html_title('Odsjeci Filozofskog fakulteta u Zagrebu'), qq|\n|;
+foreach my $department ( sort keys %{ $dep_au_count } ) {
+
+ my $dep = $department || 'Nema odsjeka';
+ my $dep_file = unac_string('utf-8',$dep);
+ print $dep_fh qq|- $dep
\n|;
+ open(my $fh, '>:encoding(utf-8)', "html/dep_au/$dep_file.new");
+
+ print $fh html_title($department . ' bibliografija tablica');
+
+ # FIXME table
+ print $fh qq|\n | |
+ , join(' | ', @report_labels )
+ , qq| |
\n|
+ ;
+
+ foreach my $authid ( keys %{ $dep_au_count->{ $department } } ) {
+ print $fh qq|$authid_fullname->{$authid} | |
+ , join(' | ', map { $dep_au_count->{$department}->{$authid}->{$_} || '-' } @report_labels )
+ , qq| |
\n|
+ ;
+ }
+
+
+ print $fh qq|
\n|;
+
+ print $fh html_end;
+ close($fh);
+ rename "html/dep_au/$dep_file.new", "html/dep_au/$dep_file.html";
+}
+
+print $dep_fh html_end;
+close($dep_fh);
+rename "html/dep_au/index.new", "html/dep_au/index.html";
+
unlink $pid_file;