diff --git a/pom.xml b/pom.xml index 4ee4cc5d..fe4a45d7 100644 --- a/pom.xml +++ b/pom.xml @@ -308,6 +308,13 @@ DynamicJasper-core-fonts 1.0 + + + + javax.mail + mail + 1.4.3 + diff --git a/src/main/java/info/bukova/isspst/AppInitListener.java b/src/main/java/info/bukova/isspst/AppInitListener.java index 5c9ec19c..46e6cbef 100644 --- a/src/main/java/info/bukova/isspst/AppInitListener.java +++ b/src/main/java/info/bukova/isspst/AppInitListener.java @@ -1,8 +1,7 @@ package info.bukova.isspst; +import info.bukova.isspst.data.GlobalSettings; import info.bukova.isspst.data.NumberSeries; -import java.util.List; - import info.bukova.isspst.data.Permission; import info.bukova.isspst.data.RequirementType; import info.bukova.isspst.data.Role; @@ -12,10 +11,13 @@ import info.bukova.isspst.reporting.ReportMapping; import info.bukova.isspst.reporting.ReportType; import info.bukova.isspst.services.numberseries.NumberSeriesService; import info.bukova.isspst.services.requirement.RequirementTypeService; +import info.bukova.isspst.services.settings.GlobalSettingsService; import info.bukova.isspst.services.users.PermissionService; import info.bukova.isspst.services.users.RoleService; import info.bukova.isspst.services.users.UserService; +import java.util.List; + import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; @@ -32,6 +34,7 @@ public class AppInitListener implements ServletContextListener { private PermissionService permService; private NumberSeriesService nsService; private RequirementTypeService reqTypeService; + private GlobalSettingsService gSettingsService; @Override public void contextDestroyed(ServletContextEvent arg0) { @@ -48,6 +51,7 @@ public class AppInitListener implements ServletContextListener { userService = ctx.getBean(UserService.class); permService = ctx.getBean(PermissionService.class); nsService =ctx.getBean(NumberSeriesService.class); + gSettingsService = ctx.getBean(GlobalSettingsService.class); reqTypeService = ctx.getBean(RequirementTypeService.class); userService.grantAdmin(); @@ -57,6 +61,7 @@ public class AppInitListener implements ServletContextListener { checkAllAdminRights(); this.checkNumberSeries(); checkReqTypes(); + this.checkGlobalSettings(); userService.removeAccess(); loadModuleReports(); @@ -173,5 +178,13 @@ public class AppInitListener implements ServletContextListener { nsService.add(ns); } } + + private void checkGlobalSettings() { + if (gSettingsService.getAll().isEmpty()) { + GlobalSettings gs = new GlobalSettings(); + gSettingsService.add(gs); + } + + } } diff --git a/src/main/java/info/bukova/isspst/Constants.java b/src/main/java/info/bukova/isspst/Constants.java index 396a19a4..cb2695e3 100644 --- a/src/main/java/info/bukova/isspst/Constants.java +++ b/src/main/java/info/bukova/isspst/Constants.java @@ -8,7 +8,8 @@ import info.bukova.isspst.reporting.Report; import info.bukova.isspst.reporting.ReportMapping; import info.bukova.isspst.services.addressbook.AdbService; import info.bukova.isspst.services.buildings.BuildingService; -import info.bukova.isspst.services.material.MaterialService; +import info.bukova.isspst.services.reqsubjects.MaterialService; +import info.bukova.isspst.services.reqsubjects.ServiceItemService; import info.bukova.isspst.services.munits.MUnitService; import info.bukova.isspst.services.requirement.RequirementService; import info.bukova.isspst.services.requirement.RequirementTypeService; @@ -58,6 +59,7 @@ public class Constants { public final static String MOD_BUILDINGS = "BUILDINGS"; public final static String MOD_MUNITS = "MUNITS"; public final static String MOD_MATERIAL = "MATERIAL"; + public final static String MOD_SERVICES = "SERVICES"; public final static String MOD_WORKGROUPS = "WORKGROUPS"; public final static String MOD_REQUIREMENTS = "REQUIREMENTS"; public final static String MOD_WORKFLOW = "WORKFLOW"; @@ -68,6 +70,7 @@ public class Constants { new Module(MOD_BUILDINGS, "Budovy", BuildingService.class), new Module(MOD_MUNITS, "Měrné jednotky", MUnitService.class), new Module(MOD_MATERIAL, "Materiál", MaterialService.class), + new Module(MOD_SERVICES, "Služby", ServiceItemService.class), new Module(MOD_WORKGROUPS, "Pracovní skupiny", WorkgroupService.class), new Module(MOD_REQUIREMENTS, "Požadavky", RequirementService.class), new Module(MOD_WORKFLOW, "Procesy schválení", RequirementTypeService.class) diff --git a/src/main/java/info/bukova/isspst/dao/GlobalSettingsDao.java b/src/main/java/info/bukova/isspst/dao/GlobalSettingsDao.java new file mode 100644 index 00000000..4b960b8e --- /dev/null +++ b/src/main/java/info/bukova/isspst/dao/GlobalSettingsDao.java @@ -0,0 +1,7 @@ +package info.bukova.isspst.dao; + +import info.bukova.isspst.data.GlobalSettings; + +public interface GlobalSettingsDao extends BaseDao { + +} diff --git a/src/main/java/info/bukova/isspst/dao/ServiceItemDao.java b/src/main/java/info/bukova/isspst/dao/ServiceItemDao.java new file mode 100644 index 00000000..3f81f8aa --- /dev/null +++ b/src/main/java/info/bukova/isspst/dao/ServiceItemDao.java @@ -0,0 +1,7 @@ +package info.bukova.isspst.dao; + +import info.bukova.isspst.data.ServiceItem; + +public interface ServiceItemDao extends BaseDao { + +} diff --git a/src/main/java/info/bukova/isspst/dao/jpa/GlobalSettingsDaoJPA.java b/src/main/java/info/bukova/isspst/dao/jpa/GlobalSettingsDaoJPA.java new file mode 100644 index 00000000..78e7365d --- /dev/null +++ b/src/main/java/info/bukova/isspst/dao/jpa/GlobalSettingsDaoJPA.java @@ -0,0 +1,9 @@ +package info.bukova.isspst.dao.jpa; + +import info.bukova.isspst.dao.GlobalSettingsDao; +import info.bukova.isspst.data.GlobalSettings; + +public class GlobalSettingsDaoJPA extends BaseDaoJPA implements + GlobalSettingsDao { + +} diff --git a/src/main/java/info/bukova/isspst/dao/jpa/ServiceItemDaoJPA.java b/src/main/java/info/bukova/isspst/dao/jpa/ServiceItemDaoJPA.java new file mode 100644 index 00000000..dc18ed76 --- /dev/null +++ b/src/main/java/info/bukova/isspst/dao/jpa/ServiceItemDaoJPA.java @@ -0,0 +1,8 @@ +package info.bukova.isspst.dao.jpa; + +import info.bukova.isspst.dao.ServiceItemDao; +import info.bukova.isspst.data.ServiceItem; + +public class ServiceItemDaoJPA extends BaseDaoJPA implements ServiceItemDao { + +} diff --git a/src/main/java/info/bukova/isspst/data/GlobalSettings.java b/src/main/java/info/bukova/isspst/data/GlobalSettings.java new file mode 100644 index 00000000..5ce9aecb --- /dev/null +++ b/src/main/java/info/bukova/isspst/data/GlobalSettings.java @@ -0,0 +1,22 @@ +package info.bukova.isspst.data; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; + +@Entity +@Table(name = "GLOBALSETTINGS") +public class GlobalSettings extends BaseData { + + @Column(name = "DATA", length = 1048576) + private String data; + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } + +} diff --git a/src/main/java/info/bukova/isspst/data/MUnitEmb.java b/src/main/java/info/bukova/isspst/data/MUnitEmb.java new file mode 100644 index 00000000..19ee5cfc --- /dev/null +++ b/src/main/java/info/bukova/isspst/data/MUnitEmb.java @@ -0,0 +1,81 @@ +package info.bukova.isspst.data; + +import javax.persistence.Column; +import javax.persistence.Embeddable; + +@Embeddable +public class MUnitEmb { + @Column(name = "MUNIT_ID") + private Integer id; + @Column(name = "MUNIT_CODE") + private String code; + @Column(name = "MUNIT_DESCRIPTION") + private String description; + @Column(name = "MUNIT_NAME") + private String name; + + public MUnitEmb() { + + } + + public MUnitEmb(MUnit munit) { + this.id = munit.getId(); + this.code = munit.getCode(); + this.description = munit.getDescription(); + this.name = munit.getName(); + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean eqWith(MUnit munit) { + return this.id == munit.getId() + && this.code.equals(munit.getCode()) + && this.name.equals(munit.getName()) + && this.description.equals(munit.getDescription()); + } + + @Override + public boolean equals(Object munit) { + return munit != null + && (munit instanceof MUnitEmb) + && this.id == ((MUnitEmb)munit).getId() + && (this.code == ((MUnitEmb)munit).getCode() || this.code.equals(((MUnitEmb)munit).getCode())) + && (this.name == ((MUnitEmb)munit).getName() || this.name.equals(((MUnitEmb)munit).getName())) + && (this.description == ((MUnitEmb)munit).getDescription() || this.description.equals(((MUnitEmb)munit).getDescription())); + } + + @Override + public String toString() { + return this.code + " - " + this.name; + } +} diff --git a/src/main/java/info/bukova/isspst/data/Material.java b/src/main/java/info/bukova/isspst/data/Material.java index 0b57148a..1aee860c 100644 --- a/src/main/java/info/bukova/isspst/data/Material.java +++ b/src/main/java/info/bukova/isspst/data/Material.java @@ -1,5 +1,6 @@ package info.bukova.isspst.data; +import javax.persistence.Embedded; import javax.persistence.Entity; import javax.persistence.Table; @@ -7,6 +8,15 @@ import javax.persistence.Table; @Table(name="MATERIAL") public class Material extends RequirementSubject { - + @Embedded + private MUnitEmb munit; + + public MUnitEmb getMunit() { + return munit; + } + + public void setMunit(MUnitEmb munit) { + this.munit = munit; + } } diff --git a/src/main/java/info/bukova/isspst/data/RequirementSubject.java b/src/main/java/info/bukova/isspst/data/RequirementSubject.java index 6a2eca97..7a49bd6c 100644 --- a/src/main/java/info/bukova/isspst/data/RequirementSubject.java +++ b/src/main/java/info/bukova/isspst/data/RequirementSubject.java @@ -25,10 +25,10 @@ public abstract class RequirementSubject implements OwnedDataModel { @Column(name =" ID") @GeneratedValue(strategy = GenerationType.TABLE) private int id; - @ManyToOne(fetch=FetchType.EAGER) + @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="OWNED_BY_ID") private User ownedBy; - @ManyToOne(fetch=FetchType.EAGER) + @ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="MODIFIED_BY_ID") private User modifiedBy; @Column(name = "CREATED") diff --git a/src/main/java/info/bukova/isspst/data/ServiceItem.java b/src/main/java/info/bukova/isspst/data/ServiceItem.java new file mode 100644 index 00000000..7ab42142 --- /dev/null +++ b/src/main/java/info/bukova/isspst/data/ServiceItem.java @@ -0,0 +1,10 @@ +package info.bukova.isspst.data; + +import javax.persistence.Entity; +import javax.persistence.Table; + +@Entity +@Table(name = "SERVICE") +public class ServiceItem extends RequirementSubject { + +} diff --git a/src/main/java/info/bukova/isspst/data/SettingsData.java b/src/main/java/info/bukova/isspst/data/SettingsData.java new file mode 100644 index 00000000..89434b41 --- /dev/null +++ b/src/main/java/info/bukova/isspst/data/SettingsData.java @@ -0,0 +1,50 @@ +package info.bukova.isspst.data; + +import info.bukova.isspst.mail.MailMessage; + +public class SettingsData { + + private boolean enableRequirements; + private MailMessage newReqTemplate; + private MailMessage authReqTemplate; + private MailMessage confReqTemplate; + + public SettingsData() { + newReqTemplate = new MailMessage(); + authReqTemplate = new MailMessage(); + confReqTemplate = new MailMessage(); + } + + public boolean isEnableRequirements() { + return enableRequirements; + } + + public void setEnableRequirements(boolean enableRequirements) { + this.enableRequirements = enableRequirements; + } + + public MailMessage getNewReqTemplate() { + return newReqTemplate; + } + + public void setNewReqTemplate(MailMessage newReqTemplate) { + this.newReqTemplate = newReqTemplate; + } + + public MailMessage getAuthReqTemplate() { + return authReqTemplate; + } + + public void setAuthReqTemplate(MailMessage authReqTemplate) { + this.authReqTemplate = authReqTemplate; + } + + public MailMessage getConfReqTemplate() { + return confReqTemplate; + } + + public void setConfReqTemplate(MailMessage confReqTemplate) { + this.confReqTemplate = confReqTemplate; + } + +} diff --git a/src/main/java/info/bukova/isspst/data/Workflow.java b/src/main/java/info/bukova/isspst/data/Workflow.java index a5d839cd..ac489428 100644 --- a/src/main/java/info/bukova/isspst/data/Workflow.java +++ b/src/main/java/info/bukova/isspst/data/Workflow.java @@ -1,5 +1,7 @@ package info.bukova.isspst.data; +import java.math.BigDecimal; + import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.JoinColumn; @@ -21,6 +23,8 @@ public class Workflow extends BaseData { private Role role; @Column(name = "WORDER") private Integer wOrder; + @Column(name = "WLIMIT", precision=15, scale=4) + private BigDecimal limit; public Boolean getCentre() { return centre; @@ -56,4 +60,12 @@ public class Workflow extends BaseData { this.wOrder = order; } + public BigDecimal getLimit() { + return limit; + } + + public void setLimit(BigDecimal limit) { + this.limit = limit; + } + } diff --git a/src/main/java/info/bukova/isspst/filters/ServiceItemFilter.java b/src/main/java/info/bukova/isspst/filters/ServiceItemFilter.java new file mode 100644 index 00000000..d12dc3b2 --- /dev/null +++ b/src/main/java/info/bukova/isspst/filters/ServiceItemFilter.java @@ -0,0 +1,56 @@ +package info.bukova.isspst.filters; + +import static info.bukova.isspst.StringUtils.nullStr; +import info.bukova.isspst.data.ServiceItem; + +import org.hamcrest.Description; +import org.hamcrest.Factory; +import org.hamcrest.Matcher; +import org.hamcrest.TypeSafeMatcher; + +public class ServiceItemFilter implements Filter { + + private ServiceItem condServiceItem; + + public ServiceItemFilter(ServiceItem condServiceItem) { + this.condServiceItem = condServiceItem; + } + + private static class ServiceItemMatcher extends TypeSafeMatcher { + + private ServiceItem condServiceItem; + + public ServiceItemMatcher(ServiceItem cond) { + this.condServiceItem = cond; + } + + @Override + public void describeTo(Description desc) { + desc.appendText("material matches"); + } + + @Override + public boolean matchesSafely(ServiceItem item) { + return nullStr(item.getCode()).toLowerCase().contains(nullStr(condServiceItem.getCode()).toLowerCase()) + && nullStr(item.getName()).toLowerCase().contains(nullStr(condServiceItem.getName()).toLowerCase()) + && nullStr(item.getDescription()).toLowerCase().contains(nullStr(condServiceItem.getDescription()).toLowerCase()); + } + + @Factory + public static Matcher matchBuilding(ServiceItem material) { + return new ServiceItemMatcher(material); + } + } + + @Override + public ServiceItemMatcher matcher() { + return new ServiceItemMatcher(condServiceItem); + } + + @Override + public String queryString() { + // TODO query string + return ""; + } + +} diff --git a/src/main/java/info/bukova/isspst/mail/MailMessage.java b/src/main/java/info/bukova/isspst/mail/MailMessage.java new file mode 100644 index 00000000..43df9fe4 --- /dev/null +++ b/src/main/java/info/bukova/isspst/mail/MailMessage.java @@ -0,0 +1,49 @@ +package info.bukova.isspst.mail; + +import org.springframework.mail.SimpleMailMessage; + +public class MailMessage extends SimpleMailMessage { + + /** + * + */ + private static final long serialVersionUID = -3240551712942170018L; + + private boolean html; + private String attachementName; + private byte[] attachementData; + private String contentType; + + public boolean isHtml() { + return html; + } + + public void setHtml(boolean html) { + this.html = html; + } + + public byte[] getAttachementData() { + return attachementData; + } + + public void setAttachementData(byte[] attachementData) { + this.attachementData = attachementData; + } + + public String getContentType() { + return contentType; + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + public String getAttachementName() { + return attachementName; + } + + public void setAttachementName(String attachementName) { + this.attachementName = attachementName; + } + +} diff --git a/src/main/java/info/bukova/isspst/mail/Mailer.java b/src/main/java/info/bukova/isspst/mail/Mailer.java new file mode 100644 index 00000000..d01e5daf --- /dev/null +++ b/src/main/java/info/bukova/isspst/mail/Mailer.java @@ -0,0 +1,7 @@ +package info.bukova.isspst.mail; + +public interface Mailer { + + public void send(MailMessage message); + +} diff --git a/src/main/java/info/bukova/isspst/mail/MailerWithAttachement.java b/src/main/java/info/bukova/isspst/mail/MailerWithAttachement.java new file mode 100644 index 00000000..b148acc3 --- /dev/null +++ b/src/main/java/info/bukova/isspst/mail/MailerWithAttachement.java @@ -0,0 +1,57 @@ +package info.bukova.isspst.mail; + +import javax.mail.MessagingException; +import javax.mail.internet.MimeMessage; + +import org.springframework.core.io.ByteArrayResource; +import org.springframework.core.io.InputStreamSource; +import org.springframework.mail.MailParseException; +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.mail.javamail.MimeMessageHelper; +import org.springframework.scheduling.annotation.Async; + +public class MailerWithAttachement implements Mailer { + + private JavaMailSender sender; + private String from; + + public MailerWithAttachement(JavaMailSender sender) { + this.sender = sender; + } + + @Override + @Async + public void send(MailMessage message) { + MimeMessage mimeMessage = sender.createMimeMessage(); + + try { + MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true); + + if (message.getFrom() == null || message.getFrom().isEmpty()) { + if (from == null || from.isEmpty()) { + message.setFrom("tomcat@is.bukova.info"); + } else { + message.setFrom(from); + } + } + + helper.setFrom(message.getFrom()); + helper.setTo(message.getTo()); + helper.setSubject(message.getSubject()); + helper.setText(message.getText(), message.isHtml()); + + if (message.getAttachementData() != null) { + InputStreamSource source = new ByteArrayResource(message.getAttachementData()); + helper.addAttachment(message.getAttachementName(), source, message.getContentType()); + } + } catch (MessagingException e) { + throw new MailParseException(e); + } + sender.send(mimeMessage); + } + + public void setFrom(String from) { + this.from = from; + } + +} diff --git a/src/main/java/info/bukova/isspst/mail/SimpleMailer.java b/src/main/java/info/bukova/isspst/mail/SimpleMailer.java new file mode 100644 index 00000000..5db91dd3 --- /dev/null +++ b/src/main/java/info/bukova/isspst/mail/SimpleMailer.java @@ -0,0 +1,33 @@ +package info.bukova.isspst.mail; + +import org.springframework.mail.javamail.JavaMailSender; +import org.springframework.scheduling.annotation.Async; + +public class SimpleMailer implements Mailer { + + private JavaMailSender sender; + private String from; + + public SimpleMailer(JavaMailSender sender) { + this.sender = sender; + } + + @Override + @Async + public void send(MailMessage message) { + if (message.getFrom() == null || message.getFrom().isEmpty()) { + if (from == null || from.isEmpty()) { + message.setFrom("tomcat@is.bukova.info"); + } else { + message.setFrom(from); + } + } + + sender.send(message); + } + + public void setFrom(String from) { + this.from = from; + } + +} diff --git a/src/main/java/info/bukova/isspst/security/IsspstPermissionEvaluator.java b/src/main/java/info/bukova/isspst/security/IsspstPermissionEvaluator.java index a0ec127f..7c1ab9c0 100644 --- a/src/main/java/info/bukova/isspst/security/IsspstPermissionEvaluator.java +++ b/src/main/java/info/bukova/isspst/security/IsspstPermissionEvaluator.java @@ -41,11 +41,12 @@ public class IsspstPermissionEvaluator implements PermissionEvaluator { private boolean evaluateGlobal(Service service, String permission, List perms) { String moduleId = ""; - String perm = ""; + String perm = permission; for (Module m : Constants.MODULES) { if (m.getServiceClass() != null && m.getServiceClass().isAssignableFrom(service.getClass())) { moduleId = m.getId(); + break; } } diff --git a/src/main/java/info/bukova/isspst/services/material/MaterialService.java b/src/main/java/info/bukova/isspst/services/reqsubjects/MaterialService.java similarity index 75% rename from src/main/java/info/bukova/isspst/services/material/MaterialService.java rename to src/main/java/info/bukova/isspst/services/reqsubjects/MaterialService.java index aa40c282..a62f4e2a 100644 --- a/src/main/java/info/bukova/isspst/services/material/MaterialService.java +++ b/src/main/java/info/bukova/isspst/services/reqsubjects/MaterialService.java @@ -1,4 +1,4 @@ -package info.bukova.isspst.services.material; +package info.bukova.isspst.services.reqsubjects; import info.bukova.isspst.data.Material; import info.bukova.isspst.services.Service; diff --git a/src/main/java/info/bukova/isspst/services/material/MaterialServiceImpl.java b/src/main/java/info/bukova/isspst/services/reqsubjects/MaterialServiceImpl.java similarity index 80% rename from src/main/java/info/bukova/isspst/services/material/MaterialServiceImpl.java rename to src/main/java/info/bukova/isspst/services/reqsubjects/MaterialServiceImpl.java index 2e9a63e1..1e3e8086 100644 --- a/src/main/java/info/bukova/isspst/services/material/MaterialServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/reqsubjects/MaterialServiceImpl.java @@ -1,4 +1,4 @@ -package info.bukova.isspst.services.material; +package info.bukova.isspst.services.reqsubjects; import info.bukova.isspst.data.Material; import info.bukova.isspst.services.AbstractOwnedService; diff --git a/src/main/java/info/bukova/isspst/services/reqsubjects/ServiceItemService.java b/src/main/java/info/bukova/isspst/services/reqsubjects/ServiceItemService.java new file mode 100644 index 00000000..a8b2d95c --- /dev/null +++ b/src/main/java/info/bukova/isspst/services/reqsubjects/ServiceItemService.java @@ -0,0 +1,8 @@ +package info.bukova.isspst.services.reqsubjects; + +import info.bukova.isspst.data.ServiceItem; +import info.bukova.isspst.services.Service; + +public interface ServiceItemService extends Service { + +} diff --git a/src/main/java/info/bukova/isspst/services/reqsubjects/ServiceItemServiceImpl.java b/src/main/java/info/bukova/isspst/services/reqsubjects/ServiceItemServiceImpl.java new file mode 100644 index 00000000..cc704c86 --- /dev/null +++ b/src/main/java/info/bukova/isspst/services/reqsubjects/ServiceItemServiceImpl.java @@ -0,0 +1,9 @@ +package info.bukova.isspst.services.reqsubjects; + +import info.bukova.isspst.data.ServiceItem; +import info.bukova.isspst.services.AbstractOwnedService; + +public class ServiceItemServiceImpl extends AbstractOwnedService implements + ServiceItemService { + +} diff --git a/src/main/java/info/bukova/isspst/services/settings/GlobalSettingServiceImpl.java b/src/main/java/info/bukova/isspst/services/settings/GlobalSettingServiceImpl.java new file mode 100644 index 00000000..a06a322f --- /dev/null +++ b/src/main/java/info/bukova/isspst/services/settings/GlobalSettingServiceImpl.java @@ -0,0 +1,110 @@ +package info.bukova.isspst.services.settings; + +import java.io.IOException; +import java.io.StringReader; +import java.io.StringWriter; + +import org.exolab.castor.xml.MarshalException; +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; +import org.exolab.castor.xml.ValidationException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.transaction.annotation.Transactional; + +import info.bukova.isspst.data.GlobalSettings; +import info.bukova.isspst.data.SettingsData; +import info.bukova.isspst.services.AbstractOwnedService; +import info.bukova.isspst.services.IsspstException; + +public class GlobalSettingServiceImpl extends AbstractOwnedService implements + GlobalSettingsService { + + private final static Logger log = LoggerFactory.getLogger(GlobalSettingsService.class); + private final static String MARSHAL_ERROR = "Cannot marshal settings data: "; + private final static String UNMARSHAL_ERROR = "Cannot unmarshal settings data: "; + + private Marshaller marshaller; + private Unmarshaller unmarshaller; + private SettingsData settings; + + public GlobalSettingServiceImpl(Marshaller marshaller, Unmarshaller unmarshaller) { + this.marshaller = marshaller; + this.unmarshaller = unmarshaller; + } + + @Override + @Transactional + @PreAuthorize("hasPermission(this, 'PERM_ADD')") + public void add(GlobalSettings entity) { + if (!this.getAll().isEmpty()) { + throw new IsspstException("Global settings allready exists"); + } + + if (entity.getData() == null || entity.getData().isEmpty()) { + SettingsData data = new SettingsData(); + entity.setData(marshalData(data)); + } + + super.add(entity); + } + + private String marshalData(SettingsData data) { + StringWriter wr = new StringWriter(); + try { + marshaller.setWriter(wr); + marshaller. marshal(data); + } catch (MarshalException e) { + log.error(MARSHAL_ERROR + e.getMessage()); + } catch (ValidationException e) { + log.error(MARSHAL_ERROR + e.getMessage()); + } catch (IOException e) { + log.error(MARSHAL_ERROR + e.getMessage()); + } + + return wr.toString(); + + } + + private SettingsData unmarshalData(String data) { + StringReader sr = new StringReader(data); + try { + unmarshaller.setClass(SettingsData.class); + return (SettingsData) unmarshaller.unmarshal(sr); + } catch (MarshalException e) { + log.error(UNMARSHAL_ERROR + e.getMessage()); + } catch (ValidationException e) { + log.error(UNMARSHAL_ERROR + e.getMessage()); + } + + return null; + } + + @Override + @Transactional + public SettingsData getSettings() { + if (settings == null) { + GlobalSettings gs = this.getAll().get(0); + settings = unmarshalData(gs.getData()); + } + return settings; + } + + @Override + @Transactional + @PreAuthorize("hasPermission(this, 'PERM_EDIT')") + public void updateSettings() { + if (this.getAll().isEmpty()) { + throw new IsspstException("Global settings does not exists"); + } + + GlobalSettings gs = this.getAll().get(0); + gs.setData(marshalData(settings)); + + super.update(gs); + } + + + +} diff --git a/src/main/java/info/bukova/isspst/services/settings/GlobalSettingsService.java b/src/main/java/info/bukova/isspst/services/settings/GlobalSettingsService.java new file mode 100644 index 00000000..e15cba77 --- /dev/null +++ b/src/main/java/info/bukova/isspst/services/settings/GlobalSettingsService.java @@ -0,0 +1,12 @@ +package info.bukova.isspst.services.settings; + +import info.bukova.isspst.data.GlobalSettings; +import info.bukova.isspst.data.SettingsData; +import info.bukova.isspst.services.Service; + +public interface GlobalSettingsService extends Service { + + public void updateSettings(); + public SettingsData getSettings(); + +} diff --git a/src/main/java/info/bukova/isspst/sort/ReflectionTools.java b/src/main/java/info/bukova/isspst/sort/ReflectionTools.java index 5a2902e6..ed363745 100644 --- a/src/main/java/info/bukova/isspst/sort/ReflectionTools.java +++ b/src/main/java/info/bukova/isspst/sort/ReflectionTools.java @@ -1,6 +1,12 @@ package info.bukova.isspst.sort; +import java.beans.BeanInfo; +import java.beans.IntrospectionException; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; public class ReflectionTools { @@ -46,4 +52,30 @@ public class ReflectionTools { throw new IllegalArgumentException("Not getter method found for '" + propertyName + "', bean: " + bean); } + + public static List getEntityFields(Class clazz) { + BeanInfo beanInfo; + try { + beanInfo = Introspector.getBeanInfo(clazz); + } catch (IntrospectionException e) { + return null; + } + PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors(); + List properties = new ArrayList(); + for (PropertyDescriptor pd : pds) { + if (!(pd.getName().equals("password") || pd.getName().equals("class") || pd.getName().equals("id") || pd.getName().equals("valid"))) { + properties.add(pd.getName()); + } + } + + return properties; + } + + public static List getEntityFields(Object entity) { + if (entity == null) { + return null; + } + + return getEntityFields(entity.getClass()); + } } diff --git a/src/main/java/info/bukova/isspst/ui/NavigationVM.java b/src/main/java/info/bukova/isspst/ui/NavigationVM.java index e857a06b..72d9a205 100644 --- a/src/main/java/info/bukova/isspst/ui/NavigationVM.java +++ b/src/main/java/info/bukova/isspst/ui/NavigationVM.java @@ -22,6 +22,18 @@ public class NavigationVM { window.doModal(); } + @Command + public void numSeries() { + Window window = (Window)Executions.createComponents("/settings/numberSeries.zul", null, null); + window.doModal(); + } + + @Command + public void globalSettings() { + Window window = (Window)Executions.createComponents("/settings/globalSettings.zul", null, null); + window.doModal(); + } + public String getContextPath() { return contextPath; } diff --git a/src/main/java/info/bukova/isspst/ui/mail/MailForm.java b/src/main/java/info/bukova/isspst/ui/mail/MailForm.java new file mode 100644 index 00000000..09c42e91 --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/mail/MailForm.java @@ -0,0 +1,73 @@ +package info.bukova.isspst.ui.mail; + +import info.bukova.isspst.mail.MailMessage; +import info.bukova.isspst.mail.Mailer; +import info.bukova.isspst.reporting.Generator; +import info.bukova.isspst.reporting.GeneratorFactory; +import info.bukova.isspst.reporting.ReportDefinition; + +import org.zkoss.bind.annotation.BindingParam; +import org.zkoss.bind.annotation.Command; +import org.zkoss.bind.annotation.ExecutionArgParam; +import org.zkoss.bind.annotation.Init; +import org.zkoss.zk.ui.select.annotation.WireVariable; +import org.zkoss.zul.Window; + +public class MailForm { + + @WireVariable + private Mailer mailer; + @WireVariable + private ReportDefinition reportDefinition; + @WireVariable + private GeneratorFactory genFactory; + private MailMessage message; + private String to; + private String attachement; + private boolean report; + + @Init + public void init(@ExecutionArgParam("report") Boolean report) { + message = new MailMessage(); + message.setHtml(true); + this.report = report; + if (report) { + attachement = "report.pdf"; + } + } + + @Command + public void send(@BindingParam("window") Window window) { + message.setTo(to); + if (report) { + Generator generator = genFactory.createGenerator(reportDefinition); + message.setAttachementData(generator.generate()); + message.setAttachementName("report.pdf"); + message.setContentType("application/pdf"); + } + + mailer.send(message); + window.detach(); + } + + public MailMessage getMessage() { + return message; + } + + public void setMessage(MailMessage message) { + this.message = message; + } + + public String getTo() { + return to; + } + + public void setTo(String to) { + this.to = to; + } + + public String getAttachement() { + return attachement; + } + +} diff --git a/src/main/java/info/bukova/isspst/ui/reporting/ColSelectVM.java b/src/main/java/info/bukova/isspst/ui/reporting/ColSelectVM.java index 6036514c..f22bd68b 100644 --- a/src/main/java/info/bukova/isspst/ui/reporting/ColSelectVM.java +++ b/src/main/java/info/bukova/isspst/ui/reporting/ColSelectVM.java @@ -1,18 +1,14 @@ package info.bukova.isspst.ui.reporting; -import java.beans.BeanInfo; -import java.beans.IntrospectionException; -import java.beans.Introspector; -import java.beans.PropertyDescriptor; -import java.util.ArrayList; -import java.util.List; - import info.bukova.isspst.reporting.Report; import info.bukova.isspst.reporting.ReportDefinition; import info.bukova.isspst.reporting.ReportType; +import info.bukova.isspst.sort.ReflectionTools; import info.bukova.isspst.ui.ListChecks; import info.bukova.isspst.ui.LocaleConverter; +import java.util.List; + import org.zkoss.bind.annotation.Init; import org.zkoss.zk.ui.select.annotation.WireVariable; @@ -38,19 +34,7 @@ public class ColSelectVM { return null; } - BeanInfo beanInfo; - try { - beanInfo = Introspector.getBeanInfo(data.get(0).getClass()); - } catch (IntrospectionException e) { - return null; - } - PropertyDescriptor[] pds = beanInfo.getPropertyDescriptors(); - List properties = new ArrayList(); - for (PropertyDescriptor pd : pds) { - if (!(pd.getName().equals("password") || pd.getName().equals("class") || pd.getName().equals("id") || pd.getName().equals("valid"))) { - properties.add(pd.getName()); - } - } + List properties = ReflectionTools.getEntityFields(data.get(0)); ListChecks columns = new ListChecks(reportDefinition.getFieldsToPrint(), properties); return columns; diff --git a/src/main/java/info/bukova/isspst/ui/reporting/ReportVM.java b/src/main/java/info/bukova/isspst/ui/reporting/ReportVM.java index 5fda96d7..dd0f4dcd 100644 --- a/src/main/java/info/bukova/isspst/ui/reporting/ReportVM.java +++ b/src/main/java/info/bukova/isspst/ui/reporting/ReportVM.java @@ -1,6 +1,12 @@ package info.bukova.isspst.ui.reporting; +import java.util.HashMap; +import java.util.Map; + +import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Init; +import org.zkoss.zk.ui.Executions; +import org.zkoss.zul.Window; public class ReportVM { @@ -8,5 +14,13 @@ public class ReportVM { public void init() { } + + @Command + public void send() { + Map params = new HashMap(); + params.put("report", true); + Window mailForm = (Window) Executions.createComponents("/app/mailForm.zul", null, params); + mailForm.doModal(); + } } diff --git a/src/main/java/info/bukova/isspst/ui/reqsubjects/MaterialForm.java b/src/main/java/info/bukova/isspst/ui/reqsubjects/MaterialForm.java new file mode 100644 index 00000000..3f789bc3 --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/reqsubjects/MaterialForm.java @@ -0,0 +1,35 @@ +package info.bukova.isspst.ui.reqsubjects; + +import java.util.ArrayList; +import java.util.List; + +import org.zkoss.bind.annotation.Init; +import org.zkoss.zk.ui.select.annotation.WireVariable; + +import info.bukova.isspst.data.MUnit; +import info.bukova.isspst.data.MUnitEmb; +import info.bukova.isspst.data.Material; +import info.bukova.isspst.services.munits.MUnitService; +import info.bukova.isspst.ui.FormViewModel; + +public class MaterialForm extends FormViewModel { + + @WireVariable + private MUnitService munitService; + private List munits; + + @Init(superclass = true) + public void init() { + List mu = munitService.getAll(); + munits = new ArrayList(); + for (MUnit m : mu) { + MUnitEmb muEmb = new MUnitEmb(m); + munits.add(muEmb); + } + } + + public List getMunits() { + return munits; + } + +} diff --git a/src/main/java/info/bukova/isspst/ui/material/MaterialList.java b/src/main/java/info/bukova/isspst/ui/reqsubjects/MaterialList.java similarity index 83% rename from src/main/java/info/bukova/isspst/ui/material/MaterialList.java rename to src/main/java/info/bukova/isspst/ui/reqsubjects/MaterialList.java index b2dc9137..ab730b9a 100644 --- a/src/main/java/info/bukova/isspst/ui/material/MaterialList.java +++ b/src/main/java/info/bukova/isspst/ui/reqsubjects/MaterialList.java @@ -1,11 +1,11 @@ -package info.bukova.isspst.ui.material; +package info.bukova.isspst.ui.reqsubjects; import org.zkoss.bind.annotation.Init; import org.zkoss.zk.ui.select.annotation.WireVariable; import info.bukova.isspst.data.Material; import info.bukova.isspst.filters.MaterialFilter; -import info.bukova.isspst.services.material.MaterialService; +import info.bukova.isspst.services.reqsubjects.MaterialService; import info.bukova.isspst.ui.ListViewModel; public class MaterialList extends ListViewModel { diff --git a/src/main/java/info/bukova/isspst/ui/material/MaterialForm.java b/src/main/java/info/bukova/isspst/ui/reqsubjects/ServiceItemForm.java similarity index 63% rename from src/main/java/info/bukova/isspst/ui/material/MaterialForm.java rename to src/main/java/info/bukova/isspst/ui/reqsubjects/ServiceItemForm.java index 2bab7210..a956c693 100644 --- a/src/main/java/info/bukova/isspst/ui/material/MaterialForm.java +++ b/src/main/java/info/bukova/isspst/ui/reqsubjects/ServiceItemForm.java @@ -1,15 +1,15 @@ -package info.bukova.isspst.ui.material; - -import org.zkoss.bind.annotation.Init; +package info.bukova.isspst.ui.reqsubjects; import info.bukova.isspst.data.Material; import info.bukova.isspst.ui.FormViewModel; -public class MaterialForm extends FormViewModel { +import org.zkoss.bind.annotation.Init; + +public class ServiceItemForm extends FormViewModel { @Init(superclass = true) public void init() { - + } } diff --git a/src/main/java/info/bukova/isspst/ui/reqsubjects/ServiceItemList.java b/src/main/java/info/bukova/isspst/ui/reqsubjects/ServiceItemList.java new file mode 100644 index 00000000..f0298c40 --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/reqsubjects/ServiceItemList.java @@ -0,0 +1,24 @@ +package info.bukova.isspst.ui.reqsubjects; + +import info.bukova.isspst.data.ServiceItem; +import info.bukova.isspst.filters.ServiceItemFilter; +import info.bukova.isspst.services.reqsubjects.ServiceItemService; +import info.bukova.isspst.ui.ListViewModel; + +import org.zkoss.bind.annotation.Init; +import org.zkoss.zk.ui.select.annotation.WireVariable; + +public class ServiceItemList extends ListViewModel { + + @WireVariable + private ServiceItemService serviceItemService; + + @Init + public void init() { + service = serviceItemService; + dataClass = ServiceItem.class; + formZul = "serviceForm.zul"; + dataFilter = new ServiceItemFilter(getFilterTemplate()); + } + +} diff --git a/src/main/java/info/bukova/isspst/ui/requirement/RequirementTypesVM.java b/src/main/java/info/bukova/isspst/ui/requirement/RequirementTypesVM.java index b1506eb0..863e61a3 100644 --- a/src/main/java/info/bukova/isspst/ui/requirement/RequirementTypesVM.java +++ b/src/main/java/info/bukova/isspst/ui/requirement/RequirementTypesVM.java @@ -7,16 +7,22 @@ import info.bukova.isspst.data.Workflow; import info.bukova.isspst.services.requirement.RequirementTypeService; import info.bukova.isspst.services.users.RoleService; +import java.math.BigDecimal; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.Command; +import org.zkoss.bind.annotation.GlobalCommand; import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.NotifyChange; +import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.event.DropEvent; import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zul.Listitem; +import org.zkoss.zul.Window; public class RequirementTypesVM { @@ -28,6 +34,8 @@ public class RequirementTypesVM { private List centreRoles; private List workgroupRoles; private RequirementType selected; + private Workflow wgSelWorkflow; + private Workflow centreSelWorkflow; @Init public void init() { @@ -199,5 +207,42 @@ public class RequirementTypesVM { this.selected = selected; } + + @Command + @NotifyChange({"selected", "centreSelWorkflow", "wgSelWorkflow"}) + public void overLimit(@BindingParam("workflow") Workflow workflow) { + if (workflow.getLimit() != null && !workflow.getLimit().equals(BigDecimal.ZERO)) { + workflow.setLimit(null); + reqTypeService.update(selected); + return; + } + + Map params = new HashMap(); + params.put("workflow", workflow); + Window win = (Window) Executions.createComponents("/settings/workflow/limit.zul", null, params); + win.doModal(); + } + + @GlobalCommand + @NotifyChange("selected") + public void refresh() { + reqTypeService.update(selected); + } + + public Workflow getWgSelWorkflow() { + return wgSelWorkflow; + } + + public void setWgSelWorkflow(Workflow wgSelWorkflow) { + this.wgSelWorkflow = wgSelWorkflow; + } + + public Workflow getCentreSelWorkflow() { + return centreSelWorkflow; + } + + public void setCentreSelWorkflow(Workflow centreSelWorkflow) { + this.centreSelWorkflow = centreSelWorkflow; + } } diff --git a/src/main/java/info/bukova/isspst/ui/requirements/LimitVM.java b/src/main/java/info/bukova/isspst/ui/requirements/LimitVM.java new file mode 100644 index 00000000..45597f4c --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/requirements/LimitVM.java @@ -0,0 +1,33 @@ +package info.bukova.isspst.ui.requirements; + +import info.bukova.isspst.data.Workflow; + +import org.zkoss.bind.annotation.BindingParam; +import org.zkoss.bind.annotation.Command; +import org.zkoss.bind.annotation.ExecutionArgParam; +import org.zkoss.bind.annotation.Init; +import org.zkoss.zul.Window; + +public class LimitVM { + + private Workflow workflow; + + @Init + public void init(@ExecutionArgParam("workflow") Workflow workflow) { + this.workflow = workflow; + } + + public Workflow getWorkflow() { + return workflow; + } + + @Command + public void save(@BindingParam("window") Window window) { + window.detach(); + } + + public boolean isCanSave() { + return true; + } + +} diff --git a/src/main/java/info/bukova/isspst/ui/settings/GlobalSettingsVM.java b/src/main/java/info/bukova/isspst/ui/settings/GlobalSettingsVM.java new file mode 100644 index 00000000..6def8eaa --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/settings/GlobalSettingsVM.java @@ -0,0 +1,60 @@ +package info.bukova.isspst.ui.settings; + +import java.util.List; + +import org.zkoss.bind.annotation.BindingParam; +import org.zkoss.bind.annotation.Command; +import org.zkoss.bind.annotation.Init; +import org.zkoss.bind.annotation.NotifyChange; +import org.zkoss.zk.ui.select.annotation.WireVariable; +import org.zkoss.zul.Window; + +import info.bukova.isspst.data.Requirement; +import info.bukova.isspst.data.SettingsData; +import info.bukova.isspst.mail.MailMessage; +import info.bukova.isspst.services.settings.GlobalSettingsService; +import info.bukova.isspst.sort.ReflectionTools; +import info.bukova.isspst.ui.LocaleConverter; + +public class GlobalSettingsVM { + + @WireVariable + private GlobalSettingsService settingsService; + private SettingsData settings; + private LocaleConverter locConverter; + + @Init + public void init() { + settings = settingsService.getSettings(); + locConverter = new LocaleConverter(); + } + + public SettingsData getSettings() { + return settings; + } + + @Command + public void save(@BindingParam("window") Window window) { + settingsService.updateSettings(); + window.detach(); + } + + public List getRequirementFields() { + return ReflectionTools.getEntityFields(Requirement.class); + } + + public boolean isCanSave() { + return true; + } + + public LocaleConverter getLocConverter() { + return locConverter; + } + + @Command + @NotifyChange("settings") + public void insertField(@BindingParam("field") String field, @BindingParam("message") MailMessage message) { + message.setText(message.getText() + ":" + field + ":"); + } + +} diff --git a/src/main/java/info/bukova/isspst/ui/settings/NumberSeriesVM.java b/src/main/java/info/bukova/isspst/ui/settings/NumberSeriesVM.java new file mode 100644 index 00000000..7e739c1a --- /dev/null +++ b/src/main/java/info/bukova/isspst/ui/settings/NumberSeriesVM.java @@ -0,0 +1,55 @@ +package info.bukova.isspst.ui.settings; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.zkoss.bind.annotation.BindingParam; +import org.zkoss.bind.annotation.Command; +import org.zkoss.bind.annotation.Init; +import org.zkoss.zk.ui.select.annotation.WireVariable; +import org.zkoss.zul.Window; + +import info.bukova.isspst.Constants; +import info.bukova.isspst.Module; +import info.bukova.isspst.data.NumberSeries; +import info.bukova.isspst.services.numberseries.NumberSeriesService; + +public class NumberSeriesVM { + + @WireVariable + private NumberSeriesService numericSeriesService; + private List numberSeriesList; + private Map moduleMap; + + @Init + public void init() { + numberSeriesList = new ArrayList(numericSeriesService.getAll()); + moduleMap = new HashMap(); + for (Module m : Constants.MODULES) { + moduleMap.put(m.getId(), m); + } + } + + public List getNumberSeriesList() { + return numberSeriesList; + } + + public boolean isCanSave() { + return true; + } + + @Command + public void save(@BindingParam("window") Window window) { + for (NumberSeries ns : numberSeriesList) { + numericSeriesService.update(ns); + } + + window.detach(); + } + + public Map getModuleMap() { + return moduleMap; + } +} diff --git a/src/main/resources/hibernate.cfg.xml b/src/main/resources/hibernate.cfg.xml index 3471a052..115c5d51 100644 --- a/src/main/resources/hibernate.cfg.xml +++ b/src/main/resources/hibernate.cfg.xml @@ -20,5 +20,7 @@ + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/locales/columns.properties b/src/main/webapp/WEB-INF/locales/columns.properties index 0c067f53..e86db2e6 100644 --- a/src/main/webapp/WEB-INF/locales/columns.properties +++ b/src/main/webapp/WEB-INF/locales/columns.properties @@ -39,4 +39,7 @@ username=Uživatelské jméno #Skupiny centre=Středisko -members=Členové \ No newline at end of file +members=Členové + +#Materiál +munit=Měrná jednotka \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/locales/zk-label.properties b/src/main/webapp/WEB-INF/locales/zk-label.properties index 9bae6ea5..b68bf9f2 100644 --- a/src/main/webapp/WEB-INF/locales/zk-label.properties +++ b/src/main/webapp/WEB-INF/locales/zk-label.properties @@ -100,6 +100,9 @@ UsersGridColumnSureName=Příjmení AgendaMaterial=Materiál MaterialFormTitle=Materiál +AgendaServices=Služby +ServiceFormTitle=Služba + AgendaWorkgroups=Střediska / komise WorkgroupFormTitle=Pracvní skupina @@ -111,6 +114,22 @@ CentreRoles=Role středisek Workflow=Proces schválení WorkgroupWorkflow=Schválení v komisi CentreWorkflow=Schválení ve středisku +LimitFormTitle=Limit pro schválení +Limit=Limit: +OverLimit=Pouze nadlimitní + +NumberSeriesFormTitle=Číselné řady +Number=Číslo: +Prefix=Prefix: + +GlobalSettings=Globální nastavení +Requirements=Požadavky +EMails=E-maily +NewRequirement=Nový požadavek +AuthRequirement=Dílčí schválení +ConfirmRequirement=Schválení +InsertField=Vložit pole +EnableRequirements=Povolit zadávání požadavků CentresForRequirements=Střediska, pro která lze vkládat požadavky WorkgroupMembership=Členství v komisích @@ -138,6 +157,12 @@ ReportTitle=Nadpis sestavy: ReportOptions=Volby sestavy ReportNoOptions=Žádná nestavení +MailForm=Odeslání e-mailu +MailFor=Komu: +MailSubject=Předmět: +MailSend=Odeslat +MailAttachement=Příloha: + Error=Chyba ErrorRights=K vykobání této operace nemáte dostatečná oprávnění diff --git a/src/main/webapp/WEB-INF/mail.properties b/src/main/webapp/WEB-INF/mail.properties new file mode 100644 index 00000000..1dbc1730 --- /dev/null +++ b/src/main/webapp/WEB-INF/mail.properties @@ -0,0 +1,7 @@ +mail.from=kosef.rokos@gmail.com +mail.host=smtp.gmail.com +mail.port=587 +mail.useauth=true +mail.usessl=true +mail.username=josef.rokos@gmail.com +mail.password=XXXXXX \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/spring/mail-services.xml b/src/main/webapp/WEB-INF/spring/mail-services.xml new file mode 100644 index 00000000..eaf99436 --- /dev/null +++ b/src/main/webapp/WEB-INF/spring/mail-services.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + ${mail.useauth} + ${mail.usessl} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/webapp/WEB-INF/spring/root-context.xml b/src/main/webapp/WEB-INF/spring/root-context.xml index 7bf44b4d..7bff9f17 100644 --- a/src/main/webapp/WEB-INF/spring/root-context.xml +++ b/src/main/webapp/WEB-INF/spring/root-context.xml @@ -1,21 +1,32 @@ - + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd"> + + /WEB-INF/jdbc.properties /WEB-INF/ldap.properties + /WEB-INF/mail.properties @@ -75,6 +86,8 @@ + + @@ -140,6 +153,14 @@ + + + + + + + + @@ -192,7 +213,7 @@ - + @@ -217,4 +238,32 @@ + + + + + + + + + + + + + + + + element + + + + + + + + + + + + diff --git a/src/main/webapp/app/mailForm.zul b/src/main/webapp/app/mailForm.zul new file mode 100644 index 00000000..971c969f --- /dev/null +++ b/src/main/webapp/app/mailForm.zul @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + +