Exemplo n.º 1
0
    def editAlias(self, alias=None, *args, **kwargs):
        c = TemplateContext()

        # vary form depending on mode (do that over ajax)
        if alias is None:
            action = "Adding"
            c.mode = "add"

            domains = self.mf.getDomains()
            c.select_domains = []
            for d in domains:
                c.select_domains.append([d.dc, d.dc])

        elif not alias == "":
            try:
                ParamChecker.checkEmail("alias")
            except:
                raise HTTPRedirect("/mails/index")

            action = "Editing"
            c.alias = alias
            c.mode = "edit"
            try:
                alias = self.mf.getAlias(alias)
                mail = ""

                for m in alias.mail:
                    if not mail == "":
                        mail += "\n"
                    if not m == alias.dn_mail:
                        mail += m

                c.mail = mail

                maildrop = ""

                for m in alias.maildrop:
                    if not maildrop == "":
                        maildrop += "\n"
                    if not m == alias.dn_mail and not m in maildrop:
                        maildrop += m

                c.maildrop = maildrop

            except LookupError:
                # @TODO implement better handler
                msg = _("No such alias!")
                return self.index(msg=msg)
        else:
            raise HTTPRedirect("/mails/index")

        c.heading = "{0} alias".format(action)

        return self.render("/mails/editAlias.mako", template_context=c)
Exemplo n.º 2
0
  def editAlias(self, alias=None, *args, **kwargs):
    c = TemplateContext()

    # vary form depending on mode (do that over ajax)
    if alias is None:
      action = 'Adding'
      c.mode = 'add'

      domains = self.mf.getDomains()
      c.select_domains = []
      for d in domains:
        c.select_domains.append([d.dc, d.dc])

    elif not alias == '':
      try:
        ParamChecker.checkEmail('alias')
      except:
        raise HTTPRedirect('/mails/index')

      action = 'Editing'
      c.alias = alias
      c.mode = 'edit'
      try:
        alias = self.mf.getAlias(alias)
        mail = ''

        for m in alias.mail:
          if not mail == '':
            mail += '\n'
          if not m == alias.dn_mail:
            mail += m

        c.mail = mail

        maildrop = ''

        for m in alias.maildrop:
          if not maildrop == '':
            maildrop += '\n'
          if not m == alias.dn_mail and not m in maildrop:
            maildrop += m

        c.maildrop = maildrop

      except LookupError:
        # @TODO implement better handler
        msg = _('No such alias!')
        return self.index(msg=msg)
    else:
      raise HTTPRedirect('/mails/index')

    c.heading = '{0} alias'.format(action)

    return self.render('/mails/editAlias.mako', template_context=c)
Exemplo n.º 3
0
    def addMember(self):
        c = TemplateContext()
        c.heading = _('Add member')
        c.mode = 'add'
        c.groups = []

        return self.render('/members/editMember.mako', template_context=c)
Exemplo n.º 4
0
  def addMember(self):
    c = TemplateContext()
    c.heading = _('Add member')
    c.mode = 'add'
    c.groups = []

    return self.render('/members/editMember.mako', template_context=c)
Exemplo n.º 5
0
    def editMember(self, member_id):
        c = TemplateContext()
        try:
            c.heading = _('Edit member')
            c.member = self.mf.getUser(member_id)
            c.mode = 'edit'

            return self.render('/members/editMember.mako', template_context=c)

        except LookupError:
            print 'No such user !'

        return 'ERROR 4x0'
Exemplo n.º 6
0
  def editMember(self, member_id):
    c = TemplateContext()
    try:
      c.heading = _('Edit member')
      c.member = self.mf.getUser(member_id)
      c.mode = 'edit'

      return self.render('/members/editMember.mako', template_context=c)

    except LookupError:
      print 'No such user !'

    return 'ERROR 4x0'
Exemplo n.º 7
0
  def editDomain(self, domain=None):
    c = TemplateContext()
    # vary form depending on mode (do that over ajax)
    if domain is None:
      action = 'Adding'
      c.mode = 'add'
    else:
      try:
        ParamChecker.checkDomain('domain')
      except:
        return self.index()

      action = 'Editing'
      c.mode = 'edit'
      try:
        c.domain = self.mf.getDomain(domain)
      except LookupError:
        msg = _('No such domain!')
        return self.index(msg=msg)

    c.heading = '%s domain' % (action)

    return self.render('/mails/editDomain.mako', template_context=c)
Exemplo n.º 8
0
    def editDomain(self, domain=None):
        c = TemplateContext()
        # vary form depending on mode (do that over ajax)
        if domain is None:
            action = "Adding"
            c.mode = "add"
        else:
            try:
                ParamChecker.checkDomain("domain")
            except:
                return self.index()

            action = "Editing"
            c.mode = "edit"
            try:
                c.domain = self.mf.getDomain(domain)
            except LookupError:
                msg = _("No such domain!")
                return self.index(msg=msg)

        c.heading = "%s domain" % (action)

        return self.render("/mails/editDomain.mako", template_context=c)