Přidána podpora pro výběr záznamu v gridu přes ID předané jako parametr
"select" v URL.
This commit is contained in:
@@ -22,8 +22,9 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
|
||||
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
|
||||
|
||||
public class LoginSuccessHandler implements AuthenticationSuccessHandler {
|
||||
public class LoginSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler implements AuthenticationSuccessHandler {
|
||||
|
||||
@Autowired
|
||||
private SessionData sessionData;
|
||||
@@ -61,7 +62,7 @@ public class LoginSuccessHandler implements AuthenticationSuccessHandler {
|
||||
userService.update(u);
|
||||
}
|
||||
|
||||
response.sendRedirect("app/");
|
||||
super.onAuthenticationSuccess(request, response, auth);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.zkoss.bind.BindUtils;
|
||||
@@ -44,7 +46,7 @@ public class ListViewModel<T extends DataModel> {
|
||||
protected Class<T> dataClass;
|
||||
protected String formZul;
|
||||
protected Filter<T> dataFilter;
|
||||
|
||||
|
||||
public List<T> getDataList() {
|
||||
if (dataList == null) {
|
||||
dataList = new ArrayList<T>();
|
||||
@@ -266,10 +268,36 @@ public class ListViewModel<T extends DataModel> {
|
||||
newRec = false;
|
||||
}
|
||||
|
||||
Map<String, String[]> map = Executions.getCurrent().getParameterMap();
|
||||
int id = -1;
|
||||
|
||||
try {
|
||||
if (map.get("select") != null) {
|
||||
id = Integer.parseInt(map.get("select")[0]);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
logger.warn("ID is not number: " + map.get("select")[0]);
|
||||
}
|
||||
|
||||
if (id > 0) {
|
||||
for (int i = 0; i < dataList.size(); i++) {
|
||||
if (dataList.get(i).getId() == id) {
|
||||
selIndex = i;
|
||||
beforeSelectViaUrl();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selIndex > -1) {
|
||||
this.setDataBean(dataList.get(selIndex));
|
||||
}
|
||||
}
|
||||
|
||||
protected void beforeSelectViaUrl() {
|
||||
|
||||
}
|
||||
|
||||
@Command
|
||||
@NotifyChange("dataBean")
|
||||
|
||||
@@ -9,6 +9,10 @@ public class TabPanelsVM
|
||||
private boolean showCentre;
|
||||
private boolean showWorkgroup;
|
||||
private boolean showAll;
|
||||
private boolean selectMy;
|
||||
private boolean selectCentre;
|
||||
private boolean selectWorkgroup;
|
||||
private boolean selectAll;
|
||||
|
||||
@Init
|
||||
public void init()
|
||||
@@ -16,8 +20,13 @@ public class TabPanelsVM
|
||||
showCentre = true;
|
||||
showWorkgroup = true;
|
||||
showAll = true;
|
||||
|
||||
selectMy = true;
|
||||
selectCentre = false;
|
||||
selectWorkgroup = false;
|
||||
selectAll = false;
|
||||
}
|
||||
|
||||
|
||||
@GlobalCommand
|
||||
@NotifyChange("showCentre")
|
||||
public void disableCentre()
|
||||
@@ -38,6 +47,27 @@ public class TabPanelsVM
|
||||
{
|
||||
showAll = false;
|
||||
}
|
||||
|
||||
@GlobalCommand
|
||||
@NotifyChange("selectCentre")
|
||||
public void selectCentre() {
|
||||
selectMy = false;
|
||||
selectCentre = true;
|
||||
}
|
||||
|
||||
@GlobalCommand
|
||||
@NotifyChange("selectWorkgroup")
|
||||
public void selectWorkgroup() {
|
||||
selectMy = false;
|
||||
selectWorkgroup = true;
|
||||
}
|
||||
|
||||
@GlobalCommand
|
||||
@NotifyChange("selectAll")
|
||||
public void selectAll() {
|
||||
selectMy = false;
|
||||
selectAll = true;
|
||||
}
|
||||
|
||||
public boolean isShowCentre()
|
||||
{
|
||||
@@ -53,4 +83,21 @@ public class TabPanelsVM
|
||||
{
|
||||
return showAll;
|
||||
}
|
||||
|
||||
public boolean isSelectMy() {
|
||||
return selectMy;
|
||||
}
|
||||
|
||||
public boolean isSelectCentre() {
|
||||
return selectCentre;
|
||||
}
|
||||
|
||||
public boolean isSelectWorkgroup() {
|
||||
return selectWorkgroup;
|
||||
}
|
||||
|
||||
public boolean isSelectAll() {
|
||||
return selectAll;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -64,4 +64,9 @@ public class ReqListMyAll extends RequirementSubpage<Requirement>
|
||||
{
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void beforeSelectViaUrl() {
|
||||
BindUtils.postGlobalCommand(null, null, "selectAll", null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,4 +64,9 @@ public class ReqListMyCenters extends RequirementSubpage<Requirement>
|
||||
{
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void beforeSelectViaUrl() {
|
||||
BindUtils.postGlobalCommand(null, null, "selectCentre", null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,4 +64,9 @@ public class ReqListMyWorkgroups extends RequirementSubpage<Requirement>
|
||||
{
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void beforeSelectViaUrl() {
|
||||
BindUtils.postGlobalCommand(null, null, "selectWorkgroup", null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,5 +59,10 @@ public class TripRequirementListAll extends RequirementSubpage<TripRequirement>
|
||||
public void reloadRelated() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void beforeSelectViaUrl() {
|
||||
BindUtils.postGlobalCommand(null, null, "selectAll", null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,5 +56,10 @@ public class TripRequirementListCentre extends RequirementSubpage<TripRequiremen
|
||||
public void reloadRelated() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void beforeSelectViaUrl() {
|
||||
BindUtils.postGlobalCommand(null, null, "selectCentre", null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -62,5 +62,10 @@ public class TripRequirementListWorkgroup extends RequirementSubpage<TripRequire
|
||||
public void reloadRelated() {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void beforeSelectViaUrl() {
|
||||
BindUtils.postGlobalCommand(null, null, "selectWorkgroup", null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,13 +6,16 @@
|
||||
<tab label="${labels.RequirementsGridMy}" />
|
||||
<tab
|
||||
label="${labels.RequirementsGridMyCentres}"
|
||||
disabled="@load(not vm.showCentre)" />
|
||||
disabled="@load(not vm.showCentre)"
|
||||
selected="@load(vm.selectCentre)" />
|
||||
<tab
|
||||
label="${labels.RequirementsGridMyWorkgroups}"
|
||||
disabled="@load(not vm.showWorkgroup)" />
|
||||
disabled="@load(not vm.showWorkgroup)"
|
||||
selected="@load(vm.selectWorkgroup)" />
|
||||
<tab
|
||||
label="${labels.RequirementsGridAll}"
|
||||
disabled="@load(not vm.showAll)" />
|
||||
disabled="@load(not vm.showAll)"
|
||||
selected="@load(vm.selectAll)" />
|
||||
</tabs>
|
||||
<tabpanels>
|
||||
<tabpanel>
|
||||
|
||||
Reference in New Issue
Block a user