From cbf218c28ed95e0c579cffff6dadf16e3821a180 Mon Sep 17 00:00:00 2001 From: doxulting Date: Mon, 5 Jul 2004 13:29:35 +0000 Subject: [PATCH] First step for working authorities --- authorities/blinddetail-biblio-search.pl | 184 ++++++++++++++++++ authorities/detail-biblio-search.pl | 184 ++++++++++++++++++ .../blinddetail-biblio-search.tmpl | 24 +++ .../en/authorities/detail-biblio-search.tmpl | 68 +++++++ .../en/authorities/searchresultlist-auth.tmpl | 89 +++++++++ .../en/authorities/searchresultlist.tmpl | 10 +- .../en/includes/auth-search-bottom.inc | 18 ++ .../default/en/includes/auth-search-top.inc | 70 +++++++ .../intranet-tmpl/default/images/arrow.gif | Bin 0 -> 1648 bytes 9 files changed, 646 insertions(+), 1 deletion(-) create mode 100755 authorities/blinddetail-biblio-search.pl create mode 100755 authorities/detail-biblio-search.pl create mode 100644 koha-tmpl/intranet-tmpl/default/en/authorities/blinddetail-biblio-search.tmpl create mode 100644 koha-tmpl/intranet-tmpl/default/en/authorities/detail-biblio-search.tmpl create mode 100644 koha-tmpl/intranet-tmpl/default/en/authorities/searchresultlist-auth.tmpl create mode 100644 koha-tmpl/intranet-tmpl/default/en/includes/auth-search-bottom.inc create mode 100644 koha-tmpl/intranet-tmpl/default/en/includes/auth-search-top.inc create mode 100644 koha-tmpl/intranet-tmpl/default/images/arrow.gif diff --git a/authorities/blinddetail-biblio-search.pl b/authorities/blinddetail-biblio-search.pl new file mode 100755 index 0000000000..a9c3bc7181 --- /dev/null +++ b/authorities/blinddetail-biblio-search.pl @@ -0,0 +1,184 @@ +#!/usr/bin/perl + +# Copyright 2000-2002 Katipo Communications +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + +=head1 NAME + +etail.pl : script to show an authority in MARC format + +=head1 SYNOPSIS + + +=head1 DESCRIPTION + +This script needs an authid + +It shows the authority in a (nice) MARC format depending on authority MARC +parameters tables. + +=head1 FUNCTIONS + +=over 2 + +=cut + + +use strict; +require Exporter; +use C4::AuthoritiesMarc; +use C4::Auth; +use C4::Context; +use C4::Output; +use C4::Interface::CGI::Output; +use CGI; +use C4::Search; +use MARC::Record; +use C4::Koha; +# use C4::Biblio; +# use C4::Catalogue; +use HTML::Template; + +my $query=new CGI; + +my $dbh=C4::Context->dbh; + +my $authid = $query->param('authid'); +my $index = $query->param('index'); +my $authtypecode = &AUTHfind_authtypecode($dbh,$authid); +my $tagslib = &AUTHgettagslib($dbh,1,$authtypecode); + +my $record =AUTHgetauthority($dbh,$authid); +# open template +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "authorities/blinddetail-biblio-search.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {catalogue => 1}, + debug => 1, + }); + +# fill arrays +my @loop_data =(); +my $tag; +# loop through each tab 0 through 9 +# for (my $tabloop = 0; $tabloop<=10;$tabloop++) { +# loop through each tag + my @fields = $record->fields(); + my @loop_data =(); + foreach my $field (@fields) { + my @subfields_data; + # if tag <10, there's no subfield, use the "@" trick + if ($field->tag()<10) { +# next if ($tagslib->{$field->tag()}->{'@'}->{tab} ne $tabloop); + next if ($tagslib->{$field->tag()}->{'@'}->{hidden}); + my %subfield_data; + $subfield_data{marc_lib}=$tagslib->{$field->tag()}->{'@'}->{lib}; + $subfield_data{marc_value}=$field->data(); + $subfield_data{marc_subfield}='@'; + $subfield_data{marc_tag}=$field->tag(); + push(@subfields_data, \%subfield_data); + } else { + my @subf=$field->subfields; + # loop through each subfield + for my $i (0..$#subf) { + $subf[$i][0] = "@" unless $subf[$i][0]; +# next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} ne $tabloop); + next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{hidden}); + my %subfield_data; + $subfield_data{marc_lib}=$tagslib->{$field->tag()}->{$subf[$i][0]}->{lib}; + if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{isurl}) { + $subfield_data{marc_value}="$subf[$i][1]"; + } else { + $subfield_data{marc_value}=$subf[$i][1]; + } + $subfield_data{marc_subfield}=$subf[$i][0]; + $subfield_data{marc_tag}=$field->tag(); + push(@subfields_data, \%subfield_data); + } + } + if ($#subfields_data>=0) { + my %tag_data; + $tag_data{tag}=$field->tag().' -'. $tagslib->{$field->tag()}->{lib}; + $tag_data{subfield} = \@subfields_data; + push (@loop_data, \%tag_data); + } + } + $template->param("0XX" =>\@loop_data); +# } +# now, build item tab ! +# the main difference is that datas are in lines and not in columns : thus, we build the first, then the values... +# loop through each tag +# warning : we may have differents number of columns in each row. Thus, we first build a hash, complete it if necessary +# then construct template. +# my @fields = $record->fields(); +# my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code +# my @big_array; +# foreach my $field (@fields) { +# next if ($field->tag()<10); +# my @subf=$field->subfields; +# my %this_row; +# # loop through each subfield +# for my $i (0..$#subf) { +# next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} ne 10); +# $witness{$subf[$i][0]} = $tagslib->{$field->tag()}->{$subf[$i][0]}->{lib}; +# $this_row{$subf[$i][0]} =$subf[$i][1]; +# } +# if (%this_row) { +# push(@big_array, \%this_row); +# } +# } +# #fill big_row with missing datas +# foreach my $subfield_code (keys(%witness)) { +# for (my $i=0;$i<=$#big_array;$i++) { +# $big_array[$i]{$subfield_code}=" " unless ($big_array[$i]{$subfield_code}); +# } +# } +# # now, construct template ! +# my @item_value_loop; +# my @header_value_loop; +# for (my $i=0;$i<=$#big_array; $i++) { +# my $items_data; +# foreach my $subfield_code (keys(%witness)) { +# $items_data .="".$big_array[$i]{$subfield_code}.""; +# } +# my %row_data; +# $row_data{item_value} = $items_data; +# push(@item_value_loop,\%row_data); +# } +# foreach my $subfield_code (keys(%witness)) { +# my %header_value; +# $header_value{header_value} = $witness{$subfield_code}; +# push(@header_value_loop, \%header_value); +# } + +my $authtypes = getauthtypes; +my @authtypesloop; +foreach my $thisauthtype (keys %$authtypes) { + my $selected = 1 if $thisauthtype eq $authtypecode; + my %row =(value => $thisauthtype, + selected => $selected, + authtypetext => $authtypes->{$thisauthtype}{'authtypetext'}, + ); + push @authtypesloop, \%row; +} + +$template->param(authid => $authid, + authtypesloop => \@authtypesloop, index => $index); +output_html_with_http_headers $query, $cookie, $template->output; + diff --git a/authorities/detail-biblio-search.pl b/authorities/detail-biblio-search.pl new file mode 100755 index 0000000000..5bfe7620a0 --- /dev/null +++ b/authorities/detail-biblio-search.pl @@ -0,0 +1,184 @@ +#!/usr/bin/perl + +# Copyright 2000-2002 Katipo Communications +# +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# Koha is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place, +# Suite 330, Boston, MA 02111-1307 USA + +=head1 NAME + +etail.pl : script to show an authority in MARC format + +=head1 SYNOPSIS + + +=head1 DESCRIPTION + +This script needs an authid + +It shows the authority in a (nice) MARC format depending on authority MARC +parameters tables. + +=head1 FUNCTIONS + +=over 2 + +=cut + + +use strict; +require Exporter; +use C4::AuthoritiesMarc; +use C4::Auth; +use C4::Context; +use C4::Output; +use C4::Interface::CGI::Output; +use CGI; +use C4::Search; +use MARC::Record; +use C4::Koha; +# use C4::Biblio; +# use C4::Catalogue; +use HTML::Template; + +my $query=new CGI; + +my $dbh=C4::Context->dbh; + +my $authid = $query->param('authid'); +my $index = $query->param('index'); +my $authtypecode = &AUTHfind_authtypecode($dbh,$authid); +my $tagslib = &AUTHgettagslib($dbh,1,$authtypecode); + +my $record =AUTHgetauthority($dbh,$authid); +# open template +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "authorities/detail-biblio-search.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {catalogue => 1}, + debug => 1, + }); + +# fill arrays +my @loop_data =(); +my $tag; +# loop through each tab 0 through 9 +# for (my $tabloop = 0; $tabloop<=10;$tabloop++) { +# loop through each tag + my @fields = $record->fields(); + my @loop_data =(); + foreach my $field (@fields) { + my @subfields_data; + # if tag <10, there's no subfield, use the "@" trick + if ($field->tag()<10) { +# next if ($tagslib->{$field->tag()}->{'@'}->{tab} ne $tabloop); + next if ($tagslib->{$field->tag()}->{'@'}->{hidden}); + my %subfield_data; + $subfield_data{marc_lib}=$tagslib->{$field->tag()}->{'@'}->{lib}; + $subfield_data{marc_value}=$field->data(); + $subfield_data{marc_subfield}='@'; + $subfield_data{marc_tag}=$field->tag(); + push(@subfields_data, \%subfield_data); + } else { + my @subf=$field->subfields; + # loop through each subfield + for my $i (0..$#subf) { + $subf[$i][0] = "@" unless $subf[$i][0]; +# next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} ne $tabloop); + next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{hidden}); + my %subfield_data; + $subfield_data{marc_lib}=$tagslib->{$field->tag()}->{$subf[$i][0]}->{lib}; + if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{isurl}) { + $subfield_data{marc_value}="$subf[$i][1]"; + } else { + $subfield_data{marc_value}=$subf[$i][1]; + } + $subfield_data{marc_subfield}=$subf[$i][0]; + $subfield_data{marc_tag}=$field->tag(); + push(@subfields_data, \%subfield_data); + } + } + if ($#subfields_data>=0) { + my %tag_data; + $tag_data{tag}=$field->tag().' -'. $tagslib->{$field->tag()}->{lib}; + $tag_data{subfield} = \@subfields_data; + push (@loop_data, \%tag_data); + } + } + $template->param("0XX" =>\@loop_data); +# } +# now, build item tab ! +# the main difference is that datas are in lines and not in columns : thus, we build the first, then the values... +# loop through each tag +# warning : we may have differents number of columns in each row. Thus, we first build a hash, complete it if necessary +# then construct template. +# my @fields = $record->fields(); +# my %witness; #---- stores the list of subfields used at least once, with the "meaning" of the code +# my @big_array; +# foreach my $field (@fields) { +# next if ($field->tag()<10); +# my @subf=$field->subfields; +# my %this_row; +# # loop through each subfield +# for my $i (0..$#subf) { +# next if ($tagslib->{$field->tag()}->{$subf[$i][0]}->{tab} ne 10); +# $witness{$subf[$i][0]} = $tagslib->{$field->tag()}->{$subf[$i][0]}->{lib}; +# $this_row{$subf[$i][0]} =$subf[$i][1]; +# } +# if (%this_row) { +# push(@big_array, \%this_row); +# } +# } +# #fill big_row with missing datas +# foreach my $subfield_code (keys(%witness)) { +# for (my $i=0;$i<=$#big_array;$i++) { +# $big_array[$i]{$subfield_code}=" " unless ($big_array[$i]{$subfield_code}); +# } +# } +# # now, construct template ! +# my @item_value_loop; +# my @header_value_loop; +# for (my $i=0;$i<=$#big_array; $i++) { +# my $items_data; +# foreach my $subfield_code (keys(%witness)) { +# $items_data .="".$big_array[$i]{$subfield_code}.""; +# } +# my %row_data; +# $row_data{item_value} = $items_data; +# push(@item_value_loop,\%row_data); +# } +# foreach my $subfield_code (keys(%witness)) { +# my %header_value; +# $header_value{header_value} = $witness{$subfield_code}; +# push(@header_value_loop, \%header_value); +# } + +my $authtypes = getauthtypes; +my @authtypesloop; +foreach my $thisauthtype (keys %$authtypes) { + my $selected = 1 if $thisauthtype eq $authtypecode; + my %row =(value => $thisauthtype, + selected => $selected, + authtypetext => $authtypes->{$thisauthtype}{'authtypetext'}, + ); + push @authtypesloop, \%row; +} + +$template->param(authid => $authid, + authtypesloop => \@authtypesloop, index => $index); +output_html_with_http_headers $query, $cookie, $template->output; + diff --git a/koha-tmpl/intranet-tmpl/default/en/authorities/blinddetail-biblio-search.tmpl b/koha-tmpl/intranet-tmpl/default/en/authorities/blinddetail-biblio-search.tmpl new file mode 100644 index 0000000000..07ff6ee062 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/authorities/blinddetail-biblio-search.tmpl @@ -0,0 +1,24 @@ + + + + + + diff --git a/koha-tmpl/intranet-tmpl/default/en/authorities/detail-biblio-search.tmpl b/koha-tmpl/intranet-tmpl/default/en/authorities/detail-biblio-search.tmpl new file mode 100644 index 0000000000..6d1eaf0072 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/authorities/detail-biblio-search.tmpl @@ -0,0 +1,68 @@ + +/includes/marc-editor.css"> +
+

