mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-12-02 21:39:11 -05:00
Follow-up to #9079. ## Summary - Ignore empty categories when sizing the export feed selector. - Keep the selector height aligned with the category headings and feeds that are actually rendered. - Preserve the grouped export choices and export request format introduced in #9079. ## Root cause The view skipped categories without feeds when rendering `<optgroup>` elements, but the `size` calculation counted every category returned by the DAO. Empty categories therefore increased the listbox height without adding any visible content. ## Before / After | Before | After | | --- | --- | | <img width="1400" height="1000" alt="9079-followup-before-1400x1000" src="https://github.com/user-attachments/assets/f225d97f-8486-4e7d-87eb-cdafd42b53a5" /> | <img width="1400" height="1000" alt="9079-followup-after-1400x1000" src="https://github.com/user-attachments/assets/aeb254e0-6410-4f6f-a0d8-3051c5dd2c83" /> | | `size="10"` for two category headings and two feeds, leaving unnecessary empty space. | `size="4"` for the same data, matching the four rendered rows. |
116 lines
4.1 KiB
PHTML
116 lines
4.1 KiB
PHTML
<?php
|
|
declare(strict_types=1);
|
|
/** @var FreshRSS_View $this */
|
|
$this->partial('aside_subscription');
|
|
?>
|
|
<main class="post ">
|
|
<h1><?= _t('sub.menu.import_export') ?></h1>
|
|
|
|
<h2><?= _t('sub.category.dynamic_opml') ?></h2>
|
|
<div class="form-group form-actions">
|
|
<div class="group-controls">
|
|
<ul>
|
|
<li><a href="<?= _url('subscription', 'add') ?>"><?= _t('sub.title.add_dynamic_opml') ?> <?= _i('opml-dyn') ?></a></li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<h2><?= _t('sub.import_export.import') ?></h2>
|
|
<form method="post" action="<?= _url('importExport', 'import') ?>" enctype="multipart/form-data" data-auto-leave-validation="1">
|
|
<input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
|
|
<div class="form-group">
|
|
<label class="group-name" for="file">
|
|
<?= extension_loaded('zip') ? _t('sub.import_export.file_to_import') : _t('sub.import_export.file_to_import_no_zip') ?>
|
|
</label>
|
|
<div class="group-controls">
|
|
<input type="file" name="file" id="file" />
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group form-actions">
|
|
<div class="group-controls">
|
|
<button type="submit" class="btn btn-important"><?= _t('gen.action.import') ?></button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
|
|
<h2><?= _t('sub.import_export.export') ?></h2>
|
|
<?php if ($this->feedCount > 0) { ?>
|
|
<form method="post" action="<?= _url('importExport', 'export') ?>" data-auto-leave-validation="1">
|
|
<input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
|
|
<div class="form-group">
|
|
<div class="group-controls">
|
|
<label class="checkbox" for="export_opml">
|
|
<input type="checkbox" name="export_opml" id="export_opml" value="1" checked="checked" />
|
|
<?= _t('sub.import_export.export_opml') ?>
|
|
</label>
|
|
|
|
<label class="checkbox" for="export_labelled">
|
|
<input type="checkbox" name="export_labelled" id="export_labelled" value="1" <?= extension_loaded('zip') ? 'checked="checked"' : '' ?> />
|
|
<?= _t('sub.import_export.export_labelled') ?>
|
|
</label>
|
|
|
|
<label class="checkbox" for="export_starred">
|
|
<input type="checkbox" name="export_starred" id="export_starred" value="1" <?= extension_loaded('zip') ? 'checked="checked"' : '' ?> />
|
|
<?= _t('sub.import_export.export_starred') ?>
|
|
</label>
|
|
|
|
<?php
|
|
$select_args = '';
|
|
if (extension_loaded('zip')) {
|
|
$select_args = ' size="' . min(10, count($this->categories) + $this->feedCount) . '" multiple="multiple"';
|
|
}
|
|
?>
|
|
<select name="export_feeds[]"<?= $select_args ?>>
|
|
<?= extension_loaded('zip') ? '' : '<option></option>' ?>
|
|
<?php foreach ($this->categories as $category):
|
|
$feeds = $category->feeds();
|
|
?>
|
|
<optgroup label="<?= $category->name() ?>">
|
|
<?php foreach ($feeds as $feed) { ?>
|
|
<option value="<?= $feed->id() ?>"><?= $feed->name() ?></option>
|
|
<?php } ?>
|
|
</optgroup>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group form-actions">
|
|
<div class="group-controls">
|
|
<button type="submit" class="btn btn-important"><?= _t('gen.action.export') ?></button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<?php } ?>
|
|
|
|
<h2><?= _t('sub.import_export.export.sqlite') ?></h2>
|
|
<?php if (count($this->sqliteArchives ?? []) === 0): ?>
|
|
<p class="alert alert-warn">
|
|
<?= _t('gen.short.not_applicable') ?>
|
|
</p>
|
|
<?php else: ?>
|
|
<form method="post" action="<?= _url('importExport', 'sqlite') ?>">
|
|
<input type="hidden" name="_csrf" value="<?= FreshRSS_Auth::csrfToken() ?>" />
|
|
<div class="form-group">
|
|
<div class="group-controls">
|
|
<select name="sqlite">
|
|
<?php foreach ($this->sqliteArchives ?? [] as $sqliteArchive): ?>
|
|
<option value="<?= htmlspecialchars($sqliteArchive['name'], ENT_COMPAT, 'UTF-8') ?>">
|
|
<?= htmlspecialchars($sqliteArchive['name'], ENT_NOQUOTES, 'UTF-8') ?>
|
|
<small>(<?= format_bytes($sqliteArchive['size']) ?> · <?= date('c', $sqliteArchive['mtime']) ?>)</small>
|
|
</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="form-group form-actions">
|
|
<div class="group-controls">
|
|
<button type="submit" class="btn btn-important"><?= _t('gen.action.download') ?></button>
|
|
</div>
|
|
</div>
|
|
</form>
|
|
<?php endif; ?>
|
|
</main>
|