register and display portlets; 'related items' portlet
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@1341 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
		
							parent
							
								
									a772e71f84
								
							
						
					
					
						commit
						aa4e337581
					
				
					 6 changed files with 69 additions and 11 deletions
				
			
		|  | @ -31,7 +31,7 @@ from zope.app.container.browser.contents import JustContents | |||
| from zope.app.container.browser.adding import ContentAdding | ||||
| from zope.app.event.objectevent import ObjectCreatedEvent, ObjectModifiedEvent | ||||
| from zope.app.pagetemplate import ViewPageTemplateFile | ||||
| #from zope.app.intid.interfaces import IIntIds | ||||
| from zope.app.security.interfaces import IUnauthenticatedPrincipal | ||||
| from zope.dottedname.resolve import resolve | ||||
| from zope.event import notify | ||||
| from zope.formlib.namedtemplate import NamedTemplate | ||||
|  | @ -69,6 +69,13 @@ class NodeView(BaseView): | |||
|         cm.register('css', identifier='loops.css', | ||||
|                     resourceName='loops.css', media='all') | ||||
|         cm.register('js', 'loops.js', resourceName='loops.js') | ||||
|         cm.register('portlet_left', 'navigation', title='Navigation', | ||||
|                      subMacro=self.template.macros['menu']) | ||||
|         if not IUnauthenticatedPrincipal.providedBy(self.request.principal): | ||||
|             cm.register('portlet_right', 'actions', title='Actions', | ||||
|                          subMacro=self.template.macros['actions']) | ||||
|             cm.register('portlet_right', 'personal', title='Personal Items', | ||||
|                          subMacro=self.template.macros['personal']) | ||||
| 
 | ||||
|     @Lazy | ||||
|     def view(self): | ||||
|  |  | |||
|  | @ -146,7 +146,11 @@ | |||
| 
 | ||||
| <!-- menu --> | ||||
| 
 | ||||
| <metal:menu define-macro="menu"> | ||||
| <metal:menu define-macro="menu" | ||||
|             tal:define="item nocall:view/menu | nothing; | ||||
|                         level level|python: 1" | ||||
|             tal:condition="nocall:item"> | ||||
|     <metal:sub define-macro="submenu"> | ||||
|           <div class="menu-3" | ||||
|                tal:attributes="class python: 'content ' | ||||
|                     + (view.selected(item) and 'even' or 'odd') | ||||
|  | @ -158,12 +162,25 @@ | |||
|           <tal:sub define="level python:level+1" | ||||
|                    condition="python: level < 4 or view.active(item)"> | ||||
|             <tal:items repeat="item item/menuItems"> | ||||
|               <metal:portlet use-macro="views/node_macros/menu" /> | ||||
|               <metal:portlet use-macro="views/node_macros/submenu" /> | ||||
|             </tal:items> | ||||
|           </tal:sub> | ||||
|     </metal:sub> | ||||
| </metal:menu> | ||||
| 
 | ||||
| 
 | ||||
| <!-- portlets --> | ||||
| 
 | ||||
| <metal:actions define-macro="actions"> | ||||
|           <div class="menu-2">Add Resource</div> | ||||
| </metal:actions> | ||||
| 
 | ||||
| 
 | ||||
| <metal:actions define-macro="personal"> | ||||
|           <div class="menu-2">Clipboard</div> | ||||
| </metal:actions> | ||||
| 
 | ||||
| 
 | ||||
| <!-- inner HTML macros --> | ||||
| 
 | ||||
