'."\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,
@@ -657,8 +340,10 @@ sub group_import {
}
my $initialtext = &mt('Replace with your own content.');
my $newhtml = <
+
+
+
$name
@@ -667,7 +352,7 @@ $initialtext
END
$env{'form.output'}=$newhtml;
- my $result =
+ my $result =
&Apache::lonnet::finishuserfileupload($coursenum,$coursedom,
'output',
"$filepath/$residx/$fname.html");
@@ -692,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 =
@@ -719,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);
}
@@ -812,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 = '';
@@ -977,7 +655,7 @@ sub docs_change_log {
sub update_paste_buffer {
my ($coursenum,$coursedom,$folder) = @_;
- my (@possibles,%removals,%cuts,$output);
+ my (@possibles,%removals,%cuts);
if ($env{'form.multiremove'}) {
$env{'form.multiremove'} =~ s/,$//;
map { $removals{$_} = 1; } split(/,/,$env{'form.multiremove'});
@@ -1024,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};
}
}
}
@@ -1045,12 +723,10 @@ sub update_paste_buffer {
next if (exists($pasteurls{$coursedom.'_'.$coursenum.'_'.$url}));
my ($suffix,$errortxt,$locknotfreed) =
&new_timebased_suffix($env{'user.domain'},$env{'user.name'},'paste');
- if ($suffix ne '') {
- push(@newpaste,$suffix);
- } else {
- if ($locknotfreed) {
- return $locknotfreed;
- }
+ push(@newpaste,$suffix);
+ if ($locknotfreed) {
+ return $locknotfreed;
+ last;
}
if (&is_supplemental_title($title)) {
&Apache::lonnet::appenv({'docs.markedcopy_supplemental_'.$suffix => $title});
@@ -1084,17 +760,12 @@ sub update_paste_buffer {
}
}
}
- if ($locknotfreed) {
- $output = $locknotfreed;
- last;
- }
}
if (@newpaste) {
$addtoenv{'docs.markedcopies'} = join(',',(@currpaste,@newpaste));
}
&Apache::lonnet::appenv(\%addtoenv);
delete($env{'form.markcopy'});
- return $output;
}
sub recurse_uploaded_maps {
@@ -1132,7 +803,6 @@ 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) {
@@ -1141,7 +811,6 @@ 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];
@@ -1197,14 +866,10 @@ sub print_paste_buffer {
$icon = &Apache::loncommon::lonhttpdurl($r->dir_config('lonIconsURL'));
$icon .= '/navmap.folder.closed.gif';
}
- my $title = $env{'docs.markedcopy_title_'.$suffix};
- if ($title eq '') {
- ($title) = ($url =~ m{/([^/]+)$});
- }
$buffer = ''.
': '.
&Apache::loncommon::parse_supplemental_title(
- &LONCAPA::map::qtescape($title));
+ &LONCAPA::map::qtescape($env{'docs.markedcopy_title_'.$suffix}));
}
$pasteitems .= '
';
my ($options,$onclick);
@@ -1239,23 +904,11 @@ sub print_paste_buffer {
$pasteitems .= '';
$form_start = '';
+ $buttons .= ''.
+ '';
+ $form_end = '';
} else {
$pasteitems = &mt('Clipboard is empty');
}
@@ -1409,24 +1062,6 @@ function validateClipboard() {
}
}
-function checkClipboard() {
- if (document.pasteform.pasting.length > 1) {
- for (var i=0; i1) {
- for (var i=0; i{'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];
@@ -1940,7 +1576,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;
@@ -1954,12 +1590,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'});
}
@@ -1976,18 +1612,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$}) {
@@ -2104,7 +1738,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)/(.+)$}) {
@@ -2550,7 +2184,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);
@@ -2577,7 +2211,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}) {
@@ -2613,45 +2247,26 @@ sub update_parameter {
}
return $haschanges;
} else {
- my $haschanges = 0;
- return $haschanges if ($env{'form.changeparms'} !~ /^($valid_parameters_re)$/);
+ return 0 if ($env{'form.changeparms'} !~ /^($valid_parameters_re)$/);
my $which = $env{'form.changeparms'};
my $idx = $env{'form.setparms'};
- my $oldvalue = 0;
- my $newvalue = 0;
- my $current = (&LONCAPA::map::getparameter($idx,'parameter_'.$which))[0];
- if ($which eq 'randompick') {
- if ($current =~ /^(\d+)$/) {
- $oldvalue = $1;
- }
- } elsif ($current =~ /^yes$/i) {
- $oldvalue = 1;
- }
if ($env{'form.'.$which.'_'.$idx}) {
- $newvalue = ($which eq 'randompick') ? $env{'form.rpicknum_'.$idx}
- : 1;
- }
- if ($oldvalue ne $newvalue) {
- $haschanges = 1;
- if ($newvalue) {
- my $storeval = 'yes';
- if ($which eq 'randompick') {
- $storeval = $newvalue;
- }
- &LONCAPA::map::storeparameter($idx, 'parameter_'.$which, $storeval,
- $parameter_type{$which});
- &remember_parms($idx,$which,'set',$storeval);
- } else {
- &LONCAPA::map::delparameter($idx,'parameter_'.$which);
- &remember_parms($idx,$which,'del');
- }
+ my $value = ($which eq 'randompick') ? $env{'form.rpicknum_'.$idx}
+ : 'yes';
+ &LONCAPA::map::storeparameter($idx, 'parameter_'.$which, $value,
+ $parameter_type{$which});
+ &remember_parms($idx,$which,'set',$value);
+ } else {
+ &LONCAPA::map::delparameter($idx,'parameter_'.$which);
+
+ &remember_parms($idx,$which,'del');
}
- return $haschanges;
+ return 1;
}
- return;
}
+
sub handle_edit_cmd {
my ($coursenum,$coursedom) =@_;
if ($env{'form.cmd'} eq '') {
@@ -2717,7 +2332,7 @@ sub editor {
my $jumpto;
unless ($supplementalflag) {
- $jumpto = "uploaded/$coursedom/$coursenum/$folder.$container";
+ $jumpto = "'uploaded/$coursedom/$coursenum/$folder.$container'";
}
unless ($allowed) {
@@ -2743,7 +2358,7 @@ sub editor {
&snapshotbefore();
if (&update_parameter()) {
- ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container,1);
+ ($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container);
return $errtext if ($fatal);
}
@@ -2807,7 +2422,7 @@ sub editor {
# Rename, cut, copy or remove a single resource
if (&handle_edit_cmd()) {
my $contentchg;
- if ($env{'form.cmd'} =~ m{^(remove|cut)_}) {
+ if ($env{'form.cmd'} =~ m{^(del|cut)_}) {
$contentchg = 1;
}
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container,$contentchg);
@@ -2839,7 +2454,7 @@ sub editor {
my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$res]);
$name=&LONCAPA::map::qtescape($name);
$url=&LONCAPA::map::qtescape($url);
- next unless $url;
+ next unless ($name && $url);
my %denied =
&action_restrictions($coursenum,$coursedom,$url,
$env{'form.folderpath'},\%curr_groups);
@@ -3055,11 +2670,11 @@ sub editor {
if (@allidx > 0) {
my $path;
if ($env{'form.folderpath'}) {
- $path =
+ $path =
&HTML::Entities::encode($env{'form.folderpath'},'<>&"');
}
if (@allidx > 1) {
- $to_show .=
+ $to_show .=
&Apache::loncommon::continue_data_table_row().
'
'
- .&mt('Currently empty')
+ .&mt('Currently no documents.')
.'
'
}
}
@@ -3189,33 +2804,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.').' '.
- '