Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-3615

Changing value-pairs-name for language tags has no effect

    Details

    • Type: Bug
    • Status: Code Review Needed (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 6.0
    • Fix Version/s: None
    • Component/s: DSpace API
    • Labels:
    • Attachments:
      0
    • Comments:
      0
    • Documentation Status:
      In Description

      Description

      Github discussion:

      https://github.com/DSpace/DSpace/pull/1740#issuecomment-306893094

       

      Changing:

      <language value-pairs-name="common_iso_languages">true</language>
      

      to:

      <language value-pairs-name="anything">true</language>
      

      had absolutely no effect.

      Problem 1: It uses the hardcoded LanguageName = "common_iso_languages".

      I found this:

      https://github.com/DSpace/DSpace/blob/master/dspace-api/src/main/java/org/dspace/app/util/DCInput.java#L36

      So I went to change it and then I saw that value-pairs-name is also hardcoded into the fieldMap:

      if ("dropdown".equals(inputType) || "qualdrop_value".equals(inputType)
                      || "list".equals(inputType))
              {
                  valueListName = fieldMap.get("value-pairs-name");
                  valueList = listMap.get(valueListName);
              }
      

      But then, how do we get the value-pairs-name for the language?

      Problem 2: value-pairs-name is used by two fields simultaneously

      Here the PAIR_TYPE_NAME is defined:

      https://github.com/DSpace/DSpace/blob/master/dspace-api/src/main/java/org/dspace/app/util/DCInputsReader.java#L53-L54

      But here it gets ugly:

      https://github.com/DSpace/DSpace/blob/master/dspace-api/src/main/java/org/dspace/app/util/DCInputsReader.java#L376-L423

      As you can see

      field.put(PAIR_TYPE_NAME, pairTypeName);

      is called for both language and types dropdown, qualdrop_value, and list, which means one will overwrite the other. And worse, the language is not even being used.

      I have two possible solutions to this:

      1. Use the same value-pairs-name
      2. Create a new language-value-pairs-name to avoid conflict.

      The final solution is simple. After we decide between what to use above, we jsut need to rewrite a single line in the DCInput. Here's the ugly version:

      valueLanguageList = listMap.get(fieldMap.get("language-value-pairs-name") == null? LanguageName : fieldMap.get("language-value-pairs-name"));
      

      I already have it working in my test enviroment

       

      Once we define the correct course of action (about the PAIR_TYPE_NAME), I can open the PR to fix this on the master and dspace_6 branches.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              edusperoni Eduardo Speroni
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: