Changeset 635

Show
Ignore:
Timestamp:
07/09/08 19:24:21 (3 months ago)
Author:
aarkerio
Message:

Added image and comments fixed

Location:
trunk/app
Files:
8 modified
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/app/config/routes.php

    r407 r635  
    99 * ...and connect the rest of 'blog' controller's urls. 
    1010 */ 
    11     Router::connect('/blog/*', array('controller' => 'users', 'action' => 'blog')); 
     11    Router::connect('/blog/*', array('controller' => 'entries', 'action' => 'display')); 
    1212/** 
    1313 * Then we connect url '/test' to our test controller. This is helpfull in 
  • trunk/app/controllers/comments_controller.php

    r631 r635  
    3232    if ($username != null): 
    3333      $user_id    = $this->User->field('id', array("username"=>$username)); 
    34     $conditions["user_id"] = $user_id; 
     34      $conditions["user_id"] = $user_id; 
    3535    endif; 
    3636       
     
    5151    if (!empty($this->data["Comment"]) ): 
    5252          
    53       $this->Sanitize = new Sanitize; 
     53      $this->Sanitize = new Sanitize;  
     54      $this->Sanitize->clean($this->data["Comment"]); //Hopefully this is enough 
     55      $this->Comment->create(); 
    5456        
    55     $this->Sanitize->clean($this->data["Comment"]); //Hopefully this is enough 
    56         
    57     $this->Comment->create(); 
    58         
    59     if ($this->Comment->save($this->data["Comment"])): 
    60       $this->msgFlash('Comment added', $this->data['Comment']['redirect_to'].'/#comments'); 
    61     endif; 
     57      if ($this->Comment->save($this->data["Comment"])): 
     58           $this->msgFlash(__('Comment added', true), $this->data['Comment']['redirect_to'].'/#comments'); 
     59      endif; 
    6260    endif; 
    6361  } 
  • trunk/app/controllers/entries_controller.php

    r593 r635  
    1919 public $components    = array('Edublog', 'Portal', 'Search'); 
    2020 
     21 public $paginate = array('limit' => 7, 'page' => 1, 'order' => array('Entry.id' => 'DESC'), 'fields'=> array('Entry.title', 'Entry.body', 'Entry.created', 'Entry.user_id', 'Entry.discution', 'Entry.subject_id', 'Entry.id', 'User.username', 'Subject.title', 'Subject.id') 
     22  ); 
     23 
    2124 public function beforeFilter()  
    2225 { 
     
    2528 }  
    2629  
     30 public function display($username = null)  
     31 { 
     32   if ($username == null): 
     33           $this->redirect("/"); 
     34           return false; 
     35   endif; 
     36      
     37   $this->pageTitle = $username . '\'s Blog'; 
     38         
     39   $user_id  = $this->Entry->User->field('id', array('username'=>$username)); 
     40         
     41   $conditions = array('Entry.user_id'=>$user_id, 'Entry.status'=>1); 
     42      
     43   $data = $this->paginate('Entry', $conditions); 
     44      
     45   $this->set(compact('data')); 
     46      
     47   $this->layout    = $this->Edublog->layout($user_id); 
     48      
     49   $this->Edublog->blog($user_id); 
     50 } 
     51  
     52 public function view($username, $entry_id)  
     53 { 
     54  if ($entry_id == null): 
     55           $this->redirect('/blog/'.$username); 
     56           return false; 
     57  endif; 
     58      
     59  $this->pageTitle = $username . '\'s Blog'; 
     60      
     61  $user_id = $this->Entry->User->field('User.id', array("username"=>$username)); 
     62      
     63  if ($username == null || $user_id == null): 
     64           $this->redirect("/"); 
     65           return false; 
     66  endif; 
     67      
     68  $conditions = array('Entry.user_id'=>$user_id, 'Entry.status'=>1, 'Entry.id'=>$entry_id); 
     69      
     70  $fields   = array("Entry.title", "Entry.body", "Entry.created", "Entry.user_id", "Entry.discution", "Entry.subject_id", "Entry.id", "User.username", "Subject.title", "Subject.id"); 
     71           
     72  $this->set('data', $this->Entry->find($conditions, $fields));  
     73      
     74  $this->layout    = $this->Edublog->layout($user_id); 
     75      
     76  $this->Edublog->blog($user_id); // blogger elements 
     77 } 
     78  
     79 
    2780 public function rss($username) 
    2881 { 
  • trunk/app/controllers/users_controller.php

    r634 r635  
    4141     if ($username == null): 
    4242           $this->redirect("/"); 
     43           return false; 
    4344     endif; 
    4445      
     
    5657      
    5758     $limit      = 7; 
    58       
    59      $this->set('data', $this->User->Entry->findAll($conditions, $fields, $order, $limit));  
     59 
     60     //$this->set('data', $this->News->findAll($conditions, $fields, $order, $limit)); 
     61     $data = $this->paginate('Entry', array('Entry.status = 1')); 
     62      
     63     $this->set(compact('data')); 
     64      
     65     //$this->set('data', $this->User->Entry->findAll($conditions, $fields, $order, $limit));  
    6066      
    6167     $this->layout    = $this->Edublog->layout($user_id); 
  • trunk/app/locale/eng/LC_MESSAGES/default.po

    r587 r635  
    1919msgid  "where_pin" 
    2020msgstr "Where is my PIN?" 
     21 
     22msgid  "participa" 
     23msgstr "It's advisable to have your participation recorded on your own computer. Before you write here, write and save your participation using a simple text editor like Wordpad or Gedit. After you have done this, copy it and paste it here. Your participation should be plain text, without any format, tables or images." 
  • trunk/app/locale/spa/LC_MESSAGES/default.po

    r634 r635  
    11msgid  "Group" 
    22msgstr "Grupo" 
     3 
     4msgid  "Groups" 
     5msgstr "Grupos" 
    36 
    47msgid  "Email" 
     
    368371msgstr "Recordarme" 
    369372 
    370 msgid  "part_advice" 
     373msgid  "participa" 
    371374msgstr "Es una buena costumbre mantener tu propio registro de participaciones, antes de ecribir aquí, escribe y guarda tu particación usando un editor  de texto sencillo como Wordpad o Gedit, luego copia y pegala aquí. La participación debe ser texto plano sin formato, sin tablas ni imágenes." 
  • trunk/app/views/elements/vclassrooms.ctp

    r445 r635  
    11<?php 
    2 echo $html->div('temas','Groups'); 
     2echo $html->div('temas', __('Groups', true)); 
    33 
    4 foreach ($blog['Vclassroom'] as $val)  
    5 { 
    6   echo $html->link($val['name'], '/vclassrooms/show/'.$val['user_id'].'/'. $val['id'], array("class"=>"petit")) . "<br />\n"; 
    7 } 
     4foreach ($blog['Vclassroom'] as $val): 
     5   echo $html->link($val['name'], '/vclassrooms/show/'.$val['user_id'].'/'. $val['id'], array("class"=>"petit")) . "<br />\n"; 
     6endforeach; 
    87?> 
    98 
  • trunk/app/views/entries/display.ctp

    r634 r635  
    1313  e($html->div('body_entry', $val['Entry']['body'])); 
    1414     
    15   $pl = 'Permalink: http://' . $_SERVER['SERVER_NAME'] . '/users/entry/'.$val["User"]["username"].'/'.$val['Entry']['id']; 
     15  $pl = 'http://' . $_SERVER['SERVER_NAME'] . '/entries/view/'.$val['User']['username'].'/'.$val['Entry']['id']; 
    1616     
    17   e($html->div('plink',$html->link($pl, '/users/entry/'.$val["User"]["username"].'/'.$val['Entry']['id']))); 
     17  e($html->div('plink',$html->link('Permalink: '.$pl, $pl))); 
    1818     
    1919  if ( $val['Entry']['discution'] == 1):  //is the comments in this entry actived and is an individual entry? 
    20     e($html->div('plink', $html->image('static/comentarios.gif', array('alt'=>__('Add comment', true))).'  '.$html->link(__('Add comment', true).'  ('.count($val['Comment']).')', '/users/entry/'.$val['User']['username'].'/'.$val['Entry']['id']))); 
     20    e($html->div('plink', $html->image('static/comentarios.gif', array('alt'=>__('Add comment', true))).'  '.$html->link(__('Add comment', true).'  ('.count($val['Comment']).')', $pl))); 
    2121  endif; 
    2222endforeach; 
     23 
     24$paginator->options(array('url' => $val['User']['username'])); 
     25 
     26$t  = $html->div(null,$paginator->prev('« Previous ',null,null,array('class'=>'disabled')),array('style'=>'width:100px;float:left')); 
     27$t .= $html->div(null,$paginator->next(' Next »', null, null, array('class' => 'disabled')),array('style'=>'width:100px;float:right')); 
     28$t .= $html->div(null,$paginator->counter(), array('style'=>'width:200px;float:center')); 
     29echo  $html->div(null,$t, array('style'=>'font-size:9pt;width:400px;margin:15px auto;')); 
    2330?> 
  • trunk/app/views/entries/view.ctp

    r634 r635  
    1010 e($html->div('body_entry', $data['Entry']['body'])); 
    1111     
    12  $pl = 'Permalink: http://' . $_SERVER['SERVER_NAME'] . '/users/entry/'.$blog['User']['username'].'/'.$entry_id; 
     12 $pl = 'http://' . $_SERVER['SERVER_NAME'] . '/entries/view/'.$blog['User']['username'].'/'.$entry_id; 
    1313  
    14  e($html->div('plink', $html->link($pl, '/users/entry/'.$blog['User']['username'].'/'.$entry_id))); 
     14 e($html->div('plink', $html->link('Permalink: '. $pl, $pl))); 
    1515         
    16  if ( $discution == 1 )  //is the comments in this entry actived by blogger? 
    17  { 
     16 if ( $discution == 1 ):  //is the comments in this entry actived by blogger? 
     17  
    1818   if ( $session->check('Auth.User') ):  // if user logged, anchor to textarea 
    1919        echo  $html->div(null, $html->image('static/comment.gif', array('alt'=>'Comments')) . '  Comments:', array('id'=>'comments'));   
     
    3939         
    4040        echo $form->create('Comment', array('onsubmit'=>'return chkForm()', 'action'=>'add')); 
    41         echo $form->hidden('Comment.redirect_to', array('value'=>'/users/entry/'.$blog['User']['username'].'/'.$entry_id)); 
     41        echo $form->hidden('Comment.redirect_to', array('value'=>'/entries/view/'.$blog['User']['username'].'/'.$entry_id)); 
    4242        echo $form->hidden('Comment.entry_id', array('value'=>$entry_id)); 
    4343         
     
    5555            echo $form->error('Comment.comment', 'A comment is required.');  
    5656          
    57             echo $form->end('Send');  
     57            echo $form->end(__('Send', true));  
    5858            echo '</fieldset>';         
    5959    else: 
    60             echo $html->para(null, $html->link('You must be logged in to write a comment', '/users/login')); 
     60            echo $html->para(null, $html->link(__('You must be logged in to write a comment', true), '/users/login')); 
    6161    endif; 
    6262          
    6363         echo "</div>"; 
    64   } 
     64 endif; 
    6565?> 
    6666<script type="text/javascript"> 
  • trunk/app/views/vclassrooms/participation.ctp

    r561 r635  
    11<?php 
    2 echo $html->div('hint', 'It\'s advisable to have your participation recorded on your own computer. Before you write here, write and save your participation using a simple text editor like Wordpad or Gedit. After you have done this, copy it and paste it here. Your participation should be plain text, without any format, tables or images.'); 
     2echo $html->div('hint', __('participa', true)); 
    33  
    44echo $form->create('Participation', array('action'=>'add', 'onsubmit'=>'return validateForm()'));