[Bug #1075] adds compiling option to disable/enable the autocomplete login.

FEA: ItEr74S04BugFixing
This commit is contained in:
Susana Montes Pedreira 2011-05-30 10:39:53 +02:00
parent 9e4b329791
commit 4f91435a73
10 changed files with 124 additions and 2 deletions

View file

@ -19,6 +19,9 @@
package org.navalplanner.business.common;
import org.navalplanner.business.common.daos.IConfigurationDAO;
import org.springframework.beans.factory.annotation.Autowired;
/**
* It contains the compiling option to disable the warning changing default
* password and implements of singleton pattern.
@ -29,6 +32,9 @@ public class Configuration {
private static final Configuration singleton = new Configuration();
@Autowired
private IConfigurationDAO configurationDAO;
private Boolean defaultPasswordsControl;
private Configuration() {

View file

@ -80,6 +80,8 @@ public class Configuration extends BaseEntity {
private Boolean changedDefaultWswriterPassword = false;
private Boolean autocompleteLogin = true;
private ProgressType progressType = ProgressType.SPREAD_PROGRESS;
private String companyLogoURL = "";
@ -311,4 +313,11 @@ public class Configuration extends BaseEntity {
: false;
}
public Boolean isAutocompleteLogin() {
return this.autocompleteLogin != null ? this.autocompleteLogin : true;
}
public void setAutocompleteLogin(Boolean autocompleteLogin) {
this.autocompleteLogin = autocompleteLogin;
}
}

View file

@ -5,4 +5,17 @@
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
<changeSet id="add-new-column-enabled-autocomplete-login" author="smontes">
<comment>Add new column enabled_autocomplete_login with default value TRUE to configuration table</comment>
<addColumn tableName="configuration">
<column name="enabled_autocomplete_login" type="BOOLEAN" />
</addColumn>
<addDefaultValue tableName="configuration" columnName="enabled_autocomplete_login"
defaultValueBoolean="TRUE" />
<addNotNullConstraint tableName="configuration"
columnName="enabled_autocomplete_login"
defaultNullValue="FALSE"
columnDataType="BOOLEAN" />
</changeSet>
</databaseChangeLog>

View file

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

View file

@ -374,6 +374,14 @@ public class ConfigurationController extends GenericForwardComposer {
.setGenerateCodeForBaseCalendars(generateCodeForBaseCalendars);
}
public Boolean isAutocompleteLogin() {
return configurationModel.isAutocompleteLogin();
}
public void setAutocompleteLogin(Boolean autocompleteLogin) {
configurationModel.setAutocompleteLogin(autocompleteLogin);
}
public void removeEntitySequence(EntitySequence entitySequence) {
try {
configurationModel.removeEntitySequence(entitySequence);

View file

@ -266,6 +266,21 @@ public class ConfigurationModel implements IConfigurationModel {
}
}
@Override
public Boolean isAutocompleteLogin() {
if (configuration == null) {
return null;
}
return configuration.isAutocompleteLogin();
}
@Override
public void setAutocompleteLogin(Boolean autocompleteLogin) {
if (configuration != null) {
configuration.setAutocompleteLogin(autocompleteLogin);
}
}
@Override
public Boolean getGenerateCodeForWorkReportType() {
if (configuration == null) {

View file

@ -144,4 +144,7 @@ public interface IConfigurationModel {
Boolean moreScenariosThanMasterCreated();
Boolean isAutocompleteLogin();
void setAutocompleteLogin(Boolean autocompleteLogin);
}

View file

@ -0,0 +1,59 @@
/*
* This file is part of NavalPlan
*
* 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.
*
* 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
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.navalplanner.web.common;
import org.navalplanner.business.common.daos.IConfigurationDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.zkoss.zk.ui.util.GenericForwardComposer;
/**
* Controller for enable/disable the autocomplete login.
* @author Susana Montes Pedreira <smontes@wirelessgalicia.com>
*/
@Component
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class LoginController extends GenericForwardComposer {
private final String autocompletLoginValue = "admin";
@Autowired
private IConfigurationDAO configurationDAO;
@Override
public void doAfterCompose(org.zkoss.zk.ui.Component comp) throws Exception {
super.doAfterCompose(comp);
comp.setVariable("loginController", this, true);
}
/**
* It returns the login value in function of the property autocompleteLogin.
*/
public String getLoginValue() {
return configurationDAO.getConfigurationWithReadOnlyTransaction()
.isAutocompleteLogin() ? this.autocompletLoginValue : null;
}
}

View file

@ -181,6 +181,10 @@
<checkbox
label="${i18n:_('MonteCarlo method')}"
checked="@{configurationController.monteCarloMethodTabVisible}" />
<checkbox id="enableAutocompleteLogin"
label="${i18n:_('enable autocomplete login')}"
checked="@{configurationController.autocompleteLogin}"
onCheck="configurationController.reloadGeneralConfiguration();" />
</row>
<row>
<checkbox id="scenariosVisible"

View file

@ -25,10 +25,13 @@
<?xel-method prefix="project" name="version" class="org.navalplanner.business.common.VersionInformation"
signature="java.lang.String getVersion()"?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<div xmlns:n="http://www.zkoss.org/2005/zk/native">
<zscript>
<![CDATA[
controller = loginController;
contextPath = Executions.getCurrent().getContextPath();
logoLoginLink = contextPath + "/common/img/" +
org.navalplanner.web.I18nHelper._("en") + "/logo_login.png";
@ -72,7 +75,7 @@
<n:tr>
<n:td><label> </label>
<div align="center">
<n:input name="j_username" type="text" class="campotexto" id="textfield" size="30" value="admin" />
<n:input name="j_username" type="text" class="campotexto" id="textfield" size="30" value="${controller.loginValue}" />
</div></n:td>
</n:tr>
<n:tr>
@ -80,7 +83,7 @@
</n:tr>
<n:tr>
<n:td><div align="center">
<n:input name="j_password" type="password" class="campotexto" id="textfield2" size="30" value="admin"/>
<n:input name="j_password" type="password" class="campotexto" id="textfield2" size="30" value="${controller.loginValue}"/>
</div></n:td>
</n:tr>
<n:tr>