--- loncom/publisher/lonpubdir.pm 2006/11/22 20:16:16 1.96
+++ loncom/publisher/lonpubdir.pm 2007/01/10 19:51:35 1.99
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Construction Space Directory Lister
#
-# $Id: lonpubdir.pm,v 1.96 2006/11/22 20:16:16 banghart Exp $
+# $Id: lonpubdir.pm,v 1.99 2007/01/10 19:51:35 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -41,6 +41,7 @@ use Apache::lonlocal;
use Apache::lonmsg;
use Apache::lonmenu;
use Apache::lonnet;
+use LONCAPA;
sub handler {
@@ -157,7 +158,7 @@ sub getEffectiveUrl {
#
$fn=~s/^http\:\/\/[^\/]+\///;
$fn=~s/^\///;
- $fn=~s/\~(\w+)/\/home\/$1\/public_html/;
+ $fn=~s{~($LONCAPA::username_re)}{/home/$1/public_html};
# Remove trailing / strings (?)
@@ -170,7 +171,7 @@ sub getEffectiveUrl {
#internal authentication, needs fixup.
$fn = $r->uri(); # non users do not get the full path request
# through SCRIPT_FILENAME
- $fn=~s|^/~(\w+)|/home/$1/public_html|;
+ $fn=~s{^/~($LONCAPA::username_re)}{/home/$1/public_html};
}
}
$fn=~s/\/+/\//g;
@@ -311,7 +312,7 @@ parent.lastknownpriv='/~$uname$thisdisfn
function changename(theform,activity) {
var oldname=theform.dispfilename.value;
var newname=prompt('New Name',oldname);
- if (newname == "" || !newname) {
+ if (newname == "" || !newname || newname == oldname) {
return
}
document.moveresource.newfilename.value = newname
@@ -514,9 +515,9 @@ sub putdirectory {
%Apache::lonpublisher::metadatafields=();
%Apache::lonpublisher::metadatakeys=();
my $construct=$here;
- $construct=~s:^/priv/(\w+)$:/home/$1/public_html:;
+ $construct=~s{^/priv/($LONCAPA::username_re)$}{/home/$1/public_html};
my $dirpath = $here;
- $dirpath=~s:^/priv/:/~:;
+ $dirpath=~s{^/priv/}{/~};
&Apache::lonpublisher::metaeval(&Apache::lonnet::getfile(
$construct.'/'.$dirname.'/default.meta'
));
@@ -715,7 +716,7 @@ sub create_pubselect {
';
+ &HTML::Entities::encode($filename).'" />';
$$numres ++;
}