Authority number :

+ "> + //images/fileopen.png"> + + + //images/edittrash.png"> + + &index=')" class="button authority"> + Print + + //images/arrow.gif" height=45 width=45 "> + + +
+


+
+ +

+ +

+ +

+ + +

+ + +
+ + + + diff --git a/koha-tmpl/intranet-tmpl/default/en/authorities/searchresultlist-auth.tmpl b/koha-tmpl/intranet-tmpl/default/en/authorities/searchresultlist-auth.tmpl new file mode 100644 index 0000000000..84559ac6c4 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/authorities/searchresultlist-auth.tmpl @@ -0,0 +1,89 @@ + +
+

Authority search results

+ + + +
+ + + + diff --git a/koha-tmpl/intranet-tmpl/default/en/authorities/searchresultlist.tmpl b/koha-tmpl/intranet-tmpl/default/en/authorities/searchresultlist.tmpl index 3444187313..586db076e0 100644 --- a/koha-tmpl/intranet-tmpl/default/en/authorities/searchresultlist.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/authorities/searchresultlist.tmpl @@ -46,7 +46,7 @@ - "> + ')"> //images/edittrash.png" width="32" hspace="0" vspace="0" border="0"> @@ -74,3 +74,11 @@ + + + \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/default/en/includes/auth-search-bottom.inc b/koha-tmpl/intranet-tmpl/default/en/includes/auth-search-bottom.inc new file mode 100644 index 0000000000..1b1b790fef --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/includes/auth-search-bottom.inc @@ -0,0 +1,18 @@ +
+

 

