summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--PcfAnnuaire.py36
-rw-r--r--skins/pcfannuaire/pcfannuaire_phones.pt2
-rw-r--r--skins/pcfannuaire/pcfannuaire_photos.pt4
-rw-r--r--skins/pcfannuaire/pcfannuaire_view.pt14
4 files changed, 40 insertions, 16 deletions
diff --git a/PcfAnnuaire.py b/PcfAnnuaire.py
index 6e97dd1..f93d4d7 100644
--- a/PcfAnnuaire.py
+++ b/PcfAnnuaire.py
@@ -30,6 +30,7 @@ class PcfAnnuaireEntry:
self.directory = directory
self._debug_entry = ldap_entry
self.debug_entry = ldap_entry
+ self.ldap_entry = ldap_entry
self.dn = ldap_dn
self.cn = get_attr('cn')
self.sn = get_attr('sn')
@@ -66,13 +67,26 @@ class PcfAnnuaireEntry:
self.manager_url = urllib.quote(self.manager)
self.manager_name = self.manager.split('=')[1].split(',')[0]
+ def all_managers(self):
+ service_managers = []
+ if self.manager:
+ manager = self.directory.getPerson(self.manager)
+ service_managers = self.directory.getServiceManager(self.service)
+ if self.manager in [x.dn for x in service_managers]:
+ return [manager] + [x for x in service_managers if x.dn != self.manager]
+ else:
+ return [manager]
+
+ def all_manager_couples(self):
+ return [(urllib.quote(x.dn), x.cn) for x in self.all_managers()]
+
def __str__(self):
return urllib.quote(self.dn)
def has_a_chief(self):
if not self.manager:
return False
- if self.service == 'Service du Greffier':
+ if self.service in ('Service du Greffier', 'Secrétariat général'):
return True
sec_gen = self.directory.getSecretaireGeneral()
if self.manager == sec_gen.dn:
@@ -162,22 +176,22 @@ class PcfAnnuaire(BaseContent):
def getServiceManager(self, service):
sec_gen = self.getSecretaireGeneral()
- if service == 'Service du Greffier':
- return sec_gen
+ if service in ('Service du Greffier', 'Secrétariat général'):
+ return [sec_gen]
try:
- return [x for x in self.getEntries() if x.service == service and x.manager == sec_gen.dn][0]
+ return [x for x in self.getEntries() if x.service == service and x.manager == sec_gen.dn]
except IndexError:
return None
def getServiceNonManagers(self, service):
- service_manager = self.getServiceManager(service)
+ service_managers_dn = [x.dn for x in self.getServiceManager(service)]
entries = [x for x in self.getEntries() if \
- x.service == service and x.manager == service_manager.dn and x.division in (None, ' ')]
+ x.service == service and x.manager in service_managers_dn and x.division in (None, ' ')]
return sorted(entries, key=get_sort_key)
def getCellules(self, service):
- service_manager = self.getServiceManager(service)
- entries = [x for x in self.getEntries() if x.manager == service_manager.dn]
+ service_managers_dn = [x.dn for x in self.getServiceManager(service)]
+ entries = [x for x in self.getEntries() if x.manager in service_managers_dn]
cells = {}
for entry in entries:
if entry.division and entry.division != ' ':
@@ -186,9 +200,11 @@ class PcfAnnuaire(BaseContent):
return cells
def getCelluleManagers(self, service, cellule):
- service_manager = self.getServiceManager(service)
+ if cellule == 'Secrétariat général':
+ return [self.getSecretaireGeneral()]
+ service_managers_dn = [x.dn for x in self.getServiceManager(service)]
entries = [x for x in self.getEntries() if \
- x.service == service and x.division == cellule and x.manager == service_manager.dn]
+ x.service == service and x.division == cellule and x.manager in service_managers_dn]
return sorted(entries, key=get_sort_key)
def getCellulePeople(self, service, cellule):
diff --git a/skins/pcfannuaire/pcfannuaire_phones.pt b/skins/pcfannuaire/pcfannuaire_phones.pt
index a8d0651..a2ab8bd 100644
--- a/skins/pcfannuaire/pcfannuaire_phones.pt
+++ b/skins/pcfannuaire/pcfannuaire_phones.pt
@@ -38,7 +38,9 @@
<table id="phone-numbers">
<tr tal:repeat="entry python: context.getEntriesWithPhone()">
<td>
+ <a tal:attributes="href string:?person=${entry}">
<span tal:replace="entry/displayName">displayName</span>
+ </a>
</td>
<td class="col-phone">
<span tal:replace="entry/shortTelephoneNumber">000</span>
diff --git a/skins/pcfannuaire/pcfannuaire_photos.pt b/skins/pcfannuaire/pcfannuaire_photos.pt
index 1aadc21..d0acaf9 100644
--- a/skins/pcfannuaire/pcfannuaire_photos.pt
+++ b/skins/pcfannuaire/pcfannuaire_photos.pt
@@ -38,8 +38,8 @@
<div id="photos">
<div tal:repeat="entry python: context.getEntries()" class="photo">
<a tal:attributes="href string:?person=${entry}">
- <img tal:attributes="src string:/intranet/static/photos/${entry/samaccountname}.jpg" width="130" height="117" />
- <span><span tal:replace="entry/displayName">displayName</span></span></a>
+ <img tal:attributes="src string:/intranet/static/photos/${entry/samaccountname}.jpg" width="100" height="117" />
+ <span><br><span tal:replace="entry/displayName">displayName</span></span></a>
</div>
</div>
diff --git a/skins/pcfannuaire/pcfannuaire_view.pt b/skins/pcfannuaire/pcfannuaire_view.pt
index 8825913..2303a16 100644
--- a/skins/pcfannuaire/pcfannuaire_view.pt
+++ b/skins/pcfannuaire/pcfannuaire_view.pt
@@ -59,7 +59,7 @@
<div tal:condition="python: (service and not cellule)">
<h2 tal:content="python: service">service name</h2>
<ul>
- <li tal:repeat="entry python: [context.getServiceManager(service)]">
+ <li tal:repeat="entry python: context.getServiceManager(service)">
<a tal:attributes="href string:?person=${entry}">
<span tal:replace="entry/displayName">displayName</span>
</a>
@@ -85,8 +85,9 @@
</div>
<div tal:condition="python: (service and cellule)">
- <h2><span tal:content="python: service">service name</span> -
- <span tal:content="python: cellule">cellule name</span></h2>
+ <h2><span tal:content="python: service">service name</span>
+<span tal:condition="python: service != cellule"> -
+ <span tal:content="python: cellule">cellule name</span></span></h2>
<ul>
<li tal:repeat="entry python: context.getCelluleManagers(service, cellule)">
<a tal:attributes="href string:?person=${entry}">
@@ -135,7 +136,12 @@ img.photo {
<li tal:condition="entry/email">Courriel : <a tal:attributes="href string:mailto:${entry/email}" tal:content="entry/email"></a></li>
<li tal:condition="entry/service">Service : <a tal:attributes="href string:?service=${entry/service}"><span tal:replace="entry/service"></span></a></li>
<li tal:condition="entry/division">Cellule : <a tal:attributes="href string:?service=${entry/service}&cellule=${entry/division}"><span tal:replace="entry/division"></span></a></li>
- <li tal:condition="entry/has_a_chief">Responsable : <a tal:attributes="href string:?person=${entry/manager_url}" tal:content="entry/manager_name"></a></li>
+ <li tal:condition="entry/has_a_chief">Responsable(s) :
+ <span tal:repeat="manager_couple entry/all_manager_couples">
+ <a tal:attributes="href python: '?person=' + manager_couple[0]" tal:content="python: manager_couple[1]">plop</a>
+ <span tal:condition="not: repeat/manager_couple/end">, </span>
+ </span>
+ </li>
</ul>
</div>
</div>