Skip to content

Commit

Permalink
Merge pull request #1 from geosolutions-it/master
Browse files Browse the repository at this point in the history
Description
  • Loading branch information
haoyunZhou authored Feb 26, 2018
2 parents cea73d3 + 283d06f commit 93c5f4e
Show file tree
Hide file tree
Showing 401 changed files with 16,442 additions and 2,515 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"no-multiple-empty-lines": [2, { // http://eslint.org/docs/rules/no-multiple-empty-lines
"max": 2
}],
"no-nested-ternary": 2, // http://eslint.org/docs/rules/no-nested-ternary
"no-nested-ternary": 0, // http://eslint.org/docs/rules/no-nested-ternary
"no-new-object": 2, // http://eslint.org/docs/rules/no-new-object
"no-spaced-func": 2, // http://eslint.org/docs/rules/no-spaced-func
"no-trailing-spaces": 2, // http://eslint.org/docs/rules/no-trailing-spaces
Expand Down
4 changes: 2 additions & 2 deletions .github_changelog_generator
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
future-release=2017.05.00
since-tag=2017.04.00
future-release=2018.01.00
since-tag=v2017.05.00
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Change Log

## [2018.01.00](https://github.com/geosolutions-it/MapStore2/tree/2018.01.00) (2018-01-29)
- **[Full Changelog](https://github.com/geosolutions-it/MapStore2/compare/v2017.05.00...2018.01.00)**

- **[Implemented enhancements](https://github.com/geosolutions-it/MapStore2/issues?q=is%3Aissue+milestone%3A%222018.01.00+Hardening%22+is%3Aclosed+label%3Aenhancement)**

- **[Fixed bugs](https://github.com/geosolutions-it/MapStore2/issues?q=is%3Aissue+milestone%3A%222018.01.00+Hardening%22+is%3Aclosed+label%3Abug)**

- **[Closed issues](https://github.com/geosolutions-it/MapStore2/issues?q=is%3Aissue+milestone%3A%222018.01.00+Hardening%22+is%3Aclosed)**



## [2017.05.00](https://github.com/geosolutions-it/MapStore2/tree/2017.05.00) (2017-10-25)
- **[Full Changelog](https://github.com/geosolutions-it/MapStore2/compare/2017.04.00...2017.05.00)**

Expand Down
47 changes: 47 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM tomcat:7.0.75
MAINTAINER geosolutions<info@geo-solutions.it>

RUN export DEBIAN_FRONTEND=noninteractive
ENV DEBIAN_FRONTEND noninteractive
RUN dpkg-divert --local --rename --add /sbin/initctl

# Set JAVA_HOME to /usr/lib/jvm/default-java and link it to OpenJDK installation
RUN ln -s /usr/lib/jvm/java-1.7.0-openjdk-amd64/ /usr/lib/jvm/default-java
ENV JAVA_HOME /usr/lib/jvm/default-java

# Install utilities
RUN apt-get -y update \
&& apt-get -y install vim \
&& rm -rf /var/lib/apt/lists/*

ENV RESOURCES_DIR="/tmp/resources/"
ADD docker/* "$RESOURCES_DIR"

# Tomcat specific stuff
ENV CATALINA_BASE "$CATALINA_HOME"
ENV JAVA_OPTS="${JAVA_OPTS} -Xms512m -Xmx512m -XX:MaxPermSize=128m"

# Optionally remove Tomcat manager, docs, and examples
ARG TOMCAT_EXTRAS=false
RUN if [ "$TOMCAT_EXTRAS" = false ]; then \
find "${CATALINA_BASE}/webapps/" -type f | xargs -L1 rm -f \
;fi

# Customize Tomcat
ARG INCLUDE_MS_WAR="false"
ENV INCLUDE_MS_WAR "${INCLUDE_MS_WAR}"
ARG APP_NAME=mapstore
RUN if [ "$INCLUDE_MS_WAR" = true ]; then \
mv "${RESOURCES_DIR}/mapstore.war" \
"${CATALINA_BASE}/webapps/${APP_NAME}.war"; \
fi;

# Geostore externalization template. Disabled by default
ADD docker/geostore-datasource-ovr.properties "${CATALINA_BASE}/conf/"
ARG GEOSTORE_OVR_OPT=""
ENV JAVA_OPTS="${JAVA_OPTS} ${GEOSTORE_OVR_OPT}"

# Set variable to better handle terminal commands
ENV TERM xterm

EXPOSE 8080
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[![Stories in Ready](https://badge.waffle.io/geosolutions-it/MapStore2.png?label=ready&title=Ready)](https://waffle.io/geosolutions-it/MapStore2)
[![Build Status](https://travis-ci.org/geosolutions-it/MapStore2.svg?branch=master)](https://travis-ci.org/geosolutions-it/MapStore2)
[![Coverage Status](https://coveralls.io/repos/geosolutions-it/MapStore2/badge.svg?branch=master&service=github)](https://coveralls.io/github/geosolutions-it/MapStore2?branch=master)
[![Codacy Badge](https://www.codacy.com/project/badge/1648d484427346e2877006dc287379b6)](https://www.codacy.com/app/simone-giannecchini/MapStore2)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/1648d484427346e2877006dc287379b6)](https://app.codacy.com/app/geosolutions/MapStore2?utm_source=github.com&utm_medium=referral&utm_content=geosolutions-it/MapStore2&utm_campaign=badger)
[![Inline docs](http://inch-ci.org/github/geosolutions-it/MapStore2.svg?branch=master)](http://inch-ci.org/github/geosolutions-it/MapStore2)
[![Twitter URL](https://img.shields.io/twitter/url/https/twitter.com/fold_left.svg?style=social&label=Follow%20%40mapstore2)](https://twitter.com/mapstore2)

Expand Down
38 changes: 32 additions & 6 deletions buildConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const NoEmitOnErrorsPlugin = require("webpack/lib/NoEmitOnErrorsPlugin");
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
const ParallelUglifyPlugin = require("webpack-parallel-uglify-plugin");

const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = (bundles, themeEntries, paths, extractThemesPlugin, prod, publicPath, cssPrefix) => ({
entry: assign({
'webpack-dev-server': 'webpack-dev-server/client?http://0.0.0.0:8081', // WebpackDevServer host and port
Expand All @@ -15,11 +15,15 @@ module.exports = (bundles, themeEntries, paths, extractThemesPlugin, prod, publi
output: {
path: paths.dist,
publicPath,
filename: "[name].js"
filename: "[name].js",
chunkFilename: prod ? "[name].[hash].chunk.js" : "[name].js"
},
plugins: [
new CopyWebpackPlugin([
{ from: path.join(paths.base, 'node_modules', 'bootstrap', 'less'), to: path.join(paths.dist, "bootstrap", "less") }
]),
new CopyWebpackPlugin([
{ from: path.join(paths.base, 'node_modules', 'react-nouislider', 'example'), to: path.join(paths.dist, "react-nouislider", "example") }
]),
new LoaderOptionsPlugin({
debug: !prod,
Expand All @@ -45,7 +49,24 @@ module.exports = (bundles, themeEntries, paths, extractThemesPlugin, prod, publi
new NormalModuleReplacementPlugin(/proj4$/, path.join(paths.framework, "libs", "proj4")),
new NoEmitOnErrorsPlugin(),
extractThemesPlugin
].concat(prod ? [new ParallelUglifyPlugin({
].concat(prod ? [new HtmlWebpackPlugin({
template: path.join(paths.framework, 'indexTemplate.html'),
chunks: ['mapstore2'],
inject: true,
hash: true
}), new HtmlWebpackPlugin({
template: path.join(paths.framework, 'embeddedTemplate.html'),
chunks: ['embedded'],
inject: true,
hash: true,
filename: 'embedded.html'
}), new HtmlWebpackPlugin({
template: path.join(paths.framework, 'apiTemplate.html'),
chunks: ['ms2-api'],
inject: 'head',
hash: true,
filename: 'api.html'
})] : []).concat(prod ? [new ParallelUglifyPlugin({
uglifyJS: {
sourceMap: false,
compress: {warnings: false},
Expand Down Expand Up @@ -129,15 +150,20 @@ module.exports = (bundles, themeEntries, paths, extractThemesPlugin, prod, publi
}],
include: paths.code
}
]
].concat(prod ? [{
test: /\.html$/,
loader: 'html-loader'
}] : [])
},
devServer: {
proxy: {
'/rest/geostore': {
target: "http://dev.mapstore2.geo-solutions.it/mapstore"
target: "https://dev.mapstore2.geo-solutions.it/mapstore",
secure: false
},
'/proxy': {
target: "http://dev.mapstore2.geo-solutions.it/mapstore"
target: "https://dev.mapstore2.geo-solutions.it/mapstore",
secure: false
},
'/docs': {
target: "http://localhost:8081",
Expand Down
2 changes: 2 additions & 0 deletions docker/geostore-datasource-ovr-h2.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
geostoreDataSource.url=jdbc:h2:./test
geostoreEntityManagerFactory.jpaPropertyMap[hibernate.hbm2ddl.auto]=update
24 changes: 24 additions & 0 deletions docker/geostore-datasource-ovr-postgres.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#Default Postgres Connection values, uncomment for using postgres
geostoreDataSource.driverClassName=org.postgresql.Driver
geostoreDataSource.url=jdbc:postgresql://postgres:5432/geostore
geostoreDataSource.username=geostore
geostoreDataSource.password=geostore
geostoreVendorAdapter.databasePlatform=org.hibernate.dialect.PostgreSQLDialect
geostoreEntityManagerFactory.jpaPropertyMap[hibernate.hbm2ddl.auto]=validate
geostoreEntityManagerFactory.jpaPropertyMap[hibernate.default_schema]=geostore
geostoreVendorAdapter.generateDdl=true
geostoreVendorAdapter.showSql=false

### USERS INITIALIZAZITION

## Sample users are "admin" and "user" (this is DEFAULT configuration, already set in the applicatioContext)
#geostoreInitializer.categoryListInitFile=classpath:sample_users.xml
## Use this form to point to an absoluthe file path
#geostoreInitializer.userListInitFile=file://path/to/your/file

### CATEGORIES INITIALIZATION

# A couple of sample categories. Use this XML file as template for yours. (this is DEFAULT configuration, already set in the applicatioContext)
#geostoreInitializer.categoryListInitFile=classpath:sample_categories.xml
## Use this form to point to an absoluthe file path
#geostoreInitializer.categoryListInitFile=file://path/to/your/file
24 changes: 24 additions & 0 deletions docker/geostore-datasource-ovr.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#Default Postgres Connection values, uncomment for using postgres
geostoreDataSource.driverClassName=org.postgresql.Driver
geostoreDataSource.url=jdbc:postgresql://postgres:5432/geostore
geostoreDataSource.username=geostore
geostoreDataSource.password=geostore
geostoreVendorAdapter.databasePlatform=org.hibernate.dialect.PostgreSQLDialect
geostoreEntityManagerFactory.jpaPropertyMap[hibernate.hbm2ddl.auto]=validate
geostoreEntityManagerFactory.jpaPropertyMap[hibernate.default_schema]=geostore
geostoreVendorAdapter.generateDdl=true
geostoreVendorAdapter.showSql=false

### USERS INITIALIZAZITION

## Sample users are "admin" and "user" (this is DEFAULT configuration, already set in the applicatioContext)
#geostoreInitializer.categoryListInitFile=classpath:sample_users.xml
## Use this form to point to an absoluthe file path
#geostoreInitializer.userListInitFile=file://path/to/your/file

### CATEGORIES INITIALIZATION

# A couple of sample categories. Use this XML file as template for yours. (this is DEFAULT configuration, already set in the applicatioContext)
#geostoreInitializer.categoryListInitFile=classpath:sample_categories.xml
## Use this form to point to an absoluthe file path
#geostoreInitializer.categoryListInitFile=file://path/to/your/file
26 changes: 26 additions & 0 deletions docker/wait-for-postgres.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
# wait-for-postgres.sh

set -e

host="$1"
shift
port="$1"
shift
user="$1"
shift
password="$1"
shift
cmd="$@"

export PGPASSWORD="$password"

set -x
until psql -h "$host" -p "$port" -U "$user" -c '\l'; do
>&2 echo "Postgres is unavailable - sleeping"
sleep 1
done

>&2 echo "Postgres is up - executing command"
exec $cmd

11 changes: 11 additions & 0 deletions docma-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@
"web/client/components/mapcontrols/mouseposition/MousePosition.jsx",
"web/client/components/notifications/NotificationContainer.jsx",
"web/client/components/buttons/ToggleButton.jsx",
"web/client/components/data/identify/GeocodeViewer.jsx",
"web/client/components/data/identify/IdentifyContainer.jsx",
"web/client/components/data/query/AutocompleteField.jsx",
"web/client/components/map/leaflet/DrawSupport.jsx",
"web/client/components/plugins/PluginsContainer.jsx",
Expand All @@ -120,9 +122,17 @@
"web/client/components/mapcontrols/annotations/AnnotationsConfig.js",
"web/client/components/misc/enhancers/emptyState.jsx",
"web/client/components/misc/enhancers/tooltip.jsx",
"web/client/components/misc/panels/Accordion.jsx",
"web/client/components/misc/panels/DockablePanel.jsx",
"web/client/components/misc/panels/DockPanel.jsx",
"web/client/components/misc/panels/PanelHeader.jsx",
"web/client/components/misc/sidebar/Sidebar.jsx",
"web/client/components/misc/toolbar/Toolbar.jsx",
"web/client/components/misc/EmptyView.jsx",
"web/client/components/misc/ResizableModal.jsx",
"web/client/components/TOC/TOCItemsSettings.jsx",
"web/client/components/TOC/fragments/settings/FeatureInfo.jsx",
"web/client/components/TOC/fragments/settings/FeatureInfoEditor.jsx",

"web/client/actions/index.jsdoc",
"web/client/actions/controls.js",
Expand Down Expand Up @@ -167,6 +177,7 @@

"web/client/utils/index.jsdoc",
"web/client/utils/CoordinatesUtils.js",
"web/client/utils/LocaleUtils.js",
"web/client/utils/PluginsUtils.js",
"web/client/utils/PrintUtils.js",
"web/client/utils/ogc/Filter/FilterBuilder.js",
Expand Down
24 changes: 0 additions & 24 deletions docs/developer-guide/add-new-language.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/developer-guide/developing-with-mapstore-2-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This section is about developing your own application using the MapStore2 framew
* [Code Conventions](code-conventions)
* [Developers FAQ](dev-faq)
* [How to customize the Theme](customize-theme)
* [How to add a new language](add-new-language)
* [internationalization](internationalization)

## Developing using plugins

Expand Down
72 changes: 72 additions & 0 deletions docs/developer-guide/internationalization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Introduction
MapStore2 offers the support for internationalization (I18N). To provide this functionality MapStore2 uses [react-intl](https://github.com/yahoo/react-intl).
In this section you can find which configuration and JS files are involved in the I18N system.

## How MapStore2 chooses the current language
MapStore2 first checks the browser's language. If it is not supported, MapStore2 will be visible in english, if present, or the first language available.
Anyway the locale can be forced using a flag locale=codeLang where codeLang can be one en,it,de...
e.g.
```
localhost:8081/?locale=en#/
```
A user can change the selected language from UI. MapStore2 will load the proper files to update the page localized in the selected language.

## Configuration files
To provide support to a specific language MapStore2 need to have the necessary setup in the LocaleUtils.js file (see below [section for details about to configure this file]).
In addition you need the proper translations files.

Let's imagine that the variable code is 'en', CODE is 'EN' standing for english. For each language you need to have **messages file** containing the localized strings, a **flag image** to identify the language and some **html fragments** (optional) for some specific plugins.
- Messages: located in `web\client\translations` folder. For each language there is a json file named data.code-CODE. e.g. `data.en-EN`.
- Flags: located in `web\client\components\I18N\images\flags` folder. For each language flag image named code-CODE.png of 16px x 11px is required.
- Fragments: actually only for cookies policy .... (required only if the Cookie plugin is present) located in `web\client\translations\fragments\cookie` folder and named cookieDetails-code-CODE.html. We recommend to add it for any language you want to support at least by copying the english version.

# How to configure supported languages in MapStore2
You can configure MapStore2 to provide to the user only a restricted list of selectable languages by setting "initialState.defaultState.locales" variable in `localConfig.json`. e.g :
```
"defaultState":
{
"locales": {
"en": {
code: "en-EN",
description: "English"
},
"it": {
code: "it-IT",
description: "Italiano"
}
}
}
```
Setting locales in localConfig.json file is doable only for supported locales present in LocaleUtils.js.
The default behaviour is to use those already configured in "supportedLocales" object.
You can customize the messages by editing the data.code-CODE files.

# How to add a new language
Let's say we want to add the russian language.
In order to add a new language to MapStore2 you need to follow these steps:

1. Update the localConfig.json file in `web\client` folder adding the new language entry
- add the following in the "initialState.defaultState.locales" object
```
"ru": {
code: "ru-RU",
description: "Pоссийский"
}
```
1. Update the LocaleUtils.js file in `web\client\utils`
- add a param in the ensureIntl() function like and the relative require
```
'intl/locale-data/jsonp/ru.js'
...
require('intl/locale-data/jsonp/ru.js');
```
- update the addLocaleData() call with the new locale obj i.e.
```
const ru = require('react-intl/locale-data/ru');
addLocaleData([...en, ...it, ...fr, ...de, ...es, ...ru]);
```
1. add the relative flag inside `web\client\components\I18N\images\flags` naming it ru-RU.png
1. add the russian translations inside `web\client\translations` naming it data.ru-RU (remember to change the locale property of this file into ru-RU)
1. create a fragment, related to the cookie module, inside `web\client\translations\fragments\cookie` naming it cookieDetails-ru-RU.html
Loading

0 comments on commit 93c5f4e

Please sign in to comment.