+ +
+Home || +Catalogue || +Members || +Acquisitions || +Circulation || +Authorities || +Reports || +Parameters || +About || +Help +
+ + + diff --git a/koha-tmpl/intranet-tmpl/default/en/includes/auth-search-top.inc b/koha-tmpl/intranet-tmpl/default/en/includes/auth-search-top.inc new file mode 100644 index 0000000000..dbb5b3d1e1 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/default/en/includes/auth-search-top.inc @@ -0,0 +1,70 @@ + + + + +KOHA: INTRANET: Authorities + + + + + + +/includes/common-style.css"> + + + + + + +

Logged in as: [Log Out]

+ +

Log In to Koha

+ +TOGGLE CSS \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/default/images/arrow.gif b/koha-tmpl/intranet-tmpl/default/images/arrow.gif new file mode 100644 index 0000000000000000000000000000000000000000..bea37201cee82356fbb78356fc87e2d18176061a GIT binary patch literal 1648 zcmb7?dpOg39LImZ&5UqtMn;=tN{TY(7Ne!mjVLOS$o*2*aH{2;ZjM`{?I0y4N1H6< zvS^AFNi6M8LkXdfy3ddswzv=wKde$)YSE~P@39U{pAK&eGJCXc%6x%kr@tyS#4`- zW`QRV2+K|EiFTHb>#PWt3n8GYs;au0I$A>mZMg!o!t#G3zYic)fIuJ-3L*gr5`-c_ zc?*C6KmY<=cWX^^5{d+zfu?5&1mXl;mTv1lr(E@yaUn@BwO@i3M-`Q`L$?ra=9*mK^6g>4 zCP_owu$mho)K|+ebM@Bcdd63QrTbC`BTgzIFCJ55EOLTjvlI22ey#Jkd7NXjYjBuJ z9P3?zZBqUqQ%5`bV_*9zul81U>E~pR?wH-L9^UyQ?@s;P@3n;W`R=@d38p(Pv(Q!( zk!A0=p**&*m$vHR)XS*@oF~nF6-5c-9yWS|_jYfi+Kx`)=<`WAH+?0XEdIk!)tx7^ z1@5JWKgp6}i3Y{DIy`v}Er%L)_s6hrLV3z zPz?_|)P8?xdDoZOJ$JNwWD`zS&Ig^+KB#Qg@hsu6IN@;8+Ji)k;u48qZJ$`TEsB>o zxJ$@WF^POk1!3`pu2h>{iv=POTN0C_bcrjyT_`J^8^hVm$zpzhfO6*2)L7PRS7ju{ zz`jh=(+R6l6h%9jS$Fp;9YvZ!2dwdsYT~X~GX&pCIzl!<7E!m3OHa2Sj_U}a@o{4o zRm5R#xNq9AuLm49T+TageZC^(Gj+*RDR;aE;hIqlp9zhRoK49d{U&RYgw<_aZ1it7 zZ})TmvWROdyI3MEhl^x65XkgNE$E?g zmG9u@8@$}uG4HeOe!UFF?EEx4<2Bl}!<>Bl!#Ma_qV|qcF<6tl`4eBYkK^YgIhBmjmc3KYpWWL0(lBJ_bi{+(BbGn9cepM)KM;;u=l{Vvvx`sSrd>~)@*B~9Yxv~_reTs>XB5u$ z9{%*?MdN;#^4#r@D$8Y9VRgZHt3!&erchH9oX6^JuoKZ%Al+67%8 zaO;6%|8U6qG?$dr$`OEOatmUkuj%&kYDq{KJ2=tpfx`gxtN<6%ps$(wVKP}Bfrh`c-j zTjiZ(et2w*onfS_k?Sv>jx1B6VM>mEU1Iv$?M6V`bY0e699RG7F2AuD7VV9o;Y3A7 zre^yVyY<-NBTcw-#__MJho8;g4-_}#?D1|TpE>>5-~ni`zl*`m?8e`iemx!6n=3LQ no1Ufb+4vJu`nHHr^r={