[LON-CAPA-cvs] cvs: loncom / lontrans.pm /interface lonmenu.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Fri, 02 Jul 2004 07:58:01 -0000
albertel Fri Jul 2 03:58:01 2004 EDT
Modified files:
/loncom lontrans.pm
/loncom/interface lonmenu.pm
Log:
- multi-domain authors weren't getting CSTR buttons, BUG#3153
Index: loncom/lontrans.pm
diff -u loncom/lontrans.pm:1.8 loncom/lontrans.pm:1.9
--- loncom/lontrans.pm:1.8 Thu Apr 1 15:18:29 2004
+++ loncom/lontrans.pm Fri Jul 2 03:58:01 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network
# URL translation for User Files
#
-# $Id: lontrans.pm,v 1.8 2004/04/01 20:18:29 raeburn Exp $
+# $Id: lontrans.pm,v 1.9 2004/07/02 07:58:01 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -42,7 +42,10 @@
my (undef,undef,$udom,$uname,@ufile)=split(/\//,$fn);
$ufile[-1]=~s/^[\~\.]+//;
my $chome=&Apache::lonnet::homeserver($uname,$udom);
- if ($chome eq $Apache::lonnet::perlvar{'lonHostID'}) {
+ my $allowed=0;
+ my @ids=&Apache::lonnet::current_machine_ids();
+ foreach my $id (@ids) { if ($id eq $chome) { $allowed=1; } }
+ if ($allowed) {
$r->filename(&Apache::loncommon::propath($udom,$uname).
'/userfiles/'.(join('/',@ufile)));
}
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.108 loncom/interface/lonmenu.pm:1.109
--- loncom/interface/lonmenu.pm:1.108 Sun Jun 27 12:03:57 2004
+++ loncom/interface/lonmenu.pm Fri Jul 2 03:58:01 2004
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.108 2004/06/27 16:03:57 www Exp $
+# $Id: lonmenu.pm,v 1.109 2004/07/02 07:58:01 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -310,9 +310,11 @@
}
# Check that we are on the correct machine
my $home = &Apache::lonnet::homeserver($caname,$cadom);
- if ($home eq $Apache::lonnet::perlvar{'lonHostID'}) {
- $editbutton=&switch
- ('','',6,1,$top,,$bottom,$action,$desc);
+ my $allowed=0;
+ my @ids=&Apache::lonnet::current_machine_ids();
+ foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
+ if (!$allowed) {
+ $editbutton=&switch('','',6,1,$top,,$bottom,$action,$desc);
}
}
##
@@ -324,16 +326,20 @@
if ($ENV{'request.filename'}) {
my $file=&Apache::lonnet::declutter($ENV{'request.filename'});
$file=~s/^(\w+)\/(\w+)/\/priv\/$2/;
- # Chech that the user has permission to edit this resource
+ # Check that the user has permission to edit this resource
($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1);
if (defined($cfudom)) {
- if (&Apache::lonnet::homeserver($cfuname,$cfudom)
- eq $Apache::lonnet::perlvar{'lonHostID'}) {
+ my $home=&Apache::lonnet::homeserver($cfuname,$cfudom);
+ my $allowed=0;
+ my @ids=&Apache::lonnet::current_machine_ids();
+ foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
+ if ($allowed) {
$cfile=$file;
}
}
}
# Finally, turn the button on or off
+ &Apache::lonnet::logthis("cfile is $cfile");
if ($cfile) {
$editbutton=&switch
('','',6,1,'cstr.gif','edit[_1]','resource[_2]',
@@ -810,7 +816,10 @@
}
$act =~ s/\$caname/$caname/g;
my $home = &Apache::lonnet::homeserver($caname,$cadom);
- if ($home eq $Apache::lonnet::perlvar{'lonHostID'}) {
+ my $allowed=0;
+ my @ids=&Apache::lonnet::current_machine_ids();
+ foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
+ if ($allowed) {
$output.=switch($caname,$cadom,
$row,$col,$img,$top,$bot,$act,$desc);
}