예제 #1
0
def init_rowselect(selection_key: str) -> None:
    selected = user.get_rowselection(weblib.selection_id(), selection_key)
    selection_properties = {
        "page_id": selection_key,
        "selection_id": weblib.selection_id(),
        "selected_rows": selected,
    }
    html.javascript("cmk.selection.init_rowselect(%s);" %
                    (json.dumps(selection_properties)))
예제 #2
0
def make_checkbox_selection_topic(selection_key: str, is_enabled: bool = True) -> PageMenuTopic:
    is_selected = user.get_rowselection(request.var("selection") or "", selection_key)
    name_selected, name_deselected = make_checkbox_selection_json_text()
    return PageMenuTopic(
        title=_("Selection"),
        entries=[
            PageMenuEntry(
                name="checkbox_selection",
                title=_("Select all checkboxes"),
                icon_name="checkbox" if is_selected else "checked_checkbox",
                item=make_javascript_link("cmk.selection.toggle_all_rows(this.form, %s, %s);" %
                                          (name_selected, name_deselected)),
                is_enabled=is_enabled,
            ),
        ],
    )