Index: controlies/trunk/applications/controlies/models/menu.py
===================================================================
--- controlies/trunk/applications/controlies/models/menu.py	(revision 217)
+++ controlies/trunk/applications/controlies/models/menu.py	(revision 218)
@@ -32,7 +32,7 @@
             ('Usuarios', False, URL( 'usuarios', 'index' )),
             ('Grupos', False,URL( 'grupos', 'index' )),
             ('Servidores LTSP',False, URL( 'hosts', 'ltspservers' )),
-            #('Workstations', False,URL( 'hosts', 'workstations' )),
+            ('Workstations', False,URL( 'workstations', 'index' )),
             ('Clientes Ligeros', False,URL( 'thinclients', 'index' )),         
             #('Parámetros DHCP', False,URL( 'dhcpd', 'index' )),
 
Index: controlies/trunk/applications/controlies/modules/Hosts.py
===================================================================
--- controlies/trunk/applications/controlies/modules/Hosts.py	(revision 217)
+++ controlies/trunk/applications/controlies/modules/Hosts.py	(revision 218)
@@ -42,64 +42,50 @@
         self.ip = ip
         self.mac = mac
         self.type_host = type_host
-
+        
+        config = self.ldap.search("cn=DHCP Config","cn=INTERNAL",["dhcpOption"])  
+        self.domainname = config[0][0][1]['dhcpOption'][4].replace('"','').replace('domain-name ','')
+            
     def validation(self,action):
 
-        if action == "add":
-            if self.type_host == "none":
-                return "type_host"
-        
+        if self.type_host == "none":
+            return "type_host"
+	
         if self.name == "":
             return "name"
-            
-        if self.type_host <> 'thinclient':
-            if self.ip == "":
-                return "ip"
 
-        if not ValidationUtils.validIP(self.ip):
-            return "ip"
-
-        if self.mac == "":
-            return "mac"
-
-        if not ValidationUtils.validMAC(self.mac):
-            return "mac"
-                        
-        if self.type_host =="thinclient":
-            if self.group == "":
-                return "group"
-
-        if self.type_host == "":
-            return "type_host"
-        
         if action == "add":
             if self.existsHostname():
                 return "hostAlreadyExists"
-        
-            # thinclients no requieren ip, la cogen dinamicamente en el aula
-            if self.type_host <> "thinclient":
-                if self.existsIP():
-                    return "ipAlreadyExists"
-                    
-            #controlar overflow en nodos        
-            if self.groupOverflow(300):
-                return "groupOverflow"
+                
+        if self.ip == "":
+            return "ip"
 
-            if self.existsMAC():
-                return "macAlreadyExists"
+        if not ValidationUtils.validIP(self.ip):
+            return "ip"
 
+        if action == "add":            
+            if self.existsIP():
+                return "ipAlreadyExists"
         elif action == "modify":
-            if self.groupOverflow(300):
-                return "groupOverflow"
-
             if not self.equalIP():
 				if self.existsIP():
 					return "ipAlreadyExists"
 
+        if self.mac == "":
+			return "mac"
+
+        if not ValidationUtils.validMAC(self.mac):
+			return "mac"
+
+        if action == "add":  
+            if self.existsMAC():
+                return "macAlreadyExists"
+        elif action == "modify":			
             if not self.equalMAC():
 				if self.existsMAC():
 					return "macAlreadyExists"
-
+					
         return "OK"
 
     def process(self,action):
@@ -190,33 +176,6 @@
 
             result = sorted(rows, key=itemgetter(sortBy), reverse=reverseSort)
             return { "page":page, "total":totalPages, "records":len(rows), "rows":result[start:finish]  }       
