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-94f89814c4df
master
jensp 2012-10-05 07:34:55 +00:00
parent 49be4ae105
commit 29a4101b03
1 changed files with 24 additions and 14 deletions

View File

@ -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,12 +105,15 @@ 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();
if (m_add.isSelected(state)) {
final CMSTask task = m_task.getTask(state); final CMSTask task = m_task.getTask(state);
task.removeAllGroupAssignees(); task.removeAllGroupAssignees();
@ -126,21 +130,25 @@ class TaskAddRole extends CMSForm {
} }
} }
}
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";
@ -165,6 +173,7 @@ 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();
} }
} }