diff --git a/main/css/academica/default.css b/main/css/academica/default.css index e61f23b97f..cc9ef8ec1f 100644 --- a/main/css/academica/default.css +++ b/main/css/academica/default.css @@ -1272,6 +1272,32 @@ a.specialLink:hover,a.specialLink:focus { background-color: #EFEFEF; } + + +.forum_description { + color: #000; + font-weight: normal; + font-family:Arial,sans,sans-serif; +} + +.forum_title{ + color: #fff; + font-size: 14px; + font-family:Arial,sans,sans-serif; + +} + +.forum_low_description{ + color: #fff; + font-style: italic ; + font-weight: normal; + font-size: 11px; + + font-family:Arial,sans,sans-serif; +} + + + /* ============================================================================== DISPLAY MESSAGES diff --git a/main/css/baby/default.css b/main/css/baby/default.css index 604e43c76b..7f4c7d3bda 100644 --- a/main/css/baby/default.css +++ b/main/css/baby/default.css @@ -1214,6 +1214,30 @@ th span { vertical-align: top; } +.forum_description { + color: #000; + font-weight: normal; + font-family:Arial,sans,sans-serif; +} + +.forum_title{ + color: #317100; + font-size: 14px; + font-family:Arial,sans,sans-serif; + +} + +.forum_low_description{ + color: #000; + font-style: italic ; + font-weight: normal; + + font-size: 11px; + font-family:Arial,sans,sans-serif; +} + + + /* ============================================================================== DISPLAY MESSAGES diff --git a/main/css/corporativa/default.css b/main/css/corporativa/default.css index 80f5a76be4..69f5c14c74 100644 --- a/main/css/corporativa/default.css +++ b/main/css/corporativa/default.css @@ -1178,6 +1178,29 @@ a.specialLink:hover,a.specialLink:focus { background-color: #EFEFEF; } + + +.forum_description { + color: #000; + font-weight: normal; + font-family:Arial,sans,sans-serif; +} + +.forum_title{ + color: #000; + font-size: 14px; + font-family:Arial,sans,sans-serif; + +} +.forum_low_description{ + color: #737780; + font-style: italic ; + font-weight: normal; + font-family:Arial,sans,sans-serif; +} + + + /* ============================================================================== DISPLAY MESSAGES diff --git a/main/css/default/default.css b/main/css/default/default.css index e70d8ce644..2776c6d976 100644 --- a/main/css/default/default.css +++ b/main/css/default/default.css @@ -1598,6 +1598,26 @@ a.forum_group_link { font-weight: lighter; } +.forum_description { + color: #000; + font-weight: normal; + font-family:Arial,sans,sans-serif; +} + +.forum_title{ + color: #000; + font-size: 14px; + font-family:Arial,sans,sans-serif; + +} +.forum_low_description{ + color: #737780; + font-style: italic ; + font-weight: normal; + font-family:Arial,sans,sans-serif; +} + + /* ------------------------------------------------------------------------------ BLOG diff --git a/main/css/default_with_tabs/default.css b/main/css/default_with_tabs/default.css index f32bf5022f..87f348035f 100644 --- a/main/css/default_with_tabs/default.css +++ b/main/css/default_with_tabs/default.css @@ -1090,6 +1090,23 @@ a.forum_group_link { display:inline; } +.forum_description { + color: #000; + font-weight: normal; +} + +.forum_title{ + color: #000; + font-size: 14px; + +} +.forum_low_description{ + color: #737780; + font-style: italic ; + font-weight: normal; +} + + /* **** BLOG **** */ span.blog_title { font-size: 20px; diff --git a/main/css/dokeosgrey/default.css b/main/css/dokeosgrey/default.css index a70d391a3f..88052f067f 100644 --- a/main/css/dokeosgrey/default.css +++ b/main/css/dokeosgrey/default.css @@ -1018,6 +1018,27 @@ a.forum_group_link { display:inline; } + +.forum_description { + color: #000; + font-weight: normal; + font-family:Arial,sans,sans-serif; +} + +.forum_title{ + color: #000; + font-size: 14px; + font-family:Arial,sans,sans-serif; + +} +.forum_low_description{ + color: #737780; + font-style: italic ; + font-weight: normal; + font-family:Arial,sans,sans-serif; +} + + /* **** BLOG **** */ span.blog_title { font-size: 20px; diff --git a/main/forum/editpost.php b/main/forum/editpost.php index 0db81375dd..6f5bbb5dbd 100644 --- a/main/forum/editpost.php +++ b/main/forum/editpost.php @@ -3,7 +3,7 @@ ============================================================================== Dokeos - elearning and course management software - Copyright (c) 2006 Dokeos S.A. + Copyright (c) 2006-2008 Dokeos S.A. Copyright (c) 2006 Ghent University (UGent) For a full list of contributors, see "credits.txt". @@ -142,7 +142,7 @@ if (isset($_POST['add_resources']) AND $_POST['add_resources']==get_lang('Resour Header ----------------------------------------------------------- */ -Display :: display_header(); +Display :: display_header(null); api_display_tool_title($nameTools); ////echo ''; /* @@ -181,23 +181,15 @@ if (!api_is_allowed_to_edit() AND $current_forum['allow_edit']==0) Display Forum Category and the Forum information ----------------------------------------------------------- */ -echo "\n"; +echo "
\n"; -// the forum category -echo "\t\n\t\t\n"; -echo "\t\n"; -// the forum -echo "\t\n"; -echo "\t\t\n\t\t\n"; +echo "\n"; echo "\t\n"; - echo '
"; -echo ''.prepare4display($current_forum_category['cat_title']).'
'; -echo ''.prepare4display($current_forum_category['cat_comment']).''; -echo "
"; +// the forum category +echo "\t
"; echo ''.prepare4display($current_forum['forum_title']).'
'; -echo ''.prepare4display($current_forum['forum_comment']).''; -echo "\n"; +echo ''.prepare4display($current_forum['forum_comment']).'';echo "
'; // the form for the reply @@ -214,7 +206,4 @@ if (!empty($values) and $_POST['SubmitPost']) */ Display :: display_footer(); -?> - - - +?> \ No newline at end of file diff --git a/main/forum/forumfunction.inc.php b/main/forum/forumfunction.inc.php index 0db4390953..ec37817afc 100644 --- a/main/forum/forumfunction.inc.php +++ b/main/forum/forumfunction.inc.php @@ -721,11 +721,21 @@ function display_up_down_icon($content, $id, $list) } if ($position>1) { - $return_value=''; + $return_value=''; } + else + { + $return_value=''; + } + if ($position<$total_items) { - $return_value.=''; + $return_value.=''; + } + else + { + + $return_value.=''; } echo $return_value; @@ -1975,15 +1985,10 @@ function display_user_image($user_id,$name) if ($user_id<>0) { - $image_path = UserManager::get_user_picture_path_by_id($user_id,'web'); + $image_path = UserManager::get_user_picture_path_by_id($user_id,'web',false, true); $image_repository = $image_path['dir']; $existing_image = $image_path['file']; - if (is_array($image_path) && $existing_image!='') { - return $link.''.$name.''; - } - else - return $link.''.$name.''; - + return $link.''.$name.''; } else diff --git a/main/forum/index.php b/main/forum/index.php index 97cd1565ca..67ac546bb9 100644 --- a/main/forum/index.php +++ b/main/forum/index.php @@ -85,7 +85,19 @@ if(!api_is_allowed_to_edit()) $fck_attribute['Config']['UserStatus'] = 'student' Header ----------------------------------------------------------- */ -Display :: display_header($nameTools); +$interbreadcrumb[]=array("url" => "index.php","name" => $nameTools); + +if ($_GET['action']=='add' ) { + + switch ($_GET['content']){ + case 'forum': $interbreadcrumb[] = array ("url" => api_get_self().'?'.api_get_cidreq().'&action=add&content=forum', 'name' => get_lang('AddForum')); break; + case 'forumcategory':$interbreadcrumb[] = array ("url" => api_get_self().'?'.api_get_cidreq().'&action=add&content=forumcategory', 'name' => get_lang('AddForumCategory'));break; + default: break; + } +} + +Display :: display_header(null); + api_display_tool_title($nameTools); //echo ''; @@ -102,277 +114,289 @@ if (api_is_allowed_to_edit()) $fck_attribute['ToolbarSet'] = 'ForumLight'; handle_forum_and_forumcategories(); } -get_whats_new(); -$whatsnew_post_info = array(); -$whatsnew_post_info = $_SESSION['whatsnew_post_info']; - -/* ------------------------------------------------------------ - TRACKING ------------------------------------------------------------ -*/ -include(api_get_path(LIBRARY_PATH).'events.lib.inc.php'); -event_access_tool(TOOL_FORUM); - - -/* ------------------------------------------------------------------------------------------------------- - RETRIEVING ALL THE FORUM CATEGORIES AND FORUMS ------------------------------------------------------------------------------------------------------- -note: we do this here just after het handling of the actions to be sure that we already incorporate the -latest changes -*/ -// Step 1: We store all the forum categories in an array $forum_categories -$forum_categories=array(); -$forum_categories_list=get_forum_categories(); - -// step 2: we find all the forums (only the visible ones if it is a student) -$forum_list=array(); -$forum_list=get_forums(); - -/* ------------------------------------------------------------------------------------------------------- - RETRIEVING ALL GROUPS AND THOSE OF THE USER ------------------------------------------------------------------------------------------------------- -*/ -// the groups of the user -$groups_of_user=array(); -$groups_of_user=GroupManager::get_group_ids($_course['dbName'], $_user['user_id']); -// all groups in the course (and sorting them as the id of the group = the key of the array -$all_groups=GroupManager::get_group_list(); -if(is_array($all_groups)) -{ - foreach ($all_groups as $group) - { - $all_groups[$group['id']]=$group; - } -} - -/* ------------------------------------------------------------------------------------------------------- - ACTION LINKS ------------------------------------------------------------------------------------------------------- -*/ -//if (api_is_allowed_to_edit() and !$_GET['action']) -echo ' '.Display::return_icon('search.gif').' '.get_lang('Search').''; -if (api_is_allowed_to_edit()) -{ - echo ' '.Display::return_icon('forum_category_new.gif').' '.get_lang('AddForumCategory').' '; - if (is_array($forum_categories_list)) - { - echo ' '.Display::return_icon('forum_new.gif').' '.get_lang('AddForum').''; - } - //echo ' | '.get_lang('MigrateForum').''; -} -/* ------------------------------------------------------------------------------------------------------- - Display Forum Categories and the Forums in it ------------------------------------------------------------------------------------------------------- -*/ -echo ''."\n"; -// Step 3: we display the forum_categories first -if(is_array($forum_categories_list)) +if ($_GET['action']!='add' && $_GET['action']!='edit' ) { - foreach ($forum_categories_list as $forum_category_key => $forum_category) + get_whats_new(); + $whatsnew_post_info = array(); + $whatsnew_post_info = $_SESSION['whatsnew_post_info']; + + /* + ----------------------------------------------------------- + TRACKING + ----------------------------------------------------------- + */ + + include(api_get_path(LIBRARY_PATH).'events.lib.inc.php'); + event_access_tool(TOOL_FORUM); + + + /* + ------------------------------------------------------------------------------------------------------ + RETRIEVING ALL THE FORUM CATEGORIES AND FORUMS + ------------------------------------------------------------------------------------------------------ + note: we do this here just after het handling of the actions to be sure that we already incorporate the + latest changes + */ + // Step 1: We store all the forum categories in an array $forum_categories + $forum_categories=array(); + $forum_categories_list=get_forum_categories(); + + // step 2: we find all the forums (only the visible ones if it is a student) + $forum_list=array(); + $forum_list=get_forums(); + + /* + ------------------------------------------------------------------------------------------------------ + RETRIEVING ALL GROUPS AND THOSE OF THE USER + ------------------------------------------------------------------------------------------------------ + */ + // the groups of the user + $groups_of_user=array(); + $groups_of_user=GroupManager::get_group_ids($_course['dbName'], $_user['user_id']); + // all groups in the course (and sorting them as the id of the group = the key of the array + $all_groups=GroupManager::get_group_list(); + if(is_array($all_groups)) { - echo "\t\n\t\t\n"; - if (api_is_allowed_to_edit()) + foreach ($all_groups as $group) { - echo "\t\t\n"; + $all_groups[$group['id']]=$group; } - echo "\t\n"; + } - // step 4: the interim headers (for the forum) - echo "\t\n"; - echo "\t\t\n"; - echo "\t\t\n"; - echo "\t\t\n"; - echo "\t\t\n"; - if (api_is_allowed_to_edit()) + /* + ------------------------------------------------------------------------------------------------------ + ACTION LINKS + ------------------------------------------------------------------------------------------------------ + */ + //if (api_is_allowed_to_edit() and !$_GET['action']) + echo ' '.Display::return_icon('search.gif').' '.get_lang('Search').''; + if (api_is_allowed_to_edit()) + { + echo ' '.Display::return_icon('forum_category_new.gif').' '.get_lang('AddForumCategory').' '; + if (is_array($forum_categories_list)) { - echo "\t\t\n"; + echo ' '.Display::return_icon('forum_new.gif').' '.get_lang('AddForum').''; } - echo "\t\n"; - - // the forums in this category - $forums_in_category=get_forums_in_category($forum_category['cat_id']); + //echo ' | '.get_lang('MigrateForum').''; + } - // step 5: we display all the forums in this category. - $forum_count=0; - foreach ($forum_list as $key=>$forum) + /* + ------------------------------------------------------------------------------------------------------ + Display Forum Categories and the Forums in it + ------------------------------------------------------------------------------------------------------ + */ + echo '
"; - echo ''.prepare4display($forum_category['cat_title']).'
'; - if ($forum_category['cat_comment']<>'' AND trim($forum_category['cat_comment'])<>' ') - { - echo ''.prepare4display($forum_category['cat_comment']).''; - } - echo "
"; - echo "".icon('../img/edit.gif',get_lang('Edit')).""; - echo "".icon('../img/delete.gif',get_lang('Delete')).""; - display_visible_invisible_icon('forumcategory', prepare4display($forum_category['cat_id']), prepare4display($forum_category['visibility'])); - display_lock_unlock_icon('forumcategory',prepare4display($forum_category['cat_id']), prepare4display($forum_category['locked'])); - display_up_down_icon('forumcategory',prepare4display($forum_category['cat_id']), $forum_categories_list); - echo "
".get_lang('Forum')."".get_lang('Topics')."".get_lang('Posts')."".get_lang('LastPosts')."".get_lang('Actions')."
'."\n"; + // Step 3: we display the forum_categories first + if(is_array($forum_categories_list)) + { + foreach ($forum_categories_list as $forum_category_key => $forum_category) { - // Here we clean the whatnew_post_info array a little bit because to display the icon we - // test if $whatsnew_post_info[$forum['forum_id']] is empty or not. - if(is_array($whatsnew_post_info[$forum['forum_id']])) + echo "\t\n\t\t\n"; + + if (api_is_allowed_to_edit()) { - foreach ($whatsnew_post_info[$forum['forum_id']] as $key_thread_id => $new_post_array) - { - if (empty($whatsnew_post_info[$forum['forum_id']][$key_thread_id])) - { - unset($whatsnew_post_info[$forum['forum_id']][$key_thread_id]); - unset($_SESSION['whatsnew_post_info'][$forum['forum_id']][$key_thread_id]); - } - } + echo ''; } - // note: this can be speeded up if we transform the $forum_list to an array that uses the forum_category as the key. - if (prepare4display($forum['forum_category'])==prepare4display($forum_category['cat_id'])) + echo "\t\n"; + + // step 4: the interim headers (for the forum) + echo "\t\n"; + echo "\t\t\n"; + echo "\t\t\n"; + echo "\t\t\n"; + echo "\t\t\n"; + if (api_is_allowed_to_edit()) { - // the forum has to be showed if - // 1.v it is a not a group forum (teacher and student) - // 2.v it is a group forum and it is public (teacher and student) - // 3. it is a group forum and it is private (always for teachers only if the user is member of the forum - // if the forum is private and it is a group forum and the user is not a member of the group forum then it cannot be displayed - //if (!($forum['forum_group_public_private']=='private' AND !is_null($forum['forum_of_group']) AND !in_array($forum['forum_of_group'], $groups_of_user))) - //{ - $show_forum=false; - - // SHOULD WE SHOW THIS PARTICULAR FORUM - // you are teacher => show forum - - if (api_is_allowed_to_edit()) + echo "\t\t\n"; + } + echo "\t\n"; + + // the forums in this category + $forums_in_category=get_forums_in_category($forum_category['cat_id']); + + // step 5: we display all the forums in this category. + $forum_count=0; + + foreach ($forum_list as $key=>$forum) + { + // Here we clean the whatnew_post_info array a little bit because to display the icon we + // test if $whatsnew_post_info[$forum['forum_id']] is empty or not. + if(is_array($whatsnew_post_info[$forum['forum_id']])) { - //echo 'teacher'; - $show_forum=true; + foreach ($whatsnew_post_info[$forum['forum_id']] as $key_thread_id => $new_post_array) + { + if (empty($whatsnew_post_info[$forum['forum_id']][$key_thread_id])) + { + unset($whatsnew_post_info[$forum['forum_id']][$key_thread_id]); + unset($_SESSION['whatsnew_post_info'][$forum['forum_id']][$key_thread_id]); + } + } } - // you are not a teacher - else - { - //echo 'student'; - // it is not a group forum => show forum (invisible forums are already left out see get_forums function) - if ($forum['forum_of_group']=='0') + + // note: this can be speeded up if we transform the $forum_list to an array that uses the forum_category as the key. + if (prepare4display($forum['forum_category'])==prepare4display($forum_category['cat_id'])) + { + // the forum has to be showed if + // 1.v it is a not a group forum (teacher and student) + // 2.v it is a group forum and it is public (teacher and student) + // 3. it is a group forum and it is private (always for teachers only if the user is member of the forum + // if the forum is private and it is a group forum and the user is not a member of the group forum then it cannot be displayed + //if (!($forum['forum_group_public_private']=='private' AND !is_null($forum['forum_of_group']) AND !in_array($forum['forum_of_group'], $groups_of_user))) + //{ + $show_forum=false; + + // SHOULD WE SHOW THIS PARTICULAR FORUM + // you are teacher => show forum + + if (api_is_allowed_to_edit()) { - //echo '-gewoon forum'; + //echo 'teacher'; $show_forum=true; } - // it is a group forum + // you are not a teacher else { - //echo '-groepsforum'; - // it is a group forum but it is public => show - if ($forum['forum_group_public_private']=='public') + //echo 'student'; + // it is not a group forum => show forum (invisible forums are already left out see get_forums function) + if ($forum['forum_of_group']=='0') { + //echo '-gewoon forum'; $show_forum=true; - //echo '-publiek'; } - // it is a group forum and it is private + // it is a group forum else { - //echo '-prive'; - // it is a group forum and it is private but the user is member of the group - if (in_array($forum['forum_of_group'],$groups_of_user)) + //echo '-groepsforum'; + // it is a group forum but it is public => show + if ($forum['forum_group_public_private']=='public') { - //echo '-is lid'; $show_forum=true; + //echo '-publiek'; } + // it is a group forum and it is private else { - //echo '-is GEEN lid'; - $show_forum=false; + //echo '-prive'; + // it is a group forum and it is private but the user is member of the group + if (in_array($forum['forum_of_group'],$groups_of_user)) + { + //echo '-is lid'; + $show_forum=true; + } + else + { + //echo '-is GEEN lid'; + $show_forum=false; + } } + } - } - } - //echo '
'; - - if ($show_forum) - { - $form_count++; - echo "\t\n"; - echo "\t\t\n"; + echo "\t\t\n"; + if ($forum['forum_of_group']<>'0') { - echo icon('../img/forum.gif'); + $group_title=substr($all_groups[$forum['forum_of_group']]['name'],0,30); + $forum_title_group_addition=' ('.$group_title.')'; } else { - echo icon('../img/forum.gif'); + $forum_title_group_addition=''; + } + + echo "\t\t\n"; + //$number_forum_topics_and_posts=get_post_topics_of_forum($forum['forum_id']); // deprecated + // the number of topics and posts + echo "\t\t\n"; + echo "\t\t\n"; + // the last post in the forum + if ($forum['last_poster_name']<>'') + { + $name=$forum['last_poster_name']; + $poster_id=0; + } + else + { + $name=$forum['last_poster_firstname'].' '.$forum['last_poster_lastname']; + $poster_id=$forum['last_poster_id']; + } + echo "\t\t\n"; - if ($forum['forum_of_group']<>'0') - { - $group_title=substr($all_groups[$forum['forum_of_group']]['name'],0,30); - $forum_title_group_addition=' ('.$group_title.')'; - } - else - { - $forum_title_group_addition=''; - } - - echo "\t\t\n"; - //$number_forum_topics_and_posts=get_post_topics_of_forum($forum['forum_id']); // deprecated - // the number of topics and posts - echo "\t\t\n"; - echo "\t\t\n"; - // the last post in the forum - if ($forum['last_poster_name']<>'') - { - $name=$forum['last_poster_name']; - $poster_id=0; - } - else - { - $name=$forum['last_poster_firstname'].' '.$forum['last_poster_lastname']; - $poster_id=$forum['last_poster_id']; - } - echo "\t\t\n"; - - - if (api_is_allowed_to_edit()) - { - echo "\t\t\n"; + + + if (api_is_allowed_to_edit()) + { + echo "\t\t\n"; + } + echo "\t"; } - echo "\t"; - } + } + } + + if (count($forum_list)==0) + { + echo "\t".(api_is_allowed_to_edit()?'':'')."\n"; } - } - if (count($forum_list)==0) - { - echo "\t".(api_is_allowed_to_edit()?'':'')."\n"; } } + echo "
"; + echo ''.prepare4display($forum_category['cat_title']).'
'; + + if ($forum_category['cat_comment']<>'' AND trim($forum_category['cat_comment'])<>' ') + { + echo ''.prepare4display($forum_category['cat_comment']).''; + } + echo "
'; + echo "".icon('../img/edit.gif',get_lang('Edit')).""; + echo "".icon('../img/delete.gif',get_lang('Delete')).""; + display_visible_invisible_icon('forumcategory', prepare4display($forum_category['cat_id']), prepare4display($forum_category['visibility'])); + display_lock_unlock_icon('forumcategory',prepare4display($forum_category['cat_id']), prepare4display($forum_category['locked'])); + display_up_down_icon('forumcategory',prepare4display($forum_category['cat_id']), $forum_categories_list); + echo '
".get_lang('Forum')."".get_lang('Topics')."".get_lang('Posts')."".get_lang('LastPosts')."".get_lang('Actions')."
"; - if ($forum['forum_of_group']!=='0') + + + //echo '
'; + + if ($show_forum) { - if (is_array($whatsnew_post_info[$forum['forum_id']]) and !empty($whatsnew_post_info[$forum['forum_id']])) + $form_count++; + echo "\t
"; + if ($forum['forum_of_group']!=='0') { - echo icon('../img/forumgroupnew.gif'); + if (is_array($whatsnew_post_info[$forum['forum_id']]) and !empty($whatsnew_post_info[$forum['forum_id']])) + { + echo icon('../img/forumgroupnew.gif'); + } + else + { + echo icon('../img/forumgroup.gif'); + } } else { - echo icon('../img/forumgroup.gif'); + if (is_array($whatsnew_post_info[$forum['forum_id']]) and !empty($whatsnew_post_info[$forum['forum_id']])) + { + echo icon('../img/forum.gif'); + } + else + { + echo icon('../img/forum.gif'); + } + } - } - else - { - if (is_array($whatsnew_post_info[$forum['forum_id']]) and !empty($whatsnew_post_info[$forum['forum_id']])) + echo "".prepare4display($forum['forum_title']).''.$forum_title_group_addition.'
'.prepare4display($forum['forum_comment'])."
".$forum['number_of_threads']."".$forum['number_of_posts'].""; + + if (!empty($forum['last_post_id'])) + { + echo $forum['last_post_date']."
".get_lang('By').' '.display_user_link($poster_id, $name); } - - } - echo "
".prepare4display($forum['forum_title']).''.$forum_title_group_addition.'
'.prepare4display($forum['forum_comment'])."
".$forum['number_of_threads']."".$forum['number_of_posts'].""; - if (!empty($forum['last_post_id'])) - { - echo $forum['last_post_date']."
".get_lang('By').' '.display_user_link($poster_id, $name); - } - echo "
"; - echo "".icon('../img/edit.gif',get_lang('Edit')).""; - echo "".icon('../img/delete.gif',get_lang('Delete')).""; - display_visible_invisible_icon('forum',$forum['forum_id'], $forum['visibility']); - display_lock_unlock_icon('forum',$forum['forum_id'], $forum['locked']); - display_up_down_icon('forum',$forum['forum_id'], $forums_in_category); echo ""; + echo "".icon('../img/edit.gif',get_lang('Edit')).""; + echo "".icon('../img/delete.gif',get_lang('Delete')).""; + display_visible_invisible_icon('forum',$forum['forum_id'], $forum['visibility']); + display_lock_unlock_icon('forum',$forum['forum_id'], $forum['locked']); + display_up_down_icon('forum',$forum['forum_id'], $forums_in_category); + echo "
".get_lang('NoForumInThisCategory')."
".get_lang('NoForumInThisCategory')."
\n"; } -echo "\n"; - /* ============================================================================== FOOTER diff --git a/main/forum/newthread.php b/main/forum/newthread.php index 065f0cdc7a..2acb030c9f 100644 --- a/main/forum/newthread.php +++ b/main/forum/newthread.php @@ -3,7 +3,7 @@ ============================================================================== Dokeos - elearning and course management software - Copyright (c) 2006 Dokeos S.A. + Copyright (c) 2006-2008 Dokeos S.A. Copyright (c) 2006 Ghent University (UGent) For a full list of contributors, see "credits.txt". @@ -132,7 +132,7 @@ if($origin=='learnpath') include(api_get_path(INCLUDE_PATH).'reduced_header.inc.php'); } else { - Display :: display_header(); + Display :: display_header(null); api_display_tool_title($nameTools); } //echo ''; @@ -182,23 +182,24 @@ handle_forum_and_forumcategories(); */ echo "\n"; -// the forum category if($origin != 'learnpath') { echo "\t\n\t\t\n"; echo "\t\n"; } - -// the forum -echo "\t\n"; -echo "\t\t\n"; -echo "\t\n"; - echo '
"; - echo ''.$current_forum_category['cat_title'].'
'; - echo ''.$current_forum_category['cat_comment'].''; + + echo ''.prepare4display($current_forum['forum_title']).''; + + if (!empty ($current_forum['forum_comment'])) + { + echo '
'.prepare4display($current_forum['forum_comment']).''; + } + + if (!empty ($current_forum_category['cat_title'])) + { + echo '
'.prepare4display($current_forum_category['cat_title'])."
"; + } echo "
".$current_forum['forum_title']."
"; -echo ''.$current_forum['forum_comment'].''; -echo "
'; $values=show_add_post_form('newthread','', $_SESSION['formelements']); @@ -214,7 +215,4 @@ if (!empty($values) and isset($values['SubmitPost'])) */ Display :: display_footer(); -?> - - - +?> \ No newline at end of file diff --git a/main/forum/reply.php b/main/forum/reply.php index 513211ed3e..9a59ecea50 100644 --- a/main/forum/reply.php +++ b/main/forum/reply.php @@ -3,7 +3,7 @@ ============================================================================== Dokeos - elearning and course management software - Copyright (c) 2006 Dokeos S.A. + Copyright (c) 2006-2008 Dokeos S.A. Copyright (c) 2006 Ghent University (UGent) For a full list of contributors, see "credits.txt". @@ -187,19 +187,17 @@ echo "\n"; // the forum category echo "\t\n\t\t\n"; -echo "\t\n"; -// the forum -echo "\t\n"; -echo "\t\t\n"; -echo "\t\n"; +echo ''.prepare4display($current_thread['thread_title']).'
'; +if (!empty ($current_forum_category['cat_title'])) +{ + echo ''.prepare4display($current_forum_category['cat_title'])." - "; +} + +echo ''.prepare4display($current_forum['forum_title']).''; +echo "\n"; +echo "\t\n"; echo '
"; -echo ''.$current_forum_category['cat_title'].'
'; -echo ''.$current_forum_category['cat_comment'].''; -echo "
"; -echo ''.$current_forum['forum_title'].'
'; -echo ''.$current_forum['forum_comment'].''; -echo "
'; // the form for the reply diff --git a/main/forum/viewforum.php b/main/forum/viewforum.php index 4c5f438b29..958ac502fb 100644 --- a/main/forum/viewforum.php +++ b/main/forum/viewforum.php @@ -3,7 +3,7 @@ ============================================================================== Dokeos - elearning and course management software - Copyright (c) 2006 Dokeos S.A. + Copyright (c) 2006-2008 Dokeos S.A. Copyright (c) 2006 Ghent University (UGent) For a full list of contributors, see "credits.txt". @@ -194,20 +194,26 @@ if (api_is_allowed_to_edit() OR ($current_forum['allow_new_threads']==1 AND isse */ echo "\n"; -// the forum category +// the current forum if($origin != 'learnpath') { - echo "\t\n\t\t\n\t\t\n"; echo "\t\n"; } -// the forum -echo "\t\n"; -echo "\t\t\n"; @@ -216,8 +222,8 @@ echo "\t\n"; echo "\t\t\n"; echo "\t\t\n"; echo "\t\t\n"; -echo "\t\t\n"; echo "\t\t\n"; +echo "\t\t\n"; echo "\t\t\n"; if (api_is_allowed_to_edit()) { @@ -271,24 +277,27 @@ if(is_array($threads)) else { $name=$row['firstname'].' '.$row['lastname']; - } - if($origin != 'learnpath') + } + echo "\t\t\n"; + + if ($row['last_poster_user_id']=='0') { - echo "\t\t\n"; + $name=$row['poster_name']; } else { - echo "\t\t\n"; + $name=$row['last_poster_firstname'].' '.$row['last_poster_lastname']; } - echo "\t\t\n"; - if ($row['last_poster_user_id']=='0') + + if($origin != 'learnpath') { - $name=$row['poster_name']; + echo "\t\t\n"; } else { - $name=$row['last_poster_firstname'].' '.$row['last_poster_lastname']; + echo "\t\t\n"; } + // if the last post is invisible and it is not the teacher who is looking then we have to find the last visible post of the thread if (($row['visible']=='1' OR api_is_allowed_to_edit()) && $origin!='learnpath') { @@ -323,6 +332,8 @@ if(is_array($threads)) echo "\t\n"; } $counter++; + + } } diff --git a/main/forum/viewforumcategory.php b/main/forum/viewforumcategory.php index 85c4a3812a..534129ba33 100644 --- a/main/forum/viewforumcategory.php +++ b/main/forum/viewforumcategory.php @@ -3,7 +3,7 @@ ============================================================================== Dokeos - elearning and course management software - Copyright (c) 2006 Dokeos S.A. + Copyright (c) 2006-2008 Dokeos S.A. Copyright (c) 2006 Ghent University (UGent) For a full list of contributors, see "credits.txt". @@ -93,7 +93,16 @@ $current_forum_category=get_forum_categories($_GET['forumcategory']); $interbreadcrumb[]=array("url" => "index.php","name" => $nameTools); $interbreadcrumb[]=array("url" => "viewforumcategory.php?forumcategory=".$current_forum_category['cat_id'],"name" => prepare4display($current_forum_category['cat_title'])); -Display :: display_header(); + +if (!empty($_GET['action']) && !empty($_GET['content'])) +{ + if ($_GET['action']=='add' && $_GET['content']=='forum' ) + { + $interbreadcrumb[] = array ("url" => api_get_self().'?'.api_get_cidreq().'&action=add&content=forum', 'name' => get_lang('AddForum')); + } +} + +Display :: display_header(null); api_display_tool_title($nameTools); /* @@ -125,6 +134,8 @@ if (api_is_allowed_to_edit()) handle_forum_and_forumcategories(); } +if ($_GET['action']!='add') +{ /* ------------------------------------------------------------------------------------------------------ RETRIEVING ALL THE FORUM CATEGORIES AND FORUMS @@ -163,26 +174,28 @@ if (api_is_allowed_to_edit()) } /* ------------------------------------------------------------ - Display Forum Categories and the Forums in it ------------------------------------------------------------ -*/ -echo "
"; - echo ''.prepare4display($current_forum_category['cat_title']).'
'; - echo ''.prepare4display($current_forum_category['cat_comment']).''; + echo "\t
"; + echo ''.prepare4display($current_forum['forum_title']).''; + + if (!empty ($current_forum['forum_comment'])) + { + echo '
'.prepare4display($current_forum['forum_comment']).''; + } + + if (!empty ($current_forum_category['cat_title'])) + { + echo '
'.prepare4display($current_forum_category['cat_title'])."
"; + } + echo "
".prepare4display($current_forum['forum_title'])."
"; -echo ''.prepare4display($current_forum['forum_comment']).''; echo "\n"; echo "\t
".get_lang('Title')."".get_lang('Replies')."".get_lang('Author')."".get_lang('Views')."".get_lang('Author')."".get_lang('LastPost')."".$row['thread_views']."".display_user_link($row['user_id'], $name)."".$name."".$row['thread_views']."".display_user_link($row['user_id'], $name)."".$name."
\n"; -echo "\t\n\t\t\n"; -if (api_is_allowed_to_edit()) -{ - echo "\t\t\n"; echo "\t\t\n"; echo "\t\n"; -/* -// The added resources -echo ""; -*/ - - // The post has been displayed => it can be removed from the what's new array unset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]); unset($_SESSION['whatsnew_post_info'][$current_forum['forum_id']][$current_thread['thread_id']][$row['post_id']]); @@ -190,40 +290,7 @@ echo "
"; -echo ''.prepare4display($forum_category['cat_title']).'
'; -echo ''.prepare4display($forum_category['cat_comment']).''; -echo "
"; - echo "".icon('../img/edit.gif',get_lang('Edit')).""; - echo "".icon('../img/delete.gif',get_lang('Delete')).""; - display_visible_invisible_icon('forumcategory', $forum_category['cat_id'], $forum_category['visibility'], array("forumcategory"=>$_GET['forumcategory'])); - display_lock_unlock_icon('forumcategory',$forum_category['cat_id'], $forum_category['locked'], array("forumcategory"=>$_GET['forumcategory'])); - display_up_down_icon('forumcategory',$forum_category['cat_id'], $forum_categories_list); + ----------------------------------------------------------- + Display Forum Categories and the Forums in it + ----------------------------------------------------------- + */ + echo "\n"; + + echo "\t\n\t\t\n"; -} -echo "\t\n"; + if (api_is_allowed_to_edit()) + { + + echo '\n"; + } + echo "\t\n"; // step 3: the interim headers (for the forum) echo "\t\n"; @@ -332,7 +345,7 @@ if (count($forum_list)==0) } echo "
"; + echo ''.prepare4display($forum_category['cat_title']).'
'; + echo ''.prepare4display($forum_category['cat_comment']).''; echo "
'; + echo "".icon('../img/edit.gif',get_lang('Edit')).""; + echo "".icon('../img/delete.gif',get_lang('Delete')).""; + display_visible_invisible_icon('forumcategory', $forum_category['cat_id'], $forum_category['visibility'], array("forumcategory"=>$_GET['forumcategory'])); + display_lock_unlock_icon('forumcategory',$forum_category['cat_id'], $forum_category['locked'], array("forumcategory"=>$_GET['forumcategory'])); + display_up_down_icon('forumcategory',$forum_category['cat_id'], $forum_categories_list); + echo "
\n"; - +} /* ============================================================================== FOOTER diff --git a/main/forum/viewthread.php b/main/forum/viewthread.php index c39116f5ea..3d42dc2816 100644 --- a/main/forum/viewthread.php +++ b/main/forum/viewthread.php @@ -3,7 +3,7 @@ ============================================================================== Dokeos - elearning and course management software - Copyright (c) 2006 Dokeos S.A. + Copyright (c) 2006-2008 Dokeos S.A. Copyright (c) 2006 Ghent University (UGent) For a full list of contributors, see "credits.txt". @@ -200,7 +200,25 @@ if ($message<>'PostDeletedSpecial') // in this case the first and only post of t // The link should only appear when the user is logged in or when anonymous posts are allowed. if ($_user['user_id'] OR ($current_forum['allow_anonymous']==1 AND !$_user['user_id'])) { + //reply link echo ''.get_lang('ReplyToThread').''; + + //new thread link + if (api_is_allowed_to_edit() OR ($current_forum['allow_new_threads']==1 AND isset($_user['user_id'])) OR ($current_forum['allow_new_threads']==1 AND !isset($_user['user_id']) AND $current_forum['allow_anonymous']==1)) + { + if ($current_forum['locked'] <> 1 AND $current_forum['locked'] <> 1) + { + echo '  '; + echo ''.Display::return_icon('forumthread_new.gif').' '.get_lang('NewTopic').''; + } + else + { + echo get_lang('ForumLocked'); + } + } + + + } } // note: this is to prevent that some browsers display the links over the table (FF does it but Opera doesn't) @@ -243,32 +261,21 @@ if ($message<>'PostDeletedSpecial') // in this case the first and only post of t // but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table echo "\n"; - // the forum category + // the thread + echo "\t\n\t\t\n\t\t\n"; - echo "\t\n"; + { + echo ''.prepare4display($current_forum_category['cat_title']).' - '; } - - // the forum - echo "\t\n"; - echo "\t\t\n"; - echo "\t\n"; - - // the thread - echo "\t\n"; - echo "\t\t\n"; - echo "\t\n"; + + echo prepare4display($current_forum['forum_title']).'
'; + echo "\n"; + echo "\t\n"; + echo ''.prepare4display($current_thread['thread_comment']).''; echo "
"; + echo ''.prepare4display($current_thread['thread_title']).'
'; + if($origin!='learnpath') - { - echo "\t
"; - echo ''.prepare4display($current_forum_category['cat_title']).'
'; - echo ''.prepare4display($current_forum_category['cat_comment']).''; - echo "
".prepare4display($current_forum['forum_title'])."
"; - echo ''.prepare4display($current_forum['forum_comment']).''; - echo "
".prepare4display($current_thread['thread_title'])."
"; - echo "
"; - - echo '
'; - + switch ($viewmode) { case 'flat': @@ -286,6 +293,7 @@ if ($message<>'PostDeletedSpecial') // in this case the first and only post of t } } // if ($message<>'PostDeletedSpecial') // in this case the first and only post of the thread is removed + /* diff --git a/main/forum/viewthread_flat.inc.php b/main/forum/viewthread_flat.inc.php index 0244ffc4b4..b310e92aaf 100644 --- a/main/forum/viewthread_flat.inc.php +++ b/main/forum/viewthread_flat.inc.php @@ -109,7 +109,7 @@ foreach ($rows as $row) echo "".icon('../img/delete.gif',get_lang('Delete'))."\n"; display_visible_invisible_icon('post', $row['post_id'], $row['visible'],array('forum'=>Security::remove_XSS($_GET['forum']),'thread'=>Security::remove_XSS($_GET['thread']), 'origin'=>$origin )); echo "\n"; - echo "".icon('../img/deplacer_fichier.gif',get_lang('Edit')).""; + echo "".icon('../img/deplacer_fichier.gif',get_lang('MovePost')).""; } echo '