| <div metal:define-macro="inline_edit" | ||||
|  |  | |||
|  | @ -27,6 +27,7 @@ from zope.app import zapi | |||
| from zope.app.catalog.interfaces import ICatalog | ||||
| from zope.app.dublincore.interfaces import ICMFDublinCore | ||||
| from zope.app.pagetemplate import ViewPageTemplateFile | ||||
| from zope.app.security.interfaces import IUnauthenticatedPrincipal | ||||
| from zope.formlib.form import FormFields | ||||
| from zope.formlib.interfaces import DISPLAY_UNWRITEABLE | ||||
| from zope.proxy import removeAllProxies | ||||
|  | @ -84,6 +85,14 @@ class ResourceView(BaseView): | |||
|         else: | ||||
|             return self.template.macros['download'] | ||||
| 
 | ||||
|     def __init__(self, context, request): | ||||
|         super(ResourceView, self).__init__(context, request) | ||||
|         if not IUnauthenticatedPrincipal.providedBy(self.request.principal): | ||||
|             cm = self.controller.macros | ||||
|             cm.register('portlet_right', 'related', title='Related Items', | ||||
|                          subMacro=self.template.macros['related'], | ||||
|                          position=0, info=self) | ||||
| 
 | ||||
|     def show(self): | ||||
|         data = self.context.data | ||||
|         response = self.request.response | ||||
|  |  | |||
|  | @ -54,3 +54,15 @@ | |||
| </form> | ||||
| 
 | ||||
| 
 | ||||
| <metal:actions define-macro="related"> | ||||
|           <div class="menu-2" | ||||
|                tal:repeat="concept macro/info/concepts"> | ||||
|             <a href="#" | ||||
|                tal:content="concept/title" | ||||
|                tal:attributes="href string:${view/url}/.target${concept/uniqueId}"> | ||||
|               Concept | ||||
|             </a> | ||||
|           </div> | ||||
| </metal:actions> | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
|  | @ -84,7 +84,7 @@ class Search(BaseView): | |||
|         """ | ||||
|         request = self.request | ||||
|         request.response.setHeader('Content-Type', 'text/plain; charset=UTF-8') | ||||
|         text = request.get('searchString', '') | ||||
|         text = request.get('searchString', '').replace('(', ' ').replace(')', ' ') | ||||
|         type = request.get('searchType') or 'loops:concept:*' | ||||
|         if type.endswith('*'): | ||||
|             start = type[:-1] | ||||
|  | @ -165,7 +165,7 @@ class SearchResults(BaseView): | |||
|         cat = self.catalog | ||||
|         request = self.request | ||||
|         type = request.get('search.3.type', 'loops:concept:*') | ||||
|         text = request.get('search.3.text') | ||||
|         text = request.get('search.3.text').replace('(', ' ').replace(')', ' ') | ||||
|         if not text and '*' in type: | ||||
|             return None | ||||
|         if type.endswith('*'): | ||||
|  |  | |||
|  | @ -44,12 +44,25 @@ | |||
|       <fieldset class="box" | ||||
|                 tal:condition="request/search.submitted | nothing"> | ||||
|         <legend>Search results</legend> | ||||
|         <div tal:repeat="row view/results"> | ||||
|           <div> | ||||
|             <a tal:attributes="href string:${view/url}/.target${row/uniqueId}" | ||||
|                tal:content="row/title" /> | ||||
|           </div> | ||||
|         </div> | ||||
|         <table class="listing" summary="Search results" | ||||
|                i18n:attributes="summary"> | ||||
|           <thead> | ||||
|             <tr> | ||||
|               <th i18n:translate="label_title">Title</th> | ||||
|               <th i18n:translate="label_type">Type</th> | ||||
|             </tr> | ||||
|           </thead> | ||||
|           <tbody> | ||||
|             <tr tal:repeat="row view/results"> | ||||
|               <td> | ||||
|                 <a tal:attributes="href string:${view/url}/.target${row/uniqueId}" | ||||
|                    tal:content="row/title" /> | ||||
|               </td> | ||||
|               <td tal:content="row/typeTitle"> | ||||
|               </td> | ||||
|             </tr> | ||||
|           </tbody> | ||||
|         </table> | ||||
|       </fieldset> | ||||
|     </div> | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 helmutm
						helmutm