Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Up master with 2.2 #3541

Merged
merged 16 commits into from
Feb 19, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ transifex-init: .build/python-venv/bin/tx \
.PRECIOUS: .build/locale/%/LC_MESSAGES/demo.po
.build/locale/%/LC_MESSAGES/demo.po:
mkdir -p $(dir $@)
wget -O $@ https://raw.githubusercontent.com/camptocamp/demo_geomapfish/master/geoportal/demo_geoportal/locale/$*/LC_MESSAGES/demo_geoportal-client.po
wget -O $@ https://raw.githubusercontent.com/camptocamp/demo_geomapfish/2.2/demo/locale/$*/LC_MESSAGES/demo-client.po

contribs/gmf/build/gmf-%.json: \
.build/locale/%/LC_MESSAGES/ngeo.po \
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/examples/authentication.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
This example shows how to use the <code>gmf-authentication</code>
directive to insert an authentication panel in a GeoMapFish page.
</p>
<gmf-authentication></gmf-authentication>
<gmf-authentication gmf-authentication-force-password-change="true"></gmf-authentication>
</body>
</html>
8 changes: 8 additions & 0 deletions contribs/gmf/externs/gmf-themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,14 @@ gmfThemes.GmfMetaData.prototype.isChecked;
*/
gmfThemes.GmfMetaData.prototype.isExpanded;

/**
* Whether the print should rotate the symbols.
* Default to true.
* For layer groups (only).
* @type {boolean|undefined}
*/
gmfThemes.GmfMetaData.prototype.printNativeAngle;


/**
* Whether the legend is expanded by default.
Expand Down
94 changes: 50 additions & 44 deletions contribs/gmf/src/authentication/component.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,32 @@
ng-click="$ctrl.changePasswordReset()" />
</div>
</form>
</div>

<ngeo-modal ng-model="$ctrl.changePasswordModalShown">
<div class="modal-header">
<button type="button"
class="close"
data-dismiss="modal"
aria-label="{{'Close' | translate}}">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">
{{'Password Changed' | translate}}
</h4>
</div>
<div class="modal-body">
{{'Your password has succesfully been changed.' | translate}}
</div>
<div class="modal-footer">
<button type="button"
class="btn btn-default"
data-dismiss="modal">{{'OK' | translate}}</button>
</div>
</ngeo-modal>
<ngeo-modal
ngeo-modal-destroy-content-on-hide="true"
ng-model="authCtrl.changePasswordModalShown">
<div class="modal-header">
<button type="button"
class="close"
data-dismiss="modal"
aria-label="{{'Close' | translate}}">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">
{{'Password Changed' | translate}}
</h4>
</div>
<div class="modal-body">
{{'Your password has succesfully been changed.' | translate}}
</div>
<div class="modal-footer">
<button type="button"
class="btn btn-default"
data-dismiss="modal">{{'OK' | translate}}</button>
</div>
</ngeo-modal>

</div>

<div ng-if="!$ctrl.gmfUser.username">
<form
Expand Down Expand Up @@ -138,26 +141,29 @@ <h4 class="modal-title">
href="">{{'Password forgotten?' | translate}}</a>
</div>
</form>
</div>

<ngeo-modal ng-model="$ctrl.resetPasswordModalShown">
<div class="modal-header">
<button type="button"
class="close"
data-dismiss="modal"
aria-label="{{'Close' | translate}}">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">
{{'Password forgotten?' | translate}}
</h4>
</div>
<div class="modal-body" translate>
A new password has just been sent to you by e-mail.
</div>
<div class="modal-footer">
<button type="button"
class="btn btn-default"
data-dismiss="modal">{{'OK' | translate}}</button>
</div>
</ngeo-modal>
<ngeo-modal
ngeo-modal-destroy-content-on-hide="true"
ng-model="authCtrl.resetPasswordModalShown">
<div class="modal-header">
<button type="button"
class="close"
data-dismiss="modal"
aria-label="{{'Close' | translate}}">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title">
{{'Password forgotten?' | translate}}
</h4>
</div>
<div class="modal-body" translate>
A new password has just been sent to you by e-mail.
</div>
<div class="modal-footer">
<button type="button"
class="btn btn-default"
data-dismiss="modal">{{'OK' | translate}}</button>
</div>
</ngeo-modal>

</div>
12 changes: 7 additions & 5 deletions contribs/gmf/src/authentication/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ gmf.authentication.component.AuthenticationController_ = class {
*/
this.newPwdConfVal = '';

ol.events.listen(gmfAuthenticationService, 'ready', this.onLoginReady_.bind(this));
ol.events.listen(gmfAuthenticationService, 'ready', this.onUserChange_.bind(this));
}

