diff --git a/libreplan-business/src/main/java/org/libreplan/business/users/entities/User.java b/libreplan-business/src/main/java/org/libreplan/business/users/entities/User.java
index fa435b46a..065d80a8c 100644
--- a/libreplan-business/src/main/java/org/libreplan/business/users/entities/User.java
+++ b/libreplan-business/src/main/java/org/libreplan/business/users/entities/User.java
@@ -299,12 +299,6 @@ public class User extends BaseEntity implements IHumanIdentifiable{
return loginName;
}
- public String getAuthenticationType() {
- if (isLibrePlanUser())
- return "Database";
- return "LDAP";
- }
-
public Worker getWorker() {
return worker;
}
diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/Util.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/Util.java
index b03f150de..7b26862c5 100644
--- a/libreplan-webapp/src/main/java/org/libreplan/web/common/Util.java
+++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/Util.java
@@ -3,7 +3,7 @@
*
* Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
* Desenvolvemento Tecnolóxico de Galicia
- * Copyright (C) 2010-2011 Igalia, S.L.
+ * Copyright (C) 2010-2012 Igalia, S.L.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -49,8 +49,11 @@ import org.zkoss.zul.Combobox;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Decimalbox;
+import org.zkoss.zul.Hbox;
import org.zkoss.zul.Intbox;
+import org.zkoss.zul.Label;
import org.zkoss.zul.Radio;
+import org.zkoss.zul.Row;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Timebox;
import org.zkoss.zul.api.Checkbox;
@@ -691,4 +694,30 @@ public class Util {
return currencySymbol;
}
+ /**
+ * Appends the text as a {@link Label} into the specified
+ * {@link Row}.
+ */
+ public static void appendLabel(Row row, String text) {
+ row.appendChild(new Label(text));
+ }
+
+ /**
+ * Appends a edit button and a remove button to the {@link Row} inside a
+ * {@link Hbox} and adds the ON_CLICK event over the
+ * {@link Row} for the edit operation.
+ *
+ * The edit button will call the editButtonListener when
+ * clicked and the remove button the removeButtonListener.
+ */
+ public static void appendOperationsAndOnClickEvent(Row row,
+ EventListener editButtonListener, EventListener removeButtonListener) {
+ Hbox hbox = new Hbox();
+ hbox.appendChild(Util.createEditButton(editButtonListener));
+ hbox.appendChild(Util.createRemoveButton(removeButtonListener));
+ row.appendChild(hbox);
+
+ row.addEventListener(Events.ON_CLICK, editButtonListener);
+ }
+
}
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 017c4b211..9db7adcf4 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
@@ -73,6 +73,32 @@ public class UserCRUDController extends BaseCRUDController implements
private IURLHandlerRegistry URLHandlerRegistry;
+ private RowRenderer usersRenderer = new RowRenderer() {
+
+ @Override
+ public void render(Row row, Object data) throws Exception {
+ final User user = (User) data;
+ row.setValue(user);
+
+ Util.appendLabel(row, user.getLoginName());
+ Util.appendLabel(row, user.isDisabled() ? _("Yes") : _("No"));
+ Util.appendLabel(row, user.isAdministrator() ? _("Yes") : _("No"));
+ Util.appendLabel(row, getAuthenticationType(user));
+
+ Util.appendOperationsAndOnClickEvent(row, new EventListener() {
+ @Override
+ public void onEvent(Event event) throws Exception {
+ goToEditForm(user);
+ }
+ }, new EventListener() {
+ @Override
+ public void onEvent(Event event) throws Exception {
+ confirmDelete(user);
+ }
+ });
+ }
+ };
+
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
@@ -260,4 +286,23 @@ public class UserCRUDController extends BaseCRUDController implements
};
}
+ public String getAuthenticationType() {
+ User user = getUser();
+ if (user != null) {
+ return getAuthenticationType(user);
+ }
+ return "";
+ }
+
+ private String getAuthenticationType(User user) {
+ if (user.isLibrePlanUser()) {
+ return _("Database");
+ }
+ return _("LDAP");
+ }
+
+ public RowRenderer getUsersRenderer() {
+ return usersRenderer;
+ }
+
}
diff --git a/libreplan-webapp/src/main/webapp/users/_editUser.zul b/libreplan-webapp/src/main/webapp/users/_editUser.zul
index 37522dc40..45edac0db 100644
--- a/libreplan-webapp/src/main/webapp/users/_editUser.zul
+++ b/libreplan-webapp/src/main/webapp/users/_editUser.zul
@@ -87,7 +87,7 @@
-
+
diff --git a/libreplan-webapp/src/main/webapp/users/_listUsers.zul b/libreplan-webapp/src/main/webapp/users/_listUsers.zul
index 388fd14ef..258f25342 100644
--- a/libreplan-webapp/src/main/webapp/users/_listUsers.zul
+++ b/libreplan-webapp/src/main/webapp/users/_listUsers.zul
@@ -3,7 +3,7 @@
Copyright (C) 2009-2010 Fundación para o Fomento da Calidade Industrial e
Desenvolvemento Tecnolóxico de Galicia
- Copyright (C) 2010-2011 Igalia, S.L.
+ Copyright (C) 2010-2012 Igalia, S.L.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
@@ -21,7 +21,8 @@
+ pageSize="10" sclass="clickable-rows"
+ rowRenderer="@{controller.usersRenderer}">
@@ -29,26 +30,6 @@
-
-
-
-
-
-
-
-
-
-
-
-