version 1.239, 2009/12/14 14:39:23
|
version 1.246, 2012/05/21 19:01:12
|
Line 638 sub prettyinput {
|
Line 638 sub prettyinput {
|
|
|
if ($values) { |
if ($values) { |
if ($only_one) { |
if ($only_one) { |
$output .= (&Apache::loncommon::select_form($cur_values_inst[0],'new_'.$type,%meta_options)); |
$output .= (&Apache::loncommon::select_form($cur_values_inst[0],'new_'.$type,\%meta_options)); |
} else { |
} else { |
$output .= (&Apache::loncommon::multiple_select_form('new_'.$type,\@cur_values_inst,undef,\%meta_options)); |
$output .= (&Apache::loncommon::multiple_select_form('new_'.$type,\@cur_values_inst,undef,\%meta_options)); |
} |
} |
Line 779 sub handler {
|
Line 779 sub handler {
|
if ($env{'request.state'} eq 'construct') { |
if ($env{'request.state'} eq 'construct') { |
&Apache::lonhtmlcommon::add_breadcrumb({ |
&Apache::lonhtmlcommon::add_breadcrumb({ |
'text' => 'Construction Space', |
'text' => 'Construction Space', |
'href' => &Apache::loncommon::authorspace(), |
'href' => &Apache::loncommon::authorspace($uri), |
}); |
}); |
} |
} |
|
|
Line 828 sub handler {
|
Line 828 sub handler {
|
{'domain' => $resdomain,})); |
{'domain' => $resdomain,})); |
$r->print(&pageheader()); |
$r->print(&pageheader()); |
&present_editable_metadata($r,$uri,'groups'); |
&present_editable_metadata($r,$uri,'groups'); |
} elsif ($uri=~m|^/~|) { |
} elsif ($uri=~m|^/priv|) { |
# Construction space |
# Construction space |
&Apache::lonhtmlcommon::add_breadcrumb({ |
&Apache::lonhtmlcommon::add_breadcrumb({ |
'text' => 'Edit Metadata', |
'text' => 'Edit Metadata', |
Line 874 sub report_bombs {
|
Line 874 sub report_bombs {
|
$uri = &Apache::lonnet::declutter($uri); |
$uri = &Apache::lonnet::declutter($uri); |
$r->print('<h1>'.&Apache::lonnet::clutter($uri).'</h1>'); |
$r->print('<h1>'.&Apache::lonnet::clutter($uri).'</h1>'); |
my ($domain,$author)=($uri=~/^($match_domain)\/($match_username)\//); |
my ($domain,$author)=($uri=~/^($match_domain)\/($match_username)\//); |
if (&Apache::loncacc::constructaccess('/~'.$author.'/',$domain)) { |
if (!&Apache::loncacc::constructaccess('/priv/'.$domain.'/'.$author.'/')) { |
if ($env{'form.clearbombs'}) { |
$r->print('<p class="LC_error">'.&mt('Not authorized').'</p>'); |
&Apache::lonmsg::clear_author_res_msg($uri); |
return; |
} |
} |
my $clear=&mt('Clear all Messages in Subdirectory'); |
|
my $cancel=&mt('Back to Directory'); |
my $showbuttons=1; |
my $cancelurl=$uri; |
my $message=''; |
$cancelurl=~s/^\Q$domain\E/\/priv/; |
if ($env{'form.clearbombs'}) { |
$r->print(<<ENDCLEAR); |
my $rc=&Apache::lonmsg::clear_author_res_msg($uri); |
<form method="post"> |
if ($rc eq 'ok') { |
<input type="submit" name="clearbombs" value="$clear" /> |
$message=&Apache::lonhtmlcommon::confirm_success( |
<a href="$cancelurl">$cancel</a> |
&mt('Messages cleared.')); |
</form><hr /> |
$showbuttons=0; |
ENDCLEAR |
} else { |
|
$message=&Apache::lonhtmlcommon::confirm_success( |
|
&mt('Error clearing messages'),1) |
|
.'<br />'.&mt('Error: [_1]',$rc); |
|
} |
|
} |
|
|
|
if ($message) { |
|
$message=&Apache::loncommon::confirmwrapper($message); |
|
$r->print($message); |
|
} |
|
|
|
my $cancelurl=$uri; |
|
$cancelurl=~s/^\Q$domain\E/\/priv\/$domain/; |
|
|
|
if ($showbuttons) { |
|
$r->print( |
|
'<form method="post" action="">'. |
|
'<input type="submit" name="clearbombs" value="'. |
|
&mt('Clear all Messages in Subdirectory').'" />'. |
|
' <a href="'.$cancelurl.'">'. |
|
&mt('Back to Source Directory').'</a>'. |
|
'</form><hr />' |
|
); |
|
# Display all bombs of subdirectory |
my %brokenurls = |
my %brokenurls = |
&Apache::lonmsg::all_url_author_res_msg($author,$domain); |
&Apache::lonmsg::all_url_author_res_msg($author,$domain); |
foreach my $key (sort(keys(%brokenurls))) { |
foreach my $key (sort(keys(%brokenurls))) { |
Line 899 ENDCLEAR
|
Line 923 ENDCLEAR
|
} |
} |
} |
} |
} else { |
} else { |
$r->print(&mt('Not authorized')); |
my $functions=&Apache::lonhtmlcommon::start_funclist('Actions'); |
|
$functions.=&Apache::lonhtmlcommon::add_item_funclist( |
|
'<a href="'.$cancelurl.'">'. |
|
&mt('Back to Source Directory').'</a>'); |
|
$functions .= &Apache::lonhtmlcommon::end_funclist(); |
|
$r->print('<p>'.$functions.'</p>'); |
} |
} |
return; |
return; |
} |
} |
Line 1053 sub print_dynamic_metadata {
|
Line 1082 sub print_dynamic_metadata {
|
} |
} |
# |
# |
# Assessment statistics |
# Assessment statistics |
if ($uri=~/\.(problem|exam|quiz|assess|survey|form)$/) { |
if ($uri=~/$LONCAPA::assess_re/) { |
if (exists($dynmeta{'stdno'}) || |
if (exists($dynmeta{'stdno'}) || |
exists($dynmeta{'avetries'}) || |
exists($dynmeta{'avetries'}) || |
exists($dynmeta{'difficulty'}) || |
exists($dynmeta{'difficulty'}) || |
Line 1092 sub print_dynamic_metadata {
|
Line 1121 sub print_dynamic_metadata {
|
.'<th>'.&mt('Course').'</th>' |
.'<th>'.&mt('Course').'</th>' |
.'<th>'.&mt('Section(s)').'</th>' |
.'<th>'.&mt('Section(s)').'</th>' |
.'<th>'.&mt('Num Students').'</th>' |
.'<th>'.&mt('Num Students').'</th>' |
|
.'<th>'.&mt('Part').'</th>' |
.'<th>'.&mt('Mean Tries').'</th>' |
.'<th>'.&mt('Mean Tries').'</th>' |
.'<th>'.&mt('Degree of Difficulty').'</th>' |
.'<th>'.&mt('Degree of Difficulty').'</th>' |
.'<th>'.&mt('Degree of Discrimination').'</th>' |
.'<th>'.&mt('Degree of Discrimination').'</th>' |
Line 1114 sub print_dynamic_metadata {
|
Line 1144 sub print_dynamic_metadata {
|
'<td align="right">'.$data->{'sections'}.'</td>'; |
'<td align="right">'.$data->{'sections'}.'</td>'; |
$table .= |
$table .= |
'<td align="right">'.$data->{'stdno'}.'</td>'; |
'<td align="right">'.$data->{'stdno'}.'</td>'; |
|
$table .= |
|
'<td align="right">'.$data->{'part'}.'</td>'; |
foreach my $item ('avetries','difficulty','disc') { |
foreach my $item ('avetries','difficulty','disc') { |
$table .= '<td align="right">'; |
$table .= '<td align="right">'; |
if (exists($data->{$item})) { |
if (exists($data->{$item})) { |
Line 1190 sub print_dynamic_metadata {
|
Line 1222 sub print_dynamic_metadata {
|
my $bombs = &Apache::lonmsg::retrieve_author_res_msg($uri); |
my $bombs = &Apache::lonmsg::retrieve_author_res_msg($uri); |
if (defined($bombs) && $bombs ne '') { |
if (defined($bombs) && $bombs ne '') { |
$r->print('<a name="bombs" />' |
$r->print('<a name="bombs" />' |
.'<h4 class="LC_error">'.&mt('Error Messages').'</h4>' |
.'<h4 class="LC_warning">'.&mt('Error Messages').'</h4>' |
.'<div>(' |
.'<div>(' |
.&mt('visible to author and co-authors only') |
.&mt('visible to author and co-authors only') |
.')</div>' |
.')</div>' |
Line 1273 sub present_editable_metadata {
|
Line 1305 sub present_editable_metadata {
|
$target=~s/\.meta$//; |
$target=~s/\.meta$//; |
my $bombs=&Apache::lonmsg::retrieve_author_res_msg($target); |
my $bombs=&Apache::lonmsg::retrieve_author_res_msg($target); |
if ($bombs) { |
if ($bombs) { |
my $showdel=1; |
# Display Bombs, not Metadata |
|
$r->print("<h1>$disuri</h1>"); |
|
my $showbuttons=1; |
|
my $message=''; |
|
my $rc=''; |
if ($env{'form.delmsg'}) { |
if ($env{'form.delmsg'}) { |
if (&Apache::lonmsg::del_url_author_res_msg($target) eq 'ok') { |
$rc=&Apache::lonmsg::del_url_author_res_msg($target); |
$bombs=&mt('Messages deleted.'); |
if ($rc eq 'ok') { |
$showdel=0; |
$message=&Apache::lonhtmlcommon::confirm_success( |
|
&mt('Messages deleted.')); |
|
$showbuttons=0; |
} else { |
} else { |
$bombs=&mt('Error deleting messages'); |
$message=&Apache::lonhtmlcommon::confirm_success( |
|
&mt('Error deleting messages'), 1) |
|
.'<br />'.&mt('Error: [_1]',$rc); |
} |
} |
} |
} |
if ($env{'form.clearmsg'}) { |
if ($env{'form.clearmsg'}) { |
my $cleardir=$target; |
my $cleardir=$target; |
$cleardir=~s/\/[^\/]+$/\//; |
$cleardir=~s/\/[^\/]+$/\//; # Extract dir: keep path, remove filename |
if (&Apache::lonmsg::clear_author_res_msg($cleardir) eq 'ok') { |
$rc=&Apache::lonmsg::clear_author_res_msg($cleardir); |
$bombs=&mt('Messages cleared.'); |
if ($rc eq 'ok') { |
$showdel=0; |
$message=&Apache::lonhtmlcommon::confirm_success( |
|
&mt('Messages cleared.')); |
|
$showbuttons=0; |
} else { |
} else { |
$bombs=&mt('Error clearing messages'); |
$message=&Apache::lonhtmlcommon::confirm_success( |
|
&mt('Error clearing messages'),1) |
|
.'<br />'.&mt('Error: [_1]',$rc); |
} |
} |
} |
} |
my $del=&mt('Delete Messages for this Resource'); |
if ($message) { |
my $clear=&mt('Clear all Messages in Subdirectory'); |
$message=&Apache::loncommon::confirmwrapper($message); |
my $goback=&mt('Back to Source File'); |
$r->print($message); |
$r->print(<<ENDBOMBS); |
} |
<h1>$disuri</h1> |
|
<form method="post" action="" name="defaultmeta"> |
$r->print('<form method="post" action="" name="defaultmeta">'); |
ENDBOMBS |
if ($showbuttons) { |
if ($showdel) { |
$r->print( |
$r->print(<<ENDDEL); |
'<input type="submit" name="delmsg" value="'. |
<input type="submit" name="delmsg" value="$del" /> |
&mt('Delete Messages for this Resource').'" />'. |
<input type="submit" name="clearmsg" value="$clear" /> |
'<input type="submit" name="clearmsg" value="'. |
ENDDEL |
&mt('Clear all Messages in Subdirectory').'" />' |
|
.'<br />'.$bombs |
|
); |
} else { |
} else { |
$r->print('<p><a href="'.$disuri.'">'.$goback.'</a></p>'); |
my $functions=&Apache::lonhtmlcommon::start_funclist('Actions'); |
if ($env{'form.clearmsg'}) { |
$functions.=&Apache::lonhtmlcommon::add_item_funclist( |
my ($diruri) = ($disuri =~ m{(.*/)[^/]*}); |
'<a href="'.$disuri.'">'. |
$r->print('<p><a href="'.$diruri.'">'. |
&mt('Back to Source File').'</a>'); |
&mt('Back To Directory').'</a></p>'); |
my ($diruri) = ($disuri =~ m{(.*/)[^/]*}); |
} |
$functions.=&Apache::lonhtmlcommon::add_item_funclist( |
} |
'<a href="'.$diruri.'">'. |
$r->print('<br />'.$bombs); |
&mt('Back to Source Directory').'</a>'); |
|
$functions .= &Apache::lonhtmlcommon::end_funclist(); |
|
$r->print('<p>'.$functions.'</p>'); |
|
} |
} else { |
} else { |
|
|
|
# Display Metadata, not Bombs |
my $displayfile=&mt('Metadata for [_1]',$disuri); |
my $displayfile=&mt('Metadata for [_1]',$disuri); |
if ($disuri=~/\/default$/) { |
if ($disuri=~/\/default$/) { |
my $dir=$disuri; |
my $dir=$disuri; |