-                
-        elif type_host == "thinclient":
-            search = self.ldap.search("cn=THINCLIENTS,cn=DHCP Config","cn=*",["cn","dhcpHWAddress"])
-            filter="(|(dhcpOption=*subnet*)(dhcpOption=*log*))"
-            
-            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"][0].replace("ethernet ",""), nodeinfo[1]],
-                        "cn":i[0][1]["cn"][0],
-                        "dhcpHWAddress":i[0][1]["dhcpHWAddress"][0],
-                        "groupName":i[0][1]["dhcpHWAddress"][0]
-                    }                       
-                    rows.append(row)
-            if len(rows) > 0:
-                totalPages = ceil( len(rows) / int(limit) )
-            else:
-                totalPages = 0
-            if page > totalPages:
-                page = totalPages
-                
-            result = sorted(rows, key=itemgetter(sortBy), reverse=reverseSort)
-            return { "page":page, "total":totalPages, "records":len(rows), "rows":result[start:finish] }                    
         
         elif type_host == "workstation":
             # Obtengo todos los elementos del nodo hosts
@@ -264,52 +223,42 @@
             return { "page":page, "total":totalPages, "records":len(rows), "rows":result[start:finish] }        
 
     def add(self):
-        if self.type_host=="thinclient":
-            attr = [
-            ('objectclass', ['top','dhcpHost']),
-            ('cn', [self.name] ),
-            ('dhcpStatements', ['filename "/var/lib/tftpboot/ltsp/i386/pxelinux.0"'] ), 
-            ('dhcpHWAddress', ['ethernet ' + self.mac] )
-            ]
-            
-            self.ldap.add("cn="+self.name +",cn="+self.group+",cn=THINCLIENTS,cn=DHCP Config", attr)
-        else:
-            # Hosts
-            attr = [
-            ('objectclass', ['top','organizationalRole','domainRelatedObject','ipHost','ieee802Device']),
-            ('associatedDomain', ['santaeulalia']),
-            ('cn', [self.name]),
-            ('macAddress', [self.mac]), 
-            ('ipHostNumber', [self.ip])
-            ]
-            self.ldap.add("cn="+self.name+",ou=Hosts", attr)
+        # Hosts
+        attr = [
+        ('objectclass', ['top','organizationalRole','domainRelatedObject','ipHost','ieee802Device']),
+        ('associatedDomain', [self.domainname]),
+        ('cn', [self.name]),
+        ('macAddress', [self.mac]), 
+        ('ipHostNumber', [self.ip])
+        ]
+        self.ldap.add("cn="+self.name+",ou=Hosts", attr)
 
-            # Hosts->domain
-            attr = [
-            ('objectclass', ['dNSDomain2','domainRelatedObject']),
-            ('associatedDomain', [self.name+'.santaeulalia']),
-            ('dc', [self.name]), 
-            ('aRecord', [self.ip])
-            ]
-            self.ldap.add("dc="+self.name+",dc=santaeulalia,ou=Hosts", attr)
+        # Hosts->domain
+        attr = [
+        ('objectclass', ['dNSDomain2','domainRelatedObject']),
+        ('associatedDomain', [self.name+'.'+self.domainname]),
+        ('dc', [self.name]), 
+        ('aRecord', [self.ip])
+        ]
+        self.ldap.add("dc="+self.name+",dc="+self.domainname+",ou=Hosts", attr)
 
-            # DHCP Config
-            attr = [
-            ('objectclass', ['top','dhcpHost']),
-            ('dhcpStatements', ['fixed-address '+self.name]),
-            ('cn', [self.name]), 
-            ('dhcpHWAddress', ['ethernet '+self.mac])
-            ]
-            self.ldap.add("cn="+self.name+",cn=group1,cn=INTERNAL,cn=DHCP Config", attr)
+		# DHCP Config
+        attr = [
+        ('objectclass', ['top','dhcpHost']),
+        ('dhcpStatements', ['fixed-address '+self.name]),
+        ('cn', [self.name]), 
+        ('dhcpHWAddress', ['ethernet '+self.mac])
+        ]
+        self.ldap.add("cn="+self.name+",cn=group1,cn=INTERNAL,cn=DHCP Config", attr)
 
-            # Netgroup            
-            triplets = self.getTriplets()
-            triplets.append('('+self.name+',-,-)')
-            triplets.sort()
+        # Netgroup            
+        triplets = self.getTriplets()
+        triplets.append('('+self.name+',-,-)')
+        triplets.sort()
+		
+        attr = [(ldap.MOD_REPLACE, 'nisNetgroupTriple', triplets )]
+        self.ldap.modify("cn=ltsp-server-hosts,ou=Netgroup", attr)
             
