Use TaskView for providing task work items listing
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3200 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
		
							parent
							
								
									46b8b0b7eb
								
							
						
					
					
						commit
						6f8e716923
					
				
					 7 changed files with 55 additions and 31 deletions
				
			
		|  | @ -7,9 +7,13 @@ | ||||||
|       <metal:slot define-slot="fields"> |       <metal:slot define-slot="fields"> | ||||||
|         <metal:block use-macro="view/concept_macros/conceptfields" /> |         <metal:block use-macro="view/concept_macros/conceptfields" /> | ||||||
|       </metal:slot> |       </metal:slot> | ||||||
|  |       <metal:slot define-slot="children"> | ||||||
|         <metal:block use-macro="view/concept_macros/conceptchildren" /> |         <metal:block use-macro="view/concept_macros/conceptchildren" /> | ||||||
|  |       </metal:slot> | ||||||
|  |       <metal:slot define-slot="resources"> | ||||||
|         <metal:block use-macro="view/concept_macros/conceptresources" /> |         <metal:block use-macro="view/concept_macros/conceptresources" /> | ||||||
|           <metal:block use-macro="view/work_macros/workitems" /> |       </metal:slot> | ||||||
|  |       <metal:slot define-slot="querydata" /> | ||||||
|       <metal:block use-macro="view/comment_macros/comments" /> |       <metal:block use-macro="view/comment_macros/comments" /> | ||||||
|   </div> |   </div> | ||||||
| </metal:data> | </metal:data> | ||||||
|  | @ -209,8 +213,9 @@ | ||||||
| <metal:actions define-macro="parents"> | <metal:actions define-macro="parents"> | ||||||
|           <div tal:repeat="concept macro/info/view/parents|macro/info/parents"> |           <div tal:repeat="concept macro/info/view/parents|macro/info/parents"> | ||||||
|             <a href="#" |             <a href="#" | ||||||
|                tal:attributes="href string:${view/url}/.target${concept/uniqueId}"> |                tal:attributes="href python: view.getUrlForTarget(concept)"> | ||||||
|               <span i18n:translate="" tal:content="concept/title">Concept</span> |               <span i18n:translate="" | ||||||
|  |                     tal:content="concept/title">Concept</span> | ||||||
|               (<i tal:content="concept/typeTitle" |               (<i tal:content="concept/typeTitle" | ||||||
|                   i18n:translate="">Type</i>) |                   i18n:translate="">Type</i>) | ||||||
|             </a> |             </a> | ||||||
|  |  | ||||||
|  | @ -398,6 +398,13 @@ div.comment { | ||||||
|     padding-top: 0.4em; |     padding-top: 0.4em; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /* calendar, work items */ | ||||||
|  | 
 | ||||||
|  | .today { | ||||||
|  |     color: #444488; | ||||||
|  |     font-weight: bold; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /* dojo stuff */ | /* dojo stuff */ | ||||||
| 
 | 
 | ||||||
| .dijitDialog { | .dijitDialog { | ||||||
|  |  | ||||||
|  | @ -501,13 +501,6 @@ class NodeView(BaseView): | ||||||
|         from loops.organize.work.browser import work_macros |         from loops.organize.work.browser import work_macros | ||||||
|         return work_macros.macros |         return work_macros.macros | ||||||
| 
 | 
 | ||||||
|     @Lazy |  | ||||||
|     def workItems(self): |  | ||||||
|         target = self.virtualTargetObject |  | ||||||
|         if target is not None: |  | ||||||
|             return component.getMultiAdapter((target, self.request), |  | ||||||
|                                              name='taskworkitems.html') |  | ||||||
| 
 |  | ||||||
|     # comments |     # comments | ||||||
| 
 | 
 | ||||||
|     @Lazy |     @Lazy | ||||||
|  |  | ||||||
|  | @ -46,5 +46,12 @@ organize_macros = ViewPageTemplateFile('view_macros.pt') | ||||||
| 
 | 
 | ||||||
| class TaskView(ConceptView): | class TaskView(ConceptView): | ||||||
| 
 | 
 | ||||||
|     pass |     @Lazy | ||||||
|  |     def macro(self): | ||||||
|  |         return organize_macros.macros['task'] | ||||||
|  | 
 | ||||||
|  |     @Lazy | ||||||
|  |     def workItems(self): | ||||||
|  |         return component.getMultiAdapter((self.context, self.request), | ||||||
|  |                                          name='taskworkitems.html') | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,6 +1,15 @@ | ||||||
| <!-- $Id$ --> | <!-- $Id$ --> | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | <metal:task define-macro="task"> | ||||||
|  |   <metal:data use-macro="view/concept_macros/conceptdata"> | ||||||
|  |     <metal:fill fill-slot="querydata"> | ||||||
|  |       <metal:workitems use-macro="view/work_macros/workitems" /> | ||||||
|  |     </metal:fill> | ||||||
|  |   </metal:data> | ||||||
|  | </metal:task> | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| <metal:data define-macro="conceptdata"> | <metal:data define-macro="conceptdata"> | ||||||
|   <tal:person condition="item/person"> |   <tal:person condition="item/person"> | ||||||
|     <metal:block use-macro="view/concept_macros/conceptdata"> |     <metal:block use-macro="view/concept_macros/conceptdata"> | ||||||
|  |  | ||||||
|  | @ -202,10 +202,7 @@ class BaseWorkItemsView(object): | ||||||
|         if not state: |         if not state: | ||||||
|             result['state'] = ['planned', 'accepted', 'running', 'done', 'done_x', |             result['state'] = ['planned', 'accepted', 'running', 'done', 'done_x', | ||||||
|                                'finished', 'delegated'] |                                'finished', 'delegated'] | ||||||
|         else: |         elif state != 'all': | ||||||
|             if state == 'all': |  | ||||||
|                 del result['state'] |  | ||||||
|             else: |  | ||||||
|             result['state'] = state |             result['state'] = state | ||||||
|         return result |         return result | ||||||
| 
 | 
 | ||||||
|  | @ -222,9 +219,14 @@ class TaskWorkItems(BaseWorkItemsView, ConceptView): | ||||||
| 
 | 
 | ||||||
|     columns = set(['User', 'Title', 'Day', 'Start', 'End', 'Duration', 'Info']) |     columns = set(['User', 'Title', 'Day', 'Start', 'End', 'Duration', 'Info']) | ||||||
| 
 | 
 | ||||||
|  |     @Lazy | ||||||
|  |     def target(self): | ||||||
|  |         return self.context | ||||||
|  | 
 | ||||||
|     def listWorkItems(self): |     def listWorkItems(self): | ||||||
|         criteria = self.baseCriteria |         criteria = self.baseCriteria | ||||||
|         criteria['task'] = util.getUidForObject(self.context) |         criteria['task'] = util.getUidForObject(self.target) | ||||||
|  |         # TODO: option: include subtasks | ||||||
|         return sorted(self.query(**criteria), key=lambda x: x.track.timeStamp) |         return sorted(self.query(**criteria), key=lambda x: x.track.timeStamp) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -5,7 +5,7 @@ | ||||||
| <!-- listings --> | <!-- listings --> | ||||||
| 
 | 
 | ||||||
| <metal:work define-macro="workitems" | <metal:work define-macro="workitems" | ||||||
|             tal:define="work nocall:view/workItems" |             tal:define="work nocall:item/workItems" | ||||||
|             tal:condition="work/listWorkItems|nothing"> |             tal:condition="work/listWorkItems|nothing"> | ||||||
|   <br /> |   <br /> | ||||||
|   <h2 i18n:translate="">Work Items</h2> |   <h2 i18n:translate="">Work Items</h2> | ||||||
|  | @ -25,12 +25,13 @@ | ||||||
|               tal:attributes="colspan python: len(work.columns)" |               tal:attributes="colspan python: len(work.columns)" | ||||||
|               tal:content="row/month">2009-01</td></tr> |               tal:content="row/month">2009-01</td></tr> | ||||||
|         <tr tal:attributes="class python: |         <tr tal:attributes="class python: | ||||||
|                                 repeat['row'].odd() and 'even' or 'odd'"> |                                 (repeat['row'].odd() and 'even' or 'odd')"> | ||||||
|           <td class="nowrap center" |           <td class="nowrap center" | ||||||
|               tal:attributes="title row/weekDay" |               tal:define="today python: row.isToday and ' today' or ''" | ||||||
|               i18n:attributes="title"> |               tal:attributes="title row/weekDay; | ||||||
|             <b tal:omit-tag="not:row/isToday" |                               class string:nowrap center$today" | ||||||
|                tal:content="row/day">2007-03-30</b></td> |               i18n:attributes="title" | ||||||
|  |               tal:content="row/day">2007-03-30</td> | ||||||
|           <td class="nowrap center" tal:content="row/start">17:30</td> |           <td class="nowrap center" tal:content="row/start">17:30</td> | ||||||
|           <td class="nowrap center" tal:content="row/end">20:00</td> |           <td class="nowrap center" tal:content="row/end">20:00</td> | ||||||
|           <td class="nowrap center" tal:content="row/duration">2:30</td> |           <td class="nowrap center" tal:content="row/duration">2:30</td> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 helmutm
						helmutm