fire-eggs / FamilyLines

A free, open-source genealogy application to track, organize, and share your family history.
13 stars 1 forks source link

Add URLs support to Person #53

Closed fire-eggs closed 7 years ago

fire-eggs commented 7 years ago

notonyournelly[CodePlex]
The GED file format permits multiple URLs (links) to be associated with an individual's record. The Family.Show code has no support for these links.

In the Experimental branch, GEDCOM.Net is being used to improve GED import. We need a way to display, edit and persist this link data.

Sub-tasks:

Add a collection of strings member to Person.cs. Add a GUI mechanism to quotphotos and historyquot to view/edit these link strings. Should provide a button a la quotplacequot to fire a link in a browser. Insure the strings load/save properly to .familyx file. In the Person() construction which takes a GedcomIndividualRecord, copy any imported links to the Person member (ask me for more details).

fire-eggs commented 7 years ago

hemashiv[CodePlex]
Marked fixed.

fire-eggs commented 7 years ago

hemashiv[CodePlex]
Done. Thanks

fire-eggs commented 7 years ago

notonyournelly[CodePlex]
Go ahead and close this entry out. Add a new issue for the addition of multiple, dynamic controls.

Nice to see such progress!!!

fire-eggs commented 7 years ago

hemashiv[CodePlex]
Should I mark complete or should we wait for the addition of multiple controls dynamically?

fire-eggs commented 7 years ago

hemashiv[CodePlex]
All done / checked in.

fire-eggs commented 7 years ago

notonyournelly[CodePlex]
My bad, again. I forgot the part where the Gedcom.Net data needs to be translated to Family.Show data. You are correct, the fix is in Person.cs.

In Person.cs you'll need to extend the constructor which takes a GedcomIndividualRecord parameter to handle the link data. Gedcom.Net parses URLs as multimedia; there is a loop in that constructor (about line 2400) that processes multimedia objects.

The foreach loop processing mmRec.Files needs be modified. Check that gnMMediaFile.Format equals URL; if so, the web URL string will be in Files[0].Filename, and the web description will be in mmRec.Title.

fire-eggs commented 7 years ago

hemashiv[CodePlex]
Ged is exported correctly. Fixed a coupl of bugs in my code. GedCOMimport may be eading all the data, however, do not see the links come in. Probably missing something in Person.cs???

fire-eggs commented 7 years ago

notonyournelly[CodePlex]
For the import from GED side, the Experimental branch should just work. If we end up shipping this feature in an earlier release, a little work will be required to extend the Family.Show code to import the link data. I wouldn't think about it right yet but I'm sure it'll be straightforward. I mention it as much for a reminder to myself...

fire-eggs commented 7 years ago

notonyournelly[CodePlex]
To save links for a person, see FamilyLinesLib, GedcomExport.cs, ExportPeople(). You'll actually be emulating ExportPhotos() and ExportAttachments(), which are invoked from that method. It doesn't matter where you invoke ExportLinks(), just don't invoke it before the Birth and death info section, i.e. do so after the ExportEvent() calls.

For each link, you should end up with the following lines in the GED file for the person: 1 OBJE 2 FORM URL 2 TITL description-goes-here 2 FILE link-text-goes-here You'll want to skip the TITL line if the description is null/empty/whitespace. You'll want to skip outputting the lines altogether if the link is null/empty/whitespace.

fire-eggs commented 7 years ago

hemashiv[CodePlex]
Anything on saving to GED format for both link and description.

fire-eggs commented 7 years ago

hemashiv[CodePlex]
All checked in... Thanks for your prompt response to my question on dynamic addition of controls. I shall try it out eventually. Also, I added a red save button instead of using the back

button for full satisfaction .

fire-eggs commented 7 years ago

notonyournelly[CodePlex]
The one place that comes to mind in the code where I add controls on-the-fly is in the FamilyViewViewer class. See the method MakeBabies.

The key point is that you need a visual container to hold your controls. I.e. in this case you have a ScrollViewer, and inside this scrollviewer you've got a container: maybe a StackPanel. When the user clicks the + button you'll need to create an instance of the link control, then add it to the container's Children list: // container is named 'Contain' in the XAML TextBox tb = new TextBox(); // set textbox properties Contain.Children.Add(tb); I simplified my life a little by creating a UserControl to add to my container. The UserControl acted as a container to hold multiple controls and handle all the details. I don't know if that will be necessary in this case.

The way the Family.Show controls are created, it'll be necessary to wipe any previous state. Clear the container's Children list before showing this person's links.

If it proves necessary to force the container to repaint (i.e. a new link control doesn't appear after the user clicks the + button), invoking: // as above, the container is named 'Contain' Contain.InvalidateVisual(); should take care of it.

fire-eggs commented 7 years ago

notonyournelly[CodePlex]
Please go ahead and check them in. I'll diff and send you any feedback when I have a minute. I can also send some details about adding controls dynamically in code-behind [I can't remember if we do that anyplace in Family Lines, I'll look.]

fire-eggs commented 7 years ago

hemashiv[CodePlex]
The task is done and saves to .family file. However: the following are not complete:

Saving to GedCom format. I have only 2 link and 2 description boxes...not really proud of this. Because I placed them in a scrollviewer. I would like to ideally have a + button which allows us to add as many links as we would like. But right now, my knowledge of adding a set of controls dynamically is 0. I am working on it.

I would like you to diff the files and review it. Would you like me to attach the files here or check them in?

fire-eggs commented 7 years ago

notonyournelly[CodePlex]
Good to hear! I guess I didn't think thru the mechanics far enough. Having the Back button do a save is a good solution.

fire-eggs commented 7 years ago

hemashiv[CodePlex]
Actively worked on this today. I got the UI set up (Yippie, did some WPF reading and jumped right in...took longer than should have tho) Now, we do not have a save button for the links and description. Should pressing Back button save this?

fire-eggs commented 7 years ago

notonyournelly[CodePlex]
I've attached a (very crude) mock of how the URL support might work. The web links sub-panel would need to have a scrollbar to permit multiple URLs (count TBD) without sacrificing too much space from the Story sub-panel.

Any alternative ideas appreciated.

fire-eggs commented 7 years ago

notonyournelly[CodePlex]
Yes, that is the correct panel.

fire-eggs commented 7 years ago

hemashiv[CodePlex]
Regarding Add a GUI mechanism to photos and history to view/edit these link strings. Should provide a button a la place to fire a link in a browser.

Please see attachment and verify whether that is the page where it goes?