Index: controlies/trunk/Plugins/Hosts.py
===================================================================
--- controlies/trunk/Plugins/Hosts.py	(revision 105)
+++ controlies/trunk/Plugins/Hosts.py	(revision 106)
@@ -169,7 +169,7 @@
 					"cn":i[0][1]["cn"][0],
 					"ipHostNumber":i[0][1]["ipHostNumber"][0],
 					"macAddress":i[0][1]["macAddress"][0]
-				}				
+				}
 				#row = { "cn":i[0][0], "cell":[i[0][1]["cn"][0], i[0][1]["ipHostNumber"][0],i[0][1]["macAddress"]]}
 				rows.append(row)
 				
@@ -184,20 +184,23 @@
 			return { "page":page, "total":totalPages, "records":len(rows), "rows":result[start:finish]  }		
 				
 		elif type == "thinclient":
-			search = self.ldap.search("cn=THINCLIENTS,cn=DHCP Config","cn=*",["cn","dhcpHWAddress"])		
+			search = self.ldap.search("cn=THINCLIENTS,cn=DHCP Config","cn=*",["cn","dhcpHWAddress"])
+			filter="(|(dhcpOption=*subnet*)(dhcpOption=*log*))"
+			import pdb
 			
 			rows = []
+			
 			# esto hay que cambiarlo: tenemos 4 groups en thinclientes
 			for i in search[6:len(search)]:
+					nodeinfo=i[0][0].replace ("cn=","").split(",")
 					row = {
 						"id":i[0][1]["cn"][0], 
-						"cell":[i[0][1]["cn"][0], i[0][1]["dhcpHWAddress"]],
+						"cell":[i[0][1]["cn"][0], i[0][1]["dhcpHWAddress"][0].replace("ethernet ",""), nodeinfo[1]],
 						"cn":i[0][1]["cn"][0],
-						"dhcpHWAddress":i[0][1]["dhcpHWAddress"][0]
+						"dhcpHWAddress":i[0][1]["dhcpHWAddress"][0],
+						"groupName":i[0][1]["dhcpHWAddress"][0]
 					}						
-					#row = { "cn":i[0][0], "cell":[i[0][1]["cn"][0], i[0][1]["dhcpHWAddress"][0]]}
 					rows.append(row)
-
 			if len(rows) > 0:
 				totalPages = ceil( len(rows) / int(limit) )
 			else:
@@ -262,7 +265,7 @@
 			('dhcpHWAddress', ['ethernet ' + self.mac] )
 			]
 			
-			self.ldap.add("cn="+self.name +",cn=group2,cn=THINCLIENTS,cn=DHCP Config", attr)
+			self.ldap.add("cn="+self.name +",cn="+self.group+",cn=THINCLIENTS,cn=DHCP Config", attr)
 						
 		return "OK"
 		
@@ -273,9 +276,12 @@
 		]
 		self.ldap.modify_s('uid='+ uid +',cn=hosts', mod_attrs)
 
-    def delete(self,uid):
-		self.ldap.delete('uid='+ uid +',cn=hosts')
+    def delete(self):
+		if self.type=="thinclient":
+			self.ldap.delete('cn='+ self.name +',cn=' +self.group +',cn=THINCLIENTS,cn=DHCP Config')
 
+		return "OK"		
+
     def wakeup(self):
 		from Plugins import NetworkUtils
 		NetworkUtils.startup(self.mac)
@@ -304,7 +310,6 @@
     def existsMAC(self):
 		# Compruebo con las macs de la rama hosts
 		if self.type == 'thinclient':
-			#search = self.ldap.search("cn=THINCLIENTS,cn=DHCP Config","cn=a*",["dhcpHWAddress"])
 			result = self.ldap.search("cn=THINCLIENTS,cn=DHCP Config","dhcpHWAddress=*",["dhcpHWAddress"])
 
 			for i in range (0, len(result) - 1):
Index: controlies/trunk/www/thinclients/index.html
===================================================================
--- controlies/trunk/www/thinclients/index.html	(revision 105)
+++ controlies/trunk/www/thinclients/index.html	(revision 106)
@@ -17,10 +17,11 @@
 					url:'hosts?action=list&type=thinclient',
 					mtype: 'POST', 
 					datatype: "json", 
