Neaktivní uživatelé se nenabízí v seznamech pro výběr uživatele (spolucestující...). V agendě Uživatelé a Střediska/komise jsou barevně odlišeni.

closes #239
Verze_3.0
Josef Rokos 9 years ago
parent 1230959854
commit 84154ccbff

@ -234,7 +234,7 @@ public class UserServiceImpl extends AbstractService<User> implements UserServic
@Override @Override
@Transactional @Transactional
public List<User> getUsersForCombo() { public List<User> getUsersForCombo() {
Query q = dao.getQuery("from User u order by u.lastName"); Query q = dao.getQuery("from User u where u.enabled = true order by u.lastName");
return q.list(); return q.list();
} }

@ -1,9 +1,5 @@
package info.bukova.isspst.ui.mail; package info.bukova.isspst.ui.mail;
import static ch.lambdaj.Lambda.filter;
import static ch.lambdaj.Lambda.having;
import static ch.lambdaj.Lambda.on;
import static org.hamcrest.Matchers.startsWith;
import info.bukova.isspst.data.Address; import info.bukova.isspst.data.Address;
import info.bukova.isspst.data.Member; import info.bukova.isspst.data.Member;
import info.bukova.isspst.data.User; import info.bukova.isspst.data.User;
@ -15,10 +11,6 @@ import info.bukova.isspst.reporting.ReportDefinition;
import info.bukova.isspst.services.addressbook.AdbService; import info.bukova.isspst.services.addressbook.AdbService;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.ui.DocumentViewModel; import info.bukova.isspst.ui.DocumentViewModel;
import java.util.ArrayList;
import java.util.List;
import org.springframework.security.access.AccessDeniedException; import org.springframework.security.access.AccessDeniedException;
import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
@ -28,6 +20,14 @@ import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
import java.util.ArrayList;
import java.util.List;
import static ch.lambdaj.Lambda.filter;
import static ch.lambdaj.Lambda.having;
import static ch.lambdaj.Lambda.on;
import static org.hamcrest.Matchers.startsWith;
public class MailForm extends DocumentViewModel public class MailForm extends DocumentViewModel
{ {
@ -69,7 +69,7 @@ public class MailForm extends DocumentViewModel
addressbook = new ArrayList<Address>(); addressbook = new ArrayList<Address>();
} }
users = userService.getAll(); users = userService.getUsersForCombo();
selectedAddresses = new ArrayList<Address>(); selectedAddresses = new ArrayList<Address>();
selectedUsers = new ArrayList<User>(); selectedUsers = new ArrayList<User>();

@ -0,0 +1,22 @@
package info.bukova.isspst.ui.renderers;
import info.bukova.isspst.data.JobMapping;
import info.bukova.isspst.data.User;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem;
/**
* @author Pepa Rokos
*/
public class JobMappingItemRenderer extends GenericListitemRenderer<JobMapping> {
@Override
protected void changeProperties(Listbox lb, Listitem li, int index, String varnm) {
JobMapping jm = getObjectOfStates();
if (jm.getMember() instanceof User && !((User)jm.getMember()).isEnabled()) {
li.setSclass("user-disabled");
}
}
}

@ -0,0 +1,20 @@
package info.bukova.isspst.ui.renderers;
import info.bukova.isspst.data.User;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem;
/**
* @author Pepa Rokos
*/
public class UserItemRenderer extends GenericListitemRenderer<User> {
@Override
protected void changeProperties(Listbox lb, Listitem li, int index, String varnm) {
User u = getObjectOfStates();
if (!u.isEnabled()) {
li.setSclass("user-disabled");
}
}
}

