Add configuration option to disable warning about new LibrePlan versions

FEA: ItEr76S10NewVersionsNotification
This commit is contained in:
Manuel Rego Casasnovas 2011-12-29 11:17:55 +01:00
parent e64dae3cab
commit d71e270f3e
10 changed files with 67 additions and 0 deletions

View file

@ -87,6 +87,8 @@ public class Configuration extends BaseEntity {
private LDAPConfiguration ldapConfiguration;
private Boolean checkNewVersionEnabled = true;
public void setDefaultCalendar(BaseCalendar defaultCalendar) {
this.defaultCalendar = defaultCalendar;
}
@ -340,4 +342,13 @@ public class Configuration extends BaseEntity {
public void setAutocompleteLogin(Boolean autocompleteLogin) {
this.autocompleteLogin = autocompleteLogin;
}
public boolean isCheckNewVersionEnabled() {
return checkNewVersionEnabled != null ? checkNewVersionEnabled : true;
}
public void setCheckNewVersionEnabled(boolean checkNewVersionEnabled) {
this.checkNewVersionEnabled = checkNewVersionEnabled;
}
}

View file

@ -32,4 +32,17 @@
</sql>
</changeSet>
<changeSet id="add-new-column-check_new_version_enabled" author="mrego">
<comment>Add new column check_new_version_enabled with default value TRUE to configuration table</comment>
<addColumn tableName="configuration">
<column name="check_new_version_enabled" type="BOOLEAN" />
</addColumn>
<addDefaultValue tableName="configuration" columnName="check_new_version_enabled"
defaultValueBoolean="TRUE" />
<addNotNullConstraint tableName="configuration"
columnName="check_new_version_enabled"
defaultNullValue="TRUE"
columnDataType="BOOLEAN" />
</changeSet>
</databaseChangeLog>

View file

@ -51,6 +51,8 @@
column="changed_default_wswriter_password" />
<property name="autocompleteLogin" not-null="true"
column="enabled_autocomplete_login" />
<property name="checkNewVersionEnabled" not-null="true"
column="check_new_version_enabled" />
<property name="progressType" column="progress_type">
<type name="org.hibernate.type.EnumType">
<param name="enumClass">org.libreplan.business.common.entities.ProgressType</param>

View file

@ -839,4 +839,12 @@ public class ConfigurationController extends GenericForwardComposer {
return !getLdapConfiguration().getLdapGroupStrategy();
}
public boolean isCheckNewVersionEnabled() {
return configurationModel.isCheckNewVersionEnabled();
}
public void setCheckNewVersionEnabled(boolean checkNewVersionEnabled) {
configurationModel.setCheckNewVersionEnabled(checkNewVersionEnabled);
}
}

View file

@ -554,4 +554,14 @@ public class ConfigurationModel implements IConfigurationModel {
public LDAPConfiguration getLdapConfiguration() {
return configuration.getLdapConfiguration();
}
@Override
public boolean isCheckNewVersionEnabled() {
return configuration.isCheckNewVersionEnabled();
}
@Override
public void setCheckNewVersionEnabled(boolean checkNewVersionEnabled) {
configuration.setCheckNewVersionEnabled(checkNewVersionEnabled);
}
}

View file

@ -150,4 +150,8 @@ public interface IConfigurationModel {
Boolean isChangedDefaultPasswdAdmin();
void setAutocompleteLogin(Boolean autocompleteLogin);
boolean isCheckNewVersionEnabled();
void setCheckNewVersionEnabled(boolean checkNewVersionEnabled);
}

View file

@ -58,4 +58,6 @@ public interface ITemplateModel {
boolean isUserAdmin();
boolean isCheckNewVersionEnabled();
}

View file

@ -184,6 +184,10 @@ public class TemplateController extends GenericForwardComposer {
}
public boolean isNewVersionAvailable() {
if (!templateModel.isCheckNewVersionEnabled()) {
return false;
}
return VersionInformation.isNewVersionAvailable();
}

View file

@ -484,4 +484,10 @@ public class TemplateModel implements ITemplateModel {
public boolean isUserAdmin() {
return UserUtil.getUserFromSession().isAdministrator();
}
@Override
@Transactional(readOnly = true)
public boolean isCheckNewVersionEnabled() {
return configurationDAO.getConfiguration().isCheckNewVersionEnabled();
}
}

View file

@ -92,6 +92,13 @@
checked="@{configurationController.autocompleteLogin}"
onCheck="configurationController.reloadGeneralConfiguration();" />
</row>
<row>
<label value="${i18n:_('Warning new version')}" />
<checkbox
label="${i18n:_('Enable/Disable')}"
tooltiptext="${i18n:_('Enable/Disable warning about new LibrePlan versions available')}"
checked="@{configurationController.checkNewVersionEnabled}" />
</row>
<row>
<label value="${i18n:_('Generate code for')}" />
<grid>