prepare stateful (workflow) stuff for concepts
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2907 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
		
							parent
							
								
									4a09b21e5f
								
							
						
					
					
						commit
						9af3d9ab29
					
				
					 6 changed files with 43 additions and 7 deletions
				
			
		|  | @ -176,6 +176,14 @@ class ConceptRelationView(BaseView): | |||
|     def order(self): | ||||
|         return self.relation.order | ||||
| 
 | ||||
|     def getActions(self, category='object', page=None, target=None): | ||||
|         t = IType(self.context) | ||||
|         actInfo = t.optionsDict.get('action.' + category, '') | ||||
|         actNames = [n.strip() for n in actInfo.split(',')] | ||||
|         if actNames: | ||||
|             return actions.get(category, actNames, view=self, page=page, target=target) | ||||
|         return [] | ||||
| 
 | ||||
| 
 | ||||
| class ConceptView(BaseView): | ||||
| 
 | ||||
|  |  | |||
|  | @ -12,6 +12,9 @@ | |||
| 
 | ||||
| 
 | ||||
| <metal:title define-macro="concepttitle"> | ||||
|     <tal:actions condition="view/showObjectActions"> | ||||
|         <div metal:use-macro="views/node_macros/object_actions" /> | ||||
|     </tal:actions> | ||||
|     <h1 tal:attributes="ondblclick item/openEditWindow"> | ||||
|       <a name="top" | ||||
|          tal:content="item/title">Title</a> | ||||
|  | @ -80,6 +83,8 @@ | |||
|             <th i18n:translate="">Type</th> | ||||
|             <th i18n:translate="">Modification Date</th> | ||||
|             <th i18n:translate="">Author(s)</th> | ||||
|             <th i18n:translate="" | ||||
|                 tal:condition="view/showObjectActions">Info</th> | ||||
|           </tr> | ||||
|           <tal:items repeat="related children"> | ||||
|             <tal:item define="class python: repeat['related'].odd() and 'even' or 'odd'; | ||||
|  | @ -96,6 +101,12 @@ | |||
|                           i18n:translate="">Type</span></td> | ||||
|                 <td><span tal:replace="related/modified">Type</span></td> | ||||
|                 <td><span tal:replace="related/creators">Type</span></td> | ||||
|                 <td style="white-space: nowrap" | ||||
|                     tal:define="target nocall:related; | ||||
|                                 style nothing" | ||||
|                     tal:condition="view/showObjectActions"> | ||||
|                   <div metal:use-macro="views/node_macros/object_actions" /> | ||||
|                 </td> | ||||
|               </tr> | ||||
|             </tal:item> | ||||
|           </tal:items> | ||||
|  |  | |||
|  | @ -329,6 +329,7 @@ class NodeView(BaseView): | |||
|     def targetDefaultView(self): | ||||
|         target = self.virtualTargetObject | ||||
|         if target is not None: | ||||
|             # zope.app.publisher.browser | ||||
|             name = zapi.getDefaultViewName(target, self.request) | ||||
|             return self.targetView(name) | ||||
|         return u'' | ||||
|  | @ -396,6 +397,7 @@ class NodeView(BaseView): | |||
|             target = self.virtualTarget | ||||
|         if target is not None: | ||||
|             actions.extend(target.getActions(category, page=self, target=target)) | ||||
|         if target != self.virtualTarget:  # self view must be used directly for target | ||||
|             actions.extend(self.view.getAdditionalActions(category, self, target)) | ||||
|         return actions | ||||
| 
 | ||||
|  |  | |||
|  | @ -109,5 +109,3 @@ | |||
|             </a> | ||||
|           </div> | ||||
| </metal:actions> | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -31,7 +31,7 @@ from cybertools.meta.interfaces import IOptions | |||
| from cybertools.stateful.base import Stateful as BaseStateful | ||||
| from cybertools.stateful.base import StatefulAdapter, IndexInfo | ||||
| from cybertools.stateful.interfaces import IStatesDefinition, ITransitionEvent | ||||
| from loops.interfaces import ILoopsObject, IResource | ||||
| from loops.interfaces import ILoopsObject, IConcept, IResource | ||||
| from loops import util | ||||
| 
 | ||||
| 
 | ||||
|  | @ -59,6 +59,16 @@ class SimplePublishable(StatefulLoopsObject): | |||
|     statesDefinition = 'simple_publishing' | ||||
| 
 | ||||
| 
 | ||||
| class StatefulConceptIndexInfo(IndexInfo): | ||||
| 
 | ||||
|     adapts(IConcept) | ||||
| 
 | ||||
|     @property | ||||
|     def availableStatesDefinitions(self): | ||||
|         options = IOptions(self.context.getLoopsRoot()) | ||||
|         return options('organize.stateful.concept', ()) | ||||
| 
 | ||||
| 
 | ||||
| class StatefulResourceIndexInfo(IndexInfo): | ||||
| 
 | ||||
|     adapts(IResource) | ||||
|  |  | |||
|  | @ -12,6 +12,13 @@ | |||
|     <allow interface="cybertools.stateful.interfaces.IStatefulIndexInfo" /> | ||||
|   </zope:class> | ||||
| 
 | ||||
|   <zope:adapter | ||||
|         factory="loops.organize.stateful.base.StatefulConceptIndexInfo" | ||||
|         trusted="True" /> | ||||
|   <zope:class class="loops.organize.stateful.base.StatefulConceptIndexInfo"> | ||||
|     <allow interface="cybertools.stateful.interfaces.IStatefulIndexInfo" /> | ||||
|   </zope:class> | ||||
| 
 | ||||
|   <!-- stateful definitions and corresponding adapters --> | ||||
| 
 | ||||
|   <zope:utility | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 helmutm
						helmutm