[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/admin auth_subfields_structure.pl auth_tag...
From: |
Tumer Garip |
Subject: |
[Koha-cvs] koha/admin auth_subfields_structure.pl auth_tag... |
Date: |
Fri, 19 May 2006 18:02:09 +0000 |
CVSROOT: /sources/koha
Module name: koha
Branch:
Changes by: Tumer Garip <address@hidden> 06/05/19 18:02:09
Modified files:
admin : auth_subfields_structure.pl
auth_tag_structure.pl
Log message:
Authority tables are modified to be compatible with new MARC
frameworks. This change is part of Authority Linking & Zebra authorities.
Requires change in Mysql database. It will break head unless all changes
regarding this is implemented. This warning will take place on all commits
regarding this
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/admin/auth_subfields_structure.pl.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/koha/koha/admin/auth_tag_structure.pl.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
Patches:
Index: koha/admin/auth_subfields_structure.pl
diff -u koha/admin/auth_subfields_structure.pl:1.5
koha/admin/auth_subfields_structure.pl:1.6
--- koha/admin/auth_subfields_structure.pl:1.5 Fri Feb 24 11:15:01 2006
+++ koha/admin/auth_subfields_structure.pl Fri May 19 18:02:09 2006
@@ -33,13 +33,15 @@
$searchstring=~ s/\'/\\\'/g;
my @data=split(' ',$searchstring);
my address@hidden;
- my $sth=$dbh->prepare("Select
tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,seealso,authorised_value,value_builder
from auth_subfield_structure where (tagfield like ? and authtypecode=?) order
by tagfield");
+ my $sth=$dbh->prepare("Select * from auth_subfield_structure where
(tagfield like ? and authtypecode=?) order by tagfield");
$sth->execute("$searchstring%",$authtypecode);
my @results;
my $cnt=0;
+ my $u=1;
while (my $data=$sth->fetchrow_hashref){
push(@results,$data);
$cnt ++;
+ $u++;
}
$sth->finish;
$dbh->disconnect;
@@ -84,9 +86,18 @@
my $data;
my $dbh = C4::Context->dbh;
my $more_subfields = $input->param("more_subfields")+1;
+ # builds kohafield tables
+ my @kohafields;
+ push @kohafields, "";
+ my $sth2=$dbh->prepare("SHOW COLUMNS from auth_header");
+ $sth2->execute;
+ while ((my $field) = $sth2->fetchrow_array) {
+ push @kohafields, "auth_header.".$field;
+ }
# build authorised value list
- my $sth2 = $dbh->prepare("select distinct category from
authorised_values");
+ $sth2->finish;
+ $sth2 = $dbh->prepare("select distinct category from
authorised_values");
$sth2->execute;
my @authorised_values;
push @authorised_values,"";
@@ -95,9 +106,19 @@
}
push (@authorised_values,"branches");
push (@authorised_values,"itemtypes");
+
# build value_builder list
my @value_builder=('');
- opendir(DIR, "../value_builder") || die "can't opendir
../value_builder: $!";
+
+ # read value_builder directory.
+ # 2 cases here : on CVS install, $cgidir does not need a /cgi-bin
+ # on a standard install, /cgi-bin need to be added.
+ # test one, then the other
+ my $cgidir = C4::Context->intranetdir ."/cgi-bin";
+ unless (opendir(DIR, "$cgidir/value_builder")) {
+ $cgidir = C4::Context->intranetdir;
+ opendir(DIR, "$cgidir/value_builder") || die "can't opendir
$cgidir/value_builder: $!";
+ }
while (my $line = readdir(DIR)) {
if ($line =~ /\.pl$/) {
push (@value_builder,$line);
@@ -106,45 +127,108 @@
closedir DIR;
# build values list
- my $sth=$dbh->prepare("select
tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,seealso,authorised_value,value_builder
from auth_subfield_structure where tagfield=? and authtypecode=?"); # and
tagsubfield='$tagsubfield'");
+ my $sth=$dbh->prepare("select * from auth_subfield_structure where
tagfield=? and authtypecode=?"); # and tagsubfield='$tagsubfield'");
$sth->execute($tagfield,$authtypecode);
my @loop_data = ();
- my $toggle="white";
+ my $toggle=1;
my $i=0;
while ($data =$sth->fetchrow_hashref) {
+
my %row_data; # get a fresh hash for the row data
- if ($toggle eq 'white'){
- $toggle="#ffffcc";
+ if ($toggle eq 1){
+ $toggle=0;
} else {
- $toggle="white";
+ $toggle=1;
}
$row_data{tab} = CGI::scrolling_list(-name=>'tab',
+ -id=>"tab$i",
-values=>['-1','0'],
- -labels => {'-1' =>'No
(ignore)','0'=>'yes'
+ -labels => {'-1' =>'ignore','0'=>'0',
},
-default=>$data->{'tab'},
-size=>1,
-multiple=>0,
);
- $row_data{tagsubfield} =$data->{'tagsubfield'}."<input
type='hidden' name='tagsubfield' value='".$data->{'tagsubfield'}."'>";
+ $row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden',
+ -id=>"ohidden$i",
+ -values=>['0','1','2'],
+ -labels => {'0'=>'Show','1'=>'Show
Collapsed',
+ '2'
=>'Hide',
+ },
+ -default=>substr($data->{'hidden'},0,1),
+ -size=>1,
+ -multiple=>0,
+ );
+ $row_data{ihidden} = CGI::scrolling_list(-name=>'ihidden',
+ -id=>"ihidden$i",
+ -values=>['0','1','2'],
+ -labels => {'0'=>'Show','1'=>'Show
Collapsed',
+ '2'
=>'Hide',
+ },
+ -default=>substr($data->{'hidden'},1,1),
+ -size=>1,
+ -multiple=>0,
+ );
+ $row_data{ehidden} = CGI::scrolling_list(-name=>'ehidden',
+ -id=>"ehidden$i",
+ -values=>['0','1','2'],
+ -labels => {'0'=>'Show','1'=>'Show
Collapsed',
+ '2'
=>'Hide',
+ },
+ -default=>substr($data->{'hidden'},2,1),
+ -size=>1,
+ -multiple=>0,
+ );
+ $row_data{tagsubfield} =$data->{'tagsubfield'}."<input
type=\"hidden\" name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\"
id=\"tagsubfield\">";
$row_data{liblibrarian} =
CGI::escapeHTML($data->{'liblibrarian'});
$row_data{libopac} = CGI::escapeHTML($data->{'libopac'});
$row_data{seealso} = CGI::escapeHTML($data->{'seealso'});
+ $row_data{kohafield}= CGI::scrolling_list( -name=>"kohafield",
+ -id=>"kohafield$i",
+ -values=> address@hidden,
+ -default=> "$data->{'kohafield'}",
+ -size=>1,
+ -multiple=>0,
+ );
$row_data{authorised_value} =
CGI::scrolling_list(-name=>'authorised_value',
+ -id=>'authorised_value',
-values=> address@hidden,
-default=>$data->{'authorised_value'},
-size=>1,
-multiple=>0,
);
$row_data{value_builder} =
CGI::scrolling_list(-name=>'value_builder',
+ -id=>'value_builder',
-values=> address@hidden,
-default=>$data->{'value_builder'},
-size=>1,
-multiple=>0,
);
- $row_data{repeatable} =
CGI::checkbox("repeatable$i",$data->{'repeatable'}?'checked':'',1,'');
- $row_data{mandatory} =
CGI::checkbox("mandatory$i",$data->{'mandatory'}?'checked':'',1,'');
- $row_data{bgcolor} = $toggle;
+
+ $row_data{repeatable} = CGI::checkbox(-name=>"repeatable$i",
+ -checked => $data->{'repeatable'}?'checked':'',
+ -value => 1,
+ -label => '',
+ -id => "repeatable$i");
+ $row_data{mandatory} = CGI::checkbox(-name => "mandatory$i",
+ -checked => $data->{'mandatory'}?'checked':'',
+ -value => 1,
+ -label => '',
+ -id => "mandatory$i");
+ $row_data{hidden} = CGI::escapeHTML($data->{hidden}) ;
+ $row_data{isurl} = CGI::checkbox( -name => "isurl$i",
+ -id => "isurl$i",
+ -checked => $data->{'isurl'}?'checked':'',
+ -value => 1,
+ -label => '');
+ $row_data{link} = CGI::checkbox( -name => "link$i",
+ -id => "link$i",
+ -checked => $data->{'link'}?'checked':'',
+ -value => 1,
+ -label => '');
+ $row_data{row} = $i;
+ $row_data{toggle} = $toggle;
+ # $row_data{link} = CGI::escapeHTML($data->{'link'});
push(@loop_data, \%row_data);
$i++;
}
@@ -152,25 +236,86 @@
for (my $i=1;$i<=$more_subfields;$i++) {
my %row_data; # get a fresh hash for the row data
$row_data{tab} = CGI::scrolling_list(-name=>'tab',
+ -id => "tab$i",
-values=>['-1','0'],
- -labels => {'-1' =>'no
(ignore)','0'=>'yes',
+ -labels => {'-1' =>'ignore','0'=>'0',
},
-default=>"",
-size=>1,
-multiple=>0,
);
- $row_data{tagsubfield} = "<input type=\"text\"
name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\" size=\"3\"
maxlength=\"1\">";
+ $row_data{ohidden} = CGI::scrolling_list(-name=>'ohidden',
+ -id=>"ohidden$i",
+ -values=>['0','1','2'],
+ -labels => {'0'=>'Show','1'=>'Show
Collapsed',
+ '2'
=>'Hide',
+ },
+ -default=>"0",
+ -size=>1,
+ -multiple=>0,
+ );
+
+ $row_data{ihidden} = CGI::scrolling_list(-name=>'ihidden',
+ -id=>"ihidden$i",
+ -values=>['0','1','2'],
+ -labels => {'0'=>'Show','1'=>'Show
Collapsed',
+ '2'
=>'Hide',
+ },
+ -default=>"0",
+ -size=>1,
+ -multiple=>0,
+ );
+ $row_data{ehidden} = CGI::scrolling_list(-name=>'ehidden',
+ -id=>"ehidden$i",
+ -values=>['0','1','2'],
+ -labels => {'0'=>'Show','1'=>'Show
Collapsed',
+ '2'
=>'Hide',
+ },
+ -default=>"0",
+ -size=>1,
+ -multiple=>0,
+ );
+ $row_data{tagsubfield} = "<input type=\"text\"
name=\"tagsubfield\" value=\"".$data->{'tagsubfield'}."\" size=\"1\"
id=\"tagsubfield\" maxlength=\"1\">";
$row_data{liblibrarian} = "";
$row_data{libopac} = "";
$row_data{seealso} = "";
- $row_data{repeatable} = CGI::checkbox('repeatable','',1,'');
- $row_data{mandatory} = CGI::checkbox('mandatory','',1,'');
+ $row_data{hidden} = "000";
+ $row_data{repeatable} = CGI::checkbox( -name=> 'repeatable',
+ -id => "repeatable$i",
+ -checked => '',
+ -value => 1,
+ -label => '');
+ $row_data{mandatory} = CGI::checkbox( -name=> 'mandatory',
+ -id => "mandatory$i",
+ -checked => '',
+ -value => 1,
+ -label => '');
+ $row_data{isurl} = CGI::checkbox(-name => 'isurl',
+ -id => "isurl$i",
+ -checked => '',
+ -value => 1,
+ -label => '');
+ $row_data{kohafield}= CGI::scrolling_list( -name=>'kohafield',
+ -id => "kohafield$i",
+ -values=> address@hidden,
+ -default=> "",
+ -size=>1,
+ -multiple=>0,
+ );
$row_data{authorised_value} =
CGI::scrolling_list(-name=>'authorised_value',
+ -id => 'authorised_value',
-values=> address@hidden,
-size=>1,
-multiple=>0,
);
- $row_data{bgcolor} = $toggle;
+ $row_data{link} = CGI::checkbox( -name => "link",
+ -id => "link$i",
+ -checked => '',
+ -value => 1,
+ -label => '');
+ # $row_data{link} = CGI::escapeHTML($data->{'link'});
+ $row_data{toggle} = $toggle;
+ $row_data{row} = $i;
push(@loop_data, \%row_data);
}
$template->param('use-heading-flags-p' => 1);
@@ -187,15 +332,23 @@
} elsif ($op eq 'add_validate') {
my $dbh = C4::Context->dbh;
$template->param(tagfield => "$input->param('tagfield')");
- my $sth=$dbh->prepare("replace auth_subfield_structure
(tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,seealso,authorised_value,value_builder,authtypecode)
- values
(?,?,?,?,?,?,?,?,?,?,?)");
+ my $sth=$dbh->prepare("replace auth_subfield_structure
(tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,seealso,authorised_value,authtypecode,value_builder,hidden,isurl,
link)
+ values
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
my @tagsubfield = $input->param('tagsubfield');
my @liblibrarian = $input->param('liblibrarian');
my @libopac = $input->param('libopac');
+ my @kohafield = $input->param('kohafield');
my @tab = $input->param('tab');
my @seealso = $input->param('seealso');
+ #my @hidden = $input->param('hidden');
+ my @hidden;
+ my @ohidden = $input->param('ohidden');
+ my @ihidden = $input->param('ihidden');
+ my @ehidden = $input->param('ehidden');
my @authorised_values = $input->param('authorised_value');
+# my $authtypecodes = $input->param('authtypecode');
my @value_builder =$input->param('value_builder');
+ my @link =$input->param('link');
for (my $i=0; $i<= $#tagsubfield ; $i++) {
my $tagfield =$input->param('tagfield');
my $tagsubfield =$tagsubfield[$i];
@@ -204,10 +357,15 @@
my $libopac =$libopac[$i];
my $repeatable =$input->param("repeatable$i")?1:0;
my $mandatory =$input->param("mandatory$i")?1:0;
+ my $kohafield =$kohafield[$i];
my $tab =$tab[$i];
my $seealso =$seealso[$i];
my $authorised_value =$authorised_values[$i];
+# my $authtypecode =$authtypecodes;
my $value_builder=$value_builder[$i];
+ my $hidden = $ohidden[$i].$ihidden[$i].$ehidden[$i]; #collate
from 3 hiddens;
+ my $isurl = $input->param("isurl$i")?1:0;
+ my $link = $input->param("link$i")?1:0;
if ($liblibrarian) {
unless (C4::Context->config('demo') eq 1) {
$sth->execute ($tagfield,
@@ -216,10 +374,18 @@
$libopac,
$repeatable,
$mandatory,
+
$kohafield,
$tab,
$seealso,
$authorised_value,
-
$value_builder,$authtypecode);
+
$authtypecode,
+
$value_builder,
+ $hidden,
+ $isurl,
+
+
+ $link,
+ );
}
}
}
@@ -232,8 +398,9 @@
# called by default form, used to confirm deletion of data in DB
} elsif ($op eq 'delete_confirm') {
my $dbh = C4::Context->dbh;
- my $sth=$dbh->prepare("select
tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,authorised_value,value_builder
from auth_subfield_structure where tagfield=? and tagsubfield=? and
authtypecode=?");
- $sth->execute($tagfield,$tagsubfield,$authtypecode);
+ my $sth=$dbh->prepare("select * from auth_subfield_structure where
tagfield=? and tagsubfield=? and authtypecode=?");
+ #FIXME : called with 2 bind variables when 3 are needed
+ $sth->execute($tagfield,$tagsubfield);
my $data=$sth->fetchrow_hashref;
$sth->finish;
$template->param(liblibrarian => $data->{'liblibrarian'},
@@ -251,7 +418,6 @@
unless (C4::Context->config('demo') eq 1) {
my $sth=$dbh->prepare("delete from auth_subfield_structure
where tagfield=? and tagsubfield=? and authtypecode=?");
$sth->execute($tagfield,$tagsubfield,$authtypecode);
- warn "DEL : $tagfield,$tagsubfield,$authtypecode";
$sth->finish;
}
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=auth_subfields_structure.pl?tagfield=$tagfield&authtypecode=$authtypecode\"></html>";
@@ -262,41 +428,52 @@
} else { # DEFAULT
my $env;
my ($count,$results)=StringSearch($env,$tagfield,$authtypecode);
- my $toggle="white";
+ my $toggle=1;
my @loop_data = ();
for (my $i=$offset; $i <
($offset+$pagesize<$count?$offset+$pagesize:$count); $i++){
- if ($toggle eq 'white'){
- $toggle="#ffffcc";
+ if ($toggle eq 1){
+ $toggle=0;
} else {
- $toggle="white";
+ $toggle=1;
}
my %row_data; # get a fresh hash for the row data
$row_data{tagfield} = $results->[$i]{'tagfield'};
$row_data{tagsubfield} = $results->[$i]{'tagsubfield'};
$row_data{liblibrarian} = $results->[$i]{'liblibrarian'};
+ $row_data{kohafield} = $results->[$i]{'kohafield'};
$row_data{repeatable} = $results->[$i]{'repeatable'};
$row_data{mandatory} = $results->[$i]{'mandatory'};
$row_data{tab} = $results->[$i]{'tab'};
$row_data{seealso} = $results->[$i]{'seealso'};
$row_data{authorised_value} =
$results->[$i]{'authorised_value'};
+ $row_data{authtypecode} = $results->[$i]{'authtypecode'};
$row_data{value_builder} =
$results->[$i]{'value_builder'};
+ $row_data{hidden} = $results->[$i]{'hidden'}
if($results->[$i]{'hidden'} gt "000") ;
+ $row_data{isurl} = $results->[$i]{'isurl'};
+ $row_data{link} = $results->[$i]{'link'};
$row_data{delete} =
"$script_name?op=delete_confirm&tagfield=$tagfield&tagsubfield=".$results->[$i]{'tagsubfield'}."&authtypecode=$authtypecode";
- $row_data{bgcolor} = $toggle;
+ $row_data{toggle} = $toggle;
if ($row_data{tab} eq -1) {
$row_data{subfield_ignored} = 1;
}
+
push(@loop_data, \%row_data);
}
$template->param(loop => address@hidden);
- $template->param(edit => "<a
href=\"$script_name?op=add_form&tagfield=$tagfield&authtypecode=$authtypecode\">");
+ $template->param(edit_tagfield => $tagfield,
+ edit_authtypecode => $authtypecode);
+
if ($offset>0) {
my $prevpage = $offset-$pagesize;
- $template->param(prev =>"<a
href=\"$script_name?offset=$prevpage&tagfield=$tagfield&authtypecode=$authtypecode\">");
+ $template->param(prev =>"<a
href=\"$script_name?offset=$prevpage\">");
}
if ($offset+$pagesize<$count) {
my $nextpage =$offset+$pagesize;
- $template->param(next => "<a
href=\"$script_name?offset=$nextpage&tagfield=$tagfield&authtypecode=$authtypecode\">");
+ $template->param(next => "<a
href=\"$script_name?offset=$nextpage\">");
}
} #---- END $OP eq DEFAULT
-
+$template->param(intranetcolorstylesheet =>
C4::Context->preference("intranetcolorstylesheet"),
+ intranetstylesheet =>
C4::Context->preference("intranetstylesheet"),
+ IntranetNav => C4::Context->preference("IntranetNav"),
+ );
output_html_with_http_headers $input, $cookie, $template->output;
Index: koha/admin/auth_tag_structure.pl
diff -u koha/admin/auth_tag_structure.pl:1.4
koha/admin/auth_tag_structure.pl:1.5
--- koha/admin/auth_tag_structure.pl:1.4 Fri Feb 24 11:15:01 2006
+++ koha/admin/auth_tag_structure.pl Fri May 19 18:02:09 2006
@@ -73,7 +73,7 @@
my $sth;
# check that authtype framework is defined in auth_tag_structure if we are on
a default action
if (!$op or $op eq 'authtype_create_confirm') {
-warn "IN";
+#warn "IN";
$sth=$dbh->prepare("select count(*) from auth_tag_structure where
authtypecode=?");
$sth->execute($authtypecode);
my ($authtypeexist) = $sth->fetchrow;
@@ -204,7 +204,7 @@
################## DEFAULT ##################################
} else { # DEFAULT
# here, $op can be unset or set to "authtype_create_confirm".
- warn "authtype : $authtypecode";
+# warn "authtype : $authtypecode";
if ($searchfield ne '') {
$template->param(searchfield => $searchfield);
}
@@ -279,19 +279,19 @@
#
sub duplicate_auth_framework {
my ($newauthtype,$oldauthtype) = @_;
- warn "TO $newauthtype FROM $oldauthtype";
+# warn "TO $newauthtype FROM $oldauthtype";
my $sth = $dbh->prepare("select
tagfield,liblibrarian,libopac,repeatable,mandatory,authorised_value from
auth_tag_structure where authtypecode=?");
$sth->execute($oldauthtype);
- my $sth_insert = $dbh->prepare("insert into auth_tag_structure
(tagfield, liblibrarian, libopac, repeatable, mandatory, authorised_value,
authtypecode) values (?,?,?,?,?,?,?)");
+ my $sth_insert = $dbh->prepare("insert into auth_tag_structure
(tagfield, liblibrarian, libopac, repeatable, mandatory, authorised_value,
authtypecode) values (?,?,?,?,?,?,?)");
while ( my
($tagfield,$liblibrarian,$libopac,$repeatable,$mandatory,$authorised_value) =
$sth->fetchrow) {
$sth_insert->execute($tagfield,$liblibrarian,$libopac,$repeatable,$mandatory,$authorised_value,$newauthtype);
}
- $sth = $dbh->prepare("select
authtypecode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,authorised_value,seealso
from auth_subfield_structure where authtypecode=?");
+ $sth = $dbh->prepare("select
tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,value_builder,seealso,hidden,link
from auth_subfield_structure where authtypecode=?");
$sth->execute($oldauthtype);
- $sth_insert = $dbh->prepare("insert into auth_subfield_structure
(authtypecode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,tab,authorised_value,value_builder,seealso)
values (?,?,?,?,?,?,?,?,?,?,?)");
- while ( my ($authtypecode, $tagfield, $tagsubfield, $liblibrarian,
$libopac, $repeatable, $mandatory, $tab, $authorised_value,
$thesaurus_category, $seealso) = $sth->fetchrow) {
- $sth_insert->execute($newauthtype, $tagfield, $tagsubfield,
$liblibrarian, $libopac, $repeatable, $mandatory, $tab, $authorised_value,
$thesaurus_category, $seealso);
+ $sth_insert = $dbh->prepare("insert into auth_subfield_structure
(authtypecode,tagfield,tagsubfield,liblibrarian,libopac,repeatable,mandatory,kohafield,tab,authorised_value,value_builder,seealso,hidden,link)
values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
+ while ( my ( $tagfield, $tagsubfield, $liblibrarian, $libopac,
$repeatable, $mandatory, $kohafield,$tab, $authorised_value,
$thesaurus_category, $seealso,$hidden,$link) = $sth->fetchrow) {
+ $sth_insert->execute($newauthtype, $tagfield, $tagsubfield,
$liblibrarian, $libopac, $repeatable, $mandatory,$kohafield, $tab,
$authorised_value, $thesaurus_category, $seealso,$hidden,$link);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha/admin auth_subfields_structure.pl auth_tag...,
Tumer Garip <=