diff --git a/geonode_mapstore_client/client/js/plugins/Print/Author.jsx b/geonode_mapstore_client/client/js/plugins/Print/Author.jsx new file mode 100644 index 0000000000..fca3ec8518 --- /dev/null +++ b/geonode_mapstore_client/client/js/plugins/Print/Author.jsx @@ -0,0 +1,55 @@ +/* + * Copyright 2024, GeoSolutions Sas. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React, { useEffect } from "react"; +import { connect } from "react-redux"; +import get from "lodash/get"; + +import { createPlugin } from "@mapstore/framework/utils/PluginsUtils"; +import { setPrintParameter } from "@mapstore/framework/actions/print"; +import printReducer from "@mapstore/framework/reducers/print"; +import { TextInput } from "@mapstore/framework/plugins/print/TextInput"; +import { addTransformer } from "@mapstore/framework/utils/PrintUtils"; + +const authorTransformer = (state, spec) => { + return Promise.resolve({ + ...spec, + author: get(state, "print.spec.author", "") + }); +}; + +const Author = (props) => { + useEffect(() => { + addTransformer("author", authorTransformer, 6); + }, []); + return ; +}; + +export default createPlugin("PrintAuthor", { + component: connect( + (state) => ({ + spec: state.print?.spec || {}, + additionalProperty: false, + property: "author", + path: "", + label: "viewer.print.author", + placeholder: "viewer.print.authorPlaceholder" + }), + { + onChangeParameter: setPrintParameter + } + )(Author), + reducers: { print: printReducer }, + containers: { + Print: { + priority: 1, + target: "left-panel", + position: 6 + } + } +}); diff --git a/geonode_mapstore_client/client/js/plugins/Print/Copyright.jsx b/geonode_mapstore_client/client/js/plugins/Print/Copyright.jsx new file mode 100644 index 0000000000..ad5f317b55 --- /dev/null +++ b/geonode_mapstore_client/client/js/plugins/Print/Copyright.jsx @@ -0,0 +1,55 @@ +/* + * Copyright 2024, GeoSolutions Sas. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. + */ + +import React, { useEffect } from "react"; +import { connect } from "react-redux"; +import get from "lodash/get"; + +import { createPlugin } from "@mapstore/framework/utils/PluginsUtils"; +import { setPrintParameter } from "@mapstore/framework/actions/print"; +import printReducer from "@mapstore/framework/reducers/print"; +import { TextInput } from "@mapstore/framework/plugins/print/TextInput"; +import { addTransformer } from "@mapstore/framework/utils/PrintUtils"; + +const copyrightTransformer = (state, spec) => { + return Promise.resolve({ + ...spec, + copyright: get(state, "print.spec.copyright", "") + }); +}; + +const Copyright = (props) => { + useEffect(() => { + addTransformer("copyright", copyrightTransformer, 7); + }, []); + return ; +}; + +export default createPlugin("PrintCopyright", { + component: connect( + (state) => ({ + spec: state.print?.spec || {}, + additionalProperty: false, + property: "copyright", + path: "", + label: "viewer.print.copyright", + placeholder: "viewer.print.copyrightPlaceholder" + }), + { + onChangeParameter: setPrintParameter + } + )(Copyright), + reducers: { print: printReducer }, + containers: { + Print: { + priority: 1, + target: "left-panel", + position: 7 + } + } +}); diff --git a/geonode_mapstore_client/client/js/plugins/index.js b/geonode_mapstore_client/client/js/plugins/index.js index 6682f4007d..275a93ba49 100644 --- a/geonode_mapstore_client/client/js/plugins/index.js +++ b/geonode_mapstore_client/client/js/plugins/index.js @@ -441,6 +441,14 @@ export const plugins = { SettingsPlugin: toModulePlugin( 'Settings', () => import(/* webpackChunkName: 'plugins/settings' */ '@mapstore/framework/plugins/Settings') + ), + PrintAuthorPlugin: toModulePlugin( + 'PrintAuthor', + () => import(/* webpackChunkName: 'plugins/print-author' */ '@js/plugins/Print/Author') + ), + PrintCopyrightPlugin: toModulePlugin( + 'PrintCopyright', + () => import(/* webpackChunkName: 'plugins/print-copyright' */ '@js/plugins/Print/Copyright') ) }; diff --git a/geonode_mapstore_client/client/themes/geonode/less/ms-theme.less b/geonode_mapstore_client/client/themes/geonode/less/ms-theme.less index 0c5322dcd3..0a21da7272 100644 --- a/geonode_mapstore_client/client/themes/geonode/less/ms-theme.less +++ b/geonode_mapstore_client/client/themes/geonode/less/ms-theme.less @@ -394,3 +394,14 @@ div#mapstore-globalspinner { .glyphicon { top: 0; } + +.gn-viewer-layout-body { + #mapstore-print-panel { + &.modal-dialog { + margin: 4px 0; + } + .modal-body { + max-height: calc(100vh - 220px); + } + } +} \ No newline at end of file diff --git a/geonode_mapstore_client/static/mapstore/configs/localConfig.json b/geonode_mapstore_client/static/mapstore/configs/localConfig.json index eaafe5c714..302ae9865e 100644 --- a/geonode_mapstore_client/static/mapstore/configs/localConfig.json +++ b/geonode_mapstore_client/static/mapstore/configs/localConfig.json @@ -921,7 +921,6 @@ "name": "Print", "cfg": { "useFixedScales": true, - "mapWidth": 256, "outputFormatOptions": { "allowedFormats": [ { @@ -992,6 +991,22 @@ } } }, + { + "name": "PrintAuthor", + "override": { + "Print": { + "position": 6 + } + } + }, + { + "name": "PrintCopyright", + "override": { + "Print": { + "position": 7 + } + } + }, { "name": "ZoomIn", "override": { @@ -1934,7 +1949,6 @@ "name": "Print", "cfg": { "useFixedScales": true, - "mapWidth": 256, "outputFormatOptions": { "allowedFormats": [ { @@ -2005,6 +2019,22 @@ } } }, + { + "name": "PrintAuthor", + "override": { + "Print": { + "position": 6 + } + } + }, + { + "name": "PrintCopyright", + "override": { + "Print": { + "position": 7 + } + } + }, { "name": "ZoomAll", "override": { diff --git a/geonode_mapstore_client/static/mapstore/configs/pluginsConfig.json b/geonode_mapstore_client/static/mapstore/configs/pluginsConfig.json index 029139c9cb..de6726d6df 100644 --- a/geonode_mapstore_client/static/mapstore/configs/pluginsConfig.json +++ b/geonode_mapstore_client/static/mapstore/configs/pluginsConfig.json @@ -276,9 +276,83 @@ "title": "plugins.Print.title", "description": "plugins.Print.description", "dependencies": [ - "SidebarMenu" + "SidebarMenu", + "PrintScale", + "PrintAuthor", + "PrintCopyright" ] }, + { + "name": "PrintScale", + "override": { + "Print": { + "position": 4 + } + }, + "hidden": true + }, + { + "name": "PrintGraticule", + "override": { + "Print": { + "position": 5 + } + }, + "defaultConfig": { + "frame": 0.07, + "style": { + "color": "#000000", + "weight": 1, + "lineDash": [ + 0.5, + 4 + ], + "opacity": 0.5 + }, + "frameStyle": { + "color": "#000000", + "weight": 1, + "fillColor": "#FFFFFF" + }, + "labelXStyle": { + "color": "#000000", + "font": "sans-serif", + "fontWeight": "bold", + "fontSize": "20", + "labelOutlineColor": "#FFFFFF", + "labelOutlineWidth": 2 + }, + "labelYStyle": { + "color": "#000000", + "font": "sans-serif", + "fontWeight": "bold", + "fontSize": "20", + "labelOutlineColor": "#FFFFFF", + "labelOutlineWidth": 2, + "rotation": 90, + "verticalAlign": "top", + "textAlign": "center" + } + } + }, + { + "name": "PrintAuthor", + "override": { + "Print": { + "position": 6 + } + }, + "hidden": true + }, + { + "name": "PrintCopyright", + "override": { + "Print": { + "position": 7 + } + }, + "hidden": true + }, { "name": "MousePosition", "glyph": "mouse", diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.de-DE.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.de-DE.json index f7372db707..9d7c54b274 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.de-DE.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.de-DE.json @@ -155,6 +155,12 @@ }, "errors": { "noPermissions": "Sie sind nicht berechtigt eine GeoStory hinzuzufügen" + }, + "print": { + "author": "Autor", + "authorPlaceholder": "Geben Sie einen Autorennamen ein...", + "copyright": "Urheberrecht", + "copyrightPlaceholder": "Geben Sie ein Urheberrecht ein..." } }, "gnviewer": { diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.en-US.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.en-US.json index b72e353721..d0f02563cc 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.en-US.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.en-US.json @@ -155,6 +155,12 @@ }, "errors": { "noPermissions": "You dont have permissions to add a geostory" + }, + "print": { + "author": "Author", + "authorPlaceholder": "Enter an author name...", + "copyright": "Copyright", + "copyrightPlaceholder": "Enter a copyright..." } }, "gnviewer": { diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.es-ES.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.es-ES.json index e5cf541d76..3d0a54eaaa 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.es-ES.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.es-ES.json @@ -155,6 +155,12 @@ }, "errors": { "noPermissions": "No tienes permisos para agregar una geohistoria" + }, + "print": { + "author": "Autor", + "authorPlaceholder": "Ingrese un nombre de autor...", + "copyright": "Derechos de autor", + "copyrightPlaceholder": "Ingrese un derecho de autor..." } }, "gnviewer": { diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.fi-FI.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.fi-FI.json index d49a7d6b8a..da8854d83b 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.fi-FI.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.fi-FI.json @@ -153,6 +153,12 @@ }, "errors": { "noPermissions": "You dont have permissions to add a geostory" + }, + "print": { + "author": "Author", + "authorPlaceholder": "Enter an author name...", + "copyright": "Copyright", + "copyrightPlaceholder": "Enter a copyright..." } }, "gnviewer": { diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.fr-FR.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.fr-FR.json index 7663992622..3e5e588a35 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.fr-FR.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.fr-FR.json @@ -155,6 +155,12 @@ }, "errors": { "noPermissions": "Vous n'êtes pas autorisé à ajouter une geostory" + }, + "print": { + "author": "Auteur", + "authorPlaceholder": "Entrez un nom d'auteur...", + "copyright": "Droits d'auteur", + "copyrightPlaceholder": "Entrez des droits d'auteur..." } }, "gnviewer": { diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.hr-HR.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.hr-HR.json index c91bd0382e..090a504b24 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.hr-HR.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.hr-HR.json @@ -153,6 +153,12 @@ }, "errors": { "noPermissions": "You dont have permissions to add a geostory" + }, + "print": { + "author": "Author", + "authorPlaceholder": "Enter an author name...", + "copyright": "Copyright", + "copyrightPlaceholder": "Enter a copyright..." } }, "gnviewer": { diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.it-IT.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.it-IT.json index 5b2484bd75..346c0c53a0 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.it-IT.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.it-IT.json @@ -157,6 +157,12 @@ }, "errors": { "noPermissions": "Non hai i permessi per aggiungere una geostoria" + }, + "print": { + "author": "Autore", + "authorPlaceholder": "Inserisci il nome dell'autore...", + "copyright": "Copyright", + "copyrightPlaceholder": "Inserisci un copyright..." } }, "gnviewer": { diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.nl-NL.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.nl-NL.json index 2dddbec8d3..a4c50acf82 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.nl-NL.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.nl-NL.json @@ -153,6 +153,12 @@ }, "errors": { "noPermissions": "You dont have permissions to add a geostory" + }, + "print": { + "author": "Author", + "authorPlaceholder": "Enter an author name...", + "copyright": "Copyright", + "copyrightPlaceholder": "Enter a copyright..." } }, "gnviewer": { diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.pt-PT.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.pt-PT.json index e8137695ac..c583daad5f 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.pt-PT.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.pt-PT.json @@ -153,6 +153,12 @@ }, "errors": { "noPermissions": "You dont have permissions to add a geostory" + }, + "print": { + "author": "Author", + "authorPlaceholder": "Enter an author name...", + "copyright": "Copyright", + "copyrightPlaceholder": "Enter a copyright..." } }, "gnviewer": { diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.sk-SK.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.sk-SK.json index 6161d6bbf5..030ac9dc7e 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.sk-SK.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.sk-SK.json @@ -153,6 +153,12 @@ }, "errors": { "noPermissions": "You dont have permissions to add a geostory" + }, + "print": { + "author": "Author", + "authorPlaceholder": "Enter an author name...", + "copyright": "Copyright", + "copyrightPlaceholder": "Enter a copyright..." } }, "gnviewer": { diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.sv-SE.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.sv-SE.json index 6dff966ebd..0687368821 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.sv-SE.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.sv-SE.json @@ -154,6 +154,12 @@ }, "errors": { "noPermissions": "You dont have permissions to add a geostory" + }, + "print": { + "author": "Author", + "authorPlaceholder": "Enter an author name...", + "copyright": "Copyright", + "copyrightPlaceholder": "Enter a copyright..." } }, "gnviewer": { diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.vi-VN.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.vi-VN.json index da732bf1c5..b861b36c4e 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.vi-VN.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.vi-VN.json @@ -153,6 +153,12 @@ }, "errors": { "noPermissions": "You dont have permissions to add a geostory" + }, + "print": { + "author": "Author", + "authorPlaceholder": "Enter an author name...", + "copyright": "Copyright", + "copyrightPlaceholder": "Enter a copyright..." } }, "gnviewer": { diff --git a/geonode_mapstore_client/static/mapstore/gn-translations/data.zh-ZH.json b/geonode_mapstore_client/static/mapstore/gn-translations/data.zh-ZH.json index 3126e457cb..a18e10f82b 100644 --- a/geonode_mapstore_client/static/mapstore/gn-translations/data.zh-ZH.json +++ b/geonode_mapstore_client/static/mapstore/gn-translations/data.zh-ZH.json @@ -153,6 +153,12 @@ }, "errors": { "noPermissions": "You dont have permissions to add a geostory" + }, + "print": { + "author": "Author", + "authorPlaceholder": "Enter an author name...", + "copyright": "Copyright", + "copyrightPlaceholder": "Enter a copyright..." } }, "gnviewer": {