Changeset 348
- Timestamp:
- 03/26/08 12:17:56 (10 months ago)
- Location:
- trunk/app
- Files:
-
- 2 added
- 4 modified
-
controllers/helps_controller.php (modified) (7 diffs)
-
views/elements/admin_menu.ctp (modified) (1 diff)
-
views/elements/email/text/report.ctp (added)
-
views/elements/login.ctp (modified) (1 diff)
-
views/helps/admin_newticket.ctp (added)
-
views/helps/newticket.ctp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/helps_controller.php
r247 r348 3 3 * Chipotle Software TM 4 4 * Manuel Montoya 2002-2008 5 * GPLv3 manuel<a t>mononeurona<dot>org5 * GPLv3 manuel<arroba>mononeurona<punto>org 6 6 */ 7 7 … … 12 12 public $helpers = array('Javascript', 'Ajax', 'Fck', 'Gags'); 13 13 14 public $components = array('Portal', 'Edublog' );14 public $components = array('Portal', 'Edublog', 'Email'); 15 15 16 public function beforeFilter() 17 { 18 $this->Auth->allow(array('display', 'tour')); 19 parent::beforeFilter(); 20 } 21 16 22 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 } 23 { 24 if (isset( $this->params[Configure::read('Routing.admin')] )) 25 { 26 if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ) // admin and teachers 27 { 28 return true; 29 } 30 } 31 return false; // go away !! 32 } 30 33 31 34 public function tour() … … 54 57 $this->set('data', $this->Help->findAll($conditions, $fields)); 55 58 } 56 57 public function newticket() 59 60 /** === ADMIN METHODS === **/ 61 //bug report 62 public function admin_newticket() 58 63 { 59 64 $this->layout = 'admin'; … … 63 68 $this->set('data', $this->Help->findAll($conditions, $fields)); 64 69 } 70 71 public function admin_submit() 72 { 73 if ( !empty( $this->data['Help'] ) ) 74 { 75 $this->Sanitize = new Sanitize; 76 77 $this->Sanitize->clean($this->data['Help']); 78 79 $report = $this->Auth->user('username') .' with email '. $this->Auth->user('email') .', wrote: '; 80 81 $report .= $this->data['Help']['report'] .'. Kind: ' . $this->data['Help']['kind']; 82 83 if ( $this->_sendNewReport( $report ) ) 84 { 85 $this->msgFlash('Email sent, Thanks!', '/admin/entries/start'); 86 } 87 88 } 89 } 90 65 91 public function about() 66 92 { … … 69 95 $this->set('Element', $this->Portal->statics()); // Charge Portal components aka Sidebars 70 96 } 71 72 /** 73 === ADMIN METHODS === 74 **/ 75 76 public function admin_listing() 77 { 97 98 public function admin_listing() 99 { 78 100 $this->layout = 'admin'; 79 101 $conditions = null; … … 84 106 85 107 $this->set('data', $this->Help->findAll($conditions, $fields, $order)); 86 }87 88 public function admin_add()89 {108 } 109 110 public function admin_add() 111 { 90 112 $this->layout = 'admin'; 91 113 92 114 if (!empty($this->data['Help'])) 93 115 { … … 125 147 } 126 148 } 127 }128 129 public function admin_delete($id)130 {149 } 150 151 public function admin_delete($id) 152 { 131 153 $this->Help->del($id); 132 154 $this->msgFlash('Help deleted','/admin/helps/listing'); 133 155 } 156 157 /** ===PRIVATE ===*/ 158 private function _sendNewReport($report) 159 { 160 $this->Email->to = 'mmontoya@gmail.com'; 161 $this->Email->bcc = array('contact@chipotle-software.com'); // note 162 // this could be just a string too 163 $this->Email->subject = 'Karamelo e-Learning:: bug report'; 164 $this->Email->replyTo = 'support@karamelo.org'; 165 $this->Email->from = 'Chipotle-software.com'; 166 $this->Email->template = 'report'; // note no '.ctp' 167 //Send as 'html', 'text' or 'both' (default is 'text') 168 $this->Email->sendAs = 'text'; // because we like to send pretty mail 169 //Set view variables as normal 170 $this->set('report', $report); 171 //Do not pass any args to send() 172 if ( $this->Email->send() ) 173 { 174 return true; 175 } 176 else 177 { 178 return false; 179 } 180 } 134 181 } 135 182 ?> -
trunk/app/views/elements/admin_menu.ctp
r319 r348 45 45 </li> 46 46 47 <li>< a href="/helps/index/set">Help</a>47 <li><?php echo $html->link('Helps', '/admin/helps/listing'); ?> 48 48 <ul> 49 <li>< a href="/helps/newticket">Report Bug</a> </li>50 <li>< a href="http://www.chipotle-software.com/index.php?id=9">Get support</a></li>49 <li><?php echo $html->link('Report bug', '/admin/helps/newticket'); ?> </li> 50 <li><?php echo $html->link('Get support', 'http://www.chipotle-software.com/index.php?id=9'); ?></li> 51 51 </ul> 52 52 </li> -
trunk/app/views/elements/login.ctp
r342 r348 4 4 <legend> Login</legend> 5 5 <?php 6 echo $form->input('User.email', array('size' => 15, 'maxlength'=> 45 )) . '<br />';7 echo $form->label('User.pwd', 'Password: ') ;8 echo $form->password('User.pwd', array('id' => 'user_pwd', 'size' => 9, 'maxlength' => 9)) ;6 echo $form->input('User.email', array('size' => 15, 'maxlength'=> 45, 'between'=>'<br />')) . '<br />'; 7 echo $form->label('User.pwd', 'Password: ').'<br />'; 8 echo $form->password('User.pwd', array('id' => 'user_pwd', 'size' => 9, 'maxlength' => 9)) . '<br />'; 9 9 echo $form->label('User.remember_me', 'Remember me: '); 10 10 echo $form->checkbox('User.remember_me'); -
trunk/app/views/helps/newticket.ctp
r303 r348 1 1 <h1>Reporting bugs</h1> 2 3 <p>You can help the Karamelo developrment team by reporting bugs and making suggestions to improve this application. </p>4 5 6 7 2 <?php 8 9 echo $form->create('Help', array('a dmin_submit'));10 3 echo $html->para(null, 'You can help the Karamelo development team by reporting bugs and making suggestions to improve this application.'); 4 echo $form->create('Help', array('action'=>'submit')); 5 11 6 echo $form->label('Help.report', 'Description:') . '<br />'; 12 7 echo $form->textarea('Help.report', array('rows'=>8, 'cols'=>60)) . '<br />'; 13 8 14 9 echo $form->label('Help.kind', 'Kind:') . '<br />'; 15 10 echo $form->select('Help.kind', array('Enhancement'=>'Enhancement', 'Bug'=>'Bug', 'Suggestion'=>'Suggestion'), null, null, false) . '<br />'; 16 11 17 12 echo $form->end('Send'); 18 13 19 14 $html->link('Submit new ticket', 'http://trac.mononeurona.org/karamelo/newticket'); 20 15
