Esempio n. 1
0
def toHtml(arxFiles, path):
    html = HtmlWriter(os.path.join(path, "files.html"))
    html.open()

    keys = sorted(
        set(
            list(arxFiles.entities.data.keys()) +
            list(arxFiles.models.data.keys())))

    html.add("<table>")
    html.add("<tr>")
    html.add("<th>Key</th>")
    html.add("<th>Instances</th>")
    html.add("<th>Model</th>")
    html.add("<th>Tweaks</th>")
    html.add("</tr>")

    for key in keys:
        html.add("<tr>")
        html.add("<td>" + '/'.join(key) + "</td>")

        if key in arxFiles.entities.data:
            e = arxFiles.entities.data[key]
            html.add("<td>" + str(len(e.instances)) + "</td>")
        else:
            html.add("<td></td>")

        if key in arxFiles.models.data:
            m = arxFiles.models.data[key]
            html.add("<td>" + m.model + "</td>")
            html.add("<td>" + str(len(m.tweaks)) + "</td>")
        else:
            html.add("<td></td>")
            html.add("<td></td>")

        html.add("</tr>")
    html.add("</table>")

    html.add("<hr>")

    html.add("Dangling files:")
    html.add("<ul>")

    for h in arxFiles.handlers:
        html.add("<li>")
        html.add(str(h.__class__.__name__))
        html.add("<ul>")
        html.li(h.danglingPaths)
        html.add("</ul>")
        html.add("</li>")

    html.li(arxFiles.danglingPaths)
    html.add("</ul>")

    html.close()
Esempio n. 2
0
def toHtml(arxFiles, path):
    html = HtmlWriter(os.path.join(path, "files.html"))
    html.open()

    keys = sorted(set(list(arxFiles.entities.data.keys()) + list(arxFiles.models.data.keys())))

    html.add("<table>")
    html.add("<tr>")
    html.add("<th>Key</th>")
    html.add("<th>Instances</th>")
    html.add("<th>Model</th>")
    html.add("<th>Tweaks</th>")
    html.add("</tr>")

    for key in keys:
        html.add("<tr>")
        html.add("<td>" + "/".join(key) + "</td>")

        if key in arxFiles.entities.data:
            e = arxFiles.entities.data[key]
            html.add("<td>" + str(len(e.instances)) + "</td>")
        else:
            html.add("<td></td>")

        if key in arxFiles.models.data:
            m = arxFiles.models.data[key]
            html.add("<td>" + m.model + "</td>")
            html.add("<td>" + str(len(m.tweaks)) + "</td>")
        else:
            html.add("<td></td>")
            html.add("<td></td>")

        html.add("</tr>")
    html.add("</table>")

    html.add("<hr>")

    html.add("Dangling files:")
    html.add("<ul>")

    for h in arxFiles.handlers:
        html.add("<li>")
        html.add(str(h.__class__.__name__))
        html.add("<ul>")
        html.li(h.danglingPaths)
        html.add("</ul>")
        html.add("</li>")

    html.li(arxFiles.danglingPaths)
    html.add("</ul>")

    html.close()
Esempio n. 3
0
def html_page(title, *content, **arguments):
    head = html.head(
        html.link(rel="shortcut icon", href=config["favicon"]),
        html.title("{} - {}".format(title, config["title"])),
        html.style(style),
    )
    nav = html.nav(
        html.ul(
            html.li(html.a("⚗", href=html.absolute())),
            html.li(html.a("Reviews", href=html.absolute("reviews"))),
            html.li(html.a("Commits", href=html.absolute("commits", repo.head.ref.name))),
            html.li(html.a("Tree", href=html.absolute("tree", repo.head.ref.name))),
            html.li(html.a("Refs", href=html.absolute("refs"))),
        )
    )
    return http.Html(html.html(head, html.body(*((nav,) + content + (html.script(script),)), **arguments)))
Esempio n. 4
0
def main_menu_items():
    """Returns the main menu."""

    def assign_defaults(name,title,url,group=[]):
        return (name,title,url,group)

    links = []
    visible_items = []
    static_links = [assign_defaults(*item) for item in tools.get_menu()]

    for (name,title,url,group) in static_links:
        if group==[] or [item for item in group if item in user.groups]:
            selector = (len(route)>1 and route[0]=='content' and route[1]==name or len(route) and route[0]==name) and 'id="current"' or ''
            links.append('<a href="%s" %s>%s</a>' % (url_for(url), selector, title))
            visible_items.append(name)

    visible_items.extend(['content','login'])

    if user.is_developer:
        current_app = route[0]
        if not current_app in visible_items:
            if visible_items[0] in ['index','home']:
                pos = 1
            else:
                pos = 0
            url = '<a href="%s" id="current">%s</a>' % (url_for('/'+current_app),system.app.title)
            links.insert(pos, url)

    return html.li(links)
Esempio n. 5
0
def system_menu_items():
    """Returns the system menu."""

    def title_of(app):
        return manager.apps[app].title

    return html.li(
        [link_to(title_of(app), "/" + app) for app in manager.get_system_app_names() if manager.apps[app].visible]
    )
Esempio n. 6
0
def system_menu_items():
    """Returns the system menu."""
    def title_of(app):
        return manager.apps[app].title
    return html.li([link_to(title_of(app),'/'+app) for app in manager.get_system_app_names() if manager.apps[app].visible])
Esempio n. 7
0
def review_to_html_summary(r):
    hexsha, review = r
    commits = html.ul(*map(lambda c: html.li(*commit_to_html(repo.commit(c))), review["includedCommits"]))
    return html.div(html.h1(html.a(hexsha[0:12], href=html.absolute("review", hexsha))), commits, **{"class": "review"})