mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 18:02:18 +00:00
- 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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -117,11 +117,25 @@ class FilterCmptLib
|
||||
//
|
||||
if (!$this->_checkJSParameters()) return;
|
||||
|
||||
// Gets the filter configuration from the file system
|
||||
require_once(APPPATH.'components/filters/'.$this->_filterType.'.php');
|
||||
//
|
||||
$filePath = findResource(APPPATH.'components/filters/', $this->_filterType, true);
|
||||
if (!isEmptyString($filePath))
|
||||
{
|
||||
// Gets the filter configuration from the file system
|
||||
require_once($filePath);
|
||||
}
|
||||
else
|
||||
{
|
||||
$filePath = findResource(APPPATH.'components/extensions/', $this->_filterType, true);
|
||||
if (!isEmptyString($filePath)) require_once($filePath);
|
||||
}
|
||||
|
||||
// Gets the filter configuration from the extensions
|
||||
// require_once(APPPATH.'components/extensions/'.$this->_filterType.'.php');
|
||||
//
|
||||
if (!isset($filterCmptArray))
|
||||
{
|
||||
$this->_setSession(error('Component definition file '.$this->_filterType.' not found'));
|
||||
return;
|
||||
}
|
||||
|
||||
//
|
||||
if (!$this->_checkPHPParameters($filterCmptArray)) return;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
$includesArray = array(
|
||||
'title' => 'Logs Viewer',
|
||||
'jquery3' => true,
|
||||
'axios027' => true,
|
||||
'bootstrap5' => true,
|
||||
'fontawesome6' => true,
|
||||
'jquery3' => true,
|
||||
'restclient' => true,
|
||||
'tablesorter2' => true,
|
||||
'vue3' => true,
|
||||
'ajaxlib' => true,
|
||||
'jqueryui1' => true,
|
||||
'filtercomponent' => true,
|
||||
'navigationcomponent' => true,
|
||||
'phrases' => array(
|
||||
@@ -23,7 +23,7 @@
|
||||
<div id="main">
|
||||
|
||||
<!-- Navigation component -->
|
||||
<core-navigation-cmpt :add-side-menu-entries="appSideMenuEntries"></core-navigation-cmpt>
|
||||
<core-navigation-cmpt v-bind:add-side-menu-entries="appSideMenuEntries"></core-navigation-cmpt>
|
||||
|
||||
<div id="content">
|
||||
<div class="row">
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
$filterwidget = isset($filterwidget) ? $filterwidget : false;
|
||||
$navigationcomponent = isset($navigationcomponent) ? $navigationcomponent : false;
|
||||
$navigationwidget = isset($navigationwidget) ? $navigationwidget : false;
|
||||
$restclient = isset($restclient) ? $restclient : false;
|
||||
$tablecomponent = isset($tablecomponent) ? $tablecomponent : false;
|
||||
$tablewidget = isset($tablewidget) ? $tablewidget : false;
|
||||
$udfs = isset($udfs) ? $udfs : false;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
// From vendor folder
|
||||
|
||||
// Axios V0.27
|
||||
if ($axios027 === true) generateJSsInclude('vendor/axios/axios/axios.min.js');
|
||||
if ($axios027 === true) generateJSsInclude('vendor/axios/axios/dist/axios.min.js');
|
||||
|
||||
// Bootstrap 5 JS
|
||||
if ($bootstrap5 === true) generateJSsInclude('vendor/twbs/bootstrap5/dist/js/bootstrap.min.js');
|
||||
@@ -132,6 +132,9 @@
|
||||
// PhrasesLib JS
|
||||
if ($phrases != null) generateJSsInclude('public/js/PhrasesLib.js');
|
||||
|
||||
// RESTClient
|
||||
if ($restclient === true) generateJSsInclude('public/js/RESTClient.js');
|
||||
|
||||
// TableWidget JS
|
||||
if ($tablewidget === true) generateJSsInclude('public/js/TableWidget.js');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user