'."\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(&mt('Searching ...').' ');
+ $r->rflush();
+# Input form
+ $r->print('');
}
$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,
@@ -656,8 +340,10 @@ sub group_import {
}
my $initialtext = &mt('Replace with your own content.');
my $newhtml = <
+
+
+
$name
@@ -666,7 +352,7 @@ $initialtext
END
$env{'form.output'}=$newhtml;
- my $result =
+ my $result =
&Apache::lonnet::finishuserfileupload($coursenum,$coursedom,
'output',
"$filepath/$residx/$fname.html");
@@ -691,7 +377,7 @@ END
removefrommap => \%removefrommap,
removeparam => \%removeparam,
);
- my ($result,$msgsarray,$lockerror) =
+ my ($result,$msgsarray,$lockerror) =
&apply_fixups($folder,1,$coursedom,$coursenum,\%import_errors,\%updated);
if (keys(%import_errors) > 0) {
$fixuperrors =
@@ -718,13 +404,6 @@ 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);
}
@@ -811,7 +490,7 @@ sub docs_change_log {
}
my $folderpath=$env{'form.folderpath'};
if ($folderpath eq '') {
- $folderpath = 'default&'.&escape(&mt('Main Content').':::::');
+ $folderpath = 'default&'.&escape(&mt('Main '.$crstype.' Content').':::::');
}
$pathitem = '';
@@ -1023,7 +702,7 @@ sub update_paste_buffer {
my $url = $env{'docs.markedcopy_url_'.$suffix};
if (($cid =~ /^$match_domain(?:_)$match_courseid$/) &&
($url ne '')) {
- $pasteurls{$cid.'_'.$url} = 1;
+ $pasteurls{$cid.'_'.$url};
}
}
}
@@ -1387,6 +1066,7 @@ END
}
+
sub do_paste_from_buffer {
my ($coursenum,$coursedom,$folder,$container,$errors) = @_;
@@ -1420,7 +1100,8 @@ sub do_paste_from_buffer {
}
my (%msgs,%before,%after,@dopaste,%is_map,%notinsupp,%notincrs,%duplicate,
- %prefixchg,%srcdom,%srcnum,%marktomove,$save_err,$lockerrors,$allresult);
+ %prefixchg,%srcdom,%srcnum,%marktomove,$save_err,$lockerrors,$allresult,
+ %msgs);
foreach my $suffix (@topaste) {
my $url=&LONCAPA::map::qtescape($env{'docs.markedcopy_url_'.$suffix});
@@ -1621,7 +1302,7 @@ sub do_paste_from_buffer {
if ($prefix eq 'smppg') {
$msg = &mt('Paste failed: An error occurred when copying the simple page.').' '.$errtext;
} elsif ($prefix eq 'bulletinboard') {
- $msg = &mt('Paste failed: An error occurred when copying the discussion board.').' '.$errtext;
+ $msg = &mt('Paste failed: An error occurred when copying the bulletin board.').' '.$errtext;
}
$results{$suffix} = $result;
$msgerrs{$suffix} = $msg;
@@ -1629,7 +1310,7 @@ sub do_paste_from_buffer {
next;
}
if ($lockerr{$prefix}) {
- $lockerrs{$suffix} = $lockerr{$prefix};
+ $lockerrs{$suffix} = $lockerr{$prefix};
}
}
}
@@ -1668,7 +1349,7 @@ sub do_paste_from_buffer {
if ($newdocsdir eq '') {
$newdocsdir = 'default';
}
- if (($prefixchg{$suffix}) ||
+ if (($prefixchg{$suffix}) ||
($srcdom{$suffix} ne $coursedom) ||
($srcnum{$suffix} ne $coursenum) ||
($env{'form.docs.markedcopy_options_'.$suffix} ne 'move')) {
@@ -1871,11 +1552,11 @@ sub get_newmap_url {
sub dbcopy {
my ($dbref,$coursedom,$coursenum,$lockerrorsref) = @_;
my ($url,$result,$errtext);
- $url = $dbref->{'src'};
+ my $url = $dbref->{'src'};
if (ref($dbref) eq 'HASH') {
if ($url =~ m{/(smppg|bulletinboard)$}) {
my $prefix = $1;
- if (($dbref->{'cdom'} =~ /^$match_domain$/) &&
+ if (($dbref->{'cdom'} =~ /^$match_domain$/) &&
($dbref->{'cnum'} =~ /^$match_courseid$/)) {
my $db_name;
my $marker = (split(m{/},$url))[4];
@@ -1896,7 +1577,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 discussion board [_1].',$url);
+ $errtext = &mt('Failed to acquire a unique timestamp-based suffix when copying a bulletin board [_1].',$url);
}
if ($error) {
$errtext .= ' '.$error;
@@ -1910,12 +1591,12 @@ sub dbcopy {
my $photo = $contents{'uploaded.photourl'};
my ($subdir,$fname) =
($photo =~ m{^/uploaded/$match_domain/$match_courseid/+(bulletin|simplepage)/(?:|\d+/)([^/]+)$});
- my $newphoto;
+ my $newphoto;
if ($fname ne '') {
my $content = &Apache::lonnet::getfile($photo);
unless ($content eq '-1') {
$env{'form.'.$suffix.'.photourl'} = $content;
- $newphoto =
+ $newphoto =
&Apache::lonnet::finishuserfileupload($coursenum,$coursedom,$suffix.'.photourl',"$subdir/$suffix/$fname");
delete($env{'form.'.$suffix.'.photourl'});
}
@@ -1932,18 +1613,16 @@ 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 discussion boards in this course.');
+ $lockerrorsref->{$prefix} .= &mt('This will prevent creation of additional bulletin boards in this course.');
}
- $lockerrorsref->{$prefix} .= ' '.&mt('Please contact the [_1]helpdesk[_2] for assistance.',
- '','').
- '
';
+ $lockerrorsref->{$prefix} .= &mt('Please contact the domain coordinator for your LON-CAPA domain.').'';
}
}
} elsif ($url =~ m{/syllabus$}) {
@@ -2060,7 +1739,7 @@ sub url_paste_fixups {
}
next if ($token->[2]->{'type'} eq 'external');
if ($token->[2]->{'type'} eq 'zombie') {
- next if ($skip);
+ next if ($skip);
$zombies->{$oldurl}{$id} = $ressrc;
$changed = 1;
} elsif ($ressrc =~ m{^/uploaded/($match_domain)/($match_courseid)/(.+)$}) {
@@ -2506,7 +2185,7 @@ sub update_parameter {
'randomorder' => {},
);
foreach my $which (keys(%allchecked)) {
- $env{'form.all'.$which} =~ s/,$//;
+ $env{'form.all'.$which} =~ s/,$//;
if ($which eq 'randompick') {
foreach my $item (split(/,/,$env{'form.all'.$which})) {
my ($res,$value) = split(/:/,$item);
@@ -2533,7 +2212,7 @@ sub update_parameter {
foreach my $which (keys(%allchecked)) {
if (($which eq 'randompick' || $which eq 'randomorder')) {
next if (!$is_map);
- }
+ }
my $oldvalue = 0;
my $newvalue = 0;
if ($allchecked{$which}{$res}) {
@@ -2591,9 +2270,7 @@ sub update_parameter {
sub handle_edit_cmd {
my ($coursenum,$coursedom) =@_;
- if ($env{'form.cmd'} eq '') {
- return 0;
- }
+ return if ($env{'form.cmd'} eq '');
my ($cmd,$idx)=split('_',$env{'form.cmd'});
my $ratstr = $LONCAPA::map::resources[$LONCAPA::map::order[$idx]];
@@ -2654,7 +2331,7 @@ sub editor {
my $jumpto;
unless ($supplementalflag) {
- $jumpto = "uploaded/$coursedom/$coursenum/$folder.$container";
+ $jumpto = "'uploaded/$coursedom/$coursenum/$folder.$container'";
}
unless ($allowed) {
@@ -2921,13 +2598,9 @@ sub editor {
my ($to_show,$output,@allidx,@allmapidx,%filters,%lists,%curr_groups);
%filters = (
- canremove => [],
- cancut => [],
- cancopy => [],
- hiddenresource => [],
- encrypturl => [],
- randomorder => [],
- randompick => [],
+ canremove => [],
+ cancut => [],
+ cancopy => [],
);
%curr_groups = &Apache::longroup::coursegroups();
&Apache::loncommon::start_data_table_count(); #setup a row counter
@@ -2952,9 +2625,7 @@ sub editor {
my $need_save;
if (($allowed) || ($supplementalflag && $folder eq 'supplemental')) {
- my $toolslink;
- if ($allowed || &Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
- $toolslink = '
'
- .&mt('Currently empty')
+ .&mt('Currently no documents.')
.'
'
}
}
@@ -3108,11 +2774,7 @@ sub multiple_check_form {
'';
if ($caller eq 'settings') {
$output .=
- ''."\n".
- ''."\n".
- ''."\n".
- ''."\n".
- ''."\n";
+ '';
} elsif ($caller eq 'actions') {
$output .=
''.
@@ -3126,30 +2788,8 @@ sub multiple_check_form {
}
sub process_file_upload {
- my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase,$uploadcmd,$crstype) = @_;
+ my ($upload_output,$coursenum,$coursedom,$allfiles,$codebase,$uploadcmd) = @_;
# 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.').' '.
- '
@@ -3582,9 +3222,6 @@ END
my $rpckchk;
if ($rpicknum) {
$rpckchk = ' checked="checked"';
- if (($ishash) && (ref($filtersref->{'randompick'}) eq 'ARRAY')) {
- push(@{$filtersref->{'randompick'}},$orderidx.':'.$rpicknum);
- }
}
my $formname = 'edit_randompick_'.$orderidx;
$rand_pick_text =
@@ -3597,20 +3234,15 @@ $form_common."\n".
}
$rand_pick_text .= ''.
$form_end;
- my $ro_set;
- if ((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i) {
- $ro_set = 'checked="checked"';
- if (($ishash) && (ref($filtersref->{'randomorder'}) eq 'ARRAY')) {
- push(@{$filtersref->{'randomorder'}},$orderidx);
- }
- }
- $formname = 'edit_rorder_'.$orderidx;
+ my $ro_set=
+ ((&LONCAPA::map::getparameter($orderidx,'parameter_randomorder'))[0]=~/^yes$/i?' checked="checked"':'');
+ my $formname = 'edit_rorder_'.$orderidx;
$rand_order_text =
'
';
}
@@ -3996,8 +3618,8 @@ sub list_symbs {
sub verifycontent {
my ($r) = @_;
my $crstype = &Apache::loncommon::course_type();
- $r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Content'));
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Content'));
+ $r->print(&Apache::loncommon::start_page('Verify '.$crstype.' Documents'));
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('Verify '.$crstype.' Documents'));
$r->print(&startContentScreen('tools'));
$r->print('
'.&mt($crstype.' content verification').'
');
$hashtied=0;
@@ -4033,8 +3655,8 @@ sub devalidateversioncache {
sub checkversions {
my ($r) = @_;
my $crstype = &Apache::loncommon::course_type();
- $r->print(&Apache::loncommon::start_page("Check $crstype Resource Versions"));
- $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Resource Versions"));
+ $r->print(&Apache::loncommon::start_page("Check $crstype Document Versions"));
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs("Check $crstype Document Versions"));
$r->print(&startContentScreen('tools'));
my $header='';
@@ -4099,7 +3721,7 @@ sub checkversions {
&changewarning($r,'');
if ($env{'form.timerange'} eq 'all') {
# show all documents
- $header=&mt('All content in '.$crstype);
+ $header=&mt('All Documents in '.$crstype);
$allsel=' selected="selected"';
foreach my $key (keys(%hash)) {
if ($key=~/^ids\_(\/res\/.+)$/) {
@@ -4190,30 +3812,10 @@ $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').'
'.
@@ -4223,25 +3825,26 @@ ENDHEADERS
'
'.&mt('History').'
'.
&Apache::loncommon::end_data_table_header_row()
);
- 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().
- '
'
- );
- # Used in course
- my $usedversion=$hash{'version_'.$linkurl};
- if (($usedversion) && ($usedversion ne 'mostrecent')) {
+ 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().
+ '