Skip to content

Commit

Permalink
compatibility to webtrees 2.1
Browse files Browse the repository at this point in the history
compatibility to webtrees 2.1, new translations, issue #130
  • Loading branch information
hartenthaler committed Dec 5, 2021
1 parent 43cf6c6 commit b0a3973
Show file tree
Hide file tree
Showing 18 changed files with 220 additions and 90 deletions.
2 changes: 2 additions & 0 deletions ExtendedFamily.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
use function explode;
use function count;

/*
require_once(__DIR__ . '/src/Factory/ExtendedFamilyPartFactory.php');
require_once(__DIR__ . '/src/Factory/ExtendedFamilyPart.php');
require_once(__DIR__ . '/src/Factory/Objects/ExtendedFamilySupport.php');
Expand All @@ -99,6 +100,7 @@
require_once(__DIR__ . '/src/Factory/ExtendedFamilyParts/Children_in_law.php');
require_once(__DIR__ . '/src/Factory/ExtendedFamilyParts/Grandchildren.php');
require_once(__DIR__ . '/src/Factory/ExtendedFamilyParts/Grandchildren_in_law.php');
*/

/**
* class ExtendedFamily
Expand Down
40 changes: 16 additions & 24 deletions ExtendedFamilyTabModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
/*
* webtrees - extended family tab
*
* based on vytux_cousins and simpl_cousins
*
* Copyright (C) 2021 Hermann Hartenthaler. All rights reserved.
* Copyright (C) 2013 Vytautas Krivickas and vytux.com. All rights reserved.
* Copyright (C) 2013 Nigel Osborne and kiwtrees.net. All rights reserved.
Expand All @@ -28,8 +26,12 @@
/*
* tbd
* ---
* Code: autoloader wieder aktivieren und alle require_once eliminieren?
* Code: Anpassungen an Bootstrap 5 (filter-Buttons) und webtrees 2.1 (neue Testumgebung aufsetzen)
* Code: Anpassungen an Bootstrap 5 (filter-Buttons)
* Code: alle Family Objekte explizit als Family deklarieren
* Code: alle array-Deklarationen mit <index, value> deklarieren
* Code: alle überflüssigen require_once Kommentare entfernen
* Code: In der Zusammenfassung weitere Informationen anzeigen
* (Generationen von/bis, früheste/späteste Geburt, Anzahl m/w/u, Anzahl lebend/tod, ...)
* Code: Beziehungsbezeichnungen als Label aus Vesta-Relationship oder durch eigene Funktion ergänzen?
* Code: Funktionen getSizeThumbnailW() und getSizeThumbnailH() verbessern (siehe issue #46 von Sir Peter)
* Gibt es einen Zusammenhang oder sind sie unabhängig? Wie genau wirken sie sich aus?
Expand All @@ -40,11 +42,6 @@
* Code: restliche, verstreut vorkommenden Übersetzungen mit I18N alle nach tab.html verschieben
* Code: Iterate-Pattern für Umgang mit groups implementieren?
* Code: alle noch verwendeten object als Klassen definieren?
*
* neue Idee: Statistikfunktion zur Ermittlung der längsten und der umfangreichsten Heiratsketten in einem Tree
* neue Idee: Liste der Spitzenahnen
* neue Idee: Kette zum entferntesten Vorfahren
* neue Idee: Kette zum entferntesten Nachkommen
*/

declare(strict_types=1);
Expand Down Expand Up @@ -73,10 +70,6 @@
use function count;
use function in_array;

require_once(__DIR__ . '/ExtendedFamily.php');
require_once(__DIR__ . '/src/Factory/Objects/ExtendedFamilySupport.php');
require_once(__DIR__ . '/ExtendedFamilyPersonExists.php');

