kopia lustrzana https://github.com/OpenDroneMap/WebODM
Merge pull request #1485 from pierotofy/autoperc
Ability to share particular map typepull/1497/head v2.4.2
commit
10a44851ac
|
@ -648,6 +648,7 @@ _('Example:'),
|
||||||
ref={(ref) => { this.shareButton = ref; }}
|
ref={(ref) => { this.shareButton = ref; }}
|
||||||
task={this.state.singleTask}
|
task={this.state.singleTask}
|
||||||
linksTarget="map"
|
linksTarget="map"
|
||||||
|
queryParams={{t: this.props.mapType}}
|
||||||
/>
|
/>
|
||||||
: ""}
|
: ""}
|
||||||
<SwitchModeButton
|
<SwitchModeButton
|
||||||
|
|
|
@ -12,7 +12,8 @@ class ShareButton extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
task: PropTypes.object.isRequired,
|
task: PropTypes.object.isRequired,
|
||||||
linksTarget: PropTypes.oneOf(['map', '3d']).isRequired,
|
linksTarget: PropTypes.oneOf(['map', '3d']).isRequired,
|
||||||
popupPlacement: PropTypes.string
|
popupPlacement: PropTypes.string,
|
||||||
|
queryParams: PropTypes.string
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props){
|
constructor(props){
|
||||||
|
@ -45,6 +46,7 @@ class ShareButton extends React.Component {
|
||||||
taskChanged={this.handleTaskChanged}
|
taskChanged={this.handleTaskChanged}
|
||||||
placement={this.props.popupPlacement}
|
placement={this.props.popupPlacement}
|
||||||
linksTarget={this.props.linksTarget}
|
linksTarget={this.props.linksTarget}
|
||||||
|
queryParams={this.props.queryParams}
|
||||||
/>;
|
/>;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -15,7 +15,8 @@ class SharePopup extends React.Component{
|
||||||
task: PropTypes.object.isRequired,
|
task: PropTypes.object.isRequired,
|
||||||
linksTarget: PropTypes.oneOf(['map', '3d']).isRequired,
|
linksTarget: PropTypes.oneOf(['map', '3d']).isRequired,
|
||||||
placement: PropTypes.string,
|
placement: PropTypes.string,
|
||||||
taskChanged: PropTypes.func
|
taskChanged: PropTypes.func,
|
||||||
|
queryParams: PropTypes.object
|
||||||
};
|
};
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
placement: 'top',
|
placement: 'top',
|
||||||
|
@ -38,7 +39,11 @@ class SharePopup extends React.Component{
|
||||||
}
|
}
|
||||||
|
|
||||||
getRelShareLink = () => {
|
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(){
|
componentDidMount(){
|
||||||
|
@ -86,8 +91,8 @@ class SharePopup extends React.Component{
|
||||||
}
|
}
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
const shareLink = Utils.absoluteUrl(this.state.relShareLink);
|
const shareLink = Utils.absoluteUrl(this.getRelShareLink());
|
||||||
const iframeUrl = Utils.absoluteUrl(`public/task/${this.state.task.id}/iframe/${this.props.linksTarget}/`);
|
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>`;
|
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}>
|
return (<div onMouseDown={e => { e.stopPropagation(); }} className={"sharePopup " + this.props.placement}>
|
||||||
|
|
|
@ -29,7 +29,8 @@ def handle_map(request, template, task_pk=None, hide_title=False):
|
||||||
'map-items': json.dumps([task.get_map_items()]),
|
'map-items': json.dumps([task.get_map_items()]),
|
||||||
'title': task.name if not hide_title else '',
|
'title': task.name if not hide_title else '',
|
||||||
'public': 'true',
|
'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()
|
}.items()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue