[Koha-devel] Rancor/Advanced MARC Editor templates?

dcook at prosentient.com.au dcook at prosentient.com.au
Mon Jul 27 01:20:53 CEST 2020


Hi Andrew,

 

I’m not sure what you mean by “Visibility for the regular editor is really determining whether or not a field is available at all”. Visibility should govern whether a subfield appears in the OPAC, Staff Interface, or Editor. If opening an existing record and there is data there, it’ll show it regardless of Visibility. If creating a new record, then it will only show the fields/subfields marked as Visible in the Editor. Unfortunately, the sample frameworks show pretty much everything in the Editor, which would spam unsuspecting users of Rancor. But we could workaround that (ie system preference so Visibility isn’t used for existing installs, but becomes the default for new installs).

 

I don’t love the macros as templates idea, but it might be worth trying. I’d like a solution for 19.11, but maybe I could have the library in mind use the in-browser macros for the time being. 

 

David Cook

Systems Librarian

Prosentient Systems

72/330 Wattle St

Ultimo, NSW 2007

Australia

 

Office: 02 9212 0899

Online: 02 8005 0595

 

From: Andrew Fuerste-Henry <andrew at bywatersolutions.com> 
Sent: Friday, 24 July 2020 10:35 PM
To: dcook at prosentient.com.au
Cc: koha-devel <koha-devel at lists.koha-community.org>
Subject: Re: [Koha-devel] Rancor/Advanced MARC Editor templates?

 

Hi David,

 

I put this on your bug as well, but Visibility for the regular editor is really determining whether or not a field is available at all. That's a pretty different question than whether or not you're offered a sort of stub/reminder tag on a blank record in Rancor. As you say, I think a lot of folks would find it quite disruptive to suddenly have everything marks as visible in editor suddenly show as a blank tag in a new Rancor record.

 

If you're poking around at marking tags and subfields mandatory in Rancor, you might want to be aware of bug 25962, subfields aren't enforced as mandatory unless the tag is also mandatory: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25962

 

Macros have been moved from the browser cache to the database proper in 20.05, so they would be sharable as templates: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17268

 

Thanks!

Andrew

 

 

On Thu, Jul 23, 2020 at 6:52 PM <dcook at prosentient.com.au <mailto:dcook at prosentient.com.au> > wrote:

Hi Andrew,

 

I think that I’ve figured out how the editor works. The relevant code is at the bottom of my email.

 

For new record, it looks like the advanced editor includes the tag if it’s marked as “mandatory” or if the “allTags” parameter is true. 

 

