def _begin_foldable_nform_container( treename: str, id_: str, isopen: bool, title: str, show_more_toggle: bool, ) -> bool: isopen = html.foldable_container_is_open(treename, id_, isopen) onclick = html.foldable_container_onclick(treename, id_, fetch_url=None) img_id = html.foldable_container_img_id(treename, id_) container_id = html.foldable_container_id(treename, id_) html.open_thead() html.open_tr(class_="heading") html.open_td(id_="nform.%s.%s" % (treename, id_), onclick=onclick, colspan=2) html.img(id_=img_id, class_=["treeangle", "nform", "open" if isopen else "closed"], src="themes/%s/images/tree_closed.png" % (html.get_theme()), align="absbottom") html.write_text(title) if show_more_toggle: html.more_button("foldable_" + id_, dom_levels_up=4) html.close_td() html.close_tr() html.close_thead() html.open_tbody(id_=container_id, class_=["open" if isopen else "closed"]) return isopen
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_ = ensure_str(base64.b64encode(ensure_binary(title))) treename = html.form_name or "nform" isopen = config.user.get_tree_state(treename, id_, isopen) container_id = html.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 config.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