コード例 #1
0
ファイル: Mailbox.py プロジェクト: rogeriofalcone/admin4
    def GetProperties(self):
        if not self.properties:
            self.RefreshVolatile(True)

            self.properties = [(xlt("Name"), self.name),
                               (xlt("Mailbox path"), self.mailboxPath),
                               (xlt("Flags"), ", ".join(self.flags))]

            if self.CanSelect():
                self.AddProperty(xlt("My rights"), self.myrights)
            self.AddProperty(xlt("Comment"), self.annotations.Get('/comment'))

            lu = self.annotations.Get('/lastupdate')
            if lu:
                self.AddProperty(xlt("Last update"),
                                 prettyDate(GetImapDate(lu)))


# need that?
#      chk=(self.annotations.Get('/check') ==  "true")
#      self.AddYesNoProperty(xlt("Check"), chk)
#      if chk:
#        self.AddProperty(xlt("Check period"), self.annotations.Get('/checkperiod'))

            sz = self.annotations.Get('/size')
            if sz != None:
                self.AddSizeProperty(xlt("Size"), sz)

            squat = self.annotations.Get(squatAnnotation)
            if squat != None:
                self.AddProperty(xlt("Squat"), squat)
            if self.quota:
                items = []
                for resource, quota in self.quota.items():
                    root, filled, total = quota
                    if root == self.mailboxPath:
                        items.append(
                            xlt("%s: %s of %s") %
                            (resource, floatToSize(
                                filled, 1024), floatToSize(total, 1024)))
                    else:
                        items.append(
                            xlt("%s: %s of %s  (root=%s)") %
                            (resource, floatToSize(
                                filled, 1024), floatToSize(total, 1024), root))
                self.AddChildrenProperty(items, xlt("Quota"), -1)
            else:
                self.AddProperty(xlt("Quota"), xlt("none"))

            if self.acl:
                imageid = self.GetImageId("User")
                for user, acl in self.acl.items():
                    self.properties.append((user, acl, imageid))

        return self.properties
コード例 #2
0
ファイル: ServerPages.py プロジェクト: rogeriofalcone/admin4
 def valFmt(val, unit):
     if not unit:
         return val
     ul = unit.lower()
     if ul == "8kb":
         return floatToSize(int(val) * 8192)
     val = "%s %s" % (val, unit)
     if ul in ['kb', 'mb', 'gb']:
         return floatToSize(sizeToFloat(val[:-1] + "iB"))
     elif ul in ['ms', 's', 'h', 'min']:
         return floatToTime(timeToFloat(val))
     else:
         return val
コード例 #3
0
ファイル: ServerPages.py プロジェクト: ed00m/admin4
 def valFmt(val, unit):
   if not unit:
     return val
   ul=unit.lower()
   if ul == "8kb":
     return floatToSize(int(val)*8192)
   val="%s %s" % (val, unit)
   if ul in ['kb', 'mb', 'gb']:
     return floatToSize(sizeToFloat(val[:-1] + "iB"))
   elif ul in ['ms', 's', 'h', 'min']:
     return floatToTime(timeToFloat(val))
   else:
     return val
コード例 #4
0
ファイル: Mailbox.py プロジェクト: andreas-p/admin4
  def GetProperties(self):
    if not self.properties:
      self.RefreshVolatile(True)
      
      self.properties=[
                       ( xlt("Name"), self.name),
                       ( xlt("Mailbox path"), self.mailboxPath),
                       ( xlt("Flags"), ", ".join(self.flags))
                       ]

      if self.CanSelect():
        self.AddProperty(xlt("My rights"), self.myrights)
      self.AddProperty(xlt("Comment"), self.annotations.Get('/comment'))

      lu=self.annotations.Get('/lastupdate')
      if lu:
        self.AddProperty(xlt("Last update"), prettyDate(GetImapDate(lu)))
# need that?
#      chk=(self.annotations.Get('/check') ==  "true")
#      self.AddYesNoProperty(xlt("Check"), chk)
#      if chk:
#        self.AddProperty(xlt("Check period"), self.annotations.Get('/checkperiod'))

      sz=self.annotations.Get('/size')
      if sz != None:
        self.AddSizeProperty(xlt("Size"), sz)
        
      squat=self.annotations.Get(squatAnnotation)
      if squat != None:
        self.AddProperty(xlt("Squat"), squat)
      if self.quota:
        items=[]
        for resource, quota in self.quota.items():
          root, filled, total = quota
          if root == self.mailboxPath:
            items.append(xlt("%s: %s of %s") % (resource, floatToSize(filled, 1024), floatToSize(total, 1024)))
          else:
            items.append(xlt("%s: %s of %s  (root=%s)") % (resource, floatToSize(filled, 1024), floatToSize(total, 1024), root) )
        self.AddChildrenProperty(items, xlt("Quota"), -1)
      else:
        self.AddProperty(xlt("Quota"), xlt("none"))

      if self.acl:
        imageid=self.GetImageId("User")
        for user, acl in self.acl.items():
          self.properties.append((user, acl, imageid))

    return self.properties
コード例 #5
0
 def AddSizeProperty(self, txt, value, imageid=-1):
     if not isinstance(value, float):
         value = sizeToFloat(value)
     self.AddProperty(txt, floatToSize(value), imageid)
コード例 #6
0
ファイル: node.py プロジェクト: andreas-p/admin4
 def AddSizeProperty(self, txt, value, imageid=-1):
   if not isinstance(value, float):
     value=sizeToFloat(value)
   self.AddProperty(txt, floatToSize(value), imageid)