Changeset 319
- Timestamp:
- 03/11/08 17:33:34 (10 months ago)
- Location:
- trunk/app
- Files:
-
- 7 added
- 4 modified
-
app_controller.php (modified) (1 diff)
-
controllers/catforums_controller.php (modified) (5 diffs)
-
views/catforums/admin_listing.ctp (modified) (3 diffs)
-
views/elements/admin_menu.ctp (modified) (1 diff)
-
webroot/img/admin/add-forum.jpg (added)
-
webroot/img/admin/message_board.gif (added)
-
webroot/img/admin/message_e.gif (added)
-
webroot/img/admin/message_n.gif (added)
-
webroot/img/admin/message_r.gif (added)
-
webroot/img/admin/new.gif (added)
-
webroot/img/admin/progress.png (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/app_controller.php
r308 r319 20 20 $this->Auth->loginError = 'Invalid e-mail / password combination. Please try again'; 21 21 $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') ); 23 23 $this->Auth->autoRedirect = true; 24 24 $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 3 3 * Chipotle Software TM 4 4 * Manuel Montoya 2002-2008 5 * GPL v3 manuel<a t>mononeurona<punto>org5 * GPL v3 manuel<arroba>mononeurona<punto>org 6 6 */ 7 7 … … 13 13 14 14 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 } 15 27 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 31 28 public function display($username, $user_id) 32 29 { … … 55 52 $this->pageTitle = 'Forums'; 56 53 57 $conditions = array("user_id"=>$this-> othAuth->user('id'));54 $conditions = array("user_id"=>$this->Auth->user('id')); 58 55 59 if ($this-> othAuth->user('group_id') == 1 && $admin != null)56 if ($this->Auth->user('group_id') == 1 && $admin != null) 60 57 { 61 58 $conditions["website"] = 1; … … 73 70 $this->layout = 'admin'; 74 71 // adds new classroom to database 75 if (!empty($this->data[ "Catforum"]))72 if (!empty($this->data['Catforum'])) 76 73 { 77 74 $this->Sanitize = new Sanitize; 78 75 79 $this->Sanitize->clean Array($this->data); //Hopefully this is enough76 $this->Sanitize->clean($this->data['Catforum']); 80 77 81 $this->data[ "Catforum"]["user_id"] = $this->othAuth->user('id');78 $this->data['Catforum']['user_id'] = $this->Auth->user('id'); 82 79 83 if ($this->Catforum->save($this->data["Catforum"])) 84 { 80 $this->Catforum->create(); 81 82 if ($this->Catforum->save($this->data['Catforum'])) 83 { 85 84 $this->msgFlash('Forum category added', '/admin/catforums/listing'); 86 85 } 87 }86 } 88 87 } 89 88 … … 102 101 $this->Sanitize = new Sanitize; 103 102 104 $this->Sanitize->clean Array($this->data["Catforum"]); //Hopefully this is enough103 $this->Sanitize->clean($this->data['Catforum']); 105 104 106 if ($this->Catforum->save($this->data[ "Catforum"]))105 if ($this->Catforum->save($this->data['Catforum'])) 107 106 { 108 107 $this->msgFlash('Forum category saved', '/admin/catforums/listing'); -
trunk/app/views/catforums/admin_listing.ctp
r258 r319 18 18 </script> 19 19 20 <?php echo $html->link($html->image('a dmin/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) ?> 21 21 22 22 <table class="tbadmin" id="tbl"> 23 23 <tr style="text-align:left;display:none;border:1px dotted grey;padding:6px" id="trh"> 24 24 <td colspan="7"> 25 <?php echo $ html->formTag('/admin/catforums/add/','post'); ?>25 <?php echo $form->create('Catforum', array('action'=>'admin_add')); ?> 26 26 <fieldset> 27 27 <legend>Add new Category Forum</legend> 28 28 <?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'); 35 34 ?> 36 </fieldset>37 </form>38 35 </td> 39 36 </tr> … … 47 44 48 45 $tr = array ( 49 $gags->sendEdit($val['Catforum']['id'], ' catforums'),46 $gags->sendEdit($val['Catforum']['id'], 'Catforum'), 50 47 $html->link($html->image('admin/add-forum.jpg', array("alt"=>"Add Forum", "title"=>"Add Forum")), '/admin/forums/add/'.$val['Catforum']['id'], null, null, false), 51 48 $val['Catforum']['title'], 52 49 $val['Catforum']['description'], 53 50 $gags->setStatus($val['Catforum']['status']), 54 $gags->confirmDel($val['Catforum']['id'], ' catforums'),51 $gags->confirmDel($val['Catforum']['id'], 'Catforum'), 55 52 ' ' 56 53 ); … … 60 57 foreach ( $val['Forum'] as $v) 61 58 { 62 echo '<tr><td> </td> <td> '. $gags->sendEdit($v["id"], 'forums') .'</td> <td> '. $v["title"] .'</td> <td colspan="2"> '. $v["description"] .' </td>'; 59 echo '<tr><td> </td> <td> '. $gags->sendEdit($v["id"], 'forums') .'</td>'; 60 echo '<td>' . $v["title"] .'</td> <td colspan="2"> '. $v["description"] .' </td>'; 63 61 echo '<td>' . $gags->setStatus($v['status']).'</td> <td> ' . $gags->confirmDel($v["id"], 'forums') . '</td> </tr>'; 64 62 } -
trunk/app/views/elements/admin_menu.ctp
r247 r319 29 29 </ul> 30 30 </li> 31 <li>< a href="/admin/catglossaries/listing">Glossaries</a>31 <li><?php echo $html->link('Glossaries', '/admin/catglossaries/listing'); ?> 32 32 <ul> 33 <li>< a href="/admin/catglossaries/add">New Glossarie</a></li>33 <li><?php echo $html->link('New Glossary', '/admin/catglossaries/add'); ?></li> 34 34 </ul> 35 35 </li> 36 <li>< a href="/admin/tests/listing">Tests</a>36 <li><?php echo $html->link('Tests', '/admin/tests/listing'); ?> 37 37 <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'); ?> 39 44 </ul> 40 45 </li>
