geoadmin/mf-geoadmin3 — pull request #1111 by gjn (2014-02-12 13:33:32+00:00)
Title: WORK IN PROGRESS: Managin global variables - take 2

This PR is based on https://github.com/geoadmin/mf-geoadmin3/pull/1093 and the discussion this morning. I managed to reduce the number of variables needed to configure the application. Maybe I'm missing a use case, but here's what's working in this branch.

Variables used to configure the build (rc files)
- `API_URL` is the chsdi url used. It should be scheme agnostic. If you want to tap a specific instance, just add it to the path. There's no trailing slash. Sample: `//mf-chsdi3.dev.bgdi.ch/ltjeg`, default: `//mf-chsdi3.dev.bgdi.ch`.
- `APACHE_BASE_PATH` is the path to access your dev environemnt. There are no slashes before or after. Sample: `ltgal`, defaults to user id executing the make command. This should never be empty or `main` during your development!

Changing the above variables requires a new make and an apache restart!

There are 4 new global variables that should be used to construct your urls. Note that there should never be a need to prefix these variables with anything (like scheme or slashes). They don't have a trailing slash:
- `gaGlobalOptions.apiUrl` : contains the chsdi instance to tap for services that have to use it directly (like post requests). This corresponds to the API_URL from above, prefixed with the correct scheme. You have to use jsonp to access services from this URL (IE9 CORS troubles)
- `gaGlobalOptions.mapUrl`: contains the base url of the instance that is not versioned. Use this to construct url to access services that will not be cached.
- `gaGlobalOptions.cachedMapUrl`: contains the base url for versioned and therefore cached resources.
- `gaGlobalOptions.ogcproxyUrl`: contains the ogxProxyUrl

I think I have adapted all code to use the above variables.

To see where the above variables are used, git grep is your friend.

TODOS:
- switch to jsonp? (IMO not needed)
- test in main environment
- adapt examples