Skip to content

Commit 31f7b7b

Browse files
#1908: Update print plugins and configurations (#1929) (#1932)
(cherry picked from commit 9e79006) Co-authored-by: Suren <[email protected]>
1 parent 48eab71 commit 31f7b7b

File tree

19 files changed

+337
-2
lines changed

19 files changed

+337
-2
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright 2024, GeoSolutions Sas.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
import React, { useEffect } from "react";
10+
import { connect } from "react-redux";
11+
import get from "lodash/get";
12+
13+
import { createPlugin } from "@mapstore/framework/utils/PluginsUtils";
14+
import { setPrintParameter } from "@mapstore/framework/actions/print";
15+
import printReducer from "@mapstore/framework/reducers/print";
16+
import { TextInput } from "@mapstore/framework/plugins/print/TextInput";
17+
import { addTransformer } from "@mapstore/framework/utils/PrintUtils";
18+
19+
const authorTransformer = (state, spec) => {
20+
return Promise.resolve({
21+
...spec,
22+
author: get(state, "print.spec.author", "")
23+
});
24+
};
25+
26+
const Author = (props) => {
27+
useEffect(() => {
28+
addTransformer("author", authorTransformer, 6);
29+
}, []);
30+
return <TextInput {...props} />;
31+
};
32+
33+
export default createPlugin("PrintAuthor", {
34+
component: connect(
35+
(state) => ({
36+
spec: state.print?.spec || {},
37+
additionalProperty: false,
38+
property: "author",
39+
path: "",
40+
label: "viewer.print.author",
41+
placeholder: "viewer.print.authorPlaceholder"
42+
}),
43+
{
44+
onChangeParameter: setPrintParameter
45+
}
46+
)(Author),
47+
reducers: { print: printReducer },
48+
containers: {
49+
Print: {
50+
priority: 1,
51+
target: "left-panel",
52+
position: 6
53+
}
54+
}
55+
});
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright 2024, GeoSolutions Sas.
3+
* All rights reserved.
4+
*
5+
* This source code is licensed under the BSD-style license found in the
6+
* LICENSE file in the root directory of this source tree.
7+
*/
8+
9+
import React, { useEffect } from "react";
10+
import { connect } from "react-redux";
11+
import get from "lodash/get";
12+
13+
import { createPlugin } from "@mapstore/framework/utils/PluginsUtils";
14+
import { setPrintParameter } from "@mapstore/framework/actions/print";
15+
import printReducer from "@mapstore/framework/reducers/print";
16+
import { TextInput } from "@mapstore/framework/plugins/print/TextInput";
17+
import { addTransformer } from "@mapstore/framework/utils/PrintUtils";
18+
19+
const copyrightTransformer = (state, spec) => {
20+
return Promise.resolve({
21+
...spec,
22+
copyright: get(state, "print.spec.copyright", "")
23+
});
24+
};
25+
26+
const Copyright = (props) => {
27+
useEffect(() => {
28+
addTransformer("copyright", copyrightTransformer, 7);
29+
}, []);
30+
return <TextInput {...props} />;
31+
};
32+
33+
export default createPlugin("PrintCopyright", {
34+
component: connect(
35+
(state) => ({
36+
spec: state.print?.spec || {},
37+
additionalProperty: false,
38+
property: "copyright",
39+
path: "",
40+
label: "viewer.print.copyright",
41+
placeholder: "viewer.print.copyrightPlaceholder"
42+
}),
43+
{
44+
onChangeParameter: setPrintParameter
45+
}
46+
)(Copyright),
47+
reducers: { print: printReducer },
48+
containers: {
49+
Print: {
50+
priority: 1,
51+
target: "left-panel",
52+
position: 7
53+
}
54+
}
55+
});

