19dce578dSGreg Roach<?php 29dce578dSGreg Roach 39dce578dSGreg Roach/** 49dce578dSGreg Roach * webtrees: online genealogy 5*d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 69dce578dSGreg Roach * This program is free software: you can redistribute it and/or modify 79dce578dSGreg Roach * it under the terms of the GNU General Public License as published by 89dce578dSGreg Roach * the Free Software Foundation, either version 3 of the License, or 99dce578dSGreg Roach * (at your option) any later version. 109dce578dSGreg Roach * This program is distributed in the hope that it will be useful, 119dce578dSGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 129dce578dSGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 139dce578dSGreg Roach * GNU General Public License for more details. 149dce578dSGreg Roach * You should have received a copy of the GNU General Public License 1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 169dce578dSGreg Roach */ 179dce578dSGreg Roach 189dce578dSGreg Roachdeclare(strict_types=1); 199dce578dSGreg Roach 209dce578dSGreg Roachnamespace Fisharebest\Webtrees\Http\RequestHandlers; 219dce578dSGreg Roach 229dce578dSGreg Roachuse Fisharebest\Webtrees\Auth; 239dce578dSGreg Roachuse Fisharebest\Webtrees\Http\ViewResponseTrait; 249dce578dSGreg Roachuse Fisharebest\Webtrees\I18N; 259dce578dSGreg Roachuse Fisharebest\Webtrees\Registry; 26b55cbc6bSGreg Roachuse Fisharebest\Webtrees\Validator; 279dce578dSGreg Roachuse Psr\Http\Message\ResponseInterface; 289dce578dSGreg Roachuse Psr\Http\Message\ServerRequestInterface; 299dce578dSGreg Roachuse Psr\Http\Server\RequestHandlerInterface; 309dce578dSGreg Roach 319dce578dSGreg Roach/** 329dce578dSGreg Roach * Edit note objects. 339dce578dSGreg Roach */ 349dce578dSGreg Roachclass EditNotePage implements RequestHandlerInterface 359dce578dSGreg Roach{ 369dce578dSGreg Roach use ViewResponseTrait; 379dce578dSGreg Roach 389dce578dSGreg Roach /** 399dce578dSGreg Roach * Show a form to create a new note object. 409dce578dSGreg Roach * 419dce578dSGreg Roach * @param ServerRequestInterface $request 429dce578dSGreg Roach * 439dce578dSGreg Roach * @return ResponseInterface 449dce578dSGreg Roach */ 459dce578dSGreg Roach public function handle(ServerRequestInterface $request): ResponseInterface 469dce578dSGreg Roach { 47b55cbc6bSGreg Roach $tree = Validator::attributes($request)->tree(); 48b55cbc6bSGreg Roach $xref = Validator::attributes($request)->isXref()->string('xref'); 499dce578dSGreg Roach $note = Registry::noteFactory()->make($xref, $tree); 509dce578dSGreg Roach $note = Auth::checkNoteAccess($note, true); 519dce578dSGreg Roach 529dce578dSGreg Roach return $this->viewResponse('edit/shared-note', [ 539dce578dSGreg Roach 'note' => $note, 549dce578dSGreg Roach 'title' => I18N::translate('Edit the shared note'), 559dce578dSGreg Roach 'tree' => $tree, 569dce578dSGreg Roach ]); 579dce578dSGreg Roach } 589dce578dSGreg Roach} 59