diff --git a/classes/class.ilOneDriveInitGUI.php b/classes/class.ilOneDriveInitGUI.php index 4bff4a4..8f5fd8c 100644 --- a/classes/class.ilOneDriveInitGUI.php +++ b/classes/class.ilOneDriveInitGUI.php @@ -20,7 +20,7 @@ public function beforeSetContent() $DIC->ui()->mainTemplate()->addJavaScript("./Customizing/global/plugins/Modules/Cloud/CloudHook/OneDrive/js/OneDriveList.js"); srChunkedDirectFileUploadInputGUI::loadJavaScript($DIC->ui()->mainTemplate()); $rename_url = $DIC->ctrl()->getLinkTargetByClass([ilObjCloudGUI::class, ilCloudPluginActionListGUI::class], ilOneDriveActionListGUI::CMD_INIT_RENAME, "", false, false); - $after_upload_url = $DIC->ctrl()->getLinkTargetByClass([ilObjCloudGUI::class, ilOneDriveUploadGUI::class], ilOneDriveUploadGUI::CMD_AFTER_UPLOAD, "", false, false); + $after_upload_url = $DIC->ctrl()->getLinkTargetByClass([ilObjCloudGUI::class, ilCloudPluginUploadGUI::class], ilOneDriveUploadGUI::CMD_AFTER_UPLOAD, "", false, false); $this->tpl_file_tree->setVariable( 'PLUGIN_AFTER_CONTENT', '' + . $tpl->get(); + } } diff --git a/src/EventLog/UI/table/package-lock.json b/src/EventLog/UI/table/package-lock.json index a6e44e2..4f30791 100644 --- a/src/EventLog/UI/table/package-lock.json +++ b/src/EventLog/UI/table/package-lock.json @@ -15,8 +15,10 @@ "@types/react": "^17.0.1", "@types/react-dom": "^17.0.0", "antd-data-table": "^1.0.1", + "i18next": "^19.8.7", "react": "^17.0.1", "react-dom": "^17.0.1", + "react-i18next": "^11.8.6", "react-scripts": "4.0.2", "typescript": "^4.1.4", "web-vitals": "^1.1.0" @@ -9403,6 +9405,14 @@ "node": ">=6" } }, + "node_modules/html-parse-stringify2": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/html-parse-stringify2/-/html-parse-stringify2-2.0.1.tgz", + "integrity": "sha1-3FZwtyksoVi3vJFsmmc1rIhyg0o=", + "dependencies": { + "void-elements": "^2.0.1" + } + }, "node_modules/html-webpack-plugin": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-4.5.0.tgz", @@ -9667,6 +9677,14 @@ "node": ">=8.12.0" } }, + "node_modules/i18next": { + "version": "19.8.7", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-19.8.7.tgz", + "integrity": "sha512-ezo1gb7QO4OQ5gQCdZMUxopwQSoqpRp6whdEjm1grxMSmkGj1NJ+kYS0UQd4NnpPIVqsgqTQ2L2eqSQYQ+U3Fw==", + "dependencies": { + "@babel/runtime": "^7.12.0" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -16648,6 +16666,19 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz", "integrity": "sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew==" }, + "node_modules/react-i18next": { + "version": "11.8.6", + "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-11.8.6.tgz", + "integrity": "sha512-Nr4Fq7BvzDLJQmaDyJRkPPINgMW1Y1qeT4STBoY/ePGmYlCZGShTYqqyBm0ly6M8dV1X0twt7M5dfmDzfi9yGQ==", + "dependencies": { + "@babel/runtime": "^7.3.1", + "html-parse-stringify2": "2.0.1" + }, + "peerDependencies": { + "i18next": ">= 19.0.0", + "react": ">= 16.8.0" + } + }, "node_modules/react-is": { "version": "17.0.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.1.tgz", @@ -20180,6 +20211,14 @@ "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==" }, + "node_modules/void-elements": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", + "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/w3c-hr-time": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", @@ -29477,6 +29516,14 @@ "terser": "^4.6.3" } }, + "html-parse-stringify2": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/html-parse-stringify2/-/html-parse-stringify2-2.0.1.tgz", + "integrity": "sha1-3FZwtyksoVi3vJFsmmc1rIhyg0o=", + "requires": { + "void-elements": "^2.0.1" + } + }, "html-webpack-plugin": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/html-webpack-plugin/-/html-webpack-plugin-4.5.0.tgz", @@ -29700,6 +29747,14 @@ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-1.1.1.tgz", "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==" }, + "i18next": { + "version": "19.8.7", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-19.8.7.tgz", + "integrity": "sha512-ezo1gb7QO4OQ5gQCdZMUxopwQSoqpRp6whdEjm1grxMSmkGj1NJ+kYS0UQd4NnpPIVqsgqTQ2L2eqSQYQ+U3Fw==", + "requires": { + "@babel/runtime": "^7.12.0" + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -35043,6 +35098,15 @@ "resolved": "https://registry.npmjs.org/react-error-overlay/-/react-error-overlay-6.0.9.tgz", "integrity": "sha512-nQTTcUu+ATDbrSD1BZHr5kgSD4oF8OFjxun8uAaL8RwPBacGBNPf/yAuVVdx17N8XNzRDMrZ9XcKZHCjPW+9ew==" }, + "react-i18next": { + "version": "11.8.6", + "resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-11.8.6.tgz", + "integrity": "sha512-Nr4Fq7BvzDLJQmaDyJRkPPINgMW1Y1qeT4STBoY/ePGmYlCZGShTYqqyBm0ly6M8dV1X0twt7M5dfmDzfi9yGQ==", + "requires": { + "@babel/runtime": "^7.3.1", + "html-parse-stringify2": "2.0.1" + } + }, "react-is": { "version": "17.0.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.1.tgz", @@ -37837,6 +37901,11 @@ "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-1.1.2.tgz", "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==" }, + "void-elements": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-2.0.1.tgz", + "integrity": "sha1-wGavtYK7HLQSjWDqkjkulNXp2+w=" + }, "w3c-hr-time": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz", diff --git a/src/EventLog/UI/table/package.json b/src/EventLog/UI/table/package.json index 772fdbc..bf6ba13 100644 --- a/src/EventLog/UI/table/package.json +++ b/src/EventLog/UI/table/package.json @@ -11,8 +11,10 @@ "@types/react": "^17.0.1", "@types/react-dom": "^17.0.0", "antd-data-table": "^1.0.1", + "i18next": "^19.8.7", "react": "^17.0.1", "react-dom": "^17.0.1", + "react-i18next": "^11.8.6", "react-scripts": "4.0.2", "typescript": "^4.1.4", "web-vitals": "^1.1.0" diff --git a/src/EventLog/UI/table/src/Columns.tsx b/src/EventLog/UI/table/src/Columns.tsx new file mode 100644 index 0000000..4aab872 --- /dev/null +++ b/src/EventLog/UI/table/src/Columns.tsx @@ -0,0 +1,30 @@ +const columns: { + dataIndex: string, + key: string +}[] = [ + { + dataIndex: "id", + key: "id" + }, + { + dataIndex: "timestamp", + key: "timestamp" + }, + { + dataIndex: "event_type", + key: "event_type" + }, + { + dataIndex: "path", + key: "path" + }, + { + dataIndex: "object_type", + key: "object_type" + }, + { + dataIndex: "additional_data", + key: "additional_data" + } +]; +export default columns; diff --git a/src/EventLog/UI/table/src/DataTable.tsx b/src/EventLog/UI/table/src/DataTable.tsx index 0d6edee..4f416e7 100644 --- a/src/EventLog/UI/table/src/DataTable.tsx +++ b/src/EventLog/UI/table/src/DataTable.tsx @@ -1,52 +1,33 @@ import React from "react"; -import { Table } from "antd"; +import {Table} from "antd"; import "antd/dist/antd.css"; +import columns from "./Columns"; +import { withTranslation } from "react-i18next"; -export default class DataTable extends React.Component { - columns: any = [ - { - title: 'Id', - dataIndex: 'id', - key: 'id' - }, - { - title: 'Timestamp', - dataIndex: 'timestamp', - key: 'timestamp', - }, - { - title: 'Name', - dataIndex: 'event_type', - key: 'event_type', - }, - { - title: 'Path', - dataIndex: 'path', - key: 'path', - }, - { - title: 'Object Type', - dataIndex: 'object_type', - key: 'object_type', - }, - { - title: 'Additional Data', - dataIndex: 'additional_data', - key: 'additional_data', - } - ]; +class DataTable extends React.Component { constructor(props: any) { super(props); // @ts-ignore let data: any = window.exod_log_data; this.state = { - data: data + data: data.map((set: any) => { + set.event_type = this.props.t("event_type." + set.event_type); + set.object_type = this.props.t("object_type." + set.object_type); + return set; + }) } } render() { - console.log(this.state.data); - return (); + return (
{ + return { + dataIndex: val.dataIndex, + key: val.key, + title: this.props.t("column." + val.key) + } + })}/>); } } + +export default withTranslation()(DataTable); diff --git a/src/EventLog/UI/table/src/i18n/i18n.json b/src/EventLog/UI/table/src/i18n/i18n.json new file mode 100644 index 0000000..5e960f5 --- /dev/null +++ b/src/EventLog/UI/table/src/i18n/i18n.json @@ -0,0 +1,57 @@ +{ + "de": { + "translation": { + "column": { + "id": "ID", + "timestamp": "Timestamp", + "name": "Name", + "path": "Pfad", + "object_type": "Objekttyp", + "additional_data": "Zusätzliche Informationen", + "event_type": "Ereignis" + }, + "event_type": { + "upload_started": "Upload gestartet", + "upload_aborted": "Upload abgebrochen", + "upload_complete": "Upload abgeschlossen", + "object_deleted": "Objekt gelöscht", + "object_renamed": "Objekt umbenannt" + }, + "object_type": { + "file": "Datei", + "folder": "Ordner" + }, + "additional_data": { + "new_name": "neuer Titel" + } + } + }, + "en": { + "translation": { + "test": "test", + "column": { + "id": "ID", + "timestamp": "Timestamp", + "name": "Name", + "path": "Path", + "object_type": "Object Type", + "additional_data": "Additional Data", + "event_type": "Event" + }, + "event_type": { + "upload_started": "upload started", + "upload_aborted": "upload aborted", + "upload_complete": "upload complete", + "object_deleted": "object deleted", + "object_renamed": "object renamed" + }, + "object_type": { + "file": "file", + "folder": "folder" + }, + "additional_data": { + "new_name": "new name" + } + } + } +} diff --git a/src/EventLog/UI/table/src/i18n/i18n.tsx b/src/EventLog/UI/table/src/i18n/i18n.tsx new file mode 100644 index 0000000..0f6416a --- /dev/null +++ b/src/EventLog/UI/table/src/i18n/i18n.tsx @@ -0,0 +1,15 @@ +import i18n from "i18next"; +import {initReactI18next} from "react-i18next"; + +const resources = require('./i18n.json') + +i18n.use(initReactI18next) + .init({ + resources, + // @ts-ignore + lng: window.lng, + fallbackLng: "en", + debug: true, + }); + +export default i18n; diff --git a/src/EventLog/UI/table/src/index.tsx b/src/EventLog/UI/table/src/index.tsx index ef2edf8..5d6fed6 100644 --- a/src/EventLog/UI/table/src/index.tsx +++ b/src/EventLog/UI/table/src/index.tsx @@ -3,6 +3,7 @@ import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals'; +import './i18n/i18n'; ReactDOM.render( diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 7074bcd..87abed4 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -45,6 +45,7 @@ 'ilOneDriveConfigGUI' => $baseDir . '/classes/class.ilOneDriveConfigGUI.php', 'ilOneDriveCreateFolderGUI' => $baseDir . '/classes/class.ilOneDriveCreateFolderGUI.php', 'ilOneDriveCreationGUI' => $baseDir . '/classes/class.ilOneDriveCreationGUI.php', + 'ilOneDriveDeleteGUI' => $baseDir . '/classes/class.ilOneDriveDeleteGUI.php', 'ilOneDriveException' => $baseDir . '/classes/Exception/ilOneDriveException.php', 'ilOneDriveFileTreeGUI' => $baseDir . '/classes/class.ilOneDriveFileTreeGUI.php', 'ilOneDriveHeaderActionGUI' => $baseDir . '/classes/class.ilOneDriveHeaderActionGUI.php', @@ -58,6 +59,7 @@ 'srag\\Plugins\\OneDrive\\EventLog\\EventLogger' => $baseDir . '/src/EventLog/EventLogger.php', 'srag\\Plugins\\OneDrive\\EventLog\\EventType' => $baseDir . '/src/EventLog/EventType.php', 'srag\\Plugins\\OneDrive\\EventLog\\ObjectType' => $baseDir . '/src/EventLog/ObjectType.php', + 'srag\\Plugins\\OneDrive\\EventLog\\UI\\EventLogTableUI' => $baseDir . '/src/EventLog/UI/EventLogTableUI.php', 'srag\\Plugins\\OneDrive\\Input\\srChunkedDirectFileUploadInputGUI' => $baseDir . '/src/Input/ChunkedFileUpload/srChunkedDirectFileUploadInputGUI.php', 'srag\\Plugins\\OneDrive\\Waiter\\Waiter' => $baseDir . '/src/Util/Waiter/Waiter.php', ); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index e56320b..109ab43 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -60,6 +60,7 @@ class ComposerStaticInit7f6a7ab5d2d9578777e239f27ff216d2 'ilOneDriveConfigGUI' => __DIR__ . '/../..' . '/classes/class.ilOneDriveConfigGUI.php', 'ilOneDriveCreateFolderGUI' => __DIR__ . '/../..' . '/classes/class.ilOneDriveCreateFolderGUI.php', 'ilOneDriveCreationGUI' => __DIR__ . '/../..' . '/classes/class.ilOneDriveCreationGUI.php', + 'ilOneDriveDeleteGUI' => __DIR__ . '/../..' . '/classes/class.ilOneDriveDeleteGUI.php', 'ilOneDriveException' => __DIR__ . '/../..' . '/classes/Exception/ilOneDriveException.php', 'ilOneDriveFileTreeGUI' => __DIR__ . '/../..' . '/classes/class.ilOneDriveFileTreeGUI.php', 'ilOneDriveHeaderActionGUI' => __DIR__ . '/../..' . '/classes/class.ilOneDriveHeaderActionGUI.php', @@ -73,6 +74,7 @@ class ComposerStaticInit7f6a7ab5d2d9578777e239f27ff216d2 'srag\\Plugins\\OneDrive\\EventLog\\EventLogger' => __DIR__ . '/../..' . '/src/EventLog/EventLogger.php', 'srag\\Plugins\\OneDrive\\EventLog\\EventType' => __DIR__ . '/../..' . '/src/EventLog/EventType.php', 'srag\\Plugins\\OneDrive\\EventLog\\ObjectType' => __DIR__ . '/../..' . '/src/EventLog/ObjectType.php', + 'srag\\Plugins\\OneDrive\\EventLog\\UI\\EventLogTableUI' => __DIR__ . '/../..' . '/src/EventLog/UI/EventLogTableUI.php', 'srag\\Plugins\\OneDrive\\Input\\srChunkedDirectFileUploadInputGUI' => __DIR__ . '/../..' . '/src/Input/ChunkedFileUpload/srChunkedDirectFileUploadInputGUI.php', 'srag\\Plugins\\OneDrive\\Waiter\\Waiter' => __DIR__ . '/../..' . '/src/Util/Waiter/Waiter.php', );