'."\n";
+ my %uploadedfiles;
+ &tiehash();
+ foreach my $file (&Apache::lonclonecourse::crsdirlist($origcrsid,'userfiles')) {
+ my ($ext)=($file=~/\.(\w+)$/);
+# FIXME Check supplemental here
+ my $title=$hash{'title_'.$hash{
+ 'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$file}};
+ if (!$title) {
+ $title=$file;
+ } else {
+ $title=~s|/|_|g;
+ }
+ $title=~s/\.(\w+)$//;
+ $title=&clean($title);
+ $title.='.'.$ext;
+# $r->print("\n
"
+ $uploadedfiles{$file} = $title;
+ }
+ &untiehash();
+ $r->print(&Apache::loncourserespicker::create_picker($navmap,'dumpdocs',$formname,$crstype,undef,
+ undef,undef,$preamble,$home,\%uploadedfiles));
+ }
}
$r->print(&endContentScreen());
}
+sub recurse_html {
+ my ($mm,$prefix,$currdirpath,$currurlpath,$container,$item,$replacehash,$deps) = @_;
+ return unless ((ref($replacehash) eq 'HASH') && (ref($deps) eq 'HASH'));
+ my (%allfiles,%codebase);
+ if (&Apache::lonnet::extract_embedded_items($currdirpath,\%allfiles,\%codebase) eq 'ok') {
+ if (keys(%allfiles)) {
+ foreach my $dependency (keys(%allfiles)) {
+ next if (($dependency =~ m{^/(res|adm)/}) || ($dependency =~ m{^https?://}));
+ my ($depurl,$relfile,$newcontainer);
+ if ($dependency =~ m{^/}) {
+ if ($dependency =~ m{^\Q$currurlpath/\E(.+)$}) {
+ $relfile = $1;
+ if ($dependency =~ m{^\Q$prefix\E(.+)$}) {
+ $newcontainer = $1;
+ next if ($replacehash->{$newcontainer});
+ }
+ $depurl = $dependency;
+ } else {
+ next;
+ }
+ } else {
+ $relfile = $dependency;
+ $depurl = $currurlpath;
+ $depurl =~ s{[^/]+$}{};
+ $depurl .= $dependency;
+ ($newcontainer) = ($depurl =~ m{^\Q$prefix\E(.+)$});
+ }
+ next if ($relfile eq '');
+ my $newname = $replacehash->{$container};
+ $newname =~ s{[^/]+$}{};
+ $replacehash->{$newcontainer} = $newname.$relfile;
+ $deps->{$item}{$newcontainer} = 1;
+ my ($newurlpath) = ($depurl =~ m{^(.*)/[^/]+$});
+ my $depfile = &Apache::lonnet::filelocation('',$depurl);
+ my $type = $mm->checktype_filename($depfile);
+ if ($type eq 'text/html') {
+ &recurse_html($mm,$prefix,$depfile,$newurlpath,$newcontainer,$item,$replacehash,$deps);
+ }
+ }
+ }
+ }
+ return;
+}
+
sub group_import {
my ($coursenum, $coursedom, $folder, $container, $caller, @files) = @_;
my ($donechk,$allmaps,%hierarchy,%titles,%addedmaps,%removefrommap,
@@ -402,6 +719,13 @@ END
}
my ($errtext,$fatal) =
&storemap($coursenum, $coursedom, $folder.'.'.$container,1);
+ unless ($fatal) {
+ if ($folder =~ /^supplemental/) {
+ &Apache::lonnet::get_numsuppfiles($coursenum,$coursedom,1);
+ my ($errtext,$fatal) = &mapread($coursenum,$coursedom,
+ $folder.'.'.$container);
+ }
+ }
return ($errtext,$fatal,$fixuperrors);
}
@@ -488,7 +812,7 @@ sub docs_change_log {
}
my $folderpath=$env{'form.folderpath'};
if ($folderpath eq '') {
- $folderpath = 'default&'.&escape(&mt('Main '.$crstype.' Content').':::::');
+ $folderpath = 'default&'.&escape(&mt('Main Content').':::::');
}
$pathitem = '';
@@ -700,7 +1024,7 @@ sub update_paste_buffer {
my $url = $env{'docs.markedcopy_url_'.$suffix};
if (($cid =~ /^$match_domain(?:_)$match_courseid$/) &&
($url ne '')) {
- $pasteurls{$cid.'_'.$url};
+ $pasteurls{$cid.'_'.$url} = 1;
}
}
}
@@ -764,6 +1088,7 @@ sub update_paste_buffer {
}
&Apache::lonnet::appenv(\%addtoenv);
delete($env{'form.markcopy'});
+ return;
}
sub recurse_uploaded_maps {
@@ -801,6 +1126,7 @@ sub print_paste_buffer {
my @currpaste = split(/,/,$env{'docs.markedcopies'});
my ($pasteitems,@pasteable);
+ my $clipboardcount = 0;
# Construct identifiers for current contents of user's paste buffer
foreach my $suffix (@currpaste) {
@@ -809,6 +1135,7 @@ sub print_paste_buffer {
my $url = $env{'docs.markedcopy_url_'.$suffix};
if (($cid =~ /^$match_domain\_$match_courseid$/) &&
($url ne '')) {
+ $clipboardcount ++;
my ($is_external,$othercourse,$fromsupp,$is_uploaded_map,$parent,
$canpaste,$nopaste,$othercrs,$areachange);
my $extension = (split(/\./,$env{'docs.markedcopy_url_'.$suffix}))[-1];
@@ -902,11 +1229,23 @@ sub print_paste_buffer {
$pasteitems .= '';
$form_start = '';
+ $buttons .= ''.(' 'x2);
+ if ($clipboardcount > 1) {
+ $buttons .=
+ ''.(' 'x20).''.(' 'x2).
+ ''.
+ (' 'x2).
+ ''.
+ (' 'x2);
+ }
+ $form_end = ''.
+ '';
} else {
$pasteitems = &mt('Clipboard is empty');
}
@@ -1060,6 +1399,24 @@ function validateClipboard() {
}
}
+function checkClipboard() {
+ if (document.pasteform.pasting.length > 1) {
+ for (var i=0; i1) {
+ for (var i=0; i{'src'};
+ $url = $dbref->{'src'};
if (ref($dbref) eq 'HASH') {
if ($url =~ m{/(smppg|bulletinboard)$}) {
my $prefix = $1;
@@ -1574,7 +1930,7 @@ sub dbcopy {
if ($prefix eq 'smppg') {
$errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a simple page [_1].',$url);
} else {
- $errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a bulletin board [_1].',$url);
+ $errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a discussion board [_1].',$url);
}
if ($error) {
$errtext .= ' '.$error;
@@ -1610,16 +1966,18 @@ sub dbcopy {
}
}
if (($freedlock ne 'ok') && (ref($lockerrorsref) eq 'HASH')) {
- $lockerrorsref->{$prefix} =
+ $lockerrorsref->{$prefix} =
'
'.
&mt('There was a problem removing a lockfile.');
if ($prefix eq 'smppg') {
- $lockerrorsref->{$prefix} .=
- &mt('This will prevent creation of additional simple pages in this course.');
+ $lockerrorsref->{$prefix} .=
+ ' '.&mt('This will prevent creation of additional simple pages in this course.');
} else {
- $lockerrorsref->{$prefix} .= &mt('This will prevent creation of additional bulletin boards in this course.');
+ $lockerrorsref->{$prefix} .= ' '.&mt('This will prevent creation of additional discussion boards in this course.');
}
- $lockerrorsref->{$prefix} .= &mt('Please contact the domain coordinator for your LON-CAPA domain.').'
'
- .&mt('Currently no documents.')
+ .&mt('Currently empty')
.'
'
}
}
@@ -2802,8 +3160,33 @@ sub multiple_check_form {
}
sub process_file_upload {
- my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase,$uploadcmd) = @_;
+ my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase,$uploadcmd,$crstype) = @_;
# upload a file, if present
+ my $filesize = length($env{'form.uploaddoc'});
+ if (!$filesize) {
+ $$upload_output = '
'.
+ &mt('Unable to upload [_1]. (size = [_2] bytes)',
+ ''.$env{'form.uploaddoc.filename'}.'',
+ $filesize).' '.
+ &mt('Either the file you attempted to upload was empty, or your web browser was unable to read its contents.').' '.
+ '
';
}
@@ -3651,8 +4035,8 @@ sub list_symbs {
sub verifycontent {
my ($r) = @_;
my $crstype = &Apache::loncommon::course_type();
- $r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Documents'));
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Documents'));
+ $r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Content'));
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Content'));
$r->print(&startContentScreen('tools'));
$r->print('
'.&mt($crstype.' content verification').'
');
$hashtied=0;
@@ -3688,8 +4072,8 @@ sub devalidateversioncache {
sub checkversions {
my ($r) = @_;
my $crstype = &Apache::loncommon::course_type();
- $r->print(&Apache::loncommon::start_page("Check $crstype Document Versions"));
- $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Document Versions"));
+ $r->print(&Apache::loncommon::start_page("Check $crstype Resource Versions"));
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Resource Versions"));
$r->print(&startContentScreen('tools'));
my $header='';
@@ -3754,7 +4138,7 @@ sub checkversions {
&changewarning($r,'');
if ($env{'form.timerange'} eq 'all') {
# show all documents
- $header=&mt('All Documents in '.$crstype);
+ $header=&mt('All content in '.$crstype);
$allsel=' selected="selected"';
foreach my $key (keys(%hash)) {
if ($key=~/^ids\_(\/res\/.+)$/) {
@@ -3845,10 +4229,30 @@ $lt{'sc'}:
$lt{'vers'}
-
ENDHEADERS
#number of columns for version history
+ my %changedbytime;
+ foreach my $key (keys(%changes)) {
+ #excludes not versionable problems from resource version history:
+ next if ($key =~ /^\/res\/lib\/templates/);
+ my $chg;
+ if ($env{'form.timerange'} eq 'all') {
+ my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);
+ $chg = &Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate');
+ } else {
+ $chg = $changes{$key};
+ next if ($chg < $starttime);
+ }
+ push(@{$changedbytime{$chg}},$key);
+ }
+ if (keys(%changedbytime) == 0) {
+ &untiehash();
+ $r->print(&mt('No content changes in imported content in specified time frame').
+ &endContentScreen());
+ return;
+ }
$r->print(
+ ''.
&Apache::loncommon::start_data_table().
&Apache::loncommon::start_data_table_header_row().
'
'.&mt('Resources').'
'.
@@ -3858,26 +4262,25 @@ ENDHEADERS
'
'.&mt('History').'
'.
&Apache::loncommon::end_data_table_header_row()
);
- foreach my $key (sort(keys(%changes))) {
- #excludes not versionable problems from resource version history:
- next unless ($changes{$key}>$starttime && $key !~ /^\/res\/lib\/templates/);
- my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);
- my $currentversion=&Apache::lonnet::getversion($key);
- if ($currentversion<0) {
- $currentversion=''.&mt('Could not be determined.').'';
- }
- my $linkurl=&Apache::lonnet::clutter($key);
- $r->print(
- &Apache::loncommon::start_data_table_row().
- '
'
- );
- # Used in course
- my $usedversion=$hash{'version_'.$linkurl};
- if (($usedversion) && ($usedversion ne 'mostrecent')) {
+ foreach my $chg (sort {$b <=> $a } keys(%changedbytime)) {
+ foreach my $key (sort(@{$changedbytime{$chg}})) {
+ my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);
+ my $currentversion=&Apache::lonnet::getversion($key);
+ if ($currentversion<0) {
+ $currentversion=''.&mt('Could not be determined.').'';
+ }
+ my $linkurl=&Apache::lonnet::clutter($key);
+ $r->print(
+ &Apache::loncommon::start_data_table_row().
+ '