Beispiel #1
0
def end() -> None:
    global g_header_open
    g_header_open = False
    section_close()
    html.tr(html.render_td('', colspan=2), class_=["bottom"])
    html.close_tbody()
    html.close_table()
Beispiel #2
0
def header(title: str,
           isopen: bool = True,
           table_id: str = "",
           narrow: bool = False,
           css: Optional[str] = None,
           show_more_toggle: bool = False,
           show_more_mode: bool = False) -> None:
    global g_header_open, g_section_open
    if g_header_open:
        end()

    id_ = ensure_str(base64.b64encode(ensure_binary(title)))
    treename = html.form_name or "nform"
    isopen = html.foldable_container_is_open(treename, id_, isopen)

    html.open_table(id_=table_id if table_id else None,
                    class_=[
                        "nform",
                        "narrow" if narrow else None,
                        css if css else None,
                        "open" if isopen else "closed",
                        "more" if show_more_mode else None,
                    ])

    _begin_foldable_nform_container(
        treename=treename,
        id_=id_,
        isopen=isopen,
        title=title,
        show_more_toggle=show_more_toggle,
    )
    html.tr(html.render_td('', colspan=2))
    g_header_open = True
    g_section_open = False
Beispiel #3
0
def end():
    global g_header_open
    g_header_open = False
    if g_section_open:
        html.close_td()
        html.close_tr()
    html.end_foldable_container()
    html.tr(html.render_td('', colspan=2), class_=["bottom"])
    html.close_tbody()
    html.close_table()
Beispiel #4
0
    def show(self) -> None:
        only_sites = snapin_site_choice("mkeventd_performance", get_event_console_site_choices())

        try:
            entries = self._mkeventd_performance_entries(only_sites)
        except Exception as e:
            html.show_error("%s" % e)
            return

        html.open_table(class_=["mkeventd_performance"])
        for _index, left, right in entries:
            html.tr(html.render_td("%s:" % left) + html.render_td(right))
        html.close_table()
Beispiel #5
0
def header(
    title: str,
    isopen: bool = True,
    table_id: str = "",
    narrow: bool = False,
    css: Optional[str] = None,
    show_table_head: bool = True,
    show_more_toggle: bool = False,
    show_more_mode: bool = False,
    help_text: Union[str, HTML, None] = None,
) -> None:
    global g_header_open, g_section_open
    if g_header_open:
        end()

    id_ = base64.b64encode(title.encode()).decode()
    treename = html.form_name or "nform"
    isopen = user.get_tree_state(treename, id_, isopen)
    container_id = foldable_container_id(treename, id_)

    html.open_table(
        id_=table_id if table_id else None,
        class_=[
            "nform",
            "narrow" if narrow else None,
            css if css else None,
            "open" if isopen else "closed",
            "more" if user.get_show_more_setting("foldable_%s" % id_)
            or show_more_mode else None,
        ],
    )

    if show_table_head:
        _table_head(
            treename=treename,
            id_=id_,
            isopen=isopen,
            title=title,
            show_more_toggle=show_more_toggle,
            help_text=help_text,
        )

    html.open_tbody(id_=container_id, class_=["open" if isopen else "closed"])
    html.tr(html.render_td("", colspan=2))
    g_header_open = True
    g_section_open = False
Beispiel #6
0
def header(title, isopen=True, table_id="", narrow=False, css=None):
    # type: (str, bool, str, bool, Optional[str]) -> None
    global g_header_open, g_section_open
    if g_header_open:
        end()

    html.open_table(id_=table_id if table_id else None,
                    class_=["nform", "narrow" if narrow else None, css if css else None])

    html.begin_foldable_container(treename=html.form_name if html.form_name else "nform",
                                  id_=ensure_str(base64.b64encode(ensure_binary(title))),
                                  isopen=isopen,
                                  title=title,
                                  indent="nform")
    html.tr(html.render_td('', colspan=2))
    g_header_open = True
    g_section_open = False
Beispiel #7
0
def header(title, isopen=True, table_id="", narrow=False, css=None):
    global g_header_open, g_section_open
    if g_header_open:
        end()

    html.open_table(id_=table_id if table_id else None,
                    class_=["nform", "narrow" if narrow else None, css if css else None])

    html.begin_foldable_container(
        treename=html.form_name if html.form_name else "nform",
        id_=base64.b64encode(title.encode("utf-8") if isinstance(title, six.text_type) else title),
        isopen=isopen,
        title=title,
        indent="nform")
    html.tr(html.render_td('', colspan=2))
    g_header_open = True
    g_section_open = False
Beispiel #8
0
def space() -> None:
    html.tr(html.render_td('', colspan=2, style="height:15px;"))