Some changes related to recent commits to patron images: Markup and javascript changes for upload form; Enabling passing of cardnumber and filetype variable to picture upload form; changes to picture display to handle missing image; Adding link to picture upload form from missing image display in circ and moremember; Removal of English text from 'no patron image' file.

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Owen Leonard 2008-02-26 10:34:28 +13:00 committed by Joshua Ferraro
parent 7aa263974d
commit bfbae81162
7 changed files with 38 additions and 28 deletions

View file

@ -1,7 +1,7 @@
<!-- TMPL_IF NAME="borrowernumber" -->
<div class="patroninfo"><h5><!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)</h5>
<ul>
<li><img src="patronimage.pl?crdnum=<!-- TMPL_VAR NAME="cardnumber" -->" alt="<!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)" border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC;" width="100" /></li>
<li><img src="/cgi-bin/koha/members/patronimage.pl?crdnum=<!-- TMPL_VAR NAME="cardnumber" -->" id="patronimage" alt="<!-- TMPL_VAR name="firstname" --> <!-- TMPL_VAR name="surname" --> (<!-- TMPL_VAR NAME="cardnumber" -->)" border="0" style="margin: .3em 0 .3em .3em; padding: .2em; border: 1px solid #CCCCCC;" /></li>
<li><!-- TMPL_IF NAME="address"-->
<!-- TMPL_VAR NAME="address" -->
<!-- TMPL_ELSE -->

View file

@ -19,7 +19,7 @@ function _(s) { return s } // dummy function for gettext
function verify_patron_images() {
for (var i = 0; i < document.images.length; i++) {
img = document.images[i];
if ((img.src.indexOf('patronimages') >= 0)) {
if ((img.src.indexOf('patronimage') >= 0)) {
w = img.width;
h = img.height;
if ((w == 0) && (h == 0) || ((img.complete != null) && (!img.complete))) {

View file

@ -10,9 +10,6 @@
$(document).ready(function() {
$('#patronlists').tabs();
});
<!-- TMPL_IF NAME="patronimages" -->$(window).load(function() {
verify_patron_images();
});<!-- /TMPL_IF -->
//]]>
</script>
<!-- TMPL_INCLUDE NAME="calendar.inc" -->
@ -555,4 +552,12 @@ No patron matched <span class="ex"><!-- TMPL_VAR name="message" --></span>
<!-- TMPL_INCLUDE NAME="circ-menu.inc" -->
</div><!-- /TMPL_UNLESS -->
</div>
<!-- TMPL_IF NAME="patronimages" --><script type="text/JavaScript" language="JavaScript">
//<![CDATA[
verify_patron_images();
<!-- TMPL_IF NAME="CAN_user_tools" -->$("#patronimage").after("<a style=\"display: block; font-size:80%; margin:0 0 1em 1em;\" href=\"/cgi-bin/koha/tools/picture-upload.pl?cardnumber=<!-- TMPL_VAR NAME="cardnumber" -->&filetype=image\">+ Click to Add Image</a>").css({cursor: "pointer"}).click(function(){
location.href="/cgi-bin/koha/tools/picture-upload.pl?cardnumber=<!-- TMPL_VAR NAME="cardnumber" -->&filetype=image";
});<!-- /TMPL_IF -->
//]]>
</script><!-- /TMPL_IF -->
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

View file

@ -450,4 +450,12 @@ for (var i=0;i<ItemsNodes.length;i++){
<!-- TMPL_INCLUDE NAME="circ-menu.inc" -->
</div>
</div>
<!-- TMPL_IF NAME="patronimages" --><script type="text/JavaScript" language="JavaScript">
//<![CDATA[
verify_patron_images();
<!-- TMPL_IF NAME="CAN_user_tools" -->$("#patronimage").after("<a style=\"display: block; font-size:80%; margin:0 0 1em 1em;\" href=\"/cgi-bin/koha/tools/picture-upload.pl?cardnumber=<!-- TMPL_VAR NAME="cardnumber" -->&filetype=image\">+ Click to Add Image</a>").css({cursor: "pointer"}).click(function(){
location.href="/cgi-bin/koha/tools/picture-upload.pl?cardnumber=<!-- TMPL_VAR NAME="cardnumber" -->&filetype=image";
});<!-- /TMPL_IF -->
//]]>
</script><!-- /TMPL_IF -->
<!-- TMPL_INCLUDE NAME="intranet-bottom.inc" -->

View file

@ -2,23 +2,14 @@
<title>Koha &rsaquo; Tools &rsaquo; Upload Patron Images</title>
<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
<script type="text/javascript">
function blah($this){
var found=null
var els=document.getElementsByName($this.name)
for(var i=0;i<els.length;i++){
if(els[i]==$this){found=i;break}
}
if(found==0)return hideCardnumber()
if(found==1)return showCardnumber()
}
function showCardnumber(){
document.getElementById("cardnum").style.display="block"
}
function hideCardnumber(){
document.getElementById("cardnum").style.display="none"
}
$(document).ready(function() {
$("#zipfile").click(function(){
$("#cardnum").hide();
});
$("#image").click(function(){
$("#cardnum").show();
});
});
</script>
</head>
<body>
@ -92,17 +83,20 @@ function hideCardnumber(){
<!-- /TMPL_IF -->
<form method="post" action="/cgi-bin/koha/tools/picture-upload.pl" enctype="multipart/form-data">
<fieldset class="brief">
<ol>
<li>
<input type="radio" id="filetype" name="filetype" onclick="blah(this)" value="zip" checked="checked" /> zip file
<br />
<input type="radio" id="filetype" name="filetype" onclick="blah(this)" value="image" /> image file
<ol class="radio">
<li class="radio">
<label for="zipfile"><input type="radio" id="zipfile" name="filetype" value="zip" checked="checked" /> zip file</label></li>
<li>
<label for="image">
<!-- TMPL_IF EXPR="filetype eq 'image'" --><input type="radio" id="image" name="filetype" value="image" checked="checked" /><!-- TMPL_ELSE --><input type="radio" id="image" name="filetype" value="image" /><!-- /TMPL_IF -->
image file</label>
<ol>
<li>
<label for="uploadfile">Select the file to upload: </label><input type="file" id="uploadfile" name="uploadfile" />
<span id="cardnum" style="display: none"><label for="cardnumber">Enter patron cardnumber: </label><input type="text" id="cardnumber" name="cardnumber" size="15" /></span>
<!-- TMPL_IF EXPR="filetype eq 'image'" --><span id="cardnum"><!-- TMPL_ELSE --><span id="cardnum" style="display: none"><!-- /TMPL_IF --><label for="cardnumber">Enter patron cardnumber: </label><input type="text" id="cardnumber" name="cardnumber" value="<!-- TMPL_VAR NAME="cardnumber" -->" size="15" /></span>
</li>
</ol>
</li></ol>
</fieldset>
<fieldset class="action"><input type="submit" value="Upload" class="submit" /> <a href="/cgi-bin/koha/tools/picture-upload.pl" class="cancel">Cancel</a>
</fieldset>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -131,6 +131,9 @@ if ( $uploadfile ) {
);
}
}
} else {
$template->param(cardnumber => $cardnumber );
$template->param(filetype => $filetype );
}
output_html_with_http_headers $input, $cookie, $template->output;