@ -9,19 +9,20 @@ import info.bukova.isspst.data.User;
import info.bukova.isspst.filters.UserFilter; import info.bukova.isspst.filters.UserFilter;
import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.users.UserService;
import info.bukova.isspst.ui.ListViewModel; import info.bukova.isspst.ui.ListViewModel;
import info.bukova.isspst.ui.renderers.UserItemRenderer;
import java.util.ArrayList;
import java.util.List;
import org.zkoss.bind.annotation.GlobalCommand; import org.zkoss.bind.annotation.GlobalCommand;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
import org.zkoss.bind.annotation.NotifyChange; import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zk.ui.select.annotation.WireVariable; import org.zkoss.zk.ui.select.annotation.WireVariable;
import java.util.ArrayList;
import java.util.List;
public class UsersList extends ListViewModel<User> { public class UsersList extends ListViewModel<User> {
@WireVariable @WireVariable
private UserService userService; private UserService userService;
private UserItemRenderer itemRenderer;
@Init @Init
public void init() { public void init() {
@ -29,6 +30,7 @@ public class UsersList extends ListViewModel<User> {
dataClass = User.class; dataClass = User.class;
formZul = "userForm.zul"; formZul = "userForm.zul";
dataFilter = new UserFilter(getFilterTemplate()); dataFilter = new UserFilter(getFilterTemplate());
itemRenderer = new UserItemRenderer();
} }
public List<Module> getModules() { public List<Module> getModules() {
@ -88,5 +90,7 @@ public class UsersList extends ListViewModel<User> {
return true; return true;
} }
public UserItemRenderer getItemRenderer() {
return itemRenderer;
}
} }

@ -13,11 +13,8 @@ import info.bukova.isspst.services.workgroups.WorkgroupException;
import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.services.workgroups.WorkgroupService;
import info.bukova.isspst.ui.BigDecimalConverter; import info.bukova.isspst.ui.BigDecimalConverter;
import info.bukova.isspst.ui.FormViewModel; import info.bukova.isspst.ui.FormViewModel;
import info.bukova.isspst.ui.renderers.JobMappingItemRenderer;
import java.util.ArrayList; import info.bukova.isspst.ui.renderers.UserItemRenderer;
import java.util.List;
import java.util.Set;
import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.BindingParam;
import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.Init;
@ -27,8 +24,14 @@ import org.zkoss.zk.ui.select.annotation.WireVariable;
import org.zkoss.zul.Listitem; import org.zkoss.zul.Listitem;
import org.zkoss.zul.Messagebox; import org.zkoss.zul.Messagebox;
import static ch.lambdaj.Lambda.*; import java.util.ArrayList;
import static org.hamcrest.Matchers.*; import java.util.List;
import java.util.Set;
import static ch.lambdaj.Lambda.filter;
import static ch.lambdaj.Lambda.having;
import static ch.lambdaj.Lambda.on;
import static org.hamcrest.Matchers.startsWith;
public class WorkgroupForm extends FormViewModel<Workgroup> { public class WorkgroupForm extends FormViewModel<Workgroup> {
@ -42,6 +45,8 @@ public class WorkgroupForm extends FormViewModel<Workgroup> {
private String findUser; private String findUser;
private List<Member> selectedUsers; private List<Member> selectedUsers;
private BigDecimalConverter bdConverter; private BigDecimalConverter bdConverter;
private JobMappingItemRenderer itemRenderer;
private UserItemRenderer userItemRenderer;
@Init(superclass = true) @Init(superclass = true)
public void init() { public void init() {
@ -49,6 +54,8 @@ public class WorkgroupForm extends FormViewModel<Workgroup> {
users.addAll(userService.getAll()); users.addAll(userService.getAll());
selectedUsers = new ArrayList<Member>(); selectedUsers = new ArrayList<Member>();
bdConverter = new BigDecimalConverter(); bdConverter = new BigDecimalConverter();
itemRenderer = new JobMappingItemRenderer();
userItemRenderer = new UserItemRenderer();
} }
public List<Member> getUsers() { public List<Member> getUsers() {
@ -238,5 +245,12 @@ public class WorkgroupForm extends FormViewModel<Workgroup> {
public BigDecimalConverter getBdConverter() { public BigDecimalConverter getBdConverter() {
return bdConverter; return bdConverter;
} }
public JobMappingItemRenderer getItemRenderer() {
return itemRenderer;
}
public UserItemRenderer getUserItemRenderer() {
return userItemRenderer;
}
} }

@ -10,7 +10,8 @@
<hbox width="100%" vflex="1"> <hbox width="100%" vflex="1">
<listbox model="@load(vm.dataList)" <listbox model="@load(vm.dataList)"
selectedItem="@bind(vm.dataBean)" selectedItem="@bind(vm.dataBean)"
itemRenderer="@load(vm.itemRenderer)"
width="650px" width="650px"
vflex="1"> vflex="1">
<listhead menupopup="auto"> <listhead menupopup="auto">

@ -59,7 +59,8 @@
maxlength="@load(vm.lengthText)" maxlength="@load(vm.lengthText)"
width="300px" /> width="300px" />
<listbox id="users" model="@bind(vm.users)" height="380px" width="300px" multiple="true" <listbox id="users" model="@bind(vm.users)" height="380px" width="300px" multiple="true"
droppable="true" onDrop="@command('addMember', event=event)" selectedItems="@bind(vm.selectedUsers)"> droppable="true" onDrop="@command('addMember', event=event)" selectedItems="@bind(vm.selectedUsers)"
itemRenderer="@load(vm.userItemRenderer)">
<listhead> <listhead>
<listheader label="Uživatelé" sort="czech(fullName)"/> <listheader label="Uživatelé" sort="czech(fullName)"/>
</listhead> </listhead>
@ -82,6 +83,7 @@
<listbox id="@load(each.authority)" <listbox id="@load(each.authority)"
model="@bind(vm.dataBean.members)" height="200px" width="290px" model="@bind(vm.dataBean.members)" height="200px" width="290px"
multiple="true" droppable="true" multiple="true" droppable="true"
itemRenderer="@load(vm.itemRenderer)"
onDrop="@command('addMember', event=event)"> onDrop="@command('addMember', event=event)">
<!-- <listhead> <!-- <listhead>
<listheader label="@load(each.description)" sort="czech(fullName)"/> <listheader label="@load(each.description)" sort="czech(fullName)"/>

@ -89,3 +89,7 @@
.req-select-approved-project { .req-select-approved-project {
background-color: #87cefa !important; background-color: #87cefa !important;
} }
.user-disabled {
background-color: #fff2dd !important;
}

Loading…
Cancel
Save