Index: controlies/Utils/avahiClient.py
===================================================================
--- controlies/Utils/avahiClient.py	(revision 92)
+++ controlies/Utils/avahiClient.py	(revision 93)
@@ -44,7 +44,7 @@
 
 class avahiClient():
 
-    def __init__(self):
+    def __init__(self, type):
 		self._callbacks = {'new-service':  [], 'remove-service': [] }
 		# initialize dbus stuff needed for discovery
 								   
@@ -54,12 +54,16 @@
 		self.server = dbus.Interface(avahi_bus, avahi.DBUS_INTERFACE_SERVER)
 		
 		stype = '_workstation._tcp'
+		stype = '_controlaula._tcp'
+
+		stype = type
+
 		domain = 'local'
 		self._plugged = {}
 
 		avahi_browser = self.server.ServiceBrowserNew(avahi.IF_UNSPEC, avahi.PROTO_UNSPEC, stype, domain, dbus.UInt32(0))
 		obj = self.bus.get_object(avahi.DBUS_NAME, avahi_browser)
-		self.browser = dbus.Interface(obj, avahi.DBUS_INTERFACE_SERVICE_BROWSER)
+		self.browser = dbus.Interface(obj, avahi.DBUS_INTERFACE_SERVICE_BROWSER)	
 
     def start(self):
 		self.browser.connect_to_signal('ItemNew', self.new_service)
@@ -78,8 +82,7 @@
 				cb(self,name, address, port)
 				
 		def resolve_service_error(exception):
