Fix für Ticket #1393: Abbrechen des Dialog zum Rollen hinzufügen speichert Änderungen
git-svn-id: https://svn.libreccm.org/ccm/trunk@1874 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
49be4ae105
commit
29a4101b03
|
|
@ -53,8 +53,8 @@ import java.util.Iterator;
|
||||||
import java.util.TooManyListenersException;
|
import java.util.TooManyListenersException;
|
||||||
|
|
||||||
class TaskAddRole extends CMSForm {
|
class TaskAddRole extends CMSForm {
|
||||||
private final TaskRequestLocal m_task;
|
|
||||||
|
|
||||||
|
private final TaskRequestLocal m_task;
|
||||||
private final OptionGroup m_roles;
|
private final OptionGroup m_roles;
|
||||||
private final Submit m_add;
|
private final Submit m_add;
|
||||||
private final Submit m_cancel;
|
private final Submit m_cancel;
|
||||||
|
|
@ -90,6 +90,7 @@ class TaskAddRole extends CMSForm {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class InitListener implements FormInitListener {
|
private class InitListener implements FormInitListener {
|
||||||
|
|
||||||
public final void init(final FormSectionEvent e)
|
public final void init(final FormSectionEvent e)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
|
|
@ -104,45 +105,52 @@ class TaskAddRole extends CMSForm {
|
||||||
|
|
||||||
m_roles.setValue(state, list.toArray());
|
m_roles.setValue(state, list.toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ProcessListener implements FormProcessListener {
|
private class ProcessListener implements FormProcessListener {
|
||||||
|
|
||||||
public final void process(final FormSectionEvent e)
|
public final void process(final FormSectionEvent e)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
final CMSTask task = m_task.getTask(state);
|
if (m_add.isSelected(state)) {
|
||||||
|
final CMSTask task = m_task.getTask(state);
|
||||||
|
|
||||||
task.removeAllGroupAssignees();
|
task.removeAllGroupAssignees();
|
||||||
|
|
||||||
final String[] roles = (String[]) m_roles.getValue(state);
|
final String[] roles = (String[]) m_roles.getValue(state);
|
||||||
|
|
||||||
if (roles != null) {
|
if (roles != null) {
|
||||||
for (int i = 0; i < roles.length; i++) {
|
for (int i = 0; i < roles.length; i++) {
|
||||||
task.assignGroup(new Group(new BigDecimal(roles[i])));
|
task.assignGroup(new Group(new BigDecimal(roles[i])));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
task.save();
|
task.save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SubmissionListener implements FormSubmissionListener {
|
private class SubmissionListener implements FormSubmissionListener {
|
||||||
|
|
||||||
public final void submitted(final FormSectionEvent e)
|
public final void submitted(final FormSectionEvent e)
|
||||||
throws FormProcessException {
|
throws FormProcessException {
|
||||||
final PageState state = e.getPageState();
|
final PageState state = e.getPageState();
|
||||||
final SecurityManager sm = Utilities.getSecurityManager(state);
|
final SecurityManager sm = CMS.getSecurityManager(state);
|
||||||
|
|
||||||
if (!sm.canAccess(state.getRequest(),
|
if (!sm.canAccess(state.getRequest(),
|
||||||
SecurityManager.WORKFLOW_ADMIN)) {
|
SecurityManager.WORKFLOW_ADMIN)) {
|
||||||
throw new FormProcessException
|
throw new FormProcessException(lz(("cms.ui.workflow.insufficient_privileges")));
|
||||||
(lz(("cms.ui.workflow.insufficient_privileges")));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RoleOptionPrintListener extends DataQueryOptionPrintListener {
|
private class RoleOptionPrintListener extends DataQueryOptionPrintListener {
|
||||||
|
|
||||||
public static final String QUERY_NAME =
|
public static final String QUERY_NAME =
|
||||||
"com.arsdigita.cms.getStaffRoles";
|
"com.arsdigita.cms.getStaffRoles";
|
||||||
|
|
||||||
public RoleOptionPrintListener() {
|
public RoleOptionPrintListener() {
|
||||||
super();
|
super();
|
||||||
|
|
@ -163,8 +171,9 @@ class TaskAddRole extends CMSForm {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getValue(DataQuery d) {
|
public String getValue(DataQuery d) {
|
||||||
return (String)d.get("name");
|
return (String) d.get("name");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static GlobalizedMessage gz(final String key) {
|
private static GlobalizedMessage gz(final String key) {
|
||||||
|
|
@ -174,4 +183,5 @@ class TaskAddRole extends CMSForm {
|
||||||
private static String lz(final String key) {
|
private static String lz(final String key) {
|
||||||
return (String) gz(key).localize();
|
return (String) gz(key).localize();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue