Style changes to User Accounts Page.
Style changes to Personal Timesheet Page. Changes to LibrePlan new version notification. Set timeout for email connection. Code refactoring.
This commit is contained in:
parent
e5d0fc5f36
commit
dd06b250c3
16 changed files with 161 additions and 145 deletions
2
NEWS.rst
2
NEWS.rst
|
|
@ -1712,7 +1712,7 @@ Changes
|
|||
* Use disabled textbox for capacity row in monthly timesheets
|
||||
* Set a pink background for days with zero capacity in the monthly timesheet
|
||||
* Fix align issues due to colspan in the first column of capacity and total rows
|
||||
* Add capcity row to monthly timesheets
|
||||
* Add capacity row to monthly timesheets
|
||||
* Add total row to monthly timesheets
|
||||
* Remove commented line
|
||||
* Add button to hide/show extra filtering options
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@ import org.apache.commons.logging.Log;
|
|||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
/**
|
||||
* It contains the current version of project and implements of singleton pattern. <br />
|
||||
* It contains the current version of project and implements of singleton pattern.
|
||||
* <br />
|
||||
* It also has a cached value with information about last project version published.
|
||||
* It checks the last version against a URL.
|
||||
*
|
||||
|
|
@ -42,15 +43,16 @@ public class VersionInformation {
|
|||
private static final Log LOG = LogFactory.getLog(VersionInformation.class);
|
||||
|
||||
/**
|
||||
* URL with a text file only with last number version of LibrePlan
|
||||
* URL with a text file only with last number version of LibrePlan.
|
||||
*/
|
||||
private static final String LIBREPLAN_VERSION_URL = "http://libreplan.org/VERSION";
|
||||
|
||||
|
||||
/**
|
||||
* Delay to wait till we check the URL again
|
||||
* Delay to wait till we check the URL again.
|
||||
* 1 Day.
|
||||
*/
|
||||
private static final long DELAY_TO_CHECK_URL = 24 * 60 * 60 * 1000L; // 1 day
|
||||
private static final long DELAY_TO_CHECK_URL = 24 * 60 * 60 * 1000L;
|
||||
|
||||
private static final VersionInformation singleton = new VersionInformation();
|
||||
|
||||
|
|
@ -69,14 +71,15 @@ public class VersionInformation {
|
|||
URL url = getURL();
|
||||
String lastVersion = (new BufferedReader(new InputStreamReader(url.openStream()))).readLine();
|
||||
if (projectVersion != null && lastVersion != null) {
|
||||
newVersionCached = !projectVersion.equals(lastVersion);
|
||||
Integer currentVersion = Integer.parseInt(projectVersion.replace(".", ""));
|
||||
Integer versionFromURL = Integer.parseInt(lastVersion.replace(".", ""));
|
||||
newVersionCached = versionFromURL > currentVersion;
|
||||
}
|
||||
} catch (MalformedURLException e) {
|
||||
LOG.warn("Problems generating URL to check LibrePlan version. MalformedURLException: " + e.getMessage());
|
||||
} catch (IOException e) {
|
||||
LOG.info(
|
||||
"Could not check LibrePlan version information from " +
|
||||
LIBREPLAN_VERSION_URL + ". IOException: " + e.getMessage());
|
||||
LOG.info("Could not check LibrePlan version information from " +
|
||||
LIBREPLAN_VERSION_URL + ". IOException: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
package org.libreplan.importers.notifications;
|
||||
|
||||
import org.libreplan.business.common.daos.IConnectorDAO;
|
||||
import org.libreplan.business.common.entities.Connector;
|
||||
import org.libreplan.business.common.entities.ConnectorProperty;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
|
|
@ -94,26 +93,30 @@ public class EmailConnectionValidator {
|
|||
Transport transport = null;
|
||||
|
||||
try {
|
||||
if ( protocol.equals("SMTP") ) {
|
||||
if ( "SMTP".equals(protocol) ) {
|
||||
properties.setProperty("mail.smtp.port", port);
|
||||
properties.setProperty("mail.smtp.host", host);
|
||||
properties.setProperty("mail.smtp.connectiontimeout", Integer.toString(3000));
|
||||
Session session = Session.getInstance(properties, null);
|
||||
|
||||
transport = session.getTransport("smtp");
|
||||
if ( "".equals(usrnme) && "".equals(psswrd) )
|
||||
if ( "".equals(usrnme) && "".equals(psswrd) ) {
|
||||
transport.connect();
|
||||
}
|
||||
|
||||
} else if ( protocol.equals("STARTTLS") ) {
|
||||
|
||||
} else if ( "STARTTLS".equals(protocol) ) {
|
||||
properties.setProperty("mail.smtps.port", port);
|
||||
properties.setProperty("mail.smtps.host", host);
|
||||
properties.setProperty("mail.smtp.connectiontimeout", Integer.toString(3000));
|
||||
properties.setProperty("mail.smtps.connectiontimeout", Integer.toString(3000));
|
||||
Session session = Session.getInstance(properties, null);
|
||||
|
||||
transport = session.getTransport("smtps");
|
||||
|
||||
if ( !"".equals(usrnme) && psswrd != null )
|
||||
if ( !"".equals(usrnme) && psswrd != null ) {
|
||||
transport.connect(host, usrnme, psswrd);
|
||||
}
|
||||
|
||||
}
|
||||
if ( transport != null && transport.isConnected() )
|
||||
return true;
|
||||
|
|
@ -128,19 +131,20 @@ public class EmailConnectionValidator {
|
|||
}
|
||||
|
||||
public List<ConnectorProperty> getEmailConnectorProperties() {
|
||||
Connector connector = connectorDAO.findUniqueByName("E-mail");
|
||||
|
||||
return connector.getProperties();
|
||||
return connectorDAO.findUniqueByName("E-mail").getProperties();
|
||||
}
|
||||
|
||||
public boolean isConnectionActivated() {
|
||||
List<ConnectorProperty> emailConnectorProperties = getEmailConnectorProperties();
|
||||
|
||||
for (ConnectorProperty item : emailConnectorProperties) {
|
||||
if ( item.getKey().equals("Activated") )
|
||||
if ( item.getValue().equals("Y") )
|
||||
if ( "Activated".equals(item.getKey()) ) {
|
||||
if ( "Y".equals(item.getValue()) ) {
|
||||
return true;
|
||||
else break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -487,6 +487,7 @@ public class ConfigurationController extends GenericForwardComposer {
|
|||
if ("SMTP".equals(protocolsCombobox.getSelectedItem().getLabel())) {
|
||||
props.setProperty("mail.smtp.port", port);
|
||||
props.setProperty("mail.smtp.host", host);
|
||||
props.setProperty("mail.smtp.connectiontimeout", Integer.toString(3000));
|
||||
Session session = Session.getInstance(props, null);
|
||||
|
||||
transport = session.getTransport("smtp");
|
||||
|
|
@ -497,6 +498,7 @@ public class ConfigurationController extends GenericForwardComposer {
|
|||
else if (STARTTLS_PROTOCOL.equals(protocolsCombobox.getSelectedItem().getLabel())) {
|
||||
props.setProperty("mail.smtps.port", port);
|
||||
props.setProperty("mail.smtps.host", host);
|
||||
props.setProperty("mail.smtps.connectiontimeout", Integer.toString(3000));
|
||||
Session session = Session.getInstance(props, null);
|
||||
|
||||
transport = session.getTransport("smtps");
|
||||
|
|
|
|||
|
|
@ -121,16 +121,38 @@ public class GatheredUsageStats {
|
|||
private String oldestDate;
|
||||
|
||||
public GatheredUsageStats() {
|
||||
this.userDAO = (IUserDAO) SpringUtil.getBean("userDAO");
|
||||
this.orderModel = (IOrderModel) SpringUtil.getBean("orderModel");
|
||||
this.workReportModel = (IWorkReportModel) SpringUtil.getBean("workReportModel");
|
||||
this.workerModel = (IWorkerModel) SpringUtil.getBean("workerModel");
|
||||
this.machineModel = (IMachineModel) SpringUtil.getBean("machineModel");
|
||||
this.expenseSheetModel = (IExpenseSheetModel) SpringUtil.getBean("expenseSheetModel");
|
||||
this.materialsModel = (IMaterialsModel) SpringUtil.getBean("materialsModel");
|
||||
if ( this.userDAO == null ) {
|
||||
this.userDAO = (IUserDAO) SpringUtil.getBean("userDAO");
|
||||
}
|
||||
|
||||
this.assignedTaskQualityFormsToOrderElementModel = (IAssignedTaskQualityFormsToOrderElementModel)
|
||||
SpringUtil.getBean("assignedTaskQualityFormsToOrderElementModel");
|
||||
if ( this.orderModel == null ) {
|
||||
this.orderModel = (IOrderModel) SpringUtil.getBean("orderModel");
|
||||
}
|
||||
|
||||
if ( this.workReportModel == null ) {
|
||||
this.workReportModel = (IWorkReportModel) SpringUtil.getBean("workReportModel");
|
||||
}
|
||||
|
||||
if ( this.workerModel == null ) {
|
||||
this.workerModel = (IWorkerModel) SpringUtil.getBean("workerModel");
|
||||
}
|
||||
|
||||
if ( this.machineModel == null ) {
|
||||
this.machineModel = (IMachineModel) SpringUtil.getBean("machineModel");
|
||||
}
|
||||
|
||||
if ( this.expenseSheetModel == null ) {
|
||||
this.expenseSheetModel = (IExpenseSheetModel) SpringUtil.getBean("expenseSheetModel");
|
||||
}
|
||||
|
||||
if ( this.materialsModel == null ) {
|
||||
this.materialsModel = (IMaterialsModel) SpringUtil.getBean("materialsModel");
|
||||
}
|
||||
|
||||
if ( this.assignedTaskQualityFormsToOrderElementModel == null ) {
|
||||
this.assignedTaskQualityFormsToOrderElementModel = (IAssignedTaskQualityFormsToOrderElementModel)
|
||||
SpringUtil.getBean("assignedTaskQualityFormsToOrderElementModel");
|
||||
}
|
||||
|
||||
initialize();
|
||||
}
|
||||
|
|
@ -160,7 +182,8 @@ public class GatheredUsageStats {
|
|||
sb.append(Integer.toString((anEncoded & 0xff) + 0x100, 16).substring(1));
|
||||
}
|
||||
|
||||
} catch (NoSuchAlgorithmException | UnsupportedEncodingException ignored) {}
|
||||
} catch (NoSuchAlgorithmException | UnsupportedEncodingException ignored) {
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
|
@ -229,7 +252,6 @@ public class GatheredUsageStats {
|
|||
connection.getInputStream();
|
||||
|
||||
} catch (IOException ignored) {
|
||||
|
||||
} finally {
|
||||
if ( connection != null ) {
|
||||
connection.disconnect();
|
||||
|
|
|
|||
|
|
@ -91,11 +91,7 @@ public class TemplateController extends GenericForwardComposer {
|
|||
}
|
||||
|
||||
public List<Scenario> getScenarios() {
|
||||
if ( templateModel == null ) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return templateModel.getScenarios();
|
||||
return templateModel == null ? Collections.emptyList() : templateModel.getScenarios();
|
||||
}
|
||||
|
||||
public String getCompanyLogoURL() {
|
||||
|
|
@ -183,7 +179,6 @@ public class TemplateController extends GenericForwardComposer {
|
|||
return asDisplayProperty(templateModel.hasChangedDefaultPassword(mandatoryUser));
|
||||
}
|
||||
|
||||
|
||||
private String asDisplayProperty(boolean passwordChanged) {
|
||||
return passwordChanged ? "none" : "inline";
|
||||
}
|
||||
|
|
@ -229,13 +224,9 @@ public class TemplateController extends GenericForwardComposer {
|
|||
}
|
||||
|
||||
public boolean isNewVersionAvailable() {
|
||||
if ( templateModel.isCheckNewVersionEnabled() ) {
|
||||
|
||||
if ( VersionInformation.isNewVersionAvailable() ){
|
||||
lastVersionNumber = VersionInformation.getLastVersion();
|
||||
|
||||
return true;
|
||||
}
|
||||
if ( templateModel.isCheckNewVersionEnabled() && VersionInformation.isNewVersionAvailable() ) {
|
||||
lastVersionNumber = VersionInformation.getLastVersion();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -243,14 +234,15 @@ public class TemplateController extends GenericForwardComposer {
|
|||
|
||||
public String getUsername() {
|
||||
CustomUser user = SecurityUtils.getLoggedUser();
|
||||
|
||||
return (user == null) ? "" : user.getUsername();
|
||||
}
|
||||
|
||||
public String getVersionMessage(){
|
||||
return _("A new version ") +
|
||||
lastVersionNumber +
|
||||
_(" of LibrePlan is available. Please check next link for more information:");
|
||||
/**
|
||||
* Should be public!
|
||||
* Used in template.zul
|
||||
*/
|
||||
public String getVersionMessage() {
|
||||
return _("A new version ") + lastVersionNumber + _(" of LibrePlan is available. Please check next link for more information:");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -424,10 +424,10 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
}
|
||||
} else {
|
||||
|
||||
SortedSet<CalculatedConsolidatedValue> consolcalculatedConsolidatedValuestedValues =
|
||||
SortedSet<CalculatedConsolidatedValue> calculatedConsolidatedValuestedValues =
|
||||
((CalculatedConsolidation) consolidation).getCalculatedConsolidatedValues();
|
||||
|
||||
for (CalculatedConsolidatedValue consolidatedValue : consolcalculatedConsolidatedValuestedValues) {
|
||||
for (CalculatedConsolidatedValue consolidatedValue : calculatedConsolidatedValuestedValues) {
|
||||
consolidationDTOs.add(new AdvanceConsolidationDTO(null, consolidatedValue));
|
||||
}
|
||||
}
|
||||
|
|
@ -469,7 +469,7 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
|
||||
@Override
|
||||
public boolean isVisibleMessages() {
|
||||
return getAdvances().size() == 0 || isSubcontracted() || !hasResourceAllocation();
|
||||
return getAdvances().isEmpty() || isSubcontracted() || !hasResourceAllocation();
|
||||
}
|
||||
|
||||
private boolean advanceIsCalculated(){
|
||||
|
|
@ -477,7 +477,7 @@ public class AdvanceConsolidationModel implements IAdvanceConsolidationModel {
|
|||
}
|
||||
|
||||
public String infoMessages() {
|
||||
return getAdvances().size() > 0
|
||||
return !getAdvances().isEmpty()
|
||||
? _("Progress cannot be consolidated.")
|
||||
: _("There is not any assigned progress to current task");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ public final class SecurityUtils {
|
|||
public static boolean isGatheredStatsAlreadySent = false;
|
||||
|
||||
private SecurityUtils() {
|
||||
|
||||
}
|
||||
|
||||
public static boolean isUserInRole(UserRole role) {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ import java.util.List;
|
|||
import static org.libreplan.web.I18nHelper._;
|
||||
|
||||
/**
|
||||
* Controller for CRUD actions over a {@link Profile}
|
||||
* Controller for CRUD actions over a {@link Profile}.
|
||||
*
|
||||
* @author Jacobo Aragunde Perez <jaragunde@igalia.com>
|
||||
* @author Diego Pino García <dpino@igalia.com>
|
||||
|
|
@ -57,8 +57,10 @@ public class ProfileCRUDController extends BaseCRUDController<Profile> {
|
|||
|
||||
private Combobox userRolesCombo;
|
||||
|
||||
public ProfileCRUDController(){
|
||||
profileModel = (IProfileModel) SpringUtil.getBean("profileModel");
|
||||
public ProfileCRUDController() {
|
||||
if ( profileModel == null ) {
|
||||
profileModel = (IProfileModel) SpringUtil.getBean("profileModel");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -70,6 +72,7 @@ public class ProfileCRUDController extends BaseCRUDController<Profile> {
|
|||
|
||||
/**
|
||||
* Appends the existing UserRoles to the Combobox passed.
|
||||
*
|
||||
* @param combo
|
||||
*/
|
||||
private void appendAllUserRolesExceptRoleBoundUser(Combobox combo) {
|
||||
|
|
@ -82,7 +85,7 @@ public class ProfileCRUDController extends BaseCRUDController<Profile> {
|
|||
}
|
||||
}
|
||||
|
||||
protected void save() throws ValidationException{
|
||||
protected void save() throws ValidationException {
|
||||
profileModel.confirmSave();
|
||||
}
|
||||
|
||||
|
|
@ -96,8 +99,8 @@ public class ProfileCRUDController extends BaseCRUDController<Profile> {
|
|||
|
||||
public void addSelectedRole() {
|
||||
Comboitem comboItem = userRolesCombo.getSelectedItem();
|
||||
if(comboItem != null) {
|
||||
addRole((UserRole)comboItem.getValue());
|
||||
if (comboItem != null) {
|
||||
addRole(comboItem.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -145,8 +148,7 @@ public class ProfileCRUDController extends BaseCRUDController<Profile> {
|
|||
profileModel.checkHasUsers(profile);
|
||||
return false;
|
||||
} catch (ValidationException e) {
|
||||
showCannotDeleteProfileDialog(e.getInvalidValue().getMessage()
|
||||
);
|
||||
showCannotDeleteProfileDialog(e.getInvalidValue().getMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -85,12 +85,9 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
|
||||
private Combobox profilesCombo;
|
||||
|
||||
private Button showCreateForm;
|
||||
|
||||
private IURLHandlerRegistry URLHandlerRegistry;
|
||||
|
||||
public UserCRUDController() {
|
||||
|
||||
}
|
||||
|
||||
private RowRenderer usersRenderer = (row, data, i) -> {
|
||||
|
|
@ -103,8 +100,8 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
Util.appendLabel(row, _(user.getUserType().toString()));
|
||||
Util.appendLabel(row, user.isBound() ? user.getWorker().getShortDescription() : "");
|
||||
|
||||
Button[] buttons = Util.appendOperationsAndOnClickEvent(row,
|
||||
event -> goToEditForm(user), event -> confirmDelete(user));
|
||||
Button[] buttons =
|
||||
Util.appendOperationsAndOnClickEvent(row, event -> goToEditForm(user), event -> confirmDelete(user));
|
||||
|
||||
// Disable remove button for default admin as it's mandatory
|
||||
if ( isDefaultAdmin(user) ) {
|
||||
|
|
@ -122,7 +119,10 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
passwordBox = (Textbox) editWindow.getFellowIfAny("password");
|
||||
passwordConfirmationBox = (Textbox) editWindow.getFellowIfAny("passwordConfirmation");
|
||||
profilesCombo = (Combobox) editWindow.getFellowIfAny("profilesCombo");
|
||||
|
||||
userRolesCombo = (Combobox) editWindow.getFellowIfAny("userRolesCombo");
|
||||
userRolesCombo.setWidth("320px");
|
||||
|
||||
appendAllUserRolesExceptRoleBoundUser(userRolesCombo);
|
||||
appendAllProfiles(profilesCombo);
|
||||
boundResourceGroupbox = (Groupbox) editWindow.getFellowIfAny("boundResourceGroupbox");
|
||||
|
|
@ -132,14 +132,26 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
}
|
||||
|
||||
private void injectsObjects() {
|
||||
userModel = (IUserModel) SpringUtil.getBean("userModel");
|
||||
limitsModel = (ILimitsModel) SpringUtil.getBean("limitsModel");
|
||||
workerCRUD = (IWorkerCRUDControllerEntryPoints) SpringUtil.getBean("workerCRUD");
|
||||
URLHandlerRegistry = (IURLHandlerRegistry) SpringUtil.getBean("URLHandlerRegistry");
|
||||
if ( userModel == null ) {
|
||||
userModel = (IUserModel) SpringUtil.getBean("userModel");
|
||||
}
|
||||
|
||||
if ( limitsModel == null ) {
|
||||
limitsModel = (ILimitsModel) SpringUtil.getBean("limitsModel");
|
||||
}
|
||||
|
||||
if ( workerCRUD == null ) {
|
||||
workerCRUD = (IWorkerCRUDControllerEntryPoints) SpringUtil.getBean("workerCRUD");
|
||||
}
|
||||
|
||||
if ( URLHandlerRegistry == null ) {
|
||||
URLHandlerRegistry = (IURLHandlerRegistry) SpringUtil.getBean("URLHandlerRegistry");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the existing UserRoles to the Combobox passed.
|
||||
*
|
||||
* @param combo
|
||||
*/
|
||||
private void appendAllUserRolesExceptRoleBoundUser(Combobox combo) {
|
||||
|
|
@ -188,7 +200,7 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
public void addSelectedRole() {
|
||||
Comboitem comboItem = userRolesCombo.getSelectedItem();
|
||||
|
||||
if(comboItem != null) {
|
||||
if (comboItem != null) {
|
||||
addRole(comboItem.getValue());
|
||||
}
|
||||
}
|
||||
|
|
@ -210,7 +222,7 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
public void addSelectedProfile() {
|
||||
Comboitem comboItem = profilesCombo.getSelectedItem();
|
||||
|
||||
if(comboItem != null) {
|
||||
if (comboItem != null) {
|
||||
addProfile(comboItem.getValue());
|
||||
}
|
||||
}
|
||||
|
|
@ -226,22 +238,21 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
}
|
||||
|
||||
/**
|
||||
* Tells the XXXModel to set the password attribute of the inner
|
||||
* {@ link User} object.
|
||||
* Tells the XXXModel to set the password attribute of the inner {@link User} object.
|
||||
*
|
||||
* @param password String with the <b>unencrypted</b> password.
|
||||
*/
|
||||
public void setPassword(String password) {
|
||||
userModel.setPassword(password);
|
||||
//update the constraint on the confirmation password box
|
||||
((Textbox)editWindow.getFellowIfAny("passwordConfirmation")).clearErrorMessage(true);
|
||||
// Update the constraint on the confirmation password box
|
||||
((Textbox) editWindow.getFellowIfAny("passwordConfirmation")).clearErrorMessage(true);
|
||||
}
|
||||
|
||||
public Constraint validatePasswordConfirmation() {
|
||||
return (comp, value) -> {
|
||||
((Textbox)comp).setRawValue(value);
|
||||
((Textbox) comp).setRawValue(value);
|
||||
|
||||
if(!value.equals(passwordBox.getValue())) {
|
||||
if (!value.equals(passwordBox.getValue())) {
|
||||
throw new WrongValueException(comp, _("passwords don't match"));
|
||||
}
|
||||
};
|
||||
|
|
@ -260,25 +271,29 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
@Override
|
||||
protected void initCreate() {
|
||||
userModel.initCreate();
|
||||
//password is compulsory when creating
|
||||
|
||||
// Password is compulsory when creating
|
||||
passwordBox.setConstraint("no empty:" + _("Password cannot be empty"));
|
||||
//clean the password boxes, they are not cleared automatically
|
||||
//because they are not directly associated to an attribute
|
||||
|
||||
// Clean the password boxes, they are not cleared automatically because they are not directly associated to an attribute
|
||||
passwordBox.setRawValue("");
|
||||
passwordConfirmationBox.setRawValue("");
|
||||
|
||||
prepareAuthenticationTypesCombo();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initEdit(User user) {
|
||||
userModel.initEdit(user);
|
||||
//password is not compulsory when editing, so we remove
|
||||
//the constraint
|
||||
|
||||
// Password is not compulsory when editing, so we remove the constraint
|
||||
passwordBox.setConstraint((Constraint)null);
|
||||
//cleans the box and forces the check of the new Constraint (null)
|
||||
|
||||
// Cleans the box and forces the check of the new Constraint (null)
|
||||
passwordBox.setValue("");
|
||||
passwordConfirmationBox.setValue("");
|
||||
//setup authentication type combo box
|
||||
|
||||
// Setup authentication type combo box
|
||||
prepareAuthenticationTypesCombo();
|
||||
}
|
||||
|
||||
|
|
@ -305,12 +320,11 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
@Override
|
||||
protected boolean beforeDeleting(User user) {
|
||||
Worker worker = user.getWorker();
|
||||
|
||||
return worker == null ||
|
||||
Messagebox.show(_("User is bound to resource \"{0}\" and it will be unbound. " +
|
||||
"Do you want to continue with user removal?",
|
||||
worker.getShortDescription()),
|
||||
_("Confirm remove user"),
|
||||
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION) == Messagebox.YES;
|
||||
"Do you want to continue with user removal?", worker.getShortDescription()),
|
||||
_("Confirm remove user"), Messagebox.YES | Messagebox.NO, Messagebox.QUESTION) == Messagebox.YES;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -320,16 +334,15 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
|
||||
public boolean isLdapUser() {
|
||||
User user = userModel.getUser();
|
||||
|
||||
return user != null && !user.isLibrePlanUser();
|
||||
}
|
||||
|
||||
public boolean isLdapUserLdapConfiguration() {
|
||||
return (isLdapUser() && userModel.isLDAPBeingUsed());
|
||||
return isLdapUser() && userModel.isLDAPBeingUsed();
|
||||
}
|
||||
|
||||
public boolean getLdapUserRolesLdapConfiguration() {
|
||||
return (isLdapUser() && userModel.isLDAPRolesBeingUsed());
|
||||
return isLdapUser() && userModel.isLDAPRolesBeingUsed();
|
||||
}
|
||||
|
||||
public RowRenderer getRolesRenderer() {
|
||||
|
|
@ -339,6 +352,7 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
row.appendChild(new Label(_(role.getDisplayName())));
|
||||
|
||||
Button removeButton = Util.createRemoveButton(event -> removeRole(role));
|
||||
|
||||
removeButton.setDisabled(areRolesAndProfilesDisabled() ||
|
||||
role.equals(UserRole.ROLE_BOUND_USER) || isUserDefaultAdmin());
|
||||
|
||||
|
|
@ -352,25 +366,16 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
|
||||
public String hasBoundResource() {
|
||||
User user = getUser();
|
||||
if (user != null && user.isBound()) {
|
||||
return _("Yes");
|
||||
}
|
||||
|
||||
return _("No");
|
||||
return user != null && user.isBound() ? _("Yes") : _("No");
|
||||
}
|
||||
|
||||
public String getBoundResource() {
|
||||
User user = getUser();
|
||||
if (user != null && user.isBound()) {
|
||||
return user.getWorker().getShortDescription();
|
||||
}
|
||||
|
||||
return "";
|
||||
return user != null && user.isBound() ? user.getWorker().getShortDescription() : "";
|
||||
}
|
||||
|
||||
public boolean isBound() {
|
||||
User user = getUser();
|
||||
|
||||
return user != null && user.isBound();
|
||||
}
|
||||
|
||||
|
|
@ -383,10 +388,8 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
}
|
||||
|
||||
private int showConfirmWorkerEditionDialog() {
|
||||
return Messagebox
|
||||
.show(_("Unsaved changes will be lost. Would you like to continue?"),
|
||||
_("Confirm edit worker"), Messagebox.OK
|
||||
| Messagebox.CANCEL, Messagebox.QUESTION);
|
||||
return Messagebox.show(_("Unsaved changes will be lost. Would you like to continue?"),
|
||||
_("Confirm edit worker"), Messagebox.OK | Messagebox.CANCEL, Messagebox.QUESTION);
|
||||
}
|
||||
|
||||
public void unboundResource() {
|
||||
|
|
@ -399,11 +402,7 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
}
|
||||
|
||||
public String getWorkerEditionButtonTooltip() {
|
||||
if (isNoRoleWorkers()) {
|
||||
return _("You do not have permissions to go to edit worker window");
|
||||
}
|
||||
|
||||
return "";
|
||||
return isNoRoleWorkers() ? _("You do not have permissions to go to edit worker window") : "";
|
||||
}
|
||||
|
||||
private boolean isDefaultAdmin(final User user) {
|
||||
|
|
@ -412,7 +411,6 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
|
||||
private boolean isUserDefaultAdmin() {
|
||||
User user = userModel.getUser();
|
||||
|
||||
return user != null && isDefaultAdmin(user);
|
||||
}
|
||||
|
||||
|
|
@ -426,18 +424,12 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
|
||||
public UserAuthenticationType getAuthenticationType() {
|
||||
User user = getUser();
|
||||
if (user != null) {
|
||||
return user.getUserType();
|
||||
}
|
||||
|
||||
return null;
|
||||
return user != null ? user.getUserType() : null;
|
||||
}
|
||||
|
||||
public void setAuthenticationType(Comboitem item) {
|
||||
if (item == null) {
|
||||
throw new WrongValueException(
|
||||
editWindow.getFellowIfAny("authenticationTypeCombo"),
|
||||
_("cannot be empty"));
|
||||
throw new WrongValueException(editWindow.getFellowIfAny("authenticationTypeCombo"), _("cannot be empty"));
|
||||
}
|
||||
|
||||
UserAuthenticationType authenticationType = item.getValue();
|
||||
|
|
@ -451,7 +443,6 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
public boolean isCreateButtonDisabled() {
|
||||
Limits usersTypeLimit = limitsModel.getUsersType();
|
||||
Integer usersCount = userModel.getRowCount().intValue();
|
||||
|
||||
return usersTypeLimit != null && usersCount >= usersTypeLimit.getValue();
|
||||
}
|
||||
|
||||
|
|
@ -464,9 +455,8 @@ public class UserCRUDController extends BaseCRUDController<User> implements IUse
|
|||
Integer usersCount = userModel.getRowCount().intValue();
|
||||
int usersLeft = usersTypeLimit.getValue() - usersCount;
|
||||
|
||||
if ( usersCount >= usersTypeLimit.getValue() )
|
||||
return _("User limit reached");
|
||||
|
||||
return _("Create") + " ( " + usersLeft + " " + _("left") + " )";
|
||||
return usersCount >= usersTypeLimit.getValue()
|
||||
? _("User limit reached")
|
||||
: _("Create") + " ( " + usersLeft + " " + _("left") + " )";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -251,7 +251,10 @@ public class PersonalTimesheetController extends GenericForwardComposer implemen
|
|||
|
||||
private void openPersonalTimesheetPopup(Textbox textbox, OrderElement orderElement, LocalDate textboxDate) {
|
||||
Textbox toFocus = setupPersonalTimesheetPopup(textbox, orderElement, textboxDate);
|
||||
|
||||
personalTimesheetPopup.open(textbox, "after_start");
|
||||
((Column) personalTimesheetPopup.getChildren().get(0).getChildren().get(0).getChildren().get(0)).setWidth("60px");
|
||||
|
||||
toFocus.setFocus(true);
|
||||
}
|
||||
|
||||
|
|
@ -419,16 +422,16 @@ public class PersonalTimesheetController extends GenericForwardComposer implemen
|
|||
|
||||
private void renderCapacityRow(Row row) {
|
||||
appendLabelSpaningTwoColumns(row, _("Capacity"));
|
||||
appendCapcityForDaysAndTotal(row);
|
||||
appendCapacityForDaysAndTotal(row);
|
||||
}
|
||||
|
||||
private void appendCapcityForDaysAndTotal(Row row) {
|
||||
private void appendCapacityForDaysAndTotal(Row row) {
|
||||
EffortDuration totalCapacity = EffortDuration.zero();
|
||||
|
||||
for (LocalDate day = first; day.compareTo(last) <= 0; day = day.plusDays(1)) {
|
||||
EffortDuration capacity = personalTimesheetModel.getResourceCapacity(day);
|
||||
|
||||
Cell cell = getCenteredCell(getDisabledTextbox(getCapcityColumnTextboxId(day), capacity));
|
||||
Cell cell = getCenteredCell(getDisabledTextbox(getCapacityColumnTextboxId(day), capacity));
|
||||
|
||||
if ( personalTimesheetModel.getResourceCapacity(day).isZero() ) {
|
||||
setBackgroundNonCapacityCell(cell);
|
||||
|
|
@ -471,7 +474,7 @@ public class PersonalTimesheetController extends GenericForwardComposer implemen
|
|||
|
||||
private void updateExtraRow(LocalDate date) {
|
||||
EffortDuration total = getEffortDuration(getTotalColumnTextboxId(date));
|
||||
EffortDuration capacity = getEffortDuration(getCapcityColumnTextboxId(date));
|
||||
EffortDuration capacity = getEffortDuration(getCapacityColumnTextboxId(date));
|
||||
|
||||
EffortDuration extra = EffortDuration.zero();
|
||||
if ( total.compareTo(capacity) > 0 ) {
|
||||
|
|
@ -837,7 +840,7 @@ public class PersonalTimesheetController extends GenericForwardComposer implemen
|
|||
return "textbox-other-capacity";
|
||||
}
|
||||
|
||||
private static String getCapcityColumnTextboxId(LocalDate date) {
|
||||
private static String getCapacityColumnTextboxId(LocalDate date) {
|
||||
return "textbox-capacity-column-" + date;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
<http auto-config="false" realm="LibrePlan Web Application" >
|
||||
|
||||
<!-- In Spring 4.1.0 it is useless to use hasRole() for single role because Spring calling hasAnyRole() anyway -->
|
||||
|
||||
<!-- Web services -->
|
||||
<intercept-url pattern="/ws/rest/bounduser/**" access="hasAnyRole('ROLE_BOUND_USER')" method="GET" />
|
||||
<intercept-url pattern="/ws/rest/bounduser/**" access="hasAnyRole('ROLE_BOUND_USER')" method="POST" />
|
||||
|
|
|
|||
|
|
@ -1094,11 +1094,11 @@ span.z-dottree-line {
|
|||
background-position: 18px 10px;
|
||||
}
|
||||
|
||||
.label-highlight:hover{
|
||||
.label-highlight:hover {
|
||||
background-color: #aacbff;
|
||||
}
|
||||
|
||||
.global-dashboard-grid{
|
||||
.global-dashboard-grid {
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<window apply="org.libreplan.web.dashboard.DashboardControllerGlobal" contentStyle="overflow:auto;">
|
||||
|
||||
<checkbox id="storedColumnVisible" label="${i18n:_('Show archived column data')}"
|
||||
checked="true" onCheck="dashboardControllerGlobal.showStoredColumn()"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -51,9 +51,8 @@
|
|||
<groupbox closable="false">
|
||||
<caption label="${i18n:_('Association with roles')}" />
|
||||
<hbox align="center" sclass="report-margin">
|
||||
<combobox id="userRolesCombo" autodrop="true" />
|
||||
<button label="${i18n:_('Add role')}" sclass="add-button"
|
||||
onClick="controller.addSelectedRole()"/>
|
||||
<combobox id="userRolesCombo" autodrop="true"/>
|
||||
<button label="${i18n:_('Add role')}" sclass="add-button" onClick="controller.addSelectedRole()"/>
|
||||
</hbox>
|
||||
<grid id="listing" model="@{controller.roles}"
|
||||
rowRenderer="@{controller.rolesRenderer}">
|
||||
|
|
@ -68,13 +67,10 @@
|
|||
</tabbox>
|
||||
|
||||
<button onClick="controller.saveAndExit();" autodisable="self"
|
||||
label="${i18n:_('Save')}"
|
||||
sclass="save-button global-action" />
|
||||
label="${i18n:_('Save')}" sclass="save-button global-action" />
|
||||
<button onClick="controller.saveAndContinue();"
|
||||
label="${i18n:_('Save & Continue')}"
|
||||
sclass="saveandcontinue-button global-action" />
|
||||
label="${i18n:_('Save & Continue')}" sclass="saveandcontinue-button global-action" />
|
||||
<button onClick="controller.cancelForm();"
|
||||
label="${i18n:_('Cancel')}"
|
||||
sclass="cancel-button global-action" />
|
||||
label="${i18n:_('Cancel')}" sclass="cancel-button global-action" />
|
||||
|
||||
</window>
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@
|
|||
visible="@{controller.areRolesAndProfilesDisabled}" />
|
||||
</vbox>
|
||||
<hbox align="center" style="margin: 2px 0 2px 0">
|
||||
<combobox id="profilesCombo" autodrop="true" />
|
||||
<combobox id="profilesCombo" autodrop="true" width="250px" />
|
||||
<button label="${i18n:_('Add profile')}" sclass="add-button"
|
||||
onClick="controller.addSelectedProfile()"
|
||||
disabled="@{controller.areRolesAndProfilesDisabled}" />
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue