def __init__(self, row): self.actionid = row.actionid url = "show.action.%d" % self.actionid self.anchor = Anchor(url, row.subject) # element = TitleTable(self.anchor) element = SubjectTable(self.anchor, row.action, row.author, row.posted) element.setAttribute("width", "100%") element.setAttribute("border", "0") url = "new.action.%d" % self.actionid ListItem.__init__(self, element) self.appendChild(Anchor(url, " (respond)"))
def set_trait(self, trait): self.clear_body() self.trait.set_trait(trait) title = SimpleTitleElement('Trait: %s' % trait, bgcolor='IndianRed', width='100%') self.body.appendChild(title) self.body.appendChild(HR()) plist = UnorderedList() parents = self.trait.parents(trait=trait) parent_section = SectionTitle('Parents') parent_section.create_rightside_table() parent_section.append_rightside_anchor( Anchor('hello.there.dude', 'edit')) parent_section.append_rightside_anchor( Anchor('hello.there.dudee', 'edit2')) self.body.appendChild(parent_section) for parent in parents: pp = Anchor('show.parent.%s' % parent, parent) plist.appendChild(ListItem(pp)) self.body.appendChild(plist) #ptitle_anchor = Anchor('edit.packages.%s' % trait, 'Packages') ptitle = SectionTitle('Packages') ptitle_anchor = Anchor('new.package.%s' % trait, '(new)') td = TD() td.appendChild(ptitle_anchor) ptitle.row.appendChild(td) self.body.appendChild(ptitle) rows = self.trait.packages(trait=trait, action=True) self.body.appendChild(PackageTable(rows, bgcolor='SkyBlue3')) ttitle = Anchor('edit.templates.%s' % trait, 'Templates') self.body.appendChild(SectionTitle(ttitle)) rows = self.trait.templates( trait=trait, fields=['package', 'template', 'templatefile']) if len(rows): self.body.appendChild(TemplateTable(rows, bgcolor='DarkSeaGreen3')) self.body.appendChild(SectionTitle('Variables', href='foo.var.ick')) if len(self.trait.environ.keys()): env = TraitEnvTable(trait, self.trait.environ, bgcolor='MistyRose3') self.body.appendChild(env) self.body.appendChild(SectionTitle('Scripts')) slist = UnorderedList() for row in self.trait._scripts.scripts(trait=trait): script = row.script sa = Anchor('show.script.%s' % script, script) slist.appendChild(ListItem(sa)) self.body.appendChild(slist)
def set_profile(self, profile): self.clear_body() self.profile.set_profile(profile) title = SimpleTitleElement('Profile: %s' % profile, bgcolor='IndianRed', width='100%') self.body.appendChild(title) rows = self.profile.get_trait_rows() ptitle = Anchor('edit.traits.%s' % self.profile.current.profile, 'Traits') self.body.appendChild(SectionTitle(ptitle)) #self.body.appendChild(SectionTitle('Traits')) if len(rows): self.body.appendChild(TraitTable(rows, bgcolor='IndianRed1')) vtitle = Anchor('edit.variables.%s' % self.profile.current.profile, 'Variables') self.body.appendChild(SectionTitle(vtitle)) erows = self.profile._env.get_rows() if len(erows): self.body.appendChild(PVarTable(erows, bgcolor='MistyRose2')) etitle = Anchor('edit.families.%s' % self.profile.current.profile, 'Families') self.body.appendChild(SectionTitle(etitle)) families = self.profile.get_families() flist = UnorderedList() for f in families: flist.appendChild(ListItem(f)) self.body.appendChild(flist)
def set_family(self, family): self.family.set_family(family) parents = self.family.parents() erows = self.family.environment_rows() self.clear_body() title = SimpleTitleElement('Family: %s' % family, bgcolor='IndianRed', width='100%') self.body.appendChild(title) self.body.appendChild(SectionTitle('Parents')) if len(parents): plist = UnorderedList() for p in parents: plist.appendChild(ListItem(p)) self.body.appendChild(plist) self.body.appendChild(SectionTitle('Variables')) if len(erows): self.body.appendChild(PVarTable(erows, bgcolor='MistyRose2'))