[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface londocs.pm
raeburn
raeburn at source.lon-capa.org
Wed Feb 10 07:46:12 EST 2021
raeburn Wed Feb 10 12:46:12 2021 EDT
Modified files: (Branch: version_2_11_X)
/loncom/interface londocs.pm
Log:
- For 2.11
Backport 1.675, 1.676
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.484.2.90 loncom/interface/londocs.pm:1.484.2.91
--- loncom/interface/londocs.pm:1.484.2.90 Wed Sep 9 02:08:15 2020
+++ loncom/interface/londocs.pm Wed Feb 10 12:46:11 2021
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.484.2.90 2020/09/09 02:08:15 raeburn Exp $
+# $Id: londocs.pm,v 1.484.2.91 2021/02/10 12:46:11 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -676,26 +676,27 @@
}
my $ext = 'false';
if ($url=~m{^http://} || $url=~m{^https://}) { $ext = 'true'; }
- $name = &LONCAPA::map::qtunescape($name);
- if ($name eq '') {
- $name = &LONCAPA::map::qtunescape(&mt('Web Page'));
- }
if ($url =~ m{^/uploaded/$coursedom/$coursenum/((?:docs|supplemental)/(?:default|\d+))/new\.html$}) {
my $filepath = $1;
- my $fname = $name;
- if ($fname =~ /^\W+$/) {
+ my $fname;
+ if ($name eq '') {
+ $name = &mt('Web Page');
$fname = 'web';
} else {
- $fname =~ s/\W/_/g;
- }
- if (length($fname) > 15) {
- $fname = substr($fname,0,14);
+ $fname = $name;
+ $fname=&Apache::lonnet::clean_filename($fname);
+ if ($fname eq '') {
+ $fname = 'web';
+ } elsif (length($fname) > 15) {
+ $fname = substr($fname,0,14);
+ }
}
+ my $title = &Apache::loncommon::cleanup_html($name);
my $initialtext = &mt('Replace with your own content.');
my $newhtml = <<END;
<html>
<head>
-<title>$name</title>
+<title>$title</title>
</head>
<body bgcolor="#ffffff">
$initialtext
@@ -717,6 +718,7 @@
return (&mt('Failed to save new web page.'),1);
}
}
+ $name = &LONCAPA::map::qtunescape($name);
$url = &LONCAPA::map::qtunescape($url);
$LONCAPA::map::resources[$residx] =
join(':', ($name, $url, $ext, 'normal', 'res'));
@@ -6629,7 +6631,7 @@
function makenewfolder(targetform,folderseq) {
var foldername=prompt('$js_lt{"p_mnf"}','$js_lt{"t_mnf"}');
if (foldername) {
- targetform.importdetail.value=escape(foldername)+"="+folderseq;
+ targetform.importdetail.value=encodeURIComponent(foldername)+"="+folderseq;
targetform.submit();
}
}
@@ -6637,7 +6639,7 @@
function makenewpage(targetform,folderseq) {
var pagename=prompt('$js_lt{"p_mnp"}','$js_lt{"t_mnp"}');
if (pagename) {
- targetform.importdetail.value=escape(pagename)+"="+folderseq;
+ targetform.importdetail.value=encodeURIComponent(pagename)+"="+folderseq;
targetform.submit();
}
}
@@ -6646,7 +6648,7 @@
var title=prompt('$js_lt{"p_mxu"}');
if (title) {
this.document.forms.newexamupload.importdetail.value=
- escape(title)+'=/res/lib/templates/examupload.problem';
+ encodeURIComponent(title)+'=/res/lib/templates/examupload.problem';
this.document.forms.newexamupload.submit();
}
}
@@ -6655,7 +6657,7 @@
var title=prompt('$js_lt{"p_msp"}');
if (title) {
this.document.forms.newsmppg.importdetail.value=
- escape(title)+'=/adm/$udom/$uname/new/smppg';
+ encodeURIComponent(title)+'=/adm/$udom/$uname/new/smppg';
this.document.forms.newsmppg.submit();
}
}
@@ -6670,7 +6672,7 @@
}
if (title) {
var webpage = formname.importdetail.value;
- formname.importdetail.value = escape(title)+'='+webpage;
+ formname.importdetail.value = encodeURIComponent(title)+'='+webpage;
formname.submit();
}
}
@@ -6679,7 +6681,7 @@
var title=prompt('$js_lt{"p_msb"}');
if (title) {
this.document.forms.newsmpproblem.importdetail.value=
- escape(title)+'=/res/lib/templates/simpleproblem.problem';
+ encodeURIComponent(title)+'=/res/lib/templates/simpleproblem.problem';
this.document.forms.newsmpproblem.submit();
}
}
@@ -6688,7 +6690,7 @@
var title=prompt('$js_lt{"p_mdb"}');
if (title) {
this.document.forms.newdropbox.importdetail.value=
- escape(title)+'=/res/lib/templates/DropBox.problem';
+ encodeURIComponent(title)+'=/res/lib/templates/DropBox.problem';
this.document.forms.newdropbox.submit();
}
}
@@ -6697,7 +6699,7 @@
var title=prompt('$js_lt{"p_mbb"}');
if (title) {
this.document.forms.newbul.importdetail.value=
- escape(title)+'=/adm/$udom/$uname/new/bulletinboard';
+ encodeURIComponent(title)+'=/adm/$udom/$uname/new/bulletinboard';
this.document.forms.newbul.submit();
}
}
More information about the LON-CAPA-cvs
mailing list