Changeset 627

Show
Ignore:
Timestamp:
07/05/08 01:09:56 (3 months ago)
Author:
aarkerio
Message:

Internatiantilzation

Location:
trunk/app
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/controllers/forums_controller.php

    r626 r627  
    119119 public function admin_topics( $f_id ) 
    120120 {   
    121     $forum_id = (int) $f_id; 
    122      
    123     if ( !is_int($forum_id) ) 
    124     { 
    125       $this->redirect('/'); 
    126     } 
     121    $forum_id = (int) $f_id; 
     122     
     123    if ( !is_int($forum_id) ): 
     124       $this->redirect('/'); 
     125       return false; 
     126    endif; 
    127127     
    128128    $this->layout = 'admin'; 
     
    139139   $this->set('vclassrooms', $this->Forum->getVclassrooms($this->Auth->user('id'))); 
    140140 
    141    if ( !empty( $this->data['Forum'] ) ) 
    142    { 
     141   if ( !empty( $this->data['Forum'] ) ): 
     142 
    143143     $this->Sanitize = new Sanitize; 
    144144      
     
    149149     $this->Forum->create(); 
    150150      
    151      if ( $this->Forum->save($this->data['Forum']) ) 
    152      { 
    153          $this->msgFlash('Forum created', '/admin/catforums/listing'); 
    154      } 
    155    } 
    156    else 
    157    { 
     151     if ( $this->Forum->save($this->data['Forum']) ): 
     152         $this->msgFlash(__('Forum created', true), '/admin/catforums/listing'); 
     153     endif; 
     154   
     155   else: 
    158156      $this->set('catforum_id', $catforum_id); 
    159    } 
     157   endif; 
    160158 } 
    161159  
     
    165163  $this->set('vclassrooms', $this->Forum->getVclassrooms($this->Auth->user('id'))); 
    166164 
    167   if (empty($this->data['Forum'])) 
    168    
     165  if (empty($this->data['Forum'])): 
     166   
    169167        $this->layout = 'admin'; 
    170168         
     
    172170         
    173171        $this->data = $this->Forum->read(); 
    174   } 
    175   else 
    176   { 
    177        $this->Sanitize = new Sanitize; 
     172   
     173  else: 
     174        $this->Sanitize = new Sanitize; 
    178175        
    179        $this->Sanitize->clean($this->data['Forum']); 
     176        $this->Sanitize->clean($this->data['Forum']); 
    180177        
    181        if ($this->Forum->save($this->data['Forum'])) 
    182        { 
    183             $this->msgFlash('Forum updated', '/admin/catforums/listing'); 
    184        } 
    185     } 
     178        if ($this->Forum->save($this->data['Forum'])): 
     179            $this->msgFlash(__('Data saved', true), '/admin/catforums/listing'); 
     180        endif; 
     181   endif; 
    186182 } 
    187183 // change status published/draft 
     
    202198 } 
    203199  
    204  public function admin_delete($id) 
     200 public function admin_delete($forum_id) 
    205201 { 
    206     if ( $this->Forum->del($id) ) 
    207     {            
    208          $this->msgFlash('Forum deleted', '/admin/catforums/listing'); 
    209     } 
    210  } 
    211  
     202    if ( $this->Forum->del($forum_id) ):            
     203         $this->msgFlash(__('Forum deleted', true), '/admin/catforums/listing'); 
     204    endif; 
     205 } 
    212206} 
    213207?> 
  • trunk/app/controllers/users_controller.php

    r614 r627  
    527527 public function admin_edit()  
    528528 { 
    529     if ( empty($this->data['User']) ) 
    530     { 
    531         $this->layout    = 'admin'; 
     529   if ( empty($this->data['User']) ): 
     530       $this->layout    = 'admin'; 
    532531         
    533         $this->set('Groups', Set::combine($this->User->Group->find('all', array('order' => 'name')), "{n}.Group.id","{n}.Group.name")); 
     532       $this->set('Groups', Set::combine($this->User->Group->find('all', array('order' => 'name')), "{n}.Group.id","{n}.Group.name")); 
    534533         
    535         $this->User->unbindModel($this->User->notNow); 
     534       $this->User->unbindModel($this->User->notNow); 
    536535             
    537                 $this->data = $this->User->read(null, $this->Auth->user('id')); 
    538     } 
    539     else 
    540     { 
    541         //die( debug($this->data['User']) ); 
    542         if ($this->User->save($this->data['User'])) 
    543         { 
    544             $this->msgFlash('User has been updated.','/admin/users/edit/'); 
    545         } 
    546     } 
     536       $this->data = $this->User->read(null, $this->Auth->user('id')); 
     537    
     538    else: 
     539       //die( debug($this->data['User']) ); 
     540       if ($this->User->save($this->data['User'])): 
     541            $this->msgFlash(__('User has been updated', true), '/admin/users/edit/'); 
     542       endif; 
     543    endif; 
    547544 } 
    548545 
     
    596593     $this->data['User']['id']     = $id; 
    597594      
    598      if ($this->User->save($this->data)) 
    599      { 
     595     if ($this->User->save($this->data['User'])): 
    600596           $this->msgFlash('User status changed', '/admin/users/listing/'); 
    601      }  
    602      else  
    603      { 
     597     else: 
    604598            $this->flash('Problem!!', '/admi/users/listing/'); 
    605      } 
     599     endif; 
    606600 } 
    607601  
    608602 /*** DELETE  **/  
    609  public function admin_delete($id) 
    610  { 
    611     if ($this->User->del($id)) 
    612     { 
    613        $this->msgFlash('User has been deleted.', '/admin/users/listing'); 
    614     } 
     603 public function admin_delete($user_id) 
     604 { 
     605   if ($this->User->del($user_id)): 
     606       $this->msgFlash(__('User deleted', true), '/admin/users/listing'); 
     607   endif; 
    615608 } 
    616609  
     
    658651    /** Security: checks to see if file is an image, if not do not allow upload ==*/ 
    659652     
    660     if ( $type != "image/jpeg" && $type != "image/pjpeg" && $type != "image/png" && $type != "image/gif")  
    661     {   /** is this a valid file? */ 
    662         $ErrMsg   = "<h1>ERROR</h1> the file $imgfile_name $imgfile is not valid.<br>"; 
    663         $ErrMsg  .= "<p>Only .jpg, .gif or .png files<br><br>"; 
    664         $ErrMsg  .= "Current type file: " . $type . "</p>\n"; 
    665              
    666         /** delete uploaded file  */ 
    667         unlink($imgfile); 
    668         die($this->flash($ErrMsg, '/admin/users/edit/') ); 
    669     } 
    670      
    671     if ( $imgfile_size > $maxfilesize)  
    672     { 
    673      $ErrMsg  = "<h1>ERROR</h1> The image is too big.<br />"; 
    674          $ErrMsg .= "<p>Bigger than 2.0 MB <br /><br />"; 
    675          $ErrMsg .= "Current size: " . $imgfile_size ."</p>\n"; 
    676               
    677          /** delete uploaded file */ 
    678          unlink($imgfile); 
    679          die( $this->flash($ErrMsg,'/admin/users/edit/') ); 
    680     } 
     653    if ( $type != "image/jpeg" && $type != "image/pjpeg" && $type != "image/png" && $type != "image/gif"):  
     654       /** is this a valid file? */ 
     655       $msg   = "Error, the file $imgfile_name $imgfile is not valid, only .jpg, .gif or .png, current type file: " . $type; 
     656       unlink($imgfile); /** delete uploaded file  */ 
     657       $this->flash($msg, '/admin/users/edit/'); 
     658       return false; 
     659    endif; 
     660     
     661    if ( $imgfile_size > $maxfilesize): 
     662       $msg  = ">Error. The image is bigger than 2.0 MB Current size: " . $imgfile_size; 
     663       unlink($imgfile); /** delete uploaded file */ 
     664       $this->flash($msg,'/admin/users/edit/'); 
     665       return false; 
     666    endif; 
    681667 
    682668    //check size 
    683     if ($width > 100 || $height > 100) 
    684     { 
    685          $ErrMsg  = "<h1>ERROR</h1> The image is too large.<br>"; 
    686          $ErrMsg .= "<p>Widht or height is larger than 100 pixels <br /><br />"; 
    687          $ErrMsg .= "Current size: width ". $width ."px  height ". $height ."px</p>\n"; 
    688               
    689          /** delete uploaded file */ 
    690          unlink($imgfile); 
    691          die( $this->flash($ErrMsg,'/admin/users/edit/') ); 
    692  
    693     } 
     669    if ($width > 100 || $height > 100): 
     670         $msg  = "Error. Width or height is larger than 100 pixels. Width ". $width ."px,  height ". $height ."px</p>\n"; 
     671         unlink($imgfile); /** delete uploaded file */ 
     672         $this->flash($msg,'/admin/users/edit/'); 
     673         return false; 
     674    endif; 
    694675         
    695676    $extension   = $this->Adds->get_extension($type); 
     
    703684    $newfile = $uploaddir . "/" . $final_filename; 
    704685     
    705     /** do extra security check to prevent malicious abuse */ 
    706     if (is_uploaded_file($imgfile)) 
    707     { 
     686   /** do extra security check to prevent malicious abuse */ 
     687   if (is_uploaded_file($imgfile)): 
    708688       /** move file to proper directory ==*/ 
    709        if (!copy($imgfile, $newfile)) 
    710        { 
     689      if (!copy($imgfile, $newfile)): 
    711690          /** if an error occurs the file could not be written, read or possibly does not exist */ 
    712           die($this->flash('Error Uploading File.', '/users/edit/'.$this->Auth->user('id'))); 
    713        } 
    714    } 
     691          die($this->flash('Error Uploading File.', '/admin/users/edit/')); 
     692       endif; 
     693   endif; 
    715694    
    716695   /** Database stuff  **/ 
     
    718697   $this->data['User']['avatar'] = $final_filename; 
    719698    
    720    if ($this->User->save($this->data)) 
    721     { 
    722            $this->redirect('/admin/users/edit/'. $this->Auth->user('id')); 
    723     } 
     699   if ($this->User->save($this->data)): 
     700           $this->redirect('/admin/users/edit/'); 
     701    endif; 
    724702     
    725703    /** delete the temporary uploaded file **/ 
  • trunk/app/locale/spa/LC_MESSAGES/default.po

    r626 r627  
     1msgid  "Group" 
     2msgstr "Grupo" 
     3 
     4msgid  "Email" 
     5msgstr "Correo" 
     6 
     7msgid  "Name and last name" 
     8msgstr "Nombre y apellido" 
     9 
     10msgid  "Left empty if you do not want to change" 
     11msgstr "Dejar vacío si no se desea cambiarlo" 
     12 
    113msgid  "Delete" 
    214msgstr "Eliminar" 
    315 
     16msgid  "Layout" 
     17msgstr "Diseño" 
     18 
     19msgid  "Quote" 
     20msgstr "Frase" 
     21 
     22msgid  "Subscribe to newsletter" 
     23msgstr "Deseo recibir el boletín" 
     24 
     25msgid  "Upload new avatar" 
     26msgstr "Subir nuevo avatar" 
     27 
    428msgid  "Data saved" 
    529msgstr "Datos guardados" 
     
    1438msgstr "Agregar" 
    1539 
     40msgid  "New user" 
     41msgstr "Nuevo usuario" 
     42 
     43msgid  "About you and your interests" 
     44msgstr "Escribe acerca de ti y tus interéses" 
     45 
     46msgid  "I read and I do agree with terms" 
     47msgstr "He leído y acepto los términos del servicio" 
     48 
    1649msgid  "Finishing date" 
    1750msgstr "Fecha de fin de curso" 
     
    5588msgid  "Send comment" 
    5689msgstr "Enviar comentario" 
     90 
     91msgid  "Send" 
     92msgstr "Enviar" 
     93 
     94msgid  "At least 5 characters, only lowercase. No spaces." 
     95msgstr "Al menos cinco caracteres, sólo minúsculas, no usar espacios." 
     96 
     97msgid  "At least 6 characters" 
     98msgstr "Al menos seis caracteres" 
    5799 
    58100msgid  "Write comment" 
     
    215257msgstr "Subir archivo" 
    216258 
    217 msgid  "read_terms" 
    218 msgstr "He leido y aceptado los terminos" 
    219  
    220259msgid  "Welcome" 
    221260msgstr "Bienvenido" 
     
    260299msgstr "Estado modificado" 
    261300 
     301msgid  "Registration form" 
     302msgstr "Forma de registro" 
     303 
    262304msgid  "Hidden" 
    263305msgstr "Oculto" 
  • trunk/app/views/users/admin_edit.ctp

    r613 r627  
    2020   
    2121  echo '<legend>'.$session->read('Auth.User.username') .'\'s account</legend>'; 
    22   echo $form->input('User.pwd', array("size"=>9, "maxlength"=>9,"value"=>"")) . '  Left empty if you do not want to change'; 
    23   echo $form->error('User.pwd', 'A name is required.');  
     22  echo $form->input('User.pwd', array('size'=>9, 'maxlength'=>9, 'value'=>'', 'label'=>__('Password', true))) . '  '.__('Left empty if you do not want to change', true); 
     23  echo $html->para(null, '<br />');  
    2424   
    25   echo $form->input('User.name', array("size" => 35, "maxlength"=>50));  
     25  echo $form->input('User.name', array('size' => 35, 'maxlength'=>50));  
    2626  echo $form->error('User.name', 'A name is required.'); 
    2727   
    28   echo $form->input('User.email', array("size" => 30, "maxlength"=>50)); 
     28  echo $form->input('User.email', array('size' => 30, 'maxlength'=>50)); 
    2929  echo $form->error('User.email', 'An email is required.');  
    3030   
    31   // if the user belongs to admin group   
    32   if ($session->read('Auth.User.group_id') == 1): 
    33      echo $form->label('User.group_id', 'Group:' ); 
    34      echo $form->select('User.group_id', $Groups); 
    35   endif;  
    36    
    37   echo $form->label('User.layout', 'Layout:' );  
     31  echo $form->label('User.layout', __('Layout',true).': ');  
    3832  $designs = array('rubyx'=>'Rubyx', 'school'=>'School', 'paris'=>'Paris'); 
    3933  echo $form->select('User.layout', $designs, null, null, false); 
    4034   
    41   echo $form->label('User.cv', 'Profile:' ); 
    42   echo $form->textarea('User.cv', array("cols" => 70, "rows" => 7)); 
     35  echo $form->label('User.cv', __('Profile',true) ); 
     36  echo $form->textarea('User.cv', array('cols' => 70, 'rows' => 7)); 
    4337   
    44   echo $form->input('User.quote', array("size" => 70, "maxlength" => 150)); 
     38  echo $form->input('User.quote', array('size' => 70, 'maxlength' => 150, 'label'=>__('Quote', true))); 
    4539   
    46   echo $form->input('User.name_blog', array("size" => 45, "maxlength" => 150));  
     40  echo $form->input('User.name_blog', array('size' => 45, 'maxlength' => 150));  
    4741    
    48   echo $form->label('User.newsletter', 'Subscribe to newsletter:' ); 
    49   echo $form->checkbox('User.newsletter', array("value" => 1));  
     42  echo $form->label('User.newsletter', __('Subscribe to newsletter', true).': '); 
     43  echo $form->checkbox('User.newsletter', array('value' => 1));  
    5044   
    51   echo $form->end('Save');  
     45  echo $form->end(__('Save', true));  
    5246 ?> 
    5347</fieldset> 
     
    6357<fieldset> 
    6458  <legend><?php __('Upload new avatar'); ?></legend> 
    65   <br /> 
    66    <p>An image 40 x 40 pixels</p> 
    67    <?php  
    68      echo $form->label('User.file', 'Avatar:' ); 
    69      echo $form->file('User.file');  
    70      echo $form->error('User.file', 'Title is required.');  
    71      echo $form->end('Upload');  
     59  <?php 
     60    echo $html->div(null, 'An image 40 x 40 pixels'); 
     61    echo $form->file('User.file');  
     62    echo $form->error('User.file', 'Title is required.');  
     63    echo $form->end(__('Upload', true));  
    7264?> 
    7365</fieldset> 
  • trunk/app/views/users/register.ctp

    r615 r627  
    44else: 
    55?> 
    6 <div style="border-bottom:1px dotted gray;font-size:16pt;color:green;font-weigth:bold;margin-top:15px">Registration form </div> 
     6<div style="border-bottom:1px dotted gray;font-size:16pt;color:green;font-weigth:bold;margin-top:15px"> 
     7<?php __('Registration form'); ?> </div> 
    78 
    89<div id="charging" style="display:none;"><?php echo $html->image('static/loading.gif', array("alt"=>"Loading")); ?></div> 
     
    1516 
    1617<fieldset> 
    17   <legend>New User:</legend>      
    18      <?php echo $form->input('User.username', array("size" => 10, "maxlength" => 10, "between"=>": ", "onBlur"=>"this.value=this.value.toLowerCase()")); ?><span class="small">At least 5 characters, only lowercase. No spaces.</span> 
    19      <br /> 
     18  <legend><?php __('New user'); ?></legend>      
     19    <?php echo $form->input('User.username', array("size" => 10, "maxlength" => 10, "between"=>": ", "onBlur"=>"this.value=this.value.toLowerCase()")); ?> 
     20  <span class="small"><?php __('At least 5 characters, only lowercase. No spaces.');?></span> 
     21     <div><br /></div> 
     22    <?php echo $form->label('User.pwd', __('Password'.': ', true)) . $form->password('User.pwd', array('size'=>9,'maxlength'=>9)); ?> 
     23   <span class="small"><?php __('At least 6 characters'); ?></span> 
     24  <?php 
     25    echo $html->div(null, '<br />'); 
     26    echo $form->input('User.name', array('size' => 25, 'maxlength' => 50, 'between'=>': ', 'label'=>__('Name and last name', true))); 
     27  
     28    echo $html->div(null, '<br />'); 
     29    echo $form->input('User.email', array('size' => 20, 'maxlength' => 45, 'between'=>': ', 'label'=>__('Email', true)));  
     30      
     31    echo $html->div(null, '<br />'); 
     32    echo $form->label('User.group_id', __('Group'.': ', true)); 
     33       
     34    $fieldName      = 'User.group_id'; 
     35    $selected       = 3; 
     36    $showEmpty      = false; 
     37    $return         = true; 
     38      
     39    echo $form->select($fieldName, $groups, $selected, null, null, $showEmpty, $return);  
    2040     
    21      <?php echo $form->input('User.email', array("size" => 20, "maxlength" => 45, "between"=>": ")); ?> 
    22      <br /> 
     41    echo $html->div(null, '<br />'); 
     42    echo $form->input('User.code', array('size' => 7, 'maxlength' => 7, 'between'=>': '));     
    2343     
    24      <?php echo $form->input('User.name', array("size" => 25, "maxlength" => 50, "between"=>": ")); ?> 
    25      <br /> 
    26      <?php echo $form->label('User.group_id', 'Group:' );?> 
    27      <?php  
    28      $fieldName      = 'User.group_id'; 
    29      $selected       = 3; 
    30      $showEmpty      = false; 
    31      $return         = true; 
    32       
    33      echo $form->select($fieldName, $groups, $selected, null, null, $showEmpty, $return);  
    34  ?> 
    35    <br /> 
    36       
    37      <?php echo $form->input('User.code', array("size" => 7, "maxlength" => 7)); ?> 
    38       
    39      <?php echo $form->label('User.pwd', 'Password: ') . $form->password('User.pwd', array('size' => 9, 'maxlength' => 9)); ?> 
    40    <span class="small">At least 6 characters</span> 
    41      <br /><br /> 
    42      <?php echo $form->label('User.description', 'About you and your interests:' );?><br /> 
    43      <?php echo $form->textarea('User.description', array("rows"=>4, "cols"=>50)) ?> 
    44      <br /><br /> 
    45 <?php  
     44    echo $html->div(null, '<br />');   
     45    echo $form->label('User.description', __('About you and your interests', true) ) . '<br />'; 
     46    echo $form->textarea('User.description', array("rows"=>4, "cols"=>50)).'<br />';  
    4647         
    47 $tmp = $html->link('I read the terms:','#header', 
     48    $tmp = $html->link(__('I read and I do agree with terms', true),'#header', 
    4849                                    array("onclick"=>"javascript:window.open('/colleges/terms', 'blank', 'toolbar=no, scrollbars=yes,width=700,height=400')")) . ' '; 
    4950 
    50   echo $form->label('User.agree', $tmp); 
    51   echo $form->checkbox('User.agree', array("value"=>1));  
    52      
    53   echo $ajax->submit('Send', array("url" => "/users/insert/",  
     51    echo $form->label('User.agree', $tmp); 
     52    echo $form->checkbox('User.agree', array('value'=>1));  
     53 
     54    echo $html->div(null, '<br />'); 
     55 
     56    echo $ajax->submit(__('Send', true), array("url" => "/users/insert/",  
    5457                                         "update"=>"updater",  
    5558                     "before" => "if ( !validateData() ) return false;", 
     
    6265 
    6366<?php 
    64 echo $html->para(null,  
     67echo $html->para(null, 
    6568'Please contact <a href="mailto:webmaster@conrad-college.edu">webmaster@conrad-college.edu</a> if you have doubts or comments about this registration process.'); 
    6669?>