/**
* Class ExtendedFamilyTabModule
*/
Expand All @@ -95,7 +88,7 @@ class ExtendedFamilyTabModule extends AbstractModule
public const CUSTOM_DESCRIPTION = 'A tab showing the extended family of an individual.';
public const CUSTOM_AUTHOR = 'Hermann Hartenthaler';
public const CUSTOM_WEBSITE = 'https://github.com/hartenthaler/' . self::CUSTOM_MODULE . '/';
public const CUSTOM_VERSION = '2.0.16.58';
public const CUSTOM_VERSION = '2.1.0.1';
public const CUSTOM_LAST = 'https://github.com/hartenthaler/' .
self::CUSTOM_MODULE. '/raw/main/latest-version.txt';

Expand Down Expand Up @@ -187,7 +180,7 @@ public static function VestaModulesAvailable(bool $showErrorMessage): bool
* generate list of other preferences
* (control panel options beside the options related to the extended family parts itself)
*
* @return array of string
* @return array<int, string>
*/
private function listOfOtherPreferences(): array
{
Expand Down Expand Up @@ -220,7 +213,7 @@ public function getAdminAction(ServerRequestInterface $request): ResponseInterfa
$response['description'] = $this->description();
$response['uses_sorting'] = true;

return $this->viewResponse($this->name() . '::settings', $response);
return $this->viewResponse($this->name() . '::' . 'settings', $response);
}

