[svn r22067] FS#2867 - The forums tool: Eliminating the global variable $fck_attribute.

skala
Ivan Tcholakov 16 years ago
parent bce5e7a0fa
commit 3a3da756a6
  1. 16
      main/forum/editpost.php
  2. 18
      main/forum/forumfunction.inc.php
  3. 352
      main/forum/iframe_thread.php
  4. 19
      main/forum/index.php
  5. 12
      main/forum/newthread.php
  6. 12
      main/forum/reply.php
  7. 13
      main/forum/viewforumcategory.php
  8. 2
      main/inc/lib/fckeditor/toolbars/forum.php
  9. 2
      main/inc/lib/fckeditor/toolbars/forum_student.php

@ -78,25 +78,9 @@ $this_section=SECTION_COURSES;
// notice for unauthorized people.
api_protect_course_script(true);
// FCKeditor configuration
$fck_attribute['Width'] = '100%';
$fck_attribute['Height'] = '400';
$fck_attribute['Config']['IMUploadPath'] = 'upload/forum/';
$fck_attribute['Config']['FlashUploadPath'] = 'upload/forum/';
// including additional library scripts
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
include_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
if(!api_is_allowed_to_edit()) {
$fck_attribute['Config']['UserStatus'] = 'student';
$fck_attribute['ToolbarSet'] = 'Forum_Student';
}
else
{
$fck_attribute['ToolbarSet'] = 'Forum';
}
$nameTools=get_lang('Forum');

