';
}
sub exportcourse {
@@ -379,7 +380,7 @@ sub exportcourse {
}
$display .= ' />'."\n";
for (my $i=0; $i<$depth; $i++) {
- $display .= ''."\n";
+ $display .= ''."\n";
}
if ($curRes->is_sequence()) {
$display .= ' '."\n";
@@ -958,12 +959,6 @@ sub breadcrumbs {
my $folderpath;
my $cpinfo='';
my $plain='';
- if ($env{'form.markedcopy_url'}) {
- $cpinfo='&markedcopy_url='.
- &escape($env{'form.markedcopy_url'}).
- '&markedcopy_title='.
- &escape($env{'form.markedcopy_title'});
- }
my $randompick=-1;
my $isencrypted=0;
my $ishidden=0;
@@ -1187,32 +1182,81 @@ sub docs_change_log {
$r->print(&Apache::loncommon::end_data_table());
}
+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) {
- $r->print('
'.$errtext.'
');
+ $r->print('
'.$errtext.'
');
} else {
# ------------------------------------------------------------ Process commands
@@ -1253,7 +1297,7 @@ sub editor {
# store the changed version
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container);
if ($fatal) {
- $r->print('
'.$errtext.'
');
+ $r->print('
'.$errtext.'
');
return;
}
}
@@ -1293,15 +1337,15 @@ sub editor {
# store the changed version
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container);
if ($fatal) {
- $r->print('
'.$errtext.'
');
+ $r->print('
'.$errtext.'
');
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;
@@ -1327,7 +1371,7 @@ sub editor {
# Store the result
($errtext,$fatal)=&storemap($coursenum,$coursedom,$folder.'.'.$container);
if ($fatal) {
- $r->print('
'.$errtext.'
');
+ $r->print('
'.$errtext.'
');
return;
}
@@ -1384,7 +1428,7 @@ sub editor {
($errtext,$fatal)=&storemap($coursenum,$coursedom,
$folder.'.'.$container);
if ($fatal) {
- $r->print('
'.$errtext.'
');
+ $r->print('
'.$errtext.'
');
return;
}
}
@@ -1404,7 +1448,7 @@ sub editor {
($errtext,$fatal)=&group_import($coursenum, $coursedom, $folder,
$container,'londocs',@imports);
if ($fatal) {
- $r->print('
'.$errtext.'
');
+ $r->print('
'.$errtext.'
');
return;
}
}
@@ -1421,15 +1465,16 @@ sub editor {
($errtext,$fatal)=&storemap($coursenum,$coursedom,
$folder.'.'.$container);
if ($fatal) {
- $r->print('
'.$errtext.'
');
+ $r->print('
'.$errtext.'
');
return;
}
} else {
- $r->print('
'.&mt('No map selected.').'
');
+ $r->print('
'.&mt('No map selected.').'
');
+
}
}
&log_differences($plain);
- }
+ }
# ---------------------------------------------------------------- End commands
# ---------------------------------------------------------------- Print screen
my $idx=0;
@@ -1460,37 +1505,9 @@ sub editor {
$r->print('
';
return 'failed';
} else {
if ($parseaction eq 'parse') {
@@ -1562,7 +1579,7 @@ sub process_file_upload {
if ($total_embedded > 0) {
my $num = 0;
my $state = '
-
+
@@ -1650,22 +1667,52 @@ sub process_secondary_uploads {
return $filename;
}
+sub is_supplemental_title {
+ my ($title) = @_;
+ return scalar($title =~ m/^(\d+)___&&&___($match_username)___&&&___($match_domain)___&&&___(.*)$/);
+}
+
+sub parse_supplemental_title {
+ my ($title) = @_;
+
+ my ($foldertitle,$renametitle);
+ if ($title =~ /&&&/) {
+ $title = &HTML::Entites::decode($title);
+ }
+ if ($title =~ m/^(\d+)___&&&___($match_username)___&&&___($match_domain)___&&&___(.*)$/) {
+ $renametitle=$4;
+ my ($time,$uname,$udom) = ($1,$2,$3);
+ $foldertitle=&Apache::lontexconvert::msgtexconverted($4);
+ my $name = &Apache::loncommon::plainname($uname,$udom);
+ $name = &HTML::Entities::encode($name,'"<>&\'');
+ $title=''.&Apache::lonlocal::locallocaltime($time).' '.
+ $name.': '.$foldertitle;
+ }
+ if (wantarray) {
+ return ($title,$foldertitle,$renametitle);
+ }
+ return $title;
+}
+
# --------------------------------------------------------------- An entry line
sub entryline {
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_;
- $title=&HTML::Entities::encode($title,'"<>&\'');
- my $renametitle=$title;
- my $foldertitle=$title;
- my $pagetitle=$title;
- my $orderidx=$LONCAPA::map::order[$index];
- if ($title=~ /^(\d+)___&&&___($match_username)___&&&___($match_domain)___&&&___(.*)$/ ) {
- $foldertitle=&Apache::lontexconvert::msgtexconverted($4);
- $renametitle=$4;
- $title=''.&Apache::lonlocal::locallocaltime($1).' '.
- &Apache::loncommon::plainname($2,$3).': '.
- $foldertitle;
+
+ my ($foldertitle,$pagetitle,$renametitle);
+ if (&is_supplemental_title($title)) {
+ ($title,$foldertitle,$renametitle) = &parse_supplemental_title($title);
+ $pagetitle = $foldertitle;
+ } else {
+ $title=&HTML::Entities::encode($title,'"<>&\'');
+ $renametitle=$title;
+ $foldertitle=$title;
+ $pagetitle=$title;
}
+
+ my $orderidx=$LONCAPA::map::order[$index];
+
+
$renametitle=~s/\\/\\\\/g;
$renametitle=~s/\"\;/\\\"/g;
my $line='
';
@@ -1675,21 +1722,17 @@ sub entryline {
if ($env{'form.folderpath'}) {
$type = 'folder';
$container = 'sequence';
- $esc_path=&escape($path = $env{'form.folderpath'});
+ $esc_path=&escape($env{'form.folderpath'});
+ $path = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
# $htmlfoldername=&HTML::Entities::encode($env{'form.foldername'},'<>&"');
}
if ($env{'form.pagepath'}) {
$type = $container = 'page';
$esc_path=&escape($path = $env{'form.pagepath'});
+ $path = &HTML::Entities::encode($env{'form.pagepath'},'<>&"');
$symb=&escape($env{'form.pagesymb'});
}
my $cpinfo='';
- if ($env{'form.markedcopy_url'}) {
- $cpinfo='&markedcopy_url='.
- &escape($env{'form.markedcopy_url'}).
- '&markedcopy_title='.
- &escape($env{'form.markedcopy_title'});
- }
if ($allowed) {
my $incindex=$index+1;
my $selectbox='';
@@ -1740,13 +1783,13 @@ sub entryline {
if (!$nocopy) {
$copylink=(<
+
$lt{'cp'}
ENDCOPY
}
if (!$nocut) {
$cutlink=(<
+
$lt{'ct'}
ENDCUT
}
@@ -1754,20 +1797,18 @@ ENDCUT
'."\n\n");
+$help{'Caching'}.''."\n\n");
}
# =========================================== Breadcrumbs for special functions
@@ -2443,8 +2484,7 @@ sub handler {
my $uploadtag;
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['folderpath','pagepath',
- 'pagesymb','markedcopy_url',
- 'markedcopy_title']);
+ 'pagesymb']);
if ($env{'form.folderpath'}) {
my (@folderpath)=split('&',$env{'form.folderpath'});
$env{'form.foldername'}=&unescape(pop(@folderpath));
@@ -2456,8 +2496,8 @@ sub handler {
$env{'form.folder'}=pop(@pagepath);
$containertag = ''.
'';
- $uploadtag = ''.
- '';
+ $uploadtag = ''.
+ '';
}
if ($r->uri=~/^\/adm\/coursedocs\/showdoc\/(.*)$/) {
$showdoc='/'.$1;
@@ -2619,6 +2659,7 @@ sub handler {
);
# -----------------------------------------------------------------------------
if ($allowed) {
+ &update_paste_buffer($coursenum,$coursedom);
my $dumpbut=&dumpbutton();
my $exportbut=&exportbutton();
my %lt=&Apache::lonlocal::texthash(
@@ -2638,35 +2679,42 @@ sub handler {
}
unless ($env{'form.pagepath'}) {
$containertag = '';
- $uploadtag = '';
+ $uploadtag = '';
}
$r->print(<
-
-
-
-$containertag
+
+
+
+
+ $containertag
+
ENDCOURSEVERIFY
$r->print(&Apache::loncommon::help_open_topic('Docs_Adding_Course_Doc',
&mt('Editing the Table of Contents for your '.$type)));
@@ -2747,10 +2795,10 @@ $help{'Importing_LON-CAPA_Resource'}