|
|
@ -260,8 +260,8 @@ if ($origin == 'learnpath') { |
|
|
|
|
|
|
|
|
|
|
|
/* Display links to upload form and tool options */ |
|
|
|
/* Display links to upload form and tool options */ |
|
|
|
|
|
|
|
|
|
|
|
if (!in_array($action, array('send_mail','add', 'upload'))) { |
|
|
|
if (!in_array($action, array('send_mail','add','create_dir','upload'))) { |
|
|
|
$token = Security::get_token(); |
|
|
|
$token = Security::get_token(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$show_tool_options = (in_array($action, array('list', 'add'))) ? true : false; |
|
|
|
$show_tool_options = (in_array($action, array('list', 'add'))) ? true : false; |
|
|
@ -507,109 +507,78 @@ switch ($action) { |
|
|
|
/* Display of tool options */ |
|
|
|
/* Display of tool options */ |
|
|
|
display_tool_options($uploadvisibledisabled, $origin); |
|
|
|
display_tool_options($uploadvisibledisabled, $origin); |
|
|
|
break; |
|
|
|
break; |
|
|
|
case 'create_dir': |
|
|
|
case 'create_dir': |
|
|
|
//show them the form for the directory name |
|
|
|
case 'add': |
|
|
|
if ($is_allowed_to_edit) { |
|
|
|
//$check = Security::check_token('post'); |
|
|
|
$token = Security::get_token(); |
|
|
|
//show them the form for the directory name |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($is_allowed_to_edit) { |
|
|
|
//create the form that asks for the directory name |
|
|
|
//create the form that asks for the directory name |
|
|
|
$new_folder_text = '<form name="form1" method="POST">'; |
|
|
|
$form = new FormValidator('form1', 'post', api_get_self().'?action=create_dir&'. api_get_cidreq()); |
|
|
|
$new_folder_text .= '<legend>'.get_lang('CreateAssignment').'</legend>'; |
|
|
|
|
|
|
|
$new_folder_text .= '<input type="hidden" name="action" value="add"/>'; |
|
|
|
$form->addElement('header', get_lang('CreateAssignment').$token); |
|
|
|
$new_folder_text .= '<input type="hidden" name="curdirpath" value="' . Security :: remove_XSS($curdirpath) . '"/>'; |
|
|
|
$form->addElement('hidden', 'action', 'add'); |
|
|
|
$new_folder_text .= '<input type="hidden" name="sec_token" value="'.$token.'" />'; |
|
|
|
$form->addElement('hidden', 'curdirpath', Security :: remove_XSS($curdirpath)); |
|
|
|
$new_folder_text .= '<div class="row"> |
|
|
|
// $form->addElement('hidden', 'sec_token', $token); |
|
|
|
<div class="label"> |
|
|
|
|
|
|
|
<span class="form_required">*</span> '.get_lang('AssignmentName').' |
|
|
|
|
|
|
|
</div> |
|
|
|
$form->addElement('text', 'new_dir', get_lang('AssignmentName')); |
|
|
|
<div class="formw"> |
|
|
|
$form->addRule('new_dir', get_lang('ThisFieldIsRequired'), 'required'); |
|
|
|
<div id="msg_error1" style="display:none;color:red"></div> |
|
|
|
|
|
|
|
<input type="text" id="work_title" name="new_dir" onfocus="document.getElementById(\'msg_error1\').style.display=\'none\';"/> |
|
|
|
$form->addElement('html_editor', 'description', get_lang('Description')); |
|
|
|
</div> |
|
|
|
|
|
|
|
</div>'; |
|
|
|
$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>'); |
|
|
|
|
|
|
|
|
|
|
|
//new additional fields inside the "if condition" just to agroup |
|
|
|
$form->addElement('html', '<div id="options" style="display: none;">'); |
|
|
|
$new_folder_text .= '<div class="row"> |
|
|
|
|
|
|
|
<div class="label"> |
|
|
|
//QualificationOfAssignment |
|
|
|
'.get_lang('Description').' |
|
|
|
$form->addElement('text', 'qualification_value', get_lang('QualificationNumeric')); |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="formw">'; |
|
|
|
$form->addElement('checkbox', 'make_calification', null, get_lang('MakeQualifiable'), array('id' =>'make_calification_id', 'onclick' => "javascript: if(this.checked){document.getElementById('option1').style.display='block';}else{document.getElementById('option1').style.display='none';}")); |
|
|
|
$oFCKeditor = new FCKeditor('description') ; |
|
|
|
|
|
|
|
$oFCKeditor->ToolbarSet = 'work'; |
|
|
|
$form->addElement('html', '<div id="option1" style="display: none;">'); |
|
|
|
$oFCKeditor->Width = '100%'; |
|
|
|
$form->addElement('text', 'weight', get_lang('WeightInTheGradebook')); |
|
|
|
$oFCKeditor->Height = '200'; |
|
|
|
$form->addElement('html', '</div>'); |
|
|
|
$oFCKeditor->Value = isset($message) ? $message : null; |
|
|
|
|
|
|
|
$return = $oFCKeditor->CreateHtml(); |
|
|
|
|
|
|
|
$new_folder_text .= $return; |
|
|
|
$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';}")); |
|
|
|
$new_folder_text .= '</div> |
|
|
|
|
|
|
|
</div>'; |
|
|
|
$form->addElement('html', '<div id="option2" style="display: none;">'); |
|
|
|
|
|
|
|
$form->addElement('advanced_settings',draw_date_picker('expires')); |
|
|
|
// Advanced parameters |
|
|
|
$form->addElement('html', '</div>'); |
|
|
|
$addtext = '<div id="options" style="display: none;">'; |
|
|
|
|
|
|
|
$addtext .= '<div style="padding:10px">'; |
|
|
|
|
|
|
|
$addtext .= '<b>'.get_lang('QualificationOfAssignment').'</b>'; |
|
|
|
$form->addElement('checkbox', 'type2', null, get_lang('EnableEndDate'), array('id' =>'make_calification_id', 'onclick' => "javascript: if(this.checked){document.getElementById('option3').style.display='block';}else{document.getElementById('option3').style.display='none';}")); |
|
|
|
$addtext .= '<table cellspacing="0" cellpading="0" border="0"><tr>'; |
|
|
|
|
|
|
|
$addtext .= '<td colspan="2"> '.get_lang('QualificationNumeric').' '; |
|
|
|
$form->addElement('html', '<div id="option3" style="display: none;">'); |
|
|
|
$addtext .= '<input type="text" name="qualification_value" value="" size="5"/></td><tr><td colspan="2">'; |
|
|
|
$form->addElement('advanced_settings', draw_date_picker('ends')); |
|
|
|
$addtext .= '<input type="checkbox" value="1" id="make_calification_id" name="make_calification" onclick="javascript: if(this.checked){document.getElementById(\'option1\').style.display=\'block\';}else{document.getElementById(\'option1\').style.display=\'none\';}"/> |
|
|
|
$form->addElement('html', '</div>'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$form->addElement('checkbox', 'add_to_calendar', null, get_lang('AddToCalendar')); |
|
|
|
|
|
|
|
$form->addElement('checkbox', 'allow_text_assignment', null, get_lang('AllowTextAssignments')); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
|
|
|
$addtext .= '<input type="checkbox" value="1" id="make_calification_id" name="make_calification" onclick=/> |
|
|
|
<label for="make_calification_id">'.get_lang('MakeQualifiable').'</label></td></tr><tr>'; |
|
|
|
<label for="make_calification_id">'.get_lang('MakeQualifiable').'</label></td></tr><tr>'; |
|
|
|
$addtext .= '<td colspan="2"><div id="option1" style="display:none">'; |
|
|
|
*/ |
|
|
|
$addtext .= '<div id="msg_error_weight" style="display:none;color:red"></div>'; |
|
|
|
$form->addElement('html', '</div>'); |
|
|
|
$addtext .= ' '.get_lang('WeightInTheGradebook').' '; |
|
|
|
$form->addElement('style_submit_button', 'submit', get_lang('CreateDirectory')); |
|
|
|
$addtext .= '<input type="text" name="weight" value="" size="5" onfocus="document.getElementById(\'msg_error_weight\').style.display=\'none\';"/></div></td></tr>'; |
|
|
|
|
|
|
|
$addtext .= '</tr></table>'; |
|
|
|
|
|
|
|
$addtext .= '<br />'; |
|
|
|
|
|
|
|
$addtext .= '<b>'.get_lang('DatesAvailables').'</b><br />'; |
|
|
|
|
|
|
|
$addtext .= '<input type="checkbox" value="1" id="type1_id" name="type1" onclick="javascript: if(this.checked){document.getElementById(\'option2\').style.display=\'block\';}else{document.getElementById(\'option2\').style.display=\'none\';}"/> |
|
|
|
|
|
|
|
<label for="type1_id">'.get_lang('EnableExpiryDate').'</label>'; |
|
|
|
|
|
|
|
$addtext .= ' <span id="msg_error2" style="display:none;color:red"></span>'; |
|
|
|
|
|
|
|
$addtext .= ' <span id="msg_error3" style="display:none;color:red"></span>'; |
|
|
|
|
|
|
|
$addtext .= '<div id="option2" style="padding:4px;display:none"> '; |
|
|
|
|
|
|
|
$addtext .= draw_date_picker('expires').'</div>'; |
|
|
|
|
|
|
|
$addtext .= '<br /><input type="checkbox" value="1" id="type2_id" name="type2" onclick="javascript: if(this.checked){document.getElementById(\'option3\').style.display=\'block\';}else{document.getElementById(\'option3\').style.display=\'none\';}"/> |
|
|
|
|
|
|
|
<label for="type2_id">'.get_lang('EnableEndDate').'</label>'; |
|
|
|
|
|
|
|
$addtext .= '<div id="option3" style="padding:4px;display:none">'; |
|
|
|
|
|
|
|
$addtext .= ' <div id="msg_error4" style="display:none;color:red"></div>'; |
|
|
|
|
|
|
|
$addtext .= draw_date_picker('ends').'<br />'; |
|
|
|
|
|
|
|
$addtext .= '</div>'; |
|
|
|
|
|
|
|
$addtext .= '<br /><br /><b>'.get_lang('Agenda').'</b><br />'; |
|
|
|
|
|
|
|
$addtext .= ' '.make_checkbox('add_to_calendar', false, get_lang('AddToCalendar')); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$addtext .= '<br /><br /><b>'.get_lang('AllowTextAssignments').'</b><br />'; |
|
|
|
|
|
|
|
$addtext .= ' '.make_checkbox('allow_text_assignment', false, get_lang('AllowTextAssignments')).'</div>'; |
|
|
|
|
|
|
|
$addtext .= '</div>'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$new_folder_text .= '<div class="row"> |
|
|
|
|
|
|
|
<div class="label"></div> |
|
|
|
|
|
|
|
<div class="formw"><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><br /> |
|
|
|
|
|
|
|
'.$addtext.' |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div>'; |
|
|
|
|
|
|
|
$new_folder_text .= '<div class="row"> |
|
|
|
|
|
|
|
<div class="label"></div> |
|
|
|
|
|
|
|
<div class="formw"> |
|
|
|
|
|
|
|
<button type="button" class="add" name="create_dir" onClick="javascript: validate();" value="' . addslashes(get_lang('CreateDirectory')) . '"/>' . addslashes(get_lang('ButtonCreateAssignment')) . '</button> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div>'; |
|
|
|
|
|
|
|
$new_folder_text .= '</form>'; |
|
|
|
|
|
|
|
//show the form |
|
|
|
|
|
|
|
echo $new_folder_text; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
|
|
|
|
case 'add': |
|
|
|
if ($is_allowed_to_edit && $form->validate()) { |
|
|
|
/* |
|
|
|
|
|
|
|
$fexpire = get_date_from_select('expires'); |
|
|
|
/* |
|
|
|
$fend = get_date_from_select('ends');*/ |
|
|
|
$fexpire = get_date_from_select('expires'); |
|
|
|
|
|
|
|
$fend = get_date_from_select('ends');*/ |
|
|
|
$directory = Security::remove_XSS($_POST['new_dir']); |
|
|
|
|
|
|
|
$directory = replace_dangerous_char($directory); |
|
|
|
$directory = Security::remove_XSS($_POST['new_dir']); |
|
|
|
$directory = disable_dangerous_file($directory); |
|
|
|
$directory = replace_dangerous_char($directory); |
|
|
|
$dir_name = $curdirpath.$directory; |
|
|
|
$directory = disable_dangerous_file($directory); |
|
|
|
$created_dir = create_unexisting_work_directory($base_work_dir, $dir_name); |
|
|
|
$dir_name = $curdirpath.$directory; |
|
|
|
|
|
|
|
$created_dir = create_unexisting_work_directory($base_work_dir, $dir_name); |
|
|
|
// we insert here the directory in the table $work_table |
|
|
|
|
|
|
|
$dir_name_sql = ''; |
|
|
|
// we insert here the directory in the table $work_table |
|
|
|
|
|
|
|
$dir_name_sql = ''; |
|
|
|
if ($is_allowed_to_edit && Security::check_token('post')) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($created_dir)) { |
|
|
|
if (!empty($created_dir)) { |
|
|
|
if ($curdirpath == '/') { |
|
|
|
if ($curdirpath == '/') { |
|
|
@ -722,7 +691,9 @@ switch ($action) { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Display :: display_error_message(get_lang('CannotCreateDir')); |
|
|
|
Display :: display_error_message(get_lang('CannotCreateDir')); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
$form->display(); |
|
|
|
|
|
|
|
} |
|
|
|
case 'upload': |
|
|
|
case 'upload': |
|
|
|
if ($student_can_edit_in_session && isset($_POST['sec_token']) && Security::check_token('post')) { |
|
|
|
if ($student_can_edit_in_session && isset($_POST['sec_token']) && Security::check_token('post')) { |
|
|
|
|
|
|
|
|
|
|
|