'; //if (($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0) OR api_is_allowed_to_edit()) diff --git a/main/forum/viewthread_nested.inc.php b/main/forum/viewthread_nested.inc.php index 63ec9ef608..60ebae181b 100644 --- a/main/forum/viewthread_nested.inc.php +++ b/main/forum/viewthread_nested.inc.php @@ -89,7 +89,7 @@ foreach ($rows as $post) { $name=$post['firstname'].' '.$post['lastname']; } - if (api_get_course_setting('allow_user_image_forum')) {echo '
'.display_user_image($post['user_id']).'
'; } + if (api_get_course_setting('allow_user_image_forum')) {echo '
'.display_user_image($post['user_id'],$name,false,true).'
'; } echo display_user_link($post['user_id'], $name).'
'; echo $post['post_date'].'

'; // The user who posted it can edit his thread only if the course admin allowed this in the properties of the forum @@ -103,7 +103,7 @@ foreach ($rows as $post) echo "".icon('../img/delete.gif',get_lang('Delete'))."\n"; display_visible_invisible_icon('post', $post['post_id'], $post['visible'],array('forum'=>Security::remove_XSS($_GET['forum']),'thread'=>Security::remove_XSS($_GET['thread']) )); echo "\n"; - echo "".icon('../img/deplacer_fichier.gif',get_lang('Edit')).""; + echo "".icon('../img/deplacer_fichier.gif',get_lang('MovePost')).""; } echo '