geonode_mapstore_client/client/js/plugins/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,14 @@ export const plugins = {
450450
SettingsPlugin: toModulePlugin(
451451
'Settings',
452452
() => import(/* webpackChunkName: 'plugins/settings' */ '@mapstore/framework/plugins/Settings')
453+
),
454+
PrintAuthorPlugin: toModulePlugin(
455+
'PrintAuthor',
456+
() => import(/* webpackChunkName: 'plugins/print-author' */ '@js/plugins/Print/Author')
457+
),
458+
PrintCopyrightPlugin: toModulePlugin(
459+
'PrintCopyright',
460+
() => import(/* webpackChunkName: 'plugins/print-copyright' */ '@js/plugins/Print/Copyright')
453461
)
454462
};
455463

geonode_mapstore_client/client/themes/geonode/less/ms-theme.less

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,3 +394,14 @@ div#mapstore-globalspinner {
394394
.glyphicon {
395395
top: 0;
396396
}
397+
398+
.gn-viewer-layout-body {
399+
#mapstore-print-panel {
400+
&.modal-dialog {
401+
margin: 0;
402+
}
403+
.modal-body {
404+
max-height: calc(100vh - 220px);
405+
}
406+
}
407+
}

geonode_mapstore_client/static/mapstore/configs/localConfig.json

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -909,7 +909,6 @@
909909
"name": "Print",
910910
"cfg": {
911911
"useFixedScales": true,
912-
"mapWidth": 256,
913912
"outputFormatOptions": {
914913
"allowedFormats": [
915914
{
@@ -923,6 +922,14 @@
923922
{
924923
"value": "jpg",
925924
"name": "JPEG"
925+
},
926+
{
927+
"value": "gif",
928+
"name": "GIF"
929+
},
930+
{
931+
"value": "tiff",
932+
"name": "TIFF"
926933
}
927934
]
928935
}
@@ -980,6 +987,22 @@
980987
}
981988
}
982989
},
990+
{
991+
"name": "PrintAuthor",
992+
"override": {
993+
"Print": {
994+
"position": 6
995+
}
996+
}
997+
},
998+
{
999+
"name": "PrintCopyright",
1000+
"override": {
1001+
"Print": {
1002+
"position": 7
1003+
}
1004+
}
1005+
},
9831006
{
9841007
"name": "ZoomIn",
9851008
"override": {
@@ -1792,7 +1815,6 @@
17921815
"name": "Print",
17931816
"cfg": {
17941817
"useFixedScales": true,
1795-
"mapWidth": 256,
17961818
"outputFormatOptions": {
17971819
"allowedFormats": [
17981820
{
@@ -1806,6 +1828,14 @@
18061828
{
18071829
"value": "jpg",
18081830
"name": "JPEG"
1831+
},
1832+
{
1833+
"value": "gif",
1834+
"name": "GIF"
1835+
},
1836+
{
1837+
"value": "tiff",
1838+
"name": "TIFF"
18091839
}
18101840
]
18111841
}
@@ -1863,6 +1893,22 @@
18631893
}
18641894
}
18651895
},
1896+
{
1897+
"name": "PrintAuthor",
1898+
"override": {
1899+
"Print": {
1900+
"position": 6
1901+
}
1902+
}
1903+
},
1904+
{
1905+
"name": "PrintCopyright",
1906+
"override": {
1907+
"Print": {
1908+
"position": 7
1909+
}
1910+
}
1911+
},
18661912
{
18671913
"name": "ZoomAll",
18681914
"override": {

geonode_mapstore_client/static/mapstore/configs/pluginsConfig.json

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,90 @@
277277
"description": "plugins.Print.description",
278278
"dependencies": [
279279
"SidebarMenu"
280+
],
281+
"children": [
282+
"PrintScale",
283+
"PrintGraticule",
284+
"PrintAuthor",
285+
"PrintCopyright"
286+
],
287+
"autoEnableChildren": [
288+
"PrintScale",
289+
"PrintAuthor",
290+
"PrintCopyright"
280291
]
281292
},
293+
{
294+
"name": "PrintScale",
295+
"override": {
296+
"Print": {
297+
"position": 4
298+
}
299+
},
300+
"hidden": true
301+
},
302+
{
303+
"name": "PrintGraticule",
304+
"override": {
305+
"Print": {
306+
"position": 5
307+
}
308+
},
309+
"defaultConfig": {
310+
"frame": 0.07,
311+
"style": {
312+
"color": "#000000",
313+
"weight": 1,
314+
"lineDash": [
315+
0.5,
316+
4
317+
],
318+
"opacity": 0.5
319+
},
320+
"frameStyle": {
321+
"color": "#000000",
322+
"weight": 1,
323+
"fillColor": "#FFFFFF"
324+
},
325+
"labelXStyle": {
326+
"color": "#000000",
327+
"font": "sans-serif",
328+
"fontWeight": "bold",
329+
"fontSize": "20",
330+
"labelOutlineColor": "#FFFFFF",
331+
"labelOutlineWidth": 2
332+
},
333+
"labelYStyle": {
334+
"color": "#000000",
335+
"font": "sans-serif",
336+
"fontWeight": "bold",
337+
"fontSize": "20",
338+
"labelOutlineColor": "#FFFFFF",
339+
"labelOutlineWidth": 2,
340+
"rotation": 90,
341+
"verticalAlign": "top",
342+
"textAlign": "center"
343+
}
344+
}
345+
},
346+
{
347+
"name": "PrintAuthor",
348+
"override": {
349+
"Print": {
350+
"position": 6
351+
}
352+
},
353+
"hidden": true
354+
},
355+
{
356+
"name": "PrintCopyright",
357+
"override": {
358+
"Print": {
359+
"position": 7
360+
}
361+
},
362+
"hidden": true
363+
},
282364
{
283365
"name": "MousePosition",
284366
"glyph": "mouse",

geonode_mapstore_client/static/mapstore/gn-translations/data.de-DE.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@
155155
},
156156
"errors": {
157157
"noPermissions": "Sie sind nicht berechtigt eine GeoStory hinzuzufügen"
158+
},
159+
"print": {
160+
"author": "Autor",
161+
"authorPlaceholder": "Geben Sie einen Autorennamen ein...",
162+
"copyright": "Urheberrecht",
163+
"copyrightPlaceholder": "Geben Sie ein Urheberrecht ein..."
158164
}
159165
},
160166
"gnviewer": {

geonode_mapstore_client/static/mapstore/gn-translations/data.en-US.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@
155155
},
156156
"errors": {
157157
"noPermissions": "You dont have permissions to add a geostory"
158+
},
159+
"print": {
160+
"author": "Author",
161+
"authorPlaceholder": "Enter an author name...",
162+
"copyright": "Copyright",
163+
"copyrightPlaceholder": "Enter a copyright..."
158164
}
159165
},
160166
"gnviewer": {

geonode_mapstore_client/static/mapstore/gn-translations/data.es-ES.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@
155155
},
156156
"errors": {
157157
"noPermissions": "No tienes permisos para agregar una geohistoria"
158+
},
159+
"print": {
160+
"author": "Autor",
161+
"authorPlaceholder": "Ingrese un nombre de autor...",
162+
"copyright": "Derechos de autor",
163+
"copyrightPlaceholder": "Ingrese un derecho de autor..."
158164
}
159165
},
160166
"gnviewer": {

geonode_mapstore_client/static/mapstore/gn-translations/data.fi-FI.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,12 @@
153153
},
154154
"errors": {
155155
"noPermissions": "You dont have permissions to add a geostory"
156+
},
157+
"print": {
158+
"author": "Author",
159+
"authorPlaceholder": "Enter an author name...",
160+
"copyright": "Copyright",
161+
"copyrightPlaceholder": "Enter a copyright..."
156162
}
157163
},
158164
"gnviewer": {

0 commit comments

Comments
 (0)