From fbf37ad887aae998544a23bc35b6e30ddb686f53 Mon Sep 17 00:00:00 2001 From: tsymb Date: Sun, 30 Jun 2019 19:30:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=B5=D1=80=D1=81=D0=B8=D1=8F=201.1.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/com_quantummanager/config.xml | 11 + .../controllers/quantumviewfiles.php | 20 +- .../fields/quantumcombine.php | 3 +- .../fields/quantumviewfiles.php | 2 + .../com_quantummanager/filesystem/local.php | 207 ++++++++++++------ .../en-GB/en-GB.com_quantummanager.ini | 10 + .../en-GB/en-GB.com_quantummanager.sys.ini | 10 + .../ru-RU/ru-RU.com_quantummanager.ini | 12 +- .../ru-RU/ru-RU.com_quantummanager.sys.ini | 12 +- .../layouts/fields/quantumupload.php | 6 +- .../com_quantummanager/layouts/help.php | 2 +- .../views/quantummanager/tmpl/default.php | 6 +- .../views/quantummanager/tmpl/modal.php | 6 +- .../views/quantummanager/tmpl/window.php | 6 +- changelog.md | 8 + media/com_quantummanager/css/main.css | 5 +- .../css/quantumviewfiles.css | 6 +- .../images/icons/folder.svg | 2 + media/com_quantummanager/js/quantumupload.js | 13 +- .../com_quantummanager/js/quantumviewfiles.js | 123 ++++++++++- quantummanager.xml | 2 +- 21 files changed, 363 insertions(+), 109 deletions(-) create mode 100644 media/com_quantummanager/images/icons/folder.svg diff --git a/administrator/components/com_quantummanager/config.xml b/administrator/components/com_quantummanager/config.xml index 17f85c7..1f9c147 100644 --- a/administrator/components/com_quantummanager/config.xml +++ b/administrator/components/com_quantummanager/config.xml @@ -39,6 +39,17 @@ + + + + + + input->getArray(); - if(!isset($data['path']) || !isset($data['name'])) + if(!isset($data['path'])) { $app->close(); } + $name = ''; + + if(isset($data['name'])) + { + $name = $data['name']; + } + JLoader::register('QuantummanagerFileSystemLocal', JPATH_ROOT . '/administrator/components/com_quantummanager/filesystem/local.php'); - echo QuantummanagerFileSystemLocal::getMetaFile($data['path'], $data['name']); + echo QuantummanagerFileSystemLocal::getMetaFile($data['path'], $name); $app->close(); } @@ -128,14 +135,19 @@ public function generatePreviewImage() try { $app = Factory::getApplication(); $data = $app->input->getArray(); + $file = ''; - if(!isset($data['path']) || !isset($data['file'])) + if(!isset($data['path'])) { $app->close(); } $path = $data['path']; - $file = $data['file']; + + if(isset($data['file'])) + { + $file = $data['file']; + } JLoader::register('QuantummanagerFileSystemLocal', JPATH_ROOT . '/administrator/components/com_quantummanager/filesystem/local.php'); QuantummanagerFileSystemLocal::generatePreviewImage($path, $file); diff --git a/administrator/components/com_quantummanager/fields/quantumcombine.php b/administrator/components/com_quantummanager/fields/quantumcombine.php index c6c3f6b..249e428 100644 --- a/administrator/components/com_quantummanager/fields/quantumcombine.php +++ b/administrator/components/com_quantummanager/fields/quantumcombine.php @@ -160,7 +160,8 @@ public function getInput() } } - catch (Exception $e) { + catch (Exception $e) + { echo $e->getMessage(); } } diff --git a/administrator/components/com_quantummanager/fields/quantumviewfiles.php b/administrator/components/com_quantummanager/fields/quantumviewfiles.php index e6099fc..0214a1e 100644 --- a/administrator/components/com_quantummanager/fields/quantumviewfiles.php +++ b/administrator/components/com_quantummanager/fields/quantumviewfiles.php @@ -52,6 +52,8 @@ protected function getLayoutPaths() */ protected function getLayoutData() { + JLoader::register('QuantummanagerHelper', JPATH_SITE . '/administrator/components/com_quantummanager/helpers/quantummanager.php'); + return array_merge(parent::getLayoutData(), [ 'directory' => $this->directory, diff --git a/administrator/components/com_quantummanager/filesystem/local.php b/administrator/components/com_quantummanager/filesystem/local.php index 1587f18..d17d9b6 100644 --- a/administrator/components/com_quantummanager/filesystem/local.php +++ b/administrator/components/com_quantummanager/filesystem/local.php @@ -238,6 +238,7 @@ public static function upload() * @param $path * @param $file * + * @return string * * @since version */ @@ -247,104 +248,161 @@ public static function getMetaFile($path, $file) $path = QuantummanagerHelper::preparePath($path); $directory = JPATH_ROOT . DIRECTORY_SEPARATOR . $path; $filePath = $directory . DIRECTORY_SEPARATOR . $file; - $meta = [ - 'preview' => [ - 'link' => 'index.php?' . http_build_query([ - 'option' => 'com_quantummanager', - 'task' => 'quantumviewfiles.generatePreviewImage', - 'file' => $file, - 'path' => $sourcePath, - 'v' => rand(111111, 999999), - ]) - ], - 'global' => [], - 'find' => [], - ]; + $meta = []; if(file_exists($filePath)) { - $splitFile = explode('.', $file); - $exs = mb_strtolower(array_pop($splitFile)); - $globalInfo[] = [ - 'key' => Text::_('COM_QUANTUMMANAGER_FILE_METAINFO_FILENAME'), - 'value' => implode('.', $splitFile), - ]; + if(is_file($filePath)) + { + $meta = [ + 'preview' => [ + 'link' => 'index.php?' . http_build_query([ + 'option' => 'com_quantummanager', + 'task' => 'quantumviewfiles.generatePreviewImage', + 'file' => $file, + 'path' => $sourcePath, + 'v' => rand(111111, 999999), + ]) + ], + 'global' => [], + 'find' => [], + ]; - $stat = stat($filePath); - if($stat !== false) - { - if(isset($stat['mtime'])) - { - $globalInfo[] = [ - 'key' => Text::_('COM_QUANTUMMANAGER_FILE_METAINFO_FILEDATETIME'), - 'value' => date(Text::_('DATE_FORMAT_LC5'), $stat['mtime']) - ]; + $splitFile = explode('.', $file); + $exs = mb_strtolower(array_pop($splitFile)); + + $globalInfo[] = [ + 'key' => Text::_('COM_QUANTUMMANAGER_FILE_METAINFO_FILENAME'), + 'value' => implode('.', $splitFile), + ]; + + $stat = stat($filePath); + + if ($stat !== false) { + if (isset($stat['mtime'])) { + $globalInfo[] = [ + 'key' => Text::_('COM_QUANTUMMANAGER_FILE_METAINFO_FILEDATETIME'), + 'value' => date(Text::_('DATE_FORMAT_LC5'), $stat['mtime']) + ]; + } + + if (isset($stat['size'])) { + $globalInfo[] = [ + 'key' => Text::_('COM_QUANTUMMANAGER_FILE_METAINFO_FILESIZE'), + 'value' => QuantummanagerHelper::formatFileSize((int)$stat['size']) + ]; + } + } - if(isset($stat['size'])) - { + if (in_array($exs, ['jpg', 'jpeg', 'png', 'gif'])) { + list($width, $height, $type, $attr) = getimagesize($filePath); + $globalInfo[] = [ - 'key' => Text::_('COM_QUANTUMMANAGER_FILE_METAINFO_FILESIZE'), - 'value' => QuantummanagerHelper::formatFileSize((int)$stat['size']) + 'key' => Text::_('COM_QUANTUMMANAGER_FILE_METAINFO_RESOLUTION'), + 'value' => $width . ' x ' . $height ]; } - } - - if(in_array($exs, ['jpg', 'jpeg', 'png', 'gif'])) - { - list($width, $height, $type, $attr) = getimagesize($filePath); - $globalInfo[] = [ - 'key' => Text::_('COM_QUANTUMMANAGER_FILE_METAINFO_RESOLUTION'), - 'value' => $width . ' x ' . $height - ]; - } - - if(in_array($exs, ['jpg', 'jpeg'])) - { + if (in_array($exs, ['jpg', 'jpeg'])) { - $tmp = exif_read_data($filePath); - foreach ($tmp as $key => $section) - { - if(is_array($section)) + try { - foreach ($section as $name => $val) - { - $meta['find'][] = [ - 'key' => $key . '.' . $name, - 'value' => $val - ]; + $tmp = exif_read_data($filePath); + foreach ($tmp as $key => $section) { + if (is_array($section)) { + foreach ($section as $name => $val) { + $meta['find'][] = [ + 'key' => $key . '.' . $name, + 'value' => $val + ]; + } + } else { + + if (!in_array(mb_strtolower($key), [ + 'filename', + 'filedatetime', + 'filesize', + 'filetype', + 'mimetype', + ])) { + $meta['find'][] = [ + 'key' => $key, + 'value' => $section, + ]; + } + + } } } - else + catch (Exception $e) { - - if(!in_array(mb_strtolower($key), [ - 'filename', - 'filedatetime', - 'filesize', - 'filetype', - 'mimetype', - ])) { - $meta['find'][] = [ - 'key' => $key, - 'value' => $section, - ]; - } - + echo $e->getMessage(); } + } + + $meta['global'] = array_merge($meta['global'], $globalInfo); + } + else + { - $meta['global'] = array_merge($meta['global'], $globalInfo); + $meta = [ + 'preview' => [ + 'link' => 'index.php?' . http_build_query([ + 'option' => 'com_quantummanager', + 'task' => 'quantumviewfiles.generatePreviewImage', + 'file' => $file, + 'path' => $sourcePath, + 'v' => rand(111111, 999999), + ]) + ], + 'global' => [], + 'find' => [], + ]; + + $splitDirectory = explode(DIRECTORY_SEPARATOR, $directory); + $directoryName = array_pop($splitDirectory); + $files = Folder::files($directory, ''); + $directories = Folder::folders($directory); + $size = 0; + + foreach($files as $file) + { + $size += filesize($directory . DIRECTORY_SEPARATOR . $file); + } + + $meta['global'] = [ + [ + 'key' => Text::_('COM_QUANTUMMANAGER_FILE_METAINFO_DIRECTORYNAME'), + 'value' => $directoryName + ], + [ + 'key' => Text::_('COM_QUANTUMMANAGER_FILE_METAINFO_COUNTDORECTORIES'), + 'value' => count($directories) + ], + [ + 'key' => Text::_('COM_QUANTUMMANAGER_FILE_METAINFO_COUNTFILES'), + 'value' => count($files) + ], + [ + 'key' => Text::_('COM_QUANTUMMANAGER_FILE_METAINFO_FILESSIZE'), + 'value' => QuantummanagerHelper::formatFileSize($size) + ] + ]; + + + } } - return json_encode($meta); + + return json_encode($meta, JSON_INVALID_UTF8_IGNORE); } @@ -596,6 +654,11 @@ public static function generatePreviewImage($path, $file) $mediaIconsPath = 'media/com_quantummanager/images/icons/'; $siteUrl = Uri::root(); + if(empty($file)) + { + $app->redirect($siteUrl . $mediaIconsPath . 'folder.svg'); + } + if(in_array($exs, ['jpg', 'jpeg', 'png', 'gif'])) { JLoader::register('JInterventionimage', JPATH_LIBRARIES . DIRECTORY_SEPARATOR . 'jinterventionimage' . DIRECTORY_SEPARATOR . 'jinterventionimage.php'); diff --git a/administrator/components/com_quantummanager/language/en-GB/en-GB.com_quantummanager.ini b/administrator/components/com_quantummanager/language/en-GB/en-GB.com_quantummanager.ini index 85b5a99..5ea3373 100644 --- a/administrator/components/com_quantummanager/language/en-GB/en-GB.com_quantummanager.ini +++ b/administrator/components/com_quantummanager/language/en-GB/en-GB.com_quantummanager.ini @@ -12,6 +12,7 @@ COM_QUANTUMMANAGER_CONFIG_GENERAL_MAXSIZE_LABEL="Maximum file size for downloadi COM_QUANTUMMANAGER_CONFIG_GENERAL_POSTFIX_LABEL="Add postfix to file names" COM_QUANTUMMANAGER_CONFIG_GENERAL_POSTFIX_DESC="" COM_QUANTUMMANAGER_CONFIG_GENERAL_METAFILE_LABEL="Meta tags for files" +COM_QUANTUMMANAGER_CONFIG_GENERAL_DROPAREAHIDDEN_LABEL="Hide loading area
There will be only a button" COM_QUANTUMMANAGER_CONFIG_GENERAL_HELP_LABEL="Show links to feedback" COM_QUANTUMMANAGER_CONFIG_GENERAL_MIMETYPE_LABEL="Allowed mime file types" COM_QUANTUMMANAGER_CONFIG_GENERAL_MIMETYPE_DESC="" @@ -49,6 +50,10 @@ COM_QUANTUMMANAGER_ERROR_UPLOAD_ACCESS="Not allowed file type" COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_DRAG_DROP="Drop files into download area" COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_DROP="Drag and drop files to download" COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_SELECT="Select on your device." +COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_ERROR_FILE="File " +COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_ERROR_MEGABITE=" megabyte." +COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_ERROR_MAXSIZE=" must not exceed " +COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_ERROR_EXS=" must have an extension." COM_QUANTUMMANAGER_FIELDS_QUANTUMVIEWFILES_LOADING="Download" COM_QUANTUMMANAGER_FIELDS_QUANTUMVIEWFILES_EMPTY="There are no files." @@ -97,10 +102,15 @@ COM_QUANTUMMANAGER_FIELDS_QUANTUMCROPPERJS_LABEL_SAVE_RATIO="Save proportions" COM_QUANTUMMANAGER_HELP_QUESTIONS="Any questions?" COM_QUANTUMMANAGER_HELP_QUESTIONS_CREATE="Ask" COM_QUANTUMMANAGER_HELP_QUESTIONS_SHOW="View all" +COM_QUANTUMMANAGER_HELP_AUTHOR="Contact with the author" COM_QUANTUMMANAGER_WINDOW_CLOSE="Close" COM_QUANTUMMANAGER_WINDOW_INSERT="Insert file" +COM_QUANTUMMANAGER_FILE_METAINFO_DIRECTORYNAME="Folder Name" +COM_QUANTUMMANAGER_FILE_METAINFO_COUNTDORECTORIES="Folders" +COM_QUANTUMMANAGER_FILE_METAINFO_COUNTFILES="Files" +COM_QUANTUMMANAGER_FILE_METAINFO_FILESSIZE="File Size" COM_QUANTUMMANAGER_FILE_METAINFO_FILENAME="File Name" COM_QUANTUMMANAGER_FILE_METAINFO_FILEDATETIME="Change Time" COM_QUANTUMMANAGER_FILE_METAINFO_FILESIZE="File Size" diff --git a/administrator/components/com_quantummanager/language/en-GB/en-GB.com_quantummanager.sys.ini b/administrator/components/com_quantummanager/language/en-GB/en-GB.com_quantummanager.sys.ini index 85b5a99..5ea3373 100644 --- a/administrator/components/com_quantummanager/language/en-GB/en-GB.com_quantummanager.sys.ini +++ b/administrator/components/com_quantummanager/language/en-GB/en-GB.com_quantummanager.sys.ini @@ -12,6 +12,7 @@ COM_QUANTUMMANAGER_CONFIG_GENERAL_MAXSIZE_LABEL="Maximum file size for downloadi COM_QUANTUMMANAGER_CONFIG_GENERAL_POSTFIX_LABEL="Add postfix to file names" COM_QUANTUMMANAGER_CONFIG_GENERAL_POSTFIX_DESC="" COM_QUANTUMMANAGER_CONFIG_GENERAL_METAFILE_LABEL="Meta tags for files" +COM_QUANTUMMANAGER_CONFIG_GENERAL_DROPAREAHIDDEN_LABEL="Hide loading area
There will be only a button" COM_QUANTUMMANAGER_CONFIG_GENERAL_HELP_LABEL="Show links to feedback" COM_QUANTUMMANAGER_CONFIG_GENERAL_MIMETYPE_LABEL="Allowed mime file types" COM_QUANTUMMANAGER_CONFIG_GENERAL_MIMETYPE_DESC="" @@ -49,6 +50,10 @@ COM_QUANTUMMANAGER_ERROR_UPLOAD_ACCESS="Not allowed file type" COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_DRAG_DROP="Drop files into download area" COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_DROP="Drag and drop files to download" COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_SELECT="Select on your device." +COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_ERROR_FILE="File " +COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_ERROR_MEGABITE=" megabyte." +COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_ERROR_MAXSIZE=" must not exceed " +COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_ERROR_EXS=" must have an extension." COM_QUANTUMMANAGER_FIELDS_QUANTUMVIEWFILES_LOADING="Download" COM_QUANTUMMANAGER_FIELDS_QUANTUMVIEWFILES_EMPTY="There are no files." @@ -97,10 +102,15 @@ COM_QUANTUMMANAGER_FIELDS_QUANTUMCROPPERJS_LABEL_SAVE_RATIO="Save proportions" COM_QUANTUMMANAGER_HELP_QUESTIONS="Any questions?" COM_QUANTUMMANAGER_HELP_QUESTIONS_CREATE="Ask" COM_QUANTUMMANAGER_HELP_QUESTIONS_SHOW="View all" +COM_QUANTUMMANAGER_HELP_AUTHOR="Contact with the author" COM_QUANTUMMANAGER_WINDOW_CLOSE="Close" COM_QUANTUMMANAGER_WINDOW_INSERT="Insert file" +COM_QUANTUMMANAGER_FILE_METAINFO_DIRECTORYNAME="Folder Name" +COM_QUANTUMMANAGER_FILE_METAINFO_COUNTDORECTORIES="Folders" +COM_QUANTUMMANAGER_FILE_METAINFO_COUNTFILES="Files" +COM_QUANTUMMANAGER_FILE_METAINFO_FILESSIZE="File Size" COM_QUANTUMMANAGER_FILE_METAINFO_FILENAME="File Name" COM_QUANTUMMANAGER_FILE_METAINFO_FILEDATETIME="Change Time" COM_QUANTUMMANAGER_FILE_METAINFO_FILESIZE="File Size" diff --git a/administrator/components/com_quantummanager/language/ru-RU/ru-RU.com_quantummanager.ini b/administrator/components/com_quantummanager/language/ru-RU/ru-RU.com_quantummanager.ini index 779c600..f5c9eb9 100644 --- a/administrator/components/com_quantummanager/language/ru-RU/ru-RU.com_quantummanager.ini +++ b/administrator/components/com_quantummanager/language/ru-RU/ru-RU.com_quantummanager.ini @@ -12,9 +12,10 @@ COM_QUANTUMMANAGER_CONFIG_GENERAL_MAXSIZE_LABEL="Максимальный раз COM_QUANTUMMANAGER_CONFIG_GENERAL_POSTFIX_LABEL="Добавлять постфикс к именам файлов" COM_QUANTUMMANAGER_CONFIG_GENERAL_POSTFIX_DESC="" COM_QUANTUMMANAGER_CONFIG_GENERAL_METAFILE_LABEL="Метаинформация для файлов" +COM_QUANTUMMANAGER_CONFIG_GENERAL_DROPAREAHIDDEN_LABEL="Скрывать область загрузки
Будет только кнопка" COM_QUANTUMMANAGER_CONFIG_GENERAL_HELP_LABEL="Показывать ссылки на обратную связь" COM_QUANTUMMANAGER_CONFIG_GENERAL_MIMETYPE_LABEL="Разрешенные mime типы файлов" -COM_QUANTUMMANAGER_CONFIG_GENERAL_MIMETYPE_DESC="1" +COM_QUANTUMMANAGER_CONFIG_GENERAL_MIMETYPE_DESC="" COM_QUANTUMMANAGER_CONFIG_IMAGE="Изображения" COM_QUANTUMMANAGER_CONFIG_IMAGE_DESC="Здесь Вы можете настроить автоматический ресайзинг картинок, а так же наложение водяного знака и обрезки изображений" @@ -49,6 +50,10 @@ COM_QUANTUMMANAGER_ERROR_UPLOAD_ACCESS="Не разрешенный тип фа COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_DRAG_DROP="Бросьте файлы в область для загрузки" COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_DROP="Для загрузки перетащите файлы или" COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_SELECT="выберите на своем устройстве." +COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_ERROR_FILE="Файл " +COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_ERROR_MEGABITE=" мегабайт" +COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_ERROR_MAXSIZE=" не должен превышать " +COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_ERROR_EXS=" должен иметь расширение." COM_QUANTUMMANAGER_FIELDS_QUANTUMVIEWFILES_LOADING="Загрузка" COM_QUANTUMMANAGER_FIELDS_QUANTUMVIEWFILES_EMPTY="Файлов нет." @@ -97,11 +102,16 @@ COM_QUANTUMMANAGER_FIELDS_QUANTUMCROPPERJS_LABEL_SAVE_RATIO="Сохранять COM_QUANTUMMANAGER_HELP_QUESTIONS="Есть вопросы?" COM_QUANTUMMANAGER_HELP_QUESTIONS_CREATE="Спросить" COM_QUANTUMMANAGER_HELP_QUESTIONS_SHOW="Просмотреть все" +COM_QUANTUMMANAGER_HELP_AUTHOR="Контакт с автором" COM_QUANTUMMANAGER_WINDOW_CLOSE="Закрыть" COM_QUANTUMMANAGER_WINDOW_INSERT="Вставить файл" +COM_QUANTUMMANAGER_FILE_METAINFO_DIRECTORYNAME="Название папки" +COM_QUANTUMMANAGER_FILE_METAINFO_COUNTDORECTORIES="Папок" +COM_QUANTUMMANAGER_FILE_METAINFO_COUNTFILES="Файлов" +COM_QUANTUMMANAGER_FILE_METAINFO_FILESSIZE="Размер файлов" COM_QUANTUMMANAGER_FILE_METAINFO_FILENAME="Название файла" COM_QUANTUMMANAGER_FILE_METAINFO_FILEDATETIME="Время изменения" COM_QUANTUMMANAGER_FILE_METAINFO_FILESIZE="Размер файла" diff --git a/administrator/components/com_quantummanager/language/ru-RU/ru-RU.com_quantummanager.sys.ini b/administrator/components/com_quantummanager/language/ru-RU/ru-RU.com_quantummanager.sys.ini index 779c600..f5c9eb9 100644 --- a/administrator/components/com_quantummanager/language/ru-RU/ru-RU.com_quantummanager.sys.ini +++ b/administrator/components/com_quantummanager/language/ru-RU/ru-RU.com_quantummanager.sys.ini @@ -12,9 +12,10 @@ COM_QUANTUMMANAGER_CONFIG_GENERAL_MAXSIZE_LABEL="Максимальный раз COM_QUANTUMMANAGER_CONFIG_GENERAL_POSTFIX_LABEL="Добавлять постфикс к именам файлов" COM_QUANTUMMANAGER_CONFIG_GENERAL_POSTFIX_DESC="" COM_QUANTUMMANAGER_CONFIG_GENERAL_METAFILE_LABEL="Метаинформация для файлов" +COM_QUANTUMMANAGER_CONFIG_GENERAL_DROPAREAHIDDEN_LABEL="Скрывать область загрузки
Будет только кнопка" COM_QUANTUMMANAGER_CONFIG_GENERAL_HELP_LABEL="Показывать ссылки на обратную связь" COM_QUANTUMMANAGER_CONFIG_GENERAL_MIMETYPE_LABEL="Разрешенные mime типы файлов" -COM_QUANTUMMANAGER_CONFIG_GENERAL_MIMETYPE_DESC="1" +COM_QUANTUMMANAGER_CONFIG_GENERAL_MIMETYPE_DESC="" COM_QUANTUMMANAGER_CONFIG_IMAGE="Изображения" COM_QUANTUMMANAGER_CONFIG_IMAGE_DESC="Здесь Вы можете настроить автоматический ресайзинг картинок, а так же наложение водяного знака и обрезки изображений" @@ -49,6 +50,10 @@ COM_QUANTUMMANAGER_ERROR_UPLOAD_ACCESS="Не разрешенный тип фа COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_DRAG_DROP="Бросьте файлы в область для загрузки" COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_DROP="Для загрузки перетащите файлы или" COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_SELECT="выберите на своем устройстве." +COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_ERROR_FILE="Файл " +COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_ERROR_MEGABITE=" мегабайт" +COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_ERROR_MAXSIZE=" не должен превышать " +COM_QUANTUMMANAGER_FIELDS_QUANTUMUPLOAD_UPLOAD_ERROR_EXS=" должен иметь расширение." COM_QUANTUMMANAGER_FIELDS_QUANTUMVIEWFILES_LOADING="Загрузка" COM_QUANTUMMANAGER_FIELDS_QUANTUMVIEWFILES_EMPTY="Файлов нет." @@ -97,11 +102,16 @@ COM_QUANTUMMANAGER_FIELDS_QUANTUMCROPPERJS_LABEL_SAVE_RATIO="Сохранять COM_QUANTUMMANAGER_HELP_QUESTIONS="Есть вопросы?" COM_QUANTUMMANAGER_HELP_QUESTIONS_CREATE="Спросить" COM_QUANTUMMANAGER_HELP_QUESTIONS_SHOW="Просмотреть все" +COM_QUANTUMMANAGER_HELP_AUTHOR="Контакт с автором" COM_QUANTUMMANAGER_WINDOW_CLOSE="Закрыть" COM_QUANTUMMANAGER_WINDOW_INSERT="Вставить файл" +COM_QUANTUMMANAGER_FILE_METAINFO_DIRECTORYNAME="Название папки" +COM_QUANTUMMANAGER_FILE_METAINFO_COUNTDORECTORIES="Папок" +COM_QUANTUMMANAGER_FILE_METAINFO_COUNTFILES="Файлов" +COM_QUANTUMMANAGER_FILE_METAINFO_FILESSIZE="Размер файлов" COM_QUANTUMMANAGER_FILE_METAINFO_FILENAME="Название файла" COM_QUANTUMMANAGER_FILE_METAINFO_FILEDATETIME="Время изменения" COM_QUANTUMMANAGER_FILE_METAINFO_FILESIZE="Размер файла" diff --git a/administrator/components/com_quantummanager/layouts/fields/quantumupload.php b/administrator/components/com_quantummanager/layouts/fields/quantumupload.php index bdc1ee4..87e521b 100644 --- a/administrator/components/com_quantummanager/layouts/fields/quantumupload.php +++ b/administrator/components/com_quantummanager/layouts/fields/quantumupload.php @@ -37,6 +37,10 @@ diff --git a/administrator/components/com_quantummanager/layouts/help.php b/administrator/components/com_quantummanager/layouts/help.php index ac5832d..942e5a6 100644 --- a/administrator/components/com_quantummanager/layouts/help.php +++ b/administrator/components/com_quantummanager/layouts/help.php @@ -24,7 +24,7 @@
- Контакт с автором + @tsymbalmitia (telegram) | quantum@hika.su (email) diff --git a/administrator/components/com_quantummanager/views/quantummanager/tmpl/default.php b/administrator/components/com_quantummanager/views/quantummanager/tmpl/default.php index ca37bbb..555c0aa 100644 --- a/administrator/components/com_quantummanager/views/quantummanager/tmpl/default.php +++ b/administrator/components/com_quantummanager/views/quantummanager/tmpl/default.php @@ -30,8 +30,8 @@ 'cssClass' => 'quantumtreecatalogs-module-muted' ], 'quantumupload' => [ - 'maxsize' => QuantummanagerHelper::getParamsComponentValue('maxsize'), - 'dropAreaHidden' => 1, + 'maxsize' => QuantummanagerHelper::getParamsComponentValue('maxsize', '10'), + 'dropAreaHidden' => QuantummanagerHelper::getParamsComponentValue('dropareahidden', '0'), 'directory' => $folderRoot ], 'quantumtoolbar' => [ @@ -44,7 +44,7 @@ 'directory' => $folderRoot, 'view' => 'list-grid', 'onlyfiles' => '0', - 'metafile' => QuantummanagerHelper::getParamsComponentValue('metafile'), + 'metafile' => QuantummanagerHelper::getParamsComponentValue('metafile' , '1'), ], 'quantumcropperjs' => [ 'position' => 'bottom' diff --git a/administrator/components/com_quantummanager/views/quantummanager/tmpl/modal.php b/administrator/components/com_quantummanager/views/quantummanager/tmpl/modal.php index 1680fa6..85bf52d 100644 --- a/administrator/components/com_quantummanager/views/quantummanager/tmpl/modal.php +++ b/administrator/components/com_quantummanager/views/quantummanager/tmpl/modal.php @@ -70,8 +70,8 @@ 'cssClass' => 'quantumtreecatalogs-module-muted' ], 'quantumupload' => [ - 'maxsize' => QuantummanagerHelper::getParamsComponentValue('maxsize'), - 'dropAreaHidden' => 1, + 'maxsize' => QuantummanagerHelper::getParamsComponentValue('maxsize', '10'), + 'dropAreaHidden' => QuantummanagerHelper::getParamsComponentValue('dropareahidden', '0'), 'directory' => $folderRoot ], 'quantumtoolbar' => [ @@ -84,7 +84,7 @@ 'directory' => $folderRoot, 'view' => 'list-grid', 'onlyfiles' => '0', - 'metafile' => QuantummanagerHelper::getParamsComponentValue('metafile'), + 'metafile' => QuantummanagerHelper::getParamsComponentValue('metafile', 1), ], 'quantumcropperjs' => [ 'position' => 'bottom' diff --git a/administrator/components/com_quantummanager/views/quantummanager/tmpl/window.php b/administrator/components/com_quantummanager/views/quantummanager/tmpl/window.php index 529404f..7c37d57 100644 --- a/administrator/components/com_quantummanager/views/quantummanager/tmpl/window.php +++ b/administrator/components/com_quantummanager/views/quantummanager/tmpl/window.php @@ -41,8 +41,8 @@ 'cssClass' => 'quantumtreecatalogs-module-muted' ], 'quantumupload' => [ - 'maxsize' => QuantummanagerHelper::getParamsComponentValue('maxsize'), - 'dropAreaHidden' => 1, + 'maxsize' => QuantummanagerHelper::getParamsComponentValue('maxsize', '10'), + 'dropAreaHidden' => QuantummanagerHelper::getParamsComponentValue('dropareahidden', '0'), 'directory' => $folderRoot ], 'quantumtoolbar' => [ @@ -55,7 +55,7 @@ 'directory' => $folderRoot, 'view' => 'list-grid', 'onlyfiles' => '0', - 'metafile' => QuantummanagerHelper::getParamsComponentValue('metafile'), + 'metafile' => QuantummanagerHelper::getParamsComponentValue('metafile', '1'), ], 'quantumcropperjs' => [ 'position' => 'bottom' diff --git a/changelog.md b/changelog.md index 182eebb..2f4c417 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,11 @@ +1.1.4 +- исправление ошибки загрузки класса +- теперь показывается метаинформация папок +- исправление краха метаинфомрации +- не был установлен по умолчанию параметр максимального размера загружаемых файлов +- не показывались ошибки при загрузке файлов +- добавлен параметр показа области загрузки + 1.1.3 - метаинформация по умолчанию включена - если картинка больше не выделена, то переключается метаинформация на следующую выбранную diff --git a/media/com_quantummanager/css/main.css b/media/com_quantummanager/css/main.css index fba04f7..e9725b4 100644 --- a/media/com_quantummanager/css/main.css +++ b/media/com_quantummanager/css/main.css @@ -89,7 +89,7 @@ flex-direction: column; } .quantummanager .quantummanager-container .quantummanager-center > div { - width: 100%; + width: calc(100% - 15px); } .quantummanager .quantummanager-container .quantummanager-right { width: 25%; @@ -528,6 +528,9 @@ background: #fff; z-index: 5; } + .quantummanager .quantummanager-left ~ .quantummanager-center { + padding-left: 20px; + } .quantummanager-left.open { left: 0; } diff --git a/media/com_quantummanager/css/quantumviewfiles.css b/media/com_quantummanager/css/quantumviewfiles.css index 8f4377b..1c73f3c 100644 --- a/media/com_quantummanager/css/quantumviewfiles.css +++ b/media/com_quantummanager/css/quantumviewfiles.css @@ -197,7 +197,7 @@ } .quantumviewfiles-module .view { position: relative; - height: 100%; + height: auto; width: 100%; } .quantumviewfiles-module .meta-file ~ .view { @@ -254,6 +254,10 @@ border: solid 5px #EFEFEF; border-radius: 5px; } +.quantumviewfiles-module .meta-file .meta-preview.meta-preview-folder img { + background-color: transparent; + border: none; +} .quantumviewfiles-module .meta-file table { border-collapse: collapse; border-spacing: 0; diff --git a/media/com_quantummanager/images/icons/folder.svg b/media/com_quantummanager/images/icons/folder.svg new file mode 100644 index 0000000..208ee99 --- /dev/null +++ b/media/com_quantummanager/images/icons/folder.svg @@ -0,0 +1,2 @@ + + diff --git a/media/com_quantummanager/js/quantumupload.js b/media/com_quantummanager/js/quantumupload.js index e3d670a..134e625 100644 --- a/media/com_quantummanager/js/quantumupload.js +++ b/media/com_quantummanager/js/quantumupload.js @@ -9,6 +9,7 @@ window.Qantumupload = function(Filemanager, UploadElement, options) { + this.options = options; this.dropAreaAll = []; this.dropAreaAll = []; this.inputFileAll = []; @@ -120,11 +121,7 @@ window.Qantumupload = function(Filemanager, UploadElement, options) { let file = files[i]; if((file.size / 1024 / 1024) > this.maxsize) { - - /*vex.dialog.alert({ - unsafeMessage: 'Файл ' + file.name + ' не должен превышать ' + maxsize + ' мегабайта.' - });*/ - + alert(QuantumuploadLang.file + file.name + QuantumuploadLang.maxsize + this.maxsize + QuantumuploadLang.megabyte); this.countFiles--; if(this.countFiles === 0) { @@ -137,11 +134,7 @@ window.Qantumupload = function(Filemanager, UploadElement, options) { let currExs = file.name.split('.'); if(currExs.length === 1) { - - /*vex.dialog.alert({ - unsafeMessage: 'Файл ' + file.name + ' должен иметь расширение.' - });*/ - + alert(QuantumuploadLang.file + file.name + QuantumuploadLang.exs); this.countFiles--; return false; } diff --git a/media/com_quantummanager/js/quantumviewfiles.js b/media/com_quantummanager/js/quantumviewfiles.js index f22d785..a390633 100644 --- a/media/com_quantummanager/js/quantumviewfiles.js +++ b/media/com_quantummanager/js/quantumviewfiles.js @@ -22,6 +22,8 @@ window.Quantumviewfiles = function(Filemanager, ViewfilesElement, options) { this.breadcrumbsLists = []; this.breadcrumbsWaitLoad = false; this.searchNameValue = ''; + this.cacheMetaPath = ''; + this.cacheMeta = ''; this.init = function() { let self = this; @@ -56,6 +58,13 @@ window.Quantumviewfiles = function(Filemanager, ViewfilesElement, options) { }); Filemanager.Quantumtoolbar.buttonAdd('viewfilesUp', 'left', 'navigations', 'btn-up hidden-label', QuantumviewfilesLang.buttonUp, 'quantummanager-icon-up', {}, function (ev) { + + if(Filemanager.data.path === undefined) + { + ev.preventDefault(); + return; + } + let currDirectories = Filemanager.data.path.split('/'); if (currDirectories.length > 1) { currDirectories.pop(); @@ -125,10 +134,16 @@ window.Quantumviewfiles = function(Filemanager, ViewfilesElement, options) { ev.preventDefault(); }); - Filemanager.Quantumtoolbar.buttonAdd('viewfilesUploadFile', 'center', 'file-other', 'btn-upload-file hidden-label', QuantumviewfilesLang.buttonUpload, 'quantummanager-icon-upload', {}, function (ev) { - Filemanager.Qantumupload.selectFiles(); - ev.preventDefault(); - }); + if(Filemanager.Qantumupload !== undefined) + { + if(Filemanager.Qantumupload.options.dropAreaHidden === '1') { + Filemanager.Quantumtoolbar.buttonAdd('viewfilesUploadFile', 'center', 'file-other', 'btn-upload-file hidden-label', QuantumviewfilesLang.buttonUpload, 'quantummanager-icon-upload', {}, function (ev) { + Filemanager.Qantumupload.selectFiles(); + ev.preventDefault(); + }); + } + } + } @@ -207,6 +222,11 @@ window.Quantumviewfiles = function(Filemanager, ViewfilesElement, options) { let prevent = false; for(let i=0;i" + QuantumviewfilesLang.loading + "
"; }; - this.hideMetaFile = function () { + this.hideMeta = function () { let self = this; if(self.options.metafile === '1') { @@ -369,6 +392,94 @@ window.Quantumviewfiles = function(Filemanager, ViewfilesElement, options) { } }; + this.showMetaDirectory = function (cacheReset) { + let self = this; + + if(self.options.metafile === '1') { + + if(cacheReset === null || cacheReset === undefined || cacheReset === false) { + if(self.path === self.cacheMetaPath) + { + self.viewMeta.querySelector('.meta-file-list').innerHTML = self.cacheMeta; + let buttonToggleTags = self.viewMeta.querySelector('.show-all-tags'); + + if(buttonToggleTags !== null) { + let metaFind = self.viewMeta.querySelector('.meta-find'); + buttonToggleTags.addEventListener('click', function () { + if(this.classList.contains('active')) { + this.classList.remove('active'); + this.innerHTML = QuantumviewfilesLang.metaFileShow; + metaFind.classList.add('meta-hidden'); + } else { + this.classList.add('active'); + this.innerHTML = QuantumviewfilesLang.metaFileHide; + metaFind.classList.remove('meta-hidden'); + } + }); + } + + return; + } + } + + jQuery.get("/administrator/index.php?option=com_quantummanager&task=quantumviewfiles.getMetaFile&path=" + encodeURIComponent(self.path)).done(function (response) { + response = JSON.parse(response); + if(response.global !== undefined || response.find !== undefined) { + self.viewMeta.classList.remove('hidden'); + + let html = '
'; + + if(response.preview !== undefined) { + html += '
'; + } + + if(response.global !== undefined) { + html += ''; + for (let i in response.global) { + html += ''; + } + html += '
' + response.global[i].key + '' + response.global[i].value + '
'; + } + + if(response.find !== undefined) { + if(Object.keys(response.find).length > 0) { + html += '' + QuantumviewfilesLang.metaFileShow + ''; + html += ''; + for (let i in response.find) { + html += ''; + } + html += '
' + response.find[i].key + '' + response.find[i].value + '
'; + } + } + + html += '
'; + self.viewMeta.querySelector('.meta-file-list').innerHTML = html; + self.cacheMeta = html; + self.cacheMetaPath = self.path; + let buttonToggleTags = self.viewMeta.querySelector('.show-all-tags'); + + if(buttonToggleTags !== null) { + let metaFind = self.viewMeta.querySelector('.meta-find'); + buttonToggleTags.addEventListener('click', function () { + if(this.classList.contains('active')) { + this.classList.remove('active'); + this.innerHTML = QuantumviewfilesLang.metaFileShow; + metaFind.classList.add('meta-hidden'); + } else { + this.classList.add('active'); + this.innerHTML = QuantumviewfilesLang.metaFileHide; + metaFind.classList.remove('meta-hidden'); + } + }); + } + + } else { + self.viewMeta.classList.add('hidden'); + } + }); + } + }; + this.searchByName = function (search) { this.searchNameValue = search; let filesAll = ViewfilesElement.querySelectorAll('.field-list-files .file-item'); diff --git a/quantummanager.xml b/quantummanager.xml index 5ad86fd..e4aa0b7 100644 --- a/quantummanager.xml +++ b/quantummanager.xml @@ -7,7 +7,7 @@ https://delo-design.ru Copyright (C) 2019 "Delo Design". All rights reserved. GNU General Public License version 2 or later; see LICENSE.txt - 1.1.3 + 1.1.4 COM_QUANTUMMANAGER_XML_DESCRIPTION script.php