[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Mon, 03 Nov 2003 21:29:23 -0000
albertel Mon Nov 3 16:29:23 2003 EDT
Modified files:
/loncom/interface loncommon.pm
Log:
- able to invert meaning of hiddenparts by prepending the 'hiddenparts' string with ! (BUG#2347)
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.140 loncom/interface/loncommon.pm:1.141
--- loncom/interface/loncommon.pm:1.140 Thu Oct 30 08:57:06 2003
+++ loncom/interface/loncommon.pm Mon Nov 3 16:29:23 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.140 2003/10/30 13:57:06 matthew Exp $
+# $Id: loncommon.pm,v 1.141 2003/11/03 21:29:23 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2672,11 +2672,14 @@
my ($id,$symb,$udom,$uname) = @_;
my $hiddenparts=&Apache::lonnet::EXT('resource.0.hiddenparts',
$symb,$udom,$uname);
+ my $truth=1;
+ #if the string starts with !, then the list is the list to show not hide
+ if ($hiddenparts=~s/^\s*!//) { $truth=undef; }
my @hiddenlist=split(/,/,$hiddenparts);
foreach my $checkid (@hiddenlist) {
- if ($checkid =~ /^\s*\Q$id\E\s*$/) { return 1; }
+ if ($checkid =~ /^\s*\Q$id\E\s*$/) { return $truth; }
}
- return undef;
+ return !$truth;
}