summaryrefslogtreecommitdiffstats
path: root/idp/extra/modules/identities_ui.ptl
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@0d.be>2008-03-05 10:50:24 (GMT)
committerFrederic Peters <fpeters@0d.be>2008-03-05 10:50:24 (GMT)
commit8b1896ba3d1092867a51b73d6922d935351d9036 (patch)
tree766edadc9a56f2d781fb49bcc141e9cbee99cc43 /idp/extra/modules/identities_ui.ptl
parentede365339884914fde53407df8afa33b33dc9a1d (diff)
downloadpratic-8b1896ba3d1092867a51b73d6922d935351d9036.zip
pratic-8b1896ba3d1092867a51b73d6922d935351d9036.tar.gz
pratic-8b1896ba3d1092867a51b73d6922d935351d9036.tar.bz2
form to lookup agent by their sirh
Diffstat (limited to 'idp/extra/modules/identities_ui.ptl')
-rw-r--r--idp/extra/modules/identities_ui.ptl37
1 files changed, 36 insertions, 1 deletions
diff --git a/idp/extra/modules/identities_ui.ptl b/idp/extra/modules/identities_ui.ptl
index 8406f16..4e0ae5f 100644
--- a/idp/extra/modules/identities_ui.ptl
+++ b/idp/extra/modules/identities_ui.ptl
@@ -13,6 +13,7 @@ class AgentDirectory(Directory):
_q_exports = ['', 'edit', 'delete', 'disable', 'enable', 'password']
attrs = [
+ ('cdg59agentSirhCode', _('SIRH Code'), {'required': True, 'size': 30}),
('sn', N_('Last Name'), {'required': True, 'size': 30}),
('givenName', N_('First Name'), {'required': True, 'size': 30}),
('cdg59direction', N_('Direction'), {'size': 30}),
@@ -139,7 +140,7 @@ class AgentDirectory(Directory):
class IdentitiesDirectory(Directory):
- _q_exports = ['', 'new']
+ _q_exports = ['', 'new', 'lookup_sirh']
collectivity = None
@@ -158,9 +159,18 @@ class IdentitiesDirectory(Directory):
def _q_index [html] (self):
html_top('identities', _('Identity Management'))
+ get_session().display_message()
+
user = get_session().get_user_object()
if user.is_admin() and not self.collectivity:
# list all collectivities
+
+ form = Form(action = 'lookup_sirh')
+ form.add(StringWidget, 'sirh', title = _('Search on SIRH Code'),
+ size = 10)
+ #form.add_submit('submit', _('Search'))
+ form.render()
+
'<ul>'
for collectivity in directory.get_sorted_collectivities():
'<li><a href="%s/">' % collectivity.ou
@@ -192,6 +202,31 @@ class IdentitiesDirectory(Directory):
'<p>'
'<a href="../">%s</a>' % _('Back')
'</p>'
+
+ def lookup_sirh(self):
+ form = Form(action = 'lookup_sirh')
+ form.add(StringWidget, 'sirh', title = _('Search on SIRH Code'), size = 10,
+ required = True)
+ if not form.is_submitted() or form.has_errors():
+ get_session().message = ('error', _('Error looking up agent'))
+ return redirect('.')
+
+ sirh = form.get_widget('sirh').parse()
+ try:
+ agent = directory.get_agent_by_sirh(sirh)
+ except KeyError:
+ get_session().message = ('error', _('No agent found with this SIRH'))
+ return redirect('.')
+
+ uid, collectivity, foobar = agent.dn.split(',', 2)
+ uid = uid.split('=')[1]
+ collectivity = collectivity.split('=')[1]
+
+ if self.collectivity:
+ return redirect('../%s/%s/' % (collectivity, uid))
+ else:
+ return redirect('%s/%s/' % (collectivity, uid))
+
def new [html] (self):
form = Form(enctype='multipart/form-data')