I did a little test and marking 500 as “mandatory” made it appear in the editor (with this path /cgi-bin/koha/cataloguing/editor.pl#new/ <http://editor.pl#new/> ). However, you get an error “Incorrect syntax, cannot save” “Tag has no subfields” if you try to save the record without putting in any subfields for the 500 field. This is problematic since it’s normal for a template to have show optional fields, which act as prompts to the cataloguer. 

 

Using this path (/cgi-bin/koha/cataloguing/editor.pl#new-full/ <http://editor.pl#new-full/> ), absolutely everything in the framework gets shown in the editor, and that’s no good either. 

 

Really we should be using the “Editor” “visibility” instead of “mandatory” for this FillRecord function. Of course, that is defined at the subfield level, which makes the logic a bit trickier. 

 

Moreover, if we change the behaviour now, users might be shocked to see their new record view change dramatically after upgrading Koha. Something to think about. I’ve opened https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26055 to explore this further.

 

--

./koha-tmpl/intranet-tmpl/prog/en/includes/cateditor-ui.inc

'new': {

            titleForRecord: _("Editing new record"),

            get: function( id, callback ) {

                record = new MARC.Record();

                KohaBackend.FillRecord( '', record );

 

                callback( record );

            },

        },

 

"koha-tmpl/intranet-tmpl/lib/koha/cateditor/koha-backend.js"

FillRecord: function( frameworkcode, record, allTags ) {

            $.each( _frameworks[frameworkcode], function( undef, tag ) {

                var tagnum = tag[0], taginfo = tag[1];

 

                if ( taginfo.mandatory != "1" && !allTags ) return;

 

                var fields = record.fields(tagnum);

 

                if ( fields.length == 0 ) {

                    var newField = new MARC.Field( tagnum, ' ', ' ', [] );

                    fields.push( newField );

                    record.addFieldGrouped( newField );

 

                    if ( tagnum < '010' ) {

                        newField.addSubfield( [ '@', (taginfo.subfields[0] ? taginfo.subfields[0][1].defaultvalue : null ) || '' ] );

                        return;

                    }

                }

 

                $.each( taginfo.subfields, function( undef, subfield ) {

                    var subfieldcode = subfield[0], subfieldinfo = subfield[1];

 

                    if ( subfieldinfo.mandatory != "1" && !subfieldinfo.defaultvalue && !allTags ) return;

 

                    $.each( fields, function( undef, field ) {

                        if ( !field.hasSubfield(subfieldcode) ) {

                            field.addSubfieldGrouped( [ subfieldcode, subfieldinfo.defaultvalue || '' ] );

                        } else if ( subfieldinfo.defaultvalue && field.subfield( subfieldcode ) === '' ) {

                            field.subfield( subfieldcode, subfieldinfo.defaultvalue );

                        }

                    } );

                } );

            } );

        },

 

 

David Cook

Systems Librarian

Prosentient Systems

72/330 Wattle St

Ultimo, NSW 2007

Australia

 

Office: 02 9212 0899

Online: 02 8005 0595

 

From: dcook at prosentient.com.au <mailto:dcook at prosentient.com.au>  <dcook at prosentient.com.au <mailto:dcook at prosentient.com.au> > 
Sent: Friday, 24 July 2020 9:24 AM
To: 'Andrew Fuerste-Henry' <andrew at bywatersolutions.com <mailto:andrew at bywatersolutions.com> >
Cc: 'koha-devel' <koha-devel at lists.koha-community.org <mailto:koha-devel at lists.koha-community.org> >
Subject: RE: [Koha-devel] Rancor/Advanced MARC Editor templates?

 

Hi Andrew,

 

I’m not sure as I haven’t investigated macros very closely. At a glance, it looks like they’re stored in the browser’s local storage ("koha-tmpl/intranet-tmpl/lib/koha/cateditor/preferences.js"), so there would be no way to push macros out to users. The cataloguers would have to set them up themselves. It might work for 1 library I have in mind, but it seems more like a workaround, and probably wouldn’t be suitable for many other libraries. 

 

But thanks for the suggestion. One of these days, I do need to examine the editor more closely. 

 

David Cook

Systems Librarian

Prosentient Systems

72/330 Wattle St

Ultimo, NSW 2007

Australia

 

Office: 02 9212 0899

Online: 02 8005 0595

 

From: Andrew Fuerste-Henry <andrew at bywatersolutions.com <mailto:andrew at bywatersolutions.com> > 
Sent: Thursday, 23 July 2020 11:56 PM
To: dcook at prosentient.com.au <mailto:dcook at prosentient.com.au> 
Cc: koha-devel <koha-devel at lists.koha-community.org <mailto:koha-devel at lists.koha-community.org> >
Subject: Re: [Koha-devel] Rancor/Advanced MARC Editor templates?

 

Hi David,

 

Could macros do what you're looking for here? Create a macro for each type of record that inserts all of the blank fields you need for that type?

 

Andrew

 

On Wed, Jul 22, 2020 at 11:37 PM <dcook at prosentient.com.au <mailto:dcook at prosentient.com.au> > wrote:

Hi all,

 

Is it possible to define templates for Rancor/Advanced MARC Editor?

 

On systems like Horizon, it’s possible to have different templates, so cataloguers can at a glance see what fields they need to fill in for a particular type of record (e.g. book vs journal vs dvd). 

 

If it’s not possible, I want to make it possible, but I’m not sure if we should use the “Editor” setting in MARC Bibliographic Frameworks, or create a new feature for providing Rancor Templates. 

 

Personally, I’ve always hated how MARC Bibliographic Frameworks act as both Editor templates (for rendering HTML) and data filters (ie if the field is not in the framework, it gets stripped out of the record at save time).

 

In my ideal world, editor templates and data filters would be 2 separate features. For Rancor, I think MARC Bibliographic Frameworks already act as data filters, and it would be backwards incompatible to use them for templates as well, so adding a new feature for Rancor templates is probably the logical conclusion?

 

David Cook

Systems Librarian

Prosentient Systems

72/330 Wattle St

Ultimo, NSW 2007

Australia

 

Office: 02 9212 0899

Online: 02 8005 0595

 

_______________________________________________
Koha-devel mailing list
Koha-devel at lists.koha-community.org <mailto:Koha-devel at lists.koha-community.org> 
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/




 

-- 

Andrew Fuerste-Henry

Educator

(he/him/his)

ByWater Solutions

 <http://bywatersolutions.com/> bywatersolutions.com

Phone: <tel:(888)%20900-8944> (888)900-8944

  <https://drive.google.com/a/bywatersolutions.com/uc?id=1VVVFrey9XECr3VKtRsBrnaF0w5ESXYcA&export=download> 

 <http://bywatersolutions.com/what-is-koha/> What is Koha?




 

-- 

Andrew Fuerste-Henry

Educator

(he/him/his)

ByWater Solutions

 <http://bywatersolutions.com/> bywatersolutions.com

Phone: <tel:(888)%20900-8944> (888)900-8944

  <https://drive.google.com/a/bywatersolutions.com/uc?id=1VVVFrey9XECr3VKtRsBrnaF0w5ESXYcA&export=download> 

 <http://bywatersolutions.com/what-is-koha/> What is Koha?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20200727/439f0b93/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 484 bytes
Desc: not available
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20200727/439f0b93/attachment-0001.sig>


More information about the Koha-devel mailing list