forked from ScoDoc/ScoDoc
up to 7.24
This commit is contained in:
commit
d84102657f
@ -1313,7 +1313,7 @@ class ZAbsences(
|
|||||||
if with_evals:
|
if with_evals:
|
||||||
a["exams"] = descr_exams(a)
|
a["exams"] = descr_exams(a)
|
||||||
a["datedmy"] = a["jour"].strftime("%d/%m/%Y")
|
a["datedmy"] = a["jour"].strftime("%d/%m/%Y")
|
||||||
a["matin_o"] = int(a["matin"])
|
a["ampm"] = int(a["matin"])
|
||||||
a["matin"] = matin(a["matin"])
|
a["matin"] = matin(a["matin"])
|
||||||
index = a["description"].find(")")
|
index = a["description"].find(")")
|
||||||
if index != -1:
|
if index != -1:
|
||||||
@ -1328,7 +1328,7 @@ class ZAbsences(
|
|||||||
a["justlink"] = "<em>justifier</em>"
|
a["justlink"] = "<em>justifier</em>"
|
||||||
a["_justlink_target"] = (
|
a["_justlink_target"] = (
|
||||||
"doJustifAbsence?etudid=%s&datedebut=%s&datefin=%s&demijournee=%s"
|
"doJustifAbsence?etudid=%s&datedebut=%s&datefin=%s&demijournee=%s"
|
||||||
% (etudid, a["datedmy"], a["datedmy"], a["matin_o"])
|
% (etudid, a["datedmy"], a["datedmy"], a["ampm"])
|
||||||
)
|
)
|
||||||
#
|
#
|
||||||
titles = {
|
titles = {
|
||||||
@ -1340,6 +1340,8 @@ class ZAbsences(
|
|||||||
"motif": "Motif",
|
"motif": "Motif",
|
||||||
}
|
}
|
||||||
columns_ids = ["datedmy", "matin"]
|
columns_ids = ["datedmy", "matin"]
|
||||||
|
if format in ("json", "xml"):
|
||||||
|
columns_ids += ["jour", "ampm"]
|
||||||
if with_evals:
|
if with_evals:
|
||||||
columns_ids.append("exams")
|
columns_ids.append("exams")
|
||||||
|
|
||||||
@ -1433,7 +1435,7 @@ class ZAbsences(
|
|||||||
gr_tit = p + h
|
gr_tit = p + h
|
||||||
|
|
||||||
title = "Etat des absences %s" % gr_tit
|
title = "Etat des absences %s" % gr_tit
|
||||||
if format == "xls" or format == "xml":
|
if format == "xls" or format == "xml" or format == "json":
|
||||||
columns_ids = ["etudid"] + columns_ids
|
columns_ids = ["etudid"] + columns_ids
|
||||||
tab = GenTable(
|
tab = GenTable(
|
||||||
columns_ids=columns_ids,
|
columns_ids=columns_ids,
|
||||||
|
29
ZNotes.py
29
ZNotes.py
@ -191,15 +191,13 @@ class ZNotes(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Impl
|
|||||||
# Affecte aussi cache inscriptions
|
# Affecte aussi cache inscriptions
|
||||||
self.get_formsemestre_inscription_cache().inval_cache(
|
self.get_formsemestre_inscription_cache().inval_cache(
|
||||||
key=formsemestre_id
|
key=formsemestre_id
|
||||||
) # >
|
)
|
||||||
else:
|
else:
|
||||||
self._getNotesCache().inval_cache(
|
self._getNotesCache().inval_cache(
|
||||||
self, formsemestre_id=formsemestre_id, pdfonly=pdfonly
|
self, formsemestre_id=formsemestre_id, pdfonly=pdfonly
|
||||||
) # >
|
)
|
||||||
# Affecte aussi cache inscriptions
|
# Affecte aussi cache inscriptions
|
||||||
self.get_formsemestre_inscription_cache().inval_cache(
|
self.get_formsemestre_inscription_cache().inval_cache(key=formsemestre_id)
|
||||||
key=formsemestre_id
|
|
||||||
) # >
|
|
||||||
|
|
||||||
security.declareProtected(ScoView, "clearcache")
|
security.declareProtected(ScoView, "clearcache")
|
||||||
|
|
||||||
@ -1816,18 +1814,19 @@ class ZNotes(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Impl
|
|||||||
|
|
||||||
security.declareProtected(ScoView, "do_formsemestre_inscription_listinscrits")
|
security.declareProtected(ScoView, "do_formsemestre_inscription_listinscrits")
|
||||||
|
|
||||||
def do_formsemestre_inscription_listinscrits(self, formsemestre_id):
|
def do_formsemestre_inscription_listinscrits(
|
||||||
|
self, formsemestre_id, format=None, REQUEST=None
|
||||||
|
):
|
||||||
"""Liste les inscrits (état I) à ce semestre et cache le résultat"""
|
"""Liste les inscrits (état I) à ce semestre et cache le résultat"""
|
||||||
cache = self.get_formsemestre_inscription_cache()
|
cache = self.get_formsemestre_inscription_cache()
|
||||||
r = cache.get(formsemestre_id)
|
r = cache.get(formsemestre_id)
|
||||||
if r != None:
|
if r is None:
|
||||||
return r
|
# retreive list
|
||||||
# retreive list
|
r = self.do_formsemestre_inscription_list(
|
||||||
r = self.do_formsemestre_inscription_list(
|
args={"formsemestre_id": formsemestre_id, "etat": "I"}
|
||||||
args={"formsemestre_id": formsemestre_id, "etat": "I"}
|
)
|
||||||
)
|
cache.set(formsemestre_id, r)
|
||||||
cache.set(formsemestre_id, r)
|
return scu.sendResult(REQUEST, r, format=format, name="inscrits")
|
||||||
return r
|
|
||||||
|
|
||||||
security.declareProtected(ScoImplement, "do_formsemestre_inscription_edit")
|
security.declareProtected(ScoImplement, "do_formsemestre_inscription_edit")
|
||||||
|
|
||||||
@ -1840,7 +1839,7 @@ class ZNotes(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Impl
|
|||||||
) # > modif inscription semestre (demission ?)
|
) # > modif inscription semestre (demission ?)
|
||||||
|
|
||||||
# Cache inscriptions semestres
|
# Cache inscriptions semestres
|
||||||
def get_formsemestre_inscription_cache(self):
|
def get_formsemestre_inscription_cache(self, format=None):
|
||||||
u = self.GetDBConnexionString()
|
u = self.GetDBConnexionString()
|
||||||
if CACHE_formsemestre_inscription.has_key(u):
|
if CACHE_formsemestre_inscription.has_key(u):
|
||||||
return CACHE_formsemestre_inscription[u]
|
return CACHE_formsemestre_inscription[u]
|
||||||
|
36
ZScoDoc.py
36
ZScoDoc.py
@ -283,10 +283,26 @@ class ZScoDoc(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp
|
|||||||
|
|
||||||
security.declareProtected("View", "list_depts")
|
security.declareProtected("View", "list_depts")
|
||||||
|
|
||||||
def list_depts(self, REQUEST=None):
|
def list_depts(self, viewable=True, format=None, REQUEST=None):
|
||||||
"""List departments folders
|
"""List departments
|
||||||
(returns a list of Zope folders containing a ZScolar instance)
|
If viewable, list only depts viewable the current user.
|
||||||
"""
|
"""
|
||||||
|
authuser = REQUEST.AUTHENTICATED_USER
|
||||||
|
viewable = int(viewable)
|
||||||
|
return scu.sendResult(
|
||||||
|
REQUEST,
|
||||||
|
[
|
||||||
|
d.id
|
||||||
|
for d in self._list_depts()
|
||||||
|
if (not viewable) or authuser.has_permission(ScoView, d.Scolarite)
|
||||||
|
],
|
||||||
|
name="depts",
|
||||||
|
format=format,
|
||||||
|
)
|
||||||
|
|
||||||
|
def _list_depts(self, REQUEST=None): # not published
|
||||||
|
# List departments folders
|
||||||
|
# (returns a list of Zope folders containing a ZScolar instance)
|
||||||
folders = self.objectValues("Folder")
|
folders = self.objectValues("Folder")
|
||||||
# select folders with Scolarite object:
|
# select folders with Scolarite object:
|
||||||
r = []
|
r = []
|
||||||
@ -337,7 +353,7 @@ class ZScoDoc(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp
|
|||||||
if e:
|
if e:
|
||||||
return e
|
return e
|
||||||
|
|
||||||
if not force and DeptId not in [x.id for x in self.list_depts()]:
|
if not force and DeptId not in [x.id for x in self._list_depts()]:
|
||||||
raise ValueError("nom de departement invalide")
|
raise ValueError("nom de departement invalide")
|
||||||
|
|
||||||
self.manage_delObjects(ids=[DeptId])
|
self.manage_delObjects(ids=[DeptId])
|
||||||
@ -401,7 +417,7 @@ class ZScoDoc(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp
|
|||||||
def index_html(self, REQUEST=None, message=None):
|
def index_html(self, REQUEST=None, message=None):
|
||||||
"""Top level page for ScoDoc"""
|
"""Top level page for ScoDoc"""
|
||||||
authuser = REQUEST.AUTHENTICATED_USER
|
authuser = REQUEST.AUTHENTICATED_USER
|
||||||
deptList = self.list_depts()
|
deptList = self._list_depts()
|
||||||
self._fix_users_folder() # fix our exUserFolder
|
self._fix_users_folder() # fix our exUserFolder
|
||||||
isAdmin = not self._check_admin_perm(REQUEST)
|
isAdmin = not self._check_admin_perm(REQUEST)
|
||||||
try:
|
try:
|
||||||
@ -416,7 +432,7 @@ class ZScoDoc(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp
|
|||||||
# Si l'URL indique que l'on est dans un folder, affiche page login du departement
|
# Si l'URL indique que l'on est dans un folder, affiche page login du departement
|
||||||
try:
|
try:
|
||||||
deptfoldername = REQUEST.URL0.split("ScoDoc")[1].split("/")[1]
|
deptfoldername = REQUEST.URL0.split("ScoDoc")[1].split("/")[1]
|
||||||
if deptfoldername in [x.id for x in self.list_depts()]:
|
if deptfoldername in [x.id for x in self._list_depts()]:
|
||||||
return self.index_dept(deptfoldername=deptfoldername, REQUEST=REQUEST)
|
return self.index_dept(deptfoldername=deptfoldername, REQUEST=REQUEST)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
@ -463,7 +479,7 @@ class ZScoDoc(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Imp
|
|||||||
dest_folder = "/Scolarite"
|
dest_folder = "/Scolarite"
|
||||||
else:
|
else:
|
||||||
dest_folder = ""
|
dest_folder = ""
|
||||||
for deptFolder in self.list_depts():
|
for deptFolder in self._list_depts():
|
||||||
if authuser.has_permission(ScoView, deptFolder.Scolarite):
|
if authuser.has_permission(ScoView, deptFolder.Scolarite):
|
||||||
link_cls = "link_accessible"
|
link_cls = "link_accessible"
|
||||||
else:
|
else:
|
||||||
@ -875,7 +891,7 @@ Agent: %(HTTP_USER_AGENT)s
|
|||||||
% self.absolute_url(),
|
% self.absolute_url(),
|
||||||
]
|
]
|
||||||
|
|
||||||
deptList = [x.id for x in self.list_depts()] # definis dans Zope
|
deptList = [x.id for x in self._list_depts()] # definis dans Zope
|
||||||
deptIds = set(self._list_depts_ids()) # definis sur le filesystem
|
deptIds = set(self._list_depts_ids()) # definis sur le filesystem
|
||||||
existingDepts = set(deptList)
|
existingDepts = set(deptList)
|
||||||
addableDepts = deptIds - existingDepts
|
addableDepts = deptIds - existingDepts
|
||||||
@ -904,7 +920,7 @@ Agent: %(HTTP_USER_AGENT)s
|
|||||||
<select name="DeptId">
|
<select name="DeptId">
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
for deptFolder in self.list_depts():
|
for deptFolder in self._list_depts():
|
||||||
H.append(
|
H.append(
|
||||||
'<option value="%s">%s</option>' % (deptFolder.id, deptFolder.id)
|
'<option value="%s">%s</option>' % (deptFolder.id, deptFolder.id)
|
||||||
)
|
)
|
||||||
@ -939,7 +955,7 @@ Agent: %(HTTP_USER_AGENT)s
|
|||||||
"""Returns the dept id (eg "GEII") of an etud (identified by etudid, INE or NIP in REQUEST).
|
"""Returns the dept id (eg "GEII") of an etud (identified by etudid, INE or NIP in REQUEST).
|
||||||
Warning: This function is inefficient and its result should be cached.
|
Warning: This function is inefficient and its result should be cached.
|
||||||
"""
|
"""
|
||||||
depts = self.list_depts()
|
depts = self._list_depts()
|
||||||
depts_etud = [] # liste des depts où l'etud est defini
|
depts_etud = [] # liste des depts où l'etud est defini
|
||||||
for dept in depts:
|
for dept in depts:
|
||||||
etuds = dept.Scolarite.getEtudInfo(REQUEST=REQUEST)
|
etuds = dept.Scolarite.getEtudInfo(REQUEST=REQUEST)
|
||||||
|
@ -276,7 +276,7 @@ def search_etud_in_accessible_depts(context, expnom=None, code_nip=None, REQUEST
|
|||||||
"""
|
"""
|
||||||
result = []
|
result = []
|
||||||
accessible_depts = []
|
accessible_depts = []
|
||||||
deptList = context.list_depts() # definis dans Zope
|
deptList = context._list_depts() # definis dans Zope
|
||||||
for dept in deptList:
|
for dept in deptList:
|
||||||
# log('%s searching %s' % (str(REQUEST.AUTHENTICATED_USER),dept))
|
# log('%s searching %s' % (str(REQUEST.AUTHENTICATED_USER),dept))
|
||||||
if can_view_dept(dept, REQUEST):
|
if can_view_dept(dept, REQUEST):
|
||||||
|
@ -495,7 +495,7 @@ def sem_est_courant(context, sem):
|
|||||||
|
|
||||||
def scodoc_get_all_unlocked_sems(context):
|
def scodoc_get_all_unlocked_sems(context):
|
||||||
"""Liste de tous les semestres non verrouillés de tous les départements"""
|
"""Liste de tous les semestres non verrouillés de tous les départements"""
|
||||||
depts = context.list_depts()
|
depts = context._list_depts()
|
||||||
semdepts = []
|
semdepts = []
|
||||||
for dept in depts:
|
for dept in depts:
|
||||||
semdepts += [
|
semdepts += [
|
||||||
|
@ -569,7 +569,7 @@ def sendXML(REQUEST, data, tagname=None, force_outer_xml_tag=True):
|
|||||||
|
|
||||||
|
|
||||||
def sendResult(REQUEST, data, name=None, format=None, force_outer_xml_tag=True):
|
def sendResult(REQUEST, data, name=None, format=None, force_outer_xml_tag=True):
|
||||||
if format is None:
|
if (format is None) or (format == "html"):
|
||||||
return data
|
return data
|
||||||
elif format == "xml": # name is outer tagname
|
elif format == "xml": # name is outer tagname
|
||||||
return sendXML(
|
return sendXML(
|
||||||
|
@ -43,5 +43,5 @@ function ajaxFunction(mod, etudid, dat) {
|
|||||||
|
|
||||||
// -----
|
// -----
|
||||||
function change_moduleimpl(url) {
|
function change_moduleimpl(url) {
|
||||||
document.location = url + '&moduleimpl_id=' + document.getElementById('moduleimpl_id').value;
|
document.location = url + '&moduleimpl_id=' + document.getElementById('moduleimpl_id').value;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user