Changeset 701
- Timestamp:
- 08/08/08 16:03:49 (4 months ago)
- Location:
- trunk/app
- Files:
-
- 19 modified
-
app_model.php (modified) (1 diff)
-
controllers/catglossaries_controller.php (modified) (1 diff)
-
controllers/entries_controller.php (modified) (3 diffs)
-
controllers/lessons_controller.php (modified) (1 diff)
-
controllers/news_controller.php (modified) (3 diffs)
-
locale/spa/LC_MESSAGES/default.po (modified) (3 diffs)
-
models/answer.php (modified) (2 diffs)
-
models/catglossary.php (modified) (2 diffs)
-
models/entry.php (modified) (3 diffs)
-
models/lesson.php (modified) (1 diff)
-
models/news.php (modified) (1 diff)
-
views/entries/admin_add.ctp (modified) (2 diffs)
-
views/entries/admin_edit.ctp (modified) (2 diffs)
-
views/glossaries/admin_edit.ctp (modified) (2 diffs)
-
views/news/admin_add.ctp (modified) (4 diffs)
-
views/news/admin_edit.ctp (modified) (4 diffs)
-
views/news/admin_listing.ctp (modified) (2 diffs)
-
views/quotes/admin_listing.ctp (modified) (3 diffs)
-
views/users/admin_edit.ctp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/app_model.php
r699 r701 82 82 public function invalidate($field, $value = true) 83 83 { 84 return parent::invalidate($field, __($value, true));84 return parent::invalidate($field, __($value, true)); 85 85 } 86 86 } -
trunk/app/controllers/catglossaries_controller.php
r700 r701 109 109 } 110 110 111 public function admin_edit($catglossary_id=null)112 {113 $this->layout = 'admin';111 public function admin_edit($catglossary_id=null) 112 { 113 $this->layout = 'admin'; 114 114 115 115 if ( empty( $this->data['Catglossary'] ) ): -
trunk/app/controllers/entries_controller.php
r696 r701 123 123 $this->layout = 'admin'; 124 124 125 $this->set('subjects', Set::combine($this->Entry->Subject->find('all', array('order' => 'title')),"{n}.Subject.id","{n}.Subject.title"));126 127 if ( !empty($this->data['Entry']) )128 {125 $this->set('subjects',Set::combine($this->Entry->Subject->find('all', array('order'=>'title')),"{n}.Subject.id","{n}.Subject.title")); 126 127 if ( !empty($this->data['Entry']) ): 128 129 129 $this->Sanitize = new Sanitize; 130 130 … … 134 134 135 135 $this->data['Entry']['user_id'] = $this->Auth->user('id'); 136 137 $this->Entry->create();138 136 139 137 if ($this->Entry->save($this->data)): … … 146 144 endif; 147 145 endif; 148 }146 endif; 149 147 } 150 148 -
trunk/app/controllers/lessons_controller.php
r697 r701 31 31 32 32 $this->layout = $this->Edublog->layout($user_id); 33 33 34 34 $this->Edublog->blog($user_id); // blogger elements 35 35 36 $this->LessonTitle = __('Lesson', true);36 $this->LessonTitle = $username .' '. __('Lessons', true); 37 37 38 38 $conditions = array('Lesson.id'=>$id, 'Lesson.status'=>1); -
trunk/app/controllers/news_controller.php
r696 r701 114 114 115 115 /*** ======ADMIN METHODS === *****/ 116 public function admin_listing( $page=1)116 public function admin_listing() 117 117 { 118 118 $this->pageTitle = 'News manager'; … … 147 147 $this->set('themes', Set::combine($this->News->Theme->find('all', array('order'=>'theme')),"{n}.Theme.id","{n}.Theme.theme")); 148 148 149 if (!empty($this->data["News"])) 150 { 149 if (!empty($this->data['News'])): 151 150 $this->Sanitize = new Sanitize; 152 151 153 $this->Sanitize->paranoid($this->data[ "News"]["title"]);154 155 $this->Sanitize->paranoid($this->data[ "News"]["reference"]);156 157 $this->Sanitize->html($this->data[ "News"]["body"]);158 159 $this->data[ "News"]["user_id"] = $this->Auth->user('id');152 $this->Sanitize->paranoid($this->data['News']['title']); 153 154 $this->Sanitize->paranoid($this->data['News']['reference']); 155 156 $this->Sanitize->html($this->data['News']['body']); 157 158 $this->data['News']['user_id'] = $this->Auth->user('id'); 160 159 161 160 $this->News->create(); 162 161 163 if ($this->News->save($this->data["News"])) 164 { 165 if ( $this->data["News"]["end"] == 1 ) 166 { 167 $this->msgFlash('Story added!','/admin/news/listing'); 168 } 169 else 170 { 171 $id = $this->News->getLastInsertID(); 172 $this->msgFlash('Story added','/admin/news/edit/'.$id); 173 } 174 } 175 } 176 } 177 178 public function admin_edit($id=null) 179 { 180 $this->layout = 'admin'; 181 182 if ( empty( $this->data["News"] ) ) 183 { 184 $this->News->id = $id; 185 186 $this->data = $this->News->read(); 187 188 $this->set('themes', Set::combine($this->News->Theme->find('all', array('order'=>'theme')),"{n}.Theme.id","{n}.Theme.theme")); 189 } 190 else 191 { 162 if ($this->News->save($this->data)): 163 if ( $this->data['News']['end'] == 1 ): 164 $this->msgFlash(__('Data saved', true),'/admin/news/listing'); 165 else: 166 $id = $this->News->getLastInsertID(); 167 $this->msgFlash(__('Data saved', true),'/admin/news/edit/'.$id); 168 endif; 169 endif; 170 endif; 171 } 172 173 public function admin_edit($news_id=null) 174 { 175 $this->layout = 'admin'; 176 177 $this->set('themes', Set::combine($this->News->Theme->find('all', array('order'=>'theme')),"{n}.Theme.id","{n}.Theme.theme")); 178 179 if ( empty($this->data['News']) ): 180 $this->data = $this->News->read(null, $news_id); 181 else: 192 182 $this->Sanitize = new Sanitize; 193 183 194 184 $this->Sanitize->paranoid($this->data['News']['title']); 195 185 … … 198 188 $this->Sanitize->html($this->data['News']['body']); 199 189 200 if ($this->News->save($this->data['News'])) 201 { 202 if ( $this->data["News"]["end"] == 1 ) 203 { 204 $this->msgFlash('Story saved', '/admin/news/listing'); 205 } 206 else 207 { 208 $this->msgFlash('Story saved', '/admin/news/edit/'.$this->data["News"]["id"]); 209 } 210 } 211 } 212 } 213 214 public function admin_delete($id) 190 if ($this->News->save($this->data)): 191 if ( $this->data['News']['end'] == 1 ): 192 $this->msgFlash(__('Data saved', true), '/admin/news/listing'); 193 else: 194 $this->msgFlash(__('Data saved', true), '/admin/news/edit/'.$this->data['News']['id']); 195 endif; 196 endif; 197 endif; 198 } 199 200 public function admin_delete($news_id) 215 201 { 216 if ( $this->News->del($id) ) 217 { 218 $this->msgFlash('New deleted', '/admin/news/listing'); 219 } 220 else 221 { 222 $this->flash('Database error!', '/admin/news/listing'); 223 } 202 if ( $this->News->del($news_id) ): 203 $this->msgFlash(__('Data removed', true), '/admin/news/listing/'); 204 endif; 224 205 } 225 206 } -
trunk/app/locale/spa/LC_MESSAGES/default.po
r699 r701 4 4 msgid "New item" 5 5 msgstr "Nuevo término" 6 7 msgid "Title must be at least four characters long" 8 msgstr "El tÃtulo debe tener al menos cuatro letras" 9 10 msgid "Entry must be at least 8 characters long" 11 msgstr "La entrada debe tener al menos ocho letras" 6 12 7 13 msgid "Message sent" … … 482 488 msgstr "Temas noticias" 483 489 490 msgid "Theme" 491 msgstr "Tema" 492 493 msgid "profile" 494 msgstr "perfil" 495 496 msgid "Your URL format lucks incorrect" 497 msgstr "El formato del URL parece incorrecto" 498 499 msgid "See comments" 500 msgstr "Ver comentarios" 501 484 502 msgid "Help" 485 503 msgstr "Ayuda" … … 491 509 msgstr "Examenes" 492 510 511 msgid "Name" 512 msgstr "Nombre" 513 514 msgid "eduBlog name" 515 msgstr "Nombre del eduBlog" 516 493 517 msgid "New Test" 494 518 msgstr "Nuevo examen" -
trunk/app/models/answer.php
r365 r701 8 8 class Answer extends AppModel { 9 9 10 public $belongsTo = array('Question' =>10 public $belongsTo = array('Question' => 11 11 array('className' => 'Question', 12 12 'conditions' => '', … … 16 16 ); 17 17 18 public $validate = array( 19 'comment' => VALID_NOT_EMPTY, 20 'user_id' => VALID_NOT_EMPTY, 21 'entry_id' => VALID_NOT_EMPTY, 22 'username' => VALID_NOT_EMPTY 23 ); 24 18 19 public $validate = array( 20 'answer' => array( 21 'rule' => array('minLength', 2), 22 'message' => 'Answer must be at least two characters long', 23 'allowEmpty' => false, 24 'required' => true 25 ), 26 'correct' => array( 27 'rule' => 'numeric', 28 'allowEmpty' => false, 29 'required' => true 30 ), 31 'question_id' => array( 32 'rule' => 'numeric', 33 'allowEmpty' => false, 34 'required' => true 35 ), 36 'user_id' => array( 37 'rule' => 'numeric', 38 'allowEmpty' => false, 39 'required' => true 40 ) 41 ); 25 42 } 26 43 ?> -
trunk/app/models/catglossary.php
r282 r701 8 8 class Catglossary extends AppModel 9 9 { 10 public $name = 'Catglossary';10 public $name = 'Catglossary'; 11 11 12 public $belongsTo = array('User' =>12 public $belongsTo = array('User' => 13 13 array('className' => 'User', 14 14 'conditions' => null, … … 20 20 ); 21 21 22 public $hasMany = array('Glossary' =>22 public $hasMany = array('Glossary' => 23 23 array('className' => 'Glossary', 24 'foreignKey' => 'catglossary_id' 24 'foreignKey' => 'catglossary_id', 25 'order' => 'item' 25 26 ) 26 27 ); 27 28 28 29 29 public $validate = array( 30 'title' => VALID_NOT_EMPTY, 31 'description' => VALID_NOT_EMPTY, 32 'user_id' => VALID_NOT_EMPTY, 33 'status' => VALID_NOT_EMPTY 30 public $validate = array( 31 'title' => array( 32 'rule' => array('minLength', 8), 33 'message' => 'Title must be at least 8 characters long', 34 'allowEmpty' => false, 35 'required' => true 36 ), 37 38 'description' => array( 39 'rule' => array('minLength', 8), 40 'message' => 'Title must be at least 8 characters long', 41 'allowEmpty' => false, 42 'required' => true 43 ) 34 44 ); 35 36 45 } 37 38 46 ?> -
trunk/app/models/entry.php
r593 r701 5 5 { 6 6 7 public $belongsTo = array('User' =>7 public $belongsTo = array('User' => 8 8 array('className' => 'User', 9 9 'conditions' => '', … … 19 19 ); 20 20 21 public $hasMany = array('Comment' =>21 public $hasMany = array('Comment' => 22 22 array('className' => 'Comment', 23 23 'conditions' => null, … … 30 30 ) 31 31 ); 32 33 public $validate = array( 34 'title' => VALID_NOT_EMPTY, //'/[a-z0-9\_\-]{3,}$/i', 35 'user_id' => VALID_NOT_EMPTY, 36 'body' => VALID_NOT_EMPTY, 37 'status' => VALID_NOT_EMPTY 32 33 public $validate = array( 34 'title' => array( 35 'rule' => array('minLength', 4), 36 'message' => 'Title must be at least four characters long', 37 'allowEmpty' => false, 38 'required' => true 39 ), 40 41 'body' => array( 42 'rule' => array('minLength', 8), 43 'message' => 'Entry must be at least 8 characters long', 44 'allowEmpty' => false, 45 'required' => true 46 ) 38 47 ); 39 48 40 public function getComments($blogger_id) 41 { 42 49 public function getComments($blogger_id) 50 { 43 51 $conditions = array('Entry.user_id'=>$blogger_id); 44 52 $fields = array('Entry.title', 'Entry.id'); -
trunk/app/models/lesson.php
r632 r701 37 37 ); 38 38 39 public $validate = array( 40 'title' => VALID_NOT_EMPTY, //'/[a-z0-9\_\-]{3,}$/i', 41 'body' => VALID_NOT_EMPTY, 42 'user_id' => VALID_NOT_EMPTY 39 public $validate = array( 40 'title' => array( 41 'rule' => array('minLength', 4), 42 'message' => 'Title must be at least four characters long', 43 'allowEmpty' => false, 44 'required' => true 45 ), 46 47 'body' => array( 48 'rule' => array('minLength', 8), 49 'message' => 'Entry must be at least 8 characters long', 50 'allowEmpty' => false, 51 'required' => true 52 ), 53 'user_id' => array( 54 'rule' => 'numeric', 55 'allowEmpty' => false, 56 'required' => true 57 ) 43 58 ); 44 /*45 public $validate = array(46 'login' => array('alphanumeric' => array(47 'rule' => 'alphaNumeric',48 'required' => true,49 'message' => 'Alphabets and numbers only'50 ),51 'between' => array(52 'rule' => array('between', 5, 15),53 'message' => 'Between 5 to 15 characters'54 )55 ),56 'password' => array(57 'rule' => array('minLength', '8'),58 'message' => 'Mimimum 8 characters long'59 ),60 'email' => 'email',61 'born' => array(62 'rule' => 'date',63 'message' => 'Enter a valid date',64 'allowEmpty' => true65 )66 ); */67 59 } 68 60 ?> -
trunk/app/models/news.php
r537 r701 32 32 ); 33 33 34 public $validate = array(35 'title' => VALID_NOT_EMPTY,36 'user_id' => VALID_NOT_EMPTY,37 'body' => VALID_NOT_EMPTY,38 'status' => VALID_NOT_EMPTY39 );40 /*41 34 public $validate = array( 42 'login' => array('alphanumeric' => array( 43 'rule' => 'alphaNumeric', 44 'required' => true, 45 'message' => 'Alphabets and numbers only' 46 ), 47 'between' => array( 48 'rule' => array('between', 5, 15), 49 'message' => 'Between 5 to 15 characters' 50 ) 51 ), 52 'password' => array( 53 'rule' => array('minLength', '8'), 54 'message' => 'Mimimum 8 characters long' 55 ), 56 'email' => 'email', 57 'born' => array( 58 'rule' => 'date', 59 'message' => 'Enter a valid date', 60 'allowEmpty' => true 61 ) 62 ); */ 35 'title' => array( 36 'rule' => array('minLength', 4), 37 'message' => 'Title must be at least four characters long', 38 'allowEmpty' => false, 39 'required' => true 40 ), 41 'body' => array( 42 'rule' => array('minLength', 8), 43 'message' => 'Entry must be at least 8 characters long', 44 'allowEmpty' => false, 45 'required' => true 46 ), 47 'reference' => array( 48 'rule' => 'url', 49 'allowEmpty' => true, 50 'required' => false, 51 'message' => 'Your URL format lucks incorrect', 52 ), 53 'theme_id' => array( 54 'rule' => 'numeric', 55 'allowEmpty' => false, 56 'required' => true 57 ) 58 ); 63 59 } 64 60 ?> -
trunk/app/views/entries/admin_add.ctp
r633 r701 13 13 <?php 14 14 echo $form->input('Entry.title', array('size' => 50, 'maxlength' => 50, 'label'=>__('Title', true))); 15 echo $form->error('Entry.title' , 'Title is required.');15 echo $form->error('Entry.title'); 16 16 ?> 17 17 </td> … … 31 31 echo $form->textarea('Entry.body', array('cols'=>80, 'rows'=>30)); 32 32 echo $fck->load('EntryBody', 'Karamelo'); 33 echo $form->error('Entry.body'); 33 34 ?> 34 35 </td></tr> -
trunk/app/views/entries/admin_edit.ctp
r679 r701 51 51 <td> 52 52 <?php 53 echo $form->label('Entry.end', 'Finish edition');53 echo $form->label('Entry.end', __('Finish edition', true) ); 54 54 echo $form->checkbox('Entry.end', array('value'=>1)); 55 55 ?> … … 62 62 </tr> 63 63 </table> 64 65 64 </fieldset> -
trunk/app/views/glossaries/admin_edit.ctp
r318 r701 1 <div>2 1 <?php 3 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 4 echo $html->addCrumb('Glossaries', '/admin/catglossaries/listing'); 5 echo $html->getCrumbs(' / '); 6 ?> 7 </div> 8 9 <?php 2 echo $html->addCrumb('Control Panel', '/admin/entries/start'); 3 echo $html->addCrumb(__('Glossaries', true), '/admin/catglossaries/listing'); 4 echo $html->getCrumbs(' / '); 5 10 6 echo $form->create('Glossary'); 11 7 echo $form->hidden('Glossary.id'); … … 13 9 ?> 14 10 <fieldset> 15 <legend> Edit Item</legend>11 <legend><?php __('Edit item'); ?></legend> 16 12 <?php 17 echo $form->input('Glossary.item', array( "size" => 30, "maxlength"=> 90));13 echo $form->input('Glossary.item', array('size' => 30, 'maxlength' => 90)); 18 14 echo $form->error('Glossary.item', 'An item is required.'); 19 15 20 echo $form->label('Glossary.definition', 'Definition:');21 echo $form->textarea('Glossary.definition', array( "cols" => 40, "rows"=> 6));16 echo $form->label('Glossary.definition', __('Definition', true)); 17 echo $form->textarea('Glossary.definition', array('cols' => 40, 'rows' => 6)); 22 18 echo $form->error('Glossary.definition', 'A category definition is required.'); 23 ?>
