Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1908: Update print plugins and configurations #1929

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions geonode_mapstore_client/client/js/plugins/Print/Author.jsx
Original file line number Diff line number Diff line change
@@ -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 <TextInput {...props} />;
};

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
}
}
});
55 changes: 55 additions & 0 deletions geonode_mapstore_client/client/js/plugins/Print/Copyright.jsx
Original file line number Diff line number Diff line change
@@ -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 <TextInput {...props} />;
};

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
}
}
});
8 changes: 8 additions & 0 deletions geonode_mapstore_client/client/js/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')
)
};

Expand Down
11 changes: 11 additions & 0 deletions geonode_mapstore_client/client/themes/geonode/less/ms-theme.less
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
34 changes: 32 additions & 2 deletions geonode_mapstore_client/static/mapstore/configs/localConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,6 @@
"name": "Print",
"cfg": {
"useFixedScales": true,
"mapWidth": 256,
"outputFormatOptions": {
"allowedFormats": [
{
Expand Down Expand Up @@ -992,6 +991,22 @@
}
}
},
{
"name": "PrintAuthor",
"override": {
"Print": {
"position": 6
}
}
},
{
"name": "PrintCopyright",
"override": {
"Print": {
"position": 7
}
}
},
{
"name": "ZoomIn",
"override": {
Expand Down Expand Up @@ -1934,7 +1949,6 @@
"name": "Print",
"cfg": {
"useFixedScales": true,
"mapWidth": 256,
"outputFormatOptions": {
"allowedFormats": [
{
Expand Down Expand Up @@ -2005,6 +2019,22 @@
}
}
},
{
"name": "PrintAuthor",
"override": {
"Print": {
"position": 6
}
}
},
{
"name": "PrintCopyright",
"override": {
"Print": {
"position": 7
}
}
},
{
"name": "ZoomAll",
"override": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
Loading
Loading