forked from geosolutions-it/geonode-mapstore-client
-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
(cherry picked from commit 9e79006) Co-authored-by: Suren <dsuren1@gmail.com>
- Loading branch information
1 parent
48eab71
commit 31f7b7b
Showing
19 changed files
with
337 additions
and
2 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
geonode_mapstore_client/client/js/plugins/Print/Author.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
55
geonode_mapstore_client/client/js/plugins/Print/Copyright.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.