my $opac_search_limit = $ENV{'OPAC_SEARCH_LIMIT'};
my $opac_limit_override = $ENV{'OPAC_LIMIT_OVERRIDE'};
my $opac_name = '';
- if (($opac_search_limit =~ /branch:(\w+)/ && $opac_limit_override) || $in->{'query'}->param('limit') =~ /branch:(\w+)/){
+ if (($opac_search_limit && $opac_search_limit =~ /branch:(\w+)/ && $opac_limit_override) || ($in->{'query'}->param('limit') && $in->{'query'}->param('limit') =~ /branch:(\w+)/)){
$opac_name = $1; # opac_search_limit is a branch, so we use it.
} elsif (C4::Context->preference("SearchMyLibraryFirst") && C4::Context->userenv && C4::Context->userenv->{'branch'}) {
$opac_name = C4::Context->userenv->{'branch'};
if (C4::Context->preference('OpacMaintenance') && $type eq 'opac') {
warn "OPAC Install required, redirecting to maintenance";
print $query->redirect("/cgi-bin/koha/maintenance.pl");
+ safe_exit;
}
unless ( $version = C4::Context->preference('Version') ) { # assignment, not comparison
if ( $type ne 'opac' ) {
else {
$cookie = $query->cookie( CGISESSID => $session->id );
$session->param('lasttime',time());
- unless ( $sessiontype eq 'anon' ) { #if this is an anonymous session, we want to update the session, but not behave as if they are logged in...
+ unless ( $sessiontype && $sessiontype eq 'anon' ) { #if this is an anonymous session, we want to update the session, but not behave as if they are logged in...
$flags = haspermission($userid, $flagsrequired);
if ($flags) {
$loggedin = 1;
}
}
my $thisauthtype = GetAuthType(GetAuthTypeCode($authid));
+ $thisauthtype |= GetAuthType($authtypecode) if $authtypecode;
$newline{authtype} = defined ($thisauthtype) ?
- $thisauthtype->{'authtypetext'} :
- (GetAuthType($authtypecode) ? $_->{'authtypetext'} : '');
+ $thisauthtype->{'authtypetext'} : '';
$newline{summary} = $summary;
$newline{even} = $counter % 2;
$newline{reported_tag} = $reported_tag;
sub GetAuthority {
my ($authid)=@_;
my $authority = Koha::Authority->get_from_authid($authid);
+ return unless $authority;
return ($authority->record);
}
$results{'fuzzy'}->{ $heading->display_form() }++;
}
elsif ( C4::Context->preference('AutoCreateAuthorities') ) {
- my $authtypedata =
- C4::AuthoritiesMarc::GetAuthType( $heading->auth_type() );
- my $marcrecordauth = MARC::Record->new();
- if ( C4::Context->preference('marcflavour') eq 'MARC21' ) {
- $marcrecordauth->leader(' nz a22 o 4500');
- SetMarcUnicodeFlag( $marcrecordauth, 'MARC21' );
+ if ( _check_valid_auth_link( $current_link, $field ) ) {
+ $results{'linked'}->{ $heading->display_form() }++;
}
- my $authfield =
- MARC::Field->new( $authtypedata->{auth_tag_to_report},
- '', '', "a" => "" . $field->subfield('a') );
- map {
- $authfield->add_subfields( $_->[0] => $_->[1] )
- if ( $_->[0] =~ /[A-z]/ && $_->[0] ne "a" )
- } $field->subfields();
- $marcrecordauth->insert_fields_ordered($authfield);
+ else {
+ my $authtypedata =
+ C4::AuthoritiesMarc::GetAuthType( $heading->auth_type() );
+ my $marcrecordauth = MARC::Record->new();
+ if ( C4::Context->preference('marcflavour') eq 'MARC21' ) {
+ $marcrecordauth->leader(' nz a22 o 4500');
+ SetMarcUnicodeFlag( $marcrecordauth, 'MARC21' );
+ }
+ $field->delete_subfield( code => '9' )
+ if defined $current_link;
+ my $authfield =
+ MARC::Field->new( $authtypedata->{auth_tag_to_report},
+ '', '', "a" => "" . $field->subfield('a') );
+ map {
+ $authfield->add_subfields( $_->[0] => $_->[1] )
+ if ( $_->[0] =~ /[A-z]/ && $_->[0] ne "a" )
+ } $field->subfields();
+ $marcrecordauth->insert_fields_ordered($authfield);
# bug 2317: ensure new authority knows it's using UTF-8; currently
# only need to do this for MARC21, as MARC::Record->as_xml_record() handles
# use UTF-8, but as of 2008-08-05, did not want to introduce that kind
# of change to a core API just before the 3.0 release.
- if ( C4::Context->preference('marcflavour') eq 'MARC21' ) {
- $marcrecordauth->insert_fields_ordered(
- MARC::Field->new(
- '667', '', '',
- 'a' => "Machine generated authority record."
- )
- );
- my $cite =
- $bib->author() . ", "
- . $bib->title_proper() . ", "
- . $bib->publication_date() . " ";
- $cite =~ s/^[\s\,]*//;
- $cite =~ s/[\s\,]*$//;
- $cite =
- "Work cat.: ("
- . C4::Context->preference('MARCOrgCode') . ")"
- . $bib->subfield( '999', 'c' ) . ": "
- . $cite;
- $marcrecordauth->insert_fields_ordered(
- MARC::Field->new( '670', '', '', 'a' => $cite ) );
- }
+ if ( C4::Context->preference('marcflavour') eq 'MARC21' ) {
+ $marcrecordauth->insert_fields_ordered(
+ MARC::Field->new(
+ '667', '', '',
+ 'a' => "Machine generated authority record."
+ )
+ );
+ my $cite =
+ $bib->author() . ", "
+ . $bib->title_proper() . ", "
+ . $bib->publication_date() . " ";
+ $cite =~ s/^[\s\,]*//;
+ $cite =~ s/[\s\,]*$//;
+ $cite =
+ "Work cat.: ("
+ . C4::Context->preference('MARCOrgCode') . ")"
+ . $bib->subfield( '999', 'c' ) . ": "
+ . $cite;
+ $marcrecordauth->insert_fields_ordered(
+ MARC::Field->new( '670', '', '', 'a' => $cite ) );
+ }
# warn "AUTH RECORD ADDED : ".$marcrecordauth->as_formatted;
- $authid =
- C4::AuthoritiesMarc::AddAuthority( $marcrecordauth, '',
- $heading->auth_type() );
- $field->add_subfields( '9', $authid );
- $num_headings_changed++;
- $results{'added'}->{ $heading->display_form() }++;
+ $authid =
+ C4::AuthoritiesMarc::AddAuthority( $marcrecordauth, '',
+ $heading->auth_type() );
+ $field->add_subfields( '9', $authid );
+ $num_headings_changed++;
+ $results{'added'}->{ $heading->display_form() }++;
+ }
}
elsif ( defined $current_link ) {
- $field->delete_subfield( code => '9' );
- $num_headings_changed++;
- $results{'unlinked'}->{ $heading->display_form() }++;
+ if ( _check_valid_auth_link( $current_link, $field ) ) {
+ $results{'linked'}->{ $heading->display_form() }++;
+ }
+ else {
+ $field->delete_subfield( code => '9' );
+ $num_headings_changed++;
+ $results{'unlinked'}->{ $heading->display_form() }++;
+ }
}
else {
$results{'unlinked'}->{ $heading->display_form() }++;
return $num_headings_changed, \%results;
}
+=head2 _check_valid_auth_link
+
+ if ( _check_valid_auth_link($authid, $field) ) {
+ ...
+ }
+
+Check whether the specified heading-auth link is valid without reference
+to Zebra/Solr. Ideally this code would be in C4::Heading, but that won't be
+possible until we have de-cycled C4::AuthoritiesMarc, so this is the
+safest place.
+
+=cut
+
+sub _check_valid_auth_link {
+ my ( $authid, $field ) = @_;
+
+ require C4::AuthoritiesMarc;
+
+ my $authorized_heading =
+ C4::AuthoritiesMarc::GetAuthorizedHeading( { 'authid' => $authid } );
+
+ return ($field->as_string('abcdefghijklmnopqrstuvwxyz') eq $authorized_heading);
+}
+
=head2 GetRecordValue
my $values = GetRecordValue($field, $record, $frameworkcode);
# $deltadays is a DateTime::Duration object
my $deltadays = $calendar->days_between( $dt_due, $dt_today );
- my $circcontrol = C4::Context::preference('CircControl');
+ my $circcontrol = C4::Context->preference('CircControl');
my $issuingrule =
GetIssuingRule( $borrower->{categorycode}, $item->{itype}, $branchcode );
my $finedays = $issuingrule->{finedays};
# if ReturnBeforeExpiry ON the datedue can't be after borrower expirydate
if ( C4::Context->preference('ReturnBeforeExpiry') ) {
my $expiry_dt = dt_from_string( $borrower->{dateexpiry}, 'iso' );
+ $expiry_dt->set( hour => 23, minute => 59);
if ( DateTime->compare( $datedue, $expiry_dt ) == 1 ) {
$datedue = $expiry_dt->clone;
}
);
}
-# XXX This is not safe in a persistant environment
-my $dbh = C4::Context->dbh;
=head1 FUNCTIONS
=cut
sub TransportCostMatrix {
+ my $dbh = C4::Context->dbh;
my $transport_costs = $dbh->selectall_arrayref("SELECT * FROM transport_cost",{ Slice => {} });
my %transport_cost_matrix;
sub UpdateTransportCostMatrix {
my ($records) = @_;
+ my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare("INSERT INTO transport_cost (frombranch, tobranch, cost, disable_transfer) VALUES (?, ?, ?, ?)");
sub GetHoldsQueueItems {
my ($branchlimit) = @_;
+ my $dbh = C4::Context->dbh;
my @bind_params = ();
my $query = q/SELECT tmp_holdsqueue.*, biblio.author, items.ccode, items.location, items.enumchron, items.cn_sort, biblioitems.publishercode,biblio.copyrightdate,biblioitems.publicationyear,biblioitems.pages,biblioitems.size,biblioitems.publicationyear,biblioitems.isbn,items.copynumber
=cut
sub CreateQueue {
+ my $dbh = C4::Context->dbh;
$dbh->do("DELETE FROM tmp_holdsqueue"); # clear the old table for new info
$dbh->do("DELETE FROM hold_fill_targets");
'required' => '0',
'min_ver' => '2.13',
},
+ 'Moose' => {
+ 'usage' => 'Core',
+ 'required' => '0',
+ 'min_ver' => '1.09',
+ },
};
1;
{
idx => 'su-to',
label => 'Topics',
- tags => [ qw/ 600a 601a 602a 603a 604a 605a 606ax 610a/ ],
+ tags => [ qw/ 600ab 601ab 602a 604at 605a 606ax 610a / ],
sep => ' - ',
},
{
idx => 'su-geo',
label => 'Places',
- tags => [ qw/ 651a / ],
+ tags => [ qw/ 607a / ],
sep => ' - ',
},
{
idx => 'su-ut',
label => 'Titles',
- tags => [ qw/ 500a 501a 502a 503a 504a / ],
+ tags => [ qw/ 500a 501a 503a / ],
sep => ', ',
},
{
my $chargeable_units = _get_chargeable_units($fine_unit, $start_date, $end_date, $branchcode);
my $units_minus_grace = $chargeable_units - $data->{firstremind};
my $amount = 0;
- if ($data->{'chargeperiod'} && $units_minus_grace ) {
+ if ($data->{'chargeperiod'} && ($units_minus_grace > 0) ) {
$amount = int($chargeable_units / $data->{'chargeperiod'}) * $data->{'fine'};# TODO fine calc should be in cents
} else {
- # a zero (or null) chargeperiod means no charge.
+ # a zero (or null) chargeperiod or negative units_minus_grace value means no charge.
}
$amount = $data->{overduefinescap} if $data->{overduefinescap} && $amount > $data->{overduefinescap};
$debug and warn sprintf("CalcFine returning (%s, %s, %s, %s)", $amount, $data->{'chargename'}, $units_minus_grace, $chargeable_units);
|| ( $facets_info->{$link_value}->{'expanded'} ) )
{
- # Sanitize the link value ), ( will cause errors with CCL,
+ # Sanitize the link value : parenthesis, question and exclamation mark will cause errors with CCL
my $facet_link_value = $one_facet;
- $facet_link_value =~ s/(\(|\))/ /g;
+ $facet_link_value =~ s/[()!?¡¿؟]/ /g;
# fix the length that will display in the label,
my $facet_label_value = $one_facet;
"slim2OPACResults.xsl";
}
$xslfilename = "$htdocs/$theme/$lang/xslt/$xslfile";
- $xslfilename = "$htdocs/$theme/en/xslt/$xslfile" unless ( $lang ne 'en' && !-f $xslfilename );
- $xslfilename = "$htdocs/prog/$lang/xslt/$xslfile" unless ( !-f $xslfilename );
- $xslfilename = "$htdocs/prog/en/xslt/$xslfile" unless ( $lang ne 'en' && !-f $xslfilename );
+ $xslfilename = "$htdocs/$theme/en/xslt/$xslfile" unless ( $lang ne 'en' && -f $xslfilename );
+ $xslfilename = "$htdocs/prog/$lang/xslt/$xslfile" unless ( -f $xslfilename );
+ $xslfilename = "$htdocs/prog/en/xslt/$xslfile" unless ( $lang ne 'en' && -f $xslfilename );
}
if ( $xslfilename =~ m/\{langcode\}/ ) {
use Modern::Perl;
-use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
+use vars qw($VERSION);
use C4::Context;
use C4::Output;
# set the version for version checking
$VERSION = 0.01;
- require Exporter;
- @ISA = qw(Exporter);
- @EXPORT = qw(
-
- );
-
- my $debug = C4::Context->preference("DebugLevel");
}
=head1 NAME
sub is_holiday {
my ( $self, $dt ) = @_;
- my $dow = $dt->day_of_week;
+ my $localdt = $dt->clone();
+ my $dow = $localdt->day_of_week;
if ( $dow == 7 ) {
$dow = 0;
}
if ( $self->{weekly_closed_days}->[$dow] == 1 ) {
return 1;
}
- $dt->truncate( to => 'day' );
- my $day = $dt->day;
- my $month = $dt->month;
+ $localdt->truncate( to => 'day' );
+ my $day = $localdt->day;
+ my $month = $localdt->month;
if ( exists $self->{day_month_closed_days}->{$month}->{$day} ) {
return 1;
}
}
my $perlVersion = $];
my $mysqlVersion = `mysql -V`;
-my $apacheVersion = `httpd -v`;
-$apacheVersion = `httpd2 -v` unless $apacheVersion;
+my $apacheVersion = `httpd -v 2> /dev/null`;
+$apacheVersion = `httpd2 -v 2> /dev/null` unless $apacheVersion;
$apacheVersion = (`/usr/sbin/apache2 -V`)[0] unless $apacheVersion;
my $zebraVersion = `zebraidx -V`;
$user,
$order->{unitprice},
$order->{ecost},
- $invoiceno,
+ $invoiceid,
$order->{rrp},
undef,
$datereceived,
$template->param( add_form => 1 );
#---- if primkey exists, it's a modify action, so read values to modify...
+ my $date;
if ($curr) {
my $curr_rec =
$dbh->selectrow_hashref( 'select * from currency where currency=?',
{}, $curr );
for ( keys %{$curr_rec} ) {
+ if($_ eq "timestamp"){ $date = $curr_rec->{$_}; }
$template->param( $_ => $curr_rec->{$_} );
}
}
- my $date = $template->param('timestamp');
if ($date) {
$template->param( 'timestamp' => format_date($date) );
}
my $repeatable = $input->param('repeatable') ? 1 : 0;
my $mandatory = $input->param('mandatory') ? 1 : 0;
my $authorised_value = $input->param('authorised_value');
- unless (C4::Context->config('demo') == 1) {
+ unless (C4::Context->config('demo')) {
if ($input->param('modif')) {
$sth = $dbh->prepare(
"UPDATE marc_tag_structure SET liblibrarian=? ,libopac=? ,repeatable=? ,mandatory=? ,authorised_value=? WHERE frameworkcode=? AND tagfield=?"
################## DELETE_CONFIRMED ##################################
# called by delete_confirm, used to effectively confirm deletion of data in DB
} elsif ($op eq 'delete_confirmed') {
- unless (C4::Context->config('demo') == 1) {
+ unless (C4::Context->config('demo')) {
my $sth1 = $dbh->prepare("DELETE FROM marc_tag_structure WHERE tagfield=? AND frameworkcode=?");
my $sth2 = $dbh->prepare("DELETE FROM marc_subfield_structure WHERE tagfield=? AND frameworkcode=?");
$sth1->execute($searchfield, $frameworkcode);
my $sth = $dbh->prepare("Select variable,value,explanation,type,options from systempreferences where (variable like ?) order by variable");
$sth->execute($syspref);
while ( my $data = $sth->fetchrow_hashref ) {
+ unless (defined $data->{value}) { $data->{value} = "";}
$data->{shortvalue} = $data->{value};
- $data->{shortvalue} = substr( $data->{value}, 0, 60 ) . "..." if defined( $data->{value} ) and length( $data->{value} ) > 60;
+ $data->{shortvalue} = substr( $data->{value}, 0, 60 ) . "..." if length( $data->{value} ) > 60;
push( @results, $data );
$cnt++;
}
}
while ( my $data = $sth->fetchrow_hashref ) {
+ unless (defined $data->{value}) { $data->{value} = "";}
$data->{shortvalue} = $data->{value};
$data->{shortvalue} = substr( $data->{value}, 0, 60 ) . "..." if length( $data->{value} ) > 60;
push( @results, $data );
$value =~ s/DD/$day/g;
}
my $dbh = C4::Context->dbh;
+
+ # map '@' as "subfield" label for fixed fields
+ # to something that's allowed in a div id.
+ my $id_subfield = $subfield;
+ $id_subfield = "00" if $id_subfield eq "@";
+
my %subfield_data = (
tag => $tag,
- subfield => $subfield,
+ subfield => $id_subfield,
marc_lib => substr( $tagslib->{$tag}->{$subfield}->{lib}, 0, 22 ),
marc_lib_plain => $tagslib->{$tag}->{$subfield}->{lib},
tag_mandatory => $tagslib->{$tag}->{mandatory},
repeatable => $tagslib->{$tag}->{$subfield}->{repeatable},
kohafield => $tagslib->{$tag}->{$subfield}->{kohafield},
index => $index_tag,
- id => "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield,
+ id => "tag_".$tag."_subfield_".$id_subfield."_".$index_tag."_".$index_subfield,
value => $value,
+ random => CreateKey(),
);
- if($subfield eq '@'){
- $subfield_data{id} = "tag_".$tag."_subfield_00_".$index_tag."_".$index_subfield;
- } else {
- $subfield_data{id} = "tag_".$tag."_subfield_".$subfield."_".$index_tag."_".$index_subfield;
- }
if(exists $mandatory_z3950->{$tag.$subfield}){
$subfield_data{z3950_mandatory} = $mandatory_z3950->{$tag.$subfield};
class=\"input_marceditor\"
tabindex=\"1\" \/>
<a href=\"#\" class=\"buttonDot\"
- onclick=\"openAuth(this.parentNode.getElementsByTagName('input')[1].id,'".$tagslib->{$tag}->{$subfield}->{authtypecode}."'); return false;\" tabindex=\"1\" title=\"Tag Editor\">...</a>
+ onclick=\"openAuth(this.parentNode.getElementsByTagName('input')[1].id,'".$tagslib->{$tag}->{$subfield}->{authtypecode}."','auth'); return false;\" tabindex=\"1\" title=\"Tag Editor\">...</a>
";
# it's a plugin field
}
# it's a thesaurus / authority field
}
elsif ( $tagslib->{$tag}->{$subfield}->{authtypecode} ) {
- if (C4::Context->preference("BiblioAddsAuthorities")) {
+ # when authorities auto-creation is allowed, do not set readonly
+ my $is_readonly = !C4::Context->preference("BiblioAddsAuthorities");
$subfield_data{marc_value} =
"<input type=\"text\"
id=\"".$subfield_data{id}."\"
class=\"input_marceditor readonly\"
tabindex=\"1\"
size=\"67\"
- maxlength=\"".$subfield_data{maxlength}."\"
- \/>
+ maxlength=\"".$subfield_data{maxlength}."\"".
+ ($is_readonly ? "readonly=\"readonly\"" : "").
+ "\/>
<span class=\"subfield_controls\"><a href=\"#\" class=\"buttonDot\"
- onclick=\"openAuth(this.parentNode.parentNode.getElementsByTagName('input')[1].id,'".$tagslib->{$tag}->{$subfield}->{authtypecode}."'); return false;\" tabindex=\"1\" title=\"Tag Editor\"><img src=\"/intranet-tmpl/prog/img/edit-tag.png\" alt=\"Tag Editor\" /></a></span>
- ";
- } else {
- $subfield_data{marc_value} =
- "<input type=\"text\"
- id=\"".$subfield_data{id}."\"
- name=\"".$subfield_data{id}."\"
- value=\"$value\"
- class=\"input_marceditor readonly\"
- tabindex=\"1\"
- size=\"67\"
- maxlength=\"".$subfield_data{maxlength}."\"
- readonly=\"readonly\"
- \/><span class=\"subfield_controls\"><a href=\"#\" class=\"buttonDot\"
- onclick=\"openAuth(this.parentNode.parentNode.getElementsByTagName('input')[1].id,'".$tagslib->{$tag}->{$subfield}->{authtypecode}."'); return false;\" tabindex=\"1\" title=\"Tag Editor\"><img src=\"/intranet-tmpl/prog/img/edit-tag.png\" alt=\"Tag Editor\" /></a></span>
+ onclick=\"openAuth(this.parentNode.parentNode.getElementsByTagName('input')[1].id,'".$tagslib->{$tag}->{$subfield}->{authtypecode}."','biblio'); return false;\" tabindex=\"1\" title=\"Tag Editor\"><img src=\"/intranet-tmpl/prog/img/edit-tag.png\" alt=\"Tag Editor\" /></a></span>
";
- }
# it's a plugin field
}
elsif ( $tagslib->{$tag}->{$subfield}->{'value_builder'} ) {
my $change = index($javascript, 'function Change') > -1 ?
"return Change$function_name($subfield_data{random}, '$subfield_data{id}');" :
'return 1;';
- $subfield_data{marc_value} = qq[<input $attributes
+ $subfield_data{marc_value} = qq[<input type="text" $attributes
onfocus="Focus$function_name($subfield_data{random}, '$subfield_data{id}');"
onchange=" $change"
onblur=" Blur$function_name($subfield_data{random}, '$subfield_data{id}');" />
$javascript];
} else {
warn "Plugin Failed: $plugin";
- $subfield_data{marc_value} = "<input $attributes />"; # supply default input form
+ $subfield_data{marc_value} = "<input type=\"text\" $attributes />"; # supply default input form
}
}
elsif ( $tag eq '' ) { # it's an hidden field
$subfield_data{marc_value} = "<textarea $attributes_no_value>$value</textarea>\n";
} else {
# it's a standard field
- $subfield_data{marc_value} = "<input $attributes />";
+ $subfield_data{marc_value} = "<input type=\"text\" $attributes />";
}
return \%subfield_data;
my $holdingbranch = $gettitle->{'holdingbranch'};
my $homebranch = $gettitle->{'homebranch'};
- if ($cancelall) {
- my $res = cancel( $itemnumber, $borrowernum, $holdingbranch, $homebranch, !$transfer_when_cancel_all );
- push @cancel_result, $res if $res;
- next;
- }
-
my %getreserv = (
itemnumber => $itemnumber,
borrowernum => $borrowernum,
}
if ($today > $calcDate) {
- push @overloop, \%getreserv;
- $overcount++;
+ if ($cancelall) {
+ my $res = cancel( $itemnumber, $borrowernum, $holdingbranch, $homebranch, !$transfer_when_cancel_all );
+ push @cancel_result, $res if $res;
+ next;
+ } else {
+ push @overloop, \%getreserv;
+ $overcount++;
+ }
}else{
push @reservloop, \%getreserv;
$reservcount++;
# NOTA BENE: Build dependencies end up as runtime dependencies as well.
# See debian/rules, the override_dh_gencontrol rules.
# There are some exceptions.
-Build-Depends: libcgi-session-driver-memcached-perl,
- libalgorithm-checkdigits-perl,
+Build-Depends: libalgorithm-checkdigits-perl,
+ libanyevent-http-perl,
+ libanyevent-perl,
libauthen-cas-client-perl,
libbiblio-endnotestyle-perl,
libbusiness-isbn-perl,
+ libcache-memcached-fast-perl,
libcgi-pm-perl | perl-modules,
+ libcgi-session-driver-memcached-perl,
libcgi-session-perl,
libcgi-session-serialize-yaml-perl,
+ libchi-driver-memcached-perl,
+ libchi-perl,
libclass-accessor-perl,
libclass-factory-util-perl,
libdata-ical-perl,
+ libdata-paginator-perl,
libdate-calc-perl,
libdate-manip-perl,
libdatetime-event-ical-perl,
libdatetime-perl,
libdatetime-set-perl,
libdatetime-timezone-perl,
+ libdbd-mock-perl,
libdbd-mysql-perl,
libdbd-sqlite2-perl,
libdbi-perl,
libgd-gd2-noxpm-perl | libgd-gd2-perl,
libgraphics-magick-perl,
libgravatar-url-perl,
+ libhtml-format-perl,
libhtml-scrubber-perl,
libhttp-oai-perl,
+ libjson-any-perl,
libjson-perl,
liblingua-stem-perl,
liblingua-stem-snowball-perl,
libmemoize-memcached-perl,
libmime-lite-perl,
libmodern-perl-perl,
+ libmoose-perl,
+ libmoosex-storage-perl,
+ libmoosex-types-perl,
libnet-ldap-perl,
libnet-server-perl,
libnet-z3950-zoom-perl,
libscalar-list-utils-perl,
libschedule-at-perl,
libsms-send-perl,
+ libstring-rewriteprefix-perl,
libtemplate-perl,
+ libtemplate-plugin-htmltotext-perl,
+ libtest-deep-perl,
+ libtest-mockmodule-perl,
libtest-simple-perl | perl-modules,
libtest-strict-perl,
+ libtest-warn-perl,
+ libtest-yaml-valid-perl,
libtext-csv-encoded-perl,
libtext-csv-perl,
libtext-csv-xs-perl,
libtext-iconv-perl,
libtext-unaccent-perl,
+ libtime-progress-perl,
libuniversal-require-perl,
liburi-perl,
libwww-perl,
.
Please see /usr/share/doc/koha/README.Debian for instructions on how to
configure things after installing this package.
+
+Package: koha-deps
+Depends: ${misc:Depends},
+ apache2,
+ apache2-mpm-itk,
+ at,
+ daemon,
+ debconf,
+ idzebra-2.0,
+ libjs-jquery,
+ libjs-yui,
+ mysql-client,
+ mysql-server,
+ perl-doc,
+ pwgen,
+ sudo,
+ tinymce2,
+ unzip,
+ xmlstarlet,
+ yaz
+Architecture: all
+Description: Other dep. for koha
+ Koha is an Integrated Library Managment system for real-world libraries
+ (the kinds with books).
+ .
+ This meta-package contains general dependencies packages for koha (apache2,
+ daemon, debconf, etc.).
+
+Package: koha-perldeps
+Depends: libalgorithm-checkdigits-perl,
+ libanyevent-http-perl,
+ libanyevent-perl,
+ libauthen-cas-client-perl,
+ libbiblio-endnotestyle-perl,
+ libbusiness-isbn-perl,
+ libcache-memcached-fast-perl,
+ libcgi-pm-perl | perl-modules,
+ libcgi-session-driver-memcached-perl,
+ libcgi-session-perl,
+ libcgi-session-serialize-yaml-perl,
+ libchi-driver-memcached-perl,
+ libchi-perl,
+ libclass-accessor-perl,
+ libclass-factory-util-perl,
+ libdata-ical-perl,
+ libdata-paginator-perl,
+ libdate-calc-perl,
+ libdate-manip-perl,
+ libdatetime-event-ical-perl,
+ libdatetime-format-dateparse-perl,
+ libdatetime-format-ical-perl,
+ libdatetime-format-mysql-perl,
+ libdatetime-perl,
+ libdatetime-set-perl,
+ libdatetime-timezone-perl,
+ libdbd-mock-perl,
+ libdbd-mysql-perl,
+ libdbd-sqlite2-perl,
+ libdbi-perl,
+ libdigest-sha-perl | perl,
+ libemail-date-perl,
+ libgd-barcode-perl,
+ libgd-gd2-noxpm-perl | libgd-gd2-perl,
+ libgraphics-magick-perl,
+ libgravatar-url-perl,
+ libhtml-format-perl,
+ libhtml-scrubber-perl,
+ libhttp-oai-perl,
+ libjson-any-perl,
+ libjson-perl,
+ liblingua-stem-perl,
+ liblingua-stem-snowball-perl,
+ liblist-moreutils-perl,
+ liblocale-currency-format-perl,
+ liblocale-po-perl,
+ libmail-sendmail-perl,
+ libmarc-charset-perl,
+ libmarc-crosswalk-dublincore-perl,
+ libmarc-record-perl,
+ libmarc-xml-perl,
+ libmemoize-memcached-perl,
+ libmime-lite-perl,
+ libmodern-perl-perl,
+ libmoose-perl,
+ libmoosex-storage-perl,
+ libmoosex-types-perl,
+ libnet-ldap-perl,
+ libnet-server-perl,
+ libnet-z3950-zoom-perl,
+ libnumber-format-perl,
+ libpdf-api2-perl,
+ libpdf-api2-simple-perl,
+ libpdf-reuse-barcode-perl,
+ libpdf-reuse-perl,
+ libpdf-table-perl,
+ libpoe-perl,
+ libreadonly-perl,
+ libreadonly-xs-perl,
+ libscalar-list-utils-perl,
+ libschedule-at-perl,
+ libsms-send-perl,
+ libstring-rewriteprefix-perl,
+ libtemplate-perl,
+ libtemplate-plugin-htmltotext-perl,
+ libtest-deep-perl,
+ libtest-mockmodule-perl,
+ libtest-simple-perl | perl-modules,
+ libtest-strict-perl,
+ libtest-warn-perl,
+ libtest-yaml-valid-perl,
+ libtext-csv-encoded-perl,
+ libtext-csv-perl,
+ libtext-csv-xs-perl,
+ libtext-iconv-perl,
+ libtext-unaccent-perl,
+ libtime-progress-perl,
+ libuniversal-require-perl,
+ liburi-perl,
+ libwww-perl,
+ libxml-dumper-perl,
+ libxml-libxml-perl,
+ libxml-libxslt-perl,
+ libxml-rss-perl,
+ libxml-sax-perl,
+ libxml-sax-writer-perl,
+ libxml-simple-perl,
+ libyaml-perl,
+ libyaml-syck-perl,
+ perl,
+ perl-modules
+Architecture: all
+Description: Perl dep. for koha
+ Koha is an Integrated Library Managment system for real-world libraries
+ (the kinds with books).
+ .
+ This meta-package contains perl dependencies packages for koha (all
+ perl lib).
<refsect2><title>Administer instances</title>
<variablelist>
+ <varlistentry>
+ <term><option>koha-create</option></term>
+ <listitem>
+ <para>Create new Koha instances.</para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>koha-disable</option></term>
<listitem>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>koha-run-backups</option></term>
+ <listitem>
+ <para>Performs backups of the koha installations on the system, except an instance called 'demo'.</para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>koha-remove</option></term>
<listitem>
<refsynopsisdiv>
<cmdsynopsis>
- <command>koha-list</command> <arg><option>--enabled</option></arg> <arg><option>--email</option>|<option>--noemail</option></arg> <arg><option>command</option></arg>
+ <command>koha-foreach</command> <arg><option>--enabled</option></arg> <arg><option>--email</option>|<option>--noemail</option></arg> <arg><option>command</option></arg>
</cmdsynopsis>
</refsynopsisdiv>
--- /dev/null
+<article xmlns='http://docbook.org/ns/docbook'>
+<title>koha-run-backups</title>
+<info>
+<productname>Koha</productname> is the first free software library automation package.
+<author>
+ <orgname>The Koha Communnity</orgname>
+ <uri>http://koha-community.org/</uri>
+</author>
+</info>
+
+<refentry xml:id="koha-run-backups">
+
+ <refmeta>
+ <refentrytitle>koha-run-backups</refentrytitle>
+ <manvolnum>8</manvolnum>
+ </refmeta>
+
+ <refnamediv>
+ <refname>koha-run-backups</refname>
+ <refpurpose>Performs backups of the koha installations on the system, except an instance called 'demo'.</refpurpose>
+ <refclass>UNIX/Linux</refclass>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <cmdsynopsis>
+ <command>koha-run-backups</command>
+ <arg><option>--output</option> /some/path</arg>
+ <arg><option>--days</option> 2</arg>
+ </cmdsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1><title>Options</title>
+ <variablelist>
+
+ <varlistentry>
+ <term><option>--output</option></term>
+ <listitem>
+ <para>The directory that the resulting files will be placed into (default: /var/spool/koha).</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><option>--days</option></term>
+ <listitem>
+ <para>The number of days to keep backups around for (default: 2).</para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </refsect1>
+
+ <refsect1><title>Description</title>
+ <para><command>koha-run-backups</command> allows automation of backing up the koha data and configuration to the filesystem. It will keep the past so many backups, discarding older ones. This script uses <command>koha-dump</command> to do the actual backup.</para>
+ <para>If there is an instance called 'demo', it will be skipped by this script.</para>
+ <para>Note: backups produced using this tool can be restored using <command>koha-restore</command>.</para>
+ </refsect1>
+
+ <refsect1><title>See also</title>
+
+ <simplelist type="inline">
+ <member><command>koha-dump(8)</command></member>
+ <member><command>koha-restore(8)</command></member>
+ </simplelist>
+
+ </refsect1>
+
+</refentry>
+
+</article>
[ $# -ge 2 ] && [ $# -le 16 ] || die $usage
-TEMP=`getopt -o crpm:l:d:f:a: -l create-db,request-db,populate-db,use-db,marcflavor:,zebralang:,defaultsql:,configfile:,passwdfile:,adminuser: \
+TEMP=`getopt -o crpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,marcflavor:,zebralang:,defaultsql:,configfile:,passwdfile:,database:,adminuser: \
-n "$0" -- "$@"`
# Note the quotes around `$TEMP': they are essential!
September 11 2012 Melia Meggs becomes the 190th developer to have a patch pushed
September 20 2012 Joseph Alway beomes the 191st developer to have a patch pushed
September 22 2012 Koha 3.8.5 released releases
-September 22 2012 Koha 3.6.8 released releases
+September 22 2012 Koha 3.6.9 released releases
October 13 2012 Ivan Brown becomes the 192nd developer to have a patch pushed
-October 22 2012 Mathieu Saby becomes the 192nd developer to have a patch pushed
+October 22 2012 Mathieu Saby becomes the 193rd developer to have a patch pushed
October 22 2012 Koha 3.8.6 released releases
+October 23 2012 Koha 3.6.10 released releases
+October 26 2012 Robert Williams becomes the 194th developer to have a patch pushed
authority-zebra-indexdefs.xsl`
-->
<kohaidx:index_defs xmlns:kohaidx="http://www.koha-community.org/schemas/index-defs">
+ <id>marc:controlfield[@tag='001']</id>
<!-- variables -->
<kohaidx:var name="form_subdivision_subfield">v</kohaidx:var>
<kohaidx:var name="general_subdivision_subfield">x</kohaidx:var>
</xslo:if>
</xslo:template>
<xslo:template match="marc:record">
- <xslo:variable name="controlField001" select="normalize-space(marc:controlfield[@tag='001'])"/>
+ <xslo:variable name="idfield" select="normalize-space(marc:controlfield[@tag='001'])"/>
<z:record type="update">
<xslo:attribute name="z:id">
- <xslo:value-of select="$controlField001"/>
+ <xslo:value-of select="$idfield"/>
</xslo:attribute>
<xslo:apply-templates/>
<xslo:apply-templates mode="index_subfields"/>
<?xml version="1.0" encoding="utf-8"?>
<kohaidx:index_defs xmlns:kohaidx="http://www.koha-community.org/schemas/index-defs">
<!--record.abs line 40: xelm /record/leader llength:w:range(data,0,5),rtype:w:range(data,6,1),Bib-level:w:range(data,7,1)-->
+ <id>marc:datafield[@tag='999']/marc:subfield[@code='c']</id>
<index_leader xmlns="http://www.koha-community.org/schemas/index-defs" offset="0" length="5">
<target_index>llength:w</target_index>
</index_leader>
</index_subfields>
<!--record.abs line 286: melm 952$3 materials-specified -->
<index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="3">
- <target_index>materials-specified :w</target_index>
+ <target_index>materials-specified:w</target_index>
</index_subfields>
<!--record.abs line 287: melm 952$4 damaged:n,damaged:w-->
<index_subfields xmlns="http://www.koha-community.org/schemas/index-defs" tag="952" subfields="4">
<xslo:template match="text()" mode="index_subfields"/>
<xslo:template match="text()" mode="index_data_field"/>
<xslo:template match="text()" mode="index_heading"/>
+ <xslo:template match="text()" mode="index_heading_conditional"/>
<xslo:template match="text()" mode="index_match_heading"/>
<xslo:template match="text()" mode="index_subject_thesaurus"/>
<xslo:template match="/">
</xslo:if>
</xslo:template>
<xslo:template match="marc:record">
- <xslo:variable name="controlField001" select="normalize-space(marc:controlfield[@tag='001'])"/>
+ <xslo:variable name="idfield" select="normalize-space(marc:datafield[@tag='999']/marc:subfield[@code='c'])"/>
<z:record type="update">
<xslo:attribute name="z:id">
- <xslo:value-of select="$controlField001"/>
+ <xslo:value-of select="$idfield"/>
</xslo:attribute>
<xslo:apply-templates/>
<xslo:apply-templates mode="index_subfields"/>
<xslo:apply-templates mode="index_data_field"/>
<xslo:apply-templates mode="index_heading"/>
+ <xslo:apply-templates mode="index_heading_conditional"/>
<xslo:apply-templates mode="index_match_heading"/>
<xslo:apply-templates mode="index_subject_thesaurus"/>
</z:record>
<?xml version="1.0" encoding="utf-8"?>
<kohaidx:index_defs xmlns:kohaidx="http://www.koha-community.org/schemas/index-defs">
+ <id>marc:controlfield[@tag='001']</id>
<!--record.abs line 24: melm 001 Local-number,Local-number:n-->
<index_control_field xmlns="http://www.koha-community.org/schemas/index-defs" tag="001">
<target_index>Local-number:w</target_index>
<xslo:template match="text()" mode="index_subfields"/>
<xslo:template match="text()" mode="index_data_field"/>
<xslo:template match="text()" mode="index_heading"/>
+ <xslo:template match="text()" mode="index_heading_conditional"/>
<xslo:template match="text()" mode="index_match_heading"/>
<xslo:template match="text()" mode="index_subject_thesaurus"/>
<xslo:template match="/">
</xslo:if>
</xslo:template>
<xslo:template match="marc:record">
- <xslo:variable name="controlField001" select="normalize-space(marc:controlfield[@tag='001'])"/>
+ <xslo:variable name="idfield" select="normalize-space(marc:controlfield[@tag='001'])"/>
<z:record type="update">
<xslo:attribute name="z:id">
- <xslo:value-of select="$controlField001"/>
+ <xslo:value-of select="$idfield"/>
</xslo:attribute>
<xslo:apply-templates/>
<xslo:apply-templates mode="index_subfields"/>
<xslo:apply-templates mode="index_data_field"/>
<xslo:apply-templates mode="index_heading"/>
+ <xslo:apply-templates mode="index_heading_conditional"/>
<xslo:apply-templates mode="index_match_heading"/>
<xslo:apply-templates mode="index_subject_thesaurus"/>
</z:record>
</xslo:template>
<xslo:template match="marc:record">
- <xslo:variable name="controlField001" select="normalize-space(marc:controlfield[@tag='001'])"/>
+ <xslo:variable name="idfield">
+ <xsl:attribute name="select">normalize-space(<xsl:value-of select="//id"/>)</xsl:attribute>
+ </xslo:variable>
<z:record type="update">
- <xslo:attribute name="z:id"><xslo:value-of select="$controlField001"/></xslo:attribute>
+ <xslo:attribute name="z:id"><xslo:value-of select="$idfield"/></xslo:attribute>
<xslo:apply-templates/>
<xslo:apply-templates mode="index_subfields"/>
<xslo:apply-templates mode="index_data_field"/>
<xsl:template name="handle-index-heading-conditional">
<xsl:for-each select="//kohaidx:index_heading_conditional[generate-id() = generate-id(key('index_heading_conditional_tag', @tag)[1])]">
<xslo:template mode="index_heading_conditional">
+ <xsl:attribute name="match">marc:datafield[@tag='<xsl:value-of select="@tag"/>']</xsl:attribute>
<xslo:if>
<xsl:attribute name="test"><xsl:value-of select="@test"/></xsl:attribute>
<xsl:for-each select="key('index_heading_conditional_tag', @tag)">
libschedule-at-perl install
libsms-send-perl install
libtemplate-perl install
+libtemplate-plugin-htmltotext-perl install
libtext-charwidth-perl install
libtext-csv-encoded-perl install
libtext-csv-perl install
libschedule-at-perl install
libsms-send-perl install
libtemplate-perl install
+libtemplate-plugin-htmltotext-perl install
libtext-charwidth-perl install
libtext-csv-encoded-perl install
libtext-csv-perl install
libsms-send-perl install
libstring-rewriteprefix-perl install
libtemplate-perl install
+libtemplate-plugin-htmltotext-perl install
libtest-mockmodule-perl install
libtest-strict-perl install
libtext-charwidth-perl install
libsms-send-perl install
libstring-rewriteprefix-perl install
libtemplate-perl install
+libtemplate-plugin-htmltotext-perl install
libtest-mockmodule-perl install
libtest-strict-perl install
libtext-charwidth-perl install
$dbh->do("ALTER TABLE old_issues CHANGE returndate returndate datetime");
$dbh->do("ALTER TABLE old_issues CHANGE lastreneweddate lastreneweddate datetime");
$dbh->do("ALTER TABLE old_issues CHANGE issuedate issuedate datetime");
- print "Upgrade to $DBversion done (Setting up issues tables for hourly loans)\n";
+ $dbh->do("UPDATE accountlines SET description = CONCAT(description,' 23:59') WHERE accounttype='F' OR accounttype='FU'"); #BUG-8253
+ print "Upgrade to $DBversion done (Setting up issues and accountlines tables for hourly loans)\n";
SetVersion($DBversion);
}
}
div.subfield_line {
- padding-bottom : .3em;
- clear: both;
+ padding-bottom: .3em;
+ float: left;
+ clear: left;
+ width: 100%;
}
div.subfield_line label {
clear:left;
}
+.subfieldcode img {
+ cursor: pointer;
+}
+
.tag_title {
font-size : 90%;
padding : .2em 0;
}
fieldset.action, div.action {
+ background-color: transparent;
clear : both;
float : none;
border : 0px;
--- /dev/null
+/*
+ * Unified file for catalogue edition
+ */
+
+/* Functions developed for addbiblio.tt and authorities.tt */
+
+// returns the fieldcode based upon tag div id
+function getFieldCode(tagDivId){
+ // format : tag_<tagnumber>_...
+ return tagDivId.substr(3+1,3);
+}
+
+//returns the field and subfieldcode based upon subfield div id
+function getFieldAndSubfieldCode(subfieldDivId){
+ // format : subfield<tagnumber><subfieldnumber>...
+ return subfieldDivId.substr(8,3+1);
+}
+
+//returns the subfieldcode based upon subfieldid writing
+function getSubfieldCode(tagsubfieldid){
+ // 3 : tag +3 : tagnumber +4 : number of _ +8 subfield -1 begins at 0
+ return tagsubfieldid.substr(3+3+4+8-1,1);
+}
+
+// Take the base of tagsubfield information (removing the subfieldcodes and subfieldindexes)
+// returns the filter
+function getTagInputnameFilter(tagsubfieldid){
+ var tagsubfield=tagsubfieldid.substr(0,tagsubfieldid.lastIndexOf("_"));
+ var tagcode=tagsubfield.substr(tagsubfield.lastIndexOf("_"));
+ tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_"));
+ tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_"));
+ tagsubfield=tagsubfield+"_."+tagcode;
+ return tagsubfield;
+}
+
+// if source is "auth", we are editing an authority otherwise it is a biblio
+function openAuth(tagsubfieldid,authtype,source) {
+ // let's take the base of tagsubfield information (removing the indexes and the codes
+ var element=document.getElementById(tagsubfieldid);
+ var tagsubfield=getTagInputnameFilter(tagsubfieldid);
+ var elementsubfcode=getSubfieldCode(element.name);
+ var mainmainstring=element.value;
+ var mainstring="";
+ var inputs = element.parentNode.parentNode.getElementsByTagName("input");
+
+ for (var myindex =0; myindex<inputs.length;myindex++){
+ if (inputs[myindex].name && inputs[myindex].name.match(tagsubfield)){
+ var subfieldcode=getSubfieldCode(inputs[myindex].name);
+ if (isNaN(parseInt(subfieldcode)) && inputs[myindex].value != "" && subfieldcode!=elementsubfcode){
+ mainstring=inputs[myindex].value+" "+mainstring;
+ }
+ }
+ }
+ newin=window.open("../authorities/auth_finder.pl?source="+source+"&authtypecode="+authtype+"&index="+tagsubfieldid+"&value_mainstr="+encodeURI(mainmainstring)+"&value_main="+encodeURI(mainstring), "_blank",'width=700,height=550,toolbar=false,scrollbars=yes');
+}
+
+function ExpandField(index) {
+ var original = document.getElementById(index); //original <div>
+ var divs = original.getElementsByTagName('div');
+ for(var i=0,divslen = divs.length ; i<divslen ; i++){ // foreach div
+ if(divs[i].getAttribute('id').match(/^subfield/)){ // if it s a subfield
+ if (!divs[i].style.display) {
+ // first time => show all subfields
+ divs[i].style.display = 'block';
+ } else if (divs[i].style.display == 'none') {
+ // show
+ divs[i].style.display = 'block';
+ } else {
+ // hide
+ divs[i].style.display = 'none';
+ }
+ }
+ }
+}
+/**
+ * To clone a field
+ * @param hideMarc '0' for false, '1' for true
+ * @param advancedMARCEditor '0' for false, '1' for true
+ */
+function CloneField(index, hideMarc, advancedMARCEditor) {
+ var original = document.getElementById(index); //original <div>
+ var clone = original.cloneNode(true);
+ var new_key = CreateKey();
+ var new_id = original.getAttribute('id')+new_key;
+
+ clone.setAttribute('id',new_id); // setting a new id for the parent div
+
+ var divs = clone.getElementsByTagName('div');
+
+ // if hide_marc, indicators are hidden fields
+ // setting a new name for the new indicator
+ for(var i=0; i < 2; i++) {
+ var indicator = clone.getElementsByTagName('input')[i];
+ indicator.setAttribute('name',indicator.getAttribute('name')+new_key);
+ }
+
+ // settings all subfields
+ for(var i=0,divslen = divs.length ; i<divslen ; i++){ // foreach div
+ if(divs[i].getAttribute("id").match(/^subfield/)){ // if it s a subfield
+
+ // set the attribute for the new 'div' subfields
+ divs[i].setAttribute('id',divs[i].getAttribute('id')+new_key);
+
+ var inputs = divs[i].getElementsByTagName('input');
+ var id_input = "";
+
+ for( j = 0 ; j < inputs.length ; j++ ) {
+ if(inputs[j].getAttribute("id") && inputs[j].getAttribute("id").match(/^tag_/) ){
+ inputs[j].value = "";
+ }
+ }
+
+ inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key);
+ inputs[0].setAttribute('name',inputs[0].getAttribute('name')+new_key);
+ var id_input;
+ try {
+ id_input = inputs[1].getAttribute('id')+new_key;
+ inputs[1].setAttribute('id',id_input);
+ inputs[1].setAttribute('name',inputs[1].getAttribute('name')+new_key);
+ } catch(e) {
+ try{ // it s a select if it is not an input
+ var selects = divs[i].getElementsByTagName('select');
+ id_input = selects[0].getAttribute('id')+new_key;
+ selects[0].setAttribute('id',id_input);
+ selects[0].setAttribute('name',selects[0].getAttribute('name')+new_key);
+ }catch(e2){ // it is a textarea if it s not a select or an input
+ var textaeras = divs[i].getElementsByTagName('textarea');
+ id_input = textaeras[0].getAttribute('id')+new_key;
+ textaeras[0].setAttribute('id',id_input);
+ textaeras[0].setAttribute('name',textaeras[0].getAttribute('name')+new_key);
+ }
+ }
+
+ if (advancedMARCEditor == '0') {
+ // when cloning a subfield, re set its label too.
+ var labels = divs[i].getElementsByTagName('label');
+ labels[0].setAttribute('for',id_input);
+ }
+
+ if(hideMarc == '0') {
+ // updating javascript parameters on button up
+ var imgs = divs[i].getElementsByTagName('img');
+ imgs[0].setAttribute('onclick',"upSubfield(\'"+divs[i].getAttribute('id')+"\');");
+ }
+
+ // setting its '+' and '-' buttons
+ try {
+ var anchors = divs[i].getElementsByTagName('a');
+ for (var j = 0; j < anchors.length; j++) {
+ if(anchors[j].getAttribute('class') == 'buttonPlus'){
+ anchors[j].setAttribute('onclick',"CloneSubfield('" + divs[i].getAttribute('id') + "','" + advancedMARCEditor + "'); return false;");
+ } else if (anchors[j].getAttribute('class') == 'buttonMinus') {
+ anchors[j].setAttribute('onclick',"UnCloneField('" + divs[i].getAttribute('id') + "'); return false;");
+ }
+ }
+ }
+ catch(e){
+ // do nothig if ButtonPlus & CloneButtonPlus don t exist.
+ }
+
+ // button ...
+ var spans=0;
+ try {
+ spans = divs[i].getElementsByTagName('a');
+ } catch(e) {
+ // no spans
+ }
+ if(spans){
+ var buttonDot;
+ if(!CloneButtonPlus){ // it s impossible to have + ... (buttonDot AND buttonPlus)
+ buttonDot = spans[0];
+ if(buttonDot){
+ // 2 possibilities :
+ try{
+ var buttonDotOnClick = buttonDot.getAttribute('onclick');
+ if(buttonDotOnClick.match('Clictag')){ // -1- It s a plugin
+ var re = /\('.*'\)/i;
+ buttonDotOnClick = buttonDotOnClick.replace(re,"('"+inputs[1].getAttribute('id')+"')");
+ if(buttonDotOnClick){
+ buttonDot.setAttribute('onclick',buttonDotOnClick);
+ }
+ } else {
+ if(buttonDotOnClick.match('Dopop')) { // -2- It's a auth value
+ var re1 = /&index=.*',/;
+ var re2 = /,.*\)/;
+
+ buttonDotOnClick = buttonDotOnClick.replace(re1,"&index="+inputs[1].getAttribute('id')+"',");
+ buttonDotOnClick = buttonDotOnClick.replace(re2,",'"+inputs[1].getAttribute('id')+"')");
+
+ if(buttonDotOnClick){
+ buttonDot.setAttribute('onclick',buttonDotOnClick);
+ }
+ }
+ }
+ try {
+ // do not copy the script section.
+ var script = spans[0].getElementsByTagName('script')[0];
+ spans[0].removeChild(script);
+ } catch(e) {
+ // do nothing if there is no script
+ }
+ }catch(e){}
+ }
+ }
+ }
+ if(hideMarc == '0') {
+ var buttonUp = divs[i].getElementsByTagName('img')[0];
+ buttonUp.setAttribute('onclick',"upSubfield('" + divs[i].getAttribute('id') + "')");
+ }
+
+ } else { // it's a indicator div
+ if(divs[i].getAttribute('id').match(/^div_indicator/)){
+
+ // setting a new id for the indicator div
+ divs[i].setAttribute('id',divs[i].getAttribute('id')+new_key);
+
+ var inputs = divs[i].getElementsByTagName('input');
+ inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key);
+ inputs[1].setAttribute('id',inputs[1].getAttribute('id')+new_key);
+
+ var CloneButtonPlus;
+ try {
+ var anchors = divs[i].getElementsByTagName('a');
+ for (var j = 0; j < anchors.length; j++) {
+ if (anchors[j].getAttribute('class') == 'buttonPlus') {
+ anchors[j].setAttribute('onclick',"CloneField('" + new_id + "','" + hideMarc + "','" + advancedMARCEditor + "'); return false;");
+ } else if (anchors[j].getAttribute('class') == 'buttonMinus') {
+ anchors[j].setAttribute('onclick',"UnCloneField('" + new_id + "'); return false;");
+ } else if (anchors[j].getAttribute('class') == 'expandfield') {
+ anchors[j].setAttribute('onclick',"ExpandField('" + new_id + "'); return false;");
+ }
+ }
+ }
+ catch(e){
+ // do nothig CloneButtonPlus doesn't exist.
+ }
+
+ }
+ }
+ }
+
+ // insert this line on the page
+ original.parentNode.insertBefore(clone,original.nextSibling);
+}
+
+/**
+ * To clone a subfield
+ * @param index
+ * @param advancedMARCEditor '0' for false, '1' for true
+ */
+function CloneSubfield(index, advancedMARCEditor){
+ var original = document.getElementById(index); //original <div>
+ var clone = original.cloneNode(true);
+ var new_key = CreateKey();
+
+ // set the attribute for the new 'div' subfields
+ var inputs = clone.getElementsByTagName('input');
+ var selects = clone.getElementsByTagName('select');
+ var textareas = clone.getElementsByTagName('textarea');
+ var linkid;
+
+ // input
+ var id_input = "";
+ for(var i=0,len=inputs.length; i<len ; i++ ){
+ id_input = inputs[i].getAttribute('id')+new_key;
+ inputs[i].setAttribute('id',id_input);
+ inputs[i].setAttribute('name',inputs[i].getAttribute('name')+new_key);
+ linkid = id_input;
+ }
+
+ // select
+ for(var i=0,len=selects.length; i<len ; i++ ){
+ id_input = selects[i].getAttribute('id')+new_key;
+ selects[i].setAttribute('id',selects[i].getAttribute('id')+new_key);
+ selects[i].setAttribute('name',selects[i].getAttribute('name')+new_key);
+ }
+
+ // textarea
+ for(var i=0,len=textareas.length; i<len ; i++ ){
+ id_input = textareas[i].getAttribute('id')+new_key;
+ textareas[i].setAttribute('id',textareas[i].getAttribute('id')+new_key);
+ textareas[i].setAttribute('name',textareas[i].getAttribute('name')+new_key);
+ }
+
+ // Changing the "..." link's onclick attribute for plugin callback
+ var links = clone.getElementsByTagName('a');
+ var link = links[0];
+ var buttonDotOnClick = link.getAttribute('onclick');
+ if(buttonDotOnClick.match('Clictag')){ // -1- It s a plugin
+ var re = /\('.*'\)/i;
+ buttonDotOnClick = buttonDotOnClick.replace(re,"('"+linkid+"')");
+ if(buttonDotOnClick){
+ link.setAttribute('onclick',buttonDotOnClick);
+ }
+ }
+
+ if(advancedMARCEditor == '0') {
+ // when cloning a subfield, reset its label too.
+ var label = clone.getElementsByTagName('label')[0];
+ label.setAttribute('for',id_input);
+ }
+
+ // setting a new id for the parent div
+ var new_id = original.getAttribute('id')+new_key;
+ clone.setAttribute('id',new_id);
+
+ try {
+ var buttonUp = clone.getElementsByTagName('img')[0];
+ buttonUp.setAttribute('onclick',"upSubfield('" + new_id + "')");
+ var anchors = clone.getElementsByTagName('a');
+ if(anchors.length){
+ for(var i = 0 ,lenanchors = anchors.length ; i < lenanchors ; i++){
+ if(anchors[i].getAttribute('class') == 'buttonPlus'){
+ anchors[i].setAttribute('onclick',"CloneSubfield('" + new_id + "','" + advancedMARCEditor + "'); return false;");
+ } else if (anchors[i].getAttribute('class') == 'buttonMinus') {
+ anchors[i].setAttribute('onclick',"UnCloneField('" + new_id + "'); return false;");
+ }
+ }
+ }
+ }
+ catch(e){
+ // do nothig if ButtonPlus & CloneButtonPlus don't exist.
+ }
+ // insert this line on the page
+ original.parentNode.insertBefore(clone,original.nextSibling);
+}
+
+ /**
+ * This function removes or clears unwanted subfields
+ */
+function UnCloneField(index) {
+ var original = document.getElementById(index);
+ var canUnclone = false;
+ if ($(original).hasClass("tag")) {
+ // unclone a field, check if there will remain one field
+ var fieldCode = getFieldCode(index);
+ // tag divs with id begining with original field code
+ var cloneFields = $('.tag[id^="tag_'+fieldCode+'"]');
+ if (cloneFields.length > 1) {
+ canUnclone = true;
+ }
+ } else {
+ // unclone a subfield, check if there will remain one subfield
+ var subfieldCode = getFieldAndSubfieldCode(index);
+ // subfield divs with id begining with original field and subfield field code
+ var cloneSubfields = $('.subfield_line[id^="subfield'+subfieldCode+'"]');
+ if (cloneSubfields.length > 1) {
+ canUnclone = true;
+ }
+ }
+ if (canUnclone) {
+ // remove clone
+ original.parentNode.removeChild(original);
+ } else {
+ // clear inputs, but don't delete
+ $(":input.input_marceditor", original).each(function(){
+ // thanks to http://www.learningjquery.com/2007/08/clearing-form-data for
+ // hint about clearing selects correctly
+ var type = this.type;
+ var tag = this.tagName.toLowerCase();
+ if (type == 'text' || type == 'password' || tag == 'textarea') {
+ this.value = "";
+ } else if (type == 'checkbox' || type == 'radio') {
+ this.checked = false;
+ } else if (tag == 'select') {
+ this.selectedIndex = -1;
+ }
+ });
+ $(":input.indicator", original).val("");
+ }
+}
+
+/**
+ * This function create a random number
+ */
+function CreateKey(){
+ return parseInt(Math.random() * 100000);
+}
+
+/**
+ * This function allows to move a subfield up by clickink on the 'up' button .
+ */
+function upSubfield(index) {
+ try{
+ var line = document.getElementById(index); // get the line where the user has clicked.
+ } catch(e) {
+ return; // this line doesn't exist...
+ }
+ var tag = line.parentNode; // get the dad of this line. (should be "<div id='tag_...'>")
+
+ // getting all subfields for this tag
+ var subfields = tag.getElementsByTagName('div');
+ var subfieldsLength = subfields.length;
+
+ if(subfieldsLength<=1) return; // nothing to do if there is just one subfield.
+
+ // among all subfields
+ for(var i=0;i<subfieldsLength;i++){
+ if(subfields[i].getAttribute('id') == index){ //looking for the subfield which is clicked :
+ if(i==1){ // if the clicked subfield is on the top
+ tag.appendChild(subfields[1]);
+ return;
+ } else {
+ var lineAbove = subfields[i-1];
+ tag.insertBefore(line,lineAbove);
+ return;
+ }
+ }
+ }
+}
+
+// FIXME :: is it used ?
+function unHideSubfield(index,labelindex) {
+ subfield = document.getElementById(index);
+ subfield.style.display = 'block';
+ label = document.getElementById(labelindex);
+ label.style.display='none';
+}
+
+/* Functions developed for additem.tt */
+
+/**
+ * To clone a subfield.<br>
+ * @param original subfield div to clone
+ */
+function CloneItemSubfield(original){
+ var clone = original.cloneNode(true);
+ var new_key = CreateKey();
+
+ // set the attribute for the new 'div' subfields
+ var inputs = clone.getElementsByTagName('input');
+ var selects = clone.getElementsByTagName('select');
+ var textareas = clone.getElementsByTagName('textarea');
+
+ // input (except hidden type)
+ var id_input = "";
+ for(var i=0,len=inputs.length; i<len ; i++ ){
+ if (inputs[i].getAttribute('type') != 'hidden') {
+ id_input = inputs[i].getAttribute('id')+new_key;
+ inputs[i].setAttribute('id',id_input);
+ }
+ }
+
+ // select
+ for(var i=0,len=selects.length; i<len ; i++ ){
+ id_input = selects[i].getAttribute('id')+new_key;
+ selects[i].setAttribute('id',selects[i].getAttribute('id')+new_key);
+ }
+
+ // textarea
+ for(var i=0,len=textareas.length; i<len ; i++ ){
+ id_input = textareas[i].getAttribute('id')+new_key;
+ textareas[i].setAttribute('id',textareas[i].getAttribute('id')+new_key);
+ }
+
+ // when cloning a subfield, reset its label too.
+ var label = clone.getElementsByTagName('label')[0];
+ label.setAttribute('for',id_input);
+
+ // setting a new if for the parent div
+ var new_id = original.getAttribute('id')+new_key;
+ clone.setAttribute('id',new_id);
+
+ // insert this line on the page
+ original.parentNode.insertBefore(clone,original.nextSibling);
+}
<li>Ron Wickersham</li>
<li>Brett Wilkins</li>
<li><a href="https://www.ohloh.net/p/koha/contributors/6620692127299">Olwen Williams (Database design and data extraction for Koha 1.0)</a></li>
+ <li>Robert Williams</li>
<li>James Winter</li>
<li>Lars Wirzenius</li>
</ul>
<title>Koha › Authorities › [% IF ( authid ) %]Modify authority #[% authid %] ([% authtypetext %])[% ELSE %]Adding authority ([% authtypetext %])[% END %]</title>
[% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript" src="[% themelang %]/lib/yui/plugins/bubbling-min.js"></script>
+<script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
<script type="text/javascript">
//<![CDATA[
- var fields_in_use = {};
$(document).ready(function() {
$('#authoritytabs').tabs();
- $('.tag').each(function() {
- var field_id = this.getAttribute('id').substring(0, 7);
- if (field_id in fields_in_use) {
- fields_in_use[field_id]++;
- } else {
- fields_in_use[field_id] = 1;
- }
- });
- $('.subfield_line').each(function() {
- var field_id = this.getAttribute('id').substring(0, 12);
- if (field_id in fields_in_use) {
- fields_in_use[field_id]++;
- } else {
- fields_in_use[field_id] = 1;
- }
- });
+
$("#f").submit(function(){
return $(this).Check();
});
});
/**
- * check if mandatory subfields are writed
+ * check if mandatory subfields are written
*/
function AreMandatoriesNotOk(){
var mandatories = new Array();
for(var j=0,len2=eleminputs.length; j<len2; j++){
if(eleminputs[j].name.match(varegexp) && eleminputs[j].value){
- /* tag_801_subfield_c_841304_545657 */
inputregexp = new RegExp("^tag_" + arr[0] + "_subfield_" + eleminputs[j].value + "_" + arr[2]);
for( var k=0; k<len2; k++){
}
}
-
-// returns the subfieldcode based upon subfieldid writing
-function getSubfieldcode(tagsubfieldid){
- // 3 : tag +3 : tagnumber +4 : number of _ +8 subfield -1 begins at 0
- return tagsubfieldid.substr(3+3+4+8-1,1);
-}
-
-// Take the base of tagsubfield information (removing the subfieldcodes and subfieldindexes)
-// returns the filter
-function getTagInputnameFilter(tagsubfieldid){
- var tagsubfield=tagsubfieldid.substr(0,tagsubfieldid.lastIndexOf("_"));
- var tagcode=tagsubfield.substr(tagsubfield.lastIndexOf("_"));
- tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_"));
- tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_"));
- tagsubfield=tagsubfield+"_."+tagcode;
- return tagsubfield;
-}
-
-function openAuth(tagsubfieldid,authtype) {
- // let's take the base of tagsubfield information (removing the indexes and the codes
- var element=document.getElementById(tagsubfieldid);
- var tagsubfield=getTagInputnameFilter(tagsubfieldid);
- var elementsubfcode=getSubfieldcode(element.name);
- var mainmainstring=element.value;
- var mainstring="";
- var inputs = element.parentNode.parentNode.getElementsByTagName("input");
-
- for (var myindex =0; myindex<inputs.length;myindex++){
- if (inputs[myindex].name && inputs[myindex].name.match(tagsubfield)){
- var subfieldcode=getSubfieldcode(inputs[myindex].name);
- if (isNaN(parseInt(subfieldcode)) && inputs[myindex].value != "" && subfieldcode!=elementsubfcode){
- mainstring=inputs[myindex].value+" "+mainstring;
- }
- }
- }
- newin=window.open("../authorities/auth_finder.pl?source=auth&authtypecode="+ authtype+ "&index="+tagsubfieldid+"&value_mainstr="+encodeURI(mainmainstring)+"&value_main="+encodeURI(mainstring), "_blank",'width=700,height=550,toolbar=false,scrollbars=yes');
-}
-
function AddField(field,cntrepeatfield) {
document.forms['f'].op.value = "addfield";
document.forms['f'].addfield_field.value=field;
document.f.submit();
}
-
-function ExpandField(index) {
- var original = document.getElementById(index); //original <div>
- var divs = original.getElementsByTagName('div');
- for(var i=0,divslen = divs.length ; i<divslen ; i++){ // foreach div
- if(divs[i].getAttribute("name") == 'line'){ // if it s a subfield
- if (divs[i].style.display == 'block') {
- divs[i].style.display = 'none';
- } else {
- divs[i].style.display = 'block';
- }
- }
- }
-}
-
-/**
- * To clone a field or a subfield by clickink on '+' button
- */
-function CloneField(index) {
- var original = document.getElementById(index); //original <div>
- fields_in_use[index.substr(0, 7)]++;
- var clone = original.cloneNode(true);
- var new_key = CreateKey();
- var new_id = original.getAttribute('id')+new_key;
-
- clone.setAttribute('id',new_id); // setting a new id for the parent div
-
- var divs = clone.getElementsByTagName('div');
-
- [% UNLESS ( hide_marc ) %] // No indicator if hide_marc
- // setting a new name for the new indicator
- for(var i=0; i < 2; i++) {
- var indicator = clone.getElementsByTagName('input')[i];
- indicator.setAttribute('name',indicator.getAttribute('name')+new_key);
- }
- [% END %]
-
- // settings all subfields
- for(var i=0,divslen = divs.length ; i<divslen ; i++){ // foreach div
- if(divs[i].getAttribute("name") == 'line'){ // if it s a subfield
-
- // set the attribute for the new 'div' subfields
- divs[i].setAttribute('id',divs[i].getAttribute('id')+new_key);
-
- var inputs = divs[i].getElementsByTagName('input');
- var id_input = "";
-
- inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key);
- inputs[0].setAttribute('name',inputs[0].getAttribute('name')+new_key);
- var id_input;
- try {
- id_input = inputs[1].getAttribute('id')+new_key;
- inputs[1].setAttribute('id',id_input);
- inputs[1].setAttribute('name',inputs[1].getAttribute('name')+new_key);
- } catch(e) {
- try{ // it s a select if it is not an input
- var selects = divs[i].getElementsByTagName('select');
- id_input = selects[0].getAttribute('id')+new_key;
- selects[0].setAttribute('id',id_input);
- selects[0].setAttribute('name',selects[0].getAttribute('name')+new_key);
- }catch(e2){ // it is a textarea if it s not a select or an input
- var textaeras = divs[i].getElementsByTagName('textarea');
- id_input = textaeras[0].getAttribute('id')+new_key;
- textaeras[0].setAttribute('id',id_input);
- textaeras[0].setAttribute('name',textaeras[0].getAttribute('name')+new_key);
- }
- }
-
- [% UNLESS ( advancedMARCEditor ) %]
- // when cloning a subfield, re set its label too.
- var labels = divs[i].getElementsByTagName('label');
- labels[0].setAttribute('for',id_input);
- [% END %]
-
- [% UNLESS ( hide_marc ) %]
- // updating javascript parameters on button up
- var imgs = divs[i].getElementsByTagName('img');
- imgs[0].setAttribute('onclick',"upSubfield(\'"+divs[i].getAttribute('id')+"\');");
- [% END %]
-
- // setting its '+' and '-' buttons
- try {
- var spans = divs[i].getElementsByTagName('span');
- for (var j = 0; j < spans.length; j++) {
- if(spans[j].getAttribute('class') == 'buttonPlus'){
- spans[j].setAttribute('onclick',"CloneSubfield('" + divs[i].getAttribute('id') + "')");
- } else if (spans[j].getAttribute('class') == 'buttonMinus') {
- spans[j].setAttribute('onclick',"UnCloneField('" + divs[i].getAttribute('id') + "')");
- }
- }
- }
- catch(e){
- // do nothig if ButtonPlus & CloneButtonPlus don t exist.
- }
-
- // button ...
- var spans=0;
- try {
- spans = divs[i].getElementsByTagName('span');
- } catch(e) {
- // no spans
- }
- if(spans){
- var buttonDot;
- if(!CloneButtonPlus){ // it s impossible to have + ... (buttonDot AND buttonPlus)
- buttonDot = spans[0];
- if(buttonDot){
- // 2 possibilities :
- try{
- var buttonDotOnClick = buttonDot.getAttribute('onclick');
- if(buttonDotOnClick.match('Clictag')){ // -1- It s a plugin
- var re = /\('.*'\)/i;
- buttonDotOnClick = buttonDotOnClick.replace(re,"('"+inputs[1].getAttribute('id')+"')");
- if(buttonDotOnClick){
- buttonDot.setAttribute('onclick',buttonDotOnClick);
- }
- } else {
- if(buttonDotOnClick.match('Dopop')) { // -2- It's a auth value
-
- var re1 = /&index=.*',/;
- var re2 = /,.*\)/;
-
- buttonDotOnClick = buttonDotOnClick.replace(re1,"&index="+inputs[1].getAttribute('id')+"',");
- buttonDotOnClick = buttonDotOnClick.replace(re2,",'"+inputs[1].getAttribute('id')+"')");
-
- if(buttonDotOnClick){
- buttonDot.setAttribute('onclick',buttonDotOnClick);
- }
- }
- }
- try {
- // do not copy the script section.
- var script = spans[0].getElementsByTagName('script')[0];
- spans[0].removeChild(script);
- } catch(e) {
- // do nothing if there is no script
- }
- }catch(e){}
- }
- }
- }
- [% UNLESS ( hide_marc ) %]
- var buttonUp = divs[i].getElementsByTagName('img')[0];
- buttonUp.setAttribute('onclick',"upSubfield('" + divs[i].getAttribute('id') + "')");
- [% END %]
-
- } else { // it's a indicator div
- if(divs[i].getAttribute('name') == 'div_indicator'){
- var inputs = divs[i].getElementsByTagName('input');
- inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key);
- inputs[1].setAttribute('id',inputs[1].getAttribute('id')+new_key);
-
- var CloneButtonPlus;
- try {
- var anchors = divs[i].getElementsByTagName('span');
- for (var j = 0; j < anchors.length; j++) {
- if (anchors[j].getAttribute('class') == 'buttonPlus') {
- anchors[j].setAttribute('onclick',"CloneField('" + new_id + "')");
- } else if (anchors[j].getAttribute('class') == 'buttonMinus') {
- anchors[j].setAttribute('onclick',"UnCloneField('" + new_id + "')");
- }
- }
- }
- catch(e){
- // do nothig CloneButtonPlus doesn't exist.
- }
-
- // setting its 'Expand' property
- var ExpandFieldA=0;
- try {
- ExpandFieldA = divs[i].getElementsByTagName('a')[0];
- ExpandFieldA.setAttribute('onclick',"ExpandField('" + divs[i].parentNode.getAttribute('id') + "')");
- }
- catch(e){
- // do nothig if ButtonPlus & CloneButtonPlus don t exist.
- }
-
- }
- }
- }
-
- // insert this line on the page
- original.parentNode.insertBefore(clone,original.nextSibling);
-}
-
-function CloneSubfield(index){
- var original = document.getElementById(index); //original <div>
- fields_in_use[index.substr(0, 12)]++;
- var clone = original.cloneNode(true);
- var new_key = CreateKey();
- var new_id = original.getAttribute('id')+new_key;
-
- // set the attribute for the new 'div' subfields
- var inputs = clone.getElementsByTagName('input');
- var selects = clone.getElementsByTagName('select');
- var textareas = clone.getElementsByTagName('textarea');
-
- // input
- var id_input = "";
- for(var i=0,len=inputs.length; i<len ; i++ ){
- id_input = inputs[i].getAttribute('id')+new_key;
- inputs[i].setAttribute('id',id_input);
- inputs[i].setAttribute('name',inputs[i].getAttribute('name')+new_key);
- }
-
- // select
- for(var i=0,len=selects.length; i<len ; i++ ){
- id_input = selects[i].getAttribute('id')+new_key;
- selects[i].setAttribute('id',selects[i].getAttribute('id')+new_key);
- selects[i].setAttribute('name',selects[i].getAttribute('name')+new_key);
- }
-
- // textarea
- for(var i=0,len=textareas.length; i<len ; i++ ){
- id_input = textareas[i].getAttribute('id')+new_key;
- textareas[i].setAttribute('id',textareas[i].getAttribute('id')+new_key);
- textareas[i].setAttribute('name',textareas[i].getAttribute('name')+new_key);
- }
-
- [% UNLESS ( advancedMARCEditor ) %]
- // when cloning a subfield, reset its label too.
- var label = clone.getElementsByTagName('label')[0];
- label.setAttribute('for',id_input);
- [% END %]
-
- // setting a new if for the parent div
- clone.setAttribute('id',new_id);
-
- try {
- var buttonUp = clone.getElementsByTagName('img')[0];
- buttonUp.setAttribute('onclick',"upSubfield('" + new_id + "')");
- var spans = clone.getElementsByTagName('span');
- if(spans.length){
- for(var i = 0 ,lenspans = spans.length ; i < lenspans ; i++){
- if(spans[i].getAttribute('class') == 'buttonPlus'){
- spans[i].setAttribute('onclick',"CloneSubfield('" + new_id + "')");
- } else if (spans[i].getAttribute('class') == 'buttonMinus') {
- spans[i].setAttribute('onclick',"UnCloneField('" + new_id + "')");
- }
- }
- }
- }
- catch(e){
- // do nothig if ButtonPlus & CloneButtonPlus don't exist.
- }
- // insert this line on the page
- original.parentNode.insertBefore(clone,original.nextSibling);
-}
-
- /**
- * This function removes or clears unwanted subfields
- */
-function UnCloneField(index) {
- var original = document.getElementById(index);
- var field_id;
- if (index.match("tag")) {
- field_id = index.substr(0, 7);
- } else {
- field_id = index.substr(0, 12);
- }
- if (1 == fields_in_use[field_id]) {
- // clear inputs, but don't delete
- $(":input.input_marceditor", original).each(function(){
- // thanks to http://www.learningjquery.com/2007/08/clearing-form-data for
- // hint about clearing selects correctly
- var type = this.type;
- var tag = this.tagName.toLowerCase();
- if (type == 'text' || type == 'password' || tag == 'textarea') {
- this.value = "";
- } else if (type == 'checkbox' || type == 'radio') {
- this.checked = false;
- } else if (tag == 'select') {
- this.selectedIndex = -1;
- }
- });
- $(":input.indicator", original).val("");
- } else {
- original.parentNode.removeChild(original);
- fields_in_use[field_id]--;
- }
-}
-
-
-/**
- * This function create a random number
- */
-function CreateKey(){
- return parseInt(Math.random() * 100000);
-}
-
-/**
- * This function allows to move a subfield up by clickink on the 'up' button .
- */
-function upSubfield(index) {
- try{
- var line = document.getElementById(index); // get the line where the user has clicked.
- } catch(e) {
- return; // this line doesn't exist...
- }
- var tag = line.parentNode; // get the dad of this line. (should be "<div id='tag_...'>")
-
- // getting all subfields for this tag
- var subfields = tag.getElementsByTagName('div');
- var subfieldsLength = subfields.length;
-
- if(subfieldsLength<=1) return; // nothing to do if there is just one subfield.
-
- // among all subfields
- for(var i=0;i<subfieldsLength;i++){
- if(subfields[i].getAttribute('id') == index){ //looking for the subfield which is clicked :
- if(i==1){ // if the clicked subfield is on the top
- tag.appendChild(subfields[1]);
- return;
- } else {
- var lineAbove = subfields[i-1];
- tag.insertBefore(line,lineAbove);
- return;
- }
- }
- }
-}
-
-function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
- subfield = document.getElementById(index);
- subfield.style.display = 'block';
- label = document.getElementById(labelindex);
- label.style.display='none';
-}
-
function addauthority() {
X = document.forms[0].authtype.value;
window.location="/cgi-bin/koha/authorities/authorities.pl?authtypecode="+X;
<ul class="toolbar"><li id="addauthc"><input id="addauth" type="submit" value="Save" accesskey="w" /></li></ul></div>
<div id="authoritytabs" class="toptabs numbered">
- <ul> [% FOREACH BIG_LOO IN BIG_LOOP %]
- <li>[% IF ( BIG_LOO.number ) %]
- <a href="#tab[% BIG_LOO.number %]XX">[% BIG_LOO.number %]</a>
- [% ELSE %]
- <a href="#tab[% BIG_LOO.number %]XX">[% BIG_LOO.number %]</a>
- [% END %]</li>
- [% END %]</ul>
+ <ul>
+ [% FOREACH BIG_LOO IN BIG_LOOP %]
+ <li><a href="#tab[% BIG_LOO.number %]XX">[% BIG_LOO.number %]</a></li>
+ [% END %]
+ </ul>
[% FOREACH BIG_LOO IN BIG_LOOP %]
- <!-- hide every tab except the 1st -->
- [% IF ( BIG_LOO.number ) %]
- <div id="tab[% BIG_LOO.number %]XX">
+ <div id="tab[% BIG_LOO.number %]XX">
+
+ [% FOREACH innerloo IN BIG_LOO.innerloop %]
+ [% IF ( innerloo.tag ) %]
+ <div class="tag" id="tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]">
+ <div class="tag_title" id="div_indicator_tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]">
+ [% UNLESS hide_marc %]
+ [% IF advancedMARCEditor %]
+ <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;">[% innerloo.tag %]</a>
[% ELSE %]
- <div id="tab[% BIG_LOO.number %]XX">
+ <span title="[% innerloo.tag_lib %]">[% innerloo.tag %]</span>
[% END %]
-
- [% FOREACH innerloo IN BIG_LOO.innerloop %]
- [% IF ( innerloo.tag ) %]
- <div class="tag" id="tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]">
- <div class="tag_title" name="div_indicator">
- [% UNLESS ( innerloo.hide_marc ) %]
- [% IF ( innerloo.advancedMARCEditor ) %]
- <a class="tagnum" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]')">[% innerloo.tag %]</a>
- [% ELSE %]
- <span title="[% innerloo.tag_lib %]">[% innerloo.tag %]</span>
- [% END %]
- [% IF ( innerloo.fixedfield ) %]
- <input class="indicator flat"
- type="text"
- style="display:none;"
- name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]"
- size="1"
- maxlength="1"
- value="[% innerloo.indicator1 %]" />
- <input class="indicator flat"
- type="text"
- style="display:none;"
- name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]"
- size="1"
- maxlength="1"
- value="[% innerloo.indicator2 %]" />
- [% ELSE %]
- <input class="indicator flat"
- type="text"
- name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]"
- size="1"
- maxlength="1"
- value="[% innerloo.indicator1 %]" />
- <input class="indicator flat"
- type="text"
- name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]"
- size="1"
- maxlength="1"
- value="[% innerloo.indicator2 %]" />
- [% END %] -
+ [% IF ( innerloo.fixedfield ) %]
+ <input type="text"
+ tabindex="1"
+ class="indicator flat"
+ style="display:none;"
+ name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]"
+ size="1"
+ maxlength="1"
+ value="[% innerloo.indicator1 %]" />
+ <input type="text"
+ tabindex="1"
+ class="indicator flat"
+ style="display:none;"
+ name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]"
+ size="1"
+ maxlength="1"
+ value="[% innerloo.indicator2 %]" />
[% ELSE %]
- [% IF ( innerloo.fixedfield ) %]
- <input type="hidden"
- name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %]"
- value="[% innerloo.indicator1 %][% innerloo.random %]" />
- <input type="hidden"
- name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %]"
- value="[% innerloo.indicator2 %][% innerloo.random %]" />
- [% ELSE %]
- <input type="hidden"
- name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %]"
- value="[% innerloo.indicator1 %][% innerloo.random %]" />
- <input type="hidden"
- name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %]"
- value="[% innerloo.indicator2 %][% innerloo.random %]" />
- [% END %]
- [% END %]
-
- [% UNLESS ( innerloo.advancedMARCEditor ) %]
- <a onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]')">[% innerloo.tag_lib %]</a>
+ <input type="text"
+ tabindex="1"
+ class="indicator flat"
+ name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]"
+ size="1"
+ maxlength="1"
+ value="[% innerloo.indicator1 %]" />
+ <input type="text"
+ tabindex="1"
+ class="indicator flat"
+ name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]"
+ size="1"
+ maxlength="1"
+ value="[% innerloo.indicator2 %]" />
+ [% END %] -
+ [% ELSE %]
+ [% IF ( innerloo.fixedfield ) %]
+ <input type="hidden"
+ tabindex="1"
+ name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]"
+ value="[% innerloo.indicator1 %]" />
+ <input type="hidden"
+ tabindex="1"
+ name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]"
+ value="[% innerloo.indicator2 %]" />
+ [% ELSE %]
+ <input type="hidden"
+ tabindex="1"
+ name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]"
+ value="[% innerloo.indicator1 %]" />
+ <input type="hidden"
+ tabindex="1"
+ name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]"
+ value="[% innerloo.indicator2 %]" />
[% END %]
+ [% END %]
+
+ [% UNLESS advancedMARCEditor %]
+ <a href="#" tabindex="1" class="expandfield" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Click to Expand this Tag">[% innerloo.tag_lib %]</a>
+ [% END %]
+ <span class="field_controls">
[% IF ( innerloo.repeatable ) %]
- <span class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]')">+</span>
+ <a href="#" tabindex="1" class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]','[% hide_marc %]','[% advancedMARCEditor %]'); return false;" title="Repeat this Tag">
+ <img src="/intranet-tmpl/prog/img/repeat-tag.png" alt="Repeat this Tag" />
+ </a>
[% END %]
- [% UNLESS ( innerloo.mandatory ) %]
- <span class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]')">−</span>
+ <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Delete this Tag">
+ <img src="/intranet-tmpl/prog/img/delete-tag.png" alt="Delete this Tag" />
+ </a>
+ </span>
+
+ </div>
+
+ [% FOREACH subfield_loo IN innerloo.subfield_loop %]
+ <!-- One line on the marc editor -->
+ <div class="subfield_line" style="[% subfield_loo.visibility %]" id="subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]">
+
+ [% UNLESS advancedMARCEditor %]
+ [% IF ( subfield_loo.fixedfield ) %]<label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" style="display:none;" class="labelsubfield">
+ [% ELSE %]<label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" class="labelsubfield">
+ [% END %]
[% END %]
- </div>
-
- [% FOREACH subfield_loo IN innerloo.subfield_loop %]
- <!-- One line on the marc editor -->
- <div name="line" class="subfield_line" style="[% subfield_loo.visibility %];" id="subfield[% subfield_loo.tag %][% subfield_loo.subfield %]">
-
- [% UNLESS ( subfield_loo.advancedMARCEditor ) %]
- [% IF ( subfield_loo.fixedfield ) %]<label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" style="display:none;" class="labelsubfield" >
- [% ELSE %] <label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" class="labelsubfield" >[% END %]
- [% END %]
-
- [% UNLESS ( subfield_loo.hide_marc ) %]
+ [% UNLESS hide_marc %]
+ <span class="subfieldcode">
[% IF ( subfield_loo.fixedfield ) %]
- <img class="buttonUp" style="display:none;" src="[% themelang %]/../img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %]')" alt="Move Up" title="Move Up" />
- [% ELSE %]
- <img class="buttonUp" src="[% themelang %]/../img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %]')" alt="Move Up" title="Move Up" />
- [% END %]
- <input title="[% subfield_loo.marc_lib_plain %]"
- style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;" type="text"
- name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]"
- value="[% subfield_loo.subfield %]"
- size="1"
- maxlength="1"
- class="flat"
- tabindex="0" />
+ <img class="buttonUp" style="display:none;" src="/intranet-tmpl/prog/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" />
[% ELSE %]
- <input type="hidden"
- name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]"
- value="[% subfield_loo.subfield %]"/>
+ <img class="buttonUp" src="/intranet-tmpl/prog/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" />
[% END %]
+ <input type="text"
+ title="[% subfield_loo.marc_lib_plain %]"
+ style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;"
+ name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]"
+ value="[% subfield_loo.subfield %]"
+ size="1"
+ maxlength="1"
+ class="flat"
+ tabindex="0" />
+ </span>
+ [% ELSE %]
+ <input type="hidden"
+ name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]"
+ value="[% subfield_loo.subfield %]" />
+ [% END %]
+
+ [% UNLESS advancedMARCEditor %]
+ [% IF ( subfield_loo.mandatory ) %]<span class="subfield subfield_mandatory">[% ELSE %]<span class="subfield">[% END %]
+ [% subfield_loo.marc_lib_plain %]
+ [% IF ( subfield_loo.mandatory ) %]<span class="mandatory_marker" title="This field is mandatory">*</span>[% END %]
+ </span>
+ </label>
+ [% END %]
- [% UNLESS ( subfield_loo.advancedMARCEditor ) %]
- [% IF ( subfield_loo.mandatory ) %]<span class="subfield_mandatory">[% END %]
- [% subfield_loo.marc_lib %]
- [% IF ( subfield_loo.mandatory ) %]</span>[% END %]
- </label>
- [% END %]
-
- [% subfield_loo.marc_value %]
-
- [% IF ( subfield_loo.repeatable ) %]
- <a href="#" onclick="CloneSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %]'); return false;"><img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" /></a>
- [% END %]
- [% UNLESS ( subfield_loo.mandatory ) %]
- <a href="#" onclick="UnCloneField('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]'); return false;"><img src="/intranet-tmpl/prog/img/delete-subfield.png" alt="Delete" title="Delete this subfield" /></a>
- [% END %]
-
- </div>
- <!-- End of the line -->
+ [% subfield_loo.marc_value %]
+
+ <span class="subfield_controls">
+ [% IF ( subfield_loo.repeatable ) %]
+ <a href="#" class="buttonPlus" tabindex="1" onclick="CloneSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]','[% advancedMARCEditor %]'); return false;">
+ <img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
+ </a>
+ <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]'); return false;">
+ <img src="/intranet-tmpl/prog/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
+ </a>
+ [% END %]
+ </span>
- [% END %]
</div>
- [% END %]<!-- tag -->
+ <!-- End of the line -->
[% END %]
- </div>
-[% END %]
-[% UNLESS ( singletab ) %]
- </div>
-[% END %]
-</div>
+ </div>
+ [% END %]<!-- if innerloo.tag -->
+ [% END %]<!-- BIG_LOO.innerloop -->
+ </div>
+[% END %]<!-- BIG_LOOP -->
+
+</div><!-- tabs -->
<div name="hidden" id="hidden" class="tab">
[% FOREACH hidden_loo IN hidden_loop %]
<input type="hidden" name="subfield" value="[% oldauthtypetagsubfield %]" />
<input type="hidden" name="field_value" value="[% authtypecode %]" />
[% END %]
+
<fieldset class="action">
<input type="button" id="addauth2" value="Save" onclick="Check(this.form)" accesskey="w" />
</fieldset>
+
</form>
+
+</div>
</div>
</div>
// Try to add as many clones as needed
try {
for(var i=0; i<nb-subfields.length; i++) {
- window.opener.opener.CloneSubfield(subfields[0].getAttribute('id'));
+ window.opener.opener.CloneSubfield(subfields[0].getAttribute('id'),'[% advancedMARCEditor %]');
}
}
catch(err) {
[% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript" src="[% themelang %]/lib/yui/plugins/bubbling-min.js"></script>
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.fixFloat.js"></script>
+<script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
<script type="text/javascript">
//<![CDATA[
- var fields_in_use = {};
$(document).ready(function() {
$('#addbibliotabs').tabs().bind('show.ui-tabs', function(e, ui) {
$("#"+ui.panel.id+" input:eq(0)").focus();
});
- $('.tag').each(function() {
- var field_id = this.getAttribute('id').substring(0, 7);
- if (field_id in fields_in_use) {
- fields_in_use[field_id]++;
- } else {
- fields_in_use[field_id] = 1;
- }
- });
- $('.subfield_line').each(function() {
- var field_id = this.getAttribute('id').substring(0, 12);
- if (field_id in fields_in_use) {
- fields_in_use[field_id]++;
- } else {
- fields_in_use[field_id] = 1;
- }
- });
+
/* check cookie to hide/show marcdocs*/
if($.cookie("marcdocs_[% borrowernumber %]") == 'false'){
hideMARCdocLinks();
Check();
}
-/**
- *
- *
- */
-function Check(){
- var StrAlert = AreMandatoriesNotOk();
- if( ! StrAlert ){
- document.f.submit();
- return true;
- } else {
- alert(StrAlert);
- return false;
- }
-}
-
function Dopop(link,i) {
defaultvalue = document.getElementById(i).value;
window.open(link+"&result="+defaultvalue,"valuebuilder",'width=700,height=550,toolbar=false,scrollbars=yes');
}
}
+/**
+ *
+ *
+ */
+function Check(){
+ var StrAlert = AreMandatoriesNotOk();
+ if( ! StrAlert ){
+ document.f.submit();
+ return true;
+ } else {
+ alert(StrAlert);
+ return false;
+ }
+}
+
/**
* check if z3950 mandatories are set or not
*/
f.submit();
}
-// returns the subfieldcode based upon subfieldid writing
-function getSubfieldcode(tagsubfieldid){
- // 3 : tag +3 : tagnumber +4 : number of _ +8 subfield -1 begins at 0
- return tagsubfieldid.substr(3+3+4+8-1,1);
-}
-
-// Take the base of tagsubfield information (removing the subfieldcodes and subfieldindexes)
-// returns the filter
-function getTagInputnameFilter(tagsubfieldid){
- var tagsubfield=tagsubfieldid.substr(0,tagsubfieldid.lastIndexOf("_"));
- var tagcode=tagsubfield.substr(tagsubfield.lastIndexOf("_"));
- tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_"));
- tagsubfield=tagsubfield.substr(0,tagsubfield.lastIndexOf("_"));
- tagsubfield=tagsubfield+"_."+tagcode;
- return tagsubfield;
-}
-
-function openAuth(tagsubfieldid,authtype) {
- // let's take the base of tagsubfield information (removing the indexes and the codes
- var element=document.getElementById(tagsubfieldid);
- var tagsubfield=getTagInputnameFilter(tagsubfieldid);
- var elementsubfcode=getSubfieldcode(element.name);
- var mainmainstring=element.value;
- var mainstring="";
- var inputs = element.parentNode.parentNode.getElementsByTagName("input");
-
- for (var myindex =0; myindex<inputs.length;myindex++){
- if (inputs[myindex].name && inputs[myindex].name.match(tagsubfield)){
- var subfieldcode=getSubfieldcode(inputs[myindex].name);
- if (isNaN(parseInt(subfieldcode)) && inputs[myindex].value != "" && subfieldcode!=elementsubfcode){
- mainstring=inputs[myindex].value+" "+mainstring;
- }
- }
- }
- newin=window.open("../authorities/auth_finder.pl?authtypecode="+ authtype+ "&index="+tagsubfieldid+"&value_mainstr="+encodeURI(mainmainstring)+"&value_main="+encodeURI(mainstring), "_blank",'width=700,height=550,toolbar=false,scrollbars=yes');
-}
-
-
-function ExpandField(index) {
- var original = document.getElementById(index); //original <div>
- var divs = original.getElementsByTagName('div');
- for(var i=0,divslen = divs.length ; i<divslen ; i++){ // foreach div
- if(divs[i].getAttribute('id').match(/^subfield/)){ // if it s a subfield
- if (divs[i].style.display == 'block') {
- divs[i].style.display = 'none';
- } else {
- divs[i].style.display = 'block';
- }
- }
- }
-}
-
-/**
- * To clone a field or a subfield by clicking on '+' button
- */
-function CloneField(index) {
- var original = document.getElementById(index); //original <div>
- fields_in_use[index.substr(0, 7)]++;
- var clone = original.cloneNode(true);
- var new_key = CreateKey();
- var new_id = original.getAttribute('id')+new_key;
-
- clone.setAttribute('id',new_id); // setting a new id for the parent div
-
- var divs = clone.getElementsByTagName('div');
-
- [% UNLESS ( hide_marc ) %] // No indicator if hide_marc
- // setting a new name for the new indicator
- for(var i=0; i < 2; i++) {
- var indicator = clone.getElementsByTagName('input')[i];
- indicator.setAttribute('name',indicator.getAttribute('name')+new_key);
- }
- [% END %]
-
- // settings all subfields
- for(var i=0,divslen = divs.length ; i<divslen ; i++){ // foreach div
- if(divs[i].getAttribute("id").match(/^subfield/)){ // if it s a subfield
-
- // set the attribute for the new 'div' subfields
- divs[i].setAttribute('id',divs[i].getAttribute('id')+new_key);
-
- var inputs = divs[i].getElementsByTagName('input');
- var id_input = "";
-
- for( j = 0 ; j < inputs.length ; j++ ) {
- if(inputs[j].getAttribute("id") && inputs[j].getAttribute("id").match(/^tag_/) ){
- inputs[j].value = "";
- }
- }
-
- inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key);
- inputs[0].setAttribute('name',inputs[0].getAttribute('name')+new_key);
- var id_input;
- try {
- id_input = inputs[1].getAttribute('id')+new_key;
- inputs[1].setAttribute('id',id_input);
- inputs[1].setAttribute('name',inputs[1].getAttribute('name')+new_key);
- } catch(e) {
- try{ // it s a select if it is not an input
- var selects = divs[i].getElementsByTagName('select');
- id_input = selects[0].getAttribute('id')+new_key;
- selects[0].setAttribute('id',id_input);
- selects[0].setAttribute('name',selects[0].getAttribute('name')+new_key);
- }catch(e2){ // it is a textarea if it s not a select or an input
- var textaeras = divs[i].getElementsByTagName('textarea');
- id_input = textaeras[0].getAttribute('id')+new_key;
- textaeras[0].setAttribute('id',id_input);
- textaeras[0].setAttribute('name',textaeras[0].getAttribute('name')+new_key);
- }
- }
-
- [% UNLESS ( advancedMARCEditor ) %]
- // when cloning a subfield, re set its label too.
- var labels = divs[i].getElementsByTagName('label');
- labels[0].setAttribute('for',id_input);
- [% END %]
-
- [% UNLESS ( hide_marc ) %]
- // updating javascript parameters on button up
- var imgs = divs[i].getElementsByTagName('img');
- imgs[0].setAttribute('onclick',"upSubfield(\'"+divs[i].getAttribute('id')+"\');");
- [% END %]
-
- // setting its '+' and '-' buttons
- try {
- var anchors = divs[i].getElementsByTagName('a');
- for (var j = 0; j < anchors.length; j++) {
- if(anchors[j].getAttribute('class') == 'buttonPlus'){
- anchors[j].setAttribute('onclick',"CloneSubfield('" + divs[i].getAttribute('id') + "')");
- } else if (anchors[j].getAttribute('class') == 'buttonMinus') {
- anchors[j].setAttribute('onclick',"UnCloneField('" + divs[i].getAttribute('id') + "')");
- }
- }
- }
- catch(e){
- // do nothig if ButtonPlus & CloneButtonPlus don t exist.
- }
-
- // button ...
- var spans=0;
- try {
- spans = divs[i].getElementsByTagName('a');
- } catch(e) {
- // no spans
- }
- if(spans){
- var buttonDot;
- if(!CloneButtonPlus){ // it s impossible to have + ... (buttonDot AND buttonPlus)
- buttonDot = spans[0];
- if(buttonDot){
- // 2 possibilities :
- try{
- var buttonDotOnClick = buttonDot.getAttribute('onclick');
- if(buttonDotOnClick.match('Clictag')){ // -1- It s a plugin
- var re = /\('.*'\)/i;
- buttonDotOnClick = buttonDotOnClick.replace(re,"('"+inputs[1].getAttribute('id')+"')");
- if(buttonDotOnClick){
- buttonDot.setAttribute('onclick',buttonDotOnClick);
- }
- } else {
- if(buttonDotOnClick.match('Dopop')) { // -2- It's a auth value
- var re1 = /&index=.*',/;
- var re2 = /,.*\)/;
-
- buttonDotOnClick = buttonDotOnClick.replace(re1,"&index="+inputs[1].getAttribute('id')+"',");
- buttonDotOnClick = buttonDotOnClick.replace(re2,",'"+inputs[1].getAttribute('id')+"')");
-
- if(buttonDotOnClick){
- buttonDot.setAttribute('onclick',buttonDotOnClick);
- }
- }
- }
- try {
- // do not copy the script section.
- var script = spans[0].getElementsByTagName('script')[0];
- spans[0].removeChild(script);
- } catch(e) {
- // do nothing if there is no script
- }
- }catch(e){}
- }
- }
- }
- [% UNLESS ( hide_marc ) %]
- var buttonUp = divs[i].getElementsByTagName('img')[0];
- buttonUp.setAttribute('onclick',"upSubfield('" + divs[i].getAttribute('id') + "')");
- [% END %]
-
- } else { // it's a indicator div
- if(divs[i].getAttribute('id').match(/^div_indicator/)){
- var inputs = divs[i].getElementsByTagName('input');
- inputs[0].setAttribute('id',inputs[0].getAttribute('id')+new_key);
- inputs[1].setAttribute('id',inputs[1].getAttribute('id')+new_key);
-
- var CloneButtonPlus;
- try {
- var anchors = divs[i].getElementsByTagName('a');
- for (var j = 0; j < anchors.length; j++) {
- if (anchors[j].getAttribute('class') == 'buttonPlus') {
- anchors[j].setAttribute('onclick',"CloneField('" + new_id + "')");
- } else if (anchors[j].getAttribute('class') == 'buttonMinus') {
- anchors[j].setAttribute('onclick',"UnCloneField('" + new_id + "')");
- } else if (anchors[j].getAttribute('class') == 'expandfield') {
- anchors[j].setAttribute('onclick',"ExpandField('" + new_id + "')");
- }
- }
- }
- catch(e){
- // do nothig CloneButtonPlus doesn't exist.
- }
-
- }
- }
- }
-
- // insert this line on the page
- original.parentNode.insertBefore(clone,original.nextSibling);
-}
-
-function CloneSubfield(index){
- var original = document.getElementById(index); //original <div>
- fields_in_use[index.substr(0, 12)]++;
- var clone = original.cloneNode(true);
- var new_key = CreateKey();
- var new_id = original.getAttribute('id')+new_key;
- // set the attribute for the new 'div' subfields
- var inputs = clone.getElementsByTagName('input');
- var selects = clone.getElementsByTagName('select');
- var textareas = clone.getElementsByTagName('textarea');
- var linkid;
-
- // input
- var id_input = "";
- for(var i=0,len=inputs.length; i<len ; i++ ){
- id_input = inputs[i].getAttribute('id')+new_key;
- inputs[i].setAttribute('id',id_input);
- inputs[i].setAttribute('name',inputs[i].getAttribute('name')+new_key);
- linkid = id_input;
- }
-
- // select
- for(var i=0,len=selects.length; i<len ; i++ ){
- id_input = selects[i].getAttribute('id')+new_key;
- selects[i].setAttribute('id',selects[i].getAttribute('id')+new_key);
- selects[i].setAttribute('name',selects[i].getAttribute('name')+new_key);
- }
-
- // textarea
- for(var i=0,len=textareas.length; i<len ; i++ ){
- id_input = textareas[i].getAttribute('id')+new_key;
- textareas[i].setAttribute('id',textareas[i].getAttribute('id')+new_key);
- textareas[i].setAttribute('name',textareas[i].getAttribute('name')+new_key);
- }
-
- // Changing the "..." link's onclick attribute for plugin callback
- var links = clone.getElementsByTagName('a');
- var link = links[0];
- var buttonDotOnClick = link.getAttribute('onclick');
- if(buttonDotOnClick.match('Clictag')){ // -1- It s a plugin
- var re = /\('.*'\)/i;
- buttonDotOnClick = buttonDotOnClick.replace(re,"('"+linkid+"')");
- if(buttonDotOnClick){
- link.setAttribute('onclick',buttonDotOnClick);
- }
- }
-
-
- [% UNLESS ( advancedMARCEditor ) %]
- // when cloning a subfield, reset its label too.
- var label = clone.getElementsByTagName('label')[0];
- label.setAttribute('for',id_input);
- [% END %]
-
- // setting a new id for the parent div
- clone.setAttribute('id',new_id);
-
- try {
- var buttonUp = clone.getElementsByTagName('img')[0];
- buttonUp.setAttribute('onclick',"upSubfield('" + new_id + "')");
- var anchors = clone.getElementsByTagName('a');
- if(anchors.length){
- for(var i = 0 ,lenanchors = anchors.length ; i < lenanchors ; i++){
- if(anchors[i].getAttribute('class') == 'buttonPlus'){
- anchors[i].setAttribute('onclick',"CloneSubfield('" + new_id + "')");
- } else if (anchors[i].getAttribute('class') == 'buttonMinus') {
- anchors[i].setAttribute('onclick',"UnCloneField('" + new_id + "')");
- }
- }
- }
- }
- catch(e){
- // do nothig if ButtonPlus & CloneButtonPlus don't exist.
- }
- // insert this line on the page
- original.parentNode.insertBefore(clone,original.nextSibling);
-}
-
- /**
- * This function removes or clears unwanted subfields
- */
-function UnCloneField(index) {
- var original = document.getElementById(index);
- var field_id;
- if (index.match("tag")) {
- field_id = index.substr(0, 7);
- } else {
- field_id = index.substr(0, 12);
- }
- if (1 == fields_in_use[field_id]) {
- // clear inputs, but don't delete
- $(":input.input_marceditor", original).each(function(){
- // thanks to http://www.learningjquery.com/2007/08/clearing-form-data for
- // hint about clearing selects correctly
- var type = this.type;
- var tag = this.tagName.toLowerCase();
- if (type == 'text' || type == 'password' || tag == 'textarea') {
- this.value = "";
- } else if (type == 'checkbox' || type == 'radio') {
- this.checked = false;
- } else if (tag == 'select') {
- this.selectedIndex = -1;
- }
- });
- $(":input.indicator", original).val("");
- } else {
- original.parentNode.removeChild(original);
- fields_in_use[field_id]--;
- }
-}
-
-/**
- * This function create a random number
- */
-function CreateKey(){
- return parseInt(Math.random() * 100000);
-}
-
-/**
- * This function allows to move a subfield up by clickink on the 'up' button .
- */
-function upSubfield(index) {
- try{
- var line = document.getElementById(index); // get the line where the user has clicked.
- } catch(e) {
- return; // this line doesn't exist...
- }
- var tag = line.parentNode; // get the dad of this line. (should be "<div id='tag_...'>")
-
- // getting all subfields for this tag
- var subfields = tag.getElementsByTagName('div');
- var subfieldsLength = subfields.length;
-
- if(subfieldsLength<=1) return; // nothing to do if there is just one subfield.
-
- // among all subfields
- for(var i=0;i<subfieldsLength;i++){
- if(subfields[i].getAttribute('id') == index){ //looking for the subfield which is clicked :
- if(i==1){ // if the clicked subfield is on the top
- tag.appendChild(subfields[1]);
- return;
- } else {
- var lineAbove = subfields[i-1];
- tag.insertBefore(line,lineAbove);
- return;
- }
- }
- }
-}
-
-function unHideSubfield(index,labelindex) { // FIXME :: is it used ?
- subfield = document.getElementById(index);
- subfield.style.display = 'block';
- label = document.getElementById(labelindex);
- label.style.display='none';
-}
//]]>
</script>
<link type="text/css" rel="stylesheet" href="[% themelang %]/css/addbiblio.css" />
//]]>
</script>
[% INCLUDE 'header.inc' %]
+
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloging</a> › [% IF ( biblionumber ) %]Editing <em>[% title |html %]</em> (Record number [% biblionumber %])[% ELSE %]Add MARC record[% END %]</div>
<div id="doc" class="yui-t7">
<input type="hidden" name="breedingid" value="[% breedingid %]" />
<div id="addbibliotabs" class="toptabs numbered">
- <ul>[% FOREACH BIG_LOO IN BIG_LOOP %]
- <li> [% IF ( BIG_LOO.number ) %]
- <a href="#tab[% BIG_LOO.number %]XX">[% BIG_LOO.number %]</a>
- [% ELSE %]
- <a href="#tab[% BIG_LOO.number %]XX">[% BIG_LOO.number %]</a>
- [% END %]</li>
- [% END %]</ul>
+ <ul>
+ [% FOREACH BIG_LOO IN BIG_LOOP %]
+ <li><a href="#tab[% BIG_LOO.number %]XX">[% BIG_LOO.number %]</a></li>
+ [% END %]
+ </ul>
[% FOREACH BIG_LOO IN BIG_LOOP %]
-<!-- hide every tab except the 1st -->
-[% IF ( BIG_LOO.number ) %]
- <div id="tab[% BIG_LOO.number %]XX">
-[% ELSE %]
<div id="tab[% BIG_LOO.number %]XX">
-[% END %]
-
[% FOREACH innerloo IN BIG_LOO.innerloop %]
- [% IF ( innerloo.tag ) %]
- <div class="tag" id="tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]">
+ [% IF ( innerloo.tag ) %]
+ <div class="tag" id="tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]">
<div class="tag_title" id="div_indicator_tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]">
- [% UNLESS hide_marc %]
- [% IF advancedMARCEditor %]
- <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;">[% innerloo.tag %]</a>
- [% ELSE %]
- <span class="tagnum" title="[% innerloo.tag_lib %]">[% innerloo.tag %]
- [% IF marcflavour != 'NORMARC' %]<a class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag %]', [% BIG_LOO.number %]); return false;"> ?</a>[% END %]
- </span>
- [% END %]
+ [% UNLESS hide_marc %]
+ [% IF advancedMARCEditor %]
+ <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;">[% innerloo.tag %]</a>
+ [% ELSE %]
+ <span class="tagnum" title="[% innerloo.tag_lib %]">[% innerloo.tag %]
+ [% IF marcflavour != 'NORMARC' %]<a class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag %]', [% BIG_LOO.number %]); return false;"> ?</a>[% END %]
+ </span>
+ [% END %]
[% IF ( innerloo.fixedfield ) %]
- <input tabindex="1" class="indicator flat" type="text" style="display:none;" name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" size="1" maxlength="1" value="[% innerloo.indicator1 %]" />
- <input tabindex="1" class="indicator flat" type="text" style="display:none;" name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" size="1" maxlength="1" value="[% innerloo.indicator2 %]" />
+ <input type="text"
+ tabindex="1"
+ class="indicator flat"
+ style="display:none;"
+ name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]"
+ size="1"
+ maxlength="1"
+ value="[% innerloo.indicator1 %]" />
+ <input type="text"
+ tabindex="1"
+ class="indicator flat"
+ style="display:none;"
+ name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]"
+ size="1"
+ maxlength="1"
+ value="[% innerloo.indicator2 %]" />
[% ELSE %]
- <input tabindex="1" class="indicator flat" type="text" name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" size="1" maxlength="1" value="[% innerloo.indicator1 %]" />
- <input tabindex="1" class="indicator flat" type="text" name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" size="1" maxlength="1" value="[% innerloo.indicator2 %]" />
+ <input type="text"
+ tabindex="1"
+ class="indicator flat"
+ name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]"
+ size="1"
+ maxlength="1"
+ value="[% innerloo.indicator1 %]" />
+ <input type="text"
+ tabindex="1"
+ class="indicator flat"
+ name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]"
+ size="1"
+ maxlength="1"
+ value="[% innerloo.indicator2 %]" />
[% END %] -
- [% ELSE %]
+ [% ELSE %]
[% IF ( innerloo.fixedfield ) %]
- <input tabindex="1" type="hidden" name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" value="[% innerloo.indicator1 %]" />
- <input tabindex="1" type="hidden" name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" value="[% innerloo.indicator2 %]" />
+ <input type="hidden"
+ tabindex="1"
+ name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]"
+ value="[% innerloo.indicator1 %]" />
+ <input type="hidden"
+ tabindex="1"
+ name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]"
+ value="[% innerloo.indicator2 %]" />
[% ELSE %]
- <input tabindex="1" type="hidden" name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]" value="[% innerloo.indicator1 %]" />
- <input tabindex="1" type="hidden" name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]" value="[% innerloo.indicator2 %]" />
+ <input type="hidden"
+ tabindex="1"
+ name="tag_[% innerloo.tag %]_indicator1_[% innerloo.index %][% innerloo.random %]"
+ value="[% innerloo.indicator1 %]" />
+ <input type="hidden"
+ tabindex="1"
+ name="tag_[% innerloo.tag %]_indicator2_[% innerloo.index %][% innerloo.random %]"
+ value="[% innerloo.indicator2 %]" />
[% END %]
- [% END %]
+ [% END %]
[% UNLESS advancedMARCEditor %]
- <a href="#" tabindex="1" class="expandfield" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Click to Expand this Tag">[% innerloo.tag_lib %]</a>
- [% END %]
- [% IF ( innerloo.repeatable ) %]
- <span class="subfield_controls"><a href="#" tabindex="1" class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Repeat this Tag"><img src="/intranet-tmpl/prog/img/repeat-tag.png" alt="Repeat this Tag" /></a>
+ <a href="#" tabindex="1" class="expandfield" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Click to Expand this Tag">[% innerloo.tag_lib %]</a>
[% END %]
- <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Delete this Tag"><img src="/intranet-tmpl/prog/img/delete-tag.png" alt="Delete this Tag" /></a></span>
+ <span class="field_controls">
+ [% IF ( innerloo.repeatable ) %]
+ <a href="#" tabindex="1" class="buttonPlus" onclick="CloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]','[% hide_marc %]','[% advancedMARCEditor %]'); return false;" title="Repeat this Tag">
+ <img src="/intranet-tmpl/prog/img/repeat-tag.png" alt="Repeat this Tag" />
+ </a>
+ [% END %]
+ <a href="#" tabindex="1" class="buttonMinus" onclick="UnCloneField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;" title="Delete this Tag">
+ <img src="/intranet-tmpl/prog/img/delete-tag.png" alt="Delete this Tag" />
+ </a>
+ </span>
-
</div>
-
+
[% FOREACH subfield_loo IN innerloo.subfield_loop %]
<!-- One line on the marc editor -->
- <div class="subfield_line" style="[% subfield_loo.visibility %]; float: left; clear: left; width: 100%;" id="subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]">
+ <div class="subfield_line" style="[% subfield_loo.visibility %]" id="subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]">
[% UNLESS advancedMARCEditor %]
[% IF ( subfield_loo.fixedfield ) %]<label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" style="display:none;" class="labelsubfield">
- [% ELSE %]<label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" class="labelsubfield">[% END %]
- [% END %]
+ [% ELSE %]<label for="tag_[% subfield_loo.tag %]_subfield_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" class="labelsubfield">
+ [% END %]
+ [% END %]
[% UNLESS hide_marc %]
- <span class="subfieldcode">[% IF ( subfield_loo.fixedfield ) %]
- <img class="buttonUp" style="display:none;" src="[% themelang %]/../img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" />
+ <span class="subfieldcode">
+ [% IF ( subfield_loo.fixedfield ) %]
+ <img class="buttonUp" style="display:none;" src="/intranet-tmpl/prog/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" />
[% ELSE %]
- <img class="buttonUp" src="[% themelang %]/../img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" />
+ <img class="buttonUp" src="/intranet-tmpl/prog/img/up.png" onclick="upSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]')" alt="Move Up" title="Move Up" />
[% END %]
- <input title="[% subfield_loo.marc_lib_plain %]" style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;" type="text" tabindex="0" name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" value="[% subfield_loo.subfield %]" size="1" maxlength="1" class="flat" />
- </span>
+ <input type="text"
+ title="[% subfield_loo.marc_lib_plain %]"
+ style=" [% IF ( subfield_loo.fixedfield ) %]display:none; [% END %]border:0;"
+ name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]"
+ value="[% subfield_loo.subfield %]"
+ size="1"
+ maxlength="1"
+ class="flat"
+ tabindex="0" />
+ </span>
[% ELSE %]
- <input type="hidden" name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]" value="[% subfield_loo.subfield %]" />
- </span>
+ <input type="hidden"
+ name="tag_[% subfield_loo.tag %]_code_[% subfield_loo.subfield %]_[% subfield_loo.index %]_[% subfield_loo.index_subfield %]"
+ value="[% subfield_loo.subfield %]" />
[% END %]
[% UNLESS advancedMARCEditor %]
[% subfield_loo.marc_value %]
+ <span class="subfield_controls">
[% IF ( subfield_loo.repeatable ) %]
- <span class="subfield_controls"><a href="#" class="buttonPlus" tabindex="1" onclick="CloneSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]'); return false;"><img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" /></a>
- <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]'); return false;"><img src="/intranet-tmpl/prog/img/delete-subfield.png" alt="Delete" title="Delete this subfield" /></a></span>
+ <a href="#" class="buttonPlus" tabindex="1" onclick="CloneSubfield('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]','[% advancedMARCEditor %]'); return false;">
+ <img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
+ </a>
+ <a href="#" class="buttonMinus" tabindex="1" onclick="UnCloneField('subfield[% subfield_loo.tag %][% subfield_loo.subfield %][% subfield_loo.random %]'); return false;">
+ <img src="/intranet-tmpl/prog/img/delete-subfield.png" alt="Delete" title="Delete this subfield" />
+ </a>
[% END %]
-
+ </span>
</div>
<!-- End of the line -->
-
[% END %]
- </div>
- [% END %]<!-- tag -->
- [% END %]
+
</div>
-[% END %]
-</div>
+ [% END %]<!-- if innerloo.tag -->
+ [% END %]<!-- BIG_LOO.innerloop -->
+ </div>
+[% END %]<!-- BIG_LOOP -->
+
+</div><!-- tabs -->
+
<!-- Fields for fast add cataloguing -->
<input type="hidden" name="barcode" value="[% barcode %]" />
<input type="hidden" name="branch" value="[% branch %]" />
<input type="hidden" name="stickyduedate" value="[% stickyduedate %]" />
<input type="hidden" name="duedatespec" value="[% duedatespec %]" />
<!-- /End of fast add fields -->
+
</form>
</div>
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Cataloging › [% title |html %] [% IF ( author ) %] by [% author %][% END %] (Record #[% biblionumber %]) › Items</title>
[% INCLUDE 'doc-head-close.inc' %]
+<script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
}
}
-function CloneSubfield(index){
- var original = document.getElementById(index); //original <div>
- var clone = original.cloneNode(true);
- var new_key = CreateKey();
- var old_id = original.getAttribute('id');
- old_id=old_id.substr(12);
- var new_id = old_id+new_key;
-
- // set the attribute for the new 'div' subfields
- var inputs = clone.getElementsByTagName('input');
- var selects = clone.getElementsByTagName('select');
- var textareas = clone.getElementsByTagName('textarea');
-
- // input
- var id_input = "";
- for(var i=0,len=inputs.length; i<len ; i++ ){
- id_input = inputs[i].getAttribute('id')+new_key;
- inputs[i].setAttribute('id',id_input);
- inputs[i].setAttribute('name',inputs[i].getAttribute('name'));
- }
-
- // select
- for(var i=0,len=selects.length; i<len ; i++ ){
- id_input = selects[i].getAttribute('id')+new_key;
- selects[i].setAttribute('id',selects[i].getAttribute('id')+new_key);
- selects[i].setAttribute('name',selects[i].getAttribute('name'));
- }
-
- // textarea
- for(var i=0,len=textareas.length; i<len ; i++ ){
- id_input = textareas[i].getAttribute('id')+new_key;
- textareas[i].setAttribute('id',textareas[i].getAttribute('id')+new_key);
- textareas[i].setAttribute('name',textareas[i].getAttribute('name'));
- }
-
- [% UNLESS ( advancedMARCEditor ) %]
- // when cloning a subfield, reset its label too.
- var label = clone.getElementsByTagName('label')[0];
- label.setAttribute('for',id_input);
- [% END %]
-
- // setting a new if for the parent div
- clone.setAttribute('id',new_id);
-
- var CloneButtonPlus;
- try {
- var spans = clone.getElementsByTagName('span');
- if(spans.length){
- for(var i = 0 ,lenspans = spans.length ; i < lenspans ; i++){
- if(spans[i].getAttribute('class') == 'buttonPlus'){
- CloneButtonPlus = spans[i];
- CloneButtonPlus.setAttribute('onclick',"CloneSubfield('" + new_id + "')");
- var buttonUp = clone.getElementsByTagName('img')[0];
- buttonUp.setAttribute('onclick',"upSubfield('" + new_id + "')");
- }
- }
- }
- }
- catch(e){
- // do nothing if ButtonPlus & CloneButtonPlus don't exist.
- }
- // insert this line on the page
- original.parentNode.insertBefore(clone,original.nextSibling);
-}
-
-/**
- * This function creates a random number
- */
-function CreateKey(){
- return parseInt(Math.random() * 100000);
-}
-
$(document).ready(function() {
$("#cataloguing_additem_itemlist tr").hover(
function () {$(this).attr("class","highlight");},
<input type="hidden" name="subfield" value="[% ite.subfield %]" />
<input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
[% IF ( ite.repeatable ) %]
- <span class="buttonPlus" onclick="CloneSubfield('subfield[% ite.tag %][% ite.subfield %][% ite.random %]')">+</span>
+ <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
+ <img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
+ </a>
[% END %]
[% IF ( ite.mandatory ) %] <span class="required">Required</span>[% END %]
</div></li>
$(document).ready(function() {
[% FOREACH branchesloo IN branchesloop %]
$.tablesorter.defaults.widgets = ['zebra'];
- $("#transferst[% branchesloo.branchcode %]").tablesorter({[% IF ( branchesloo.dateformat_metric ) %]
+ $("#transferst[% branchesloo.branchcode %]").tablesorter({[% IF ( dateformat_metric ) %]
dateFormat: 'uk',[% END %]
sortList: [[0,0]],
headers: { 1: { sorter: 'articles' }}
<p>Once all of the logs from all of the circulation computers are loaded you will be able to check them all or select just those you want to process into Koha.</p>
<ul>
- <li>Click on the Process button and Koha will record every sorted transaction one by one. For each transaction, the status will change to:
+ <li>Click on the Process button and Koha will record every stored transaction one by one. For each transaction, the status will change to:
<ul>
<li>"Success." if the transaction was processed correctly</li>
<li>"Borrower not found." if the borrower card number is incorrect</li>
[% END %]
</ol>
</fieldset>
- [% UNLESS nodateenrolled && nodateexpiry && noopacnote && noborrowernotes %]
+ [% UNLESS nodateenrolled && noopacnote && noborrowernotes %]
<fieldset class="rows" id="memberentry_subscription">
<legend id="library_setup_lgd">Library set-up</legend><ol>
[% UNLESS nodateenrolled %]
[% END %]
[% UNLESS nodateexpiry %]
<li>
+ [% ELSE %]
+ <li style="display:none">
+ [% END %]
[% IF ( mandatorydateexpiry ) %]
<label for="to" class="required">
[% ELSE %]
[% IF ( ERROR_dateexpiry ) %]<span class="required">(Error)</span>[% END %]
<div class="hint">[% INCLUDE 'date-format.inc' %]</div>
</li>
- [% END %]
[% UNLESS noopacnote %]
<li>
[% IF ( mandatoryopacnote ) %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha › Serials › Serial edition [% bibliotitle %]</title>
[% INCLUDE 'doc-head-close.inc' %]
+<script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
<script language="JavaScript" type="text/javascript">
//<![CDATA[
function generateReceive() {
var elem = document.getElementById("supexpecteddate");
elem.value = adate;
}
-function CloneSubfield(index){
- var original = document.getElementById(index); //original <div>
- var clone = original.cloneNode(true);
- var new_key = CreateKey();
- var old_id = original.getAttribute('id');
- old_id=old_id.substr(12);
- var new_id = old_id+new_key;
-
- // set the attribute for the new 'div' subfields
- var inputs = clone.getElementsByTagName('input');
- var selects = clone.getElementsByTagName('select');
- var textareas = clone.getElementsByTagName('textarea');
-
- // input
- var id_input = "";
- for(var i=0,len=inputs.length; i<len ; i++ ){
- id_input = inputs[i].getAttribute('id')+new_key;
- inputs[i].setAttribute('id',id_input);
- inputs[i].setAttribute('name',inputs[i].getAttribute('name'));
- }
-
- // select
- for(var i=0,len=selects.length; i<len ; i++ ){
- id_input = selects[i].getAttribute('id')+new_key;
- selects[i].setAttribute('id',selects[i].getAttribute('id')+new_key);
- selects[i].setAttribute('name',selects[i].getAttribute('name'));
- }
-
- // textarea
- for(var i=0,len=textareas.length; i<len ; i++ ){
- id_input = textareas[i].getAttribute('id')+new_key;
- textareas[i].setAttribute('id',textareas[i].getAttribute('id')+new_key);
- textareas[i].setAttribute('name',textareas[i].getAttribute('name'));
- }
-
- [% UNLESS ( advancedMARCEditor ) %]
- // when cloning a subfield, reset its label too.
- var label = clone.getElementsByTagName('label')[0];
- label.setAttribute('for',id_input);
- [% END %]
-
- // setting a new if for the parent div
- clone.setAttribute('id',new_id);
-
- var CloneButtonPlus;
- try {
- var spans = clone.getElementsByTagName('span');
- if(spans.length){
- for(var i = 0 ,lenspans = spans.length ; i < lenspans ; i++){
- if(spans[i].getAttribute('class') == 'buttonPlus'){
- CloneButtonPlus = spans[i];
- CloneButtonPlus.setAttribute('onclick',"CloneSubfield('" + new_id + "')");
- var buttonUp = clone.getElementsByTagName('img')[0];
- buttonUp.setAttribute('onclick',"upSubfield('" + new_id + "')");
- }
- }
- }
- }
- catch(e){
- // do nothig if ButtonPlus & CloneButtonPlus don't exist.
- }
- // insert this line on the page
- original.parentNode.insertBefore(clone,original.nextSibling);
-}
+
$(document).ready(function() {
$("form#serials_edit").submit(function() {
var total_errors = 0;
[% FOREACH item IN serialslis.items %]
<div id="item[% item.serialid %][% item.countitems %]" class="items">
<ol>[% FOREACH iteminformatio IN item.iteminformation %]<li>
- <div class="subfield_line" style="[% iteminformatio.hidden %];" id="subfield[% item.serialid %][% item.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
+ <div class="subfield_line" style="[% iteminformatio.hidden %]" id="subfield[% item.serialid %][% item.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
<label>[% iteminformatio.subfield %] - [% IF ( iteminformatio.mandatory ) %]<b>[% END %][% iteminformatio.marc_lib %][% IF ( iteminformatio.mandatory ) %] *</b>[% END %]</label>
[% iteminformatio.marc_value %]
<input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
<input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
<input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
- [% IF ( iteminformatio.ITEM_SUBFIELDS_ARE_NOT_REPEATABLE ) %]
- <span class="buttonPlus" onclick="CloneSubfield('subfield[% item.serialid %][% item.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]')">+</span>
+ [% IF ( iteminformatio.repeatable ) %]
+ <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
+ <img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
+ </a>
[% END %]
</div></li>
<div class="cataloguing_additem_itemlist">
<div id="item[% newserialloo.serialid %][% newserialloo.countitems %]" class="items">
<ol>[% FOREACH iteminformatio IN newserialloo.iteminformation %]<li>
- <div class="subfield_line" style="[% iteminformatio.hidden %];" id="subfield[% newserialloo.serialid %][% newserialloo.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
+ <div class="subfield_line" style="[% iteminformatio.hidden %]" id="subfield[% newserialloo.serialid %][% newserialloo.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]">
<label>[% iteminformatio.subfield %] - [% IF ( iteminformatio.mandatory ) %]<b>[% END %][% iteminformatio.marc_lib %][% IF ( iteminformatio.mandatory ) %] *</b>[% END %]</label>
[% iteminformatio.marc_value %]
<input type="hidden" name="tag" value="[% iteminformatio.tag %]" />
<input type="hidden" name="subfield" value="[% iteminformatio.subfield %]" />
<input type="hidden" name="mandatory" value="[% iteminformatio.mandatory %]" />
- [% IF ( iteminformatio.ITEM_SUBFIELDS_ARE_NOT_REPEATABLE ) %]
- <span class="buttonPlus" onclick="CloneSubfield('subfield[% newserialloo.serialid %][% newserialloo.countitems %][% iteminformatio.subfield %][% iteminformatio.random %]')">+</span>
+ [% IF ( iteminformatio.repeatable ) %]
+ <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
+ <img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
+ </a>
[% END %]
</div>
</li>[% END %]</ol>
<tr>
<td class="count">[% offset + loop.count %]
</td>
- [% IF ( approved == 0 ) %]<td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" class="pending" /></span>
+ [% IF ( tagloo.approved == 0 ) %]<td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" class="pending" /></span>
[% ELSE %]<td><span><input type="checkbox" value="[% tagloo.term %]" name="tags" /></span>[% END %]
</td>
[% IF ( tagloo.approved == -1 ) %]<td class="red">rejected
</td>
[% IF ( tagloo.approved ) %]
<td><span class="ajax_buttons" style="visibility:hidden">
- [% IF ( approved == -1 ) %]
+ [% IF ( tagloo.approved == -1 ) %]
<input class="ok" type="submit" title="[% tagloo.term %]" value="Approve" name="approve" />
<input class="rej" disabled="disabled" type="submit" title="[% tagloo.term %]" value="Rejected" name="reject" />
[% ELSE %]
<title>Koha › Tools › Batch item modification</title>
[% INCLUDE 'doc-head-close.inc' %]
<script type="text/javascript" src="[% themelang %]/js/background-job-progressbar.js"></script>
+<script type="text/javascript" src="[% themelang %]/js/cataloging.js"></script>
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/pages/batchMod.css" />
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
<input type="hidden" name="subfield" value="[% ite.subfield %]" />
<input type="hidden" name="mandatory" value="[% ite.mandatory %]" />
[% IF ( ite.repeatable ) %]
- <span class="buttonPlus" onclick="CloneSubfield('subfield[% ite.tag %][% ite.subfield %][% ite.random %]')">+</span>
+ <a href="#" class="buttonPlus" onclick="CloneItemSubfield(this.parentNode); return false;">
+ <img src="/intranet-tmpl/prog/img/clone-subfield.png" alt="Clone" title="Clone this subfield" />
+ </a>
[% END %]
<span class="hint" id="hint[% ite.tag %][% ite.subfield %][% ite.random %]"></span>
</div></li>
<ol>
[% FOREACH field IN fields %]
<li>
- <label style="width:20em;">[% field.lib %]</label>
+ <label style="width:20em;">
+ [% SWITCH ( field.name ) %]
+ [% CASE 'surname' %]
+ Surname:
+ [% CASE 'firstname' %]
+ First name:
+ [% CASE 'branchcode' %]
+ Library:
+ [% CASE 'categorycode' %]
+ Category
+ [% CASE 'sort1' %]
+ Sort 1:
+ [% CASE 'sort2' %]
+ Sort 2:
+ [% CASE 'dateenrolled' %]
+ Registration date:
+ [% CASE 'dateexpiry' %]
+ Expiry date:
+ [% CASE 'debarred' %]
+ Restricted:
+ [% CASE 'debarredcomment' %]
+ Restriction comment:
+ [% CASE 'borrowernotes' %]
+ Circulation note:
+ [% END %]
+ </label>
[% IF field.mandatory %]
<input type="checkbox" title="This field is mandatory" name="disable_input" value="[% field.name %]" readonly="readonly" onclick="return false;" />
[% ELSE %]
[% END %]
[% IF ( patron_attributes_codes ) %]
<li class="attributes">
- <label style="width:20em;">Attribute
+ <label style="width:20em;">Attribute:
<select name="patron_attributes">
[% FOREACH pac IN patron_attributes_codes %]
<option value="[% pac.attribute_code %]" data-type="[% pac.type %]" data-category="[% pac.category_lib %]">[% pac.attribute_lib %]</option>
background: -webkit-linear-gradient(top, #f4f9fc 0%,#dfeefa 4%,#bfd5ea 93%,#a1c4e2 97%,#b8d0e6 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #f4f9fc 0%,#dfeefa 4%,#bfd5ea 93%,#a1c4e2 97%,#b8d0e6 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #f4f9fc 0%,#dfeefa 4%,#bfd5ea 93%,#a1c4e2 97%,#b8d0e6 100%); /* IE10+ */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f9fc', endColorstr='#b8d0e6',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #f4f9fc 0%,#dfeefa 4%,#bfd5ea 93%,#a1c4e2 97%,#b8d0e6 100%); /* W3C */
border-top: 1px solid #cccccc;
border-left: 1px solid #cccccc;
background: -o-linear-gradient(top, #b2b2b2 0%,#e0e0e0 14%,#e8e8e8 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #b2b2b2 0%,#e0e0e0 14%,#e8e8e8 100%); /* IE10+ */
background: linear-gradient(top, #b2b2b2 0%,#e0e0e0 14%,#e8e8e8 100%); /* W3C */
-filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e0e0e0', endColorstr='#e8e8e8',GradientType=0 ); /* IE6-9 */
margin : 0 0 1em 0;
padding-top : .5em;
padding-left : 10px;
background: -o-linear-gradient(top, #8fb4e8 0%,#8cb1e5 19%,#80a8dc 48%,#7da5d8 52%,#7198cf 83%,#618ac0 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #8fb4e8 0%,#8cb1e5 19%,#80a8dc 48%,#7da5d8 52%,#7198cf 83%,#618ac0 100%); /* IE10+ */
background: linear-gradient(top, #8fb4e8 0%,#8cb1e5 19%,#80a8dc 48%,#7da5d8 52%,#7198cf 83%,#618ac0 100%); /* W3C */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#8fb4e8', endColorstr='#618ac0',GradientType=0 ); /* IE6-9 */
border-top : 1px solid #335599;
border-bottom : 1px solid #335599;
margin-left : -10px;
background: -webkit-linear-gradient(top, #fef8d3 0%,#ffec91 9%,#ffed87 89%,#f9dc00 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #fef8d3 0%,#ffec91 9%,#ffed87 89%,#f9dc00 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #fef8d3 0%,#ffec91 9%,#ffed87 89%,#f9dc00 100%); /* IE10+ */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fef8d3', endColorstr='#f9dc00',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #fef8d3 0%,#ffec91 9%,#ffed87 89%,#f9dc00 100%); /* W3C */
text-align : center;
}
background: -webkit-linear-gradient(top, #ffffff 0%,#f4f6fa 2%,#eaeef5 23%,#e8edf6 94%,#cddbf2 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #ffffff 0%,#f4f6fa 2%,#eaeef5 23%,#e8edf6 94%,#cddbf2 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #ffffff 0%,#f4f6fa 2%,#eaeef5 23%,#e8edf6 94%,#cddbf2 100%); /* IE10+ */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#cddbf2',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #ffffff 0%,#f4f6fa 2%,#eaeef5 23%,#e8edf6 94%,#cddbf2 100%); /* W3C */
border : 1px solid #bcbcbc;
width : 55%;
background: -webkit-linear-gradient(left, #eef4fe 0%,#eef4fe 88%,#f6f9fe 98%,#ffffff 99%,#a5c2f6 99%,#e6eefe 100%,#cbdefe 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, #eef4fe 0%,#eef4fe 88%,#f6f9fe 98%,#ffffff 99%,#a5c2f6 99%,#e6eefe 100%,#cbdefe 100%); /* Opera11.10+ */
background: -ms-linear-gradient(left, #eef4fe 0%,#eef4fe 88%,#f6f9fe 98%,#ffffff 99%,#a5c2f6 99%,#e6eefe 100%,#cbdefe 100%); /* IE10+ */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eef4fe', endColorstr='#cbdefe',GradientType=1 ); /* IE6-9 */
background: linear-gradient(left, #eef4fe 0%,#eef4fe 88%,#f6f9fe 98%,#ffffff 99%,#a5c2f6 99%,#e6eefe 100%,#cbdefe 100%); /* W3C */
border : 1px solid #739acf;
padding : .3em 1em 0 0;
background: -webkit-linear-gradient(top, #e6f3fe 0%,#dfeefa 8%,#bfd5ea 49%,#b8d0e6 52%,#b8d0e6 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #e6f3fe 0%,#dfeefa 8%,#bfd5ea 49%,#b8d0e6 52%,#b8d0e6 100%); /* Opera11.10+ */
background: -ms-linear-gradient(top, #e6f3fe 0%,#dfeefa 8%,#bfd5ea 49%,#b8d0e6 52%,#b8d0e6 100%); /* IE10+ */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e6f3fe', endColorstr='#b8d0e6',GradientType=0 ); /* IE6-9 */
background: linear-gradient(top, #e6f3fe 0%,#dfeefa 8%,#bfd5ea 49%,#b8d0e6 52%,#b8d0e6 100%); /* W3C */
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
background: -o-linear-gradient(left, #eeeeee 0%,#eeeeee 96%,#e6e6e6 97%,#cccccc 99%,#c1c1c1 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, #eeeeee 0%,#eeeeee 96%,#e6e6e6 97%,#cccccc 99%,#c1c1c1 100%); /* IE10+ */
background: linear-gradient(left, #eeeeee 0%,#eeeeee 96%,#e6e6e6 97%,#cccccc 99%,#c1c1c1 100%); /* W3C */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#c1c1c1',GradientType=1 ); /* IE6-9 */
text-decoration : none;
display : block;
border : 1px solid #979797;
background: -o-linear-gradient(left, #eaeef5 0%,#dee6f4 96%,#c4d5ef 98%,#a2bee8 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, #eaeef5 0%,#dee6f4 96%,#c4d5ef 98%,#a2bee8 100%); /* IE10+ */
background: linear-gradient(left, #eaeef5 0%,#dee6f4 96%,#c4d5ef 98%,#a2bee8 100%); /* W3C */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eaeef5', endColorstr='#a2bee8',GradientType=1 ); /* IE6-9 */
}
div#menu li.active a:hover {
background: url("../../images/sprite.png"),-o-linear-gradient(top, #d7e5ff 0%,#b1cbff 50%,#9fbfff 100%); /* Opera 11.10+ */
background: url("../../images/sprite.png"),-ms-linear-gradient(top, #d7e5ff 0%,#b1cbff 50%,#9fbfff 100%); /* IE10+ */
background: url("../../images/sprite.png"),linear-gradient(top, #d7e5ff 0%,#b1cbff 50%,#9fbfff 100%); /* W3C */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d7e5ff', endColorstr='#9fbfff',GradientType=0 ); /* IE6-9 */
background-position: 40px -287px,top left;
background-repeat: no-repeat;
border: 1px solid #629DCF;
background: url("../../images/sprite.png"),-o-linear-gradient(top, #e2ecf5 0%,#c3d8ea 50%,#b8d0e6 100%); /* Opera 11.10+ */
background: url("../../images/sprite.png"),-ms-linear-gradient(top, #e2ecf5 0%,#c3d8ea 50%,#b8d0e6 100%); /* IE10+ */
background: url("../../images/sprite.png"),linear-gradient(top, #e2ecf5 0%,#c3d8ea 50%,#b8d0e6 100%); /* W3C */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e2ecf5', endColorstr='#b8d0e6',GradientType=0 ); /* IE6-9 */
background-repeat: no-repeat;
background-position: 40px -287px,top left;
}
background: url("../../images/sprite.png"),-o-linear-gradient(top, #d5eaba 0%,#b7db8a 50%,#98cb59 100%); /* Opera 11.10+ */
background: url("../../images/sprite.png"),-ms-linear-gradient(top, #d5eaba 0%,#b7db8a 50%,#98cb59 100%); /* IE10+ */
background: url("../../images/sprite.png"),linear-gradient(top, #d5eaba 0%,#b7db8a 50%,#98cb59 100%); /* W3C */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d5eaba', endColorstr='#98cb59',GradientType=0 ); /* IE6-9 */
background-position: -5px -256px, left top;
background-repeat: no-repeat;
border: 1px solid #5EA28C;
background: url("../../images/sprite.png"),-o-linear-gradient(top, #e5f1d4 0%,#cbe4aa 50%,#c0de98 100%); /* Opera 11.10+ */
background: url("../../images/sprite.png"),-ms-linear-gradient(top, #e5f1d4 0%,#cbe4aa 50%,#c0de98 100%); /* IE10+ */
background: url("../../images/sprite.png"),linear-gradient(top, #e5f1d4 0%,#cbe4aa 50%,#c0de98 100%); /* W3C */
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e5f1d4', endColorstr='#c0de98',GradientType=0 ); /* IE6-9 */
background-repeat: no-repeat;
background-position: -5px -256px, left top;
}
widgets : ['zebra'],
sortList: [[0,0]]
});
- [% IF ( query_desc ) %][% IF ( OpacHighlightedWords ) %]var query_desc = "[% query_desc |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]";
+ [% IF ( query_desc ) %][% IF ( OpacHighlightedWords ) %]var query_desc = "[% query_desc |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') |html %]";
q_array = query_desc.split(" ");
highlightOn();
$("#highlight_toggle_on" ).hide().click(function() {highlightOn() ; return false;});
<div><a id="twitter" href="http://twitter.com/share" title="Share on Twitter">Twitter</a></div>
<div><a id="linkedin" href="http://www.linkedin.com/shareArticle?mini=true&url=[% current_url |url %]&title=[% title |url %]" title="Share on LinkedIn">LinkedIn</a></div>
<div><a id="delicious" href="http://www.delicious.com/save?url=[% current_url |url %]&title=[% title |url %]" title="Share on Delicious">Delicious</a></div>
- <div><a id="email" href="mailto:?subject=[% title %]&body=[% title %] ([% current_url |url %])" title="Share by email">Email</a></div>
+ <div><a id="email" href="mailto:?subject=[% title |url %]&body=[% title |url %] ([% current_url |url %])" title="Share by email">Email</a></div>
<div><g:plusone size="small"></g:plusone></div>
</div>
[% END %]
[% IF ( SEARCH_RESULT.pages ) %]. [% SEARCH_RESULT.pages |html %][% END %]
[% IF ( SEARCH_RESULT.notes ) %], [% SEARCH_RESULT.notes |html %][% END %]
[% IF ( SEARCH_RESULT.size ) %] [% SEARCH_RESULT.size |html %]. [% END %]
- [% IF ( SEARCH_RESULT.isbn ) %] [% SEARCH_RESULT.isbn |html %][% END %] </p><p>
+ [% IF ( SEARCH_RESULT.isbn ) %] [% SEARCH_RESULT.isbn |html %][% END %]
+ </p>
[% IF ( RequestOnOpac ) %]
-<a href="[% OPACBaseURL %]/cgi-bin/koha/opac-reserve.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Place Hold on <i>[% SEARCH_RESULT.title %]</i></a></p>
+<p><a href="[% OPACBaseURL %]/cgi-bin/koha/opac-reserve.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]">Place Hold on <i>[% SEARCH_RESULT.title %]</i></a></p>
[% END %]
]]></description>
<guid>[% OPACBaseURL %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% SEARCH_RESULT.biblionumber %]</guid>
return false;
});
[% IF ( query_desc ) %]
- var query_desc = "[% query_desc |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]";
+ var query_desc = "[% query_desc |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') |html %]";
q_array = query_desc.split(" ");
// ensure that we don't have "" at the end of the array, which can
// break the highlighter
[% END %]
$("#holdDetails").hide();
-[% IF ( query_desc ) %][% IF ( OpacHighlightedWords ) %]var query_desc = "[% query_desc |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]";
+[% IF ( query_desc ) %][% IF ( OpacHighlightedWords ) %]var query_desc = "[% query_desc |replace("'", "\'") |replace('\n', '\\n') |replace('\r', '\\r') |html %]";
q_array = query_desc.split(" ");
// ensure that we don't have "" at the end of the array, which can
// break the highlighter
-[% INCLUDE 'doc-head-open.inc' %][% LibraryNameTitle or "Koha online" %] catalog › Comments on [% title %]
+[% INCLUDE 'doc-head-open.inc' %][% LibraryNameTitle or "Koha online" %] catalog › Comments on [% title |html %]
[% INCLUDE 'doc-head-close.inc' %]
<style type="text/css">
#custom-doc { width:37.08em;*width:36.16em;min-width:485px; margin:1em auto; text-align:left; }
<input type="hidden" name="biblionumber" value="[% biblionumber | html%]" />
[% IF ( reviewid ) %]<input type="hidden" name="reviewid" value="[% reviewid | html%]" />[% END %]
<fieldset class="brief">
- <legend>Comments on <i>[% title |html %] [% subtitle %]</i>[% IF ( author ) %]by [% author %][% END %]</legend>
+ <legend>Comments on <i>[% title |html %] [% subtitle %]</i>[% IF ( author ) %]by [% author |html %][% END %]</legend>
<ol><li><textarea id="review" name="review" cols="60" rows="8">[% review %]</textarea></li></ol>
</fieldset>
<p>Note: Your comment must be approved by a librarian. </p>
Search for:
</th>
<td>
- <input type="text" name="title" value="[% title %]" />
+ <input type="text" name="title" value="[% title |html %]" />
</td>
<th>
Suggested by:
<!-- Tittel og ansvarsopplysninger -->
<xsl:if test="marc:datafield[@tag=245]">
- <h1>
+ <h1 class="title">
<xsl:for-each select="marc:datafield[@tag=245]">
<xsl:call-template name="subfieldSelect">
<xsl:with-param name="codes">a</xsl:with-param>
--- /dev/null
+#!/usr/bin/perl
+#
+# Copyright (C) 2012 ByWater Solutions
+#
+# 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.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+use strict;
+use warnings;
+
+BEGIN {
+ # find Koha's Perl modules
+ # test carefully before changing this
+ use FindBin;
+ eval { require "$FindBin::Bin/../kohalib.pl" };
+}
+
+use C4::Context;
+use C4::Installer;
+use C4::Dates;
+
+use Getopt::Long;
+use Data::Dumper;
+
+sub print_usage {
+ print <<_USAGE_
+$0: Remove duplicate fines
+
+Due to bug 8253, upgrading from Koha 3.6 to 3.8 may introduce duplicate fines.
+This script will remove these duplicate fines. To use, repeatably run this
+script until there are no more duplicates in the database.
+
+Parameters:
+ --confirm or -c Confirm you want to run the script.
+ --help or -h Print out this help message.
+_USAGE_
+}
+
+my $help;
+my $confirm;
+my $result = GetOptions(
+ 'confirm|c' => \$confirm,
+ 'help|h' => \$help,
+);
+if ( $help || !$confirm ) {
+ print_usage();
+ exit 0;
+}
+
+
+my $dbh = C4::Context->dbh;
+
+my $query = "
+ SELECT * FROM accountlines
+ WHERE ( accounttype = 'FU' OR accounttype = 'F' )
+ AND description like '%23:59%'
+ ORDER BY borrowernumber, itemnumber, accountno, description
+";
+my $sth = $dbh->prepare($query);
+$sth->execute();
+my $results = $sth->fetchall_arrayref( {} );
+
+$query =
+"SELECT * FROM accountlines WHERE description LIKE ? AND description NOT LIKE ?";
+$sth = $dbh->prepare($query);
+
+my @fines;
+foreach my $keeper (@$results) {
+
+ warn "WORKING ON KEEPER: " . Data::Dumper::Dumper( $keeper );
+ my ($description_to_match) = split( / 23:59/, $keeper->{'description'} );
+ $description_to_match .= '%';
+
+ warn "DESCRIPTION TO MATCH: " . $description_to_match;
+
+ $sth->execute( $description_to_match, $keeper->{'description'} );
+
+ my $has_changed = 0;
+
+ while ( my $f = $sth->fetchrow_hashref() ) {
+
+ warn "DELETING: " . Data::Dumper::Dumper( $f );
+
+ if ( $f->{'amountoutstanding'} < $keeper->{'amountoutstanding'} ) {
+ $keeper->{'amountoutstanding'} = $f->{'amountoutstanding'};
+ $has_changed = 1;
+ }
+
+ my $sql =
+ "DELETE FROM accountlines WHERE borrowernumber = ? AND accountno = ? AND itemnumber = ? AND date = ? AND description = ? LIMIT 1";
+ $dbh->do( $sql, undef, $f->{'borrowernumber'},
+ $f->{'accountno'}, $f->{'itemnumber'}, $f->{'date'},
+ $f->{'description'} );
+ }
+
+ if ($has_changed) {
+ my $sql =
+ "UPDATE accountlines SET amountoutstanding = ? WHERE borrowernumber = ? AND accountno = ? AND itemnumber = ? AND date = ? AND description = ? LIMIT 1";
+ $dbh->do(
+ $sql, undef,
+ $keeper->{'amountoutstanding'}, $keeper->{'borrowernumber'},
+ $keeper->{'accountno'}, $keeper->{'itemnumber'},
+ $keeper->{'date'}, $keeper->{'description'}
+ );
+ }
+}
+
+exit;
);
my $biblionumber = $query->param('biblionumber');
+$biblionumber = int($biblionumber);
# get biblionumbers stored in the cart
my @cart_list;
my $itemtype = &GetFrameworkCode($biblionumber);
my $tagslib = &GetMarcStructure( 0, $itemtype );
my $biblio = GetBiblioData($biblionumber);
+$biblionumber = $biblio->{biblionumber};
my $record = GetMarcBiblio($biblionumber, 1);
if ( ! $record ) {
print $query->redirect("/cgi-bin/koha/errors/404.pl");
);
my $authid = $query->param('authid');
+$authid = int($authid);
my $record = GetAuthority( $authid );
if ( ! $record ) {
print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
);
my $biblionumber = $query->param('biblionumber') || $query->param('bib');
+$biblionumber = int($biblionumber);
my $record = GetMarcBiblio($biblionumber);
if ( ! $record ) {
my $op=$query->param("op")||''; #op=export is currently the only use
my $format=$query->param("format")||'utf8';
my $biblionumber = $query->param("bib")||0;
+$biblionumber = int($biblionumber);
my ($marc, $error)= ('','');
$marc = GetMarcBiblio($biblionumber, 1) if $biblionumber;
}
elsif ($format =~ /endnote/) {
$marc = marc2endnote($marc);
+ $format = 'endnote';
}
elsif ($format =~ /marcxml/) {
$marc = marc2marcxml($marc);
+ $format = 'marcxml';
}
elsif ($format=~ /mods/) {
$marc = marc2modsxml($marc);
+ $format = 'mods';
}
elsif ($format =~ /ris/) {
$marc = marc2ris($marc);
+ $format = 'ris';
}
elsif ($format =~ /bibtex/) {
$marc = marc2bibtex(C4::Biblio::GetMarcBiblio($biblionumber),$biblionumber);
+ $format = 'bibtex';
}
elsif ($format =~ /dc/) {
($error,$marc) = marc2dcxml($marc,1);
elsif ($format =~ /marc8/) {
($error,$marc) = changeEncoding($marc,"MARC","MARC21","MARC-8");
$marc = $marc->as_usmarc() unless $error;
+ $format = 'marc8';
}
elsif ($format =~ /utf8/) {
C4::Charset::SetUTF8Flag($marc,1);
$marc = $marc->as_usmarc();
+ $format = 'utf8';
}
elsif ($format =~ /marcstd/) {
C4::Charset::SetUTF8Flag($marc,1);
($error,$marc) = marc2marc($marc, 'marcstd', C4::Context->preference('marcflavour'));
+ $format = 'marcstd';
}
else {
$error= "Format $format is not supported.";
print $query->header();
print $query->start_html();
print "<h1>An error occurred </h1>";
- print $error;
+ print $query->escapeHTML("$error");
print $query->end_html();
}
else {
my $input = new CGI;
my $biblionumber = $input->param('id');
+$biblionumber = int($biblionumber);
my $importid = $input->param('importid');
my $view = $input->param('viewas') || 'marc';
use CGI;
use Mail::Sendmail;
+use Encode;
use C4::Auth; # checkauth, getborrowernumber.
use C4::Context;
my $B_address2 = $borr->{'B_address2'} || '';
foreach my $field (@fields) {
- my $newfield = $query->param($field) || '';
+ my $newfield = decode('utf-8',$query->param($field)) || '';
my $borrowerfield = '';
if($borr->{$field}) {
$borrowerfield = $borr->{$field};
To => $updateemailaddress,
From => $patronemail,
Subject => "User Request for update of Record.",
- Message => $message,
- 'Content-Type' => 'text/plain; charset="utf8"',
+ Message => encode('utf-8', $message), # Mail::Sendmail doesn't like wide characters
+ 'Content-Type' => 'text/plain; charset="utf-8"',
);
if ( sendmail %mail ) {
return if $m =~ /C4::Reports::Guided/; # DB
return if $m =~ /C4::Serials/; # DB
return if $m =~ /C4::VirtualShelves::Page/; # DB
+ return if $m =~ /C4::Members::Statistics/; # DB
use_ok($m) || BAIL_OUT("***** PROBLEMS LOADING FILE '$m'");
},
}, $lib);
+++ /dev/null
-#!/usr/bin/perl
-#
-# This Koha test module is a stub!
-# Add more tests here!!!
-
-use strict;
-use warnings;
-
-use Test::More tests => 5;
-use Test::MockModule;
-use MARC::Record;
-
-BEGIN {
- use_ok('C4::AuthoritiesMarc');
-}
-
-# We are now going to be testing the authorities hierarchy code, and
-# therefore need to pretend that we have consistent data in our database
-my $module = new Test::MockModule('C4::AuthoritiesMarc');
-$module->mock('GetHeaderAuthority', sub {
- return {'authtrees' => ''};
-});
-$module->mock('AddAuthorityTrees', sub {
- return;
-});
-$module->mock('GetAuthority', sub {
- my ($authid) = @_;
- my $record = MARC::Record->new();
- if ($authid eq '1') {
- $record->add_fields(
- [ '001', '1' ],
- [ '151', ' ', ' ', a => 'United States' ]
- );
- } elsif ($authid eq '2') {
- $record->add_fields(
- [ '001', '2' ],
- [ '151', ' ', ' ', a => 'New York (State)' ],
- [ '551', ' ', ' ', a => 'United States', w => 'g', 9 => '1' ]
- );
- } elsif ($authid eq '3') {
- $record->add_fields(
- [ '001', '3' ],
- [ '151', ' ', ' ', a => 'New York (City)' ],
- [ '551', ' ', ' ', a => 'New York (State)', w => 'g', 9 => '2' ]
- );
- } elsif ($authid eq '4') {
- $record->add_fields(
- [ '001', '4' ],
- [ '151', ' ', ' ', a => 'New York (City)' ],
- [ '551', ' ', ' ', a => 'New York (State)', w => 'g' ]
- );
- } else {
- undef $record;
- }
- return $record;
-});
-
-is(BuildAuthHierarchies(3, 1), '1,2,3', "Built linked authtrees hierarchy string");
-
-my $expectedhierarchy = [ [ {
- 'authid' => '1',
- 'value' => 'United States',
- 'class' => 'child0',
- 'children' => [ {
- 'authid' => '2',
- 'value' => 'New York (State)',
- 'class' => 'child1',
- 'children' => [ {
- 'authid' => '3',
- 'current_value' => 1,
- 'value' => 'New York (City)',
- 'class' => 'child2',
- 'children' => [],
- 'parents' => [ {
- 'authid' => '2',
- 'value' => 'New York (State)'
- } ]
- } ],
- 'parents' => [ {
- 'authid' => '1',
- 'value' => 'United States'
- } ]
- } ],
- 'parents' => []
-} ] ];
-
-is_deeply(GenerateHierarchy(3), $expectedhierarchy, "Generated hierarchy data structure for linked hierarchy");
-
-is(BuildAuthHierarchies(4, 1), '4', "Built unlinked authtrees hierarchy string");
-$expectedhierarchy = [ [ {
- 'authid' => '4',
- 'current_value' => 1,
- 'value' => 'New York (City)',
- 'class' => 'child0',
- 'children' => [],
- 'parents' => []
-} ] ];
-is_deeply(GenerateHierarchy(4), $expectedhierarchy, "Generated hierarchy data structure for unlinked hierarchy");
use strict;
use warnings;
use DateTime;
-use Test::More tests => 21;
+use Test::More tests => 23;
use Koha::DateUtils;
BEGIN {
cmp_ok( $ret->ymd(), 'eq', '2012-07-30', 'Add 7 days Days mode' );
$cal->set_daysmode('Calendar');
+# see bugzilla #8966
+is( $cal->is_holiday($later_dt), 0, 'is holiday for the next test' );
+cmp_ok( $later_dt, 'eq', '2012-09-17T17:30:00', 'Date should be the same after is_holiday' );
+
# example tests for bug report
$cal->clear_weekly_closed_days();
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Test::More;
-
-BEGIN {
- use_ok('Koha::SuggestionEngine');
-}
-
-my $suggestor = Koha::SuggestionEngine->new( { plugins => [ 'ExplodedTerms' ] } );
-is(ref($suggestor), 'Koha::SuggestionEngine', 'Created suggestion engine');
-
-my $result = $suggestor->get_suggestions({search => 'Cookery'});
-
-ok((grep { $_->{'search'} eq 'su-na=Cookery' } @$result) && (grep { $_->{'search'} eq 'su-br=Cookery' } @$result) && (grep { $_->{'search'} eq 'su-rl=Cookery' } @$result), "Suggested correct alternatives for keyword search 'Cookery'");
-
-$result = $suggestor->get_suggestions({search => 'su:Cookery'});
-
-ok((grep { $_->{'search'} eq 'su-na=Cookery' } @$result) && (grep { $_->{'search'} eq 'su-br=Cookery' } @$result) && (grep { $_->{'search'} eq 'su-rl=Cookery' } @$result), "Suggested correct alternatives for subject search 'Cookery'");
-
-$result = $suggestor->get_suggestions({search => 'nt:Cookery'});
-
-is(scalar @$result, 0, "No suggestions for fielded search");
-
-$result = $suggestor->get_suggestions({search => 'ccl=su:Cookery'});
-
-is(scalar @$result, 0, "No suggestions for CCL search");
-
-done_testing();
--- /dev/null
+#!/usr/bin/perl
+#
+# This Koha test module is a stub!
+# Add more tests here!!!
+
+use strict;
+use warnings;
+
+use Test::More tests => 5;
+use Test::MockModule;
+use MARC::Record;
+
+BEGIN {
+ use_ok('C4::AuthoritiesMarc');
+}
+
+# We are now going to be testing the authorities hierarchy code, and
+# therefore need to pretend that we have consistent data in our database
+my $module = new Test::MockModule('C4::AuthoritiesMarc');
+$module->mock('GetHeaderAuthority', sub {
+ return {'authtrees' => ''};
+});
+$module->mock('AddAuthorityTrees', sub {
+ return;
+});
+$module->mock('GetAuthority', sub {
+ my ($authid) = @_;
+ my $record = MARC::Record->new();
+ if ($authid eq '1') {
+ $record->add_fields(
+ [ '001', '1' ],
+ [ '151', ' ', ' ', a => 'United States' ]
+ );
+ } elsif ($authid eq '2') {
+ $record->add_fields(
+ [ '001', '2' ],
+ [ '151', ' ', ' ', a => 'New York (State)' ],
+ [ '551', ' ', ' ', a => 'United States', w => 'g', 9 => '1' ]
+ );
+ } elsif ($authid eq '3') {
+ $record->add_fields(
+ [ '001', '3' ],
+ [ '151', ' ', ' ', a => 'New York (City)' ],
+ [ '551', ' ', ' ', a => 'New York (State)', w => 'g', 9 => '2' ]
+ );
+ } elsif ($authid eq '4') {
+ $record->add_fields(
+ [ '001', '4' ],
+ [ '151', ' ', ' ', a => 'New York (City)' ],
+ [ '551', ' ', ' ', a => 'New York (State)', w => 'g' ]
+ );
+ } else {
+ undef $record;
+ }
+ return $record;
+});
+
+is(BuildAuthHierarchies(3, 1), '1,2,3', "Built linked authtrees hierarchy string");
+
+my $expectedhierarchy = [ [ {
+ 'authid' => '1',
+ 'value' => 'United States',
+ 'class' => 'child0',
+ 'children' => [ {
+ 'authid' => '2',
+ 'value' => 'New York (State)',
+ 'class' => 'child1',
+ 'children' => [ {
+ 'authid' => '3',
+ 'current_value' => 1,
+ 'value' => 'New York (City)',
+ 'class' => 'child2',
+ 'children' => [],
+ 'parents' => [ {
+ 'authid' => '2',
+ 'value' => 'New York (State)'
+ } ]
+ } ],
+ 'parents' => [ {
+ 'authid' => '1',
+ 'value' => 'United States'
+ } ]
+ } ],
+ 'parents' => []
+} ] ];
+
+is_deeply(GenerateHierarchy(3), $expectedhierarchy, "Generated hierarchy data structure for linked hierarchy");
+
+is(BuildAuthHierarchies(4, 1), '4', "Built unlinked authtrees hierarchy string");
+$expectedhierarchy = [ [ {
+ 'authid' => '4',
+ 'current_value' => 1,
+ 'value' => 'New York (City)',
+ 'class' => 'child0',
+ 'children' => [],
+ 'parents' => []
+} ] ];
+is_deeply(GenerateHierarchy(4), $expectedhierarchy, "Generated hierarchy data structure for unlinked hierarchy");
--- /dev/null
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use File::Basename;
+use File::Spec;
+use Test::More;
+use Test::MockModule;
+
+BEGIN {
+ use_ok('Koha::SuggestionEngine');
+}
+
+my $langModule = new Test::MockModule('C4::Languages');
+$langModule->mock('regex_lang_subtags', sub {
+ return {
+ 'extension' => undef,
+ 'script' => undef,
+ 'privateuse' => undef,
+ 'variant' => undef,
+ 'language' => 'en',
+ 'region' => undef,
+ 'rfc4646_subtag' => 'en'
+ };
+});
+$langModule->mock('getTranslatedLanguages', sub {
+ return [
+ {
+ 'sublanguages_loop' => [
+ {
+ 'script' => undef,
+ 'extension' => undef,
+ 'language' => 'en',
+ 'region' => undef,
+ 'region_description' => undef,
+ 'sublanguage_current' => 1,
+ 'privateuse' => undef,
+ 'variant' => undef,
+ 'variant_description' => undef,
+ 'script_description' => undef,
+ 'rfc4646_subtag' => 'en',
+ 'native_description' => 'English',
+ 'enabled' => 1
+ },
+ ],
+ 'plural' => 1,
+ 'language' => 'en',
+ 'current' => 1,
+ 'native_description' => 'English',
+ 'rfc4646_subtag' => 'en',
+ 'group_enabled' => 1
+ }
+ ];
+});
+my $tmplModule = new Test::MockModule('C4::Templates');
+$tmplModule->mock('_get_template_file', sub {
+ my ($tmplbase, $interface, $query) = @_;
+ my $opactmpl = File::Spec->rel2abs(dirname(__FILE__) . '/../../koha-tmpl/opac-tmpl');
+ return ($opactmpl, 'prog', 'en', "$opactmpl/prog/en/modules/$tmplbase");
+});
+my $contextModule = new Test::MockModule('C4::Context');
+$contextModule->mock('preference', sub {
+ return '';
+});
+$contextModule->mock('config', sub {
+ return '';
+});
+
+
+my $suggestor = Koha::SuggestionEngine->new( { plugins => [ 'ExplodedTerms' ] } );
+is(ref($suggestor), 'Koha::SuggestionEngine', 'Created suggestion engine');
+
+my $result = $suggestor->get_suggestions({search => 'Cookery'});
+
+ok((grep { $_->{'search'} eq 'su-na=Cookery' } @$result) && (grep { $_->{'search'} eq 'su-br=Cookery' } @$result) && (grep { $_->{'search'} eq 'su-rl=Cookery' } @$result), "Suggested correct alternatives for keyword search 'Cookery'");
+
+$result = $suggestor->get_suggestions({search => 'su:Cookery'});
+
+ok((grep { $_->{'search'} eq 'su-na=Cookery' } @$result) && (grep { $_->{'search'} eq 'su-br=Cookery' } @$result) && (grep { $_->{'search'} eq 'su-rl=Cookery' } @$result), "Suggested correct alternatives for subject search 'Cookery'");
+
+$result = $suggestor->get_suggestions({search => 'nt:Cookery'});
+
+is(scalar @$result, 0, "No suggestions for fielded search");
+
+$result = $suggestor->get_suggestions({search => 'ccl=su:Cookery'});
+
+is(scalar @$result, 0, "No suggestions for CCL search");
+
+done_testing();
my $temp;
my $extended_param = plugin_parameters( $dbh, $temp, $tagslib, $subfield_data{id}, \@loop_data );
my ( $function_name, $javascript ) = plugin_javascript( $dbh, $temp, $tagslib, $subfield_data{id}, \@loop_data );
- $subfield_data{marc_value} = qq[<input $attributes
+ $subfield_data{marc_value} = qq[<input type="text" $attributes
onfocus="Focus$function_name($subfield_data{random}, '$subfield_data{id}');"
onblur=" Blur$function_name($subfield_data{random}, '$subfield_data{id}');" />
<a href="#" class="buttonDot" onclick="Clic$function_name('$subfield_data{id}'); return false;" title="Tag Editor">...</a>
$javascript];
} else {
warn "Plugin Failed: $plugin";
- $subfield_data{marc_value} = "<input $attributes />"; # supply default input form
+ $subfield_data{marc_value} = "<input type=\"text\" $attributes />"; # supply default input form
}
}
elsif ( $tag eq '' ) { # it's an hidden field
$subfield_data{marc_value} = "<textarea $attributes_no_value>$value</textarea>\n";
} else {
# it's a standard field
- $subfield_data{marc_value} = "<input $attributes />";
+ $subfield_data{marc_value} = "<input type=\"text\" $attributes />";
}
# $subfield_data{marc_value}="<input type=\"text\" name=\"field_value\">";
push (@loop_data, \%subfield_data);
my @fields = (
{
name => "surname",
- lib => "Surname",
type => "text",
mandatory => ( grep /surname/, @mandatoryFields ) ? 1 : 0
}
,
{
name => "firstname",
- lib => "Firstname",
type => "text",
mandatory => ( grep /surname/, @mandatoryFields ) ? 1 : 0,
}
,
{
name => "branchcode",
- lib => "Branchname",
type => "select",
option => \@branches_option,
mandatory => ( grep /branchcode/, @mandatoryFields ) ? 1 : 0,
,
{
name => "categorycode",
- lib => "Category",
type => "select",
option => \@categories_option,
mandatory => ( grep /categorycode/, @mandatoryFields ) ? 1 : 0,
,
{
name => "sort1",
- lib => "Sort 1",
type => @sort1_option ? "select" : "text",
option => \@sort1_option,
mandatory => ( grep /sort1/, @mandatoryFields ) ? 1 : 0,
,
{
name => "sort2",
- lib => "Sort 2",
type => @sort2_option ? "select" : "text",
option => \@sort2_option,
mandatory => ( grep /sort2/, @mandatoryFields ) ? 1 : 0,
,
{
name => "dateenrolled",
- lib => "Date enrolled",
type => "date",
mandatory => ( grep /dateenrolled/, @mandatoryFields ) ? 1 : 0,
}
,
{
name => "dateexpiry",
- lib => "Date expiry",
type => "date",
mandatory => ( grep /dateexpiry/, @mandatoryFields ) ? 1 : 0,
}
,
{
name => "debarred",
- lib => "Debarred",
type => "date",
mandatory => ( grep /debarred/, @mandatoryFields ) ? 1 : 0,
}
,
{
name => "debarredcomment",
- lib => "Debarred comment",
type => "text",
mandatory => ( grep /debarredcomment/, @mandatoryFields ) ? 1 : 0,
}
,
{
name => "borrowernotes",
- lib => "Borrower Notes",
type => "text",
mandatory => ( grep /borrowernotes/, @mandatoryFields ) ? 1 : 0,
}