Show
Ignore:
Timestamp:
05/14/08 14:52:22 (8 months ago)
Author:
aarkerio
Message:

Message interfase

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/views/messages/compose.ctp

    r487 r488  
    1 <div class="barra">Compose new message</div> 
     1<?php 
     2echo $javascript->link('controls'); 
     3?> 
     4<style type="text/css"> 
     5div.auto_complete { 
     6  position         :absolute; 
     7  width            :120px; 
     8  background-color :white; 
     9  border           :1px solid #888; 
     10  margin           :0; 
     11  padding          :0; 
     12} 
     13 
     14div.auto_complete li { 
     15   margin     : 0; 
     16   padding    : 0; 
     17   color:#000; 
     18   list-style : none; 
     19   font-weight:bold; 
     20} 
     21li.selected { background-color: orange; } 
     22</style> 
    223 
    324<?php         
    4   echo $form->create('Message', array('onsubmit'=>'return false'));  
    5   echo $form->hidden('Message.sender_id',  array("value"=>$cU['User']['id'])); 
    6   echo $form->hidden('Message.username', array("value"=>$cU['User']['username'] )); 
     25  e($html->div('barra', 'Compose new message')); 
     26  e($form->create('Message', array('action'=>'deliver','onsubmit'=>'return validateForm()')));  
    727?> 
    828<fieldset> 
     
    1030<?php  
    1131  echo $form->label('Message.user_id', 'Send message to:' ) . '<br />'; 
    12    echo $ajax->autoComplete('Message.sendern', '/messages/autocomplete') .'<br />';   
    13   echo $cU['User']['username'] . "  escribe: <br />"; 
    14   echo $form->input('Message.title', array("size" => 35, "maxlength" => 50)) . "<br />"; 
     32  echo $ajax->autoComplete('Message.sendern', '/messages/autocomplete') .'<br />';   
     33  echo $cU['User']['username'] . "  writes: <br />"; 
     34 
     35  echo $form->input('Message.title', array("size"=>25, "maxlength"=>50)) . '<br />'; 
    1536 
    1637  echo $form->label('Message.body', 'Message:' ) . '<br />'; 
     
    1940?> 
    2041</fieldset> 
     42 
     43<script type="text/javascript"> 
     44function validateForm() 
     45{  
     46  var title     = document.getElementById("MessageTitle"); 
     47  var body      = document.getElementById("MessageBody"); 
     48  var email     = document.getElementById("MessageEmail"); 
     49  
     50  if (name.value.length < 5) 
     51  { 
     52    alert('Name must have five letters at least'); 
     53    name.focus(); 
     54    return false; 
     55  
     56  } 
     57 
     58  if (username.value.length < 5) 
     59  { 
     60    alert('Username must have five letters at least'); 
     61    username.focus(); 
     62    return false; 
     63  } 
     64 
     65  var space = username.value.indexOf(" "); 
     66   
     67  //alert('at: ' + atpos); 
     68   
     69  if ( space > 0 )  
     70  { 
     71    alert('Username can not contain spaces'); 
     72    username.focus(); 
     73    return false;    
     74  }   
     75 
     76  //check email 
     77  var atpos  = email.value.indexOf("@");    //indexOf find something in your JavaScript string 
     78  var dotpos = email.value.indexOf("."); 
     79   
     80  //alert('at: ' + atpos); 
     81   
     82  if ( atpos < 1 || dotpos < 1 || email.value.length < 5)  
     83  { 
     84    alert('Mmmm, this email ' + email.value + ' does not look as a valid email'); 
     85    email.focus(); 
     86    return false; 
     87  } 
     88 
     89  if (agree.checked == false) 
     90  { 
     91    alert('You must do agree'); 
     92    return false; 
     93  } 
     94 
     95  return true; 
     96} 
     97</script>