Nová agenda na definici středisek a pracovních skupin.

refs #97
multitenant
Josef Rokos 11 years ago
parent 607139d790
commit af1cf69958

@ -10,6 +10,7 @@ import info.bukova.isspst.services.munits.MUnitService;
import info.bukova.isspst.services.material.MaterialService; import info.bukova.isspst.services.material.MaterialService;
import info.bukova.isspst.services.users.RoleService; import info.bukova.isspst.services.users.RoleService;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
public class Constants { public class Constants {
@ -53,13 +54,15 @@ public class Constants {
public final static String MOD_BUILDINGS = "BUILDINGS"; public final static String MOD_BUILDINGS = "BUILDINGS";
public final static String MOD_MUNITS = "MUNITS"; public final static String MOD_MUNITS = "MUNITS";
public final static String MOD_MATERIAL = "MATERIAL"; public final static String MOD_MATERIAL = "MATERIAL";
public final static String MOD_WORKGROUPS = "WORKGROUPS";
public final static Module MODULES[] = { public final static Module MODULES[] = {
new Module(MOD_USERS, "Uživatelé", UserService.class) new Module(MOD_USERS, "Uživatelé", UserService.class),
, new Module(MOD_PERMISSIONS, "Práva", RoleService.class) new Module(MOD_PERMISSIONS, "Práva", RoleService.class),
, new Module(MOD_ADDRESSBOOK, "Dodavatelé", AdbService.class) new Module(MOD_ADDRESSBOOK, "Dodavatelé", AdbService.class),
, new Module(MOD_BUILDINGS, "Budovy", BuildingService.class) new Module(MOD_BUILDINGS, "Budovy", BuildingService.class),
, new Module(MOD_MUNITS, "Měrné jednotky", MUnitService.class) new Module(MOD_MUNITS, "Měrné jednotky", MUnitService.class),
, new Module(MOD_MATERIAL, "Materiál", MaterialService.class) new Module(MOD_MATERIAL, "Materiál", MaterialService.class),
new Module(MOD_WORKGROUPS, "Pracovní skupiny", WorkgroupService.class)
}; };
public final static String DYNAMIC_REPORT_NAME = "Tabulková sestava"; public final static String DYNAMIC_REPORT_NAME = "Tabulková sestava";

@ -0,0 +1,7 @@
package info.bukova.isspst.dao;
import info.bukova.isspst.data.Workgroup;
public interface WorkgroupDao extends BaseDao<Workgroup> {
}

@ -0,0 +1,13 @@
package info.bukova.isspst.dao.jpa;
import info.bukova.isspst.dao.WorkgroupDao;
import info.bukova.isspst.data.Workgroup;
public class WorkgroupDaoJPA extends BaseDaoJPA<Workgroup> implements WorkgroupDao {
@Override
public String getEntityName() {
return Workgroup.class.getSimpleName();
}
}

@ -0,0 +1,71 @@
package info.bukova.isspst.data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name = "JOBMAPPING")
public class JobMapping {
@Id
@Column(name = "ID")
@GeneratedValue
private int id;
@ManyToOne(fetch = FetchType.EAGER)
@JoinTable(name = "JOB_MEMBER", joinColumns = { @JoinColumn(name = "JOB_ID") }, inverseJoinColumns = { @JoinColumn(name = "MEMBER_ID") })
private Member member;
@ManyToOne(fetch = FetchType.EAGER)
@JoinTable(name = "JOB_ROLE", joinColumns = { @JoinColumn(name = "JOB_ID") }, inverseJoinColumns = { @JoinColumn(name = "ROLE_ID") })
private Role role;
public JobMapping() {
}
public JobMapping(Member member, Role role) {
this.member = member;
this.role = role;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Member getMember() {
return member;
}
public void setMember(Member member) {
this.member = member;
}
public Role getRole() {
return role;
}
public void setRole(Role role) {
this.role = role;
}
@Override
public boolean equals(Object o) {
if (o instanceof JobMapping
&& ((JobMapping)o).getMember().equals(this.getMember())
&& ((JobMapping)o).getRole().equals(this.getRole())) {
return true;
}
return false;
}
}

@ -0,0 +1,63 @@
package info.bukova.isspst.data;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Transient;
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class Member implements DataModel {
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
private int id;
@Column(name = "CREATED")
private Date created;
@Column(name = "MODIFIED")
private Date modified;
@Transient
private boolean valid;
public abstract String getFullName();
public abstract boolean isHasJob();
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getModified() {
return modified;
}
public void setModified(Date modified) {
this.modified = modified;
}
public boolean isValid() {
return valid;
}
public void setValid(boolean valid) {
this.valid = valid;
}
}

@ -2,6 +2,8 @@ package info.bukova.isspst.data;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table; import javax.persistence.Table;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
@ -21,15 +23,33 @@ public class Permission extends BaseSimpleData implements GrantedAuthority {
private String description; private String description;
@Column(name="MODULE") @Column(name="MODULE")
private String module; private String module;
@Column(name = "TYPE")
@Enumerated(EnumType.ORDINAL)
private PermissionType type;
public Permission(String authority, String description) { public Permission(String authority, String description) {
this();
this.authority = authority; this.authority = authority;
this.description = description; this.description = description;
this.module = ""; this.module = "";
} }
public Permission() { public Permission(String authority, String description, String module) {
this(authority, description);
this.module = module;
}
public Permission(String authority, String description, PermissionType type) {
this(authority, description, "", type);
}
public Permission(String authority, String description, String module, PermissionType type) {
this(authority, description, module);
this.type = type;
}
public Permission() {
type = PermissionType.GLOBAL;
} }
@Override @Override

@ -0,0 +1,9 @@
package info.bukova.isspst.data;
public enum PermissionType {
GLOBAL,
WORKGROUP,
CENTRE
}

@ -31,15 +31,21 @@ public class Role extends BaseSimpleData implements GrantedAuthority, DataModel
@LazyCollection(LazyCollectionOption.FALSE) @LazyCollection(LazyCollectionOption.FALSE)
@JoinTable(name="ROLE_PERMISSION", joinColumns={@JoinColumn(name="ROLE_ID")}, inverseJoinColumns={@JoinColumn(name="PERMISSION_ID")}) @JoinTable(name="ROLE_PERMISSION", joinColumns={@JoinColumn(name="ROLE_ID")}, inverseJoinColumns={@JoinColumn(name="PERMISSION_ID")})
private List<Permission> permissions; private List<Permission> permissions;
@Column(name = "WORKGROUP")
private boolean workgroup;
@Column(name = "CENTRE")
private boolean centre;
public Role(String authority, String description) { public Role(String authority, String description) {
this();
this.authority = authority; this.authority = authority;
this.description = description; this.description = description;
this.permissions = new ArrayList<Permission>();
} }
public Role() { public Role() {
this.permissions = new ArrayList<Permission>(); this.permissions = new ArrayList<Permission>();
centre = false;
workgroup = false;
} }
@Override @Override
@ -80,4 +86,20 @@ public class Role extends BaseSimpleData implements GrantedAuthority, DataModel
} }
} }
public boolean isWorkgroup() {
return workgroup;
}
public void setWorkgroup(boolean workgroup) {
this.workgroup = workgroup;
}
public boolean isCentre() {
return centre;
}
public void setCentre(boolean centre) {
this.centre = centre;
}
} }

