Add new field to configure seconds for planning warning
FEA: ItEr77S03Community
This commit is contained in:
parent
c4f8dc9f50
commit
805f65b9ea
8 changed files with 95 additions and 25 deletions
|
|
@ -23,6 +23,7 @@ package org.libreplan.business.common.entities;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.hibernate.validator.AssertTrue;
|
import org.hibernate.validator.AssertTrue;
|
||||||
|
import org.hibernate.validator.Min;
|
||||||
import org.hibernate.validator.NotEmpty;
|
import org.hibernate.validator.NotEmpty;
|
||||||
import org.hibernate.validator.NotNull;
|
import org.hibernate.validator.NotNull;
|
||||||
import org.libreplan.business.calendars.entities.BaseCalendar;
|
import org.libreplan.business.calendars.entities.BaseCalendar;
|
||||||
|
|
@ -113,6 +114,8 @@ public class Configuration extends BaseEntity {
|
||||||
|
|
||||||
private PersonalTimesheetsPeriodicityEnum personalTimesheetsPeriodicity = PersonalTimesheetsPeriodicityEnum.MONTHLY;
|
private PersonalTimesheetsPeriodicityEnum personalTimesheetsPeriodicity = PersonalTimesheetsPeriodicityEnum.MONTHLY;
|
||||||
|
|
||||||
|
private Integer secondsPlanningWarning = 30;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maximum users configurable directly in database for SaaS products. If
|
* Maximum users configurable directly in database for SaaS products. If
|
||||||
* zero it means that there isn't any limitation.
|
* zero it means that there isn't any limitation.
|
||||||
|
|
@ -490,4 +493,14 @@ public class Configuration extends BaseEntity {
|
||||||
return maxResources;
|
return maxResources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Min(value = 0, message = "seconds planning warning cannot be negative")
|
||||||
|
@NotNull(message = "seconds planning warning not specified")
|
||||||
|
public Integer getSecondsPlanningWarning() {
|
||||||
|
return secondsPlanningWarning;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSecondsPlanningWarning(Integer secondsPlanningWarning) {
|
||||||
|
this.secondsPlanningWarning = secondsPlanningWarning;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -193,4 +193,19 @@
|
||||||
constraintName="order_element_code_key" />
|
constraintName="order_element_code_key" />
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet id="add-seconds_planning_warning-column-to-configuration"
|
||||||
|
author="mrego">
|
||||||
|
<comment>Add seconds_planning_warning column to configuration</comment>
|
||||||
|
<addColumn tableName="configuration">
|
||||||
|
<column name="seconds_planning_warning" type="INTEGER" />
|
||||||
|
</addColumn>
|
||||||
|
<update tableName="configuration">
|
||||||
|
<column name="seconds_planning_warning" value="30" />
|
||||||
|
</update>
|
||||||
|
<addNotNullConstraint tableName="configuration"
|
||||||
|
columnName="seconds_planning_warning"
|
||||||
|
defaultNullValue="30"
|
||||||
|
columnDataType="INTEGER" />
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,9 @@
|
||||||
<property name="maxUsers" column="max_users" />
|
<property name="maxUsers" column="max_users" />
|
||||||
<property name="maxResources" column="max_resources" />
|
<property name="maxResources" column="max_resources" />
|
||||||
|
|
||||||
|
<property name="secondsPlanningWarning" not-null="true"
|
||||||
|
column="seconds_planning_warning" />
|
||||||
|
|
||||||
<component name="ldapConfiguration" class="org.libreplan.business.common.entities.LDAPConfiguration">
|
<component name="ldapConfiguration" class="org.libreplan.business.common.entities.LDAPConfiguration">
|
||||||
<property name="ldapHost" column="ldap_host"/>
|
<property name="ldapHost" column="ldap_host"/>
|
||||||
<property name="ldapPort" column="ldap_port"/>
|
<property name="ldapPort" column="ldap_port"/>
|
||||||
|
|
|
||||||
|
|
@ -915,4 +915,12 @@ public class ConfigurationController extends GenericForwardComposer {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getSecondsPlanningWarning() {
|
||||||
|
return configurationModel.getSecondsPlanningWarning();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSecondsPlanningWarning(Integer secondsPlanningWarning) {
|
||||||
|
configurationModel.setSecondsPlanningWarning(secondsPlanningWarning);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -657,4 +657,14 @@ public class ConfigurationModel implements IConfigurationModel {
|
||||||
return !workReportDAO.isAnyPersonalTimesheetAlreadySaved();
|
return !workReportDAO.isAnyPersonalTimesheetAlreadySaved();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getSecondsPlanningWarning() {
|
||||||
|
return configuration.getSecondsPlanningWarning();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSecondsPlanningWarning(Integer secondsPlanningWarning) {
|
||||||
|
configuration.setSecondsPlanningWarning(secondsPlanningWarning);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.libreplan.web.common;
|
package org.libreplan.web.common;
|
||||||
|
|
||||||
|
import org.libreplan.business.common.Registry;
|
||||||
import org.zkoss.ganttz.util.LongOperationFeedback;
|
import org.zkoss.ganttz.util.LongOperationFeedback;
|
||||||
import org.zkoss.ganttz.util.LongOperationFeedback.IBackGroundOperation;
|
import org.zkoss.ganttz.util.LongOperationFeedback.IBackGroundOperation;
|
||||||
import org.zkoss.ganttz.util.LongOperationFeedback.IDesktopUpdate;
|
import org.zkoss.ganttz.util.LongOperationFeedback.IDesktopUpdate;
|
||||||
|
|
@ -32,37 +33,41 @@ import org.zkoss.zk.ui.util.Clients;
|
||||||
*/
|
*/
|
||||||
public class ConfirmCloseUtil {
|
public class ConfirmCloseUtil {
|
||||||
|
|
||||||
private static final int WARNING_ON_EXIT_MS = 30000; // 30 seconds
|
|
||||||
|
|
||||||
public static void resetConfirmClose() {
|
public static void resetConfirmClose() {
|
||||||
Clients.confirmClose(null);
|
Clients.confirmClose(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setConfirmClose(Desktop desktop, final String message) {
|
public static void setConfirmClose(Desktop desktop, final String message) {
|
||||||
LongOperationFeedback
|
final Integer seconds = Registry.getConfigurationDAO()
|
||||||
.progressive(
|
.getConfigurationWithReadOnlyTransaction()
|
||||||
desktop,
|
.getSecondsPlanningWarning();
|
||||||
new IBackGroundOperation<LongOperationFeedback.IDesktopUpdate>() {
|
|
||||||
|
|
||||||
@Override
|
if (seconds > 0) {
|
||||||
public void doOperation(
|
LongOperationFeedback
|
||||||
IDesktopUpdatesEmitter<IDesktopUpdate> desktopUpdateEmitter) {
|
.progressive(
|
||||||
try {
|
desktop,
|
||||||
Thread.sleep(WARNING_ON_EXIT_MS);
|
new IBackGroundOperation<LongOperationFeedback.IDesktopUpdate>() {
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
@Override
|
||||||
|
public void doOperation(
|
||||||
|
IDesktopUpdatesEmitter<IDesktopUpdate> desktopUpdateEmitter) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(seconds * 1000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
desktopUpdateEmitter
|
||||||
|
.doUpdate(new IDesktopUpdate() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doUpdate() {
|
||||||
|
resetConfirmClose();
|
||||||
|
Clients.confirmClose(message);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
desktopUpdateEmitter
|
});
|
||||||
.doUpdate(new IDesktopUpdate() {
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void doUpdate() {
|
|
||||||
resetConfirmClose();
|
|
||||||
Clients.confirmClose(message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -180,4 +180,9 @@ public interface IConfigurationModel {
|
||||||
|
|
||||||
boolean isAnyPersonalTimesheetAlreadySaved();
|
boolean isAnyPersonalTimesheetAlreadySaved();
|
||||||
|
|
||||||
|
Integer getSecondsPlanningWarning();
|
||||||
|
|
||||||
|
void setSecondsPlanningWarning(
|
||||||
|
Integer planningWarningExitWithoutSavingSeconds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -209,6 +209,17 @@
|
||||||
label="${i18n:_('MonteCarlo method')}"
|
label="${i18n:_('MonteCarlo method')}"
|
||||||
checked="@{configurationController.monteCarloMethodTabVisible}" />
|
checked="@{configurationController.monteCarloMethodTabVisible}" />
|
||||||
</row>
|
</row>
|
||||||
|
<row>
|
||||||
|
<label
|
||||||
|
value="${i18n:_('Seconds planning warning')}" />
|
||||||
|
<hbox>
|
||||||
|
<intbox width="50px"
|
||||||
|
value="@{configurationController.secondsPlanningWarning}"
|
||||||
|
constraint="no empty,no negative:${i18n:_('cannot be negative or empty')}" />
|
||||||
|
<label
|
||||||
|
value="${i18n:_('Defines the time since last saving operation at project planning perspectives after which a warning is raised on leaving. Set to 0 in order to disable the warning.')}" />
|
||||||
|
</hbox>
|
||||||
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
</grid>
|
</grid>
|
||||||
</tabpanel>
|
</tabpanel>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue