version 1.256, 2006/11/22 14:07:13
|
version 1.271, 2007/01/29 21:18:53
|
Line 42 use HTML::Entities;
|
Line 42 use HTML::Entities;
|
use GDBM_File; |
use GDBM_File; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Cwd; |
use Cwd; |
use LONCAPA; |
use LONCAPA qw(:DEFAULT :match); |
|
|
my $iconpath; |
my $iconpath; |
|
|
Line 99 sub authorhosts {
|
Line 99 sub authorhosts {
|
$ca=$env{'user.name'}; |
$ca=$env{'user.name'}; |
$cd=$env{'user.domain'}; |
$cd=$env{'user.domain'}; |
} else { |
} else { |
($cd,$ca)=($realm=~/^\/(\w+)\/(\w+)$/); |
($cd,$ca)=($realm=~/^\/($match_domain)\/($match_username)$/); |
} |
} |
my $allowed=0; |
my $allowed=0; |
my $myhome=&Apache::lonnet::homeserver($ca,$cd); |
my $myhome=&Apache::lonnet::homeserver($ca,$cd); |
Line 147 sub dumpcourse {
|
Line 147 sub dumpcourse {
|
my $type = &Apache::loncommon::course_type(); |
my $type = &Apache::loncommon::course_type(); |
$r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space'). |
$r->print(&Apache::loncommon::start_page('Dump '.$type.' DOCS to Construction Space'). |
'<form name="dumpdoc" method="post">'); |
'<form name="dumpdoc" method="post">'); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Dump '.$type.' DOCS to Construction Space')); |
my ($home,$other,%outhash)=&authorhosts(); |
my ($home,$other,%outhash)=&authorhosts(); |
unless ($home) { return ''; } |
unless ($home) { return ''; } |
my $origcrsid=$env{'request.course.id'}; |
my $origcrsid=$env{'request.course.id'}; |
Line 234 sub dumpcourse {
|
Line 235 sub dumpcourse {
|
my ($ext)=($_=~/\.(\w+)$/); |
my ($ext)=($_=~/\.(\w+)$/); |
my $title=$hash{'title_'.$hash{ |
my $title=$hash{'title_'.$hash{ |
'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$_}}; |
'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$_}}; |
$title=~s/:/:/g; |
|
$r->print('<td>'.($title?$title:' ').'</td>'); |
$r->print('<td>'.($title?$title:' ').'</td>'); |
if (!$title) { |
if (!$title) { |
$title=$_; |
$title=$_; |
Line 315 sub exportcourse {
|
Line 315 sub exportcourse {
|
} |
} |
} |
} |
$r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package')); |
$r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package')); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package')); |
$r->print($outcome); |
$r->print($outcome); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} else { |
} else { |
Line 364 sub exportcourse {
|
Line 365 sub exportcourse {
|
if (ref($curRes)) { |
if (ref($curRes)) { |
my $symb = $curRes->symb(); |
my $symb = $curRes->symb(); |
my $ressymb = $symb; |
my $ressymb = $symb; |
if ($ressymb =~ m|adm/(\w+)/(\w+)/(\d+)/bulletinboard$|) { |
if ($ressymb =~ m|adm/($match_domain)/($match_username)/(\d+)/bulletinboard$|) { |
unless ($ressymb =~ m|adm/wrapper/adm|) { |
unless ($ressymb =~ m|adm/wrapper/adm|) { |
$ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard'; |
$ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard'; |
} |
} |
Line 456 function containerCheck(item) {
|
Line 457 function containerCheck(item) {
|
|; |
|; |
$r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package', |
$r->print(&Apache::loncommon::start_page('Export '.lc($type).' to IMS content package', |
$scripttag)); |
$scripttag)); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Export '.lc($type).' to IMS content package')); |
$r->print($display.'</table>'. |
$r->print($display.'</table>'. |
'<p><input type="hidden" name="finishexport" value="1">'. |
'<p><input type="hidden" name="finishexport" value="1">'. |
'<input type="submit" name="exportcourse" value="'. |
'<input type="submit" name="exportcourse" value="'. |
Line 610 sub build_package {
|
Line 612 sub build_package {
|
if (grep/^$count$/,@$discussions) { |
if (grep/^$count$/,@$discussions) { |
my $ressymb = $symb; |
my $ressymb = $symb; |
my $mode; |
my $mode; |
if ($ressymb =~ m|adm/(\w+)/(\w+)/(\d+)/bulletinboard$|) { |
if ($ressymb =~ m|adm/($match_domain)/($match_username)/(\d+)/bulletinboard$|) { |
unless ($ressymb =~ m|adm/wrapper/adm|) { |
unless ($ressymb =~ m|adm/wrapper/adm|) { |
$ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard'; |
$ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard'; |
} |
} |
Line 695 sub process_content {
|
Line 697 sub process_content {
|
} |
} |
} elsif ($symb =~ m-lib/templates/examupload\.problem$-) { |
} elsif ($symb =~ m-lib/templates/examupload\.problem$-) { |
$content_type = 'examupload'; |
$content_type = 'examupload'; |
} elsif ($symb =~ m-adm/(\w+)/(\w+)/(\d+)/bulletinboard$-) { |
} elsif ($symb =~ m-adm/($match_domain)/($match_username)/(\d+)/bulletinboard$-) { |
$content_type = 'bulletinboard'; |
$content_type = 'bulletinboard'; |
my $contents = &Apache::imsexport::templatedpage($content_type,$3,$count,\@uploads,$1,$2); |
my $contents = &Apache::imsexport::templatedpage($content_type,$3,$count,\@uploads,$1,$2); |
if ($contents) { |
if ($contents) { |
Line 910 sub group_import {
|
Line 912 sub group_import {
|
while (@_) { |
while (@_) { |
my $name = shift; |
my $name = shift; |
my $url = shift; |
my $url = shift; |
if (($url =~ m#^/uploaded/$coursedom/$coursenum/(default_\d+\.)(page|sequence)$#) && ($caller eq 'londocs')) { |
if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$}) && ($caller eq 'londocs')) { |
my $errtext = ''; |
my $errtext = ''; |
my $fatal = 0; |
my $fatal = 0; |
my $newmapstr = '<map>'."\n". |
my $newmapstr = '<map>'."\n". |
Line 933 sub group_import {
|
Line 935 sub group_import {
|
my $idx = &LONCAPA::map::getresidx($url); |
my $idx = &LONCAPA::map::getresidx($url); |
$LONCAPA::map::order[$#LONCAPA::map::order+1]=$idx; |
$LONCAPA::map::order[$#LONCAPA::map::order+1]=$idx; |
my $ext = 'false'; |
my $ext = 'false'; |
if ($url=~/^http:\/\//) { $ext = 'true'; } |
if ($url=~m{^http://} || $url=~m{^https://}) { $ext = 'true'; } |
$url =~ s/:/\:/g; |
$url =~ &LONCAPA::map::qtunescape($url); |
$name =~ s/:/\:/g; |
$name =~ &LONCAPA::map::qtunescape($name); |
$LONCAPA::map::resources[$idx] = |
$LONCAPA::map::resources[$idx] = |
join ':', ($name, $url, $ext, 'normal', 'res'); |
join ':', ($name, $url, $ext, 'normal', 'res'); |
} |
} |
Line 985 sub breadcrumbs {
|
Line 987 sub breadcrumbs {
|
{'href'=>$url.$cpinfo, |
{'href'=>$url.$cpinfo, |
'title'=>$name, |
'title'=>$name, |
'text'=>'<font size="+1">'. |
'text'=>'<font size="+1">'. |
$name.'</font>' |
$name.'</font>', |
|
'no_mt'=>1, |
}); |
}); |
$plain.=$name.' > '; |
$plain.=$name.' > '; |
} |
} |
Line 1025 sub log_docs {
|
Line 1028 sub log_docs {
|
|
|
sub log_differences { |
sub log_differences { |
my ($plain)=@_; |
my ($plain)=@_; |
my %storehash=('folder' => $plain); |
my %storehash=('folder' => $plain, |
|
'currentfolder' => $env{'form.folder'}); |
if ($parmidx) { |
if ($parmidx) { |
$storehash{'parameter_res'}=$oldresources[$parmidx]; |
$storehash{'parameter_res'}=$oldresources[$parmidx]; |
foreach my $parm (keys %parmaction) { |
foreach my $parm (keys %parmaction) { |
Line 1060 sub log_docs {
|
Line 1064 sub log_docs {
|
# |
# |
sub docs_change_log { |
sub docs_change_log { |
my ($r)=@_; |
my ($r)=@_; |
|
my $folder=$env{'form.folder'}; |
$r->print(&Apache::loncommon::start_page('Course Document Change Log')); |
$r->print(&Apache::loncommon::start_page('Course Document Change Log')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Document Change Log')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Course Document Change Log')); |
|
|
my %docslog=&Apache::lonnet::dump('nohist_docslog', |
my %docslog=&Apache::lonnet::dump('nohist_docslog', |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
Line 1083 sub docs_change_log {
|
Line 1087 sub docs_change_log {
|
'randompick' => 'Randomly pick', |
'randompick' => 'Randomly pick', |
'set' => 'set to', |
'set' => 'set to', |
'del' => 'deleted'); |
'del' => 'deleted'); |
|
$r->print(&Apache::loncommon::display_filter(). |
my $countselect = |
'<input type="hidden" name="folder" value="'.$folder.'" />'. |
&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>'); |
'<input type="submit" value="'.&mt('Display').'" /></form>'); |
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). |
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). |
'<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Folder').'</th><th>'.&mt('Before').'</th><th>'. |
'<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Folder').'</th><th>'.&mt('Before').'</th><th>'. |
Line 1096 sub docs_change_log {
|
Line 1096 sub docs_change_log {
|
&Apache::loncommon::end_data_table_header_row()); |
&Apache::loncommon::end_data_table_header_row()); |
my $shown=0; |
my $shown=0; |
foreach my $id (sort { $docslog{$b}{'exe_time'}<=>$docslog{$a}{'exe_time'} } (keys(%docslog))) { |
foreach my $id (sort { $docslog{$b}{'exe_time'}<=>$docslog{$a}{'exe_time'} } (keys(%docslog))) { |
|
if ($env{'form.displayfilter'} eq 'currentfolder') { |
|
if ($docslog{$id}{'logentry'}{'currentfolder'} ne $folder) { next; } |
|
} |
my @changes=keys(%{$docslog{$id}{'logentry'}}); |
my @changes=keys(%{$docslog{$id}{'logentry'}}); |
|
if ($env{'form.displayfilter'} eq 'containing') { |
|
my $wholeentry=$docslog{$id}{'exe_uname'}.':'.$docslog{$id}{'exe_udom'}.':'. |
|
&Apache::loncommon::plainname($docslog{$id}{'exe_uname'},$docslog{$id}{'exe_udom'}); |
|
foreach my $key (@changes) { |
|
$wholeentry.=':'.$docslog{$id}{'logentry'}{$key}; |
|
} |
|
if ($wholeentry!~/\Q$env{'form.containingphrase'}\E/i) { next; } |
|
} |
my $count = 0; |
my $count = 0; |
my $time = |
my $time = |
&Apache::lonlocal::locallocaltime($docslog{$id}{'exe_time'}); |
&Apache::lonlocal::locallocaltime($docslog{$id}{'exe_time'}); |
Line 1212 sub editor {
|
Line 1223 sub editor {
|
if ($env{'form.changeparms'}) { |
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.changeparms'} eq 'randompick') { |
&LONCAPA::map::storeparameter($idx,'parameter_randompick',$env{'form.randpick_'.$idx},'int_pos'); |
if ($env{'form.randpick_'.$idx}) { |
&remember_parms($idx,'randompick','set',$env{'form.randpick_'.$idx}); |
&LONCAPA::map::storeparameter($idx,'parameter_randompick',$env{'form.randpick_'.$idx},'int_pos'); |
} else { |
&remember_parms($idx,'randompick','set',$env{'form.randpick_'.$idx}); |
&LONCAPA::map::delparameter($idx,'parameter_randompick'); |
} else { |
&remember_parms($idx,'randompick','del'); |
&LONCAPA::map::delparameter($idx,'parameter_randompick'); |
|
&remember_parms($idx,'randompick','del'); |
|
} |
|
} |
|
if ($env{'form.changeparms'} eq 'hiddenresource') { |
|
if ($env{'form.hidprs_'.$idx}) { |
|
&LONCAPA::map::storeparameter($idx,'parameter_hiddenresource','yes','string_yesno'); |
|
&remember_parms($idx,'hiddenresource','set',$env{'form.hidprs_'.$idx}); |
|
} else { |
|
&LONCAPA::map::delparameter($idx,'parameter_hiddenresource'); |
|
&remember_parms($idx,'hiddenresource','del'); |
|
} |
|
} |
|
if ($env{'form.changeparms'} eq 'encrypturl') { |
|
if ($env{'form.encprs_'.$idx}) { |
|
&LONCAPA::map::storeparameter($idx,'parameter_encrypturl','yes','string_yesno'); |
|
&remember_parms($idx,'encrypturl','set',$env{'form.encprs_'.$idx}); |
|
} else { |
|
&LONCAPA::map::delparameter($idx,'parameter_encrypturl'); |
|
&remember_parms($idx,'encrypturl','del'); |
|
} |
} |
} |
if ($env{'form.hidprs_'.$idx}) { |
|
&LONCAPA::map::storeparameter($idx,'parameter_hiddenresource','yes','string_yesno'); |
|
&remember_parms($idx,'hiddenresource','set',$env{'form.hidprs_'.$idx}); |
|
} else { |
|
&LONCAPA::map::delparameter($idx,'parameter_hiddenresource'); |
|
&remember_parms($idx,'hiddenresource','del'); |
|
} |
|
if ($env{'form.encprs_'.$idx}) { |
|
&LONCAPA::map::storeparameter($idx,'parameter_encrypturl','yes','string_yesno'); |
|
&remember_parms($idx,'encrypturl','set',$env{'form.encprs_'.$idx}); |
|
} else { |
|
&LONCAPA::map::delparameter($idx,'parameter_encrypturl'); |
|
&remember_parms($idx,'encrypturl','del'); |
|
} |
|
# 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) { |
Line 1292 sub editor {
|
Line 1309 sub editor {
|
$url=~/^(.+)\.(\w+)$/; |
$url=~/^(.+)\.(\w+)$/; |
my $newurl=$1.$newid.'.'.$2; |
my $newurl=$1.$newid.'.'.$2; |
my $storefn=$newurl; |
my $storefn=$newurl; |
$storefn=~s/^\/\w+\/\w+\/\w+\///; |
$storefn=~s{^/\w+/$match_domain/$match_username/}{}; |
&Apache::lonclonecourse::writefile |
&Apache::lonclonecourse::writefile |
($env{'request.course.id'},$storefn, |
($env{'request.course.id'},$storefn, |
&Apache::lonnet::getfile($url)); |
&Apache::lonnet::getfile($url)); |
$url=$newurl; |
$url=$newurl; |
} |
} |
$title=~s/\</\<\;/g; |
$title = &LONCAPA::map::qtunescape($title); |
$title=~s/\>/\>\;/g; |
|
$title=~s/\:/\:/g; |
|
my $ext='false'; |
my $ext='false'; |
if ($url=~/^http\:\/\//) { $ext='true'; } |
if ($url=~/^http\:\/\//) { $ext='true'; } |
$url=~s/\:/\:/g; |
$url = &LONCAPA::map::qtunescape($url); |
# Now insert the URL at the bottom |
# Now insert the URL at the bottom |
my $newidx=&LONCAPA::map::getresidx($url); |
my $newidx=&LONCAPA::map::getresidx($url); |
$LONCAPA::map::resources[$newidx]= |
$LONCAPA::map::resources[$newidx]= |
Line 1355 sub editor {
|
Line 1370 sub editor {
|
my $ratstr = $LONCAPA::map::resources[$LONCAPA::map::order[$idx]]; |
my $ratstr = $LONCAPA::map::resources[$LONCAPA::map::order[$idx]]; |
my ($rtitle,@rrest)=split(/\:/, |
my ($rtitle,@rrest)=split(/\:/, |
$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]); |
$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]); |
my $comment= |
my $comment=$env{'form.title'}; |
&HTML::Entities::decode($env{'form.title'}); |
$comment = &LONCAPA::map::qtunescape($comment); |
$comment=~s/\</\<\;/g; |
|
$comment=~s/\>/\>\;/g; |
|
$comment=~s/\:/\:/g; |
|
if ($comment=~/\S/) { |
if ($comment=~/\S/) { |
$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]= |
$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]= |
$comment.':'.join(':',@rrest); |
$comment.':'.join(':',@rrest); |
} |
} |
# Devalidate title cache |
# Devalidate title cache |
my $renamed_url=$rrest[0]; |
my $renamed_url=&LONCAPA::map::qtescape($rrest[0]); |
# Has the :-escaping |
|
$renamed_url=~s/\&colon\;/\:/g; |
|
&Apache::lonnet::devalidate_title_cache($renamed_url); |
&Apache::lonnet::devalidate_title_cache($renamed_url); |
} |
} |
# Store the changed version |
# Store the changed version |
Line 1521 sub process_file_upload {
|
Line 1531 sub process_file_upload {
|
$codebase); |
$codebase); |
my $ext='false'; |
my $ext='false'; |
if ($url=~/^http\:\/\//) { $ext='true'; } |
if ($url=~/^http\:\/\//) { $ext='true'; } |
$url=~s/\:/\:/g; |
$url = &LONCAPA::map::qtunescape($url); |
my $comment=$env{'form.comment'}; |
my $comment=$env{'form.comment'}; |
$comment=~s/\</\<\;/g; |
$comment = &LONCAPA::map::qtunescape($comment); |
$comment=~s/\>/\>\;/g; |
|
$comment=~s/\:/\:/g; |
|
if ($folder=~/^supplemental/) { |
if ($folder=~/^supplemental/) { |
$comment=time.'___&&&___'.$env{'user.name'}.'___&&&___'. |
$comment=time.'___&&&___'.$env{'user.name'}.'___&&&___'. |
$env{'user.domain'}.'___&&&___'.$comment; |
$env{'user.domain'}.'___&&&___'.$comment; |
Line 1544 sub process_file_upload {
|
Line 1552 sub process_file_upload {
|
my $total_embedded = keys(%{$allfiles}); |
my $total_embedded = keys(%{$allfiles}); |
if ($total_embedded > 0) { |
if ($total_embedded > 0) { |
my $num = 0; |
my $num = 0; |
$$upload_output .= 'This file contains embedded multimedia objects, which need to be uploaded to LON-CAPA.<br /> |
my $state = ' |
<form name="upload_embedded" action="/adm/coursedocs" |
<input type="hidden" name="folderpath" value="'.$env{'form.folderpath'}.'" /> |
method="post" enctype="multipart/form-data"> |
<input type="hidden" name="cmd" value="upload_embedded" /> |
<input type="hidden" name="folderpath" value="'.$env{'form.folderpath'}.'" /> <input type="hidden" name="cmd" value="upload_embedded" /> |
|
<input type="hidden" name="newidx" value="'.$newidx.'" /> |
<input type="hidden" name="newidx" value="'.$newidx.'" /> |
<input type="hidden" name="primaryurl" value="'.&escape($url).'" /> |
<input type="hidden" name="primaryurl" value="'.&escape($url).'" /> |
<input type="hidden" name="phasetwo" value="'.$total_embedded.'" />'; |
<input type="hidden" name="phasetwo" value="'.$total_embedded.'" />'; |
$$upload_output .= '<b>Upload embedded files</b>:<br /> |
$phase_status = 'phasetwo'; |
<table>'; |
|
foreach my $embed_file (keys(%{$allfiles})) { |
$$upload_output .= |
$$upload_output .= '<tr><td>'.$embed_file. |
'This file contains embedded multimedia objects, which need to be uploaded to LON-CAPA.<br />'. |
'<input name="embedded_item_'.$num.'" type="file" /> |
&ask_for_embedded_content('/adm/coursedocs', |
<input name="embedded_orig_'.$num.'" type="hidden" value="'.&escape($embed_file).'" />'; |
$state,$allfiles,$codebase); |
my $attrib; |
|
if (@{$$allfiles{$embed_file}} > 1) { |
|
$attrib = join(':',@{$$allfiles{$embed_file}}); |
|
} else { |
|
$attrib = $$allfiles{$embed_file}[0]; |
|
} |
|
$$upload_output .= |
|
'<input name="embedded_attrib_'.$num.'" type="hidden" value="'.$attrib.'" />'; |
|
if (exists($$codebase{$embed_file})) { |
|
$$upload_output .= |
|
'<input name="codebase_'.$num.'" type="hidden" value="'.&escape($$codebase{$embed_file}).'" />'; |
|
} |
|
$$upload_output .= '</td></tr>'; |
|
$num ++; |
|
} |
|
$phase_status = 'phasetwo'; |
|
$$upload_output .= '</table><br /> |
|
<input type ="submit" value="Complete upload" /> |
|
</form>'; |
|
} else { |
} else { |
$$upload_output .= 'No embedded items identified<br />'; |
$$upload_output .= 'No embedded items identified<br />'; |
} |
} |
Line 1585 sub process_file_upload {
|
Line 1573 sub process_file_upload {
|
return $phase_status; |
return $phase_status; |
} |
} |
|
|
|
sub ask_for_embedded_content { |
|
my ($actionurl,$state,$allfiles,$codebase,$args)=@_; |
|
my $upload_output = ' |
|
<form name="upload_embedded" action="'.$actionurl.'" |
|
method="post" enctype="multipart/form-data">'; |
|
$upload_output .= $state; |
|
$upload_output .= '<b>Upload embedded files</b>:<br />'. |
|
&Apache::loncommon::start_data_table(); |
|
|
|
my $num = 0; |
|
foreach my $embed_file (keys(%{$allfiles})) { |
|
$upload_output .= &Apache::loncommon::start_data_table_row(). |
|
'<td>'.$embed_file.'</td><td>'; |
|
if ($args->{'error_on_invalid_names'} |
|
&& $embed_file ne &Apache::lonnet::clean_filename($embed_file,{'keep_path' => 1,})) { |
|
|
|
$upload_output.='<span class="LC_warning">'.&mt("Invalid characters").'</span>'; |
|
} else { |
|
$upload_output .=' |
|
<input name="embedded_item_'.$num.'" type="file" value="bob" /> |
|
<input name="embedded_orig_'.$num.'" type="hidden" value="'.&escape($embed_file).'" />'; |
|
my $attrib = join(':',@{$$allfiles{$embed_file}}); |
|
$upload_output .= |
|
"\n\t\t". |
|
'<input name="embedded_attrib_'.$num.'" type="hidden" value="'. |
|
$attrib.'" />'; |
|
if (exists($$codebase{$embed_file})) { |
|
$upload_output .= |
|
"\n\t\t". |
|
'<input name="codebase_'.$num.'" type="hidden" value="'. |
|
&escape($$codebase{$embed_file}).'" />'; |
|
} |
|
} |
|
$upload_output .= '</td>'.&Apache::loncommon::end_data_table_row(); |
|
$num++; |
|
} |
|
$upload_output .= &Apache::loncommon::end_data_table().'<br /> |
|
<input type ="hidden" name="number_embedded_items" value="'.$num.'" /> |
|
<input type ="submit" value="Complete upload" /> |
|
</form>'; |
|
return $upload_output; |
|
} |
|
|
sub process_secondary_uploads { |
sub process_secondary_uploads { |
my ($upload_output,$coursedom,$coursenum,$formname,$num,$newidx) = @_; |
my ($upload_output,$coursedom,$coursenum,$formname,$num,$newidx) = @_; |
my $folder=$env{'form.folder'}; |
my $folder=$env{'form.folder'}; |
Line 1600 sub process_secondary_uploads {
|
Line 1631 sub process_secondary_uploads {
|
$destination .= $newidx; |
$destination .= $newidx; |
my ($url,$filename); |
my ($url,$filename); |
$url=&Apache::lonnet::userfileupload($formname.$num,1,$destination); |
$url=&Apache::lonnet::userfileupload($formname.$num,1,$destination); |
($filename) = ($url =~ m-^/uploaded/$coursedom/$coursenum/$destination/(.+)$-); |
($filename) = ($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/\Q$destination\E/(.+)$}); |
return $filename; |
return $filename; |
} |
} |
|
|
Line 1608 sub process_secondary_uploads {
|
Line 1639 sub process_secondary_uploads {
|
|
|
sub entryline { |
sub entryline { |
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_; |
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_; |
$title=~s/\&colon\;/\:/g; |
$title=&HTML::Entities::encode($title,'"<>&\''); |
$title=&HTML::Entities::encode(&HTML::Entities::decode( |
|
&unescape($title)),'"<>&\''); |
|
my $renametitle=$title; |
my $renametitle=$title; |
my $foldertitle=$title; |
my $foldertitle=$title; |
my $pagetitle=$title; |
my $pagetitle=$title; |
my $orderidx=$LONCAPA::map::order[$index]; |
my $orderidx=$LONCAPA::map::order[$index]; |
if ($title=~ /^(\d+)___&&&___(\w+)___&&&___(\w+)___&&&___(.*)$/ ) { |
if ($title=~ /^(\d+)___&&&___($match_username)___&&&___($match_domain)___&&&___(.*)$/ ) { |
$foldertitle=&Apache::lontexconvert::msgtexconverted($4); |
$foldertitle=&Apache::lontexconvert::msgtexconverted($4); |
$renametitle=$4; |
$renametitle=$4; |
$title='<i>'.&Apache::lonlocal::locallocaltime($1).'</i> '. |
$title='<i>'.&Apache::lonlocal::locallocaltime($1).'</i> '. |
Line 1677 sub entryline {
|
Line 1706 sub entryline {
|
'rn' => 'Rename', |
'rn' => 'Rename', |
'cp' => 'Copy'); |
'cp' => 'Copy'); |
my $nocopy=0; |
my $nocopy=0; |
|
my $nocut=0; |
if ($url=~/\.(page|sequence)$/) { |
if ($url=~/\.(page|sequence)$/) { |
foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$url))) { |
foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$url))) { |
my ($title,$url,$ext,$type)=split(/\:/,$_); |
my ($title,$url,$ext,$type)=split(/\:/,$_); |
Line 1686 sub entryline {
|
Line 1716 sub entryline {
|
} |
} |
} |
} |
} |
} |
|
if ($url=~/^\/res\/lib\/templates\//) { |
|
$nocopy=1; |
|
$nocut=1; |
|
} |
my $copylink=' '; |
my $copylink=' '; |
|
my $cutlink=' '; |
if ($env{'form.pagepath'}) { |
if ($env{'form.pagepath'}) { |
unless ($nocopy) { |
if (!$nocopy) { |
$copylink=(<<ENDCOPY); |
$copylink=(<<ENDCOPY); |
<a href='javascript:markcopy("$pagepath","$index","$renametitle","page","$pagesymb");'> |
<a href='javascript:markcopy("$pagepath","$index","$renametitle","page","$pagesymb");'> |
<font size="-2" color="#000099">$lt{'cp'}</font></a></td> |
<font size="-2" color="#000099">$lt{'cp'}</font></a></td> |
ENDCOPY |
ENDCOPY |
|
} |
|
if (!$nocut) { |
|
$cutlink=(<<ENDCUT); |
|
<a href='javascript:cutres("$pagepath","$index","$renametitle","page","$pagesymb");'> |
|
<font size="-2" color="#550044">$lt{'ct'}</font></a> |
|
ENDCUT |
} |
} |
$line.=(<<END); |
$line.=(<<END); |
<form name="entry_$index" action="/adm/coursedocs" method="post"> |
<form name="entry_$index" action="/adm/coursedocs" method="post"> |
Line 1714 ENDCOPY
|
Line 1755 ENDCOPY
|
</td><td bgcolor="#DDDDDD"> |
</td><td bgcolor="#DDDDDD"> |
<a href='javascript:removeres("$pagepath","$index","$renametitle","page","$pagesymb");'> |
<a href='javascript:removeres("$pagepath","$index","$renametitle","page","$pagesymb");'> |
<font size="-2" color="#990000">$lt{'rm'}</font></a> |
<font size="-2" color="#990000">$lt{'rm'}</font></a> |
<a href='javascript:cutres("$pagepath","$index","$renametitle","page","$pagesymb");'> |
$cutlink |
<font size="-2" color="#550044">$lt{'ct'}</font></a> |
|
<a href='javascript:changename("$pagepath","$index","$renametitle","page","$pagesymb");'> |
<a href='javascript:changename("$pagepath","$index","$renametitle","page","$pagesymb");'> |
<font size="-2" color="#009900">$lt{'rn'}</font></a> |
<font size="-2" color="#009900">$lt{'rn'}</font></a> |
$copylink |
$copylink |
END |
END |
} else { |
} else { |
unless ($nocopy) { |
if (!$nocopy) { |
$copylink=(<<ENDCOPY); |
$copylink=(<<ENDCOPY); |
<a href='javascript:markcopy("$folderpath","$index","$renametitle","sequence");'> |
<a href='javascript:markcopy("$folderpath","$index","$renametitle","sequence");'> |
<font size="-2" color="#000099">$lt{'cp'}</font></a></td> |
<font size="-2" color="#000099">$lt{'cp'}</font></a></td> |
ENDCOPY |
ENDCOPY |
} |
} |
|
if (!$nocut) { |
|
$cutlink=(<<ENDCUT); |
|
<a href='javascript:cutres("$folderpath","$index","$renametitle","sequence");'> |
|
<font size="-2" color="#550044">$lt{'ct'}</font></a> |
|
ENDCUT |
|
} |
$line.=(<<END); |
$line.=(<<END); |
<form name="entry_$index" action="/adm/coursedocs" method="post"> |
<form name="entry_$index" action="/adm/coursedocs" method="post"> |
<input type="hidden" name="folderpath" value="$env{'form.folderpath'}" /> |
<input type="hidden" name="folderpath" value="$env{'form.folderpath'}" /> |
Line 1746 ENDCOPY
|
Line 1792 ENDCOPY
|
</td><td bgcolor="#DDDDDD"> |
</td><td bgcolor="#DDDDDD"> |
<a href='javascript:removeres("$folderpath","$index","$renametitle","sequence");'> |
<a href='javascript:removeres("$folderpath","$index","$renametitle","sequence");'> |
<font size="-2" color="#990000">$lt{'rm'}</font></a> |
<font size="-2" color="#990000">$lt{'rm'}</font></a> |
<a href='javascript:cutres("$folderpath","$index","$renametitle","sequence");'> |
$cutlink |
<font size="-2" color="#550044">$lt{'ct'}</font></a> |
|
<a href='javascript:changename("$folderpath","$index","$renametitle","sequence");'> |
<a href='javascript:changename("$folderpath","$index","$renametitle","sequence");'> |
<font size="-2" color="#009900">$lt{'rn'}</font></a> |
<font size="-2" color="#009900">$lt{'rn'}</font></a> |
$copylink |
$copylink |
Line 1766 END
|
Line 1811 END
|
if ($uploaded) { |
if ($uploaded) { |
if ($extension eq 'sequence') { |
if ($extension eq 'sequence') { |
$icon=$iconpath.'/folder_closed.gif'; |
$icon=$iconpath.'/folder_closed.gif'; |
$url=~/$coursenum\/([\/\w]+)\.sequence$/; |
$url=~/\Q$coursenum\E\/([\/\w]+)\.sequence$/; |
$url='/adm/coursedocs?'; |
$url='/adm/coursedocs?'; |
$folderarg=$1; |
$folderarg=$1; |
$isfolder=1; |
$isfolder=1; |
} elsif ($extension eq 'page') { |
} elsif ($extension eq 'page') { |
$icon=$iconpath.'/page.gif'; |
$icon=$iconpath.'/page.gif'; |
$url=~/$coursenum\/([\/\w]+)\.page$/; |
$url=~/\Q$coursenum\E\/([\/\w]+)\.page$/; |
$pagearg=$1; |
$pagearg=$1; |
$url='/adm/coursedocs?'; |
$url='/adm/coursedocs?'; |
$ispage=1; |
$ispage=1; |
Line 1831 END
|
Line 1876 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.changeparms.value=1;this.form.submit()" name="randpick_'.$orderidx.'" value="'. |
'<input type="text" size="4" onChange="this.form.changeparms.value='."'randompick'".';this.form.submit()" name="randpick_'.$orderidx.'" value="'. |
(&LONCAPA::map::getparameter($orderidx, |
(&LONCAPA::map::getparameter($orderidx, |
'parameter_randompick'))[0]. |
'parameter_randompick'))[0]. |
'" />'. |
'" />'. |
Line 1870 END
|
Line 1915 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.changeparms.value=1;this.form.submit()" $hidtext /> $lt{'hd'}</label></nobr></td> |
<nobr><label><input type="checkbox" name="hidprs_$orderidx" onClick="this.form.changeparms.value='hiddenresource';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.changeparms.value=1;this.form.submit()" $enctext /> $lt{'ec'}</label></nobr></td> |
<nobr><label><input type="checkbox" name="encprs_$orderidx" onClick="this.form.changeparms.value='encrypturl';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 1986 sub list_symbs {
|
Line 2031 sub list_symbs {
|
my ($r) = @_; |
my ($r) = @_; |
|
|
$r->print(&Apache::loncommon::start_page('Symb List')); |
$r->print(&Apache::loncommon::start_page('Symb List')); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Symb List')); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
$r->print("<pre>\n"); |
$r->print("<pre>\n"); |
foreach my $res ($navmap->retrieveResources()) { |
foreach my $res ($navmap->retrieveResources()) { |
Line 2005 sub verifycontent {
|
Line 2051 sub verifycontent {
|
my $loaderror=&Apache::lonnet::overloaderror($r); |
my $loaderror=&Apache::lonnet::overloaderror($r); |
if ($loaderror) { return $loaderror; } |
if ($loaderror) { return $loaderror; } |
$r->print(&Apache::loncommon::start_page('Verify '.$type.' Documents')); |
$r->print(&Apache::loncommon::start_page('Verify '.$type.' Documents')); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$type.' Documents')); |
$hashtied=0; |
$hashtied=0; |
undef %alreadyseen; |
undef %alreadyseen; |
%alreadyseen=(); |
%alreadyseen=(); |
Line 2040 sub checkversions {
|
Line 2087 sub checkversions {
|
my ($r) = @_; |
my ($r) = @_; |
my $type = &Apache::loncommon::course_type(); |
my $type = &Apache::loncommon::course_type(); |
$r->print(&Apache::loncommon::start_page("Check $type Document Versions")); |
$r->print(&Apache::loncommon::start_page("Check $type Document Versions")); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $type Document Versions")); |
my $header=''; |
my $header=''; |
my $startsel=''; |
my $startsel=''; |
my $monthsel=''; |
my $monthsel=''; |
Line 2331 sub changewarning {
|
Line 2379 sub changewarning {
|
$help{'Caching'}.'</font></h3></form>'."\n\n"); |
$help{'Caching'}.'</font></h3></form>'."\n\n"); |
} |
} |
|
|
|
# =========================================== Breadcrumbs for special functions |
|
|
|
sub init_breadcrumbs { |
|
my ($form,$text)=@_; |
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs", |
|
text=>&Apache::loncommon::course_type()." Documents", |
|
faq=>273, |
|
bug=>'Instructor Interface', |
|
help => 'Docs_Adding_Course_Doc'}); |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/coursedocs?".$form.'=1', |
|
text=>$text, |
|
faq=>273, |
|
bug=>'Instructor Interface'}); |
|
} |
|
|
# ================================================================ Main Handler |
# ================================================================ Main Handler |
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
Line 2364 sub handler {
|
Line 2428 sub handler {
|
|
|
# does this user have privileges to modify docs |
# does this user have privileges to modify docs |
my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'}); |
my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'}); |
|
|
if ($allowed && $env{'form.verify'}) { |
if ($allowed && $env{'form.verify'}) { |
|
&init_breadcrumbs('verify','Verify Content'); |
&verifycontent($r); |
&verifycontent($r); |
} elsif ($allowed && $env{'form.listsymbs'}) { |
} elsif ($allowed && $env{'form.listsymbs'}) { |
|
&init_breadcrumbs('listsymbs','List Symbs'); |
&list_symbs($r); |
&list_symbs($r); |
} elsif ($allowed && $env{'form.docslog'}) { |
} elsif ($allowed && $env{'form.docslog'}) { |
|
&init_breadcrumbs('docslog','Show Log'); |
&docs_change_log($r); |
&docs_change_log($r); |
} elsif ($allowed && $env{'form.versions'}) { |
} elsif ($allowed && $env{'form.versions'}) { |
|
&init_breadcrumbs('versions','Check/Set Resource Versions'); |
&checkversions($r); |
&checkversions($r); |
} elsif ($allowed && $env{'form.dumpcourse'}) { |
} elsif ($allowed && $env{'form.dumpcourse'}) { |
|
&init_breadcrumbs('dumpcourse','Dump '.&Apache::loncommon::course_type().' DOCS to Construction Space'); |
&dumpcourse($r); |
&dumpcourse($r); |
} elsif ($allowed && $env{'form.exportcourse'}) { |
} elsif ($allowed && $env{'form.exportcourse'}) { |
|
&init_breadcrumbs('exportcourse','Export '.&Apache::loncommon::course_type().' to IMS'); |
&exportcourse($r); |
&exportcourse($r); |
} else { |
} else { |
# is this a standard course? |
# is this a standard course? |
Line 2449 sub handler {
|
Line 2518 sub handler {
|
my %codebase = (); |
my %codebase = (); |
my ($upload_result,$upload_output); |
my ($upload_result,$upload_output); |
if ($allowed) { |
if ($allowed) { |
if (($env{'form.uploaddoc.filename'}) && ($env{'form.cmd'}=~/^upload_(\w+)/)) { |
if (($env{'form.uploaddoc.filename'}) && |
|
($env{'form.cmd'}=~/^upload_(\w+)/)) { |
# Process file upload - phase one - upload and parse primary file. |
# Process file upload - phase one - upload and parse primary file. |
$upload_result = &process_file_upload(\$upload_output,$coursenum, |
$upload_result = &process_file_upload(\$upload_output,$coursenum, |
$coursedom,\%allfiles, |
$coursedom,\%allfiles, |
Line 2608 $exportbut
|
Line 2678 $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"> |
</td><td bgcolor="#DDDDCC"> |
|
<input type="hidden" name="folder" value="$env{'form.folder'}" /> |
<input type="submit" name="docslog" value="$lt{'sl'}" /> |
<input type="submit" name="docslog" value="$lt{'sl'}" /> |
</td></tr></table> |
</td></tr></table> |
</form> |
</form> |