[Alba-desarrollo] SVN Alba r4503 - in prosistem/alba/trunk/alba/apps/principal/modules/docente: actions config templates validate

commits en pressenter.com.ar commits en pressenter.com.ar
Lun Mar 19 20:50:27 CET 2007


Author: ftoledo
Date: 2007-03-19 16:50:24 -0300 (Mon, 19 Mar 2007)
New Revision: 4503

Modified:
   prosistem/alba/trunk/alba/apps/principal/modules/docente/actions/actions.class.php
   prosistem/alba/trunk/alba/apps/principal/modules/docente/config/generator.yml
   prosistem/alba/trunk/alba/apps/principal/modules/docente/templates/_fk_provincia_id.php
   prosistem/alba/trunk/alba/apps/principal/modules/docente/templates/_pais_id.php
   prosistem/alba/trunk/alba/apps/principal/modules/docente/templates/cambiarPaisSuccess.php
   prosistem/alba/trunk/alba/apps/principal/modules/docente/validate/edit.yml
Log:
provincia + pais con ajax en docente


Modified: prosistem/alba/trunk/alba/apps/principal/modules/docente/actions/actions.class.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/docente/actions/actions.class.php	2007-03-19 19:40:08 UTC (rev 4502)
+++ prosistem/alba/trunk/alba/apps/principal/modules/docente/actions/actions.class.php	2007-03-19 19:50:24 UTC (rev 4503)
@@ -75,9 +75,10 @@
      }
 
     public function executeCambiarPais() {
-        $pais_id = $this->getRequestParameter('pais_id');
+        $this->pais_id = $this->getRequestParameter('pais_id');
+        $this->provincia_id = $this->getRequestParameter('provincia_id');
         $c = new Criteria();
-        $c->add(ProvinciaPeer::FK_PAIS_ID, $pais_id);
+        $c->add(ProvinciaPeer::FK_PAIS_ID, $this->pais_id);
         $this->provincias = ProvinciaPeer::getEnOrden($c);
     }
 }

Modified: prosistem/alba/trunk/alba/apps/principal/modules/docente/config/generator.yml
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/docente/config/generator.yml	2007-03-19 19:40:08 UTC (rev 4502)
+++ prosistem/alba/trunk/alba/apps/principal/modules/docente/config/generator.yml	2007-03-19 19:50:24 UTC (rev 4503)
@@ -28,7 +28,7 @@
         title: Editar Docente
         display:       
                  "Informacion general":  [apellido, nombre, fecha_nacimiento, _sexo, fk_tipodocumento_id, nro_documento ]
-                 "Donde vive": [direccion, ciudad, _fk_provincia_id, _pais_id, codigo_postal]
+                 "Donde vive": [direccion, ciudad, _pais_id, _fk_provincia_id, codigo_postal]
                  "Otros": [ email, telefono, telefono_movil, libreta_sanitaria, psicofisico, titulo, activo ]
                                                          
                     

Modified: prosistem/alba/trunk/alba/apps/principal/modules/docente/templates/_fk_provincia_id.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/docente/templates/_fk_provincia_id.php	2007-03-19 19:40:08 UTC (rev 4502)
+++ prosistem/alba/trunk/alba/apps/principal/modules/docente/templates/_fk_provincia_id.php	2007-03-19 19:50:24 UTC (rev 4503)
@@ -1,8 +1,2 @@
 <div id="item_provincia">
-<?php  echo object_select_tag($docente, 'getFkProvinciaId', array (
-                             'related_class' => 'Provincia',
-                              'peer_method' => 'getEnOrden',
-                             'control_name' => 'docente[fk_provincia_id]',
-                             'include_custom' => '--Seleccione una Provincia--',
-                             )) ?>                             
 </div>                            
\ No newline at end of file

Modified: prosistem/alba/trunk/alba/apps/principal/modules/docente/templates/_pais_id.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/docente/templates/_pais_id.php	2007-03-19 19:40:08 UTC (rev 4502)
+++ prosistem/alba/trunk/alba/apps/principal/modules/docente/templates/_pais_id.php	2007-03-19 19:50:24 UTC (rev 4503)
@@ -5,8 +5,10 @@
     $paises = PaisPeer::doSelect($c);
     if ($docente->getFkProvinciaId()) {
         $pais_selected = $docente->getProvincia()->getPais()->getId();
+        $provincia_id = $docente->getFkProvinciaId();
     } else {
-        $pais_selected = 0;
+        $pais_selected = $paises[0]->getId();
+        $provincia_id = 0;
     }
         
     echo select_tag('pais_id',objects_for_select($paises,'getId','getNombreLargo',$pais_selected));
@@ -15,4 +17,12 @@
         'update'   => 'item_provincia',
         'url'      => 'docente/cambiarPais?vista=noMuestraMenu',
         'with'     => "'pais_id=' + value"));
+        
+    echo javascript_tag(
+        remote_function( array(
+        'update'  => 'item_provincia',
+        'url'     => 'docente/cambiarPais?vista=noMuestraMenu&pais_id='. $pais_selected . '&provincia_id=' . $provincia_id,
+        ))
+    );
+                                              
 ?>

Modified: prosistem/alba/trunk/alba/apps/principal/modules/docente/templates/cambiarPaisSuccess.php
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/docente/templates/cambiarPaisSuccess.php	2007-03-19 19:40:08 UTC (rev 4502)
+++ prosistem/alba/trunk/alba/apps/principal/modules/docente/templates/cambiarPaisSuccess.php	2007-03-19 19:50:24 UTC (rev 4503)
@@ -3,6 +3,6 @@
 ?>
 <div id="item_provincia">
 <?php 
-    echo select_tag('docente[fk_provincia_id]', objects_for_select($provincias, 'getId','getNombreLargo'), array('control_name' => 'docente[fk_provincia_id]'));
+    echo select_tag('docente[fk_provincia_id]', objects_for_select($provincias, 'getId','getNombreLargo',$provincia_id), array('control_name' => 'docente[fk_provincia_id]'));
 ?>
 </div>
\ No newline at end of file

Modified: prosistem/alba/trunk/alba/apps/principal/modules/docente/validate/edit.yml
===================================================================
--- prosistem/alba/trunk/alba/apps/principal/modules/docente/validate/edit.yml	2007-03-19 19:40:08 UTC (rev 4502)
+++ prosistem/alba/trunk/alba/apps/principal/modules/docente/validate/edit.yml	2007-03-19 19:50:24 UTC (rev 4503)
@@ -16,6 +16,7 @@
     - "docente{psicofisico}"            
     - "docente{activo}"   
     - "docente{fecha_nacimiento}"         
+    - "docente{fk_provincia_id}"         
     
 fillin:
     enabled:       on
@@ -81,6 +82,11 @@
     docente{email}:
         required:     No
         validators: validaEmail, caracteresMaximos128
+
+    docente{fk_provincia_id}:
+        required:     Yes
+        required_msg: El campo provincia es obligatorio
+        validators: validaProvincia
         
         
 caracteresMaximos128:
@@ -126,4 +132,10 @@
     class: sfEmailValidator
     param:
        email_error:   "No ingresaste un email correctamente ( ej: nombre en dominio.com)"
-                    
\ No newline at end of file
+
+validaProvincia:
+    class: sfNumberValidator
+    param:
+        nan_error: El campo provincia contiene un valor incorrecto       
+        min: 1
+        min_error: El campo provincia es obligatorio
\ No newline at end of file




Más información sobre la lista de distribución Alba-desarrollo