version 1.244, 2006/08/11 22:00:07
|
version 1.280, 2007/06/29 21:08:07
|
Line 33 use Apache::Constants qw(:common :http);
|
Line 33 use Apache::Constants qw(:common :http);
|
use Apache::imsexport; |
use Apache::imsexport; |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::loncommon; |
use Apache::loncommon; |
use Apache::lonratedt; |
use LONCAPA::map(); |
use Apache::lonratsrv; |
use Apache::lonratedt(); |
use Apache::lonxml; |
use Apache::lonxml; |
use Apache::lonclonecourse; |
use Apache::lonclonecourse; |
use Apache::lonnavmaps; |
use Apache::lonnavmaps; |
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 57 my $hadchanges;
|
Line 57 my $hadchanges;
|
|
|
my %help=(); |
my %help=(); |
|
|
# Mapread read maps into lonratedt::global arrays |
# Mapread read maps into LONCAPA::map:: global arrays |
# @order and @resources, determines status |
# @order and @resources, determines status |
# sets @order - pointer to resources in right order |
# sets @order - pointer to resources in right order |
# sets @resources - array with the resources with correct idx |
# sets @resources - array with the resources with correct idx |
Line 66 my %help=();
|
Line 66 my %help=();
|
sub mapread { |
sub mapread { |
my ($coursenum,$coursedom,$map)=@_; |
my ($coursenum,$coursedom,$map)=@_; |
return |
return |
&Apache::lonratedt::mapread('/uploaded/'.$coursedom.'/'.$coursenum.'/'. |
&LONCAPA::map::mapread('/uploaded/'.$coursedom.'/'.$coursenum.'/'. |
$map); |
$map); |
} |
} |
|
|
sub storemap { |
sub storemap { |
my ($coursenum,$coursedom,$map)=@_; |
my ($coursenum,$coursedom,$map)=@_; |
my ($outtext,$errtext)= |
my ($outtext,$errtext)= |
&Apache::lonratedt::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'. |
&LONCAPA::map::storemap('/uploaded/'.$coursedom.'/'.$coursenum.'/'. |
$map,1); |
$map,1); |
if ($errtext) { return ($errtext,2); } |
if ($errtext) { return ($errtext,2); } |
|
|
$hadchanges=1; |
$hadchanges=1; |
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 902 sub store_template {
|
Line 904 sub store_template {
|
# Imports the given (name, url) resources into the course |
# Imports the given (name, url) resources into the course |
# coursenum, coursedom, and folder must precede the list |
# coursenum, coursedom, and folder must precede the list |
sub group_import { |
sub group_import { |
my $coursenum = shift; |
my ($coursenum, $coursedom, $folder, $container, $caller, @files) = @_; |
my $coursedom = shift; |
|
my $folder = shift; |
while (@files) { |
my $container = shift; |
my $name = shift(@files); |
my $caller = shift; |
my $url = shift(@files); |
while (@_) { |
#FIXME check if file exists before overwriting, might be restoring it |
my $name = shift; |
if (($url =~ m{^/uploaded/\Q$coursedom\E/\Q$coursenum\E/(default_\d+\.)(page|sequence)$}) |
my $url = shift; |
&& ($caller eq 'londocs') |
if (($url =~ m#^/uploaded/$coursedom/$coursenum/(default_\d+\.)(page|sequence)$#) && ($caller eq 'londocs')) { |
&& (!&Apache::lonnet::stat_file($url))) { |
|
|
my $errtext = ''; |
my $errtext = ''; |
my $fatal = 0; |
my $fatal = 0; |
my $newmapstr = '<map>'."\n". |
my $newmapstr = '<map>'."\n". |
Line 930 sub group_import {
|
Line 933 sub group_import {
|
} |
} |
} |
} |
if ($url) { |
if ($url) { |
my $idx = &Apache::lonratedt::getresidx($url); |
my $idx = &LONCAPA::map::getresidx($url); |
$Apache::lonratedt::order[$#Apache::lonratedt::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); |
$Apache::lonratedt::resources[$idx] = |
$LONCAPA::map::resources[$idx] = |
join ':', ($name, $url, $ext, 'normal', 'res'); |
join ':', ($name, $url, $ext, 'normal', 'res'); |
} |
} |
} |
} |
Line 954 sub breadcrumbs {
|
Line 957 sub breadcrumbs {
|
} |
} |
my $folderpath; |
my $folderpath; |
my $cpinfo=''; |
my $cpinfo=''; |
|
my $plain=''; |
if ($env{'form.markedcopy_url'}) { |
if ($env{'form.markedcopy_url'}) { |
$cpinfo='&markedcopy_url='. |
$cpinfo='&markedcopy_url='. |
&escape($env{'form.markedcopy_url'}). |
&escape($env{'form.markedcopy_url'}). |
Line 984 sub breadcrumbs {
|
Line 988 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=~s/\>\;\s*$//; |
return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp', |
return (&Apache::lonhtmlcommon::breadcrumbs(undef,undef,0,'nohelp', |
'LC_docs_path'),$randompick,$ishidden,$isencrypted); |
'LC_docs_path'),$randompick,$ishidden,$isencrypted,$plain); |
|
} |
|
|
|
sub log_docs { |
|
return &Apache::lonnet::instructor_log('docslog',@_); |
|
} |
|
|
|
{ |
|
my @oldresources=(); |
|
my @oldorder=(); |
|
my $parmidx; |
|
my %parmaction=(); |
|
my %parmvalue=(); |
|
my $changedflag; |
|
|
|
sub snapshotbefore { |
|
@oldresources=@LONCAPA::map::resources; |
|
@oldorder=@LONCAPA::map::order; |
|
$parmidx=undef; |
|
%parmaction=(); |
|
%parmvalue=(); |
|
$changedflag=0; |
|
} |
|
|
|
sub remember_parms { |
|
my ($idx,$parameter,$action,$value)=@_; |
|
$parmidx=$idx; |
|
$parmaction{$parameter}=$action; |
|
$parmvalue{$parameter}=$value; |
|
$changedflag=1; |
|
} |
|
|
|
sub log_differences { |
|
my ($plain)=@_; |
|
my %storehash=('folder' => $plain, |
|
'currentfolder' => $env{'form.folder'}); |
|
if ($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 ($#LONCAPA::map::resources>$#oldresources) { |
|
$maxidx=$#LONCAPA::map::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]; |
|
$changedflag=1; |
|
} |
|
if ($LONCAPA::map::order[$idx] ne $oldorder[$idx]) { |
|
$storehash{'before_order_res_'.$idx}=$oldresources[$oldorder[$idx]]; |
|
$storehash{'after_order_res_'.$idx}=$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]; |
|
$changedflag=1; |
|
} |
|
} |
|
$storehash{'maxidx'}=$maxidx; |
|
if ($changedflag) { &log_docs(\%storehash); } |
|
} |
|
} |
|
|
|
|
|
# |
|
# Docs Change Log |
|
# |
|
sub docs_change_log { |
|
my ($r)=@_; |
|
my $folder=$env{'form.folder'}; |
|
$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 %lt=('hiddenresource' => 'Resources hidden', |
|
'encrypturl' => 'URL hidden', |
|
'randompick' => 'Randomly pick', |
|
'set' => 'set to', |
|
'del' => 'deleted'); |
|
$r->print(&Apache::loncommon::display_filter(). |
|
'<input type="hidden" name="folder" value="'.$folder.'" />'. |
|
'<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('Folder').'</th><th>'.&mt('Before').'</th><th>'. |
|
&mt('After').'</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))) { |
|
if ($env{'form.displayfilter'} eq 'currentfolder') { |
|
if ($docslog{$id}{'logentry'}{'currentfolder'} ne $folder) { next; } |
|
} |
|
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 $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><td>'. |
|
$docslog{$id}{'logentry'}{'folder'}.'</td><td>'); |
|
# Before |
|
for (my $idx=0;$idx<=$docslog{$id}{'logentry'}{'maxidx'};$idx++) { |
|
my $oldname=(split(/\:/,$docslog{$id}{'logentry'}{'before_resources_'.$idx}))[0]; |
|
my $newname=(split(/\:/,$docslog{$id}{'logentry'}{'after_resources_'.$idx}))[0]; |
|
if ($oldname ne $newname) { |
|
$r->print(&LONCAPA::map::qtescape($oldname)); |
|
} |
|
} |
|
$r->print('<ul>'); |
|
for (my $idx=0;$idx<=$docslog{$id}{'logentry'}{'maxidx'};$idx++) { |
|
if ($docslog{$id}{'logentry'}{'before_order_res_'.$idx}) { |
|
$r->print('<li>'.&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'before_order_res_'.$idx}))[0]).'</li>'); |
|
} |
|
} |
|
$r->print('</ul>'); |
|
# After |
|
$r->print('</td><td>'); |
|
|
|
for (my $idx=0;$idx<=$docslog{$id}{'logentry'}{'maxidx'};$idx++) { |
|
my $oldname=(split(/\:/,$docslog{$id}{'logentry'}{'before_resources_'.$idx}))[0]; |
|
my $newname=(split(/\:/,$docslog{$id}{'logentry'}{'after_resources_'.$idx}))[0]; |
|
if ($oldname ne '' && $oldname ne $newname) { |
|
$r->print(&LONCAPA::map::qtescape($newname)); |
|
} |
|
} |
|
$r->print('<ul>'); |
|
for (my $idx=0;$idx<=$docslog{$id}{'logentry'}{'maxidx'};$idx++) { |
|
if ($docslog{$id}{'logentry'}{'after_order_res_'.$idx}) { |
|
$r->print('<li>'.&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'after_order_res_'.$idx}))[0]).'</li>'); |
|
} |
|
} |
|
$r->print('</ul>'); |
|
if ($docslog{$id}{'logentry'}{'parameter_res'}) { |
|
$r->print(&LONCAPA::map::qtescape((split(/\:/,$docslog{$id}{'logentry'}{'parameter_res'}))[0]).':<ul>'); |
|
foreach my $parameter ('randompick','hiddenresource','encrypturl') { |
|
if ($docslog{$id}{'logentry'}{'parameter_action_'.$parameter}) { |
|
$r->print('<li>'. |
|
&mt($lt{$parameter}.' '.$lt{$docslog{$id}{'logentry'}{'parameter_action_'.$parameter}}.' [_1]', |
|
$docslog{$id}{'logentry'}{'parameter_value_'.$parameter}) |
|
.'</li>'); |
|
} |
|
} |
|
$r->print('</ul>'); |
|
} |
|
# End |
|
$r->print('</td>'.&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()); |
} |
} |
|
|
sub editor { |
sub editor { |
Line 1001 sub editor {
|
Line 1197 sub editor {
|
} |
} |
($errtext,$fatal)= |
($errtext,$fatal)= |
&mapread($coursenum,$coursedom,$folder.'.'.$container); |
&mapread($coursenum,$coursedom,$folder.'.'.$container); |
if ($#Apache::lonratedt::order<1) { |
if ($#LONCAPA::map::order<1) { |
my $idx=&Apache::lonratedt::getresidx(); |
my $idx=&LONCAPA::map::getresidx(); |
if ($idx<=0) { $idx=1; } |
if ($idx<=0) { $idx=1; } |
$Apache::lonratedt::order[0]=$idx; |
$LONCAPA::map::order[0]=$idx; |
$Apache::lonratedt::resources[$idx]=''; |
$LONCAPA::map::resources[$idx]=''; |
} |
} |
if (defined($env{'form.markcopy'})) { |
if (defined($env{'form.markcopy'})) { |
# Mark for copying |
# Mark for copying |
my ($title,$url)=split(':',$Apache::lonratedt::resources[$Apache::lonratedt::order[$env{'form.markcopy'}]]); |
my ($title,$url)=split(':',$LONCAPA::map::resources[$LONCAPA::map::order[$env{'form.markcopy'}]]); |
$env{'form.markedcopy_title'}=$title; |
$env{'form.markedcopy_title'}=$title; |
$env{'form.markedcopy_url'}=$url; |
$env{'form.markedcopy_url'}=$url; |
} |
} |
my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted)=&breadcrumbs($folder); |
my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain)=&breadcrumbs($folder); |
$r->print($breadcrumbtrail); |
$r->print($breadcrumbtrail); |
if ($fatal) { |
if ($fatal) { |
$r->print('<p><font color="red">'.$errtext.'</font></p>'); |
$r->print('<p><font color="red">'.$errtext.'</font></p>'); |
Line 1023 sub editor {
|
Line 1219 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.changeparms'} eq 'randompick') { |
&Apache::lonratedt::storeparameter($idx,'parameter_randompick',$env{'form.randpick_'.$idx},'int_pos'); |
if ($env{'form.randpick_'.$idx}) { |
} else { |
&LONCAPA::map::storeparameter($idx,'parameter_randompick',$env{'form.randpick_'.$idx},'int_pos'); |
&Apache::lonratedt::delparameter($idx,'parameter_randompick'); |
&remember_parms($idx,'randompick','set',$env{'form.randpick_'.$idx}); |
|
} else { |
|
&LONCAPA::map::delparameter($idx,'parameter_randompick'); |
|
&remember_parms($idx,'randompick','del'); |
|
} |
} |
} |
if ($env{'form.hidprs_'.$idx}) { |
if ($env{'form.changeparms'} eq 'hiddenresource') { |
&Apache::lonratedt::storeparameter($idx,'parameter_hiddenresource','yes','string_yesno'); |
if ($env{'form.hidprs_'.$idx}) { |
} else { |
&LONCAPA::map::storeparameter($idx,'parameter_hiddenresource','yes','string_yesno'); |
&Apache::lonratedt::delparameter($idx,'parameter_hiddenresource'); |
&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}) { |
if ($env{'form.changeparms'} eq 'encrypturl') { |
&Apache::lonratedt::storeparameter($idx,'parameter_encrypturl','yes','string_yesno'); |
if ($env{'form.encprs_'.$idx}) { |
} else { |
&LONCAPA::map::storeparameter($idx,'parameter_encrypturl','yes','string_yesno'); |
&Apache::lonratedt::delparameter($idx,'parameter_encrypturl'); |
&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 |
|
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); |
|
if ($fatal) { |
|
$r->print('<p><font color="red">'.$errtext.'</font></p>'); |
|
return; |
} |
} |
|
} |
|
|
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]=$Apache::lonratedt::order[$i]; |
$neworder[$i]=$LONCAPA::map::order[$i]; |
} |
} |
for ($i=$currentpos;$i<$newpos;$i++) { |
for ($i=$currentpos;$i<$newpos;$i++) { |
$neworder[$i]=$Apache::lonratedt::order[$i+1]; |
$neworder[$i]=$LONCAPA::map::order[$i+1]; |
} |
} |
$neworder[$newpos]=$Apache::lonratedt::order[$currentpos]; |
$neworder[$newpos]=$LONCAPA::map::order[$currentpos]; |
for ($i=$newpos+1;$i<=$#Apache::lonratedt::order;$i++) { |
for ($i=$newpos+1;$i<=$#LONCAPA::map::order;$i++) { |
$neworder[$i]=$Apache::lonratedt::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]=$Apache::lonratedt::order[$i]; |
$neworder[$i]=$LONCAPA::map::order[$i]; |
} |
} |
$neworder[$newpos]=$Apache::lonratedt::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]=$Apache::lonratedt::order[$i-1]; |
$neworder[$i]=$LONCAPA::map::order[$i-1]; |
} |
} |
for ($i=$currentpos+1;$i<=$#Apache::lonratedt::order;$i++) { |
for ($i=$currentpos+1;$i<=$#LONCAPA::map::order;$i++) { |
$neworder[$i]=$Apache::lonratedt::order[$i]; |
$neworder[$i]=$LONCAPA::map::order[$i]; |
} |
|
} |
} |
@Apache::lonratedt::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 1096 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=&Apache::lonratedt::getresidx($url); |
my $newidx=&LONCAPA::map::getresidx($url); |
$Apache::lonratedt::resources[$newidx]= |
$LONCAPA::map::resources[$newidx]= |
$title.':'.$url.':'.$ext.':normal:res'; |
$title.':'.$url.':'.$ext.':normal:res'; |
$Apache::lonratedt::order[1+$#Apache::lonratedt::order]=$newidx; |
$LONCAPA::map::order[1+$#LONCAPA::map::order]=$newidx; |
# Store the result |
# Store the result |
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); |
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container); |
if ($fatal) { |
if ($fatal) { |
Line 1125 sub editor {
|
Line 1336 sub editor {
|
if ($env{'form.cmd'}) { |
if ($env{'form.cmd'}) { |
my ($cmd,$idx)=split(/\_/,$env{'form.cmd'}); |
my ($cmd,$idx)=split(/\_/,$env{'form.cmd'}); |
if ($cmd eq 'del') { |
if ($cmd eq 'del') { |
my (undef,$url)=split(':',$Apache::lonratedt::resources[$Apache::lonratedt::order[$idx]]); |
my (undef,$url)=split(':',$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]); |
if (($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) && |
if (($url=~m|/+uploaded/\Q$coursedom\E/\Q$coursenum\E/|) && |
($url!~/\.(page|sequence|problem|exam|quiz|assess|survey|form|library|task)$/)) { |
($url!~/\.(page|sequence|problem|exam|quiz|assess|survey|form|library|task)$/)) { |
&Apache::lonnet::removeuploadedurl($url); |
&Apache::lonnet::removeuploadedurl($url); |
} else { |
} else { |
&Apache::lonratedt::makezombie($Apache::lonratedt::order[$idx]); |
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]); |
} |
} |
for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) { |
for (my $i=$idx;$i<$#LONCAPA::map::order;$i++) { |
$Apache::lonratedt::order[$i]= |
$LONCAPA::map::order[$i] = $LONCAPA::map::order[$i+1]; |
$Apache::lonratedt::order[$i+1]; |
|
} |
} |
$#Apache::lonratedt::order--; |
$#LONCAPA::map::order--; |
} elsif ($cmd eq 'cut') { |
} elsif ($cmd eq 'cut') { |
my (undef,$url)=split(':',$Apache::lonratedt::resources[$Apache::lonratedt::order[$idx]]); |
my (undef,$url)=split(':',$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]); |
&Apache::lonratedt::makezombie($Apache::lonratedt::order[$idx]); |
&LONCAPA::map::makezombie($LONCAPA::map::order[$idx]); |
for (my $i=$idx;$i<$#Apache::lonratedt::order;$i++) { |
for (my $i=$idx;$i<$#LONCAPA::map::order;$i++) { |
$Apache::lonratedt::order[$i]= |
$LONCAPA::map::order[$i] = $LONCAPA::map::order[$i+1]; |
$Apache::lonratedt::order[$i+1]; |
|
} |
} |
$#Apache::lonratedt::order--; |
$#LONCAPA::map::order--; |
} elsif ($cmd eq 'up') { |
} elsif ($cmd eq 'up') { |
if (($idx) && (defined($Apache::lonratedt::order[$idx-1]))) { |
if (($idx) && (defined($LONCAPA::map::order[$idx-1]))) { |
my $i=$Apache::lonratedt::order[$idx-1]; |
my $i=$LONCAPA::map::order[$idx-1]; |
$Apache::lonratedt::order[$idx-1]= |
$LONCAPA::map::order[$idx-1] = $LONCAPA::map::order[$idx]; |
$Apache::lonratedt::order[$idx]; |
$LONCAPA::map::order[$idx] = $i; |
$Apache::lonratedt::order[$idx]=$i; |
|
} |
} |
} elsif ($cmd eq 'down') { |
} elsif ($cmd eq 'down') { |
if (defined($Apache::lonratedt::order[$idx+1])) { |
if (defined($LONCAPA::map::order[$idx+1])) { |
my $i=$Apache::lonratedt::order[$idx+1]; |
my $i=$LONCAPA::map::order[$idx+1]; |
$Apache::lonratedt::order[$idx+1]= |
$LONCAPA::map::order[$idx+1] = $LONCAPA::map::order[$idx]; |
$Apache::lonratedt::order[$idx]; |
$LONCAPA::map::order[$idx] = $i; |
$Apache::lonratedt::order[$idx]=$i; |
|
} |
} |
} elsif ($cmd eq 'rename') { |
} elsif ($cmd eq 'rename') { |
my $ratstr = $Apache::lonratedt::resources[$Apache::lonratedt::order[$idx]]; |
my $ratstr = $LONCAPA::map::resources[$LONCAPA::map::order[$idx]]; |
my ($rtitle,@rrest)=split(/\:/, |
my ($rtitle,@rrest)=split(/\:/, |
$Apache::lonratedt::resources[ |
$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]); |
$Apache::lonratedt::order[$idx]]); |
my $comment=$env{'form.title'}; |
my $comment= |
$comment = &LONCAPA::map::qtunescape($comment); |
&HTML::Entities::decode($env{'form.title'}); |
|
$comment=~s/\</\<\;/g; |
|
$comment=~s/\>/\>\;/g; |
|
$comment=~s/\:/\:/g; |
|
if ($comment=~/\S/) { |
if ($comment=~/\S/) { |
$Apache::lonratedt::resources[ |
$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]= |
$Apache::lonratedt::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 1201 sub editor {
|
Line 1401 sub editor {
|
} |
} |
} |
} |
# Store the changed version |
# Store the changed version |
($errtext,$fatal)=group_import($coursenum, $coursedom, $folder, |
($errtext,$fatal)=&group_import($coursenum, $coursedom, $folder, |
$container,'londocs',@imports); |
$container,'londocs',@imports); |
if ($fatal) { |
if ($fatal) { |
$r->print('<p><font color="red">'.$errtext.'</font></p>'); |
$r->print('<p><font color="red">'.$errtext.'</font></p>'); |
Line 1213 sub editor {
|
Line 1413 sub editor {
|
if ($env{'form.importmap'}=~/\w/) { |
if ($env{'form.importmap'}=~/\w/) { |
foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$env{'form.importmap'}))) { |
foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$env{'form.importmap'}))) { |
my ($title,$url,$ext,$type)=split(/\:/,$_); |
my ($title,$url,$ext,$type)=split(/\:/,$_); |
my $idx=&Apache::lonratedt::getresidx($url); |
my $idx=&LONCAPA::map::getresidx($url); |
$Apache::lonratedt::resources[$idx]=$_; |
$LONCAPA::map::resources[$idx]=$_; |
$Apache::lonratedt::order |
$LONCAPA::map::order[$#LONCAPA::map::order+1]=$idx; |
[$#Apache::lonratedt::order+1]=$idx; |
|
} |
} |
# Store the changed version |
# Store the changed version |
($errtext,$fatal)=&storemap($coursenum,$coursedom, |
($errtext,$fatal)=&storemap($coursenum,$coursedom, |
Line 1229 sub editor {
|
Line 1428 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($plain); |
} |
} |
# ---------------------------------------------------------------- End commands |
# ---------------------------------------------------------------- End commands |
# ---------------------------------------------------------------- Print screen |
# ---------------------------------------------------------------- Print screen |
Line 1245 sub editor {
|
Line 1445 sub editor {
|
$r->print('<p>'.&mt('Caution: this folder is set to randomly pick a subset of resources. Adding or removing resources from this folder will change the set of resources that the students see, resulting in spurious or missing credit for completed problems, not limited to ones you modify. Do not modify the contents of this folder if it is in active student use.').'</p>'); |
$r->print('<p>'.&mt('Caution: this folder is set to randomly pick a subset of resources. Adding or removing resources from this folder will change the set of resources that the students see, resulting in spurious or missing credit for completed problems, not limited to ones you modify. Do not modify the contents of this folder if it is in active student use.').'</p>'); |
} |
} |
$r->print('<table>'); |
$r->print('<table>'); |
foreach (@Apache::lonratedt::order) { |
foreach my $res (@LONCAPA::map::order) { |
my ($name,$url)=split(/\:/,$Apache::lonratedt::resources[$_]); |
my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]); |
$name=&Apache::lonratsrv::qtescape($name); |
$name=&LONCAPA::map::qtescape($name); |
$url=&Apache::lonratsrv::qtescape($url); |
$url=&LONCAPA::map::qtescape($url); |
unless ($name) { $name=(split(/\//,$url))[-1]; } |
unless ($name) { $name=(split(/\//,$url))[-1]; } |
unless ($name) { $idx++; next; } |
unless ($name) { $idx++; next; } |
$r->print(&entryline($idx,$name,$url,$folder,$allowed,$_,$coursenum)); |
$r->print(&entryline($idx,$name,$url,$folder,$allowed,$res, |
|
$coursenum)); |
$idx++; |
$idx++; |
$shown++; |
$shown++; |
} |
} |
Line 1265 sub editor {
|
Line 1466 sub editor {
|
<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'}" /> |
ENDPASTE |
ENDPASTE |
$r->print( |
$r->print('<input type="submit" name="pastemarked" value="'.&mt('Paste').'" /> '); |
'<input type="submit" name="pastemarked" value="'.&mt('Paste'). |
|
'" /> '.&Apache::loncommon::filedescription( |
my $type; |
(split(/\./,$env{'form.markedcopy_url'}))[-1]).': '. |
if ($env{'form.markedcopy_url'} =~ m{^/adm/wrapper/ext}) { |
$env{'form.markedcopy_title'}); |
$type = &mt('External Resource'); |
|
$r->print($type.': '. $env{'form.markedcopy_title'}); |
|
} else { |
|
my $extension = (split(/\./,$env{'form.markedcopy_url'}))[-1]; |
|
my $type = &Apache::loncommon::filedescription($extension); |
|
my $icon = '<img src="'.&Apache::loncommon::icon($extension). |
|
'" class="LC_icon" />'; |
|
$r->print($icon.$type.': '. $env{'form.markedcopy_title'}); |
|
} |
if ($container eq 'page') { |
if ($container eq 'page') { |
$r->print(<<PAGEINFO); |
$r->print(<<PAGEINFO); |
<input type="hidden" name="pagepath" value="$env{'form.pagepath'}" /> |
<input type="hidden" name="pagepath" value="$env{'form.pagepath'}" /> |
Line 1306 sub process_file_upload {
|
Line 1515 sub process_file_upload {
|
} |
} |
($errtext,$fatal)= |
($errtext,$fatal)= |
&mapread($coursenum,$coursedom,$folder.'.'.$container); |
&mapread($coursenum,$coursedom,$folder.'.'.$container); |
if ($#Apache::lonratedt::order<1) { |
if ($#LONCAPA::map::order<1) { |
$Apache::lonratedt::order[0]=1; |
$LONCAPA::map::order[0]=1; |
$Apache::lonratedt::resources[1]=''; |
$LONCAPA::map::resources[1]=''; |
} |
} |
if ($fatal) { |
if ($fatal) { |
return 'failed'; |
return 'failed'; |
Line 1324 sub process_file_upload {
|
Line 1533 sub process_file_upload {
|
} |
} |
# this is for a course, not a user, so set coursedoc flag |
# this is for a course, not a user, so set coursedoc flag |
# probably the only place in the system where this should be "1" |
# probably the only place in the system where this should be "1" |
my $newidx=&Apache::lonratedt::getresidx(); |
my $newidx=&LONCAPA::map::getresidx(); |
$destination .= $newidx; |
$destination .= $newidx; |
my $url=&Apache::lonnet::userfileupload('uploaddoc',1,$destination, |
my $url=&Apache::lonnet::userfileupload('uploaddoc',1,$destination, |
$parseaction,$allfiles, |
$parseaction,$allfiles, |
$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; |
} |
} |
|
|
$Apache::lonratedt::resources[$newidx]= |
$LONCAPA::map::resources[$newidx]= |
$comment.':'.$url.':'.$ext.':normal:res'; |
$comment.':'.$url.':'.$ext.':normal:res'; |
$Apache::lonratedt::order[$#Apache::lonratedt::order+1]= $newidx; |
$LONCAPA::map::order[$#LONCAPA::map::order+1]= $newidx; |
($errtext,$fatal)=&storemap($coursenum,$coursedom, |
($errtext,$fatal)=&storemap($coursenum,$coursedom, |
$folder.'.'.$container); |
$folder.'.'.$container); |
if ($fatal) { |
if ($fatal) { |
Line 1354 sub process_file_upload {
|
Line 1561 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 1395 sub process_file_upload {
|
Line 1582 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 (sort {lc($a) cmp lc($b)} keys(%{$allfiles})) { |
|
$upload_output .= &Apache::loncommon::start_data_table_row(). |
|
'<td>'.$embed_file.'</td><td>'; |
|
if ($args->{'ignore_remote_references'} |
|
&& $embed_file =~ m{^\w+://}) { |
|
$upload_output.='<span class="LC_warning">'.&mt("URL points to other server.").'</span>'; |
|
} elsif ($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="'.&mt('Upload Listed Files').'" /> |
|
'.&mt('(only files for which a location has been provided will be uploaded)').' |
|
</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 1410 sub process_secondary_uploads {
|
Line 1646 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 1418 sub process_secondary_uploads {
|
Line 1654 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=$Apache::lonratedt::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 1437 sub entryline {
|
Line 1671 sub entryline {
|
my $line='<tr>'; |
my $line='<tr>'; |
# Edit commands |
# Edit commands |
my $container; |
my $container; |
my $folderpath; |
my ($container, $type, $esc_path, $path, $symb); |
if ($env{'form.folderpath'}) { |
if ($env{'form.folderpath'}) { |
|
$type = 'folder'; |
$container = 'sequence'; |
$container = 'sequence'; |
$folderpath=&escape($env{'form.folderpath'}); |
$esc_path=&escape($path = $env{'form.folderpath'}); |
# $htmlfoldername=&HTML::Entities::encode($env{'form.foldername'},'<>&"'); |
# $htmlfoldername=&HTML::Entities::encode($env{'form.foldername'},'<>&"'); |
} |
} |
my ($pagepath,$pagesymb); |
|
if ($env{'form.pagepath'}) { |
if ($env{'form.pagepath'}) { |
$container = 'page'; |
$type = $container = 'page'; |
$pagepath=&escape($env{'form.pagepath'}); |
$esc_path=&escape($path = $env{'form.pagepath'}); |
$pagesymb=&escape($env{'form.pagesymb'}); |
$symb=&escape($env{'form.pagesymb'}); |
} |
} |
my $cpinfo=''; |
my $cpinfo=''; |
if ($env{'form.markedcopy_url'}) { |
if ($env{'form.markedcopy_url'}) { |
Line 1460 sub entryline {
|
Line 1694 sub entryline {
|
my $incindex=$index+1; |
my $incindex=$index+1; |
my $selectbox=''; |
my $selectbox=''; |
if (($folder!~/^supplemental/) && |
if (($folder!~/^supplemental/) && |
($#Apache::lonratedt::order>0) && |
($#LONCAPA::map::order>0) && |
((split(/\:/, |
((split(/\:/, |
$Apache::lonratedt::resources[$Apache::lonratedt::order[0]]))[1] |
$LONCAPA::map::resources[$LONCAPA::map::order[0]]))[1] |
ne '') && |
ne '') && |
((split(/\:/, |
((split(/\:/, |
$Apache::lonratedt::resources[$Apache::lonratedt::order[1]]))[1] |
$LONCAPA::map::resources[$LONCAPA::map::order[1]]))[1] |
ne '')) { |
ne '')) { |
$selectbox= |
$selectbox= |
'<input type="hidden" name="currentpos" value="'.$incindex.'" />'. |
'<input type="hidden" name="currentpos" value="'.$incindex.'" />'. |
'<select name="newpos" onChange="this.form.submit()">'; |
'<select name="newpos" onChange="this.form.submit()">'; |
for (my $i=1;$i<=$#Apache::lonratedt::order+1;$i++) { |
for (my $i=1;$i<=$#LONCAPA::map::order+1;$i++) { |
if ($i==$incindex) { |
if ($i==$incindex) { |
$selectbox.='<option value="" selected="1">('.$i.')</option>'; |
$selectbox.='<option value="" selected="1">('.$i.')</option>'; |
} else { |
} else { |
Line 1487 sub entryline {
|
Line 1721 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 1496 sub entryline {
|
Line 1731 sub entryline {
|
} |
} |
} |
} |
} |
} |
|
if ($url=~/^\/res\/lib\/templates\//) { |
|
$nocopy=1; |
|
$nocut=1; |
|
} |
my $copylink=' '; |
my $copylink=' '; |
if ($env{'form.pagepath'}) { |
my $cutlink=' '; |
unless ($nocopy) { |
|
$copylink=(<<ENDCOPY); |
if (!$nocopy) { |
<a href='javascript:markcopy("$pagepath","$index","$renametitle","page","$pagesymb");'> |
$copylink=(<<ENDCOPY); |
<font size="-2" color="#000099">$lt{'cp'}</font></a></td> |
<a href='javascript:markcopy("$esc_path","$index","$renametitle","$container","$symb");'> |
ENDCOPY |
<font size="-2" color="#000099">$lt{'cp'}</font></a> |
} |
|
$line.=(<<END); |
|
<form name="entry_$index" action="/adm/coursedocs" method="post"> |
|
<input type="hidden" name="pagepath" value="$env{'form.pagepath'}" /> |
|
<input type="hidden" name="pagesymb" value="$env{'form.pagesymb'}" /> |
|
<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="setparms" value="$orderidx" /> |
|
<td><table border='0' cellspacing='2' cellpadding='0'> |
|
<tr><td bgcolor="#DDDDDD"> |
|
<a href='/adm/coursedocs?cmd=up_$index&pagepath=$pagepath&pagesymb=$pagesymb$cpinfo'> |
|
<img src="${iconpath}move_up.gif" alt='$lt{'up'}' border='0' /></a></td></tr> |
|
<tr><td bgcolor="#DDDDDD"> |
|
<a href='/adm/coursedocs?cmd=down_$index&pagepath=$pagepath&pagesymb=$pagesymb$cpinfo'> |
|
<img src="${iconpath}move_down.gif" alt='$lt{'dw'}' border='0' /></a></td></tr> |
|
</table></td> |
|
<td>$selectbox |
|
</td><td bgcolor="#DDDDDD"> |
|
<a href='javascript:removeres("$pagepath","$index","$renametitle","page","$pagesymb");'> |
|
<font size="-2" color="#990000">$lt{'rm'}</font></a> |
|
<a href='javascript:cutres("$pagepath","$index","$renametitle","page","$pagesymb");'> |
|
<font size="-2" color="#550044">$lt{'ct'}</font></a> |
|
<a href='javascript:changename("$pagepath","$index","$renametitle","page","$pagesymb");'> |
|
<font size="-2" color="#009900">$lt{'rn'}</font></a> |
|
$copylink |
|
END |
|
} else { |
|
unless ($nocopy) { |
|
$copylink=(<<ENDCOPY); |
|
<a href='javascript:markcopy("$folderpath","$index","$renametitle","sequence");'> |
|
<font size="-2" color="#000099">$lt{'cp'}</font></a></td> |
|
ENDCOPY |
ENDCOPY |
} |
} |
$line.=(<<END); |
if (!$nocut) { |
<form name="entry_$index" action="/adm/coursedocs" method="post"> |
$cutlink=(<<ENDCUT); |
<input type="hidden" name="folderpath" value="$env{'form.folderpath'}" /> |
<a href='javascript:cutres("$esc_path","$index","$renametitle","$container","$symb");'> |
<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="setparms" value="$orderidx" /> |
|
<td><table border='0' cellspacing='2' cellpadding='0'> |
|
<tr><td bgcolor="#DDDDDD"> |
|
<a href='/adm/coursedocs?cmd=up_$index&folderpath=$folderpath$cpinfo'> |
|
<img src="${iconpath}move_up.gif" alt='$lt{'up'}' border='0' /></a></td></tr> |
|
<tr><td bgcolor="#DDDDDD"> |
|
<a href='/adm/coursedocs?cmd=down_$index&folderpath=$folderpath$cpinfo'> |
|
<img src="${iconpath}move_down.gif" alt='$lt{'dw'}' border='0' /></a></td></tr> |
|
</table></td> |
|
<td>$selectbox |
|
</td><td bgcolor="#DDDDDD"> |
|
<a href='javascript:removeres("$folderpath","$index","$renametitle","sequence");'> |
|
<font size="-2" color="#990000">$lt{'rm'}</font></a> |
|
<a href='javascript:cutres("$folderpath","$index","$renametitle","sequence");'> |
|
<font size="-2" color="#550044">$lt{'ct'}</font></a> |
<font size="-2" color="#550044">$lt{'ct'}</font></a> |
<a href='javascript:changename("$folderpath","$index","$renametitle","sequence");'> |
ENDCUT |
<font size="-2" color="#009900">$lt{'rn'}</font></a> |
} |
|
$line.=(<<END); |
|
<form name="entry_$index" action="/adm/coursedocs" method="post"> |
|
<input type="hidden" name="${type}path" value="$path" /> |
|
<input type="hidden" name="${type}symb" value="$symb" /> |
|
<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="setparms" value="$orderidx" /> |
|
<input type="hidden" name="changeparms" value="0" /> |
|
<td> |
|
<table border='0' cellspacing='2' cellpadding='0'> |
|
<tr> |
|
<td bgcolor="#DDDDDD"> |
|
<a href='/adm/coursedocs?cmd=up_$index&${type}path=$esc_path&${type}symb=$symb$cpinfo'><img src="${iconpath}move_up.gif" alt='$lt{'up'}' border='0' /></a> |
|
</td> |
|
</tr> |
|
<tr> |
|
<td bgcolor="#DDDDDD"> |
|
<a href='/adm/coursedocs?cmd=down_$index&${type}path=$esc_path&${type}symb=$symb$cpinfo'><img src="${iconpath}move_down.gif" alt='$lt{'dw'}' border='0' /></a> |
|
</td> |
|
</tr> |
|
</table> |
|
</td> |
|
<td> |
|
$selectbox |
|
</td> |
|
<td bgcolor="#DDDDDD"> |
|
<a href='javascript:removeres("$esc_path","$index","$renametitle","$container","$symb");'><font size="-2" color="#990000">$lt{'rm'}</font></a> |
|
$cutlink |
|
<a href='javascript:changename("$esc_path","$index","$renametitle","$container","$symb");'><font size="-2" color="#009900">$lt{'rn'}</font></a> |
$copylink |
$copylink |
|
</td> |
END |
END |
} |
|
} |
} |
# Figure out what kind of a resource this is |
# Figure out what kind of a resource this is |
my ($extension)=($url=~/\.(\w+)$/); |
my ($extension)=($url=~/\.(\w+)$/); |
Line 1574 END
|
Line 1796 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 1631 END
|
Line 1853 END
|
if ($folderpath) { $folderpath.='&' }; |
if ($folderpath) { $folderpath.='&' }; |
# Append randompick number, hidden, and encrypted with ":" to foldername, |
# Append randompick number, hidden, and encrypted with ":" to foldername, |
# so it gets transferred between levels |
# so it gets transferred between levels |
$folderpath.=$folderarg.'&'.$foldername.':'.(&Apache::lonratedt::getparameter($orderidx, |
$folderpath.=$folderarg.'&'.$foldername.':'.(&LONCAPA::map::getparameter($orderidx, |
'parameter_randompick'))[0] |
'parameter_randompick'))[0] |
.':'.((&Apache::lonratedt::getparameter($orderidx, |
.':'.((&LONCAPA::map::getparameter($orderidx, |
'parameter_hiddenresource'))[0]=~/^yes$/i) |
'parameter_hiddenresource'))[0]=~/^yes$/i) |
.':'.((&Apache::lonratedt::getparameter($orderidx, |
.':'.((&LONCAPA::map::getparameter($orderidx, |
'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='."'randompick'".';this.form.submit()" name="randpick_'.$orderidx.'" value="'. |
(&Apache::lonratedt::getparameter($orderidx, |
(&LONCAPA::map::getparameter($orderidx, |
'parameter_randompick'))[0]. |
'parameter_randompick'))[0]. |
'" />'. |
'" />'. |
'<font size="-2"><a href="javascript:void(0)">'.&mt('Store').'</a></font></label>'; |
'<font size="-2"><a href="javascript:void(0)">'.&mt('Save').'</a></font></label>'; |
|
|
} |
} |
if ($ispage) { |
if ($ispage) { |
Line 1673 END
|
Line 1895 END
|
'hd' => 'Hidden', |
'hd' => 'Hidden', |
'ec' => 'URL hidden'); |
'ec' => 'URL hidden'); |
my $enctext= |
my $enctext= |
((&Apache::lonratedt::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="1"':''); |
((&LONCAPA::map::getparameter($orderidx,'parameter_encrypturl'))[0]=~/^yes$/i?' checked="1"':''); |
my $hidtext= |
my $hidtext= |
((&Apache::lonratedt::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='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.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 1794 sub list_symbs {
|
Line 2016 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 1813 sub verifycontent {
|
Line 2036 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 1848 sub checkversions {
|
Line 2072 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 1899 sub checkversions {
|
Line 2124 sub checkversions {
|
if (&Apache::lonnet::put('resourceversions',\%newsetversions, |
if (&Apache::lonnet::put('resourceversions',\%newsetversions, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') { |
$env{'course.'.$env{'request.course.id'}.'.num'}) eq 'ok') { |
$r->print('<h1>'.&mt('Your Version Settings have been Stored').'</h1>'); |
$r->print('<h1>'.&mt('Your Version Settings have been Saved').'</h1>'); |
} else { |
} else { |
$r->print('<h1><font color="red">'.&mt('An Error Occured while Attempting to Store your Version Settings').'</font></h1>'); |
$r->print('<h1><font color="red">'.&mt('An Error Occured while Attempting to Save your Version Settings').'</font></h1>'); |
} |
} |
&mark_hash_old(); |
&mark_hash_old(); |
} |
} |
Line 2139 sub changewarning {
|
Line 2364 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 2167 sub handler {
|
Line 2408 sub handler {
|
'Docs_About_Bulletin_Board,Docs_Editing_Templated_Pages'); |
'Docs_About_Bulletin_Board,Docs_Editing_Templated_Pages'); |
$help{'My Personal Info'} = &Apache::loncommon::help_open_topic( |
$help{'My Personal Info'} = &Apache::loncommon::help_open_topic( |
'Docs_About_My_Personal_Info,Docs_Editing_Templated_Pages'); |
'Docs_About_My_Personal_Info,Docs_Editing_Templated_Pages'); |
|
$help{'Group Files'} = &Apache::loncommon::help_open_topic('Docs_About_Group_Files'); |
$help{'Caching'} = &Apache::loncommon::help_open_topic('Caching'); |
$help{'Caching'} = &Apache::loncommon::help_open_topic('Caching'); |
|
|
# 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'}) { |
|
&init_breadcrumbs('docslog','Show Log'); |
|
&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 2235 sub handler {
|
Line 2484 sub handler {
|
# get personal data |
# get personal data |
my $uname=$env{'user.name'}; |
my $uname=$env{'user.name'}; |
my $udom=$env{'user.domain'}; |
my $udom=$env{'user.domain'}; |
my $plainname=&escape( |
my $plainname=&escape(&Apache::loncommon::plainname($uname,$udom)); |
&Apache::loncommon::plainname($uname,$udom)); |
|
|
|
# graphics settings |
# graphics settings |
|
|
Line 2255 sub handler {
|
Line 2503 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 2360 sub handler {
|
Line 2609 sub handler {
|
'scuf' => 'Score Upload Form', |
'scuf' => 'Score Upload Form', |
'bull' => 'Bulletin Board', |
'bull' => 'Bulletin Board', |
'mypi' => 'My Personal Info', |
'mypi' => 'My Personal Info', |
|
'grpo' => 'Group Files', |
'abou' => 'About User', |
'abou' => 'About User', |
'imsf' => 'Import IMS package', |
'imsf' => 'Import IMS package', |
'file' => 'File', |
'file' => 'File', |
Line 2375 sub handler {
|
Line 2625 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 2398 sub handler {
|
Line 2649 sub handler {
|
$containertag |
$containertag |
</form> |
</form> |
<form name="simpleedit" method="post" action="/adm/coursedocs"> |
<form name="simpleedit" method="post" action="/adm/coursedocs"> |
<input type=hidden name="importdetail" value=""> |
<input type="hidden" name="importdetail" value="" /> |
$uploadtag |
$uploadtag |
</form> |
</form> |
<form action="/adm/coursedocs" method="post" name="courseverify"> |
<form action="/adm/coursedocs" method="post" name="courseverify"> |
Line 2411 $dumpbut
|
Line 2662 $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="hidden" name="folder" value="$env{'form.folder'}" /> |
|
<input type="submit" name="docslog" value="$lt{'sl'}" /> |
</td></tr></table> |
</td></tr></table> |
</form> |
</form> |
ENDCOURSEVERIFY |
ENDCOURSEVERIFY |
Line 2510 ENDFORM
|
Line 2764 ENDFORM
|
<hr /> |
<hr /> |
<form action="/adm/coursedocs" method="post" name="newext"> |
<form action="/adm/coursedocs" method="post" name="newext"> |
$uploadtag |
$uploadtag |
<input type=hidden name="importdetail" value=""> |
<input type="hidden" name="importdetail" value="" /> |
<nobr> |
<nobr> |
<input name="newext" type="button" onClick="javascript:makenewext('newext');" |
<input name="newext" type="button" onClick="javascript:makenewext('newext');" |
value="$lt{'extr'}" /> $help{'Adding_External_Resource'} |
value="$lt{'extr'}" /> $help{'Adding_External_Resource'} |
Line 2528 ENDFORM
|
Line 2782 ENDFORM
|
$r->print(<<ENDFORM); |
$r->print(<<ENDFORM); |
<br /><form action="/adm/coursedocs" method="post" name="newfolder"> |
<br /><form action="/adm/coursedocs" method="post" name="newfolder"> |
<input type="hidden" name="folderpath" value="$env{'form.folderpath'}" /> |
<input type="hidden" name="folderpath" value="$env{'form.folderpath'}" /> |
<input type=hidden name="importdetail" value=""> |
<input type="hidden" name="importdetail" value="" /> |
<nobr> |
<nobr> |
<input name="newfolder" type="button" |
<input name="newfolder" type="button" |
onClick="javascript:makenewfolder(this.form,'$folderseq');" |
onClick="javascript:makenewfolder(this.form,'$folderseq');" |
Line 2537 value="$lt{'newf'}" />$help{'Adding_Fold
|
Line 2791 value="$lt{'newf'}" />$help{'Adding_Fold
|
</form> |
</form> |
<br /><form action="/adm/coursedocs" method="post" name="newpage"> |
<br /><form action="/adm/coursedocs" method="post" name="newpage"> |
<input type="hidden" name="folderpath" value="$env{'form.folderpath'}" /> |
<input type="hidden" name="folderpath" value="$env{'form.folderpath'}" /> |
<input type=hidden name="importdetail" value=""> |
<input type="hidden" name="importdetail" value="" /> |
<nobr> |
<nobr> |
<input name="newpage" type="button" |
<input name="newpage" type="button" |
onClick="javascript:makenewpage(this.form,'$pageseq');" |
onClick="javascript:makenewpage(this.form,'$pageseq');" |
Line 2546 value="$lt{'newp'}" />$help{'Adding_Page
|
Line 2800 value="$lt{'newp'}" />$help{'Adding_Page
|
</form> |
</form> |
<br /><form action="/adm/coursedocs" method="post" name="newsyl"> |
<br /><form action="/adm/coursedocs" method="post" name="newsyl"> |
$uploadtag |
$uploadtag |
<input type=hidden name="importdetail" |
<input type="hidden" name="importdetail" |
value="Syllabus=/public/$coursedom/$coursenum/syllabus"> |
value="Syllabus=/public/$coursedom/$coursenum/syllabus" /> |
<nobr> |
<nobr> |
<input name="newsyl" type="submit" value="$lt{'syll'}" /> |
<input name="newsyl" type="submit" value="$lt{'syll'}" /> |
$help{'Syllabus'} |
$help{'Syllabus'} |
Line 2555 value="Syllabus=/public/$coursedom/$cour
|
Line 2809 value="Syllabus=/public/$coursedom/$cour
|
</form> |
</form> |
<br /><form action="/adm/coursedocs" method="post" name="newnav"> |
<br /><form action="/adm/coursedocs" method="post" name="newnav"> |
$uploadtag |
$uploadtag |
<input type=hidden name="importdetail" |
<input type="hidden" name="importdetail" |
value="Navigate Content=/adm/navmaps"> |
value="Navigate Content=/adm/navmaps" /> |
<nobr> |
<nobr> |
<input name="newnav" type="submit" value="$lt{'navc'}" /> |
<input name="newnav" type="submit" value="$lt{'navc'}" /> |
$help{'Navigate_Content'} |
$help{'Navigate_Content'} |
Line 2564 $help{'Navigate_Content'}
|
Line 2818 $help{'Navigate_Content'}
|
</form> |
</form> |
<br /><form action="/adm/coursedocs" method="post" name="newsmppg"> |
<br /><form action="/adm/coursedocs" method="post" name="newsmppg"> |
$uploadtag |
$uploadtag |
<input type=hidden name="importdetail" value=""> |
<input type="hidden" name="importdetail" value="" /> |
<nobr> |
<nobr> |
<input name="newsmppg" type="button" value="$lt{'sipa'}" |
<input name="newsmppg" type="button" value="$lt{'sipa'}" |
onClick="javascript:makesmppage();" /> $help{'Simple Page'} |
onClick="javascript:makesmppage();" /> $help{'Simple Page'} |
Line 2572 onClick="javascript:makesmppage();" /> $
|
Line 2826 onClick="javascript:makesmppage();" /> $
|
</form> |
</form> |
<br /><form action="/adm/coursedocs" method="post" name="newsmpproblem"> |
<br /><form action="/adm/coursedocs" method="post" name="newsmpproblem"> |
$uploadtag |
$uploadtag |
<input type=hidden name="importdetail" value=""> |
<input type="hidden" name="importdetail" value="" /> |
<nobr> |
<nobr> |
<input name="newsmpproblem" type="button" value="$lt{'sipr'}" |
<input name="newsmpproblem" type="button" value="$lt{'sipr'}" |
onClick="javascript:makesmpproblem();" />$help{'Simple Problem'} |
onClick="javascript:makesmpproblem();" />$help{'Simple Problem'} |
Line 2580 onClick="javascript:makesmpproblem();" /
|
Line 2834 onClick="javascript:makesmpproblem();" /
|
</form> |
</form> |
<br /><form action="/adm/coursedocs" method="post" name="newdropbox"> |
<br /><form action="/adm/coursedocs" method="post" name="newdropbox"> |
$uploadtag |
$uploadtag |
<input type=hidden name="importdetail" value=""> |
<input type="hidden" name="importdetail" value="" /> |
<nobr> |
<nobr> |
<input name="newdropbox" type="button" value="$lt{'drbx'}" |
<input name="newdropbox" type="button" value="$lt{'drbx'}" |
onClick="javascript:makedropbox();" /> |
onClick="javascript:makedropbox();" /> |
Line 2588 onClick="javascript:makedropbox();" />
|
Line 2842 onClick="javascript:makedropbox();" />
|
</form> |
</form> |
<br /><form action="/adm/coursedocs" method="post" name="newexamupload"> |
<br /><form action="/adm/coursedocs" method="post" name="newexamupload"> |
$uploadtag |
$uploadtag |
<input type=hidden name="importdetail" value=""> |
<input type="hidden" name="importdetail" value="" /> |
<nobr> |
<nobr> |
<input name="newexamupload" type="button" value="$lt{'scuf'}" |
<input name="newexamupload" type="button" value="$lt{'scuf'}" |
onClick="javascript:makeexamupload();" /> |
onClick="javascript:makeexamupload();" /> |
Line 2597 $help{'Score_Upload_Form'}
|
Line 2851 $help{'Score_Upload_Form'}
|
</form> |
</form> |
<br /><form action="/adm/coursedocs" method="post" name="newbul"> |
<br /><form action="/adm/coursedocs" method="post" name="newbul"> |
$uploadtag |
$uploadtag |
<input type=hidden name="importdetail" value=""> |
<input type="hidden" name="importdetail" value="" /> |
<nobr> |
<nobr> |
<input name="newbulletin" type="button" value="$lt{'bull'}" |
<input name="newbulletin" type="button" value="$lt{'bull'}" |
onClick="javascript:makebulboard();" /> |
onClick="javascript:makebulboard();" /> |
Line 2606 $help{'Bulletin Board'}
|
Line 2860 $help{'Bulletin Board'}
|
</form> |
</form> |
<br /><form action="/adm/coursedocs" method="post" name="newaboutme"> |
<br /><form action="/adm/coursedocs" method="post" name="newaboutme"> |
$uploadtag |
$uploadtag |
<input type=hidden name="importdetail" |
<input type="hidden" name="importdetail" |
value="$plainname=/adm/$udom/$uname/aboutme"> |
value="$plainname=/adm/$udom/$uname/aboutme" /> |
<nobr> |
<nobr> |
<input name="newaboutme" type="submit" value="$lt{'mypi'}" /> |
<input name="newaboutme" type="submit" value="$lt{'mypi'}" /> |
$help{'My Personal Info'} |
$help{'My Personal Info'} |
Line 2615 $help{'My Personal Info'}
|
Line 2869 $help{'My Personal Info'}
|
</form> |
</form> |
<br /><form action="/adm/coursedocs" method="post" name="newaboutsomeone"> |
<br /><form action="/adm/coursedocs" method="post" name="newaboutsomeone"> |
$uploadtag |
$uploadtag |
<input type=hidden name="importdetail" value=""> |
<input type="hidden" name="importdetail" value="" /> |
<nobr> |
<nobr> |
<input name="newaboutsomeone" type="button" value="$lt{'abou'}" |
<input name="newaboutsomeone" type="button" value="$lt{'abou'}" |
onClick="javascript:makeabout();" /> |
onClick="javascript:makeabout();" /> |
</nobr> |
</nobr> |
</form> |
</form> |
|
<br /><form action="/adm/coursedocs" method="post" name="newgroupfiles"> |
|
$uploadtag |
|
<input type="hidden" name="importdetail" |
|
value="Group Files=/adm/$coursedom/$coursenum/aboutme" /> |
|
<nobr> |
|
<input name="newgroupfiles" type="submit" value="$lt{'grpo'}" /> |
|
$help{'Group Files'} |
|
</nobr> |
|
</form> |
ENDFORM |
ENDFORM |
} |
} |
if ($env{'form.pagepath'}) { |
if ($env{'form.pagepath'}) { |
$r->print(<<ENDBLOCK); |
$r->print(<<ENDBLOCK); |
<form action="/adm/coursedocs" method="post" name="newsmpproblem"> |
<form action="/adm/coursedocs" method="post" name="newsmpproblem"> |
$uploadtag |
$uploadtag |
<input type=hidden name="importdetail" value=""> |
<input type="hidden" name="importdetail" value="" /> |
<nobr> |
<nobr> |
<input name="newsmpproblem" type="button" value="$lt{'sipr'}" |
<input name="newsmpproblem" type="button" value="$lt{'sipr'}" |
onClick="javascript:makesmpproblem();" />$help{'Simple Problem'} |
onClick="javascript:makesmpproblem();" />$help{'Simple Problem'} |
Line 2635 onClick="javascript:makesmpproblem();" /
|
Line 2898 onClick="javascript:makesmpproblem();" /
|
</form> |
</form> |
<br /><form action="/adm/coursedocs" method="post" name="newexamupload"> |
<br /><form action="/adm/coursedocs" method="post" name="newexamupload"> |
$uploadtag |
$uploadtag |
<input type=hidden name="importdetail" value=""> |
<input type="hidden" name="importdetail" value="" /> |
<nobr> |
<nobr> |
<input name="newexamupload" type="button" value="$lt{'scuf'}" |
<input name="newexamupload" type="button" value="$lt{'scuf'}" |
onClick="javascript:makeexamupload();" /> |
onClick="javascript:makeexamupload();" /> |
Line 2699 $lt{'comment'}:<br />
|
Line 2962 $lt{'comment'}:<br />
|
<td bgcolor="#DDDDDD"> |
<td bgcolor="#DDDDDD"> |
<form action="/adm/coursedocs" method="post" name="supnewfolder"> |
<form action="/adm/coursedocs" method="post" name="supnewfolder"> |
<input type="hidden" name="folderpath" value="$env{'form.folderpath'}" /> |
<input type="hidden" name="folderpath" value="$env{'form.folderpath'}" /> |
<input type=hidden name="importdetail" value=""> |
<input type="hidden" name="importdetail" value="" /> |
<nobr> |
<nobr> |
<input name="newfolder" type="button" |
<input name="newfolder" type="button" |
onClick="javascript:makenewfolder(this.form,'$folderseq');" |
onClick="javascript:makenewfolder(this.form,'$folderseq');" |
Line 2708 value="$lt{'newf'}" /> $help{'Adding_Fol
|
Line 2971 value="$lt{'newf'}" /> $help{'Adding_Fol
|
</form> |
</form> |
<br /><form action="/adm/coursedocs" method="post" name="supnewext"> |
<br /><form action="/adm/coursedocs" method="post" name="supnewext"> |
<input type="hidden" name="folderpath" value="$env{'form.folderpath'}" /> |
<input type="hidden" name="folderpath" value="$env{'form.folderpath'}" /> |
<input type=hidden name="importdetail" value=""> |
<input type="hidden" name="importdetail" value="" /> |
<nobr> |
<nobr> |
<input name="newext" type="button" |
<input name="newext" type="button" |
onClick="javascript:makenewext('supnewext');" |
onClick="javascript:makenewext('supnewext');" |
Line 2717 value="$lt{'extr'}" /> $help{'Adding_Ext
|
Line 2980 value="$lt{'extr'}" /> $help{'Adding_Ext
|
</form> |
</form> |
<br /><form action="/adm/coursedocs" method="post" name="supnewsyl"> |
<br /><form action="/adm/coursedocs" method="post" name="supnewsyl"> |
<input type="hidden" name="folderpath" value="$env{'form.folderpath'}" /> |
<input type="hidden" name="folderpath" value="$env{'form.folderpath'}" /> |
<input type=hidden name="importdetail" |
<input type="hidden" name="importdetail" |
value="Syllabus=/public/$coursedom/$coursenum/syllabus"> |
value="Syllabus=/public/$coursedom/$coursenum/syllabus" /> |
<nobr> |
<nobr> |
<input name="newsyl" type="submit" value="$lt{'syll'}" /> |
<input name="newsyl" type="submit" value="$lt{'syll'}" /> |
$help{'Syllabus'} |
$help{'Syllabus'} |
Line 2726 $help{'Syllabus'}
|
Line 2989 $help{'Syllabus'}
|
</form> |
</form> |
<br /><form action="/adm/coursedocs" method="post" name="subnewaboutme"> |
<br /><form action="/adm/coursedocs" method="post" name="subnewaboutme"> |
<input type="hidden" name="folderpath" value="$env{'form.folderpath'}" /> |
<input type="hidden" name="folderpath" value="$env{'form.folderpath'}" /> |
<input type=hidden name="importdetail" |
<input type="hidden" name="importdetail" |
value="$plainname=/adm/$udom/$uname/aboutme"> |
value="$plainname=/adm/$udom/$uname/aboutme" /> |
<nobr> |
<nobr> |
<input name="newaboutme" type="submit" value="$lt{'mypi'}" /> |
<input name="newaboutme" type="submit" value="$lt{'mypi'}" /> |
$help{'My Personal Info'} |
$help{'My Personal Info'} |