diff --git a/conlite/classes/gui/class.file_list.php b/conlite/classes/gui/class.file_list.php
new file mode 100644
index 0000000..da33a5a
--- /dev/null
+++ b/conlite/classes/gui/class.file_list.php
@@ -0,0 +1,115 @@
+_sPath = $sPath;
+ $this->_mFileExt = $mFileExt;
+ $this->_iScanDepth = 3;
+ $this->_oTpl = new Template();
+ }
+
+ public function scanDir() {
+ if (empty($this->_sPath) || !is_readable($this->_sPath)) {
+ return false;
+ }
+ $this->_bWritable = (!is_writable($this->_sPath)) ? true : false;
+
+ $this->_aDirItems = $this->_assetsMap($this->_sPath, $this->_iScanDepth);
+ asort($this->_aDirItems, SORT_STRING | SORT_FLAG_CASE | SORT_NATURAL);
+ }
+
+ public function renderList($sTpl = null, $bReturn = false) {
+ global $sess, $area;
+ $sList = '
' . "\n";
+ foreach ($this->_aDirItems as $key => $item) {
+ if (is_array($item)) {
+ $sList .= $this->_getSubItems($key, $item, $this->_sPath);
+ } else {
+ $sAddClass = (is_writable($this->_sPath . $item)) ? '' : ' notwritable';
+ $sList .= '- ' . $item . '
' . "\n";
+ }
+ }
+
+ $sList .= '
' . "\n";
+ $this->_oTpl->set('s', 'item_list', $sList);
+
+ $this->_oTpl->set('s', 'multilink1', $sess->url("main.php?area=$area&frame=3&file=\${file}"));
+ $this->_oTpl->set('s', 'multilink2', $sess->url("main.php?area=$area&frame=4&action=js_edit&file=\${file}&tmp_file=\${file}"));
+
+ $this->_oTpl->generate(cRegistry::getConfigValue('path', 'contenido') . cRegistry::getConfigValue('path', 'templates') . "html5/file_list.html", $bReturn);
+ }
+
+ protected function _getSubItems($sName, $aItems, $sPathToItem) {
+ $sPathToItem = $sPathToItem . $sName . DIRECTORY_SEPARATOR;
+ $sItemListEntry = '' . $sName . "\n\t";
+ if (is_array($aItems) && count($aItems) > 0) {
+ $sItemListEntry .= '' . "\n\t";
+ foreach ($aItems as $key => $item) {
+ if (is_array($item)) {
+ $sItemListEntry .= $this->_getSubItems($key, $item, $sPathToItem);
+ } else {
+ $sAddClass = (is_writable($sPathToItem . $item)) ? '' : ' notwritable';
+ $sItemListEntry .= '- ' . $item . '
' . "\n";
+ }
+ }
+ $sItemListEntry .= '
' . "\n";
+ }
+ $sItemListEntry .= '' . "\n";
+ return $sItemListEntry;
+ }
+
+ protected function _assetsMap($source_dir, $directory_depth = 0, $hidden = false) {
+ if ($fp = @opendir($source_dir)) {
+ $filedata = array();
+ $new_depth = $directory_depth - 1;
+ $source_dir = rtrim($source_dir, '/') . '/';
+
+ while (FALSE !== ($file = readdir($fp))) {
+ // Remove '.', '..', and hidden files [optional]
+ if (!trim($file, '.') OR ($hidden == false && $file[0] == '.')) {
+ continue;
+ }
+
+
+ if (($directory_depth < 1 OR $new_depth > 0) && is_dir($source_dir . $file)) {
+ $aTmp = $this->_assetsMap($source_dir . $file . '/', $new_depth, $hidden);
+ if (!empty($aTmp)) {
+ asort($aTmp, SORT_STRING | SORT_FLAG_CASE | SORT_NATURAL);
+ $filedata[$file] = $aTmp;
+ }
+ unset($aTmp);
+ } else {
+ $sFileExt = strtolower(pathinfo($file, PATHINFO_EXTENSION));
+ if (!empty($this->_mFileExt) && in_array($sFileExt, $this->_mFileExt)) {
+ $filedata[] = $file;
+ }
+ }
+ }
+
+ closedir($fp);
+ return $filedata;
+ }
+ echo 'can not open dir';
+ return FALSE;
+ }
+
+}
diff --git a/conlite/includes/include.js_files_overview.php b/conlite/includes/include.js_files_overview.php
index e13505c..611f761 100644
--- a/conlite/includes/include.js_files_overview.php
+++ b/conlite/includes/include.js_files_overview.php
@@ -7,114 +7,8 @@ if (!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
-class clFileList {
- protected $_sPath;
- protected $_mFileExt;
- protected $_iScanDepth;
- protected $_aDirItems;
- protected $_bWritable;
- protected $_oTpl;
-
- public function __construct($sPath, $mFileExt = null) {
-
- if(!empty($mFileExt) && is_string($mFileExt)) {
- $mFileExt = [strtolower($mFileExt)];
- }
- $this->_sPath = $sPath;
- $this->_mFileExt = $mFileExt;
- $this->_iScanDepth = 3;
- $this->_oTpl = new Template();
- }
-
- public function scanDir() {
- if (empty($this->_sPath) || !is_readable($this->_sPath)) {
- return false;
- }
- $this->_bWritable = (!is_writable($this->_sPath)) ? true : false;
-
- $this->_aDirItems = $this->_assetsMap($this->_sPath, $this->_iScanDepth);
- asort($this->_aDirItems, SORT_STRING | SORT_FLAG_CASE | SORT_NATURAL);
- }
-
- public function renderList($sTpl = null, $bReturn = false) {
- global $sess, $area;
- $sList = ''."\n";
- foreach($this->_aDirItems as $key => $item) {
- if(is_array($item)) {
- $sList .= $this->_getSubItems($key, $item,$this->_sPath);
- } else {
- $sAddClass = (is_writable($this->_sPath.$item))?'':' notwritable';
- $sList .= '- '.$item.'
'."\n";
- }
- }
-
- $sList .= '
'."\n";
- $this->_oTpl->set('s', 'item_list', $sList);
-
- $this->_oTpl->set('s', 'multilink1', $sess->url("main.php?area=$area&frame=3&file=\${file}"));
- $this->_oTpl->set('s', 'multilink2', $sess->url("main.php?area=$area&frame=4&action=js_edit&file=\${file}&tmp_file=\${file}"));
-
- $this->_oTpl->generate(cRegistry::getConfigValue('path', 'contenido') . cRegistry::getConfigValue('path', 'templates') . "html5/file_list.html", $bReturn);
- }
-
- protected function _getSubItems($sName, $aItems, $sPathToItem) {
- $sPathToItem = $sPathToItem.$sName.DIRECTORY_SEPARATOR;
- $sItemListEntry = ''.$sName."\n\t";
- if(is_array($aItems) && count($aItems) >0) {
- $sItemListEntry .= ''."\n\t";
- foreach($aItems as $key=>$item) {
- if(is_array($item)) {
- $sItemListEntry .= $this->_getSubItems($key, $item, $sPathToItem);
- } else {
- $sAddClass = (is_writable($sPathToItem.$item))?'':' notwritable';
- $sItemListEntry .= '- '.$item.'
'."\n";
- }
- }
- $sItemListEntry .= '
'."\n";
- }
- $sItemListEntry .= ''."\n";
- return $sItemListEntry;
- }
-
- protected function _assetsMap($source_dir, $directory_depth = 0, $hidden = false) {
- if ($fp = @opendir($source_dir)) {
- $filedata = array();
- $new_depth = $directory_depth - 1;
- $source_dir = rtrim($source_dir, '/') . '/';
-
- while (FALSE !== ($file = readdir($fp))) {
- // Remove '.', '..', and hidden files [optional]
- if (!trim($file, '.') OR ($hidden == false && $file[0] == '.')) {
- continue;
- }
-
-
- if (($directory_depth < 1 OR $new_depth > 0) && is_dir($source_dir . $file)) {
- $aTmp = $this->_assetsMap($source_dir . $file . '/', $new_depth, $hidden);
- if(!empty($aTmp)) {
- asort($aTmp, SORT_STRING | SORT_FLAG_CASE | SORT_NATURAL);
- $filedata[$file] = $aTmp;
- }
- unset($aTmp);
- } else {
- $sFileExt = strtolower(pathinfo($file, PATHINFO_EXTENSION));
- if(!empty($this->_mFileExt) && in_array($sFileExt, $this->_mFileExt)) {
- $filedata[] = $file;
- }
- }
- }
-
- closedir($fp);
- return $filedata;
- }
- echo 'can not open dir';
- return FALSE;
- }
-
-}
-
-$oDirList = new clFileList($cfgClient[$client]["js"]["path"], 'js');
+$oDirList = new cGuiFileList($cfgClient[$client]["js"]["path"], 'js');
$oDirList->scanDir();
$oDirList->renderList();
\ No newline at end of file
diff --git a/data/config/production/config.autoloader.php b/data/config/production/config.autoloader.php
index 2432532..8a8efda 100644
--- a/data/config/production/config.autoloader.php
+++ b/data/config/production/config.autoloader.php
@@ -345,5 +345,6 @@ return array(
'PHPMailerOAuthGoogle' => 'conlite/external/PHPMailer/class.phpmaileroauthgoogle.php',
'cStringMultiByteWrapper' => 'conlite/classes/class.string.multi.byte.wrapper.php',
'cString' => 'conlite/classes/class.string.php',
- 'cGuiPage' => 'conlite/classes/gui/class.page.php'
+ 'cGuiPage' => 'conlite/classes/gui/class.page.php',
+ 'cGuiFileList' => 'conlite/classes/gui/class.file_list.php'
);