[Koha-bugs] [Bug 10892] Make facets customisable - step 1 : store facet config in YAML block

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sat Sep 21 12:52:51 CEST 2013


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10892

--- Comment #5 from mathieu saby <mathieu.saby at univ-rennes2.fr> ---
Yes, I know that. That's why I want to add some "standard" facet, based on
existing zebra conf, which could be activated or not. It implies changing the 2
templates and the definition currently stored in Koha.pm.

Once the configuration will be in YAML separate file, as libraries would be
able to edit the YAML file (to change facet orders or fields used to build
them), I suppose writing a patch for adding new facets could not be done
cleanly just by git.
I think we will need to run a little script that will read the existing YAML
into perl data structure (array of hashes or hash of hashes), add new facet in
this structure, and dump it into YAML file again.
(The equivalent of operations made by updatedatabase for sql database)

For "local use" facets defined by the library itself :
- templates files won't know the name of these new facets
- it won't work if it does not match zebra record.abs (we will need a warning
for avoiding librarians to do mistakes)

But this can be circumvented if YAML data for local use facets are not
structured like the standard ones.
For ex, something like : 

customfacet1:
   type: 'customfacet'
   idx: 'customindex'
   labels:
      en: 'Custom facet 1'
      fr-FR: 'Facette spéciale 1'
   tags:
      -210$b
   sep: ' - '
   order:5

and code like that:
- in facet configuration page :
if (type = customfacet) {
   get all the list of the languages available in OPAC and Staff interface
   ask the librarian to define a label for each of these languages (for ex,
"en" and "fr-FR")
   store it in labels->{en} and labels->{fr-FR}
}

- in template displaying facets in OPAC and Staff interface
if (type = customfacet) {
  display labels->{current_language} 
}

Do you think it will work?

Mathieu

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list