Ejemplo n.º 1
0
    def tohtml( self ) :
        etp = self.macronode.parser.etparser
        app = etp.app
        etp.dynamictext = True

        try :   # To handle test cases.
            p   = getattr( app.c, 'project', None )
        except :
            p   = None
        if self.project :
            p = app.projcomp.get_project( unicode(self.project ))

        html= ''
        cntnr = lhtml.Element(
                    'div',
                    { 'name' : 'projectdesc',
                      'class' : 'projectdescription',
                      'style' : self.style
                    }
                )
        if p :
            cntnr.append( 
                lhtml.fromstring( template % \
                                ( p.summary, p.project_info.descriptionhtml )
                             )
            )
        return lhtml.tostring( cntnr )
Ejemplo n.º 2
0
    def tohtml( self ) :
        etp = self.macronode.parser.etparser
        app = etp.app
        etp.dynamictext = True

        try :   # To handle test cases.
            p   = getattr( app.c, 'project', None )
        except :
            p   = None
        if self.project :
            p = app.projcomp.get_project( unicode(self.project ))

        cntnr = lhtml.Element(
                    'div',
                    { 'name' : 'projectvers',
                      'class': 'verdescr etmacro-projectversions',
                      'style' : self.style
                    }
                )
        e     = lhtml.Element( 'h3', { 'style' : "border-bottom : 1px solid cadetBlue; color: cadetBlue" })
        e.text= 'Versions'
        cntnr.append( e )
        versions = p and sorted( p.versions, key=lambda v : v.created_on ) or []
        for v in versions :
            e      = lhtml.Element( 'div', { 'style' : 'font-weight: bold' } ) 
            e.text = v.version_name or ' '  # Don't leave the text empty
            cntnr.append( e )
            e      = lhtml.Element( 'blockquote', {} )
            try :
                e.append( lhtml.fromstring( getattr( v, 'descriptionhtml', '<div> </div>' )))
            except :
                pass
            cntnr.append( e )
        return lhtml.tostring( cntnr )
Ejemplo n.º 3
0
    def tohtml( self ) :
        etp = self.macronode.parser.etparser
        app = etp.app
        etp.dynamictext = True

        try :   # To handle test cases.
            p = getattr( app.c, 'project', None )
        except :
            p = None
        if self.project :
            p = app.projcomp.get_project( unicode(self.project ))

        cntnr = lhtml.Element(
                    'div',
                    { 'name' : 'projectattrs',
                      'style' : self.style,
                      'class' : 'etmacro-projectattributes'
                    }
                )
        if p :
            cntnr.append(
                lhtml.fromstring(
                    template % \
                        ( p.admin_email, p.license and p.license.licensename,
                          ', '.join([ m.mailing_list for m in p.mailinglists ]),
                          ', '.join([ m.ircchannel for m in p.ircchannels ]),
                        )
                )
            )
        return lhtml.tostring( cntnr )
Ejemplo n.º 4
0
    def tohtml(self):
        etp = self.macronode.parser.etparser
        app = etp.app
        etp.dynamictext = True

        try:  # To handle test cases.
            p = getattr(app.c, 'project', None)
        except:
            p = None
        if self.project:
            p = app.projcomp.get_project(unicode(self.project))

        html = ''
        cntnr = lhtml.Element(
            'div', {
                'name': 'projectdesc',
                'class': 'projectdescription',
                'style': self.style
            })
        if p:
            cntnr.append(
                lhtml.fromstring( template % \
                                ( p.summary, p.project_info.descriptionhtml )
                             )
            )
        return lhtml.tostring(cntnr)
Ejemplo n.º 5
0
    def tohtml( self ) :
        etp = self.macronode.parser.etparser
        app = etp.app
        etp.dynamictext = True

        try :   # To handle test cases.
            p = getattr( app.c, 'project', None )
        except :
            p = None
        if self.project :
            p = app.projcomp.get_project( unicode(self.project ))

        cntnr = lhtml.Element(
                    'div',
                    { 'name' : 'projectteam',
                      'class' : 'projectteam',
                      'style' : self.style
                    }
                )

        if p :
            admin  = p.admin.username
            admin  = '<a href="%s">%s</a>' % \
                            ( app.h.url_foruser( admin ), admin  )
            items  = app.projcomp.projectteams( p ).items()
            teams  = ''
            for team, value in sorted( items, key=lambda x : x[0] ) :
                if team == app.projcomp.team_nomember :
                    continue
                users = [ '<a href="%s">%s</a>' % ( app.h.url_foruser(u), u ) 
                          for id, u in value[0] ]
                teams += team_template % \
                            ( team, users and ', '.join( users ) or '-' )
            cntnr.append( lhtml.fromstring( template % ( admin, teams )))
        return lhtml.tostring( cntnr )
