Revisión 112
Añadido por Manu Mora Gordillo hace alrededor de 14 años
controlies/trunk/Server.py | ||
---|---|---|
|
||
# Start up the web service.
|
||
Root = MainLoop.ControlIESProtocol() #Resource object
|
||
#Root.PageDir='/home/manu/proyectos/controlies/trunk/www/'
|
||
Root.PageDir='/home/chisco/Proyectos/controlies/trunk/www'
|
||
Root.PageDir='/home/manu/proyectos/controlies/trunk/www/'
|
||
#Root.PageDir='/home/chisco/Proyectos/controlies/trunk/www'
|
||
site = server.Site(Root)
|
||
|
||
fileNameServers = '/tmp/controlIES.ltpsSevers'
|
controlies/trunk/Plugins/Users.py | ||
---|---|---|
self.getUserGroups()
|
||
result = self.ldap.search("ou=People","uid="+self.user,["uid","cn","sn","employeenumber","homedirectory","jpegPhoto"])
|
||
|
||
if len(result) == 0:
|
||
return { "user":"", "name":"", "surname":"", "nif":"", "photo":"", "type":"", "groups":[] }
|
||
|
||
type = "student"
|
||
if result[0][0][1]["homeDirectory"][0][0:14]=="/home/profesor":
|
||
type = "teacher"
|
controlies/trunk/www/classroomServers/index.html | ||
---|---|---|
return false;
|
||
}else{
|
||
|
||
if( $("#selectable-"+selected[0]+" #userName").html()=="" ){
|
||
modalAlert("No hay datos que mostrar");
|
||
return false;
|
||
}
|
||
|
||
$("#messageLoading").show();
|
||
|
||
//$("#dialog-details").html("").css("display","none");;
|
||
|
||
$("#dialog-details").load("classroomServers/details.html", function() {
|
||
|
||
$.post('hosts','action=getClassroomDetails&classroom='+selected[0], function(data) {
|
||
$.post('hosts','action=getClassroomDetails&classroom='+selected[0]+'&teacher='+$("#selectable-"+selected[0]+" #userName").html(), function(data) {
|
||
var result = $.parseJSON(data);
|
||
|
||
$("#teacherName").html(result.teacher.name);
|
||
|
||
$.each(result.teacher.groups.departments, function(i, l){
|
||
$("#teacherDepartments").append(l+" ");
|
||
});
|
||
|
||
if(result.students.length>0){
|
||
$.each(result.students, function(i, l){
|
||
$('#selectableStudents').append('<li class="ui-state-default" id="selectableStudents-'+l.username+'"><div id="pcName" style="font-size:11px;">'+l.host+'</div><img class="thumb-image" src="data:image/png;base64+'l.photo'+"/><div id="userName" style="font-size:11px;">'+l.username+'</div></li>');
|
||
|
||
src = "img/nobody.png";
|
||
if(l.photo.photo!="")
|
||
src = "data:image/png;base64,"+l.photo.photo;
|
||
|
||
$('#selectableStudents').append('<li class="ui-state-default" id="selectableStudents-'+l.username+'"><div id="pcName" style="font-size:11px;">'+l.host+'</div><img class="thumb-image" src="'+src+'" style="width:64px; height:64px;"/><div id="userName" style="font-size:11px;">'+l.username+'</div></li>');
|
||
});
|
||
}else{
|
||
//$("#dialog-details").html("No hay alumnos detectados").css("text-align","center").css("font-weight","bold");
|
||
$("#dialog-details #selectableStudents").html("No hay alumnos detectados").css("text-align","center").css("font-weight","bold");
|
||
}
|
||
|
||
x = ($(window).width()-500)/2;
|
||
... | ... | |
position: top,
|
||
modal: true,
|
||
width: 500,
|
||
title: "Detalles del aula"
|
||
title: "Detalles del aula: "+result.classroom
|
||
}).dialog('option', 'position', [x, y]);
|
||
});
|
||
});
|
controlies/trunk/MainLoop.py | ||
---|---|---|
f = open('/tmp/controlIES.ltpsTeachers', 'r')
|
||
teachers = f.read().split(" ")
|
||
teachers.sort()
|
||
|
||
|
||
return json.dumps({ "computers":computers, "teachers":teachers })
|
||
|
||
|
||
elif request.args['action'][0] == "getClassroomDetails":
|
||
|
||
import xmlrpclib
|
||
from Plugins.Users import Users
|
||
|
||
from Plugins.Users import Users
|
||
|
||
objUser = Users(l,"","","","",request.args['teacher'][0],"","","","")
|
||
teacherData = objUser.getUserData()
|
||
|
||
s = xmlrpclib.Server("http://" + request.args['classroom'][0] + ":8900");
|
||
|
||
users = s.Users()
|
||
|
||
response = []
|
||
response = []
|
||
for u in users:
|
||
user = u.split("@")
|
||
|
||
objUser = Users(l,"","","","",user[0],"","","","")
|
||
photo = objUser.getUserPhoto()
|
||
|
||
response.append({ 'username': user[0], 'host': user[1], 'photo': photo })
|
||
|
||
return json.dumps({ "classroom" : request.args['classroom'][0], "students" : response })
|
||
|
||
elif request.args['action'][0]=="delete":
|
||
return json.dumps({ "teacher" : teacherData, "classroom" : request.args['classroom'][0], "students" : response })
|
||
|
||
|
||
elif request.args['action'][0]=="delete":
|
||
h = Hosts(l,request.args['cn'][0],"","",request.args['group'][0],request.args['type'][0])
|
||
response = h.process(request.args['action'][0])
|
||
return json.dumps({"response" : response})
|
||
|
||
else: #add
|
||
if request.args ['type'][0] == 'thinclient':
|
||
ip = ""
|
Exportar a: Unified diff
Ya muestra los alumnos de un aula