Minor - UI fixes

skala
Julio Montoya 13 years ago
parent 90ae552d49
commit 37dc8f282e
  1. 43
      main/work/work.lib.php
  2. 177
      main/work/work.php

@ -113,7 +113,7 @@ function display_tool_options($uploadvisibledisabled, $origin) {
if (!$is_allowed_to_edit) { if (!$is_allowed_to_edit) {
return; return;
} }
echo '<form method="post" action="'.api_get_self().'?origin='.$origin.'&gradebook='.$gradebook.'&action=settings">'; echo '<form class="form-horizontal" method="post" action="'.api_get_self().'?origin='.$origin.'&gradebook='.$gradebook.'&action=settings">';
echo '<legend>'.get_lang('EditToolOptions').'</legend>'; echo '<legend>'.get_lang('EditToolOptions').'</legend>';
display_default_visibility_form($uploadvisibledisabled); display_default_visibility_form($uploadvisibledisabled);
display_studentsdelete_form(); display_studentsdelete_form();
@ -135,19 +135,19 @@ function display_tool_options($uploadvisibledisabled, $origin) {
*/ */
function display_default_visibility_form($uploadvisibledisabled) { function display_default_visibility_form($uploadvisibledisabled) {
?> ?>
<div class="row"> <div class="control-group">
<div class="label"> <label class="control-label">
<?php echo get_lang('_default_upload'); ?> <?php echo get_lang('_default_upload'); ?>
</div> </label>
<div class="formw"> <div class="controls">
<input id="uploadvisibledisabled_1" class="checkbox" type="radio" name="uploadvisibledisabled" value="0" <?php if ($uploadvisibledisabled == 0) echo 'checked'; ?> /> <label class="radio" for="uploadvisibledisabled_1">
<label for="uploadvisibledisabled_1"> <input id="uploadvisibledisabled_1" class="checkbox" type="radio" name="uploadvisibledisabled" value="0" <?php if ($uploadvisibledisabled == 0) echo 'checked'; ?> />
<?php echo get_lang('_new_visible'); ?></label> <?php echo get_lang('_new_visible'); ?>
</label>
<input id="uploadvisibledisabled_2" class="checkbox" type="radio" name="uploadvisibledisabled" value="1" <?php if ($uploadvisibledisabled == 1) echo 'checked'; ?> /> <label class="radio" for="uploadvisibledisabled_2">
<label for="uploadvisibledisabled_2"> <input id="uploadvisibledisabled_2" class="checkbox" type="radio" name="uploadvisibledisabled" value="1" <?php if ($uploadvisibledisabled == 1) echo 'checked'; ?> />
<?php echo get_lang('_new_unvisible'); ?> <?php echo get_lang('_new_unvisible'); ?>
</label> </label>
</div> </div>
</div> </div>
<?php <?php
@ -169,17 +169,16 @@ function display_studentsdelete_form() {
$current_course_setting_value = 0; $current_course_setting_value = 0;
} }
?> ?>
<div class="row"> <div class="control-group">
<div class="label"><?php echo get_lang('StudentAllowedToDeleteOwnPublication'); ?></div> <label class="control-label"><?php echo get_lang('StudentAllowedToDeleteOwnPublication'); ?></label>
<div class="formw"> <div class="controls">
<input id="student_delete_own_publication_2" class="checkbox" type="radio" name="student_delete_own_publication" value="1" <?php if ($current_course_setting_value == 1) echo 'checked'; ?> /> <label class="radio" for="student_delete_own_publication_2">
<label for="student_delete_own_publication_2"> <input id="student_delete_own_publication_2" class="checkbox" type="radio" name="student_delete_own_publication" value="1" <?php if ($current_course_setting_value == 1) echo 'checked'; ?> />
<?php echo get_lang('Yes'); ?> <?php echo get_lang('Yes'); ?>
</label> </label>
<div></div> <label class="radio" for="student_delete_own_publication_1">
<input id="student_delete_own_publication_1" class="checkbox" type="radio" name="student_delete_own_publication" value="0" <input id="student_delete_own_publication_1" class="checkbox" type="radio" name="student_delete_own_publication" value="0"
<?php if ($current_course_setting_value == 0) echo 'checked'; ?> /> <?php if ($current_course_setting_value == 0) echo 'checked'; ?> />
<label for="student_delete_own_publication_1">
<?php echo get_lang('No'); ?> <?php echo get_lang('No'); ?>
</label> </label>

@ -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">&nbsp;&nbsp;'.get_lang('QualificationNumeric').'&nbsp;'; $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 .= '&nbsp;&nbsp;'.get_lang('WeightInTheGradebook').'&nbsp;'; $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 .= '&nbsp;&nbsp;&nbsp;<span id="msg_error2" style="display:none;color:red"></span>';
$addtext .= '&nbsp;&nbsp;&nbsp;<span id="msg_error3" style="display:none;color:red"></span>';
$addtext .= '<div id="option2" style="padding:4px;display:none">&nbsp;&nbsp;';
$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 .= '&nbsp;&nbsp;&nbsp;<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 .= '&nbsp;&nbsp;'.make_checkbox('add_to_calendar', false, get_lang('AddToCalendar'));
$addtext .= '<br /><br /><b>'.get_lang('AllowTextAssignments').'</b><br />';
$addtext .= '&nbsp;&nbsp;'.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')) {

Loading…
Cancel
Save