provide a query view for linking to other loops sites in the same instance
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3107 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
ed35bcf5af
commit
9cbc45818e
8 changed files with 112 additions and 2 deletions
|
@ -393,7 +393,8 @@ class BaseView(GenericView, I18NView):
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def options(self):
|
def options(self):
|
||||||
return IOptions(self.context)
|
#return IOptions(self.context)
|
||||||
|
return IOptions(self.adapted)
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def globalOptions(self):
|
def globalOptions(self):
|
||||||
|
|
|
@ -468,6 +468,7 @@
|
||||||
<include package=".rest" />
|
<include package=".rest" />
|
||||||
<include package=".search" />
|
<include package=".search" />
|
||||||
<include package=".security" />
|
<include package=".security" />
|
||||||
|
<include package=".system" />
|
||||||
<include package=".versioning" />
|
<include package=".versioning" />
|
||||||
<include package=".xmlrpc" />
|
<include package=".xmlrpc" />
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,8 @@ class CommentsView(NodeView):
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def allowed(self):
|
def allowed(self):
|
||||||
return self.globalOptions('organize.allowComments')
|
return (self.virtualTargetObject is not None and
|
||||||
|
self.globalOptions('organize.allowComments'))
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def addUrl(self):
|
def addUrl(self):
|
||||||
|
|
|
@ -8,4 +8,6 @@
|
||||||
<zope:adapter factory="loops.system.setup.SetupManager"
|
<zope:adapter factory="loops.system.setup.SetupManager"
|
||||||
name="system" />
|
name="system" />
|
||||||
|
|
||||||
|
<include package=".site" />
|
||||||
|
|
||||||
</configure>
|
</configure>
|
||||||
|
|
4
system/site/__init__.py
Normal file
4
system/site/__init__.py
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
"""
|
||||||
|
$Id$
|
||||||
|
"""
|
||||||
|
|
67
system/site/browser.py
Normal file
67
system/site/browser.py
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
#
|
||||||
|
|
||||||
|
"""
|
||||||
|
View class(es) for work items.
|
||||||
|
|
||||||
|
$Id$
|
||||||
|
"""
|
||||||
|
|
||||||
|
from zope.cachedescriptors.property import Lazy
|
||||||
|
from zope.app.pagetemplate import ViewPageTemplateFile
|
||||||
|
from zope.security import canAccess
|
||||||
|
from zope.traversing.api import getParent, getRoot, traverse
|
||||||
|
from zope.traversing.browser import absoluteURL
|
||||||
|
|
||||||
|
from loops.browser.common import BaseView
|
||||||
|
from loops.browser.concept import ConceptView
|
||||||
|
from loops import util
|
||||||
|
from loops.util import _
|
||||||
|
|
||||||
|
|
||||||
|
site_macros = ViewPageTemplateFile('view_macros.pt')
|
||||||
|
|
||||||
|
|
||||||
|
class SitesListing(ConceptView):
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def site_macros(self):
|
||||||
|
return site_macros.macros
|
||||||
|
|
||||||
|
@property
|
||||||
|
def macro(self):
|
||||||
|
return self.site_macros['sites_listing']
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def root(self):
|
||||||
|
return getRoot(self.context)
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def sites(self):
|
||||||
|
result = []
|
||||||
|
paths = self.options('system.sites') or []
|
||||||
|
for p in paths:
|
||||||
|
s = traverse(self.root, p)
|
||||||
|
if canAccess(s, 'title'):
|
||||||
|
result.append(SiteDetails(s, self.request))
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
class SiteDetails(BaseView):
|
||||||
|
|
||||||
|
pass
|
16
system/site/configure.zcml
Normal file
16
system/site/configure.zcml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<!-- $Id$ -->
|
||||||
|
|
||||||
|
<configure
|
||||||
|
xmlns:zope="http://namespaces.zope.org/zope"
|
||||||
|
xmlns:browser="http://namespaces.zope.org/browser"
|
||||||
|
i18n_domain="loops">
|
||||||
|
|
||||||
|
<zope:adapter
|
||||||
|
name="loops_sites.html"
|
||||||
|
for="loops.interfaces.IConcept
|
||||||
|
zope.publisher.interfaces.browser.IBrowserRequest"
|
||||||
|
provides="zope.interface.Interface"
|
||||||
|
factory="loops.system.site.browser.SitesListing"
|
||||||
|
permission="zope.View" />
|
||||||
|
|
||||||
|
</configure>
|
18
system/site/view_macros.pt
Normal file
18
system/site/view_macros.pt
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<html i18n:domain="loops">
|
||||||
|
<!-- $Id$ -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- listings -->
|
||||||
|
|
||||||
|
<metal:work define-macro="sites_listing">
|
||||||
|
<h2 i18n:translate="">loops Sites</h2>
|
||||||
|
<ul>
|
||||||
|
<tal:site tal:repeat="row item/sites">
|
||||||
|
<li><a tal:attributes="href row/url"
|
||||||
|
tal:content="row/dcTitle">My Site</a></li>
|
||||||
|
</tal:site>
|
||||||
|
</ul>
|
||||||
|
</metal:work>
|
||||||
|
|
||||||
|
|
||||||
|
</html>
|
Loading…
Add table
Reference in a new issue