Bug 16513 - Improvements and fixes for quote upload process

This patch fixes some minor bugs and adds a small enhancement to the
quotes editor and quotes upload pages.

To test, apply the patch and go to Tools -> Quote editor

- In the table of quotes, clicking the "ID" table header should trigger
  an alert, "Click on the quote's ide to select..."
- Go to "Import quotes" and select a file to upload.
- On the upload preview page you should see a new "Cancel import"
  button. Clicking it should return you to the quotes upload page after
  asking for confirmation.
- Test the upload cancel button:
  - If you have fast reflexes or are uploading a file large enough, you
    should be able to see a "Cancel upload" button during the upload
    process.
  - Clicking this button should cancel the upload and return you to the
    quote upload page.

Tested on top of Bug 16589, works as expected.
Signed-off-by: Marc Véron <veron@veron.ch>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit 90a1d98e06)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
This commit is contained in:
Owen Leonard 2016-05-13 09:59:53 -04:00 committed by Frédéric Demians
parent f72d2cb6bf
commit 5f3ee1ed82
3 changed files with 19 additions and 7 deletions

View File

@ -1,4 +1,5 @@
<div id="toolbar" class="btn-toolbar" style="visibility: hidden; position: absolute">
<div class="btn-group"><a class="btn btn-small" id="save_quotes" href="#"><i class="fa fa-save"></i> Save quotes</a></div>
<div class="btn-group"><a class="btn btn-small" id="delete_quote" href="#"><i class="fa fa-remove"></i> Delete quote(s)</a></div>
<div class="btn-group"><a class="btn btn-small" id="delete_quote" href="#"><i class="fa fa-trash"></i> Delete quote(s)</a></div>
<div class="btn-group"><a href="/cgi-bin/koha/tools/quotes-upload.pl" id="cancel_quotes" class="btn btn-small"><i class="fa fa-remove"></i> Cancel import</a></div>
</div>

View File

@ -11,6 +11,14 @@
var oTable; //DataTable object
$(document).ready(function() {
$("#cancel_upload").on("click",function(e){
e.preventDefault();
fnAbortRead();
});
$("#cancel_quotes").on("click",function(){
return confirm( _("Are you sure you want to cancel this import?") );
});
// Credits:
// FileReader() code copied and hacked from:
// http://www.html5rocks.com/en/tutorials/file/dndfiles/
@ -222,14 +230,14 @@
parent.location='quotes-upload.pl';
};
reader.onloadstart = function(e) {
$('#cancel_upload').css("visibility","visible");
$('#cancel_upload').show();
$('#progress_bar').addClass("loading");
};
reader.onload = function(e) {
// Ensure that the progress bar displays 100% at the end.
progress.style.width = '100%';
progress.textContent = '100%';
$('#cancel_upload').css("visibility","hidden");
$('#cancel_upload').hide();
quotes = fnCSVToArray(e.target.result, ',');
fnDataTable(quotes);
}
@ -333,7 +341,7 @@
<legend>Upload quotes</legend>
<div id="file_upload">
<input type="file" name="file" />
<button id="cancel_upload" style="visibility:hidden;" onclick="fnAbortRead();">Cancel Upload</button>
<button id="cancel_upload" style="display:none">Cancel upload</button>
<div id="progress_bar"><div class="percent">0%</div></div>
</div>
</fieldset>

View File

@ -8,7 +8,6 @@
<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.jeditable.mini.js"></script>
<script type="text/javascript">
//<![CDATA[
var MSG_ID_HELP = _("Click on the quote's id to select or deselect the quote. Multiple quotes may be selected.");
var oTable; /* oTable needs to be global */
var sEmptyTable = _("No quotes available. Please use the 'Add quote' button to add a quote."); /* override the default message in datatables.inc */
@ -90,6 +89,10 @@
fnClickDeleteRow();
return false;
});
$("#id_help").on("click",function(e){
e.stopPropagation();
alert( _("Click on the quote's id to select or deselect the quote. Multiple quotes may be selected.") );
});
});
function fnClickAddQuote(e, node) {
@ -190,7 +193,7 @@
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; Quote Editor</div>
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; Quote editor</div>
<div id="doc3" class="yui-t2">
<div id="bd">
@ -215,7 +218,7 @@
<table id="quotes_editor">
<thead>
<tr>
<th><span style="cursor: help" onclick="event.stopPropagation();alert(MSG_ID_HELP);">ID</span></th>
<th><span style="cursor: help" id="id_help">ID</span></th>
<th>Source</th>
<th>Text</th>
<th>Last displayed</th>