-            attr = [(ldap.MOD_REPLACE, 'nisNetgroupTriple', triplets )]
-            self.ldap.modify("cn=ltsp-server-hosts,ou=Netgroup", attr)
-            
         return "OK"
         
     def modify(self):
@@ -322,7 +271,7 @@
 
         # Hosts->domain
         attr = [(ldap.MOD_REPLACE, 'aRecord', [self.ip] )]
-        self.ldap.modify("dc="+self.name+",dc=santaeulalia,ou=Hosts", attr)
+        self.ldap.modify("dc="+self.name+",dc="+self.domainname+",ou=Hosts", attr)
 
         # DHCP Config
         attr = [(ldap.MOD_REPLACE, 'dhcpHWAddress', [self.mac] )]
@@ -331,20 +280,17 @@
         return "OK"
 
     def delete(self):
-        if self.type_host=="thinclient":
-            self.ldap.delete('cn='+ self.name +',cn=group1,cn=THINCLIENTS,cn=DHCP Config')
-        else:
-            self.ldap.delete("cn="+self.name+",ou=Hosts")
-            self.ldap.delete("dc="+self.name+",dc=santaeulalia,ou=Hosts")
-            self.ldap.delete("cn="+self.name+",cn=group1,cn=INTERNAL,cn=DHCP Config")
+        self.ldap.delete("cn="+self.name+",ou=Hosts")
+        self.ldap.delete("dc="+self.name+",dc="+self.domainname+",ou=Hosts")
+        self.ldap.delete("cn="+self.name+",cn=group1,cn=INTERNAL,cn=DHCP Config")
             
-            # Netgroup            
-            triplets = self.getTriplets()
-            triplets.remove('('+self.name+',-,-)')
-            triplets.sort()
+        # Netgroup            
+        triplets = self.getTriplets()
+        triplets.remove('('+self.name+',-,-)')
+        triplets.sort()
             
-            attr = [(ldap.MOD_REPLACE, 'nisNetgroupTriple', triplets )]
-            self.ldap.modify("cn=ltsp-server-hosts,ou=Netgroup", attr)
+        attr = [(ldap.MOD_REPLACE, 'nisNetgroupTriple', triplets )]
+        self.ldap.modify("cn=ltsp-server-hosts,ou=Netgroup", attr)
 
         return "OK"     
 
@@ -351,22 +297,10 @@
     def wakeup(self):
         from Plugins import NetworkUtils
         NetworkUtils.startup(self.mac)
-        
-    def groupOverflow(self,overflow):
-        if self.type_host == 'thinclient':
-            search = self.ldap.search("cn=" + self.group +",cn=THINCLIENTS,cn=DHCP Config","cn=*",["cn"])
-            if len(search)-2 >= overflow:
-                return True
-                
-        return False
-            
+    
     def existsHostname(self):
+        result = self.ldap.search("ou=hosts","cn="+self.name,["cn"])
         
-        if self.type_host == 'thinclient':
-            result = self.ldap.search("cn=THINCLIENTS,cn=DHCP Config","cn="+self.name,["cn"])
-        else:
-            result = self.ldap.search("ou=hosts","cn="+self.name,["cn"])
-        
         if len(result) > 0:
             return True
         
@@ -373,17 +307,10 @@
         return False
         
     def existsMAC(self):
-        # Compruebo con las macs de la rama hosts
-        if self.type_host == '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"])
+        result = self.ldap.search("ou=hosts","macAddress="+self.mac,["macAddress"])
 
-            if len(result) > 0:
-                return True
+        if len(result) > 0:
+            return True
         
         return False
 
@@ -420,16 +347,7 @@
     def getName (self):
         return self.mac   
 
-    def getThinclientGroups (self):
-
-        groups = []
-        search = self.ldap.search("cn=THINCLIENTS,cn=DHCP Config","cn=group*",["cn"])
         
-        for g in search:
-            groups.append (g[0][1]["cn"][0])
-            
-        return { "groups":groups }
-        
     def getInternalGroups (self):
         
         groups = []
