Quellcode durchsuchen

Ticket #3398 - Change search order.

AntonLV vor 4 Jahren
Ursprung
Commit
42634fe599

+ 33 - 20
inc/classes/BxDolTemplate.php

@@ -2968,28 +2968,41 @@ class BxDolTemplate extends BxDolFactory implements iBxDolSingleton
             }
         }
 
+        /** 
+         * Module(mod) related locations will be checked first in TMPL and BASE,
+         * then system(sys) location(s) will be checked in TMPL and BASE.
+         */
+        $aLocationsList = array_reverse($this->_aLocations, true);
+        $aLocationsGrouped = ['mod' => [], 'sys' => []];
+        foreach($aLocationsList as $sLocation => $aLocation) {
+            if($sLocation == 'system')
+                $aLocationsGrouped['sys'][$sLocation] = $aLocation;
+            else
+                $aLocationsGrouped['mod'][$sLocation] = $aLocation;
+        }
+
         $sResult = '';
-        $aLocations = array_reverse($this->_aLocations, true);
-
-        //--- Check it Template.
-        $bInSub = false;
-        $aCheckIn = [BX_DOL_TEMPLATE_CHECK_IN_BOTH, BX_DOL_TEMPLATE_CHECK_IN_TMPL];
-        if(in_array($sCheckIn, $aCheckIn) || $bInSub = (isset($sCheckIn['in'], $sCheckIn['sub']) && in_array($sCheckIn['in'], $aCheckIn)))
-            foreach($aLocations as $sKey => $aLocation)
-                if((!$bInSub || $sCheckIn['sub'] == $sKey) && extFileExists(BX_DIRECTORY_PATH_MODULES . $this->getPath(). 'data' . DIRECTORY_SEPARATOR . BX_DOL_TEMPLATE_FOLDER_ROOT . DIRECTORY_SEPARATOR . $sKey . DIRECTORY_SEPARATOR . $sFolder . $sName)) {
-                    $sResult = $sRoot . 'modules' . $sDivider . $sDirectory. 'data' . $sDivider . BX_DOL_TEMPLATE_FOLDER_ROOT . $sDivider . $sKey . $sDivider . $sFolder . $sName;
-                    break;
-                }
+        foreach($aLocationsGrouped as $aLocations) {
+            //--- Check it Template.
+            $bInSub = false;
+            $aCheckIn = [BX_DOL_TEMPLATE_CHECK_IN_BOTH, BX_DOL_TEMPLATE_CHECK_IN_TMPL];
+            if(in_array($sCheckIn, $aCheckIn) || $bInSub = (isset($sCheckIn['in'], $sCheckIn['sub']) && in_array($sCheckIn['in'], $aCheckIn)))
+                foreach($aLocations as $sKey => $aLocation)
+                    if((!$bInSub || $sCheckIn['sub'] == $sKey) && extFileExists(BX_DIRECTORY_PATH_MODULES . $this->getPath(). 'data' . DIRECTORY_SEPARATOR . BX_DOL_TEMPLATE_FOLDER_ROOT . DIRECTORY_SEPARATOR . $sKey . DIRECTORY_SEPARATOR . $sFolder . $sName)) {
+                        $sResult = $sRoot . 'modules' . $sDivider . $sDirectory. 'data' . $sDivider . BX_DOL_TEMPLATE_FOLDER_ROOT . $sDivider . $sKey . $sDivider . $sFolder . $sName;
+                        break 2;
+                    }
 
-        //--- Check it Base.
-        $bInSub = false;
-        $aCheckIn = [BX_DOL_TEMPLATE_CHECK_IN_BOTH, BX_DOL_TEMPLATE_CHECK_IN_BASE];
-        if(empty($sResult) && (in_array($sCheckIn, $aCheckIn) || $bInSub = (isset($sCheckIn['in'], $sCheckIn['sub']) && in_array($sCheckIn['in'], $aCheckIn))))
-            foreach($aLocations as $sKey => $aLocation)
-                if((!$bInSub || $sCheckIn['sub'] == $sKey) && extFileExists($aLocation['path'] . BX_DOL_TEMPLATE_FOLDER_ROOT . DIRECTORY_SEPARATOR . $sFolder . $sName)) {
-                    $sResult = $aLocation[$sType] . BX_DOL_TEMPLATE_FOLDER_ROOT . $sDivider . $sFolder . $sName;
-                    break;
-                }
+            //--- Check it Base.
+            $bInSub = false;
+            $aCheckIn = [BX_DOL_TEMPLATE_CHECK_IN_BOTH, BX_DOL_TEMPLATE_CHECK_IN_BASE];
+            if(empty($sResult) && (in_array($sCheckIn, $aCheckIn) || $bInSub = (isset($sCheckIn['in'], $sCheckIn['sub']) && in_array($sCheckIn['in'], $aCheckIn))))
+                foreach($aLocations as $sKey => $aLocation)
+                    if((!$bInSub || $sCheckIn['sub'] == $sKey) && extFileExists($aLocation['path'] . BX_DOL_TEMPLATE_FOLDER_ROOT . DIRECTORY_SEPARATOR . $sFolder . $sName)) {
+                        $sResult = $aLocation[$sType] . BX_DOL_TEMPLATE_FOLDER_ROOT . $sDivider . $sFolder . $sName;
+                        break 2;
+                    }
+        }
 
         /**
          * try to find from received path

+ 0 - 26
modules/boonex/artificer/data/template/bx_posts/form_ghost_template.html

@@ -1,26 +0,0 @@
-<div id="bx-uploader-file-{storage_object}-{file_id}" class="bx-uploader-ghost mt-2 flex items-start">
-    <input type="hidden" name="__name__[]" value="{file_id}" />
-    <div class="bx-base-general-icon-wrapper mr-2">
-        <img src="{file_icon}" class="bx-base-general-icon rounded bx-base-general-icon-{file_id}" />
-    </div>
-    <span class="bx-base-general-uploader-ghost">
-        <div class="font-bold"><bx_text:_sys_txt_form_entry_input_picture_pic_url /></div>
-        <div class="bx-form-input-wrapper bx-form-input-wrapper-text mt-1">
-            <input class="bx-def-font-inputs bx-form-input-text block w-full py-2 px-3 border border-gray-300 dark:border-gray-700 rounded-md shadow-sm bg-white dark:bg-gray-900 placeholder-gray-500 focus:outline-none focus:placeholder-gray-400 focus:ring-2 focus:text-gray-900 dark:focus:text-gray-100 focus:ring-blue-500 focus:border-opacity-70 focus:ring-opacity-20 focus:border-blue-500 text-sm text-gray-700 dark:text-gray-300 appearance-none" type="text" value="{file_url}" readonly="1" />
-        </div>
-        <div class="mt-2">
-            <span id="bx-base-general-intert-to-post-link-{file_id}" class="inline-block" style="display:none;">
-                <a class="bx-btn bx-btn-small mr-2" href="javascript:void(0);" onclick="bx_base_general_insert_to_post('{file_id}', '{file_url}', '__editor_id__');"><bx_text:_sys_txt_form_entry_input_picture_insert /></a>
-            </span>
-            <a class="bx-btn bx-btn-small mr-2" href="javascript:void(0);" onclick="bx_base_general_delete_ghost('{file_id}', '{file_url}', '{file_icon}', ['__editor_id__'], {js_instance_name});"><bx_text:_sys_txt_form_entry_input_picture_delete /></a>
-        </div>
-    </span>
-</div>
-<script>
-    $('#bx-base-general-intert-to-post-link-{file_id}').show();
-
-    // disable images drag&drop, because resized images address can be reset after some time
-    $(".bx-base-general-icon-{file_id}").bind('dragstart', function(){
-        return false; 
-    });
-</script>

+ 0 - 16
modules/boonex/posts/template/form_ghost_template_cover.html

@@ -1,16 +0,0 @@
-<div id="bx-uploader-file-{storage_object}-{file_id}" class="bx-uploader-ghost bx-def-margin-sec-top bx-clearfix">
-    <input type="hidden" name="__name__[]" value="{file_id}" />
-    <input type="hidden" name="__name_thumb__[]" value="{file_id}" onclick="bx_base_general_select_thumb(this)" id="__name_thumb__-{file_id}" />
-    <div class="bx-base-general-icon-wrapper bx-def-margin-sec-right">
-        <img src="{file_icon}" class="bx-def-round-corners bx-base-general-icon bx-base-general-icon-{file_id}" />
-    </div>
-    <span class="bx-base-general-uploader-ghost">
-        <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_delete_ghost('{file_id}', '{file_url}', '{file_icon}', ['__editor_id__'], {js_instance_name});"><bx_text:_sys_txt_form_entry_input_picture_delete /></a>
-    </span>
-</div>
-<script>
-    // disable images drag&drop, because resized images address can be reset after some time
-    $(".bx-base-general-icon-{file_id}").bind('dragstart', function(){
-        return false; 
-    });
-</script>

+ 0 - 19
modules/boonex/posts/template/form_ghost_template_file.html

@@ -1,19 +0,0 @@
-<div id="bx-uploader-file-{storage_object}-{file_id}" class="bx-uploader-ghost bx-def-margin-sec-top bx-clearfix">
-    <input type="hidden" name="__name__[]" value="{file_id}" />
-    <div class="bx-base-general-icon-wrapper bx-def-margin-sec-right">
-        <img src="{file_icon}" class="bx-def-round-corners bx-base-general-icon bx-base-general-icon-{file_id}" />
-    </div>
-    <span class="bx-base-general-uploader-ghost">
-        <b><bx_text:_sys_txt_form_entry_input_picture_pic_url /></b><br />
-        <input class="bx-def-font-inputs bx-form-input-text bx-def-margin-sec-bottom" type="text" value="{file_url}" readonly="1" /> <br />
-        <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_delete_ghost('{file_id}', '{file_url}', '{file_icon}', ['__editor_id__'], {js_instance_name});"><bx_text:_sys_txt_form_entry_input_picture_delete /></a>
-    </span>
-</div>
-<script>
-    $('#bx-base-general-intert-to-post-link-{file_id}').show();
-
-    // disable images drag&drop, because resized images address can be reset after some time
-    $(".bx-base-general-icon-{file_id}").bind('dragstart', function(){
-        return false; 
-    });
-</script>

+ 0 - 22
modules/boonex/posts/template/form_ghost_template_sound.html

@@ -1,22 +0,0 @@
-<div id="bx-uploader-file-{storage_object}-{file_id}" class="bx-uploader-ghost bx-def-margin-sec-top bx-clearfix">
-    <input type="hidden" name="__name__[]" value="{file_id}" />
-    <div class="bx-base-general-icon-wrapper bx-def-margin-sec-right">
-        <img src="{file_icon}" class="bx-def-round-corners bx-base-general-icon bx-base-general-icon-{file_id}" />
-    </div>
-    <span class="bx-base-general-uploader-ghost">
-        <b><bx_text:_sys_txt_form_entry_input_picture_pic_url /></b><br />
-        <input class="bx-def-font-inputs bx-form-input-text bx-def-margin-sec-bottom" type="text" value="{file_url}" readonly="1" /> <br />
-        <span id="bx-base-general-insert-to-post-link-{file_id}" style="display:none;">
-            <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_insert_to_post('{file_id}', '{file_url}', '__editor_id__', '{file_type}', '__embed_url__');"><bx_text:_sys_txt_form_entry_input_picture_insert /></a>
-        </span>
-        <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_delete_ghost('{file_id}', '{file_url}', '{file_icon}', ['__editor_id__'], {js_instance_name});"><bx_text:_sys_txt_form_entry_input_picture_delete /></a>
-    </span>
-</div>
-<script>
-    $('#bx-base-general-insert-to-post-link-{file_id}').show();
-
-    // disable images drag&drop, because resized images address can be reset after some time
-    $(".bx-base-general-icon-{file_id}").bind('dragstart', function(){
-        return false; 
-    });
-</script>

+ 0 - 22
modules/boonex/posts/template/form_ghost_template_video.html

@@ -1,22 +0,0 @@
-<div id="bx-uploader-file-{storage_object}-{file_id}" class="bx-uploader-ghost bx-def-margin-sec-top bx-clearfix">
-    <input type="hidden" name="__name__[]" value="{file_id}" />
-    <div class="bx-base-general-icon-wrapper bx-def-margin-sec-right">
-        <img src="{file_icon}" class="bx-def-round-corners bx-base-general-icon bx-base-general-icon-{file_id}" />
-    </div>
-    <span class="bx-base-general-uploader-ghost">
-        <b><bx_text:_sys_txt_form_entry_input_picture_pic_url /></b><br />
-        <input class="bx-def-font-inputs bx-form-input-text bx-def-margin-sec-bottom" type="text" value="{file_url}" readonly="1" /> <br />
-        <span id="bx-base-general-intert-to-post-link-{file_id}" style="display:none;">
-            <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_insert_to_post('{file_id}', '{file_url}', '__editor_id__', '{file_type}', '__embed_url__');"><bx_text:_sys_txt_form_entry_input_picture_insert /></a>
-        </span>
-        <a class="bx-btn bx-btn-small bx-def-margin-sec-right" href="javascript:void(0);" onclick="bx_base_general_delete_ghost('{file_id}', '{file_url}', '{file_icon}', ['__editor_id__'], {js_instance_name});"><bx_text:_sys_txt_form_entry_input_picture_delete /></a>
-    </span>
-</div>
-<script>
-    $('#bx-base-general-intert-to-post-link-{file_id}').show();
-
-    // disable images drag&drop, because resized images address can be reset after some time
-    $(".bx-base-general-icon-{file_id}").bind('dragstart', function(){
-        return false; 
-    });
-</script>