Ejemplo n.º 6
0
    def html( self, node, igen, *args, **kwargs ) :
        fn = lambda (k, v) : '%s : %s' % (k,v)
        style = '; '.join(map( fn, self.css.items() ))
        if self.style :
            style += '; ' + self.style + '; '

        try :
            boxnode = lhtml.fromstring( self.nowiki )
        except :
            if self.extnode.parser.etparser.debug : raise
            html = tmpl % (style, '')
        else :
            html = tmpl % (style, lhtml.tostring(boxnode) )
        return html
Ejemplo n.º 7
0
    def tohtml(self):
        etp = self.macronode.parser.etparser
        app = etp.app
        etp.dynamictext = True

        try:  # To handle test cases.
            p = getattr(app.c, 'project', None)
        except:
            p = None
        if self.project:
            p = app.projcomp.get_project(unicode(self.project))

        cntnr = lhtml.Element(
            'div', {
                'name': 'projectcomps',
                'class': 'etmacro-projectcomponents compdescr',
                'style': self.style
            })
        e = lhtml.Element(
            'h3',
            {'style': "border-bottom : 1px solid cadetBlue; color: cadetBlue"})
        e.text = 'Components'
        cntnr.append(e)
        components = p and sorted(p.components,
                                  key=lambda c: c.created_on) or []
        for c in components:
            owner = c.owner.username
            e = lhtml.fromstring(
                ct_template %
                (c.componentname, app.h.url_foruser(owner), owner))
            cntnr.append(e)
            e = lhtml.Element('blockquote', {})
            try:
                e.append(
                    lhtml.fromstring(
                        getattr(c, 'descriptionhtml', '<div> </div>')))
            except:
                pass
            cntnr.append(e)
        return lhtml.tostring(cntnr)
Ejemplo n.º 8
0
    def tohtml( self ) :
        etp = self.macronode.parser.etparser
        app = etp.app
        etp.dynamictext = True

        try :   # To handle test cases.
            p   = getattr( app.c, 'project', None )
        except :
            p   = None
        if self.project :
            p = app.projcomp.get_project( unicode(self.project ))

        cntnr = lhtml.Element(
                    'div',
                    { 'name' : 'projectcomps',
                      'class' : 'etmacro-projectcomponents compdescr',
                      'style' : self.style
                    }
                )
        e = lhtml.Element( 'h3', { 'style' : "border-bottom : 1px solid cadetBlue; color: cadetBlue" })
        e.text= 'Components'
        cntnr.append( e )
        components = p and sorted( p.components, key=lambda c : c.created_on ) or []
        for c in components :
            owner  = c.owner.username
            e      = lhtml.fromstring( ct_template % ( c.componentname,
                                                    app.h.url_foruser( owner ),
                                                    owner
                                                  )
                                  )
            cntnr.append( e )
            e      = lhtml.Element( 'blockquote', {} )
            try :
                e.append( lhtml.fromstring( getattr( c, 'descriptionhtml', '<div> </div>' )))
            except :
                pass
            cntnr.append( e )
        return lhtml.tostring( cntnr )
Ejemplo n.º 9
0
    def tohtml(self):
        etp = self.macronode.parser.etparser
        app = etp.app
        etp.dynamictext = True

        try:  # To handle test cases.
            p = getattr(app.c, 'project', None)
        except:
            p = None
        if self.project:
            p = app.projcomp.get_project(unicode(self.project))

        cntnr = lhtml.Element(
            'div', {
                'name': 'projectvers',
                'class': 'verdescr etmacro-projectversions',
                'style': self.style
            })
        e = lhtml.Element(
            'h3',
            {'style': "border-bottom : 1px solid cadetBlue; color: cadetBlue"})
        e.text = 'Versions'
        cntnr.append(e)
        versions = p and sorted(p.versions, key=lambda v: v.created_on) or []
        for v in versions:
            e = lhtml.Element('div', {'style': 'font-weight: bold'})
            e.text = v.version_name or ' '  # Don't leave the text empty
            cntnr.append(e)
            e = lhtml.Element('blockquote', {})
            try:
                e.append(
                    lhtml.fromstring(
                        getattr(v, 'descriptionhtml', '<div> </div>')))
            except:
                pass
            cntnr.append(e)
        return lhtml.tostring(cntnr)