Index: controlies/trunk/Server.py
===================================================================
--- controlies/trunk/Server.py	(revision 112)
+++ controlies/trunk/Server.py	(revision 113)
@@ -46,8 +46,8 @@
 
 # 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'
Index: controlies/trunk/Plugins/Hosts.py
===================================================================
--- controlies/trunk/Plugins/Hosts.py	(revision 112)
+++ controlies/trunk/Plugins/Hosts.py	(revision 113)
@@ -84,9 +84,13 @@
 			if self.existsMAC():
 				return "macAlreadyExists"
 
-		elif action == "modify":			
-			return "OK"
+		elif action == "modify":		
+			if self.groupOverflow(300):
+				return "groupOverflow"
 
+			if self.existsMAC():
+				return "macAlreadyExists"	
+
 		return "OK"		
 		
     def process(self,action):
@@ -101,7 +105,7 @@
 				return response
 
 		if action == "modify":
-			val = self.validation()
+			val = self.validation(action)
 			
 			if val != "OK":
 				return val
@@ -270,12 +274,15 @@
 		return "OK"
 		
     def modify(self):
-		mod_attrs = [
-		(ldap.MOD_ADD, 'description', 'Author of New Organon'),
-		(ldap.MOD_ADD, 'description', 'British empiricist') 
+		attr = [
+		(ldap.MOD_REPLACE, 'cn', [self.name] ),
+		(ldap.MOD_REPLACE, 'dhcpHWAddress', ["ethernet "+ self.mac])
 		]
-		self.ldap.modify_s('uid='+ uid +',cn=hosts', mod_attrs)
+			
+		self.ldap.modify("cn="+self.name+",cn="+self.group +",cn=THINCLIENTS,cn=DHCP Config", attr)
 
+		return "OK"
+
     def delete(self):
 		if self.type=="thinclient":
 			self.ldap.delete('cn='+ self.name +',cn=' +self.group +',cn=THINCLIENTS,cn=DHCP Config')
@@ -311,11 +318,9 @@
 		# Compruebo con las macs de la rama hosts
 		if self.type == 'thinclient':
 			result = self.ldap.search("cn=THINCLIENTS,cn=DHCP Config","dhcpHWAddress=*",["dhcpHWAddress"])
-
 			for i in range (0, len(result) - 1):
 				if result [i][0][1]['dhcpHWAddress'][0].replace ("ethernet ", "") == self.mac:
 					return True
-
 		else:
 			result = self.ldap.search("ou=hosts","macAddress="+self.mac,["macAddress"])
 
@@ -339,7 +344,6 @@
 		return False
 		
     def getThinclientGroups (self):
-		import pdb
 
 		groups = []
 		search = self.ldap.search("cn=THINCLIENTS,cn=DHCP Config","cn=group*",["cn"])
@@ -349,7 +353,20 @@
 			
 		return { "groups":groups }
 		
+    def getHostData(self):
+		#self.getUserGroups()
+		if self.type == "thinclient":
+			result = self.ldap.search("cn=THINCLIENTS,cn=DHCP Config","cn="+self.name,["cn","dhcpHWAddress"])
 		
+			dataHost = {
+				"cn":result[0][0][1]["cn"][0],
+				"mac":result[0][0][1]["dhcpHWAddress"][0].replace("ethernet ",""),
+				"group":self.group 
+			}
+		 
+		return dataHost		
+		
+		
     def getLTSPServers (self):
 		triplets = self.ldap.search("ou=Netgroup","cn=ltsp-server-hosts",["nisNetgroupTriple"])
 		triplets = triplets [0][0][1]["nisNetgroupTriple"]
Index: controlies/trunk/www/thinclients/index.html
===================================================================
--- controlies/trunk/www/thinclients/index.html	(revision 112)
+++ controlies/trunk/www/thinclients/index.html	(revision 113)
@@ -150,19 +150,8 @@
 				}).dialog('open');
 			}			
 			
