Changeset 319

Show
Ignore:
Timestamp:
03/11/08 17:33:34 (10 months ago)
Author:
aarkerio
Message:

New images an changes in forums

Location:
trunk/app
Files:
7 added
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/app/app_controller.php

    r308 r319  
    2020     $this->Auth->loginError = 'Invalid e-mail / password combination. Please try again'; 
    2121     $this->Auth->authorize = 'controller';   
    22      $this->Auth->allow( array('view', 'display', 'subscribe', 'recover', 'register', 'insert', 'vote', 'download') ); 
     22     $this->Auth->allow( array('view', 'display', 'subscribe', 'recover', 'register', 'insert', 'vote', 'download', 'blog','portfolio', 'about', 'message') ); 
    2323     $this->Auth->autoRedirect = true; 
    2424     $this->set('cU', $this->Auth->user());  // $cU current user array to use in the views if user logged 
  • trunk/app/controllers/catforums_controller.php

    r247 r319  
    33*  Chipotle Software TM 
    44*  Manuel Montoya 2002-2008 
    5 *  GPL v3 manuel<at>mononeurona<punto>org 
     5*  GPL v3 manuel<arroba>mononeurona<punto>org 
    66*/  
    77  
     
    1313     
    1414 public $components    = array('Edublog');   
     15 
     16 public function isAuthorized() 
     17 {      
     18    if (isset( $this->params[Configure::read('Routing.admin')] )) 
     19    { 
     20        if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 )  // admin and teachers 
     21        { 
     22               return true; 
     23    } 
     24    } 
     25    return false;  // go away !! 
     26 } 
    1527  
    16   public function isAuthorized()  
    17   { 
    18     if ($this->action == 'delete')  
    19       { 
    20     if ($this->Auth->user('group_id') == 1)  
    21           { 
    22         return true; 
    23           } else { 
    24         return false; 
    25           } 
    26       } 
    27   
    28     return true; 
    29   }    
    30  
    3128 public function display($username, $user_id)  
    3229 {  
     
    5552        $this->pageTitle = 'Forums'; 
    5653         
    57         $conditions = array("user_id"=>$this->othAuth->user('id')); 
     54        $conditions = array("user_id"=>$this->Auth->user('id')); 
    5855         
    59         if ($this->othAuth->user('group_id') == 1 && $admin != null) 
     56        if ($this->Auth->user('group_id') == 1 && $admin != null) 
    6057        { 
    6158            $conditions["website"] = 1; 
     
    7370     $this->layout = 'admin'; 
    7471        // adds new classroom to database 
    75      if (!empty($this->data["Catforum"])) 
     72     if (!empty($this->data['Catforum'])) 
    7673     {      
    7774          $this->Sanitize = new Sanitize; 
    7875           
    79           $this->Sanitize->cleanArray($this->data); //Hopefully this is enough 
     76          $this->Sanitize->clean($this->data['Catforum']);  
    8077           
    81           $this->data["Catforum"]["user_id"] = $this->othAuth->user('id'); 
     78          $this->data['Catforum']['user_id'] = $this->Auth->user('id'); 
    8279           
    83           if ($this->Catforum->save($this->data["Catforum"])) 
    84            { 
     80          $this->Catforum->create(); 
     81           
     82          if ($this->Catforum->save($this->data['Catforum'])) 
     83      { 
    8584                  $this->msgFlash('Forum category added', '/admin/catforums/listing'); 
    8685          } 
    87      } 
     86    } 
    8887 } 
    8988  
     
    102101        $this->Sanitize = new Sanitize; 
    103102         
    104         $this->Sanitize->cleanArray($this->data["Catforum"]); //Hopefully this is enough 
     103        $this->Sanitize->clean($this->data['Catforum']); 
    105104         
    106         if ($this->Catforum->save($this->data["Catforum"])) 
     105        if ($this->Catforum->save($this->data['Catforum'])) 
    107106        { 
    108107            $this->msgFlash('Forum category saved', '/admin/catforums/listing'); 
  • trunk/app/views/catforums/admin_listing.ctp

    r258 r319  
    1818</script> 
    1919 
    20 <?php echo $html->link($html->image('admin/new.gif', array("alt"=>"Add new", "title"=>"Add new")), '#', array("onclick"=>"hU()"), false, false) ?> 
     20<?php echo $html->link($html->image('actions/new.png', array("alt"=>"Add new forum", "title"=>"Add new forum")), '#', array("onclick"=>"hU()"), false, false) ?> 
    2121 
    2222<table class="tbadmin" id="tbl"> 
    2323<tr style="text-align:left;display:none;border:1px dotted grey;padding:6px" id="trh"> 
    2424<td colspan="7"> 
    25   <?php echo $html->formTag('/admin/catforums/add/','post'); ?> 
     25  <?php echo $form->create('Catforum', array('action'=>'admin_add')); ?> 
    2626  <fieldset> 
    2727     <legend>Add new Category Forum</legend> 
    2828     <?php  
    29            echo $form->labelTag('Catforum/title', 'Title:') . $html->input('Catforum/title', array("size"=>60, "maxlength"=>150)); 
    30            echo $form->labelTag('Catforum/description', 'description:' ); 
    31            echo $html->input('Catforum/description', array("size"=>60, "maxlength"=>150)); 
    32            echo $form->labelTag('Catforum/status', 'Actived:') . $html->checkbox('Catforum/status', 1); 
    33            echo '<div style="clear:both"></div>'; 
    34            echo $html->submit('Send');  
     29           echo $form->input('Catforum.title', array("size"=>50, "maxlength"=>150));   
     30           echo $form->input('Catforum.description', array("size"=>70, "maxlength"=>150)); 
     31           echo $form->label('Catforum.status', 'Actived:') . $form->checkbox('Catforum.status'); 
     32           echo '<div style="clear:both"></div></fieldset>'; 
     33           echo $form->end('Save');  
    3534     ?> 
    36 </fieldset> 
    37 </form> 
    3835</td> 
    3936</tr> 
     
    4744             
    4845       $tr = array (  
    49                $gags->sendEdit($val['Catforum']['id'], 'catforums'), 
     46               $gags->sendEdit($val['Catforum']['id'], 'Catforum'), 
    5047                $html->link($html->image('admin/add-forum.jpg', array("alt"=>"Add Forum", "title"=>"Add Forum")), '/admin/forums/add/'.$val['Catforum']['id'], null, null, false), 
    5148               $val['Catforum']['title'], 
    5249               $val['Catforum']['description'], 
    5350               $gags->setStatus($val['Catforum']['status']), 
    54                $gags->confirmDel($val['Catforum']['id'], 'catforums'), 
     51               $gags->confirmDel($val['Catforum']['id'], 'Catforum'), 
    5552               '&nbsp;' 
    5653        ); 
     
    6057      foreach ( $val['Forum'] as $v) 
    6158      { 
    62          echo '<tr><td>&nbsp;</td> <td> '.  $gags->sendEdit($v["id"], 'forums') .'</td>  <td> '. $v["title"] .'</td>  <td colspan="2"> '. $v["description"] .' </td>'; 
     59         echo '<tr><td>&nbsp;</td> <td> '.  $gags->sendEdit($v["id"], 'forums') .'</td>'; 
     60         echo '<td>' . $v["title"] .'</td>  <td colspan="2"> '. $v["description"] .' </td>'; 
    6361         echo '<td>' . $gags->setStatus($v['status']).'</td>  <td> ' .  $gags->confirmDel($v["id"], 'forums') . '</td> </tr>'; 
    6462      } 
  • trunk/app/views/elements/admin_menu.ctp

    r247 r319  
    2929       </ul> 
    3030  </li> 
    31   <li><a href="/admin/catglossaries/listing">Glossaries</a> 
     31  <li><?php echo $html->link('Glossaries', '/admin/catglossaries/listing'); ?> 
    3232       <ul> 
    33           <li><a href="/admin/catglossaries/add">New Glossarie</a> </li> 
     33          <li><?php echo $html->link('New Glossary', '/admin/catglossaries/add'); ?></li> 
    3434       </ul> 
    3535  </li> 
    36   <li><a href="/admin/tests/listing">Tests</a> 
     36  <li><?php echo $html->link('Tests', '/admin/tests/listing'); ?> 
    3737       <ul> 
    38           <li><a href="/admin/tests/add">New Test</a> </li> 
     38          <li><?php echo $html->link('New Test', '/admin/tests/add'); ?></li> 
     39       </ul> 
     40  </li> 
     41  <li><?php echo $html->link('Forums', '/admin/catforums/listing'); ?> 
     42       <ul> 
     43       <li> <?php echo $html->link('New forum', '/admin/catforums/add'); ?> 
    3944       </ul> 
    4045  </li>