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], ]
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)
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)
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
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
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')], ']', ]
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')], ']', ]
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
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)