[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] CVS: koha/admin itemtypes.pl,1.19,1.20
From: |
Paul POULAIN |
Subject: |
[Koha-cvs] CVS: koha/admin itemtypes.pl,1.19,1.20 |
Date: |
Fri, 02 Sep 2005 07:18:40 -0700 |
Update of /cvsroot/koha/koha/admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26960/admin
Modified Files:
itemtypes.pl
Log Message:
new feature : image for itemtypes.
* run updater/updatedatabase to create imageurl field in itemtypes.
* go to Koha >> parameters >> itemtypes >> modify (or add) an itemtype. You
will see around 20 nice images to choose between (thanks to owen). If you
prefer your own image, you also can type a complete url
(http://www.myserver.lib/path/to/my/image.gif)
* go to OPAC, and search something. In the result list, you now have the
picture instead of the text itemtype.
Index: itemtypes.pl
===================================================================
RCS file: /cvsroot/koha/koha/admin/itemtypes.pl,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** itemtypes.pl 20 Jun 2005 13:17:16 -0000 1.19
--- itemtypes.pl 2 Sep 2005 14:18:38 -0000 1.20
***************
*** 97,110 ****
if ($itemtype) {
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("select
itemtype,description,renewalsallowed,rentalcharge,notforloan from itemtypes
where itemtype=?");
$sth->execute($itemtype);
$data=$sth->fetchrow_hashref;
$sth->finish;
}
$template->param(itemtype => $itemtype,
description =>
$data->{'description'},
renewalsallowed =>
$data->{'renewalsallowed'},
rentalcharge =>
sprintf("%.2f",$data->{'rentalcharge'}),
! notforloan =>
$data->{'notforloan'}
);
;
--- 97,136 ----
if ($itemtype) {
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("select * from itemtypes where
itemtype=?");
$sth->execute($itemtype);
$data=$sth->fetchrow_hashref;
$sth->finish;
}
+ # build list of images
+ my $imagedir =
C4::Context->opachtdocs."/".C4::Context->preference('opacthemes');
+ warn "img : $imagedir";
+ unless (opendir(DIR, "$imagedir/itemtypeimg/")) {
+ # my $cgidir = C4::Context->intranetdir;
+ opendir(DIR, "$imagedir/value_builder") || die "can't opendir
$imagedir/value_builder: $!";
+ }
+ my @imagelist;
+ while (my $line = readdir(DIR)) {
+ if ($line =~ /\.gif$/) {
+ my %x;
+ $x{KohaImage} = "$line";
+ push @imagelist, \%x;
+ }
+ }
+ closedir DIR;
+ # my $CGIitemtypes = CGI::scrolling_list(-name=>'itemtypes',
+ # -id=>"itemtypes",
+ # -values=> address@hidden,
+ # -size=>1,
+ # -multiple=>0,
+ # );
+ #
$template->param(itemtype => $itemtype,
description =>
$data->{'description'},
renewalsallowed =>
$data->{'renewalsallowed'},
rentalcharge =>
sprintf("%.2f",$data->{'rentalcharge'}),
! notforloan =>
$data->{'notforloan'},
! imageurl =>
$data->{'imageurl'},
! opacthemes =>
C4::Context->preference('opacthemes'),
! IMAGESLOOP =>
address@hidden,
);
;
***************
*** 114,122 ****
} elsif ($op eq 'add_validate') {
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("replace itemtypes
(itemtype,description,renewalsallowed,rentalcharge,notforloan) values
(?,?,?,?,?)");
$sth->execute(
$input->param('itemtype'),$input->param('description'),
$input->param('renewalsallowed'),$input->param('rentalcharge'),
! $input->param('notforloan')?1:0);
$sth->finish;
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=itemtypes.pl\"></html>";
--- 140,149 ----
} elsif ($op eq 'add_validate') {
my $dbh = C4::Context->dbh;
! my $sth=$dbh->prepare("replace itemtypes
(itemtype,description,renewalsallowed,rentalcharge,notforloan,imageurl) values
(?,?,?,?,?,?)");
$sth->execute(
$input->param('itemtype'),$input->param('description'),
$input->param('renewalsallowed'),$input->param('rentalcharge'),
! $input->param('notforloan')?1:0,
! $input->param('imageurl'));
$sth->finish;
print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0;
URL=itemtypes.pl\"></html>";
***************
*** 144,150 ****
$template->param(itemtype => $itemtype,
! description =>
$data->{'description'},
! renewalsallowed =>
$data->{'renewalsallowed'},
! rentalcharge =>
sprintf("%.2f",$data->{'rentalcharge'}),
total => $total);
# END $OP eq DELETE_CONFIRM
--- 171,178 ----
$template->param(itemtype => $itemtype,
! description =>
$data->{description},
! renewalsallowed =>
$data->{renewalsallowed},
! rentalcharge =>
sprintf("%.2f",$data->{rentalcharge}),
! imageurl =>
$data->{imageurl},
total => $total);
# END $OP eq DELETE_CONFIRM
***************
*** 181,188 ****
$row_data{renewalsallowed} = $results->[$i]{renewalsallowed};
$row_data{notforloan} = $results->[$i]{notforloan};
$row_data{rentalcharge} =
sprintf("%.2f",$results->[$i]{rentalcharge});
push(@loop_data, \%row_data);
}
! $template->param(loop => address@hidden);
if ($offset>0) {
my $prevpage = $offset-$pagesize;
--- 209,222 ----
$row_data{renewalsallowed} = $results->[$i]{renewalsallowed};
$row_data{notforloan} = $results->[$i]{notforloan};
+ if ($results->[$i]{imageurl} =~ /^http/) {
+ $row_data{absoluteurl} = 1;
+ }
+ $row_data{imageurl} = $results->[$i]{imageurl};
$row_data{rentalcharge} =
sprintf("%.2f",$results->[$i]{rentalcharge});
push(@loop_data, \%row_data);
}
! $template->param(loop => address@hidden,
! opacthemes =>
C4::Context->preference('opacthemes')
! );
if ($offset>0) {
my $prevpage = $offset-$pagesize;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] CVS: koha/admin itemtypes.pl,1.19,1.20,
Paul POULAIN <=