Changeset 254


Ignore:
Timestamp:
03/18/09 17:28:31 (3 years ago)
Author:
aarkerio
Message:

Elements enhanced

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/controllers/comentblogs_controller.php

    r221 r254  
    3939                $user_id  = $this->Comentblog->Entry->field('user_id', array('Entry.id'=>$this->data['Comentblog']['entry_id'])); 
    4040                 
    41                 $this->_sendMail($user_id, $this->data["Comentblog"]["entry_id"]); 
     41                $this->_sendMail($user_id, $this->data['Comentblog']['entry_id']); 
    4242                 
    4343                $this->redirect($this->data['Comentblog']['redirect_to'].'#comments'); 
     
    6969        $url   = '<img src="http://www.mononeurona.org/img/admin/new_user.jpg" alt="MonoNeurona" title="MonoNeurona" /><br />'; 
    7070        $url  .= '<h2>'.$data["User"]["username"].'</h2><p>You have a new comment in your blog: '; 
    71         $url  .= '<a href="http://'.$_SERVER['SERVER_NAME'].'/users/entry/'.$data["User"]["username"].'/'.$entry_id.'">'; 
    72         $url  .= 'http://'.$_SERVER['SERVER_NAME'].'/users/entry/'.$data["User"]["username"].'/'.$entry_id.'</a></p>'; 
     71        $url  .= '<a href="http://'.$_SERVER['SERVER_NAME'].'/entries/view/'.$data['User']['username'].'/'.$entry_id.'">'; 
     72        $url  .= 'http://'.$_SERVER['SERVER_NAME'].'/entries/view/'.$data['User']['username'].'/'.$entry_id.'</a></p>'; 
    7373         
    7474        //die($url); 
  • trunk/controllers/users_controller.php

    r253 r254  
    1111class UsersController extends AppController { 
    1212     
    13  public $helpers          = array('Javascript', 'Ajax', 'Form', 'User', 'Fck', 'Time', 'Gags'); 
     13 public $helpers          = array('Javascript', 'User', 'Fck', 'Gags'); 
    1414     
    1515 public $components       = array('Email', 'Blog', 'Adds'); 
     
    2121    
    2222   if ( isset($this->data['User']['pwd'] ) ):  
    23        if ( strlen($this->data['User']['pwd']) < 6):    // passwd too short, so unset 
     23       if ( strlen($this->data['User']['pwd']) < 6 &&  strlen($this->data['User']['pwd']) != 0 ):    // passwd too short, so unset 
    2424             unset($this->data['User']['pwd']); 
    2525             $this->Session->setFlash(__('Password too short', true)); 
     26       elseif(  strlen($this->data['User']['pwd']) == 0 ): 
     27              unset($this->data['User']['pwd']); 
    2628       endif; 
    2729   endif; 
     
    3234  $this->layout    = 'blog'; 
    3335  $this->pageTitle = 'About me, ' . $username; 
    34   $user_id = $this->User->field('id', array('username'=>$username)); 
    35   $conditions      = array('User.id'=>$user_id); 
    36   $this->set('Element', $this->Blog->bloggerStuff($user_id)); // Charge Blog components aka Sidebars 
    37   $this->set('data', $this->User->findAll($conditions));   
    38   $this->set('style', $this->Blog->getStyle($user_id)); 
    39   $this->set('tagCloud', $this->Blog->tagCloud($username)); // tagCloud 
     36  $this->Blog->setUserID($username); 
     37  $this->User->contain(); 
     38  $data = $this->User->find(array('User.username'=>$username)); 
     39  if  (!$data): 
     40      $this->cakeError('error404'); 
     41  endif; 
     42  $this->set('data', $data); 
    4043 }   
    4144     
     
    105108                   $this->flash('Error!, call to the companie\'s computers guy ', '/users/register'); 
    106109                  endif; 
    107          endif; 
     110         endif;  
    108111  else:  
    109112         $this->set('message', $this->User->validationErrors); 
     
    148151  $this->layout    = 'admin';    
    149152  if (empty($this->data['User'])): 
    150         $this->data      = $this->User->read(null, $this->Auth->user('id')); 
     153        $this->User->contain(); 
     154        $this->data = $this->User->read(null, $this->Auth->user('id')); 
    151155  else:    
    152         $this->data['User'] = Sanitize::clean($this->data['User']);              
     156        #$this->data['User'] = Sanitize::clean($this->data['User']); 
     157        #die(debug( $this->data['User'])); 
     158        unset($this->data['User']['username']); #don't save this 
     159        unset($this->data['User']['email']); 
    153160        if ($this->User->save($this->data)): 
    154161            $this->msgFlash('Profile has been saved','/admin/users/edit/'); 
     162        else: 
     163             die(debug($this->User->validationErrors)); 
    155164        endif; 
    156165  endif;    
     
    166175 } 
    167176    
    168  public function admin_delete($id) 
    169  { 
    170    $this->User->del($id); 
    171    $this->msgFlash('User deleted', '/admin/users/listing'); 
    172     
     177 public function admin_delete($user_id) 
     178 { 
     179   if ($this->User->del($user_id) ): 
     180      $this->msgFlash('User deleted', '/admin/users/listing'); 
     181   endif; 
    173182 } 
    174183  
     
    176185 { 
    177186  $this->layout = 'admin'; 
    178    
    179    
    180187 } 
    181188 // change user status actived/no actived 
     
    211218    $uploaddir    = '../webroot/img/avatars'; 
    212219    $maxfilesize  = 2097152; /** 2MB max size */ 
    213      
    214220    $imgfile_name = $this->data['User']['file']['name']; 
    215221    $imgfile_size = $this->data['User']['file']['size']; 
  • trunk/models/news.php

    r175 r254  
    44{ 
    55    public $name      = 'News'; 
    6      
     6 
     7    public $actsAs = array('Containable');     
     8 
    79    public $hasMany  = array( 
    810             'Comentnew' => array( 
  • trunk/models/user.php

    r238 r254  
    22//AppModel gives you all of Cake's Model functionality 
    33 
    4 class User extends AppModel { 
    5      
    6     // Its always good practice to include this variable. 
    7     public $name       = 'User'; 
    8      
    9     public $belongsTo  = array( 
     4class User extends AppModel  
     5{ 
     6 
     7  public $name   = 'User'; 
     8 
     9  public $actsAs = array('Containable'); 
     10 
     11  public $belongsTo  = array( 
    1012             'Group' => array( 
    1113                         'className' => 'Group', 
     
    1315                         )); 
    1416     
    15     public $hasOne = array( 
     17  public $hasOne = array( 
    1618      'Style' => array( 
    1719        'className'  => 'Style', 
     
    5355 public $validate = array( 
    5456   'username' => array( 
    55                               array( 
     57                        array( 
    5658                            'rule'       => array('minLength', 5), 
    5759                            'message'    => 'Username must be at least 5 characters long', 
    5860                                'allowEmpty' => false, 
     61                            'on'         => 'create', // but not on update 
    5962                                    'required'   => true 
    6063                                         ), 
    6164                      array( 
    62                                     'rule' => 'isUnique', 
     65                                    'rule'    => 'isUnique', 
     66                            'on'      => 'create', // but not on update 
    6367                            'message' => 'This username has already been taken.' 
    6468                                   ) 
     
    6973                            'message'    => 'Email must be at least 8 characters long', 
    7074                                'allowEmpty' => false, 
     75                            'on'         => 'create', // but not on update 
    7176                                    'required'   => true 
    7277                                         ), 
    7378                      array( 
    74                                     'rule' => 'isUnique', 
    75                             'message' => 'This email has already been taken.' 
     79                                    'rule'    => 'isUnique', 
     80                            'message' => 'This email has already been taken.', 
     81                            'on'      => 'create' // but not on update 
    7682                            ), 
    7783                      array( 
    78                             'rule' => array('email', true), 
    79                             'message' => 'Please supply a valid email address.' 
     84                            'rule'    => array('email', true), 
     85                            'message' => 'Please supply a valid email address.', 
     86                            'on'      => 'create' // but not on updat 
    8087                            ) 
    8188                      ), 
  • trunk/views/images/admin_listing.ctp

    r231 r254  
    7474?>  
    7575</table> 
    76  
    7776<?php 
    7877$t  = $html->div(null,$paginator->prev('«'. __('Previous', true).' ',null,null,array('class'=>'disabled')),array('style'=>'width:100px;float:left')); 
  • trunk/views/users/about.ctp

    r130 r254  
    44<?php 
    55//die( var_dump($blog) ); 
    6     echo  "<div class=\"title_section\">Here I am</div>"; 
    7     echo  $data[0]['User']['name']    . " <br />"; 
    8     echo  $data[0]['User']['cv']    . " <br />"; 
    9     echo  $html->image('avatars/'.$data[0]['User']['avatar'], array('alt' => $data[0]['User']['name'], 'title' =>$data[0]['User']['name'])) . " "; 
    10      
     6    echo  $html->div('title_section', 'Here I am'); 
     7    echo  $data['User']['name']  . ' <br />'; 
     8    echo  $data['User']['cv']    . ' <br />'; 
     9    echo  $html->image('avatars/'.$data['User']['avatar'], array('alt' => $data['User']['name'], 'title' =>$data['User']['name'])) . ' '; 
    1110?>  
    1211</div> 
  • trunk/views/users/admin_edit.ctp

    r196 r254  
    11<?php  
    2  //die( var_dump( $this->data ) );  
     2 #die( debug( $this->data ) );  
    33 
    44 if ($this->data['User']['id'] != $session->read('Auth.User.id')): 
     
    88 echo $html->para(null, $html->image('avatars/'.$this->data['User']['avatar'], array('alt'=>$this->data['User']['username'], 'title'=>$this->data['User']['username'])));  
    99   
    10   echo $form->create('User', array('onsubmit'=>'return chkForm()')); 
     10  echo $form->create('User'); 
    1111  echo $form->hidden('User.id');  
    1212  echo $form->hidden('User.email');  
     
    2424  echo $form->input('User.quote', array('size' => 70, 'maxlength' => 150, 'label'=>__('Quote', true))); 
    2525     
    26   echo $form->input('User.name_blog', array('size' => 45, 'maxlength' => 150, 'label'=>__('eduBlog name', true)));  
    27     
     26  echo $form->input('User.name_blog', array('size' => 45, 'maxlength' => 150, 'label'=>__('eduBlog name', true))); 
     27  
     28  echo $form->label('User.tags', __('Tags', true)). '<br />'; 
     29  echo $form->textarea('User.tags', array('cols' => 70, 'rows' => 2, 'label'=>__('Tags', true))); 
     30   
    2831  echo $form->label('User.newsletter', __('Subscribe to newsletter', true).': '); 
    2932  echo $form->checkbox('User.newsletter');  
Note: See TracChangeset for help on using the changeset viewer.