Skip to content

Commit 34c8190

Browse files
committed
Fix: #4465 - increase limit on generations in charts
1 parent 52e8ff1 commit 34c8190

File tree

8 files changed

+20
-17
lines changed

8 files changed

+20
-17
lines changed

app/Module/AncestorsChartModule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class AncestorsChartModule extends AbstractModule implements ModuleChartInterfac
5555

5656
// Limits
5757
protected const int MINIMUM_GENERATIONS = 2;
58-
protected const int MAXIMUM_GENERATIONS = 10;
58+
protected const int MAXIMUM_GENERATIONS = PHP_INT_SIZE === 4 ? 31 : 63;
5959

6060
private ChartService $chart_service;
6161

app/Module/DescendancyChartModule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class DescendancyChartModule extends AbstractModule implements ModuleChartInterf
5555

5656
// Limits
5757
protected const int MINIMUM_GENERATIONS = 2;
58-
protected const int MAXIMUM_GENERATIONS = 10;
58+
protected const int MAXIMUM_GENERATIONS = PHP_INT_SIZE === 4 ? 31 : 63;
5959

6060
private ChartService $chart_service;
6161

app/Module/FamilyBookChartModule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class FamilyBookChartModule extends AbstractModule implements ModuleChartInterfa
5353
protected const int MAXIMUM_BOOK_SIZE = 5;
5454

5555
protected const int MINIMUM_GENERATIONS = 2;
56-
protected const int MAXIMUM_GENERATIONS = 10;
56+
protected const int MAXIMUM_GENERATIONS = PHP_INT_SIZE === 4 ? 31 : 63;
5757

5858
/**
5959
* Initialization.

app/Module/HourglassChartModule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class HourglassChartModule extends AbstractModule implements ModuleChartInterfac
5252

5353
// Limits
5454
protected const int MINIMUM_GENERATIONS = 2;
55-
protected const int MAXIMUM_GENERATIONS = 10;
55+
protected const int MAXIMUM_GENERATIONS = PHP_INT_SIZE === 4 ? 31 : 63;
5656

5757
/**
5858
* Initialization.

app/Module/PedigreeMapModule.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
use function ucfirst;
4545
use function view;
4646

47+
use const PHP_INT_SIZE;
48+
4749
class PedigreeMapModule extends AbstractModule implements ModuleChartInterface, RequestHandlerInterface
4850
{
4951
use ModuleChartTrait;
@@ -58,7 +60,7 @@ class PedigreeMapModule extends AbstractModule implements ModuleChartInterface,
5860

5961
// Limits
6062
public const int MINIMUM_GENERATIONS = 1;
61-
public const int MAXIMUM_GENERATIONS = 10;
63+
public const int MAXIMUM_GENERATIONS = PHP_INT_SIZE === 4 ? 31 : 63;
6264

6365
// CSS colors for each generation
6466
protected const int COUNT_CSS_COLORS = 12;
@@ -192,14 +194,15 @@ public function handle(ServerRequestInterface $request): ResponseInterface
192194
]);
193195

194196
return $this->viewResponse('modules/pedigree-map/page', [
195-
'module' => $this->name(),
197+
'module' => $this->name(),
196198
/* I18N: %s is an individual’s name */
197-
'title' => I18N::translate('Pedigree map of %s', $individual->fullName()),
198-
'tree' => $tree,
199-
'individual' => $individual,
200-
'generations' => $generations,
201-
'maxgenerations' => self::MAXIMUM_GENERATIONS,
202-
'map' => $map,
199+
'title' => I18N::translate('Pedigree map of %s', $individual->fullName()),
200+
'tree' => $tree,
201+
'individual' => $individual,
202+
'generations' => $generations,
203+
'minimum_generations' => self::MINIMUM_GENERATIONS,
204+
'maximum_generations' => self::MAXIMUM_GENERATIONS,
205+
'map' => $map,
203206
]);
204207
}
205208

resources/views/modules/family-book-chart/page.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ use Fisharebest\Webtrees\Tree;
5050
<?= I18N::translate('Descendant generations') ?>
5151
</label>
5252
<div class="col-sm-9 wt-page-options-value">
53-
<?= view('components/select-number', ['name' => 'generations', 'selected' => $generations, 'options' => range($minimum_generations, $maximum_generations)]) ?>
53+
<input class="form-control" id="generations" name="generations" type="number" min="<?= e($minimum_generations) ?>" max="<?= e($maximum_generations) ?>" value="<?= e($generations) ?>" required="required">
5454
</div>
5555
</div>
5656

resources/views/modules/hourglass-chart/page.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use Fisharebest\Webtrees\Tree;
3838
<?= I18N::translate('Generations') ?>
3939
</label>
4040
<div class="col-sm-9 wt-page-options-value">
41-
<?= view('components/select-number', ['name' => 'generations', 'selected' => $generations, 'options' => range($minimum_generations, $maximum_generations)]) ?>
41+
<input class="form-control" id="generations" name="generations" type="number" min="<?= e($minimum_generations) ?>" max="<?= e($maximum_generations) ?>" value="<?= e($generations) ?>" required="required">
4242
</div>
4343
</div>
4444

resources/views/modules/pedigree-map/page.phtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ use Fisharebest\Webtrees\Tree;
1010
* @var int $generations
1111
* @var Individual $individual
1212
* @var string $map
13-
* @var int $maxgenerations
13+
* @var int $maximum_generations
14+
* @var int $minimum_generations
1415
* @var string $title
1516
* @var Tree $tree
1617
*/
@@ -34,7 +35,7 @@ use Fisharebest\Webtrees\Tree;
3435
<?= I18N::translate('Generations') ?>
3536
</label>
3637
<div class="col-sm-9 wt-page-options-value">
37-
<?= view('components/select-number', ['name' => 'generations', 'selected' => $generations, 'options' => range(2, $maxgenerations)]) ?>
38+
<input class="form-control" id="generations" name="generations" type="number" min="<?= e($minimum_generations) ?>" max="<?= e($maximum_generations) ?>" value="<?= e($generations) ?>" required="required">
3839
</div>
3940
</div>
4041

@@ -54,4 +55,3 @@ use Fisharebest\Webtrees\Tree;
5455
<div class="wt-ajax-load wt-page-content">
5556
<?= $map ?>
5657
</div>
57-

0 commit comments

Comments
 (0)