'; //if (($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0) OR api_is_allowed_to_edit()) diff --git a/main/forum/viewthread_threaded.inc.php b/main/forum/viewthread_threaded.inc.php index 22ba01cf32..867dc43483 100644 --- a/main/forum/viewthread_threaded.inc.php +++ b/main/forum/viewthread_threaded.inc.php @@ -3,7 +3,7 @@ ============================================================================== Dokeos - elearning and course management software - Copyright (c) 2006 Dokeos S.A. + Copyright (c) 2006-2008 Dokeos S.A. Copyright (c) 2006 Ghent University (UGent) For a full list of contributors, see "credits.txt". @@ -68,6 +68,123 @@ else $display_post_id=$current['post_id']; } +// -------------------------------------- +// Displaying the thread (structure) +// -------------------------------------- +$thread_structure="
".get_lang('Structure')."
"; +$counter=0; +$prev_next_array=array(); +foreach ($rows as $post) +{ + $counter++; + $indent=$post['indent_cnt']*'20'; + $thread_structure.= "
"; + + if (isset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$post['post_id']]) and !empty($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$post['post_id']]) and !empty($whatsnew_post_info[$_GET['forum']][$post['thread_id']])) + { + $post_image=icon('../img/forumpostnew.gif'); + } + else + { + $post_image=icon('../img/forumpost.gif'); + } + $thread_structure.= $post_image; + if ($_GET['post']==$post['post_id'] OR ($counter==1 AND !isset($_GET['post']))) + { + $thread_structure.=''.prepare4display($post['post_title']).'
'; + $prev_next_array[]=$post['post_id']; + } + else + { + if ($post['visible']=='0') + { + $class=' class="invisible"'; + } + else + { + $class=''; + } + $thread_structure.= "".prepare4display($post['post_title'])."\n"; + $prev_next_array[]=$post['post_id']; + } +} + +/*-------------------------------------------------- + NAVIGATION CONTROLS +---------------------------------------------------- +*/ + +$current_id=array_search($display_post_id,$prev_next_array); +$max=count($prev_next_array); +$next_id=$current_id+1; +$prev_id=$current_id-1; + +$firs_message=get_lang('FirstMessage'); +$prev_message=get_lang('PrevMessage'); + +$next_message=get_lang('NextMessage'); +$prev_message=get_lang('PrevMessage'); + +$prev_img = ''; +$next_img = ''; + +$first_page_text = ''; +$last_page_text = ''; + +$href_prev='"viewthread.php?'.api_get_cidreq().'&forum='.Security::remove_XSS($_GET['forum']).'&thread='.Security::remove_XSS($_GET['thread']).'&post='.$prev_next_array[$prev_id].'"'; +$href_next='"viewthread.php?'.api_get_cidreq().'&forum='.Security::remove_XSS($_GET['forum']).'&thread='.Security::remove_XSS($_GET['thread']).'&post='.$prev_next_array[$next_id].'"'; + +// the last message +if ($next_id>=$max) +{ + $next_id=0; + $class_next=' class="invisible"'; + $href_next=1; +} + +// the first message +if ($next_id==1) { + $class_prev=' class="invisible"'; + $href_prev=1; +} + +echo '
'; +// for the loop +if ($prev_id<0) +{ + $prev_id=$max-1; +} + +//first message img +echo '".$first_page_text.""; +// prev message link +if ($href_prev==1) +{ + echo ''.$prev_message.''; + +} +else +echo ''.$prev_message.''; + +// current counter +echo ' [ '.($current_id+1).' / '.$max.' ] '; + +// next message link + +if ($href_next==1) +{ + echo ''.$next_message.''; +} +else +echo ''.$next_message.''; + +//last message img +echo '".$last_page_text.""; + +echo '
'; + +//-------------------------------------------------------------------------------------------- + // the style depends on the status of the message: approved or not if ($rows[$display_post_id]['visible']=='0') { @@ -100,7 +217,7 @@ else { $name=$rows[$display_post_id]['firstname'].' '.$rows[$display_post_id]['lastname']; } -if (api_get_course_setting('allow_user_image_forum')) {echo '
'.display_user_image($rows[$display_post_id]['user_id']).'
'; } +if (api_get_course_setting('allow_user_image_forum')) {echo '
'.display_user_image($rows[$display_post_id]['user_id'],$name,false,true).'
'; } echo display_user_link($rows[$display_post_id]['user_id'], $name).'
'; echo $rows[$display_post_id]['post_date'].'

