Bug 16314: Show upload link for upload plugin in basic MARC editor
authorOwen Leonard <oleonard@myacpl.org>
Sat, 11 Jul 2020 13:25:11 +0000 (13:25 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 9 Sep 2020 13:39:51 +0000 (15:39 +0200)
This patch updates the basic MARC editor to provide a plugin name
variable to the template, allowing us to make a check on the name and
conditionally show an upload link if the "upload.pl" cataloging plugin
is selected.

To test, apply the patch and rebuild the staff client CSS
(https://wiki.koha-community.org/wiki/Working_with_SCSS_in_the_OPAC_and_staff_client).

 - Go do Administration -> MARC bibliographic framework -> MARC
   structure -> 856 -> Edit subfields.
 - Edit the "u" subfield and select "upload.pl" as the plugin under
   "Other options."
 - Go to Cataloging and create or edit a MARC record.
 - Under tab 8 look for the 856 tag, subfield u. There should be an
   "Upload" link corresponding to the form field.
 - Click the upload link to confirm that it triggers a popup window with
   the upload form.
 - Confirm that other similar plugin links (for instance 100$a, 600$a)
   display the old "tag editor" icon.

Signed-off-by: Lisette Scheer <lisetteslatah@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
cataloguing/addbiblio.pl
cataloguing/value_builder/upload.pl
koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt

index e5c33dc..996f611 100755 (executable)
@@ -395,6 +395,7 @@ sub create_input {
                 size           => 67,
                 maxlength      => $subfield_data{maxlength},
                 javascript     => $plugin->javascript,
+                plugin         => $plugin->name,
                 noclick        => $plugin->noclick,
             };
         } else {
index e26bca7..85c6bc6 100755 (executable)
@@ -35,6 +35,7 @@ my $builder = sub {
     return <<"SCRIPT";
 <script type=\"text/javascript\">
         function Click$params->{id}(event) {
+            event.preventDefault();
             var index = event.data.id;
             var str = document.getElementById(index).value;
             var myurl, term;
index 64f79cd..9a74705 100644 (file)
@@ -3455,6 +3455,15 @@ progress {
     text-indent: 100%;
     white-space: nowrap;
     width: 16px;
+
+    &.upload {
+        background: transparent none;
+        font-size: 90%;
+        height: unset;
+        overflow: unset;
+        text-indent: unset;
+        width: unset;
+    }
 }
 
 .browse-controls {
index 4f4fc59..70dbd7e 100644 (file)
                                                         [% IF mv.noclick %]
                                                             <span class="buttonDot tag_editor disabled" tabindex="-1" title="Field autofilled by plugin"></span>
                                                         [% ELSE %]
-                                                            <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor framework_plugin" tabindex="1" title="Tag editor">Tag editor</a>
+                                                            [% IF mv.plugin == "upload.pl" %]
+                                                                <a href="#" id="buttonDot_[% mv.id | html %]" class="tag_editor upload framework_plugin" tabindex="1"><i class="fa fa-upload" aria-hidden="true"></i> Upload</a>
+                                                            [% ELSE %]
+                                                                <a href="#" id="buttonDot_[% mv.id | html %]" class="buttonDot tag_editor framework_plugin" tabindex="1" title="Tag editor">Tag editor</a>
+                                                            [% END %]
                                                         [% END %]
                                                     </span>
                                                     [% mv.javascript | $raw %]