Example #1
0
def JxTableDisplay(TupleList,Class,Type=None):
        if Type != None:
                from globalobjects import FactId2Types            
                if not FactId2Types:
                        from graphs import JxParseFacts4Stats
                        JxParseFacts4Stats()
                tupleStart=1
        else:
                tupleStart=0

        JxHtmlBuffer = u"" 
        Boolean = True 
        for Tuple in TupleList:
                if Type != None:
                        Types= [t for (t,e,c) in FactId2Types[Tuple[0]][0]] #FactID2Type is a very strange structure
                if Type == None or Type in Types:
                        if Boolean:
                                    JxHtmlBuffer += u"""<tr class="Tr-Odd">"""
                        else:
                                    JxHtmlBuffer += u"""<tr class="Tr-Even">"""
                        Boolean = not(Boolean)
                        for Index in range(tupleStart,len(Tuple)):
                                JxHtmlBuffer += u'<td class="Td-' + JxInt2Name(Index) + u'">' + rubify(Tuple[Index].strip()) + u'</td>'
                        JxHtmlBuffer += u"</tr>"

        if len(JxHtmlBuffer):
                return u'<table cellspacing="0px" cellpadding="0px" class="' + Class + u'">%s</table>' % JxHtmlBuffer
        else:
                return u""
Example #2
0
def JxTableDisplay(TupleList,Class,Type=None):
        if Type != None:
                tupleStart=1
        else:
                tupleStart=0

        JxHtmlBuffer = u"" 
        Boolean = True 
        for Tuple in TupleList:
                if Type != None:
                        from JxPlugin.database import eDeck 
                        Types= [type for (type,list) in JxType if type in eDeck.types[Tuple[0]]] 
                if Type == None or Type in Types:
                        if Boolean:
                                    JxHtmlBuffer += u"""<tr class="Tr-Odd">"""
                        else:
                                    JxHtmlBuffer += u"""<tr class="Tr-Even">"""
                        Boolean = not(Boolean)
                        for Index in range(tupleStart,len(Tuple)):
                                JxHtmlBuffer += u'<td class="Td-' + JxInt2Name(Index) + u'">' + rubify(Tuple[Index].strip()) + u'</td>'
                        JxHtmlBuffer += u"</tr>"

        if len(JxHtmlBuffer):
                return u'<table cellspacing="0px" cellpadding="0px" class="' + Class + u'">%s</table>' % JxHtmlBuffer
        else:
                return u""