version 1.246, 2006/11/11 18:36:43
|
version 1.247, 2006/11/12 02:13:05
|
Line 991 sub breadcrumbs {
|
Line 991 sub breadcrumbs {
|
'LC_docs_path'),$randompick,$ishidden,$isencrypted); |
'LC_docs_path'),$randompick,$ishidden,$isencrypted); |
} |
} |
|
|
|
sub log_docs { |
|
return &Apache::lonnet::instructor_log('docslog',@_); |
|
} |
|
|
|
{ |
|
my @oldresources=(); |
|
my @oldorder=(); |
|
my $parmidx; |
|
my %parmaction=(); |
|
my %parmvalue=(); |
|
|
|
sub snapshotbefore { |
|
@oldresources=@Apache::lonratedt::resources; |
|
@oldorder=@Apache::lonratedt::order; |
|
$parmidx=undef; |
|
%parmaction=(); |
|
%parmvalue=(); |
|
} |
|
|
|
sub remember_parms { |
|
my ($idx,$parameter,$action,$value)=@_; |
|
$parmidx=$idx; |
|
$parmaction{$parameter}=$action; |
|
$parmvalue{$parameter}=$value; |
|
} |
|
|
|
sub log_differences { |
|
my $r=shift; |
|
my %storehash=('folder' => $env{'form.folder'}); |
|
if ($parmidx) { |
|
$storehash{'parameter_idx'}=$parmidx; |
|
$storehash{'parameter_res'}=$oldresources[$parmidx]; |
|
foreach my $parm (keys %parmaction) { |
|
$storehash{'parameter_action_'.$parm}=$parmaction{$parm}; |
|
$storehash{'parameter_value_'.$parm}=$parmvalue{$parm}; |
|
} |
|
} |
|
my $maxidx=$#oldresources; |
|
if ($#Apache::lonratedt::resources>$#oldresources) { |
|
$maxidx=$#Apache::lonratedt::resources; |
|
} |
|
for (my $idx=0; $idx<=$maxidx; $idx++) { |
|
if ($LONCAPA::map::resources[$idx] ne $oldresources[$idx]) { |
|
$storehash{'before_resources_'.$idx}=$oldresources[$idx]; |
|
$storehash{'after_resources_'.$idx}=$LONCAPA::map::resources[$idx]; |
|
} |
|
if ($LONCAPA::map::order[$idx] ne $oldorder[$idx]) { |
|
$storehash{'before_order_'.$idx}=$oldorder[$idx]; |
|
$storehash{'after_order_'.$idx}=$LONCAPA::map::order[$idx]; |
|
$storehash{'before_order_res_'.$idx}=$oldresources[$idx]; |
|
$storehash{'after_order_res_'.$idx}=$LONCAPA::map::resources[$idx]; |
|
} |
|
} |
|
&log_docs(\%storehash); |
|
} |
|
} |
|
|
|
|
|
# |
|
# Docs Change Log |
|
# |
|
sub docs_change_log { |
|
my ($r)=@_; |
|
$r->print(&Apache::loncommon::start_page('Course Document Change Log')); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Document Change Log')); |
|
|
|
my %docslog=&Apache::lonnet::dump('nohist_docslog', |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
|
|
if ((keys(%docslog))[0]=~/^error\:/) { undef(%docslog); } |
|
|
|
$r->print('<form action="/adm/coursedocs" method="post" name="docslog">'. |
|
'<input type="hidden" name="docslog" value="1" />'); |
|
|
|
my %saveable_parameters = ('show' => 'scalar',); |
|
&Apache::loncommon::store_course_settings('docs_log', |
|
\%saveable_parameters); |
|
&Apache::loncommon::restore_course_settings('docs_log', |
|
\%saveable_parameters); |
|
if (!$env{'form.show'}) { $env{'form.show'}=10; } |
|
|
|
my $countselect = |
|
&Apache::lonmeta::selectbox('show',$env{'form.show'},undef, |
|
(&mt('all'),10,20,50,100,1000,10000)); |
|
|
|
$r->print('<nobr>'.&mt('[_1] Records',$countselect).'</nobr>'. |
|
'<input type="submit" value="'.&mt('Display').'" /></form>'); |
|
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). |
|
'<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Extent').'</th><th>'.&mt('Users').'</th><th>'. |
|
&mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th><th>'.&mt('Announce').'</th>'. |
|
&Apache::loncommon::end_data_table_header_row()); |
|
my $shown=0; |
|
foreach my $id (sort { $docslog{$b}{'exe_time'}<=>$docslog{$a}{'exe_time'} } (keys(%docslog))) { |
|
my @changes=keys(%{$docslog{$id}{'logentry'}}); |
|
my $count = 0; |
|
my $time = |
|
&Apache::lonlocal::locallocaltime($docslog{$id}{'exe_time'}); |
|
my $plainname = |
|
&Apache::loncommon::plainname($docslog{$id}{'exe_uname'}, |
|
$docslog{$id}{'exe_udom'}); |
|
my $about_me_link = |
|
&Apache::loncommon::aboutmewrapper($plainname, |
|
$docslog{$id}{'exe_uname'}, |
|
$docslog{$id}{'exe_udom'}); |
|
my $send_msg_link=''; |
|
if ((($docslog{$id}{'exe_uname'} ne $env{'user.name'}) |
|
|| ($docslog{$id}{'exe_udom'} ne $env{'user.domain'}))) { |
|
$send_msg_link ='<br />'. |
|
&Apache::loncommon::messagewrapper(&mt('Send message'), |
|
$docslog{$id}{'exe_uname'}, |
|
$docslog{$id}{'exe_udom'}); |
|
} |
|
$r->print(&Apache::loncommon::start_data_table_row()); |
|
$r->print('<td>'.$time.'</td> |
|
<td>'.$about_me_link. |
|
'<br /><tt>'.$docslog{$id}{'exe_uname'}. |
|
':'.$docslog{$id}{'exe_udom'}.'</tt>'. |
|
$send_msg_link.'</td>'); |
|
|
|
$r->print(&Apache::loncommon::end_data_table_row()); |
|
$shown++; |
|
if (!($env{'form.show'} eq &mt('all') |
|
|| $shown<=$env{'form.show'})) { last; } |
|
} |
|
$r->print(&Apache::loncommon::end_data_table()); |
|
$r->print(&Apache::loncommon::end_page()); |
|
} |
|
|
sub editor { |
sub editor { |
my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output)=@_; |
my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output)=@_; |
my $errtext=''; |
my $errtext=''; |
Line 1023 sub editor {
|
Line 1152 sub editor {
|
# ---------------- if they are for this folder and user allowed to make changes |
# ---------------- if they are for this folder and user allowed to make changes |
if (($allowed) && ($env{'form.folder'} eq $folder)) { |
if (($allowed) && ($env{'form.folder'} eq $folder)) { |
# set parameters and change order |
# set parameters and change order |
if (defined($env{'form.setparms'})) { |
&snapshotbefore(); |
|
if ($env{'form.changeparms'}) { |
my $idx=$env{'form.setparms'}; |
my $idx=$env{'form.setparms'}; |
# set parameters |
# set parameters |
if ($env{'form.randpick_'.$idx}) { |
if ($env{'form.randpick_'.$idx}) { |
&LONCAPA::map::storeparameter($idx,'parameter_randompick',$env{'form.randpick_'.$idx},'int_pos'); |
&LONCAPA::map::storeparameter($idx,'parameter_randompick',$env{'form.randpick_'.$idx},'int_pos'); |
|
&remember_parms($idx,'randompick','set',$env{'form.randpick_'.$idx}); |
} else { |
} else { |
&LONCAPA::map::delparameter($idx,'parameter_randompick'); |
&LONCAPA::map::delparameter($idx,'parameter_randompick'); |
|
&remember_parms($idx,'randompick','del'); |
} |
} |
if ($env{'form.hidprs_'.$idx}) { |
if ($env{'form.hidprs_'.$idx}) { |
&LONCAPA::map::storeparameter($idx,'parameter_hiddenresource','yes','string_yesno'); |
&LONCAPA::map::storeparameter($idx,'parameter_hiddenresource','yes','string_yesno'); |
} else { |
&remember_parms($idx,'hiddenresource','set',$env{'form.hidprs_'.$idx}); |
|
} else { |
&LONCAPA::map::delparameter($idx,'parameter_hiddenresource'); |
&LONCAPA::map::delparameter($idx,'parameter_hiddenresource'); |
} |
&remember_parms($idx,'hiddenresource','del'); |
|
} |
if ($env{'form.encprs_'.$idx}) { |
if ($env{'form.encprs_'.$idx}) { |
&LONCAPA::map::storeparameter($idx,'parameter_encrypturl','yes','string_yesno'); |
&LONCAPA::map::storeparameter($idx,'parameter_encrypturl','yes','string_yesno'); |
} else { |
&remember_parms($idx,'encrypturl','set',$env{'form.encprs_'.$idx}); |
|
} else { |
&LONCAPA::map::delparameter($idx,'parameter_encrypturl'); |
&LONCAPA::map::delparameter($idx,'parameter_encrypturl'); |
} |
&remember_parms($idx,'encrypturl','del'); |
|
} |
|
} |
|
|
if ($env{'form.newpos'}) { |
if ($env{'form.newpos'}) { |
# change order |
# change order |
|
my $newpos=$env{'form.newpos'}-1; |
my $newpos=$env{'form.newpos'}-1; |
my $currentpos=$env{'form.currentpos'}-1; |
my $currentpos=$env{'form.currentpos'}-1; |
my $i; |
my $i; |
my @neworder=(); |
my @neworder=(); |
if ($newpos>$currentpos) { |
if ($newpos>$currentpos) { |
|
# moving stuff up |
# moving stuff up |
for ($i=0;$i<$currentpos;$i++) { |
for ($i=0;$i<$currentpos;$i++) { |
$neworder[$i]=$LONCAPA::map::order[$i]; |
$neworder[$i]=$LONCAPA::map::order[$i]; |
} |
} |
for ($i=$currentpos;$i<$newpos;$i++) { |
for ($i=$currentpos;$i<$newpos;$i++) { |
$neworder[$i]=$LONCAPA::map::order[$i+1]; |
$neworder[$i]=$LONCAPA::map::order[$i+1]; |
} |
} |
$neworder[$newpos]=$LONCAPA::map::order[$currentpos]; |
$neworder[$newpos]=$LONCAPA::map::order[$currentpos]; |
for ($i=$newpos+1;$i<=$#LONCAPA::map::order;$i++) { |
for ($i=$newpos+1;$i<=$#LONCAPA::map::order;$i++) { |
$neworder[$i]=$LONCAPA::map::order[$i]; |
$neworder[$i]=$LONCAPA::map::order[$i]; |
} |
} |
} else { |
} else { |
# moving stuff down |
# moving stuff down |
for ($i=0;$i<$newpos;$i++) { |
for ($i=0;$i<$newpos;$i++) { |
$neworder[$i]=$LONCAPA::map::order[$i]; |
$neworder[$i]=$LONCAPA::map::order[$i]; |
} |
} |
$neworder[$newpos]=$LONCAPA::map::order[$currentpos]; |
$neworder[$newpos]=$LONCAPA::map::order[$currentpos]; |
for ($i=$newpos+1;$i<$currentpos+1;$i++) { |
for ($i=$newpos+1;$i<$currentpos+1;$i++) { |
$neworder[$i]=$LONCAPA::map::order[$i-1]; |
$neworder[$i]=$LONCAPA::map::order[$i-1]; |
} |
} |
for ($i=$currentpos+1;$i<=$#LONCAPA::map::order;$i++) { |
for ($i=$currentpos+1;$i<=$#LONCAPA::map::order;$i++) { |
$neworder[$i]=$LONCAPA::map::order[$i]; |
$neworder[$i]=$LONCAPA::map::order[$i]; |
} |
|
} |
} |
@LONCAPA::map::order=@neworder; |
|
} |
} |
|
@LONCAPA::map::order=@neworder; |
# store the changed version |
# store the changed version |
|
|
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); |
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); |
if ($fatal) { |
if ($fatal) { |
$r->print('<p><font color="red">'.$errtext.'</font></p>'); |
$r->print('<p><font color="red">'.$errtext.'</font></p>'); |
return; |
return; |
} |
} |
|
|
} |
} |
|
|
if ($env{'form.pastemarked'}) { |
if ($env{'form.pastemarked'}) { |
# paste resource to end of list |
# paste resource to end of list |
my $url=$env{'form.markedcopy_url'}; |
my $url=$env{'form.markedcopy_url'}; |
Line 1222 sub editor {
|
Line 1356 sub editor {
|
$r->print('<p><font color="red">'.&mt('No map selected.').'</font></p>'); |
$r->print('<p><font color="red">'.&mt('No map selected.').'</font></p>'); |
} |
} |
} |
} |
|
&log_differences($r); |
} |
} |
# ---------------------------------------------------------------- End commands |
# ---------------------------------------------------------------- End commands |
# ---------------------------------------------------------------- Print screen |
# ---------------------------------------------------------------- Print screen |
Line 1504 ENDCOPY
|
Line 1639 ENDCOPY
|
<input type="hidden" name="markedcopy_url" value="$env{'form.markedcopy_url'}" /> |
<input type="hidden" name="markedcopy_url" value="$env{'form.markedcopy_url'}" /> |
<input type="hidden" name="markedcopy_title" value="$env{'form.markedcopy_title'}" /> |
<input type="hidden" name="markedcopy_title" value="$env{'form.markedcopy_title'}" /> |
<input type="hidden" name="setparms" value="$orderidx" /> |
<input type="hidden" name="setparms" value="$orderidx" /> |
|
<input type="hidden" name="changeparms" value="0" /> |
<td><table border='0' cellspacing='2' cellpadding='0'> |
<td><table border='0' cellspacing='2' cellpadding='0'> |
<tr><td bgcolor="#DDDDDD"> |
<tr><td bgcolor="#DDDDDD"> |
<a href='/adm/coursedocs?cmd=up_$index&pagepath=$pagepath&pagesymb=$pagesymb$cpinfo'> |
<a href='/adm/coursedocs?cmd=up_$index&pagepath=$pagepath&pagesymb=$pagesymb$cpinfo'> |
Line 1535 ENDCOPY
|
Line 1671 ENDCOPY
|
<input type="hidden" name="markedcopy_url" value="$env{'form.markedcopy_url'}" /> |
<input type="hidden" name="markedcopy_url" value="$env{'form.markedcopy_url'}" /> |
<input type="hidden" name="markedcopy_title" value="$env{'form.markedcopy_title'}" /> |
<input type="hidden" name="markedcopy_title" value="$env{'form.markedcopy_title'}" /> |
<input type="hidden" name="setparms" value="$orderidx" /> |
<input type="hidden" name="setparms" value="$orderidx" /> |
|
<input type="hidden" name="changeparms" value="0" /> |
<td><table border='0' cellspacing='2' cellpadding='0'> |
<td><table border='0' cellspacing='2' cellpadding='0'> |
<tr><td bgcolor="#DDDDDD"> |
<tr><td bgcolor="#DDDDDD"> |
<a href='/adm/coursedocs?cmd=up_$index&folderpath=$folderpath$cpinfo'> |
<a href='/adm/coursedocs?cmd=up_$index&folderpath=$folderpath$cpinfo'> |
Line 1632 END
|
Line 1769 END
|
'parameter_encrypturl'))[0]=~/^yes$/i); |
'parameter_encrypturl'))[0]=~/^yes$/i); |
$url.='folderpath='.&escape($folderpath).$cpinfo; |
$url.='folderpath='.&escape($folderpath).$cpinfo; |
$parameterset='<label>'.&mt('Randomly Pick: '). |
$parameterset='<label>'.&mt('Randomly Pick: '). |
'<input type="text" size="4" onChange="this.form.submit()" name="randpick_'.$orderidx.'" value="'. |
'<input type="text" size="4" onChange="this.form.changeparms.value=1;this.form.submit()" name="randpick_'.$orderidx.'" value="'. |
(&LONCAPA::map::getparameter($orderidx, |
(&LONCAPA::map::getparameter($orderidx, |
'parameter_randompick'))[0]. |
'parameter_randompick'))[0]. |
'" />'. |
'" />'. |
Line 1671 END
|
Line 1808 END
|
((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="1"':''); |
((&LONCAPA::map::getparameter($orderidx,'parameter_hiddenresource'))[0]=~/^yes$/i?' checked="1"':''); |
$line.=(<<ENDPARMS); |
$line.=(<<ENDPARMS); |
<td bgcolor="#BBBBFF"><font size='-2'> |
<td bgcolor="#BBBBFF"><font size='-2'> |
<nobr><label><input type="checkbox" name="hidprs_$orderidx" onClick="this.form.submit()" $hidtext /> $lt{'hd'}</label></nobr></td> |
<nobr><label><input type="checkbox" name="hidprs_$orderidx" onClick="this.form.changeparms.value=1;this.form.submit()" $hidtext /> $lt{'hd'}</label></nobr></td> |
<td bgcolor="#BBBBFF"><font size='-2'> |
<td bgcolor="#BBBBFF"><font size='-2'> |
<nobr><label><input type="checkbox" name="encprs_$orderidx" onClick="this.form.submit()" $enctext /> $lt{'ec'}</label></nobr></td> |
<nobr><label><input type="checkbox" name="encprs_$orderidx" onClick="this.form.changeparms.value=1;this.form.submit()" $enctext /> $lt{'ec'}</label></nobr></td> |
<td bgcolor="#BBBBFF"><font size="-2">$parameterset</font></td> |
<td bgcolor="#BBBBFF"><font size="-2">$parameterset</font></td> |
ENDPARMS |
ENDPARMS |
} |
} |
Line 2169 sub handler {
|
Line 2306 sub handler {
|
&verifycontent($r); |
&verifycontent($r); |
} elsif ($allowed && $env{'form.listsymbs'}) { |
} elsif ($allowed && $env{'form.listsymbs'}) { |
&list_symbs($r); |
&list_symbs($r); |
|
} elsif ($allowed && $env{'form.docslog'}) { |
|
&docs_change_log($r); |
} elsif ($allowed && $env{'form.versions'}) { |
} elsif ($allowed && $env{'form.versions'}) { |
&checkversions($r); |
&checkversions($r); |
} elsif ($allowed && $env{'form.dumpcourse'}) { |
} elsif ($allowed && $env{'form.dumpcourse'}) { |
Line 2367 sub handler {
|
Line 2506 sub handler {
|
'vc' => 'Verify Content', |
'vc' => 'Verify Content', |
'cv' => 'Check/Set Resource Versions', |
'cv' => 'Check/Set Resource Versions', |
'ls' => 'List Symbs', |
'ls' => 'List Symbs', |
|
'sl' => 'Show Log' |
); |
); |
|
|
my $folderpath=$env{'form.folderpath'}; |
my $folderpath=$env{'form.folderpath'}; |
Line 2403 $dumpbut
|
Line 2543 $dumpbut
|
$exportbut |
$exportbut |
</td><td bgcolor="#DDDDCC"> |
</td><td bgcolor="#DDDDCC"> |
<input type="submit" name="listsymbs" value="$lt{'ls'}" /> |
<input type="submit" name="listsymbs" value="$lt{'ls'}" /> |
|
</td><td bgcolor="#DDDDCC"> |
|
<input type="submit" name="docslog" value="$lt{'sl'}" /> |
</td></tr></table> |
</td></tr></table> |
</form> |
</form> |
ENDCOURSEVERIFY |
ENDCOURSEVERIFY |