| 2 | | echo '<h1>' .$data['Lesson']['title'] . '</h1>'; |
| 3 | | echo '<div>' .$data['Lesson']['body'] . '</div>'; |
| 4 | | echo '<div>' .$data['Lesson']['created'] . '</div>'; |
| | 2 | echo '<h1>' .$data['Lesson']['title'] . '</h1>'; |
| | 3 | echo $html->div(null, $data['Lesson']['body']); |
| | 4 | echo $html->div(null, __('Last edition', true). ': '.$data['Lesson']['created']); |
| | 5 | |
| | 6 | echo $form->create('CommentsLesson', array('onsubmit'=>'return chkForm()', 'action'=>'add')); |
| | 7 | echo $form->hidden('CommentsLesson.redirect_to', array('value'=>'/lessons/view/'.$blog['User']['username'].'/'.$data['Lesson']['id'])); |
| | 8 | echo $form->hidden('CommentsLesson.lesson_id', array('value'=>$data['Lesson']['id'])); |
| | 9 | |
| | 10 | if ( $session->check('Auth.User') ): |
| | 12 | <fieldset> |
| | 13 | <legend id="new_comment"><?php __('New Comment'); ?></legend> |
| | 14 | <?php |
| | 15 | echo $session->read('Auth.User.username') . ' ' . __('writes', true); |
| | 16 | |
| | 17 | echo $form->label('CommentsLesson.comment', 'Comment'); |
| | 18 | echo $form->textarea('CommentsLesson.comment', array('rows' => 10, 'cols' => 50)); |
| | 19 | echo $form->error('CommentsLesson.comment', 'A comment is required.'); |
| | 20 | |
| | 21 | echo $form->end(__('Send', true)); |
| | 22 | echo '</fieldset>'; |
| | 23 | |
| | 24 | else: |
| | 25 | echo $html->para(null, $html->link('You must be logged in to write a comment', '/users/login')); |
| | 26 | endif; |
| | 27 | ?> |
| | 28 | <script type="text/javascript"> |
| | 29 | /* <![CDATA[ */ |
| | 30 | |
| | 31 | function chkForm() |
| | 32 | { |
| | 33 | var title = document.getElementById("CommentsLessonCommentsLesson"); |
| | 34 | |
| | 35 | if (title.value.length < 2) |
| | 36 | { |
| | 37 | alert('Comment too short'); |
| | 38 | title.focus(); |
| | 39 | return false; |
| | 40 | } |
| | 41 | return true; |
| | 42 | } |
| | 43 | /* ]]> */ |
| | 44 | </script> |