Koha/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload-images.tt
Wainui Witika-Park b6f036a7ac Bug 26703: tools folder
Swapped the order of the page titles to have the unique information
first, i.e. the name of the specific page displays first, and the name of the website (e.g. Koha) displays at the end.

To test:
1) Apply patch
2) Ensure each of the files in the tools folder are swapped around
to display the most unique information first, and the website name is at the end
3) Ensure the pages displayed on the Staff Client that correspond to
these files also display the changes

Sponsored-by: Catalyst IT
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Henry Bolshaw <bolshawh@parliament.uk>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2021-04-21 11:16:35 +02:00

253 lines
12 KiB
Text

[% USE raw %]
[% USE Asset %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Upload images &rsaquo; Tools &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
<style>
#fileuploadstatus,#fileuploadfailed,#jobpanel,#jobstatus,#jobfailed { display : none; }
</style>
</head>
<body id="tools_upload-images" class="tools">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
</li>
<li>
<a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
</li>
[% IF ( uploadimage ) %]
<li>
<a href="/cgi-bin/koha/tools/upload-cover-image.pl">Upload local cover image</a>
</li>
<li>
<a href="#" aria-current="page">
Upload results
</a>
</li>
[% ELSIF itemnumber %]
<li>
<a href="/cgi-bin/koha/tools/upload-cover-image.pl">Upload local cover image</a>
</li>
<li>
<a href="#" aria-current="page">
Upload cover for itemnumber: [% itemnumber | html %]
</a>
</li>
[% ELSIF biblionumber %]
<li>
<a href="/cgi-bin/koha/tools/upload-cover-image.pl">Upload local cover image</a>
</li>
<li>
<a href="#" aria-current="page">
Upload cover for biblionumber: [% biblionumber | html %]
</a>
</li>
[% ELSE %]
<li>
<a href="#" aria-current="page">
Upload local cover image
</a>
</li>
[% END %]
</ol>
</nav>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<main>
[% IF ( uploadimage ) %]
<h1>Image upload results :</h1>
<ul>
<li>[% total | html %] images found</li>
[% IF ( error ) %]
<li>
<div class="dialog alert">
[% IF ( error == 'UZIPFAIL' ) %]
<p><strong>Failed to unzip archive.<br />Please ensure you are uploading a valid zip file and try again.</strong></p>
[% ELSIF ( error == 'OPNLINK' ) %]
<p><strong>Cannot open folder index (idlink.txt or datalink.txt) to read.<br />Please verify that it exists.</strong></p>
[% ELSIF ( error == 'OPNIMG' ) %]
<p><strong>Cannot process file as an image.<br />Please ensure you only upload GIF, JPEG, PNG, or XPM images.</strong></p>
[% ELSIF ( error == 'DELERR' ) %]
<p><strong>Unrecognized or missing field delimiter.<br />Please verify that you are using either a single quote or a tab.</strong></p>
[% ELSIF ( error == 'DBERR' ) %]
<p><strong>Unable to save image to database.</strong></p>
[% ELSE %]
<p><strong>An unknown error has occurred.<br />Please review the error log for more details.</strong></p>
[% END %]
</div>
</li>
[% END # /IF error %]
<li><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% biblionumber | uri %]">View final record</a></li>
<li><a href="/cgi-bin/koha/tools/tools-home.pl">Back</a></li>
</ul>
<hr />
[% END # /IF uploadimage %]
[% UNLESS itemnumber || biblionumber %]
<h1>Upload local cover image</h1>
[% ELSIF itemnumber %]
<h1>Upload local cover image for itemnumber: [% itemnumber | html %]</h1>
[% ELSIF biblionumber %]
<h1>Upload local cover image for biblionumber: [% biblionumber | html %]</h1>
[% END %]
<ul>
[% UNLESS itemnumber || biblionumber %]
<li>Select an image file or ZIP file to upload. The tool will accept images in GIF, JPEG, PNG, and XPM formats.</li>
[% ELSE %]
<li>Select an image file to upload. The tool will accept images in GIF, JPEG, PNG, and XPM formats.</li>
[% END %]
</ul>
<form method="post" action="/cgi-bin/koha/tools/upload-cover-image.pl" id="uploadfile" enctype="multipart/form-data">
<fieldset class="rows" >
<legend>Upload images</legend>
<ol>
<li>
<div id="fileuploadform">
<label for="fileToUpload" class="required">Select the file to upload: </label>
<input type="file" id="fileToUpload" name="fileToUpload" required="required" class="required" />
<span class="required">Required</span>
</div>
</li>
</ol>
<fieldset class="action"><button class="submit btn btn-default">Upload file</button></fieldset>
</fieldset>
<div id="uploadpanel">
<div id="fileuploadstatus" class="progress_panel">Upload progress:
<progress max="100" value="0" id="fileuploadprogress">
</progress>
<span class="fileuploadpercent">0</span>%
</div>
<div id="fileuploadfailed"></div>
</div>
</form> <!-- /#uploadfile -->
<form method="post" id="processfile" action="/cgi-bin/koha/tools/upload-cover-image.pl" enctype="multipart/form-data">
<input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
<input type="hidden" name="runinbackground" id="runinbackground" value="" />
<input type="hidden" name="completedJobID" id="completedJobID" value="" />
[% UNLESS itemnumber || biblionumber %]
<fieldset class="rows">
<legend>File type</legend>
<ol>
<li class="radio">
[% IF (filetype != 'image' ) %]
<input type="radio" id="zipfile" name="filetype" value="zip" checked="checked" />
[% ELSE %]
<input type="radio" id="zipfile" name="filetype" value="zip" />
[% END %]
<label for="zipfile">ZIP file</label>
</li>
<li class="radio">
[% IF (filetype == 'image' ) %]
<input type="radio" id="image" name="filetype" value="image" checked="checked" />
[% ELSE %]
<input type="radio" id="image" name="filetype" value="image" />
[% END %]
<label for="image">Image file</label>
</li>
<li class="radio">
[% IF ( filetype == 'image' ) %]
<span id="bibnum">
[% ELSE %]
<span id="bibnum" style="display: none">
[% END %]
<label for="biblionumber">Enter cover biblionumber: </label>
<input type="text" id="biblionumber" name="biblionumber" value="[% biblionumber | html %]" size="15" /></span>
</li>
</ol>
</fieldset>
[% ELSIF itemnumber %]
<input type="hidden" id="itemnumber" name="itemnumber" value="[% itemnumber | html %]" />
<input type="hidden" name="filetype" value="image" />
[% ELSIF biblionumber %]
<input type="hidden" id="biblionumber" name="biblionumber" value="[% biblionumber | html %]" />
<input type="hidden" name="filetype" value="image" />
[% END %]
<fieldset class="rows">
<legend>Options</legend>
<ol>
<li class="checkbox">
[% IF AllowMultipleCovers == 0 %]
<input type="checkbox" id="replace" name="replace" checked="checked" disabled="disabled" value="1" />
[% ELSE %]
<input type="checkbox" id="replace" name="replace" value="1" />
[% END %]
<label for="replace">Replace existing covers</label>
</li>
</ol>
</fieldset>
<fieldset class="action">
<button type="submit" class="btn btn-default btn-sm">Process images</button>
</fieldset>
</form> <!-- /#processfile -->
</main>
</div> <!-- /.col-sm-10.col-sm-push-2 -->
<div class="col-sm-2 col-sm-pull-10">
<aside>
[% INCLUDE 'tools-menu.inc' %]
</aside>
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% Asset.js("js/tools-menu.js") | $raw %]
[% Asset.js("js/file-upload.js") | $raw %]
<script>
function StartUpload() {
if( $('#fileToUpload').prop('files').length == 0 ) return;
$('#uploadform button.submit').prop('disabled',true);
$("#fileuploadstatus").show();
$("#uploadedfileid").val('');
xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), 'temp=1', cbUpload );
}
function cbUpload( status, fileid, errors ) {
if( status=='done' ) {
$("#uploadedfileid").val( fileid );
$('#fileToUpload').prop('disabled',true);
$("#processfile").show();
} else {
var errMsgs = [ _("Error code 0 not used"), _("File already exists"), _("Directory is not writeable"), _("Root directory for uploads not defined"), _("Temporary directory for uploads not defined") ];
var errCode = errors[$('#fileToUpload').prop('files')[0].name].code;
$("#fileuploadstatus").hide();
$("#fileuploadfailed").show();
$("#fileuploadfailed").text( _("Upload status: ") +
( status=='failed'? _("Failed") + " - (" + errCode + ") " + errMsgs[errCode]:
( status=='denied'? _("Denied"): status ))
);
$("#processfile").hide();
}
}
$(document).ready(function(){
$("#processfile").hide();
$("#zipfile").click(function(){
$("#bibnum").hide();
});
$("#image").click(function(){
$("#bibnum").show();
});
$("#uploadfile").validate({
submitHandler: function(form) {
StartUpload();
return false;
}
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]