/**
Expand Down Expand Up @@ -510,11 +503,13 @@ public function isGrayedOut(Individual $individual): bool
{
return !$this->personExistsInExtendedFamily($individual);
}

/**
* Where are the CCS specifications for this module stored?
*
* @return ResponseInterface
*
* @throws \JsonException
*/
function getCssAction() : ResponseInterface
{
Expand All @@ -529,10 +524,9 @@ function getCssAction() : ResponseInterface
public function getTabContent(Individual $individual): string
{
/*return view($this->name() . '::test.blade', ['title'=>'Laravel Blade Example']);*/
return view($this->name() . '::tab', [
return view($this->name() . '::' . 'tab', [
'extfam_obj' => $this->getExtendedFamily($individual),
'extended_family_css' => route('module', ['module' => $this->name(), 'action' => 'Css']),
'module_obj' => $this,
]);
}

Expand Down Expand Up @@ -569,15 +563,13 @@ public function boot(): void
* additional translations
*
* @param string $language
* @return array of string
* @return array<string, string>
*/
public function customTranslations(string $language): array
{
// Here we are using an array for translations.
// If you had .MO files, you could use them with: return (new Translation('path/to/file.mo'))->asArray();

require_once($this->resourcesFolder() . 'lang/ExtendedFamilyTranslations.php');

switch ($language) {
case 'cs':
return ExtendedFamilyTranslations::czechTranslations();
Expand All @@ -591,7 +583,7 @@ public function customTranslations(string $language): array
return ExtendedFamilyTranslations::finnishTranslations(); // tbd
case 'fr':
case 'fr-CA':
return ExtendedFamilyTranslations::frenchTranslations(); // tbd
return ExtendedFamilyTranslations::frenchTranslations();
case 'he':
return ExtendedFamilyTranslations::hebrewTranslations(); // tbd
case 'hi':
Expand All @@ -601,7 +593,7 @@ public function customTranslations(string $language): array
case 'lt':
return ExtendedFamilyTranslations::lithuanianTranslations(); // tbd
case 'nb':
return ExtendedFamilyTranslations::norwegianBokmålTranslations(); // tbd
return ExtendedFamilyTranslations::norwegianBokmålTranslations();
case 'nl':
return ExtendedFamilyTranslations::dutchTranslations();
case 'nn':
Expand Down
14 changes: 14 additions & 0 deletions autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

namespace Hartenthaler\Webtrees\Module\ExtendedFamily;

use Composer\Autoload\ClassLoader;

$loader = new ClassLoader();
$loader->addPsr4('Hartenthaler\\Webtrees\\Module\\ExtendedFamily\\', __DIR__);
$loader->addPsr4('Hartenthaler\\Webtrees\\Module\\ExtendedFamily\\', __DIR__ . '/resources/lang');
$loader->addPsr4('Hartenthaler\\Webtrees\\Module\\ExtendedFamily\\', __DIR__ . '/src');
$loader->addPsr4('Hartenthaler\\Webtrees\\Module\\ExtendedFamily\\', __DIR__ . '/src/Factory');
$loader->addPsr4('Hartenthaler\\Webtrees\\Module\\ExtendedFamily\\', __DIR__ . '/src/Factory/Objects');
$loader->addPsr4('Hartenthaler\\Webtrees\\Module\\ExtendedFamily\\', __DIR__ . '/src/Factory/ExtendedFamilyParts');
$loader->register();
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion latest-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.16.58
2.1.0.1
6 changes: 6 additions & 0 deletions module.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* webtrees - extended family tab
*
Expand Down Expand Up @@ -29,6 +30,8 @@
if (defined("WT_MODULES_DIR")) {
// this is a webtrees 2.x module; it cannot be used with webtrees 1.x. See README.md.
return;
} else {
$modulesPath = Webtrees::MODULES_PATH;
}

// add our own dependencies if necessary
Expand All @@ -38,6 +41,9 @@
// so we aren't loading 'too much' here.
// DO NOT USE $file HERE! see Module.loadModule($file) - we must not change that var!

foreach (glob(Webtrees::ROOT_DIR . $modulesPath . '*/autoload.php') as $autoloadFile) {
require_once $autoloadFile;
}
require_once(__DIR__ . '/ExtendedFamilyTabModule.php');

return app(ExtendedFamilyTabModule::class);
13 changes: 8 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)

![webtrees major version](https://img.shields.io/badge/webtrees-v2.0.x-green)
![webtrees major version](https://img.shields.io/badge/webtrees-v2.1.x-green)

[![Maintainability](https://api.codeclimate.com/v1/badges/0f3951ce4532e3837215/maintainability)](https://codeclimate.com/github/hartenthaler/hh_extended_family/maintainability)
![Latest Release](https://img.shields.io/github/v/release/hartenthaler/hh_extended_family)
Expand Down Expand Up @@ -73,24 +74,26 @@ The default presentation sequence of the extended family parts is oriented at th
## Screenshots

Screenshot of tab using the compact design
<p align="center"><img src="resources/docu/screenshot.png" alt="Screenshot of tab" align="center" width="80%"></p>
<p align="center"><img src="docs/screenshot.png" alt="Screenshot of tab" align="center" width="80%"></p>

Screenshot showing photo as well as birth and death information
<p align="center"><img src="resources/docu/screenshot_full.png" alt="Screenshot showing photo as well as birth and death information" align="center" width="85%"></p>
<p align="center"><img src="docs/screenshot_full.png" alt="Screenshot showing photo as well as birth and death information" align="center" width="85%"></p>

Screenshot showing chain of partners (partner of partner of partner of ...)
<p align="center"><img src="resources/docu/screenshot_partner_chain.png" alt="Screenshot showing chain of partners" align="center" width="85%"></p>
<p align="center"><img src="docs/screenshot_partner_chain.png" alt="Screenshot showing chain of partners" align="center" width="85%"></p>

Screenshot of control panel menu
<p align="center"><img src="resources/docu/screenshot_control_panel.png" alt="Screenshot of control panel menu" align="center" width="85%"></p>
<p align="center"><img src="docs/screenshot_control_panel.png" alt="Screenshot of control panel menu" align="center" width="85%"></p>

<a name="requirements"></a>
## Requirements

This module requires **webtrees** version 2.0 or later.
This module has the same requirements as [webtrees#system-requirements](https://github.com/fisharebest/webtrees#system-requirements).

This module was tested with **webtrees** 2.0.17 version and all available themes and all other custom modules.
This module was tested with **webtrees** 2.0.19 version
and all available themes and all other custom modules.
It can be used with the 2.1.0-alpha.1 version, too.

<a name="installation"></a>
## Installation
Expand Down
Loading

0 comments on commit b0a3973

Please sign in to comment.