/**
Expand Down Expand Up @@ -294,7 +294,10 @@ gmf.authentication.component.AuthenticationController_ = class {
} else {
const error = gettextCatalog.getString('Incorrect username or password.');
this.gmfAuthenticationService_.login(this.loginVal, this.pwdVal).then(
this.resetError_.bind(this),
() => {
this.resetError_();
this.onUserChange_();
},
this.setError_.bind(this, error));
}
}
Expand Down Expand Up @@ -356,11 +359,10 @@ gmf.authentication.component.AuthenticationController_ = class {


/**
* @param {gmfx.AuthenticationEvent} e GMF Authentication event.
* @private
*/
onLoginReady_(e) {
if (e.detail.user.is_password_changed === false && this.forcePasswordChange) {
onUserChange_() {
if (this.gmfUser.is_password_changed === false && this.forcePasswordChange) {
const gettextCatalog = this.gettextCatalog;
const msg = gettextCatalog.getString('You must change your password.');
this.notification_.notify({
Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/src/backgroundlayerselector/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ gmf.backgroundlayerselector.component.Controller_.prototype.$onInit = function()
* @private
*/
gmf.backgroundlayerselector.component.Controller_.prototype.handleThemesChange_ = function() {
this.gmfThemes_.getBgLayers(this.dimensions).then((layers) => {
this.gmfThemes_.getBgLayers().then((layers) => {
this.bgLayers = layers;
});
};
Expand Down
4 changes: 2 additions & 2 deletions contribs/gmf/src/controllers/AbstractAppController.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ gmf.controllers.AbstractAppController = function(config, $scope, $injector) {
* @private
*/
this.updateCurrentBackgroundLayer_ = function(skipPermalink) {
this.gmfThemes_.getBgLayers(this.dimensions).then((layers) => {
this.gmfThemes_.getBgLayers().then((layers) => {
let background;
if (!skipPermalink) {
// get the background from the permalink
Expand Down Expand Up @@ -645,7 +645,7 @@ gmf.controllers.AbstractAppController.prototype.initLanguage = function() {
* @private
*/
gmf.controllers.AbstractAppController.prototype.setDefaultBackground_ = function(theme) {
this.gmfThemes_.getBgLayers(this.dimensions).then((layers) => {
this.gmfThemes_.getBgLayers().then((layers) => {
let layer;

// get the background from the permalink
Expand Down
7 changes: 7 additions & 0 deletions contribs/gmf/src/layertree/SyncLayertreeMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@ gmf.layertree.SyncLayertreeMap.prototype.createGroup_ = function(treeCtrl, map,
let layer = null;
const isFirstLevelGroup = treeCtrl.parent.isRoot;

let printNativeAngle = true;
if (groupNode.metadata.printNativeAngle !== undefined) {
printNativeAngle = groupNode.metadata.printNativeAngle;
}

if (isFirstLevelGroup) { // First level group
layer = this.createLayerFromGroup_(treeCtrl, !!groupNode.mixed);
// Insert the layer at the right place
Expand All @@ -182,6 +187,8 @@ gmf.layertree.SyncLayertreeMap.prototype.createGroup_ = function(treeCtrl, map,
layerGroup.getLayers().insertAt(0, layer);
}
}

layer.set('printNativeAngle', printNativeAngle);
return layer;
};

Expand Down
12 changes: 11 additions & 1 deletion contribs/gmf/src/print/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ goog.require('ngeo.print.Service');
goog.require('ngeo.print.Utils');
goog.require('ngeo.query.MapQuerent');
goog.require('ol.array');
goog.require('ol.layer.Image');
goog.require('ol.layer.Tile');
goog.require('ol.layer.Group');
goog.require('ol.Observable');
Expand Down Expand Up @@ -833,6 +834,7 @@ gmf.print.component.Controller_ = class {
map.setView(this.map.getView());
const ol_layers = this.ngeoLayerHelper_.getFlatLayers(this.map.getLayerGroup());
const new_ol_layers = [];
let print_native_angle = true;
for (let i = 0, ii = ol_layers.length; i < ii; i++) {
let layer = ol_layers[i];
const metadata = layer.get('metadata');
Expand All @@ -853,10 +855,18 @@ gmf.print.component.Controller_ = class {
}
}
}

// Get the print native angle parameter for WMS layers when set to not use default value
// Is applied only once when the value is overridden with a metadata from administration
if (layer instanceof ol.layer.Image && layer.get('printNativeAngle') === false) {
print_native_angle = false;
}

new_ol_layers.push(layer);
}
map.setLayerGroup(new ol.layer.Group({
layers: new_ol_layers
layers: new_ol_layers,
'printNativeAngle': print_native_angle
}));

const spec = this.ngeoPrint_.createSpec(map, scale, this.layoutInfo.dpi,
Expand Down
12 changes: 5 additions & 7 deletions contribs/gmf/src/query/gridComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ gmf.query.gridComponent.component_ = {
'removeEmptyColumnsFn': '&?gmfDisplayquerygridRemoveemptycolumns',
'maxResultsFn': '&?gmfDisplayquerygridMaxresults',
'maxRecenterZoomFn': '&?gmfDisplayquerygridMaxrecenterzoom',
'mergeTabsFn': '&?gmfDisplayquerygridMergetabs'
'mergeTabs': '<?gmfDisplayquerygridMergetabs'
},
templateUrl: gmfDisplayquerygridTemplateUrl
};
Expand Down Expand Up @@ -231,9 +231,8 @@ gmf.query.gridComponent.Controller_ = function($injector, $scope, ngeoQueryResul

/**
* @type {!gmfx.GridMergeTabs}
* @private
*/
this.mergeTabs_ = {};
this.mergeTabs = {};

/**
* A mapping between row uid and the corresponding feature for each
Expand Down Expand Up @@ -301,7 +300,6 @@ gmf.query.gridComponent.Controller_ = function($injector, $scope, ngeoQueryResul
gmf.query.gridComponent.Controller_.prototype.$onInit = function() {
this.removeEmptyColumns_ = this['removeEmptyColumnsFn'] ? this['removeEmptyColumnsFn']() === true : false;
this.maxRecenterZoom = this['maxRecenterZoomFn'] ? this['maxRecenterZoomFn']() : undefined;
this.mergeTabs_ = this['mergeTabsFn'] ? this['mergeTabsFn']() : {};

const featuresOverlay = this.ngeoFeatureOverlayMgr_.getFeatureOverlay();
featuresOverlay.setFeatures(this.features_);
Expand Down Expand Up @@ -370,7 +368,7 @@ gmf.query.gridComponent.Controller_.prototype.updateData_ = function() {
this.pending = false;
let sources = this.ngeoQueryResult.sources;
// merge sources if requested
if (Object.keys(this.mergeTabs_).length > 0) {
if (Object.keys(this.mergeTabs).length > 0) {
sources = this.getMergedSources_(sources);
}

Expand Down Expand Up @@ -487,8 +485,8 @@ gmf.query.gridComponent.Controller_.prototype.getMergedSources_ = function(sourc
gmf.query.gridComponent.Controller_.prototype.getMergedSource_ = function(source, mergedSources) {
let mergeSourceId = null;

for (const currentMergeSourceId in this.mergeTabs_) {
const sourceLabels = this.mergeTabs_[currentMergeSourceId];
for (const currentMergeSourceId in this.mergeTabs) {
const sourceLabels = this.mergeTabs[currentMergeSourceId];
const containsSource = sourceLabels.some(sourceLabel => sourceLabel == source.label);
if (containsSource) {
mergeSourceId = currentMergeSourceId;
Expand Down
3 changes: 1 addition & 2 deletions contribs/gmf/src/theme/Themes.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,9 @@ gmf.theme.Themes.getFlatNodes = function(node, nodes) {

/**
* Get background layers.
* @param {!Object.<string, string>} appDimensions Dimensions.
* @return {!angular.$q.Promise.<!Array.<!ol.layer.Base>>} Promise.
*/
gmf.theme.Themes.prototype.getBgLayers = function(appDimensions) {
gmf.theme.Themes.prototype.getBgLayers = function() {
const gettextCatalog = this.gettextCatalog;
if (this.bgLayerPromise_) {
return this.bgLayerPromise_;
Expand Down
4 changes: 2 additions & 2 deletions contribs/gmf/test/spec/directives/displayquerygrid.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ describe('gmf.query.gridComponent', () => {
queried: true
}];

queryGridController.mergeTabs_ = {
queryGridController.mergeTabs = {
'merged_source': ['Test 1', 'Test 2']
};

Expand Down Expand Up @@ -496,7 +496,7 @@ describe('gmf.query.gridComponent', () => {
queried: true
}];

queryGridController.mergeTabs_ = {
queryGridController.mergeTabs = {
'merged_source': ['Test 1', 'Test 2']
};

Expand Down
2 changes: 1 addition & 1 deletion contribs/gmf/test/spec/services/themesservice.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('gmf.theme.Themes', () => {

it('Get background layers', () => {
const spy = jasmine.createSpy();
gmfThemes.getBgLayers({}).then(spy);
gmfThemes.getBgLayers().then(spy);
const urls = [];

$httpBackend.expectGET(treeUrl);
Expand Down
Loading