Esempio n. 1
0
def get_dotted_name(obj):
    """ Return dotted name relative to site
    """
    name = []
    while not ISite.providedBy(obj):
        name.append(obj.__name__)
        obj = obj.__parent__

    name.reverse()
    return ".".join(name)
Esempio n. 2
0
    def headtitle(self):
        if ISite.providedBy(self.page):
            return u'Ziare online, ziarul tau, stiri online de ultima ora, jocuri'

        title = getattr(self.page, 'title', '')
        if not title:
            return u'Revista presei romanesti'

        util = queryUtility(IText)
        title = util.translate(title)
        return util.truncate(title)
Esempio n. 3
0
    def items(self):
        items = []

        if ISite.providedBy(self.context):
            return self._site_items
        elif IPage.providedBy(self.context):
            return self._page_items
        elif IServer.providedBy(self.context):
            return self._server_items
        elif INews.providedBy(self.context):
            return self._news_items
        return []
Esempio n. 4
0
    def tabs(self):
        """ Return the first IPage subobject
        """
        if ISite.providedBy(self.page):
            yield self.page['sursa']
            raise StopIteration

        content = queryAdapter(self.context, ISortedContent)
        if not content:
            raise StopIteration

        for page in content.children(IPage, sort_by='order', reverse=False):
            if page == self.page:
                continue
            yield page
Esempio n. 5
0
    def headsubtitle(self):
        if ISite.providedBy(self.page):
            return (u'stiam.ro - ziare online, ziarul si revista presei '
                    'romanesti - contine stiri online de ultima ora, jocuri '
                    'ca solitaire, sudoku, bomberman, dartz, domino, golf '
                    'si altele')

        description = getattr(self.page, 'description', u'')
        if not description:
            return (u'Revista presei romanesti contine stiri de pe cele mai '
                    'importante site-uri de stiri romanesti. Jocuri: '
                    'solitaire, sudoku si altele')

        util = queryUtility(IText)
        description = util.translate(description)
        return util.truncate(description, words=27, length=135)
Esempio n. 6
0
    def items(self):
        items = []

        page = self.context
        while 1:
            items.insert(0, {
                'url': absoluteURL(page, self.request),
                'title': page.title or page.__name__
            })
            if ISection.providedBy(page):
                break

            if ISite.providedBy(page):
                break

            page = page.__parent__

        for page in items:
            yield page
Esempio n. 7
0
    def tabs(self):
        """ Return the first IPage subobject
        """
        root = ISite.providedBy(self.page)
        yield {
            'url': absoluteURL(self.context, self.request),
            'title': 'Revista presei',
            'current': root
        }

        if INews.providedBy(self.page):
            server = self.page.__parent__
            title = getattr(server, 'title', server.__name__)
            if len(title) > 25:
                title = title[:25] + '...'
            yield {
                'url': absoluteURL(server, self.request),
                'title': title,
                'current': False
            }

        if not (root or ISection.providedBy(self.page)):
            title = getattr(self.page, 'title', self.page.__name__)
            if len(title) > 25:
                title = title[:25] + '...'

            yield {
                'url': absoluteURL(self.page, self.request),
                'title': title,
                'current': True
            }

        content = ISortedContent(self.context)
        for section in content.children(ISection, sort_by='order'):
            yield {
                'url': absoluteURL(section, self.request),
                'title': section.title,
                'current': self.page.__name__ == section.__name__
            }