-			self.warning('could not resolve daap service %s %s: %s' %
-				(name, domain, exception))
+			self.warning('could not resolve daap service %s %s: %s' % (name, domain, exception))
 
 		self.server.ResolveService(interface, protocol, name, type, domain,
 				avahi.PROTO_UNSPEC, dbus.UInt32(0),
Index: controlies/www/classroomServers/index.html
===================================================================
--- controlies/www/classroomServers/index.html	(revision 92)
+++ controlies/www/classroomServers/index.html	(revision 93)
@@ -15,7 +15,7 @@
 			var result = $.parseJSON(data);
 			
 			$.each(result.response, function(i, l){
-				$('#selectable').append('<li class="ui-state-default" id="selectable-'+l+'"><div id="pcName" style="font-size:11px;">'+l+'</div><img class="thumb-image" src="img/turnOff.png"/><div id="userName" style="font-size:11px;">ajimenezf01</div></li>');					
+				$('#selectable').append('<li class="ui-state-default" id="selectable-'+l+'"><div id="pcName" style="font-size:11px;">'+l+'</div><img class="thumb-image" src="img/turnOff.png"/><div id="userName" style="font-size:11px;"></div></li>');					
 			});
 			
 			getLTSPStatus();
@@ -25,12 +25,21 @@
 	function getLTSPStatus(){
 		$.post('hosts','action=getLTSPStatus', function(data) {
 			var result = $.parseJSON(data);
+
+			$('#selectable li .thumb-image').attr('src','img/turnOff.png');
 			
-			$.each(result.response, function(i, l){
-				$('#selectable').append('<li class="ui-state-default" id="selectable-'+l+'"><div id="pcName" style="font-size:11px;">'+l+'</div><img class="thumb-image" src="img/turnOff.png"/><div id="userName" style="font-size:11px;">ajimenezf01</div></li>');					
+			$.each(result.computers, function(i, l){
+				$('#selectable #selectable-'+l+' .thumb-image').attr('src','img/turnOn.png');
 			});
+
+			$.each(result.teachers, function(i, l){
+				var teacher = l.split(".");
+				var computer = teacher[0].split("@");
+				$('#selectable #selectable-'+computer[1]+' #userName').html(computer[0]);
+				$('#selectable #selectable-'+computer[1]+' .thumb-image').attr('src','img/nobody.png');
+			});
 			
-			setTimeout("getLTSPStatus()",2000);			
+			setTimeout("getLTSPStatus()",10000);			
 		});
 	}
 	
Index: controlies/www/img/nobody.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: controlies/MainLoop.py
===================================================================
--- controlies/MainLoop.py	(revision 92)
+++ controlies/MainLoop.py	(revision 93)
@@ -200,10 +200,16 @@
 				return json.dumps({"response" : response})		
 
         	elif request.args['action'][0] == "getLTSPStatus":
-				h = Hosts (l,"","","","","")
-				response = h.getLTSPStatus ()
-				return json.dumps({"response" : response})		
+				f = open('/tmp/controlIES.ltpsSevers', 'r')
+				computers = f.read().split(" ")
+				computers.sort()
 				
+				f = open('/tmp/controlIES.ltpsTeachers', 'r')
+				teachers = f.read().split(" ")
+				teachers.sort()
+				
+				return json.dumps({ "computers":computers, "teachers":teachers })
+				
         	else:
 				if request.args ['type'][0] == 'thinclient':
 					ip = ""
Index: controlies/Server.py
===================================================================
--- controlies/Server.py	(revision 92)
+++ controlies/Server.py	(revision 93)
@@ -41,33 +41,83 @@
 #Root.PageDir='/home/chisco/Proyectos/controlies/www'
 site = server.Site(Root)
 
-fileName = '/tmp/controlIES.ltpsSevers'
+fileNameServers = '/tmp/controlIES.ltpsSevers'
+if os.path.isfile(fileNameServers):
+	os.remove(fileNameServers)
 
-if os.path.isfile(fileName):
-	os.remove(fileName)
+f = open(fileNameServers, 'w')
+
+
+fileNameTeachers = '/tmp/controlIES.ltpsTeachers'
+if os.path.isfile(fileNameTeachers):
+	os.remove(fileNameTeachers)
+
+f = open(fileNameTeachers, 'w')
+
+
+def _add_locationServers(self, name, address, port):
+	print name
+	computerToAdd = name.split(" ")
+	f = open(fileNameServers, 'a')
+	f.write(computerToAdd[0]+" ")
+	f.close()
+
 	
-f = open(fileName, 'w')
+def _remove_locationServers(self, name, address, port):
+	computerToDelete = name.split(" ")
+	f = open(fileNameServers, 'r')
+	computersList = f.read()
+	f.close()
+	#print "computer list "+computerlist	
+	#print "computer to delete "+computerToDelete[0]
+	computersList.replace(computerToDelete[0]+" ","")
 
+	#print "computer list "+computerList
+	
+	f = open(fileNameServers, 'w')	
+	f.write(computersList)
+	f.close()
 
-def _add_location(self, name, address, port):
-	f = open(fileName, 'r+')
-	f.write(name)
+
+def _add_locationTeachers(self, name, address, port):
+	print name
+	teacherToAdd = name.split(" ")
+	f = open(fileNameTeachers, 'a')
+	f.write(teacherToAdd[0]+" ")
 	f.close()
-	print "add"
 
 	
-def _remove_location(self, name, address, port):	
-	print "remove"
-	#remove ipv6 entries:
-	if address.find(":") == -1:
-		print "removed:" + name,address,port
+def _remove_locationTeachers(self, name, address, port):
+	teacherToDelete = name.split(" ")
+	f = open(fileNameTeachers, 'r')
+	teachersList = f.read()
+	f.close()
+	#print "computer list "+computerlist	
+	#print "computer to delete "+computerToDelete[0]
+	teachersList.replace(teacherToDelete[0]+" ","")
 
+	#print "computer list "+computerList
+	
+	f = open(fileNameTeachers, 'w')	
+	f.write(teachersList)
+	f.close()
+	
 
+try:	
+	_monitor = avahiClient('_workstation._tcp')	
+	_monitor.add_callback('new-service', _add_locationServers)
+	_monitor.add_callback('remove-service', _remove_locationServers)
+	_monitor.start()
+	
+except Exception, ex:
+	error_msg = "Couldn't initialize Avahi monitor: %s" % str(ex)
+	#raise InitializeFailure(self.name, error_msg)
 
+
 try:	
-	_monitor = avahiClient()	
-	_monitor.add_callback('new-service', _add_location)
-	_monitor.add_callback('remove-service', _remove_location)
+	_monitor = avahiClient('_controlaula._tcp')	
+	_monitor.add_callback('new-service', _add_locationTeachers)
+	_monitor.add_callback('remove-service', _remove_locationTeachers)
 	_monitor.start()
 	
 except Exception, ex:
@@ -74,6 +124,7 @@
 	error_msg = "Couldn't initialize Avahi monitor: %s" % str(ex)
 	#raise InitializeFailure(self.name, error_msg)
 
+
 from twisted.internet import reactor
 
 reactor.listenTCP(7778,site)
