Changeset 460


Ignore:
Timestamp:
06/18/10 16:55:18 (20 months ago)
Author:
aarkerio
Message:

Update contacts package

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/config/core.php

    r458 r460  
    141141 * Actual value depends on 'Security.level' setting. 
    142142 */ 
    143   Configure::write('Session.timeout', '360000'); 
     143  Configure::write('Session.timeout', '36000'); 
    144144 
    145145/** 
     
    246246 * Xcache (http://xcache.lighttpd.net/) */ 
    247247 
    248   Cache::config('default', array( 
    249                                  'engine'      => 'Xcache', //[required] 
    250                                          'duration'    => 3600, //[optional] 
    251                                          'probability' => 100, //[optional] 
    252                                          'prefix'      => Inflector::slug(APP_DIR) . '_', //[optional] prefix every cache file with this string 
    253                                          'user'        => 'user', //user from xcache.admin.user settings 
    254                                  'password'    => 'password', //plaintext password (xcache.admin.pass) 
    255                                         )); 
     248 Cache::config('default', array( 
     249                                 'engine'      => 'Xcache',    # [required] 
     250                                         'duration'    => 36000,       # [optional] 
     251                                         'probability' => 100,         # [optional] 
     252                                         'prefix'      => Inflector::slug(APP_DIR) . '_',  # [optional] prefix every cache file with this string 
     253                                         'user'        => 'user',      # user from xcache.admin.user settings 
     254                                 'password'    => 'password',  # plaintext password (xcache.admin.pass) 
     255                                 ));  
    256256 /* 
    257257 * Memcache (http://www.danga.com/memcached/) 
     
    270270 */ 
    271271 #Cache::config('default', array('engine' => 'File')); 
    272 # ? > 
     272# ? > EOF 
  • trunk/controllers/contacts_controller.php

    r386 r460  
    6868 public function admin_edit($id=null) 
    6969 { 
    70   if (empty($this->data["Contact"])) 
    71   { 
    72         $this->layout        = 'admin'; 
    73          
    74         $this->Contact->id  = $id; 
    75          
    76         $this->data          = $this->Contact->read(); 
    77    } 
    78    else 
    79    {      
    80        if ($this->Contact->save($this->data)): 
    81            $this->msgFlash('Contact has been saved!','/admin/contacts/listing'); 
    82             exit(); 
    83          endif; 
    84     } 
     70  if (empty($this->data['Contact'])): 
     71      $this->layout        = 'admin';      
     72      $this->Contact->id   = $id; 
     73      $this->data          = $this->Contact->read(); 
     74  else:   
     75      if ($this->Contact->save($this->data)): 
     76          $this->msgFlash('Contact has been saved!','/admin/contacts/listing'); 
     77      else: 
     78          die(debug($this->Contact->validationErrors));  
     79      endif; 
     80  endif; 
    8581} 
    8682 
    8783 public function admin_single($id=null) 
    8884 { 
    89         $this->layout        = 'admin'; 
    90          
    91         $conditions  = array("Contact.id"=>$id, "Contact.user_id"=>$this->Auth->user('id')); 
    92          
    93         $this->set('data', $this->Contact->find($conditions)); 
     85   $this->layout        = 'admin';       
     86   $params = array('conditions'  => array('Contact.id'=>$id, 'Contact.user_id'=>$this->Auth->user('id'))); 
     87   $this->set('data', $this->Contact->find('first', $params)); 
    9488 } 
    9589 
    9690 public function admin_delete($id) 
    9791 { 
    98                 $this->Contact->delete($id); 
    99                 $this->msgFlash('Contact has been deleted!', '/admin/contacts/listing'); 
    100                 exit(); 
    101   } 
    102    
     92   $this->Contact->delete($id); 
     93   $this->msgFlash('Contact has been deleted!', '/admin/contacts/listing'); 
     94   exit(); 
     95 } 
     96  
    10397} 
    104 # ? > 
     98# ? > EOF 
  • trunk/models/comentblog.php

    r380 r460  
    5555                            'rule'       => 'notEmpty', 
    5656                            'message'    => 'Name must not be empty', 
    57                                 'allowEmpty' => false, 
    58                                     'required'   => true 
     57                                'allowEmpty' => False, 
     58                                    'required'   => True 
    5959                                         ) 
    6060                               ) 
    6161         ); 
    6262  
    63  
    6463} 
    65 # ? > 
     64# ? > EOF 
  • trunk/models/contact.php

    r381 r460  
    1212class Contact extends AppModel 
    1313{ 
    14     public $name      = 'Contact'; 
     14 public $name      = 'Contact'; 
    1515     
    1616     
    17     public $belongsTo  = array( 
     17 public $belongsTo  = array( 
    1818             'User' => array( 
    1919                             'className'    => 'User', 
     
    2323             ); 
    2424     
    25    public $validate = array( 
    26                        'firstname' => array('rule' => array('minLength', 4), 
    27                                                      'message'    => 'Must be at least four characters long', 
    28                                                      'allowEmpty' => False, 
    29                                                      'required'   => True ),      
    30                        'user_id' => array('rule' => array('minLength', 4), 
    31                                                    'message'    => 'Must be at least four characters long', 
    32                                                    'allowEmpty' => False, 
    33                                                   'required'   => True )  
     25 public $validate = array( 
     26                     'firstname' => array('rule'       => array('minLength', 4), 
     27                                          'message'    => 'Must be at least four characters long', 
     28                                          'allowEmpty' => False, 
     29                                          'required'   => True ),      
     30                     'user_id' => array('rule'       => 'numeric', 
     31                                        'message'    => 'Must be at least four characters long', 
     32                                        'allowEmpty' => False, 
     33                                        'on'         => 'create', 
     34                                        'required'   => True )  
    3435   ); 
    3536    
    3637} 
    3738 
    38 # ? > 
     39# ? > EOF 
  • trunk/views/contacts/admin_edit.ctp

    r410 r460  
    11<?php  
    2    echo $this->Html->script('fckeditor/fckeditor');  
    3    echo $this->Html->addCrumb('Control Tools', '/admin/entries/start');  
    4    echo $this->Html->addCrumb('Contact', '/admin/contacts/listing');  
    5    echo $this->Html->getCrumbs(' / ');  
     2 $this->Html->addCrumb('Control Tools', '/admin/entries/start');  
     3 $this->Html->addCrumb('Contact', '/admin/contacts/listing');  
     4 echo $this->Html->getCrumbs(' > ');  
    65 
    7    echo $this->Form->create('Contact');  
    8    echo $this->Form->hidden('Contact.id'); 
     6 echo $this->Form->create('Contact', array('action'=>'edit', 'admin'=>True));  
     7 echo $this->Form->hidden('Contact.id'); 
    98?> 
    109<fieldset> 
    1110<legend>New Contact</legend> 
    1211<?php 
    13   //title varchar(6), 
    14   echo $this->Form->label('Contact.title', 'Title:' ); 
    15   echo $this->Form->select('Contact.title', array('Mr.'=>'Mr.', 'Ms.'=>'Ms.', 'Miss'=>'Miss', 'Young fellow'=>'Young fellow', 'Dr.'=>'Dr.', 'Lic.'=>'Lic.', 'Hacker'=>'Hacker'), null, array(), false); 
     12 #title varchar(6), 
     13 echo $this->Form->input('Contact.title', array('options'=>array('Mr.'=>'Mr.','Ms.'=>'Ms.','Miss'=>'Miss', 'Young fellow'=>'Young fellow', 'Dr.'=>'Dr.', 'Lic.'=>'Lic.', 'Hacker'=>'Hacker'))); 
    1614      
    17     echo $this->Form->input('Contact.firstname', array('size' => 40, 'maxlength' => 40, 'label'=>'First Name'));  
     15 echo $this->Form->input('Contact.firstname', array('size' => 40, 'maxlength' => 40, 'label'=>'First Name'));  
    1816 
    19    //last name 
    20    echo $this->Form->input('Contact.lastname', array('size' => 40, 'maxlength' => 40, 'label'=>'Last Name'));  
     17 # last name 
     18 echo $this->Form->input('Contact.lastname', array('size' => 40, 'maxlength' => 40, 'label'=>'Last Name'));  
    2119      
    22  //nickname varchar(30), 
    23       echo $this->Form->label('Contact.nickname', 'Nickname:' );   
    24       echo $this->Form->input('Contact.nickname', array('size' => 30, 'maxlength' => 30)); 
     20 # nickname varchar(30) 
     21 echo $this->Form->input('Contact.nickname', array('size' => 30, 'maxlength' => 30)); 
    2522       
    26  //email1 varchar(100), 
    27       echo $this->Form->label('Contact.email1', 'Email:' );   
    28       echo $this->Form->input('Contact.email1', array('size' => 40, 'maxlength' => 100));  
     23 # email1 varchar(100), 
     24 echo $this->Form->input('Contact.email1', array('size' => 40, 'maxlength' => 100));  
    2925 
    30  //email2 varchar(100), 
    31       echo $this->Form->label('Contact.email2', 'Additional email:' );   
    32       echo $this->Form->input('Contact.email2', array('size' => 40, 'maxlength' => 100)); 
     26 # email2 varchar(100), 
     27 echo $this->Form->input('Contact.email2', array('size' => 40, 'maxlength' => 100)); 
    3328       
    34 //cellphone varchar(150), 
    35       echo $this->Form->label('Contact.cellphone', 'Cell Phone:' );   
    36       echo $this->Form->input('Contact.cellphone', array('size' => 40, 'maxlength' => 150));  
     29 # cellphone varchar(150) 
     30 echo $this->Form->input('Contact.cellphone', array('size' => 40, 'maxlength' => 150));  
    3731 
    38  //homephone varchar(150), 
    39       echo $this->Form->label('Contact.homephone', 'Home Phone:' );   
    40       echo $this->Form->input('Contact.homephone', array('size' => 40, 'maxlength' => 150));  
     32 # homephone varchar(150), 
     33 echo $this->Form->input('Contact.homephone', array('size' => 40, 'maxlength' => 150));  
    4134 
    42  //workphone varchar(150), 
    43       echo $this->Form->label('Contact.workphone', 'Work Phone:' );   
    44       echo $this->Form->input('Contact.workphone', array('size' => 40, 'maxlength' => 150)); 
     35 # workphone varchar(150), 
     36 echo $this->Form->input('Contact.workphone', array('size' => 40, 'maxlength' => 150)); 
    4537       
    46 //fax varchar(100), 
    47       echo $this->Form->label('Contact.fax', 'Fax:' );   
    48       echo $this->Form->input('Contact.fax', array('size' => 40, 'maxlength' => 100));  
     38 # fax varchar(100), 
     39 echo $this->Form->input('Contact.fax', array('size' => 40, 'maxlength' => 100));  
    4940 
    50 //website varchar(400), 
    51       echo $this->Form->label('Contact.website', 'Website:' );   
    52       echo $this->Form->input('Contact.website', array('size' => 40, 'maxlength' => 250));  
     41 # website varchar(400) 
     42 echo $this->Form->input('Contact.website', array('size' => 40, 'maxlength' => 250));  
    5343 
    54  //skype varchar(150), 
    55       echo $this->Form->label('Contact.skype', 'skype:' );   
    56       echo $this->Form->input('Contact.skype', array('size' => 40, 'maxlength' => 100));  
     44 # skype varchar(150) 
     45 echo $this->Form->input('Contact.skype', array('size' => 40, 'maxlength' => 100));  
    5746 
    58  //msn varchar(150), 
    59       echo $this->Form->label('Contact.msn', 'MSN:' );   
    60       echo $this->Form->input('Contact.msn', array('size' => 40, 'maxlength' => 50));  
     47 # msn varchar(150) 
     48 echo $this->Form->input('Contact.msn', array('size' => 40, 'maxlength' => 50));  
    6149 
    62  //address varchar(400), 
    63       echo $this->Form->label('Contact.address', 'Address:' );   
    64       echo $this->Form->input('Contact.address', array('size' => 70, 'maxlength' => 250)); 
     50 # address varchar(400) 
     51 echo $this->Form->input('Contact.address', array('size' => 70, 'maxlength' => 250)); 
    6552       
    66 //address varchar(8), 
    67       echo $this->Form->label('Contact.cp', 'P.C.:' );   
    68       echo $this->Form->input('Contact.cp', array('size' => 4, 'maxlength' => 8));  
     53 # address varchar(8), 
     54 echo $this->Form->input('Contact.cp', array('size' => 4, 'maxlength' => 8));  
    6955 
    70  //organization varchar(100), 
    71       echo $this->Form->label('Contact.organization', 'Organization:' );   
    72       echo $this->Form->input('Contact.organization', array('size' => 35, 'maxlength' => 100));  
     56 #organization varchar(100), 
     57 echo $this->Form->input('Contact.organization', array('size' => 35, 'maxlength' => 100));  
    7358 
    74  //birthday date, 1976-07-03 
    75       echo $this->Form->label('Contact.birthday', 'Birthday:' );   
    76       echo $this->Form->input('Contact.birthday', array('type'=>'date','label'=>'Birthday', 'dateFormat'=>'DMY')); 
    77       echo '<div style="clear:both;margin-top:15px"> </dvi>'; 
    78       echo $this->Form->end('Send');  
    79       ?> 
     59 #birthday date, 1976-07-03 
     60 echo $this->Form->input('Contact.birthday', array('type'=>'date','label'=>'Birthday', 'dateFormat'=>'DMY')); 
     61 echo '<div style="clear:both;margin-top:15px"> </dvi>'; 
     62 echo $this->Form->end('Save');  
     63   ?> 
    8064</fieldset> 
    8165</form> 
  • trunk/views/contacts/admin_listing.ctp

    r392 r460  
    1 <div class="title_section">Contacts</div> 
     1<?php 
    22 
    3 <div style="float:right"> <?php echo $this->Html->link($this->Html->image('admin/icon_export.gif', array('alt'=>"Export Contacts", 'title'=>"Export Contacts to LDIF format")), '/admin/contacts/export/'.$session->read('Auth.User.username'), null, false, false); ?></div> 
    4 <p> <?php echo $this->Html->link($this->Html->image('admin/new.gif', array('alt'=>"Add new", 'title'=>"Add new")), '/admin/contacts/add', null, false, false); ?></p> 
     3echo $this->Html->div('title_section', 'Contacts'); 
    54 
    6 <table class="tbadmin" style="width:100%"> 
    7 <?php 
    8 //die(print_r($data)); 
     5echo  $this->Html->div(Null, $this->Html->link($this->Html->image('admin/icon_export.gif', array('alt'=>'Export Contacts', 'title'=>'Export Contacts to LDIF format')), '/admin/contacts/export/'.$session->read('Auth.User.username'), array('escape'=>False)), array('style'=>'float:right;width:300px;'));  
     6 
     7echo $this->Html->para(Null, $this->Html->link($this->Html->image('admin/new.gif', array('alt'=>'Add new', 'title'=>'Add new')), '/admin/contacts/add', array('escape'=>False)));  
     8 
     9echo '<table class="tbadmin" style="width:100%">'; 
    910 
    1011$th = array ('Edit', 'First Name', 'Last Name', 'Email', 'WorkPhone', 'CellPhone', 'See all data', 'Delete'); 
     
    1213echo $this->Html->tableHeaders($th);     
    1314 
    14 foreach ($data as $key=>$val) 
    15     { 
    16              
    17        $tr = array ( 
     15foreach ($data as $key=>$val):    
     16    $tr = array ( 
    1817        $gags->sendEdit($val['Contact']['id'], 'contacts'), 
    1918        $val['Contact']['firstname'], 
     
    2221        $val['Contact']['workphone'], 
    2322        $val['Contact']['cellphone'], 
    24         $this->Html->link($this->Html->image('admin/icon-mg.png', array('alt'=>"See data", 'title'=>"See data")), '/admin/contacts/single/'.$val['Contact']['id'], null, null, false), 
     23        $this->Html->link($this->Html->image('admin/icon-mg.png', array('alt'=>'See data', 'title'=>'See data')), '/admin/contacts/single/'.$val['Contact']['id'], array('escape'=>False)), 
    2524        $gags->confirmDel($val['Contact']['id'], 'contacts') 
    2625        ); 
    27         
    28     echo $this->Html->tableCells($tr, array('class'=>"altRow", "onmouseover"=>"this.className='highlight'", "onmouseout"=>"this.className='altRow'"),  
    29                                 array('class'=>'evenRow',"onmouseover"=>"this.className='highlight'", "onmouseout"=>"this.className='evenRow'")); 
    30      
    31     } 
    32 ?> 
    33 </table> 
     26  
     27    echo $this->Html->tableCells($tr, $gags->aRow, $gags->eRow); 
     28endforeach; 
    3429 
    35 <?php  
    36 //echo $pagination;  
    37 ?> 
     30echo '</table>'; 
    3831 
     32# echo $pagination;  
     33# ? > EOF 
     34 
Note: See TracChangeset for help on using the changeset viewer.