Fixing contains_file bug + using fckeditor for the description see BT#4131

skala
Julio Montoya 14 years ago
parent e5d5171d37
commit 07fd93b3d2
  1. 21
      main/work/work.php

@ -434,8 +434,9 @@ switch ($action) {
} else {
$form->addElement('hidden', 'item_id', $item_id);
}
$form->addElement('text', 'title', get_lang('Title'), 'id="file_upload" style="width: 350px;"');
$form->addElement('textarea', 'description', get_lang("Description"), 'style="width: 350px; height: 60px;"');
$form->addElement('text', 'title', get_lang('Title'), array('id' => 'file_upload', 'class' => 'span4'));
//$form->addElement('html_editor', 'description', get_lang("Description"));
$form->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'Work', 'Width' => '100%', 'Height' => '200'));
if ($item_id && !empty($work_item)) {
$defaults['title'] = $work_item['title'];
@ -519,6 +520,8 @@ switch ($action) {
if (isset($_POST['submitWork']) && !empty($is_course_member)) {
$authors = api_get_person_name($currentUserFirstName, $currentUserLastName);
$url = null;
$contains_file = 0;
if ($_POST['contains_file'] && !empty($_FILES['file']['size'])) {
$updir = $currentCourseRepositorySys . 'work/'; //directory path to upload
@ -549,8 +552,11 @@ switch ($action) {
$new_file_name = api_get_unique_id();
//if we come from the group tools the groupid will be saved in $work_table
@move_uploaded_file($_FILES['file']['tmp_name'], $updir.$curdirpath.'/'.$new_file_name);
$result = @move_uploaded_file($_FILES['file']['tmp_name'], $updir.$curdirpath.'/'.$new_file_name);
if ($result) {
$url = 'work'.$curdirpath.'/'.$new_file_name;
$contains_file = 1;
}
}
if (empty($title)) {
@ -564,7 +570,7 @@ switch ($action) {
title = '" . Database::escape_string($title) . "',
description = '" . Database::escape_string($description) . "',
author = '" . Database::escape_string($authors) . "',
contains_file = '".intval($_POST['contains_file'])."',
contains_file = '".$contains_file."',
active = '" . $active . "',
accepted = '1',
post_group_id = '".$group_id."',
@ -742,11 +748,11 @@ switch ($action) {
$form->addElement('hidden', 'curdirpath', Security :: remove_XSS($curdirpath));
// $form->addElement('hidden', 'sec_token', $token);
$form->addElement('text', 'new_dir', get_lang('AssignmentName'));
$form->addRule('new_dir', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('html_editor', 'description', get_lang('Description'));
//$form->addElement('html_editor', 'description', get_lang('Description'));
$form->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'Work', 'Width' => '100%', 'Height' => '200'));
$form->addElement('advanced_settings', '<a href="javascript: void(0);" onclick="javascript: return plus();"><span id="plus">'.Display::return_icon('div_show.gif',get_lang('AdvancedParameters'), array('style' => 'vertical-align:center')).' '.get_lang('AdvancedParameters').'</span></a>');
@ -761,7 +767,6 @@ switch ($action) {
$form->addElement('text', 'weight', get_lang('WeightInTheGradebook'));
$form->addElement('html', '</div>');
$form->addElement('checkbox', 'type1', null, get_lang('EnableExpiryDate'), array('id' =>'make_calification_id', 'onclick' => "javascript: if(this.checked){document.getElementById('option2').style.display='block';}else{document.getElementById('option2').style.display='none';}"));
$form->addElement('html', '<div id="option2" style="display: none;">');
@ -1093,7 +1098,6 @@ switch ($action) {
$my_cur_dir_path = $curdirpath;
}
if (!empty($my_folder_data['description'])) {
echo '<p><div><strong>'.get_lang('Description').':</strong><p>'.Security::remove_XSS($my_folder_data['description'], STUDENT).'</p></div></p>';
}
@ -1135,7 +1139,6 @@ switch ($action) {
);
}
$extra_params = array();
//Autowidth

Loading…
Cancel
Save