forked from MapComplete/MapComplete
		
	Small fixes for the GRB theme and value substitution
This commit is contained in:
		
							parent
							
								
									328dc5577c
								
							
						
					
					
						commit
						71f4d4091e
					
				
					 17 changed files with 798 additions and 74 deletions
				
			
		|  | @ -74,9 +74,7 @@ export class Changes { | |||
|         const eventSource = State.state.allElements.getElement(elementId); | ||||
| 
 | ||||
|         eventSource.data[key] = value; | ||||
|         if(value === undefined || value === ""){ | ||||
|             delete eventSource.data[key]; | ||||
|         } | ||||
|         | ||||
|         eventSource.ping(); | ||||
|         // We get the id from the event source, as that ID might be rewritten
 | ||||
|         this._pendingChanges.push({elementId: eventSource.data.id, key: key, value: value}); | ||||
|  |  | |||
|  | @ -53,14 +53,14 @@ export class ChangesetHandler { | |||
|     private OpenChangeset(continuation: (changesetId: string) => void) { | ||||
| 
 | ||||
|         const layout = State.state.layoutToUse.data; | ||||
| 
 | ||||
|         const commentExtra = layout.changesetMessage !== undefined? " - "+layout.changesetMessage : ""; | ||||
|         this.auth.xhr({ | ||||
|             method: 'PUT', | ||||
|             path: '/api/0.6/changeset/create', | ||||
|             options: {header: {'Content-Type': 'text/xml'}}, | ||||
|             content: [`<osm><changeset>`, | ||||
|                 `<tag k="created_by" v="MapComplete ${State.vNumber}" />`, | ||||
|                 `<tag k="comment" v="Adding data with #MapComplete"/>`, | ||||
|                 `<tag k="comment" v="Adding data with #MapComplete for theme #${layout.name}${commentExtra}"/>`, | ||||
|                 `<tag k="theme" v="${layout.name}"/>`, | ||||
|                 layout.maintainer !== undefined ? `<tag k="theme-creator" v="${layout.maintainer}"/>` : "", | ||||
|                 `</changeset></osm>`].join("") | ||||
|  | @ -94,7 +94,7 @@ export class ChangesetHandler { | |||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     private CloseChangeset(changesetId: string, continuation: (() => void)) { | ||||
|     public CloseChangeset(changesetId: string, continuation: (() => void)) { | ||||
|         console.log("closing"); | ||||
|         this.auth.xhr({ | ||||
|             method: 'PUT', | ||||
|  | @ -112,7 +112,7 @@ export class ChangesetHandler { | |||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     private static parseUploadChangesetResponse(response: XMLDocument) { | ||||
|     public static parseUploadChangesetResponse(response: XMLDocument) { | ||||
|         const nodes = response.getElementsByTagName("node"); | ||||
|         const mapping = {}; | ||||
|         // @ts-ignore
 | ||||
|  |  | |||
|  | @ -24,8 +24,8 @@ export class OsmConnection { | |||
|     public userDetails: UIEventSource<UserDetails>; | ||||
|     private _dryRun: boolean; | ||||
| 
 | ||||
|     public _preferencesHandler: OsmPreferences; | ||||
|     private _changesetHandler: ChangesetHandler; | ||||
|     public preferencesHandler: OsmPreferences; | ||||
|     public changesetHandler: ChangesetHandler; | ||||
|      | ||||
|     private _onLoggedIn : ((userDetails: UserDetails) => void)[] = []; | ||||
| 
 | ||||
|  | @ -68,9 +68,9 @@ export class OsmConnection { | |||
|         this.userDetails.data.dryRun = dryRun; | ||||
|         this._dryRun = dryRun; | ||||
| 
 | ||||
|         this._preferencesHandler = new OsmPreferences(this.auth, this); | ||||
|         this.preferencesHandler = new OsmPreferences(this.auth, this); | ||||
|          | ||||
|         this._changesetHandler = new ChangesetHandler(dryRun, this.userDetails, this.auth); | ||||
|         this.changesetHandler = new ChangesetHandler(dryRun, this.userDetails, this.auth); | ||||
|         if (oauth_token.data !== undefined) { | ||||
|             console.log(oauth_token.data) | ||||
|             const self = this; | ||||
|  | @ -94,15 +94,15 @@ export class OsmConnection { | |||
|     public UploadChangeset(generateChangeXML: (csid: string) => string, | ||||
|                            handleMapping: (idMapping: any) => void, | ||||
|                            continuation: () => void) { | ||||
|         this._changesetHandler.UploadChangeset(generateChangeXML, handleMapping, continuation); | ||||
|         this.changesetHandler.UploadChangeset(generateChangeXML, handleMapping, continuation); | ||||
|     } | ||||
| 
 | ||||
|     public GetPreference(key: string, prefix: string = "mapcomplete-"): UIEventSource<string> { | ||||
|         return this._preferencesHandler.GetPreference(key, prefix); | ||||
|         return this.preferencesHandler.GetPreference(key, prefix); | ||||
|     } | ||||
| 
 | ||||
|     public GetLongPreference(key: string, prefix: string = "mapcomplete-"): UIEventSource<string> { | ||||
|         return this._preferencesHandler.GetLongPreference(key, prefix); | ||||
|         return this.preferencesHandler.GetLongPreference(key, prefix); | ||||
|     } | ||||
| 
 | ||||
|     public OnLoggedIn(action: (userDetails: UserDetails) => void){ | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue