Lines 5-11
Link Here
|
5 |
<title>Quote uploader › Tools › Koha</title> |
5 |
<title>Quote uploader › Tools › Koha</title> |
6 |
[% INCLUDE 'doc-head-close.inc' %] |
6 |
[% INCLUDE 'doc-head-close.inc' %] |
7 |
[% Asset.css("css/uploader.css") | $raw %] |
7 |
[% Asset.css("css/uploader.css") | $raw %] |
8 |
[% Asset.css("css/quotes.css") | $raw %] |
8 |
<style> |
|
|
9 |
.jeditable-text { |
10 |
display: block; |
11 |
height: 5em; |
12 |
margin-bottom: .5em; |
13 |
min-width: 20em; |
14 |
width: 70%; |
15 |
} |
16 |
</style> |
9 |
</head> |
17 |
</head> |
10 |
|
18 |
|
11 |
<body id="tools_quotes" class="tools"> |
19 |
<body id="tools_quotes" class="tools"> |
Lines 31-38
Link Here
|
31 |
<div class="row"> |
39 |
<div class="row"> |
32 |
<div class="col-sm-10 col-sm-push-2"> |
40 |
<div class="col-sm-10 col-sm-push-2"> |
33 |
<main> |
41 |
<main> |
34 |
<div id="toolbar" class="btn-toolbar" style="visibility: hidden; position: absolute"> |
42 |
<div id="toolbar" class="btn-toolbar" style="display:none"> |
35 |
<div class="btn-group"><a class="btn btn-default" id="save_quotes" href="#"><i class="fa fa-save"></i> Save quotes</a></div> |
43 |
<div class="btn-group"><a class="btn btn-primary" id="save_quotes" href="#"><i class="fa fa-save"></i> Save quotes</a></div> |
36 |
<div class="btn-group"><a href="/cgi-bin/koha/tools/quotes-upload.pl" id="cancel_quotes" class="btn btn-default"><i class="fa fa-times"></i> Cancel import</a></div> |
44 |
<div class="btn-group"><a href="/cgi-bin/koha/tools/quotes-upload.pl" id="cancel_quotes" class="btn btn-default"><i class="fa fa-times"></i> Cancel import</a></div> |
37 |
</div> |
45 |
</div> |
38 |
|
46 |
|
Lines 43-51
Link Here
|
43 |
<div class="import_error dialog alert" style="display: none;"></div> |
51 |
<div class="import_error dialog alert" style="display: none;"></div> |
44 |
</div> |
52 |
</div> |
45 |
|
53 |
|
46 |
<div id="instructions"> |
54 |
<div id="instructions" class="page-section"> |
47 |
<fieldset id="file_uploader_help" class="rows"> |
55 |
<h2>Instructions</h2> |
48 |
<legend>Instructions</legend> |
|
|
49 |
<div id="file_uploader_inst"> |
56 |
<div id="file_uploader_inst"> |
50 |
<ul> |
57 |
<ul> |
51 |
<li>The quote uploader accepts standard csv files with two columns: "source","text"</li> |
58 |
<li>The quote uploader accepts standard csv files with two columns: "source","text"</li> |
Lines 53-93
Link Here
|
53 |
<li>The file will be imported into an editable table for review prior to saving.</li> |
60 |
<li>The file will be imported into an editable table for review prior to saving.</li> |
54 |
</ul> |
61 |
</ul> |
55 |
</div> |
62 |
</div> |
56 |
<div id="file_editor_inst"> |
63 |
<div id="file_editor_inst" style="display:none"> |
57 |
<ul> |
64 |
<ul> |
58 |
<li>Click on any field to edit the contents; Press the <Enter> key to save edit.</li> |
65 |
<li>Click on any field to edit the contents; Press the <Enter> key to save edit.</li> |
59 |
<li>Click the 'Save quotes' button in the toolbar to save the entire batch of quotes.</li> |
66 |
<li>Click the 'Save quotes' button in the toolbar to save the entire batch of quotes.</li> |
60 |
</ul> |
67 |
</ul> |
61 |
</div> |
68 |
</div> |
62 |
</fieldset> |
|
|
63 |
</div> |
69 |
</div> |
64 |
|
70 |
|
65 |
<fieldset id="file_uploader" class="rows"> |
71 |
<fieldset id="file_uploader" class="rows"> |
66 |
<legend>Upload quotes</legend> |
72 |
<legend>Upload quotes</legend> |
67 |
<div id="file_upload"> |
73 |
<ol> |
68 |
<input type="file" name="file" /> |
74 |
<li> |
69 |
<button id="cancel_upload" style="display:none">Cancel upload</button> |
75 |
<label for="uploadfile">Select the file to upload: </label> |
70 |
<div id="progress_bar"><div class="percent">0%</div></div> |
76 |
<div id="file_upload"> |
71 |
</div> |
77 |
<input type="file" name="file" /> |
|
|
78 |
<button id="cancel_upload" style="display:none">Cancel upload</button> |
79 |
<div id="progress_bar"><div class="percent">0%</div></div> |
80 |
</div> |
81 |
</li> |
82 |
</ol> |
72 |
</fieldset> |
83 |
</fieldset> |
73 |
<table id="quotes_editor" style="visibility: hidden;"> |
84 |
|
74 |
<thead> |
85 |
<div class="page-section"> |
75 |
<tr> |
86 |
<table id="quotes_editor" style="display:none"> |
76 |
<th>Source</th> |
87 |
</table> |
77 |
<th>Text</th> |
88 |
</div> |
78 |
<th class="noExport">Actions</th> |
89 |
|
79 |
</tr> |
90 |
<fieldset id="footer" class="action" style="display:none"> |
80 |
</thead> |
|
|
81 |
<tbody> |
82 |
<!-- tbody content is generated by DataTables --> |
83 |
<tr> |
84 |
<td></td> |
85 |
<td>Loading data...</td> |
86 |
<td></td> |
87 |
</tr> |
88 |
</tbody> |
89 |
</table> |
90 |
<fieldset id="footer" class="action" style="visibility: hidden;"> |
91 |
</fieldset> |
91 |
</fieldset> |
92 |
|
92 |
|
93 |
</main> |
93 |
</main> |
Lines 249-264
Link Here
|
249 |
} |
249 |
} |
250 |
|
250 |
|
251 |
/* Transition from the quote file uploader to the quote file editor interface */ |
251 |
/* Transition from the quote file uploader to the quote file editor interface */ |
252 |
$('#toolbar').css("visibility","visible"); |
252 |
$('#toolbar').show(); |
253 |
$('#toolbar').css("position",""); |
253 |
$('#file_editor_inst').show(); |
254 |
$('#file_editor_inst').css("visibility", "visible"); |
254 |
$('#file_uploader_inst').hide(); |
255 |
$('#file_editor_inst').css("position", ""); |
255 |
$('#save_quotes').show(); |
256 |
$('#file_uploader_inst').css("visibility", "hidden"); |
256 |
$('#file_uploader').hide(); |
257 |
$('#save_quotes').css("visibility","visible"); |
257 |
$('#quotes_editor').show(); |
258 |
$('#file_uploader').css("visibility","hidden"); |
|
|
259 |
$('#file_uploader').css("position","absolute"); |
260 |
$('#file_uploader').css("top","-150px"); |
261 |
$('#quotes_editor').css("visibility","visible"); |
262 |
$("#save_quotes").on("click", yuiGetData); |
258 |
$("#save_quotes").on("click", yuiGetData); |
263 |
|
259 |
|
264 |
oTable = $('#quotes_editor').dataTable( { |
260 |
oTable = $('#quotes_editor').dataTable( { |
Lines 268-273
Link Here
|
268 |
"sPaginationType" : "full_numbers", |
264 |
"sPaginationType" : "full_numbers", |
269 |
"sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">', |
265 |
"sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">', |
270 |
"aaData" : aaData, |
266 |
"aaData" : aaData, |
|
|
267 |
"pageLength": 20, |
268 |
"fixedHeader": true, |
271 |
"aoColumns" : [ |
269 |
"aoColumns" : [ |
272 |
{ |
270 |
{ |
273 |
"sTitle" : _("Number"), |
271 |
"sTitle" : _("Number"), |
Lines 305-318
Link Here
|
305 |
return(value); |
303 |
return(value); |
306 |
}, |
304 |
}, |
307 |
{ |
305 |
{ |
308 |
"callback" : function( sValue, y ) { |
306 |
"callback" : function( sValue, y ) { |
309 |
oTable.fnDraw(false); /* no filter/sort or we lose our pagination */ |
307 |
oTable.fnDraw(false); /* no filter/sort or we lose our pagination */ |
310 |
}, |
308 |
}, |
311 |
"height" : "14px", |
309 |
"cancel" : _("Cancel"), |
312 |
}); |
310 |
"height": "none", |
|
|
311 |
"inputcssclass": "jeditable-text", |
312 |
"onblur": "ignore", |
313 |
"style": "", |
314 |
"submit" : _("Save"), |
315 |
"type": "textarea", |
316 |
"width": "none", |
317 |
} |
318 |
); |
313 |
}, |
319 |
}, |
314 |
}); |
320 |
}); |
315 |
$('#footer').css("visibility","visible"); |
321 |
$('#footer').show(); |
316 |
} |
322 |
} |
317 |
|
323 |
|
318 |
function fnHandleFileSelect(evt) { |
324 |
function fnHandleFileSelect(evt) { |
Lines 359-365
Link Here
|
359 |
reader.readAsText(evt.target.files[0]); |
365 |
reader.readAsText(evt.target.files[0]); |
360 |
} |
366 |
} |
361 |
|
367 |
|
362 |
$('#file_upload').one('change', fnHandleFileSelect); |
368 |
$('#file_upload').on('change', fnHandleFileSelect); |
363 |
|
369 |
|
364 |
var MSG_IMPORT_SUCCESS = _("%s quotes imported successfully"); |
370 |
var MSG_IMPORT_SUCCESS = _("%s quotes imported successfully"); |
365 |
var MSG_IMPORT_ERROR = _("%s quotes have not been imported. An error occurred"); |
371 |
var MSG_IMPORT_ERROR = _("%s quotes have not been imported. An error occurred"); |
Lines 376-382
Link Here
|
376 |
data : JSON.stringify(data), |
382 |
data : JSON.stringify(data), |
377 |
dataType : "application/json", |
383 |
dataType : "application/json", |
378 |
success : function(data) { |
384 |
success : function(data) { |
379 |
$("#messages").show(); |
385 |
$("#messages").addClass("message").show(); |
380 |
var import_success = $("#messages .import_success"); |
386 |
var import_success = $("#messages .import_success"); |
381 |
import_success.show(); |
387 |
import_success.show(); |
382 |
import_success.data("nb") |
388 |
import_success.data("nb") |
Lines 387-393
Link Here
|
387 |
}, |
393 |
}, |
388 |
error : function(xhr) { |
394 |
error : function(xhr) { |
389 |
if (xhr.status==201) { this.success(null, "Created", xhr); return; } |
395 |
if (xhr.status==201) { this.success(null, "Created", xhr); return; } |
390 |
$("#messages").show(); |
396 |
$("#messages").addClass("alert").show(); |
391 |
var import_error = $("#messages .import_error"); |
397 |
var import_error = $("#messages .import_error"); |
392 |
import_error.show(); |
398 |
import_error.show(); |
393 |
import_error.data("nb") |
399 |
import_error.data("nb") |