Web based family history software

Question Localized date insertion

  • mlocati
  • Topic Author
  • Visitor
  • Visitor
13 years 9 months ago #1 by mlocati
Localized date insertion was created by mlocati
Hello to everybody

I think it's quite important to allow the users to insert dates (and date ranges) in a convenient way.
The Gedcom format is not so difficult to understand and use, but:
- I think that is the computer that should try to be more user-friendly (and that the users shouldn't be so computer-friendly ;) )
- if all the webtrees is translated, why not the date insert functions?

So I've start writing some code to help users to insert dates. Since I think it's quite good, I'd like to share this with you. For now it supports just the Gregorian calendar, but if the developer team thinks that this code could be used in webtrees I can add the other standard Gedcom calendars.

To see it in action, copy the file contained in the attached archive into the root folder of the webtrees installation (tested with webtrees-8456) and navigate to it with the web browser...

I hope this may be of some help...

File Attachment:

File Name: gedcom_dates_test.zip
File Size:11 KB
Attachments:

Please Log in or Create an account to join the conversation.

  • mlocati
  • Topic Author
  • Visitor
  • Visitor
13 years 9 months ago #2 by mlocati
Replied by mlocati on topic Re: Localized date insertion
PS: the calendar icon isn't working with localized date insertions. I think I'll fix this in a few days.

Please Log in or Create an account to join the conversation.

  • mlocati
  • Topic Author
  • Visitor
  • Visitor
13 years 9 months ago #3 by mlocati
Replied by mlocati on topic Re: Localized date insertion
Here's an updated version of the javascript object that allows the insertion of localized dates.

File Attachment:

File Name: gedcom_dat...0601.zip
File Size:11 KB
Attachments:

Please Log in or Create an account to join the conversation.

More
13 years 9 months ago #4 by wooc
Replied by wooc on topic Re: Localized date insertion
Michele,
It looks good. Could you make this improvement direct to webtrees files?

Please Log in or Create an account to join the conversation.

  • fisharebest
  • Away
  • Administrator
  • Administrator
More
13 years 9 months ago #5 by fisharebest
Replied by fisharebest on topic Re: Localized date insertion
There are difficulties with this sort of edit input.

Gedcom dates can include other calendars, such as hebrew, french republican, etc.

So, you need to be able to enter

@#DHEBREW# 14 TVT 5240
@#DFRENCH R# 26 BRUM 9

Gedcom dates can include new-style/old-style years, such as 23 JAN 1610/11

Gedcom dates can include negative years, such as 44 B.C. These will be julian, so this should really be

@#DJULIAN@ 44 B.C.

If you extend the edit control to allow for all these cases, it becomes too awkward to use.

Greg Roach - greg@subaqua.co.uk - @fisharebest@phpc.social - fisharebest.webtrees.net

Please Log in or Create an account to join the conversation.

  • mlocati
  • Topic Author
  • Visitor
  • Visitor
13 years 9 months ago #6 by mlocati
Replied by mlocati on topic Re: Localized date insertion
fisharebest wrote:

There are difficulties with this sort of edit input.
[...]
If you extend the edit control to allow for all these cases, it becomes too awkward to use.


Well, in that case, users can always insert data manually, that is in the standard way.

I've tried to insert it in webtrees, and it seems to work.

Here's what I've done to do this little test:
1) edited includes/functions/functions_edit.php to:
- write the html code for the new input
Code:
echo '<script type="text/javascript">GedcomDateInput.Write("', $element_name, '", "', PrintReady(htmlspecialchars($value,ENT_COMPAT,'UTF-8')), '");</script>';
- remove the extra calendar and date display

2) edited the edit_interface.php to include the script
?><script src="gedcom_date.js.php?lang=<?php echo $_SESSION; ?>" language="JavaScript" type="text/javascript"></script><?php

And I tested with a BIRT fact... Seems to work as expected. For now it doesn't support the "read-only" mode, and I need to do some more check, but if you can find it useful all these things can be done...

In the attached archive you can find the functions_edit.php and edit_interface.php files I modified (based on webtrees-8520), the script (gedcom_date.js.php) and the test page (gedcom_date_test.php).

File Attachment:

File Name: date_inser...test.zip
File Size:53 KB
Attachments:

Please Log in or Create an account to join the conversation.

  • mlocati
  • Topic Author
  • Visitor
  • Visitor
13 years 9 months ago #7 by mlocati
Replied by mlocati on topic Re: Localized date insertion
mlocati wrote:

For now it doesn't support the "read-only" mode


Now it does. The files edit_interface.php and includes/functions/functions_edit.php are patched from webtrees-8581.

File Attachment:

File Name: date_inser...0604.zip
File Size:53 KB
Attachments:

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum
}