--- loncom/interface/londocs.pm 2007/01/05 16:40:27 1.265
+++ loncom/interface/londocs.pm 2007/01/26 23:37:53 1.270
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.265 2007/01/05 16:40:27 albertel Exp $
+# $Id: londocs.pm,v 1.270 2007/01/26 23:37:53 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -235,7 +235,6 @@ sub dumpcourse {
my ($ext)=($_=~/\.(\w+)$/);
my $title=$hash{'title_'.$hash{
'ids_/uploaded/'.$origcrsdata{'domain'}.'/'.$origcrsdata{'num'}.'/'.$_}};
- $title=~s/:/:/g;
$r->print('
'.($title?$title:' ').' | ');
if (!$title) {
$title=$_;
@@ -937,8 +936,8 @@ sub group_import {
$LONCAPA::map::order[$#LONCAPA::map::order+1]=$idx;
my $ext = 'false';
if ($url=~m{^http://} || $url=~m{^https://}) { $ext = 'true'; }
- $url =~ s/:/\:/g;
- $name =~ s/:/\:/g;
+ $url =~ &LONCAPA::map::qtunescape($url);
+ $name =~ &LONCAPA::map::qtunescape($name);
$LONCAPA::map::resources[$idx] =
join ':', ($name, $url, $ext, 'normal', 'res');
}
@@ -988,7 +987,8 @@ sub breadcrumbs {
{'href'=>$url.$cpinfo,
'title'=>$name,
'text'=>''.
- $name.''
+ $name.'',
+ 'no_mt'=>1,
});
$plain.=$name.' > ';
}
@@ -1315,12 +1315,10 @@ sub editor {
&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]=
@@ -1372,19 +1370,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
@@ -1455,7 +1448,7 @@ sub editor {
foreach (@LONCAPA::map::order) {
my ($name,$url)=split(/\:/,$LONCAPA::map::resources[$_]);
$name=&LONCAPA::map::qtescape($name);
- $url=&LONCAPA::map::qtescape($url);
+ $url =&LONCAPA::map::qtescape($url);
unless ($name) { $name=(split(/\//,$url))[-1]; }
unless ($name) { $idx++; next; }
$r->print(&entryline($idx,$name,$url,$folder,$allowed,$_,$coursenum));
@@ -1538,11 +1531,9 @@ sub process_file_upload {
$codebase);
my $ext='false';
if ($url=~/^http\:\/\//) { $ext='true'; }
- $url=~s/\:/\:/g;
+ $url = &LONCAPA::map::qtunescape($url);
my $comment=$env{'form.comment'};
- $comment=~s/\\<\;/g;
- $comment=~s/\>/\>\;/g;
- $comment=~s/\:/\:/g;
+ $comment = &LONCAPA::map::qtunescape($comment);
if ($folder=~/^supplemental/) {
$comment=time.'___&&&___'.$env{'user.name'}.'___&&&___'.
$env{'user.domain'}.'___&&&___'.$comment;
@@ -1561,38 +1552,18 @@ sub process_file_upload {
my $total_embedded = keys(%{$allfiles});
if ($total_embedded > 0) {
my $num = 0;
- $$upload_output .= 'This file contains embedded multimedia objects, which need to be uploaded to LON-CAPA.
- ';
+ $phase_status = 'phasetwo';
+
+ $$upload_output .=
+ 'This file contains embedded multimedia objects, which need to be uploaded to LON-CAPA.
'.
+ &ask_for_embedded_content('/adm/coursedocs',
+ $state,$allfiles,$codebase);
} else {
$$upload_output .= 'No embedded items identified
';
}
@@ -1602,6 +1573,41 @@ sub process_file_upload {
return $phase_status;
}
+sub ask_for_embedded_content {
+ my ($actionurl,$state,$allfiles,$codebase)=@_;
+ my $upload_output = '
+ ';
+ return $upload_output;
+}
+
sub process_secondary_uploads {
my ($upload_output,$coursedom,$coursenum,$formname,$num,$newidx) = @_;
my $folder=$env{'form.folder'};
@@ -1625,9 +1631,7 @@ sub process_secondary_uploads {
sub entryline {
my ($index,$title,$url,$folder,$allowed,$residx,$coursenum)=@_;
- $title=~s/\&colon\;/\:/g;
- $title=&HTML::Entities::encode(&HTML::Entities::decode(
- &unescape($title)),'"<>&\'');
+ $title=&HTML::Entities::encode($title,'"<>&\'');
my $renametitle=$title;
my $foldertitle=$title;
my $pagetitle=$title;
@@ -1694,6 +1698,7 @@ sub entryline {
'rn' => 'Rename',
'cp' => 'Copy');
my $nocopy=0;
+ my $nocut=0;
if ($url=~/\.(page|sequence)$/) {
foreach (&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$url))) {
my ($title,$url,$ext,$type)=split(/\:/,$_);
@@ -1703,13 +1708,24 @@ sub entryline {
}
}
}
+ if ($url=~/^\/res\/lib\/templates\//) {
+ $nocopy=1;
+ $nocut=1;
+ }
my $copylink=' ';
+ my $cutlink=' ';
if ($env{'form.pagepath'}) {
- unless ($nocopy) {
+ if (!$nocopy) {
$copylink=(<
$lt{'cp'}
ENDCOPY
+ }
+ if (!$nocut) {
+ $cutlink=(<
+$lt{'ct'}
+ENDCUT
}
$line.=(<
@@ -1731,19 +1747,24 @@ ENDCOPY
$lt{'rm'}
-
-$lt{'ct'}
+$cutlink
$lt{'rn'}
$copylink
END
} else {
- unless ($nocopy) {
+ if (!$nocopy) {
$copylink=(<
$lt{'cp'} |
ENDCOPY
}
+ if (!$nocut) {
+ $cutlink=(<
+$lt{'ct'}
+ENDCUT
+ }
$line.=(<
@@ -1763,8 +1784,7 @@ ENDCOPY
$lt{'rm'}
-
-$lt{'ct'}
+$cutlink
$lt{'rn'}
$copylink
|