Changeset 485

Show
Ignore:
Timestamp:
05/14/08 00:45:34 (8 months ago)
Author:
aarkerio
Message:

Messages system

Location:
trunk/app
Files:
2 added
3 modified

Legend:

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

    r484 r485  
    1616 public function beforeFilter()  
    1717 { 
    18     $this->Auth->allow(array('message', 'deliver', 'listing', 'compose', 'display', 'add', 'send')); 
     18    $this->Auth->allow(array('message', 'deliver', 'listing', 'compose', 'display', 'add', 'send', 'autocomplete')); 
    1919    parent::beforeFilter(); 
    2020 } 
     
    111111  
    112112   $this->Portal->statics(); // Charge Portal components aka Sidebars 
     113 } 
     114 
     115 public function autocomplete() 
     116 { 
     117    //Partial strings will come from the autocomplete field as 
     118    //$this->data['Post']['subject']  
     119 
     120    $this->set('users',  $this->Message->User->findAll("username LIKE '{$this->data['Message']['sendern']}%'")); 
     121      
     122    $this->layout = 'ajax'; 
    113123 } 
    114124 
  • trunk/app/views/messages/listing.ctp

    r483 r485  
    11<?php  
    22// die(debug($data)); 
    3 echo $html->link($html->image('admin/compose_on.gif', array("alt"=>"Compose New Message", "title"=>"Compose New Message")), '/messages/add', null, false, false); 
     3echo $html->link($html->image('admin/compose_on.gif', array("alt"=>"Compose New Message", "title"=>"Compose New Message")),  
     4'/messages/compose', null, false, false); 
    45 
    56echo $form->create('Message', array('delete', 'onsubmit'=>'return chkList();', 'name'=>'privmsg_list')); 
  • trunk/app/views/users/register.ctp

    r415 r485  
    3737     <br /><br /> 
    3838     <?php echo $form->label('User.description', 'About you and your interests:' );?><br /> 
    39      <?php echo $form->textarea('User.description', array("rows"=>"4", "cols"=>"50")) ?> 
     39     <?php echo $form->textarea('User.description', array("rows"=>4, "cols"=>50)) ?> 
    4040     <br /><br /> 
    41  
     41     <?php echo $form->label('User.agree', 'I read the terms:' );?><br /> 
     42     <?php echo $form->checkbox('User.agree', array("value"=>1)); ?> 
     43     
    4244  <?php echo $ajax->submit('Send', array("url" => "/users/insert/",  
    4345                                         "update"=>"updater", 
     46                     "before" => "return validateData();", 
    4447                                         "loading" => "Element.show('charging');Element.hide('updater')", 
    4548                                         "complete" => "Element.hide('charging');Effect.Appear('updater')" 
     
    4952</div> 
    5053 
    51 <p>Please contact <a href="mailto:webmaster@conrad-college.edu">webmaster@conrad-college.edu</a> if you have doubts or comments about this registration process.</p> 
     54<?php 
     55echo $html->para(null,  
     56'Please contact <a href="mailto:webmaster@conrad-college.edu">webmaster@conrad-college.edu</a> if you have doubts or comments about this registration process.'); 
     57?> 
     58 
     59<script type="text/javascript"> 
     60function validateData() 
     61{  
     62 var pwd       = document.getElementById("UserPwd"); 
     63 var name      = document.getElementById("UserName"); 
     64 var username  = document.getElementById("UserUsername"); 
     65 var email     = document.getElementById("UserEmail"); 
     66 var agree     = document.getElementById("UserAgree");  
     67  
     68 if (name.value.length < 5) 
     69 { 
     70   alert('Name must have five letters at least'); 
     71   name.focus(); 
     72   return false; 
     73  
     74 } 
     75 
     76 if (username.value.length < 5) 
     77 { 
     78   alert('Username must have five letters at least'); 
     79   username.focus(); 
     80   return false; 
     81 } 
     82 
     83 var space = username.value.indexOf(" "); 
     84   
     85 //alert('at: ' + atpos); 
     86   
     87 if ( space > 0 )  
     88 { 
     89   alert('Username can not contain spaces'); 
     90   username.focus(); 
     91   return false;    
     92 }   
     93 
     94 //check email 
     95 var atpos  = email.value.indexOf("@");    //indexOf find something in your JavaScript string 
     96 var dotpos = email.value.indexOf("."); 
     97   
     98 //alert('at: ' + atpos); 
     99   
     100 if ( atpos < 1 || dotpos < 1 || email.value.length < 5)  
     101 { 
     102   alert('Mmmm, this email ' + email.value + ' does not look as a valid email'); 
     103   email.focus(); 
     104   return false; 
     105 } 
     106 
     107 if (agree.checked == false) 
     108 { 
     109   alert('You must do agree'); 
     110   return false; 
     111 } 
     112 
     113 return true; 
     114} 
     115</script>