From 6b89cda9699e22a095b34fb96960882989c76c9a Mon Sep 17 00:00:00 2001 From: Chris Nighswonger Date: Thu, 6 Mar 2008 09:05:46 +1300 Subject: [PATCH] Completing adding patronimage upload form to patron details screen. Signed-off-by: Chris Cormack Signed-off-by: Joshua Ferraro --- .../intranet-tmpl/prog/en/includes/circ-menu.inc | 6 ++++++ .../prog/en/modules/members/moremember.tmpl | 5 +++-- members/patronimage.pl | 12 +++++------- tools/picture-upload.pl | 8 +++++++- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc index e854391aa5..6a281ae43a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/circ-menu.inc @@ -1,7 +1,13 @@
()
    + +
  • " id="patronimage" alt=" ()" border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC;" />
  • + +
  • <!-- TMPL_VAR name= ()" border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC;" />
  • + +
  • diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl index 0fe0596e7f..968d6c6969 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tmpl @@ -202,9 +202,10 @@ for (var i=0;i
    Upload Patron Image - does not currently have an image available. To import an image for , enter the name of an image file to upload. + does not currently have an image available. To import an image for , enter the name of an image file to upload. - " /> + " /> + " />
    1. diff --git a/members/patronimage.pl b/members/patronimage.pl index 2ee992fa74..92b8612060 100755 --- a/members/patronimage.pl +++ b/members/patronimage.pl @@ -21,7 +21,7 @@ # use strict; -use CGI qw(:standard escapeHTML); +use CGI; #qw(:standard escapeHTML); use C4::Context; use C4::Members; @@ -41,7 +41,7 @@ patronimage.pl - Script for retrieving and formating Koha patron images for disp =head1 DESCRIPTION -This script, when called from within HTML and passed a valid patron cardnumber, will retrieve the image data associated with that cardnumber, format it in proper HTML format and pass it back to be displayed. +This script, when called from within HTML and passed a valid patron cardnumber, will retrieve the image data associated with that cardnumber if one exists, format it in proper HTML format and pass it back to be displayed. =cut @@ -65,13 +65,11 @@ if ($dberror) { # things will result... you have been warned! if ($imagedata) { - print $data->header (-type => $imagedata->{'mimetype'}, -Content_Length => length ($imagedata->{'imagefile'})), $imagedata->{'imagefile'}; + print $data->header (-type => $imagedata->{'mimetype'}, -'Cache-Control' => 'no-store', -Content_Length => length ($imagedata->{'imagefile'})), $imagedata->{'imagefile'}; exit; } else { - warn "No image exists for $cardnumber" if $DEBUG; - my $urlbase = url(-base => 1 -rewrite => 1); - warn "URL base: $urlbase" if $DEBUG; - print $data->redirect (-uri => "$urlbase/intranet-tmpl/prog/img/patron-blank.png"); + warn "No image exists for $cardnumber"; + exit; } exit; diff --git a/tools/picture-upload.pl b/tools/picture-upload.pl index 75dcbd06dd..849e1e39f9 100755 --- a/tools/picture-upload.pl +++ b/tools/picture-upload.pl @@ -45,6 +45,7 @@ my $filetype = $input->param('filetype'); my $cardnumber = $input->param('cardnumber'); my $uploadfilename = $input->param('uploadfile'); my $uploadfile = $input->upload('uploadfile'); +my $borrowernumber = $input->param('borrowernumber'); #FIXME: This code is really in the rough. The variables need to be re-scoped as the two subs depend on global vars to operate. # Other parts of this code could be optimized as well, I think. Perhaps the file upload could be done with YUI's upload @@ -136,7 +137,12 @@ if ( $uploadfile ) { $template->param(filetype => $filetype ); } -output_html_with_http_headers $input, $cookie, $template->output; +if ( $borrowernumber ) { + my $urlbase = $input->url(-base => 1 -rewrite => 1); + print $input->redirect ("/cgi-bin/koha/members/moremember.pl?borrowernumber=$borrowernumber"); +} else { + output_html_with_http_headers $input, $cookie, $template->output; +} sub handle_dir { my ( $dir, $suffix ) = @_; -- 2.39.2