[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/authorities auth_finder.pl authorities-hom...
From: |
Antoine Farnault |
Subject: |
[Koha-cvs] koha/authorities auth_finder.pl authorities-hom... |
Date: |
Thu, 26 Jul 2007 15:20:23 +0000 |
CVSROOT: /sources/koha
Module name: koha
Changes by: Antoine Farnault <toins> 07/07/26 15:20:23
Modified files:
authorities : auth_finder.pl authorities-home.pl
Log message:
reindenting + removing unused syspref.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/authorities/auth_finder.pl?cvsroot=koha&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/koha/authorities/authorities-home.pl?cvsroot=koha&r1=1.19&r2=1.20
Patches:
Index: auth_finder.pl
===================================================================
RCS file: /sources/koha/koha/authorities/auth_finder.pl,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- auth_finder.pl 24 Apr 2007 13:54:28 -0000 1.15
+++ auth_finder.pl 26 Jul 2007 15:20:22 -0000 1.16
@@ -23,30 +23,30 @@
use CGI;
use C4::Output;
use C4::Auth;
-
use C4::Context;
use C4::AuthoritiesMarc;
use C4::Acquisition;
use C4::Koha; # XXX subfield_is_koha_internal_p
-my $query=new CGI;
+my $query = new CGI;
my $op = $query->param('op');
my $authtypecode = $query->param('authtypecode');
my $index = $query->param('index');
-my $tagid=$query->param('tagid');
+my $tagid = $query->param('tagid');
my $resultstring = $query->param('result');
my $dbh = C4::Context->dbh;
-my $startfrom=$query->param('startfrom');
-$startfrom=0 if(!defined $startfrom);
-my ($template, $loggedinuser, $cookie);
+my $startfrom = $query->param('startfrom');
+$startfrom = 0 if ( !defined $startfrom );
+my ( $template, $loggedinuser, $cookie );
my $resultsperpage;
my $authtypes = getauthtypes;
my @authtypesloop;
-foreach my $thisauthtype (keys %$authtypes) {
+foreach my $thisauthtype ( keys %$authtypes ) {
my $selected = 1 if $thisauthtype eq $authtypecode;
- my %row =(value => $thisauthtype,
+ my %row = (
+ value => $thisauthtype,
selected => $selected,
authtypetext => $authtypes->{$thisauthtype}{'authtypetext'},
index => $index,
@@ -54,113 +54,118 @@
push @authtypesloop, \%row;
}
-if ($op eq "do_search") {
+if ( $op eq "do_search" ) {
my @marclist = $query->param('marclist');
my @and_or = $query->param('and_or');
my @excluding = $query->param('excluding');
my @operator = $query->param('operator');
my @value = $query->param('value');
- $resultsperpage= $query->param('resultsperpage');
- $resultsperpage = 19 if(!defined $resultsperpage);
+ $resultsperpage = $query->param('resultsperpage');
+ $resultsperpage = 19 if ( !defined $resultsperpage );
- my ($results,$total) = SearchAuthorities(address@hidden,address@hidden,
- address@hidden, address@hidden,
address@hidden,
- $startfrom*$resultsperpage,
$resultsperpage,$authtypecode);# $orderby);
+ my ( $results, $total ) =
+ SearchAuthorities( address@hidden, address@hidden, address@hidden,
address@hidden, address@hidden,
+ $startfrom * $resultsperpage,
+ $resultsperpage, $authtypecode ); # $orderby);
# multi page display gestion
- my $displaynext=0;
- my $displayprev=$startfrom;
- if(($total - (($startfrom+1)*($resultsperpage))) > 0 ) {
+ my $displaynext = 0;
+ my $displayprev = $startfrom;
+ if ( ( $total - ( ( $startfrom + 1 ) * ($resultsperpage) ) ) > 0 ) {
$displaynext = 1;
}
my @field_data = ();
-
- my @marclist_ini = $query->param('marclist'); # get marclist again, as
the previous one has been modified by catalogsearch (mainentry replaced by
field name
- for(my $i = 0 ; $i <= $#marclist ; $i++) {
- push @field_data, { term => "marclist", val=>$marclist_ini[$i]
};
- push @field_data, { term => "and_or", val=>$and_or[$i] };
- push @field_data, { term => "excluding", val=>$excluding[$i] };
- push @field_data, { term => "operator", val=>$operator[$i] };
- push @field_data, { term => "value", val=>$value[$i] };
+ my @marclist_ini =
+ $query->param('marclist')
+ ; # get marclist again, as the previous one has been modified by
catalogsearch (mainentry replaced by field name
+ for ( my $i = 0 ; $i <= $#marclist ; $i++ ) {
+ push @field_data, { term => "marclist", val => $marclist_ini[$i] };
+ push @field_data, { term => "and_or", val => $and_or[$i] };
+ push @field_data, { term => "excluding", val => $excluding[$i] };
+ push @field_data, { term => "operator", val => $operator[$i] };
+ push @field_data, { term => "value", val => $value[$i] };
}
my @numbers = ();
- if ($total>$resultsperpage) {
- for (my $i=1; $i<$total/$resultsperpage+1; $i++) {
- if ($i<16) {
- my $highlight=0;
- ($startfrom==($i-1)) && ($highlight=1);
- push @numbers, { number => $i,
- highlight => $highlight ,
- searchdata=> address@hidden,
- startfrom => ($i-1)};
+ if ( $total > $resultsperpage ) {
+ for ( my $i = 1 ; $i < $total / $resultsperpage + 1 ; $i++ ) {
+ if ( $i < 16 ) {
+ my $highlight = 0;
+ ( $startfrom == ( $i - 1 ) ) && ( $highlight = 1 );
+ push @numbers,
+ {
+ number => $i,
+ highlight => $highlight,
+ searchdata => address@hidden,
+ startfrom => ( $i - 1 )
+ };
}
}
}
- my $from = $startfrom*$resultsperpage+1;
+ my $from = $startfrom * $resultsperpage + 1;
my $to;
- if($total < (($startfrom+1)*$resultsperpage)) {
+ if ( $total < ( ( $startfrom + 1 ) * $resultsperpage ) ) {
$to = $total;
- } else {
- $to = (($startfrom+1)*$resultsperpage);
}
- ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name =>
"authorities/searchresultlist-auth.tmpl",
+ else {
+ $to = ( ( $startfrom + 1 ) * $resultsperpage );
+ }
+ ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "authorities/searchresultlist-auth.tmpl",
query => $query,
type => 'intranet',
authnotrequired => 0,
- flagsrequired => {catalogue => 1},
- debug => 1,
- });
-
- $template->param(result => $results) if $results;
- $template->param(index => $query->param('index')."");
- $template->param(startfrom=> $startfrom,
- displaynext=> $displaynext,
- displayprev=> $displayprev,
+ flagsrequired => { catalogue => 1 },
+ }
+ );
+
+ $template->param( result => $results ) if $results;
+ $template->param(
+ startfrom => $startfrom,
+ displaynext => $displaynext,
+ displayprev => $displayprev,
resultsperpage => $resultsperpage,
- startfromnext => $startfrom+1,
- startfromprev => $startfrom-1,
- index => $index,
- tagid => $tagid,
- searchdata=>address@hidden,
- total=>$total,
- from=>$from,
- to=>$to,
- numbers=>address@hidden,
- authtypecode =>$authtypecode,
- mainmainstring =>$value[0],
- mainstring =>$value[1],
- anystring =>$value[2],
+ startfromnext => $startfrom + 1,
+ startfromprev => $startfrom - 1,
+ searchdata => address@hidden,
+ total => $total,
+ from => $from,
+ to => $to,
+ numbers => address@hidden,
+ authtypecode => $authtypecode,
+ mainmainstring => $value[0],
+ mainstring => $value[1],
+ anystring => $value[2],
);
} else {
- ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name =>
"authorities/auth_finder.tmpl",
+ ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "authorities/auth_finder.tmpl",
query => $query,
type => 'intranet',
authnotrequired => 0,
- flagsrequired => {catalogue => 1},
- debug => 1,
- });
+ flagsrequired => { catalogue => 1 },
+ }
+ );
- $template->param(index=>$query->param('index')."",
- tagid => $tagid,
+ $template->param(
resultstring => $resultstring,
);
}
-$template->param(authtypesloop => address@hidden,
+$template->param(
+ tagid => $tagid,
+ index => $index,
+ authtypesloop => address@hidden,
authtypecode => $authtypecode,
- intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
- intranetstylesheet => C4::Context->preference("intranetstylesheet"),
- IntranetNav => C4::Context->preference("IntranetNav"),
- );
+);
# Print the page
output_html_with_http_headers $query, $cookie, $template->output;
Index: authorities-home.pl
===================================================================
RCS file: /sources/koha/koha/authorities/authorities-home.pl,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- authorities-home.pl 24 Apr 2007 13:54:28 -0000 1.19
+++ authorities-home.pl 26 Jul 2007 15:20:23 -0000 1.20
@@ -1,5 +1,4 @@
#!/usr/bin/perl
-# WARNING: 4-character tab stops here
# Copyright 2000-2002 Katipo Communications
#
@@ -31,26 +30,29 @@
use C4::Koha; # XXX subfield_is_koha_internal_p
use C4::Biblio;
-my $query=new CGI;
+my $query = new CGI;
my $op = $query->param('op');
my $authtypecode = $query->param('authtypecode');
my $dbh = C4::Context->dbh;
-my $authid=$query->param('authid');
-my ($template, $loggedinuser, $cookie);
+my $authid = $query->param('authid');
+my ( $template, $loggedinuser, $cookie );
my $authtypes = getauthtypes;
my @authtypesloop;
-foreach my $thisauthtype (sort { $authtypes->{$a} <=> $authtypes->{$b} } keys
%$authtypes) {
+foreach my $thisauthtype ( sort { $authtypes->{$a} <=> $authtypes->{$b} }
+ keys %$authtypes )
+{
my $selected = 1 if $thisauthtype eq $authtypecode;
- my %row =(value => $thisauthtype,
+ my %row = (
+ value => $thisauthtype,
selected => $selected,
authtypetext =>
$authtypes->{$thisauthtype}{'authtypetext'},
);
push @authtypesloop, \%row;
}
-if ($op eq "do_search") {
+if ( $op eq "do_search" ) {
my @marclist = $query->param('marclist');
my @and_or = $query->param('and_or');
my @excluding = $query->param('excluding');
@@ -61,27 +63,21 @@
my $startfrom = $query->param('startfrom') || 1;
my $resultsperpage = $query->param('resultsperpage') || 19;
- my ($results,$total) = SearchAuthorities(
- address@hidden,
- address@hidden,
- address@hidden,
- address@hidden,
- address@hidden,
- ($startfrom - 1)*$resultsperpage,
- $resultsperpage,
- $authtypecode,
- $orderby
- );
+ my ( $results, $total ) =
+ SearchAuthorities( address@hidden, address@hidden, address@hidden,
address@hidden, address@hidden,
+ ( $startfrom - 1 ) * $resultsperpage,
+ $resultsperpage, $authtypecode, $orderby );
- ($template, $loggedinuser, $cookie)
- = get_template_and_user({
+ ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
template_name => "authorities/searchresultlist.tmpl",
query => $query,
type => 'intranet',
authnotrequired => 0,
- flagsrequired => {catalogue => 1},
+ flagsrequired => { catalogue => 1 },
debug => 1,
- });
+ }
+ );
my @field_data = ();
@@ -89,85 +85,84 @@
# has been replaced by something else during the search, thus the links
# next/previous would not work anymore
my @marclist_ini = $query->param('marclist');
- for(my $i = 0 ; $i <= $#marclist ; $i++)
- {
- push @field_data, { term => "marclist" ,
val=>$marclist_ini[$i] };
- push @field_data, { term => "and_or" , val=>$and_or[$i] };
- push @field_data, { term => "excluding" , val=>$excluding[$i] };
- push @field_data, { term => "operator" , val=>$operator[$i] };
- push @field_data, { term => "value" , val=>$value[$i] };
+ for ( my $i = 0 ; $i <= $#marclist ; $i++ ) {
+ push @field_data, { term => "marclist", val => $marclist_ini[$i] };
+ push @field_data, { term => "and_or", val => $and_or[$i] };
+ push @field_data, { term => "excluding", val => $excluding[$i] };
+ push @field_data, { term => "operator", val => $operator[$i] };
+ push @field_data, { term => "value", val => $value[$i] };
}
# construction of the url of each page
my $base_url =
'authorities-home.pl?'
- .join(
- '&',
- map { $_->{term}.'='.$_->{val} } @field_data
- )
- .'&'
- .join(
+ . join( '&', map { $_->{term} . '=' . $_->{val} } @field_data )
+ . '&'
+ . join(
'&',
- map { $_->{term}.'='.$_->{val} } (
- {term => 'resultsperpage', val => $resultsperpage},
- {term => 'type' , val => 'intranet'},
- {term => 'op' , val => 'do_search'},
- {term => 'authtypecode' , val => $authtypecode},
- {term => 'orderby' , val => $orderby},
- )
+ map { $_->{term} . '=' . $_->{val} } (
+ { term => 'resultsperpage', val => $resultsperpage },
+ { term => 'type', val => 'intranet' },
+ { term => 'op', val => 'do_search' },
+ { term => 'authtypecode', val => $authtypecode },
+ { term => 'orderby', val => $orderby },
)
- ;
+ );
- my $from = ($startfrom - 1) * $resultsperpage + 1;
+ my $from = ( $startfrom - 1 ) * $resultsperpage + 1;
my $to;
- if ($total < $startfrom * $resultsperpage) {
+ if ( $total < $startfrom * $resultsperpage ) {
$to = $total;
}
else {
$to = $startfrom * $resultsperpage;
}
- $template->param(result => $results) if $results;
+ $template->param( result => $results ) if $results;
$template->param(
pagination_bar => pagination_bar(
- $base_url,
- int($total/$resultsperpage)+1,
- $startfrom,
- 'startfrom'
+ $base_url, int( $total / $resultsperpage ) + 1,
+ $startfrom, 'startfrom'
),
- total=>$total,
- from=>$from,
- to=>$to,
+ total => $total,
+ from => $from,
+ to => $to,
isEDITORS => $authtypecode eq 'EDITORS',
);
-} elsif ($op eq "delete") {
+}
+elsif ( $op eq "delete" ) {
- &DelAuthority($authid, 1);
+ &DelAuthority( $authid, 1 );
- ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name =>
"authorities/authorities-home.tmpl",
+ ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "authorities/authorities-home.tmpl",
query => $query,
type => 'intranet',
authnotrequired => 0,
- flagsrequired => {catalogue => 1},
+ flagsrequired => { catalogue => 1 },
debug => 1,
- });
-# $template->param("statements" => address@hidden,
-# "nbstatements" =>
$nbstatements);
+ }
+ );
+
+ # $template->param("statements" => address@hidden,
+ # "nbstatements" =>
$nbstatements);
}
-elsif ($op eq "AddStatement") {
+elsif ( $op eq "AddStatement" ) {
- ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name =>
"authorities/authorities-home.tmpl",
+ ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "authorities/authorities-home.tmpl",
query => $query,
type => 'intranet',
authnotrequired => 0,
- flagsrequired => {catalogue => 1},
+ flagsrequired => { catalogue => 1 },
debug => 1,
- });
+ }
+ );
# Gets the entered information
my @marcfields = $query->param('marclist');
@@ -182,38 +177,40 @@
my $marcarray = create_marclist();
my $nbstatements = $query->param('nbstatements');
- $nbstatements = 1 if(!defined $nbstatements);
+ $nbstatements = 1 if ( !defined $nbstatements );
- for(my $i = 0 ; $i < $nbstatements ; $i++)
- {
+ for ( my $i = 0 ; $i < $nbstatements ; $i++ ) {
my %fields = ();
# Recreates the old scrolling lists with the previously
selected values
- my $marclist = create_scrolling_list({name=>"marclist",
- values=> $marcarray,
- size=> 1,
- -tabindex=>'',
- default=>$marcfields[$i],
- onChange => "sql_update()"}
+ my $marclist = create_scrolling_list(
+ {
+ name => "marclist",
+ values => $marcarray,
+ size => 1,
+ -tabindex => '',
+ default => $marcfields[$i],
+ onChange => "sql_update()"
+ }
);
$fields{'marclist'} = $marclist;
- $fields{'first'} = 1 if($i == 0);
+ $fields{'first'} = 1 if ( $i == 0 );
- # Restores the and/or parameters (no need to test the 'and' for
activation because it's the default value)
- $fields{'or'} = 1 if($and_or[$i] eq "or");
+# Restores the and/or parameters (no need to test the 'and' for activation
because it's the default value)
+ $fields{'or'} = 1 if ( $and_or[$i] eq "or" );
#Restores the "not" parameters
- $fields{'not'} = 1 if($excluding[$i]);
+ $fields{'not'} = 1 if ( $excluding[$i] );
#Restores the operators (most common operators first);
- if($operator[$i] eq "=") { $fields{'eq'} = 1; }
- elsif($operator[$i] eq "contains") { $fields{'contains'} = 1; }
- elsif($operator[$i] eq "start") { $fields{'start'} = 1; }
- elsif($operator[$i] eq ">") { $fields{'gt'} = 1; }
#greater than
- elsif($operator[$i] eq ">=") { $fields{'ge'} = 1; } #greater or
equal
- elsif($operator[$i] eq "<") { $fields{'lt'} = 1; } #lower than
- elsif($operator[$i] eq "<=") { $fields{'le'} = 1; } #lower or
equal
+ if ( $operator[$i] eq "=" ) { $fields{'eq'} = 1; }
+ elsif ( $operator[$i] eq "contains" ) { $fields{'contains'} = 1; }
+ elsif ( $operator[$i] eq "start" ) { $fields{'start'} = 1; }
+ elsif ( $operator[$i] eq ">" ) { $fields{'gt'} = 1; } #greater than
+ elsif ( $operator[$i] eq ">=" ) { $fields{'ge'} = 1; } #greater or
equal
+ elsif ( $operator[$i] eq "<" ) { $fields{'lt'} = 1; } #lower than
+ elsif ( $operator[$i] eq "<=" ) { $fields{'le'} = 1; } #lower or equal
#Restores the value
$fields{'value'} = $value[$i];
@@ -223,38 +220,40 @@
$nbstatements++;
# The new scrolling list
- my $marclist = create_scrolling_list({name=>"marclist",
- values=> $marcarray,
- size=>1,
- -tabindex=>'',
- onChange => "sql_update()"});
- push @statements, {"marclist" => $marclist };
+ my $marclist = create_scrolling_list(
+ {
+ name => "marclist",
+ values => $marcarray,
+ size => 1,
+ -tabindex => '',
+ onChange => "sql_update()"
+ }
+ );
+ push @statements, { "marclist" => $marclist };
- $template->param("statements" => address@hidden,
- "nbstatements" =>
$nbstatements);
+ $template->param(
+ "statements" => address@hidden,
+ "nbstatements" => $nbstatements
+ );
}
else {
- ($template, $loggedinuser, $cookie)
- = get_template_and_user({template_name =>
"authorities/authorities-home.tmpl",
+ ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "authorities/authorities-home.tmpl",
query => $query,
type => 'intranet',
authnotrequired => 0,
- flagsrequired => {catalogue => 1},
+ flagsrequired => { catalogue => 1 },
debug => 1,
- });
+ }
+ );
}
-$template->param(authtypesloop => address@hidden,
- intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
- intranetstylesheet =>
C4::Context->preference("intranetstylesheet"),
- IntranetNav => C4::Context->preference("IntranetNav"),
- );
+$template->param(
+ authtypesloop => address@hidden,
+);
# Print the page
output_html_with_http_headers $query, $cookie, $template->output;
-
-# Local Variables:
-# tab-width: 4
-# End:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha/authorities auth_finder.pl authorities-hom...,
Antoine Farnault <=