@ -15,7 +15,7 @@ import org.springframework.security.core.userdetails.UserDetails;
@Entity @Entity
@Table(name="USER") @Table(name="USER")
public class User extends BaseSimpleData implements UserDetails, DataModel { public class User extends Member implements UserDetails, DataModel {
/** /**
* *
@ -129,10 +129,12 @@ public class User extends BaseSimpleData implements UserDetails, DataModel {
public String getFullName() { public String getFullName() {
String ret = ""; String ret = "";
if (firstName != null && !firstName.isEmpty()) { if (lastName != null && !lastName.isEmpty()) {
ret = firstName + " "; ret = lastName + " ";
} }
return ret + lastName == null ? "" : lastName; ret = ret + (firstName == null ? "" : firstName);
return ret;
} }
public String getFirstName() { public String getFirstName() {
@ -175,4 +177,23 @@ public class User extends BaseSimpleData implements UserDetails, DataModel {
this.notify = notify; this.notify = notify;
} }
@Override
public boolean equals(Object o) {
if ((o instanceof User) && (((User)o).getId() == this.getId())) {
return true;
} else {
return false;
}
}
@Override
public String toString() {
return getFullName();
}
@Override
public boolean isHasJob() {
return true;
}
} }

@ -0,0 +1,125 @@
package info.bukova.isspst.data;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;
@Entity
@Table(name = "WORKGROUP")
public class Workgroup extends Member implements OwnedDataModel {
@Column(name = "CODE")
private String code;
@Column(name = "NAME")
private String name;
@ManyToMany(cascade = {CascadeType.ALL})
@LazyCollection(LazyCollectionOption.FALSE)
@JoinTable(name="WORKGROUP_MEMBER", joinColumns={@JoinColumn(name="WORKGROUP_ID")}, inverseJoinColumns={@JoinColumn(name="JOBMAPPING_ID")})
private List<JobMapping> members;
@Column(name = "CENTRE")
private boolean centre;
//BaseData
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="OWNED_BY_ID")
private User ownedBy;
@ManyToOne(fetch=FetchType.EAGER)
@JoinColumn(name="MODIFIED_BY_ID")
private User modifiedBy;
public Workgroup() {
members = new ArrayList<JobMapping>();
centre = false;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isCentre() {
return centre;
}
public void setCentre(boolean centre) {
this.centre = centre;
}
@Override
public void setOwnedBy(User user) {
this.ownedBy = user;
}
@Override
public User getOwnedBy() {
return ownedBy;
}
@Override
public void setModifiedBy(User user) {
this.modifiedBy = user;
}
@Override
public User getModifiedBy() {
return modifiedBy;
}
@Override
public String getFullName() {
return name;
}
@Override
public boolean isHasJob() {
return false;
}
public List<JobMapping> getMembers() {
return members;
}
public void setMembers(List<JobMapping> members) {
this.members = members;
}
public void removeMember(JobMapping mapping) {
members.remove(mapping);
}
public void removeMember(Member member, Role role) {
JobMapping mapping = new JobMapping(member, role);
members.remove(mapping);
}
public boolean equals(Object o) {
if (o instanceof Workgroup && ((Workgroup)o).getId() == this.getId()) {
return true;
}
return false;
}
}

@ -1,10 +1,14 @@
package info.bukova.isspst.services.users; package info.bukova.isspst.services.users;
import java.util.List;
import info.bukova.isspst.data.Role; import info.bukova.isspst.data.Role;
import info.bukova.isspst.services.Service; import info.bukova.isspst.services.Service;
public interface RoleService extends Service<Role> { public interface RoleService extends Service<Role> {
public Role getRoleByAuthority(String authority); public Role getRoleByAuthority(String authority);
public List<Role> getWorkgroupRoles();
public List<Role> getCentreRoles();
} }

@ -1,5 +1,7 @@
package info.bukova.isspst.services.users; package info.bukova.isspst.services.users;
import java.util.List;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import info.bukova.isspst.data.Role; import info.bukova.isspst.data.Role;
@ -13,4 +15,16 @@ public class RoleServiceImpl extends AbstractService<Role> implements RoleServic
return this.selectSingle("from Role where authority = '" + authority + "'"); return this.selectSingle("from Role where authority = '" + authority + "'");
} }
@Override
@Transactional
public List<Role> getWorkgroupRoles() {
return this.execQuery("from Role where workgroup = true");
}
@Override
@Transactional
public List<Role> getCentreRoles() {
return this.execQuery("from Role where centre = true");
}
} }

@ -0,0 +1,20 @@
package info.bukova.isspst.services.workgroups;
import info.bukova.isspst.services.IsspstException;
public class WorkgroupException extends IsspstException {
/**
*
*/
private static final long serialVersionUID = -1729975111741519801L;
public final static String NO_WORGROUP = "WorkgroupNotAllowed";
public final static String MSUT_HAS_CENTER = "RoleMustHasCentre";
public final static String MUST_HAS_WORKGROUP = "WorkgroupMustHasCentre";
public WorkgroupException(String message) {
super(message);
}
}

@ -0,0 +1,17 @@
package info.bukova.isspst.services.workgroups;
import java.util.List;
import info.bukova.isspst.data.Member;
import info.bukova.isspst.data.Role;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.services.Service;
public interface WorkgroupService extends Service<Workgroup> {
public void addMember(Workgroup workgroup, Member member, Role role);
public List<Workgroup> getWorkgroups();
public List<Workgroup> getCentres();
public boolean isMember(Workgroup workgroup, Member member);
}

@ -0,0 +1,57 @@
package info.bukova.isspst.services.workgroups;
import java.util.List;
import org.springframework.transaction.annotation.Transactional;
import info.bukova.isspst.Constants;
import info.bukova.isspst.data.JobMapping;
import info.bukova.isspst.data.Member;
import info.bukova.isspst.data.Role;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.services.AbstractOwnedService;
public class WorkgroupServiceImpl extends AbstractOwnedService<Workgroup> implements WorkgroupService {
@Override
public void addMember(Workgroup workgroup, Member member, Role role) {
if (!member.isHasJob() && !role.getAuthority().equals(Constants.ROLE_USER)) {
throw new WorkgroupException(WorkgroupException.NO_WORGROUP);
}
if (workgroup.isCentre() && !role.isCentre()) {
throw new WorkgroupException(WorkgroupException.MSUT_HAS_CENTER);
}
if (!workgroup.isCentre() && !role.isWorkgroup()) {
throw new WorkgroupException(WorkgroupException.MUST_HAS_WORKGROUP);
}
JobMapping mapping = new JobMapping(member, role);
if (!workgroup.getMembers().contains(mapping)) {
workgroup.getMembers().add(mapping);
}
}
@Override
@Transactional
public List<Workgroup> getWorkgroups() {
return this.execQuery("from Workgroup where centre = false");
}
@Override
@Transactional
public List<Workgroup> getCentres() {
return this.execQuery("from Workgroup where centre = true");
}
@Override
public boolean isMember(Workgroup workgroup, Member member) {
for (JobMapping jm : workgroup.getMembers()) {
if (jm.getMember().equals(member)) {
return true;
}
}
return false;
}
}

@ -0,0 +1,145 @@
package info.bukova.isspst.ui.workgroups;
import info.bukova.isspst.data.JobMapping;
import info.bukova.isspst.data.Member;
import info.bukova.isspst.data.Role;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.services.users.RoleService;
import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.FormViewModel;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
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.event.DropEvent;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Listitem;
public class WorkgroupForm extends FormViewModel<Workgroup> {
@WireVariable
private UserService userService;
@WireVariable
private RoleService roleService;
@WireVariable
private WorkgroupService workgroupService;
private List<Member> users;
@Init(superclass = true)
public void init() {
users = new ArrayList<Member>();
users.addAll(userService.getAll());
List<Workgroup> wg = workgroupService.getWorkgroups();
for (Workgroup w : wg) {
if (!workgroupService.isMember(getDataBean(), w)) {
users.add(w);
}
}
}
public List<Member> getUsers() {
return users;
}
public List<Role> getWorkgroupRoles() {
if (getDataBean().isCentre()) {
return roleService.getCentreRoles();
} else {
return roleService.getWorkgroupRoles();
}
}
@NotifyChange({"workgroupRoles", "centre"})
public void setCentre(boolean centre) {
getDataBean().setCentre(centre);
}
public boolean getCentre() {
return getDataBean().isCentre();
}
@Command
@NotifyChange({"users", "dataBean"})
public void addMember(@BindingParam("event") DropEvent event) {
Set<Listitem> selected = ((Listitem)event.getDragged()).getListbox().getSelectedItems();
if (selected.isEmpty()) {
try {
Member u = ((Listitem)event.getDragged()).getValue();
moveUser(u, event);
} catch(ClassCastException e) {
JobMapping u = ((Listitem)event.getDragged()).getValue();
moveUser(u, event);
}
return;
}
for (Listitem li : selected) {
try {
Member u = li.getValue();
moveUser(u, event);
} catch (ClassCastException e) {
JobMapping u = li.getValue();
moveUser(u, event);
}
}
}
private void moveUser(JobMapping u, DropEvent event) {
String source = getSource(event);
String target = getTarget(event);
if (source.equals(target)) {
return;
}
getDataBean().removeMember(u);
if (!target.equals("users")) {
moveUser(u.getMember(), event);
} else if (!u.getMember().isHasJob()) {
users.add(u.getMember());
}
}
private void moveUser(Member u, DropEvent event) {
String source = getSource(event);
String target = getTarget(event);
if (source.equals(target)) {
return;
}
workgroupService.addMember(getDataBean(), u, roleService.getRoleByAuthority(target));
if (!u.isHasJob()) {
users.remove(u);
}
}
private String getSource(DropEvent event) {
return ((Listitem)event.getDragged()).getListbox().getId();
}
private String getTarget(DropEvent event) {
String target;
if (event.getTarget() instanceof Listitem) {
target = ((Listitem)event.getTarget()).getListbox().getId();
} else {
target = event.getTarget().getId();
}
return target;
}
}

@ -0,0 +1,22 @@
package info.bukova.isspst.ui.workgroups;
import org.zkoss.bind.annotation.Init;
import org.zkoss.zk.ui.select.annotation.WireVariable;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.ListViewModel;
public class WorkgroupList extends ListViewModel<Workgroup> {
@WireVariable
private WorkgroupService workgroupService;
@Init
public void init() {
service = workgroupService;
dataClass = Workgroup.class;
formZul = "workgroupForm.zul";
}
}

@ -13,6 +13,9 @@
<mapping class="info.bukova.isspst.data.Building"></mapping> <mapping class="info.bukova.isspst.data.Building"></mapping>
<mapping class="info.bukova.isspst.data.MUnit"></mapping> <mapping class="info.bukova.isspst.data.MUnit"></mapping>
<mapping class="info.bukova.isspst.data.Material"></mapping> <mapping class="info.bukova.isspst.data.Material"></mapping>
<mapping class="info.bukova.isspst.data.Workgroup"></mapping>
<mapping class="info.bukova.isspst.data.Member"></mapping>
<mapping class="info.bukova.isspst.data.JobMapping"></mapping>
</session-factory> </session-factory>
</hibernate-configuration> </hibernate-configuration>

@ -72,6 +72,9 @@ UsersGridColumnSureName=Příjmení
AgendaMaterial=Materiál AgendaMaterial=Materiál
MaterialFormTitle=Materiál MaterialFormTitle=Materiál
AgendaWorkgroups=Pracovní skupiny
WorkgroupFormTitle=Pracvní skupina
ButtonStorno=Storno ButtonStorno=Storno
ButtonSave=Uložit ButtonSave=Uložit

@ -124,6 +124,10 @@
<property name="sessionFactory" ref="sessionFactory"/> <property name="sessionFactory" ref="sessionFactory"/>
</bean> </bean>
<bean id="commissionDao" class="info.bukova.isspst.dao.jpa.WorkgroupDaoJPA">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!-- Business logic --> <!-- Business logic -->
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/> <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
@ -181,4 +185,9 @@
<property name="validator" ref="validator"/> <property name="validator" ref="validator"/>
</bean> </bean>
<bean id="workgroupService" class="info.bukova.isspst.services.workgroups.WorkgroupServiceImpl">
<property name="dao" ref="commissionDao"/>
<property name="validator" ref="validator"/>
</bean>
</beans> </beans>

@ -4,6 +4,10 @@
viewModel="@id('vm') @init('info.bukova.isspst.ui.users.PermissionForm')"> viewModel="@id('vm') @init('info.bukova.isspst.ui.users.PermissionForm')">
<caption zclass="form-caption" label="${labels.AgendaRights}" /> <caption zclass="form-caption" label="${labels.AgendaRights}" />
<label value="@load(vm.dataBean.description)" style="font-weight: bold;"/> <label value="@load(vm.dataBean.description)" style="font-weight: bold;"/>
<hbox>
<checkbox label="Práva pracovních skupin" checked="@bind(vm.dataBean.workgroup)"/>
<checkbox label="Práva středisek" checked="@bind(vm.dataBean.centre)"/>
</hbox>
<vbox children="@load(vm.modules)" width="530px"> <vbox children="@load(vm.modules)" width="530px">
<template name="children" var="module"> <template name="children" var="module">

@ -34,6 +34,7 @@
<menuitem label="${labels.AgendaBuildings}" href="/buildings" disabled="${not sec:isAllGranted('PERM_READ_BUILDINGS')}" /> <menuitem label="${labels.AgendaBuildings}" href="/buildings" disabled="${not sec:isAllGranted('PERM_READ_BUILDINGS')}" />
<menuitem label="Místnosti" href="/admin/users"/> <menuitem label="Místnosti" href="/admin/users"/>
<menuitem label="${labels.AgendaMaterial}" href="/material" disabled="${not sec:isAllGranted('PERM_READ_MATERIAL')}"/> <menuitem label="${labels.AgendaMaterial}" href="/material" disabled="${not sec:isAllGranted('PERM_READ_MATERIAL')}"/>
<menuitem label="${labels.AgendaWorkgroups}" href="/workgroups" disabled="${not sec:isAllGranted('PERM_READ_WORKGROUPS')}"/>
<menuitem label="Dodavatelé" href="/admin/addressbook" disabled="${not sec:isAllGranted('PERM_READ_ADDRESSBOOK')}"/> <menuitem label="Dodavatelé" href="/admin/addressbook" disabled="${not sec:isAllGranted('PERM_READ_ADDRESSBOOK')}"/>
</menubar> </menubar>
</tabpanel> </tabpanel>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

@ -0,0 +1,10 @@
<?page title="${labels.AgendaCommissions}" contentType="text/html;charset=UTF-8"?>
<zk>
<zscript>
String gridZul = "workgroups.zul";
</zscript>
<include src="/app/template.zhtml"/>
</zk>

@ -0,0 +1,67 @@
<?page title="${labels.WorkgroupFormTitle}" contentType="text/html;charset=UTF-8"?>
<zk>
<window id="editWin" closable="true" border="normal" position="center" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.workgroups.WorkgroupForm')">
<caption src="/img/commission.png" zclass="form-caption" label="${labels.WorkgroupFormTitle}" />
<vlayout>
<grid hflex="min">
<columns>
<column align="right" hflex="min" />
<column />
</columns>
<rows>
<row>
<cell sclass="row-title">${labels.code} :</cell>
<cell>
<textbox id="code" constraint="@load(vm.constriant)" width="200px" value="@bind(vm.dataBean.code)" />
</cell>
</row>
<row>
<cell sclass="row-title">${labels.name} :</cell>
<cell>
<textbox id="name" width="200px" value="@bind(vm.dataBean.name)" />
</cell>
</row>
<row>
<cell>
<checkbox label="Středisko" checked="@bind(vm.centre)"/>
</cell>
</row>
</rows>
</grid>
<label value="Přetáhněte myší:"/>
<hlayout>
<listbox id="users" model="@bind(vm.users)" height="280px" width="200px" multiple="true"
droppable="true" onDrop="@command('addMember', event=event)">
<listhead>
<listheader label="Uživatelé" sort="czech(fullName)"/>
</listhead>
<template name="model">
<listitem image="@load(each.hasJob ? '/img/user-small.png' : '/img/commission-small.png')" label="@load(each.fullName)" draggable="user" droppable="user"
onDrop="@command('addMember', event=event)" attributes.item="@load(each)"/>
</template>
</listbox>
<vlayout children="@load(vm.workgroupRoles)">
<template name="children">
<listbox id="@load(each.authority)" model="@bind(vm.dataBean.members)" height="120px" width="200px" multiple="true"
droppable="true" onDrop="@command('addMember', event=event)">
<listhead>
<listheader label="@load(each.description)" sort="czech(fullName)"/>
</listhead>
<template name="model" var="member">
<listitem image="@load(member.member.hasJob ? '/img/user-small.png' : '/img/commission-small.png')" label="@load(member.member.fullName)" draggable="user" droppable="user"
onDrop="@command('addMember', event=event)" attributes.item="@load(member)" visible="@load(member.role.authority eq each.authority)"/>
</template>
</listbox>
</template>
</vlayout>
</hlayout>
<include src="/app/formButtons.zul" />
</vlayout>
</window>
</zk>

@ -0,0 +1,94 @@
<?page title="${labels.AgendaWorkgroups}" contentType="text/html;charset=UTF-8"?>
<zk>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<window border="normal" apply="org.zkoss.bind.BindComposer"
viewModel="@id('vm') @init('info.bukova.isspst.ui.workgroups.WorkgroupList')">
<caption zclass="form-caption" label="${labels.AgendaWorkgroups}" />
<include src="/app/toolbar.zul" />
<hbox width="100%" height="500px">
<listbox model="@load(vm.dataList)" selectedItem="@bind(vm.dataBean)" width="680px" height="480px">
<listhead menupopup="auto">
<listheader label="${labels.code}" sort="czech(code)" width="10%" />
<listheader label="${labels.name}" sort="czech(name)" width="30%" />
</listhead>
<!--
<auxhead sclass="category-center" visible="@load(vm.filter)">
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox value="@bind(vm.filterTemplate.code)" instant="true" onChange="@command('doFilter')" sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox value="@bind(vm.filterTemplate.name)" instant="true" onChange="@command('doFilter')" sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
<auxheader>
<div sclass="find-grid-cell">
<div sclass="find-grid-divtextbox">
<textbox value="@bind(vm.filterTemplate.description)" instant="true" onChange="@command('doFilter')" sclass="find-grid-textbox" />
</div>
<div sclass="find-grid-img">
<image src="/img/funnel.png" />
</div>
</div>
</auxheader>
</auxhead>
-->
<template name="model">
<listitem>
<listcell label="@load(each.code)" />
<listcell label="@load(each.name)" />
</listitem>
</template>
</listbox>
<!-- <panel hflex="1" width="70%" height="480px">
<panelchildren>
<grid model="@load(vm.dataBean.approvers)" height="90px">
<columns>
<column label="Vedoucí" sort="auto(fullName)"/>
</columns>
<rows>
<template name="model">
<row>
<cell>
<image src="/img/user-small-red.png"/><label value="@load(each.fullName)"/>
</cell>
</row>
</template>
</rows>
</grid>
<grid model="@load(vm.dataBean.members)" height="290px">
<columns>
<column label="Členové" sort="auto(fullName)"/>
</columns>
<rows>
<template name="model">
<row>
<cell>
<image src="/img/user-small.png"/><label value="@load(each.fullName)"/>
</cell>
</row>
</template>
</rows>
</grid>
</panelchildren>
</panel> -->
</hbox>
</window>
</zk>
Loading…
Cancel
Save