Skip to content

Commit

Permalink
Legal regulations updated
Browse files Browse the repository at this point in the history
  • Loading branch information
hartenthaler committed Jan 14, 2023
1 parent b0c5f69 commit d505aad
Show file tree
Hide file tree
Showing 11 changed files with 1,268 additions and 203 deletions.
934 changes: 934 additions & 0 deletions LegalNoticeFooterModule.php

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,17 @@ The webtrees admin can choose if the following additional parts should be shown
* image of the responsible person using the [Gravatar](https://gravatar.com/)
* list of contact persons for a tree (genealogical and technical)
* list of administrators of this site with their contact links
* chapter about "Legal Regulations" with several sections

The following parts are a first draft.
They are only available in German.
The administrator can enable or disable them, but the sequence cannot be chosen at the moment.
* show a chapter about "Datenschutzerklärung"
* show a chapter about "Rechtliche Regelungen"
Those sections can be reordered and individually enabled or disabled.
There are two styles provided for those sections: "I" style and "We" style,
depending on the number of website administrators.

It is intended to add more content to those two chapters
and to make them translatable.
The chapter "Datenschutzerklärung" is a first draft.
It is only available in German.
The administrator can enable or disable this chapter, but the sequence cannot be chosen at the moment.
It is intended to add more content to this chapter
and to make the content translatable.

<a name="screenshots"></a>
## Screenshots
Expand Down
6 changes: 3 additions & 3 deletions autoload.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

namespace Hartenthaler\Webtrees\Module\Imprint;;
namespace Hartenthaler\Webtrees\Module\LegalNotice;

use Composer\Autoload\ClassLoader;

$loader = new ClassLoader();
$loader->addPsr4('Hartenthaler\\Webtrees\\Module\\Imprint\\', __DIR__);
$loader->addPsr4('Hartenthaler\\Webtrees\\Module\\Imprint\\', __DIR__ . '/src');
$loader->addPsr4('Hartenthaler\\Webtrees\\Module\\LegalNotice\\', __DIR__);
$loader->addPsr4('Hartenthaler\\Webtrees\\Module\\LegalNotice\\', __DIR__ . DIRECTORY_SEPARATOR . 'src');
$loader->register();
2 changes: 1 addition & 1 deletion latest-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.15.2
2.1.15.3
6 changes: 4 additions & 2 deletions module.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
* along with this program; If not, see <https://www.gnu.org/licenses/>.
*/

namespace Hartenthaler\Webtrees\Module\Imprint;
declare(strict_types=1);

namespace Hartenthaler\Webtrees\Module\LegalNotice;

use Fisharebest\Webtrees\Webtrees;
use Illuminate\Support\Collection;
Expand Down Expand Up @@ -63,4 +65,4 @@
require_once $filename;
});

return app(ImprintFooterModule::class);
return app(LegalNoticeFooterModule::class);
7 changes: 3 additions & 4 deletions resources/views/footer.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

declare(strict_types=1);

use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\View;

/**
* @var string $title title of this footer element
* @var string $url link to Legal Notice
Expand All @@ -13,10 +16,6 @@ declare(strict_types=1);
* @var bool $cookiesWarning option whether a cookies warning should be shown
* @var string $cookiesMessage message that cookies are used
*/

use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\View;

?>

<div class="wt-footer wt-footer-custom hh-legal-notice text-center py-2">
Expand Down
237 changes: 99 additions & 138 deletions resources/views/page.phtml

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions resources/views/settings.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,55 @@ use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;

<p>&nbsp;</p>

<h3><?= I18N::translate('In which sequence should the sections of the chapter "Legal Regulations" be shown?') ?></h3>
<table class="table table-bordered wt-table-menu">
<thead>
<tr>
<th><?= I18N::translate('Section') ?></th>
<th class="text-center"><?= I18N::translate('Enabled') ?></th>
<th class="text-center"><?= I18N::translate('Move up') ?></th>
<th class="text-center"><?= I18N::translate('Move down') ?></th>
</tr>
</thead>

<tbody>
<?php foreach ($chapters as $chapter) : ?>
<?php if ($chapter->getLink() == 9 && $chapter->getLevel() == 2): ?>
<tr>
<th scope="col">
<input type="hidden" name="order[]" value="<?= $chapter->getKey() ?>">
<span title="<?= $chapter->getHeading() ?>">
<?= $chapter->getHeading() ?>
</span>
</th>

<td class="text-center">
<label class="d-block">
<input type="checkbox" name="status-<?= $chapter->getKey() ?>" id="status-<?= $chapter->getKey() ?>" <?= ($chapter->getEnabled()) ? 'checked' : '' ?>>
<span class="sr-only">
<?= I18N::translate('Enabled') ?>
</span>
</label>
</td>

<td class="move up text-center">
<a href="#" title="<?= I18N::translate('Move up') ?>">
<?= view('icons/arrow-up') ?>
</a>
</td>
<td class="move down text-center">
<a href="#" title="<?= I18N::translate('Move down') ?>">
<?= view('icons/arrow-down') ?>
</a>
</td>
</tr>
<?php endif ?>
<?php endforeach ?>
</tbody>
</table>

<p>&nbsp;</p>

<button type="submit" class="btn btn-primary">
<?= view('icons/save') ?>
<?= I18N::translate('save') ?>
Expand Down
74 changes: 51 additions & 23 deletions src/Chapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,9 @@
* along with this program; If not, see <https://www.gnu.org/licenses/>.
*/

namespace Hartenthaler\Webtrees\Module\Imprint;

/**
* class Chapter
*
*/
declare(strict_types=1);

namespace Hartenthaler\Webtrees\Module\LegalNotice;

/**
* class Chapter
Expand All @@ -42,12 +37,12 @@ class Chapter
/**
* @var object $chapter
* ->key string key
* ->id int unique chapter id // tbd kann vielleicht entfallen
* ->id int unique chapter id
* ->heading string translated chapter heading
* ->level int level of heading (1=top level)
* ->link int link to id of next higher level
* ->enabled bool chapter should be shown
* ->content string content of this chapter
* ->enabled bool true if chapter should be shown
* ->content string content of this chapter (used if contentIWe is false)
*/
private object $chapter;

Expand All @@ -56,13 +51,14 @@ class Chapter
/**
* construct object
*
* @param string $key
* @param int $id
* @param string $heading
* @param int $level
* @param int $link
* @param bool $enabled
* @param string $content
* @param string $key
* @param int $id
* @param string $heading
* @param int $level
* @param int $link
* @param bool $enabled
* @param bool $contentIWe
* @param array<string> $content list of paragraphs
*/
public function __construct
(
Expand All @@ -72,7 +68,8 @@ public function __construct
int $level,
int $link,
bool $enabled,
string $content
bool $contentIWe,
array $content
)
{
$this->chapter = (object)[];
Expand All @@ -82,6 +79,7 @@ public function __construct
$this->chapter->level = $level;
$this->chapter->link = $link;
$this->chapter->enabled = $enabled;
$this->chapter->contentIWe = $contentIWe;
$this->chapter->content = $content;
}

Expand All @@ -105,6 +103,16 @@ public function getKey(): string
return $this->chapter->key;
}

/**
* get id of chapter
*
* @return int
*/
public function getId(): int
{
return $this->chapter->id;
}

/**
* get level of chapter (1=top level)
*
Expand All @@ -116,22 +124,42 @@ public function getLevel(): int
}

/**
* get chapter heading
* get link of this chapter to next higher hierarchy id
*
* @return string
* @return int
*/
public function getHeading(): string
public function getLink(): int
{
return $this->chapter->heading;
return $this->chapter->link;
}

/**
* get chapter content (list of paragraphs)
*
* @return array
*/
public function getContent(): array
{
return $this->chapter->content;
}

/**
* get chapter enabling status
*
* @return string
* @return bool
*/
public function getEnabled(): bool
{
return $this->chapter->enabled;
}

/**
* get chapter heading
*
* @return string
*/
public function getHeading(): string
{
return $this->chapter->heading;
}
}
6 changes: 4 additions & 2 deletions src/ContactsList.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

declare(strict_types=1);

namespace Hartenthaler\Webtrees\Module\Imprint;
namespace Hartenthaler\Webtrees\Module\LegalNotice;

use Fisharebest\Webtrees\Module\ContactsFooterModule;
use Fisharebest\Webtrees\Services\UserService;
Expand Down Expand Up @@ -126,13 +126,15 @@ private function findTreeContacts(UserService $userService, ServerRequestInterfa
private function findAdministrators(UserService $userService, ServerRequestInterface $request): void
{
$this->administratorsList = [];
$administrators = $userService->administrators(); // Collection<int,User>
$administrators = $userService->administrators(); // Collection<int,User>
foreach ($administrators as $admin) {
$administrator = (object)[];

$administrator->userId = $admin->id();
$administrator->realName = $admin->realName();
$administrator->email = $admin->email();
$administrator->contact = $userService->contactLink($admin, $request);

$this->administratorsList[] = $administrator;
}
}
Expand Down
Loading

0 comments on commit d505aad

Please sign in to comment.