def _vs_message(): dest_choices: List[CascadingDropdownChoice] = [ ("all_users", _("All users")), ( "list", _("A list of specific users"), DualListChoice( choices=sorted( [ (uid, u.get("alias", uid)) for uid, u in active_config.multisite_users.items() ], key=lambda x: x[1].lower(), ), allow_empty=False, ), ), # ('contactgroup', _('All members of a contact group')), ("online", _("All online users")), ] return Dictionary( elements=[ ( "text", TextAreaUnicode( title=_("Message"), help=_("Insert the text to be sent to all reciepents."), allow_empty=False, empty_text=_("You need to provide a text."), cols=50, rows=10, ), ), ( "dest", CascadingDropdown( title=_("Send message to"), help=_( "You can send the message to a list of multiple users, which " "can be chosen out of these predefined filters." ), choices=dest_choices, ), ), ( "methods", ListChoice( title=_("Messaging methods"), allow_empty=False, choices=[(k, v["title"]) for k, v in _messaging_methods().items()], default_value=["popup"], ), ), ( "valid_till", Optional( valuespec=AbsoluteDate( include_time=True, label=_("at"), ), title=_("Message expiration"), label=_("Expire message"), help=_( "It is possible to automatically delete messages when the " "configured time is reached. This makes it possible to inform " "users about a scheduled event but suppress the message " "after the event has happened." ), ), ), ], validate=_validate_msg, optional_keys=[], )
def valuespec(self): return Dictionary( elements=[ ( "start", Alternative( title=_("Started"), elements=[ FixedValue( None, totext=_("No scan has been started yet."), ), AbsoluteDate( include_time=True, default_value=0, ), ], ), ), ( "end", Alternative( title=_("Finished"), elements=[ FixedValue( None, totext=_("No scan has finished yet."), ), FixedValue( True, totext="", # currently running ), AbsoluteDate( include_time=True, default_value=0, ), ], ), ), ( "state", Alternative( title=_("State"), elements=[ FixedValue( None, totext="", # Not started or currently running ), FixedValue( True, totext=_("Succeeded"), ), FixedValue( False, totext=_("Failed"), ), ], ), ), ( "output", TextInput(title=_("Output"), ), ), ], title=_("Last Scan Result"), optional_keys=[], default_text=_("No scan performed yet."), )
def _vs_down_to(self): return AbsoluteDate( title=_("Until"), include_time=True, submit_form_name="_down_custom", )
def _audit_log_options(self): object_types: Choices = [ ("", _("All object types")), (None, _("No object type")), ] + [(t.name, t.name) for t in ObjectRefType] return [ ( "object_type", DropdownChoice( title=_("Object type"), choices=object_types, ), ), ( "object_ident", TextInput(title=_("Object"), ), ), ( "user_id", UserSelection( title=_("User"), only_contacts=False, none=_("All users"), ), ), ( "filter_regex", RegExp( title=_("Filter pattern (RegExp)"), mode="infix", ), ), ( "start", CascadingDropdown( title=_("Start log from"), default_value="now", orientation="horizontal", choices=[ ("now", _("Current date")), ("time", _("Specific date"), AbsoluteDate()), ], ), ), ( "display", CascadingDropdown( title=_("Display mode of entries"), default_value="daily", orientation="horizontal", choices=[ ("daily", _("Daily paged display")), ( "number_of_days", _("Number of days from now (single page)"), Integer( minvalue=1, unit=_("days"), default_value=1, ), ), ], ), ), ]
def _vs_down_from(self) -> AbsoluteDate: return AbsoluteDate( title=_("From"), include_time=True, submit_form_name="_down_custom", )