diff --git a/INSTALL.rst b/INSTALL.rst index ff37b58d1..a2456522f 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -164,7 +164,7 @@ Debian/Ubuntu * Install requirements:: - # apt-get install openjdk-7-jre postgresql postgresql-client tomcat7 libpg-java cutycapt xvfb + # apt-get install openjdk-8-jre postgresql postgresql-client tomcat8 libpg-java cutycapt xvfb * Connect to database:: @@ -201,9 +201,9 @@ Debian/Ubuntu $ wget -O libreplan.war http://downloads.sourceforge.net/project/libreplan/LibrePlan/libreplan_1.4.1.war -* Create a new file ``/etc/tomcat7/Catalina/localhost/libreplan.xml`` (file +* Create a new file ``/etc/tomcat8/Catalina/localhost/libreplan.xml`` (file name has to match with ``.war`` name) with database configuration for - Tomcat 7:: + Tomcat 8:: @@ -216,21 +216,18 @@ Debian/Ubuntu url="jdbc:postgresql://localhost/libreplan" /> -* Add next lines to Tomcat 7 policy file ``/etc/tomcat7/catalina.policy`` or ``/var/lib/tomcat7/conf`` or ``/etc/tomcat7/policy.d/03catalina.policy`` +* Add next lines to Tomcat 8 policy file ``/etc/tomcat8/catalina.policy`` or ``/var/lib/tomcat8/conf`` or ``/etc/tomcat8/policy.d/03catalina.policy`` with the following content:: - grant codeBase "file:/var/lib/tomcat7/webapps/libreplan/-" { + grant codeBase "file:/var/lib/tomcat8/webapps/libreplan/-" { permission java.security.AllPermission; }; - grant codeBase "file:/var/lib/tomcat7/webapps/libreplan.war" { + grant codeBase "file:/var/lib/tomcat8/webapps/libreplan.war" { permission java.security.AllPermission; }; - .. NOTE:: - For Tomcat 6, create a ``/etc/tomcat6/policy.d/51libreplan.policy`` and replace `̀ tomcat7`` by ``tomcat6``. - -* Also add next lines to Tomcat 7 policy file:: +* Also add next lines to Tomcat 8 policy file:: grant codeBase "file:${catalina.home}/bin/tomcat-juli.jar" { ... @@ -240,21 +237,17 @@ Debian/Ubuntu ... }; - .. NOTE:: +* Add link to Java JDBC driver for PostgreSQL in Tomcat8 libraries directory:: - For Tomcat 6, this is the ``/etc/tomcat6/policy.d/03catalina.policy``. + # ln -s /usr/share/java/postgresql-jdbc4.jar /usr/share/tomcat8/lib/ -* Add link to Java JDBC driver for PostgreSQL in Tomcat6 libraries directory:: +* Copy war to Tomcat 8 web applications directory:: - # ln -s /usr/share/java/postgresql-jdbc4.jar /usr/share/tomcat7/lib/ + # cp libreplan.war /var/lib/tomcat8/webapps/ -* Copy war to Tomcat 7 web applications directory:: +* Restart Tomcat 8:: - # cp libreplan.war /var/lib/tomcat7/webapps/ - -* Restart Tomcat 7:: - - # /etc/init.d/tomcat7 restart + # /etc/init.d/tomcat8 restart * Go to http://localhost:8080/libreplan/ @@ -269,7 +262,7 @@ openSUSE * Install requirements:: - # zypper install java-1_7_0-openjdk postgresql-server postgresql tomcat7 xorg-x11-server + # zypper install java-1_8_0-openjdk postgresql-server postgresql tomcat8 xorg-x11-server * JDBC Driver manual installation:: @@ -324,9 +317,9 @@ openSUSE $ wget -O libreplan.war http://downloads.sourceforge.net/project/libreplan/LibrePlan/libreplan_1.4.1.war -* Create a new file ``/etc/tomcat7/Catalina/localhost/libreplan.xml`` (file +* Create a new file ``/etc/tomcat8/Catalina/localhost/libreplan.xml`` (file name has to match with ``.war`` name) with database configuration for - Tomcat 7:: + Tomcat 8:: @@ -339,17 +332,17 @@ openSUSE url="jdbc:postgresql://localhost/libreplan" /> -* Add link to Java JDBC driver for PostgreSQL in Tomcat7 libraries directory:: +* Add link to Java JDBC driver for PostgreSQL in Tomcat8 libraries directory:: - # ln -s /usr/share/java/postgresql-jdbc4.jar /usr/share/tomcat7/lib/ + # ln -s /usr/share/java/postgresql-jdbc4.jar /usr/share/tomcat8/lib/ -* Copy war to Tomcat 7 web applications directory:: +* Copy war to Tomcat 8 web applications directory:: - # cp libreplan.war /srv/tomcat7/webapps/ + # cp libreplan.war /srv/tomcat8/webapps/ -* Restart Tomcat 7: +* Restart Tomcat 8: - # /etc/init.d/tomcat7 restart + # /etc/init.d/tomcat8 restart * Go to http://localhost:8080/libreplan/ @@ -358,17 +351,17 @@ Microsoft Windows Instructions: -* Download and install latest Java Runtime Environment 7uXX (JRE7uXX):: +* Download and install latest Java Runtime Environment 8uXX (JRE8uXX):: - # http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html + # http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html * Download and install latest PostgreSQL database:: # http://www.enterprisedb.com/products-services-training/pgdownload#windows -* Download and install Apache Tomcat 6:: +* Download and install Apache Tomcat 8:: - # http://tomcat.apache.org/download-60.cgi + # https://tomcat.apache.org/download-80.cgi .. NOTE:: @@ -377,7 +370,7 @@ Instructions: * Set up JDBC41 PostgreSQL Driver:: # Download latest driver: https://jdbc.postgresql.org/download.html - # Copy downloaded *.jar file to JRE location: (e.g. C:\Program Files\Java\jre7\lib\ext) + # Copy downloaded *.jar file to JRE location: (e.g. C:\Program Files\Java\jre8\lib\ext) * Download latest ``.war`` file from SourceForge.net (for PostgreSQL) and rename it to libreplan.war:: @@ -407,9 +400,9 @@ Instructions: * Configure Apache Tomcat Server -* Put libreplan.war file to Apache Tomcat webapps folder (e.g. C:/Program Files/Apache Software Foundation/Tomcat 6.0/webapps/) +* Put libreplan.war file to Apache Tomcat webapps folder (e.g. C:/Program Files/Apache Software Foundation/Tomcat 8.0/webapps/) -* Go to localhost folder (e.g. C:/Program Files/Apache Software Foundation/Tomcat 6.0/conf/Catalina/localhost/) +* Go to localhost folder (e.g. C:/Program Files/Apache Software Foundation/Tomcat 8.0/conf/Catalina/localhost/) and create there libreplan.xml file with this lines of code:: @@ -425,7 +418,7 @@ Instructions: * Start Apache Tomcat server - # Example location: C:/Program Files/Apache Software Foundation/Tomcat 6.0/bin/Tomcat6.exe + # Example location: C:/Program Files/Apache Software Foundation/Tomcat 8.0/bin/Tomcat8.exe If you will face SKIP_IDENTIFIER_CHECK error, refer to: http://stackoverflow.com/questions/24546304/how-to-skip-java-reserve-keyword-identifier-check-in-tomcat @@ -436,8 +429,8 @@ Logs ---- Since *LibrePlan 1.1.1* log system is configured automatically creating a new -folder under ``/var/log/tomcat6/`` with ``.war`` name. For example: -``/var/log/tomcat6/libreplan/``. +folder under ``/var/log/tomcat8/`` with ``.war`` name. For example: +``/var/log/tomcat8/libreplan/``. Inside this new directory there will be two files (``libreplan.log`` and ``libreplan-error.log``) that will be rotated every day. @@ -449,8 +442,8 @@ Anyway if you want to set manually LibrePlan log path you will have to configure ``JAVA_OPTS`` variable in your server. This variable is configured in different files depending on the distribution: -* Debian or Ubuntu: ``/etc/default/tomcat6`` -* Fedora or openSUSE: ``/etc/tomcat6/tomcat6.conf`` +* Debian or Ubuntu: ``/etc/default/tomcat8`` +* Fedora or openSUSE: ``/etc/tomcat8/tomcat8.conf`` Where you will need to add the next line:: @@ -459,7 +452,7 @@ Where you will need to add the next line:: .. WARNING:: - You have to be sure that the user running Tomcat (usually ``tomcat6``) has + You have to be sure that the user running Tomcat (usually ``tomcat8``) has permissions to write in the specified directory. @@ -512,8 +505,8 @@ In order to avoid this problem you need to configure properly ``JAVA_OPTS`` variable in your server. This is configured in different files depending on the distribution: -* Debian or Ubuntu: ``/etc/default/tomcat6`` -* Fedora or openSUSE: ``/etc/tomcat6/tomcat6.conf`` +* Debian or Ubuntu: ``/etc/default/tomcat8`` +* Fedora or openSUSE: ``/etc/tomcat8/tomcat8.conf`` The next lines show a possible configuration to fix the memory errors (the exact values depends on the server features):: diff --git a/doc/src/technical/howto-start-development-with-eclipse.rst b/doc/src/technical/howto-start-development-with-eclipse.rst index a7845e958..3d9a92cb4 100644 --- a/doc/src/technical/howto-start-development-with-eclipse.rst +++ b/doc/src/technical/howto-start-development-with-eclipse.rst @@ -153,7 +153,7 @@ Configure project to run Configure how to run LibrePlan in Eclipse * Click *Run* and application will be available at - http://localhost:8080/libreplan-webapp/ + http://localhost:8080/ Configure Maven profiles diff --git a/doc/src/technical/howto-start-development-with-intellij-idea.rst b/doc/src/technical/howto-start-development-with-intellij-idea.rst index 9fbceaddf..166eb2dff 100644 --- a/doc/src/technical/howto-start-development-with-intellij-idea.rst +++ b/doc/src/technical/howto-start-development-with-intellij-idea.rst @@ -20,7 +20,7 @@ How To Start Development With JetBrains Intellij IDEA Download LibrePlan source code ------------------------------ -* You need to download LibrePlan_ source code to start hacking on it. You have two options: +* You need to download LibrePlan source code to start hacking on it. You have two options: a) Clone Git repository (recommended):: @@ -45,7 +45,7 @@ Import LibrePlan project * Select directory with source code of Libreplan - # e.g. C/Users/PC-User/IdeaProjects/libreplan + # e.g. C:/Users/PC-User/IdeaProjects/libreplan * Select *Import project from external model* > *Maven* and click *Next* @@ -55,7 +55,7 @@ Import LibrePlan project * Then leave all by default -* Then choose your JDK(SDK), 1.7 strongly preferred +* Then choose your JDK(SDK), 1.8 strongly preferred * Then define project name or leave default name diff --git a/libreplan-business/src/main/java/org/libreplan/business/common/Configuration.java b/libreplan-business/src/main/java/org/libreplan/business/common/Configuration.java index 3654cf7c5..8c65384ae 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/common/Configuration.java +++ b/libreplan-business/src/main/java/org/libreplan/business/common/Configuration.java @@ -26,7 +26,7 @@ import org.apache.commons.lang3.BooleanUtils; /** * This is a singleton that contains the compilation options passed from Maven. * - * Currently we have three options: + * Currently we have four options: * * * @author Susana Montes Pedreira @@ -47,9 +48,11 @@ public class Configuration { private Boolean defaultPasswordsControl; - private Boolean exampleUsersDisabled; + private boolean exampleUsersDisabled; - private Boolean emailSendingEnabled; + private boolean emailSendingEnabled; + + private boolean deleteAllProjectsButtonDisabled; private Configuration() { } @@ -73,36 +76,35 @@ public class Configuration { this.defaultPasswordsControl = defaultPasswordsControl; } - - /** - * Returns the value of example users disabled compilation option. - */ public static boolean isExampleUsersDisabled() { return BooleanUtils.isNotFalse(singleton.getExampleUsersDisabled()); } - public Boolean getExampleUsersDisabled() { + public boolean getExampleUsersDisabled() { return exampleUsersDisabled; } - public void setExampleUsersDisabled(Boolean exampleUsersDisabled) { + public void setExampleUsersDisabled(boolean exampleUsersDisabled) { this.exampleUsersDisabled = exampleUsersDisabled; } - - /** - * Returns the value of E-mail sending disabled compilation option. - */ public static boolean isEmailSendingEnabled() { return BooleanUtils.isNotFalse(singleton.getEmailSendingEnabled()); } - public Boolean getEmailSendingEnabled() { + public boolean getEmailSendingEnabled() { return emailSendingEnabled; } - public void setEmailSendingEnabled(Boolean emailSendingEnabled) { + public void setEmailSendingEnabled(boolean emailSendingEnabled) { this.emailSendingEnabled = emailSendingEnabled; } + public boolean isDeleteAllProjectsButtonDisabled() { + return deleteAllProjectsButtonDisabled; + } + + public void setDeleteAllProjectsButtonDisabled(boolean deleteAllProjectsButtonDisabled) { + this.deleteAllProjectsButtonDisabled = deleteAllProjectsButtonDisabled; + } } diff --git a/libreplan-business/src/main/resources/db.changelog-1.2.xml b/libreplan-business/src/main/resources/db.changelog-1.2.xml index 9b41c9a9b..a23f0af55 100644 --- a/libreplan-business/src/main/resources/db.changelog-1.2.xml +++ b/libreplan-business/src/main/resources/db.changelog-1.2.xml @@ -177,24 +177,16 @@ - Add new column allow_to_gather_usage_stats_enabled with default value TRUE to configuration table + Add new column allow_to_gather_usage_stats_enabled with default value FALSE to configuration table + defaultValueBoolean="FALSE" /> - - - - - Update allow_to_gather_usage_stats_enabled field - - - + + Update allow_to_gather_usage_stats_enabled field + + + + + + + + + + diff --git a/libreplan-business/src/main/resources/db.changelog-database.xml b/libreplan-business/src/main/resources/db.changelog-database.xml index 346761bb3..dd148d3d7 100644 --- a/libreplan-business/src/main/resources/db.changelog-database.xml +++ b/libreplan-business/src/main/resources/db.changelog-database.xml @@ -788,9 +788,9 @@ - + - + @@ -805,9 +805,9 @@ - + - + @@ -874,7 +874,7 @@ - + @@ -1314,7 +1314,7 @@ - + @@ -1508,9 +1508,9 @@ - + - + @@ -1744,7 +1744,7 @@ - + @@ -1984,16 +1984,16 @@ - + - + - + - + @@ -2149,7 +2149,7 @@ - + @@ -2209,13 +2209,13 @@ - + - + - + @@ -2255,4 +2255,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libreplan-business/src/main/resources/libreplan-business-spring-config.xml b/libreplan-business/src/main/resources/libreplan-business-spring-config.xml index 8806d8dbc..351deffdb 100644 --- a/libreplan-business/src/main/resources/libreplan-business-spring-config.xml +++ b/libreplan-business/src/main/resources/libreplan-business-spring-config.xml @@ -143,6 +143,7 @@ + diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderCRUDController.java index c667a798d..a5b9a618e 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderCRUDController.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/orders/OrderCRUDController.java @@ -24,6 +24,7 @@ package org.libreplan.web.orders; import org.apache.commons.lang3.StringUtils; import org.joda.time.LocalDate; import org.libreplan.business.calendars.entities.BaseCalendar; +import org.libreplan.business.common.Configuration; import org.libreplan.business.common.Registry; import org.libreplan.business.common.exceptions.InstanceNotFoundException; import org.libreplan.business.externalcompanies.entities.DeadlineCommunication; @@ -77,7 +78,6 @@ import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.SelectEvent; import org.zkoss.zk.ui.util.GenericForwardComposer; import org.zkoss.zul.Button; -import org.zkoss.zul.Checkbox; import org.zkoss.zul.Column; import org.zkoss.zul.Combobox; import org.zkoss.zul.Comboitem; @@ -293,6 +293,22 @@ public class OrderCRUDController extends GenericForwardComposer { loadLabels(); FilterUtils.writeProjectPlanningFilterChanged(false); + + createDeleteAllProjectsButton(); + } + + /** + * This method is needed to create "Delete all projects" button, + * that is visible only for developers on orders list page. + */ + private void createDeleteAllProjectsButton() { + if (!isDeleteAllProjectsButtonDisabled()) { + Button deleteAllProjectButton = new Button(); + deleteAllProjectButton.setLabel("Delete all projects"); + deleteAllProjectButton.setDisabled(isDeleteAllProjectsButtonDisabled()); + deleteAllProjectButton.addEventListener(Events.ON_CLICK, event -> deleteAllProjects()); + orderFilter.appendChild(deleteAllProjectButton); + } } private void loadLabels() { @@ -1798,4 +1814,29 @@ public class OrderCRUDController extends GenericForwardComposer { return getOrder().getBudget().add(getResourcesBudget()); } + private Boolean isDeleteAllProjectsButtonDisabled() { + return Configuration.getInstance().isDeleteAllProjectsButtonDisabled(); + } + + /** + * Should be public! + * Used in orders/_orderFilter.zul + */ + public void deleteAllProjects() { + boolean canNotDelete = false; + for (Order order : orderModel.getOrders()) { + try { + orderModel.remove(order); + } catch (Exception ignored) { + canNotDelete = true; + continue; + } + } + if (canNotDelete) { + messagesForUser.showMessage(Level.ERROR, "Not all projects were removed") ; + } + listing.setModel(new SimpleListModel<>(orderModel.getOrders())); + listing.invalidate(); + } + } 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 388be3d24..5aa615da0 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 @@ -158,6 +158,7 @@ public class UserCRUDController extends BaseCRUDController implements IUse List roles = new ArrayList<>(Arrays.asList(UserRole.values())); roles.remove(UserRole.ROLE_BOUND_USER); + // Sorting by ASC Collections.sort(roles, (arg0, arg1) -> _(arg0.getDisplayName()).compareTo(_(arg1.getDisplayName()))); for (UserRole role : roles) { @@ -202,6 +203,10 @@ public class UserCRUDController extends BaseCRUDController implements IUse if (comboItem != null) { addRole(comboItem.getValue()); + + userRolesCombo.removeItemAt(comboItem.getIndex()); + userRolesCombo.setSelectedItem(null); + userRolesCombo.setText(null); } } @@ -212,9 +217,34 @@ public class UserCRUDController extends BaseCRUDController implements IUse public void removeRole(UserRole role) { userModel.removeRole(role); + + userRolesCombo.getItems().clear(); + appendAllUserRolesExcept(UserRole.ROLE_BOUND_USER, userModel.getRoles(), userRolesCombo); + Util.reloadBindings(editWindow); } + /** + * Appends the existing UserRoles to the {@link Combobox} passed. + * + * @param boundUserRole {@link UserRole#ROLE_BOUND_USER} that need to be excluded + * @param userRoles a list of {@link UserRole} that need to be excluded + * @param combo {@link Combobox} to which a list of user roles will be appended + */ + private void appendAllUserRolesExcept(UserRole boundUserRole, List userRoles, Combobox combo) { + List roles = new ArrayList<>(Arrays.asList(UserRole.values())); + roles.remove(boundUserRole); + roles.removeAll(userRoles); + + // Sorting by ASC + Collections.sort(roles, (arg0, arg1) -> _(arg0.getDisplayName()).compareTo(_(arg1.getDisplayName()))); + + for (UserRole role : roles) { + Comboitem item = combo.appendItem(_(role.getDisplayName())); + item.setValue(role); + } + } + public List getProfiles() { return userModel.getProfiles(); } diff --git a/pom.xml b/pom.xml index 6d229dc2e..5665a842d 100644 --- a/pom.xml +++ b/pom.xml @@ -35,6 +35,7 @@ true true true + true UTF-8 @@ -94,6 +95,9 @@ false + + + false