Neriderc / GVExport

Repository for GVExport module for Webtrees
GNU General Public License v2.0
15 stars 6 forks source link

Background colour based on shared note #416

Closed Neriderc closed 10 months ago

Neriderc commented 1 year ago

As discussed in https://github.com/Neriderc/GVExport/issues/397

@hartenthaler suggested:

It is possible to use custom tags in webtrees without any problems. But if you like to support them in editing masks and check the allowed values of such a tag, you need to add the tag in a custom module. So finally I think it is not a good idea to use custom GEDCOM tags. It would be better to use a shared note. For example, use a shared note "Custom colour: succession to the throne" or "Custom colour: genetic problem BRCA1". You can use the build-in functions of webtrees to manage such shared notes. There should be a management function in GVExport with a list to map such shared notes to a tile background/border colour or an icon.

Neriderc commented 1 year ago

@hartenthaler for this, would you display a selection for all shared notes, and any items with that shared note would be highlighted with that colour?

And how does this work in the UI? If you choose to set the colour based on this shared note, would you e.g. have the border set to one colour if they have the note and another if they don't? Or are we expecting this would overwrite other colours. E.g. based on gender but if this shared note is present then it would be the colour set for the shared note?

hartenthaler commented 1 year ago

I would suggest to use the same behavior as how to highlight the starting persons, ie use the "normal" colours, but use the selected colour of this option if there is a shared note for the specific individual. This is based on the assumption that most of the persons do not have such a shared note and that only a few of them have it.

But what if there are 2 or more shared colour notes for one person? Use the first one?

Beside the shared notes related to persons it would be interesting to use shared notes for families. Maybe to indicate families without a marriage. But when thinking about that, this is indicated already by a non existing MARR event. So this is another issue "use special colours to indicate non-married or divorced families". So I do not have any idea for using a shared note for families.

Regarding the user interface: I suggest to allow the user to build up a list of pairs of shared note and colour to be used. So search in all shared notes by entering some characters, select one, select a colour, and add this pair to a list. It should be possible to delete entries and to reorder them. The admin should be able to define a default list.

hartenthaler commented 1 year ago

I just found an application for this new option: in my tree many persons have already shared notes if they belong to a world tree, like FamilySearch FamilyTree or Geni or WikiTree. So I can use this new function to visualize all members of such a world tree in GVExport. Then it would be easy to identify persons in my tree where this shared note is missing or to see how to to connect unconnected branches in a world tree using the information in my tree.

hartenthaler commented 1 year ago

Another application could be: add a shared note to all persons in a tree "source needed". Then remove this note if there are sources for birth/christening AND death/burial (by using regular expressions in search and replace). Then visualize that by using GVExport.

Neriderc commented 1 year ago

Great, thanks for the suggestions. It sounds like we want:

Questions:

hartenthaler commented 1 year ago

Q1: tagging persons via shared notes should be visualized in a prominent style. So the shape of the tile and the border colour are less important. The tile background is a good choice because this is visible very good. But the tile background can show only one colour, so there is a priority necessary: highlighted starting person, shared note tag, other default colour.

The stripe is a good choice, too. For me the stripe is comparable to the colored dots that are used inside the persons box by MyHeritage. Up to now a stripe has only one colour, it should be possible to attach more colours to a stripe by cutting a long stripe into two shorter stripes (or more pieces). Each piece could have another colour. So the stripe can show for example simultaneously the information that this person is dead/alive and that it is tagged by one or more shared notes. So no hierarchy is necessary for stripe colours. The stripe approach is even better than the colored dots of MyHeritage: if you have to visualize ten colours for example this is still possible using the defined space for the stripe; I do not know what happens if MyHeritage likes to show ten colored dots - so many dots need much more space than the reserved area for one to three dots. Maybe they reduce the size of the dots.

Yes, it would be great if it is possible to expand each list item and select if the tile background or the stripe is used for that shared note. If this is too complicated, I would prefer to use only the above discussed stripe colour concept because that is more flexible and has no conflict with other uses like the tile background colour.

hartenthaler commented 1 year ago

By the way: I like the user interface as it is now very much! It looks clear and well organized. If you open each part there is a lot of complexity hidden. You can dive in as a more experienced user and have so many possibilities but you are not overwhelmed. Great design! Thank you!

hartenthaler commented 1 year ago

Q2: you are right, an admin list is not needed for shared notes. It would be too complicated and is not necessary. To include the shared note list in a setting is sufficient.

Neriderc commented 1 year ago

Great, thanks for the response. I will have a play to see if I can come up with something in line with what you're imagining.

Neriderc commented 1 year ago

I'm starting simple on this, and will work my way up to attempting the more elaborate version envisaged. In my initial testing, I've noticed that webtrees does not show notes when logged out, so it is not possible to select a shared not if you are not logged in.

Is this possible to change?

I'm wondering if I can remove this option from view when logged out, or if I need to account for the ability to change this setting. I wasn't able to find a setting to show notes to visitors, but that doesn't mean such a setting doesn't exist.

hartenthaler commented 1 year ago

This looks to me like a bug. See https://github.com/fisharebest/webtrees/issues/4886

Neriderc commented 1 year ago

Thanks! Looks like I'll need to allow for it. Do you know how I can test if that setting allows the current user or not?

hartenthaler commented 1 year ago

From my point of view, when using PHP you can access NOTE always (independent whether the user is logged in or not, if the user is an editor or admin, ...). You have to program active a test using the "canShow()" function to prevent that not logged-in users can see something that webtrees likes to hide. There are presumably many webtrees settings that are influencing the result of canShow().

Neriderc commented 1 year ago

I'm using the built in control for selecting a shared note. This seems to already filter out notes that are visible to you.

However, if no notes are visible to visitors, then it seems like the option to select one should not be visible.

I will have a look into that function to see if I can use it to decide to hide the option, thanks for the tip :slightly_smiling_face:

Neriderc commented 10 months ago

I have just merged in a pull request with this functionality, ready for testing! For anyone who wants to test, go to the main page of this repository, click the green Code button, then download zip. Unzip and install as usual.

Some notes:

I'm keen for any feedback on this!

hartenthaler commented 10 months ago

I can see the new option, but the list of shared notes is empty for my tree. There are already several shared notes in my tree. Is there a special format the shared notes should have to be used in GVExport? Or is there another way to add a new shared note?

hartenthaler commented 10 months ago

Ahh.. In the meantime, I found that I have to enter at least one character in the search/selection field to see my shared notes. It works great!!! This is very helpful. I will prepare several nice diagrams to show the power of this new function. Thank you very much! That is a great Christmas gift!

Neriderc commented 10 months ago

That's great to hear! The search is provided by webtrees, and the only filtering is that I remove any items already in the shared note list.

Final plans for this before closing the issue:

When these are done I will close this story as complete (and we may then be ready for a new release).

hartenthaler commented 10 months ago

One first example: show a tree with a genetic mutation (in this case using a shared note "BRCA1" added to some persons)

gvexport (8)

Neriderc commented 10 months ago

Closing this as completed in #461