Dialogs

Admin4 sources come with its own copy or xrced, because this editor isn't maintained intensively and somewhat buggy. Admin4's version is known to work, and has been enhanced to support additional Admin4-specific controls.

The access to controls within dialogs is made easier by supporting custom methods which rely on name conventions. This is implemented in the ControlContainer class.

A control's XML name looks like [flag:][flag:]name[-validator], e.g."ldap:must:label=shadowLabel:shadowMax-uint [valParam] [valParam]". The control can be accessed in the following way:

  • ctl=self['shadowMax'] gives a Python object to the control
  • ctl.flags is a list of flags, as extracted from the XML name. In the example, flags is ['ldap', 'must']. Their use is up to the application programmer.
  • ctl.labelCtl is a Python Object, representing the StaticLabel assigned to the control, extracted from the flag "label=<labelName>".
  • self.EnableControls(controlNameList, how) enables or disables the named controls, together with their assigned labels
  • self.shadowMax = 300 will assign the value to the control. The set method observes the type of the control, and will use SetValue/SetLabel/SetSelection or whatever method is needed.
  • intValue=self.shadowMax retrieves the value from the control.The Get methods observe the type of the control, and will use GetValue/GetLabel/GetSelection or whatever method is needed and will convert to the expected type.
  • self.SetUnchanged() iterates all named controls and will remember the current value for change detection, which is performed by
  • self.GetChanged()
  • If a validator is specified in the XML name, it will be applied when editing the field. Currently, there are validators for int, uint, bool, timestamp (ISO-format), ts_int (UNIX-timestamp) and mac (MAC-Address in the form xx:xx:xx:xx:xx:xx).
  • The validator may have additional params, which are separated by spaces:
    • int, uint have an optional length parameter (e.g. used in modLdap/ShadowAccount.xrc:uidNumber)
    • bool can have a true value and a false value that is used in Python for a set/unset checkbox (e.g. in modLdap/SambaDomain.xrc:refuseLabel:null:sambaRefuseMachinePwdChange to return int 1/0 instead of bool True/False)