planetfederal / gxp

High level components for GeoExt based applications.
http://boundlessgeo.com/
Other
84 stars 97 forks source link

make the embed map dialog a true gxp.plugin #163

Open bartvde opened 12 years ago

bartvde commented 12 years ago

See the discussion here with @ahocevar on IRC:

bartvde
hey ahocevar wrt the embed window suggestion you did, I am guessing this will involve more changes than only make the embedWindow an API Property since the content of the dialog is different based on the map's id
unless all dialogs have some function to update the mapId of the dialog
9:30
ahocevar
bartvde: where is the mapId needed?

9:31
bartvde
in GeoExplorer it reads:        var embedMap = new gxp.EmbedMapDialog({ id: 'geobuilder-1',    url: "../viewer/#maps/" + this.id}); ahocevar
so it creates a new window all the time
9:32
ahocevar
bartvde: but isn't that just for the copy/paste link?

9:32
bartvde
right
the link for the iframe
9:35
ahocevar
bartvde: so we cannot just have a static configuration for the embed window.

9:35
bartvde
right ahocevar

9:36
ahocevar
unless we take the id from the current browser window

9:37
bartvde
can you elaborate on that though ahocevar?
we would need a reference to the gxp.EmbedMapDialog and a public method to update the url in there as well
9:38
ahocevar
bartvde: take window.location.href should have the id by the time this copy/paste window is shown

9:38
bartvde
geonode does not update the href
we return false in beforehashchange

9:38
ahocevar
couldn't the dialog just listen for the idchange event (or whatever that event is called)?

9:39
bartvde
you mean the save event?

9:39
ahocevar
yeah.

9:40
bartvde
and then we would need a public method in the EmbedMapDialog to update the url as well, since it's currently private
i.e. updateSnippet
9:41
ahocevar
bartvde: isn't the EmbedMap dialog created by the embed window every time it is needed?

9:41
ahocevar
So only the embed window needs to know.

9:41
bartvde
yeah sure we could recreate the window like we do now true

9:42
ahocevar
then the embedwindow could even be a gxp plugin

9:42
bartvde
so the app would recreate embedWindow everytime save is called?
i.e. save is called and the id is different than the previous one

9:42
ahocevar
no - embedWindow would listen for the save event on the target, so it can create the correct EmbedMap dialog when it is needed.
only the copy/paste dialog is recreated.

9:44
bartvde
okay so if it would be a gxp.plugin, how would GeoNode influence the dialog?
9:44
ahocevar
bartvde: it would get a different plugin instead.

9:44
ahocevar
When you hook into loadConfig with the event I suggested, you can easily do that.

9:44
bartvde
okay true
so it would take out the current plugin and put in its own
9:45
ahocevar
bartvde: you could even configure the viewer with the embedWindow ptype - that would even be smarter.

9:45
bartvde
right indeed ahocevar
I am gonna ticket this one now, since it's a bit more work than I have time for now, but will place a TODO in the geonode code
and remove the api signature in GeoExplorer

9:46
ahocevar
cool. I hope this is not too much effort.
because I
'd really like to have this

9:47
bartvde
9:47
right, agreed