Changeset 529

Show
Ignore:
Timestamp:
05/20/08 12:57:16 (5 months ago)
Author:
aarkerio
Message:

Login box fixed

Location:
trunk/app
Files:
5 modified

Legend:

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

    r526 r529  
    1212uses('sanitize'); 
    1313 
    14 App::import('Model','User'); 
    15  
    1614class DiscussionsController extends AppController 
    1715{ 
     
    2523 { 
    2624    parent::beforeFilter(); 
    27     $this->Auth->allow(array('captcha', 'add')); 
     25 
     26    if ( $this->Auth->user() ): 
     27         $this->Auth->allow(array('captcha', 'add')); 
     28    endif; 
    2829 } 
    2930 
     
    7071     $this->Discussion->create(); 
    7172          
    72      if ( $this->Discussion->save($this->data['Discussion']) )  //save the comment 
    73      { 
     73     if ( $this->Discussion->save($this->data['Discussion']) ):  //save the comment 
     74 
    7475          $user_id  = $this->Discussion->News->field('user_id', array('News.id'=>$this->data['Discussion']['new_id'])); 
    7576                 
     
    7778                 
    7879          $this->redirect('/news/view/'.$this->data['Discussion']['new_id'].'#cnews'); 
    79      } 
     80     endif; 
    8081   } 
    8182 } 
     
    8687   $this->User = new User; 
    8788 
    88    $this->User->unbindModel(array("hasMany"=>array('Entry', 'Lesson', 'Faq', 'Vclassroom', 'Acquaintance')));                 
     89   $this->User->unbindAll();                 
    8990                                                                               
    9091   $val = $this->User->find(array('User.id'=>$user_id), array("User.name", "User.email")); 
     
    119120 
    120121/*****#### ADMIN METHODS  #####*****/ 
    121  public function admin_listing($limit=20) 
     122 
     123 public function admin_listing($paginate=0, $limit=20) 
    122124 { 
    123125   $this->layout    = 'admin'; 
     
    127129   $conditions  = null; 
    128130 
    129    $fields = array("Discussion.id", "News.title", "Discussion.id", "Discussion.comment", "Discussion.created", "Discussion.name", "Discussion.user_id"); 
     131   $fields = array("Discussion.id", "News.title", "Discussion.id", "Discussion.comment", "Discussion.created", "Discussion.username", "Discussion.user_id"); 
    130132   $order           = "Discussion.id DESC"; 
    131133        
    132    $this->set('data', $this->Discussion->findAll($conditions, $fields, $order, $limit, null, 2)); 
     134   $this->set('data', $this->Discussion->findAll($conditions, $fields, $order, $limit)); 
    133135 } 
    134136  
  • trunk/app/views/discussions/admin_listing.ctp

    r409 r529  
    11<?php 
    2 echo 'later'; 
     2die(debug($data)); 
     3echo $html->addCrumb('Control Tools', '/admin/news/start');  
     4echo $html->addCrumb('Comments', '/admin/comments/listing');  
     5echo $html->getCrumbs(' / ');  
     6  
     7echo $html->div('title_section', 'Comments on News'); 
     8 
     9foreach ($data as $val): 
     10   $tmp  = $html->link($val['Discussion']['title'], '/users/entry/'. $cU['User']['username'] . '/'.$val['Discussion']['id']) . '<br />'; 
     11   $tmp .= $val['Comment']['created'].' <b>'.$val['Comment']['username'].' wrote:</b><br />'; 
     12   $tmp .= $html->para(null, $val['Comment']['comment']); 
     13   $tmp .= $gags->confirmDel($val['Comment']['id'], 'Comment'); 
     14   echo $html->div(null, $tmp); 
     15endforeach; 
    316?> 
    417 
  • trunk/app/views/elements/login_hide.ctp

    r366 r529  
    11<!-- hide by default --> 
    2 <div id="cover" style="display:none;" onclick="hide('cover', 'loginpopup')"> 
     2<div id="cover" style="display:none;" onclick="ocultar()"> 
    33    
    44</div> 
    55<div id="loginpopup" style="display:none"> 
    6 <div style="border-right: 2px solid #D3D3D3; vertical-align: top; padding-right:10px"> 
    7 <?php echo $html->link($html->image('close.gif', array('alt'=>'Close window', 'title'=>'Close window')), 
     6<div style="border:3px solid orange; vertical-align: top; padding:3px 10px 4px 4px"> 
     7<?php  
     8echo $html->div(null,$html->link($html->image('close.gif', array('alt'=>'Close window', 'title'=>'Close window')), 
    89               '#', 
    9                        array("onclick"=>"javascript:hide('loginpopup', 'cover');"),  
    10                        false,  
     10                       array("onclick"=>"ocultar()"), 
     11               null,  
    1112                       false 
    12                       ); 
     13                      ), array('style'=>'width:150px;float:right;')); 
     14  
     15echo  $html->div(null, 'Login', array('style'=>'width:250px;float:left;')); 
     16echo  $html->div(null, '', array('style'=>'clear:both;')); 
     17echo  $form->create('User',array("action"=>"login","onsubmit"=>"return validateLogin()"));  
    1318?> 
    14 <h1>login</h1> 
    15  <p>Already have an account and just want to login?</p> 
    16  
    17 <?php echo  $form->create('User',array("action"=>"login","onsubmit"=>"return validateLogin()")); ?> 
    1819<fieldset> 
    1920<legend>Login</legend> 
     
    2526   echo $form->label('remember_me', 'Remember me:'); 
    2627   echo  $form->checkbox("User.cokie", array("value" => 1)); 
    27 ?> 
    28   <br /> 
    29  </fieldset> 
    30  <?php  
    31        echo $form->end('Login'); 
    32        echo $html->para(null, $html->link('Join us!', '/users/register')); 
    33        echo $html->para(null, $html->link('forgot your password?', '/recovers/recover'));  
     28 
     29   echo $form->end('Login'); 
     30   echo '</fieldset>'; 
     31 
     32   echo $html->div(null, $html->link('Join us!', '/users/register')); 
     33   echo $html->div(null, $html->link('forgot your password?', '/recovers/recover'));  
    3434 ?> 
    3535</div> 
  • trunk/app/views/layouts/portal.ctp

    r494 r529  
    1414    echo $html->charset('UTF-8'); 
    1515    echo $javascript->link('prototype'); 
     16    echo $javascript->link('scriptaculous.js?load=effects'); 
    1617    echo $javascript->link('myfunctions'); 
    17     echo $javascript->link('scriptaculous.js?load=effects'); 
    1818 endif; 
    1919echo $html->css("portal/portal"); 
  • trunk/app/webroot/js/myfunctions.js

    r326 r529  
    33var logged = false; 
    44 
    5 function init() { 
     5function init()  
     6{ 
    67    //Check log 
    78    if (!logged)  
    89    {    
    9         createCookie("karamelo_first", "first", 999999) 
     10        createCookie("karamelo_first", "first", 999999); 
    1011        return;    
    1112    } 
     
    2728}  
    2829 
    29 function validateVote(vote) { 
     30function validateVote(vote)  
     31{ 
    3032         
    3133   valid = false; 
    3234 
    3335   // Opera 5.05 Linux does not support for/in on this object 
    34    for ( var i = 0; i <  vote.length; i++ ) { 
    35       if ( vote[i].checked ) { 
     36   for ( var i = 0; i <  vote.length; i++ )  
     37   { 
     38      if ( vote[i].checked )  
     39      { 
    3640         valid = true; 
    3741         break; 
    3842      } 
    3943   } 
    40    if ( ! valid ) { 
     44 
     45   if ( ! valid )  
     46   { 
    4147      alert("You must choose one"); 
    4248   } 
     
    116122    var name      = document.getElementById('UserName'); 
    117123    var passwd    = document.getElementById('UserPasswd'); 
    118     var email     = document.getElementById('UserEmail'); 
     124 var email     = document.getElementById('UserEmail'); 
    119125     
    120126    if (username.value.length < 6)  
     
    206212} 
    207213 
    208 function hide () {for (i = 0; i < arguments.length; i++) {var e = $(arguments[i]); if (e) e.style.display = "none";}} 
     214function ocultar()  
     215{ 
     216     var Cover = document.getElementById('cover'); 
     217     var Login = document.getElementById('loginpopup'); 
     218      
     219     Cover.style.display = "none"; 
     220     Login.style.display = "none";           
     221} 
     222 
    209223function show () {for (i = 0; i < arguments.length; i++) {var e = $(arguments[i]); if (e) e.style.display = "";}} 
    210224