Пример #1
0
    def render(self):
        table = self.table
        prefix = table.prefix
        colID = self.column.id

        # this may return a string 'id-name-idx' if coming from request,
        # otherwise in Table class it is intialised as a integer string
        currentSortID = table.getSortOn()
        try:
            currentSortID = int(currentSortID)
        except ValueError:
            currentSortID = currentSortID.rsplit('-', 1)[-1]

        currentSortOrder = table.getSortOrder()

        sortID = colID.rsplit('-', 1)[-1]

        sortOrder = table.sortOrder
        if int(sortID) == int(currentSortID):
            # ordering the same column so we want to reverse the order
            if currentSortOrder in table.reverseSortOrderNames:
                sortOrder = 'ascending'
            elif currentSortOrder == 'ascending':
                sortOrder = table.reverseSortOrderNames[0]

        args = self.getQueryStringArgs()
        args.update({
            '%s-sortOn' % prefix: colID,
            '%s-sortOrder' % prefix: sortOrder
        })
        queryString = '?%s' % (urllib.urlencode(args))

        # CSS
        if unicode(self.column.id).endswith('-' + str(currentSortID)):
            cssClass = u' class="active %s"' % sortOrder
        else:
            cssClass = u""

        return '<a href="%s" title="%s"%s>%s</a>' % (
            queryString, zope.i18n.translate(_('Sort'),
                                             context=self.request), cssClass,
            zope.i18n.translate(self.column.header, context=self.request))
Пример #2
0
 def __call__(self):
     return _('sitelabel', u"quotationtool.org web-application")
Пример #3
0
 def __call__(self):
     return _('usererror-label', u"User Error")
Пример #4
0
 def __call__(self):
     return _('notfounderror-label', u"Error 404: Not Found")
Пример #5
0
 def __call__(self):
     return _('unauthorizederror-label', u"Error 403: Unauthorized")
Пример #6
0
 def __call__(self):
     return _('systemerror-label', u"System Error")