'; // The user who posted it can edit his thread only if the course admin allowed this in the properties of the forum @@ -114,7 +231,7 @@ if (api_is_allowed_to_edit()) echo "".icon('../img/delete.gif',get_lang('Delete'))."\n"; display_visible_invisible_icon('post', $rows[$display_post_id]['post_id'], $rows[$display_post_id]['visible'],array('forum'=>Security::remove_XSS($_GET['forum']),'thread'=>Security::remove_XSS($_GET['thread']), 'post'=>Security::remove_XSS($_GET['post']) )); echo "\n"; - echo "".icon('../img/deplacer_fichier.gif',get_lang('Edit'))."\n"; + echo "".icon('../img/deplacer_fichier.gif',get_lang('MovePost'))."\n"; } echo '

'; //if (($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0) OR api_is_allowed_to_edit()) @@ -164,23 +281,6 @@ echo "\t
".prepare4display($rows[$display_post_id]['post_text'])."
"; -if (check_added_resources("forum_post", $rows[$display_post_id]["post_id"])) -{ - - echo "".get_lang("AddedResources")."
"; - if ($rows[$display_post_id]['visible']=='0') - { - $addedresource_style="invisible"; - } - display_added_resources("forum_post", $rows[$display_post_id]["post_id"], $addedresource_style); -} -echo "
"; // Displaying the thread (structure) // -------------------------------------- -echo "
".get_lang('Structure')."
"; -$counter=0; -foreach ($rows as $post) -{ - $counter++; - $indent=$post['indent_cnt']*'20'; - echo "
"; - if (isset($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$post['post_id']]) and !empty($whatsnew_post_info[$current_forum['forum_id']][$current_thread['thread_id']][$post['post_id']]) and !empty($whatsnew_post_info[$_GET['forum']][$post['thread_id']])) - { - $post_image=icon('../img/forumpostnew.gif'); - } - else - { - $post_image=icon('../img/forumpost.gif'); - } - echo $post_image; - if ($_GET['post']==$post['post_id'] OR ($counter==1 AND !isset($_GET['post']))) - { - echo ''.prepare4display($post['post_title']).'
'; - } - else - { - if ($post['visible']=='0') - { - $class=' class="invisible"'; - } - else - { - $class=''; - } - echo "".prepare4display($post['post_title'])."\n"; - } -} - +echo $thread_structure; /** @@ -263,5 +330,4 @@ function _phorum_recursive_sort($rows, &$threads, $seed=0, $indent=0) } } } - ?> \ No newline at end of file