From: <pb...@fe...> - 2012-12-18 08:30:14
|
Author: pboy Date: 2012-12-18 08:30:05 +0000 (Tue, 18 Dec 2012) New Revision: 2420 Modified: trunk/ccm-cms/src/com/arsdigita/cms/ContentItemXMLRenderer.java trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/TaskAddRole.java Log: Fixed UI (Cancel dialogue adding roles, saves changes), various formatting. (on behalf of JensP) Modified: trunk/ccm-cms/src/com/arsdigita/cms/ContentItemXMLRenderer.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ContentItemXMLRenderer.java 2012-12-18 08:02:21 UTC (rev 2419) +++ trunk/ccm-cms/src/com/arsdigita/cms/ContentItemXMLRenderer.java 2012-12-18 08:30:05 UTC (rev 2420) @@ -48,7 +48,7 @@ final String path, final String context, final DomainObject linkObject) { - final long start = System.nanoTime(); + //final long start = System.nanoTime(); DomainObject nObj = obj; @@ -60,7 +60,7 @@ super.walk(adapter, nObj, path, context, linkObject); - System.out.printf("Walked object in %d ms\n", (System.nanoTime() - start) / 1000000); + //System.out.printf("Walked object in %d ms\n", (System.nanoTime() - start) / 1000000); } @Override Modified: trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/TaskAddRole.java =================================================================== --- trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/TaskAddRole.java 2012-12-18 08:02:21 UTC (rev 2419) +++ trunk/ccm-cms/src/com/arsdigita/cms/ui/workflow/TaskAddRole.java 2012-12-18 08:30:05 UTC (rev 2420) @@ -53,8 +53,8 @@ import java.util.TooManyListenersException; class TaskAddRole extends CMSForm { + private final TaskRequestLocal m_task; - private final OptionGroup m_roles; private final Submit m_add; private final Submit m_cancel; @@ -90,6 +90,7 @@ } private class InitListener implements FormInitListener { + public final void init(final FormSectionEvent e) throws FormProcessException { final PageState state = e.getPageState(); @@ -104,45 +105,52 @@ m_roles.setValue(state, list.toArray()); } + } private class ProcessListener implements FormProcessListener { + public final void process(final FormSectionEvent e) throws FormProcessException { 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) { - for (int i = 0; i < roles.length; i++) { - task.assignGroup(new Group(new BigDecimal(roles[i]))); + if (roles != null) { + for (int i = 0; i < roles.length; i++) { + task.assignGroup(new Group(new BigDecimal(roles[i]))); + } } + + task.save(); } + } - task.save(); - } } private class SubmissionListener implements FormSubmissionListener { + public final void submitted(final FormSectionEvent e) throws FormProcessException { final PageState state = e.getPageState(); - final SecurityManager sm = Utilities.getSecurityManager(state); + final SecurityManager sm = CMS.getSecurityManager(state); if (!sm.canAccess(state.getRequest(), SecurityManager.WORKFLOW_ADMIN)) { - throw new FormProcessException - (lz(("cms.ui.workflow.insufficient_privileges"))); + throw new FormProcessException(lz(("cms.ui.workflow.insufficient_privileges"))); } } + } private class RoleOptionPrintListener extends DataQueryOptionPrintListener { + public static final String QUERY_NAME = - "com.arsdigita.cms.getStaffRoles"; + "com.arsdigita.cms.getStaffRoles"; public RoleOptionPrintListener() { super(); @@ -163,8 +171,9 @@ } public String getValue(DataQuery d) { - return (String)d.get("name"); + return (String) d.get("name"); } + } private static GlobalizedMessage gz(final String key) { @@ -174,4 +183,5 @@ private static String lz(final String key) { return (String) gz(key).localize(); } + } |