- Added new JS public/js/RESTClient.js as axios wrapper

- composer.json: added axios from github
- Added new directory application/components/extensions/
- Added new utility function findResource to application/helpers/hlp_common_helper.php
- Now the library libraries/FilterCmptLib loads the component definition php files from the extensions
- views/system/logs/logsViewer now includes axios and restclient, removed the includes for ajaxlib and jQueryUI
- Added includes for the RESTClient and axios to views/templates/FHC-Common and views/templates/FHC-Footer
- Improved component js/components/Fetch
- Components public/js/components/Filter.js and public/js/components/Navigation.js now they are making use of the Fetch component or/and the RESTClient
This commit is contained in:
Paolo
2022-07-04 19:25:16 +02:00
parent 32daed2ad2
commit 60b3be3d64
11 changed files with 512 additions and 140 deletions
+41 -2
View File
@@ -132,9 +132,9 @@ function loadResource($path, $resources = null, $subdir = false)
while (($entry = readdir($dirHandler)) !== false)
{
// If entry is a directory but not the current and subdirectories should be loaded
if ($subdir === true && $entry != '.' && $entry != '..' && is_dir($entry))
if ($subdir === true && $entry != '.' && $entry != '..' && is_dir($path.$entry))
{
$tmpPaths[] = $entry;
$tmpPaths[] = $path.$entry.'/';
}
// If no resources are specified and the current file system entry is a file
if ($resources == null && is_file($path.$entry))
@@ -351,3 +351,42 @@ function sanitizeProblemChars($str)
return preg_replace($acentos, array_keys($acentos), htmlentities($str, ENT_NOQUOTES | ENT_HTML5, $enc));
}
/**
*
*/
function findResource($path, $resource, $subdir = false)
{
// Place a / character at the and of the string if not present
if (strrpos($path, '/') < strlen($path) - 1) $path .= '/';
// Loads in $tmpPaths path and eventually the subdirectories
$tmpPaths = array($path);
// NOTE: Used @ to prevent ugly error messages
if (is_dir($path) && ($dirHandler = @opendir($path)) !== false)
{
// Reads all file system entries present in path
while (($entry = readdir($dirHandler)) !== false)
{
// If entry is a directory but not the current and subdirectories should be loaded
if ($subdir === true && $entry != '.' && $entry != '..' && is_dir($path.$entry))
{
$tmpPaths[] = $path.$entry.'/';
}
}
closedir($dirHandler);
}
// Loops through the paths
foreach ($tmpPaths as $tmpPath)
{
$fileName = $tmpPath.$resource.'.php'; // Php extension
if (file_exists($fileName))
{
return $fileName;
}
}
return null;
}