Ability to share a particular map type

pull/1485/head
Piero Toffanin 2024-04-04 10:46:53 -04:00
rodzic 02b4132daa
commit c2c65a2cc2
4 zmienionych plików z 15 dodań i 6 usunięć

Wyświetl plik

@ -648,6 +648,7 @@ _('Example:'),
ref={(ref) => { this.shareButton = ref; }}
task={this.state.singleTask}
linksTarget="map"
queryParams={{t: this.props.mapType}}
/>
: ""}
<SwitchModeButton

Wyświetl plik

@ -12,7 +12,8 @@ class ShareButton extends React.Component {
static propTypes = {
task: PropTypes.object.isRequired,
linksTarget: PropTypes.oneOf(['map', '3d']).isRequired,
popupPlacement: PropTypes.string
popupPlacement: PropTypes.string,
queryParams: PropTypes.string
}
constructor(props){
@ -45,6 +46,7 @@ class ShareButton extends React.Component {
taskChanged={this.handleTaskChanged}
placement={this.props.popupPlacement}
linksTarget={this.props.linksTarget}
queryParams={this.props.queryParams}
/>;
return (

Wyświetl plik

@ -15,7 +15,8 @@ class SharePopup extends React.Component{
task: PropTypes.object.isRequired,
linksTarget: PropTypes.oneOf(['map', '3d']).isRequired,
placement: PropTypes.string,
taskChanged: PropTypes.func
taskChanged: PropTypes.func,
queryParams: PropTypes.object
};
static defaultProps = {
placement: 'top',
@ -38,7 +39,11 @@ class SharePopup extends React.Component{
}
getRelShareLink = () => {
return `/public/task/${this.props.task.id}/${this.props.linksTarget}/`;
let url = `/public/task/${this.props.task.id}/${this.props.linksTarget}/`;
if (this.props.queryParams){
url += Utils.toSearchQuery(this.props.queryParams);
}
return url;
}
componentDidMount(){
@ -86,8 +91,8 @@ class SharePopup extends React.Component{
}
render(){
const shareLink = Utils.absoluteUrl(this.state.relShareLink);
const iframeUrl = Utils.absoluteUrl(`public/task/${this.state.task.id}/iframe/${this.props.linksTarget}/`);
const shareLink = Utils.absoluteUrl(this.getRelShareLink());
const iframeUrl = Utils.absoluteUrl(`public/task/${this.state.task.id}/iframe/${this.props.linksTarget}/${Utils.toSearchQuery(this.props.queryParams)}`);
const iframeCode = `<iframe scrolling="no" title="WebODM" width="61.8033%" height="360" frameBorder="0" src="${iframeUrl}"></iframe>`;
return (<div onMouseDown={e => { e.stopPropagation(); }} className={"sharePopup " + this.props.placement}>

Wyświetl plik

@ -29,7 +29,8 @@ def handle_map(request, template, task_pk=None, hide_title=False):
'map-items': json.dumps([task.get_map_items()]),
'title': task.name if not hide_title else '',
'public': 'true',
'share-buttons': 'false' if settings.DESKTOP_MODE else 'true'
'share-buttons': 'false' if settings.DESKTOP_MODE else 'true',
'selected-map-type': request.GET.get('t', 'auto'),
}.items()
})