X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=html.pl;h=f23e38be12cf7a7a0fe5563d236e5c16f61ccd17;hb=37f76cb9ed121b9507b040bf4530aa9d78d4465d;hp=18ad509cda309294820cb138bb4c6fbd93da01d2;hpb=373c951884ed78c6aadc06beea978d5050927a1e;p=koha-bibliografija diff --git a/html.pl b/html.pl index 18ad509..f23e38b 100755 --- a/html.pl +++ b/html.pl @@ -114,7 +114,7 @@ while( my $row = $sth_auth->fetchrow_hashref ) { debug 'department_in_group' => $department_in_group; foreach my $department ( keys %$department_in_sum ) { - $department_in_sum->{$department} = 0 unless $department =~ m/(centar|croaticum|katedra|odsjek)/i; +# $department_in_sum->{$department} = 0 unless $department =~ m/(centar|croaticum|katedra|odsjek)/i; } debug 'auth_department' => $auth_department; @@ -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 }); @@ -601,7 +602,7 @@ debug 'department_category_author' => $department_category_author; sub department_html { - my ( $fh, $department, $type, $label ) = @_; + my ( $fh, $department, $type, $label, $csv_fh ) = @_; print $fh qq|

$label

\n|; @@ -614,10 +615,32 @@ sub department_html { next unless @biblionumber; - my $label = $category_label->{$category} || 'Bez kategorije'; - print $fh qq|

$label

\n
    \n|; + my $cat_label = $category_label->{$category} || 'Bez kategorije'; + print $fh qq|

    $cat_label

    \n
      \n|; + + foreach my $bib_num ( @biblionumber ) { + my @li = li_biblio( $bib_num ); + my $li_html = join('', @li); + $li_html =~ s{}{}gs; + print $fh $li_html; + + next unless $csv_fh; + + my $year = $li[1]; + my @html; + foreach ( split(/}{} ) { + $html[$1] = $_; + } else { + warn "SKIPPED: Can't find col in [$_] from $li[4]" unless m/^<[^>]+>$/; + } + } + my $html = join("\t", @html); - print $fh li_biblio( $_ ) foreach @biblionumber; + $html =~ s{]*>}{}gs; + $html =~ s{\s+$}{}gs; + print $csv_fh "$bib_num\t$year\t$type\t$label\t$category\t$cat_label\t$html\n"; + } print $fh qq|
    |; } @@ -644,16 +667,24 @@ foreach my $department ( sort keys %$department_category_author ) { } html_year_selection $fh => @authids; + my $csv_fh; + if ( $department eq 'AAA_ukupno' ) { + open($csv_fh, '>:encoding(utf-8)', "html/departments/$department.csv"); + } + 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 ); + department_html( $fh, $department, $type, $label, $csv_fh ); } + close($csv_fh) if $csv_fh; + print $fh html_end; close($fh); rename "html/departments/$dep_file.new", "html/departments/$dep_file.html"; + } print $dep_fh qq|\n|, html_end; close($dep_fh);