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

"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a21a3668c0b2_38223e41440239@gitlab-sidekiq-low-urgency-cpu-bound-v2-58c8bf65fd-zp9tb.mail>

ushindi bienvenu pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
0194046d by MAGENE Sem Joel at 2026-06-04T15:51:43+00:00
[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

- - - - -


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">
@@ -282,7 +282,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
=====================================
@@ -115,7 +115,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/0194046dfae31d1d86a75f3ba1f126b4ece78814

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/0194046dfae31d1d86a75f3ba1f126b4ece78814
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.