6498c5835c
Javascript function `_` works only if used in template file (.tt or .inc). In .js files we should use `__` This patch updates .js files to use `__` instead of `_` Test Plan: 1. Do not apply the patch yet 2. Run `npx gulp po:update --lang fr-FR` (choose another language if you prefer) 3. Open misc/translator/po/fr-FR-messages-js.po and search "Please select a CSV (.csv) or ODS (.ods) spreadsheet file" 4. Notice that the references above only mention biblio_framework.js 5. If not already translated, translate it 6. Run misc/translator/translate install fr-FR 7. Go to staff interface and change language to fr-FR 8. Go to Administration » Authority types and click on "Actions -> Import" 9. In the modal window, click on "Import" without selecting a file. You should see an alert with the non-translated text 10. Apply the patch 11. Run `npx gulp po:update --lang fr-FR` 12. Open misc/translator/po/fr-FR-messages-js.po and search "Please select a CSV (.csv) or ODS (.ods) spreadsheet file" 13. Notice that the references above now also mention authtype.js 14. If the translation is marked as fuzzy, remove the fuzzy flag 15. Run misc/translator/translate install fr-FR 16. Go to staff interface again 17. Go to Administration » Authority types and click on "Actions -> Import" 18. In the modal window, click on "Import" without selecting a file. You should see an alert, this time with the translated text Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
84 lines
2.7 KiB
JavaScript
84 lines
2.7 KiB
JavaScript
var backgroundJobProgressTimer = 0;
|
|
var jobID = '';
|
|
var savedForm;
|
|
var inBackgroundJobProgressTimer = false;
|
|
function updateJobProgress() {
|
|
if (inBackgroundJobProgressTimer) {
|
|
return;
|
|
}
|
|
inBackgroundJobProgressTimer = true;
|
|
$.getJSON("/cgi-bin/koha/tools/background-job-progress.pl?jobID=" + jobID, function(json) {
|
|
var percentage = json.job_status == 'completed' ? 100 :
|
|
json.job_size > 0 ? Math.floor(100 * json.progress / json.job_size) :
|
|
100;
|
|
var bgproperty = (parseInt(percentage*2)-300)+"px 0px";
|
|
$("#jobprogress").css("background-position",bgproperty);
|
|
$("#jobprogresspercent").text(percentage);
|
|
|
|
if (percentage == 100) {
|
|
clearInterval(backgroundJobProgressTimer); // just in case form submission fails
|
|
completeJob();
|
|
}
|
|
inBackgroundJobProgressTimer = false;
|
|
});
|
|
}
|
|
|
|
function completeJob() {
|
|
savedForm.completedJobID.value = jobID;
|
|
savedForm.submit();
|
|
}
|
|
|
|
// submit a background job with data
|
|
// supplied from form f and activate
|
|
// progress indicator
|
|
function submitBackgroundJob(f) {
|
|
// check for background field
|
|
if (f.runinbackground) {
|
|
// set value of this hidden field for
|
|
// use by CGI script
|
|
savedForm = f;
|
|
f.mainformsubmit.disabled = true;
|
|
f.runinbackground.value = 'true';
|
|
|
|
// gather up form submission
|
|
var inputs = [];
|
|
$(':input:enabled', f).each(function() {
|
|
if (this.type == 'radio' || this.type == 'checkbox') {
|
|
if (this.checked) {
|
|
inputs.push(this.name + '=' + encodeURIComponent(this.value));
|
|
}
|
|
} else if (this.type == 'button') {
|
|
; // do nothing
|
|
} else {
|
|
inputs.push(this.name + '=' + encodeURIComponent(this.value));
|
|
}
|
|
|
|
});
|
|
|
|
// and submit the request
|
|
$("#jobpanel").show();
|
|
$("#jobstatus").show();
|
|
$.ajax({
|
|
data: inputs.join('&'),
|
|
url: f.action,
|
|
dataType: 'json',
|
|
type: 'post',
|
|
success: function(json) {
|
|
jobID = json.jobID;
|
|
inBackgroundJobProgressTimer = false;
|
|
backgroundJobProgressTimer = setInterval("updateJobProgress()", 500);
|
|
},
|
|
error: function(xml, textStatus) {
|
|
humanMsg.displayMsg( '<p>' + __('Import of record(s) failed: ') + textStatus + '</p></br>'+xml.responseText, { className: 'humanError' } );
|
|
}
|
|
|
|
});
|
|
|
|
} else {
|
|
// background job support not enabled,
|
|
// so just do a normal form submission
|
|
f.submit();
|
|
}
|
|
|
|
return false;
|
|
}
|