@ -159,7 +159,7 @@ function show_add_forumcategory_form($inputvalues=array()) {
$form->addElement('header', '', get_lang('AddForumCategory'));
$form->addElement('text', 'forum_category_title', get_lang('Title'),'class="input_titles"');
//$form->applyFilter('forum_category_title', 'html_filter');
$form->addElement('html_editor', 'forum_category_comment', get_lang('Comment'));
$form->addElement('html_editor', 'forum_category_comment', get_lang('Comment'), null, array('ToolbarSet' => 'Forum', 'Width' => '98%', 'Height' => '200'));
//$form->applyFilter('forum_category_comment', 'html_filter');
$form->addElement('style_submit_button', 'SubmitForumCategory', get_lang('CreateCategory'), 'class="add"');
@ -214,7 +214,7 @@ function show_add_forum_form($inputvalues=array()) {
$form->addElement('text', 'forum_title', get_lang('Title'),'class="input_titles"');
//$form->applyFilter('forum_title', 'html_filter');
// The comment of the forum
$form->addElement('html_editor', 'forum_comment', get_lang('Comment'));
$form->addElement('html_editor', 'forum_comment', get_lang('Comment'), null, array('ToolbarSet' => 'Forum', 'Width' => '98%', 'Height' => '200'));
//$form->applyFilter('forum_comment', 'html_filter');
// dropdown list: Forum Categories
$forum_categories=get_forum_categories();
@ -449,7 +449,7 @@ function show_edit_forumcategory_form($inputvalues=array()) {
$form->addElement('hidden', 'forum_category_id');
$form->addElement('text', 'forum_category_title', get_lang('Title'),'class="input_titles"');
//$form->applyFilter('forum_category_title', 'html_filter');
$form->addElement('html_editor', 'forum_category_comment', get_lang('Comment'));
$form->addElement('html_editor', 'forum_category_comment', get_lang('Comment'), null, array('ToolbarSet' => 'Forum', 'Width' => '98%', 'Height' => '200'));
//$form->applyFilter('forum_category_comment', 'html_filter');
$form->addElement('style_submit_button', 'SubmitEditForumCategory',get_lang('ModifyCategory'), 'class="save"');
global $charset;
@ -1916,7 +1916,11 @@ function show_add_post_form($action='', $id='', $form_values='') {
$form->addElement('text', 'post_title', get_lang('Title'),'class="input_titles"');
//$form->applyFilter('post_title', 'html_filter');
$form->addElement('html_editor', 'post_text', get_lang('Text'));
$form->addElement('html_editor', 'post_text', get_lang('Text'), null,
api_is_allowed_to_edit()
? array('ToolbarSet' => 'Forum', 'Width' => '100%', 'Height' => '400')
: array('ToolbarSet' => 'Forum_Student', 'Width' => '100%', 'Height' => '400', 'UserStatus' => 'student')
);
//$form->applyFilter('post_text', 'html_filter');
$form->addElement('html', '<div class="row"><div class="label">');
@ -2345,7 +2349,11 @@ function show_edit_post_form($current_post, $current_thread, $current_forum, $fo
}
$form->addElement('text', 'post_title', get_lang('Title'),'class="input_titles"');
$form->applyFilter('post_title', 'html_filter');
$form->addElement('html_editor', 'post_text', get_lang('Text'));
$form->addElement('html_editor', 'post_text', get_lang('Text'), null,
api_is_allowed_to_edit()
? array('ToolbarSet' => 'Forum', 'Width' => '100%', 'Height' => '400')
: array('ToolbarSet' => 'Forum_Student', 'Width' => '100%', 'Height' => '400', 'UserStatus' => 'student')
);
//$form->applyFilter('post_text', 'html_filter');
$form->addElement('html', '<div class="row"><div class="label">');

@ -1,184 +1,170 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2006 Dokeos SPRL
Copyright (c) 2006 Ghent University (UGent)
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/**
* These files are a complete rework of the forum. The database structure is
* based on phpBB but all the code is rewritten. A lot of new functionalities
* are added:
* - forum categories and forums can be sorted up or down, locked or made invisible
* - consistent and integrated forum administration
* - forum options: are students allowed to edit their post?
* moderation of posts (approval)
* reply only forums (students cannot create new threads)
* multiple forums per group
* - sticky messages
* - new view option: nested view
* - quoting a message
*
* @Author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @Copyright Ghent University
* @Copyright Patrick Cool
*
* @package dokeos.forum
*/
/**
**************************************************************************
* IMPORTANT NOTICE
* Please do not change anything is this code yet because there are still
* some significant code that need to happen and I do not have the time to
* merge files and test it all over again. So for the moment, please do not
* touch the code
* -- Patrick Cool <patrick.cool@UGent.be>
**************************************************************************
*/
/*
==============================================================================
INIT SECTION
==============================================================================
*/
/*
-----------------------------------------------------------
Language Initialisation
-----------------------------------------------------------
*/
// name of the language file that needs to be included
$language_file = 'forum';
//$this_section=SECTION_COURSES;
require_once '../inc/global.inc.php';
/* ------------ ACCESS RIGHTS ------------ */
// notice for unauthorized people.
api_protect_course_script(true);
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
include_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
$fck_attribute['Width'] = '100%';
$fck_attribute['Height'] = '400';
$fck_attribute['Config']['IMUploadPath'] = 'upload/forum/';
$fck_attribute['Config']['FlashUploadPath'] = 'upload/forum/';
if (!api_is_allowed_to_edit(false,true)) {
$fck_attribute['Config']['UserStatus'] = 'student';
$fck_attribute['ToolbarSet'] = 'Forum_Student';
}
else
{
$fck_attribute['ToolbarSet'] = 'Forum';
}
$nameTools=get_lang('Forum');
?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<style type="text/css" media="screen, projection">
/*<![CDATA[*/
@import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/<?php echo api_get_setting('stylesheets');?>/default.css";
/*]]>*/
</style>
</head>
<body>
<?php
/*
-----------------------------------------------------------
Including necessary files
-----------------------------------------------------------
*/
require 'forumconfig.inc.php';
require_once 'forumfunction.inc.php';
/*
==============================================================================
MAIN DISPLAY SECTION
==============================================================================
*/
/*
-----------------------------------------------------------
Retrieving forum and forum categorie information
-----------------------------------------------------------
*/
// we are getting all the information about the current forum and forum category.
// note pcool: I tried to use only one sql statement (and function) for this
// but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table
$current_thread=get_thread_information($_GET['thread']); // note: this has to be validated that it is an existing thread
$current_forum=get_forum_information($current_thread['forum_id']); // note: this has to be validated that it is an existing forum.
$current_forum_category=get_forumcategory_information($current_forum['forum_category']);
/*
-----------------------------------------------------------
Is the user allowed here?
-----------------------------------------------------------
*/
// if the user is not a course administrator and the forum is hidden
// then the user is not allowed here.
if (!api_is_allowed_to_edit(false,true) AND ($current_forum['visibility']==0 OR $current_thread['visibility']==0)) {
forum_not_allowed_here();
}
/*
-----------------------------------------------------------
Display Forum Category and the Forum information
-----------------------------------------------------------
*/
// we are getting all the information about the current forum and forum category.
// note pcool: I tried to use only one sql statement (and function) for this
// but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table
$sql="SELECT * FROM $table_posts posts, $table_users users
WHERE posts.thread_id='".$current_thread['thread_id']."'
AND posts.poster_id=users.user_id
ORDER BY posts.post_id ASC";
$result=api_sql_query($sql, __FILE__, __LINE__);
echo "<table width=\"100%\" cellspacing=\"5\" border=\"0\">\n";
while ($row=Database::fetch_array($result)) {
echo "\t<tr>\n";
echo "\t\t<td rowspan=\"2\" class=\"forum_message_left\">";
if ($row['user_id']=='0') {
$name=$row['poster_name'];
} else {
$name=$row['firstname'].' '.$row['lastname'];
}
echo $name.'<br />';
echo $row['post_date'].'<br /><br />';
echo "</td>\n";
echo "\t\t<td class=\"forum_message_post_title\">".$row['post_title']."</td>\n";
echo "\t</tr>\n";
echo "\t<tr>\n";
echo "\t\t<td class=\"forum_message_post_text\">".$row['post_text']."</td>\n";
echo "\t</tr>\n";
}
echo "</table>";
?>
</body>
<?php
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2006 Dokeos SPRL
Copyright (c) 2006 Ghent University (UGent)
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/**
* These files are a complete rework of the forum. The database structure is
* based on phpBB but all the code is rewritten. A lot of new functionalities
* are added:
* - forum categories and forums can be sorted up or down, locked or made invisible
* - consistent and integrated forum administration
* - forum options: are students allowed to edit their post?
* moderation of posts (approval)
* reply only forums (students cannot create new threads)
* multiple forums per group
* - sticky messages
* - new view option: nested view
* - quoting a message
*
* @Author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @Copyright Ghent University
* @Copyright Patrick Cool
*
* @package dokeos.forum
*/
/**
**************************************************************************
* IMPORTANT NOTICE
* Please do not change anything is this code yet because there are still
* some significant code that need to happen and I do not have the time to
* merge files and test it all over again. So for the moment, please do not
* touch the code
* -- Patrick Cool <patrick.cool@UGent.be>
**************************************************************************
*/
/*
==============================================================================
INIT SECTION
==============================================================================
*/
/*
-----------------------------------------------------------
Language Initialisation
-----------------------------------------------------------
*/
// name of the language file that needs to be included
$language_file = 'forum';
//$this_section=SECTION_COURSES;
require_once '../inc/global.inc.php';
/* ------------ ACCESS RIGHTS ------------ */
// notice for unauthorized people.
api_protect_course_script(true);
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');
include_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
$nameTools=get_lang('Forum');
?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<style type="text/css" media="screen, projection">
/*<![CDATA[*/
@import "<?php echo api_get_path(WEB_CODE_PATH); ?>css/<?php echo api_get_setting('stylesheets');?>/default.css";
/*]]>*/
</style>
</head>
<body>
<?php
/*
-----------------------------------------------------------
Including necessary files
-----------------------------------------------------------
*/
require 'forumconfig.inc.php';
require_once 'forumfunction.inc.php';
/*
==============================================================================
MAIN DISPLAY SECTION
==============================================================================
*/
/*
-----------------------------------------------------------
Retrieving forum and forum categorie information
-----------------------------------------------------------
*/
// we are getting all the information about the current forum and forum category.
// note pcool: I tried to use only one sql statement (and function) for this
// but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table
$current_thread=get_thread_information($_GET['thread']); // note: this has to be validated that it is an existing thread
$current_forum=get_forum_information($current_thread['forum_id']); // note: this has to be validated that it is an existing forum.
$current_forum_category=get_forumcategory_information($current_forum['forum_category']);
/*
-----------------------------------------------------------
Is the user allowed here?
-----------------------------------------------------------
*/
// if the user is not a course administrator and the forum is hidden
// then the user is not allowed here.
if (!api_is_allowed_to_edit(false,true) AND ($current_forum['visibility']==0 OR $current_thread['visibility']==0)) {
forum_not_allowed_here();
}
/*
-----------------------------------------------------------
Display Forum Category and the Forum information
-----------------------------------------------------------
*/
// we are getting all the information about the current forum and forum category.
// note pcool: I tried to use only one sql statement (and function) for this
// but the problem is that the visibility of the forum AND forum cateogory are stored in the item_property table
$sql="SELECT * FROM $table_posts posts, $table_users users
WHERE posts.thread_id='".$current_thread['thread_id']."'
AND posts.poster_id=users.user_id
ORDER BY posts.post_id ASC";
$result=api_sql_query($sql, __FILE__, __LINE__);
echo "<table width=\"100%\" cellspacing=\"5\" border=\"0\">\n";
while ($row=Database::fetch_array($result)) {
echo "\t<tr>\n";
echo "\t\t<td rowspan=\"2\" class=\"forum_message_left\">";
if ($row['user_id']=='0') {
$name=$row['poster_name'];
} else {
$name=$row['firstname'].' '.$row['lastname'];
}
echo $name.'<br />';
echo $row['post_date'].'<br /><br />';
echo "</td>\n";
echo "\t\t<td class=\"forum_message_post_title\">".$row['post_title']."</td>\n";
echo "\t</tr>\n";
echo "\t<tr>\n";
echo "\t\t<td class=\"forum_message_post_text\">".$row['post_text']."</td>\n";
echo "\t</tr>\n";
}
echo "</table>";
?>
</body>
</html>

@ -87,22 +87,6 @@ $nameTools=get_lang('Forums');
require 'forumconfig.inc.php';
require_once 'forumfunction.inc.php';
$fck_attribute['Width'] = '100%';
$fck_attribute['Height'] = '400';
$fck_attribute['Config']['IMUploadPath'] = 'upload/forum/';
$fck_attribute['Config']['FlashUploadPath'] = 'upload/forum/';
$fck_attribute['Config']['InDocument'] = false;
$fck_attribute['Config']['CreateDocumentDir'] = '../../courses/'.api_get_course_path().'/document/';
if(!api_is_allowed_to_edit(false,true)) {
$fck_attribute['Config']['UserStatus'] = 'student';
$fck_attribute['ToolbarSet'] = 'Forum_Student';
}
else
{
$fck_attribute['ToolbarSet'] = 'Forum';
}
/*
==============================================================================
@ -160,9 +144,6 @@ $form_count=0;
*/
$get_actions=isset($_GET['action']) ? $_GET['action'] : '';
if (api_is_allowed_to_edit(false,true)) {
$fck_attribute['Width'] = '98%';
$fck_attribute['Height'] = '200';
$fck_attribute['ToolbarSet'] = 'Forum';
handle_forum_and_forumcategories();
}

@ -62,18 +62,6 @@ require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'
include_once (api_get_path(LIBRARY_PATH).'groupmanager.lib.php');
$nameTools=get_lang('Forum');
// configuration for FCKeditor
$fck_attribute['Width'] = '100%';
$fck_attribute['Height'] = '400';
if(!api_is_allowed_to_edit(false,true)) {
$fck_attribute['Config']['UserStatus'] = 'student';
$fck_attribute['ToolbarSet'] = 'Forum_Student';
}
else
{
$fck_attribute['ToolbarSet'] = 'Forum';
}
/*
-----------------------------------------------------------

@ -54,18 +54,6 @@ $this_section=SECTION_COURSES;
// notice for unauthorized people.
api_protect_course_script(true);
// configuration for FCKeditor
$fck_attribute['Width'] = '100%';
$fck_attribute['Height'] = '400';
if(!api_is_allowed_to_edit(false,true)) {
$fck_attribute['Config']['UserStatus'] = 'student';
$fck_attribute['ToolbarSet'] = 'Forum_Student';
}
else
{
$fck_attribute['ToolbarSet'] = 'Forum';
}
// including additional library scripts
require_once (api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php');

@ -97,19 +97,6 @@ require_once 'forumfunction.inc.php';
==============================================================================
*/
$fck_attribute['Width'] = '100%';
$fck_attribute['Height'] = '400';
$fck_attribute['Config']['IMUploadPath'] = 'upload/forum/';
$fck_attribute['Config']['FlashUploadPath'] = 'upload/forum/';
if(!api_is_allowed_to_edit(false,true)) {
$fck_attribute['Config']['UserStatus'] = 'student';
$fck_attribute['ToolbarSet'] = 'Forum_Student';
}
else
{
$fck_attribute['ToolbarSet'] = 'Forum';
}
/*
-----------------------------------------------------------

@ -45,4 +45,4 @@ $config['ToolbarSets']['Maximized'] = array(
// Here new width and height of the editor may be set.
// Possible values, examples: 300 , '250' , '100%' , ...
//$config['Width'] = '100%';
//$config['Height'] = '300';
//$config['Height'] = '400';

@ -46,4 +46,4 @@ $config['BlockCopyPaste'] = true;
// Here new width and height of the editor may be set.
// Possible values, examples: 300 , '250' , '100%' , ...
//$config['Width'] = '100%';
//$config['Height'] = '300';
//$config['Height'] = '400';

Loading…
Cancel
Save