diff --git a/libreplan-business/src/main/java/org/libreplan/business/common/Registry.java b/libreplan-business/src/main/java/org/libreplan/business/common/Registry.java index 441e6d264..0d50523e7 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/common/Registry.java +++ b/libreplan-business/src/main/java/org/libreplan/business/common/Registry.java @@ -40,6 +40,8 @@ import org.libreplan.business.expensesheet.daos.IExpenseSheetLineDAO; import org.libreplan.business.externalcompanies.daos.IExternalCompanyDAO; import org.libreplan.business.labels.daos.ILabelDAO; import org.libreplan.business.labels.daos.ILabelTypeDAO; +import org.libreplan.business.logs.daos.IIssueLogDAO; +import org.libreplan.business.logs.daos.IRiskLogDAO; import org.libreplan.business.materials.daos.IMaterialCategoryDAO; import org.libreplan.business.materials.daos.IMaterialDAO; import org.libreplan.business.materials.daos.IUnitTypeDAO; @@ -200,6 +202,12 @@ public class Registry { @Autowired private IExpenseSheetDAO expenseSheetDAO; + @Autowired + private IIssueLogDAO issueLogDAO; + + @Autowired + private IRiskLogDAO riskLogDAO; + @Autowired private IExpenseSheetLineDAO expenseSheetLineDAO; @@ -383,6 +391,12 @@ public class Registry { return getInstance().expenseSheetDAO; } + public static IIssueLogDAO getIssueLogDAO() { + return getInstance().issueLogDAO; + } + + public static IRiskLogDAO getRiskLogDAO() {return getInstance().riskLogDAO;} + public static IExpenseSheetLineDAO getExpenseSheetLineDAO() { return getInstance().expenseSheetLineDAO; } diff --git a/libreplan-business/src/main/java/org/libreplan/business/common/entities/Configuration.java b/libreplan-business/src/main/java/org/libreplan/business/common/entities/Configuration.java index c56edd8ff..e6a811070 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/common/entities/Configuration.java +++ b/libreplan-business/src/main/java/org/libreplan/business/common/entities/Configuration.java @@ -48,6 +48,8 @@ public class Configuration extends BaseEntity { private String companyCode; + private Boolean generateCodeForProjectLog = true; + private Boolean generateCodeForCriterion = true; private Boolean generateCodeForLabel = true; @@ -202,6 +204,12 @@ public class Configuration extends BaseEntity { return true; } + //TODO 2 added methods follow below + public void setGeneratedCodeForProjectLog(Boolean generateCodeForProjectLog) { + this.generateCodeForProjectLog = generateCodeForProjectLog; + } + public Boolean getGenerateCodeForProjectLog(){ return generateCodeForProjectLog;} + public void setGenerateCodeForCriterion(Boolean generateCodeForCriterion) { this.generateCodeForCriterion = generateCodeForCriterion; } diff --git a/libreplan-business/src/main/java/org/libreplan/business/common/entities/EntityNameEnum.java b/libreplan-business/src/main/java/org/libreplan/business/common/entities/EntityNameEnum.java index 25e25f062..f8f127d53 100644 --- a/libreplan-business/src/main/java/org/libreplan/business/common/entities/EntityNameEnum.java +++ b/libreplan-business/src/main/java/org/libreplan/business/common/entities/EntityNameEnum.java @@ -31,6 +31,8 @@ import org.libreplan.business.costcategories.entities.ResourcesCostCategoryAssig import org.libreplan.business.costcategories.entities.TypeOfWorkHours; import org.libreplan.business.expensesheet.entities.ExpenseSheet; import org.libreplan.business.labels.entities.LabelType; +import org.libreplan.business.logs.entities.IssueLog; +import org.libreplan.business.logs.entities.RiskLog; import org.libreplan.business.materials.entities.MaterialCategory; import org.libreplan.business.materials.entities.UnitType; import org.libreplan.business.orders.entities.Order; @@ -56,7 +58,7 @@ public enum EntityNameEnum { "Calendar exception day", true), COST_CATEGORY("Cost category", true), RESOURCE_CALENDAR("Resource calendar", true), CRITERION_SATISFACTION( "Criterion satisfaction", true), RESOURCE_COST_CATEGORY_ASSIGNMENT( - "Resource cost category assignment", true), EXPENSE_SHEET("Expense sheet", true); + "Resource cost category assignment", true), EXPENSE_SHEET("Expense sheet", true), ISSUE_LOG("Issue log", true), RISK_LOG("Risk log", true); private String description; @@ -121,6 +123,13 @@ public enum EntityNameEnum { .getResourcesCostCategoryAssignmentDAO(); case EXPENSE_SHEET: return (IIntegrationEntityDAO) Registry.getExpenseSheetDAO(); + + case ISSUE_LOG: + return (IIntegrationEntityDAO) Registry.getIssueLogDAO(); + + case RISK_LOG: + return (IIntegrationEntityDAO) Registry.getRiskLogDAO(); + default: throw new RuntimeException("can't handle the code sequence of the " + description); diff --git a/libreplan-business/src/main/java/org/libreplan/business/logs/daos/IIssueLogDAO.java b/libreplan-business/src/main/java/org/libreplan/business/logs/daos/IIssueLogDAO.java new file mode 100644 index 000000000..95966063d --- /dev/null +++ b/libreplan-business/src/main/java/org/libreplan/business/logs/daos/IIssueLogDAO.java @@ -0,0 +1,40 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ + +package org.libreplan.business.logs.daos; + +import java.util.List; + +import org.libreplan.business.common.daos.IIntegrationEntityDAO; +import org.libreplan.business.logs.entities.IssueLog; + +/** + * Contract for {@link IssueLogDAO} + * + * @author Miciele Ghiorghis + */ +public interface IIssueLogDAO extends IIntegrationEntityDAO { + + /** + * Gets all the issue-logs + * + * @return a list of {@link IssueLog} objects + */ + List getIssueLogs(); +} diff --git a/libreplan-business/src/main/java/org/libreplan/business/logs/daos/IProjectLogDAO.java b/libreplan-business/src/main/java/org/libreplan/business/logs/daos/IProjectLogDAO.java new file mode 100644 index 000000000..cbe212ade --- /dev/null +++ b/libreplan-business/src/main/java/org/libreplan/business/logs/daos/IProjectLogDAO.java @@ -0,0 +1,49 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ + +package org.libreplan.business.logs.daos; + +import java.util.List; + +import org.libreplan.business.common.daos.IIntegrationEntityDAO; +import org.libreplan.business.logs.entities.IssueLog; +import org.libreplan.business.logs.entities.ProjectLog; +import org.libreplan.business.logs.entities.RiskLog; + +/** + * Contract for {@link ProjectLogDAO} + * + * @author Miciele Ghiorghis + */ +public interface IProjectLogDAO extends IIntegrationEntityDAO { + + /** + * Gets all the issue-logs + * + * @return a list of {@link IssueLog} objects + */ + List getIssueLogs(); + + /** + * Gets all the risk logs + * + * @return a list of {@link RiskLog} objects + */ + List getRiskLogs(); +} diff --git a/libreplan-business/src/main/java/org/libreplan/business/logs/daos/IRiskLogDAO.java b/libreplan-business/src/main/java/org/libreplan/business/logs/daos/IRiskLogDAO.java new file mode 100644 index 000000000..bcc20a7f6 --- /dev/null +++ b/libreplan-business/src/main/java/org/libreplan/business/logs/daos/IRiskLogDAO.java @@ -0,0 +1,36 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ + +package org.libreplan.business.logs.daos; + +import java.util.List; + +import org.libreplan.business.common.daos.IIntegrationEntityDAO; +import org.libreplan.business.logs.entities.RiskLog; + +public interface IRiskLogDAO extends IIntegrationEntityDAO { + + /** + * Gets all the risk-logs + * + * @return a list of {@link RiskLog} objects + */ + List getRiskLogs(); + +} diff --git a/libreplan-business/src/main/java/org/libreplan/business/logs/daos/IssueLogDAO.java b/libreplan-business/src/main/java/org/libreplan/business/logs/daos/IssueLogDAO.java new file mode 100644 index 000000000..0bdcd9e37 --- /dev/null +++ b/libreplan-business/src/main/java/org/libreplan/business/logs/daos/IssueLogDAO.java @@ -0,0 +1,46 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ + +package org.libreplan.business.logs.daos; + +import java.util.List; + +import org.libreplan.business.common.daos.IntegrationEntityDAO; +import org.libreplan.business.logs.entities.IssueLog; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Repository; + +/** + * DAO for {@link IssueLog} + * + * @author Miciele Ghiorghis + */ +@Repository +@Scope(BeanDefinition.SCOPE_SINGLETON) +public class IssueLogDAO extends IntegrationEntityDAO implements + IIssueLogDAO { + + @Override + public List getIssueLogs() { + return list(IssueLog.class); + } + + +} diff --git a/libreplan-business/src/main/java/org/libreplan/business/logs/daos/ProjectLogDAO.java b/libreplan-business/src/main/java/org/libreplan/business/logs/daos/ProjectLogDAO.java new file mode 100644 index 000000000..ec161e9ba --- /dev/null +++ b/libreplan-business/src/main/java/org/libreplan/business/logs/daos/ProjectLogDAO.java @@ -0,0 +1,54 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ + +package org.libreplan.business.logs.daos; + +import java.util.List; + +import org.libreplan.business.common.daos.IntegrationEntityDAO; +import org.libreplan.business.logs.entities.IssueLog; +import org.libreplan.business.logs.entities.ProjectLog; +import org.libreplan.business.logs.entities.RiskLog; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Repository; +import org.springframework.transaction.annotation.Transactional; + +/** + * DAO for {@link ProjectLog} + * + * @author Miciele Ghiorghis + */ +@Repository +@Scope(BeanDefinition.SCOPE_SINGLETON) +@Transactional +public class ProjectLogDAO extends IntegrationEntityDAO implements + IProjectLogDAO { + + @Override + public List getIssueLogs() { + return list(IssueLog.class); + } + + @Override + public List getRiskLogs() { + return list(RiskLog.class); + } + +} diff --git a/libreplan-business/src/main/java/org/libreplan/business/logs/daos/RiskLogDAO.java b/libreplan-business/src/main/java/org/libreplan/business/logs/daos/RiskLogDAO.java new file mode 100644 index 000000000..2bce9a40b --- /dev/null +++ b/libreplan-business/src/main/java/org/libreplan/business/logs/daos/RiskLogDAO.java @@ -0,0 +1,46 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ + +package org.libreplan.business.logs.daos; + +import java.util.List; + +import org.libreplan.business.common.daos.IntegrationEntityDAO; +import org.libreplan.business.logs.entities.RiskLog; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Repository; + +/** + * DAO for {@link RiskLog} + * + * @author Miciele Ghiorghis + */ +@Repository +@Scope(BeanDefinition.SCOPE_SINGLETON) +public class RiskLogDAO extends IntegrationEntityDAO implements + IRiskLogDAO { + + + @Override + public List getRiskLogs() { + return list(RiskLog.class); + } + +} diff --git a/libreplan-business/src/main/java/org/libreplan/business/logs/entities/IssueLog.java b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/IssueLog.java new file mode 100644 index 000000000..bc42efd9a --- /dev/null +++ b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/IssueLog.java @@ -0,0 +1,157 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ + +package org.libreplan.business.logs.entities; +import javax.validation.constraints.NotNull; +import java.util.Date; + +import org.libreplan.business.common.IntegrationEntity; +import org.libreplan.business.common.Registry; +import org.libreplan.business.common.daos.IIntegrationEntityDAO; +import org.libreplan.business.users.entities.User; + +/** + * IssueLog entity, represents parameters to be able to administrate issues that + * come up in the project + * + * @author Misha Gozhda + */ +public class IssueLog extends ProjectLog { + + private IssueTypeEnum type = IssueTypeEnum.getDefault(); + private String status = "LOW"; + private LowMediumHighEnum priority = LowMediumHighEnum.getDefault(); + private LowMediumHighEnum severity = LowMediumHighEnum.getDefault(); + private Date dateRaised; + private User createdBy; + private String assignedTo; + private Date dateResolved; + private Date deadline; + private String notes; + + + public static IssueLog create() { + return create(new IssueLog(new Date())); + } + + /** + * Constructor for Hibernate. Do not use! + */ + protected IssueLog() { + + } + + private IssueLog(Date date) { + this.dateRaised = date; + } + + public IssueTypeEnum getType() { + return type; + } + + public void setType(IssueTypeEnum type) { + this.type = type; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public LowMediumHighEnum getPriority() { + return priority; + } + + public void setPriority(LowMediumHighEnum priority) { + this.priority = priority; + } + + public LowMediumHighEnum getSeverity() { + return severity; + } + + public void setSeverity(LowMediumHighEnum severity) { + this.severity = severity; + } + + @NotNull(message = "date raised is not specified") + public Date getDateRaised() { + return dateRaised; + } + + public void setDateRaised(Date dateEntered) { + this.dateRaised = dateEntered; + } + + public User getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(User user) { + this.createdBy = user; + } + + public String getAssignedTo() { + return assignedTo; + } + + public void setAssignedTo(String assignedTo) { + this.assignedTo = assignedTo; + } + + public Date getDateResolved() { + return dateResolved; + } + + public void setDateResolved(Date dateResolved) { + this.dateResolved = dateResolved; + } + + + public Date getDeadline() { + return deadline; + } + + public void setDeadline(Date decisionDate) { + this.deadline = decisionDate; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + + @Override + public String getHumanId() { + return getCode(); + } + + @Override + protected IIntegrationEntityDAO getIntegrationEntityDAO() { + return (IIntegrationEntityDAO) Registry + .getIssueLogDAO(); + } +} diff --git a/libreplan-business/src/main/java/org/libreplan/business/logs/entities/IssueTypeEnum.java b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/IssueTypeEnum.java new file mode 100644 index 000000000..0db92e05e --- /dev/null +++ b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/IssueTypeEnum.java @@ -0,0 +1,28 @@ +package org.libreplan.business.logs.entities; + +import static org.libreplan.business.i18n.I18nHelper._; + +/** + * Defines PROBLEM_OR_CONCERN, REQUEST_FOR_CHANGE, OFF_SPECIFICATION enums + * to be used as data type in + * {@link IssueLog} + * + * @author Misha Gozhda + */ +public enum IssueTypeEnum { + PROBLEM_OR_CONCERN(_("Problem or concern")), REQUEST_FOR_CHANGE(_("Request for change")), OFF_SPECIFICATION(_("Off specification")); + + private final String issueTypeEnum; + + IssueTypeEnum(String issueTypeEnum) { + this.issueTypeEnum = issueTypeEnum; + } + + public String getDisplayName() { + return issueTypeEnum; + } + + public static IssueTypeEnum getDefault() { + return IssueTypeEnum.OFF_SPECIFICATION; + } +} diff --git a/libreplan-business/src/main/java/org/libreplan/business/logs/entities/LowMediumHighEnum.java b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/LowMediumHighEnum.java new file mode 100644 index 000000000..686b46d35 --- /dev/null +++ b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/LowMediumHighEnum.java @@ -0,0 +1,47 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ +package org.libreplan.business.logs.entities; + +import static org.libreplan.business.i18n.I18nHelper._; + + +/** + * Defines the low, medium and high enums to be used as data type in + * {@link IssueLog} and {@link RiskLog} + * + * @author Misha Gozhda + */ +public enum LowMediumHighEnum { + + LOW(_("Low")), MEDIUM(_("Medium")), HIGH(_("High")); + + private final String lowMediumHighEnum; + + LowMediumHighEnum(String lowMediumHighEnum) { + this.lowMediumHighEnum = lowMediumHighEnum; + } + + public String getDisplayName() { + return lowMediumHighEnum; + } + + public static LowMediumHighEnum getDefault() { + return LowMediumHighEnum.LOW; + } +} diff --git a/libreplan-business/src/main/java/org/libreplan/business/logs/entities/ProjectLog.java b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/ProjectLog.java new file mode 100644 index 000000000..c9a810700 --- /dev/null +++ b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/ProjectLog.java @@ -0,0 +1,54 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ + +package org.libreplan.business.logs.entities; + +import org.libreplan.business.common.IHumanIdentifiable; +import org.libreplan.business.common.IntegrationEntity; +import org.libreplan.business.common.Registry; +import org.libreplan.business.common.daos.IIntegrationEntityDAO; +import org.libreplan.business.orders.entities.Order; + +/** + * This class is the base class for all logs like issue-log, risk-log etc. + * + * @author Misha Gozhda + */ +public abstract class ProjectLog extends IntegrationEntity implements + IHumanIdentifiable { + + protected Order project; + protected String description; + + public Order getOrder() { + return project; + } + + public void setOrder(Order order) { + this.project = order; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } +} diff --git a/libreplan-business/src/main/java/org/libreplan/business/logs/entities/RiskLog.java b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/RiskLog.java new file mode 100644 index 000000000..f4d387a28 --- /dev/null +++ b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/RiskLog.java @@ -0,0 +1,176 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ + +package org.libreplan.business.logs.entities; + +import org.libreplan.business.common.IntegrationEntity; +import org.libreplan.business.common.Registry; +import org.libreplan.business.common.daos.IIntegrationEntityDAO; +import org.libreplan.business.users.entities.User; + +import java.util.Date; + +/** + * RiskLog entity, represents parameters to be able to administrate risks that + * come up in the project + * + * @author Misha Gozhda + */ +public class RiskLog extends ProjectLog { + + private String projectName; + private String status; + private LowMediumHighEnum probability = LowMediumHighEnum.getDefault(); + private LowMediumHighEnum impact = LowMediumHighEnum.getDefault(); + private Date dateCreated; + private User createdBy; + private String counterMeasures; + private String contingency; + private String responsible; + private Date actionWhen; + private String notes; + private RiskScoreStatesEnum score = RiskScoreStatesEnum.getDefault(); + + public static RiskLog create() { + return create(new RiskLog(new Date())); + } + + private RiskLog(Date date) { + this.dateCreated = date; + } + + /** + * Constructor for Hibernate. Do not use! + */ + protected RiskLog() { + + } + + public String getProjectName() { + return projectName; + } + + public void setProjectName (String projectName) { + this.projectName = projectName; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public LowMediumHighEnum getProbability() { + return probability; + } + + public void setProbability(LowMediumHighEnum probability) { + this.probability = probability; + } + + public LowMediumHighEnum getImpact() { + return impact; + } + + public void setImpact(LowMediumHighEnum impact) { + this.impact = impact; + } + + public Date getDateCreated() { + return dateCreated; + } + + public void setDateCreated(Date dateCreated) { + this.dateCreated = dateCreated; + } + + public User getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(User createdBy) { + this.createdBy = createdBy; + } + + public String getCounterMeasures() { + return counterMeasures; + } + + public void setCounterMeasures(String counterMeasures) { + this.counterMeasures = counterMeasures; + } + + public String getContingency() { + return contingency; + } + + public void setContingency(String contingency) { + this.contingency = contingency; + } + + public void setResponsible(String responsible) { + this.responsible = responsible; + } + + public String getResponsible() { + return responsible; + } + + public Date getActionWhen() { + return actionWhen; + } + + public void setActionWhen(Date actionWhen) { + this.actionWhen = actionWhen; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public void setScoreAfterCM(RiskScoreStatesEnum scoreAfterCM) { + this.score = scoreAfterCM; + } + + public RiskScoreStatesEnum getScoreAfterCM() { + return score; + } + + public int getRiskScore() { + return (probability.ordinal() + 1) * (impact.ordinal() + 1); + } + + @Override + public String getHumanId() { + return getCode(); + } + + @Override + protected IIntegrationEntityDAO getIntegrationEntityDAO() { + return (IIntegrationEntityDAO) Registry + .getRiskLogDAO(); + } + +} diff --git a/libreplan-business/src/main/java/org/libreplan/business/logs/entities/RiskScoreStatesEnum.java b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/RiskScoreStatesEnum.java new file mode 100644 index 000000000..26f3e4bc7 --- /dev/null +++ b/libreplan-business/src/main/java/org/libreplan/business/logs/entities/RiskScoreStatesEnum.java @@ -0,0 +1,26 @@ +package org.libreplan.business.logs.entities; +import static org.libreplan.business.i18n.I18nHelper._; +/** + * Defines ZERO, ONE, TWO, THREE, FOUR, SIX, NINE + * to be used as data type in + * {@link RiskLog} + * + * @author Misha Gozhda + */ +public enum RiskScoreStatesEnum { + ZERO(_("0")), ONE(_("1")), TWO(_("2")), THREE(_("3")), FOUR(_("4")), SIX(_("6")), NINE(_("9")) ; + + private final String riskScoreStateEnum; + + RiskScoreStatesEnum(String riskScoreStateEnum) { + this.riskScoreStateEnum = riskScoreStateEnum; + } + + public String getDisplayName() { + return riskScoreStateEnum; + } + + public static RiskScoreStatesEnum getDefault() { + return RiskScoreStatesEnum.ZERO; + } +} diff --git a/libreplan-business/src/main/resources/db.changelog-1.5.xml b/libreplan-business/src/main/resources/db.changelog-1.5.xml index f969c70b6..128b0eeb6 100644 --- a/libreplan-business/src/main/resources/db.changelog-1.5.xml +++ b/libreplan-business/src/main/resources/db.changelog-1.5.xml @@ -51,4 +51,79 @@ initiallyDeferred="false"/> - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 c7e391a87..4f00767e4 100644 --- a/libreplan-business/src/main/resources/libreplan-business-spring-config.xml +++ b/libreplan-business/src/main/resources/libreplan-business-spring-config.xml @@ -97,6 +97,9 @@ org/libreplan/business/email/entities/Email.hbm.xml + + org/libreplan/business/logs/entities/Logs.hbm.xml + diff --git a/libreplan-business/src/main/resources/org/libreplan/business/logs/entities/Logs.hbm.xml b/libreplan-business/src/main/resources/org/libreplan/business/logs/entities/Logs.hbm.xml new file mode 100644 index 000000000..9fbf1086b --- /dev/null +++ b/libreplan-business/src/main/resources/org/libreplan/business/logs/entities/Logs.hbm.xml @@ -0,0 +1,110 @@ + + + + + + + 100 + + + + + + + + + + + + org.libreplan.business.logs.entities.IssueTypeEnum + + + + + + + + org.libreplan.business.logs.entities.LowMediumHighEnum + + + + + + org.libreplan.business.logs.entities.LowMediumHighEnum + + + + + + + + + + + + + + + + + + + + + + + + + + + 100 + + + + + + + + + + + + org.libreplan.business.logs.entities.LowMediumHighEnum + + + + + + org.libreplan.business.logs.entities.LowMediumHighEnum + + + + + + + + + + + + + + + + + + + + + + + + + + org.libreplan.business.logs.entities.RiskScoreStatesEnum + + + + + + diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/common/CustomMenuController.java b/libreplan-webapp/src/main/java/org/libreplan/web/common/CustomMenuController.java index c62280ee5..b048af54a 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/common/CustomMenuController.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/common/CustomMenuController.java @@ -275,6 +275,7 @@ public class CustomMenuController extends Div implements IMenuItemsRegister { } }, "01-introducion.html#id2")); } + if (SecurityUtils.isSuperuserOrUserInRoles(UserRole.ROLE_PLANNING)) { planningItems.add(subItem(_("Resources Load"), new ICapture() { @Override @@ -298,6 +299,16 @@ public class CustomMenuController extends Div implements IMenuItemsRegister { planningItems.add(subItem(_("Import project"), "/orders/imports/projectImport.zul", "")); } + + + //TODO There is some problem here! + /*planningItems.add(subItem(_("Logs"), new ICapture() { + @Override + public void capture() { + globalView.goToLogs(); + } + }, "01-asd"));*/ + if (!planningItems.isEmpty()) { topItem(_("Planning"), "/planner/index.zul", "", planningItems); } diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/logs/IIssueLogModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/logs/IIssueLogModel.java new file mode 100644 index 000000000..813365aa4 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/web/logs/IIssueLogModel.java @@ -0,0 +1,119 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ + +package org.libreplan.web.logs; + +import java.util.List; + +import org.libreplan.business.common.exceptions.ValidationException; +import org.libreplan.business.logs.entities.IssueLog; +import org.libreplan.business.orders.entities.Order; +import org.libreplan.business.users.entities.User; + +/** + * Contract for {@link IssueLogModel} + * + * @author Miciele Ghiorghis + */ +public interface IIssueLogModel { + + /** + * Returns a list of all {@link IssueLog} + */ + List getIssueLogs(); + + /** + * Returns a list of all {@link Order} + */ + List getOrders(); + + /** + * Returns current {@link Order} + */ + Order getOrder(); + + /** + * Sets the order + * + * @param order + * the order to be set + */ + void setOrder(Order order); + + /** + * Returns a list of all {@link User} + */ + List getUsers(); + + /** + * Returns the {@link User} + */ + User getCreatedBy(); + + /** + * Sets the user + * + * @param user + * the user to be set + */ + void setCreatedBy(User user); + + /** + * Prepares for create a new {@link IssueLog}. + */ + void initCreate(); + + /** + * Prepares for edit {@link IssueLog} + * + * @param issueLog + * an object to be edited + */ + void initEdit(IssueLog issueLog); + + /** + * Gets the current {@link IssueLog}. + * + * @return A {@link IssueLog} + */ + IssueLog getIssueLog(); + + /** + * Saves the current {@link IssueLog} + * + * @throws ValidationException + * if validation fails + */ + void confirmSave() throws ValidationException; + + /** + * Cancels the current {@link IssueLog} + */ + void cancel(); + + /** + * Removes the current {@link IssueLog} + * + * @param issueLog + * an object to be removed + */ + void remove(IssueLog issueLog); + + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/logs/IRiskLogModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/logs/IRiskLogModel.java new file mode 100644 index 000000000..63893aec7 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/web/logs/IRiskLogModel.java @@ -0,0 +1,119 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ + +package org.libreplan.web.logs; + +import java.util.List; + +import org.libreplan.business.common.exceptions.ValidationException; +import org.libreplan.business.logs.entities.RiskLog; +import org.libreplan.business.orders.entities.Order; +import org.libreplan.business.users.entities.User; + +/** + * Contract for {@link RiskLogModel} + * + * @author Miciele Ghiorghis + */ +public interface IRiskLogModel { + + /** + * Returns a list of all {@link RiskLog} + */ + List getRiskLogs(); + + /** + * Returns a list of all {@link Order} + */ + List getOrders(); + + /** + * Returns current {@link Order} + */ + Order getOrder(); + + /** + * Sets the order + * + * @param order + * the order to set + */ + void setOrder(Order order); + + /** + * Returns a list of all {@link User} + */ + List getUsers(); + + /** + * Returns {@link User} + */ + User getCreatedBy(); + + /** + * Sets the user + * + * @param user + * the user to be set + */ + void setCreatedBy(User user); + + /** + * Prepares for create a new {@link RiskLog}. + */ + void initCreate(); + + /** + * Prepares for edit {@link RiskLog} + * + * @param riskLog + * an object to be edited + */ + void initEdit(RiskLog riskLog); + + /** + * Gets the current {@link RiskLog}. + * + * @return A {@link RiskLog} + */ + RiskLog getRiskLog(); + + /** + * Saves the current {@link RiskLog} + * + * @throws ValidationException + * if validation fails + */ + void confirmSave() throws ValidationException; + + /** + * Cancels the current {@link RiskLog} + */ + void cancel(); + + /** + * Removes the current {@link RiskLog} + * + * @param riskLog + * an object to be removed + */ + void remove(RiskLog riskLog); + + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/logs/IssueLogCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/logs/IssueLogCRUDController.java new file mode 100644 index 000000000..a7151a613 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/web/logs/IssueLogCRUDController.java @@ -0,0 +1,484 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ + +package org.libreplan.web.logs; + +import static org.libreplan.web.I18nHelper._; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +import org.apache.commons.logging.LogFactory; +import org.libreplan.business.common.exceptions.InstanceNotFoundException; +import org.libreplan.business.common.exceptions.ValidationException; +import org.libreplan.business.logs.entities.IssueLog; +import org.libreplan.business.logs.entities.IssueTypeEnum; +import org.libreplan.business.logs.entities.LowMediumHighEnum; +import org.libreplan.business.orders.entities.Order; +import org.libreplan.business.users.entities.User; +import org.libreplan.web.common.BaseCRUDController; +import org.libreplan.web.common.Util; +import org.libreplan.web.common.components.bandboxsearch.BandboxSearch; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.Scope; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.WrongValueException; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zul.*; + +import javax.swing.*; +import javax.swing.table.TableCellEditor; + +/** + * Controller for IssueLog CRUD actions + * + * @author Misha Gozhda + */ +@SuppressWarnings("serial") +@org.springframework.stereotype.Component +@Scope(BeanDefinition.SCOPE_PROTOTYPE) +public class IssueLogCRUDController extends BaseCRUDController { + + private static final org.apache.commons.logging.Log LOG = LogFactory + .getLog(IssueLogCRUDController.class); + + @Autowired + private IIssueLogModel issueLogModel; + + private BandboxSearch bdProjectIssueLog; + + private BandboxSearch bdUserIssueLog; + + private Listbox status; + + @Override + public void doAfterCompose(Component comp) throws Exception { + super.doAfterCompose(comp); + status = (Listbox)comp.getFellow("editWindow").getFellow("listIssueLogStatus"); + comp.setVariable("issueLogController", this, true); + showListWindow(); + initializeOrderComponent(); + initializeUserComponent(); + bdProjectIssueLog.setDisabled(!LogsController.getProjectNameVisibility()); + bdUserIssueLog.setDisabled(true); + } + + /** + * Initializes order component + */ + private void initializeOrderComponent() { + bdProjectIssueLog = (BandboxSearch) editWindow + .getFellow("bdProjectIssueLog"); + Util.createBindingsFor(bdProjectIssueLog); + bdProjectIssueLog.setListboxEventListener(Events.ON_SELECT, + new EventListener() { + @Override + public void onEvent(Event event) { + final Object object = bdProjectIssueLog + .getSelectedElement(); + issueLogModel.setOrder((Order) object); + } + }); + bdProjectIssueLog.setListboxEventListener(Events.ON_OK, + new EventListener() { + @Override + public void onEvent(Event event) { + final Object object = bdProjectIssueLog + .getSelectedElement(); + issueLogModel.setOrder((Order) object); + bdProjectIssueLog.close(); + } + }); + } + + /** + * Initializes user component + */ + private void initializeUserComponent() { + bdUserIssueLog = (BandboxSearch) editWindow.getFellow("bdUserIssueLog"); + Util.createBindingsFor(bdUserIssueLog); + + bdUserIssueLog.setListboxEventListener(Events.ON_SELECT, new EventListener() { + @Override + public void onEvent(Event event) { + final Object object = bdUserIssueLog.getSelectedElement(); + issueLogModel.setCreatedBy((User) object); + } + }); + bdUserIssueLog.setListboxEventListener(Events.ON_OK, new EventListener() { + @Override + public void onEvent(Event event) { + final Object object = bdUserIssueLog.getSelectedElement(); + issueLogModel.setCreatedBy((User) object); + bdUserIssueLog.close(); + } + }); + } + + /** + * Enumerations rendering + */ + public static ListitemRenderer issueTypeRenderer = new ListitemRenderer() { + @Override + public void render(org.zkoss.zul.Listitem item, Object data) + throws Exception { + IssueTypeEnum issueTypeEnum = (IssueTypeEnum) data; + String displayName = issueTypeEnum.getDisplayName(); + item.setLabel(displayName); + } + }; + + + + public static ListitemRenderer lowMediumHighEnumRenderer = new ListitemRenderer() { + @Override + public void render(org.zkoss.zul.Listitem item, Object data) + throws Exception { + LowMediumHighEnum lowMediumHighEnum = (LowMediumHighEnum) data; + String displayName = lowMediumHighEnum.getDisplayName(); + item.setLabel(displayName); + } + }; + + /** + * Renders issue logs + * + * @return {@link RowRenderer} + */ + public RowRenderer getIssueLogsRowRenderer() { + return new RowRenderer() { + + @Override + public void render(Row row, Object data) throws Exception { + final IssueLog issueLog = (IssueLog) data; + row.setValue(issueLog); + appendObject(row, issueLog.getCode()); + appendLabel(row, issueLog.getOrder().getName()); + appendObject(row, issueLog.getType()); + appendObject(row, issueLog.getStatus()); + appendLabel(row, issueLog.getDescription()); + appendLabel(row, issueLog.getPriority().getDisplayName()); + appendLabel(row, issueLog.getSeverity().getDisplayName()); + appendDate(row, issueLog.getDateRaised()); + appendLabel(row, issueLog.getCreatedBy().getLoginName()); + appendLabel(row, issueLog.getAssignedTo()); + appendDate(row, issueLog.getDeadline()); + appendDate(row, issueLog.getDateResolved()); + appendLabel(row, issueLog.getNotes()); + appendOperations(row, issueLog); + setPriorityCellColor(row, issueLog.getPriority()); + } + }; + } + + private void setPriorityCellColor(Row row, LowMediumHighEnum priority) { + Cell cell = (Cell) row.getChildren().get(5); + if (priority == LowMediumHighEnum.LOW) { + cell.setClass("issueLog-priority-color-green"); + } + + if (priority == LowMediumHighEnum.MEDIUM) { + cell.setClass("issueLog-priority-color-yellow"); + } + + if (priority == LowMediumHighEnum.HIGH) { + cell.setClass("issueLog-priority-color-red"); + } + } + + /** + * Appends the specified object to the specified + * row + * + * @param row + * @param object + */ + private void appendObject(final Row row, Object object) { + String text = new String(""); + if (object != null) { + text = object.toString(); + } + appendLabel(row, text); + } + + /** + * Creates {@link Label} bases on the specified value and + * appends to the specified row + * + * @param row + * @param value + */ + private void appendLabel(final Row row, String value) { + Label label = new Label(value); + Cell cell = new Cell(); + cell.appendChild(label); + row.appendChild(cell); + } + + /** + * Appends the specified date to the specified row + * @param row + * @param date*/ + private void appendDate(final Row row, Date date) { + String labelDate = new String(""); + if (date != null) { + labelDate = Util.formatDate(date); + } + appendLabel(row, labelDate); + } + + /** + * Appends operation(edit and remove) to the specified row + * + * @param row + * @param issueLog + */ + private void appendOperations(final Row row, final IssueLog issueLog) { + Hbox hbox = new Hbox(); + hbox.appendChild(Util.createEditButton(new EventListener() { + @Override + public void onEvent(Event event) { + goToEditForm(issueLog); + } + })); + hbox.appendChild(Util.createRemoveButton(new EventListener() { + @Override + public void onEvent(Event event) { + confirmDelete(issueLog); + } + })); + row.appendChild(hbox); + } + + /** + * Returns {@link LowMediumHighEnum} values + */ + public LowMediumHighEnum[] getLowMediumHighEnum() { + return LowMediumHighEnum.values(); + } + + /** + * Returns {@link IssueTypeEnum} values + */ + public IssueTypeEnum[] getIssueTypeEnum() { + return IssueTypeEnum.values(); + } + + /** + * Returns {@link ArrayList} values + */ + public ArrayList getIssueStatusEnum() { + ArrayList result = new ArrayList(); + if (getIssueLog().getType() == IssueTypeEnum.REQUEST_FOR_CHANGE){ + result.add(_("Must have")); + result.add(_("Should have")); + result.add(_("Could have")); + result.add(_("Won't have")); + return result; + } + if (getIssueLog().getType() == IssueTypeEnum.PROBLEM_OR_CONCERN) { + result.add(_("Minor")); + result.add(_("Significant")); + result.add(_("Major")); + result.add(_("Critical")); + return result; + } + + result.add(_("Low")); + result.add(_("Medium")); + result.add(_("High")); + return result; + } + + public void updateStatusList(boolean ifNew) { + ListModelList model = new ListModelList(getIssueStatusEnum()); + status.setModel(model); + if(ifNew) + status.setSelectedItem(status.getItemAtIndex(0)); + else { + for(int i = 0; i < status.getItems().size(); i++) { + if (status.getModel().getElementAt(i).toString().equals(getIssueLog().getStatus())) { + status.setSelectedItem(status.getItemAtIndex(i)); + break; + } + } + } + } + + /** + * Returns a list of {@link Order} objects + */ + public List getOrders() { + return issueLogModel.getOrders(); + } + + + /** + * Returns a list of {@link User} objects + */ + public List getUsers() { + return issueLogModel.getUsers(); + } + + /** + * Returns {@link Date} + */ + public Date getDateRaised() { + if (issueLogModel.getIssueLog() == null) { + return null; + } + return (issueLogModel.getIssueLog().getDateRaised() != null) ? issueLogModel + .getIssueLog().getDateRaised() + : null; + } + + /** + * Sets the date raised + * + * @param date + * date raised + */ + public void setDateRaised(Date date) { + issueLogModel.getIssueLog().setDateRaised(date); + } + + /** + * Returns {@link Date} + */ + public Date getDateResolved() { + if (issueLogModel.getIssueLog() == null) { + return null; + } + return (issueLogModel.getIssueLog().getDateResolved() != null) ? issueLogModel + .getIssueLog().getDateResolved() + : null; + } + /** + * Sets the date resolved + * + * @param date + * the date resolved + */ + public void setDateResolved(Date date) { + issueLogModel.getIssueLog().setDateResolved(date); + } + + /** + * Returns {@link Date} + */ + public Date getDeadline() { + if (issueLogModel.getIssueLog() == null) { + return null; + } + return (issueLogModel.getIssueLog().getDeadline() != null) ? issueLogModel + .getIssueLog().getDeadline() // this is a getIntegrationEntityDAO method + : null; + } + + public void setDeadline(Date date) { + issueLogModel.getIssueLog().setDeadline(date); + } + + /** + * Returns the {@link IssueLog} object + */ + public IssueLog getIssueLog() { + return issueLogModel.getIssueLog(); + } + + /** + * Returns a list of {@link IssueLog} objects + */ + public List getIssueLogs() { + if (LogsController.getProjectNameVisibility() == true) + return issueLogModel.getIssueLogs(); + else{ + List issueLogs = new ArrayList(); + Order order = LogsController.getOrder(); + for (IssueLog issueLog : issueLogModel.getIssueLogs()) { + if (issueLog.getOrder().equals(order)) + issueLogs.add(issueLog); + } + return issueLogs; + } + } + + public Order getOrder() { + if (LogsController.getProjectNameVisibility() == false){ + this.getIssueLog().setOrder(LogsController.getOrder()); + return getIssueLog().getOrder(); + } + else + return getIssueLog().getOrder(); + } + + @Override + protected String getEntityType() { + return _("issuelog-number"); + } + + @Override + protected String getPluralEntityType() { + return _("Issue logs"); + } + + @Override + protected void initCreate() { + issueLogModel.initCreate(); + updateStatusList(true); + } + + @Override + protected void initEdit(IssueLog entity) { + issueLogModel.initEdit(entity); + updateStatusList(false); + } + + @Override + protected void save() throws ValidationException { + if (getIssueLog().getOrder() == null) { + throw new WrongValueException(bdProjectIssueLog, + _("please select a project")); + } + + if (getIssueLog().getCreatedBy() == null) { + throw new WrongValueException(bdUserIssueLog, + _("please select an author")); + } + getIssueLog().setStatus(status.getSelectedItem().getLabel()); + issueLogModel.confirmSave(); + } + + @Override + protected IssueLog getEntityBeingEdited() { + return issueLogModel.getIssueLog(); + } + + @Override + protected void delete(IssueLog entity) throws InstanceNotFoundException { + issueLogModel.remove(entity); + } + + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/logs/IssueLogModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/logs/IssueLogModel.java new file mode 100644 index 000000000..22e24f26f --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/web/logs/IssueLogModel.java @@ -0,0 +1,186 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ + +package org.libreplan.web.logs; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.libreplan.business.common.IntegrationEntity; +import org.libreplan.business.common.daos.IConfigurationDAO; +import org.libreplan.business.common.entities.EntityNameEnum; +import org.libreplan.business.common.exceptions.InstanceNotFoundException; +import org.libreplan.business.common.exceptions.ValidationException; +import org.libreplan.business.logs.daos.IIssueLogDAO; +import org.libreplan.business.logs.daos.IProjectLogDAO; +import org.libreplan.business.logs.entities.IssueLog; +import org.libreplan.business.orders.daos.IOrderDAO; +import org.libreplan.business.orders.entities.Order; +import org.libreplan.business.scenarios.IScenarioManager; +import org.libreplan.business.users.daos.IUserDAO; +import org.libreplan.business.users.entities.User; +import org.libreplan.web.common.IntegrationEntityModel; +import org.libreplan.web.common.concurrentdetection.OnConcurrentModification; +import org.libreplan.web.security.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Model for UI operations related to {@link IssueLog} + * + * @author Misha Gozhda + */ +@Service +@Scope(BeanDefinition.SCOPE_PROTOTYPE) +@OnConcurrentModification(goToPage = "/logs/_logs.zul") +public class IssueLogModel extends IntegrationEntityModel implements + IIssueLogModel { + + private IssueLog issueLog; + + @Autowired + private IIssueLogDAO issueLogDAO; + + @Autowired + private IProjectLogDAO projectLogDAO; + + @Autowired + private IUserDAO userDAO; + + @Autowired + private IOrderDAO orderDAO; + + @Autowired + private IConfigurationDAO configurationDAO; + + @Override + @Transactional(readOnly = true) + public List getIssueLogs() { + return projectLogDAO.getIssueLogs(); + } + + @Override + @Transactional(readOnly = true) + public List getOrders() { + return orderDAO.getOrders(); + } + + @Override + @Transactional(readOnly = true) + public List getUsers() { + List users = new ArrayList(); + users.addAll(userDAO.findAll()); + return users; + } + + @Override + @Transactional(readOnly = true) + public void initCreate() { + boolean codeGenerated = configurationDAO.getConfiguration() + .getGenerateCodeForProjectLog(); + this.issueLog = IssueLog.create(); + if (codeGenerated) { + issueLog.setCodeAutogenerated(codeGenerated); + setDefaultCode(); + try { + issueLog.setCreatedBy(userDAO.findByLoginName(SecurityUtils.getSessionUserLoginName())); + } catch (InstanceNotFoundException e) { + e.printStackTrace(); + } + } + } + + @Override + public void initEdit(IssueLog issueLog) { + this.issueLog = issueLog; + } + + @Override + public IssueLog getIssueLog() { + return this.issueLog; + } + + @Override + @Transactional + public void confirmSave() throws ValidationException { + issueLogDAO.save(issueLog); + } + + @Override + public void cancel() { + issueLog = null; + } + + @Override + @Transactional + public void remove(IssueLog issueLog) { + try { + issueLogDAO.remove(issueLog.getId()); + } catch (InstanceNotFoundException e) { + throw new RuntimeException(e); + } + } + + @Override + public EntityNameEnum getEntityName() { + return EntityNameEnum.ISSUE_LOG; + } + + @Override + public IntegrationEntity getCurrentEntity() { + return this.issueLog; + } + + @Override + protected Set getChildren() { + return new HashSet(); + } + + @Override + public Order getOrder() { + return issueLog.getOrder(); + } + + @Override + public void setOrder(Order order) { + if (this.issueLog != null) { + IssueLog issueLog = getIssueLog(); + issueLog.setOrder(order); + } + } + + @Override + public User getCreatedBy() { + return issueLog.getCreatedBy(); + } + + @Override + public void setCreatedBy(User user) { + if (this.issueLog != null) { + IssueLog issueLog = getIssueLog(); + issueLog.setCreatedBy(user); + } + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/logs/LogsController.java b/libreplan-webapp/src/main/java/org/libreplan/web/logs/LogsController.java new file mode 100644 index 000000000..26ee583f0 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/web/logs/LogsController.java @@ -0,0 +1,104 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ + +package org.libreplan.web.logs; +import org.libreplan.business.orders.entities.Order; +import org.libreplan.web.common.Util; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.Scope; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.util.GenericForwardComposer; +import org.zkoss.zul.api.Window; + +import javax.swing.*; + + +/** + * Controller for Logs(issue and risk logs) + * + * @author Misha Gozhda + */ +@org.springframework.stereotype.Component +@Scope(BeanDefinition.SCOPE_PROTOTYPE) +public class LogsController extends GenericForwardComposer { + + + private Window issueLogWindow; + private Window riskLogWindow; + private Window logWindow; + + private IssueLogCRUDController issueLogController; + private RiskLogCRUDController riskLogController; + private static boolean projectNameVisibility = true; + private static Order order = null; + + @Override + public void doAfterCompose(Component comp) throws Exception { + super.doAfterCompose(comp); + comp.setVariable("logsController", this, true); + logWindow = (Window) comp.getFellowIfAny("logWindow"); + Util.createBindingsFor(logWindow); + setupIssueLogController(); + } + + public void setupIssueLogController() { + issueLogWindow = (Window) self.getFellowIfAny("issueLogWindow"); + + if (issueLogController == null) { + issueLogController = new IssueLogCRUDController(); + } + try { + issueLogController.doAfterCompose(issueLogWindow); + } catch (Exception e) { + throw new RuntimeException(e); + } + + } + + public void setupRiskLogController() { + riskLogWindow = (Window) self.getFellowIfAny("riskLogWindow"); + + if (riskLogController == null) { + riskLogController = new RiskLogCRUDController(); + } + try { + riskLogController.doAfterCompose(riskLogWindow); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public static void goToOrderMode(Order order) { + LogsController.projectNameVisibility =false; + LogsController.order = order; + } + + public static void goToGlobalMode(){ + projectNameVisibility = true; + order = null; + } + + public static boolean getProjectNameVisibility() { + return projectNameVisibility; + } + + public static Order getOrder() { + return order; + } +} \ No newline at end of file diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/logs/RiskLogCRUDController.java b/libreplan-webapp/src/main/java/org/libreplan/web/logs/RiskLogCRUDController.java new file mode 100644 index 000000000..f727abc9f --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/web/logs/RiskLogCRUDController.java @@ -0,0 +1,449 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ + +package org.libreplan.web.logs; + +import static org.libreplan.web.I18nHelper._; + +import java.nio.charset.UnsupportedCharsetException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.apache.commons.logging.LogFactory; +import org.libreplan.business.common.exceptions.InstanceNotFoundException; +import org.libreplan.business.common.exceptions.ValidationException; +import org.libreplan.business.logs.entities.LowMediumHighEnum; +import org.libreplan.business.logs.entities.RiskLog; +import org.libreplan.business.logs.entities.RiskScoreStatesEnum; +import org.libreplan.business.orders.entities.Order; +import org.libreplan.business.users.entities.User; +import org.libreplan.web.common.BaseCRUDController; +import org.libreplan.web.common.Util; +import org.libreplan.web.common.components.bandboxsearch.BandboxSearch; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.Scope; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.WrongValueException; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zul.*; + +/** + * Controller for RiskLog CRUD actions + * + * @author Misha Gozhda + */ +@SuppressWarnings("serial") +@org.springframework.stereotype.Component +@Scope(BeanDefinition.SCOPE_PROTOTYPE) +public class RiskLogCRUDController extends BaseCRUDController { + + private static final org.apache.commons.logging.Log LOG = LogFactory + .getLog(RiskLogCRUDController.class); + + @Autowired + private IRiskLogModel riskLogModel; + + private BandboxSearch bdProjectRiskLog; + + private BandboxSearch bdUserRiskLog; + + private Textbox riskScore; + + @Override + public void doAfterCompose(Component comp) throws Exception { + super.doAfterCompose(comp); + riskScore = (Textbox)comp.getFellow("editWindow").getFellow("riskScore"); + comp.setVariable("riskLogController", this, true); + showListWindow(); + initializeOrderComponent(); + initializeUserComponent(); + bdProjectRiskLog.setDisabled(!LogsController.getProjectNameVisibility()); + bdUserRiskLog.setDisabled(true); + } + + /** + * Initializes order component + */ + private void initializeOrderComponent() { + bdProjectRiskLog = (BandboxSearch) editWindow + .getFellow("bdProjectRiskLog"); + Util.createBindingsFor(bdProjectRiskLog); + bdProjectRiskLog.setListboxEventListener(Events.ON_SELECT, + new EventListener() { + @Override + public void onEvent(Event event) { + final Object object = bdProjectRiskLog.getSelectedElement(); + riskLogModel.setOrder((Order) object); + } + }); + bdProjectRiskLog.setListboxEventListener(Events.ON_OK, new EventListener() { + @Override + public void onEvent(Event event) { + final Object object = bdProjectRiskLog.getSelectedElement(); + riskLogModel.setOrder((Order) object); + bdProjectRiskLog.close(); + } + }); + } + + /** + * Initializes user component + */ + private void initializeUserComponent() { + bdUserRiskLog = (BandboxSearch) editWindow.getFellow("bdUserRiskLog"); + Util.createBindingsFor(bdUserRiskLog); + bdUserRiskLog.setListboxEventListener(Events.ON_SELECT, + new EventListener() { + @Override + public void onEvent(Event event) { + final Object object = bdUserRiskLog + .getSelectedElement(); + riskLogModel.setCreatedBy((User) object); + } + }); + bdUserRiskLog.setListboxEventListener(Events.ON_OK, + new EventListener() { + @Override + public void onEvent(Event event) { + final Object object = bdUserRiskLog + .getSelectedElement(); + riskLogModel.setCreatedBy((User) object); + bdUserRiskLog.close(); + } + }); + } + + /** + * Renders risk logs + * + * @return {@link RowRenderer} + */ + public RowRenderer getRiskLogsRowRenderer() { + return new RowRenderer() { + + @Override + public void render(Row row, Object data) throws Exception { + final RiskLog riskLog = (RiskLog) data; + row.setValue(riskLog); + appendObject(row, riskLog.getCode()); + appendLabel(row, riskLog.getOrder().getName()); + appendObject(row, riskLog.getProbability()); + appendObject(row, riskLog.getImpact()); + appendObject(row, riskLog.getRiskScore()); + appendLabel(row, riskLog.getStatus()); + appendLabel(row, riskLog.getDescription()); + appendDate(row, riskLog.getDateCreated()); + appendLabel(row, riskLog.getCreatedBy().getFullName() + riskLog.getCreatedBy().getLoginName()); + appendLabel(row, riskLog.getCounterMeasures()); + appendLabel(row, riskLog.getScoreAfterCM().getDisplayName()); + appendLabel(row, riskLog.getContingency()); + appendLabel(row, riskLog.getResponsible()); + appendDate(row, riskLog.getActionWhen()); + appendLabel(row, riskLog.getNotes()); + appendOperations(row, riskLog); + setScoreCellColor(row, riskLog.getRiskScore()); + } + }; + } + + private void setScoreCellColor(Row row, int riskScore) { + Cell cell = (Cell) row.getChildren().get(4); + switch (riskScore) { + case 1: cell.setClass("riskLog-score-color-1"); + break; + case 2: cell.setClass("riskLog-score-color-2"); + break; + case 3: cell.setClass("riskLog-score-color-3"); + break; + case 4: cell.setClass("riskLog-score-color-4"); + break; + case 6: cell.setClass("riskLog-score-color-6"); + break; + case 9: cell.setClass("riskLog-score-color-9"); + break; + default: throw new UnsupportedCharsetException("Unsupported risk score"); + } + } + + public ListitemRenderer lowMediumHighEnumRenderer = new ListitemRenderer() { + @Override + public void render(org.zkoss.zul.Listitem item, Object data) + throws Exception { + LowMediumHighEnum lowMediumHighEnum = (LowMediumHighEnum) data; + String displayName = lowMediumHighEnum.getDisplayName(); + item.setLabel(displayName); + } + }; + public ListitemRenderer riskScoreStatesEnumRenderer = new ListitemRenderer() { + @Override + public void render(org.zkoss.zul.Listitem item, Object data) + throws Exception { + RiskScoreStatesEnum riskScoreStatesEnum = (RiskScoreStatesEnum) data; + String displayName = riskScoreStatesEnum.getDisplayName(); + item.setLabel(displayName); + } + }; + + /** + * Renders LOW, MEDIUM, HIGH enums + * + * @return {@link ListitemRenderer} + */ + public ListitemRenderer getLowMediumHighEnumRenderer() { + return lowMediumHighEnumRenderer; + } + + /** + * Renders riskScoreState enums + * + * @return {@link ListitemRenderer} + */ + public ListitemRenderer getRiskScoreStatesEnumRenderer() { + return riskScoreStatesEnumRenderer; + } + + /** + * Appends the specified object to the specified + * row + * + * @param row + * @param object + */ + private void appendObject(final Row row, Object object) { + String text = new String(""); + if (object != null) { + text = object.toString(); + } + appendLabel(row, text); + } + + /** + * Creates {@link Label} bases on the specified value and + * appends to the specified row + * + * @param row + * @param value + */ + private void appendLabel(final Row row, String value) { + Label label = new Label(value); + Cell cell = new Cell(); + cell.appendChild(label); + row.appendChild(cell); + } + + /** + * Appends the specified date to the specified row + * + * @param row + * @param date + */ + private void appendDate(final Row row, Date date) { + String labelDate = new String(""); + if (date != null) { + labelDate = Util.formatDate(date); + } + appendLabel(row, labelDate); + } + + /** + * Appends operation(edit and remove) to the specified row + * + * @param row + * @param riskLog + */ + private void appendOperations(final Row row, final RiskLog riskLog) { + Hbox hbox = new Hbox(); + hbox.appendChild(Util.createEditButton(new EventListener() { + @Override + public void onEvent(Event event) { + goToEditForm(riskLog); + } + })); + hbox.appendChild(Util.createRemoveButton(new EventListener() { + @Override + public void onEvent(Event event) { + confirmDelete(riskLog); + } + })); + row.appendChild(hbox); + } + + /** + * Returns {@link LowMediumHighEnum} values + */ + public LowMediumHighEnum[] getLowMediumHighEnums() { + return LowMediumHighEnum.values(); + } + /** + * Returns {@link org.libreplan.business.logs.entities.RiskScoreStatesEnum} values + */ + public RiskScoreStatesEnum[] getRiskScoreStatesEnums() { + return RiskScoreStatesEnum.values(); + } + + /** + * Returns a list of {@link Order} objects + */ + public List getOrders() { + return riskLogModel.getOrders(); + } + + /** + * Returns a list of {@link User} objects + */ + public List getUsers() { + return riskLogModel.getUsers(); + } + + /** + * Returns {@link Date} value + */ + public Date getDateCreated() { + if (riskLogModel.getRiskLog() == null) { + return null; + } + return (riskLogModel.getRiskLog().getDateCreated() != null) ? riskLogModel + .getRiskLog().getDateCreated() + : null; + } + + /** + * Sets the date created + * + * @param date + * date created + */ + public void setDateCreated(Date date) { + riskLogModel.getRiskLog().setDateCreated(date); + } + + /** + * Sets the Action When + * + * @param date + * date created + */ + public void setActionWhen(Date date) { + riskLogModel.getRiskLog().setActionWhen(date); + } + + /** + * Returns {@link Date} value + */ + public Date getActionWhen() { + if (riskLogModel.getRiskLog() == null) { + return null; + } + return (riskLogModel.getRiskLog().getActionWhen() != null) ? riskLogModel + .getRiskLog().getActionWhen() + : null; + } + + /** + * Sets the Score for risk + * + */ + public void setUpdateScore() { + riskScore.setValue(String.valueOf(getRiskLog().getRiskScore())); + } + + /** + * Returns the {@link RiskLog} object + */ + public RiskLog getRiskLog() { + return riskLogModel.getRiskLog(); + } + + /** + * Returns a list of {@link RiskLog} objects + */ + public List getRiskLogs() { + if (LogsController.getProjectNameVisibility() == true) + return riskLogModel.getRiskLogs(); + else{ + List riskLogs = new ArrayList(); + Order order = LogsController.getOrder(); + for (RiskLog issueLog : riskLogModel.getRiskLogs()) { + if (issueLog.getOrder().equals(order)) + riskLogs.add(issueLog); + } + return riskLogs; + } + } + + public Order getOrder() { + if (LogsController.getProjectNameVisibility() == false) { + getRiskLog().setOrder(LogsController.getOrder()); + return getRiskLog().getOrder(); + } + else + return riskLogModel.getRiskLog().getOrder(); + } + + @Override + protected String getEntityType() { + return _("Issue log"); + } + + @Override + protected String getPluralEntityType() { + return _("Issue logs"); + } + + @Override + protected void initCreate() { + riskLogModel.initCreate(); + } + + @Override + protected void initEdit(RiskLog entity) { + riskLogModel.initEdit(entity); + } + + @Override + protected void save() throws ValidationException { + if (getRiskLog().getOrder() == null) { + throw new WrongValueException(bdProjectRiskLog, + _("please select a project")); + } + + if (getRiskLog().getCreatedBy() == null) { + throw new WrongValueException(bdUserRiskLog, + _("please select an author")); + } + + riskLogModel.confirmSave(); + } + + @Override + protected RiskLog getEntityBeingEdited() { + return riskLogModel.getRiskLog(); + } + + @Override + protected void delete(RiskLog entity) throws InstanceNotFoundException { + riskLogModel.remove(entity); + + } + +} \ No newline at end of file diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/logs/RiskLogModel.java b/libreplan-webapp/src/main/java/org/libreplan/web/logs/RiskLogModel.java new file mode 100644 index 000000000..c48a3e47c --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/web/logs/RiskLogModel.java @@ -0,0 +1,185 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ + +package org.libreplan.web.logs; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.libreplan.business.common.IntegrationEntity; +import org.libreplan.business.common.daos.IConfigurationDAO; +import org.libreplan.business.common.entities.EntityNameEnum; +import org.libreplan.business.common.exceptions.InstanceNotFoundException; +import org.libreplan.business.common.exceptions.ValidationException; +import org.libreplan.business.logs.daos.IProjectLogDAO; +import org.libreplan.business.logs.daos.IRiskLogDAO; +import org.libreplan.business.logs.entities.RiskLog; +import org.libreplan.business.orders.daos.IOrderDAO; +import org.libreplan.business.orders.entities.Order; +import org.libreplan.business.users.daos.IUserDAO; +import org.libreplan.business.users.entities.User; +import org.libreplan.web.common.IntegrationEntityModel; +import org.libreplan.web.common.concurrentdetection.OnConcurrentModification; +import org.libreplan.web.security.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.BeanDefinition; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * Model for UI operations related to {@link RiskLog} + * + * @author Misha Gozhda + */ +@Service +@Scope(BeanDefinition.SCOPE_PROTOTYPE) +@OnConcurrentModification(goToPage = "/logs/_logs.zul") +public class RiskLogModel extends IntegrationEntityModel implements + IRiskLogModel { + + private RiskLog riskLog; + + @Autowired + private IRiskLogDAO riskLogDAO; + + @Autowired + private IProjectLogDAO projectLogDAO; + + @Autowired + private IUserDAO userDAO; + + @Autowired + private IOrderDAO orderDAO; + + @Autowired + private IConfigurationDAO configurationDAO; + + @Override + @Transactional(readOnly = true) + public List getRiskLogs() { + return projectLogDAO.getRiskLogs(); + } + + @Override + @Transactional(readOnly = true) + public List getOrders() { + return orderDAO.getOrders(); + } + + @Override + @Transactional(readOnly = true) + public List getUsers() { + List users = new ArrayList(); + users.addAll(userDAO.findAll()); + return users; + } + + @Override + @Transactional(readOnly = true) + public void initCreate() { + boolean codeGenerated = configurationDAO.getConfiguration() + .getGenerateCodeForProjectLog(); + this.riskLog = RiskLog.create(); + if (codeGenerated) { + riskLog.setCodeAutogenerated(codeGenerated); + setDefaultCode(); + try { + riskLog.setCreatedBy(userDAO.findByLoginName(SecurityUtils.getSessionUserLoginName())); + } catch (InstanceNotFoundException e) { + e.printStackTrace(); + } + } + } + + @Override + public void initEdit(RiskLog riskLog) { + this.riskLog = riskLog; + } + + @Override + public RiskLog getRiskLog() { + return this.riskLog; + } + + @Override + @Transactional + public void confirmSave() throws ValidationException { + riskLogDAO.save(riskLog); + } + + @Override + public void cancel() { + riskLog = null; + } + + @Override + @Transactional + public void remove(RiskLog riskLog) { + try { + riskLogDAO.remove(riskLog.getId()); + } catch (InstanceNotFoundException e) { + throw new RuntimeException(e); + } + } + + @Override + public EntityNameEnum getEntityName() { + return EntityNameEnum.RISK_LOG; + } + + @Override + public IntegrationEntity getCurrentEntity() { + return this.riskLog; + } + + @Override + protected Set getChildren() { + return new HashSet(); + } + + @Override + public Order getOrder() { + return riskLog.getOrder(); + } + + @Override + public void setOrder(Order order) { + if (this.riskLog != null) { + RiskLog riskLog = getRiskLog(); + riskLog.setOrder(order); + } + } + + @Override + public User getCreatedBy() { + return riskLog.getCreatedBy(); + } + + @Override + public void setCreatedBy(User user) { + if (this.riskLog != null) { + RiskLog riskLog = getRiskLog(); + riskLog.setCreatedBy(user); + } + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/IGlobalViewEntryPoints.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/IGlobalViewEntryPoints.java index 154a154e2..8e184a6de 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/IGlobalViewEntryPoints.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/IGlobalViewEntryPoints.java @@ -47,6 +47,9 @@ public interface IGlobalViewEntryPoints { @EntryPoint("limiting_resources") public void goToLimitingResources(); +/* @EntryPoint("logs") + public void goToLogs();*/ + @EntryPoint("orders_list") public void goToOrdersList(); diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/LogsTabCreator.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/LogsTabCreator.java new file mode 100644 index 000000000..58ef47721 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/LogsTabCreator.java @@ -0,0 +1,160 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2013 St. Antoniusziekenhuis + * + * 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 . + */ +package org.libreplan.web.planner.tabs; + +import static org.libreplan.web.I18nHelper._; +import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.BREADCRUMBS_SEPARATOR; +import static org.libreplan.web.planner.tabs.MultipleTabsPlannerController.getSchedulingLabel; + +import java.util.HashMap; +import java.util.Map; + +import org.libreplan.business.users.entities.UserRole; +import org.libreplan.web.common.Util; +import org.libreplan.web.logs.LogsController; +import org.libreplan.web.planner.order.IOrderPlanningGate; +import org.libreplan.web.planner.tabs.CreatedOnDemandTab.IComponentCreator; +import org.libreplan.web.security.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.zkoss.ganttz.extensions.ITab; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.Executions; +import org.zkoss.zul.Image; +import org.zkoss.zul.Label; + +import javax.swing.*; + +/** + * Creates global Tab for Logs(issue and risk logs) + * + * @author Misha Gozhda + */ +public class LogsTabCreator { + + public static ITab create(Mode mode, LogsController logsController, LogsController logsControllerGlobal, + Component breadcrumbs, IOrderPlanningGate orderPlanningGate, + Map parameters) { + return new LogsTabCreator(mode, logsController, logsControllerGlobal, breadcrumbs, + orderPlanningGate, parameters) + .build(); + } + + private final Mode mode; + + private final LogsController logsControllerGlobal; + + private final LogsController logsController; + + private final Component breadcrumbs; + + private final IOrderPlanningGate orderPlanningGate; + + private LogsTabCreator(Mode mode, LogsController logsController, LogsController logsControllerGlobal, + Component breadcrumbs, IOrderPlanningGate orderPlanningGate, + Map parameters) { + this.mode = mode; + this.logsController = logsController; + this.logsControllerGlobal = logsControllerGlobal; + this.breadcrumbs = breadcrumbs; + this.orderPlanningGate = orderPlanningGate; + } + + private ITab build() { + return TabOnModeType.forMode(mode) + .forType(ModeType.GLOBAL, createGlobalLogsTab()) + .forType(ModeType.ORDER, createOrderLogsTab()) + .create(); + } + + + private ITab createGlobalLogsTab() { + IComponentCreator componentCreator = new IComponentCreator() { + + @Override + public org.zkoss.zk.ui.Component create( + org.zkoss.zk.ui.Component parent) { + Map arguments = new HashMap(); + arguments.put("logsController", logsControllerGlobal); + return Executions.createComponents("/logs/_logs.zul", + parent, arguments); + } + + }; + return new CreatedOnDemandTab(_("Logs"), "logs-global", + componentCreator) { + @Override + protected void beforeShowAction() { + if (!SecurityUtils + .isSuperuserOrUserInRoles(UserRole.ROLE_PLANNING)) { + Util.sendForbiddenStatusCodeInHttpServletResponse(); + } + } + + @Override + protected void afterShowAction() { + if (breadcrumbs.getChildren() != null) { + breadcrumbs.getChildren().clear(); + } + breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR)); + breadcrumbs.appendChild(new Label(getSchedulingLabel())); + breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR)); + breadcrumbs.appendChild(new Label(_("Logs"))); + } + }; + } + + private ITab createOrderLogsTab() { + IComponentCreator componentCreator = new IComponentCreator() { + + @Override + public org.zkoss.zk.ui.Component create( + org.zkoss.zk.ui.Component parent) { + Map arguments = new HashMap(); + arguments.put("logsController", logsController); + return Executions.createComponents("/logs/_logs.zul", + parent, arguments); + } + + }; + return new CreatedOnDemandTab(_("Logs"), "logs-order", + componentCreator) { + @Override + protected void beforeShowAction() { + if (!SecurityUtils + .isSuperuserOrUserInRoles(UserRole.ROLE_PLANNING)) { + Util.sendForbiddenStatusCodeInHttpServletResponse(); + } + } + + @Override + protected void afterShowAction() { + if (breadcrumbs.getChildren() != null) { + breadcrumbs.getChildren().clear(); + } + breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR)); + breadcrumbs.appendChild(new Label(getSchedulingLabel())); + breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR)); + breadcrumbs.appendChild(new Label(_("Logs"))); + breadcrumbs.appendChild(new Image(BREADCRUMBS_SEPARATOR)); + breadcrumbs.appendChild(new Label(mode.getOrder().getName())); + } + }; + } + +} diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MultipleTabsPlannerController.java b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MultipleTabsPlannerController.java index 7b5db901a..1ea0f107a 100644 --- a/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MultipleTabsPlannerController.java +++ b/libreplan-webapp/src/main/java/org/libreplan/web/planner/tabs/MultipleTabsPlannerController.java @@ -42,6 +42,7 @@ import org.libreplan.web.common.entrypoints.URLHandlerRegistry; import org.libreplan.web.dashboard.DashboardController; import org.libreplan.web.dashboard.DashboardControllerGlobal; import org.libreplan.web.limitingresources.LimitingResourcesController; +import org.libreplan.web.logs.LogsController; import org.libreplan.web.montecarlo.MonteCarloController; import org.libreplan.web.orders.OrderCRUDController; import org.libreplan.web.planner.allocation.AdvancedAllocationController.IBack; @@ -75,6 +76,8 @@ import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.util.Composer; +import javax.swing.*; + /** * Creates and handles several tabs * @@ -83,7 +86,8 @@ import org.zkoss.zk.ui.util.Composer; */ @Component @Scope(BeanDefinition.SCOPE_PROTOTYPE) -public class MultipleTabsPlannerController implements Composer, +public class + MultipleTabsPlannerController implements Composer, IGlobalViewEntryPoints { public static String WELCOME_URL = "-- no URL provided --"; @@ -164,6 +168,8 @@ public class MultipleTabsPlannerController implements Composer, private ITab dashboardTab; + private ITab logsTab; + private TabSwitcher tabsSwitcher; @Autowired @@ -190,6 +196,12 @@ public class MultipleTabsPlannerController implements Composer, @Autowired private DashboardControllerGlobal dashboardControllerGlobal; + @Autowired + private LogsController logsController; + + @Autowired + private LogsController logsControllerGlobal; + private org.zkoss.zk.ui.Component breadcrumbs; @Autowired @@ -254,7 +266,7 @@ public class MultipleTabsPlannerController implements Composer, @Override public void goToTaskResourceAllocation(Order order, - TaskElement task) { + TaskElement task) { orderPlanningController.setShowedTask(task); orderPlanningController.setCurrentControllerToShow(orderPlanningController.getEditTaskController()); getTabsRegistry() @@ -303,6 +315,32 @@ public class MultipleTabsPlannerController implements Composer, dashboardController, dashboardControllerGlobal, orderPlanningController, breadcrumbs, resourcesSearcher); + logsTab = LogsTabCreator.create(mode, logsController, logsControllerGlobal, breadcrumbs, new IOrderPlanningGate() { + + @Override + public void goToScheduleOf(Order order) { + getTabsRegistry() + .show(planningTab, changeModeTo(order)); + } + + @Override + public void goToOrderDetails(Order order) { + getTabsRegistry().show(ordersTab, changeModeTo(order)); + } + + @Override + public void goToTaskResourceAllocation(Order order, + TaskElement task) { + // do nothing + } + + @Override + public void goToDashboard(Order order) { + // do nothing + } + + }, parameters); + final boolean isMontecarloVisible = isMonteCarloVisible(); if (isMontecarloVisible) { monteCarloTab = MonteCarloTabCreator.create(mode, @@ -334,6 +372,8 @@ public class MultipleTabsPlannerController implements Composer, tabsConfiguration.add(visibleOnlyAtOrderMode(monteCarloTab)); } + tabsConfiguration.add(tabWithNameReloading(logsTab, typeChanged)); + return tabsConfiguration; } @@ -467,6 +507,7 @@ public class MultipleTabsPlannerController implements Composer, @Override public void goToCompanyScheduling() { + LogsController.goToGlobalMode(); getTabsRegistry().show(planningTab); } @@ -475,6 +516,11 @@ public class MultipleTabsPlannerController implements Composer, getTabsRegistry().show(resourceLoadTab); } + /*@Override + public void goToLogs() { + getTabsRegistry().show(logsTab); + }*/ + @Override public void goToCompanyLimitingResources() { getTabsRegistry().show(limitingResourcesTab); @@ -541,6 +587,7 @@ public class MultipleTabsPlannerController implements Composer, } private IBeforeShowAction changeModeTo(final Order order) { + logsController.goToOrderMode(order); return new IBeforeShowAction() { @Override public void doAction() { diff --git a/libreplan-webapp/src/main/java/org/libreplan/web/users/services/CustomTargetUrlResolver.java b/libreplan-webapp/src/main/java/org/libreplan/web/users/services/CustomTargetUrlResolver.java new file mode 100644 index 000000000..6174f5900 --- /dev/null +++ b/libreplan-webapp/src/main/java/org/libreplan/web/users/services/CustomTargetUrlResolver.java @@ -0,0 +1,119 @@ +/* + * This file is part of LibrePlan + * + * Copyright (C) 2012 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 . + *//* + + +package org.libreplan.web.users.services; + +import javax.servlet.http.HttpServletRequest; + +import org.libreplan.business.common.IAdHocTransactionService; +import org.libreplan.business.common.IOnTransaction; +import org.libreplan.business.common.exceptions.InstanceNotFoundException; +import org.libreplan.business.users.daos.IOrderAuthorizationDAO; +import org.libreplan.business.users.daos.IUserDAO; +import org.libreplan.business.users.entities.User; +import org.libreplan.business.users.entities.UserRole; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.Authentication; +import org.springframework.security.ui.TargetUrlResolverImpl; +import org.springframework.security.ui.savedrequest.SavedRequest; +import org.springframework.security.userdetails.UserDetails; + +*/ +/** + * Determines the URL for authenticated users depending on if user is bound or + * not to any resource.
+ * + * If the user is bound to a resource then the target URL will be the user + * dashboard. + * + * @author Manuel Rego Casasnovas + *//* + +public class CustomTargetUrlResolver extends TargetUrlResolverImpl { + + public final static String USER_DASHBOARD_URL = "/myaccount/userDashboard.zul"; + + public static final String PLANNING_URL = "/planner/index.zul"; + + public static final String SETTINGS_URL = "/myaccount/settings.zul"; + + @Autowired + private IUserDAO userDAO; + + @Autowired + private IOrderAuthorizationDAO orderAuthorizationDAO; + + @Autowired + private IAdHocTransactionService transactionServiceDAO; + + @Override + public String determineTargetUrl(SavedRequest savedRequest, + HttpServletRequest currentRequest, final Authentication auth) { + if (isUserInRole(auth, UserRole.ROLE_SUPERUSER.name())) { + return super.determineTargetUrl(savedRequest, currentRequest, auth); + } + + if (isUserInRole(auth, UserRole.ROLE_BOUND_USER.name())) { + return USER_DASHBOARD_URL; + } + + if (isUserInRole(auth, UserRole.ROLE_PLANNING.name())) { + return PLANNING_URL; + } + + boolean userOrItsProfilesHaveAnyAuthorization = transactionServiceDAO + .runOnReadOnlyTransaction(new IOnTransaction() { + @Override + public Boolean execute() { + try { + UserDetails userDetails = (UserDetails) auth.getPrincipal(); + User user = userDAO.findByLoginName(userDetails.getUsername()); + user.getProfiles().size(); + return orderAuthorizationDAO + .userOrItsProfilesHaveAnyAuthorization(user); + } catch (InstanceNotFoundException e) { + throw new RuntimeException(e); + } + + } + }); + if (userOrItsProfilesHaveAnyAuthorization) { + return PLANNING_URL; + } + + return SETTINGS_URL; + } + + private boolean isUserInRole(Authentication auth, String role) { + if ((auth == null) || (auth.getPrincipal() == null) + || (auth.getAuthorities() == null)) { + return false; + } + + for (int i = 0; i < auth.getAuthorities().length; i++) { + if (role.equals(auth.getAuthorities()[i].getAuthority())) { + return true; + } + } + + return false; + } +} +*/ diff --git a/libreplan-webapp/src/main/webapp/common/css/libreplan_zk.css b/libreplan-webapp/src/main/webapp/common/css/libreplan_zk.css index 838b699f6..bc3a42410 100644 --- a/libreplan-webapp/src/main/webapp/common/css/libreplan_zk.css +++ b/libreplan-webapp/src/main/webapp/common/css/libreplan_zk.css @@ -6,18 +6,18 @@ * to integrate the custom appearance of the web application. */ - /* ----- Predefined Height dependent styles ----- */ - .scheduling-graphics { - height:200px; - } +/* ----- Predefined Height dependent styles ----- */ +.scheduling-graphics { + height:200px; +} - .main-layout { - height: 560px; - } +.main-layout { + height: 560px; +} - .taskheaders-border { - width: 300px; - } +.taskheaders-border { + width: 300px; +} .plannerlayout #watermark { height: 99999px !important; @@ -108,12 +108,12 @@ body .advancedallocationlayout .icono .z-button-cm { } .toolbar-box .z-button { - padding: 1px 2px 2px 2px; + padding: 1px 2px 2px 2px; } .planner-command .z-button-cm, .planner-icon .z-button-cm { - padding: 2px; + padding: 2px; } .toolbar-box .z-button .z-button-cm, @@ -159,7 +159,7 @@ body .advancedallocationlayout .icono .z-button-cm { } .global-action.z-button .z-button-cm { - padding: 4px 25px; + padding: 4px 25px !important; background-position: 5px; background-repeat: no-repeat; margin-right: 1px; @@ -172,11 +172,11 @@ body .advancedallocationlayout .icono .z-button-cm { } .save-button.z-button .z-button-cm { - background-image: url(../img/bt_ok.png); + background-image: url(../img/bt_ok.png) !important; } .create-button.z-button .z-button-cm { - background-image: url(../img/bt_create.png); + background-image: url(../img/bt_create.png) !important; } .saveandcontinue-button.z-button .z-button-cm { @@ -184,7 +184,7 @@ body .advancedallocationlayout .icono .z-button-cm { } .cancel-button.z-button .z-button-cm { - background-image: url(../img/bt_cancel.png); + background-image: url(../img/bt_cancel.png) !important; } .back-button.z-button .z-button-cm { @@ -400,7 +400,7 @@ div.z-row-cnt { } .z-window-embedded-tr,.z-window-highlighted-tr,.z-window-overlapped-tr,.z-window-popup-tr - { +{ background: none; } @@ -581,7 +581,7 @@ div.z-grid { } .listdetails .z-tree .z-datebox-inp { -padding-top: 3px; + padding-top: 3px; } .listdetails input { @@ -722,7 +722,7 @@ padding-top: 3px; border: 0; } .perspectives-column { -/* border-right: solid 1px; */ + /* border-right: solid 1px; */ } /* Legend colors: @@ -893,19 +893,19 @@ span.z-dottree-line { } .z-menu-body { - background-color: #d4e1ef; - border-radius: 10px 10px 0 0; + background-color: #d4e1ef; + border-radius: 10px 10px 0 0; } .z-menu-inner-m .z-menu-btn { - font-weight: normal; - color: #005782; + font-weight: normal; + color: #005782; } .z-menu-body-over .z-menu-inner-m .z-menu-btn, .z-menu-body-seld .z-menu-inner-m .z-menu-btn, .current-section .z-menu-body .z-menu-inner-m .z-menu-btn { - color: #FFFFFF; + color: #FFFFFF; } .z-menu-body-over, .z-menu-body-seld, .current-section .z-menu-body { @@ -916,7 +916,7 @@ span.z-dottree-line { .z-menu-body-over .z-menu-inner-l, .z-menu-body-over .z-menu-inner-m, .z-menu-body-over .z-menu-inner-r { - background-image:none; + background-image:none; } .z-menu-body-seld .z-menu-inner-l, @@ -1077,6 +1077,19 @@ span.perspective, span.perspective-active { margin-top: 5px; } +.perspective.logs-global .z-button-cm { + background-image: url(../img/ico_logs-global.png); +} +.perspective-active.logs-global .z-button-cm { + background-image: url(../img/ico_logs-global.png); +} + +.perspective.logs-order .z-button-cm { + background-image: url(../img/ico_logs-order.png); +} +.perspective-active.logs-order .z-button-cm { + background-image: url(../img/ico_logs-order.png); +} .perspectives-column { display:none; @@ -1137,7 +1150,7 @@ span.perspective, span.perspective-active { } .main-area > .z-center-body:first-child { -/* height: auto !important; */ + /* height: auto !important; */ width: auto !important; } @@ -1175,18 +1188,18 @@ tr.z-treerow-seld input { tr.z-treerow-over input { background-color: #eff2f6; /* Soft blue */ - background-image: none; + background-image: none; } tr.z-treerow-over input { background-color: #eff2f6; /* Soft blue */ - background-image: none; + background-image: none; } .timeplot-canvas { position:relative; overflow:hidden; - } +} .resourcesload .timetracker-secondlevel { height: 2000px; @@ -1268,15 +1281,15 @@ tr.z-treerow-over input { } .timeTrackedTableWithLeftPane input[value="0"] { - color: #DDDDDD; + color: #DDDDDD; } /* for horizontal scrolling */ .timeTrackedTableWithLeftPane .z-grid-body table { - position:relative; + position:relative; } .timeTrackedTableWithLeftPane div.z-grid-body { -overflow: visible; + overflow: visible; } .advancedallocationlayout #timeTracker .z-vbox { @@ -1323,7 +1336,7 @@ overflow: visible; } .advancedallocationlayout .timetrackergap { - overflow: visible; + overflow: visible; } .timeTrackedTableWithLeftPane .z-grid-body .z-row-inner { @@ -1412,7 +1425,7 @@ tr.z-tree-row-seld .z-row-cnt { } .edit-task-window .z-tab-accordion { -display:none; + display:none; } .edit-task-window .z-tabpanel-accordion { @@ -1485,7 +1498,7 @@ display:none; } #ganttpanel .second_level_ #watermark .bankHoliday { -border-right: solid 1px #F2D8D8 !important; + border-right: solid 1px #F2D8D8 !important; } @@ -1584,7 +1597,7 @@ border-right: solid 1px #F2D8D8 !important; .advanced-assignment-area td .limiting.z-textbox { height: 20px; background: #61B598; // LIMITING_ASSIGNED - color: #555555; +color: #555555; border-right: solid 1px white; opacity: 1; -moz-opacity: 1; @@ -1594,7 +1607,7 @@ border-right: solid 1px #F2D8D8 !important; .advanced-assignment-area td .limiting.z-intbox[value="0"], .advanced-assignment-area td .limiting.z-textbox[value="0"] { background: #C1D9D1; // LIMITING_UNNASSIGNED - color: #555555; +color: #555555; } .advanced-assignment-area > .z-center-body { @@ -1655,7 +1668,7 @@ input.z-datebox-text-disd { display: none; } -.toolbar-box .z-button tbody, +.toolbar-box .z-button tbody, .toolbar-box .z-button tbody:hover, .toolbar-box .z-button tbody:active { background-color: transparent; @@ -1716,7 +1729,7 @@ input.z-datebox-text-disd { background-color: #A1D586; } -.z-button .z-button-tl, .z-button .z-button-tr, +.z-button .z-button-tl, .z-button .z-button-tr, .z-button .z-button-bl, .z-button .z-button-br { background-image: url(../img/btn-corner-green.gif); } @@ -1888,7 +1901,7 @@ select { } .scheduling-graphics { - width: auto !important; + width: auto !important; } .scheduling-graphics .z-tabs-ver-space { @@ -1927,3 +1940,41 @@ select { .z-menu-popup a:focus { text-decoration: none !important; } + +.issueLog-priority-color-red { + background: #FF4000 !important; +} + +.issueLog-priority-color-yellow { + background: #FFA500 !important; +} + +.issueLog-priority-color-green { + background: #AAFFAA !important; +} + +.riskLog-score-color-1 { + background: #BAF109 !important; +} + +.riskLog-score-color-2 { + background: #A3D307 !important; +} + +.riskLog-score-color-3 { + background: #FFAF04 !important; +} + +.riskLog-score-color-4 { + background: #FF9000 !important; +} + +.riskLog-score-color-6 { + background: #FF4B00 !important; +} + +.riskLog-score-color-9 { + background: #EA0024 !important; +} + + diff --git a/libreplan-webapp/src/main/webapp/common/img/cabecera.jpg b/libreplan-webapp/src/main/webapp/common/img/cabecera.jpg new file mode 100644 index 000000000..94ea1aa32 Binary files /dev/null and b/libreplan-webapp/src/main/webapp/common/img/cabecera.jpg differ diff --git a/libreplan-webapp/src/main/webapp/common/img/ico_logs-global.png b/libreplan-webapp/src/main/webapp/common/img/ico_logs-global.png new file mode 100644 index 000000000..90cdafaa4 Binary files /dev/null and b/libreplan-webapp/src/main/webapp/common/img/ico_logs-global.png differ diff --git a/libreplan-webapp/src/main/webapp/common/img/ico_logs-order.png b/libreplan-webapp/src/main/webapp/common/img/ico_logs-order.png new file mode 100644 index 000000000..8c5a475b6 Binary files /dev/null and b/libreplan-webapp/src/main/webapp/common/img/ico_logs-order.png differ diff --git a/libreplan-webapp/src/main/webapp/common/img/logo.gif b/libreplan-webapp/src/main/webapp/common/img/logo.gif new file mode 100644 index 000000000..7e91b4652 Binary files /dev/null and b/libreplan-webapp/src/main/webapp/common/img/logo.gif differ diff --git a/libreplan-webapp/src/main/webapp/common/img/logo2.gif b/libreplan-webapp/src/main/webapp/common/img/logo2.gif new file mode 100644 index 000000000..79b37add3 Binary files /dev/null and b/libreplan-webapp/src/main/webapp/common/img/logo2.gif differ diff --git a/libreplan-webapp/src/main/webapp/logs/_editIssueLog.zul b/libreplan-webapp/src/main/webapp/logs/_editIssueLog.zul new file mode 100644 index 000000000..a083f9a25 --- /dev/null +++ b/libreplan-webapp/src/main/webapp/logs/_editIssueLog.zul @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +