From 3ec61443002a30df4f0d29249de7517765216c93 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 11 Feb 2013 05:49:05 -0500 Subject: [PATCH] [SIGNED-OFF] Bug 9545 - Fix import MARC bibliographic framework text label This patch improves the labeling of import controls on the MARC frameworks page by making import options more explicit. Other changes: - Form markup fixed to match standard form constructions - JavaScript corrected to make more embedded English strings translatable. - Form labels made clickable by making "for" attributes match unique form field ids. - Some warning re-worded for readability and translatability. - Large "loading" icon replaced with more proportional smaller one. To test, view the MARC frameworks page (admin/biblio_framework.pl) and test Export and Import functionality. Clicking each should display a form with options clearly labeled. Import and Export operations should complete correctly. Signed-off-by: David Cook Works as described, although I see what Owen means about it being a good candidate for replacement with a modal dialog box in the future. --- .../intranet-tmpl/prog/en/css/staff-global.css | 17 ++--- .../prog/en/modules/admin/biblio_framework.tt | 84 +++++++++++--------- 2 files changed, 51 insertions(+), 50 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css index 1a3e563..fc21fe1 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css +++ b/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css @@ -1923,15 +1923,13 @@ fieldset.rows+h3 {clear:both;padding-top:.5em;} z-index: 1; width: 300px; } -.import_export_options li{ - display: block; - list-style: none; - padding-top: 10px; +.import_export_options fieldset.rows li label { + width : 16em; } -.import_export_options .import_export_close { - cursor: pointer; - text-decoration: underline; +.form_import fieldset.rows li label { + width : auto; } + .import_export_options .export_ok { padding: 10; background: #E3E3E3 none; @@ -1939,7 +1937,7 @@ fieldset.rows+h3 {clear:both;padding-top:.5em;} margin-left: 20px; border: none; } -.import_export_options .import_ok { +.import_export_options { padding: 10; background: #E3E3E3 none; cursor: pointer; @@ -1953,9 +1951,6 @@ fieldset.rows+h3 {clear:both;padding-top:.5em;} padding: inherit; background: none; } -.li_close_import_export { - text-align: right; -} .importing { position: relative; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt index 6b7df81..bebeb2f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt @@ -67,6 +67,7 @@ $(document).ready(function() { if (!importing) { $('.import_export_options').fadeOut('fast'); $("body").css("cursor", "auto"); + return false; } }); $('.input_import').val(""); @@ -75,9 +76,7 @@ $(document).ready(function() { if (matches && matches.length > 1) { alert(_("Error importing the framework ") + decodeURIComponent(matches[1])); } - }); - - $(function() { + $('input.input_import').change( function() { var filename = $(this).val(); if ( ! /(?:\.csv|\.sql|\.ods|\.xml)$/.test(filename)) { @@ -95,12 +94,12 @@ $(document).ready(function() { var id = $(this).attr('id'); var obj = $('#' + id + ' input:file'); if (/(?:\.csv|\.sql|\.ods|\.xml)$/.test(obj.val())) { - if (confirm('Do you really want to import the framework fields/subfields (will overwrite current configuration, for safety reasons please make before an export to have a backup file)?')) { + if (confirm(_("Do you really want to import the framework fields and subfields? This will overwrite the current configuration. For safety reasons please use the export option to make a backup"))) { var frameworkcode = $('#' + id + ' input:hidden[name=frameworkcode]').val(); - $('#importing_' + frameworkcode).find("span").html("Importing " + frameworkcode + " from " + obj.val().replace(new RegExp("^.+[/\\\\]"),"") + ""); + $('#importing_' + frameworkcode).find("span").html(_("Importing to framework:")+"" + frameworkcode + "
" +_("Importing from file:")+"" + obj.val().replace(new RegExp("^.+[/\\\\]"),"") + ""); if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) { var timestamp = new Date().getTime(); - $('#importing_' + frameworkcode).find("img").attr('src', '/intranet-tmpl/prog/img/loading.gif' + '?' +timestamp); + $('#importing_' + frameworkcode).find("img").attr('src', '/intranet-tmpl/prog/img/loading-small.gif' + '?' +timestamp); } $('#importing_' + frameworkcode).css('display', 'block'); if (navigator.userAgent.toLowerCase().indexOf('firefox') == -1) $("body").css("cursor", "progress"); @@ -116,8 +115,6 @@ $(document).ready(function() { return false; }); }); - - @@ -200,15 +197,17 @@ $(document).ready(function() {
Export
+
+ Export framework -
    -
  • Close
  • -
  • -
  • -
  • -
  • -
  • -
+
    +
  1. +
  2. +
  3. +
  4. +
+
+
Cancel
@@ -216,13 +215,16 @@ $(document).ready(function() {
Import
+
+ Import [% frameworkcode %] framework structure (fields and subfields) from a spreadsheet file (.csv, .xml, .ods) or SQL file -
    -
  • Close
  • -
  • -
  • -
+
    +
  1. +
  2. +
+
+
Cancel
@@ -230,41 +232,45 @@ $(document).ready(function() { [% FOREACH loo IN loop %] - [% IF ( loop.odd ) %] - [% ELSE %] - [% END %] + [% IF ( loop.odd ) %] + [% ELSE %] + [% END %] [% loo.frameworkcode %] [% loo.frameworktext %] MARC structure Edit Delete -
Export +
Export
+
+ Export framework -
    -
  • Close
  • -
  • -
  • -
  • -
  • -
  • -
+
    +
  1. +
  2. +
  3. +
  4. +
+
+
Cancel
-
Import +
Import
+
+ Import [% frameworkcode %] framework structure (fields and subfields) from a spreadsheet file (.csv, .xml, .ods) or SQL file -
    -
  • Close
  • -
  • -
  • -
+
    +
  1. +
+
+
Cancel
-- 1.7.7.4