From: <ap...@vh...> - 2005-08-22 15:36:28
|
Author: apevec Date: 2005-08-22 17:28:15 +0200 (Mon, 22 Aug 2005) New Revision: 720 Modified: ccm-cms/trunk/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.ora.pdl ccm-cms/trunk/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.pg.pdl ccm-cms/trunk/src/com/arsdigita/cms/ui/TasksPanel.java ccm-cms/trunk/web/packages/content-section/xsl/content-center.xsl Log: content-center task list view: - make Action column sortable - add sortable Workflow column - change default filter to View your locked tasks Modified: ccm-cms/trunk/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.ora.pdl =================================================================== --- ccm-cms/trunk/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.ora.pdl 2005-08-22 14:49:42 UTC (rev 719) +++ ccm-cms/trunk/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.ora.pdl 2005-08-22 15:28:15 UTC (rev 720) @@ -36,9 +36,9 @@ String taskType; String taskTypeClass; Integer status; + String processLabel; do { - select * from - (select cw_tasks.task_id, + select cw_tasks.task_id, cw_tasks.parent_task_id, cw_tasks.label, cw_tasks.description, @@ -48,27 +48,29 @@ ( cw_user_tasks.is_locked ) ELSE ( 'f' ) - END as is_locked, + END as is_locked, cw_user_tasks.due_date, cms_items.section_id, cms_items.item_id, cms_items.name, cms_pages.title, - CASE WHEN (cw_user_tasks.locking_user_id = :userId) then + CASE WHEN (cw_user_tasks.locking_user_id = :userId) then 1 - when (cw_user_tasks.locking_user_id is null) then + WHEN (cw_user_tasks.locking_user_id is null) then 2 - else + ELSE 3 - END as status, - cw_user_tasks.locking_user_id - from cw_tasks, - cw_user_tasks, - cms_tasks, - cms_task_types, - cw_processes, - cms_items, - cms_pages + END as status, + cw_user_tasks.locking_user_id, + cw_tasks_proc.label as processLabel + from cw_tasks, + cw_user_tasks, + cms_tasks, + cms_task_types, + cw_processes, + cms_items, + cms_pages, + cw_tasks cw_tasks_proc where cw_tasks.task_id = cw_user_tasks.task_id and cw_user_tasks.task_id = cms_tasks.task_id and cms_tasks.task_type_id = cms_task_types.task_type_id @@ -76,6 +78,7 @@ and cw_tasks.parent_task_id = cw_processes.process_id and cms_items.item_id = cw_processes.object_id and cms_items.item_id = cms_pages.item_id + and cw_tasks_proc.task_id = cw_processes.process_id and ( :userId in (select cw_task_user_assignees.user_id from cw_task_user_assignees where cw_task_user_assignees.task_id = cw_tasks.task_id) @@ -85,7 +88,6 @@ in (select cw_task_group_assignees.group_id from cw_task_group_assignees where cw_task_group_assignees.task_id = cw_tasks.task_id))) - order by status asc, due_date asc, cms_pages.title asc) } map { taskID = cw_tasks.task_id; processID = cw_tasks.parent_task_id; @@ -101,5 +103,6 @@ taskType = taskname; taskTypeClass = cms_task_types.classname; status = status; + processLabel = processLabel; } } Modified: ccm-cms/trunk/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.pg.pdl =================================================================== --- ccm-cms/trunk/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.pg.pdl 2005-08-22 14:49:42 UTC (rev 719) +++ ccm-cms/trunk/pdl/com/arsdigita/content-section/query-getEnabledUserTasks.pg.pdl 2005-08-22 15:28:15 UTC (rev 720) @@ -36,9 +36,9 @@ String taskType; String taskTypeClass; Integer status; + String processLabel; do { - select * from - (select cw_tasks.task_id, + select cw_tasks.task_id, cw_tasks.parent_task_id, cw_tasks.label, cw_tasks.description, @@ -46,7 +46,7 @@ cms_task_types.name as taskname, CASE WHEN (cw_user_tasks.is_locked is not null) THEN ( cw_user_tasks.is_locked ) - ELSE + ELSE ( 'f' ) END as is_locked, cw_user_tasks.due_date, @@ -56,19 +56,21 @@ cms_pages.title, CASE WHEN (cw_user_tasks.locking_user_id = :userId) then 1 - WHEN (cw_user_tasks.locking_user_id is null) then + WHEN (cw_user_tasks.locking_user_id is null) then 2 - ELSE + ELSE 3 - END as status, - cw_user_tasks.locking_user_id + END as status, + cw_user_tasks.locking_user_id, + cw_tasks_proc.label as processLabel from cw_tasks, cw_user_tasks, cms_tasks, cms_task_types, cw_processes, cms_items, - cms_pages + cms_pages, + cw_tasks cw_tasks_proc where cw_tasks.task_id = cw_user_tasks.task_id and cw_user_tasks.task_id = cms_tasks.task_id and cms_tasks.task_type_id = cms_task_types.task_type_id @@ -76,16 +78,16 @@ and cw_tasks.parent_task_id = cw_processes.process_id and cms_items.item_id = cw_processes.object_id and cms_items.item_id = cms_pages.item_id + and cw_tasks_proc.task_id = cw_processes.process_id and ( exists (select 1 from cw_task_user_assignees where cw_task_user_assignees.user_id = :userId and cw_task_user_assignees.task_id = cw_tasks.task_id) - or + or exists (select 1 from group_member_trans_map, cw_task_group_assignees where :userId = member_id and group_member_trans_map.group_id = cw_task_group_assignees.group_id and cw_task_group_assignees.task_id = cw_tasks.task_id)) - order by status asc, due_date asc, cms_pages.title asc) results } map { taskID = cw_tasks.task_id; processID = cw_tasks.parent_task_id; @@ -101,5 +103,6 @@ taskType = taskname; taskTypeClass = cms_task_types.classname; status = status; + processLabel = processLabel; } } Modified: ccm-cms/trunk/src/com/arsdigita/cms/ui/TasksPanel.java =================================================================== --- ccm-cms/trunk/src/com/arsdigita/cms/ui/TasksPanel.java 2005-08-22 14:49:42 UTC (rev 719) +++ ccm-cms/trunk/src/com/arsdigita/cms/ui/TasksPanel.java 2005-08-22 15:28:15 UTC (rev 720) @@ -101,23 +101,24 @@ private Paginator m_paginator; private ActionLink m_viewLockLink,m_viewUnlockLink,m_viewAllLockLink; private Label m_viewLockLabel,m_viewUnlockLabel,m_viewAllLockLabel; - private Label m_actionLabel; private StringParameter m_sortDirectionParam; private StringParameter m_sortTypeParam; private StringParameter m_lockFilterParam; // control link variable - private static final String ACTION = "taskAction"; - private static final String SORT_ACTION_DOWN = "sortActionUp"; - private static final String SORT_ACTION_UP = "sortActionDown"; + private static final String TASK_ACTION = "taskAction"; + private static final String SORT_DOWN = "sortActionUp"; + private static final String SORT_UP = "sortActionDown"; - public static final String LOCK_FILTER_TYPE = "lockFilterType"; - public static final String SORT_TYPE = "sortType"; - public static final String SORT_DIRECTION = "sortDirection"; - public static final String SORT_USER = "user"; - public static final String SORT_TITLE = "title"; - public static final String SORT_DATE = "date"; - public static final String SORT_STATUS = "status"; + private static final String LOCK_FILTER_TYPE = "lockFilterType"; + private static final String SORT_TYPE = "sortType"; + private static final String SORT_DIRECTION = "sortDirection"; + private static final String SORT_ACTION = "action"; + private static final String SORT_DATE = "date"; + private static final String SORT_STATUS = "status"; + private static final String SORT_TITLE = "title"; + private static final String SORT_USER = "user"; + private static final String SORT_WORKFLOW = "workflow"; // IMAGES public static final String UP_ARROW_IMAGE = "/assets/gray-triangle-up.gif"; @@ -262,8 +263,8 @@ add(getTasksList()); add(getPaginator()); - m_actionLabel = new Label(GlobalizationUtil.globalize("cms.ui.action")); - m_actionLabel.setClassAttr("action"); +// m_actionLabel = new Label(GlobalizationUtil.globalize("cms.ui.action")); +// m_actionLabel.setClassAttr("action"); } public void register(Page p) { @@ -286,13 +287,13 @@ String lockFilterType = getLockFilterType(state); - if ( lockFilterType.equals("lock") ) { - m_viewLockLabel.setVisible(state,true); - m_viewLockLink.setVisible(state,false); + if ( lockFilterType.equals("all") ) { + m_viewLockLabel.setVisible(state,false); + m_viewLockLink.setVisible(state,true); m_viewUnlockLabel.setVisible(state,false); m_viewUnlockLink.setVisible(state,true); - m_viewAllLockLabel.setVisible(state,false); - m_viewAllLockLink.setVisible(state,true); + m_viewAllLockLabel.setVisible(state,true); + m_viewAllLockLink.setVisible(state,false); } else if ( lockFilterType.equals("unlock") ) { m_viewLockLabel.setVisible(state,false); m_viewLockLink.setVisible(state,true); @@ -300,13 +301,13 @@ m_viewUnlockLink.setVisible(state,false); m_viewAllLockLabel.setVisible(state,false); m_viewAllLockLink.setVisible(state,true); - } else { - m_viewLockLabel.setVisible(state,false); - m_viewLockLink.setVisible(state,true); + } else { // default is "lock" + m_viewLockLabel.setVisible(state,true); + m_viewLockLink.setVisible(state,false); m_viewUnlockLabel.setVisible(state,false); m_viewUnlockLink.setVisible(state,true); - m_viewAllLockLabel.setVisible(state,true); - m_viewAllLockLink.setVisible(state,false); + m_viewAllLockLabel.setVisible(state,false); + m_viewAllLockLink.setVisible(state,true); } } }); @@ -354,7 +355,7 @@ protected String getSortDirection(PageState state) { String sortDirection = (String)state.getValue(m_sortDirectionParam); if ( sortDirection == null ) { - sortDirection = SORT_ACTION_UP; + sortDirection = SORT_UP; } return sortDirection; } @@ -453,8 +454,8 @@ private DataQuery makeQuery(PageState state) { User user = (User)Kernel.getContext().getParty(); - DataQuery query = SessionManager.getSession().retrieveQuery - ("com.arsdigita.cms.workflow.getEnabledUserTasks"); + DataQuery query = SessionManager.getSession() + .retrieveQuery(QUERY_NAME); addQueryFilters(query,user,state); return query; @@ -489,7 +490,7 @@ String sortKey = getSortType(state); String sortDirection = getSortDirection(state); String sortPostfix = " asc"; - if (sortDirection.equals(SORT_ACTION_DOWN)) { + if (sortDirection.equals(SORT_DOWN)) { sortPostfix = " desc"; } @@ -501,15 +502,25 @@ ", lower(status) asc, lower(pageTitle) asc"); } else if ( sortKey.equals(SORT_USER) ) { query.setOrder("lockingUserID " + sortPostfix + - ", lower(status) asc, dueDate desc, " + - " lower(pageTitle) asc"); + ", lower(status) asc, dueDate desc " + + ", lower(pageTitle) asc"); } else if ( sortKey.equals(SORT_STATUS) ) { query.setOrder("lower(status) " + sortPostfix + - ", dueDate desc, " + - " lower(pageTitle) asc"); + ", dueDate desc " + + ", lower(pageTitle) asc"); - } - + } else if ( sortKey.equals(SORT_ACTION) ) { + query.setOrder("taskType " + sortPostfix + + ", lower(status) asc, dueDate desc " + + ", lower(pageTitle) asc" + ); + } else if ( sortKey.equals(SORT_WORKFLOW) ) { + query.setOrder("processLabel " + sortPostfix + + ", lower(status) asc, dueDate desc " + + ", lower(pageTitle) asc" + ); + } + HashMap sections = new HashMap(); while (query.next()) { @@ -536,6 +547,7 @@ task.addAttribute("processID", query.get("processID").toString()); task.addAttribute("taskLabel", (String)query.get("taskLabel")); task.addAttribute("taskDescription", (String)query.get("taskDescription")); + task.addAttribute("processLabel", (String)query.get("processLabel")); String isLocked = (String)query.get("isLocked"); task.addAttribute("isLocked", isLocked); @@ -568,7 +580,7 @@ // control event for locking a task try { - state.setControlEvent(this, ACTION, itemID.toString()); + state.setControlEvent(this, TASK_ACTION, itemID.toString()); task.addAttribute("actionURL", state.stateAsURL()); state.clearControlEvent(); } catch (java.io.IOException ex) { @@ -582,26 +594,28 @@ } } - m_actionLabel.generateXML(state, content); + // m_actionLabel.generateXML(state, content); String[][] sortableHeaders = {{SORT_TITLE, "cms.ui.workflow.task.item_title"}, + {SORT_ACTION, "cms.ui.action"}, {SORT_DATE, "cms.tasks.ui.due_date"}, {SORT_STATUS, "cms.tasks.ui.status_no_colon"}, - {SORT_USER, "cms.ui.workflow.task.locking_user"}}; + {SORT_USER, "cms.ui.workflow.task.locking_user"}, + {SORT_WORKFLOW, "cms.ui.workflow"}}; for (int i=0;i<sortableHeaders.length;i++) { String header = sortableHeaders[i][0]; String labelKey = sortableHeaders[i][1]; - if (sortDirection.equals(SORT_ACTION_UP) && header.equals(sortKey)) { - state.setControlEvent(this, SORT_ACTION_DOWN, header); + if (sortDirection.equals(SORT_UP) && header.equals(sortKey)) { + state.setControlEvent(this, SORT_DOWN, header); } else { - state.setControlEvent(this, SORT_ACTION_UP, header); + state.setControlEvent(this, SORT_UP, header); } SimpleContainer container = new SimpleContainer(); container.add(new Label(GlobalizationUtil.globalize(labelKey))); if (header.equals(sortKey)) { String imageURLStub = null; - if (SORT_ACTION_UP.equals(sortDirection)) { + if (SORT_UP.equals(sortDirection)) { imageURLStub = UP_ARROW_IMAGE; } else { imageURLStub = DOWN_ARROW_IMAGE; @@ -622,7 +636,7 @@ public void respond(PageState state) throws ServletException { String key = state.getControlEventName(); String value = state.getControlEventValue(); - if (ACTION.equals(key)) { + if (TASK_ACTION.equals(key)) { BigDecimal itemID = new BigDecimal(value); try { @@ -655,12 +669,12 @@ } catch (DataObjectNotFoundException ex) { throw new ServletException("Unknown content ID" + itemID); } - } else if ( SORT_ACTION_UP.equals(key) || SORT_ACTION_DOWN.equals(key)) { + } else if ( SORT_UP.equals(key) || SORT_DOWN.equals(key)) { state.setValue(m_sortTypeParam, value); - if (SORT_ACTION_DOWN.equals(key)) { - state.setValue(m_sortDirectionParam, SORT_ACTION_DOWN); + if (SORT_DOWN.equals(key)) { + state.setValue(m_sortDirectionParam, SORT_DOWN); } else { - state.setValue(m_sortDirectionParam, SORT_ACTION_UP); + state.setValue(m_sortDirectionParam, SORT_UP); } } else { throw new ServletException("Unknown control event: " + key); Modified: ccm-cms/trunk/web/packages/content-section/xsl/content-center.xsl =================================================================== --- ccm-cms/trunk/web/packages/content-section/xsl/content-center.xsl 2005-08-22 14:49:42 UTC (rev 719) +++ ccm-cms/trunk/web/packages/content-section/xsl/content-center.xsl 2005-08-22 15:28:15 UTC (rev 720) @@ -22,18 +22,12 @@ <table class="data"> <thead> <tr> - <th> - <xsl:apply-templates select="bebop:link[@class='title']"/> - </th> - <th> - <xsl:apply-templates select="bebop:label[@class='action']"/></th> - <th> - <xsl:apply-templates select="bebop:link[@class='date']"/> - </th> + <th><xsl:apply-templates select="bebop:link[@class='title']"/></th> + <th><xsl:apply-templates select="bebop:link[@class='action']"/></th> + <th><xsl:apply-templates select="bebop:link[@class='date']"/></th> <th><xsl:apply-templates select="bebop:link[@class='status']"/></th> - <th> - <xsl:apply-templates select="bebop:link[@class='user']"/> - </th> + <th><xsl:apply-templates select="bebop:link[@class='user']"/></th> + <th><xsl:apply-templates select="bebop:link[@class='workflow']"/></th> </tr> </thead> <tbody> @@ -74,13 +68,12 @@ <td> <xsl:choose> <xsl:when test="@assignee"> - <xsl:value-of select="@assignee" /> - </xsl:when> - <xsl:otherwise> - -- - </xsl:otherwise> + <xsl:value-of select="@assignee"/> + </xsl:when> + <xsl:otherwise>--</xsl:otherwise> </xsl:choose> </td> + <td><xsl:value-of select="@processLabel"/></td> </tr> </xsl:for-each> </tbody> |