'.
@@ -1096,7 +1091,18 @@ sub docs_change_log {
&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'});
@@ -1143,7 +1149,7 @@ sub docs_change_log {
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) {
+ if ($oldname ne '' && $oldname ne $newname) {
$r->print(&LONCAPA::map::qtescape($newname));
}
}
@@ -1173,31 +1179,79 @@ sub docs_change_log {
|| $shown<=$env{'form.show'})) { last; }
}
$r->print(&Apache::loncommon::end_data_table());
- $r->print(&Apache::loncommon::end_page());
+}
+
+sub update_paste_buffer {
+ my ($coursenum,$coursedom) = @_;
+
+ return if (!defined($env{'form.markcopy'}));
+ return if (!defined($env{'form.copyfolder'}));
+ return if ($env{'form.markcopy'} < 0);
+
+ my ($errtext,$fatal) = &mapread($coursenum,$coursedom,
+ $env{'form.copyfolder'});
+
+ return if ($fatal);
+
+# Mark for copying
+ my ($title,$url)=split(':',$LONCAPA::map::resources[$LONCAPA::map::order[$env{'form.markcopy'}]]);
+ if (&is_supplemental_title($title)) {
+ ($title) = &parse_supplemental_title($title);
+ }
+ &Apache::lonnet::appenv('docs.markedcopy_title' => $title,
+ 'docs.markedcopy_url' => $url);
+ delete($env{'form.markcopy'});
+}
+
+sub print_paste_buffer {
+ my ($r,$container) = @_;
+ return if (!defined($env{'docs.markedcopy_url'}));
+
+ $r->print(<');
}
sub editor {
- my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output)=@_;
+ my ($r,$coursenum,$coursedom,$folder,$allowed,$upload_output,$which)=@_;
my $errtext='';
my $fatal=0;
my $container='sequence';
if ($env{'form.pagepath'}) {
$container='page';
}
- ($errtext,$fatal)=
- &mapread($coursenum,$coursedom,$folder.'.'.$container);
+ ($errtext,$fatal) = &mapread($coursenum,$coursedom,$folder.'.'.$container);
if ($#LONCAPA::map::order<1) {
my $idx=&LONCAPA::map::getresidx();
if ($idx<=0) { $idx=1; }
$LONCAPA::map::order[0]=$idx;
$LONCAPA::map::resources[$idx]='';
}
- if (defined($env{'form.markcopy'})) {
-# Mark for copying
- my ($title,$url)=split(':',$LONCAPA::map::resources[$LONCAPA::map::order[$env{'form.markcopy'}]]);
- $env{'form.markedcopy_title'}=$title;
- $env{'form.markedcopy_url'}=$url;
- }
+
my ($breadcrumbtrail,$randompick,$ishidden,$isencrypted,$plain)=&breadcrumbs($folder);
$r->print($breadcrumbtrail);
if ($fatal) {
@@ -1212,27 +1266,33 @@ sub editor {
if ($env{'form.changeparms'}) {
my $idx=$env{'form.setparms'};
# set parameters
- if ($env{'form.randpick_'.$idx}) {
- &LONCAPA::map::storeparameter($idx,'parameter_randompick',$env{'form.randpick_'.$idx},'int_pos');
- &remember_parms($idx,'randompick','set',$env{'form.randpick_'.$idx});
- } else {
- &LONCAPA::map::delparameter($idx,'parameter_randompick');
- &remember_parms($idx,'randompick','del');
+ if ($env{'form.changeparms'} eq 'randompick') {
+ if ($env{'form.randpick_'.$idx}) {
+ &LONCAPA::map::storeparameter($idx,'parameter_randompick',$env{'form.randpick_'.$idx},'int_pos');
+ &remember_parms($idx,'randompick','set',$env{'form.randpick_'.$idx});
+ } else {
+ &LONCAPA::map::delparameter($idx,'parameter_randompick');
+ &remember_parms($idx,'randompick','del');
+ }
+ }
+ if ($env{'form.changeparms'} eq 'hiddenresource') {
+ if ($env{'form.hidprs_'.$idx}) {
+ &LONCAPA::map::storeparameter($idx,'parameter_hiddenresource','yes','string_yesno');
+ &remember_parms($idx,'hiddenresource','set',$env{'form.hidprs_'.$idx});
+ } else {
+ &LONCAPA::map::delparameter($idx,'parameter_hiddenresource');
+ &remember_parms($idx,'hiddenresource','del');
+ }
+ }
+ if ($env{'form.changeparms'} eq 'encrypturl') {
+ if ($env{'form.encprs_'.$idx}) {
+ &LONCAPA::map::storeparameter($idx,'parameter_encrypturl','yes','string_yesno');
+ &remember_parms($idx,'encrypturl','set',$env{'form.encprs_'.$idx});
+ } else {
+ &LONCAPA::map::delparameter($idx,'parameter_encrypturl');
+ &remember_parms($idx,'encrypturl','del');
+ }
}
- if ($env{'form.hidprs_'.$idx}) {
- &LONCAPA::map::storeparameter($idx,'parameter_hiddenresource','yes','string_yesno');
- &remember_parms($idx,'hiddenresource','set',$env{'form.hidprs_'.$idx});
- } else {
- &LONCAPA::map::delparameter($idx,'parameter_hiddenresource');
- &remember_parms($idx,'hiddenresource','del');
- }
- if ($env{'form.encprs_'.$idx}) {
- &LONCAPA::map::storeparameter($idx,'parameter_encrypturl','yes','string_yesno');
- &remember_parms($idx,'encrypturl','set',$env{'form.encprs_'.$idx});
- } else {
- &LONCAPA::map::delparameter($idx,'parameter_encrypturl');
- &remember_parms($idx,'encrypturl','del');
- }
# store the changed version
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container);
if ($fatal) {
@@ -1280,11 +1340,11 @@ sub editor {
return;
}
}
-
+
if ($env{'form.pastemarked'}) {
# paste resource to end of list
- my $url=$env{'form.markedcopy_url'};
- my $title=$env{'form.markedcopy_title'};
+ my $url=$env{'docs.markedcopy_url'};
+ my $title=$env{'docs.markedcopy_title'};
# Maps need to be copied first
if (($url=~/\.(page|sequence)$/) || ($url=~/^\/uploaded\//)) {
$title=&mt('Copy of').' '.$title;
@@ -1292,18 +1352,16 @@ sub editor {
$url=~/^(.+)\.(\w+)$/;
my $newurl=$1.$newid.'.'.$2;
my $storefn=$newurl;
- $storefn=~s/^\/\w+\/\w+\/\w+\///;
+ $storefn=~s{^/\w+/$match_domain/$match_username/}{};
&Apache::lonclonecourse::writefile
($env{'request.course.id'},$storefn,
&Apache::lonnet::getfile($url));
$url=$newurl;
}
- $title=~s/\\<\;/g;
- $title=~s/\>/\>\;/g;
- $title=~s/\:/\:/g;
+ $title = &LONCAPA::map::qtunescape($title);
my $ext='false';
if ($url=~/^http\:\/\//) { $ext='true'; }
- $url=~s/\:/\:/g;
+ $url = &LONCAPA::map::qtunescape($url);
# Now insert the URL at the bottom
my $newidx=&LONCAPA::map::getresidx($url);
$LONCAPA::map::resources[$newidx]=
@@ -1355,19 +1413,14 @@ sub editor {
my $ratstr = $LONCAPA::map::resources[$LONCAPA::map::order[$idx]];
my ($rtitle,@rrest)=split(/\:/,
$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]);
- my $comment=
- &HTML::Entities::decode($env{'form.title'});
- $comment=~s/\\<\;/g;
- $comment=~s/\>/\>\;/g;
- $comment=~s/\:/\:/g;
+ my $comment=$env{'form.title'};
+ $comment = &LONCAPA::map::qtunescape($comment);
if ($comment=~/\S/) {
$LONCAPA::map::resources[$LONCAPA::map::order[$idx]]=
$comment.':'.join(':',@rrest);
}
# Devalidate title cache
- my $renamed_url=$rrest[0];
-# Has the :-escaping
- $renamed_url=~s/\&colon\;/\:/g;
+ my $renamed_url=&LONCAPA::map::qtescape($rrest[0]);
&Apache::lonnet::devalidate_title_cache($renamed_url);
}
# Store the changed version
@@ -1419,7 +1472,7 @@ sub editor {
}
}
&log_differences($plain);
- }
+ }
# ---------------------------------------------------------------- End commands
# ---------------------------------------------------------------- Print screen
my $idx=0;
@@ -1435,13 +1488,14 @@ sub editor {
$r->print('
'.&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.').'