Changeset 460
- Timestamp:
- 06/18/10 16:55:18 (20 months ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
config/core.php (modified) (3 diffs)
-
controllers/contacts_controller.php (modified) (1 diff)
-
models/comentblog.php (modified) (1 diff)
-
models/contact.php (modified) (2 diffs)
-
views/contacts/admin_edit.ctp (modified) (1 diff)
-
views/contacts/admin_listing.ctp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/config/core.php
r458 r460 141 141 * Actual value depends on 'Security.level' setting. 142 142 */ 143 Configure::write('Session.timeout', '36000 0');143 Configure::write('Session.timeout', '36000'); 144 144 145 145 /** … … 246 246 * Xcache (http://xcache.lighttpd.net/) */ 247 247 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 string253 'user' => 'user', //user from xcache.admin.user settings254 '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 )); 256 256 /* 257 257 * Memcache (http://www.danga.com/memcached/) … … 270 270 */ 271 271 #Cache::config('default', array('engine' => 'File')); 272 # ? > 272 # ? > EOF -
trunk/controllers/contacts_controller.php
r386 r460 68 68 public function admin_edit($id=null) 69 69 { 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; 85 81 } 86 82 87 83 public function admin_single($id=null) 88 84 { 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)); 94 88 } 95 89 96 90 public function admin_delete($id) 97 91 { 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 103 97 } 104 # ? > 98 # ? > EOF -
trunk/models/comentblog.php
r380 r460 55 55 'rule' => 'notEmpty', 56 56 'message' => 'Name must not be empty', 57 'allowEmpty' => false,58 'required' => true57 'allowEmpty' => False, 58 'required' => True 59 59 ) 60 60 ) 61 61 ); 62 62 63 64 63 } 65 # ? > 64 # ? > EOF -
trunk/models/contact.php
r381 r460 12 12 class Contact extends AppModel 13 13 { 14 public $name = 'Contact';14 public $name = 'Contact'; 15 15 16 16 17 public $belongsTo = array(17 public $belongsTo = array( 18 18 'User' => array( 19 19 'className' => 'User', … … 23 23 ); 24 24 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 ) 34 35 ); 35 36 36 37 } 37 38 38 # ? > 39 # ? > EOF -
trunk/views/contacts/admin_edit.ctp
r410 r460 1 1 <?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(' > '); 6 5 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'); 9 8 ?> 10 9 <fieldset> 11 10 <legend>New Contact</legend> 12 11 <?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'))); 16 14 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')); 18 16 19 //last name20 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')); 21 19 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)); 25 22 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)); 29 25 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)); 33 28 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)); 37 31 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)); 41 34 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)); 45 37 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)); 49 40 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)); 53 43 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)); 57 46 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)); 61 49 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)); 65 52 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)); 69 55 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)); 73 58 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 ?> 80 64 </fieldset> 81 65 </form> -
trunk/views/contacts/admin_listing.ctp
r392 r460 1 < div class="title_section">Contacts</div>1 <?php 2 2 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> 3 echo $this->Html->div('title_section', 'Contacts'); 5 4 6 <table class="tbadmin" style="width:100%"> 7 <?php 8 //die(print_r($data)); 5 echo $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 7 echo $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 9 echo '<table class="tbadmin" style="width:100%">'; 9 10 10 11 $th = array ('Edit', 'First Name', 'Last Name', 'Email', 'WorkPhone', 'CellPhone', 'See all data', 'Delete'); … … 12 13 echo $this->Html->tableHeaders($th); 13 14 14 foreach ($data as $key=>$val) 15 { 16 17 $tr = array ( 15 foreach ($data as $key=>$val): 16 $tr = array ( 18 17 $gags->sendEdit($val['Contact']['id'], 'contacts'), 19 18 $val['Contact']['firstname'], … … 22 21 $val['Contact']['workphone'], 23 22 $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)), 25 24 $gags->confirmDel($val['Contact']['id'], 'contacts') 26 25 ); 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); 28 endforeach; 34 29 35 <?php 36 //echo $pagination; 37 ?> 30 echo '</table>'; 38 31 32 # echo $pagination; 33 # ? > EOF 34
Note: See TracChangeset
for help on using the changeset viewer.
