This is an automated email from the ASF dual-hosted git repository.
ilgrosso pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git
The following commit(s) were added to refs/heads/2_1_X by this push:
new 54b8588 [SYNCOPE-1560] Setting FileInputConfig's language after
SyncopeConsoleSession
54b8588 is described below
commit 54b8588a4bfb529c15cf963436c6167dc5080a2e
Author: Francesco Chicchiriccò <[email protected]>
AuthorDate: Tue May 12 11:07:40 2020 +0200
[SYNCOPE-1560] Setting FileInputConfig's language after
SyncopeConsoleSession
---
.../wicket/markup/html/form/BinaryFieldPanel.java | 21 +++++++++--------
.../console/wizards/CSVPullWizardBuilder.java | 26 +++++++++++++++++-----
.../console/SyncopeConsoleApplication.properties | 1 +
.../SyncopeConsoleApplication_fr_CA.properties | 1 +
.../SyncopeConsoleApplication_it.properties | 1 +
.../SyncopeConsoleApplication_ja.properties | 1 +
.../SyncopeConsoleApplication_pt_BR.properties | 1 +
.../SyncopeConsoleApplication_ru.properties | 1 +
.../markup/html/form/BinaryFieldPanel.properties | 17 --------------
.../html/form/BinaryFieldPanel_ja.properties | 17 --------------
10 files changed, 37 insertions(+), 50 deletions(-)
diff --git
a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
index 610ac5b..0730b37 100644
---
a/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
+++
b/client/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.java
@@ -173,10 +173,9 @@ public class BinaryFieldPanel extends FieldPanel<String> {
downloadLink.setOutputMarkupId(true);
uploadForm.add(downloadLink);
- FileInputConfig config = new FileInputConfig();
- config.showUpload(false);
- config.showRemove(false);
- config.showPreview(false);
+ FileInputConfig config = new FileInputConfig().
+ showUpload(false).showRemove(false).showPreview(false).
+
withLocale(SyncopeConsoleSession.get().getLocale().getLanguage());
fileUpload = new BootstrapFileInputField("fileUpload", new
ListModel<>(new ArrayList<>()), config);
fileUpload.setOutputMarkupId(true);
@@ -187,24 +186,24 @@ public class BinaryFieldPanel extends FieldPanel<String> {
@Override
protected void onSubmit(final AjaxRequestTarget target) {
- final FileUpload uploadedFile = fileUpload.getFileUpload();
+ FileUpload uploadedFile = fileUpload.getFileUpload();
if (uploadedFile != null) {
if (maxUploadSize != null && uploadedFile.getSize() >
maxUploadSize.bytes()) {
// SYNCOPE-1213 manage directly max upload file size
(if set in properties file)
-
SyncopeConsoleSession.get().error(getString("tooLargeFile")
- .replace("${maxUploadSizeB}",
String.valueOf(maxUploadSize.bytes()))
- .replace("${maxUploadSizeMB}",
String.valueOf(maxUploadSize.bytes() / 1000000L)));
+
SyncopeConsoleSession.get().error(getString("tooLargeFile").
+ replace("${maxUploadSizeB}",
String.valueOf(maxUploadSize.bytes())).
+ replace("${maxUploadSizeMB}",
String.valueOf(maxUploadSize.bytes() / 1000000L)));
((BasePage)
getPageReference().getPage()).getNotificationPanel().refresh(target);
} else {
- final byte[] uploadedBytes = uploadedFile.getBytes();
- final String uploaded =
Base64.getEncoder().encodeToString(uploadedBytes);
+ byte[] uploadedBytes = uploadedFile.getBytes();
+ String uploaded =
Base64.getEncoder().encodeToString(uploadedBytes);
field.setModelObject(uploaded);
target.add(field);
if (previewer == null) {
container.addOrReplace(emptyFragment);
} else {
- final Component panelPreview =
previewer.preview(uploadedBytes);
+ Component panelPreview =
previewer.preview(uploadedBytes);
changePreviewer(panelPreview);
fileUpload.setModelObject(null);
uploadForm.addOrReplace(fileUpload);
diff --git
a/client/console/src/main/java/org/apache/syncope/client/console/wizards/CSVPullWizardBuilder.java
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/CSVPullWizardBuilder.java
index c977fc8..f342449 100644
---
a/client/console/src/main/java/org/apache/syncope/client/console/wizards/CSVPullWizardBuilder.java
+++
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/CSVPullWizardBuilder.java
@@ -27,7 +27,10 @@ import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.client.console.SyncopeConsoleApplication;
+import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.commons.Constants;
+import org.apache.syncope.client.console.pages.BasePage;
import org.apache.syncope.client.console.panels.CSVConfPanel;
import org.apache.syncope.client.console.rest.ImplementationRestClient;
import org.apache.syncope.client.console.rest.ReconciliationRestClient;
@@ -59,6 +62,7 @@ import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.util.ListModel;
+import org.apache.wicket.util.lang.Bytes;
public class CSVPullWizardBuilder extends AjaxWizardBuilder<CSVPullSpec> {
@@ -93,8 +97,14 @@ public class CSVPullWizardBuilder extends
AjaxWizardBuilder<CSVPullSpec> {
private final Model<byte[]> csv = new Model<>();
+ private final Bytes maxUploadSize;
+
public CSVPullWizardBuilder(final CSVPullSpec defaultItem, final
PageReference pageRef) {
super(defaultItem, pageRef);
+
+ this.maxUploadSize =
SyncopeConsoleApplication.get().getMaxUploadFileSizeMB() == null
+ ? null
+ :
Bytes.megabytes(SyncopeConsoleApplication.get().getMaxUploadFileSizeMB());
}
@Override
@@ -121,10 +131,9 @@ public class CSVPullWizardBuilder extends
AjaxWizardBuilder<CSVPullSpec> {
private static final long serialVersionUID = -4736870165235853919L;
public Details(final CSVPullSpec spec) {
- FileInputConfig csvFile = new FileInputConfig();
- csvFile.showUpload(false);
- csvFile.showRemove(false);
- csvFile.showPreview(false);
+ FileInputConfig csvFile = new FileInputConfig().
+ showUpload(false).showRemove(false).showPreview(false).
+
withLocale(SyncopeConsoleSession.get().getLocale().getLanguage());
BootstrapFileInputField csvUpload =
new BootstrapFileInputField("csvUpload", new
ListModel<>(new ArrayList<>()), csvFile);
csvUpload.setRequired(true);
@@ -137,7 +146,14 @@ public class CSVPullWizardBuilder extends
AjaxWizardBuilder<CSVPullSpec> {
protected void onSubmit(final AjaxRequestTarget target) {
FileUpload uploadedFile = csvUpload.getFileUpload();
if (uploadedFile != null) {
- csv.setObject(uploadedFile.getBytes());
+ if (maxUploadSize != null && uploadedFile.getSize() >
maxUploadSize.bytes()) {
+
SyncopeConsoleSession.get().error(getString("tooLargeFile").
+ replace("${maxUploadSizeB}",
String.valueOf(maxUploadSize.bytes())).
+ replace("${maxUploadSizeMB}",
String.valueOf(maxUploadSize.bytes() / 1000000L)));
+ ((BasePage)
getPageReference().getPage()).getNotificationPanel().refresh(target);
+ } else {
+ csv.setObject(uploadedFile.getBytes());
+ }
}
}
});
diff --git
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
index be10086..aadbb1d 100644
---
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
+++
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication.properties
@@ -76,3 +76,4 @@ security=Security
before=Before
after=After
nomatch=No matches found
+tooLargeFile=File is too large, max upload file size is ${maxUploadSizeB}
bytes (${maxUploadSizeMB} MB).
diff --git
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_fr_CA.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_fr_CA.properties
index e98987c..2e37055 100644
---
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_fr_CA.properties
+++
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_fr_CA.properties
@@ -74,3 +74,4 @@ security=S\u00e9curit\u00e9
before=Avant
after=Apr\u00e8s
nomatch=Aucune correspondance trouv\u00e9e
+tooLargeFile=Fichier trop volumineux, la taille maximale autoris\u00e9e est de
$ {maxUploadSizeB} octets ($ {maxUploadSizeMB} Mo).
diff --git
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
index 1cd8df1..c86cc23 100644
---
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
+++
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_it.properties
@@ -76,3 +76,4 @@ security=Sicurezza
before=Prima
after=Dopo
nomatch=Nessun risultato trovato
+tooLargeFile=File troppo grande, la dimensione massima ammessa \u00e8
${maxUploadSizeB} bytes (${maxUploadSizeMB} MB).
diff --git
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ja.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ja.properties
index a0275df..aa66bf1 100644
---
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ja.properties
+++
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ja.properties
@@ -74,3 +74,4 @@ security=\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3
before=\u524d
after=\u5f8c
nomatch=No matches found
+tooLargeFile=File is too large, max upload file size is ${maxUploadSizeB}
bytes (${maxUploadSizeMB} MB).
diff --git
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_pt_BR.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_pt_BR.properties
index 8e2a574..f34817c 100644
---
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_pt_BR.properties
+++
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_pt_BR.properties
@@ -76,3 +76,4 @@ security=Security
before=Before
after=After
nomatch=Nenhuma correspond\u00eancia encontrada
+tooLargeFile=File is too large, max upload file size is ${maxUploadSizeB}
bytes (${maxUploadSizeMB} MB).
diff --git
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ru.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ru.properties
index 2154692..f49e8e1 100644
---
a/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ru.properties
+++
b/client/console/src/main/resources/org/apache/syncope/client/console/SyncopeConsoleApplication_ru.properties
@@ -75,3 +75,4 @@ security=Security
before=Before
after=After
nomatch=No matches found
+tooLargeFile=File is too large, max upload file size is ${maxUploadSizeB}
bytes (${maxUploadSizeMB} MB).
diff --git
a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.properties
deleted file mode 100644
index 6db49af..0000000
---
a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-tooLargeFile=File is too large, max upload file size is ${maxUploadSizeB}
bytes (${maxUploadSizeMB} MB).
diff --git
a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel_ja.properties
b/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel_ja.properties
deleted file mode 100644
index f82cd54..0000000
---
a/client/console/src/main/resources/org/apache/syncope/client/console/wicket/markup/html/form/BinaryFieldPanel_ja.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-tooLargeFile=\u30d5\u30a1\u30a4\u30eb\u304c\u5927\u304d\u3059\u304e\u307e\u3059\u3002\u6700\u5927\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u30b5\u30a4\u30ba\u306f
${maxUploadSizeB} \u30d0\u30a4\u30c8 (${maxUploadSizeMB} MB) \u3067\u3059\u3002