# Path: wh.py
# def xlt(s): # translate
#   return s
#   t=wx.GetTranslation(s)
#   # if dict set and t == s: log untranslated
#   return t


from SpecificEntry import SpecificEntry
from Entry import Entry
from wh import xlt
import wx, adm
    if self.GetIdFromMax("posixAccount", "gidNumber"):
      self['GenerateGid'].Disable()


  def Check(self):
    ok=SpecificEntry.Check(self)
    
    if self.dialog.HasObjectClass("posixAccount"):
      if not self.uidNumber and self.GetServer().GetIdGeneratorStyle():
        dn=self.GetServer().GetSambaUnixIdPoolDN()
        if not dn:
          if not self.dialog.HasObjectClass("sambaSamAccount"):
            ok=self.dialog.CheckValid(ok, dn, xlt("Need sambaUnixIdPoolDN configured for this server or Samba Account data"))
        
    return ok
  
  
  def OnExpire(self, ev=None):
    if self.shadowAccount:
      self.EnableControls("shadowExpire shadowWarning", self.Expires)
      if not self.Expires:
        self.shadowExpire=99999
        self.shadowWarning=None
    if ev:
      self.dialog.OnCheck()
SpecificEntry.AddClass(ShadowAccount)



class Contact(SpecificEntry):

# Path: wh.py
# def xlt(s): # translate
#   return s
#   t=wx.GetTranslation(s)
#   # if dict set and t == s: log untranslated
#   return t


# Path: modLdap/Posix.py
from SpecificEntry import SpecificEntry
from Entry import Entry
from wh import xlt
import wx, adm

    if self.GetIdFromMax("posixAccount", "gidNumber"):
      self['GenerateGid'].Disable()


  def Check(self):
    ok=SpecificEntry.Check(self)
    
    if self.dialog.HasObjectClass("posixAccount"):
      if not self.uidNumber and self.GetServer().GetIdGeneratorStyle():
        dn=self.GetServer().GetSambaUnixIdPoolDN()
        if not dn:
          if not self.dialog.HasObjectClass("sambaSamAccount"):
            ok=self.dialog.CheckValid(ok, dn, xlt("Need sambaUnixIdPoolDN configured for this server or Samba Account data"))
        
    return ok
  
  
  def OnExpire(self, ev=None):
    if self.shadowAccount:
      self.EnableControls("shadowExpire shadowWarning", self.Expires)
      if not self.Expires:
        self.shadowExpire=99999
        self.shadowWarning=None
    if ev:
      self.dialog.OnCheck()
SpecificEntry.AddClass(ShadowAccount)



class Contact(SpecificEntry):

  name=xlt("Contact")