-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added worldmap geoexplorer client source code. Fixes #265
- Loading branch information
Showing
3,177 changed files
with
609,593 additions
and
0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
FROM java:9-jdk | ||
MAINTAINER Wayner Barrios<wayner@piensa.co> | ||
# Install Ant | ||
|
||
ENV ANT_VERSION 1.9.4 | ||
RUN cd && \ | ||
wget -q http://archive.apache.org/dist/ant/binaries/apache-ant-${ANT_VERSION}-bin.tar.gz && \ | ||
tar -xzf apache-ant-${ANT_VERSION}-bin.tar.gz && \ | ||
mv apache-ant-${ANT_VERSION} /opt/ant && \ | ||
rm apache-ant-${ANT_VERSION}-bin.tar.gz | ||
|
||
ENV ANT_HOME /opt/ant | ||
#Adding ANT into bin | ||
ENV PATH ${PATH}:/opt/ant/bin | ||
|
||
RUN mkdir -p /usr/src/app | ||
WORKDIR /usr/src/app | ||
COPY . /usr/src/app | ||
EXPOSE 9090 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# GeoNode Client | ||
|
||
This is the javascript client part of GeoNode. | ||
|
||
|
||
## Debug Mode | ||
|
||
Loads all scripts uncompressed. | ||
|
||
ant init | ||
ant debug | ||
|
||
This will give you an application available at http://localhost:8080/ by | ||
default. You only need to run `ant init` once (or any time dependencies | ||
change). | ||
|
||
Note that http://localhost:8080/index.html is just a "Hello World" to | ||
see if everything is configured correctly. This project is not intended to run | ||
standalone. Instead, it is meant to be used by GeoNode. To make GeoNode use it | ||
instead of the static, minified JavaScript resources, make your GeoNode's | ||
src/GeoNodePy/geonode/local_settings.py point to it: | ||
|
||
GEONODE_CLIENT_LOCATION = "http://localhost:8080/" | ||
|
||
|
||
## Prepare App for Deployment | ||
|
||
To create a zip with the minified application run the following: | ||
|
||
ant zip | ||
|
||
The archive will be assembled in the build directory. GeoNode's | ||
setup_geonode_client paver task expects this zip to be available at | ||
http://dev.geonode.org/dev-data/geonode-client.zip for the master branch, and | ||
http://dev.geonode.org/dev-data/synth/geonode-client.zip for the synth branch. | ||
|
||
For now, since we don't have a post-commit hook yet that automatically updates | ||
these resources, if you are a core developer with access to dev.geonode.org, | ||
please copy the most recent geonode-client.zip to | ||
/var/www/dev.geonode.org/htdocs/dev-data/(synth/) after a commit. |
44 changes: 44 additions & 0 deletions
44
geonode/contrib/worldmap/src/geonode-client/app/autoloader.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// the autoloader injects scripts into the document dynamically | ||
// only suitable for development/debug mode | ||
|
||
var {Application} = require("stick"); | ||
var FS = require("fs"); | ||
var CONFIG = require("buildkit").config; | ||
var MERGE = require("buildkit").merge; | ||
|
||
var template = getResource("./templates/debug-loader.js").getContent(); | ||
|
||
var libLoader = function(section, order) { | ||
var paths = order.map(function(script) { | ||
return "'@" + "/" + script.root + "/" + script.path + "'"; | ||
}); | ||
var body = template.replace("{{paths}}", paths.join(",\n")); | ||
return function(env) { | ||
return { | ||
status: 200, | ||
headers: {"Content-Type": "text/javascript"}, | ||
body: [body] | ||
}; | ||
}; | ||
}; | ||
|
||
var App = function(config) { | ||
var sections = CONFIG.parse(config); | ||
var group, root, order; | ||
var app = Application(); | ||
app.configure("mount"); | ||
for (var section in sections) { | ||
group = sections[section]; | ||
order = MERGE.order(group); | ||
// mount lib loader for the section | ||
app.mount("/" + section, libLoader(section, order)); | ||
} | ||
// mount a script loader for all scripts | ||
var scriptLoader = Application(); | ||
scriptLoader.configure("static"); | ||
scriptLoader.static(FS.directory(config)); | ||
app.mount("/@", scriptLoader); | ||
return app; | ||
}; | ||
|
||
exports.App = App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
var {Application} = require("stick"); | ||
|
||
var app = Application(); | ||
app.configure("notfound", "error", "static", "params", "mount"); | ||
app.static(module.resolve("static"), "index.html"); | ||
app.mount("/proxy", require("./root/proxy").app); | ||
|
||
// debug mode loads unminified scripts | ||
// assumes markup pulls in scripts under the path /servlet_name/script/ | ||
var pathMappings; | ||
if (java.lang.System.getProperty("app.debug")) { | ||
var fs = require("fs"); | ||
var config = fs.normal(fs.join(module.directory, "..", "buildjs.cfg")); | ||
app.mount("/script/", require("./autoloader").App(config)); | ||
|
||
// path mappings for debug mode | ||
pathMappings = { | ||
"/externals/gxp/theme/": "/externals/gxp/src/theme/", | ||
"/theme/ux/colorpicker/": "/script/ux/colorpicker/", | ||
"/theme/ux/spinner/": "/script/ux/spinner/", | ||
"/theme/ux/fileuploadfield/": "/script/ux/fileuploadfield/css/" | ||
}; | ||
|
||
// proxy a remote geoserver on /geoserver by setting proxy.geoserver to remote URL | ||
// only recommended for debug mode | ||
var geoserver = java.lang.System.getProperty("app.proxy.geoserver"); | ||
if (geoserver) { | ||
if (geoserver.charAt(geoserver.length-1) !== "/") { | ||
geoserver = geoserver + "/"; | ||
} | ||
// debug specific proxy | ||
app.mount("/geoserver/", require("./root/proxy").pass({url: geoserver, preserveHost: true})); | ||
} | ||
} | ||
|
||
// Redirect requests for servlet name without a trailing slash. | ||
// Jetty does this automatically for /servlet_name, Tomcat does not. | ||
// Also rewrites requests to map directory structure for debug mode. | ||
function rewrite(app) { | ||
return function(request) { | ||
var servletRequest = request.env.servletRequest; | ||
|
||
function redirect(location) { | ||
var location = servletRequest.getScheme() + "://" + | ||
servletRequest.getServerName() + ":" + servletRequest.getServerPort() + | ||
location; | ||
return { | ||
status: 301, | ||
headers: {"Location": location}, | ||
body: [] | ||
}; | ||
} | ||
|
||
var uri = servletRequest.getRequestURI(); | ||
var pathInfo = servletRequest.getPathInfo(); | ||
if (pathInfo === "/") { | ||
if (uri.charAt(uri.length-1) !== "/") { | ||
return redirect(uri + "/"); | ||
} | ||
} | ||
if (pathMappings) { | ||
for (var p in pathMappings) { | ||
if (uri.indexOf(p) === 0) { | ||
return redirect(uri.replace(p, pathMappings[p])); | ||
} | ||
} | ||
} | ||
|
||
return app(request); | ||
}; | ||
} | ||
|
||
exports.app = rewrite(app); | ||
|
||
// main script to start application | ||
if (require.main === module) { | ||
require("ringo/httpserver").main(module.id); | ||
} |
139 changes: 139 additions & 0 deletions
139
geonode/contrib/worldmap/src/geonode-client/app/root/proxy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
var clientRequest = require("ringo/httpclient").request; | ||
var Headers = require("ringo/utils/http").Headers; | ||
var MemoryStream = require("io").MemoryStream; | ||
var objects = require("ringo/utils/objects"); | ||
var responseForStatus = require("../util").responseForStatus; | ||
|
||
var URL = java.net.URL; | ||
|
||
var app = exports.app = function(request) { | ||
var response; | ||
var url = request.queryParams.url; | ||
if (url) { | ||
response = proxyPass({ | ||
request: request, | ||
url: url | ||
}); | ||
} else { | ||
response = responseForStatus(400, "Request must contain url parameter."); | ||
} | ||
return response; | ||
}; | ||
|
||
var pass = exports.pass = function(config) { | ||
if (typeof config == "string") { | ||
config = {url: config}; | ||
} | ||
return function(request) { | ||
var query = request.queryString; | ||
var path = request.pathInfo && request.pathInfo.substring(1) || ""; | ||
var newUrl = config.url + path + (query ? "?" + query : ""); | ||
return proxyPass(objects.merge({ | ||
request: request, | ||
url: newUrl | ||
}, config)); | ||
}; | ||
}; | ||
|
||
var getUrlProps = exports.getUrlProps = function(url) { | ||
var o, props; | ||
try { | ||
o = new URL(url); | ||
} catch(err) { | ||
// pass | ||
} | ||
if (o) { | ||
var username, password; | ||
var userInfo = o.getUserInfo(); | ||
if (userInfo) { | ||
// this could potentially be removed if the following ticket is closed | ||
// https://github.com/ringo/ringojs/issues/issue/121 | ||
// but, it could make sense to keep it here as well | ||
[username, password] = userInfo.split(":"); | ||
url = url.replace(userInfo + "@", ""); | ||
} | ||
var port = o.getPort(); | ||
if (port < 0) { | ||
port = null; | ||
} | ||
props = { | ||
url: url, | ||
scheme: o.getProtocol(), | ||
username: username || null, | ||
password: password || null, | ||
host: o.getHost(), | ||
port: port, | ||
path: o.getPath() || "/", | ||
query: o.getQuery(), | ||
hash: o.getRef() | ||
}; | ||
} | ||
return props; | ||
}; | ||
|
||
var createProxyRequestProps = exports.createProxyRequestProps = function(config) { | ||
var props; | ||
var request = config.request; | ||
var url = config.url; | ||
var urlProps = getUrlProps(url); | ||
if (urlProps) { | ||
var headers = new Headers(objects.clone(request.headers)); | ||
if (!config.preserveHost) { | ||
headers.set("Host", urlProps.host + (urlProps.port ? ":" + urlProps.port : "")); | ||
} | ||
if (!config.allowAuth) { | ||
// strip authorization and cookie headers | ||
headers.unset("Authorization"); | ||
headers.unset("Cookie"); | ||
} | ||
var data; | ||
var method = request.method; | ||
if (method == "PUT" || method == "POST") { | ||
if (request.headers.get("content-length")) { | ||
data = request.input; | ||
} | ||
} | ||
props = { | ||
url: urlProps.url, | ||
method: request.method, | ||
scheme: urlProps.scheme, | ||
username: urlProps.username, | ||
password: urlProps.password, | ||
headers: headers, | ||
data: data | ||
}; | ||
} | ||
return props; | ||
}; | ||
|
||
function proxyPass(config) { | ||
var response; | ||
var outgoing = createProxyRequestProps(config); | ||
var incoming = config.request; | ||
if (!outgoing || outgoing.scheme !== incoming.scheme) { | ||
response = responseForStatus(400, "The url parameter value must be absolute url with same scheme as request."); | ||
} else { | ||
// re-issue request | ||
var exchange = clientRequest({ | ||
url: outgoing.url, | ||
method: outgoing.method, | ||
username: outgoing.username, | ||
password: outgoing.password, | ||
headers: outgoing.headers, | ||
data: outgoing.data, | ||
async: false | ||
}); | ||
} | ||
exchange.wait(); | ||
var headers = new Headers(objects.clone(exchange.headers)); | ||
if (!config.allowAuth) { | ||
// strip out authorization and cookie headers | ||
headers.unset("WWW-Authenticate"); | ||
headers.unset("Set-Cookie"); | ||
} | ||
return { | ||
status: exchange.status, | ||
headers: headers, | ||
body: new MemoryStream(exchange.contentBytes) | ||
}; | ||
} |
42 changes: 42 additions & 0 deletions
42
.../worldmap/src/geonode-client/app/static/externals/PrintPreview/examples/PrintPreview.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<html> | ||
<head> | ||
<title>Printing ux PrintPreview Example</title> | ||
|
||
<script type="text/javascript" src="http://extjs.cachefly.net/ext-3.2.1/adapter/ext/ext-base.js"></script> | ||
<script type="text/javascript" src="http://extjs.cachefly.net/ext-3.2.1/ext-all.js"></script> | ||
<link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-3.2.1/resources/css/ext-all.css" /> | ||
<link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-3.2.1/examples/shared/examples.css" /> | ||
<script src="http://dev.openlayers.org/nightly/OpenLayers.js"></script> | ||
<script type="text/javascript" src="../../../../geoext/lib/GeoExt.js"></script> | ||
|
||
<!-- script and css resources for this ux --> | ||
<script type="text/javascript" src="../lib/GeoExt.ux/PrintPreview.js"></script> | ||
<link rel="stylesheet" type="text/css" href="../resources/css/printpreview.css" /> | ||
|
||
<script type="text/javascript" src="PrintPreview.js"></script> | ||
|
||
<script type="text/javascript" src="http://demo.opengeo.org/geoserver/pdf/info.json?var=printCapabilities"></script> | ||
|
||
</head> | ||
<body> | ||
<h1>PrintPreview using GeoExt.data.PrintProvider</h1> | ||
|
||
<p>This example shows how to use GeoExt.data.PrintProvider to talk | ||
to the <a href="http://trac.mapfish.org/trac/mapfish/wiki/PrintModuleInstallation">Mapfish print module</a>, | ||
which also runs inside the | ||
<a href="http://docs.geoserver.org/stable/en/user/community/printing/">GeoServer printing module</a>.</p> | ||
|
||
<p>Use the "Print" button from the bottom toolbar of the map to open | ||
the print dialog.</p> | ||
|
||
<p>Note that this example uses GET requests to communicate with the | ||
print servlet (provided by the OpenGeo demo server). This saves us a | ||
proxy, but has limitations (URL length in Internet Explorer, and | ||
character encoding issues). For production use, the POST method is | ||
recommended.</p> | ||
|
||
<p>See <a href="PrintPreview.js">PrintPreview.js</a> for the source code.</p> | ||
|
||
<div id="content"></div> | ||
</body> | ||
</html> |
Oops, something went wrong.