book, book topics: show only published texts and topics
This commit is contained in:
parent
ad144f7f69
commit
513e730132
1 changed files with 20 additions and 3 deletions
|
@ -95,6 +95,20 @@ class Base(object):
|
||||||
if self.editable:
|
if self.editable:
|
||||||
return 'index.html'
|
return 'index.html'
|
||||||
|
|
||||||
|
def checkState(self, stateful):
|
||||||
|
if stateful is None:
|
||||||
|
return True
|
||||||
|
if stateful.statesDefinition == 'simple_publishing':
|
||||||
|
return stateful.state in ('published',)
|
||||||
|
return True
|
||||||
|
|
||||||
|
def children(self):
|
||||||
|
for c in self.getChildren():
|
||||||
|
for stf in c.states or [None]:
|
||||||
|
if self.checkState(stf):
|
||||||
|
yield c
|
||||||
|
break
|
||||||
|
|
||||||
def getResources(self):
|
def getResources(self):
|
||||||
relViews = super(Base, self).getResources()
|
relViews = super(Base, self).getResources()
|
||||||
return relViews
|
return relViews
|
||||||
|
@ -106,9 +120,12 @@ class Base(object):
|
||||||
idx = 0
|
idx = 0
|
||||||
for rv in self.getResources():
|
for rv in self.getResources():
|
||||||
if rv.context.contentType.startswith('text/'):
|
if rv.context.contentType.startswith('text/'):
|
||||||
idx += 1
|
for stf in rv.states or [None]:
|
||||||
result.append(rv)
|
if self.checkState(stf):
|
||||||
self.images.append([])
|
idx += 1
|
||||||
|
result.append(rv)
|
||||||
|
self.images.append([])
|
||||||
|
break
|
||||||
else:
|
else:
|
||||||
self.registerDojoLightbox()
|
self.registerDojoLightbox()
|
||||||
url = self.nodeView.getUrlForTarget(rv.context)
|
url = self.nodeView.getUrlForTarget(rv.context)
|
||||||
|
|
Loading…
Add table
Reference in a new issue