[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [BP][FIX][UI] File galleries: fix direct mapping adapter field toggling and save integrity

"MAGENE Sem Joel \(@Jomagene\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a23d82cdae6_376348c707643@gitlab-sidekiq-low-urgency-cpu-bound-v2-7bd4cd44c6-pqvsr.mail>

MAGENE Sem Joel pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
18b95dc3 by MAGENE Sem Joel at 2026-06-06T08:12:57+00:00
[BP][FIX][UI] File galleries: fix direct mapping adapter field toggling and save integrity
---
* [BP][FIX][UI] File galleries: fix direct mapping adapter field toggling and save integrity
---
* [FIX][UI] File galleries: fix direct mapping adapter field toggling and save integrity
---
* [FIX][UI] File galleries: fix direct mapping adapter field toggling and save integrity

See merge request tikiwiki/tiki!10417

(cherry picked from commit 0194046dfae31d1d86a75f3ba1f126b4ece78814)

See merge request tikiwiki/tiki!10454

(cherry picked from commit 344c4ca24843938c3b662b792dae942f4ce48337)

See merge request tikiwiki/tiki!10455

- - - - -


3 changed files:

- lib/jquery_tiki/files.js
- templates/edit_file_gallery.tpl
- tiki-list_file_gallery.php


Changes:

=====================================
lib/jquery_tiki/files.js
=====================================
@@ -602,15 +602,25 @@
     }));
 
     $(document).on('change', '#fgal_type', function () {
-        $(this).closest('form').find('.fgal_type_dependent').hide();
-        $(this).closest('form').find('.fgal_type_dependent.' + $(this).val() + '_childcontainer').show();
-        $('#direct_adapter').trigger('change');
+        var $type = $(this),
+            $form = $type.closest('form');
+
+        $form.find('.fgal_type_dependent').hide();
+        $form.find('.fgal_type_dependent.' + $type.val() + '_childcontainer').show();
+        $form.find('#direct_adapter').trigger('change');
     });
     $(document).on('change', '#direct_adapter', function () {
-        $(this).closest('form').find('.direct_adapter_dependent').hide();
-        if ($(this).is(':visible')) {
-            $(this).closest('form').find('.direct_adapter_dependent.' + $(this).val() + '_childcontainer').show();
+        var $adapter = $(this),
+            $form = $adapter.closest('form'),
+            $directContainer = $adapter.closest('.fgal_type_dependent.direct_childcontainer');
+
+        $form.find('.direct_adapter_dependent').hide();
+
+        if ($directContainer.length && ! $directContainer.is(':visible')) {
+            return;
         }
+
+        $form.find('.direct_adapter_dependent.' + $adapter.val() + '_childcontainer').show();
     });
 
     $(document).ready(function() {


=====================================
templates/edit_file_gallery.tpl
=====================================
@@ -61,7 +61,7 @@ if ($(this).val() != '') {
                 <div class="tiki-form-group row">
                     <label for="fgal_type" class="col-sm-4 col-form-label">{tr}Type{/tr}</label>
                     <div class="col-sm-8">
-                        {if $galleryId eq $treeRootId or $gal_info.type eq 'user' or $gal_info.type eq 'attachments' or ($gal_info.type eq 'direct' and ($gal_info.direct.adapter eq 'inherit' or $gal_info.direct.adapter eq ''))}
+                        {if $galleryId eq $treeRootId or $gal_info.type eq 'user' or $gal_info.type eq 'attachments' or ($gal_info.type eq 'direct' and $gal_info.direct.adapter eq 'inherit')}
                             {if $gal_info.type eq 'system'}
                                 {tr}System{/tr}
                             {elseif $gal_info.type eq 'user'}
@@ -82,7 +82,7 @@ if ($(this).val() != '') {
                         {/if}
                     </div>
                 </div>
-                {if $tiki_p_admin eq 'y' and not ($gal_info.type eq 'direct' and ($gal_info.direct.adapter eq 'inherit' or $gal_info.direct.adapter eq ''))}
+                {if $tiki_p_admin eq 'y' and not ($gal_info.type eq 'direct' and $gal_info.direct.adapter eq 'inherit')}
                 <fieldset class="fgal_type_dependent direct_childcontainer" {if $gal_info.type neq 'direct'}style="display:none"{/if}>
                     <legend>{tr}Direct mapping settings{/tr}</legend>
                     <div class="tiki-form-group row">
@@ -267,7 +267,7 @@ if ($(this).val() != '') {
                             </div>
                         </div>
                     </div>
-                    {if $galleryId neq $treeRootId and not ($gal_info.type eq 'direct' and ($gal_info.direct.adapter eq 'inherit' or $gal_info.direct.adapter eq ''))}
+                    {if $galleryId neq $treeRootId and not ($gal_info.type eq 'direct' and $gal_info.direct.adapter eq 'inherit')}
                         <div class="tiki-form-group row">
                             <label for="parentId" class="col-sm-4 col-form-label">{tr}Parent gallery{/tr}</label>
                             <div class="col-sm-8">


=====================================
tiki-list_file_gallery.php
=====================================
@@ -111,7 +111,9 @@ $inputConfiguration = [
         ],
         'staticKeyFiltersForArrays' => [
             'cat_categories' => 'digits',
-            'direct'         => 'digits',
+            // Direct mapping contains adapter/path/credentials, so a digits-only
+            // filter would corrupt values like "local" or "/tmp/data".
+            'direct'         => 'text',
             'ocr_lang'       => 'text',
         ],
     ],



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/18b95dc3643e12c363cb42af26a5a1d3282a2907

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/18b95dc3643e12c363cb42af26a5a1d3282a2907
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.