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.
|
|
@ -96,16 +96,42 @@ if ($op eq 'add_form') {
|
|||
my $data;
|
||||
if ($itemtype) {
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $sth=$dbh->prepare("select itemtype,description,renewalsallowed,rentalcharge,notforloan from itemtypes where itemtype=?");
|
||||
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=> \@imagelist,
|
||||
# -size=>1,
|
||||
# -multiple=>0,
|
||||
# );
|
||||
#
|
||||
$template->param(itemtype => $itemtype,
|
||||
description => $data->{'description'},
|
||||
renewalsallowed => $data->{'renewalsallowed'},
|
||||
rentalcharge => sprintf("%.2f",$data->{'rentalcharge'}),
|
||||
notforloan => $data->{'notforloan'}
|
||||
notforloan => $data->{'notforloan'},
|
||||
imageurl => $data->{'imageurl'},
|
||||
opacthemes => C4::Context->preference('opacthemes'),
|
||||
IMAGESLOOP => \@imagelist,
|
||||
);
|
||||
;
|
||||
# END $OP eq ADD_FORM
|
||||
|
|
@ -113,11 +139,12 @@ if ($op eq 'add_form') {
|
|||
# called by add_form, used to insert/modify data in DB
|
||||
} elsif ($op eq 'add_validate') {
|
||||
my $dbh = C4::Context->dbh;
|
||||
my $sth=$dbh->prepare("replace itemtypes (itemtype,description,renewalsallowed,rentalcharge,notforloan) values (?,?,?,?,?)");
|
||||
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('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>";
|
||||
exit;
|
||||
|
|
@ -143,9 +170,10 @@ if ($op eq 'add_form') {
|
|||
$sth->finish;
|
||||
|
||||
$template->param(itemtype => $itemtype,
|
||||
description => $data->{'description'},
|
||||
renewalsallowed => $data->{'renewalsallowed'},
|
||||
rentalcharge => sprintf("%.2f",$data->{'rentalcharge'}),
|
||||
description => $data->{description},
|
||||
renewalsallowed => $data->{renewalsallowed},
|
||||
rentalcharge => sprintf("%.2f",$data->{rentalcharge}),
|
||||
imageurl => $data->{imageurl},
|
||||
total => $total);
|
||||
# END $OP eq DELETE_CONFIRM
|
||||
################## DELETE_CONFIRMED ##################################
|
||||
|
|
@ -180,10 +208,16 @@ if ($op eq 'add_form') {
|
|||
$row_data{description} = $results->[$i]{description};
|
||||
$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 => \@loop_data);
|
||||
$template->param(loop => \@loop_data,
|
||||
opacthemes => C4::Context->preference('opacthemes')
|
||||
);
|
||||
if ($offset>0) {
|
||||
my $prevpage = $offset-$pagesize;
|
||||
$template->param(previous => "$script_name?offset=".$prevpage);
|
||||
|
|
|
|||
|
|
@ -56,6 +56,10 @@ function Check(f) {
|
|||
alert(alertString2);
|
||||
}
|
||||
}
|
||||
|
||||
function report_itemtype(value_to_report) {
|
||||
Aform.imageurl.value=value_to_report;
|
||||
}
|
||||
</script>
|
||||
<div id="mainbloc">
|
||||
<!-- TMPL_IF NAME="add_form" -->
|
||||
|
|
@ -76,6 +80,13 @@ function Check(f) {
|
|||
<label class="label100">Description</label>
|
||||
<input type="text" name="description" size="40" maxlength="80" value="<!-- TMPL_VAR NAME="description" escape=HTML -->">
|
||||
</p>
|
||||
<p>
|
||||
<label class="label100">Image</label>
|
||||
<input type="text" name="imageurl" value="<!-- TMPL_VAR name="imageurl" -->" size="40" maxlength="80">
|
||||
<!-- TMPL_LOOP NAME="IMAGESLOOP" -->
|
||||
<a href="javascript:report_itemtype('<!-- TMPL_VAR name="KohaImage" -->')"><img src="/opac-tmpl/<!-- TMPL_VAR name="opacthemes" -->/itemtypeimg/<!-- TMPL_VAR name="KohaImage" -->"></a>
|
||||
<!-- /TMPL_LOOP -->
|
||||
</p>
|
||||
<p>
|
||||
<label class="label100">Not for loan</label>
|
||||
<!-- TMPL_IF NAME="notforloan" -->
|
||||
|
|
@ -138,7 +149,16 @@ function Check(f) {
|
|||
</tr>
|
||||
<!-- TMPL_LOOP NAME="loop" -->
|
||||
<tr>
|
||||
<td><!-- TMPL_VAR NAME="itemtype" --></td>
|
||||
<td>
|
||||
<!-- TMPL_IF name="imageurl" -->
|
||||
<!-- TMPL_IF name="absoluteurl" -->
|
||||
<img src="<!-- TMPL_VAR name="imageurl" -->">
|
||||
<!-- TMPL_ELSE -->
|
||||
<img src="/opac-tmpl/<!-- TMPL_VAR name="opacthemes" -->/itemtypeimg/<!-- TMPL_VAR name="imageurl" -->">
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- /TMPL_IF -->
|
||||
<!-- TMPL_VAR NAME="itemtype" -->
|
||||
</td>
|
||||
<td><!-- TMPL_VAR NAME="description" --></td>
|
||||
<td><!-- TMPL_IF NAME="notforloan" -->Yes<!-- /TMPL_IF --></td>
|
||||
<td><!-- TMPL_UNLESS name="notforloan" -->
|
||||
|
|
|
|||
|
|
@ -79,7 +79,11 @@
|
|||
</p>
|
||||
</td>
|
||||
<td align="center" <!-- TMPL_IF name="even" --> class="hilighted"<!-- /TMPL_IF -->>
|
||||
<!-- TMPL_VAR name="description" -->
|
||||
<!-- TMPL_IF name="imageurl" -->
|
||||
<img src="/opac-tmpl/<!-- TMPL_VAR name="theme" -->/itemtypeimg/<!-- TMPL_VAR name="imageurl" -->" title="<!-- TMPL_VAR name="description" -->"
|
||||
<!-- TMPL_ELSE -->
|
||||
<!-- TMPL_VAR name="description" -->
|
||||
<!-- /TMPL_IF -->
|
||||
</td>
|
||||
<td align="center" <!-- TMPL_IF name="even" --> class="hilighted"<!-- /TMPL_IF -->>
|
||||
<!-- TMPL_VAR name="totitem" -->
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 222 B |
|
After Width: | Height: | Size: 294 B |
|
After Width: | Height: | Size: 405 B |
|
After Width: | Height: | Size: 289 B |
|
After Width: | Height: | Size: 289 B |
|
After Width: | Height: | Size: 289 B |
|
After Width: | Height: | Size: 306 B |
|
After Width: | Height: | Size: 222 B |
|
After Width: | Height: | Size: 277 B |
|
After Width: | Height: | Size: 263 B |
|
After Width: | Height: | Size: 322 B |
|
After Width: | Height: | Size: 241 B |
|
After Width: | Height: | Size: 281 B |
|
After Width: | Height: | Size: 282 B |
|
After Width: | Height: | Size: 431 B |
|
After Width: | Height: | Size: 304 B |
|
After Width: | Height: | Size: 231 B |
|
After Width: | Height: | Size: 211 B |
|
After Width: | Height: | Size: 293 B |
|
After Width: | Height: | Size: 222 B |
|
After Width: | Height: | Size: 294 B |
|
After Width: | Height: | Size: 235 B |
|
After Width: | Height: | Size: 365 B |
|
After Width: | Height: | Size: 400 B |
|
After Width: | Height: | Size: 288 B |
|
After Width: | Height: | Size: 294 B |
|
After Width: | Height: | Size: 380 B |
|
After Width: | Height: | Size: 235 B |
|
After Width: | Height: | Size: 365 B |
|
After Width: | Height: | Size: 282 B |
|
After Width: | Height: | Size: 400 B |
|
After Width: | Height: | Size: 380 B |
|
After Width: | Height: | Size: 293 B |
|
After Width: | Height: | Size: 292 B |
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 351 B |
|
After Width: | Height: | Size: 262 B |
|
After Width: | Height: | Size: 351 B |
|
After Width: | Height: | Size: 351 B |
|
After Width: | Height: | Size: 278 B |
|
After Width: | Height: | Size: 262 B |
|
After Width: | Height: | Size: 241 B |
|
After Width: | Height: | Size: 283 B |
|
After Width: | Height: | Size: 292 B |
|
After Width: | Height: | Size: 221 B |
|
After Width: | Height: | Size: 216 B |
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 216 B |
|
After Width: | Height: | Size: 295 B |
|
After Width: | Height: | Size: 331 B |
|
After Width: | Height: | Size: 236 B |
|
After Width: | Height: | Size: 171 B |
|
After Width: | Height: | Size: 276 B |
|
After Width: | Height: | Size: 281 B |
|
After Width: | Height: | Size: 289 B |
|
After Width: | Height: | Size: 289 B |
|
After Width: | Height: | Size: 289 B |
|
After Width: | Height: | Size: 294 B |
|
After Width: | Height: | Size: 411 B |
|
After Width: | Height: | Size: 350 B |
|
After Width: | Height: | Size: 309 B |
|
After Width: | Height: | Size: 223 B |
|
After Width: | Height: | Size: 263 B |
|
After Width: | Height: | Size: 223 B |
|
After Width: | Height: | Size: 251 B |
|
|
@ -98,6 +98,7 @@ my %requiretables = (
|
|||
|
||||
my %requirefields = (
|
||||
subscription => { 'letter' => 'char(20) NULL'},
|
||||
itemtypes => { 'imageurl' => 'char(200) NULL'},
|
||||
# tablename => { 'field' => 'fieldtype' },
|
||||
);
|
||||
|
||||
|
|
@ -276,6 +277,7 @@ foreach $table ( keys %fielddefinitions ) {
|
|||
my $field = $row->{field};
|
||||
my $type = $row->{type};
|
||||
my $null = $row->{null};
|
||||
# $null = 'YES' if $row->{null} eq 'NULL';
|
||||
my $key = $row->{key};
|
||||
my $default = $row->{default};
|
||||
$default="''" unless $default;
|
||||
|
|
@ -619,6 +621,13 @@ sub MARCgetitem {
|
|||
exit;
|
||||
|
||||
# $Log$
|
||||
# Revision 1.122 2005/09/02 14:18:38 tipaul
|
||||
# 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.
|
||||
#
|
||||
# Revision 1.121 2005/08/24 08:49:03 hdl
|
||||
# Adding a note field in serial table.
|
||||
# This will allow librarian to mention a note on a peculiar waiting serial number.
|
||||
|
|
|
|||