En faisant un hg add c'est mieux…
This commit is contained in:
parent
2997533aac
commit
943742ed54
56
Brie/brie/controllers/getemails.py
Normal file
56
Brie/brie/controllers/getemails.py
Normal file
@ -0,0 +1,56 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from tg import session
|
||||
from tg.controllers import redirect
|
||||
from tg.decorators import expose, validate
|
||||
|
||||
from brie.config import ldap_config
|
||||
from brie.lib.ldap_helper import *
|
||||
from brie.lib.aurore_helper import *
|
||||
from brie.model.ldap import *
|
||||
|
||||
from brie.controllers import auth
|
||||
from brie.controllers.auth import AuthenticatedBaseController, AuthenticatedRestController
|
||||
|
||||
from operator import itemgetter
|
||||
|
||||
class GetEmailsController(AuthenticatedBaseController):
|
||||
|
||||
@expose("brie.templates.getemails.index")
|
||||
def index(self):
|
||||
residences = []
|
||||
rooms_stats = dict()
|
||||
members_stats = dict()
|
||||
residences_ldap = Residences.get_residences(self.user)
|
||||
for residence_ldap in residences_ldap:
|
||||
residence_dn = residence_ldap.uniqueMember.first()
|
||||
residence_name = residence_ldap.cn.first()
|
||||
residences.append(residence_name)
|
||||
members_stats[residence_name] = CotisationComputes.members_status_from_residence(self.user, residence_dn)
|
||||
members_stats[residence_name]['number_of_cotisation_paid_members'] = len(members_stats[residence_name]['cotisation_paid_members'])
|
||||
members_stats[residence_name]['number_of_cotisation_late_members'] = len(members_stats[residence_name]['cotisation_late_members'])
|
||||
members_stats[residence_name]['number_of_no_cotisation_members'] = len(members_stats[residence_name]['no_cotisation_members'])
|
||||
members_stats[residence_name]['number_of_old_members'] = len(members_stats[residence_name]['old_members'])
|
||||
members_stats[residence_name]['number_of_current_members'] = members_stats[residence_name]['number_of_cotisation_paid_members'] + members_stats[residence_name]['number_of_cotisation_late_members'] + members_stats[residence_name]['number_of_no_cotisation_members']
|
||||
rooms_stats[residence_name] = dict()
|
||||
rooms_stats[residence_name]['number_of_rooms'] = Room.get_number_of_rooms(self.user, residence_dn)
|
||||
rooms_stats[residence_name]['empty_rooms'] = []
|
||||
for room in Room.get_rooms(self.user, residence_dn):
|
||||
if not room.has("x-memberIn"):
|
||||
rooms_stats[residence_name]['empty_rooms'].append(room)
|
||||
|
||||
residence = None
|
||||
if self.user is not None:
|
||||
residence = Residences.get_name_by_dn(self.user, self.user.residence_dn)
|
||||
#end if
|
||||
|
||||
return {
|
||||
"user" : self.user,
|
||||
"residence" : residence,
|
||||
"residences" : residences,
|
||||
"rooms_stats" : rooms_stats,
|
||||
"members_stats" : members_stats
|
||||
}
|
||||
#end def
|
||||
#end class
|
||||
|
56
Brie/brie/controllers/stats.py
Normal file
56
Brie/brie/controllers/stats.py
Normal file
@ -0,0 +1,56 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from tg import session
|
||||
from tg.controllers import redirect
|
||||
from tg.decorators import expose, validate
|
||||
|
||||
from brie.config import ldap_config
|
||||
from brie.lib.ldap_helper import *
|
||||
from brie.lib.aurore_helper import *
|
||||
from brie.model.ldap import *
|
||||
|
||||
from brie.controllers import auth
|
||||
from brie.controllers.auth import AuthenticatedBaseController, AuthenticatedRestController
|
||||
|
||||
from operator import itemgetter
|
||||
|
||||
class StatsController(AuthenticatedBaseController):
|
||||
|
||||
@expose("brie.templates.stats.index")
|
||||
def index(self):
|
||||
residences = []
|
||||
rooms_stats = dict()
|
||||
members_stats = dict()
|
||||
residences_ldap = Residences.get_residences(self.user)
|
||||
for residence_ldap in residences_ldap:
|
||||
residence_dn = residence_ldap.uniqueMember.first()
|
||||
residence_name = residence_ldap.cn.first()
|
||||
residences.append(residence_name)
|
||||
members_stats[residence_name] = CotisationComputes.members_status_from_residence(self.user, residence_dn)
|
||||
members_stats[residence_name]['number_of_cotisation_paid_members'] = len(members_stats[residence_name]['cotisation_paid_members'])
|
||||
members_stats[residence_name]['number_of_cotisation_late_members'] = len(members_stats[residence_name]['cotisation_late_members'])
|
||||
members_stats[residence_name]['number_of_no_cotisation_members'] = len(members_stats[residence_name]['no_cotisation_members'])
|
||||
members_stats[residence_name]['number_of_old_members'] = len(members_stats[residence_name]['old_members'])
|
||||
members_stats[residence_name]['number_of_current_members'] = members_stats[residence_name]['number_of_cotisation_paid_members'] + members_stats[residence_name]['number_of_cotisation_late_members'] + members_stats[residence_name]['number_of_no_cotisation_members']
|
||||
rooms_stats[residence_name] = dict()
|
||||
rooms_stats[residence_name]['number_of_rooms'] = Room.get_number_of_rooms(self.user, residence_dn)
|
||||
rooms_stats[residence_name]['empty_rooms'] = []
|
||||
for room in Room.get_rooms(self.user, residence_dn):
|
||||
if not room.has("x-memberIn"):
|
||||
rooms_stats[residence_name]['empty_rooms'].append(room)
|
||||
|
||||
residence = None
|
||||
if self.user is not None:
|
||||
residence = Residences.get_name_by_dn(self.user, self.user.residence_dn)
|
||||
#end if
|
||||
|
||||
return {
|
||||
"user" : self.user,
|
||||
"residence" : residence,
|
||||
"residences" : residences,
|
||||
"rooms_stats" : rooms_stats,
|
||||
"members_stats" : members_stats
|
||||
}
|
||||
#end def
|
||||
#end class
|
||||
|
0
Brie/brie/templates/getemails/__init__.py
Normal file
0
Brie/brie/templates/getemails/__init__.py
Normal file
47
Brie/brie/templates/getemails/index.html
Normal file
47
Brie/brie/templates/getemails/index.html
Normal file
@ -0,0 +1,47 @@
|
||||
<html xmlns:py="http://genshi.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="/css/common.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/show.css" />
|
||||
<xi:include href="common-css-header.html" />
|
||||
</head>
|
||||
<body>
|
||||
<xi:include href="navbar.html" />
|
||||
<div class="section" >
|
||||
<span class="section_name show_section_name">Adresses mails des adhérents de ${residence}</span>
|
||||
<!--
|
||||
<div>
|
||||
<div class="room_number ok_color">${"%03d" % members_stats[residence]['number_of_cotisation_paid_members']}</div>
|
||||
<span>Cotisations à jour</span>
|
||||
</div>
|
||||
<div>
|
||||
<div class="room_number non_certif_color">${"%03d" % members_stats[residence]['number_of_cotisation_late_members']}</div>
|
||||
<span>Cotisations en retard</span>
|
||||
</div>
|
||||
<div>
|
||||
<div class="room_number non_paye_color">${"%03d" % members_stats[residence]['number_of_no_cotisation_members']}</div>
|
||||
<span>Sans cotisations</span>
|
||||
</div>
|
||||
<div>
|
||||
<div class="room_number vide_color">${"%03d" % members_stats[residence]['number_of_current_members']}</div>
|
||||
<span>Adhérents actuels</span>
|
||||
<form action="/getemails/" method="post" class="inline_block">
|
||||
<input type="hidden" name="residence" value="${residence}"/>
|
||||
<input type="submit" value="Récupérer toutes les adresses mails" class="button"/>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<div class="room_number vide_color">${"%03d" % members_stats[residence]['number_of_old_members']}</div>
|
||||
<span>Anciens membres</span>
|
||||
</div>
|
||||
<div>
|
||||
<div class="room_number vide_color">${"%03d" % rooms_stats[residence]['number_of_rooms']}</div>
|
||||
<span>Pièces</span>
|
||||
</div>
|
||||
<div>
|
||||
<div class="room_number vide_color">${"%03d" % len(rooms_stats[residence]['empty_rooms'])}</div>
|
||||
<span>Pièces vides</span>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
0
Brie/brie/templates/stats/__init__.py
Normal file
0
Brie/brie/templates/stats/__init__.py
Normal file
81
Brie/brie/templates/stats/index.html
Normal file
81
Brie/brie/templates/stats/index.html
Normal file
@ -0,0 +1,81 @@
|
||||
<html xmlns:py="http://genshi.edgewall.org/" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="/css/common.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/css/rooms.css" />
|
||||
<xi:include href="common-css-header.html" />
|
||||
</head>
|
||||
<body>
|
||||
<xi:include href="navbar.html" />
|
||||
<div class="section" >
|
||||
<div py:for="residence in residences">
|
||||
<span class="section_name show_section_name">${residence}</span>
|
||||
<div>
|
||||
<div>
|
||||
<div class="room_number ok_color">${"%03d" % members_stats[residence]['number_of_cotisation_paid_members']}</div>
|
||||
<span>Cotisations à jour</span>
|
||||
</div>
|
||||
<div>
|
||||
<div class="room_number non_certif_color">${"%03d" % members_stats[residence]['number_of_cotisation_late_members']}</div>
|
||||
<span>Cotisations en retard</span>
|
||||
</div>
|
||||
<div>
|
||||
<div class="room_number non_paye_color">${"%03d" % members_stats[residence]['number_of_no_cotisation_members']}</div>
|
||||
<span>Sans cotisations</span>
|
||||
</div>
|
||||
<div>
|
||||
<div class="room_number vide_color">${"%03d" % members_stats[residence]['number_of_current_members']}</div>
|
||||
<span>Adhérents actuels</span>
|
||||
<form action="/getemails/" method="post" class="inline_block">
|
||||
<input type="hidden" name="residence" value="${residence}"/>
|
||||
<input type="submit" value="Récupérer toutes les adresses mails" class="button"/>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<div class="room_number vide_color">${"%03d" % members_stats[residence]['number_of_old_members']}</div>
|
||||
<span>Anciens membres</span>
|
||||
</div>
|
||||
<div>
|
||||
<div class="room_number vide_color">${"%03d" % rooms_stats[residence]['number_of_rooms']}</div>
|
||||
<span>Pièces</span>
|
||||
</div>
|
||||
<div>
|
||||
<div class="room_number vide_color">${"%03d" % len(rooms_stats[residence]['empty_rooms'])}</div>
|
||||
<span>Pièces vides</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<span class="section_name show_section_name">GROUPES</span>
|
||||
<div py:for="group in groups_ldap">
|
||||
<span class="item_name">${group.cn.first()}</span>
|
||||
<div class="inline_block param_block" py:choose="group.uniqueMember">
|
||||
<py:when test="None">
|
||||
<span class="enum_block">aucun membre</span>
|
||||
</py:when>
|
||||
<py:otherwise>
|
||||
<span class="enum_block" py:for="member in group.uniqueMember.values">${member} <a class="link_button" href="groups/delete_member/${group.cn.first()}/${member}">retirer</a></span>
|
||||
</py:otherwise>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div>
|
||||
<span class="item_name">ajouter</span>
|
||||
<form class="inline_block" method="post" action="groups/add_member/">
|
||||
<select name="user_dn">
|
||||
<option py:for="user in all_users" value="${user.dn}">${user.cn.first()}</option>
|
||||
</select>
|
||||
à
|
||||
<select name="group_cn">
|
||||
<option py:for="group in groups_ldap" value="${group.cn.first()}">
|
||||
${group.cn.first()}
|
||||
</option>
|
||||
</select>
|
||||
<input type="submit" class="button" value="GO"></input>
|
||||
</form>
|
||||
</div> -->
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user