Example #1
0
    def paint(self,
              search=False,
              single=False,
              status=None,
              curIndex=0,
              onlyChildren=False):
        if status is None:
            if search:
                status = [common.TEMP]
            else:
                status = common.getHomeStatuses()
        if self.manager.download.__name__ == self.type and self.status not in status:
            return ''

        if not onlyChildren:
            html = self.buildHtml(search, curIndex=curIndex)
        else:
            html = '{{children}}'
        if single:
            return html

        children = Element.select().where(Element.parent == self.id)
        curIndex = 0
        if '{{children}}' in html:
            for child in sorted(children, key=lambda c: c.orderFieldValues):
                html = html.replace(
                    '{{children}}',
                    '%s{{children}}' % child.paint(search=search,
                                                   single=single,
                                                   status=status,
                                                   curIndex=curIndex), 1)
                curIndex += 1

        html = html.replace('{{children}}', '')
        return html
Example #2
0
    def paint(self, search=False, single=False, status=None, curIndex=0, onlyChildren=False):
        if status is None:
            if search:
                status = [common.TEMP]
            else:
                status = common.getHomeStatuses()
        if self.manager.download.__name__ == self.type and self.status not in status:
            return ''

        if not onlyChildren:
            html = self.buildHtml(search, curIndex=curIndex)
        else:
            html = '{{children}}'
        if single:
            return html

        children = Element.select().where(Element.parent == self.id)
        curIndex = 0
        orderReverse = False
        if children.count():
            orderReverse = children.first().orderReverse
        if '{{children}}' in html:
            for child in sorted(children,
                                key=lambda c: c.orderFieldValues,
                                reverse=orderReverse
                         ):
                html = html.replace('{{children}}', '%s{{children}}' % child.paint(search=search, single=single, status=status, curIndex=curIndex), 1)
                curIndex += 1

        html = html.replace('{{children}}', '')
        return html
Example #3
0
    def paint(self, search=False, single=False, status=None, curIndex=0, onlyChildren=False):
        if status is None:
            if search:
                status = [common.TEMP]
            else:
                status = common.getHomeStatuses()
        if self.manager.download.__name__ == self.type and self.status not in status:
            return ""

        if not onlyChildren:
            html = self.buildHtml(search, curIndex=curIndex)
        else:
            html = "{{children}}"
        if single:
            return html

        children = Element.select().where(Element.parent == self.id)
        curIndex = 0
        if "{{children}}" in html:
            for child in sorted(children, key=lambda c: c.orderFieldValues):
                html = html.replace(
                    "{{children}}",
                    "%s{{children}}" % child.paint(search=search, single=single, status=status, curIndex=curIndex),
                    1,
                )
                curIndex += 1

        html = html.replace("{{children}}", "")
        return html
Example #4
0
    def paint(self, root=None, status=None):
        if status is None:
            status = common.getHomeStatuses()

        if root is None:
            log('init paint on default root %s %s' % (self.root, self.root.id))
            return self.root.paint(status=status)
        else:
            log('init paint on given root %s %s' % (root, root.id))
            return root.paint(search=True)
Example #5
0
File: bases.py Project: foXaCe/XDM
    def paint(self, root=None, status=None):
        if status is None:
            status = common.getHomeStatuses()

        if root is None:
            log('init paint on default root %s' % self.root)
            return self.root.paint(status=status)
        else:
            log('init paint on given root %s' % root)
            return root.paint(search=True)
Example #6
0
 def homeStatuses(self):
     return common.getHomeStatuses()
Example #7
0
 def getDownloadableElements(self, asList=True):
     return self.getElementsWithStatusIn(common.getHomeStatuses(), asList,
                                         [self.download.__name__])
Example #8
0
 def homeStatuses(self):
     return common.getHomeStatuses()
Example #9
0
File: bases.py Project: foXaCe/XDM
 def getDownloadableElements(self, asList=True):
     return self.getElementsWithStatusIn(common.getHomeStatuses(), asList, [self.download.__name__])