xref: /webtrees/resources/views/admin/gedcom-export-options.phtml (revision 10e0649788c8d7d4974d81c048ca2b225df8f22e)
11c6adce8SGreg Roach<?php
21c6adce8SGreg Roach
3*10e06497SGreg Roachdeclare(strict_types=1);
4*10e06497SGreg Roach
51c6adce8SGreg Roachuse Fisharebest\Webtrees\Auth;
61c6adce8SGreg Roachuse Fisharebest\Webtrees\Encodings\ANSEL;
71c6adce8SGreg Roachuse Fisharebest\Webtrees\Encodings\ASCII;
81c6adce8SGreg Roachuse Fisharebest\Webtrees\Encodings\UTF16BE;
91c6adce8SGreg Roachuse Fisharebest\Webtrees\Encodings\UTF8;
101c6adce8SGreg Roachuse Fisharebest\Webtrees\I18N;
1136779af1SGreg Roachuse Fisharebest\Webtrees\Tree;
1216ecfcafSGreg Roachuse Fisharebest\Webtrees\View;
1336779af1SGreg Roach
1436779af1SGreg Roach/**
1516ecfcafSGreg Roach * @var array<string> $download_filenames
1636779af1SGreg Roach * @var Tree          $tree
1716ecfcafSGreg Roach * @var bool          $zip_available
1836779af1SGreg Roach */
191c6adce8SGreg Roach
201c6adce8SGreg Roach?>
211c6adce8SGreg Roach
221c6adce8SGreg Roach<div class="row mb-3">
231c6adce8SGreg Roach    <label class="col-sm-3" for="format">
241c6adce8SGreg Roach        <?= I18N::translate('Format') ?>
251c6adce8SGreg Roach    </label>
261c6adce8SGreg Roach
271c6adce8SGreg Roach    <div class="col-sm-9">
281c6adce8SGreg Roach        <div class="form-check">
2916ecfcafSGreg Roach            <input class="form-check-input" type="radio" name="format" id="format-gedcom" value="gedcom" checked="checked" data-wt-extension=".ged">
301c6adce8SGreg Roach
311c6adce8SGreg Roach            <label class="form-check-label" for="format-gedcom">
321c6adce8SGreg Roach                <?= I18N::translate('GEDCOM') ?>
331c6adce8SGreg Roach            </label>
341c6adce8SGreg Roach        </div>
351c6adce8SGreg Roach
361c6adce8SGreg Roach        <div class="form-check">
3716ecfcafSGreg Roach            <input class="form-check-input" type="radio" name="format" id="format-zip" value="zip" data-wt-extension=".zip" <?= $zip_available ? '' : 'disabled="disabled"'?>>
381c6adce8SGreg Roach
391c6adce8SGreg Roach            <label class="form-check-label" for="format-zip">
4016ecfcafSGreg Roach                <?= /* I18N: ZIP = file format */ I18N::translate('ZIP') ?>
411c6adce8SGreg Roach            </label>
421c6adce8SGreg Roach        </div>
4316ecfcafSGreg Roach
4416ecfcafSGreg Roach        <div class="form-check">
4516ecfcafSGreg Roach            <input class="form-check-input" type="radio" name="format" id="format-zipmedia" value="zipmedia" data-wt-extension=".zip" <?= $zip_available ? '' : 'disabled="disabled"'?>>
4616ecfcafSGreg Roach
4716ecfcafSGreg Roach            <label class="form-check-label" for="format-zipmedia">
4816ecfcafSGreg Roach                <?= /* I18N: ZIP = file format */ I18N::translate('ZIP') ?>
4916ecfcafSGreg Roach                <?= I18N::translate('(includes media files)') ?>
5016ecfcafSGreg Roach            </label>
5116ecfcafSGreg Roach        </div>
5216ecfcafSGreg Roach
5316ecfcafSGreg Roach        <div class="form-check">
5416ecfcafSGreg Roach            <input class="form-check-input" type="radio" name="format" id="format-gdz" value="gedzip" data-wt-extension=".gdz" <?= $zip_available ? '' : 'disabled="disabled"'?>>
5516ecfcafSGreg Roach
5616ecfcafSGreg Roach            <label class="form-check-label" for="format-gdz">
5716ecfcafSGreg Roach                <?= /* I18N: GEDZIP = file format */ I18N::translate('GEDZIP') ?>
5816ecfcafSGreg Roach                <?= I18N::translate('(includes media files)') ?>
5916ecfcafSGreg Roach            </label>
6016ecfcafSGreg Roach        </div>
6116ecfcafSGreg Roach    </div>
6216ecfcafSGreg Roach</div>
6316ecfcafSGreg Roach
6416ecfcafSGreg Roach<div class="row mb-3">
6516ecfcafSGreg Roach    <label class="col-sm-3" for="filename">
6616ecfcafSGreg Roach        <?= I18N::translate('Filename') ?>
6716ecfcafSGreg Roach    </label>
6816ecfcafSGreg Roach
6916ecfcafSGreg Roach    <div class="col-sm-9">
7016ecfcafSGreg Roach        <div class="input-group">
7116ecfcafSGreg Roach            <?= view('components/select', ['name' => 'filename', 'id' => 'filename', 'selected' => 0, 'options' => $download_filenames]) ?>
7216ecfcafSGreg Roach            <span class="input-group-text" id="extension">.ged</span>
7316ecfcafSGreg Roach        </div>
741c6adce8SGreg Roach    </div>
751c6adce8SGreg Roach</div>
761c6adce8SGreg Roach
771c6adce8SGreg Roach<div class="row mb-3">
781c6adce8SGreg Roach    <label class="col-sm-3" for="encoding">
791c6adce8SGreg Roach        <?= I18N::translate('Character encoding') ?>
801c6adce8SGreg Roach    </label>
811c6adce8SGreg Roach
821c6adce8SGreg Roach    <div class="col-sm-9">
831c6adce8SGreg Roach        <?= view('components/select', ['name' => 'encoding', 'id' => 'encoding', 'selected' => UTF8::NAME, 'options' => [UTF8::NAME => 'UTF-8', UTF16BE::NAME => 'UNICODE (UTF16-BE)', ANSEL::NAME => 'ANSEL', ASCII::NAME => 'ASCII', 'CP1252' => 'ANSI (CP1252)']]) ?>
841c6adce8SGreg Roach    </div>
851c6adce8SGreg Roach</div>
861c6adce8SGreg Roach
871c6adce8SGreg Roach<div class="row mb-3">
881c6adce8SGreg Roach    <label class="col-sm-3" for="line_endings">
891c6adce8SGreg Roach        <?= I18N::translate('Line endings') ?>
901c6adce8SGreg Roach    </label>
911c6adce8SGreg Roach
921c6adce8SGreg Roach    <div class="col-sm-9">
931c6adce8SGreg Roach        <?= view('components/radios-inline', ['name' => 'line_endings', 'options' => ['CRLF' => 'CR/LF (windows)', 'LF' => 'LF (unix)'], 'selected' => 'CRLF']) ?>
941c6adce8SGreg Roach    </div>
951c6adce8SGreg Roach</div>
961c6adce8SGreg Roach
971c6adce8SGreg Roach<div class="row mb-3">
981c6adce8SGreg Roach    <label class="col-sm-3" for="privacy">
991c6adce8SGreg Roach        <?= I18N::translate('Apply privacy settings') ?>
1001c6adce8SGreg Roach    </label>
1011c6adce8SGreg Roach
1021c6adce8SGreg Roach    <div class="col-sm-9">
1031c6adce8SGreg Roach        <?php if (Auth::isAdmin()) : ?>
1041c6adce8SGreg Roach            <?= view('components/radios-inline', ['name' => 'privacy', 'options' => ['none' => I18N::translate('None'), 'gedadmin' => I18N::translate('Manager'), 'user' => I18N::translate('Member'), 'visitor' => I18N::translate('Visitor')], 'selected' => 'none']) ?>
1051c6adce8SGreg Roach        <?php elseif (Auth::isManager($tree)) : ?>
1061c6adce8SGreg Roach            <?= view('components/radios-inline', ['name' => 'privacy', 'options' => ['gedadmin' => I18N::translate('Manager'), 'user' => I18N::translate('Member'), 'visitor' => I18N::translate('Visitor')], 'selected' => 'gedadmin']) ?>
1071c6adce8SGreg Roach        <?php elseif (Auth::isMember($tree)) : ?>
1081c6adce8SGreg Roach            <?= view('components/radios-inline', ['name' => 'privacy', 'options' => ['user' => I18N::translate('Member'), 'visitor' => I18N::translate('Visitor')], 'selected' => 'user']) ?>
1091c6adce8SGreg Roach        <?php else : ?>
1101c6adce8SGreg Roach            <input type="hidden" name="privacy" value="visitor">
1111c6adce8SGreg Roach        <?php endif ?>
1121c6adce8SGreg Roach    </div>
1131c6adce8SGreg Roach</div>
1141c6adce8SGreg Roach
11516ecfcafSGreg Roach<?php View::push('javascript') ?>
11616ecfcafSGreg Roach<script>
11716ecfcafSGreg Roach  'use strict';
11816ecfcafSGreg Roach
11916ecfcafSGreg Roach  document.querySelectorAll('[name=format]').forEach(element => element.addEventListener('change', event => document.getElementById('extension').innerText = event.target.dataset.wtExtension));
12016ecfcafSGreg Roach
12116ecfcafSGreg Roach  // Firefox will reload the page and change the selected item.
12216ecfcafSGreg Roach  document.getElementById('extension').innerText = document.querySelector('[name=format]:checked').dataset.wtExtension;
12316ecfcafSGreg Roach
12416ecfcafSGreg Roach</script>
12516ecfcafSGreg Roach<?php View::endpush(); ?>
126