-					colNames:['Nombre','mac'],
+					colNames:['Nombre','MAC','Grupo'],
 					colModel:[ 
 						{name:'cn',index:'cn', width:80, align:"center"},
-						{name:'macAddress',index:'dhcpHWAddress', width:60, align:"center"}
+						{name:'macAddress',index:'dhcpHWAddress', width:60, align:"center"},
+						{name:'groupName',index:'groupName', width:60, align:"center"}
 					], 
 					rowNum:25,
 					height:335,
@@ -46,7 +47,7 @@
 					caption: "Modificar", 
 					buttonicon :'ui-icon-pencil',
 					onClickButton : function (){ 
-						handleRecord('modify','Modificar Usuario');
+						modifyRecord();
 					} 
 				}); 
 				$("#list").jqGrid('navButtonAdd','#pager',{
@@ -60,6 +61,28 @@
 				$("#list").jqGrid('filterToolbar'); 
 			}
 			
+
+			function getCell (column) {
+				var rowid = $("#list").jqGrid('getGridParam', 'selrow');
+				
+				if( rowid == null ){
+					$( "#dialog-alert" ).dialog({
+						resizable: false,
+						height:150,
+						width:290,
+						modal: true,
+						buttons: { "Aceptar": function() { $( this ).dialog( "close" ); }}
+					}).dialog('open');
+					return false;
+				}
+				
+				var Cell = $("#list").jqGrid('getCell', rowid, column);
+				
+				
+				return Cell;
+			}			
+			
+			
 			function rowSelected(){
 				var id = $("#list").jqGrid('getGridParam','selrow'); 
 
@@ -99,10 +122,13 @@
 					}
 				});
 			}
-			function deleteRecord(){
+			
+		function deleteRecord(){
 				
-				var id = rowSelected();
-				if(id==false)
+				var cn = rowSelected();
+				var grupo = getCell("groupName");
+
+				if(cn==false)
 					return false;
 			
 				$( "#dialog-confirm" ).dialog({
@@ -112,17 +138,17 @@
 					modal: true,
 					buttons: {
 						"Borrar": function() {
-							$.post("users","idUser="+id+"&action=delete", function(data){
-								$( this ).dialog( "close" );
+							$.post("hosts","cn="+cn+"&action=delete&type=thinclient&group="+grupo, function(data){
+								$("#dialog-confirm").dialog( "close" );
 								$("#list").trigger("reloadGrid");
 							});
 						},
 						"Cancelar": function() {
-							$( this ).dialog( "close" );
+							$(this).dialog( "close" );
 						}
 					}
 				}).dialog('open');
-			}
+			}			
 			
 			function loadGroups () {
 				
@@ -161,6 +187,67 @@
 					}).dialog('option', 'position', [x, y]);								
 				});
 			}							
+			
+			function modifyRecord(){
+				var uid;
+
+				$("#messageLoading").show();
+				
+				var uid = rowSelected();
+				if(uid==false)
+					return false;
+
+				$("#dialog-form").html("").css("display","none");
+				$("#dialog-form").load("users/form.html", function() {
+					
+					getAllGroups();
+					
+					$("#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");
+					
+					$.post('users', 'action=getUserData&user='+uid, 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 #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;
+						
+						$("#messageLoading").hide();
+						
+						$("#dialog-form").dialog({
+							resizable: false,
+							modal: true,
+							width: 300,
+							title: "Modificar Usuario"
+						}).dialog('option', 'position', [x, y]);						
+					});				  
+				});
+			}
+			
 		</script>
 
 		<div id="tabla_clientes">
Index: controlies/trunk/MainLoop.py
===================================================================
--- controlies/trunk/MainLoop.py	(revision 105)
+++ controlies/trunk/MainLoop.py	(revision 106)
@@ -222,13 +222,17 @@
 				return json.dumps({ "students" : s.Hosts() })
 
 
-        	else:
+        	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 = ""
 				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})
 				
Index: controlies/trunk/Server.py
===================================================================
--- controlies/trunk/Server.py	(revision 105)
+++ controlies/trunk/Server.py	(revision 106)
@@ -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/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'