-			function loadGroups () {
-				
-			}
-
-
-			function addRecord(){
-
-				$("#dialog-form").html("");
-				$("#dialog-form").load("thinclients/form.html", function() {
-					$("#form_data #action").val("add");
-					$("#form_data #messageForm").html("Todos los campos son obligatorios");		
-					
-					$.post('hosts','action=getThinclientGroups', function(data) {
+			function getThinClientGroups(selected) {
+				$.post('hosts','action=getThinclientGroups', function(data) {
 						var result = $.parseJSON(data);
 
 						var selectGrupos = document.getElementById("group");				
@@ -171,11 +160,22 @@
 							var optn = document.createElement("option");
 							optn.text = result.response.groups[i];
 							optn.value = result.response.groups[i];
-				
+							if (selected==optn.text) 
+								optn.selected = true;
 							selectGrupos.options.add (optn);
 						}
-					});
+				});
+			}
+			
+			function addRecord(){
+
+				$("#dialog-form").html("");
+				$("#dialog-form").load("thinclients/form.html", function() {
+					$("#form_data #action").val("add");
+					$("#form_data #messageForm").html("Todos los campos son obligatorios");		
 					
+					getThinClientGroups();
+					
 					x = ($(window).width()-250)/2;
 					y = ($(window).height()-400)/2;
 
@@ -189,50 +189,32 @@
 			}							
 			
 			function modifyRecord(){
-				var uid;
-
+				var hid;
+				var group; 
 				$("#messageLoading").show();
 				
-				var uid = rowSelected();
-				if(uid==false)
+				var hid = rowSelected();
+				var group = getCell("groupName"); 
+				if(hid==false)
 					return false;
 
 				$("#dialog-form").html("").css("display","none");
-				$("#dialog-form").load("users/form.html", function() {
+				$("#dialog-form").load("thinclients/form.html", function() {
 					
-					getAllGroups();
+					getThinClientGroups(group);
 					
 					$("#form_data #action").val("modify");
-					$("#form_data #user").attr("readonly","true");
-					$("#form_data #user").css("background-color","#DDD");
-					$("#form_data #messageForm").html("Si deja la contraseña en blanco no se modificará<br>El resto de campos son obligatorios");
+					$("#form_data #name").attr("readonly","true");
+					$("#form_data #name").css("background-color","#DDD");
+					$("#form_data #group").attr("readonly","true");
+					$("#form_data #group").css("background-color","#DDD");
 					
-					$.post('users', 'action=getUserData&user='+uid, function(data) {
+					$.post('hosts', 'action=getHostData&cn='+hid+'&group='+group+'&type=thinclient', function(data) {
 						var result = $.parseJSON(data);
 
-						if(result.response['type']=="teacher")
-							var textType = "Profesor";
-						else
-							var textType = "Alumno";
-							
-						var dep = Array(result.response['groups']['departments']);
-
-						$("#form_data #type").replaceWith(textType+"<input type='hidden' id='type' name='type' value='"+result.response['type']+"'/>");
-						$("#form_data #name").val(result.response['name']);
-						$("#form_data #nif").val(result.response['nif']);		
-						$("#form_data #user").val(result.response['user']);
-						$("#form_data #surname").val(result.response['surname']);
+						$("#form_data #name").val(result.response['cn']);
+						$("#form_data #mac").val(result.response['mac']);		
 						
-						$("#form_data #photo").attr("src","data:image/png;base64,"+result.response['photo']);						
-
-						$.each(result.response['groups']['departments'], function(i, l){
-							$('#form_data input:checkbox[value='+l+']').attr('checked', true);							
-						});
-
-						$.each(result.response['groups']['classrooms'], function(i, l){
-							$('#form_data input:checkbox[value='+l+']').attr('checked', true);							
-						});						
-
 						x = ($(window).width()-300)/2;
 						y = ($(window).height()-500)/2;
 						
@@ -242,7 +224,7 @@
 							resizable: false,
 							modal: true,
 							width: 300,
-							title: "Modificar Usuario"
+							title: "Modificar Cliente Ligero"
 						}).dialog('option', 'position', [x, y]);						
 					});				  
 				});
Index: controlies/trunk/MainLoop.py
===================================================================
--- controlies/trunk/MainLoop.py	(revision 112)
+++ controlies/trunk/MainLoop.py	(revision 113)
@@ -237,19 +237,22 @@
 
 				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
+        	elif request.args['action'][0] == "getHostData":
+				h = Hosts(l,request.args['cn'][0],"","",request.args['group'][0],request.args['type'][0])
+				response = h.getHostData()
+				return json.dumps({"response" : response})				
+				
+        	else: #add, modify
 				if request.args ['type'][0] == 'thinclient':
 					ip = ""
 				else:
 					ip = request.args ['ip'][0]
 				h = Hosts(l,request.args['name'][0],ip,request.args['mac'][0],request.args['group'][0],request.args['type'][0])
-				
 				response = h.process(request.args['action'][0])
 				return json.dumps({"response" : response})
 				
