[svn r20199] logic changes - added html_filter in forum tool - (partial FS#4122)

skala
Isaac Flores 16 years ago
parent edc7bb5c00
commit a5932331b0
  1. 25
      main/forum/forumfunction.inc.php

@ -158,7 +158,9 @@ function show_add_forumcategory_form($inputvalues=array()) {
// settting the form elements // settting the form elements
$form->addElement('header', '', get_lang('AddForumCategory')); $form->addElement('header', '', get_lang('AddForumCategory'));
$form->addElement('text', 'forum_category_title', get_lang('Title'),'class="input_titles"'); $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'));
$form->applyFilter('forum_category_comment', 'html_filter');
$form->addElement('style_submit_button', 'SubmitForumCategory', get_lang('CreateCategory'), 'class="add"'); $form->addElement('style_submit_button', 'SubmitForumCategory', get_lang('CreateCategory'), 'class="add"');
// setting the rules // setting the rules
@ -213,14 +215,17 @@ function show_add_forum_form($inputvalues=array()) {
} }
// The title of the forum // The title of the forum
$form->addElement('text', 'forum_title', get_lang('Title'),'class="input_titles"'); $form->addElement('text', 'forum_title', get_lang('Title'),'class="input_titles"');
$form->applyFilter('forum_title', 'html_filter');
// The comment of the forum // The comment of the forum
$form->addElement('html_editor', 'forum_comment', get_lang('Comment')); $form->addElement('html_editor', 'forum_comment', get_lang('Comment'));
$form->applyFilter('forum_comment', 'html_filter');
// dropdown list: Forum Categories // dropdown list: Forum Categories
$forum_categories=get_forum_categories(); $forum_categories=get_forum_categories();
foreach ($forum_categories as $key=>$value) { foreach ($forum_categories as $key=>$value) {
$forum_categories_titles[$value['cat_id']]=$value['cat_title']; $forum_categories_titles[$value['cat_id']]=$value['cat_title'];
} }
$form->addElement('select', 'forum_category', get_lang('InForumCategory'), $forum_categories_titles); $form->addElement('select', 'forum_category', get_lang('InForumCategory'), $forum_categories_titles);
$form->applyFilter('forum_category', 'html_filter');
if ($_course['visibility']==COURSE_VISIBILITY_OPEN_WORLD) { if ($_course['visibility']==COURSE_VISIBILITY_OPEN_WORLD) {
// This is for vertical // This is for vertical
@ -447,7 +452,9 @@ function show_edit_forumcategory_form($inputvalues=array()) {
$form->addElement('header', '', get_lang('EditForumCategory')); $form->addElement('header', '', get_lang('EditForumCategory'));
$form->addElement('hidden', 'forum_category_id'); $form->addElement('hidden', 'forum_category_id');
$form->addElement('text', 'forum_category_title', get_lang('Title'),'class="input_titles"'); $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'));
$form->applyFilter('forum_category_comment', 'html_filter');
$form->addElement('style_submit_button', 'SubmitEditForumCategory',get_lang('ModifyCategory'), 'class="save"'); $form->addElement('style_submit_button', 'SubmitEditForumCategory',get_lang('ModifyCategory'), 'class="save"');
global $charset; global $charset;
// setting the default values // setting the default values
@ -698,7 +705,7 @@ function delete_forum_forumcategory_thread($content, $id) {
if (!empty($number_threads)){ if (!empty($number_threads)){
$sql="SELECT thread_id FROM". $table_forum_thread . "WHERE forum_id='".$id."'"; $sql="SELECT thread_id FROM". $table_forum_thread . "WHERE forum_id='".$id."'";
$result = api_sql_query($sql, __FILE__, __LINE__); $result = api_sql_query($sql, __FILE__, __LINE__);
$row = mysql_fetch_array($result); $row = Database::fetch_array($result);
foreach ($row as $arr_forum) { foreach ($row as $arr_forum) {
$forum_id = $arr_forum['thread_id']; $forum_id = $arr_forum['thread_id'];
api_item_property_update($_course,'forum_thread',$forum_id,'delete',api_get_user_id()); api_item_property_update($_course,'forum_thread',$forum_id,'delete',api_get_user_id());
@ -1902,10 +1909,13 @@ function show_add_post_form($action='', $id='', $form_values='') {
// if anonymous posts are allowed we also display a form to allow the user to put his name or username in // if anonymous posts are allowed we also display a form to allow the user to put his name or username in
if ($current_forum['allow_anonymous']==1 AND !isset($_user['user_id'])) { if ($current_forum['allow_anonymous']==1 AND !isset($_user['user_id'])) {
$form->addElement('text', 'poster_name', get_lang('Name')); $form->addElement('text', 'poster_name', get_lang('Name'));
$form->applyFilter('poster_name', 'html_filter');
} }
$form->addElement('text', 'post_title', get_lang('Title'),'class="input_titles"'); $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'));
$form->applyFilter('post_text', 'html_filter');
$form->addElement('static','Group','<a href="javascript://" onclick="return advanced_parameters()"><span id="img_plus_and_minus"><img src="../img/div_show.gif" alt="" /> '.get_lang('AdvancedParameters').'</span></a>',''); $form->addElement('static','Group','<a href="javascript://" onclick="return advanced_parameters()"><span id="img_plus_and_minus"><img src="../img/div_show.gif" alt="" /> '.get_lang('AdvancedParameters').'</span></a>','');
$form->addElement('html','<div id="id_qualify" style="display:none">'); $form->addElement('html','<div id="id_qualify" style="display:none">');
if( (api_is_course_admin() || api_is_course_coach() || api_is_course_tutor()) && !($my_thread) ){ if( (api_is_course_admin() || api_is_course_coach() || api_is_course_tutor()) && !($my_thread) ){
@ -1913,11 +1923,14 @@ function show_add_post_form($action='', $id='', $form_values='') {
$form->addElement('static','Group', '<br /><strong>'.get_lang('AlterQualifyThread').'</strong>'); $form->addElement('static','Group', '<br /><strong>'.get_lang('AlterQualifyThread').'</strong>');
$form->addElement('text', 'numeric_calification', get_lang('QualifyNumeric'),'Style="width:40px"'); $form->addElement('text', 'numeric_calification', get_lang('QualifyNumeric'),'Style="width:40px"');
$form->applyFilter('numeric_calification', 'html_filter');
$form->addElement('checkbox', 'thread_qualify_gradebook', '', get_lang('QualifyThreadGradebook'),'onclick="javascript:if(this.checked==true){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"'); $form->addElement('checkbox', 'thread_qualify_gradebook', '', get_lang('QualifyThreadGradebook'),'onclick="javascript:if(this.checked==true){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
$form -> addElement('html','<div id="options_field" style="display:none">'); $form -> addElement('html','<div id="options_field" style="display:none">');
$form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook')); $form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook'));
$form->applyFilter('calification_notebook_title', 'html_filter');
$form->addElement('text', 'weight_calification', get_lang('QualifyWeight'),'value="0.00" Style="width:40px" onfocus="this.select();"'); $form->addElement('text', 'weight_calification', get_lang('QualifyWeight'),'value="0.00" Style="width:40px" onfocus="this.select();"');
$form->applyFilter('weight_calification', 'html_filter');
$form->addElement('html','</div>'); $form->addElement('html','</div>');
} }
@ -1938,6 +1951,7 @@ function show_add_post_form($action='', $id='', $form_values='') {
$form->addElement('html','<br /><b><div class="row"><div class="label">'.get_lang('AddAnAttachment').'</div></div></b><br /><br />'); $form->addElement('html','<br /><b><div class="row"><div class="label">'.get_lang('AddAnAttachment').'</div></div></b><br /><br />');
$form->addElement('file','user_upload',get_lang('FileName'),''); $form->addElement('file','user_upload',get_lang('FileName'),'');
$form->addElement('textarea','file_comment',get_lang('FileComment'),array ('rows' => 4, 'cols' => 34)); $form->addElement('textarea','file_comment',get_lang('FileComment'),array ('rows' => 4, 'cols' => 34));
$form->applyFilter('file_comment', 'html_filter');
$form->addElement('html','</div>'); $form->addElement('html','</div>');
$userid =api_get_user_id(); $userid =api_get_user_id();
$info =api_get_user_info($userid); $info =api_get_user_info($userid);
@ -2324,7 +2338,9 @@ function show_edit_post_form($current_post, $current_thread, $current_forum, $fo
$form->addElement('hidden', 'is_first_post_of_thread', '1'); $form->addElement('hidden', 'is_first_post_of_thread', '1');
} }
$form->addElement('text', 'post_title', get_lang('Title'),'class="input_titles"'); $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'));
$form->applyFilter('post_text', 'html_filter');
$form->addElement('static','Group','<a href="javascript://" onclick="return advanced_parameters()"><span id="img_plus_and_minus"><img src="../img/div_show.gif" alt="" />'.get_lang('AdvancedParameters').'</span></a>',''); $form->addElement('static','Group','<a href="javascript://" onclick="return advanced_parameters()"><span id="img_plus_and_minus"><img src="../img/div_show.gif" alt="" />'.get_lang('AdvancedParameters').'</span></a>','');
$form->addElement('html','<div id="id_qualify" style="display:none">'); $form->addElement('html','<div id="id_qualify" style="display:none">');
@ -2332,6 +2348,7 @@ function show_edit_post_form($current_post, $current_thread, $current_forum, $fo
if (!isset($_GET['edit'])) { if (!isset($_GET['edit'])) {
$form->addElement('static','Group','<strong>'.get_lang('AlterQualifyThread').'</strong>'); $form->addElement('static','Group','<strong>'.get_lang('AlterQualifyThread').'</strong>');
$form->addElement('text', 'numeric_calification', get_lang('QualifyNumeric'),'value="'.$current_thread['thread_qualify_max'].'" Style="width:40px"'); $form->addElement('text', 'numeric_calification', get_lang('QualifyNumeric'),'value="'.$current_thread['thread_qualify_max'].'" Style="width:40px"');
$form->applyFilter('numeric_calification', 'html_filter');
$form->addElement('checkbox', 'thread_qualify_gradebook', '', get_lang('QualifyThreadGradebook'),'onclick="javascript:if(this.checked==true){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"'); $form->addElement('checkbox', 'thread_qualify_gradebook', '', get_lang('QualifyThreadGradebook'),'onclick="javascript:if(this.checked==true){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"');
$defaults['thread_qualify_gradebook']=is_resource_in_course_gradebook(api_get_course_id(),5,$_GET['thread'],api_get_session_id()); $defaults['thread_qualify_gradebook']=is_resource_in_course_gradebook(api_get_course_id(),5,$_GET['thread'],api_get_session_id());
@ -2341,7 +2358,9 @@ function show_edit_post_form($current_post, $current_thread, $current_forum, $fo
$form -> addElement('html','<div id="options_field" style="display:none">'); $form -> addElement('html','<div id="options_field" style="display:none">');
} }
$form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook'),'value="'.$current_thread['thread_title_qualify'].'"'); $form->addElement('text', 'calification_notebook_title', get_lang('TitleColumnGradebook'),'value="'.$current_thread['thread_title_qualify'].'"');
$form->applyFilter('calification_notebook_title', 'html_filter');
$form->addElement('text', 'weight_calification', get_lang('QualifyWeight'),'value="'.$current_thread['thread_weight'].'" Style="width:40px"'); $form->addElement('text', 'weight_calification', get_lang('QualifyWeight'),'value="'.$current_thread['thread_weight'].'" Style="width:40px"');
$form->applyFilter('weight_calification', 'html_filter');
$form->addElement('html','</div>'); $form->addElement('html','</div>');
//add gradebook //add gradebook
} }
@ -2367,6 +2386,7 @@ function show_edit_post_form($current_post, $current_thread, $current_forum, $fo
$form->addElement('html','<br /><b><div class="row"><div class="label">'.$message.'</div></div></b><br /><br />'); $form->addElement('html','<br /><b><div class="row"><div class="label">'.$message.'</div></div></b><br /><br />');
$form->addElement('file','user_upload',get_lang('FileName'),''); $form->addElement('file','user_upload',get_lang('FileName'),'');
$form->addElement('textarea','file_comment',get_lang('FileComment'),array ('rows' => 4, 'cols' => 34)); $form->addElement('textarea','file_comment',get_lang('FileComment'),array ('rows' => 4, 'cols' => 34));
$form->applyFilter('file_comment', 'html_filter');
$form->addElement('html','</div><br /><br />'); $form->addElement('html','</div><br /><br />');
if ($current_forum['allow_attachments']=='1' OR api_is_allowed_to_edit()) { if ($current_forum['allow_attachments']=='1' OR api_is_allowed_to_edit()) {
if (empty($form_values) AND !isset($_POST['SubmitPost'])) { if (empty($form_values) AND !isset($_POST['SubmitPost'])) {
@ -3000,7 +3020,7 @@ function move_post_form() {
$threads_list[$value['thread_id']]=$value['thread_title']; $threads_list[$value['thread_id']]=$value['thread_title'];
} }
$form->addElement('select', 'thread', get_lang('MoveToThread'), $threads_list); $form->addElement('select', 'thread', get_lang('MoveToThread'), $threads_list);
$form->applyFilter('thread', 'html_filter');
// The OK button // The OK button
$form->addElement('style_submit_button', 'submit',get_lang('MovePost'),'class="save"'); $form->addElement('style_submit_button', 'submit',get_lang('MovePost'),'class="save"');
@ -3162,6 +3182,7 @@ function forum_search() {
// settting the form elements // settting the form elements
$form->addElement('header', '', get_lang('ForumSearch')); $form->addElement('header', '', get_lang('ForumSearch'));
$form->addElement('text', 'search_term', get_lang('SearchTerm'),'class="input_titles"'); $form->addElement('text', 'search_term', get_lang('SearchTerm'),'class="input_titles"');
$form->applyFilter('search_term', 'html_filter');
$form->addElement('static', 'search_information', '', get_lang('ForumSearchInformation')/*, $dissertation[$_GET['opleidingsonderdeelcode']]['code']*/); $form->addElement('static', 'search_information', '', get_lang('ForumSearchInformation')/*, $dissertation[$_GET['opleidingsonderdeelcode']]['code']*/);
$form->addElement('style_submit_button', 'SubmitForumSearch', get_lang('Search'), 'class="search"'); $form->addElement('style_submit_button', 'SubmitForumSearch', get_lang('Search'), 'class="search"');

Loading…
Cancel
Save