version 1.350.2.6, 2007/01/18 21:14:04
|
version 1.362, 2007/03/17 02:14:26
|
Line 554 sub valout {
|
Line 554 sub valout {
|
} |
} |
$result=~s/\s+$//; |
$result=~s/\s+$//; |
} elsif (&isdateparm($type)) { |
} elsif (&isdateparm($type)) { |
$result = localtime($value).&date_sanity_info($value); |
$result = &Apache::lonlocal::locallocaltime($value). |
|
&date_sanity_info($value); |
} else { |
} else { |
$result = $value; |
$result = $value; |
} |
} |
Line 2121 sub crsenv {
|
Line 2122 sub crsenv {
|
'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question'). |
'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question'). |
'</b><br />(<tt>user:domain,'. |
'</b><br />(<tt>user:domain,'. |
'user:domain(section;section;...;*;...),...</tt>)', |
'user:domain(section;section;...;*;...),...</tt>)', |
|
'question.email.text' => '<b>'.&mt('Custom Text for Resource Content Question Option in Feedback'). |
|
'</b>', |
'comment.email' => '<b>'.&mt('Feedback Addresses for Course Content Comments').'</b><br />'. |
'comment.email' => '<b>'.&mt('Feedback Addresses for Course Content Comments').'</b><br />'. |
'(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)', |
'(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)', |
|
'comment.email.text' => '<b>'.&mt('Custom Text for Course Content Option in Feedback'). |
|
'</b>', |
'policy.email' => '<b>'.&mt('Feedback Addresses for Course Policy').'</b>'. |
'policy.email' => '<b>'.&mt('Feedback Addresses for Course Policy').'</b>'. |
'<br />(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)', |
'<br />(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)', |
|
'policy.email.text' => '<b>'.&mt('Custom Text for Course Policy Option in Feedback'). |
|
'</b>', |
'hideemptyrows' => '<b>'.&mt('Hide Empty Rows in Spreadsheets').'</b><br />'. |
'hideemptyrows' => '<b>'.&mt('Hide Empty Rows in Spreadsheets').'</b><br />'. |
'('.&mt('"[_1]" for default hiding','<tt>yes</tt>').')', |
'('.&mt('"[_1]" for default hiding','<tt>yes</tt>').')', |
'pageseparators' => '<b>'.&mt('Visibly Separate Items on Pages').'</b><br />'. |
'pageseparators' => '<b>'.&mt('Visibly Separate Items on Pages').'</b><br />'. |
Line 2207 sub crsenv {
|
Line 2214 sub crsenv {
|
=> '<b>'.&mt('Disable display of problem receipts').'</b><br />'. |
=> '<b>'.&mt('Disable display of problem receipts').'</b><br />'. |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
'task_messages' |
'task_messages' |
=> '<b>'.&mt('Send message to student when clicking Done on Tasks. [_1] to send a message only to student, [_2] to send message to student and add record to user information page for instructors. Leave blank to disable.','<tt>only_student</tt>','<tt>student_and_user_notes_screen</tt>').'</b>', |
=> '<b>'.&mt('Send message to student when clicking Done on Tasks').'</b><br /> ('.&mt('[_1] to send a message only to student, [_2] to send message to student and add record to user information page for instructors. Leave blank to disable.','<tt>only_student</tt>','<tt>student_and_user_notes_screen</tt>').')', |
'disablesigfigs' |
'disablesigfigs' |
=> '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'. |
=> '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'. |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
Line 2222 sub crsenv {
|
Line 2229 sub crsenv {
|
my @Display_Order = ('url','description','courseid','cloners','grading', |
my @Display_Order = ('url','description','courseid','cloners','grading', |
'externalsyllabus', |
'externalsyllabus', |
'default_xml_style','pageseparators', |
'default_xml_style','pageseparators', |
'question.email','comment.email','policy.email', |
'question.email','question.email.text','comment.email','comment.email.text','policy.email','policy.email.text', |
'student_classlist_view', |
'student_classlist_view', |
'plc.roles.denied','plc.users.denied', |
'plc.roles.denied','plc.users.denied', |
'pch.roles.denied','pch.users.denied', |
'pch.roles.denied','pch.users.denied', |
Line 2875 ENDOVER
|
Line 2882 ENDOVER
|
'<td><input type="checkbox" name="del_'.$thiskey.'" /></td>' ); |
'<td><input type="checkbox" name="del_'.$thiskey.'" /></td>' ); |
|
|
$r->print('<td>'); |
$r->print('<td>'); |
|
my $display_value = $resourcedata->{$thiskey}; |
|
if (&isdateparm($resourcedata->{$thiskey.'.type'})) { |
|
$display_value = |
|
&Apache::lonlocal::locallocaltime($display_value); |
|
} |
$r->print(&mt('Parameter: "[_1]" with value: "[_2]"', |
$r->print(&mt('Parameter: "[_1]" with value: "[_2]"', |
&standard_parameter_names($data{'parameter_name'}), |
&standard_parameter_names($data{'parameter_name'}), |
$resourcedata->{$thiskey})); |
$resourcedata->{$thiskey})); |
Line 2899 ENDOVER
|
Line 2911 ENDOVER
|
$r->print(&mt('Resource: [_1] <br /> with ID: [_2] <br /> in folder [_3]', |
$r->print(&mt('Resource: [_1] <br /> with ID: [_2] <br /> in folder [_3]', |
$url,$resid,$map)); |
$url,$resid,$map)); |
} |
} |
$r->print(&mt('Part: [_1]',$data{'parameter_part'})); |
$r->print(' <br /> '.&mt('Part: [_1]',$data{'parameter_part'})); |
$r->print('</td></tr>'); |
$r->print('</td></tr>'); |
|
|
} |
} |
Line 3189 ENDMAINFORMHEAD
|
Line 3201 ENDMAINFORMHEAD
|
### Set portfolio metadata |
### Set portfolio metadata |
sub output_row { |
sub output_row { |
my ($r, $field_name, $field_text, $added_flag) = @_; |
my ($r, $field_name, $field_text, $added_flag) = @_; |
my $row_class; |
|
my $output; |
my $output; |
my $options=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'}; |
my $options=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'}; |
my $values=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.values'}; |
my $values=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.values'}; |
Line 3198 sub output_row {
|
Line 3209 sub output_row {
|
$values = ''; |
$values = ''; |
} |
} |
if (!($options =~ /deleted/)) { |
if (!($options =~ /deleted/)) { |
$output = &Apache::loncommon::start_data_table_row(); |
|
$output .= '<td><span class="LC_metadata"><strong>'.$field_text.':</strong></span></td>'; |
|
# $output .= '<td><strong>'.$field_text.':</strong></td>'; |
|
$output .= '<td><span class="LC_metadata"><input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /></span></td>'; |
|
$output .= &Apache::loncommon::end_data_table_row(); |
|
my @options= ( ['active', 'Show to student'], |
my @options= ( ['active', 'Show to student'], |
['onlyone','Student may select only one choice'], |
['stuadd', 'Provide text area for students to type catalog information'], |
['stuadd', 'Student may type choices']); |
['choices','Provide choices for students to select from']); |
|
# ['onlyone','Student may select only one choice']); |
if ($added_flag) { |
if ($added_flag) { |
push @options,['deleted', 'Delete Metadata Field']; |
push @options,['deleted', 'Delete Metadata Field']; |
} |
} |
|
$output = &Apache::loncommon::start_data_table_row(); |
|
$output .= '<td><span class="LC_metadata"><strong>'.$field_text.':</strong></span></td>'; |
|
$output .= &Apache::loncommon::end_data_table_row(); |
foreach my $opt (@options) { |
foreach my $opt (@options) { |
my $checked = ($options =~ m/$opt->[0]/) ? ' checked="checked" ' : '' ; |
my $checked = ($options =~ m/$opt->[0]/) ? ' checked="checked" ' : '' ; |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= &Apache::loncommon::continue_data_table_row(); |
$output .= '<td colspan="2">'.(' ' x 5).'<span class="LC_metadata"><label><input type="checkbox" name="'. |
$output .= '<td>'.(' ' x 5).'<span class="LC_metadata"><label> |
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
<input type="checkbox" name="'. |
&mt($opt->[1]).'</label></span> </td>'; |
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
|
&mt($opt->[1]).'</label></span> </td>'; |
$output .= &Apache::loncommon::end_data_table_row(); |
$output .= &Apache::loncommon::end_data_table_row(); |
} |
} |
|
$output .= &Apache::loncommon::continue_data_table_row(); |
|
$output .= '<td>'.(' ' x 10).'<span class="LC_metadata"><input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /></span></td>'; |
|
$output .= &Apache::loncommon::end_data_table_row(); |
|
my $multiple_checked; |
|
my $single_checked; |
|
if ($options =~ m/onlyone/) { |
|
$multiple_checked = ""; |
|
$single_checked = " CHECKED "; |
|
} else { |
|
$multiple_checked = " CHECKED "; |
|
$single_checked = ""; |
|
} |
|
$output .= &Apache::loncommon::continue_data_table_row(); |
|
$output .= '<td>'.(' ' x 10).'<span class="LC_metadata"> |
|
<input type="radio" name="'.$field_name.'_onlyone" value="multiple" '.$multiple_checked .'/> |
|
Student may select multiple choices from list</span></td>'; |
|
$output .= &Apache::loncommon::end_data_table_row(); |
|
$output .= &Apache::loncommon::continue_data_table_row(); |
|
$output .= '<td>'.(' ' x 10).'<span class="LC_metadata"> |
|
<input type="radio" name="'.$field_name.'_onlyone" value="single" '.$single_checked.'/> |
|
Student may select only one choice from list</span></td>'; |
|
$output .= &Apache::loncommon::end_data_table_row(); |
} |
} |
return ($output); |
return ($output); |
} |
} |
Line 3268 sub order_meta_fields {
|
Line 3300 sub order_meta_fields {
|
{'metadata.addedorder'=>$ordered_fields},$dom,$crs); |
{'metadata.addedorder'=>$ordered_fields},$dom,$crs); |
&Apache::lonnet::appenv('course.'.$env{'request.course.id'}.'.metadata.addedorder' => $ordered_fields); |
&Apache::lonnet::appenv('course.'.$env{'request.course.id'}.'.metadata.addedorder' => $ordered_fields); |
} |
} |
my $fields = &get_added_meta_fieldnames(); |
my $fields = &get_added_meta_fieldnames($env{'request.course.id'}); |
my $ordered_fields; |
my $ordered_fields; |
my @fields_in_order = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}; |
my @fields_in_order = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}; |
if (!@fields_in_order) { |
if (!@fields_in_order) { |
Line 3340 sub addmetafield {
|
Line 3372 sub addmetafield {
|
$r->print('Added new Metadata Field <strong>'.$env{'form.fieldname'}."</strong> with result ".$put_result.'<br />'); |
$r->print('Added new Metadata Field <strong>'.$env{'form.fieldname'}."</strong> with result ".$put_result.'<br />'); |
$r->print(&continue()); |
$r->print(&continue()); |
} else { |
} else { |
my $fields = &get_deleted_meta_fieldnames(); |
my $fields = &get_deleted_meta_fieldnames($env{'request.course.id'}); |
if ($fields) { |
if ($fields) { |
$r->print('You may undelete previously deleted fields.<br />Check those you wish to undelete and click Undelete.<br />'); |
$r->print('You may undelete previously deleted fields.<br />Check those you wish to undelete and click Undelete.<br />'); |
$r->print('<form method="post" action="">'); |
$r->print('<form method="post" action="">'); |
Line 3353 sub addmetafield {
|
Line 3385 sub addmetafield {
|
$r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.<form method="post" action="/adm/parmset?action=addmetadata"'); |
$r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.<form method="post" action="/adm/parmset?action=addmetadata"'); |
$r->print('<input type="text" name="fieldname" /><br />'); |
$r->print('<input type="text" name="fieldname" /><br />'); |
$r->print('<input type="submit" value="Add Metadata Field" />'); |
$r->print('<input type="submit" value="Add Metadata Field" />'); |
$r->print('</form>'); |
|
} |
} |
|
$r->print('</form>'); |
} |
} |
sub setrestrictmeta { |
sub setrestrictmeta { |
my ($r)=@_; |
my ($r)=@_; |
Line 3379 sub setrestrictmeta {
|
Line 3411 sub setrestrictmeta {
|
if ($env{'form.'.$meta_field.'_stuadd'}) { |
if ($env{'form.'.$meta_field.'_stuadd'}) { |
$options.='stuadd,'; |
$options.='stuadd,'; |
} |
} |
if ($env{'form.'.$meta_field.'_onlyone'}) { |
if ($env{'form.'.$meta_field.'_choices'}) { |
|
$options.='choices,'; |
|
} |
|
if ($env{'form.'.$meta_field.'_onlyone'} eq 'single') { |
$options.='onlyone,'; |
$options.='onlyone,'; |
} |
} |
if ($env{'form.'.$meta_field.'_active'}) { |
if ($env{'form.'.$meta_field.'_active'}) { |
Line 3388 sub setrestrictmeta {
|
Line 3423 sub setrestrictmeta {
|
if ($env{'form.'.$meta_field.'_deleted'}) { |
if ($env{'form.'.$meta_field.'_deleted'}) { |
$options.='deleted,'; |
$options.='deleted,'; |
} |
} |
|
|
my $name = $save_field; |
my $name = $save_field; |
$put_result = &Apache::lonnet::put('environment', |
$put_result = &Apache::lonnet::put('environment', |
{'metadata.'.$meta_field.'.options'=>$options, |
{'metadata.'.$meta_field.'.options'=>$options, |
Line 3403 sub setrestrictmeta {
|
Line 3437 sub setrestrictmeta {
|
# Get the default metadata fields |
# Get the default metadata fields |
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
# Now get possible added metadata fields |
# Now get possible added metadata fields |
my $added_metadata_fields = &get_added_meta_fieldnames(\%metadata_fields); |
my $added_metadata_fields = &get_added_meta_fieldnames($env{'request.course.id'}); |
my $row_alt = 1; |
my $row_alt = 1; |
$output .= &Apache::loncommon::start_data_table(); |
$output .= &Apache::loncommon::start_data_table(); |
foreach my $field (sort(keys(%metadata_fields))) { |
foreach my $field (sort(keys(%metadata_fields))) { |
Line 3412 sub setrestrictmeta {
|
Line 3446 sub setrestrictmeta {
|
$output.= &output_row($r, $field, $metadata_fields{$field}); |
$output.= &output_row($r, $field, $metadata_fields{$field}); |
} |
} |
} |
} |
|
my $buttons = (<<ENDButtons); |
|
<input type="submit" name="restrictmeta" value="Save" /> |
|
</form><br /> |
|
<form method="post" action="/adm/parmset?action=addmetadata" name="form1"> |
|
<input type="submit" name="restrictmeta" value="Add a Metadata Field" /> |
|
</form> |
|
<br /> |
|
<form method="post" action="/adm/parmset?action=ordermetadata" name="form2"> |
|
<input type="submit" name="restrictmeta" value="Order Metadata Fields" /> |
|
ENDButtons |
my $added_flag = 1; |
my $added_flag = 1; |
foreach my $field (sort(keys(%$added_metadata_fields))) { |
foreach my $field (sort(keys(%$added_metadata_fields))) { |
$row_alt = $row_alt ? 0 : 1; |
$row_alt = $row_alt ? 0 : 1; |
Line 3421 sub setrestrictmeta {
|
Line 3465 sub setrestrictmeta {
|
$r->print(<<ENDenv); |
$r->print(<<ENDenv); |
<form method="post" action="/adm/parmset?action=setrestrictmeta" name="form"> |
<form method="post" action="/adm/parmset?action=setrestrictmeta" name="form"> |
$output |
$output |
<input type="submit" name="restrictmeta" value="Update Metadata Restrictions" /> |
$buttons |
</form><br /> |
|
<form method="post" action="/adm/parmset?action=addmetadata" name="form1"> |
|
<input type="submit" name="restrictmeta" value="Add a Metadata Field" /> |
|
</form> |
|
<br /> |
|
<form method="post" action="/adm/parmset?action=ordermetadata" name="form2"> |
|
<input type="submit" name="restrictmeta" value="Order Metadata Fields" /> |
|
</form> |
</form> |
ENDenv |
ENDenv |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
Line 3436 ENDenv
|
Line 3473 ENDenv
|
} |
} |
################################################## |
################################################## |
sub get_added_meta_fieldnames { |
sub get_added_meta_fieldnames { |
|
my ($cid) = @_; |
my %fields; |
my %fields; |
foreach my $key(%env) { |
foreach my $key(%env) { |
if ($key =~ m/\.metadata\.(.+)\.added$/) { |
if ($key =~ m/\Q$cid\E\.metadata\.(.+)\.added$/) { |
my $field_name = $1; |
my $field_name = $1; |
my ($display_field_name) = $env{$key}; |
my ($display_field_name) = $env{$key}; |
$fields{$field_name} = $display_field_name; |
$fields{$field_name} = $display_field_name; |
Line 3447 sub get_added_meta_fieldnames {
|
Line 3485 sub get_added_meta_fieldnames {
|
return \%fields; |
return \%fields; |
} |
} |
sub get_deleted_meta_fieldnames { |
sub get_deleted_meta_fieldnames { |
|
my ($cid) = @_; |
my %fields; |
my %fields; |
my ($default_fields) = @_; |
|
foreach my $key(%env) { |
foreach my $key(%env) { |
if ($key =~ m/\.metadata\.(.+)\.added$/) { |
if ($key =~ m/\Q$cid\E\.metadata\.(.+)\.added$/) { |
my $field_name = $1; |
my $field_name = $1; |
if ($env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'} =~ m/deleted/) { |
if ($env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'} =~ m/deleted/) { |
my ($display_field_name) = $env{$key}; |
my ($display_field_name) = $env{$key}; |