diff --git a/.gitignore b/.gitignore index 7108f78..fb3ebc6 100644 --- a/.gitignore +++ b/.gitignore @@ -43,3 +43,9 @@ buildNumber.properties Network Trash Folder Temporary Items .apdisk + +/**/node_modules/ + +# Jangaroo Build +dist/ +build/ diff --git a/README.md b/README.md index b3178b0..96cf77f 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,10 @@ Per default, requests can only be redirected to a CoreMedia content. Redirects t Getting started =============== -The extension is always kept compatible with the newest CoreMedia version (currently cmcc-10-2107.1). The redirect -manager is also known to work with cms-9-1904, cms-9-1901 and cms-9-1810 (https://github.com/tallence/core-redirects/tree/cm9-1904). +The extension runs with CoreMedia 11 (v2110.1). And also runs with: +- v2107.1. See the release [cmcc-10-2107.1](https://github.com/tallence/core-redirects/releases/tag/cmcc-10-2107.1). +- v2007.2. See the release [cmcc-10-2007.2](https://github.com/tallence/core-redirects/releases/tag/cmcc-10-2007.2). +- CoreMedia 9 (v18.10). See the branch: [1904.2-compatible](https://github.com/tallence/core-redirects/tree/cm9-1904). There is a [simple user guide](docs/userguide.md) available. diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/.eslintrc.js b/apps/studio-client/apps/main/core-redirects-studio-plugin/.eslintrc.js new file mode 100644 index 0000000..bc3a898 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: ["@jangaroo/eslint-config"], +}; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/jangaroo.config.js b/apps/studio-client/apps/main/core-redirects-studio-plugin/jangaroo.config.js new file mode 100644 index 0000000..f317a97 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/jangaroo.config.js @@ -0,0 +1,40 @@ +const { jangarooConfig } = require("@jangaroo/core"); + +module.exports = jangarooConfig({ + type: "code", + sencha: { + name: "com.coremedia.blueprint__core-redirects-studio-plugin", + namespace: "com.tallence.core.redirects.studio", + studioPlugins: [ + { + mainClass: "com.tallence.core.redirects.studio.RedirectManagerStudioPlugin", + name: "Redirect Manager Extension", + }, + ], + }, + appManifests: { + en: { + categories: [ + "Content", + ], + cmServiceShortcuts: [ + { + cmKey: "redirect-manager", + cmCategory: "Content", + name: "Redirect manager", + url: "", + cmAdministrative: true, + cmService: { + name: "launchSubAppService", + method: "launchSubApp", + }, + }, + ], + }, + }, + command: { + build: { + ignoreTypeErrors: false + }, + }, +}); diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/package.json b/apps/studio-client/apps/main/core-redirects-studio-plugin/package.json new file mode 100644 index 0000000..43757f3 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/package.json @@ -0,0 +1,56 @@ +{ + "name": "@coremedia-blueprint/studio-client.main.core-redirects-studio-plugin", + "author": "Tallence AG", + "version": "1.0.0-SNAPSHOT", + "private": true, + "dependencies": { + "@coremedia-blueprint/studio-client.main.blueprint-forms": "1.0.0-SNAPSHOT", + "@coremedia/studio-client.app-context-models": "2110.1.0", + "@coremedia/studio-client.cap-base-models": "2110.1.0", + "@coremedia/studio-client.cap-rest-client": "2110.1.0", + "@coremedia/studio-client.client-core": "2110.1.0", + "@coremedia/studio-client.client-core-impl": "2110.1.0", + "@coremedia/studio-client.core-icons": "2110.1.0", + "@coremedia/studio-client.ext.base-components": "2110.1.0", + "@coremedia/studio-client.ext.ui-components": "2110.1.0", + "@coremedia/studio-client.main.bpbase-studio-components": "2110.1.0", + "@coremedia/studio-client.main.editor-components": "2110.1.0", + "@coremedia/studio-client.multi-site-models": "2110.1.0", + "@jangaroo/ext-ts": "^1.0.0", + "@jangaroo/jooflash-core": "^1.0.0", + "@jangaroo/runtime": "^1.0.0" + }, + "devDependencies": { + "@jangaroo/build": "^1.0.0", + "@jangaroo/core": "^1.0.0", + "@jangaroo/eslint-config": "^1.0.0", + "@jangaroo/publish": "^1.0.0", + "eslint": "^7.27.0", + "rimraf": "^3.0.2" + }, + "scripts": { + "clean": "rimraf ./dist && rimraf ./build", + "build": "jangaroo build", + "watch": "jangaroo watch", + "publish": "jangaroo publish", + "lint": "eslint --fix \"src/**/*.ts\"" + }, + "exports": { + "./*": { + "types": "./src/*.ts", + "default": "./dist/src/*.js" + } + }, + "coremedia": { + "projectExtensionFor": "studio-client.main-static" + }, + "publishConfig": { + "directory": "dist", + "exports": { + "./*": { + "types": "./src/*.d.ts", + "default": "./src/*.js" + } + } + } +} diff --git a/core-redirects-studio-plugin/src/main/sencha/resources/fonts/tallencecme.eot b/apps/studio-client/apps/main/core-redirects-studio-plugin/sencha/resources/fonts/tallencecme.eot old mode 100755 new mode 100644 similarity index 100% rename from core-redirects-studio-plugin/src/main/sencha/resources/fonts/tallencecme.eot rename to apps/studio-client/apps/main/core-redirects-studio-plugin/sencha/resources/fonts/tallencecme.eot diff --git a/core-redirects-studio-plugin/src/main/sencha/resources/fonts/tallencecme.svg b/apps/studio-client/apps/main/core-redirects-studio-plugin/sencha/resources/fonts/tallencecme.svg old mode 100755 new mode 100644 similarity index 100% rename from core-redirects-studio-plugin/src/main/sencha/resources/fonts/tallencecme.svg rename to apps/studio-client/apps/main/core-redirects-studio-plugin/sencha/resources/fonts/tallencecme.svg diff --git a/core-redirects-studio-plugin/src/main/sencha/resources/fonts/tallencecme.ttf b/apps/studio-client/apps/main/core-redirects-studio-plugin/sencha/resources/fonts/tallencecme.ttf old mode 100755 new mode 100644 similarity index 100% rename from core-redirects-studio-plugin/src/main/sencha/resources/fonts/tallencecme.ttf rename to apps/studio-client/apps/main/core-redirects-studio-plugin/sencha/resources/fonts/tallencecme.ttf diff --git a/core-redirects-studio-plugin/src/main/sencha/resources/fonts/tallencecme.woff b/apps/studio-client/apps/main/core-redirects-studio-plugin/sencha/resources/fonts/tallencecme.woff old mode 100755 new mode 100644 similarity index 100% rename from core-redirects-studio-plugin/src/main/sencha/resources/fonts/tallencecme.woff rename to apps/studio-client/apps/main/core-redirects-studio-plugin/sencha/resources/fonts/tallencecme.woff diff --git a/core-redirects-studio-plugin/src/main/sencha/sass/src/com/tallence/core/redirects/studio/RedirectManagerStudioPlugin.scss b/apps/studio-client/apps/main/core-redirects-studio-plugin/sencha/sass/src/RedirectManagerStudioPlugin.scss similarity index 100% rename from core-redirects-studio-plugin/src/main/sencha/sass/src/com/tallence/core/redirects/studio/RedirectManagerStudioPlugin.scss rename to apps/studio-client/apps/main/core-redirects-studio-plugin/sencha/sass/src/RedirectManagerStudioPlugin.scss diff --git a/core-redirects-studio-plugin/src/main/sencha/sass/var/com/tallence/core/redirects/studio/RedirectManagerStudioPlugin.scss b/apps/studio-client/apps/main/core-redirects-studio-plugin/sencha/sass/var/RedirectManagerStudioPlugin.scss similarity index 100% rename from core-redirects-studio-plugin/src/main/sencha/sass/var/com/tallence/core/redirects/studio/RedirectManagerStudioPlugin.scss rename to apps/studio-client/apps/main/core-redirects-studio-plugin/sencha/sass/var/RedirectManagerStudioPlugin.scss diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/RedirectManagerStudioPlugin.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/RedirectManagerStudioPlugin.ts new file mode 100644 index 0000000..3f2fe38 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/RedirectManagerStudioPlugin.ts @@ -0,0 +1,102 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import ContentTypes_properties from "@coremedia/studio-client.cap-base-models/content/ContentTypes_properties"; +import StudioAppsImpl from "@coremedia/studio-client.app-context-models/apps/StudioAppsImpl"; +import studioApps from "@coremedia/studio-client.app-context-models/apps/studioApps"; +import CopyResourceBundleProperties + from "@coremedia/studio-client.main.editor-components/configuration/CopyResourceBundleProperties"; +import RegisterRestResource from "@coremedia/studio-client.main.editor-components/configuration/RegisterRestResource"; +import AddTabbedDocumentFormsPlugin + from "@coremedia/studio-client.main.editor-components/sdk/plugins/AddTabbedDocumentFormsPlugin"; +import TabbedDocumentFormDispatcher + from "@coremedia/studio-client.main.editor-components/sdk/premular/TabbedDocumentFormDispatcher"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import resourceManager from "@jangaroo/runtime/l10n/resourceManager"; +import RedirectManagerStudioPluginBase from "./RedirectManagerStudioPluginBase"; +import RedirectContentTypes_properties from "./bundles/RedirectContentTypes_properties"; +import RedirectImpl from "./data/RedirectImpl"; +import RedirectsImpl from "./data/RedirectsImpl"; +import RedirectForm from "./studioform/RedirectForm"; +import IEditorContext from "@coremedia/studio-client.main.editor-components/sdk/IEditorContext"; +import {cast} from "@jangaroo/runtime"; +import OpenRedirectManagerEditorAction from "./action/OpenRedirectManagerEditorAction"; +import WorkArea from "@coremedia/studio-client.main.editor-components/sdk/desktop/WorkArea"; +import WorkAreaTabTypesPlugin + from "@coremedia/studio-client.main.editor-components/sdk/desktop/WorkAreaTabTypesPlugin"; +import ComponentBasedWorkAreaTabType + from "@coremedia/studio-client.main.editor-components/sdk/desktop/ComponentBasedWorkAreaTabType"; +import RedirectManagerEditor from "./editor/RedirectManagerEditor"; + +interface RedirectManagerStudioPluginConfig extends Config { +} + +class RedirectManagerStudioPlugin extends RedirectManagerStudioPluginBase { + declare Config: RedirectManagerStudioPluginConfig; + + override init(editorContext: IEditorContext): void { + super.init(editorContext); + + cast(StudioAppsImpl, studioApps._).getSubAppLauncherRegistry().registerSubAppLauncher("redirect-manager", (): void => { + const openTagsAction = new OpenRedirectManagerEditorAction(); + openTagsAction.execute(); + }); + } + + constructor(config: Config = null) { + super(ConfigUtils.apply(Config(RedirectManagerStudioPlugin, { + + rules: [ + + Config(TabbedDocumentFormDispatcher, { + plugins: [ + Config(AddTabbedDocumentFormsPlugin, { + documentTabPanels: [ + Config(RedirectForm, { itemId: "Redirect" }), + ], + }), + ], + }), + + Config(WorkArea, { + plugins: [ + Config(WorkAreaTabTypesPlugin, { + tabTypes: [ + new ComponentBasedWorkAreaTabType({ tabComponent: Config(RedirectManagerEditor, { closable: true }) }), + ], + }), + ], + }), + + ], + + configuration: [ + + new RegisterRestResource({ beanClass: RedirectsImpl }), + new RegisterRestResource({ beanClass: RedirectImpl }), + + new CopyResourceBundleProperties({ + destination: resourceManager.getResourceBundle(null, ContentTypes_properties), + source: resourceManager.getResourceBundle(null, RedirectContentTypes_properties), + }), + + ], + + }), config)); + } +} + +export default RedirectManagerStudioPlugin; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/RedirectManagerStudioPluginBase.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/RedirectManagerStudioPluginBase.ts new file mode 100644 index 0000000..9e7ab4f --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/RedirectManagerStudioPluginBase.ts @@ -0,0 +1,43 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import BeanClassRegistry from "@coremedia/studio-client.client-core-impl/data/impl/BeanClassRegistry"; +import StudioPlugin from "@coremedia/studio-client.main.editor-components/configuration/StudioPlugin"; +import IEditorContext from "@coremedia/studio-client.main.editor-components/sdk/IEditorContext"; +import Config from "@jangaroo/runtime/Config"; +import RedirectManagerStudioPlugin from "./RedirectManagerStudioPlugin"; +import RedirectSourceParameter from "./data/RedirectSourceParameter"; +import RedirectTargetParameter from "./data/RedirectTargetParameter"; + +interface RedirectManagerStudioPluginBaseConfig extends Config { +} + +class RedirectManagerStudioPluginBase extends StudioPlugin { + declare Config: RedirectManagerStudioPluginBaseConfig; + + constructor(config: Config = null) { + super(config); + } + + override init(editorContext: IEditorContext): void { + super.init(editorContext); + + BeanClassRegistry.registerTypeImplementation("com.tallence.core.redirects.studio.data.RedirectSourceParameter", RedirectSourceParameter); + BeanClassRegistry.registerTypeImplementation("com.tallence.core.redirects.studio.data.RedirectTargetParameter", RedirectTargetParameter); + } +} + +export default RedirectManagerStudioPluginBase; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/action/OpenRedirectManagerEditorAction.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/action/OpenRedirectManagerEditorAction.ts new file mode 100644 index 0000000..8df7651 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/action/OpenRedirectManagerEditorAction.ts @@ -0,0 +1,31 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import OpenRedirectManagerEditorActionBase from "./OpenRedirectManagerEditorActionBase"; + +interface OpenRedirectManagerEditorActionConfig extends Config { +} + +class OpenRedirectManagerEditorAction extends OpenRedirectManagerEditorActionBase { + declare Config: OpenRedirectManagerEditorActionConfig; + + constructor(config: Config = null) { + super(ConfigUtils.apply(Config(OpenRedirectManagerEditorAction), config)); + } +} + +export default OpenRedirectManagerEditorAction; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/action/OpenRedirectManagerEditorActionBase.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/action/OpenRedirectManagerEditorActionBase.ts new file mode 100644 index 0000000..8132b87 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/action/OpenRedirectManagerEditorActionBase.ts @@ -0,0 +1,54 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import WorkArea from "@coremedia/studio-client.main.editor-components/sdk/desktop/WorkArea"; +import editorContext from "@coremedia/studio-client.main.editor-components/sdk/editorContext"; +import Action from "@jangaroo/ext-ts/Action"; +import Panel from "@jangaroo/ext-ts/panel/Panel"; +import { as } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import RedirectManagerEditor from "../editor/RedirectManagerEditor"; +import RedirectManagerEditorBase from "../editor/RedirectManagerEditorBase"; +import OpenRedirectManagerEditorAction from "./OpenRedirectManagerEditorAction"; + +interface OpenRedirectManagerEditorActionBaseConfig extends Config { +} + +class OpenRedirectManagerEditorActionBase extends Action { + declare Config: OpenRedirectManagerEditorActionBaseConfig; + + constructor(config: Config = null) { + config.handler = OpenRedirectManagerEditorActionBase.openRedirectAdmin; + super(config); + } + + static openRedirectAdmin(): void { + const workArea = as(editorContext._.getWorkArea(), WorkArea); + let redirectManagerTab = RedirectManagerEditorBase.getInstance(); + + if (!redirectManagerTab) { + const workAreaTabType = workArea.getTabTypeById(RedirectManagerEditor.xtype); + workAreaTabType.createTab(null, (tab: Panel): void => { + redirectManagerTab = as(tab, RedirectManagerEditor); + workArea.addTab(workAreaTabType, redirectManagerTab); + }); + } + + workArea.setActiveTab(redirectManagerTab); + } +} + +export default OpenRedirectManagerEditorActionBase; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/bundles/RedirectContentTypes_de_properties.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/bundles/RedirectContentTypes_de_properties.ts new file mode 100644 index 0000000..48bf6c6 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/bundles/RedirectContentTypes_de_properties.ts @@ -0,0 +1,30 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import ResourceBundleUtil from "@jangaroo/runtime/l10n/ResourceBundleUtil"; +import RedirectContentTypes_properties from "./RedirectContentTypes_properties"; + +/** + * Overrides of ResourceBundle "RedirectContentTypes" for Locale "de". + * @see RedirectContentTypes_properties#INSTANCE + */ +ResourceBundleUtil.override(RedirectContentTypes_properties, { + Redirect_redirectType_text: "Typ", + Redirect_edit_hint_text: "Die Umleitung kann in diesem Formular nicht editiert werden. Bitte nutzen Sie dafür den Redirect-Manager:", + Redirect_sourceUrlType_text: "Url Typ", + Redirect_source_text: "Quelle", + Redirect_targetLink_text: "Ziel", + Redirect_description_text: "Beschreibung", +}); diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/bundles/RedirectContentTypes_properties.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/bundles/RedirectContentTypes_properties.ts new file mode 100644 index 0000000..e582d20 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/bundles/RedirectContentTypes_properties.ts @@ -0,0 +1,46 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Interface values for ResourceBundle "RedirectContentTypes". + * @see RedirectContentTypes_properties#INSTANCE + */ +interface RedirectContentTypes_properties { + + Redirect_icon: string; + Redirect_edit_hint_text: string; + Redirect_redirectType_text: string; + Redirect_sourceUrlType_text: string; + Redirect_source_text: string; + Redirect_targetLink_text: string; + Redirect_description_text: string; +} + +/** + * Singleton for the current user Locale's instance of ResourceBundle "RedirectContentTypes". + * @see RedirectContentTypes_properties + */ +const RedirectContentTypes_properties: RedirectContentTypes_properties = { + Redirect_icon: "tallence-icons tallence-icons--redirects", + Redirect_edit_hint_text: "Redirects cannot be edited in this form. Please use the redirect manager:", + Redirect_redirectType_text: "Type", + Redirect_sourceUrlType_text: "Source Url Type", + Redirect_source_text: "Source", + Redirect_targetLink_text: "Target Link", + Redirect_description_text: "Description", +}; + +export default RedirectContentTypes_properties; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/bundles/RedirectManagerStudioPlugin_de_properties.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/bundles/RedirectManagerStudioPlugin_de_properties.ts new file mode 100644 index 0000000..28d6074 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/bundles/RedirectManagerStudioPlugin_de_properties.ts @@ -0,0 +1,151 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import ResourceBundleUtil from "@jangaroo/runtime/l10n/ResourceBundleUtil"; +import RedirectManagerStudioPlugin_properties from "./RedirectManagerStudioPlugin_properties"; + +/** + * Overrides of ResourceBundle "RedirectManagerStudioPlugin" for Locale "de". + * @see RedirectManagerStudioPlugin_properties#INSTANCE + */ +ResourceBundleUtil.override(RedirectManagerStudioPlugin_properties, { + redirectmanager_text: "RedirectManager", + redirectmanager_button_text: "Umleitungen", + redirectmanager_button_tooltip: "Umleitungen verwalten", + redirectmanager_editor_list_loading: "Lade Umleitungen..", + redirectmanager_editor_list_nothing_found: "Keine Umleitungen gefunden..", + redirectmanager_editor_list_nothing_found_match: "Keine Umleitungen mit der gleichen Quelle gefunden..", + redirectmanager_editor_same_source_title: "Umelitungen mit der selben Quell-Url", + redirectmanager_editor_list_text: "Umleitungen", + redirectmanager_editor_list_error_no_target: "Fehlendes Ziel", + redirectmanager_editor_edit_text: "Umleitung", + redirectmanager_editor_field_active: "Publiziert", + redirectmanager_editor_field_source: "Quelle", + redirectmanager_editor_field_target: "Ziel", + redirectmanager_editor_field_target_link_select: "Inhalt", + redirectmanager_editor_field_target_path_select: "URL", + redirectmanager_editor_field_targetLink: "Ziel-Inhalt", + redirectmanager_editor_field_targetUrl: "Ziel-Url", + redirectmanager_editor_field_creationDate: "Erstellungsdatum", + redirectmanager_editor_field_type: "Typ", + redirectmanager_editor_field_type_value_0: "Immer", + redirectmanager_editor_field_type_value_1: "Nur nach 404", + redirectmanager_editor_field_type_value_2: "Vanity Umleitung", + redirectmanager_editor_field_type_invalid: "Ungültiger Wert", + redirectmanager_editor_field_parameters: "Parameter", + redirectmanager_editor_field_description: "Beschreibung", + redirectmanager_editor_field_sourceType: "Quell-Url-Type", + redirectmanager_editor_field_sourceType_plain: "Plain", + redirectmanager_editor_field_sourceType_regex: "Regulärer Ausdruck", + redirectmanager_editor_actions_new_tooltip: "Neue Umleitung hinzufügen", + redirectmanager_editor_actions_new_text: "Neue Umleitung", + redirectmanager_editor_actions_new_success_text: "Die Umleitung wurde erfolgreich angelegt!
Die Umleitung ist nicht direkt in der Tabelle sichtbar.
Bitte klicken Sie den Aktualisierungs Button.", + redirectmanager_editor_actions_new_error_text: "fehler beim Erstellen der Umleitung!
Ursache:", + redirectmanager_editor_field_parameterName: "Name", + redirectmanager_editor_field_parameterValue: "Wert", + redirectmanager_editor_field_sourceParameters: "Quell-Parameter", + redirectmanager_editor_field_targetParameters: "Ziel-Parameter", + redirectmanager_editor_actions_delete_tooltip: "Umleitung löschen", + redirectmanager_editor_actions_delete_confirm_title: "Umleitung löschen", + redirectmanager_editor_actions_delete_confirm_text: "Wollen Sie diese Umleitung wirklich löschen?", + redirectmanager_editor_actions_save_confirm_title: "Umleitung speichern", + redirectmanager_editor_actions_save_confirm_text: "Wollen Sie die Änderungen an dieser Umleitung speichern?", + redirectmanager_editor_actions_reload_tooltip: "Umleitungen neu laden", + redirectmanager_editor_actions_reload_text: "Neu laden", + redirectmanager_editor_action_result_title_success: "Erfolgreich", + redirectmanager_editor_action_result_title_error: "Fehler", + redirectmanager_editor_actions_publish_tooltip: "Aktuellen Stand der Umleitungen publizieren", + redirectmanager_editor_actions_publish_text: "Publizieren", + redirectmanager_editor_actions_publish_confirm_title: "Umleitungen publizieren", + redirectmanager_editor_actions_publish_confirm_text: "Wollen Sie den aktuellen Stand der Umleitungen publizieren?", + redirectmanager_editor_actions_publish_result_text_success: "Die Umleitungen wurden erfolgreich publiziert", + redirectmanager_editor_actions_publish_result_text_error: "Fehler bei der Publikation der Umleitungen!", + redirectmanager_editor_actions_publish_result_text_error_w_msg: "Fehler bei der Publikation der Umleitungen!
Ursache:", + redirectmanager_editor_actions_delete_text: "Löschen", + redirectmanager_editor_actions_save_text: "Speichern", + redirectmanager_editor_list_empty: "Leer", + redirectmanager_editor_actions_save_result_text_success: "Die Umleitung wurde erfolgreich gespeichert!", + redirectmanager_editor_actions_save_result_text_error: "Fehler beim Speichern der Umleitung!", + redirectmanager_editor_actions_save_result_text_error_w_msg: "Fehler beim Speichern der Umleitung!
Ursache:", + redirectmanager_editor_actions_delete_result_text_error: "Fehler beim Löschen der Umleitung!", + redirectmanager_editor_actions_delete_result_text_error_w_msg: "Fehler beim Löschen der Umleitung!
Ursache:", + redirectmanager_editor_actions_delete_result_text_success: "Die Umleitung wurde erfolgreich gelöscht!", + redirectmanager_editor_actions_save_validationerror_title: "Validierungsfehler", + redirectmanager_editor_actions_save_validationerror_text: "Bitte füllen Sie die folgenden Felder aus:", + redirectmanager_editor_actions_save_validationerror_targetField: "Ziel-Inhalt oder Ziel-URL", + redirectmanager_editor_help_tooltip: "Hilfe", + redirectmanager_editor_help_source_button: "Hilfe", + redirectmanager_editor_help_source_title: "Hilfe", + redirectmanager_editor_help_source_text: "Die Url, die umgeleitet werden soll z.B. /produkte/altes-produkt. Sie sollte keine Fragmente (#anchor) enthalten. Query-Parameter (z.B. ?param=value) werden automatisch entfernt und in das \"Quell-Parameter\"-Feld übertragen. Wenden Sie sich an Ihren Administrator wenn Sie das Feld nicht sehen sollten.
Für mehrsprachige Seiten muss der Sprach-Präfix weggelassen werden, also z.B. /old-link anstelle von /fr/old-link für die Französisch-sprachige Schweizer-Seite.", + redirectmanager_editor_help_targetUrl_text: "Die Url, auf die umgeleitet werden soll. Pr�fen Sie, ob stattdessen ein CoreMedia-Inhalt im \"Ziel-Inhalt\"-Feld verlinkt werden kann, da die Wartung dadurch vereinfacht wird und kein 404 im Umleitungs-Ziel auftreten kann.", + redirectmanager_editor_actions_csvupload_example_header_sourceUrl_text: "Die Quell-Url", + redirectmanager_editor_actions_csvupload_example_header_targetLink_text: "Pfad zum Dokument oder die CoreMedia-Inhalt-Id", + redirectmanager_editor_actions_csvupload_example_header_description_text: "Eine optionale Beschreibung", + redirectmanager_editor_actions_csvupload_example_header_sourceParameters_text: "The Url-Parameter der Quell-Url oder [], Beispiel: [{\"name\": \"parameterName\", \"value\": \"value\", \"operator\": \"EQUALS\"}]", + redirectmanager_editor_actions_csvupload_example_header_targetParameters_title: "Ziel-Url Parameter:", + redirectmanager_editor_actions_csvupload_example_header_targetParameters_text: "Die Url-Parameter, die an die Ziel-Url angehangen werden sollen or [], Beispiel: [{\"name\": \"parameterName\", \"value\": \"value\"}]", + redirectmanager_editor_actions_csvupload_tooltip: "Klicken Sie hier, um eine Liste von Redirects über einen CSV Upload anzulegen.", + redirectmanager_editor_actions_csvupload_text: "Upload", + redirectmanager_editor_actions_csvupload_dropin_title: "Redirect CSV Import", + redirectmanager_editor_actions_csvupload_dropin_label: "Datei hierhin ziehen..", + redirectmanager_editor_actions_csvupload_upload_button_text: "Upload", + redirectmanager_editor_actions_csvupload_upload_inProgress_text: "Umleitungen werden importiert...", + redirectmanager_editor_actions_csvupload_cancel_button_text: "Abbrechen", + redirectmanager_editor_actions_csvupload_upload_failed_title: "Import failed", + redirectmanager_editor_actions_csvupload_upload_failed_msg: "Beim anlegen der Weiterleitungen ist ein Fehler aufgetreten:", + redirectmanager_editor_actions_csvupload_upload_error_title: "Fehler beim Anlegen der Redirects", + redirectmanager_editor_actions_csvupload_upload_error_msg: "Bitte senden Sie folgende Meldung an Ihren Administrator:

", + redirectmanager_editor_actions_csvupload_no_file_selected_title: "Keine Datei ausgewählt", + redirectmanager_editor_actions_csvupload_no_file_selected_msg: "Bitte wählen Sie eine Datei aus...", + redirectmanager_editor_actions_csvupload_import_result_title: "Import erfolgreich", + redirectmanager_editor_actions_csvupload_import_result_msg: "Der Import war erfolgreich<\/span>

", + redirectmanager_editor_actions_csvupload_import_result_not_created_msg: "Folgende Weiterleitungen konnten nicht angelegt werden:", + redirectmanager_editor_actions_csvupload_import_result_button_ok_text: "OK", + redirectmanager_editor_actions_csvupload_import_error_length_invalid: "Es werden 6 Spalten für den Import einer Umleitung benötigt.", + redirectmanager_editor_actions_csvupload_import_error_active_invalid: "Der Wert für 'active' darf nur true oder false sein.", + redirectmanager_editor_actions_csvupload_import_error_sourceUrlType_invalid: "Der Wert für 'sourceUrlType' darf entweder 'REGEX' oder 'PLAIN' sein.", + redirectmanager_editor_actions_csvupload_import_error_source_invalid: "Der Wert für die Quelle darf nicht leer sein und muss mit einem '/' beginnen.", + redirectmanager_editor_actions_csvupload_import_error_source_whitespace: "Der Wert für die Quelle darf keine Leerzeichen enthalten.", + redirectmanager_editor_actions_csvupload_import_error_source_already_exists: "Es existiert bereits eine Umleitung für die Quelle mit den gleichen Quell-Parametern.", + redirectmanager_editor_actions_csvupload_import_error_target_missing: "Die Umleitung benötigt ein Ziel.", + redirectmanager_editor_actions_csvupload_import_error_target_invalid: "Um die Umleitung publizieren zu können muss das Ziel publiziert sein.", + redirectmanager_editor_actions_csvupload_import_error_target_both: "Es sollte ein \"Ziel-Inhalt\" oder eine \"Ziel-Url\" verwendet werden, nicht beide.", + redirectmanager_editor_actions_csvupload_import_error_target_url_invalid: "Die Ziel-Url ist ungültig.", + redirectmanager_editor_actions_csvupload_import_error_redirectType_invalid: "Der Wert für 'redirectType' darf entweder 'ALWAYS' oder 'AFTER_NOT_FOUND' sein.", + redirectmanager_editor_actions_csvupload_import_error_creation_failure: "Die Umleitung konnte nicht erstellt werden.", + redirectmanager_editor_actions_csvupload_import_error_description_invalid: "Die Beschreibung ist ungültig. Sie darf nur 1024 Zeichen lang sein.", + redirectmanager_editor_actions_csvupload_import_error_duplicate_source: "Der Csv-Import enthält die Quell-Url mit den gleichen Parametern mehrmals.", + redirectmanager_editor_actions_csvupload_import_error_parsing_failure: "Die Umleitung konnte nicht erstellt werden, da die Quell- oder Ziel-Parameter nicht gelesen werden konnten.", + redirectmanager_editor_error_source_invalid: "Der Wert für die Quelle darf nicht leer sein und muss mit einem '/' beginnen.", + redirectmanager_editor_error_source_whitespace: "Der Wert für die Quelle darf keine Leerzeichen enthalten.", + redirectmanager_editor_error_source_already_exists: "Es existiert bereits eine Umleitung für die Quelle mit den gleichen Quell-Parametern.", + redirectmanager_editor_error_target_missing: "Die Umleitung benötigt ein Ziel.", + redirectmanager_editor_error_target_invalid: "Um die Umleitung publizieren zu können muss das Ziel publiziert sein.", + redirectmanager_editor_error_target_both: "Es sollte ein \"Ziel-Inhalt\" oder eine \"Ziel-Url\" verwendet werden, nicht beide.", + redirectmanager_editor_error_target_url_invalid: "Die Ziel-Url ist ungültig.", + redirectmanager_editor_error_description_invalid: "Die Beschreibung ist ungültig. Sie darf nur 1024 Zeichen lang sein.", + redirectmanager_editor_grid_search_label: "Filter:", + redirectmanager_editor_grid_search_empty_text: "Suchbegriff eingeben", + redirectmanager_editor_grid_site_selector_label: "Umleitung der Seite:", + redirectmanager_editor_grid_redirect_edit_label: "Umleitung bearbeiten", + redirectmanager_editor_grid_redirect_delete_label: "Umleitung löschen", + redirectmanager_editor_grid_redirect_open_label: "Umleitungsziel öffnen", + redirectmanager_decision_use404Type: "Eine Quelle, die mit einer ID endet kann im Zusammenhang mit dem Typ \"Nur nach 404\" dazu führen, dass der Redirect nicht korrekt funktioniert. Der Typ sollte auf \"Immer\" geändert werden.", + redirectmanager_decision_useAlwaysType: "Der Typ \"Immer\" sollte nur in Ausnahmefällen verwendet werden. Ansonsten könnten Anfragen auf gültige Seiten durch alte Umleitungen versehentlich umgeleitet werden. Der Typ sollte auf \"Nur nach 404\" geändert werden.", + redirectmanager_decision_ok: "Typ ändern und speichern", + redirectmanager_decision_title: "Überprüfung des Typ", + redirectmanager_validation_error: "Die Umleitung konnte nicht validiert werden.", + redirectmanager_validation_source_already_exists: "Es existiert bereits eine Umleitung für die Quelle.", +}); diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/bundles/RedirectManagerStudioPlugin_properties.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/bundles/RedirectManagerStudioPlugin_properties.ts new file mode 100644 index 0000000..b0cf4dd --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/bundles/RedirectManagerStudioPlugin_properties.ts @@ -0,0 +1,315 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Interface values for ResourceBundle "RedirectManagerStudioPlugin". + * @see RedirectManagerStudioPlugin_properties#INSTANCE + */ +interface RedirectManagerStudioPlugin_properties { + +/** + * + */ + redirectmanager_text: string; + redirectmanager_button_text: string; + redirectmanager_button_tooltip: string; + redirectmanager_editor_list_loading: string; + redirectmanager_editor_list_nothing_found: string; + redirectmanager_editor_list_nothing_found_match: string; + redirectmanager_editor_same_source_title: string; + redirectmanager_editor_list_empty: string; + redirectmanager_editor_list_text: string; + redirectmanager_editor_list_error_no_target: string; + redirectmanager_editor_edit_text: string; + redirectmanager_editor_field_active: string; + redirectmanager_editor_field_source: string; + redirectmanager_editor_field_target: string; + redirectmanager_editor_field_target_link_select: string; + redirectmanager_editor_field_target_path_select: string; + redirectmanager_editor_field_targetLink: string; + redirectmanager_editor_field_targetUrl: string; + redirectmanager_editor_field_creationDate: string; + redirectmanager_editor_field_type: string; + redirectmanager_editor_field_type_value_0: string; + redirectmanager_editor_field_type_value_1: string; + redirectmanager_editor_field_type_value_2: string; + redirectmanager_editor_field_type_invalid: string; + redirectmanager_editor_field_parameters: string; + redirectmanager_editor_field_description: string; + redirectmanager_editor_field_sourceType: string; + redirectmanager_editor_field_sourceType_plain: string; + redirectmanager_editor_field_sourceType_regex: string; + redirectmanager_editor_field_parameterName: string; + redirectmanager_editor_field_parameterValue: string; + redirectmanager_editor_field_sourceParameters: string; + redirectmanager_editor_field_targetParameters: string; + redirectmanager_editor_actions_new_tooltip: string; + redirectmanager_editor_actions_new_text: string; + redirectmanager_editor_actions_new_success_text: string; + redirectmanager_editor_actions_new_error_text: string; + redirectmanager_editor_actions_delete_text: string; + redirectmanager_editor_actions_delete_tooltip: string; + redirectmanager_editor_actions_delete_confirm_title: string; + redirectmanager_editor_actions_delete_confirm_text: string; + redirectmanager_editor_actions_delete_result_text_error: string; + redirectmanager_editor_actions_delete_result_text_error_w_msg: string; + redirectmanager_editor_actions_delete_result_text_success: string; + redirectmanager_editor_actions_save_text: string; + redirectmanager_editor_actions_save_confirm_title: string; + redirectmanager_editor_actions_save_confirm_text: string; + redirectmanager_editor_actions_save_validationerror_title: string; + redirectmanager_editor_actions_save_validationerror_text: string; + redirectmanager_editor_actions_save_validationerror_targetField: string; + redirectmanager_editor_actions_save_result_text_success: string; + redirectmanager_editor_actions_save_result_text_error: string; + redirectmanager_editor_actions_save_result_text_error_w_msg: string; + redirectmanager_editor_actions_reload_text: string; + redirectmanager_editor_actions_reload_tooltip: string; + redirectmanager_editor_action_result_title_success: string; + redirectmanager_editor_action_result_title_error: string; + redirectmanager_editor_actions_publish_tooltip: string; + redirectmanager_editor_actions_publish_text: string; + redirectmanager_editor_actions_publish_confirm_title: string; + redirectmanager_editor_actions_publish_confirm_text: string; + redirectmanager_editor_actions_publish_result_text_success: string; + redirectmanager_editor_actions_publish_result_text_error: string; + redirectmanager_editor_actions_publish_result_text_error_w_msg: string; + redirectmanager_editor_help_tooltip: string; + redirectmanager_editor_help_source_button: string; + redirectmanager_editor_help_source_title: string; + redirectmanager_editor_help_targetUrl_title: string; + redirectmanager_editor_help_source_text: string; + redirectmanager_editor_help_targetUrl_text: string; + redirectmanager_editor_actions_csvupload_example_header: string; + redirectmanager_editor_actions_csvupload_example: string; + redirectmanager_editor_actions_csvupload_example_header_active_title: string; + redirectmanager_editor_actions_csvupload_example_header_active_text: string; + redirectmanager_editor_actions_csvupload_example_header_sourceUrlType_title: string; + redirectmanager_editor_actions_csvupload_example_header_sourceUrlType_text: string; + redirectmanager_editor_actions_csvupload_example_header_sourceUrl_title: string; + redirectmanager_editor_actions_csvupload_example_header_sourceUrl_text: string; + redirectmanager_editor_actions_csvupload_example_header_targetLink_title: string; + redirectmanager_editor_actions_csvupload_example_header_targetLink_text: string; + redirectmanager_editor_actions_csvupload_example_header_redirectType_title: string; + redirectmanager_editor_actions_csvupload_example_header_redirectType_text: string; + redirectmanager_editor_actions_csvupload_example_header_description_title: string; + redirectmanager_editor_actions_csvupload_example_header_description_text: string; + redirectmanager_editor_actions_csvupload_example_header_sourceParameters_title: string; + redirectmanager_editor_actions_csvupload_example_header_sourceParameters_text: string; + redirectmanager_editor_actions_csvupload_example_header_targetParameters_title: string; + redirectmanager_editor_actions_csvupload_example_header_targetParameters_text: string; + redirectmanager_editor_actions_csvupload_dropin_title: string; + redirectmanager_editor_actions_csvupload_tooltip: string; + redirectmanager_editor_actions_csvupload_text: string; + redirectmanager_editor_actions_csvupload_dropin_label: string; + redirectmanager_editor_actions_csvupload_upload_button_text: string; + redirectmanager_editor_actions_csvupload_upload_inProgress_text: string; + redirectmanager_editor_actions_csvupload_cancel_button_text: string; + redirectmanager_editor_actions_csvupload_upload_failed_title: string; + redirectmanager_editor_actions_csvupload_upload_failed_msg: string; + redirectmanager_editor_actions_csvupload_upload_error_title: string; + redirectmanager_editor_actions_csvupload_upload_error_msg: string; + redirectmanager_editor_actions_csvupload_no_file_selected_title: string; + redirectmanager_editor_actions_csvupload_no_file_selected_msg: string; + redirectmanager_editor_actions_csvupload_import_result_title: string; + redirectmanager_editor_actions_csvupload_import_result_msg: string; + redirectmanager_editor_actions_csvupload_import_result_not_created_msg: string; + redirectmanager_editor_actions_csvupload_import_result_button_ok_text: string; + redirectmanager_editor_actions_csvupload_import_error_length_invalid: string; + redirectmanager_editor_actions_csvupload_import_error_active_invalid: string; + redirectmanager_editor_actions_csvupload_import_error_sourceUrlType_invalid: string; + redirectmanager_editor_actions_csvupload_import_error_source_invalid: string; + redirectmanager_editor_actions_csvupload_import_error_source_whitespace: string; + redirectmanager_editor_actions_csvupload_import_error_source_already_exists: string; + redirectmanager_editor_actions_csvupload_import_error_target_missing: string; + redirectmanager_editor_actions_csvupload_import_error_target_invalid: string; + redirectmanager_editor_actions_csvupload_import_error_target_both: string; + redirectmanager_editor_actions_csvupload_import_error_target_url_invalid: string; + redirectmanager_editor_actions_csvupload_import_error_redirectType_invalid: string; + redirectmanager_editor_actions_csvupload_import_error_creation_failure: string; + redirectmanager_editor_actions_csvupload_import_error_description_invalid: string; + redirectmanager_editor_actions_csvupload_import_error_duplicate_source: string; + redirectmanager_editor_actions_csvupload_import_error_parsing_failure: string; + redirectmanager_editor_error_source_invalid: string; + redirectmanager_editor_error_source_whitespace: string; + redirectmanager_editor_error_source_already_exists: string; + redirectmanager_editor_error_target_missing: string; + redirectmanager_editor_error_target_invalid: string; + redirectmanager_editor_error_target_both: string; + redirectmanager_editor_error_target_url_invalid: string; + redirectmanager_editor_error_description_invalid: string; + redirectmanager_editor_grid_search_label: string; + redirectmanager_editor_grid_search_empty_text: string; + redirectmanager_editor_grid_site_selector_label: string; + redirectmanager_editor_grid_redirect_edit_label: string; + redirectmanager_editor_grid_redirect_delete_label: string; + redirectmanager_editor_grid_redirect_open_label: string; + redirectmanager_decision_use404Type: string; + redirectmanager_decision_useAlwaysType: string; + redirectmanager_decision_ok: string; + redirectmanager_decision_title: string; + redirectmanager_validation_error: string; + redirectmanager_validation_source_already_exists: string; +} + +/** + * Singleton for the current user Locale's instance of ResourceBundle "RedirectManagerStudioPlugin". + * @see RedirectManagerStudioPlugin_properties + */ +const RedirectManagerStudioPlugin_properties: RedirectManagerStudioPlugin_properties = { + redirectmanager_text: "RedirectManager", + redirectmanager_button_text: "Redirects", + redirectmanager_button_tooltip: "Manage redirects", + redirectmanager_editor_list_loading: "Loading redirects..", + redirectmanager_editor_list_nothing_found: "No redirects found..", + redirectmanager_editor_list_nothing_found_match: "No redirects found with same path and different source parameters..", + redirectmanager_editor_same_source_title: "Redirects with the same source", + redirectmanager_editor_list_empty: "Empty", + redirectmanager_editor_list_text: "Redirects", + redirectmanager_editor_list_error_no_target: "Missing target", + redirectmanager_editor_edit_text: "Redirect", + redirectmanager_editor_field_active: "Published", + redirectmanager_editor_field_source: "Source", + redirectmanager_editor_field_target: "Target", + redirectmanager_editor_field_target_link_select: "Content", + redirectmanager_editor_field_target_path_select: "URL", + redirectmanager_editor_field_targetLink: "Target Link", + redirectmanager_editor_field_targetUrl: "Target Url", + redirectmanager_editor_field_creationDate: "Creation Date", + redirectmanager_editor_field_type: "Type", + redirectmanager_editor_field_type_value_0: "Always", + redirectmanager_editor_field_type_value_1: "Only after 404", + redirectmanager_editor_field_type_value_2: "Vanity Redirect", + redirectmanager_editor_field_type_invalid: "Invalid value", + redirectmanager_editor_field_parameters: "Parameters", + redirectmanager_editor_field_description: "Description", + redirectmanager_editor_field_sourceType: "Source-Type", + redirectmanager_editor_field_sourceType_plain: "Plain", + redirectmanager_editor_field_sourceType_regex: "Regular Expression", + redirectmanager_editor_field_parameterName: "Name", + redirectmanager_editor_field_parameterValue: "Value", + redirectmanager_editor_field_sourceParameters: "Source Parameters", + redirectmanager_editor_field_targetParameters: "Target Parameters", + redirectmanager_editor_actions_new_tooltip: "Click here to add a new redirect", + redirectmanager_editor_actions_new_text: "New Redirect", + redirectmanager_editor_actions_new_success_text: "The redirect was created successfully!
The redirect is not immediately visible in the table.
Please click the Refresh-Button.", + redirectmanager_editor_actions_new_error_text: "Error while creating redirect!
Reason:", + redirectmanager_editor_actions_delete_text: "Delete", + redirectmanager_editor_actions_delete_tooltip: "Delete redirect", + redirectmanager_editor_actions_delete_confirm_title: "Delete redirect", + redirectmanager_editor_actions_delete_confirm_text: "Do you really want to delete this redirect?", + redirectmanager_editor_actions_delete_result_text_error: "Error while deleting redirect!", + redirectmanager_editor_actions_delete_result_text_error_w_msg: "Error while deleting redirect!
Reason:", + redirectmanager_editor_actions_delete_result_text_success: "The redirect was successfully deleted!", + redirectmanager_editor_actions_save_text: "Save", + redirectmanager_editor_actions_save_confirm_title: "Save redirect", + redirectmanager_editor_actions_save_confirm_text: "Do you want to save the changes to this redirect?", + redirectmanager_editor_actions_save_validationerror_title: "Validation error", + redirectmanager_editor_actions_save_validationerror_text: "Please complete the following missing fields:", + redirectmanager_editor_actions_save_validationerror_targetField: "Target Link or Target Path", + redirectmanager_editor_actions_save_result_text_success: "The redirect was saved successfully!", + redirectmanager_editor_actions_save_result_text_error: "Error while saving redirect!", + redirectmanager_editor_actions_save_result_text_error_w_msg: "Error while saving redirect!
Reason:", + redirectmanager_editor_actions_reload_text: "Reload", + redirectmanager_editor_actions_reload_tooltip: "Click here to reload redirects", + redirectmanager_editor_action_result_title_success: "Success", + redirectmanager_editor_action_result_title_error: "Error", + redirectmanager_editor_actions_publish_tooltip: "Click here to publish the current state", + redirectmanager_editor_actions_publish_text: "Publish", + redirectmanager_editor_actions_publish_confirm_title: "Publish Redirects", + redirectmanager_editor_actions_publish_confirm_text: "Do you want to publish the current redirects?", + redirectmanager_editor_actions_publish_result_text_success: "Redirects published", + redirectmanager_editor_actions_publish_result_text_error: "Error while publishing redirects!", + redirectmanager_editor_actions_publish_result_text_error_w_msg: "Error while publishing redirect!
Reason:", + redirectmanager_editor_help_tooltip: "Help", + redirectmanager_editor_help_source_button: "Help", + redirectmanager_editor_help_source_title: "Help", + redirectmanager_editor_help_targetUrl_title: "Help", + redirectmanager_editor_help_source_text: "The url to be redirected e.g. /products/old-product. It should not contain fragments (#anchor). Query-parameters (e.g. ?param=value) will automatically removed und copied into the \"Source Parameters\" field. If you do not see this field, ask your Administrator to activate that feature.
For multi-language countries, leave out the language prefix, so e.g. type /old-link instead of /fr/old-link for french speaking Switzerland.", + redirectmanager_editor_help_targetUrl_text: "The target url of this redirect. Consider linking a CoreMedia-Document in the field \"Target Link\" instead, because the redirectTarget will never produce a 404 in that case.", + redirectmanager_editor_actions_csvupload_example_header: "Active;Source URL Type;Source URL;Target Link;Target Url;Redirect Type;Description;Source Parameters;Target Parameters", + redirectmanager_editor_actions_csvupload_example: "TRUE;REGEX;/sourceUrl;/Sites/Chef Corp./Aurora B2C Page;;AFTER_NOT_FOUND;description;[{\"name\": \"parameterName\", \"value\": \"value\", \"operator\": \"EQUALS\"}];[{\"name\": \"parameterName\", \"value\": \"value\"}]", + redirectmanager_editor_actions_csvupload_example_header_active_title: "Active:", + redirectmanager_editor_actions_csvupload_example_header_active_text: "TRUE or FALSE", + redirectmanager_editor_actions_csvupload_example_header_sourceUrlType_title: "Source URL Type:", + redirectmanager_editor_actions_csvupload_example_header_sourceUrlType_text: "REGEX or PLAIN", + redirectmanager_editor_actions_csvupload_example_header_sourceUrl_title: "Source URL:", + redirectmanager_editor_actions_csvupload_example_header_sourceUrl_text: "the source url", + redirectmanager_editor_actions_csvupload_example_header_targetLink_title: "Target Link:", + redirectmanager_editor_actions_csvupload_example_header_targetLink_text: "path to the content item or the content-id", + redirectmanager_editor_actions_csvupload_example_header_redirectType_title: "Redirect Type:", + redirectmanager_editor_actions_csvupload_example_header_redirectType_text: "AFTER_NOT_FOUND or ALWAYS", + redirectmanager_editor_actions_csvupload_example_header_description_title: "Description:", + redirectmanager_editor_actions_csvupload_example_header_description_text: "an optional description", + redirectmanager_editor_actions_csvupload_example_header_sourceParameters_title: "Source Parameters:", + redirectmanager_editor_actions_csvupload_example_header_sourceParameters_text: "the source parameters or [], example: [{\"name\": \"parameterName\", \"value\": \"value\", \"operator\": \"EQUALS\"}]", + redirectmanager_editor_actions_csvupload_example_header_targetParameters_title: "Target Parameters:", + redirectmanager_editor_actions_csvupload_example_header_targetParameters_text: "the target parameters or [], example: [{\"name\": \"parameterName\", \"value\": \"value\"}]", + redirectmanager_editor_actions_csvupload_dropin_title: "Redirect CSV import", + redirectmanager_editor_actions_csvupload_tooltip: "Click here to create a list of redirects by uploading a CSV file", + redirectmanager_editor_actions_csvupload_text: "Upload", + redirectmanager_editor_actions_csvupload_dropin_label: "Drop file here...", + redirectmanager_editor_actions_csvupload_upload_button_text: "Upload", + redirectmanager_editor_actions_csvupload_upload_inProgress_text: "Import in progress...", + redirectmanager_editor_actions_csvupload_cancel_button_text: "Cancel", + redirectmanager_editor_actions_csvupload_upload_failed_title: "Upload failed", + redirectmanager_editor_actions_csvupload_upload_failed_msg: "The following error occured:", + redirectmanager_editor_actions_csvupload_upload_error_title: "Error creating redirects", + redirectmanager_editor_actions_csvupload_upload_error_msg: "Please send the following message to your administrator: \n\n", + redirectmanager_editor_actions_csvupload_no_file_selected_title: "No file selected", + redirectmanager_editor_actions_csvupload_no_file_selected_msg: "Please select a file...", + redirectmanager_editor_actions_csvupload_import_result_title: "Import successful", + redirectmanager_editor_actions_csvupload_import_result_msg: "The redirect import was successful<\/span>

", + redirectmanager_editor_actions_csvupload_import_result_not_created_msg: "Redirects not created:", + redirectmanager_editor_actions_csvupload_import_result_button_ok_text: "OK", + redirectmanager_editor_actions_csvupload_import_error_length_invalid: "Invalid length. Six columns are required to import a redirect.", + redirectmanager_editor_actions_csvupload_import_error_active_invalid: "The value for 'active' may only be true or false.", + redirectmanager_editor_actions_csvupload_import_error_sourceUrlType_invalid: "The value for'sourceUrlType' should be'REGEX' or'PLAIN'.", + redirectmanager_editor_actions_csvupload_import_error_source_invalid: "The value for the source must not be empty and must start with '/'.", + redirectmanager_editor_actions_csvupload_import_error_source_whitespace: "The value for the source must not contain whitespace characters.", + redirectmanager_editor_actions_csvupload_import_error_source_already_exists: "There is already a redirect for that source url and source parameters.", + redirectmanager_editor_actions_csvupload_import_error_target_missing: "The redirect must contain a target.", + redirectmanager_editor_actions_csvupload_import_error_target_invalid: "To publish the redirect the target must be published.", + redirectmanager_editor_actions_csvupload_import_error_target_both: "Use a either a \"Target Link\" or a \"Target Url\", bot not both.", + redirectmanager_editor_actions_csvupload_import_error_target_url_invalid: "The target-Url is invalid.", + redirectmanager_editor_actions_csvupload_import_error_redirectType_invalid: "The value for'redirectType' should be'ALWAYS' or'AFTER_NOT_FOUND'.", + redirectmanager_editor_actions_csvupload_import_error_creation_failure: "The redirect could not be created.", + redirectmanager_editor_actions_csvupload_import_error_description_invalid: "The description is invalid, only 1024 chars are allowed.", + redirectmanager_editor_actions_csvupload_import_error_duplicate_source: "The import contains this source with the same source parameters multiple times.", + redirectmanager_editor_actions_csvupload_import_error_parsing_failure: "The redirect could not be created because the source or target parameters could not be read.", + redirectmanager_editor_error_source_invalid: "The value for the source must not be empty and must start with '/'.", + redirectmanager_editor_error_source_whitespace: "The value for the source must not contain whitespace characters.", + redirectmanager_editor_error_source_already_exists: "There is already a redirect for that source url and source parameters.", + redirectmanager_editor_error_target_missing: "The redirect must contain a target.", + redirectmanager_editor_error_target_invalid: "To publish the redirect the target must be published.", + redirectmanager_editor_error_target_both: "Use a either a \"Target Link\" or a \"Target Url\", bot not both.", + redirectmanager_editor_error_target_url_invalid: "The target-Url is invalid.", + redirectmanager_editor_error_description_invalid: "The description is invalid, only 1024 chars are allowed.", + redirectmanager_editor_grid_search_label: "Filter Redirects:", + redirectmanager_editor_grid_search_empty_text: "Enter search term", + redirectmanager_editor_grid_site_selector_label: "Redirects for Site:", + redirectmanager_editor_grid_redirect_edit_label: "Edit Redirect", + redirectmanager_editor_grid_redirect_delete_label: "Delete Redirect", + redirectmanager_editor_grid_redirect_open_label: "Open Redirect target", + redirectmanager_decision_use404Type: "A Redirect-Source ending with an ID used together with the Type \"Only after 404\" might not work if a document exist with the same ID in the CMS. The Type should be changed to \"Always\".", + redirectmanager_decision_useAlwaysType: "The Type \"Always\" should be used with care. Otherwise requests on valid pages could be redirected based on old redirects. The Type should be changed to \"Only after 404\".", + redirectmanager_decision_ok: "Change the Type and save", + redirectmanager_decision_title: "Check the Type", + redirectmanager_validation_error: "Could not validate redirect.", + redirectmanager_validation_source_already_exists: "There is already a redirect for that source url.", +}; + +export default RedirectManagerStudioPlugin_properties; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/PermissionResponse.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/PermissionResponse.ts new file mode 100644 index 0000000..f24c260 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/PermissionResponse.ts @@ -0,0 +1,51 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +class PermissionResponse { + + #mayWrite: boolean = false; + + #mayPublish: boolean = false; + + #mayUseRegex: boolean = false; + + #mayUseTargetUrls: boolean = false; + + constructor(jsonResponse: any = null) { + this.#mayWrite = jsonResponse ? jsonResponse.mayWrite : false; + this.#mayPublish = jsonResponse ? jsonResponse.mayPublish : false; + this.#mayUseRegex = jsonResponse ? jsonResponse.mayUseRegex : false; + this.#mayUseTargetUrls = jsonResponse ? jsonResponse.mayUseTargetUrls : false; + } + + isMayWrite(): boolean { + return this.#mayWrite; + } + + isMayPublish(): boolean { + return this.#mayPublish; + } + + isMayUseRegex(): boolean { + return this.#mayUseRegex; + } + + isMayUseTargetUrls(): boolean { + return this.#mayUseTargetUrls; + } +} + +export default PermissionResponse; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/Redirect.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/Redirect.ts new file mode 100644 index 0000000..3f17b44 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/Redirect.ts @@ -0,0 +1,80 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UndocContent from "@coremedia/studio-client.cap-rest-client/content/UndocContent"; +import RemoteBean from "@coremedia/studio-client.client-core/data/RemoteBean"; +import { AnyFunction } from "@jangaroo/runtime/types"; + +/** + * A model representing a redirect. + */ +abstract class Redirect extends RemoteBean { + + abstract deleteMe(callback?: AnyFunction): void; + + abstract getId(): string; + + abstract isActive(): boolean; + + abstract setActive(active: boolean): void; + + abstract getTargetLink(): UndocContent; + + abstract getTargetUrl(): string; + + abstract setTargetLink(content: UndocContent): void; + + abstract setTargetUrl(targetUrl: string): void; + + abstract getTargetLinkName(): string; + + abstract setTargetLinkName(name: string): void; + + abstract getCreationDate(): Date; + + abstract setCreationDate(creationDate: Date): void; + + abstract getRedirectType(): number; + + abstract setRedirectType(redirectType: number): void; + + abstract getDescription(): string; + + abstract setDescription(description: string): void; + + abstract isImported(): boolean; + + abstract getSourceType(): string; + + abstract setSourceType(sourceType: string): void; + + abstract getSource(): string; + + abstract setSource(source: string): void; + + abstract getSiteId(): string; + + abstract setSourceParameters(parameters: Array): void; + + abstract getSourceParameters(): Array; + + abstract setTargetParameters(parameters: Array): void; + + abstract getTargetParameters(): Array; + +} + +export default Redirect; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectImpl.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectImpl.ts new file mode 100644 index 0000000..fe7f421 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectImpl.ts @@ -0,0 +1,208 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import UndocContent from "@coremedia/studio-client.cap-rest-client/content/UndocContent"; +import Content from "@coremedia/studio-client.cap-rest-client/content/Content"; +import RemoteBeanImpl from "@coremedia/studio-client.client-core-impl/data/impl/RemoteBeanImpl"; +import RemoteServiceMethod from "@coremedia/studio-client.client-core-impl/data/impl/RemoteServiceMethod"; +import RemoteServiceMethodResponse from "@coremedia/studio-client.client-core-impl/data/impl/RemoteServiceMethodResponse"; +import { mixin } from "@jangaroo/runtime"; +import { AnyFunction } from "@jangaroo/runtime/types"; +import RedirectManagerStudioPlugin_properties from "../bundles/RedirectManagerStudioPlugin_properties"; +import NotificationUtil from "../util/NotificationUtil"; +import Redirect from "./Redirect"; +import RedirectSourceParameter from "./RedirectSourceParameter"; +import RedirectTargetParameter from "./RedirectTargetParameter"; + +class RedirectImpl extends RemoteBeanImpl implements Redirect { + static readonly REST_RESOURCE_URI_TEMPLATE: string = "redirect/{siteId:[^/]+}/{id:[^/]+}"; + + static readonly ACTIVE: string = "active"; + + static readonly CREATION_DATE: string = "creationDate"; + + static readonly REDIRECT_TYPE: string = "redirectType"; + + static readonly REDIRECT_TYPE_ALWAYS: string = "ALWAYS"; + + static readonly REDIRECT_TYPE_404: string = "AFTER_NOT_FOUND"; + + static readonly SOURCE: string = "source"; + + static readonly SOURCE_TYPE: string = "sourceUrlType"; + + static readonly SOURCE_TYPE_PLAIN: string = "PLAIN"; + + static readonly SOURCE_TYPE_REGEX: string = "REGEX"; + + static readonly TARGET_LINK: string = "targetLink"; + + static readonly TARGET_LINK_NAME: string = "targetLinkName"; + + static readonly TARGET_URL: string = "targetUrl"; + + static readonly DESCRIPTION: string = "description"; + + static readonly IMPORTED: string = "imported"; + + static readonly SITE_ID: string = "siteId"; + + static readonly SOURCE_PARAMETERS: string = "sourceParameters"; + + static readonly TARGET_PARAMETERS: string = "targetParameters"; + + /** + * List of all redirect properties, used by the grid. + */ + static readonly REDIRECT_PROPERTIES: Array = [ + RedirectImpl.ACTIVE, + RedirectImpl.CREATION_DATE, + RedirectImpl.REDIRECT_TYPE, + RedirectImpl.SOURCE, + RedirectImpl.SOURCE_TYPE, + RedirectImpl.SOURCE_TYPE_PLAIN, + RedirectImpl.SOURCE_TYPE_REGEX, + RedirectImpl.TARGET_LINK, + RedirectImpl.TARGET_LINK_NAME, + RedirectImpl.DESCRIPTION, + RedirectImpl.IMPORTED, + RedirectImpl.SITE_ID, + RedirectImpl.SOURCE_PARAMETERS, + RedirectImpl.TARGET_PARAMETERS, + ]; + + constructor(path: string) { + super(path); + } + + deleteMe(callback: AnyFunction = null): void { + const rsm = new RemoteServiceMethod(this.getUriPath(), "DELETE"); + rsm.request( + null, + function success(rsmr: RemoteServiceMethodResponse): void { + NotificationUtil.showInfo(RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_delete_result_text_success); + callback.call(this); + }, + (rsmr: RemoteServiceMethodResponse): void => + NotificationUtil.showError(RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_delete_result_text_error_w_msg + rsmr.getError()), + ); + } + + isActive(): boolean { + return this.get(RedirectImpl.ACTIVE); + } + + setActive(active: boolean): void { + this.set(RedirectImpl.ACTIVE, active); + } + + getTargetLink(): UndocContent { + return this.get(RedirectImpl.TARGET_LINK); + } + + setTargetLink(content: Content): void { + this.set(RedirectImpl.TARGET_LINK, content); + } + + getTargetUrl(): string { + return this.get(RedirectImpl.TARGET_URL); + } + + setTargetUrl(targetUrl: string): void { + this.set(RedirectImpl.TARGET_URL, targetUrl); + } + + getTargetLinkName(): string { + return this.get(RedirectImpl.TARGET_LINK_NAME); + } + + setTargetLinkName(name: string): void { + this.set(RedirectImpl.TARGET_LINK_NAME, name); + } + + getCreationDate(): Date { + return this.get(RedirectImpl.CREATION_DATE); + } + + setCreationDate(creationDate: Date): void { + this.set(RedirectImpl.CREATION_DATE, creationDate); + } + + getRedirectType(): number { + return this.get(RedirectImpl.REDIRECT_TYPE); + } + + setRedirectType(redirectType: number): void { + this.set(RedirectImpl.REDIRECT_TYPE, redirectType); + } + + getDescription(): string { + return this.get(RedirectImpl.DESCRIPTION); + } + + setDescription(description: string): void { + this.set(RedirectImpl.DESCRIPTION, description); + } + + isImported(): boolean { + return this.get(RedirectImpl.IMPORTED); + } + + getSourceType(): string { + return this.get(RedirectImpl.SOURCE_TYPE); + } + + setSourceType(sourceType: string): void { + this.set(RedirectImpl.SOURCE_TYPE, sourceType); + } + + getSource(): string { + return this.get(RedirectImpl.SOURCE); + } + + setSource(source: string): void { + this.set(RedirectImpl.SOURCE, source); + } + + getSiteId(): string { + return this.get(RedirectImpl.SITE_ID); + } + + setSourceParameters(parameters: Array): void { + this.set(RedirectImpl.SOURCE_PARAMETERS, parameters); + } + + getSourceParameters(): Array { + return this.get(RedirectImpl.SOURCE_PARAMETERS); + } + + setTargetParameters(parameters: Array): void { + this.set(RedirectImpl.TARGET_PARAMETERS, parameters); + } + + getTargetParameters(): Array { + return this.get(RedirectImpl.TARGET_PARAMETERS); + } + + protected override propertiesUpdated(overwrittenValues: any, newValues: any): void { + NotificationUtil.showInfo(RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_save_result_text_success); + super.propertiesUpdated(overwrittenValues, newValues); + } + +} +mixin(RedirectImpl, Redirect); + +export default RedirectImpl; diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectImportResponse.as b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectImportResponse.ts similarity index 64% rename from core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectImportResponse.as rename to apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectImportResponse.ts index 2823c99..d9960ac 100644 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectImportResponse.as +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectImportResponse.ts @@ -14,27 +14,27 @@ * limitations under the License. */ -package com.tallence.core.redirects.studio.data { - /** * Redirects import response containing the imported redirects and the error messages of the import. */ -public class RedirectImportResponse { +class RedirectImportResponse { + + #redirects: Array = null; - private var redirects:Array; - private var errors:Array; + #errors: Array = null; - public function RedirectImportResponse(redirects:Array, errors:Array) { - this.redirects = redirects; - this.errors = errors; + constructor(redirects: Array, errors: Array) { + this.#redirects = redirects; + this.#errors = errors; } - public function getRedirects():Array { - return redirects; + getRedirects(): Array { + return this.#redirects; } - public function getErrors():Array { - return errors; + getErrors(): Array { + return this.#errors; } } -} \ No newline at end of file + +export default RedirectImportResponse; diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectSourceParameter.as b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectSourceParameter.ts similarity index 51% rename from core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectSourceParameter.as rename to apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectSourceParameter.ts index b951760..bfe7d09 100644 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectSourceParameter.as +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectSourceParameter.ts @@ -14,25 +14,28 @@ * limitations under the License. */ -package com.tallence.core.redirects.studio.data { -public class RedirectSourceParameter extends RedirectTargetParameter { +import RedirectTargetParameter from "./RedirectTargetParameter"; - public static const OPERATOR:String = "operator"; - public static const OPERATOR_EQUALS:String = "EQUALS"; +class RedirectSourceParameter extends RedirectTargetParameter { - public function RedirectSourceParameter(json:Object) { + static readonly OPERATOR: string = "operator"; + + static readonly OPERATOR_EQUALS: string = "EQUALS"; + + constructor(json: any) { super(json); - this[OPERATOR] = json[OPERATOR]; + this[RedirectSourceParameter.OPERATOR] = json[RedirectSourceParameter.OPERATOR]; } - public function getOperator():String { - return this[OPERATOR]; + getOperator(): string { + return this[RedirectSourceParameter.OPERATOR]; } - override public function getParametersAsMap():Object { - var map:Object = super.getParametersAsMap(); - map[OPERATOR] = getOperator(); + override getParametersAsMap(): any { + const map = super.getParametersAsMap(); + map[RedirectSourceParameter.OPERATOR] = this.getOperator(); return map; } } -} + +export default RedirectSourceParameter; diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectTargetParameter.as b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectTargetParameter.ts similarity index 58% rename from core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectTargetParameter.as rename to apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectTargetParameter.ts index 1940fdf..4480c19 100644 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectTargetParameter.as +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectTargetParameter.ts @@ -14,38 +14,39 @@ * limitations under the License. */ -package com.tallence.core.redirects.studio.data { - /** * * We extend the javascript object and store the data directly in the object as properties. We can't use private * variables because they are automatically changed by the compiler (for example, name to name$123). The changed names * are then automatically used for serializing, so parsing in the BE would not be possible. */ -public class RedirectTargetParameter extends Object { +class RedirectTargetParameter extends Object { + + static readonly NAME: string = "name"; - public static const NAME:String = "name"; - public static const VALUE:String = "value"; + static readonly VALUE: string = "value"; - public function RedirectTargetParameter(json:Object) { - this[NAME] = json[NAME]; - this[VALUE] = json[VALUE]; + constructor(json: any) { + super(); + this[RedirectTargetParameter.NAME] = json[RedirectTargetParameter.NAME]; + this[RedirectTargetParameter.VALUE] = json[RedirectTargetParameter.VALUE]; } - public function getName():String { - return this[NAME]; + getName(): string { + return this[RedirectTargetParameter.NAME]; } - public function getValue():String { - return this[VALUE]; + getValue(): string { + return this[RedirectTargetParameter.VALUE]; } - public function getParametersAsMap():Object { - var map:Object = {}; - map[NAME] = getName(); - map[VALUE] = getValue(); + getParametersAsMap(): any { + const map: Record = {}; + map[RedirectTargetParameter.NAME] = this.getName(); + map[RedirectTargetParameter.VALUE] = this.getValue(); return map; } } -} + +export default RedirectTargetParameter; diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/Redirects.as b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/Redirects.ts similarity index 75% rename from core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/Redirects.as rename to apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/Redirects.ts index 2011550..e69d80c 100644 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/Redirects.as +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/Redirects.ts @@ -14,17 +14,17 @@ * limitations under the License. */ -package com.tallence.core.redirects.studio.data { -import com.coremedia.ui.data.RemoteBean; +import RemoteBean from "@coremedia/studio-client.client-core/data/RemoteBean"; /** * An interface for the remote bean containing a list of redirects. */ -public interface Redirects extends RemoteBean { +abstract class Redirects extends RemoteBean { - function getItems():Array; + abstract getItems(): Array; - function getTotal():Number; + abstract getTotal(): number; } -} + +export default Redirects; diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectsImpl.as b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectsImpl.ts similarity index 52% rename from core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectsImpl.as rename to apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectsImpl.ts index efd7aa5..dd84a34 100644 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectsImpl.as +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectsImpl.ts @@ -14,25 +14,27 @@ * limitations under the License. */ -package com.tallence.core.redirects.studio.data { -import com.coremedia.ui.data.impl.RemoteBeanImpl; +import RemoteBeanImpl from "@coremedia/studio-client.client-core-impl/data/impl/RemoteBeanImpl"; +import { mixin } from "@jangaroo/runtime"; +import Redirect from "./Redirect"; +import Redirects from "./Redirects"; -[RestResource(uriTemplate="redirects/{siteId:[^/]+}")] -public class RedirectsImpl extends RemoteBeanImpl implements Redirects { +class RedirectsImpl extends RemoteBeanImpl implements Redirects { + static readonly REST_RESOURCE_URI_TEMPLATE: string = "redirects/{siteId:[^/]+}"; - public function RedirectsImpl(path:String) { + constructor(path: string) { super(path); } - [ArrayElementType("com.tallence.core.redirects.studio.data.Redirect")] - public function getItems():Array { - return get("items"); + getItems(): Array { + return this.get("items"); } - public function getTotal():Number { - return get("total"); + getTotal(): number { + return this.get("total"); } } +mixin(RedirectsImpl, Redirects); -} +export default RedirectsImpl; diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectsResponse.as b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectsResponse.ts similarity index 64% rename from core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectsResponse.as rename to apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectsResponse.ts index 6d2e9be..3b47a63 100644 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectsResponse.as +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/RedirectsResponse.ts @@ -14,27 +14,27 @@ * limitations under the License. */ -package com.tallence.core.redirects.studio.data { - /** * Redirects response containing the redirects for the page and the number of total records. */ -public class RedirectsResponse { +class RedirectsResponse { + + #redirects: Array = null; - private var redirects:Array; - private var total:Number; + #total: number = NaN; - public function RedirectsResponse(redirects:Array, total:Number) { - this.redirects = redirects; - this.total = total; + constructor(redirects: Array, total: number) { + this.#redirects = redirects; + this.#total = total; } - public function getRedirects():Array { - return redirects; + getRedirects(): Array { + return this.#redirects; } - public function getTotal():Number { - return total; + getTotal(): number { + return this.#total; } } -} \ No newline at end of file + +export default RedirectsResponse; diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/ValidationResponse.as b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/ValidationResponse.ts similarity index 64% rename from core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/ValidationResponse.as rename to apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/ValidationResponse.ts index d64fc82..087f9b5 100644 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/ValidationResponse.as +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/data/ValidationResponse.ts @@ -14,24 +14,24 @@ * limitations under the License. */ -package com.tallence.core.redirects.studio.data { -import ext.util.HashMap; +import HashMap from "@jangaroo/ext-ts/util/HashMap"; /** * Redirect validation response containing the error codes if the redirect is invalid. */ -public class ValidationResponse { +class ValidationResponse { - private var valid:Boolean; - private var errorCodes:HashMap; + #valid: boolean = false; - public function ValidationResponse(jsonResponse:Object) { - this.valid = jsonResponse.valid; - this.errorCodes = jsonResponse.errorCodes; + #errorCodes: HashMap = null; + + constructor(jsonResponse: any) { + this.#valid = jsonResponse.valid; + this.#errorCodes = jsonResponse.errorCodes; } - public function isValid():Boolean { - return valid; + isValid(): boolean { + return this.#valid; } /** @@ -39,8 +39,9 @@ public class ValidationResponse { * * Example: {'source': ['invalid'] } */ - public function getErrorCodes():HashMap { - return errorCodes; + getErrorCodes(): HashMap { + return this.#errorCodes; } } -} + +export default ValidationResponse; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/RedirectManagerEditor.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/RedirectManagerEditor.ts new file mode 100644 index 0000000..74c62e5 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/RedirectManagerEditor.ts @@ -0,0 +1,122 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import CoreIcons_properties from "@coremedia/studio-client.core-icons/CoreIcons_properties"; +import IconButton from "@coremedia/studio-client.ext.ui-components/components/IconButton"; +import BindPropertyPlugin from "@coremedia/studio-client.ext.ui-components/plugins/BindPropertyPlugin"; +import ButtonSkin from "@coremedia/studio-client.ext.ui-components/skins/ButtonSkin"; +import ToolbarSkin from "@coremedia/studio-client.ext.ui-components/skins/ToolbarSkin"; +import CollapsibleFormPanel from "@coremedia/studio-client.main.editor-components/sdk/premular/CollapsibleFormPanel"; +import Container from "@jangaroo/ext-ts/container/Container"; +import VBoxLayout from "@jangaroo/ext-ts/layout/container/VBox"; +import Panel from "@jangaroo/ext-ts/panel/Panel"; +import Separator from "@jangaroo/ext-ts/toolbar/Separator"; +import Toolbar from "@jangaroo/ext-ts/toolbar/Toolbar"; +import { bind } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import RedirectManagerStudioPlugin_properties from "../bundles/RedirectManagerStudioPlugin_properties"; +import RedirectManagerEditorBase from "./RedirectManagerEditorBase"; +import RedirectsOverviewGrid from "./grid/RedirectsOverviewGrid"; + +interface RedirectManagerEditorConfig extends Config { +} + +class RedirectManagerEditor extends RedirectManagerEditorBase { + declare Config: RedirectManagerEditorConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.redirectManagerEditorBase"; + + constructor(config: Config = null) { + super((()=> ConfigUtils.apply(Config(RedirectManagerEditor, { + id: RedirectManagerEditorBase.ID, + title: RedirectManagerStudioPlugin_properties.redirectmanager_button_text, + closable: true, + iconCls: "tallence-icons tallence-icons--redirects", + itemId: RedirectManagerEditorBase.ID, + layout: "fit", + items: [ + Config(Panel, { + layout: Config(VBoxLayout, { align: "stretch" }), + items: [ + Config(Container, { + cls: "redirectmanager-center-panel", + items: [ + Config(CollapsibleFormPanel, { + title: RedirectManagerStudioPlugin_properties.redirectmanager_editor_list_text, + collapsible: false, + items: [ + Config(RedirectsOverviewGrid, { + height: "100%", + selectedSiteIdVE: this.getSelectedSiteVE(), + mayNotWriteVE: this.getMayNotWriteVE(), + mayNotPublishVE: this.getMayNotPublishVE(), + mayNotUseRegexVE: this.getMayNotUseRegexVE(), + mayNotUseTargetUrlsVE: this.getMayNotUseTargetUrlsVE(), + siteIsNotSelectedVE: this.getSiteIsNotSelectedVE(), + }), + ], + }), + ], + }), + ], + tbar: Config(Toolbar, { + ui: ToolbarSkin.WORKAREA.getSkin(), + items: [ + Config(IconButton, { + itemId: "add", + tooltip: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_new_tooltip, + iconCls: CoreIcons_properties.create_content, + handler: bind(this, this.createRedirect), + ...ConfigUtils.append({ + plugins: [ + Config(BindPropertyPlugin, { + componentProperty: "disabled", + bindTo: this.getMayNotWriteVE(), + }), + ], + }), + }), + Config(Separator), + Config(IconButton, { + itemId: "upload", + tooltip: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_tooltip, + iconCls: CoreIcons_properties.upload, + handler: bind(this, this.csvUploadButtonHandler), + ...ConfigUtils.append({ + plugins: [ + Config(BindPropertyPlugin, { + componentProperty: "disabled", + bindTo: this.getMayNotWriteVE(), + }), + ], + }), + }), + ], + defaultType: IconButton.xtype, + defaults: Config({ + scale: "medium", + ui: ButtonSkin.WORKAREA.getSkin(), + }), + }), + }), + + ], + + }), config))()); + } +} + +export default RedirectManagerEditor; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/RedirectManagerEditorBase.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/RedirectManagerEditorBase.ts new file mode 100644 index 0000000..0dda3a9 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/RedirectManagerEditorBase.ts @@ -0,0 +1,144 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import ValueExpressionFactory from "@coremedia/studio-client.client-core/data/ValueExpressionFactory"; +import editorContext from "@coremedia/studio-client.main.editor-components/sdk/editorContext"; +import Ext from "@jangaroo/ext-ts"; +import Panel from "@jangaroo/ext-ts/panel/Panel"; +import { as, bind } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import RedirectManagerStudioPlugin_properties from "../bundles/RedirectManagerStudioPlugin_properties"; +import PermissionResponse from "../data/PermissionResponse"; +import RedirectsUtil from "../util/RedirectsUtil"; +import RedirectManagerEditor from "./RedirectManagerEditor"; +import RedirectEditWindow from "./form/RedirectEditWindow"; +import RedirectUploadWindow from "./upload/RedirectUploadWindow"; + +interface RedirectManagerEditorBaseConfig extends Config { +} + +class RedirectManagerEditorBase extends Panel { + declare Config: RedirectManagerEditorBaseConfig; + + protected static readonly ID: string = "redirectManagerEditor"; + + #selectedSiteVE: ValueExpression = null; + + #mayNotWriteVE: ValueExpression = null; + + #mayNotPublishVE: ValueExpression = null; + + #mayNotUseRegexVE: ValueExpression = null; + + #mayNotUseTargetUrlsVE: ValueExpression = null; + + constructor(config: Config = null) { + super(config); + + this.getSelectedSiteVE().addChangeListener(bind(this, this.#resolveRights)); + //Call it in case the site is already selected + this.#resolveRights(); + } + + #resolveRights(): void { + const siteId = this.getSelectedSiteVE().getValue(); + + //In case the request takes long or fails, the user has no rights + this.getMayNotWriteVE().setValue(true); + this.getMayNotPublishVE().setValue(true); + this.getMayNotUseRegexVE().setValue(true); + + RedirectsUtil.resolvePermissions(siteId).then((response: PermissionResponse): void => { + this.getMayNotWriteVE().setValue(!response.isMayWrite()); + this.getMayNotPublishVE().setValue(!response.isMayPublish()); + this.getMayNotUseRegexVE().setValue(!response.isMayUseRegex()); + this.getMayNotUseTargetUrlsVE().setValue(!response.isMayUseTargetUrls()); + }); + } + + static getInstance(): RedirectManagerEditor { + return as(Ext.getCmp(RedirectManagerEditorBase.ID), RedirectManagerEditor); + } + + protected createRedirect(): void { + const window = new RedirectEditWindow(Config(RedirectEditWindow, { + title: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_new_text, + selectedSiteIdVE: this.getSelectedSiteVE(), + mayNotPublishVE: this.#mayNotPublishVE, + mayNotUseRegexVE: this.#mayNotUseRegexVE, + mayNotUseTargetUrlsVE: this.#mayNotUseTargetUrlsVE, + })); + window.show(); + } + + protected csvUploadButtonHandler(): void { + const dialog = new RedirectUploadWindow( + Config(RedirectUploadWindow, { selectedSiteIdVE: this.getSelectedSiteVE() }), + ); + dialog.show(); + } + + /** + * Creates a ValueExpression that stores the currently selected site. + * @return ValueExpression + */ + protected getSelectedSiteVE(): ValueExpression { + if (!this.#selectedSiteVE) { + const preferredSite = editorContext._.getSitesService().getPreferredSite(); + this.#selectedSiteVE = ValueExpressionFactory.createFromValue(preferredSite ? preferredSite.getId() : ""); + } + return this.#selectedSiteVE; + } + + protected getMayNotWriteVE(): ValueExpression { + if (!this.#mayNotWriteVE) { + this.#mayNotWriteVE = ValueExpressionFactory.createFromValue(false); + } + return this.#mayNotWriteVE; + } + + protected getMayNotPublishVE(): ValueExpression { + if (!this.#mayNotPublishVE) { + this.#mayNotPublishVE = ValueExpressionFactory.createFromValue(false); + } + return this.#mayNotPublishVE; + } + + protected getMayNotUseRegexVE(): ValueExpression { + if (!this.#mayNotUseRegexVE) { + this.#mayNotUseRegexVE = ValueExpressionFactory.createFromValue(false); + } + return this.#mayNotUseRegexVE; + } + + protected getMayNotUseTargetUrlsVE(): ValueExpression { + if (!this.#mayNotUseTargetUrlsVE) { + this.#mayNotUseTargetUrlsVE = ValueExpressionFactory.createFromValue(false); + } + return this.#mayNotUseTargetUrlsVE; + } + + protected getSiteIsNotSelectedVE(): ValueExpression { + return ValueExpressionFactory.createFromFunction((): boolean => { + const siteId: string = this.getSelectedSiteVE().getValue(); + return !siteId || siteId == ""; + }); + } + +} + +export default RedirectManagerEditorBase; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/ErrorFieldContainer.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/ErrorFieldContainer.ts new file mode 100644 index 0000000..e020877 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/ErrorFieldContainer.ts @@ -0,0 +1,75 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import BindComponentsPlugin from "@coremedia/studio-client.ext.ui-components/plugins/BindComponentsPlugin"; +import FieldContainer from "@jangaroo/ext-ts/form/FieldContainer"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import ErrorMessage from "./ErrorMessage"; + +interface ErrorFieldContainerConfig extends Config, Partial> { +} + +class ErrorFieldContainer extends FieldContainer { + declare Config: ErrorFieldContainerConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.form.errorFieldContainer"; + + #errorMessagesVE: ValueExpression = null; + + /** + * A value expression containing a map with error codes. + * + * Example: {'source': ['invalid'] } + */ + get errorMessagesVE(): ValueExpression { + return this.#errorMessagesVE; + } + + set errorMessagesVE(value: ValueExpression) { + this.#errorMessagesVE = value; + } + + #propertyName: string = null; + + /** + * The key used to display the error messages for the given property name. + */ + get propertyName(): string { + return this.#propertyName; + } + + set propertyName(value: string) { + this.#propertyName = value; + } + + constructor(config: Config = null) { + super(ConfigUtils.apply(Config(ErrorFieldContainer, { + plugins: [ + Config(BindComponentsPlugin, { + valueExpression: config.errorMessagesVE.extendBy(config.propertyName), + configBeanParameterName: "errorCode", + template: Config(ErrorMessage), + }), + ], + }), config)); + } +} + +export default ErrorFieldContainer; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/ErrorMessage.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/ErrorMessage.ts new file mode 100644 index 0000000..cacbd4c --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/ErrorMessage.ts @@ -0,0 +1,46 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import DisplayField from "@jangaroo/ext-ts/form/field/Display"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import RedirectManagerStudioPlugin_properties from "../../bundles/RedirectManagerStudioPlugin_properties"; + +interface ErrorMessageConfig extends Config, Partial> { +} + +class ErrorMessage extends DisplayField { + declare Config: ErrorMessageConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.form.errorMessage"; + + #errorCode: string = null; + + get errorCode(): string { + return this.#errorCode; + } + + set errorCode(value: string) { + this.#errorCode = value; + } + + constructor(config: Config = null) { + super(ConfigUtils.apply(Config(ErrorMessage, { value: RedirectManagerStudioPlugin_properties["redirectmanager_editor_error_" + config.errorCode] }), config)); + } +} + +export default ErrorMessage; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectEditPanel.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectEditPanel.ts new file mode 100644 index 0000000..d30f3e5 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectEditPanel.ts @@ -0,0 +1,377 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Bean from "@coremedia/studio-client.client-core/data/Bean"; +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import StatefulDateField from "@coremedia/studio-client.ext.ui-components/components/StatefulDateField"; +import CollapsiblePanel from "@coremedia/studio-client.ext.ui-components/components/panel/CollapsiblePanel"; +import BindPropertyPlugin from "@coremedia/studio-client.ext.ui-components/plugins/BindPropertyPlugin"; +import DisplayFieldSkin from "@coremedia/studio-client.ext.ui-components/skins/DisplayFieldSkin"; +import FormSpacerElement from "@coremedia/studio-client.main.editor-components/sdk/premular/fields/FormSpacerElement"; +import SingleLinkEditor from "@coremedia/studio-client.main.editor-components/sdk/premular/fields/SingleLinkEditor"; +import FieldContainer from "@jangaroo/ext-ts/form/FieldContainer"; +import Checkbox from "@jangaroo/ext-ts/form/field/Checkbox"; +import ComboBox from "@jangaroo/ext-ts/form/field/ComboBox"; +import DisplayField from "@jangaroo/ext-ts/form/field/Display"; +import TextArea from "@jangaroo/ext-ts/form/field/TextArea"; +import FitLayout from "@jangaroo/ext-ts/layout/container/Fit"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import { AnyFunction } from "@jangaroo/runtime/types"; +import RedirectManagerStudioPlugin_properties from "../../bundles/RedirectManagerStudioPlugin_properties"; +import Redirect from "../../data/Redirect"; +import RedirectImpl from "../../data/RedirectImpl"; +import BindValidationStatePlugin from "../../plugins/BindValidationStatePlugin"; +import IdenticalRedirectsGrid from "../grid/IdenticalRedirectsGrid"; +import RedirectParametersGrid from "../parameters/RedirectParametersGrid"; +import ErrorFieldContainer from "./ErrorFieldContainer"; +import RedirectEditPanelBase from "./RedirectEditPanelBase"; +import RedirectSourceFieldContainer from "./RedirectSourceFieldContainer"; +import RedirectTargetUrlFieldContainer from "./RedirectTargetUrlFieldContainer"; + +interface RedirectEditPanelConfig extends Config, Partial> { +} + +class RedirectEditPanel extends RedirectEditPanelBase { + declare Config: RedirectEditPanelConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.form.redirectEditPanel"; + + constructor(config: Config = null) { + super(ConfigUtils.apply(Config(RedirectEditPanel, { + items: [ + Config(CollapsiblePanel, { + collapsible: false, + defaultType: FieldContainer["xtype"], + defaults: Config({ + labelAlign: "left", + width: "100%", + labelWidth: 130, + }), + items: [ + + Config(Checkbox, { + fieldLabel: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_active, + ...ConfigUtils.append({ + plugins: [ + Config(BindPropertyPlugin, { + bidirectional: true, + bindTo: RedirectEditPanelBase.getBindTo(config.localModel, RedirectImpl.ACTIVE), + }), + Config(BindPropertyPlugin, { + componentProperty: "hidden", + bindTo: config.mayNotPublishVE, + }), + ], + }), + }), + + Config(FormSpacerElement, { height: "10px" }), + + Config(StatefulDateField, { + disabled: true, + editable: false, + fieldLabel: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_creationDate, + startDay: 1, + plugins: [ + Config(BindPropertyPlugin, { + bidirectional: true, + bindTo: RedirectEditPanelBase.getBindTo(config.localModel, RedirectImpl.CREATION_DATE), + }), + ], + }), + + Config(FormSpacerElement, { height: "10px" }), + + Config(ComboBox, { + itemId: "redirectTypeField", + fieldLabel: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_type, + forceSelection: true, + triggerAction: "all", + editable: false, + store: [ + [RedirectImpl.REDIRECT_TYPE_404, RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_type_value_1], + [RedirectImpl.REDIRECT_TYPE_ALWAYS, RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_type_value_0], + ], + ...ConfigUtils.append({ + plugins: [ + Config(BindPropertyPlugin, { + bidirectional: true, + bindTo: RedirectEditPanelBase.getBindTo(config.localModel, RedirectImpl.REDIRECT_TYPE), + }), + ], + }), + }), + + Config(FormSpacerElement, { height: "10px" }), + + Config(RedirectSourceFieldContainer, { + errorMessagesVE: config.errorMessagesVE, + sourceUrlVE: RedirectEditPanelBase.getBindTo(config.localModel, RedirectImpl.SOURCE), + sourceUrlParametersVE: RedirectEditPanelBase.getBindTo(config.localModel, RedirectImpl.SOURCE_PARAMETERS), + }), + + Config(ErrorFieldContainer, { + errorMessagesVE: config.errorMessagesVE, + propertyName: RedirectImpl.SOURCE, + }), + + Config(DisplayField, { + value: RedirectManagerStudioPlugin_properties.redirectmanager_editor_same_source_title, + ui: DisplayFieldSkin.BOLD.getSkin(), + margin: "10 0 0 0", + }), + + Config(IdenticalRedirectsGrid, { + selectedSiteIdVE: config.selectedSiteIdVE, + height: "25px", + selectedRedirect: config.redirect, + exactMatch: true, + emptyText: RedirectManagerStudioPlugin_properties.redirectmanager_editor_list_nothing_found_match, + searchFieldVE: RedirectEditPanelBase.getBindTo(config.localModel, RedirectImpl.SOURCE), + }), + + Config(DisplayField, { + value: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_sourceParameters, + ui: DisplayFieldSkin.BOLD.getSkin(), + }), + Config(RedirectParametersGrid, { + bindTo: RedirectEditPanelBase.getBindTo(config.localModel, RedirectImpl.SOURCE_PARAMETERS), + validateRedirectHandler: config.validateRedirectHandler, + }), + + Config(ErrorFieldContainer, { + errorMessagesVE: config.errorMessagesVE, + propertyName: RedirectImpl.SOURCE_PARAMETERS, + }), + + Config(FormSpacerElement, { height: "10px" }), + + /*TODO both elements (spacer and comboBox) are bound to the mayNotUseRegexVE. There might is a more elegant way!*/ + Config(FormSpacerElement, { + height: "10px", + ...ConfigUtils.append({ + plugins: [ + Config(BindPropertyPlugin, { + componentProperty: "hidden", + bindTo: config.mayNotUseRegexVE, + }), + ], + }), + }), + Config(ComboBox, { + itemId: "sourceTypeField", + fieldLabel: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_sourceType, + forceSelection: true, + triggerAction: "all", + editable: false, + store: [ + [RedirectImpl.SOURCE_TYPE_PLAIN, RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_sourceType_plain], + [RedirectImpl.SOURCE_TYPE_REGEX, RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_sourceType_regex], + ], + ...ConfigUtils.append({ + plugins: [ + Config(BindPropertyPlugin, { + bidirectional: true, + bindTo: RedirectEditPanelBase.getBindTo(config.localModel, RedirectImpl.SOURCE_TYPE), + }), + Config(BindPropertyPlugin, { + componentProperty: "hidden", + bindTo: config.mayNotUseRegexVE, + }), + + ], + }), + }), + + Config(FormSpacerElement, { height: "10px" }), + + Config(SingleLinkEditor, { + linkContentType: "CMLinkable", + labelAlign: "left", + width: 640, + bindTo: RedirectEditPanelBase.getBindTo(config.localModel, RedirectImpl.TARGET_LINK), + linkListLabel: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_targetLink, + ...ConfigUtils.append({ + plugins: [ + Config(BindValidationStatePlugin, { + bindTo: config.errorMessagesVE, + propertyName: RedirectImpl.TARGET_LINK, + }), + ], + }), + }), + + Config(ErrorFieldContainer, { + errorMessagesVE: config.errorMessagesVE, + propertyName: RedirectImpl.TARGET_LINK, + }), + + Config(FormSpacerElement, { height: "10px" }), + + Config(DisplayField, { + value: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_targetParameters, + ui: DisplayFieldSkin.BOLD.getSkin(), + }), + Config(RedirectParametersGrid, { bindTo: RedirectEditPanelBase.getBindTo(config.localModel, RedirectImpl.TARGET_PARAMETERS) }), + + Config(ErrorFieldContainer, { + errorMessagesVE: config.errorMessagesVE, + propertyName: RedirectImpl.TARGET_PARAMETERS, + }), + + Config(FormSpacerElement, { + height: "10px", + ...ConfigUtils.append({ + plugins: [ + Config(BindPropertyPlugin, { + componentProperty: "hidden", + bindTo: config.mayNotUseTargetUrlsVE, + }), + ], + }), + }), + + Config(RedirectTargetUrlFieldContainer, { + errorMessagesVE: config.errorMessagesVE, + targetUrlVE: RedirectEditPanelBase.getBindTo(config.localModel, RedirectImpl.TARGET_URL), + ...ConfigUtils.append({ + plugins: [ + Config(BindPropertyPlugin, { + componentProperty: "hidden", + bindTo: config.mayNotUseTargetUrlsVE, + }), + ], + }), + }), + + Config(ErrorFieldContainer, { + errorMessagesVE: config.errorMessagesVE, + propertyName: RedirectImpl.TARGET_URL, + }), + + Config(FormSpacerElement, { height: "10px" }), + + Config(TextArea, { + fieldLabel: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_description, + ...ConfigUtils.append({ + plugins: [ + Config(BindPropertyPlugin, { + bidirectional: true, + bindTo: RedirectEditPanelBase.getBindTo(config.localModel, RedirectImpl.DESCRIPTION), + }), + ], + }), + }), + + ], + }), + ], + layout: Config(FitLayout), + + }), config)); + } + + #localModel: Bean = null; + + get localModel(): Bean { + return this.#localModel; + } + + set localModel(value: Bean) { + this.#localModel = value; + } + + #errorMessagesVE: ValueExpression = null; + + get errorMessagesVE(): ValueExpression { + return this.#errorMessagesVE; + } + + set errorMessagesVE(value: ValueExpression) { + this.#errorMessagesVE = value; + } + + #mayNotPublishVE: ValueExpression = null; + + get mayNotPublishVE(): ValueExpression { + return this.#mayNotPublishVE; + } + + set mayNotPublishVE(value: ValueExpression) { + this.#mayNotPublishVE = value; + } + + #mayNotUseRegexVE: ValueExpression = null; + + get mayNotUseRegexVE(): ValueExpression { + return this.#mayNotUseRegexVE; + } + + set mayNotUseRegexVE(value: ValueExpression) { + this.#mayNotUseRegexVE = value; + } + + #mayNotUseTargetUrlsVE: ValueExpression = null; + + get mayNotUseTargetUrlsVE(): ValueExpression { + return this.#mayNotUseTargetUrlsVE; + } + + set mayNotUseTargetUrlsVE(value: ValueExpression) { + this.#mayNotUseTargetUrlsVE = value; + } + + #selectedSiteIdVE: ValueExpression = null; + + get selectedSiteIdVE(): ValueExpression { + return this.#selectedSiteIdVE; + } + + set selectedSiteIdVE(value: ValueExpression) { + this.#selectedSiteIdVE = value; + } + + #validateRedirectHandler: AnyFunction = null; + + get validateRedirectHandler(): AnyFunction { + return this.#validateRedirectHandler; + } + + set validateRedirectHandler(value: AnyFunction) { + this.#validateRedirectHandler = value; + } + + #redirect: Redirect = null; + + get redirect(): Redirect { + return this.#redirect; + } + + set redirect(value: Redirect) { + this.#redirect = value; + } +} + +export default RedirectEditPanel; diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/form/RedirectEditPanelBase.as b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectEditPanelBase.ts similarity index 52% rename from core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/form/RedirectEditPanelBase.as rename to apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectEditPanelBase.ts index e68a260..381953d 100644 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/form/RedirectEditPanelBase.as +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectEditPanelBase.ts @@ -14,27 +14,31 @@ * limitations under the License. */ -package com.tallence.core.redirects.studio.editor.form { -import com.coremedia.ui.data.Bean; -import com.coremedia.ui.data.ValueExpression; -import com.coremedia.ui.data.ValueExpressionFactory; - -import ext.container.Container; +import Bean from "@coremedia/studio-client.client-core/data/Bean"; +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import ValueExpressionFactory from "@coremedia/studio-client.client-core/data/ValueExpressionFactory"; +import Container from "@jangaroo/ext-ts/container/Container"; +import Config from "@jangaroo/runtime/Config"; +import RedirectEditPanel from "./RedirectEditPanel"; +interface RedirectEditPanelBaseConfig extends Config { +} /** * A form for editing redirects. Changes are bind to the localModel. * The localModel can be passed as a configuration parameter. */ -public class RedirectEditPanelBase extends Container { +class RedirectEditPanelBase extends Container { + declare Config: RedirectEditPanelBaseConfig; - public function RedirectEditPanelBase(config:RedirectEditPanel = null) { + constructor(config: Config = null) { super(config); } - protected static function getBindTo(localModel:Bean, propertyName:String):ValueExpression { + protected static getBindTo(localModel: Bean, propertyName: string): ValueExpression { return ValueExpressionFactory.create(propertyName, localModel); } } -} + +export default RedirectEditPanelBase; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectEditWindow.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectEditWindow.ts new file mode 100644 index 0000000..7e20fc5 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectEditWindow.ts @@ -0,0 +1,141 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import BindPropertyPlugin from "@coremedia/studio-client.ext.ui-components/plugins/BindPropertyPlugin"; +import ButtonSkin from "@coremedia/studio-client.ext.ui-components/skins/ButtonSkin"; +import Editor_properties from "@coremedia/studio-client.main.editor-components/Editor_properties"; +import Button from "@jangaroo/ext-ts/button/Button"; +import Fill from "@jangaroo/ext-ts/toolbar/Fill"; +import Toolbar from "@jangaroo/ext-ts/toolbar/Toolbar"; +import { bind } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import RedirectManagerStudioPlugin_properties from "../../bundles/RedirectManagerStudioPlugin_properties"; +import Redirect from "../../data/Redirect"; +import RedirectEditPanel from "./RedirectEditPanel"; +import RedirectEditWindowBase from "./RedirectEditWindowBase"; + +interface RedirectEditWindowConfig extends Config, Partial> { +} + +/* +The Windows is not "modal" because the editor might drag a document from the workarea and drop it to the redirect-target-field */ +class RedirectEditWindow extends RedirectEditWindowBase { + declare Config: RedirectEditWindowConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.form.redirectEditWindow"; + + constructor(config: Config = null) { + super((()=> ConfigUtils.apply(Config(RedirectEditWindow, { + autoScroll: true, + width: "700px", + items: [ + Config(RedirectEditPanel, { + localModel: this.getLocalModel(), + mayNotUseRegexVE: config.mayNotUseRegexVE, + mayNotUseTargetUrlsVE: config.mayNotUseTargetUrlsVE, + mayNotPublishVE: config.mayNotPublishVE, + errorMessagesVE: this.getErrorMessagesVE(), + selectedSiteIdVE: config.selectedSiteIdVE, + validateRedirectHandler: bind(this, this.validateRedirect), + redirect: config.redirect, + }), + ], + fbar: Config(Toolbar, { + items: [ + Config(Fill), + Config(Button, { + ui: ButtonSkin.FOOTER_PRIMARY.getSkin(), + text: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_save_text, + handler: bind(this, this.save), + scale: "small", + plugins: [ + Config(BindPropertyPlugin, { + componentProperty: "disabled", + bindTo: this.getSaveButtonDisabledVE(), + }), + ], + }), + Config(Button, { + ui: ButtonSkin.FOOTER_SECONDARY.getSkin(), + text: Editor_properties.dialog_defaultCancelButton_text, + handler: bind(this, this.close), + scale: "small", + }), + ], + }), + + }), config))()); + } + + #redirect: Redirect = null; + + get redirect(): Redirect { + return this.#redirect; + } + + set redirect(value: Redirect) { + this.#redirect = value; + } + + #selectedSiteIdVE: ValueExpression = null; + + get selectedSiteIdVE(): ValueExpression { + return this.#selectedSiteIdVE; + } + + set selectedSiteIdVE(value: ValueExpression) { + this.#selectedSiteIdVE = value; + } + + #mayNotPublishVE: ValueExpression = null; + + get mayNotPublishVE(): ValueExpression { + return this.#mayNotPublishVE; + } + + set mayNotPublishVE(value: ValueExpression) { + this.#mayNotPublishVE = value; + } + + #mayNotUseRegexVE: ValueExpression = null; + + get mayNotUseRegexVE(): ValueExpression { + return this.#mayNotUseRegexVE; + } + + set mayNotUseRegexVE(value: ValueExpression) { + this.#mayNotUseRegexVE = value; + } + + #mayNotUseTargetUrlsVE: ValueExpression = null; + + get mayNotUseTargetUrlsVE(): ValueExpression { + return this.#mayNotUseTargetUrlsVE; + } + + set mayNotUseTargetUrlsVE(value: ValueExpression) { + this.#mayNotUseTargetUrlsVE = value; + } +} + +export default RedirectEditWindow; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectEditWindowBase.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectEditWindowBase.ts new file mode 100644 index 0000000..e44dd8e --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectEditWindowBase.ts @@ -0,0 +1,253 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Content from "@coremedia/studio-client.cap-rest-client/content/Content"; +import Bean from "@coremedia/studio-client.client-core/data/Bean"; +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import ValueExpressionFactory from "@coremedia/studio-client.client-core/data/ValueExpressionFactory"; +import beanFactory from "@coremedia/studio-client.client-core/data/beanFactory"; +import RemoteError from "@coremedia/studio-client.client-core/data/error/RemoteError"; +import MessageBoxUtil from "@coremedia/studio-client.main.editor-components/sdk/util/MessageBoxUtil"; +import Window from "@jangaroo/ext-ts/window/Window"; +import { bind } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import RedirectManagerStudioPlugin_properties from "../../bundles/RedirectManagerStudioPlugin_properties"; +import Redirect from "../../data/Redirect"; +import RedirectImpl from "../../data/RedirectImpl"; +import ValidationResponse from "../../data/ValidationResponse"; +import NotificationUtil from "../../util/NotificationUtil"; +import RedirectsUtil from "../../util/RedirectsUtil"; +import RedirectEditWindow from "./RedirectEditWindow"; + +interface RedirectEditWindowBaseConfig extends Config { +} + +/** + * A window to create or edit redirects. + */ +class RedirectEditWindowBase extends Window { + declare Config: RedirectEditWindowBaseConfig; + + static #SOURCE_TYPE_DEFAULT: string = RedirectImpl.SOURCE_TYPE_PLAIN; + + static readonly #MESSAGE_BOX_DECISION_POSITIVE: string = "yes"; + + #localModel: Bean = null; + + #redirect: Redirect = null; + + #isValidSourceVE: ValueExpression = null; + + #errorMessagesVE: ValueExpression = null; + + #selectedSiteIdVE: ValueExpression = null; + + #mayNotPublishVE: ValueExpression = null; + + constructor(config: Config = null) { + super(config); + this.#redirect = config.redirect; + this.#selectedSiteIdVE = config.selectedSiteIdVE; + this.#mayNotPublishVE = config.mayNotPublishVE; + this.#initLocalModel(); + this.#initValidationChangeListeners(); + } + + /** + * Initializes the change listeners to validate the redirect. If the lifecycle satus of the target change, the + * redirect must be validated again. + */ + #initValidationChangeListeners(): void { + this.getLocalModel().addPropertyChangeListener(RedirectImpl.ACTIVE, bind(this, this.validateRedirect)); + this.getLocalModel().addPropertyChangeListener(RedirectImpl.SOURCE, bind(this, this.validateRedirect)); + this.getLocalModel().addPropertyChangeListener(RedirectImpl.TARGET_LINK, bind(this, this.validateRedirect)); + this.getLocalModel().addPropertyChangeListener(RedirectImpl.TARGET_URL, bind(this, this.validateRedirect)); + const lifecycleStatusVE = ValueExpressionFactory.create(RedirectImpl.TARGET_LINK, this.getLocalModel()).extendBy("0", "lifecycleStatus"); + lifecycleStatusVE.addChangeListener(bind(this, this.validateRedirect)); + this.validateRedirect(); + } + + protected validateRedirect(): void { + const siteId: string = this.#redirect ? this.#redirect.getSiteId() : this.#selectedSiteIdVE.getValue(); + const redirectId: string = this.#redirect ? this.#redirect.getUriPath().replace("redirect/", "").replace(siteId + "/", "") : ""; + const targetLink: Content = this.getLocalModel().get(RedirectImpl.TARGET_LINK)[0]; + const targetId: string = targetLink ? targetLink.getId() : ""; + const targetUrl: string = this.getLocalModel().get(RedirectImpl.TARGET_URL); + const active: boolean = this.getLocalModel().get(RedirectImpl.ACTIVE); + const sourceParameters: Array = this.getLocalModel().get(RedirectImpl.SOURCE_PARAMETERS); + RedirectsUtil + .validateRedirect(siteId, redirectId, this.getLocalModel().get(RedirectImpl.SOURCE), targetId, targetUrl, active, sourceParameters) + .then(bind(this, this.#handleValidationResponse), RedirectEditWindowBase.#validationErrorHandler); + } + + #handleValidationResponse(response: ValidationResponse): void { + this.getIsValidSourceVE().setValue(response.isValid()); + this.getErrorMessagesVE().setValue(response.getErrorCodes()); + } + + static #validationErrorHandler(error: RemoteError): void { + NotificationUtil.showError(RedirectManagerStudioPlugin_properties.redirectmanager_validation_error + error); + } + + /** + * If a redirect is available, the local model will be initialized. + */ + #initLocalModel(): void { + const model = this.getLocalModel(); + if (this.#redirect) { + model.set(RedirectImpl.ACTIVE, this.#redirect.isActive()); + model.set(RedirectImpl.TARGET_LINK, this.#redirect.getTargetLink() ? [this.#redirect.getTargetLink()] : []); + model.set(RedirectImpl.DESCRIPTION, this.#redirect.getDescription()); + model.set(RedirectImpl.SOURCE, this.#redirect.getSource()); + model.set(RedirectImpl.TARGET_URL, this.#redirect.getTargetUrl()); + model.set(RedirectImpl.SOURCE_TYPE, this.#redirect.getSourceType()); + model.set(RedirectImpl.REDIRECT_TYPE, this.#redirect.getRedirectType()); + model.set(RedirectImpl.CREATION_DATE, this.#redirect.getCreationDate()); + model.set(RedirectImpl.SOURCE_PARAMETERS, [].concat(this.#redirect.getSourceParameters())); + model.set(RedirectImpl.TARGET_PARAMETERS, [].concat(this.#redirect.getTargetParameters())); + } else { + //Set default values. The redirect is active by default, if the user has publication rights + model.set(RedirectImpl.ACTIVE, !this.#mayNotPublishVE.getValue()); + model.set(RedirectImpl.SOURCE, "/"); + model.set(RedirectImpl.SOURCE_TYPE, RedirectEditWindowBase.#SOURCE_TYPE_DEFAULT); + model.set(RedirectImpl.REDIRECT_TYPE, RedirectImpl.REDIRECT_TYPE_404); + model.set(RedirectImpl.CREATION_DATE, new Date()); + model.set(RedirectImpl.SOURCE_PARAMETERS, []); + model.set(RedirectImpl.TARGET_PARAMETERS, []); + } + } + + /** + * If a redirect is available, the redirects will be updated. Otherwise a new redirect is created. + */ + protected save(): void { + const model = this.getLocalModel(); + + const source: string = model.get(RedirectImpl.SOURCE); + const redirectType: string = model.get(RedirectImpl.REDIRECT_TYPE); + + const endsWithEvenId: boolean = source && source.match(".+-.*[02468]") != null; + + if (source && endsWithEvenId && RedirectImpl.REDIRECT_TYPE_404 == redirectType) { + + MessageBoxUtil.showDecision(RedirectManagerStudioPlugin_properties.redirectmanager_decision_title, + RedirectManagerStudioPlugin_properties.redirectmanager_decision_use404Type, + RedirectManagerStudioPlugin_properties.redirectmanager_decision_ok, + //when clicked on ok: + (decision: string): void => + this.#processSaveWithDecision(decision, RedirectImpl.REDIRECT_TYPE_ALWAYS), + ); + } else if (source && !endsWithEvenId && RedirectImpl.REDIRECT_TYPE_ALWAYS == redirectType) { + MessageBoxUtil.showDecision(RedirectManagerStudioPlugin_properties.redirectmanager_decision_title, + RedirectManagerStudioPlugin_properties.redirectmanager_decision_useAlwaysType, + RedirectManagerStudioPlugin_properties.redirectmanager_decision_ok, + //when clicked on ok: + (decision: string): void => + this.#processSaveWithDecision(decision, RedirectImpl.REDIRECT_TYPE_404), + ); + } else { + this.#processSave(); + } + } + + #processSaveWithDecision(decision: string, redirectType: string): void { + if (decision == RedirectEditWindowBase.#MESSAGE_BOX_DECISION_POSITIVE) { + this.getLocalModel().set(RedirectImpl.REDIRECT_TYPE, redirectType); + } + this.#processSave(); + } + + #processSave(): void { + + const model = this.getLocalModel(); + + if (this.#redirect) { + this.#redirect.setActive(model.get(RedirectImpl.ACTIVE)); + this.#redirect.setTargetLink(model.get(RedirectImpl.TARGET_LINK)[0]); + this.#redirect.setTargetUrl(model.get(RedirectImpl.TARGET_URL)); + this.#redirect.setDescription(model.get(RedirectImpl.DESCRIPTION)); + this.#redirect.setSource(model.get(RedirectImpl.SOURCE)); + this.#redirect.setSourceType(model.get(RedirectImpl.SOURCE_TYPE)); + this.#redirect.setRedirectType(model.get(RedirectImpl.REDIRECT_TYPE)); + this.#redirect.setSourceParameters(model.get(RedirectImpl.SOURCE_PARAMETERS)); + this.#redirect.setTargetParameters(model.get(RedirectImpl.TARGET_PARAMETERS)); + } else { + const siteId: string = this.#redirect ? this.#redirect.getSiteId() : this.#selectedSiteIdVE.getValue(); + const sourceType: string = model.get(RedirectImpl.SOURCE_TYPE); + RedirectsUtil.createRedirect( + siteId, + model.get(RedirectImpl.ACTIVE), + model.get(RedirectImpl.TARGET_LINK)[0], + model.get(RedirectImpl.TARGET_URL), + model.get(RedirectImpl.DESCRIPTION), + model.get(RedirectImpl.SOURCE), + //Default value, if the input field is hidden (because of missing permissions) + sourceType ? sourceType : RedirectEditWindowBase.#SOURCE_TYPE_DEFAULT, + model.get(RedirectImpl.REDIRECT_TYPE), + model.get(RedirectImpl.SOURCE_PARAMETERS), + model.get(RedirectImpl.TARGET_PARAMETERS), + ); + } + this.close(); + } + + /** + * Returns a ValueExpression to enable or disable the save button. + * If a redirect is invalid, the button should be disabled. + * @return the value expression. + */ + protected getSaveButtonDisabledVE(): ValueExpression { + return ValueExpressionFactory.createFromFunction((): boolean => { + const model = this.getLocalModel(); + const isValid: boolean = this.getIsValidSourceVE().getValue(); + + const active: boolean = model.get(RedirectImpl.ACTIVE); + const invalidPublishAttempt: boolean = active && this.#mayNotPublishVE.getValue(); + + return invalidPublishAttempt || !isValid; + }); + } + + /** + * Returns a local model representing a redirect. Initializes the linked content with an empty array, otherwise + * SingleLinkEditor could not initialize the content binding. + * @return + */ + protected getLocalModel(): Bean { + if (!this.#localModel) { + this.#localModel = beanFactory._.createLocalBean({}); + this.#localModel.set(RedirectImpl.TARGET_LINK, []); + } + return this.#localModel; + } + + protected getIsValidSourceVE(): ValueExpression { + if (!this.#isValidSourceVE) { + this.#isValidSourceVE = ValueExpressionFactory.createFromValue(true); + } + return this.#isValidSourceVE; + } + + protected getErrorMessagesVE(): ValueExpression { + if (!this.#errorMessagesVE) { + this.#errorMessagesVE = ValueExpressionFactory.createFromValue([]); + } + return this.#errorMessagesVE; + } + +} + +export default RedirectEditWindowBase; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectSourceFieldContainer.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectSourceFieldContainer.ts new file mode 100644 index 0000000..bd58585 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectSourceFieldContainer.ts @@ -0,0 +1,69 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import CoreIcons_properties from "@coremedia/studio-client.core-icons/CoreIcons_properties"; +import IconButton from "@coremedia/studio-client.ext.ui-components/components/IconButton"; +import StatefulTextField from "@coremedia/studio-client.ext.ui-components/components/StatefulTextField"; +import BindPropertyPlugin from "@coremedia/studio-client.ext.ui-components/plugins/BindPropertyPlugin"; +import HBoxLayout from "@jangaroo/ext-ts/layout/container/HBox"; +import { bind } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import RedirectManagerStudioPlugin_properties from "../../bundles/RedirectManagerStudioPlugin_properties"; +import RedirectImpl from "../../data/RedirectImpl"; +import BindValidationStatePlugin from "../../plugins/BindValidationStatePlugin"; +import RedirectSourceFieldContainerBase from "./RedirectSourceFieldContainerBase"; + +interface RedirectSourceFieldContainerConfig extends Config { +} + +class RedirectSourceFieldContainer extends RedirectSourceFieldContainerBase { + declare Config: RedirectSourceFieldContainerConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.form.redirectSourceFieldContainer"; + + constructor(config: Config = null) { + super((()=> ConfigUtils.apply(Config(RedirectSourceFieldContainer, { + fieldLabel: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_source, + items: [ + Config(StatefulTextField, { + width: 490, + checkChangeBuffer: 400, + ...ConfigUtils.append({ + plugins: [ + Config(BindValidationStatePlugin, { + bindTo: config.errorMessagesVE, + propertyName: RedirectImpl.SOURCE, + }), + Config(BindPropertyPlugin, { + bidirectional: true, + bindTo: config.sourceUrlVE, + }), + ], + }), + }), + Config(IconButton, { + iconCls: CoreIcons_properties.help, + tooltip: RedirectManagerStudioPlugin_properties.redirectmanager_editor_help_tooltip, + handler: bind(this, this.showInfoDialog), + }), + ], + layout: Config(HBoxLayout), + + }), config))()); + } +} + +export default RedirectSourceFieldContainer; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectSourceFieldContainerBase.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectSourceFieldContainerBase.ts new file mode 100644 index 0000000..6be33a2 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectSourceFieldContainerBase.ts @@ -0,0 +1,130 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import MessageBoxUtil from "@coremedia/studio-client.main.editor-components/sdk/util/MessageBoxUtil"; +import Ext from "@jangaroo/ext-ts"; +import ObjectUtil from "@jangaroo/ext-ts/Object"; +import FieldContainer from "@jangaroo/ext-ts/form/FieldContainer"; +import { as, bind } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import RedirectManagerStudioPlugin_properties from "../../bundles/RedirectManagerStudioPlugin_properties"; +import RedirectSourceParameter from "../../data/RedirectSourceParameter"; +import RedirectTargetParameter from "../../data/RedirectTargetParameter"; +import RedirectSourceFieldContainer from "./RedirectSourceFieldContainer"; + +interface RedirectSourceFieldContainerBaseConfig extends Config, Partial> { +} + +/** + * A form for editing redirects. Changes are bind to the localModel. + * The localModel can be passed as a configuration parameter. + */ +class RedirectSourceFieldContainerBase extends FieldContainer { + declare Config: RedirectSourceFieldContainerBaseConfig; + + #errorMessagesVE: ValueExpression = null; + + get errorMessagesVE(): ValueExpression { + return this.#errorMessagesVE; + } + + set errorMessagesVE(value: ValueExpression) { + this.#errorMessagesVE = value; + } + + #sourceUrlVE: ValueExpression = null; + + get sourceUrlVE(): ValueExpression { + return this.#sourceUrlVE; + } + + set sourceUrlVE(value: ValueExpression) { + this.#sourceUrlVE = value; + } + + #sourceUrlParametersVE: ValueExpression = null; + + get sourceUrlParametersVE(): ValueExpression { + return this.#sourceUrlParametersVE; + } + + set sourceUrlParametersVE(value: ValueExpression) { + this.#sourceUrlParametersVE = value; + } + + constructor(config: Config = null) { + super(config); + this.sourceUrlParametersVE = config.sourceUrlParametersVE; + config.sourceUrlVE.addChangeListener(bind(this, this.#sourceUrlChangeListener)); + + } + + /** + * When the source url changes, the listener checks if the string contains url parameters. In this case the + * parameters are parsed and added as {@link RedirectSourceParameter}. Additionally the value expression for the + * source url is overwritten so that the string with the parameters is no longer part of the url. + */ + #sourceUrlChangeListener(update: ValueExpression): void { + const sourceUrl: string = update.getValue(); + if (sourceUrl && sourceUrl.indexOf("?") != -1) { + const queryString = sourceUrl.substring(sourceUrl.indexOf("?") + 1); + + const queryParams = ObjectUtil.fromQueryString(queryString); + const params = ObjectUtil.getKeys(queryParams).map((key: string): RedirectSourceParameter => + RedirectSourceFieldContainerBase.#convertToRedirectParameter(key, queryParams[key]), + ); + + const parameters = [].concat(this.sourceUrlParametersVE.getValue()).concat(params); + this.sourceUrlParametersVE.setValue(parameters); + + update.setValue(sourceUrl.substr(0, sourceUrl.indexOf("?"))); + } + } + + static #convertToRedirectParameter(key: string, entry: any): RedirectSourceParameter { + let value = ""; + if (entry instanceof Array) { + value = (as(entry, Array))[0] as string; + } else { + value = String(entry); + } + const init: Record = {}; + init[RedirectTargetParameter.NAME] = key; + init[RedirectTargetParameter.VALUE] = value; + init[RedirectSourceParameter.OPERATOR] = RedirectSourceParameter.OPERATOR_EQUALS; + return new RedirectSourceParameter(init); + } + + /** + * Opens a dialog with descriptions for the source field. + */ + showInfoDialog(): void { + MessageBoxUtil.showInfo( + RedirectManagerStudioPlugin_properties.redirectmanager_editor_help_source_title, + RedirectManagerStudioPlugin_properties.redirectmanager_editor_help_source_text, + Ext.emptyFn, + false, + ); + } + +} + +export default RedirectSourceFieldContainerBase; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectTargetUrlFieldContainer.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectTargetUrlFieldContainer.ts new file mode 100644 index 0000000..fef0077 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/form/RedirectTargetUrlFieldContainer.ts @@ -0,0 +1,104 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import CoreIcons_properties from "@coremedia/studio-client.core-icons/CoreIcons_properties"; +import IconButton from "@coremedia/studio-client.ext.ui-components/components/IconButton"; +import StatefulTextField from "@coremedia/studio-client.ext.ui-components/components/StatefulTextField"; +import BindPropertyPlugin from "@coremedia/studio-client.ext.ui-components/plugins/BindPropertyPlugin"; +import MessageBoxUtil from "@coremedia/studio-client.main.editor-components/sdk/util/MessageBoxUtil"; +import Ext from "@jangaroo/ext-ts"; +import FieldContainer from "@jangaroo/ext-ts/form/FieldContainer"; +import HBoxLayout from "@jangaroo/ext-ts/layout/container/HBox"; +import { bind } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import RedirectManagerStudioPlugin_properties from "../../bundles/RedirectManagerStudioPlugin_properties"; +import RedirectImpl from "../../data/RedirectImpl"; +import BindValidationStatePlugin from "../../plugins/BindValidationStatePlugin"; + +interface RedirectTargetUrlFieldContainerConfig extends Config, Partial> { +} + +class RedirectTargetUrlFieldContainer extends FieldContainer { + declare Config: RedirectTargetUrlFieldContainerConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.form.redirectSourceFieldContainer"; + + #targetUrlVE: ValueExpression = null; + + get targetUrlVE(): ValueExpression { + return this.#targetUrlVE; + } + + set targetUrlVE(value: ValueExpression) { + this.#targetUrlVE = value; + } + + #errorMessagesVE: ValueExpression = null; + + get errorMessagesVE(): ValueExpression { + return this.#errorMessagesVE; + } + + set errorMessagesVE(value: ValueExpression) { + this.#errorMessagesVE = value; + } + + constructor(config: Config = null) { + super((()=> ConfigUtils.apply(Config(RedirectTargetUrlFieldContainer, { + fieldLabel: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_targetUrl, + items: [ + Config(StatefulTextField, { + width: 490, + checkChangeBuffer: 400, + ...ConfigUtils.append({ + plugins: [ + Config(BindValidationStatePlugin, { + bindTo: config.errorMessagesVE, + propertyName: RedirectImpl.TARGET_URL, + }), + Config(BindPropertyPlugin, { + bidirectional: true, + bindTo: config.targetUrlVE, + }), + ], + }), + }), + Config(IconButton, { + iconCls: CoreIcons_properties.help, + tooltip: RedirectManagerStudioPlugin_properties.redirectmanager_editor_help_tooltip, + handler: bind(this, this.showInfoDialog), + }), + ], + layout: Config(HBoxLayout), + + }), config))()); + } + + showInfoDialog(): void { + MessageBoxUtil.showInfo( + RedirectManagerStudioPlugin_properties.redirectmanager_editor_help_targetUrl_title, + RedirectManagerStudioPlugin_properties.redirectmanager_editor_help_targetUrl_text, + Ext.emptyFn, + false, + ); + } +} + +export default RedirectTargetUrlFieldContainer; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/IdenticalRedirectsGrid.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/IdenticalRedirectsGrid.ts new file mode 100644 index 0000000..bc97ee9 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/IdenticalRedirectsGrid.ts @@ -0,0 +1,49 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import RedirectManagerStudioPlugin_properties from "../../bundles/RedirectManagerStudioPlugin_properties"; +import RedirectImpl from "../../data/RedirectImpl"; +import IdenticalRedirectsGridBase from "./IdenticalRedirectsGridBase"; +import RedirectParametersColumn from "./columns/RedirectParametersColumn"; +import RedirectStatusColumn from "./columns/RedirectStatusColumn"; +import RedirectTargetColumn from "./columns/RedirectTargetColumn"; + +interface IdenticalRedirectsGridConfig extends Config { +} + +class IdenticalRedirectsGrid extends IdenticalRedirectsGridBase { + declare Config: IdenticalRedirectsGridConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.grid.identicalRedirectsGrid"; + + constructor(config: Config = null) { + super(ConfigUtils.apply(Config(IdenticalRedirectsGrid, { + + columns: [ + Config(RedirectStatusColumn), + Config(RedirectTargetColumn), + Config(RedirectParametersColumn, { + header: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_sourceParameters, + dataIndex: RedirectImpl.SOURCE_PARAMETERS, + }), + ], + + }), config)); + } +} + +export default IdenticalRedirectsGrid; diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/grid/IdenticalRedirectsGridBase.as b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/IdenticalRedirectsGridBase.ts similarity index 64% rename from core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/grid/IdenticalRedirectsGridBase.as rename to apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/IdenticalRedirectsGridBase.ts index 453da93..df0ca6a 100644 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/grid/IdenticalRedirectsGridBase.as +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/IdenticalRedirectsGridBase.ts @@ -14,22 +14,24 @@ * limitations under the License. */ -package com.tallence.core.redirects.studio.editor.grid { -import com.coremedia.cms.editor.sdk.editorContext; +import Config from "@jangaroo/runtime/Config"; +import IdenticalRedirectsGrid from "./IdenticalRedirectsGrid"; +import RedirectsGrid from "./RedirectsGrid"; -use namespace editorContext; +interface IdenticalRedirectsGridBaseConfig extends Config { +} /** * Pageable grid component for redirects. Redirects can be filtered by source. * Redirects are edited or deleted via the context menu or can be edited with a double-click. */ -[ResourceBundle('com.tallence.core.redirects.studio.bundles.RedirectManagerStudioPlugin')] -[ResourceBundle('com.coremedia.cms.editor.Editor')] -public class IdenticalRedirectsGridBase extends RedirectsGrid { +class IdenticalRedirectsGridBase extends RedirectsGrid { + declare Config: IdenticalRedirectsGridBaseConfig; - public function IdenticalRedirectsGridBase(config:IdenticalRedirectsGrid = null) { + constructor(config: Config = null) { super(config); } } -} + +export default IdenticalRedirectsGridBase; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/RedirectProxy.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/RedirectProxy.ts new file mode 100644 index 0000000..47ddd2e --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/RedirectProxy.ts @@ -0,0 +1,112 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import BeanRecord from "@coremedia/studio-client.ext.ui-components/store/BeanRecord"; +import IPromise from "@jangaroo/ext-ts/IPromise"; +import Promise from "@jangaroo/ext-ts/Promise"; +import ResultSet from "@jangaroo/ext-ts/data/ResultSet"; +import Operation from "@jangaroo/ext-ts/data/operation/Operation"; +import ReadOperation from "@jangaroo/ext-ts/data/operation/Read"; +import DataProxy from "@jangaroo/ext-ts/data/proxy/Proxy"; +import { as, bind } from "@jangaroo/runtime"; +import Redirect from "../../data/Redirect"; +import RedirectImpl from "../../data/RedirectImpl"; +import RedirectsResponse from "../../data/RedirectsResponse"; +import RedirectsUtil from "../../util/RedirectsUtil"; + +/** + * A proxy for a Store to load redirects asynchronously. + */ +class RedirectProxy extends DataProxy { + + #selectedSiteVE: ValueExpression = null; + + #searchFieldVE: ValueExpression = null; + + #selectedRedirect: Redirect = null; + + #exactMatch: boolean = false; + + /** + * Creates a RedirectsProxy + * + * @param selectedSiteVE ValueExpression holding the selected site id + * @param searchFieldVE ValueExpression holding the search text + * @param selectedRedirect the selected redirect to be excluded in the grid if the grid is to be used in the edit window + * @param exactMatch true if the path of the redirect for the search should match exactly + */ + constructor(selectedSiteVE: ValueExpression, searchFieldVE: ValueExpression, selectedRedirect: Redirect, exactMatch: boolean) { + super(); + this.#selectedSiteVE = selectedSiteVE; + this.#searchFieldVE = searchFieldVE; + this.#selectedRedirect = selectedRedirect; + this.#exactMatch = exactMatch; + } + + /** + * The method is called by the redirects grid as soon as the search input changes, the selected page changes or the + * refresh button of the table is clicked. + * + * @param operation the read operation of the grid. + */ + override read(operation: Operation): void { + this.loadRedirects(as(operation, ReadOperation)) + .then(bind(this, this.#createResultSet)) + .then((resultSet: ResultSet): void => { + operation.setResultSet(resultSet); + operation.setSuccessful(true); + }); + } + + /** + * Converts the loaded {@link RedirectsResponse} into a {@link ResultSet}. The {@link ResultSet} is then used by the + * grid to update the grid store and the pageable /searchable toolbar. + * + * @param redirectsResponse the loaded response. + * @return The promise. Resolve method signature: function(response:ResultSet):void + */ + #createResultSet(redirectsResponse: RedirectsResponse): IPromise { + const recordType = BeanRecord.create(RedirectImpl.REDIRECT_PROPERTIES, false); + + const beanRecords = []; + redirectsResponse.getRedirects().forEach((redirect: Redirect): void => { + if (!this.#selectedRedirect || this.#selectedRedirect.getId() != redirect.getId()) { + beanRecords.push(new recordType({ bean: redirect })); + } + }); + + const resultSet = new ResultSet(); + resultSet.setRecords(beanRecords); + resultSet.setTotal(redirectsResponse.getTotal()); + return Promise.resolve(resultSet); + } + + /** + * Loads all redirects for the given read operation. + * @param operation the read operation. + * + * @return The promise. Resolve method signature: function(response:RedirectsResponse):void + */ + protected loadRedirects(operation: ReadOperation): IPromise { + const siteId: string = this.#selectedSiteVE.getValue(); + const searchText: string = this.#searchFieldVE.getValue(); + return RedirectsUtil.getRedirects(siteId, searchText, operation, this.#exactMatch); + } + +} + +export default RedirectProxy; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/RedirectsGrid.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/RedirectsGrid.ts new file mode 100644 index 0000000..3abb360 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/RedirectsGrid.ts @@ -0,0 +1,108 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import TableView from "@jangaroo/ext-ts/view/Table"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import RedirectManagerStudioPlugin_properties from "../../bundles/RedirectManagerStudioPlugin_properties"; +import Redirect from "../../data/Redirect"; +import RedirectsGridBase from "./RedirectsGridBase"; + +interface RedirectsGridConfig extends Config, Partial> { +} + +class RedirectsGrid extends RedirectsGridBase { + declare Config: RedirectsGridConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.grid.redirectsGrid"; + + #selectedSiteIdVE: ValueExpression = null; + + get selectedSiteIdVE(): ValueExpression { + return this.#selectedSiteIdVE; + } + + set selectedSiteIdVE(value: ValueExpression) { + this.#selectedSiteIdVE = value; + } + + #searchFieldVE: ValueExpression = null; + + get searchFieldVE(): ValueExpression { + return this.#searchFieldVE; + } + + set searchFieldVE(value: ValueExpression) { + this.#searchFieldVE = value; + } + + #selectedRedirect: Redirect = null; + + get selectedRedirect(): Redirect { + return this.#selectedRedirect; + } + + set selectedRedirect(value: Redirect) { + this.#selectedRedirect = value; + } + + #exactMatch: boolean = false; + + get exactMatch(): boolean { + return this.#exactMatch; + } + + set exactMatch(value: boolean) { + this.#exactMatch = value; + } + + /** + * The base class for the grid used in two different places. The {@link RedirectsOverviewGrid} is used in the + * overview and shows all redirects. The redirects are filtered by two filters (site and search). These two values + * can be passed as variables. + * + * The {@link IdenticalRedirectsGrid} grid is used within the edit panel and shows redirects to the same source url. + * Here the value expression for the site and the search is passed directly and can not be edited by the user. + */ + constructor(config: Config = null) { + super((()=> ConfigUtils.apply(Config(RedirectsGrid, { + enableColumnHide: false, + enableColumnMove: false, + margin: "10 10 10 10", + height: 10, + store: this.getRedirectsStore(config), + forceFit: true, + draggable: false, + viewConfig: Config(TableView, { + stripeRows: true, + trackOver: true, + loadMask: true, + deferEmptyText: false, + minHeight: 25, + loadingText: RedirectManagerStudioPlugin_properties.redirectmanager_editor_list_loading, + emptyText: ConfigUtils.asString(config.emptyText ? config.emptyText : RedirectManagerStudioPlugin_properties.redirectmanager_editor_list_nothing_found), + }), + + }), config))()); + } +} + +export default RedirectsGrid; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/RedirectsGridBase.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/RedirectsGridBase.ts new file mode 100644 index 0000000..3ab4b02 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/RedirectsGridBase.ts @@ -0,0 +1,106 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import ValueExpressionFactory from "@coremedia/studio-client.client-core/data/ValueExpressionFactory"; +import Store from "@jangaroo/ext-ts/data/Store"; +import GridPanel from "@jangaroo/ext-ts/grid/Panel"; +import { bind } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import RedirectImpl from "../../data/RedirectImpl"; +import RedirectProxy from "./RedirectProxy"; +import RedirectsGrid from "./RedirectsGrid"; + +interface RedirectsGridBaseConfig extends Config { +} + +/** + * Pageable grid component for redirects. Redirects can be filtered by source. + * Redirects are edited or deleted via the context menu or can be edited with a double-click. + */ +class RedirectsGridBase extends GridPanel { + declare Config: RedirectsGridBaseConfig; + + #selectedSiteVE: ValueExpression = null; + + #searchFieldVE: ValueExpression = null; + + constructor(config: Config = null) { + super(config); + } + + /** + * Returns the ValueExpression that stores the currently selected site. The value is used to filter the redirects. If + * the value changes, the actual selected page must be reset to 1. + * @return ValueExpression + */ + protected getSelectedSiteVE(config: Config): ValueExpression { + if (!this.#selectedSiteVE) { + this.#selectedSiteVE = config.selectedSiteIdVE; + this.#selectedSiteVE.addChangeListener(bind(this, this.resetPage)); + } + return this.#selectedSiteVE; + } + + /** + * Creates a ValueExpression that stores the source url filter text. The value is used to filter the redirects. If + * the value changes, the actual selected page must be reset to 1. + * @return ValueExpression + */ + protected getSearchFieldVE(config: Config): ValueExpression { + if (!this.#searchFieldVE) { + this.#searchFieldVE = config.searchFieldVE ? config.searchFieldVE : ValueExpressionFactory.createFromValue(""); + this.#searchFieldVE.addChangeListener(bind(this, this.resetPage)); + } + return this.#searchFieldVE; + } + + /** + * Creates a store with a custom proxy to use the {@link com.tallence.core.redirects.studio.data.Redirects } + * to load the redirects. + * @return Store + */ + protected getRedirectsStore(config: Config): Store { + const exactMatch: boolean = config.exactMatch != undefined ? config.exactMatch : false; + const proxy = new RedirectProxy(this.getSelectedSiteVE(config), this.getSearchFieldVE(config), config.selectedRedirect, exactMatch); + + const store = new Store(Config(Store, { + pageSize: 20, + sorters: [ + { + property: RedirectImpl.SOURCE, + direction: "ASC", + }, + ], + remoteSort: true, + proxy: proxy, + })); + store.load(); + return store; + } + + protected resetPage(): void { + this.getStore().loadPage(1); + } + + protected override onDestroy(): void { + if (this.#selectedSiteVE) this.#selectedSiteVE.removeChangeListener(bind(this, this.resetPage)); + if (this.#searchFieldVE) this.#searchFieldVE.removeChangeListener(bind(this, this.resetPage)); + super.onDestroy(); + } +} + +export default RedirectsGridBase; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/RedirectsOverviewGrid.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/RedirectsOverviewGrid.ts new file mode 100644 index 0000000..b89c63c --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/RedirectsOverviewGrid.ts @@ -0,0 +1,230 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import CoreIcons_properties from "@coremedia/studio-client.core-icons/CoreIcons_properties"; +import LocalComboBox from "@coremedia/studio-client.ext.ui-components/components/LocalComboBox"; +import BindListPlugin from "@coremedia/studio-client.ext.ui-components/plugins/BindListPlugin"; +import BindPropertyPlugin from "@coremedia/studio-client.ext.ui-components/plugins/BindPropertyPlugin"; +import ContextMenuPlugin from "@coremedia/studio-client.ext.ui-components/plugins/ContextMenuPlugin"; +import ToolbarSkin from "@coremedia/studio-client.ext.ui-components/skins/ToolbarSkin"; +import DataField from "@coremedia/studio-client.ext.ui-components/store/DataField"; +import Editor_properties from "@coremedia/studio-client.main.editor-components/Editor_properties"; +import TextField from "@jangaroo/ext-ts/form/field/Text"; +import Item from "@jangaroo/ext-ts/menu/Item"; +import Menu from "@jangaroo/ext-ts/menu/Menu"; +import Separator from "@jangaroo/ext-ts/menu/Separator"; +import PagingToolbar from "@jangaroo/ext-ts/toolbar/Paging"; +import Toolbar from "@jangaroo/ext-ts/toolbar/Toolbar"; +import { bind } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import RedirectManagerStudioPlugin_properties from "../../bundles/RedirectManagerStudioPlugin_properties"; +import RedirectImpl from "../../data/RedirectImpl"; +import RedirectsOverviewGridBase from "./RedirectsOverviewGridBase"; +import RedirectCreationDateColumn from "./columns/RedirectCreationDateColumn"; +import RedirectParametersColumn from "./columns/RedirectParametersColumn"; +import RedirectSourceColumn from "./columns/RedirectSourceColumn"; +import RedirectStatusColumn from "./columns/RedirectStatusColumn"; +import RedirectTargetColumn from "./columns/RedirectTargetColumn"; +import RedirectTypeColumn from "./columns/RedirectTypeColumn"; + +interface RedirectsOverviewGridConfig extends Config, Partial> { +} + +class RedirectsOverviewGrid extends RedirectsOverviewGridBase { + declare Config: RedirectsOverviewGridConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.grid.redirectsOverviewGrid"; + + #mayNotWriteVE: ValueExpression = null; + + get mayNotWriteVE(): ValueExpression { + return this.#mayNotWriteVE; + } + + set mayNotWriteVE(value: ValueExpression) { + this.#mayNotWriteVE = value; + } + + #mayNotPublishVE: ValueExpression = null; + + get mayNotPublishVE(): ValueExpression { + return this.#mayNotPublishVE; + } + + set mayNotPublishVE(value: ValueExpression) { + this.#mayNotPublishVE = value; + } + + #mayNotUseRegexVE: ValueExpression = null; + + get mayNotUseRegexVE(): ValueExpression { + return this.#mayNotUseRegexVE; + } + + set mayNotUseRegexVE(value: ValueExpression) { + this.#mayNotUseRegexVE = value; + } + + #mayNotUseTargetUrlsVE: ValueExpression = null; + + get mayNotUseTargetUrlsVE(): ValueExpression { + return this.#mayNotUseTargetUrlsVE; + } + + set mayNotUseTargetUrlsVE(value: ValueExpression) { + this.#mayNotUseTargetUrlsVE = value; + } + + #siteIsNotSelectedVE: ValueExpression = null; + + get siteIsNotSelectedVE(): ValueExpression { + return this.#siteIsNotSelectedVE; + } + + set siteIsNotSelectedVE(value: ValueExpression) { + this.#siteIsNotSelectedVE = value; + } + + constructor(config: Config = null) { + super((()=> ConfigUtils.apply(Config(RedirectsOverviewGrid, { + dockedItems: [ + Config(Toolbar, { + ui: ToolbarSkin.HEADER_GRID_100.getSkin(), + items: [ + Config(TextField, { + labelAlign: "left", + width: 300, + checkChangeBuffer: 1000, + fieldLabel: RedirectManagerStudioPlugin_properties.redirectmanager_editor_grid_search_label, + emptyText: RedirectManagerStudioPlugin_properties.redirectmanager_editor_grid_search_empty_text, + plugins: [ + Config(BindPropertyPlugin, { + bindTo: this.getSearchFieldVE(config), + bidirectional: true, + }), + Config(BindPropertyPlugin, { + componentProperty: "disabled", + bindTo: config.siteIsNotSelectedVE, + }), + ], + }), + Config(LocalComboBox, { + width: 400, + labelWidth: 180, + fieldLabel: RedirectManagerStudioPlugin_properties.redirectmanager_editor_grid_site_selector_label, + valueField: "id", + displayField: "name", + anyMatch: true, + valueNotFoundText: Editor_properties.HeaderToolbar_siteSelector_none_text, + emptyText: Editor_properties.HeaderToolbar_siteSelector_empty_text, + editable: false, + encodeItems: true, + plugins: [ + Config(BindListPlugin, { + sortField: "name", + bindTo: this.getSitesStoreVE(), + fields: [ + Config(DataField, { + name: "id", + encode: false, + }), + Config(DataField, { + name: "name", + encode: false, + sortType: "asUCString", + }), + ], + }), + Config(BindPropertyPlugin, { + bidirectional: true, + bindTo: this.getSelectedSiteVE(config), + }), + ], + }), + ], + }), + Config(PagingToolbar, { id: RedirectsOverviewGridBase.TOOLBAR_ID }), + ], + ...ConfigUtils.prepend({ + plugins: [ + Config(ContextMenuPlugin, { + contextMenu: Config(Menu, { + items: [ + Config(Item, { + iconCls: CoreIcons_properties.pencil, + text: RedirectManagerStudioPlugin_properties.redirectmanager_editor_grid_redirect_edit_label, + handler: bind(this, this.openEditWindow), + ...ConfigUtils.append({ + plugins: [ + Config(BindPropertyPlugin, { + componentProperty: "disabled", + bindTo: config.mayNotWriteVE, + }), + ], + }), + }), + Config(Item, { + iconCls: CoreIcons_properties.trash_bin, + text: RedirectManagerStudioPlugin_properties.redirectmanager_editor_grid_redirect_delete_label, + handler: bind(this, this.deleteRedirect), + ...ConfigUtils.append({ + plugins: [ + Config(BindPropertyPlugin, { + componentProperty: "disabled", + bindTo: config.mayNotWriteVE, + }), + ], + }), + }), + Config(Separator), + Config(Item, { + iconCls: CoreIcons_properties.type_object, + text: RedirectManagerStudioPlugin_properties.redirectmanager_editor_grid_redirect_open_label, + handler: bind(this, this.openRedirectTarget), + }), + ], + }), + }), + ], + }), + columns: [ + Config(RedirectStatusColumn), + Config(RedirectSourceColumn), + Config(RedirectTargetColumn), + Config(RedirectCreationDateColumn), + Config(RedirectTypeColumn), + Config(RedirectParametersColumn, { + header: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_sourceParameters, + dataIndex: RedirectImpl.SOURCE_PARAMETERS, + }), + Config(RedirectParametersColumn, { + header: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_targetParameters, + dataIndex: RedirectImpl.TARGET_PARAMETERS, + }), + ], + + }), config))()); + } +} + +export default RedirectsOverviewGrid; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/RedirectsOverviewGridBase.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/RedirectsOverviewGridBase.ts new file mode 100644 index 0000000..dc96970 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/RedirectsOverviewGridBase.ts @@ -0,0 +1,121 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import ValueExpressionFactory from "@coremedia/studio-client.client-core/data/ValueExpressionFactory"; +import EncodingUtil from "@coremedia/studio-client.client-core/util/EncodingUtil"; +import BeanRecord from "@coremedia/studio-client.ext.ui-components/store/BeanRecord"; +import Editor_properties from "@coremedia/studio-client.main.editor-components/Editor_properties"; +import editorContext from "@coremedia/studio-client.main.editor-components/sdk/editorContext"; +import Site from "@coremedia/studio-client.multi-site-models/Site"; +import RowSelectionModel from "@jangaroo/ext-ts/selection/RowModel"; +import Format from "@jangaroo/ext-ts/util/Format"; +import { as, bind } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import RedirectManagerStudioPlugin_properties from "../../bundles/RedirectManagerStudioPlugin_properties"; +import Redirect from "../../data/Redirect"; +import RedirectEditWindow from "../form/RedirectEditWindow"; +import RedirectsGrid from "./RedirectsGrid"; +import RedirectsOverviewGrid from "./RedirectsOverviewGrid"; + +interface RedirectsOverviewGridBaseConfig extends Config { +} + +/** + * Pageable grid component for redirects. Redirects can be filtered by source. + * Redirects are edited or deleted via the context menu or can be edited with a double-click. + */ +class RedirectsOverviewGridBase extends RedirectsGrid { + declare Config: RedirectsOverviewGridBaseConfig; + + protected static readonly TOOLBAR_ID: string = "pagingToolbar"; + + #mayNotUseRegexVE: ValueExpression = null; + + #mayNotUseTargetUrlsVE: ValueExpression = null; + + #mayNotPublishVE: ValueExpression = null; + + constructor(config: Config = null) { + super(config); + this.addListener("rowdblclick", bind(this, this.openEditWindow)); + + this.#mayNotUseRegexVE = config.mayNotUseRegexVE; + this.#mayNotUseTargetUrlsVE = config.mayNotUseTargetUrlsVE; + this.#mayNotPublishVE = config.mayNotPublishVE; + } + + /** + * Creates a ValueExpression with an array of all registered sites. + * @return + */ + protected getSitesStoreVE(): ValueExpression { + return ValueExpressionFactory.createFromFunction((): Array => { + const sitesStore = []; + const sites = editorContext._.getSitesService().getSites(); + if (sites) { + for (let i = 0; i < sites.length; i++) { + const site: Site = sites[i]; + const pattern = Editor_properties.HeaderToolbar_siteSelector_displayName_pattern; + const calculatedSiteName = Format.format(pattern, + EncodingUtil.encodeForHTML(site.getName()), + site.getLocale().getLanguageTag(), + site.getLocale().getDisplayName()); + sitesStore.push({ + id: site.getId(), + name: calculatedSiteName, + }); + } + } + return sitesStore; + }); + } + + protected openEditWindow(): void { + const window = new RedirectEditWindow(Config(RedirectEditWindow, { + title: RedirectManagerStudioPlugin_properties.redirectmanager_editor_edit_text, + redirect: this.#getSelectedRedirect(), + mayNotPublishVE: this.#mayNotPublishVE, + mayNotUseRegexVE: this.#mayNotUseRegexVE, + mayNotUseTargetUrlsVE: this.#mayNotUseTargetUrlsVE, + selectedSiteIdVE: this.selectedSiteIdVE, + })); + window.show(); + } + + protected deleteRedirect(): void { + this.#getSelectedRedirect().deleteMe(bind(this, this.resetPage)); + } + + protected openRedirectTarget(): void { + const targetLink = this.#getSelectedRedirect().getTargetLink(); + editorContext._.getContentTabManager().openDocument(targetLink); + } + + /** + * Returns the selected redirect. The selection model always consists of one element, + * because multiple selection is disabled. + * @return Redirect + */ + #getSelectedRedirect(): Redirect { + const selections: Array = as(this.getSelectionModel(), RowSelectionModel).getSelection(); + const selection: BeanRecord = selections && selections.length > 0 && selections[0]; + return selection ? as(selection.getBean(), Redirect) : null; + } + +} + +export default RedirectsOverviewGridBase; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectCreationDateColumn.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectCreationDateColumn.ts new file mode 100644 index 0000000..199514e --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectCreationDateColumn.ts @@ -0,0 +1,41 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import RedirectManagerStudioPlugin_properties from "../../../bundles/RedirectManagerStudioPlugin_properties"; +import RedirectImpl from "../../../data/RedirectImpl"; +import RedirectCreationDateColumnBase from "./RedirectCreationDateColumnBase"; + +interface RedirectCreationDateColumnConfig extends Config { +} + +class RedirectCreationDateColumn extends RedirectCreationDateColumnBase { + declare Config: RedirectCreationDateColumnConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.grid.redirectCreationDateColumn"; + + constructor(config: Config = null) { + super(ConfigUtils.apply(Config(RedirectCreationDateColumn, { + header: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_creationDate, + renderer: RedirectCreationDateColumnBase.creationDateColRenderer, + dataIndex: RedirectImpl.CREATION_DATE, + width: 30, + sortable: true, + }), config)); + } +} + +export default RedirectCreationDateColumn; diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/grid/columns/RedirectCreationDateColumnBase.as b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectCreationDateColumnBase.ts similarity index 54% rename from core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/grid/columns/RedirectCreationDateColumnBase.as rename to apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectCreationDateColumnBase.ts index 09e3a9a..19c24ee 100644 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/grid/columns/RedirectCreationDateColumnBase.as +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectCreationDateColumnBase.ts @@ -14,23 +14,23 @@ * limitations under the License. */ -package com.tallence.core.redirects.studio.editor.grid.columns { -import com.coremedia.cms.editor.sdk.editorContext; +import DateUtil from "@jangaroo/ext-ts/Date"; +import Column from "@jangaroo/ext-ts/grid/column/Column"; +import Config from "@jangaroo/runtime/Config"; +import RedirectCreationDateColumn from "./RedirectCreationDateColumn"; -import ext.DateUtil; -import ext.grid.column.Column; - -use namespace editorContext; +interface RedirectCreationDateColumnBaseConfig extends Config { +} -[ResourceBundle('com.coremedia.icons.CoreIcons')] -public class RedirectCreationDateColumnBase extends Column { +class RedirectCreationDateColumnBase extends Column { + declare Config: RedirectCreationDateColumnBaseConfig; - public function RedirectCreationDateColumnBase(config:RedirectCreationDateColumn = null) { + constructor(config: Config = null) { super(config); } - protected static function creationDateColRenderer(value:Date):String { - var date:String = ''; + protected static creationDateColRenderer(value: Date): string { + let date = ""; if (value) { date = DateUtil.format(value, "d.m.Y"); } @@ -38,4 +38,5 @@ public class RedirectCreationDateColumnBase extends Column { } } -} \ No newline at end of file + +export default RedirectCreationDateColumnBase; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectParametersColumn.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectParametersColumn.ts new file mode 100644 index 0000000..1c54739 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectParametersColumn.ts @@ -0,0 +1,37 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { bind } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import RedirectParametersColumnBase from "./RedirectParametersColumnBase"; + +interface RedirectParametersColumnConfig extends Config { +} + +class RedirectParametersColumn extends RedirectParametersColumnBase { + declare Config: RedirectParametersColumnConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.grid.redirectParametersColumn"; + + constructor(config: Config = null) { + super((()=> ConfigUtils.apply(Config(RedirectParametersColumn, { + renderer: bind(this, this.typeColRenderer), + width: 100, + }), config))()); + } +} + +export default RedirectParametersColumn; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectParametersColumnBase.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectParametersColumnBase.ts new file mode 100644 index 0000000..bd1e39f --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectParametersColumnBase.ts @@ -0,0 +1,44 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Column from "@jangaroo/ext-ts/grid/column/Column"; +import Config from "@jangaroo/runtime/Config"; +import RedirectTargetParameter from "../../../data/RedirectTargetParameter"; +import RedirectParametersColumn from "./RedirectParametersColumn"; + +interface RedirectParametersColumnBaseConfig extends Config { +} + +class RedirectParametersColumnBase extends Column { + declare Config: RedirectParametersColumnBaseConfig; + + constructor(config: Config = null) { + super(config); + } + + protected typeColRenderer(parameters: Array): string { + let value: string = parameters && parameters.length > 0 ? "?" : ""; + + value = value + parameters.map((parameter: RedirectTargetParameter): string => + parameter.getName() + "=" + parameter.getValue(), + ).join("&"); + + return value; + } + +} + +export default RedirectParametersColumnBase; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectSourceColumn.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectSourceColumn.ts new file mode 100644 index 0000000..6598fc0 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectSourceColumn.ts @@ -0,0 +1,40 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Column from "@jangaroo/ext-ts/grid/column/Column"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import RedirectManagerStudioPlugin_properties from "../../../bundles/RedirectManagerStudioPlugin_properties"; +import RedirectImpl from "../../../data/RedirectImpl"; + +interface RedirectSourceColumnConfig extends Config { +} + +class RedirectSourceColumn extends Column { + declare Config: RedirectSourceColumnConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.grid.redirectSourceColumn"; + + constructor(config: Config = null) { + super(ConfigUtils.apply(Config(RedirectSourceColumn, { + header: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_source, + width: 100, + sortable: true, + dataIndex: RedirectImpl.SOURCE, + }), config)); + } +} + +export default RedirectSourceColumn; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectStatusColumn.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectStatusColumn.ts new file mode 100644 index 0000000..b3078b7 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectStatusColumn.ts @@ -0,0 +1,39 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import RedirectManagerStudioPlugin_properties from "../../../bundles/RedirectManagerStudioPlugin_properties"; +import RedirectStatusColumnBase from "./RedirectStatusColumnBase"; + +interface RedirectStatusColumnConfig extends Config { +} + +class RedirectStatusColumn extends RedirectStatusColumnBase { + declare Config: RedirectStatusColumnConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.grid.redirectStatusColumn"; + + constructor(config: Config = null) { + super(ConfigUtils.apply(Config(RedirectStatusColumn, { + header: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_active, + width: 80, + sortable: false, + dataIndex: "active", + }), config)); + } +} + +export default RedirectStatusColumn; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectStatusColumnBase.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectStatusColumnBase.ts new file mode 100644 index 0000000..0ef86b6 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectStatusColumnBase.ts @@ -0,0 +1,47 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import CoreIcons_properties from "@coremedia/studio-client.core-icons/CoreIcons_properties"; +import IconColumn from "@coremedia/studio-client.ext.ui-components/grid/column/IconColumn"; +import BeanRecord from "@coremedia/studio-client.ext.ui-components/store/BeanRecord"; +import Model from "@jangaroo/ext-ts/data/Model"; +import Store from "@jangaroo/ext-ts/data/Store"; +import { as } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import Redirect from "../../../data/Redirect"; +import RedirectStatusColumn from "./RedirectStatusColumn"; + +interface RedirectStatusColumnBaseConfig extends Config { +} + +class RedirectStatusColumnBase extends IconColumn { + declare Config: RedirectStatusColumnBaseConfig; + + constructor(config: Config = null) { + super(config); + } + + protected override calculateIconCls(value: any, metadata: any, record: Model, rowIndex: number, colIndex: number, store: Store): string { + const redirect = as(as(record, BeanRecord).getBean(), Redirect); + if (redirect.isActive()) { + return CoreIcons_properties.checkbox_checked; + } + return CoreIcons_properties.checkbox_unchecked; + } + +} + +export default RedirectStatusColumnBase; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectTargetColumn.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectTargetColumn.ts new file mode 100644 index 0000000..e3baa27 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectTargetColumn.ts @@ -0,0 +1,40 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Column from "@jangaroo/ext-ts/grid/column/Column"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import RedirectManagerStudioPlugin_properties from "../../../bundles/RedirectManagerStudioPlugin_properties"; +import RedirectImpl from "../../../data/RedirectImpl"; + +interface RedirectTargetColumnConfig extends Config { +} + +class RedirectTargetColumn extends Column { + declare Config: RedirectTargetColumnConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.grid.redirectTargetColumn"; + + constructor(config: Config = null) { + super(ConfigUtils.apply(Config(RedirectTargetColumn, { + header: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_target, + sortable: false, + width: 100, + dataIndex: RedirectImpl.TARGET_LINK_NAME, + }), config)); + } +} + +export default RedirectTargetColumn; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectTypeColumn.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectTypeColumn.ts new file mode 100644 index 0000000..2e7118f --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectTypeColumn.ts @@ -0,0 +1,42 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { bind } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import RedirectManagerStudioPlugin_properties from "../../../bundles/RedirectManagerStudioPlugin_properties"; +import RedirectImpl from "../../../data/RedirectImpl"; +import RedirectTypeColumnBase from "./RedirectTypeColumnBase"; + +interface RedirectTypeColumnConfig extends Config { +} + +class RedirectTypeColumn extends RedirectTypeColumnBase { + declare Config: RedirectTypeColumnConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.grid.redirectTypeColumn"; + + constructor(config: Config = null) { + super((()=> ConfigUtils.apply(Config(RedirectTypeColumn, { + header: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_type, + renderer: bind(this, this.typeColRenderer), + dataIndex: RedirectImpl.REDIRECT_TYPE, + width: 100, + sortable: false, + }), config))()); + } +} + +export default RedirectTypeColumn; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectTypeColumnBase.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectTypeColumnBase.ts new file mode 100644 index 0000000..5030f2b --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/grid/columns/RedirectTypeColumnBase.ts @@ -0,0 +1,45 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Column from "@jangaroo/ext-ts/grid/column/Column"; +import Config from "@jangaroo/runtime/Config"; +import RedirectManagerStudioPlugin_properties from "../../../bundles/RedirectManagerStudioPlugin_properties"; +import RedirectImpl from "../../../data/RedirectImpl"; +import RedirectTypeColumn from "./RedirectTypeColumn"; + +interface RedirectTypeColumnBaseConfig extends Config { +} + +class RedirectTypeColumnBase extends Column { + declare Config: RedirectTypeColumnBaseConfig; + + constructor(config: Config = null) { + super(config); + } + + protected typeColRenderer(value: string): string { + if (value.toUpperCase() === RedirectImpl.REDIRECT_TYPE_ALWAYS) { + return RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_type_value_0; + } else if (value.toUpperCase() === RedirectImpl.REDIRECT_TYPE_404) { + return RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_type_value_1; + } else { + return RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_type_invalid; + } + } + +} + +export default RedirectTypeColumnBase; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/parameters/RedirectParametersGrid.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/parameters/RedirectParametersGrid.ts new file mode 100644 index 0000000..8f417cc --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/parameters/RedirectParametersGrid.ts @@ -0,0 +1,134 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import CoreIcons_properties from "@coremedia/studio-client.core-icons/CoreIcons_properties"; +import IconButton from "@coremedia/studio-client.ext.ui-components/components/IconButton"; +import BindListPlugin from "@coremedia/studio-client.ext.ui-components/plugins/BindListPlugin"; +import BindPropertyPlugin from "@coremedia/studio-client.ext.ui-components/plugins/BindPropertyPlugin"; +import BindSelectionPlugin from "@coremedia/studio-client.ext.ui-components/plugins/BindSelectionPlugin"; +import CellEditPlugin from "@coremedia/studio-client.ext.ui-components/plugins/CellEditPlugin"; +import DataField from "@coremedia/studio-client.ext.ui-components/store/DataField"; +import TextField from "@jangaroo/ext-ts/form/field/Text"; +import Column from "@jangaroo/ext-ts/grid/column/Column"; +import FitLayout from "@jangaroo/ext-ts/layout/container/Fit"; +import RowSelectionModel from "@jangaroo/ext-ts/selection/RowModel"; +import Separator from "@jangaroo/ext-ts/toolbar/Separator"; +import Toolbar from "@jangaroo/ext-ts/toolbar/Toolbar"; +import { bind } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import { AnyFunction } from "@jangaroo/runtime/types"; +import RedirectManagerStudioPlugin_properties from "../../bundles/RedirectManagerStudioPlugin_properties"; +import RedirectSourceParameter from "../../data/RedirectSourceParameter"; +import RedirectTargetParameter from "../../data/RedirectTargetParameter"; +import RedirectParamtersGridBase from "./RedirectParamtersGridBase"; + +interface RedirectParametersGridConfig extends Config, Partial> { +} + +class RedirectParametersGrid extends RedirectParamtersGridBase { + declare Config: RedirectParametersGridConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.parameters.redirectParametersGrid"; + + constructor(config: Config = null) { + super((()=> ConfigUtils.apply(Config(RedirectParametersGrid, { + maxHeight: 150, + minHeight: 25, + margin: "0 0 0 130", + width: "500px", + height: "100px", + + tbar: Config(Toolbar, { + items: [ + Config(IconButton, { + iconCls: CoreIcons_properties.remove, + disabled: true, + handler: bind(this, this.deleteRow), + plugins: [ + Config(BindPropertyPlugin, { + componentProperty: "disabled", + bindTo: this.getSelectedPositionsExpression(), + transformer: RedirectParamtersGridBase.isEmptySelection, + }), + ], + }), + Config(Separator), + Config(IconButton, { + iconCls: CoreIcons_properties.add, + handler: bind(this, this.addRow), + }), + ], + }), + + ...ConfigUtils.append({ + plugins: [ + Config(BindSelectionPlugin, { selectedPositions: this.getSelectedPositionsExpression() }), + Config(CellEditPlugin, { clicksToEdit: 2 }), + Config(BindListPlugin, { + bindTo: config.bindTo, + fields: [ + Config(DataField, { name: RedirectTargetParameter.NAME }), + Config(DataField, { name: RedirectTargetParameter.VALUE }), + Config(DataField, { name: RedirectSourceParameter.OPERATOR }), + ], + }), + ], + }), + columns: [ + Config(Column, { + header: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_parameterName, + dataIndex: RedirectTargetParameter.NAME, + editor: Config(TextField, { allowBlank: false }), + }), + Config(Column, { + header: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_parameterValue, + flex: 1, + dataIndex: RedirectTargetParameter.VALUE, + editor: Config(TextField, { allowBlank: false }), + }), + ], + layout: Config(FitLayout), + selModel: new RowSelectionModel({}), + + }), config))()); + } + + #errorMessagesVE: ValueExpression = null; + + get errorMessagesVE(): ValueExpression { + return this.#errorMessagesVE; + } + + set errorMessagesVE(value: ValueExpression) { + this.#errorMessagesVE = value; + } + + #validateRedirectHandler: AnyFunction = null; + + get validateRedirectHandler(): AnyFunction { + return this.#validateRedirectHandler; + } + + set validateRedirectHandler(value: AnyFunction) { + this.#validateRedirectHandler = value; + } +} + +export default RedirectParametersGrid; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/parameters/RedirectParamtersGridBase.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/parameters/RedirectParamtersGridBase.ts new file mode 100644 index 0000000..c17eb50 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/parameters/RedirectParamtersGridBase.ts @@ -0,0 +1,89 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import ValueExpressionFactory from "@coremedia/studio-client.client-core/data/ValueExpressionFactory"; +import GridPanel from "@jangaroo/ext-ts/grid/Panel"; +import Config from "@jangaroo/runtime/Config"; +import RedirectSourceParameter from "../../data/RedirectSourceParameter"; +import RedirectTargetParameter from "../../data/RedirectTargetParameter"; +import RedirectParametersGrid from "./RedirectParametersGrid"; + +interface RedirectParamtersGridBaseConfig extends Config, Partial> { +} + +class RedirectParamtersGridBase extends GridPanel { + declare Config: RedirectParamtersGridBaseConfig; + + #bindTo: ValueExpression = null; + + get bindTo(): ValueExpression { + return this.#bindTo; + } + + set bindTo(value: ValueExpression) { + this.#bindTo = value; + } + + #selectedPositionsExpression: ValueExpression = null; + + constructor(config: Config = null) { + super(config); + if (config.validateRedirectHandler) { + // If the data in the grid changes, a validation of the redirect must be triggered if the grid is used for the + // source parameters. This cannot be solved with a change listener in the edit window, since a change listener + // does not trigger when values change within an object of a list. + this.getStore().addListener("datachanged", config.validateRedirectHandler); + } + } + + protected static isEmptySelection(selection: Array): boolean { + return !selection || selection.length == 0; + } + + protected addRow(): void { + const init: Record = {}; + init[RedirectTargetParameter.NAME] = "parameter"; + init[RedirectTargetParameter.VALUE] = "value"; + init[RedirectSourceParameter.OPERATOR] = RedirectSourceParameter.OPERATOR_EQUALS; + const redirectParameterImpl = new RedirectSourceParameter(init); + const parameters = [].concat(this.bindTo.getValue()); + parameters.push(redirectParameterImpl); + this.bindTo.setValue(parameters); + } + + protected deleteRow(): void { + const selection: Array = this.getSelectedPositionsExpression().getValue(); + if (selection && selection.length > 0) { + const position: number = selection[0]; + const items = [].concat(this.bindTo.getValue()); + items.splice(position, 1); + this.bindTo.setValue(items); + } + } + + protected getSelectedPositionsExpression(): ValueExpression { + if (!this.#selectedPositionsExpression) { + this.#selectedPositionsExpression = ValueExpressionFactory.createFromValue([]); + } + return this.#selectedPositionsExpression; + } + +} + +export default RedirectParamtersGridBase; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectCsvHeaderDescriptionContainer.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectCsvHeaderDescriptionContainer.ts new file mode 100644 index 0000000..fad0ae8 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectCsvHeaderDescriptionContainer.ts @@ -0,0 +1,73 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import DisplayFieldSkin from "@coremedia/studio-client.ext.ui-components/skins/DisplayFieldSkin"; +import Container from "@jangaroo/ext-ts/container/Container"; +import DisplayField from "@jangaroo/ext-ts/form/field/Display"; +import HBoxLayout from "@jangaroo/ext-ts/layout/container/HBox"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; + +interface RedirectCsvHeaderDescriptionContainerConfig extends Config, Partial> { +} + +class RedirectCsvHeaderDescriptionContainer extends Container { + declare Config: RedirectCsvHeaderDescriptionContainerConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.upload.redirectCsvHeaderDescriptionContainer"; + + #title: string = null; + + get title(): string { + return this.#title; + } + + set title(value: string) { + this.#title = value; + } + + #text: string = null; + + get text(): string { + return this.#text; + } + + set text(value: string) { + this.#text = value; + } + + constructor(config: Config = null) { + super(ConfigUtils.apply(Config(RedirectCsvHeaderDescriptionContainer, { + items: [ + Config(DisplayField, { + value: config.title, + ui: DisplayFieldSkin.BOLD.getSkin(), + }), + Config(DisplayField, { + value: config.text, + margin: "0 0 0 10", + ui: DisplayFieldSkin.EMBEDDED.getSkin(), + }), + ], + layout: Config(HBoxLayout), + + }), config)); + } +} + +export default RedirectCsvHeaderDescriptionContainer; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectImportErrorMessageContainer.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectImportErrorMessageContainer.ts new file mode 100644 index 0000000..feb7029 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectImportErrorMessageContainer.ts @@ -0,0 +1,57 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import DisplayFieldSkin from "@coremedia/studio-client.ext.ui-components/skins/DisplayFieldSkin"; +import Container from "@jangaroo/ext-ts/container/Container"; +import DisplayField from "@jangaroo/ext-ts/form/field/Display"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import RedirectManagerStudioPlugin_properties from "../../bundles/RedirectManagerStudioPlugin_properties"; + +interface RedirectImportErrorMessageContainerConfig extends Config, Partial> { +} + +class RedirectImportErrorMessageContainer extends Container { + declare Config: RedirectImportErrorMessageContainerConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.upload.redirectImportErrorMessageContainer"; + + constructor(config: Config = null) { + super(ConfigUtils.apply(Config(RedirectImportErrorMessageContainer, { + items: [ + Config(DisplayField, { + value: config.errorMessage.csvEntry, + ui: DisplayFieldSkin.BOLD.getSkin(), + }), + Config(DisplayField, { value: RedirectManagerStudioPlugin_properties[("redirectmanager_editor_actions_csvupload_import_error_" + config.errorMessage.errorCode)] }), + ], + + }), config)); + } + + #errorMessage: any = null; + + get errorMessage(): any { + return this.#errorMessage; + } + + set errorMessage(value: any) { + this.#errorMessage = value; + } +} + +export default RedirectImportErrorMessageContainer; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectUploadProgressDialog.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectUploadProgressDialog.ts new file mode 100644 index 0000000..4757c6d --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectUploadProgressDialog.ts @@ -0,0 +1,183 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import SpacingBEMEntities from "@coremedia/studio-client.ext.ui-components/bem/SpacingBEMEntities"; +import BindComponentsPlugin from "@coremedia/studio-client.ext.ui-components/plugins/BindComponentsPlugin"; +import BindListPlugin from "@coremedia/studio-client.ext.ui-components/plugins/BindListPlugin"; +import BindPropertyPlugin from "@coremedia/studio-client.ext.ui-components/plugins/BindPropertyPlugin"; +import VerticalSpacingPlugin from "@coremedia/studio-client.ext.ui-components/plugins/VerticalSpacingPlugin"; +import ButtonSkin from "@coremedia/studio-client.ext.ui-components/skins/ButtonSkin"; +import DisplayFieldSkin from "@coremedia/studio-client.ext.ui-components/skins/DisplayFieldSkin"; +import WindowSkin from "@coremedia/studio-client.ext.ui-components/skins/WindowSkin"; +import DataField from "@coremedia/studio-client.ext.ui-components/store/DataField"; +import Editor_properties from "@coremedia/studio-client.main.editor-components/Editor_properties"; +import ProgressBar from "@jangaroo/ext-ts/ProgressBar"; +import Button from "@jangaroo/ext-ts/button/Button"; +import Container from "@jangaroo/ext-ts/container/Container"; +import DisplayField from "@jangaroo/ext-ts/form/field/Display"; +import GridPanel from "@jangaroo/ext-ts/grid/Panel"; +import VBoxLayout from "@jangaroo/ext-ts/layout/container/VBox"; +import Fill from "@jangaroo/ext-ts/toolbar/Fill"; +import Toolbar from "@jangaroo/ext-ts/toolbar/Toolbar"; +import TableView from "@jangaroo/ext-ts/view/Table"; +import { bind } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import RedirectManagerStudioPlugin_properties from "../../bundles/RedirectManagerStudioPlugin_properties"; +import RedirectImpl from "../../data/RedirectImpl"; +import RedirectParametersColumn from "../grid/columns/RedirectParametersColumn"; +import RedirectSourceColumn from "../grid/columns/RedirectSourceColumn"; +import RedirectStatusColumn from "../grid/columns/RedirectStatusColumn"; +import RedirectTargetColumn from "../grid/columns/RedirectTargetColumn"; +import RedirectTypeColumn from "../grid/columns/RedirectTypeColumn"; +import RedirectImportErrorMessageContainer from "./RedirectImportErrorMessageContainer"; +import RedirectUploadProgressDialogBase from "./RedirectUploadProgressDialogBase"; + +interface RedirectUploadProgressDialogConfig extends Config { +} + +class RedirectUploadProgressDialog extends RedirectUploadProgressDialogBase { + declare Config: RedirectUploadProgressDialogConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.upload.redirectUploadProgressDialog"; + + constructor(config: Config = null) { + super((()=> ConfigUtils.apply(Config(RedirectUploadProgressDialog, { + title: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_text, + modal: true, + width: 800, + minWidth: 800, + minHeight: 155, + closable: false, + resizable: false, + constrainHeader: true, + ui: WindowSkin.GRID_200.getSkin(), + plugins: [ + Config(VerticalSpacingPlugin, { modifier: SpacingBEMEntities.VERTICAL_SPACING_MODIFIER_200 }), + ], + items: [ + Config(ProgressBar, { + itemId: RedirectUploadProgressDialogBase.PROGRESS_BAR_ITEM_ID, + plugins: [ + Config(BindPropertyPlugin, { + componentProperty: "hidden", + bindTo: this.getUploadInProgressVE(), + transformer: RedirectUploadProgressDialogBase.hiddenValueTransformer, + }), + ], + }), + + Config(Container, { + plugins: [ + Config(BindPropertyPlugin, { + componentProperty: "hidden", + bindTo: this.getUploadInProgressVE(), + }), + ], + items: [ + Config(DisplayField, { + value: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_import_result_title, + padding: "0 0 5 0", + ui: DisplayFieldSkin.BOLD.getSkin(), + }), + Config(GridPanel, { + forceFit: true, + enableColumnHide: false, + enableColumnMove: false, + draggable: false, + plugins: [ + Config(BindListPlugin, { + bindTo: this.getRedirectsVE(), + fields: [ + Config(DataField, { name: RedirectImpl.ACTIVE }), + Config(DataField, { name: RedirectImpl.SOURCE }), + Config(DataField, { name: RedirectImpl.TARGET_LINK_NAME }), + Config(DataField, { name: RedirectImpl.REDIRECT_TYPE }), + Config(DataField, { name: RedirectImpl.SOURCE_PARAMETERS }), + Config(DataField, { name: RedirectImpl.TARGET_PARAMETERS }), + ], + }), + ], + columns: [ + Config(RedirectStatusColumn), + Config(RedirectSourceColumn), + Config(RedirectTargetColumn), + Config(RedirectTypeColumn), + Config(RedirectParametersColumn, { + header: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_sourceParameters, + dataIndex: RedirectImpl.SOURCE_PARAMETERS, + }), + Config(RedirectParametersColumn, { + header: RedirectManagerStudioPlugin_properties.redirectmanager_editor_field_targetParameters, + dataIndex: RedirectImpl.TARGET_PARAMETERS, + }), + ], + viewConfig: Config(TableView, { + stripeRows: true, + maxHeight: 200, + scrollable: true, + trackOver: true, + loadMask: true, + deferEmptyText: false, + emptyText: RedirectManagerStudioPlugin_properties.redirectmanager_editor_list_loading, + }), + }), + + Config(DisplayField, { + value: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_import_result_not_created_msg, + padding: "0 0 5 0", + ui: DisplayFieldSkin.BOLD.getSkin(), + }), + Config(Container, { + maxHeight: 300, + scrollable: true, + plugins: [ + Config(BindComponentsPlugin, { + configBeanParameterName: "errorMessage", + getKey: RedirectUploadProgressDialogBase.getKeyForErrorMessage, + valueExpression: this.getErrorMessagesVE(), + template: Config(RedirectImportErrorMessageContainer), + }), + ], + }), + + ], + }), + ], + layout: Config(VBoxLayout, { align: "stretch" }), + fbar: Config(Toolbar, { + ...{ enableFocusableContainer: false }, + items: [ + Config(Fill), + Config(Button, { + text: Editor_properties.dialog_defaultCloseButton_text, + scale: "small", + handler: bind(this, this.close), + ui: ButtonSkin.FOOTER_PRIMARY.getSkin(), + plugins: [ + Config(BindPropertyPlugin, { + componentProperty: "disabled", + bindTo: this.getUploadInProgressVE(), + }), + ], + }), + ], + }), + + }), config))()); + } +} + +export default RedirectUploadProgressDialog; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectUploadProgressDialogBase.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectUploadProgressDialogBase.ts new file mode 100644 index 0000000..0340c23 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectUploadProgressDialogBase.ts @@ -0,0 +1,158 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import ValueExpressionFactory from "@coremedia/studio-client.client-core/data/ValueExpressionFactory"; +import StudioDialog from "@coremedia/studio-client.ext.base-components/dialogs/StudioDialog"; +import FileWrapper from "@coremedia/studio-client.main.editor-components/sdk/upload/FileWrapper"; +import ProgressBar from "@jangaroo/ext-ts/ProgressBar"; +import TimerEvent from "@jangaroo/jooflash-core/flash/events/TimerEvent"; +import Timer from "@jangaroo/jooflash-core/flash/utils/Timer"; +import { as, bind } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import RedirectManagerStudioPlugin_properties from "../../bundles/RedirectManagerStudioPlugin_properties"; +import RedirectImportResponse from "../../data/RedirectImportResponse"; +import NotificationUtil from "../../util/NotificationUtil"; +import RedirectsUtil from "../../util/RedirectsUtil"; +import RedirectUploadProgressDialog from "./RedirectUploadProgressDialog"; + +interface RedirectUploadProgressDialogBaseConfig extends Config, Partial> { +} + +/** + * A window to display the import result. + */ +class RedirectUploadProgressDialogBase extends StudioDialog { + declare Config: RedirectUploadProgressDialogBaseConfig; + + protected static readonly PROGRESS_BAR_ITEM_ID: string = "progressBar"; + + #errorMessagesVE: ValueExpression = null; + + #createdRedirectsVE: ValueExpression = null; + + #uploadInProgressVE: ValueExpression = null; + + #progressBar: ProgressBar = null; + + #timer: Timer = null; + + #fileWrapper: FileWrapper = null; + + get fileWrapper(): FileWrapper { + return this.#fileWrapper; + } + + set fileWrapper(value: FileWrapper) { + this.#fileWrapper = value; + } + + #selectedSiteIdVE: ValueExpression = null; + + get selectedSiteIdVE(): ValueExpression { + return this.#selectedSiteIdVE; + } + + set selectedSiteIdVE(value: ValueExpression) { + this.#selectedSiteIdVE = value; + } + + constructor(config: Config = null) { + super(config); + this.#initProgressBar(); + RedirectsUtil.uploadRedirects(config.selectedSiteIdVE.getValue(), config.fileWrapper, bind(this, this.#uploadSuccessHandler), bind(this, this.#uploadErrorHandler)); + } + + /** + * Init the progress bar and start a timer to animate the progress bar until the redirects are imported. + */ + #initProgressBar(): void { + this.#progressBar = as(this.queryById(RedirectUploadProgressDialogBase.PROGRESS_BAR_ITEM_ID), ProgressBar); + this.#timer = new Timer(400); + this.#timer.addEventListener(TimerEvent.TIMER, bind(this, this.#updateProgressBar)); + this.#timer.start(); + } + + /** + * Animates the progress bar. + */ + #updateProgressBar(e: TimerEvent): void { + if (this.#progressBar.getValue() >= 1) { + this.#progressBar.updateProgress(0, RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_upload_inProgress_text, true); + } else { + this.#progressBar.updateProgress(this.#progressBar.getValue() + 0.05, RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_upload_inProgress_text, true); + } + } + + #uploadSuccessHandler(response: RedirectImportResponse): void { + this.#timer.stop(); + this.getUploadInProgressVE().setValue(false); + this.getErrorMessagesVE().setValue(response.getErrors()); + this.getCreatedRedirectsVE().setValue(response.getRedirects()); + } + + #uploadErrorHandler(errorMessage: string): void { + this.#timer.stop(); + this.getUploadInProgressVE().setValue(false); + NotificationUtil.showError(RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_upload_failed_msg + errorMessage); + this.close(); + } + + protected getCreatedRedirectsVE(): ValueExpression { + if (!this.#createdRedirectsVE) { + this.#createdRedirectsVE = ValueExpressionFactory.createFromValue([]); + } + return this.#createdRedirectsVE; + } + + protected getRedirectsVE(): ValueExpression { + return ValueExpressionFactory.createFromFunction((): Array => { + const redirects: Array = this.getCreatedRedirectsVE().getValue(); + if (redirects && redirects.every(RedirectsUtil.redirectIsAccessible)) { + return redirects; + } + return undefined; + }); + } + + protected static getKeyForErrorMessage(errorMessage: any): string { + return errorMessage.csvEntry + "-" + errorMessage.errorCode; + } + + protected getErrorMessagesVE(): ValueExpression { + if (!this.#errorMessagesVE) { + this.#errorMessagesVE = ValueExpressionFactory.createFromValue([]); + } + return this.#errorMessagesVE; + } + + protected getUploadInProgressVE(): ValueExpression { + if (!this.#uploadInProgressVE) { + this.#uploadInProgressVE = ValueExpressionFactory.createFromValue(true); + } + return this.#uploadInProgressVE; + } + + protected static hiddenValueTransformer(value: boolean): boolean { + return !value; + } + +} + +export default RedirectUploadProgressDialogBase; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectUploadWindow.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectUploadWindow.ts new file mode 100644 index 0000000..f547212 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectUploadWindow.ts @@ -0,0 +1,219 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import SpacingBEMEntities from "@coremedia/studio-client.ext.ui-components/bem/SpacingBEMEntities"; +import CollapsiblePanel from "@coremedia/studio-client.ext.ui-components/components/panel/CollapsiblePanel"; +import BindComponentsPlugin from "@coremedia/studio-client.ext.ui-components/plugins/BindComponentsPlugin"; +import BindPropertyPlugin from "@coremedia/studio-client.ext.ui-components/plugins/BindPropertyPlugin"; +import VerticalSpacingPlugin from "@coremedia/studio-client.ext.ui-components/plugins/VerticalSpacingPlugin"; +import ButtonSkin from "@coremedia/studio-client.ext.ui-components/skins/ButtonSkin"; +import ContainerSkin from "@coremedia/studio-client.ext.ui-components/skins/ContainerSkin"; +import DisplayFieldSkin from "@coremedia/studio-client.ext.ui-components/skins/DisplayFieldSkin"; +import WindowSkin from "@coremedia/studio-client.ext.ui-components/skins/WindowSkin"; +import BrowsePlugin from "@coremedia/studio-client.main.editor-components/sdk/components/html5/BrowsePlugin"; +import FileDropPlugin from "@coremedia/studio-client.main.editor-components/sdk/upload/FileDropPlugin"; +import FileContainer from "@coremedia/studio-client.main.editor-components/sdk/upload/dialog/FileContainer"; +import Button from "@jangaroo/ext-ts/button/Button"; +import Container from "@jangaroo/ext-ts/container/Container"; +import DisplayField from "@jangaroo/ext-ts/form/field/Display"; +import HBoxLayout from "@jangaroo/ext-ts/layout/container/HBox"; +import VBoxLayout from "@jangaroo/ext-ts/layout/container/VBox"; +import Fill from "@jangaroo/ext-ts/toolbar/Fill"; +import Toolbar from "@jangaroo/ext-ts/toolbar/Toolbar"; +import { bind } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import RedirectManagerStudioPlugin_properties from "../../bundles/RedirectManagerStudioPlugin_properties"; +import RedirectCsvHeaderDescriptionContainer from "./RedirectCsvHeaderDescriptionContainer"; +import RedirectUploadWindowBase from "./RedirectUploadWindowBase"; + +interface RedirectUploadWindowConfig extends Config, Partial> { +} + +class RedirectUploadWindow extends RedirectUploadWindowBase { + declare Config: RedirectUploadWindowConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.upload.redirectUploadWindow"; + + #selectedSiteIdVE: ValueExpression = null; + + get selectedSiteIdVE(): ValueExpression { + return this.#selectedSiteIdVE; + } + + set selectedSiteIdVE(value: ValueExpression) { + this.#selectedSiteIdVE = value; + } + + constructor(config: Config = null) { + super((()=> ConfigUtils.apply(Config(RedirectUploadWindow, { + title: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_dropin_title, + width: 800, + minWidth: 800, + height: 500, + minHeight: 500, + resizable: false, + modal: true, + constrainHeader: true, + ui: WindowSkin.GRID_200.getSkin(), + plugins: [ + Config(VerticalSpacingPlugin, { modifier: SpacingBEMEntities.VERTICAL_SPACING_MODIFIER_200 }), + ], + items: [ + Config(CollapsiblePanel, { + title: "Example", + itemId: "test", + collapsible: false, + items: [ + Config(DisplayField, { + value: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example_header, + ui: DisplayFieldSkin.BOLD.getSkin(), + }), + Config(DisplayField, { + value: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example, + ui: DisplayFieldSkin.EMBEDDED.getSkin(), + }), + Config(Container, { + margin: "10 0 0 0", + items: [ + Config(Container, { + items: [ + Config(RedirectCsvHeaderDescriptionContainer, { + title: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example_header_active_title, + text: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example_header_active_text, + }), + Config(RedirectCsvHeaderDescriptionContainer, { + title: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example_header_sourceUrlType_title, + text: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example_header_sourceUrlType_text, + }), + ], + }), + Config(Container, { + margin: "0 0 0 10", + items: [ + Config(RedirectCsvHeaderDescriptionContainer, { + title: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example_header_sourceUrl_title, + text: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example_header_sourceUrl_text, + }), + Config(RedirectCsvHeaderDescriptionContainer, { + title: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example_header_targetLink_title, + text: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example_header_targetLink_text, + }), + ], + }), + Config(Container, { + margin: "0 0 0 10", + items: [ + Config(RedirectCsvHeaderDescriptionContainer, { + title: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example_header_redirectType_title, + text: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example_header_redirectType_text, + }), + Config(RedirectCsvHeaderDescriptionContainer, { + title: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example_header_description_title, + text: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example_header_description_text, + }), + ], + }), + ], + layout: Config(HBoxLayout), + }), + Config(RedirectCsvHeaderDescriptionContainer, { + title: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example_header_sourceParameters_title, + text: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example_header_sourceParameters_text, + }), + Config(RedirectCsvHeaderDescriptionContainer, { + title: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example_header_targetParameters_title, + text: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_example_header_targetParameters_text, + }), + ], + }), + Config(Container, { + flex: 1, + minHeight: 80, + ui: ContainerSkin.FRAME_GRID_200.getSkin(), + items: [ + Config(Button, { + text: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_text, + handler: bind(this, this.uploadButtonHandler), + scale: "small", + ui: ButtonSkin.INLINE.getSkin(), + plugins: [ + Config(BrowsePlugin, { + enableFileDrop: true, + multiple: false, + dropEl: this.el, + }), + ], + }), + Config(DisplayField, { + value: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_dropin_label, + ui: DisplayFieldSkin.ITALIC.getSkin(), + }), + ], + layout: Config(VBoxLayout, { + align: "center", + pack: "center", + }), + plugins: [ + Config(FileDropPlugin, { dropHandler: bind(this, this.handleDrop) }), + ], + }), + Config(Container, { + items: [ + ], + plugins: [ + Config(BindComponentsPlugin, { + valueExpression: this.getFileListVE(), + configBeanParameterName: "file", + template: Config(FileContainer, { removeFileHandler: bind(this, this.removeFiles) }), + }), + Config(VerticalSpacingPlugin, { modifier: SpacingBEMEntities.VERTICAL_SPACING_MODIFIER_200 }), + ], + }), + ], + layout: Config(VBoxLayout, { align: "stretch" }), + fbar: Config(Toolbar, { + ...{ enableFocusableContainer: false }, + items: [ + Config(Fill), + Config(Button, { + text: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_text, + scale: "small", + handler: bind(this, this.okPressed), + ui: ButtonSkin.FOOTER_PRIMARY.getSkin(), + plugins: [ + Config(BindPropertyPlugin, { + componentProperty: "disabled", + bindTo: this.getUploadButtonDisabledExpression(), + }), + ], + }), + Config(Button, { + text: RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_csvupload_cancel_button_text, + scale: "small", + handler: bind(this, this.close), + ui: ButtonSkin.FOOTER_SECONDARY.getSkin(), + }), + ], + }), + + }), config))()); + } +} + +export default RedirectUploadWindow; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectUploadWindowBase.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectUploadWindowBase.ts new file mode 100644 index 0000000..1552442 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/editor/upload/RedirectUploadWindowBase.ts @@ -0,0 +1,123 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Logger from "@coremedia/studio-client.client-core-impl/logging/Logger"; +import ValueExpression from "@coremedia/studio-client.client-core/data/ValueExpression"; +import ValueExpressionFactory from "@coremedia/studio-client.client-core/data/ValueExpressionFactory"; +import EventUtil from "@coremedia/studio-client.client-core/util/EventUtil"; +import StudioDialog from "@coremedia/studio-client.ext.base-components/dialogs/StudioDialog"; +import BrowsePlugin from "@coremedia/studio-client.main.editor-components/sdk/components/html5/BrowsePlugin"; +import FileWrapper from "@coremedia/studio-client.main.editor-components/sdk/upload/FileWrapper"; +import Config from "@jangaroo/runtime/Config"; +import RedirectUploadProgressDialog from "./RedirectUploadProgressDialog"; +import RedirectUploadWindow from "./RedirectUploadWindow"; + +interface RedirectUploadWindowBaseConfig extends Config { +} + +/** + * A window to select import file for redirects. + */ +class RedirectUploadWindowBase extends StudioDialog { + declare Config: RedirectUploadWindowBaseConfig; + + #validationExpression: ValueExpression = null; + + #fileListVE: ValueExpression = null; + + #selectedSiteIdVE: ValueExpression = null; + + constructor(config: Config = null) { + super((()=>{ + this.#selectedSiteIdVE = config.selectedSiteIdVE; + return config; + })()); + } + + /** + * The upload button handler, converts the selected files to FileWrapper objects. + * @param browsePlugin the browse plugin used for the file selection and contains the file selection. + */ + protected uploadButtonHandler(browsePlugin: any): void { + const fileWrappers = []; + const fileList: any = browsePlugin.getFileList(); + for (let i = 0; i < fileList.length; i++) { + fileWrappers.push(new FileWrapper(fileList.item(i))); + } + this.handleDrop(fileWrappers); + } + + /** + * Fired when a file object has been dropped on the target drop area. + * The file drop plugin fire an event for each file that is dropped + * and the corresponding action is handled here. + */ + protected handleDrop(files: Array): void { + EventUtil.invokeLater((): void => { + //otherwise the progress bar does not appear :( + if (files.length > 0) { + //Currently only one document per upload is allowed. + this.getFileListVE().setValue([files[0]]); + } + }); + } + + protected getUploadButtonDisabledExpression(): ValueExpression { + if (!this.#validationExpression) { + this.#validationExpression = ValueExpressionFactory.createFromFunction((): boolean => { + const files: Array = this.getFileListVE().getValue(); + + if (files.length == 1) { + const file: FileWrapper = files[0]; + const name: string = file.getFile().name; + + if (file.getMimeType() != "text/csv") { + //only log a warning, the mimeType seems to be different in some browsers. + Logger.warn("The fileType of uploaded file is invalid: " + file.getMimeType()); + } + //Check for the file extension instead: does it end with '.csv'? + return (name.length - name.indexOf(".csv")) != 4; + } + + return true; + }); + } + return this.#validationExpression; + } + + protected getFileListVE(): ValueExpression { + if (!this.#fileListVE) { + this.#fileListVE = ValueExpressionFactory.createFromValue([]); + } + return this.#fileListVE; + } + + protected removeFiles(): void { + this.getFileListVE().setValue([]); + } + + protected okPressed(): void { + const fileWrapper: FileWrapper = this.getFileListVE().getValue()[0]; + new RedirectUploadProgressDialog(Config(RedirectUploadProgressDialog, { + fileWrapper: fileWrapper, + selectedSiteIdVE: this.#selectedSiteIdVE, + })).show(); + this.close(); + } + +} + +export default RedirectUploadWindowBase; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/plugins/BindValidationStatePlugin.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/plugins/BindValidationStatePlugin.ts new file mode 100644 index 0000000..ba72064 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/plugins/BindValidationStatePlugin.ts @@ -0,0 +1,41 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { bind } from "@jangaroo/runtime"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import BindValidationStatePluginBase from "./BindValidationStatePluginBase"; + +interface BindValidationStatePluginConfig extends Config { +} + +class BindValidationStatePlugin extends BindValidationStatePluginBase { + declare Config: BindValidationStatePluginConfig; + + /** + * This plugin can be used to bind the validation state to a property editor in the redirect edit panel. A value + * expression containing the error codes should be passed as the bindTo. If the object contains entries for the + * specified property name, the validation state is set to error. + */ + constructor(config: Config = null) { + super((()=> ConfigUtils.apply(Config(BindValidationStatePlugin, { + componentProperty: "validationState", + transformer: bind(this, this.computeValidationState), + + }), config))()); + } +} + +export default BindValidationStatePlugin; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/plugins/BindValidationStatePluginBase.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/plugins/BindValidationStatePluginBase.ts new file mode 100644 index 0000000..def03cd --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/plugins/BindValidationStatePluginBase.ts @@ -0,0 +1,52 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ValidationState from "@coremedia/studio-client.ext.ui-components/mixins/ValidationState"; +import BindPropertyPlugin from "@coremedia/studio-client.ext.ui-components/plugins/BindPropertyPlugin"; +import Config from "@jangaroo/runtime/Config"; +import BindValidationStatePlugin from "./BindValidationStatePlugin"; + +interface BindValidationStatePluginBaseConfig extends Config, Partial> { +} + +class BindValidationStatePluginBase extends BindPropertyPlugin { + declare Config: BindValidationStatePluginBaseConfig; + + #propertyName: string = null; + + get propertyName(): string { + return this.#propertyName; + } + + set propertyName(value: string) { + this.#propertyName = value; + } + + constructor(config: Config = null) { + super((()=>{ + this.propertyName = config.propertyName; + return config; + })()); + } + + protected computeValidationState(errorCodes: any): ValidationState { + return errorCodes[this.propertyName] ? ValidationState.ERROR : null; + } +} + +export default BindValidationStatePluginBase; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/studioform/RedirectForm.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/studioform/RedirectForm.ts new file mode 100644 index 0000000..7ef430d --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/studioform/RedirectForm.ts @@ -0,0 +1,102 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import BlueprintTabs_properties from "@coremedia-blueprint/studio-client.main.blueprint-forms/BlueprintTabs_properties"; +import CustomLabels_properties from "@coremedia-blueprint/studio-client.main.blueprint-forms/CustomLabels_properties"; +import ValueExpressionFactory from "@coremedia/studio-client.client-core/data/ValueExpressionFactory"; +import ButtonSkin from "@coremedia/studio-client.ext.ui-components/skins/ButtonSkin"; +import DocumentForm from "@coremedia/studio-client.main.editor-components/sdk/premular/DocumentForm"; +import DocumentInfo from "@coremedia/studio-client.main.editor-components/sdk/premular/DocumentInfo"; +import DocumentTabPanel from "@coremedia/studio-client.main.editor-components/sdk/premular/DocumentTabPanel"; +import PropertyFieldGroup from "@coremedia/studio-client.main.editor-components/sdk/premular/PropertyFieldGroup"; +import ReferrerListPanel from "@coremedia/studio-client.main.editor-components/sdk/premular/ReferrerListPanel"; +import VersionHistory from "@coremedia/studio-client.main.editor-components/sdk/premular/VersionHistory"; +import LinkListPropertyField from "@coremedia/studio-client.main.editor-components/sdk/premular/fields/LinkListPropertyField"; +import StringPropertyField from "@coremedia/studio-client.main.editor-components/sdk/premular/fields/StringPropertyField"; +import TextAreaStringPropertyField from "@coremedia/studio-client.main.editor-components/sdk/premular/fields/TextAreaStringPropertyField"; +import Button from "@jangaroo/ext-ts/button/Button"; +import Container from "@jangaroo/ext-ts/container/Container"; +import DisplayField from "@jangaroo/ext-ts/form/field/Display"; +import HBoxLayout from "@jangaroo/ext-ts/layout/container/HBox"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; +import OpenRedirectManagerEditorAction from "../action/OpenRedirectManagerEditorAction"; +import RedirectContentTypes_properties from "../bundles/RedirectContentTypes_properties"; +import RedirectManagerStudioPlugin_properties from "../bundles/RedirectManagerStudioPlugin_properties"; + +interface RedirectFormConfig extends Config { +} + +class RedirectForm extends DocumentTabPanel { + declare Config: RedirectFormConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.studioform.redirectForm"; + + constructor(config: Config = null) { + super(ConfigUtils.apply(Config(RedirectForm, { + + items: [ + + Config(DocumentForm, { + title: BlueprintTabs_properties.Tab_content_title, + items: [ + Config(PropertyFieldGroup, { + title: CustomLabels_properties.PropertyGroup_Details_label, + itemId: "detailsDocumentForm", + propertyNames: ["redirectType", "sourceUrlType", "source", "targetLink", "imported", "description"], + expandOnValues: "redirectType,sourceUrlType,source,targetLink,imported,description", + manageHeight: false, + forceReadOnlyValueExpression: ValueExpressionFactory.createFromValue(true), + items: [ + Config(Container, { + items: [ + Config(DisplayField, { value: RedirectContentTypes_properties.Redirect_edit_hint_text }), + Config(Button, { + text: RedirectManagerStudioPlugin_properties.redirectmanager_button_text, + tooltip: RedirectManagerStudioPlugin_properties.redirectmanager_button_tooltip, + ui: ButtonSkin.LINK.getSkin(), + baseAction: new OpenRedirectManagerEditorAction({}), + }), + ], + layout: Config(HBoxLayout), + }), + Config(StringPropertyField, { propertyName: "redirectType" }), + Config(StringPropertyField, { propertyName: "sourceUrlType" }), + Config(StringPropertyField, { propertyName: "source" }), + Config(LinkListPropertyField, { propertyName: "targetLink" }), + Config(TextAreaStringPropertyField, { propertyName: "description" }), + ], + }), + ], + }), + + Config(DocumentForm, { + title: BlueprintTabs_properties.Tab_system_title, + itemId: "system", + autoHide: true, + items: [ + Config(DocumentInfo), + Config(VersionHistory), + Config(ReferrerListPanel), + ], + }), + + ], + + }), config)); + } +} + +export default RedirectForm; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/tsconfig.json b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/tsconfig.json new file mode 100644 index 0000000..c857f76 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/tsconfig.json @@ -0,0 +1,196 @@ +// This file was generated by @jangaroo/build +// Customizing the TypeScript configuration is currently not supported! +{ + "extends": "@jangaroo/build/tsconfig-jangaroo.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "../dist/src", + "baseUrl": ".", + "paths": { + "@coremedia-blueprint/studio-client.blueprint-doctypes/*": [ + "../../../../../../../../../apps/studio-client/shared/js/blueprint-doctypes/src/*" + ], + "@coremedia-blueprint/studio-client.main.blueprint-forms/*": [ + "../../../../../../../../../apps/studio-client/apps/main/blueprint-forms/src/*" + ], + "@coremedia/studio-client.app-context-models/*": [ + "../node_modules/@coremedia/studio-client.app-context-models/src/*" + ], + "@coremedia/studio-client.base-models/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.base-models@2110.1.0/node_modules/@coremedia/studio-client.base-models/src/*" + ], + "@coremedia/studio-client.cap-base-models/*": [ + "../node_modules/@coremedia/studio-client.cap-base-models/src/*" + ], + "@coremedia/studio-client.cap-base-services-api/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.cap-base-services-api@2110.1.0/node_modules/@coremedia/studio-client.cap-base-services-api/src/*" + ], + "@coremedia/studio-client.cap-base-services-toolkit/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.cap-base-services-toolkit@2110.1.0/node_modules/@coremedia/studio-client.cap-base-services-toolkit/src/*" + ], + "@coremedia/studio-client.cap-rest-client/*": [ + "../node_modules/@coremedia/studio-client.cap-rest-client/src/*" + ], + "@coremedia/studio-client.cap-rest-client-impl/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.cap-rest-client-impl@2110.1.0/node_modules/@coremedia/studio-client.cap-rest-client-impl/src/*" + ], + "@coremedia/studio-client.ckeditor-constants/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ckeditor-constants@2110.1.0/node_modules/@coremedia/studio-client.ckeditor-constants/src/*" + ], + "@coremedia/studio-client.ckeditor-factory/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ckeditor-factory@2110.1.0/node_modules/@coremedia/studio-client.ckeditor-factory/src/*" + ], + "@coremedia/studio-client.client-core/*": [ + "../node_modules/@coremedia/studio-client.client-core/src/*" + ], + "@coremedia/studio-client.client-core-impl/*": [ + "../node_modules/@coremedia/studio-client.client-core-impl/src/*" + ], + "@coremedia/studio-client.collaboration-icons/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.collaboration-icons@2110.1.0/node_modules/@coremedia/studio-client.collaboration-icons/src/*" + ], + "@coremedia/studio-client.content-link-list-models/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.content-link-list-models@2110.1.0/node_modules/@coremedia/studio-client.content-link-list-models/src/*" + ], + "@coremedia/studio-client.core-icons/*": [ + "../node_modules/@coremedia/studio-client.core-icons/src/*" + ], + "@coremedia/studio-client.embed-app-services-api/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.embed-app-services-api@2110.1.0/node_modules/@coremedia/studio-client.embed-app-services-api/src/*" + ], + "@coremedia/studio-client.ext.base-components/*": [ + "../node_modules/@coremedia/studio-client.ext.base-components/src/*" + ], + "@coremedia/studio-client.ext.cap-base-components/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ext.cap-base-components@2110.1.0/node_modules/@coremedia/studio-client.ext.cap-base-components/src/*" + ], + "@coremedia/studio-client.ext.content-link-list-components/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ext.content-link-list-components@2110.1.0/node_modules/@coremedia/studio-client.ext.content-link-list-components/src/*" + ], + "@coremedia/studio-client.ext.errors-validation-components/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ext.errors-validation-components@2110.1.0/node_modules/@coremedia/studio-client.ext.errors-validation-components/src/*" + ], + "@coremedia/studio-client.ext.form-services-toolkit/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ext.form-services-toolkit@2110.1.0/node_modules/@coremedia/studio-client.ext.form-services-toolkit/src/*" + ], + "@coremedia/studio-client.ext.frame-components/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ext.frame-components@2110.1.0/node_modules/@coremedia/studio-client.ext.frame-components/src/*" + ], + "@coremedia/studio-client.ext.interaction-components/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ext.interaction-components@2110.1.0/node_modules/@coremedia/studio-client.ext.interaction-components/src/*" + ], + "@coremedia/studio-client.ext.library-services-toolkit/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ext.library-services-toolkit@2110.1.0/node_modules/@coremedia/studio-client.ext.library-services-toolkit/src/*" + ], + "@coremedia/studio-client.ext.link-list-components/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ext.link-list-components@2110.1.0/node_modules/@coremedia/studio-client.ext.link-list-components/src/*" + ], + "@coremedia/studio-client.ext.logger-components/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ext.logger-components@2110.1.0/node_modules/@coremedia/studio-client.ext.logger-components/src/*" + ], + "@coremedia/studio-client.ext.lottie-components/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ext.lottie-components@2110.1.0/node_modules/@coremedia/studio-client.ext.lottie-components/src/*" + ], + "@coremedia/studio-client.ext.multi-site-components/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ext.multi-site-components@2110.1.0/node_modules/@coremedia/studio-client.ext.multi-site-components/src/*" + ], + "@coremedia/studio-client.ext.split-main-view-components/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ext.split-main-view-components@2110.1.0/node_modules/@coremedia/studio-client.ext.split-main-view-components/src/*" + ], + "@coremedia/studio-client.ext.startup-components/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ext.startup-components@2110.1.0/node_modules/@coremedia/studio-client.ext.startup-components/src/*" + ], + "@coremedia/studio-client.ext.startup-plugins/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ext.startup-plugins@2110.1.0/node_modules/@coremedia/studio-client.ext.startup-plugins/src/*" + ], + "@coremedia/studio-client.ext.toast-components/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ext.toast-components@2110.1.0/node_modules/@coremedia/studio-client.ext.toast-components/src/*" + ], + "@coremedia/studio-client.ext.ui-components/*": [ + "../node_modules/@coremedia/studio-client.ext.ui-components/src/*" + ], + "@coremedia/studio-client.ext.workflow-components/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ext.workflow-components@2110.1.0/node_modules/@coremedia/studio-client.ext.workflow-components/src/*" + ], + "@coremedia/studio-client.ext.workflow-services-toolkit/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.ext.workflow-services-toolkit@2110.1.0/node_modules/@coremedia/studio-client.ext.workflow-services-toolkit/src/*" + ], + "@coremedia/studio-client.form-models/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.form-models@2110.1.0/node_modules/@coremedia/studio-client.form-models/src/*" + ], + "@coremedia/studio-client.form-services-api/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.form-services-api@2110.1.0/node_modules/@coremedia/studio-client.form-services-api/src/*" + ], + "@coremedia/studio-client.interaction-services-api/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.interaction-services-api@2110.1.0/node_modules/@coremedia/studio-client.interaction-services-api/src/*" + ], + "@coremedia/studio-client.interaction-services-impl/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.interaction-services-impl@2110.1.0/node_modules/@coremedia/studio-client.interaction-services-impl/src/*" + ], + "@coremedia/studio-client.kinetic-js/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.kinetic-js@2110.1.0/node_modules/@coremedia/studio-client.kinetic-js/src/*" + ], + "@coremedia/studio-client.library-services-api/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.library-services-api@2110.1.0/node_modules/@coremedia/studio-client.library-services-api/src/*" + ], + "@coremedia/studio-client.link-list-models/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.link-list-models@2110.1.0/node_modules/@coremedia/studio-client.link-list-models/src/*" + ], + "@coremedia/studio-client.main.bpbase-pagegrid-studio-plugin/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.main.bpbase-pagegrid-studio-plugin@2110.1.0/node_modules/@coremedia/studio-client.main.bpbase-pagegrid-studio-plugin/src/*" + ], + "@coremedia/studio-client.main.bpbase-studio-components/*": [ + "../node_modules/@coremedia/studio-client.main.bpbase-studio-components/src/*" + ], + "@coremedia/studio-client.main.ckeditor4-components/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.main.ckeditor4-components@2110.1.0/node_modules/@coremedia/studio-client.main.ckeditor4-components/src/*" + ], + "@coremedia/studio-client.main.editor-components/*": [ + "../node_modules/@coremedia/studio-client.main.editor-components/src/*" + ], + "@coremedia/studio-client.main.image-editor-components/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.main.image-editor-components@2110.1.0/node_modules/@coremedia/studio-client.main.image-editor-components/src/*" + ], + "@coremedia/studio-client.main.image-map-editor-components/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.main.image-map-editor-components@2110.1.0/node_modules/@coremedia/studio-client.main.image-map-editor-components/src/*" + ], + "@coremedia/studio-client.multi-site-models/*": [ + "../node_modules/@coremedia/studio-client.multi-site-models/src/*" + ], + "@coremedia/studio-client.workflow-issues-services-api/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.workflow-issues-services-api@2110.1.0/node_modules/@coremedia/studio-client.workflow-issues-services-api/src/*" + ], + "@coremedia/studio-client.workflow-models/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.workflow-models@2110.1.0/node_modules/@coremedia/studio-client.workflow-models/src/*" + ], + "@coremedia/studio-client.workflow-plugin-models/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.workflow-plugin-models@2110.1.0/node_modules/@coremedia/studio-client.workflow-plugin-models/src/*" + ], + "@coremedia/studio-client.workflow-services-api/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@coremedia+studio-client.workflow-services-api@2110.1.0/node_modules/@coremedia/studio-client.workflow-services-api/src/*" + ], + "@jangaroo/ext-ts/*": [ + "../node_modules/@jangaroo/ext-ts/src/*" + ], + "@jangaroo/jangaroo-net/*": [ + "../../../../../../../../../apps/studio-client/node_modules/.pnpm/@jangaroo+jangaroo-net@1.0.0/node_modules/@jangaroo/jangaroo-net/src/*" + ], + "@jangaroo/jooflash-core/*": [ + "../node_modules/@jangaroo/jooflash-core/src/*" + ], + "@jangaroo/runtime/*": [ + "../node_modules/@jangaroo/runtime/src/*" + ] + }, + "types": [ + "@coremedia/studio-client.client-core", + "@coremedia/studio-client.main.editor-components", + "@jangaroo/ext-ts" + ] + }, + "references": [ + { + "path": "../../../../../../../../../apps/studio-client/apps/main/blueprint-forms/src" + } + ] +} diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/util/NotificationUtil.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/util/NotificationUtil.ts new file mode 100644 index 0000000..bc52864 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/util/NotificationUtil.ts @@ -0,0 +1,43 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import ValidationState from "@coremedia/studio-client.ext.ui-components/mixins/ValidationState"; +import Config from "@jangaroo/runtime/Config"; +import RedirectProcessNotification from "./RedirectProcessNotification"; + +/** + * Utility class to inform the user about failure or success messages. + */ +class NotificationUtil { + + static showInfo(message: string): void { + NotificationUtil.#showRedirectProcessNotification(message, ValidationState.INFO); + } + + static showError(message: string): void { + NotificationUtil.#showRedirectProcessNotification(message, ValidationState.ERROR); + } + + static #showRedirectProcessNotification(message: string, validationState: ValidationState): void { + new RedirectProcessNotification(Config(RedirectProcessNotification, { + html: message, + validationState: validationState, + })).show(); + } + +} + +export default NotificationUtil; diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/util/PromiseUtil.as b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/util/PromiseUtil.ts similarity index 52% rename from core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/util/PromiseUtil.as rename to apps/studio-client/apps/main/core-redirects-studio-plugin/src/util/PromiseUtil.ts index 6fafef3..81206cb 100644 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/util/PromiseUtil.as +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/util/PromiseUtil.ts @@ -14,20 +14,19 @@ * limitations under the License. */ -package com.tallence.core.redirects.studio.util { -import com.coremedia.ui.data.RemoteBean; -import com.coremedia.ui.data.impl.RemoteServiceMethod; -import com.coremedia.ui.data.impl.RemoteServiceMethodResponse; - -import ext.Deferred; -import ext.IPromise; -import ext.JSON; -import ext.Promise; +import RemoteServiceMethod from "@coremedia/studio-client.client-core-impl/data/impl/RemoteServiceMethod"; +import RemoteServiceMethodResponse from "@coremedia/studio-client.client-core-impl/data/impl/RemoteServiceMethodResponse"; +import RemoteBean from "@coremedia/studio-client.client-core/data/RemoteBean"; +import Deferred from "@jangaroo/ext-ts/Deferred"; +import IPromise from "@jangaroo/ext-ts/IPromise"; +import JSON from "@jangaroo/ext-ts/JSON"; +import Class from "@jangaroo/runtime/Class"; +import { AnyFunction } from "@jangaroo/runtime/types"; /** * Utility class for creating promises. */ -public class PromiseUtil { +class PromiseUtil { /** * Creates a promise that invalidates the given remote bean. @@ -35,11 +34,11 @@ public class PromiseUtil { * @param remoteBean the bean to be invalidated. * @return The promise. Resolve method signature: function(bean:RemoteBean):void */ - public static function invalidateRemoteBean(remoteBean:RemoteBean):IPromise { - var deferred:Deferred = new Deferred(); - remoteBean.invalidate(function (result:RemoteBean):void { - deferred.resolve(result); - }); + static invalidateRemoteBean(remoteBean: RemoteBean): IPromise { + const deferred = new Deferred(); + remoteBean.invalidate((result: RemoteBean): void => + deferred.resolve(result), + ); return deferred.promise; } @@ -50,11 +49,11 @@ public class PromiseUtil { * @param remoteBean the bean to be loaded * @return The promise. Resolve method signature: function(bean:RemoteBean):void */ - public static function loadRemoteBean(remoteBean:RemoteBean):IPromise { - var deferred:Deferred = new Deferred(); - remoteBean.load(function (loaded:RemoteBean):void { - deferred.resolve(loaded); - }); + static loadRemoteBean(remoteBean: RemoteBean): IPromise { + const deferred = new Deferred(); + remoteBean.load((loaded: RemoteBean): void => + deferred.resolve(loaded), + ); return deferred.promise; } @@ -67,23 +66,24 @@ public class PromiseUtil { * @param responseClass the class to which the json response should be parsed * @return The promise. Resolve method signature: function(responseClass:Class):void */ - public static function getRequest(path:String, params:Object, responseClass:Class):IPromise { - var deferred:Deferred = new Deferred(); + static getRequest(path: string, params: any, responseClass: Class): IPromise { + const deferred = new Deferred(); - var rsm:RemoteServiceMethod = new RemoteServiceMethod(path, "GET"); + const rsm = new RemoteServiceMethod(path, "GET"); rsm.request( - params, - function success(rsmr:RemoteServiceMethodResponse):void { - var jsonResponse:Object = JSON.decode(rsmr.text); - var constructor:Function = responseClass.bind.apply(responseClass, [null, jsonResponse]); - deferred.resolve(new constructor()); - }, - function failure(rsmr:RemoteServiceMethodResponse):void { - deferred.reject(rsmr.getError()); - }); + params, + (rsmr: RemoteServiceMethodResponse): void => { + const jsonResponse = JSON.decode(rsmr.text); + const constructor: VoidFunction = responseClass["bind"].apply(responseClass, [null, jsonResponse]); + deferred.resolve(new constructor()); + }, + (rsmr: RemoteServiceMethodResponse): void => + deferred.reject(rsmr.getError()), + ); return deferred.promise; } } -} + +export default PromiseUtil; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/util/RedirectProcessNotification.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/util/RedirectProcessNotification.ts new file mode 100644 index 0000000..188a90b --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/util/RedirectProcessNotification.ts @@ -0,0 +1,49 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AnimatedNotification from "@coremedia/studio-client.ext.ui-components/components/AnimatedNotification"; +import TipSkin from "@coremedia/studio-client.ext.ui-components/skins/TipSkin"; +import FitLayout from "@jangaroo/ext-ts/layout/container/Fit"; +import Config from "@jangaroo/runtime/Config"; +import ConfigUtils from "@jangaroo/runtime/ConfigUtils"; + +interface RedirectProcessNotificationConfig extends Config { +} + +class RedirectProcessNotification extends AnimatedNotification { + declare Config: RedirectProcessNotificationConfig; + + static override readonly xtype: string = "com.tallence.core.redirects.studio.editor.form.redirectProcessNotification"; + + constructor(config: Config = null) { + super(ConfigUtils.apply(Config(RedirectProcessNotification, { + position: "rt", + yOffset: 50.0, + xOffset: 37.0, + target: "topContainer-innerCt", + isMouseAware: true, + hideAnchor: true, + minHeight: 60.0, + width: 400, + ui: TipSkin.EMBEDDING.getSkin(), + layout: Config(FitLayout), + // alignToTarget: "tr-tl", + visibilityDuration: 6000 + + }), config)); + } +} + +export default RedirectProcessNotification; diff --git a/apps/studio-client/apps/main/core-redirects-studio-plugin/src/util/RedirectsUtil.ts b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/util/RedirectsUtil.ts new file mode 100644 index 0000000..d20f171 --- /dev/null +++ b/apps/studio-client/apps/main/core-redirects-studio-plugin/src/util/RedirectsUtil.ts @@ -0,0 +1,276 @@ +/* + * Copyright 2019 Tallence AG + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import Content from "@coremedia/studio-client.cap-rest-client/content/Content"; +import BeanFactoryImpl from "@coremedia/studio-client.client-core-impl/data/impl/BeanFactoryImpl"; +import RemoteService from "@coremedia/studio-client.client-core-impl/data/impl/RemoteService"; +import RemoteServiceMethod from "@coremedia/studio-client.client-core-impl/data/impl/RemoteServiceMethod"; +import RemoteServiceMethodResponse + from "@coremedia/studio-client.client-core-impl/data/impl/RemoteServiceMethodResponse"; +import RemoteBeanUtil from "@coremedia/studio-client.client-core/data/RemoteBeanUtil"; +import beanFactory from "@coremedia/studio-client.client-core/data/beanFactory"; +import RemoteError from "@coremedia/studio-client.client-core/data/error/RemoteError"; +import Uploader from "@coremedia/studio-client.main.editor-components/sdk/components/html5/Uploader"; +import FileWrapper from "@coremedia/studio-client.main.editor-components/sdk/upload/FileWrapper"; +import IPromise from "@jangaroo/ext-ts/IPromise"; +import JSON from "@jangaroo/ext-ts/JSON"; +import ObjectUtil from "@jangaroo/ext-ts/Object"; +import Promise from "@jangaroo/ext-ts/Promise"; +import StringUtil from "@jangaroo/ext-ts/String"; +import ReadOperation from "@jangaroo/ext-ts/data/operation/Read"; +import Sorter from "@jangaroo/ext-ts/util/Sorter"; +import {as} from "@jangaroo/runtime"; +import int from "@jangaroo/runtime/int"; +import {AnyFunction} from "@jangaroo/runtime/types"; +import RedirectManagerStudioPlugin_properties from "../bundles/RedirectManagerStudioPlugin_properties"; +import PermissionResponse from "../data/PermissionResponse"; +import Redirect from "../data/Redirect"; +import RedirectImpl from "../data/RedirectImpl"; +import RedirectImportResponse from "../data/RedirectImportResponse"; +import RedirectSourceParameter from "../data/RedirectSourceParameter"; +import Redirects from "../data/Redirects"; +import RedirectsResponse from "../data/RedirectsResponse"; +import ValidationResponse from "../data/ValidationResponse"; +import NotificationUtil from "./NotificationUtil"; +import PromiseUtil from "./PromiseUtil"; + +/** + * Utility class for {@link Redirect}s. + */ +class RedirectsUtil { + + static readonly #CREATE_URI_SEGMENT: string = "create"; + + static readonly #DEFAULT_UPLOAD_SIZE: int = 67108864; + + /** + * Returns true, if the redirect the linked content is loaded. + * @param redirect the redirect. + * @return Boolean + */ + static redirectIsAccessible(redirect: Redirect): boolean { + if (!redirect.isLoaded() && !RemoteBeanUtil.isAccessible(redirect)) { + return false; + } + + const targetLink: Content = redirect.getTargetLink(); + if (targetLink && !targetLink.isLoaded()) { + targetLink.load(); + return false; + } + return true; + } + + /** + * Creates a new {@link Redirect} with the given properties + */ + static createRedirect(siteId: string, active: boolean, targetLink: Content, targetUrl: string, + description: string, source: string, sourceType: string, redirectType: string, + sourceParameters: Array, targetParameters: Array): void { + const rsm = new RemoteServiceMethod("redirects/" + siteId + "/" + RedirectsUtil.#CREATE_URI_SEGMENT, "POST", true); + rsm.request({ + active: active, + targetLink: targetLink, + targetUrl: targetUrl, + description: description, + source: source, + sourceUrlType: sourceType, + redirectType: redirectType, + sourceParameters: sourceParameters, + targetParameters: targetParameters, + }, + (rsmr: RemoteServiceMethodResponse): void => + NotificationUtil.showInfo(RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_new_success_text) + , + (rsmr: RemoteServiceMethodResponse): void => + NotificationUtil.showError(RedirectManagerStudioPlugin_properties.redirectmanager_editor_actions_new_error_text + rsmr.getError()), + + ); + } + + /** + * Creates a promise that loads the redirects for the given site. As soon as all redirects are loaded, the result is + * returned by the promise. All redirect beans are already loaded. The beans of the redirect targets are not loaded + * and have to be loaded asynchronously if necessary. + * + * @param siteId the site id. + * @param searchText the search text. + * @param operation the read operation. + * @param exactMatch true if the path of the redirect for the search should match exactly + * @return The promise. Resolve method signature: function(response:RedirectsResponse):void + */ + static getRedirects(siteId: string, searchText: string, operation: ReadOperation, exactMatch: boolean): IPromise { + if (!siteId || 0 === siteId.length) { + return Promise.resolve(new RedirectsResponse([], 0)); + } + + const bean = beanFactory._.getRemoteBean("redirects/" + siteId + RedirectsUtil.#getQueryParams(searchText, operation, exactMatch)); + + // A RemoteBean is used to load the redirects. Once a RemoteBean has been loaded, property data is cached. However, + // a new request should be sent to the server when the reload button of the grid is activated or after a redirect is + // created. To force reloading, the invalidate() method is used. The invalidation is also processed + // asynchronously, so that afterwards the remote bean can be reloaded. + return PromiseUtil + .invalidateRemoteBean(bean) + .then(PromiseUtil.loadRemoteBean) + .then(RedirectsUtil.#createRedirectsResponse); + } + + /** + * Converts the response of the remote bean request into a {@link RedirectsResponse}. + * + * @param redirects the loaded redirects remote bean. + * @return The promise. Resolve method signature: function(response:RedirectsResponse):void + */ + static #createRedirectsResponse(redirects: Redirects): IPromise { + const response = new RedirectsResponse(redirects.getItems(), redirects.getTotal()); + return Promise.resolve(response); + } + + static #getQueryParams(searchText: string, operation: ReadOperation, exactMatch: boolean): string { + const limit = operation.getLimit().toString(); + const page = operation.getPage().toString(); + const sorters: Array = operation.getSorters(); + let sorter; + let sortDirection; + if (sorters && sorters.length) { + let sorterConf = as(sorters[0], Sorter); + if (!sorterConf.isInstance) { + return; + } + sorter = sorterConf.getProperty(); + sortDirection = sorterConf.getDirection(); + + } else { + sorter = RedirectImpl.SOURCE; + sortDirection = "ASC"; + } + + const queryParams: Record = {}; + queryParams["page"] = page; + queryParams["pageSize"] = limit; + queryParams["sorter"] = sorter; + queryParams["sortDirection"] = sortDirection; + queryParams["search"] = searchText; + queryParams["exactMatch"] = exactMatch; + + return "?" + ObjectUtil.toQueryString(queryParams); + } + + /** + * Uploads a csv and imports all redirects. + * + * @param siteId the site id. + * @param fileWrapper the file + * @param success callback function for success + * @param error callback function for error + */ + static uploadRedirects(siteId: string, + fileWrapper: FileWrapper, + success: AnyFunction, + error: AnyFunction): void { + + const upldr = new Uploader({ + maxFileSize: RedirectsUtil.#DEFAULT_UPLOAD_SIZE, + timeout: 20000, + url: RemoteService.calculateRequestURI("/rest/api/redirects/" + siteId + "/upload"), + method: "POST", + }); + + upldr.addListener("uploadcomplete", (_uploader: Uploader, response: XMLHttpRequest): void => { + BeanFactoryImpl.resolveBeans(JSON.decode(response.responseText)); + + //Hack for html4 upload. + if (response.status === 200) { + const importResponse = JSON.decode(response.responseText); + const created = as(BeanFactoryImpl.resolveBeans(importResponse.created), Array); + success.call(null, new RedirectImportResponse(created, importResponse.errorMessages)); + } else { + error.call(null, response.statusText + " (code " + response.status + ")"); + } + }); + + upldr.addListener("uploadfailure", (_uploader: Uploader, response: XMLHttpRequest): void => { + try { + const result = new RemoteError(JSON.decode(response.responseText)); + error.call(null, result.message); + } catch (e) { + error.call(null, response.responseText); + } + }); + + const file = fileWrapper.getFile(); + upldr.upload(file); + } + + /** + * Creates a promise that validates a redirect and returns a validation result. + * + * @param siteId the site id. + * @param redirectId the redirect id. + * @param source the source. + * @param targetId the id of the target + * @param targetUrl the targetUrl + * @param active true, if the redirect is published + * @param sourceParameters a list of SourceUrlParameters + * + * @return The promise. Resolve method signature: function(response:ValidationResponse):void + */ + static validateRedirect(siteId: string, + redirectId: string, + source: string, + targetId: string, + targetUrl: string, + active: boolean, + sourceParameters: Array): IPromise { + const urlTemplate = "/{0}/validate"; + + const joined = sourceParameters + .map((parameter: RedirectSourceParameter): any => + parameter.getParametersAsMap()) + .map((map: any): string => + JSON.encodeValue(map), + ) + .map(encodeURIComponent) + .join(","); + + const params: Record = { + source: source, + redirectId: redirectId, + targetId: targetId, + targetUrl: targetUrl, + active: active, + sourceParameters: joined, + }; + + const url = StringUtil.format(urlTemplate, siteId); + return PromiseUtil.getRequest("redirects" + url, params, ValidationResponse); + } + + /** + * Resolve the permissions for the redirects in the selected site. + */ + static resolvePermissions(siteId: string): IPromise { + if (!siteId || siteId == "") { + // if no site is selected, nothing may be edited + return Promise.resolve(new PermissionResponse()); + } + return PromiseUtil.getRequest("redirects/" + siteId + "/permissions", {}, PermissionResponse); + } + +} + +export default RedirectsUtil; diff --git a/apps/studio-client/package.json b/apps/studio-client/package.json new file mode 100644 index 0000000..ebe7bce --- /dev/null +++ b/apps/studio-client/package.json @@ -0,0 +1,15 @@ +{ + "name": "studio-client", + "version": "1.0.0-SNAPSHOT", + "private": true, + "engines": { + "node": ">=16", + "pnpm": ">=6.14.6" + }, + "devDependencies": { + "@coremedia/set-version": "^1.1.1" + }, + "scripts": { + "set-version": "set-version" + } +} diff --git a/apps/studio-client/pnpm-workspace.yaml b/apps/studio-client/pnpm-workspace.yaml new file mode 100644 index 0000000..bf1275a --- /dev/null +++ b/apps/studio-client/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +packages: + - "apps/main/core-redirects-studio-plugin" diff --git a/core-redirects-studio-lib/pom.xml b/core-redirects-studio-lib/pom.xml index 2549f00..59c28d8 100644 --- a/core-redirects-studio-lib/pom.xml +++ b/core-redirects-studio-lib/pom.xml @@ -98,7 +98,7 @@ org.apache.commons commons-csv - 1.3 + 1.9.0 diff --git a/core-redirects-studio-plugin/package.json b/core-redirects-studio-plugin/package.json deleted file mode 100644 index 65836d1..0000000 --- a/core-redirects-studio-plugin/package.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "resources": [ - {"path": "${package.dir}/resources"} - ], - "studioPlugins": [ - { - "mainClass": "com.tallence.core.redirects.studio.RedirectManagerStudioPlugin", - "name": "Redirect Manager Extension" - } - ] -} \ No newline at end of file diff --git a/core-redirects-studio-plugin/pom.xml b/core-redirects-studio-plugin/pom.xml deleted file mode 100644 index 4d71b87..0000000 --- a/core-redirects-studio-plugin/pom.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - com.coremedia.blueprint - studio-client.extensions - 1-SNAPSHOT - ../../../../apps/studio-client/modules/extensions/pom.xml - - - 4.0.0 - core-redirects-studio-plugin - swc - - - studio - - - Plugin for generating redirects in CoreMedia Studio - - - - - ${project.groupId} - blueprint-forms - ${project.version} - swc - - - - - com.coremedia.ui.toolkit - ui-components - swc - - - com.coremedia.ui.sdk - editor-components - swc - - - com.coremedia.blueprint.base - bpbase-studio-components - swc - - - net.jangaroo - ext-as - swc - - - com.coremedia.cms - studio-client.cap-base-models - swc - - - com.coremedia.ui.toolkit - client-core - swc - - - com.coremedia.cms - studio-client.multi-site-models - swc - - - com.coremedia.ui.sdk - cap-rest-client - swc - - - com.coremedia.ui.toolkit - core-icons - swc - - - com.coremedia.ui.toolkit - client-core-impl - swc - - - com.coremedia.cms - studio-client.base-components - swc - - - net.jangaroo - jooflash-core - swc - - - - - - - - - src/main/sencha - ../packages/local/package - - - - - - net.jangaroo - jangaroo-maven-plugin - ${jangaroo.version} - true - - com.tallence.core.redirects.studio - - - exml:com.tallence.core.redirects.studio.config - - - - - - - - diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/RedirectManagerStudioPlugin.mxml b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/RedirectManagerStudioPlugin.mxml deleted file mode 100644 index 5f3df98..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/RedirectManagerStudioPlugin.mxml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/RedirectManagerStudioPluginBase.as b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/RedirectManagerStudioPluginBase.as deleted file mode 100644 index 18ce4cd..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/RedirectManagerStudioPluginBase.as +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2019 Tallence AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.tallence.core.redirects.studio { -import com.coremedia.cms.editor.configuration.StudioPlugin; -import com.coremedia.cms.editor.sdk.IEditorContext; -import com.coremedia.cms.editor.sdk.editorContext; -import com.coremedia.ui.data.impl.BeanClassRegistry; -import com.tallence.core.redirects.studio.data.RedirectSourceParameter; -import com.tallence.core.redirects.studio.data.RedirectTargetParameter; - -use namespace editorContext; - -public class RedirectManagerStudioPluginBase extends StudioPlugin { - - public function RedirectManagerStudioPluginBase(config:RedirectManagerStudioPlugin = null) { - super(config); - } - - override public function init(editorContext:IEditorContext):void { - super.init(editorContext); - - BeanClassRegistry.registerTypeImplementation('com.tallence.core.redirects.studio.data.RedirectSourceParameter', RedirectSourceParameter); - BeanClassRegistry.registerTypeImplementation('com.tallence.core.redirects.studio.data.RedirectTargetParameter', RedirectTargetParameter); - } -} -} diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/action/OpenRedirectManagerEditorAction.mxml b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/action/OpenRedirectManagerEditorAction.mxml deleted file mode 100644 index 06a552c..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/action/OpenRedirectManagerEditorAction.mxml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/action/OpenRedirectManagerEditorActionBase.as b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/action/OpenRedirectManagerEditorActionBase.as deleted file mode 100644 index 2f249e7..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/action/OpenRedirectManagerEditorActionBase.as +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2019 Tallence AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.tallence.core.redirects.studio.action { - -import com.coremedia.cms.editor.sdk.desktop.WorkArea; -import com.coremedia.cms.editor.sdk.desktop.WorkAreaTabType; -import com.coremedia.cms.editor.sdk.editorContext; -import com.tallence.core.redirects.studio.editor.RedirectManagerEditor; -import com.tallence.core.redirects.studio.editor.RedirectManagerEditorBase; - -import ext.Action; -import ext.panel.Panel; - -use namespace editorContext; - -public class OpenRedirectManagerEditorActionBase extends Action { - - public function OpenRedirectManagerEditorActionBase(config:OpenRedirectManagerEditorAction = null) { - config.handler = openRedirectAdmin; - super(config); - } - - public static function openRedirectAdmin():void { - var workArea:WorkArea = editorContext.getWorkArea() as WorkArea; - var redirectManagerTab:RedirectManagerEditor = RedirectManagerEditorBase.getInstance(); - - if (!redirectManagerTab) { - var workAreaTabType:WorkAreaTabType = workArea.getTabTypeById(RedirectManagerEditor.xtype); - workAreaTabType.createTab(null, function (tab:Panel):void { - redirectManagerTab = tab as RedirectManagerEditor; - workArea.addTab(workAreaTabType, redirectManagerTab); - }); - } - - workArea.setActiveTab(redirectManagerTab); - } -} -} \ No newline at end of file diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/bundles/RedirectContentTypes.properties b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/bundles/RedirectContentTypes.properties deleted file mode 100644 index b7bb52d..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/bundles/RedirectContentTypes.properties +++ /dev/null @@ -1,7 +0,0 @@ -Redirect_icon=tallence-icons tallence-icons--redirects -Redirect_edit_hint_text=Redirects cannot be edited in this form. Please use the redirect manager: -Redirect_redirectType_text=Type -Redirect_sourceUrlType_text=Source Url Type -Redirect_source_text=Source -Redirect_targetLink_text=Target Link -Redirect_description_text=Description diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/bundles/RedirectContentTypes_de.properties b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/bundles/RedirectContentTypes_de.properties deleted file mode 100644 index 6858981..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/bundles/RedirectContentTypes_de.properties +++ /dev/null @@ -1,6 +0,0 @@ -Redirect_redirectType_text=Typ -Redirect_edit_hint_text=Die Umleitung kann in diesem Formular nicht editiert werden. Bitte nutzen Sie daf\u00FCr den Redirect-Manager: -Redirect_sourceUrlType_text=Url Typ -Redirect_source_text=Quelle -Redirect_targetLink_text=Ziel -Redirect_description_text=Beschreibung diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/bundles/RedirectManagerStudioPlugin.properties b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/bundles/RedirectManagerStudioPlugin.properties deleted file mode 100644 index 574e651..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/bundles/RedirectManagerStudioPlugin.properties +++ /dev/null @@ -1,168 +0,0 @@ -# -redirectmanager_text=RedirectManager - -redirectmanager_button_text=Redirects -redirectmanager_button_tooltip=Manage redirects - -redirectmanager_editor_list_loading=Loading redirects.. -redirectmanager_editor_list_nothing_found=No redirects found.. -redirectmanager_editor_list_nothing_found_match=No redirects found with same path and different source parameters.. -redirectmanager_editor_same_source_title=Redirects with the same source -redirectmanager_editor_list_empty=Empty -redirectmanager_editor_list_text=Redirects - -redirectmanager_editor_list_error_no_target=Missing target - -redirectmanager_editor_edit_text=Redirect -redirectmanager_editor_field_active=Published -redirectmanager_editor_field_source=Source -redirectmanager_editor_field_target=Target -redirectmanager_editor_field_target_link_select=Content -redirectmanager_editor_field_target_path_select=URL -redirectmanager_editor_field_targetLink=Target Link -redirectmanager_editor_field_targetUrl=Target Url -redirectmanager_editor_field_creationDate=Creation Date -redirectmanager_editor_field_type=Type -redirectmanager_editor_field_type_value_0=Always -redirectmanager_editor_field_type_value_1=Only after 404 -redirectmanager_editor_field_type_value_2=Vanity Redirect -redirectmanager_editor_field_type_invalid=Invalid value -redirectmanager_editor_field_parameters=Parameters -redirectmanager_editor_field_description=Description -redirectmanager_editor_field_sourceType=Source-Type -redirectmanager_editor_field_sourceType_plain=Plain -redirectmanager_editor_field_sourceType_regex=Regular Expression -redirectmanager_editor_field_parameterName=Name -redirectmanager_editor_field_parameterValue=Value -redirectmanager_editor_field_sourceParameters=Source Parameters -redirectmanager_editor_field_targetParameters=Target Parameters - -redirectmanager_editor_actions_new_tooltip=Click here to add a new redirect -redirectmanager_editor_actions_new_text=New Redirect -redirectmanager_editor_actions_new_success_text=The redirect was created successfully\!
The redirect is not immediately visible in the table.
Please click the Refresh-Button. -redirectmanager_editor_actions_new_error_text=Error while creating redirect\!
Reason\: - -redirectmanager_editor_actions_delete_text=Delete -redirectmanager_editor_actions_delete_tooltip=Delete redirect -redirectmanager_editor_actions_delete_confirm_title=Delete redirect -redirectmanager_editor_actions_delete_confirm_text=Do you really want to delete this redirect? -redirectmanager_editor_actions_delete_result_text_error=Error while deleting redirect\! -redirectmanager_editor_actions_delete_result_text_error_w_msg=Error while deleting redirect\!
Reason\: -redirectmanager_editor_actions_delete_result_text_success=The redirect was successfully deleted\! - -redirectmanager_editor_actions_save_text=Save -redirectmanager_editor_actions_save_confirm_title=Save redirect -redirectmanager_editor_actions_save_confirm_text=Do you want to save the changes to this redirect? -redirectmanager_editor_actions_save_validationerror_title=Validation error -redirectmanager_editor_actions_save_validationerror_text=Please complete the following missing fields\: -redirectmanager_editor_actions_save_validationerror_targetField=Target Link or Target Path -redirectmanager_editor_actions_save_result_text_success=The redirect was saved successfully\! -redirectmanager_editor_actions_save_result_text_error=Error while saving redirect\! -redirectmanager_editor_actions_save_result_text_error_w_msg=Error while saving redirect\!
Reason\: - -redirectmanager_editor_actions_reload_text=Reload -redirectmanager_editor_actions_reload_tooltip=Click here to reload redirects - -redirectmanager_editor_action_result_title_success=Success -redirectmanager_editor_action_result_title_error=Error - -redirectmanager_editor_actions_publish_tooltip=Click here to publish the current state -redirectmanager_editor_actions_publish_text=Publish -redirectmanager_editor_actions_publish_confirm_title=Publish Redirects -redirectmanager_editor_actions_publish_confirm_text=Do you want to publish the current redirects? -redirectmanager_editor_actions_publish_result_text_success=Redirects published -redirectmanager_editor_actions_publish_result_text_error=Error while publishing redirects\! -redirectmanager_editor_actions_publish_result_text_error_w_msg=Error while publishing redirect\!
Reason\: - -redirectmanager_editor_help_tooltip=Help -redirectmanager_editor_help_source_button=Help -redirectmanager_editor_help_source_title=Help -redirectmanager_editor_help_targetUrl_title=Help -redirectmanager_editor_help_source_text=The url to be redirected e.g. /products/old-product. It should not contain fragments (#anchor). Query-parameters (e.g. ?param=value) will automatically removed und copied into the "Source Parameters" field. If you do not see this field, ask your Administrator to activate that feature.
For multi-language countries, leave out the language prefix, so e.g. type /old-link instead of /fr/old-link for french speaking Switzerland. -redirectmanager_editor_help_targetUrl_text=The target url of this redirect. Consider linking a CoreMedia-Document in the field "Target Link" instead, because the redirectTarget will never produce a 404 in that case. - -redirectmanager_editor_actions_csvupload_example_header=Active;Source URL Type;Source URL;Target Link;Target Url;Redirect Type;Description;Source Parameters;Target Parameters -redirectmanager_editor_actions_csvupload_example=TRUE;REGEX;/sourceUrl;/Sites/Chef Corp./Aurora B2C Page;;AFTER_NOT_FOUND;description;[{"name": "parameterName", "value": "value", "operator": "EQUALS"}];[{"name": "parameterName", "value": "value"}] - -redirectmanager_editor_actions_csvupload_example_header_active_title=Active: -redirectmanager_editor_actions_csvupload_example_header_active_text=TRUE or FALSE -redirectmanager_editor_actions_csvupload_example_header_sourceUrlType_title=Source URL Type: -redirectmanager_editor_actions_csvupload_example_header_sourceUrlType_text=REGEX or PLAIN -redirectmanager_editor_actions_csvupload_example_header_sourceUrl_title=Source URL: -redirectmanager_editor_actions_csvupload_example_header_sourceUrl_text=the source url -redirectmanager_editor_actions_csvupload_example_header_targetLink_title=Target Link: -redirectmanager_editor_actions_csvupload_example_header_targetLink_text=path to the content item or the content-id -redirectmanager_editor_actions_csvupload_example_header_redirectType_title=Redirect Type: -redirectmanager_editor_actions_csvupload_example_header_redirectType_text=AFTER_NOT_FOUND or ALWAYS -redirectmanager_editor_actions_csvupload_example_header_description_title=Description: -redirectmanager_editor_actions_csvupload_example_header_description_text=an optional description -redirectmanager_editor_actions_csvupload_example_header_sourceParameters_title=Source Parameters: -redirectmanager_editor_actions_csvupload_example_header_sourceParameters_text=the source parameters or [], example: [{"name": "parameterName", "value": "value", "operator": "EQUALS"}] -redirectmanager_editor_actions_csvupload_example_header_targetParameters_title=Target Parameters: -redirectmanager_editor_actions_csvupload_example_header_targetParameters_text=the target parameters or [], example: [{"name": "parameterName", "value": "value"}] - - -redirectmanager_editor_actions_csvupload_dropin_title=Redirect CSV import - -redirectmanager_editor_actions_csvupload_tooltip=Click here to create a list of redirects by uploading a CSV file -redirectmanager_editor_actions_csvupload_text=Upload - -redirectmanager_editor_actions_csvupload_dropin_label=Drop file here... - -redirectmanager_editor_actions_csvupload_upload_button_text=Upload -redirectmanager_editor_actions_csvupload_upload_inProgress_text=Import in progress... -redirectmanager_editor_actions_csvupload_cancel_button_text=Cancel - -redirectmanager_editor_actions_csvupload_upload_failed_title=Upload failed -redirectmanager_editor_actions_csvupload_upload_failed_msg=The following error occured: - -redirectmanager_editor_actions_csvupload_upload_error_title=Error creating redirects -redirectmanager_editor_actions_csvupload_upload_error_msg=Please send the following message to your administrator: \n\n - -redirectmanager_editor_actions_csvupload_no_file_selected_title=No file selected -redirectmanager_editor_actions_csvupload_no_file_selected_msg=Please select a file... - -redirectmanager_editor_actions_csvupload_import_result_title=Import successful -redirectmanager_editor_actions_csvupload_import_result_msg=The redirect import was successful

-redirectmanager_editor_actions_csvupload_import_result_not_created_msg=Redirects not created: -redirectmanager_editor_actions_csvupload_import_result_button_ok_text=OK - -redirectmanager_editor_actions_csvupload_import_error_length_invalid=Invalid length. Six columns are required to import a redirect. -redirectmanager_editor_actions_csvupload_import_error_active_invalid=The value for 'active' may only be true or false. -redirectmanager_editor_actions_csvupload_import_error_sourceUrlType_invalid=The value for'sourceUrlType' should be'REGEX' or'PLAIN'. -redirectmanager_editor_actions_csvupload_import_error_source_invalid=The value for the source must not be empty and must start with '/'. -redirectmanager_editor_actions_csvupload_import_error_source_whitespace=The value for the source must not contain whitespace characters. -redirectmanager_editor_actions_csvupload_import_error_source_already_exists=There is already a redirect for that source url and source parameters. -redirectmanager_editor_actions_csvupload_import_error_target_missing=The redirect must contain a target. -redirectmanager_editor_actions_csvupload_import_error_target_invalid=To publish the redirect the target must be published. -redirectmanager_editor_actions_csvupload_import_error_target_both=Use a either a "Target Link" or a "Target Url", bot not both. -redirectmanager_editor_actions_csvupload_import_error_target_url_invalid=The target-Url is invalid. -redirectmanager_editor_actions_csvupload_import_error_redirectType_invalid=The value for'redirectType' should be'ALWAYS' or'AFTER_NOT_FOUND'. -redirectmanager_editor_actions_csvupload_import_error_creation_failure=The redirect could not be created. -redirectmanager_editor_actions_csvupload_import_error_description_invalid=The description is invalid, only 1024 chars are allowed. -redirectmanager_editor_actions_csvupload_import_error_duplicate_source=The import contains this source with the same source parameters multiple times. -redirectmanager_editor_actions_csvupload_import_error_parsing_failure=The redirect could not be created because the source or target parameters could not be read. - -redirectmanager_editor_error_source_invalid=The value for the source must not be empty and must start with '/'. -redirectmanager_editor_error_source_whitespace=The value for the source must not contain whitespace characters. -redirectmanager_editor_error_source_already_exists=There is already a redirect for that source url and source parameters. -redirectmanager_editor_error_target_missing=The redirect must contain a target. -redirectmanager_editor_error_target_invalid=To publish the redirect the target must be published. -redirectmanager_editor_error_target_both=Use a either a "Target Link" or a "Target Url", bot not both. -redirectmanager_editor_error_target_url_invalid=The target-Url is invalid. -redirectmanager_editor_error_description_invalid=The description is invalid, only 1024 chars are allowed. - -redirectmanager_editor_grid_search_label=Filter Redirects: -redirectmanager_editor_grid_search_empty_text=Enter search term -redirectmanager_editor_grid_site_selector_label=Redirects for Site: -redirectmanager_editor_grid_redirect_edit_label=Edit Redirect -redirectmanager_editor_grid_redirect_delete_label=Delete Redirect -redirectmanager_editor_grid_redirect_open_label=Open Redirect target - -redirectmanager_decision_use404Type=A Redirect-Source ending with an ID used together with the ${redirectmanager_editor_field_type} "${redirectmanager_editor_field_type_value_1}" might not work if a document exist with the same ID in the CMS. The ${redirectmanager_editor_field_type} should be changed to "${redirectmanager_editor_field_type_value_0}". -redirectmanager_decision_useAlwaysType=The ${redirectmanager_editor_field_type} "${redirectmanager_editor_field_type_value_0}" should be used with care. Otherwise requests on valid pages could be redirected based on old redirects. The ${redirectmanager_editor_field_type} should be changed to "${redirectmanager_editor_field_type_value_1}". -redirectmanager_decision_ok=Change the ${redirectmanager_editor_field_type} and save -redirectmanager_decision_title=Check the ${redirectmanager_editor_field_type} - -redirectmanager_validation_error=Could not validate redirect. -redirectmanager_validation_source_already_exists=There is already a redirect for that source url. diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/bundles/RedirectManagerStudioPlugin_de.properties b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/bundles/RedirectManagerStudioPlugin_de.properties deleted file mode 100644 index 4584575..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/bundles/RedirectManagerStudioPlugin_de.properties +++ /dev/null @@ -1,138 +0,0 @@ -# -redirectmanager_text=RedirectManager -redirectmanager_button_text=Umleitungen -redirectmanager_button_tooltip=Umleitungen verwalten -redirectmanager_editor_list_loading=Lade Umleitungen.. -redirectmanager_editor_list_nothing_found=Keine Umleitungen gefunden.. -redirectmanager_editor_list_nothing_found_match=Keine Umleitungen mit der gleichen Quelle gefunden.. -redirectmanager_editor_same_source_title=Umelitungen mit der selben Quell-Url -redirectmanager_editor_list_text=Umleitungen -redirectmanager_editor_list_error_no_target=Fehlendes Ziel -redirectmanager_editor_edit_text=Umleitung -redirectmanager_editor_field_active=Publiziert -redirectmanager_editor_field_source=Quelle -redirectmanager_editor_field_target=Ziel -redirectmanager_editor_field_target_link_select=Inhalt -redirectmanager_editor_field_target_path_select=URL -redirectmanager_editor_field_targetLink=Ziel-Inhalt -redirectmanager_editor_field_targetUrl=Ziel-Url -redirectmanager_editor_field_creationDate=Erstellungsdatum -redirectmanager_editor_field_type=Typ -redirectmanager_editor_field_type_value_0=Immer -redirectmanager_editor_field_type_value_1=Nur nach 404 -redirectmanager_editor_field_type_value_2=Vanity Umleitung -redirectmanager_editor_field_type_invalid=Ung\u00FCltiger Wert -redirectmanager_editor_field_parameters=Parameter -redirectmanager_editor_field_description=Beschreibung -redirectmanager_editor_field_sourceType=Quell-Url-Type -redirectmanager_editor_field_sourceType_plain=Plain -redirectmanager_editor_field_sourceType_regex=Regul\u00E4rer Ausdruck -redirectmanager_editor_actions_new_tooltip=Neue Umleitung hinzuf\u00FCgen -redirectmanager_editor_actions_new_text=Neue Umleitung -redirectmanager_editor_actions_new_success_text=Die Umleitung wurde erfolgreich angelegt\!
Die Umleitung ist nicht direkt in der Tabelle sichtbar.
Bitte klicken Sie den Aktualisierungs Button. -redirectmanager_editor_actions_new_error_text=fehler beim Erstellen der Umleitung\!
Ursache\: -redirectmanager_editor_field_parameterName=Name -redirectmanager_editor_field_parameterValue=Wert -redirectmanager_editor_field_sourceParameters=Quell-Parameter -redirectmanager_editor_field_targetParameters=Ziel-Parameter - - -redirectmanager_editor_actions_delete_tooltip=Umleitung l\u00F6schen -redirectmanager_editor_actions_delete_confirm_title=Umleitung l\u00F6schen -redirectmanager_editor_actions_delete_confirm_text=Wollen Sie diese Umleitung wirklich l\u00F6schen? -redirectmanager_editor_actions_save_confirm_title=Umleitung speichern -redirectmanager_editor_actions_save_confirm_text=Wollen Sie die \u00C4nderungen an dieser Umleitung speichern? -redirectmanager_editor_actions_reload_tooltip=Umleitungen neu laden -redirectmanager_editor_actions_reload_text=Neu laden -redirectmanager_editor_action_result_title_success=Erfolgreich -redirectmanager_editor_action_result_title_error=Fehler -redirectmanager_editor_actions_publish_tooltip=Aktuellen Stand der Umleitungen publizieren -redirectmanager_editor_actions_publish_text=Publizieren -redirectmanager_editor_actions_publish_confirm_title=Umleitungen publizieren -redirectmanager_editor_actions_publish_confirm_text=Wollen Sie den aktuellen Stand der Umleitungen publizieren? -redirectmanager_editor_actions_publish_result_text_success=Die Umleitungen wurden erfolgreich publiziert -redirectmanager_editor_actions_publish_result_text_error=Fehler bei der Publikation der Umleitungen\! -redirectmanager_editor_actions_publish_result_text_error_w_msg=Fehler bei der Publikation der Umleitungen\!
Ursache\: -redirectmanager_editor_actions_delete_text=L\u00F6schen -redirectmanager_editor_actions_save_text=Speichern -redirectmanager_editor_list_empty=Leer -redirectmanager_editor_actions_save_result_text_success=Die Umleitung wurde erfolgreich gespeichert\! -redirectmanager_editor_actions_save_result_text_error=Fehler beim Speichern der Umleitung\! -redirectmanager_editor_actions_save_result_text_error_w_msg=Fehler beim Speichern der Umleitung\!
Ursache\: -redirectmanager_editor_actions_delete_result_text_error=Fehler beim L\u00F6schen der Umleitung\! -redirectmanager_editor_actions_delete_result_text_error_w_msg=Fehler beim L\u00F6schen der Umleitung\!
Ursache\: -redirectmanager_editor_actions_delete_result_text_success=Die Umleitung wurde erfolgreich gel\u00F6scht\! -redirectmanager_editor_actions_save_validationerror_title=Validierungsfehler -redirectmanager_editor_actions_save_validationerror_text=Bitte f\u00FCllen Sie die folgenden Felder aus\: -redirectmanager_editor_actions_save_validationerror_targetField=Ziel-Inhalt oder Ziel-URL -redirectmanager_editor_help_tooltip=Hilfe -redirectmanager_editor_help_source_button=Hilfe -redirectmanager_editor_help_source_title=Hilfe -redirectmanager_editor_help_source_text=Die Url, die umgeleitet werden soll z.B. /produkte/altes-produkt. Sie sollte keine Fragmente (#anchor) enthalten. Query-Parameter (z.B. ?param=value) werden automatisch entfernt und in das "Quell-Parameter"-Feld \u00FCbertragen. Wenden Sie sich an Ihren Administrator wenn Sie das Feld nicht sehen sollten.
F\u00FCr mehrsprachige Seiten muss der Sprach-Pr\u00E4fix weggelassen werden, also z.B. /old-link anstelle von /fr/old-link f\u00FCr die Franz\u00F6sisch-sprachige Schweizer-Seite. -redirectmanager_editor_help_targetUrl_text=Die Url, auf die umgeleitet werden soll. Prüfen Sie, ob stattdessen ein CoreMedia-Inhalt im "Ziel-Inhalt"-Feld verlinkt werden kann, da die Wartung dadurch vereinfacht wird und kein 404 im Umleitungs-Ziel auftreten kann. - -redirectmanager_editor_actions_csvupload_example_header_sourceUrl_text=Die Quell-Url -redirectmanager_editor_actions_csvupload_example_header_targetLink_text=Pfad zum Dokument oder die CoreMedia-Inhalt-Id -redirectmanager_editor_actions_csvupload_example_header_description_text=Eine optionale Beschreibung -redirectmanager_editor_actions_csvupload_example_header_sourceParameters_text=The Url-Parameter der Quell-Url oder [], Beispiel: [{"name": "parameterName", "value": "value", "operator": "EQUALS"}] -redirectmanager_editor_actions_csvupload_example_header_targetParameters_title=Ziel-Url Parameter: -redirectmanager_editor_actions_csvupload_example_header_targetParameters_text=Die Url-Parameter, die an die Ziel-Url angehangen werden sollen or [], Beispiel: [{"name": "parameterName", "value": "value"}] - -redirectmanager_editor_actions_csvupload_tooltip=Klicken Sie hier, um eine Liste von Redirects \u00FCber einen CSV Upload anzulegen. -redirectmanager_editor_actions_csvupload_text=Upload -redirectmanager_editor_actions_csvupload_dropin_title=Redirect CSV Import -redirectmanager_editor_actions_csvupload_dropin_label=Datei hierhin ziehen.. -redirectmanager_editor_actions_csvupload_upload_button_text=Upload -redirectmanager_editor_actions_csvupload_upload_inProgress_text=Umleitungen werden importiert... -redirectmanager_editor_actions_csvupload_cancel_button_text=Abbrechen -redirectmanager_editor_actions_csvupload_upload_failed_title=Import failed -redirectmanager_editor_actions_csvupload_upload_failed_msg=Beim anlegen der Weiterleitungen ist ein Fehler aufgetreten: -redirectmanager_editor_actions_csvupload_upload_error_title=Fehler beim Anlegen der Redirects -redirectmanager_editor_actions_csvupload_upload_error_msg=Bitte senden Sie folgende Meldung an Ihren Administrator:

-redirectmanager_editor_actions_csvupload_no_file_selected_title=Keine Datei ausgew\u00E4hlt -redirectmanager_editor_actions_csvupload_no_file_selected_msg=Bitte w\u00E4hlen Sie eine Datei aus... - -redirectmanager_editor_actions_csvupload_import_result_title=Import erfolgreich -redirectmanager_editor_actions_csvupload_import_result_msg=Der Import war erfolgreich

-redirectmanager_editor_actions_csvupload_import_result_not_created_msg=Folgende Weiterleitungen konnten nicht angelegt werden: -redirectmanager_editor_actions_csvupload_import_result_button_ok_text=OK - -redirectmanager_editor_actions_csvupload_import_error_length_invalid=Es werden 6 Spalten f\u00FCr den Import einer Umleitung ben\u00F6tigt. -redirectmanager_editor_actions_csvupload_import_error_active_invalid=Der Wert f\u00FCr 'active' darf nur true oder false sein. -redirectmanager_editor_actions_csvupload_import_error_sourceUrlType_invalid=Der Wert f\u00FCr 'sourceUrlType' darf entweder 'REGEX' oder 'PLAIN' sein. -redirectmanager_editor_actions_csvupload_import_error_source_invalid=Der Wert f\u00FCr die Quelle darf nicht leer sein und muss mit einem '/' beginnen. -redirectmanager_editor_actions_csvupload_import_error_source_whitespace=Der Wert f\u00FCr die Quelle darf keine Leerzeichen enthalten. -redirectmanager_editor_actions_csvupload_import_error_source_already_exists=Es existiert bereits eine Umleitung f\u00FCr die Quelle mit den gleichen Quell-Parametern. -redirectmanager_editor_actions_csvupload_import_error_target_missing=Die Umleitung ben\u00F6tigt ein Ziel. -redirectmanager_editor_actions_csvupload_import_error_target_invalid=Um die Umleitung publizieren zu k\u00F6nnen muss das Ziel publiziert sein. -redirectmanager_editor_actions_csvupload_import_error_target_both=Es sollte ein "Ziel-Inhalt" oder eine "Ziel-Url" verwendet werden, nicht beide. -redirectmanager_editor_actions_csvupload_import_error_target_url_invalid=Die Ziel-Url ist ung\u00FCltig. -redirectmanager_editor_actions_csvupload_import_error_redirectType_invalid=Der Wert f\u00FCr 'redirectType' darf entweder 'ALWAYS' oder 'AFTER_NOT_FOUND' sein. -redirectmanager_editor_actions_csvupload_import_error_creation_failure=Die Umleitung konnte nicht erstellt werden. -redirectmanager_editor_actions_csvupload_import_error_description_invalid=Die Beschreibung ist ung\u00FCltig. Sie darf nur 1024 Zeichen lang sein. -redirectmanager_editor_actions_csvupload_import_error_duplicate_source=Der Csv-Import enth\u00E4lt die Quell-Url mit den gleichen Parametern mehrmals. -redirectmanager_editor_actions_csvupload_import_error_parsing_failure=Die Umleitung konnte nicht erstellt werden, da die Quell- oder Ziel-Parameter nicht gelesen werden konnten. - -redirectmanager_editor_error_source_invalid=Der Wert f\u00FCr die Quelle darf nicht leer sein und muss mit einem '/' beginnen. -redirectmanager_editor_error_source_whitespace=Der Wert f\u00FCr die Quelle darf keine Leerzeichen enthalten. -redirectmanager_editor_error_source_already_exists=Es existiert bereits eine Umleitung f\u00FCr die Quelle mit den gleichen Quell-Parametern. -redirectmanager_editor_error_target_missing=Die Umleitung ben\u00F6tigt ein Ziel. -redirectmanager_editor_error_target_invalid=Um die Umleitung publizieren zu k\u00F6nnen muss das Ziel publiziert sein. -redirectmanager_editor_error_target_both=Es sollte ein "Ziel-Inhalt" oder eine "Ziel-Url" verwendet werden, nicht beide. -redirectmanager_editor_error_target_url_invalid=Die Ziel-Url ist ung\u00FCltig. -redirectmanager_editor_error_description_invalid=Die Beschreibung ist ung\u00FCltig. Sie darf nur 1024 Zeichen lang sein. - -redirectmanager_editor_grid_search_label=Filter: -redirectmanager_editor_grid_search_empty_text=Suchbegriff eingeben -redirectmanager_editor_grid_site_selector_label=Umleitung der Seite: -redirectmanager_editor_grid_redirect_edit_label=Umleitung bearbeiten -redirectmanager_editor_grid_redirect_delete_label=Umleitung l\u00F6schen -redirectmanager_editor_grid_redirect_open_label=Umleitungsziel \u00F6ffnen - -redirectmanager_decision_use404Type=Eine Quelle, die mit einer ID endet kann im Zusammenhang mit dem ${redirectmanager_editor_field_type} "${redirectmanager_editor_field_type_value_1}" dazu f\u00FChren, dass der Redirect nicht korrekt funktioniert. Der Typ sollte auf "${redirectmanager_editor_field_type_value_0}" ge\u00E4ndert werden. -redirectmanager_decision_useAlwaysType=Der ${redirectmanager_editor_field_type} "${redirectmanager_editor_field_type_value_0}" sollte nur in Ausnahmef\u00E4llen verwendet werden. Ansonsten k\u00F6nnten Anfragen auf g\u00FCltige Seiten durch alte Umleitungen versehentlich umgeleitet werden. Der Typ sollte auf "${redirectmanager_editor_field_type_value_1}" ge\u00E4ndert werden. -redirectmanager_decision_ok=${redirectmanager_editor_field_type} \u00E4ndern und speichern -redirectmanager_decision_title=\u00DCberpr\u00FCfung des ${redirectmanager_editor_field_type} - -redirectmanager_validation_error=Die Umleitung konnte nicht validiert werden. -redirectmanager_validation_source_already_exists=Es existiert bereits eine Umleitung f\u00FCr die Quelle. diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/PermissionResponse.as b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/PermissionResponse.as deleted file mode 100644 index c8a1779..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/PermissionResponse.as +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2019 Tallence AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.tallence.core.redirects.studio.data { - -public class PermissionResponse { - - private var mayWrite:Boolean; - private var mayPublish:Boolean; - private var mayUseRegex:Boolean; - private var mayUseTargetUrls:Boolean; - - public function PermissionResponse(jsonResponse:Object = null) { - this.mayWrite = jsonResponse ? jsonResponse.mayWrite : false; - this.mayPublish = jsonResponse ? jsonResponse.mayPublish : false; - this.mayUseRegex = jsonResponse ? jsonResponse.mayUseRegex : false; - this.mayUseTargetUrls = jsonResponse ? jsonResponse.mayUseTargetUrls : false; - } - - public function isMayWrite():Boolean { - return mayWrite; - } - - public function isMayPublish():Boolean { - return mayPublish; - } - - public function isMayUseRegex():Boolean { - return mayUseRegex; - } - - public function isMayUseTargetUrls():Boolean { - return mayUseTargetUrls; - } -} -} diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/Redirect.as b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/Redirect.as deleted file mode 100644 index 447301a..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/Redirect.as +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2019 Tallence AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.tallence.core.redirects.studio.data { -import com.coremedia.cap.undoc.content.Content; -import com.coremedia.ui.data.RemoteBean; - -/** - * A model representing a redirect. - */ -public interface Redirect extends RemoteBean { - - function deleteMe(callback:Function = null):void; - - function getId():String; - - function isActive():Boolean; - - function setActive(active:Boolean):void; - - function getTargetLink():Content; - - function getTargetUrl():String; - - function setTargetLink(content:Content):void; - - function setTargetUrl(targetUrl: String):void; - - function getTargetLinkName():String; - - function setTargetLinkName(name:String):void; - - function getCreationDate():Date; - - function setCreationDate(creationDate:Date):void; - - function getRedirectType():Number; - - function setRedirectType(redirectType:Number):void; - - function getDescription():String; - - function setDescription(description:String):void; - - function isImported():Boolean; - - function getSourceType():String; - - function setSourceType(sourceType:String):void; - - function getSource():String; - - function setSource(source:String):void; - - function getSiteId():String; - - function setSourceParameters(parameters:Array):void; - - function getSourceParameters():Array; - - function setTargetParameters(parameters:Array):void; - - function getTargetParameters():Array; - -} -} diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectImpl.as b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectImpl.as deleted file mode 100644 index 8d482d4..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/data/RedirectImpl.as +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Copyright 2019 Tallence AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.tallence.core.redirects.studio.data { -import com.coremedia.cap.content.Content; -import com.coremedia.ui.data.impl.RemoteBeanImpl; -import com.coremedia.ui.data.impl.RemoteServiceMethod; -import com.coremedia.ui.data.impl.RemoteServiceMethodResponse; -import com.tallence.core.redirects.studio.util.NotificationUtil; - -import mx.resources.ResourceManager; - -[RestResource(uriTemplate="redirect/{siteId:[^/]+}/{id:[^/]+}")] -public class RedirectImpl extends RemoteBeanImpl implements Redirect { - - public static const ACTIVE:String = "active"; - public static const CREATION_DATE:String = "creationDate"; - public static const REDIRECT_TYPE:String = "redirectType"; - public static const REDIRECT_TYPE_ALWAYS:String = "ALWAYS"; - public static const REDIRECT_TYPE_404:String = "AFTER_NOT_FOUND"; - public static const SOURCE:String = "source"; - public static const SOURCE_TYPE:String = "sourceUrlType"; - public static const SOURCE_TYPE_PLAIN:String = "PLAIN"; - public static const SOURCE_TYPE_REGEX:String = "REGEX"; - public static const TARGET_LINK:String = "targetLink"; - public static const TARGET_LINK_NAME:String = "targetLinkName"; - public static const TARGET_URL:String = "targetUrl"; - public static const DESCRIPTION:String = "description"; - public static const IMPORTED:String = "imported"; - public static const SITE_ID:String = "siteId"; - public static const SOURCE_PARAMETERS:String = "sourceParameters"; - public static const TARGET_PARAMETERS:String = "targetParameters"; - - /** - * List of all redirect properties, used by the grid. - */ - public static const REDIRECT_PROPERTIES:Array = [ - ACTIVE, - CREATION_DATE, - REDIRECT_TYPE, - SOURCE, - SOURCE_TYPE, - SOURCE_TYPE_PLAIN, - SOURCE_TYPE_REGEX, - TARGET_LINK, - TARGET_LINK_NAME, - DESCRIPTION, - IMPORTED, - SITE_ID, - SOURCE_PARAMETERS, - TARGET_PARAMETERS - ]; - - public function RedirectImpl(path:String) { - super(path); - } - - public function deleteMe(callback:Function = null):void { - var rsm:RemoteServiceMethod = new RemoteServiceMethod(this.getUriPath(), 'DELETE'); - rsm.request( - null, - function success(rsmr:RemoteServiceMethodResponse):void { - NotificationUtil.showInfo(ResourceManager.getInstance().getString('com.tallence.core.redirects.studio.bundles.RedirectManagerStudioPlugin', 'redirectmanager_editor_actions_delete_result_text_success')); - callback.call(this); - }, - function failure(rsmr:RemoteServiceMethodResponse):void { - NotificationUtil.showError(ResourceManager.getInstance().getString('com.tallence.core.redirects.studio.bundles.RedirectManagerStudioPlugin', 'redirectmanager_editor_actions_delete_result_text_error_w_msg') + rsmr.getError()); - }); - } - - public function isActive():Boolean { - return get(ACTIVE); - } - - public function setActive(active:Boolean):void { - set(ACTIVE, active); - } - - public function getTargetLink():Content { - return get(TARGET_LINK); - } - - public function setTargetLink(content:Content):void { - set(TARGET_LINK, content); - } - - public function getTargetUrl():String { - return get(TARGET_URL); - } - - - public function setTargetUrl(targetUrl:String):void { - set(TARGET_URL, targetUrl); - } - - public function getTargetLinkName():String { - return get(TARGET_LINK_NAME); - } - - public function setTargetLinkName(name:String):void { - set(TARGET_LINK_NAME, name); - } - - public function getCreationDate():Date { - return get(CREATION_DATE); - } - - public function setCreationDate(creationDate:Date):void { - set(CREATION_DATE, creationDate); - } - - public function getRedirectType():Number { - return get(REDIRECT_TYPE); - } - - public function setRedirectType(redirectType:Number):void { - set(REDIRECT_TYPE, redirectType); - } - - public function getDescription():String { - return get(DESCRIPTION); - } - - public function setDescription(description:String):void { - set(DESCRIPTION, description); - } - - public function isImported():Boolean { - return get(IMPORTED); - } - - public function getSourceType():String { - return get(SOURCE_TYPE); - } - - public function setSourceType(sourceType:String):void { - set(SOURCE_TYPE, sourceType); - } - - public function getSource():String { - return get(SOURCE); - } - - public function setSource(source:String):void { - set(SOURCE, source); - } - - public function getSiteId():String { - return get(SITE_ID); - } - - public function setSourceParameters(parameters:Array):void { - set(SOURCE_PARAMETERS, parameters); - } - - [ArrayElementType("com.tallence.core.redirects.studio.data.RedirectSourceParameter")] - public function getSourceParameters():Array { - return get(SOURCE_PARAMETERS); - } - - public function setTargetParameters(parameters:Array):void { - set(TARGET_PARAMETERS, parameters); - } - - [ArrayElementType("com.tallence.core.redirects.studio.data.RedirectTargetParameter")] - public function getTargetParameters():Array { - return get(TARGET_PARAMETERS); - } - - override protected function propertiesUpdated(overwrittenValues:Object, newValues:Object):void { - NotificationUtil.showInfo(ResourceManager.getInstance().getString('com.tallence.core.redirects.studio.bundles.RedirectManagerStudioPlugin', 'redirectmanager_editor_actions_save_result_text_success')); - super.propertiesUpdated(overwrittenValues, newValues); - } - -} -} diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/RedirectManagerEditor.mxml b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/RedirectManagerEditor.mxml deleted file mode 100644 index 428ecf7..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/RedirectManagerEditor.mxml +++ /dev/null @@ -1,88 +0,0 @@ - - - - [ResourceBundle('com.tallence.core.redirects.studio.bundles.RedirectManagerStudioPlugin')] - [ResourceBundle('com.coremedia.icons.CoreIcons')] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/RedirectManagerEditorBase.as b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/RedirectManagerEditorBase.as deleted file mode 100644 index e4d3523..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/RedirectManagerEditorBase.as +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 2019 Tallence AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.tallence.core.redirects.studio.editor { -import com.coremedia.cms.editor.sdk.editorContext; -import com.coremedia.cms.studio.multisite.models.sites.Site; -import com.coremedia.ui.data.ValueExpression; -import com.coremedia.ui.data.ValueExpressionFactory; -import com.tallence.core.redirects.studio.data.PermissionResponse; -import com.tallence.core.redirects.studio.editor.form.RedirectEditWindow; -import com.tallence.core.redirects.studio.editor.upload.RedirectUploadWindow; -import com.tallence.core.redirects.studio.util.RedirectsUtil; - -import ext.Ext; -import ext.panel.Panel; - -use namespace editorContext; - -public class RedirectManagerEditorBase extends Panel { - - protected static const ID:String = "redirectManagerEditor"; - - private var selectedSiteVE:ValueExpression; - private var mayNotWriteVE:ValueExpression; - private var mayNotPublishVE:ValueExpression; - private var mayNotUseRegexVE:ValueExpression; - private var mayNotUseTargetUrlsVE:ValueExpression; - - public function RedirectManagerEditorBase(config:RedirectManagerEditor = null) { - super(config); - - getSelectedSiteVE().addChangeListener(resolveRights); - //Call it in case the site is already selected - resolveRights(); - } - - private function resolveRights(): void { - var siteId:* = getSelectedSiteVE().getValue(); - - //In case the request takes long or fails, the user has no rights - getMayNotWriteVE().setValue(true); - getMayNotPublishVE().setValue(true); - getMayNotUseRegexVE().setValue(true); - - RedirectsUtil.resolvePermissions(siteId).then(function(response: PermissionResponse): void { - getMayNotWriteVE().setValue(!response.isMayWrite()); - getMayNotPublishVE().setValue(!response.isMayPublish()); - getMayNotUseRegexVE().setValue(!response.isMayUseRegex()); - getMayNotUseTargetUrlsVE().setValue(!response.isMayUseTargetUrls()); - }); - } - - public static function getInstance():RedirectManagerEditor { - return Ext.getCmp(ID) as RedirectManagerEditor; - } - - protected function createRedirect():void { - var window:RedirectEditWindow = new RedirectEditWindow(RedirectEditWindow({ - title: resourceManager.getString('com.tallence.core.redirects.studio.bundles.RedirectManagerStudioPlugin', 'redirectmanager_editor_actions_new_text'), - selectedSiteIdVE: getSelectedSiteVE(), - mayNotPublishVE: this.mayNotPublishVE, - mayNotUseRegexVE: this.mayNotUseRegexVE, - mayNotUseTargetUrlsVE: this.mayNotUseTargetUrlsVE - })); - window.show(); - } - - protected function csvUploadButtonHandler():void { - var dialog:RedirectUploadWindow = new RedirectUploadWindow( - RedirectUploadWindow({ - selectedSiteIdVE: getSelectedSiteVE() - }) - ); - dialog.show(); - } - - /** - * Creates a ValueExpression that stores the currently selected site. - * @return ValueExpression - */ - protected function getSelectedSiteVE():ValueExpression { - if (!selectedSiteVE) { - var preferredSite:Site = editorContext.getSitesService().getPreferredSite(); - selectedSiteVE = ValueExpressionFactory.createFromValue(preferredSite ? preferredSite.getId() : ""); - } - return selectedSiteVE; - } - - protected function getMayNotWriteVE():ValueExpression { - if (!mayNotWriteVE) { - mayNotWriteVE = ValueExpressionFactory.createFromValue(false); - } - return mayNotWriteVE; - } - - protected function getMayNotPublishVE():ValueExpression { - if (!mayNotPublishVE) { - mayNotPublishVE = ValueExpressionFactory.createFromValue(false); - } - return mayNotPublishVE; - } - - protected function getMayNotUseRegexVE():ValueExpression { - if (!mayNotUseRegexVE) { - mayNotUseRegexVE = ValueExpressionFactory.createFromValue(false); - } - return mayNotUseRegexVE; - } - - protected function getMayNotUseTargetUrlsVE():ValueExpression { - if (!mayNotUseTargetUrlsVE) { - mayNotUseTargetUrlsVE = ValueExpressionFactory.createFromValue(false); - } - return mayNotUseTargetUrlsVE; - } - - protected function getSiteIsNotSelectedVE():ValueExpression { - return ValueExpressionFactory.createFromFunction(function ():Boolean { - var siteId:String = getSelectedSiteVE().getValue(); - return !siteId || siteId == ""; - }) - } - -} -} diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/form/ErrorFieldContainer.mxml b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/form/ErrorFieldContainer.mxml deleted file mode 100644 index a3f4221..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/form/ErrorFieldContainer.mxml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/form/ErrorMessage.mxml b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/form/ErrorMessage.mxml deleted file mode 100644 index 49434c1..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/form/ErrorMessage.mxml +++ /dev/null @@ -1,22 +0,0 @@ - - - - [ResourceBundle('com.tallence.core.redirects.studio.bundles.RedirectManagerStudioPlugin')] - - - - - diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/form/RedirectEditPanel.mxml b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/form/RedirectEditPanel.mxml deleted file mode 100644 index 49154a4..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/form/RedirectEditPanel.mxml +++ /dev/null @@ -1,217 +0,0 @@ - - - - [ResourceBundle('com.tallence.core.redirects.studio.bundles.RedirectManagerStudioPlugin')] - [ResourceBundle('com.coremedia.icons.CoreIcons')] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/form/RedirectEditWindow.mxml b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/form/RedirectEditWindow.mxml deleted file mode 100644 index af524dd..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/form/RedirectEditWindow.mxml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - [ResourceBundle('com.tallence.core.redirects.studio.bundles.RedirectManagerStudioPlugin')] - [ResourceBundle('com.coremedia.cms.editor.Editor')] - - - - - - - - - - - - - - - - - diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/upload/RedirectUploadProgressDialogBase.as b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/upload/RedirectUploadProgressDialogBase.as deleted file mode 100644 index 035780f..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/upload/RedirectUploadProgressDialogBase.as +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2019 Tallence AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.tallence.core.redirects.studio.editor.upload { -import com.coremedia.cms.editor.sdk.components.StudioDialog; -import com.coremedia.cms.editor.sdk.editorContext; -import com.coremedia.cms.editor.sdk.upload.FileWrapper; -import com.coremedia.ui.data.ValueExpression; -import com.coremedia.ui.data.ValueExpressionFactory; -import com.tallence.core.redirects.studio.data.RedirectImportResponse; -import com.tallence.core.redirects.studio.util.NotificationUtil; -import com.tallence.core.redirects.studio.util.RedirectsUtil; - -import ext.ProgressBar; - -import flash.events.TimerEvent; -import flash.utils.Timer; - -import mx.resources.ResourceManager; - -use namespace editorContext; - -/** - * A window to display the import result. - */ -public class RedirectUploadProgressDialogBase extends StudioDialog { - - protected static const PROGRESS_BAR_ITEM_ID:String = "progressBar"; - - private var errorMessagesVE:ValueExpression; - private var createdRedirectsVE:ValueExpression; - private var uploadInProgressVE:ValueExpression; - - private var progressBar:ProgressBar; - private var timer:Timer; - - [Bindable] - public var fileWrapper:FileWrapper; - - [Bindable] - public var selectedSiteIdVE:ValueExpression; - - public function RedirectUploadProgressDialogBase(config:RedirectUploadProgressDialog = null) { - super(config); - initProgressBar(); - RedirectsUtil.uploadRedirects(config.selectedSiteIdVE.getValue(), config.fileWrapper, uploadSuccessHandler, uploadErrorHandler); - } - - /** - * Init the progress bar and start a timer to animate the progress bar until the redirects are imported. - */ - private function initProgressBar():void { - progressBar = queryById(PROGRESS_BAR_ITEM_ID) as ProgressBar; - timer = new Timer(400); - timer.addEventListener(TimerEvent.TIMER, updateProgressBar); - timer.start(); - } - - /** - * Animates the progress bar. - */ - private function updateProgressBar(e:TimerEvent):void { - if (progressBar.getValue() >= 1) { - progressBar.updateProgress(0, ResourceManager.getInstance().getString('com.tallence.core.redirects.studio.bundles.RedirectManagerStudioPlugin', 'redirectmanager_editor_actions_csvupload_upload_inProgress_text'), true); - } else { - progressBar.updateProgress(progressBar.getValue() + 0.05, ResourceManager.getInstance().getString('com.tallence.core.redirects.studio.bundles.RedirectManagerStudioPlugin', 'redirectmanager_editor_actions_csvupload_upload_inProgress_text'), true); - } - } - - private function uploadSuccessHandler(response:RedirectImportResponse):void { - timer.stop(); - getUploadInProgressVE().setValue(false); - getErrorMessagesVE().setValue(response.getErrors()); - getCreatedRedirectsVE().setValue(response.getRedirects()); - } - - private function uploadErrorHandler(errorMessage:String):void { - timer.stop(); - getUploadInProgressVE().setValue(false); - NotificationUtil.showError(ResourceManager.getInstance().getString('com.tallence.core.redirects.studio.bundles.RedirectManagerStudioPlugin', 'redirectmanager_editor_actions_csvupload_upload_failed_msg') + errorMessage); - close(); - } - - protected function getCreatedRedirectsVE():ValueExpression { - if (!createdRedirectsVE) { - createdRedirectsVE = ValueExpressionFactory.createFromValue([]); - } - return createdRedirectsVE; - } - - protected function getRedirectsVE():ValueExpression { - return ValueExpressionFactory.createFromFunction(function ():Array { - var redirects:Array = getCreatedRedirectsVE().getValue(); - if (redirects && redirects.every(RedirectsUtil.redirectIsAccessible)) { - return redirects; - } - return undefined; - }) - } - - protected static function getKeyForErrorMessage(errorMessage:Object):String { - return errorMessage.csvEntry + "-" + errorMessage.errorCode; - } - - protected function getErrorMessagesVE():ValueExpression { - if (!errorMessagesVE) { - errorMessagesVE = ValueExpressionFactory.createFromValue([]); - } - return errorMessagesVE; - } - - protected function getUploadInProgressVE():ValueExpression { - if (!uploadInProgressVE) { - uploadInProgressVE = ValueExpressionFactory.createFromValue(true); - } - return uploadInProgressVE; - } - - protected static function hiddenValueTransformer(value:Boolean):Boolean { - return !value; - } - -} -} diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/upload/RedirectUploadWindow.mxml b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/upload/RedirectUploadWindow.mxml deleted file mode 100644 index 1c9fd0f..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/editor/upload/RedirectUploadWindow.mxml +++ /dev/null @@ -1,157 +0,0 @@ - - - - [ResourceBundle('com.tallence.core.redirects.studio.bundles.RedirectManagerStudioPlugin')] - [ResourceBundle('com.coremedia.cms.editor.Editor')] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/plugins/AddRedirectManagerPluginBase.as b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/plugins/AddRedirectManagerPluginBase.as deleted file mode 100644 index 66bf49b..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/plugins/AddRedirectManagerPluginBase.as +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2019 Tallence AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.tallence.core.redirects.studio.plugins { -import com.coremedia.cms.editor.sdk.util.UserUtil; -import com.coremedia.cms.editor.sdk.editorContext; -import com.coremedia.ui.plugins.NestedRulesPlugin; - -use namespace editorContext; - -public class AddRedirectManagerPluginBase extends NestedRulesPlugin { - - protected var groups:Array; - - public function AddRedirectManagerPluginBase(config:AddRedirectManagerPlugin = null) { - super(config); - } - - protected function checkPermission():Boolean { - if (groups.length > 0) { - for each(var group:String in groups) { - if (UserUtil.isInGroup(group)) { - return true; - } - } - return false; - } - return true; - } -} -} diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/plugins/BindValidationStatePlugin.mxml b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/plugins/BindValidationStatePlugin.mxml deleted file mode 100644 index 48bc18a..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/plugins/BindValidationStatePlugin.mxml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/plugins/BindValidationStatePluginBase.as b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/plugins/BindValidationStatePluginBase.as deleted file mode 100644 index aa0e57c..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/plugins/BindValidationStatePluginBase.as +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2019 Tallence AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.tallence.core.redirects.studio.plugins { -import com.coremedia.ui.mixins.ValidationState; -import com.coremedia.ui.plugins.BindPropertyPlugin; - -public class BindValidationStatePluginBase extends BindPropertyPlugin { - - [Bindable] - public var propertyName:String; - - public function BindValidationStatePluginBase(config:BindValidationStatePlugin = null) { - this.propertyName = config.propertyName; - super(config); - } - - protected function computeValidationState(errorCodes:Object):ValidationState { - return errorCodes[propertyName] ? ValidationState.ERROR : null; - } -} -} diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/studioform/RedirectForm.mxml b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/studioform/RedirectForm.mxml deleted file mode 100644 index 209928a..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/studioform/RedirectForm.mxml +++ /dev/null @@ -1,80 +0,0 @@ - - - - [ResourceBundle('com.coremedia.blueprint.studio.BlueprintTabs')] - [ResourceBundle('com.coremedia.blueprint.studio.CustomLabels')] - [ResourceBundle('com.tallence.core.redirects.studio.bundles.RedirectManagerStudioPlugin')] - [ResourceBundle('com.tallence.core.redirects.studio.bundles.RedirectContentTypes')] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/util/NotificationUtil.as b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/util/NotificationUtil.as deleted file mode 100644 index f7f8ceb..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/util/NotificationUtil.as +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2019 Tallence AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.tallence.core.redirects.studio.util { -import com.coremedia.ui.mixins.ValidationState; - -/** - * Utility class to inform the user about failure or success messages. - */ -public class NotificationUtil { - - public static function showInfo(message:String):void { - showRedirectProcessNotification(message, ValidationState.INFO); - } - - public static function showError(message:String):void { - showRedirectProcessNotification(message, ValidationState.ERROR); - } - - private static function showRedirectProcessNotification(message:String, validationState:ValidationState):void { - new RedirectProcessNotification(RedirectProcessNotification({ - title: message, - validationState: validationState - })).show(); - } - -} -} \ No newline at end of file diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/util/RedirectProcessNotification.mxml b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/util/RedirectProcessNotification.mxml deleted file mode 100644 index b626ff1..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/util/RedirectProcessNotification.mxml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/util/RedirectsUtil.as b/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/util/RedirectsUtil.as deleted file mode 100644 index ce7daa3..0000000 --- a/core-redirects-studio-plugin/src/main/joo/com/tallence/core/redirects/studio/util/RedirectsUtil.as +++ /dev/null @@ -1,264 +0,0 @@ -/* - * Copyright 2019 Tallence AG - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.tallence.core.redirects.studio.util { -import com.coremedia.cap.content.Content; -import com.coremedia.cms.editor.sdk.components.html5.Uploader; -import com.coremedia.cms.editor.sdk.upload.FileWrapper; -import com.coremedia.ui.data.RemoteBean; -import com.coremedia.ui.data.RemoteBeanUtil; -import com.coremedia.ui.data.beanFactory; -import com.coremedia.ui.data.error.RemoteError; -import com.coremedia.ui.data.impl.BeanFactoryImpl; -import com.coremedia.ui.data.impl.RemoteService; -import com.coremedia.ui.data.impl.RemoteServiceMethod; -import com.coremedia.ui.data.impl.RemoteServiceMethodResponse; -import com.tallence.core.redirects.studio.data.PermissionResponse; -import com.tallence.core.redirects.studio.data.Redirect; -import com.tallence.core.redirects.studio.data.RedirectImpl; -import com.tallence.core.redirects.studio.data.RedirectImportResponse; -import com.tallence.core.redirects.studio.data.RedirectSourceParameter; -import com.tallence.core.redirects.studio.data.Redirects; -import com.tallence.core.redirects.studio.data.RedirectsResponse; -import com.tallence.core.redirects.studio.data.ValidationResponse; - -import ext.IPromise; -import ext.JSON; -import ext.ObjectUtil; -import ext.Promise; -import ext.StringUtil; -import ext.data.operation.ReadOperation; -import ext.util.Sorter; - -import js.XMLHttpRequest; - -import mx.resources.ResourceManager; - -/** - * Utility class for {@link Redirect}s. - */ -public class RedirectsUtil { - - private static const CREATE_URI_SEGMENT:String = "create"; - private static const DEFAULT_UPLOAD_SIZE:int = 67108864; - - /** - * Returns true, if the redirect the linked content is loaded. - * @param redirect the redirect. - * @return Boolean - */ - public static function redirectIsAccessible(redirect:Redirect):Boolean { - if (!redirect.isLoaded() && !RemoteBeanUtil.isAccessible(redirect)) { - return false; - } - - var targetLink:Content = redirect.getTargetLink(); - if (targetLink && !targetLink.isLoaded()) { - targetLink.load(); - return false; - } - return true; - } - - /** - * Creates a new {@link Redirect} with the given properties - */ - public static function createRedirect(siteId:String, active:Boolean, targetLink:Content, targetUrl: String, - description:String, source:String, sourceType:String, redirectType:String, - sourceParameters:Array, targetParameters:Array):void { - var rsm:RemoteServiceMethod = new RemoteServiceMethod("redirects/" + siteId + "/" + CREATE_URI_SEGMENT, "POST", true); - rsm.request({ - active: active, - targetLink: targetLink, - targetUrl: targetUrl, - description: description, - source: source, - sourceUrlType: sourceType, - redirectType: redirectType, - sourceParameters: sourceParameters, - targetParameters: targetParameters - }, - function success(rsmr:RemoteServiceMethodResponse):void { - NotificationUtil.showInfo(ResourceManager.getInstance().getString('com.tallence.core.redirects.studio.bundles.RedirectManagerStudioPlugin', 'redirectmanager_editor_actions_new_success_text')); - }, - function failure(rsmr:RemoteServiceMethodResponse):void { - NotificationUtil.showError(ResourceManager.getInstance().getString('com.tallence.core.redirects.studio.bundles.RedirectManagerStudioPlugin', 'redirectmanager_editor_actions_new_error_text') + rsmr.getError()); - } - ); - } - - /** - * Creates a promise that loads the redirects for the given site. As soon as all redirects are loaded, the result is - * returned by the promise. All redirect beans are already loaded. The beans of the redirect targets are not loaded - * and have to be loaded asynchronously if necessary. - * - * @param siteId the site id. - * @param searchText the search text. - * @param operation the read operation. - * @param exactMatch true if the path of the redirect for the search should match exactly - * @return The promise. Resolve method signature: function(response:RedirectsResponse):void - */ - public static function getRedirects(siteId:String, searchText:String, operation:ReadOperation, exactMatch:Boolean):IPromise { - if (!siteId || 0 === siteId.length) { - return Promise.resolve(new RedirectsResponse([], 0)); - } - - var bean:RemoteBean = beanFactory.getRemoteBean("redirects/" + siteId + getQueryParams(searchText, operation, exactMatch)); - - // A RemoteBean is used to load the redirects. Once a RemoteBean has been loaded, property data is cached. However, - // a new request should be sent to the server when the reload button of the grid is activated or after a redirect is - // created. To force reloading, the invalidate() method is used. The invalidation is also processed - // asynchronously, so that afterwards the remote bean can be reloaded. - return PromiseUtil - .invalidateRemoteBean(bean) - .then(PromiseUtil.loadRemoteBean) - .then(createRedirectsResponse); - } - - /** - * Converts the response of the remote bean request into a {@link RedirectsResponse}. - * - * @param redirects the loaded redirects remote bean. - * @return The promise. Resolve method signature: function(response:RedirectsResponse):void - */ - private static function createRedirectsResponse(redirects:Redirects):IPromise { - var response:RedirectsResponse = new RedirectsResponse(redirects.getItems(), redirects.getTotal()); - return Promise.resolve(response); - } - - - private static function getQueryParams(searchText:String, operation:ReadOperation, exactMatch:Boolean):String { - var limit:String = operation.getLimit().toString(); - var page:String = operation.getPage().toString(); - var sorters:Array = operation.getSorters(); - var sorter:String = sorters && sorters.length > 0 ? (sorters[0] as Sorter).getProperty() : RedirectImpl.SOURCE; - var sortDirection:String = sorters && sorters.length > 0 ? (sorters[0] as Sorter).getDirection() : "ASC"; - - var queryParams:Object = {}; - queryParams["page"] = page; - queryParams["pageSize"] = limit; - queryParams["sorter"] = sorter; - queryParams["sortDirection"] = sortDirection; - queryParams["search"] = searchText; - queryParams["exactMatch"] = exactMatch; - - return "?" + ObjectUtil.toQueryString(queryParams); - } - - /** - * Uploads a csv and imports all redirects. - * - * @param siteId the site id. - * @param fileWrapper the file - * @param success callback function for success - * @param error callback function for error - */ - public static function uploadRedirects(siteId:String, - fileWrapper:FileWrapper, - success:Function, - error:Function):void { - - var upldr:Uploader = new Uploader(Uploader({ - maxFileSize: DEFAULT_UPLOAD_SIZE, - timeout: 20000, - url: RemoteService.calculateRequestURI("redirects/" + siteId + "/upload"), - method: 'POST' - })); - - upldr.addListener('uploadcomplete', function (_uploader:Uploader, response:XMLHttpRequest):void { - BeanFactoryImpl.resolveBeans(JSON.decode(response.responseText)); - - //Hack for html4 upload. - if (response.status === 200) { - var importResponse:Object = JSON.decode(response.responseText); - var created:Array = BeanFactoryImpl.resolveBeans(importResponse.created) as Array; - success.call(null, new RedirectImportResponse(created, importResponse.errorMessages)); - } else { - error.call(null, response.statusText + ' (code ' + response.status + ')'); - } - }); - - upldr.addListener('uploadfailure', function (_uploader:Uploader, response:XMLHttpRequest):void { - try { - var result:RemoteError = new RemoteError(JSON.decode(response.responseText)); - error.call(null, result.message); - } catch (e:*) { - error.call(null, response.responseText); - } - }); - - var file:* = fileWrapper.getFile(); - upldr.upload(file); - } - - /** - * Creates a promise that validates a redirect and returns a validation result. - * - * @param siteId the site id. - * @param redirectId the redirect id. - * @param source the source. - * @param targetId the id of the target - * @param targetUrl the targetUrl - * @param active true, if the redirect is published - * @param sourceParameters a list of SourceUrlParameters - * - * @return The promise. Resolve method signature: function(response:ValidationResponse):void - */ - public static function validateRedirect(siteId:String, - redirectId:String, - source:String, - targetId:String, - targetUrl:String, - active:Boolean, - sourceParameters:Array):IPromise { - var urlTemplate:String = "/{0}/validate"; - - var joined:String = sourceParameters - .map(function (parameter:RedirectSourceParameter):Object { - return parameter.getParametersAsMap();}) - .map(function (map:Object):String { - return JSON.encodeValue(map); - }) - .map(encodeURIComponent) - .join(","); - - var params:Object = { - source: source, - redirectId: redirectId, - targetId: targetId, - targetUrl: targetUrl, - active: active, - sourceParameters: joined - }; - - var url:String = StringUtil.format(urlTemplate, siteId); - return PromiseUtil.getRequest("redirects" + url, params, ValidationResponse); - } - - /** - * Resolve the permissions for the redirects in the selected site. - */ - public static function resolvePermissions(siteId:String):IPromise { - if (!siteId || siteId == "") { - // if no site is selected, nothing may be edited - return Promise.resolve(new PermissionResponse()); - } - return PromiseUtil.getRequest("redirects/" + siteId + "/permissions", {}, PermissionResponse); - } - - -} -} diff --git a/core-redirects-studio-plugin/src/main/joo/manifest.xml b/core-redirects-studio-plugin/src/main/joo/manifest.xml deleted file mode 100644 index 1247aad..0000000 --- a/core-redirects-studio-plugin/src/main/joo/manifest.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/pom.xml b/pom.xml index cbdfea8..9b7c058 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,6 @@ core-redirects-cae core-redirects-contentfeeder core-redirects-studio-lib - core-redirects-studio-plugin