Changeset 155

Show
Ignore:
Timestamp:
09/01/10 15:44:14 (17 months ago)
Author:
gnum
Message:

References #100, the second subtask is done, also created a unified standalone comment view, similar logic should be used for any piece of very similar code, unless there are one too many custom cases to handle

Location:
trunk
Files:
1 added
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/actions/ajax/add_facilitator.php

    r139 r155  
    1616        // Check if data is provided 
    1717        if ($facilitator && $educourse->getSubtype() == 'educourse' && edufeedrCanManageEducourse($educourse)) { 
    18  
    19                 /* XXX WE DO NOT INSERT FACILITATOR AS TEACHER YET 
    20                 $es = new EduSuckr; 
    21                 $query = insert_data("INSERT INTO {$CONFIG->dbprefix}edufeedr_course_participants (course_guid, firstname, lastname, email, blog, posts, comments, status) VALUES (".$educourse->getGUID().", 'Course', 'Blog', '".$teacher->email."', '$course_blog', '".$pc['posts']."', '".$pc['comments']."', 'teacher')"); 
    22         $teacher_data = array( 
    23                 'participant_id' => $participant_id, 
    24                 'course_guid' => $educourse->getGUID(), 
    25                 'firstname' => "Course", 
    26                 'lastname' => "Blog", 
    27                 'email' => $teacher->email, 
    28                 'blog' => $course_blog, 
    29                 'posts' => $pc['posts'], 
    30                 'comments' => $pc['comments'], 
    31                 'status' => 'teacher' 
    32                 ); 
    33                  */ 
    3418                // Check if that facilitator has already been added to the course 
    3519                $added_check = get_data("SELECT id from {$CONFIG->dbprefix}edufeedr_course_facilitators WHERE course_guid = {$educourse->getGUID()} and user_guid = {$facilitator->getGUID()}"); 
  • trunk/api.php

    r139 r155  
    148148                $feed->handle_content_type(); 
    149149 
    150                 //XXX We do not handleerrors here, as invalid XML is processed fine, but might raise errors 
     150                //We do not handle errors here, as invalid XML is processed fine, but might raise errors 
    151151                //TODO Think about preprocessing Feed before giving it to SimplePie parser 
    152152                if ($feed->error()) 
  • trunk/languages/en.php

    r153 r155  
    5757        /*  
    5858        File: /edufeedr/views/default/object/educourse.php 
    59         Lines: 63 
     59        Lines: 64 
    6060        Text: Delete course 
    6161        _missing_translation_ 
     
    105105        /*  
    106106        File: /edufeedr/views/default/edufeedr/educourse_blog.php 
    107         Lines: 44 
     107        File: /edufeedr/views/default/edufeedr/singles/educourse_comment.php 
     108        Lines: 44, 50 
    108109        Text: read more 
    109110        _missing_translation_ 
     
    118119        */ 
    119120        "edufeedr:action:download:vcard:file" => "vCard file with Address Book contacts", 
    120          
    121         /*  
    122         File: /edufeedr/open_courses.php 
    123         Lines: 9 
    124         Text: Open courses 
    125         _missing_translation_ 
    126         */ 
    127         "edufeedr:title:open:courses" => "Open courses", 
    128121         
    129122        /*  
     
    334327        /*  
    335328        File: /edufeedr/views/default/edufeedr/educourse_blog.php 
    336         File: /edufeedr/views/default/edufeedr/educourse_blog.php 
    337329        File: /edufeedr/views/default/edufeedr/educourse_post.php 
    338         File: /edufeedr/views/default/edufeedr/educourse_post.php 
    339         Lines: 48, 92, 24, 40 
     330        File: /edufeedr/views/default/edufeedr/singles/educourse_comment.php 
     331        Lines: 48, 24, 59 
    340332        Text: hide 
    341333        _missing_translation_ 
     
    377369        /*  
    378370        File: /edufeedr/views/default/edufeedr/educourse_blog.php 
    379         Lines: 110 
     371        Lines: 86 
    380372        Text: Hidden comments 
    381373        _missing_translation_ 
     
    505497        /*  
    506498        File: /edufeedr/views/default/edufeedr/educourse_post.php 
    507         Lines: 49 
     499        Lines: 40 
    508500        Text: Post a comment 
    509501        _missing_translation_ 
     
    623615         
    624616        /*  
     617        File: /edufeedr/views/default/edufeedr/singles/educourse_comment.php 
     618        Lines: 27 
     619        Text: %s to %s 
     620        _missing_translation_ 
     621        */ 
     622        "edufeedr:post_comment_commenter_to_poster" => "%s to %s", 
     623         
     624        /*  
    625625        File: /edufeedr/actions/join_educourse.php 
    626626        Lines: 65 
     
    882882         
    883883        /*  
    884         File: /edufeedr/views/default/edufeedr/educourse_blog.php 
    885         Lines: 87 
    886         Text: read the post 
    887         _missing_translation_ 
    888         */ 
    889         "edufeedr:read:the:blogpost" => "read the post", 
     884        File: /edufeedr/open_courses.php 
     885        Lines: 9 
     886        Text: Open courses 
     887        _missing_translation_ 
     888        */ 
     889        "edufeedr:title:open:courses" => "Open courses", 
    890890         
    891891        /*  
     
    923923        /*  
    924924        File: /edufeedr/views/default/object/educourse.php 
    925         Lines: 56 
     925        Lines: 57 
    926926        Text: Edit course info 
    927927        _missing_translation_ 
     
    931931        /*  
    932932        File: /edufeedr/views/default/edufeedr/educourse_blog.php 
    933         Lines: 107 
     933        Lines: 83 
    934934        Text: Hidden posts 
    935935        _missing_translation_ 
  • trunk/languages/et.php

    r153 r155  
    5757        /*  
    5858        File: /edufeedr/views/default/object/educourse.php 
    59         Lines: 63 
     59        Lines: 64 
    6060        Text: Delete course 
    6161        _missing_translation_ 
     
    105105        /*  
    106106        File: /edufeedr/views/default/edufeedr/educourse_blog.php 
    107         Lines: 44 
     107        File: /edufeedr/views/default/edufeedr/singles/educourse_comment.php 
     108        Lines: 44, 50 
    108109        Text: read more 
    109110        _missing_translation_ 
     
    118119        */ 
    119120        "edufeedr:action:download:vcard:file" => "vCard file with Address Book contacts", 
    120          
    121         /*  
    122         File: /edufeedr/open_courses.php 
    123         Lines: 9 
    124         Text: Open courses 
    125         _missing_translation_ 
    126         */ 
    127         "edufeedr:title:open:courses" => "Open courses", 
    128121         
    129122        /*  
     
    334327        /*  
    335328        File: /edufeedr/views/default/edufeedr/educourse_blog.php 
    336         File: /edufeedr/views/default/edufeedr/educourse_blog.php 
    337329        File: /edufeedr/views/default/edufeedr/educourse_post.php 
    338         File: /edufeedr/views/default/edufeedr/educourse_post.php 
    339         Lines: 48, 92, 24, 40 
     330        File: /edufeedr/views/default/edufeedr/singles/educourse_comment.php 
     331        Lines: 48, 24, 59 
    340332        Text: hide 
    341333        _missing_translation_ 
     
    377369        /*  
    378370        File: /edufeedr/views/default/edufeedr/educourse_blog.php 
    379         Lines: 110 
     371        Lines: 86 
    380372        Text: Hidden comments 
    381373        _missing_translation_ 
     
    505497        /*  
    506498        File: /edufeedr/views/default/edufeedr/educourse_post.php 
    507         Lines: 49 
     499        Lines: 40 
    508500        Text: Post a comment 
    509501        _missing_translation_ 
     
    623615         
    624616        /*  
     617        File: /edufeedr/views/default/edufeedr/singles/educourse_comment.php 
     618        Lines: 27 
     619        Text: %s to %s 
     620        _missing_translation_ 
     621        */ 
     622        "edufeedr:post_comment_commenter_to_poster" => "%s to %s", 
     623         
     624        /*  
    625625        File: /edufeedr/actions/join_educourse.php 
    626626        Lines: 65 
     
    882882         
    883883        /*  
    884         File: /edufeedr/views/default/edufeedr/educourse_blog.php 
    885         Lines: 87 
    886         Text: read the post 
    887         _missing_translation_ 
    888         */ 
    889         "edufeedr:read:the:blogpost" => "read the post", 
     884        File: /edufeedr/open_courses.php 
     885        Lines: 9 
     886        Text: Open courses 
     887        _missing_translation_ 
     888        */ 
     889        "edufeedr:title:open:courses" => "Open courses", 
    890890         
    891891        /*  
     
    923923        /*  
    924924        File: /edufeedr/views/default/object/educourse.php 
    925         Lines: 56 
     925        Lines: 57 
    926926        Text: Edit course info 
    927927        _missing_translation_ 
     
    931931        /*  
    932932        File: /edufeedr/views/default/edufeedr/educourse_blog.php 
    933         Lines: 107 
     933        Lines: 83 
    934934        Text: Hidden posts 
    935935        _missing_translation_ 
  • trunk/views/default/edufeedr/educourse_blog.php

    r154 r155  
    6868                                        $comm_date = date('d.m.Y', $comment['date']); 
    6969                                } 
    70                 $chtml .= "<h4 style=\"padding-top:15px;\">".$comment['title']."</h4>"; 
    71                 /*$chtml .= "<div><i>".$comment['author']."</i></div>";*/ 
    72                 $chtml .= "<em>".date("d.m.Y G:i",$comment['date'])."</em>"; 
    73                 $chtml .= "<div>"; 
    74                 if (strlen($comment['content'])>200) { 
    75                     $last_space = strrpos(substr($comment['content'], 0, 200), ' '); 
    76                         $content_piece = substr($comment['content'], 0, $last_space); 
    77                     $chtml .= '<div id="comment_intro_'.$c.'">'.$content_piece.'...</div>'; 
    78                     $chtml .= '<div id="comment_'.$c.'" style="display:none">'.$comment['content'].'</div>'; 
    79                                 } else { 
    80  
    81                     $chtml .= $comment['content']; 
    82                                 } 
    83  
    84                                 if ($comment['post_id']) { 
    85                                         $chtml .= '<div class="clearfloat"></div>'; 
    86                                         /*translation:read the post*/ 
    87                                         $chtml .= '<a href="'.$vars['url'].'pg/edufeedr/view_post/'.$vars['entity']->getGUID().'/'.$comment['post_id'].'">' . elgg_echo('edufeedr:read:the:blogpost') . '</a>'; 
    88                                 } 
    89                                 // Hide comment 
    90                                 if ($vars['entity']->canEdit() && edufeedrCanEditEducourse($vars['entity'])) { 
    91                                         /*translation:hide*/ 
    92                                         $chtml .= ' | <a href="'.$vars['url'].'action/edufeedr/hide_comment?comment_id='.$comment['id'].'&educourse='.$vars['entity']->getGUID().'&__elgg_ts='.$ts.'&__elgg_token='.$token.'">' . elgg_echo('edufeedr:action:hide'). '</a>'; 
    93                                 } 
    94                                 $chtml .= '</div>'; 
     70                                $chtml .= elgg_view('edufeedr/singles/educourse_comment', array('educourse' => $vars['entity'], 'comment' => $comment, 'type' => 'coursefeed')); 
    9571                                $c++; 
    9672            } 
  • trunk/views/default/edufeedr/educourse_post.php

    r132 r155  
    3232                        if (is_array($data['comments']) && sizeof($data['comments']) > 0) { 
    3333                                foreach ($data['comments'] as $comment) { 
    34                                     $body .= '<div class="edufeedr_post_comment">'; 
    35                                         $body .= '<em>' . date('d.m.Y G:i', $comment['date']) . '</em>'; 
    36                                         $body .= '<div class="edufeedr_comment_content">' . $comment['content'] . '</div>'; 
    37                                         // Hide comment 
    38                                         if ($vars['entity']->canEdit() && edufeedrCanEditEducourse($vars['entity'])) { 
    39                                                 /*translation:hide*/ 
    40                                                 $body .= '<a href="'.$vars['url'].'action/edufeedr/hide_comment?comment_id='.$comment['id'].'&educourse='.$vars['entity']->getGUID().'&__elgg_ts='.$ts.'&__elgg_token='.$token.'">' . elgg_echo('edufeedr:action:hide') . '</a>'; 
    41                                         } 
    42  
    43                                     $body .= '</div>'; 
     34                                        $body .= elgg_view('edufeedr/singles/educourse_comment', array('educourse' => $vars['entity'], 'comment' => $comment, 'type' => 'viewpost')); 
    4435                                } 
    4536                        }