Skip to content

Commit

Permalink
Release 2.0.6.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ric2016 committed Jun 28, 2020
1 parent b71c3d9 commit 1b7478f
Show file tree
Hide file tree
Showing 10 changed files with 604 additions and 50 deletions.
117 changes: 76 additions & 41 deletions Gov4WebtreesModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Cissee\Webtrees\Module\Gov4Webtrees\FunctionsGov;
use Cissee\WebtreesExt\AbstractModule;
use Cissee\WebtreesExt\FactPlaceAdditions;
use Cissee\WebtreesExt\MoreI18N;
use Cissee\WebtreesExt\Requests;
use DateTime;
use Fisharebest\ExtCalendar\GregorianCalendar;
Expand Down Expand Up @@ -87,7 +88,7 @@ protected function onBoot(): void {
//migrate (we need the module name here to store the setting)
$this->updateSchema('\Cissee\Webtrees\Module\Gov4Webtrees\Schema', 'SCHEMA_VERSION', 2);

$this->flashWhatsNew('\Cissee\Webtrees\Module\Gov4Webtrees\WhatsNew', 1);
$this->flashWhatsNew('\Cissee\Webtrees\Module\Gov4Webtrees\WhatsNew', 2);
}

public function flashGovServerUnavailable() {
Expand Down Expand Up @@ -424,7 +425,7 @@ public function gov2html(GovReference $govReference, Tree $tree): ?GenericViewEl
$locale = I18N::locale();

$compactDisplay = boolval($this->getPreference('COMPACT_DISPLAY', '1'));
$withInternalLinks = boolval($this->getPreference('DISPLAY_INTERNAL_LINKS', '1'));
$withInternalLinks = intval($this->getPreference('DISPLAY_INTERNAL_LINKS', '1'));
$allowSettlements = boolval($this->getPreference('ALLOW_SETTLEMENTS', '1'));

$fallbackPreferDeu = boolval($this->getPreference('FALLBACK_LANGUAGE_PREFER_DEU', '1'));
Expand Down Expand Up @@ -558,7 +559,7 @@ public function factPlaceAdditions(PlaceStructure $place): ?FactPlaceAdditions {
$locale = I18N::locale();

$compactDisplay = boolval($this->getPreference('COMPACT_DISPLAY', '1'));
$withInternalLinks = boolval($this->getPreference('DISPLAY_INTERNAL_LINKS', '1'));
$withInternalLinks = intval($this->getPreference('DISPLAY_INTERNAL_LINKS', '1'));
$showCurrentDateGov = intval($this->getPreference('SHOW_CURRENT_DATE', '0'));
$allowSettlements = boolval($this->getPreference('ALLOW_SETTLEMENTS', '1'));
$useMedianDate = boolval($this->getPreference('USE_MEDIAN_DATE', '0'));
Expand Down Expand Up @@ -595,10 +596,24 @@ public function factPlaceAdditions(PlaceStructure $place): ?FactPlaceAdditions {

return new FactPlaceAdditions(GenericViewElement::createEmpty(), $gve, GenericViewElement::createEmpty());
}

protected function plac2linkIcon(PlaceStructure $ps): string {
return $this->linkIcon(
$this->name() . '::icons/place',
MoreI18N::xlate('Place'),
$ps->getPlace()->url());
}

public function linkIcon($view, $title, $url) {
return '<a href="' . $url . '" rel="nofollow" title="' . $title . '">' .
view($view) .
'<span class="sr-only">' . $title . '</span>' .
'</a>';
}

protected function getHierarchy(
bool $compactDisplay,
bool $withInternalLinks,
int $withInternalLinks,
bool $allowSettlements,
string $locale,
string $julianDay,
Expand Down Expand Up @@ -632,47 +647,67 @@ protected function getHierarchy(
if ($hierarchy !== '') {
$hierarchy .= ', ';
}

if ($withInternalLinks) {

//Issue #13: is this a known webtrees place?
//(note: there may be more than one - we restrict to first found)
$ps = FunctionsPlaceUtils::gov2plac($this, $govReference, $tree);
if ($ps !== null) {


switch ($withInternalLinks) {
case 0: //classic
$hierarchy .= '<a href="http://gov.genealogy.net/item/show/' . $nextId . '" target="_blank" title="' . $data['type'] . ' ' . $data['label'] . '">';
$hierarchy .= $data['label'];
$hierarchy .= '</a>';
break;
case 1: //classic plus place/shared place icons
case 2: //names and main links to place, plus gov icons
$pre = '';
//link to location? note: for now not indirectly = only if location defines the GOV!
$loc = $ps->getLoc();
if ($loc !== null) {
$locLink = FunctionsPlaceUtils::loc2linkIcon($this, new LocReference($loc, $tree, new Trace('')));
if ($locLink !== null) {
$pre = $locLink;

//Issue #13: is this a known webtrees place?
//(note: there may be more than one - we restrict to first found)
$ps = FunctionsPlaceUtils::gov2plac($this, $govReference, $tree);
if ($ps !== null) {

//link to location? note: for now not indirectly = only if location defines the GOV!
$loc = $ps->getLoc();
if ($loc !== null) {
$locLink = FunctionsPlaceUtils::loc2linkIcon($this, new LocReference($loc, $tree, new Trace('')));
if ($locLink !== null) {
$pre = $locLink;
}
}
}
}

$hierarchy .= '<a href="http://gov.genealogy.net/item/show/' . $nextId . '" target="_blank" title="GOV: ' . $data['type'] . ' ' . $data['label'] . '">';
$hierarchy .= '<span class="wt-icon-map-gov"><i class="fas fa-play fa-fw" aria-hidden="true"></i></span>';
$hierarchy .= '&#8239;'; //meh (Narrow no-break space), should do this with css instead
$hierarchy .= '</a>';
$hierarchy .= $pre;
$hierarchy .= '<a dir="auto" href="' . e($ps->getPlace()->url()) . '">' . $ps->getPlace()->placeName() . '</a>';

} else {
$hierarchy .= '<a href="http://gov.genealogy.net/item/show/' . $nextId . '" target="_blank" title="GOV: ' . $data['type'] . ' ' . $data['label'] . '">';
$hierarchy .= '<span class="wt-icon-map-gov"><i class="fas fa-play fa-fw" aria-hidden="true"></i></span>';
$hierarchy .= '&#8239;'; //meh (Narrow no-break space), should do this with css instead
$hierarchy .= '</a>';
$hierarchy .= '<i>' . $data['label'] . '</i>';
}

} else {
$hierarchy .= '<a href="http://gov.genealogy.net/item/show/' . $nextId . '" target="_blank" title="' . $data['type'] . ' ' . $data['label'] . '">';
$hierarchy .= $data['label'];
$hierarchy .= '</a>';
switch ($withInternalLinks) {
case 1: //classic plus place/shared place icons
if (($ps !== null) && ($pre === '')) {
$pre = $this->plac2LinkIcon($ps);
}
$hierarchy .= $pre;
$hierarchy .= '<a href="http://gov.genealogy.net/item/show/' . $nextId . '" target="_blank" title="' . $data['type'] . ' ' . $data['label'] . '">';
$hierarchy .= $data['label'];
$hierarchy .= '</a>';
break;
case 2: //names and main links to place, plus gov icons
if ($ps !== null) {
$hierarchy .= '<a href="http://gov.genealogy.net/item/show/' . $nextId . '" target="_blank" title="GOV: ' . $data['type'] . ' ' . $data['label'] . '">';
$hierarchy .= '<span class="wt-icon-map-gov"><i class="fas fa-play fa-fw" aria-hidden="true"></i></span>';
$hierarchy .= '&#8239;'; //meh (Narrow no-break space), should do this with css instead
$hierarchy .= '</a>';
$hierarchy .= $pre;
$hierarchy .= '<a dir="auto" href="' . e($ps->getPlace()->url()) . '">' . $ps->getPlace()->placeName() . '</a>';

} else {
$hierarchy .= '<a href="http://gov.genealogy.net/item/show/' . $nextId . '" target="_blank" title="GOV: ' . $data['type'] . ' ' . $data['label'] . '">';
$hierarchy .= '<span class="wt-icon-map-gov"><i class="fas fa-play fa-fw" aria-hidden="true"></i></span>';
$hierarchy .= '&#8239;'; //meh (Narrow no-break space), should do this with css instead
$hierarchy .= '</a>';
$hierarchy .= '<i>' . $data['label'] . '</i>';
}
break;
default:
break;
}
break;
default:
break;
}




if (!$compactDisplay) {
if ($hierarchy2 !== '') {
$hierarchy2 .= ', ';
Expand Down
26 changes: 21 additions & 5 deletions Gov4WebtreesModuleTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,6 @@ protected function createPrefs() {
null,
'COMPACT_DISPLAY',
'1'),
new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Use place names and link to places existing in webtrees'),
/* I18N: Module Configuration */I18N::translate('If this is checked, the displayed GOV hierarchy uses place names from the GEDCOM data, if possible.'),
'DISPLAY_INTERNAL_LINKS',
'1'),
new ControlPanelCheckbox(
/* I18N: Module Configuration */I18N::translate('Allow objects of type \'settlement\' in hierarchy'),
/* I18N: Module Configuration */I18N::translate('According to the current GOV specification, settlements are not supposed to be parents of other settlements.') .
Expand All @@ -148,6 +143,27 @@ protected function createPrefs() {
'0')));

$factsAndEventsSub[] = new ControlPanelSubsection(
/* I18N: Module Configuration */I18N::translate('Place text and links'),
array(new ControlPanelRadioButtons(
false,
array(
new ControlPanelRadioButton(
/* I18N: Module Configuration */I18N::translate('Use place names and links from GOV'),
/* I18N: Module Configuration */I18N::translate('\'Classic\' mode.'),
'0'),
new ControlPanelRadioButton(
/* I18N: Module Configuration */I18N::translate('Use place names and links from GOV, additionally link to places existing in webtrees via icons'),
/* I18N: Module Configuration */I18N::translate('\'Classic\' mode, extended to link to places from the GEDCOM data, if possible.'),
'1'),
new ControlPanelRadioButton(
/* I18N: Module Configuration */I18N::translate('Use place names and link to places existing in webtrees, additionally link to GOV via icons'),
/* I18N: Module Configuration */I18N::translate('If this is checked, the displayed GOV hierarchy uses place names from the GEDCOM data, if possible.'),
'2')),
null,
'DISPLAY_INTERNAL_LINKS',
'1')));

$generalSub[] = new ControlPanelSubsection(
/* I18N: Module Configuration */I18N::translate('Internals (adjusted automatically if necessary)'),
array(/* new ControlPanelCheckbox(
I18N::translate('Use fast ajax requests'),
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Access a demo of the module [here](https://cissee.de/gov4webtrees2Demo). Feel fr

### Download<a name="download"/>

* Current version: 2.0.6.0.4
* Current version: 2.0.6.1.0
* Based on and tested with webtrees 2.0.6. Cannot be used with webtrees 1.x. May not work with earlier 2.x versions!
* Requires the ⚶ Vesta Common module ('vesta_common').
* Displays data via the ⚶ Vesta Facts and events module ('vesta_personal_facts').
Expand Down Expand Up @@ -70,6 +70,7 @@ If you use GEDCOM data with _GOV tags for GOV ids (either directly or via the Sh
* Nutzt Daten des [Geschichtlichen Orts-Verzeichnisses GOV](http://gov.genealogy.net) des [Vereins für Computergenealogie e. V.](http://compgen.de), basierend auf einer [Creative Commons-Lizenz](http://wiki-de.genealogy.net/GOV/Webservice#Lizenz).
* Dutch translations provided by TheDutchJewel.
* Slovak translations provided by Ladislav Rosival.
* Czech translations provided by Josef Prause.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down
4 changes: 2 additions & 2 deletions WhatsNew/WhatsNew0.php → WhatsNew/WhatsNew1.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
use Cissee\WebtreesExt\WhatsNew\WhatsNewInterface;
use Fisharebest\Webtrees\I18N;

class WhatsNew0 implements WhatsNewInterface {
class WhatsNew1 implements WhatsNewInterface {

public function getMessage(): string {
return I18N::translate("Vesta Gov4Webtrees: The displayed GOV hierarchy now uses place names and links from webtrees where possible. You can switch back to the traditional display via the module configuration.");
return I18N::translate("Vesta Gov4Webtrees: The displayed GOV hierarchy now additionally links to webtrees places where possible. You can switch back to the classic display (and others) via the module configuration.");
}
}
2 changes: 1 addition & 1 deletion latest-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.6.0.4
2.0.6.1.0
7 changes: 7 additions & 0 deletions resources/css/minimal.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@
background-repeat: no-repeat;
background-size: cover;
}

.wt-icon-shared-place {
display: inline-block;
vertical-align: middle;
background-repeat: no-repeat;
background-size: cover;
}
5 changes: 5 additions & 0 deletions resources/css/webtrees.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added resources/lang/cs.mo
Binary file not shown.
Loading

0 comments on commit 1b7478f

Please sign in to comment.