From 5a6241b7f98e78f2b21f1c64668c219f8398a4f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacobo=20Aragunde=20P=C3=A9rez?= Date: Thu, 8 Nov 2012 18:10:56 +0100 Subject: [PATCH] Bug #1556: Use a combo box to show the value of UserAuthenticationType field. It's a step previous to allow the edition of that field. FEA: ItEr77S04BugFixing --- .../web/users/UserCRUDController.java | 32 +++++++++++++++++++ .../src/main/webapp/users/_editUser.zul | 6 +++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/users/UserCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/users/UserCRUDController.java index 57fd415b3..dc4732ddc 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/users/UserCRUDController.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/users/UserCRUDController.java @@ -283,6 +283,16 @@ public class UserCRUDController extends BaseCRUDController implements //because they are not directly associated to an attribute passwordBox.setRawValue(""); passwordConfirmationBox.setRawValue(""); + hideAuthenticationTypesCombo(); + } + + private void hideAuthenticationTypesCombo() { + Row comboRow = (Row) editWindow + .getFellowIfAny("authenticationTypeComboRow"); + Row labelRow = (Row) editWindow + .getFellowIfAny("authenticationTypeLabelRow"); + comboRow.setVisible(false); + labelRow.setVisible(true); } @Override @@ -294,6 +304,28 @@ public class UserCRUDController extends BaseCRUDController implements //cleans the box and forces the check of the new Constraint (null) passwordBox.setValue(""); passwordConfirmationBox.setValue(""); + //setup authentication type combo box + prepareAuthenticationTypesCombo(); + } + + private void prepareAuthenticationTypesCombo() { + Combobox combo = (Combobox) editWindow + .getFellowIfAny("authenticationTypeCombo"); + combo.getChildren().clear(); + for (UserAuthenticationType type : UserAuthenticationType.values()) { + Comboitem item = combo.appendItem(type.toString()); + item.setValue(type); + if (type.equals(getAuthenticationType())) { + combo.setSelectedItem(item); + } + } + + Row comboRow = (Row) editWindow + .getFellowIfAny("authenticationTypeComboRow"); + Row labelRow = (Row) editWindow + .getFellowIfAny("authenticationTypeLabelRow"); + comboRow.setVisible(true); + labelRow.setVisible(false); } @Override diff --git a/libreplan-webapp/src/main/webapp/users/_editUser.zul b/libreplan-webapp/src/main/webapp/users/_editUser.zul index 849a61148..540ea5280 100644 --- a/libreplan-webapp/src/main/webapp/users/_editUser.zul +++ b/libreplan-webapp/src/main/webapp/users/_editUser.zul @@ -85,7 +85,11 @@ - + + +