コード例 #1
0
ファイル: edit.py プロジェクト: KenMacD/ldaptor
    def render_status(self, context, data):
        try:
            obj = context.locate(inevow.IHand)
        except KeyError:
            return context.tag.clear()

        if not isinstance(obj, EditStatus):
            return context.tag.clear()[obj]

        u=url.URL.fromContext(context)
        u=u.parentdir().parentdir().clear()

        return context.tag.clear()[
            _("Edited "),
            tags.a(href=u.parentdir()
                   .child(obj.entry.dn)
                   .child("search"))[obj.entry.dn],
            _(" successfully. "),

            # TODO share implementation with entryLinks
            '[',
            tags.a(href=u.sibling('move').child(uriQuote(obj.entry.dn)))[_('move')],
            '|',
            tags.a(href=u.sibling('delete').child(uriQuote(obj.entry.dn)))[_('delete')],
            '|',
            tags.a(href=u.sibling('change_password').child(uriQuote(obj.entry.dn)))[_('change password')],
            ']',

            tags.p[obj.changes],

            ]
コード例 #2
0
ファイル: search.py プロジェクト: norox/ldaptor
 def render_entryLinks(self, ctx, data):
     u = url.URL.fromContext(ctx).parentdir().clear()
     l = [
         (u.sibling("edit").child(uriQuote(data)), _("edit")),
         (u.sibling("move").child(uriQuote(data)), _("move")),
         (u.sibling("delete").child(uriQuote(data)), _("delete")),
         (u.sibling("change_password").child(uriQuote(data)), _("change password")),
     ]
     return self.render_sequence(ctx, l)
コード例 #3
0
ファイル: search.py プロジェクト: Jbran77/ldaptor
 def render_entryLinks(self, ctx, data):
     u = url.URL.fromContext(ctx).parentdir().clear()
     l = [ (u.sibling('edit').child(uriQuote(data)),
            _('edit')),
           (u.sibling('move').child(uriQuote(data)),
            _('move')),
           (u.sibling('delete').child(uriQuote(data)),
            _('delete')),
           (u.sibling('change_password').child(uriQuote(data)),
            _('change password')),
           ]
     return self.render_sequence(ctx, l)
コード例 #4
0
ファイル: search.py プロジェクト: norox/ldaptor
    def data_navilink(self, context, data):
        cfg = context.locate(interfaces.ILDAPConfig)
        dn = iwebui.ICurrentDN(context)

        r = []
        while dn != distinguishedname.DistinguishedName(stringValue=""):  # TODO and while inside base?
            firstPart = dn.split()[0]
            r.append(("../../%s" % uriQuote(str(dn)), str(firstPart)))
            dn = dn.up()
        return r
コード例 #5
0
ファイル: search.py プロジェクト: Jbran77/ldaptor
    def data_navilink(self, context, data):
        cfg = context.locate(interfaces.ILDAPConfig)
        dn = iwebui.ICurrentDN(context)

        r=[]
        while dn!=distinguishedname.DistinguishedName(stringValue=''): #TODO and while inside base?
            firstPart=dn.split()[0]
            r.append(('../../%s' % uriQuote(str(dn)),
                      str(firstPart)))
            dn=dn.up()
        return r
コード例 #6
0
ファイル: add.py プロジェクト: tubaman/ldaptor
    def render_status(self, context, data):
        try:
            obj = context.locate(inevow.IHand)
        except KeyError:
            return context.tag.clear()

        e = interfaces.ILDAPEntry(obj, None)
        if e is not None:
            status = AddStatus(entry=e)
        else:
            status = IAddStatus(obj, None)
            if status is None:
                return context.tag.clear()[obj]

        e = status.entry
        u=url.URL.fromContext(context)
        u=u.parentdir().parentdir().parentdir().clear()

        msg = [
            _("Added "),
            tags.a(href=u.parentdir().child(e.dn).child("search"))[e.dn],
            ]

        if status.password is not None:
            msg.extend([_(' with password '), status.password])

        return context.tag.clear()[
            msg,
            ' ',

            # TODO share implementation with entryLinks
            '[',
            tags.a(href=u.sibling('edit').child(uriQuote(e.dn)))[_('edit')],
            '|',
            tags.a(href=u.sibling('move').child(uriQuote(e.dn)))[_('move')],
            '|',
            tags.a(href=u.sibling('delete').child(uriQuote(e.dn)))[_('delete')],
            '|',
            tags.a(href=u.sibling('change_password').child(uriQuote(e.dn)))[_('change password')],
            ']',
            ]
コード例 #7
0
    def render_status(self, context, data):
        try:
            obj = context.locate(inevow.IHand)
        except KeyError:
            return context.tag.clear()

        e = interfaces.ILDAPEntry(obj, None)
        if e is not None:
            status = AddStatus(entry=e)
        else:
            status = IAddStatus(obj, None)
            if status is None:
                return context.tag.clear()[obj]

        e = status.entry
        u = url.URL.fromContext(context)
        u = u.parentdir().parentdir().parentdir().clear()

        msg = [
            _("Added "),
            tags.a(href=u.parentdir().child(e.dn).child("search"))[e.dn],
        ]

        if status.password is not None:
            msg.extend([_(' with password '), status.password])

        return context.tag.clear(
        )[msg, ' ',

          # TODO share implementation with entryLinks
          '[',
          tags.a(href=u.sibling('edit').child(uriQuote(e.dn)))[_('edit')], '|',
          tags.a(href=u.sibling('move').child(uriQuote(e.dn)))[_('move')], '|',
          tags.a(href=u.sibling('delete').child(uriQuote(e.dn)))[_('delete')],
          '|',
          tags.a(href=u.sibling('change_password').child(uriQuote(e.dn))
                 )[_('change password')], ']', ]
コード例 #8
0
ファイル: edit.py プロジェクト: KenMacD/ldaptor
 def _redirect(r, ctx, newDN):
     request = inevow.IRequest(ctx)
     u = url.URL.fromContext(ctx).curdir()
     u = u.child(uriQuote(newDN))
     request.setComponent(iformless.IRedirectAfterPost, u)
     return r
コード例 #9
0
ファイル: search.py プロジェクト: Jbran77/ldaptor
 def render_mass_change_password(self, ctx, data):
     u = url.URL.fromContext(ctx)
     u = u.parentdir().sibling("mass_change_password")
     u = u.child(uriQuote(data))
     return ctx.tag(href=u)
コード例 #10
0
ファイル: search.py プロジェクト: norox/ldaptor
 def render_mass_change_password(self, ctx, data):
     u = url.URL.fromContext(ctx)
     u = u.parentdir().sibling("mass_change_password")
     u = u.child(uriQuote(data))
     return ctx.tag(href=u)