diff --git a/src/packages/com_mokobackup/forms/profile.xml b/src/packages/com_mokobackup/forms/profile.xml index 123e01c..5c3fd2d 100644 --- a/src/packages/com_mokobackup/forms/profile.xml +++ b/src/packages/com_mokobackup/forms/profile.xml @@ -124,7 +124,7 @@
+ * @copyright Copyright (C) 2026 Moko Consulting. All rights reserved. + * @license GNU General Public License version 3 or later; see LICENSE + * + * Interactive directory tree field with checkboxes for exclude/include filtering. + * Loads the directory tree from the server via AJAX (browseDir endpoint). + */ + +namespace Joomla\Component\MokoBackup\Administrator\Field; + +defined('_JEXEC') or die; + +use Joomla\CMS\Form\FormField; +use Joomla\CMS\Language\Text; + +class DirectoryFilterField extends FormField +{ + protected $type = 'DirectoryFilter'; + + protected function getInput(): string + { + $id = htmlspecialchars($this->id, ENT_QUOTES, 'UTF-8'); + $name = htmlspecialchars($this->name, ENT_QUOTES, 'UTF-8'); + $mode = htmlspecialchars((string) ($this->element['mode'] ?? 'exclude'), ENT_QUOTES, 'UTF-8'); + + // Parse current values (newline-separated) + $items = []; + + if (!empty($this->value)) { + $items = array_values(array_filter(array_map('trim', explode("\n", str_replace("\r", '', $this->value))))); + } + + $itemsJson = json_encode($items); + $jRoot = json_encode(JPATH_ROOT); + + $labelExclude = Text::_('COM_MOKOBACKUP_FILTER_EXCLUDED'); + $labelInclude = Text::_('COM_MOKOBACKUP_FILTER_INCLUDED'); + $labelManual = Text::_('COM_MOKOBACKUP_FILTER_ADD_MANUAL'); + $addLabel = Text::_('JGLOBAL_FIELD_ADD'); + $placeholder = htmlspecialchars((string) ($this->element['hint'] ?? 'path/to/directory'), ENT_QUOTES, 'UTF-8'); + + return << + + + +
+ + +
+ + +
+ + +
+
+ + +
+
+
+ + + + + +HTML; + } +}