[LON-CAPA-cvs] cvs: loncom /auth roles.tab rolesplain.tab /interface lonannounce.pm loncommon.pm lonmsgdisplay.pm lonpickcourse.pm /lonnet/perl lonnet.pm
raeburn
lon-capa-cvs@mail.lon-capa.org
Wed, 29 Nov 2006 07:46:44 -0000
This is a MIME encoded message
--raeburn1164786404
Content-Type: text/plain
raeburn Wed Nov 29 02:46:44 2006 EDT
Modified files:
/loncom/interface lonmsgdisplay.pm loncommon.pm lonpickcourse.pm
lonannounce.pm
/loncom/lonnet/perl lonnet.pm
/loncom/auth roles.tab rolesplain.tab
Log:
evb privilege - with this privilege users evade blocking of communication functionality defined by blocks placed by users with dcm privilege.
dcm privilege - this is now used to determine if link to block setting is displayed.
loncommon::findallcourses() now return a hash, where the keys are courseIDs instead of an array of courseIDs. Places where findallcourses() was called - lonannounce, lonpickcourse changed accordingly.
loncommon::findallcourses() now reports courses for a user where the user's only role was a custom role.
lonnet::allowed() can now take a fourth optional argument ($role) which allows privs to be investigated for roles other than the user's currently active role
&blockcheck, &parse_block_record(), and &build_block_table() moved from lonmsgdisplay to loncommon, so they are available for evaluation of blocking state for other communication functions besides COM.
Each block record for a blocking event in a course is now a hash, with key=values of the hash being setter = username:domain of user who set block, title=event title for block, and blocks = hash of blocked features ('com','chat','boards','port','groups').
Backwards compatibility retained with previous : separated text for block record value.
--raeburn1164786404
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20061129024644.txt"
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.43 loncom/interface/lonmsgdisplay.pm:1.44
--- loncom/interface/lonmsgdisplay.pm:1.43 Wed Nov 29 00:54:34 2006
+++ loncom/interface/lonmsgdisplay.pm Wed Nov 29 02:46:39 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging display
#
-# $Id: lonmsgdisplay.pm,v 1.43 2006/11/29 05:54:34 raeburn Exp $
+# $Id: lonmsgdisplay.pm,v 1.44 2006/11/29 07:46:39 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -649,12 +649,10 @@
my @msgids = sort(&Apache::lonnet::getkeys('nohist_email'));
my @newmsgs;
my %setters = ();
- my $startblock = 0;
- my $endblock = 0;
my %blocked = ();
my $numblocked = 0;
# Check for blocking of display because of scheduled online exams.
- &blockcheck(\%setters,\$startblock,\$endblock);
+ my ($startblock,$endblock) = &Apache::loncommon::blockcheck(\%setters,'com');
my %status_cache =
&Apache::lonnet::get('email_status',\@msgids);
my %descriptions;
@@ -715,7 +713,8 @@
}
$r->print(
&mt('display of LON-CAPA messages sent to you by other students between').' '.$beginblock.' '.&mt('and').' '.$finishblock.' '.&mt('is currently being blocked because of online exams').'.');
- &build_block_table($r,$startblock,$endblock,\%setters);
+ $r->print(&Apache::loncommon::build_block_table($startblock,$endblock,
+ \%setters));
}
}
@@ -740,10 +739,8 @@
my ($r,$folder)=@_;
my %blocked = ();
my %setters = ();
- my $startblock;
- my $endblock;
my $numblocked = 0;
- &blockcheck(\%setters,\$startblock,\$endblock);
+ my ($startblock,$endblock) = &Apache::loncommon::blockcheck(\%setters,'com');
$r->print(<<ENDDISHEADER);
<script type="text/javascript">
function checkall() {
@@ -887,7 +884,8 @@
my $finishblock = &Apache::lonlocal::locallocaltime($endblock);
$r->print('<br /><br />'.
$numblocked.' '.&mt('message(s) is/are not viewable because display of LON-CAPA messages sent to you by other students between').' '.$beginblock.' '.&mt('and').' '.$finishblock.' '.&mt('is currently being blocked because of online exams.'));
- &build_block_table($r,$startblock,$endblock,\%setters);
+ $r->print(&Apache::loncommon::build_block_table($startblock,$endblock,
+ \%setters));
}
}
@@ -1311,8 +1309,8 @@
sub examblock {
my ($r,$action) = @_;
unless ($env{'request.course.id'}) { return;}
- if (!&Apache::lonnet::allowed('srm',$env{'request.course.id'})
- && ! &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
+ if (!&Apache::lonnet::allowed('dcm',$env{'request.course.id'})
+ && ! &Apache::lonnet::allowed('dcm',$env{'request.course.id'}.
'/'.$env{'request.course.sec'})) {
$r->print('Not allowed');
return;
@@ -1331,6 +1329,7 @@
'dura' => 'Duration',
'setb' => 'Set by',
'even' => 'Event',
+ 'blck' => 'Blocked?',
'actn' => 'Action',
'star' => 'Start',
'endd' => 'End'
@@ -1388,7 +1387,7 @@
my %blocking = ();
$r->print('<h3>'.$lt{'head'}.'</h3>');
foreach my $envkey (keys(%env)) {
- if ($envkey =~ m/^form\.modify_(\w+)$/) {
+ if ($envkey =~ m/^form\.modify_(\d+)$/) {
$adds{$1} = $1;
$removals{$1} = $1;
$modtotal ++;
@@ -1401,7 +1400,7 @@
} elsif ($envkey =~ m/^form\.add_(\d+)$/) {
$adds{$1} = $1;
$addtotal ++;
- }
+ }
}
foreach my $key (keys(%removals)) {
@@ -1415,7 +1414,12 @@
unless ( defined($cancels{$key}) ) {
my ($newstart,$newend) = &get_dates_from_form($key);
my $newkey = $newstart.'____'.$newend;
- $blocking{$newkey} = $env{'user.name'}.':'.$env{'user.domain'}.':'.$env{'form.title_'.$key};
+ my $blocktypes = &get_block_choices($key);
+ $blocking{$newkey} = {
+ setter => $env{'user.name'}.':'.$env{'user.domain'},
+ event => &escape($env{'form.title_'.$key}),
+ blocks => $blocktypes,
+ };
}
}
if ($addtotal + $modtotal > 0) {
@@ -1466,6 +1470,20 @@
}
}
+sub get_block_choices {
+ my $item = shift;
+ my $blocklist;
+ my ($typeorder,$types) = &blocktype_text();
+ foreach my $type (@{$typeorder}) {
+ if ($env{'form.'.$type.'_'.$item}) {
+ $blocklist->{$type} = 'on';
+ } else {
+ $blocklist->{$type} = 'off';
+ }
+ }
+ return $blocklist;
+}
+
sub display_blocker_status {
my ($r,$records,$ltext) = @_;
my $parmcount = 0;
@@ -1474,13 +1492,15 @@
'modi' => 'Modify',
'canc' => 'Cancel',
);
+ my ($typeorder,$types) = &blocktype_text();
$r->print(&Apache::loncommon::start_data_table());
$r->print(<<"END");
<tr>
- <th>$$ltext{'dura'}</th>
- <th>$$ltext{'setb'}</th>
- <th>$$ltext{'even'}</th>
- <th>$$ltext{'actn'}?</th>
+ <th>$ltext->{'dura'}</th>
+ <th>$ltext->{'setb'}</th>
+ <th>$ltext->{'even'}</th>
+ <th>$ltext->{'blck'}</th>
+ <th>$ltext->{'actn'}?</th>
</tr>
END
foreach my $record (sort(keys(%{$records}))) {
@@ -1491,15 +1511,29 @@
my $startform = &Apache::lonhtmlcommon::date_setter('blockform','startdate_'.$parmcount,$start,$onchange);
my $endform = &Apache::lonhtmlcommon::date_setter('blockform','enddate_'.$parmcount,$end,$onchange);
- my ($setuname,$setudom,$title) =
- &parse_block_record($$records{$record});
+ my ($setuname,$setudom,$title,$blocks) =
+ &Apache::loncommon::parse_block_record($$records{$record});
$title = &HTML::Entities::encode($title,'"<>&');
- my $settername = &Apache::loncommon::plainname($setuname,$setudom);
+ my $settername =
+ &Apache::loncommon::aboutmewrapper(
+ &Apache::loncommon::plainname($setuname,$setudom),
+ $setuname,$setudom);
$r->print(&Apache::loncommon::start_data_table_row());
$r->print(<<"END");
- <td>$$ltext{'star'}: $startform<br/>$$ltext{'endd'}: $endform</td>
+ <td>$ltext->{'star'}: $startform<br/>$ltext->{'endd'}: $endform</td>
<td>$settername</td>
<td><input type="text" name="title_$parmcount" size="15" value="$title" /><input type="hidden" name="key_$parmcount" value="$record" /></td>
+ <td>
+END
+ foreach my $block (@{$typeorder}) {
+ my $blockstatus = '';
+ if ($blocks->{$block} eq 'on') {
+ $blockstatus = 'checked="true"';
+ }
+ $r->print('<label><input type="checkbox" name="'.$block.'_'.$parmcount.'" '.$blockstatus.' value="1" />'.$types->{$block}.'</label><br />');
+ }
+ $r->print(<<"END");
+ </td>
<td><label>$lt{'modi'}? <input type="checkbox" name="modify_$parmcount" /></label><br /><label>$lt{'canc'}? <input type="checkbox" name="cancel_$parmcount" /></label>
END
$r->print(&Apache::loncommon::end_data_table_row());
@@ -1513,19 +1547,6 @@
return $parmcount;
}
-sub parse_block_record {
- my ($record) = @_;
- my ($setuname,$setudom,$title);
- my @data = split(/:/,$record,3);
- if (scalar(@data) eq 2) {
- $title = $data[1];
- ($setuname,$setudom) = split(/@/,$data[0]);
- } else {
- ($setuname,$setudom,$title) = @data;
- }
- return ($setuname,$setudom,$title);
-}
-
sub display_addblocker_table {
my ($r,$parmcount,$ltext) = @_;
my $start = time;
@@ -1540,21 +1561,30 @@
'exam' => 'e.g., Exam 1',
'addn' => 'Add new communication blocking periods'
);
+ my ($typeorder,$types) = &blocktype_text();
$r->print(<<"END");
<h4>$lt{'addn'}</h4>
END
$r->print(&Apache::loncommon::start_data_table());
$r->print(<<"END");
<tr>
- <th>$$ltext{'dura'}</th>
- <th>$$ltext{'even'} $lt{'exam'}</th>
- <th>$$ltext{'actn'}?</th>
+ <th>$ltext->{'dura'}</th>
+ <th>$ltext->{'even'} $lt{'exam'}</th>
+ <th>$ltext->{'blck'}</th>
+ <th>$ltext->{'actn'}?</th>
</tr>
END
- $r->print(&Apache::loncommon::start_data_table_row());
+ $r->print(&Apache::loncommon::start_data_table_row());
$r->print(<<"END");
- <td>$$ltext{'star'}: $startform<br />$$ltext{'endd'}: $endform</td>
+ <td>$ltext->{'star'}: $startform<br />$ltext->{'endd'}: $endform</td>
<td><input type="text" name="title_$parmcount" size="15" value="" /></td>
+ <td>
+END
+ foreach my $block (@{$typeorder}) {
+ $r->print('<label><input type="checkbox" name="'.$block.'_'.$parmcount.'" value="1" />'.$types->{$block}.'</label><br />');
+ }
+ $r->print(<<"END");
+ </td>
<td><label>$lt{'addb'}? <input type="checkbox" name="add_$parmcount" value="1" /></label></td>
END
$r->print(&Apache::loncommon::end_data_table_row());
@@ -1562,86 +1592,16 @@
return;
}
-sub blockcheck {
- my ($setters,$startblock,$endblock) = @_;
- # Retrieve active student roles and active course coordinator/instructor roles
- my %live_courses =
- map { $_ => 1} &Apache::loncommon::findallcourses();
- # FIXME should really probe for apriv, but ::allowed can only probe the
- # currently active role
- my %staff_of =
- map { $_ => 1} &Apache::loncommon::findallcourses(['cc','in']);
-
- # Retrieve blocking times and identity of blocker for active courses
- # for students.
- return if (!%live_courses);
-
- foreach my $course (keys(%live_courses)) {
- my $cdom = $env{'course.'.$course.'.domain'};
- my $cnum = $env{'course.'.$course.'.num'};
-
- # if they are a staff member and are currently not playing student
- next if ( $staff_of{$course}
- && ($env{'request.role'} !~ m{^st\./$cdom/$cnum}));
-
- $setters->{$course} = {};
- $setters->{$course}{'staff'} = [];
- $setters->{$course}{'times'} = [];
- my %records = &Apache::lonnet::dump('comm_block',$cdom,$cnum);
- foreach my $record (keys(%records)) {
- my ($start,$end) = ($record =~ m/^(\d+)____(\d+)$/);
- if ($start <= time && $end >= time) {
- my ($staff_name,$staff_dom,$title) =
- &parse_block_record($records{$record});
- push(@{$$setters{$course}{'staff'}}, [$staff_name,$staff_dom]);
- push(@{$$setters{$course}{'times'}}, [$start,$end]);
- if ( ($$startblock == 0) || ($$startblock > $1) ) {
- $$startblock = $1;
- }
- if ( ($$endblock == 0) || ($$endblock < $2) ) {
- $$endblock = $2;
- }
- }
- }
- }
-}
-
-sub build_block_table {
- my ($r,$startblock,$endblock,$setters) = @_;
- my %lt = &Apache::lonlocal::texthash(
- 'cacb' => 'Currently active communication blocks',
- 'cour' => 'Course/Group',
- 'dura' => 'Duration',
- 'blse' => 'Block set by'
+sub blocktype_text {
+ my %types = &Apache::lonlocal::texthash(
+ 'com' => 'Messaging',
+ 'chat' => 'Chat',
+ 'boards' => 'Discussion',
+ 'port' => 'Portfolio',
+ 'groups' => 'Groups'
);
- $r->print(<<"END");
-<br /><br />$lt{'cacb'}:<br /><br />
-END
- $r->print(&Apache::loncommon::start_data_table());
- $r->print(<<"END");
-<tr>
- <th>$lt{'cour'}</th>
- <th>$lt{'dura'}</th>
- <th>$lt{'blse'}</th>
-</tr>
-END
- foreach my $course (keys(%{$setters})) {
- my %courseinfo=&Apache::lonnet::coursedescription($course);
- for (my $i=0; $i<@{$$setters{$course}{staff}}; $i++) {
- my ($uname,$udom) = @{$$setters{$course}{staff}[$i]};
- my $fullname = &Apache::loncommon::plainname($uname,$udom);
- my ($openblock,$closeblock) = @{$$setters{$course}{times}[$i]};
- $openblock = &Apache::lonlocal::locallocaltime($openblock);
- $closeblock= &Apache::lonlocal::locallocaltime($closeblock);
- $r->print(&Apache::loncommon::start_data_table_row().
- '<td>'.$courseinfo{'description'}.'</td>'.
- '<td>'.$openblock.' to '.$closeblock.'</td>'.
- '<td>'.$fullname.' ('.$uname.':'.$udom.
- ')</td>'.
- &Apache::loncommon::end_data_table_row());
- }
- }
- $r->print(&Apache::loncommon::end_data_table());
+ my $typeorder = ['com','chat','boards','port','groups'];
+ return ($typeorder,\%types);
}
# ----------------------------------------------------------- Display a message
@@ -1651,13 +1611,11 @@
my $suffix=&Apache::lonmsg::foldersuffix($folder);
my %blocked = ();
my %setters = ();
- my $startblock = 0;
- my $endblock = 0;
my $numblocked = 0;
my $crstype = &Apache::loncommon::course_type();
# info to generate "next" and "previous" buttons and check if message is blocked
- &blockcheck(\%setters,\$startblock,\$endblock);
+ my ($startblock,$endblock) = &Apache::loncommon::blockcheck(\%setters,'com');
my @messages=&sortedmessages(\%blocked,$startblock,$endblock,\$numblocked,$folder);
if ( $blocked{$msgid} eq 'ON' ) {
&printheader($r,'/adm/email',&mt('Display a Message'));
@@ -1909,7 +1867,7 @@
my ($rec,$txt) = ($line =~ /^([^:]+:[^:]+):(.*)$/);
if ($txt) {
$rec =~ s/^\s+//;
- $rec =~ ~s/\s+$//;
+ $rec =~ s/\s+$//;
$toaddr{$rec}.=$txt."\n";
}
}
@@ -2262,7 +2220,7 @@
&storedcommentlisting($r);
} else {
&printheader($r,'','Display All Messages');
- &Apache::loncommunicate::menu($r);
+ &Apache::loncommunicate::menu($r);
&disall($r,($folder?$folder:$dismode));
}
$r->print(&Apache::loncommon::end_page());
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.473 loncom/interface/loncommon.pm:1.474
--- loncom/interface/loncommon.pm:1.473 Wed Nov 22 19:04:09 2006
+++ loncom/interface/loncommon.pm Wed Nov 29 02:46:39 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.473 2006/11/23 00:04:09 raeburn Exp $
+# $Id: loncommon.pm,v 1.474 2006/11/29 07:46:39 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2792,8 +2792,9 @@
my %courses;
my $now=time;
foreach my $key (keys(%env)) {
- if ( $key=~m{^user\.role\.(\w+)\./(\w+)/(\w+)} ) {
- my ($role,$domain,$id) = ($1,$2,$3);
+ if ( $key=~m{^user\.role\.(\w+)\./(\w+)/(\w+)/?(\w*)$} ||
+ $key=~m{^user\.role\.(cr/\w+/\w+/\w+)\./(\w+)/(\w+)}) {
+ my ($role,$domain,$id,$sec) = ($1,$2,$3,$4);
next if ($role eq 'ca' || $role eq 'aa');
next if (%roles && !exists($roles{$role}));
my ($starttime,$endtime)=split(/\./,$env{$key});
@@ -2804,13 +2805,131 @@
if ($endtime) {
if ($now>$endtime) { $active=0; }
}
- if ($active) { $courses{$domain.'_'.$id}=1; }
+ if ($active) {
+ if ($sec eq '') {
+ $sec = 'none';
+ }
+ $courses{$domain.'_'.$id}{$sec} = 1;
+ }
}
}
- return keys(%courses);
+ return %courses;
}
###############################################
+
+sub blockcheck {
+ my ($setters,$activity) = @_;
+ # Retrieve active student roles and active course coordinator/instructor roles
+
+ my %live_courses = &findallcourses();
+
+ # Retrieve blocking times and identity of blocker for active courses
+ # unless user has 'evb' privilege.
+
+ my $startblock = 0;
+ my $endblock = 0;
+
+ foreach my $course (keys(%live_courses)) {
+ my $cdom = $env{'course.'.$course.'.domain'};
+ my $cnum = $env{'course.'.$course.'.num'};
+ my $noblock = 0;
+ foreach my $sec (keys(%{$live_courses{$course}})) {
+ my $role = 'cm./'.$cdom.'/'.$cnum;
+ if ($sec ne 'none') {
+ $role .= '/'.$sec;
+ }
+ if (&Apache::lonnet::allowed('evb',undef,undef,$role)) {
+ $noblock = 1;
+ last;
+ }
+ }
+ # if they have the evb priv and are currently not playing student
+ next if (($noblock) &&
+ ($env{'request.role'} !~ m{^st\./$cdom/$cnum}));
+
+ $setters->{$course} = {};
+ $setters->{$course}{'staff'} = [];
+ $setters->{$course}{'times'} = [];
+ my %records = &Apache::lonnet::dump('comm_block',$cdom,$cnum);
+ foreach my $record (keys(%records)) {
+ my ($start,$end) = ($record =~ m/^(\d+)____(\d+)$/);
+ if ($start <= time && $end >= time) {
+ my ($staff_name,$staff_dom,$title,$blocks) =
+ &parse_block_record($records{$record});
+ if ($blocks->{$activity} eq 'on') {
+ push(@{$$setters{$course}{'staff'}}, [$staff_name,$staff_dom]); push(@{$$setters{$course}{'times'}}, [$start,$end]);
+ if ( ($startblock == 0) || ($startblock > $1) ) {
+ $startblock = $1;
+ }
+ if ( ($endblock == 0) || ($endblock < $2) ) {
+ $endblock = $2;
+ }
+ }
+ }
+ }
+ }
+ return ($startblock,$endblock);
+}
+
+sub parse_block_record {
+ my ($record) = @_;
+ my ($setuname,$setudom,$title,$blocks);
+ if (ref($record) eq 'HASH') {
+ ($setuname,$setudom) = split(/:/,$record->{'setter'});
+ $title = &unescape($record->{'event'});
+ $blocks = $record->{'blocks'};
+
+ } else {
+ my @data = split(/:/,$record,3);
+ if (scalar(@data) eq 2) {
+ $title = $data[1];
+ ($setuname,$setudom) = split(/@/,$data[0]);
+ } else {
+ ($setuname,$setudom,$title) = @data;
+ }
+ $blocks = { 'com' => 'on' };
+ }
+ return ($setuname,$setudom,$title,$blocks);
+}
+
+sub build_block_table {
+ my ($startblock,$endblock,$setters) = @_;
+ my %lt = &Apache::lonlocal::texthash(
+ 'cacb' => 'Currently active communication blocks',
+ 'cour' => 'Course',
+ 'dura' => 'Duration',
+ 'blse' => 'Block set by'
+ );
+ my $output;
+ $output = '<br /><br />'.$lt{'cacb'}.':<br /><br />';
+ $output .= &start_data_table();
+ $output .= '
+<tr>
+ <th>'.$lt{'cour'}.'</th>
+ <th>'.$lt{'dura'}.'</th>
+ <th>'.$lt{'blse'}.'</th>
+</tr>
+';
+ foreach my $course (keys(%{$setters})) {
+ my %courseinfo=&Apache::lonnet::coursedescription($course);
+ for (my $i=0; $i<@{$$setters{$course}{staff}}; $i++) {
+ my ($uname,$udom) = @{$$setters{$course}{staff}[$i]};
+ my $fullname = &Apache::loncommon::plainname($uname,$udom);
+ my ($openblock,$closeblock) = @{$$setters{$course}{times}[$i]};
+ $openblock = &Apache::lonlocal::locallocaltime($openblock);
+ $closeblock= &Apache::lonlocal::locallocaltime($closeblock);
+ $output .= &Apache::loncommon::start_data_table_row().
+ '<td>'.$courseinfo{'description'}.'</td>'.
+ '<td>'.$openblock.' to '.$closeblock.'</td>'.
+ '<td>'.$fullname.' ('.$uname.':'.$udom.
+ ')</td>'.
+ &Apache::loncommon::end_data_table_row();
+ }
+ }
+ $output .= &end_data_table();
+}
+
###############################################
=pod
Index: loncom/interface/lonpickcourse.pm
diff -u loncom/interface/lonpickcourse.pm:1.59 loncom/interface/lonpickcourse.pm:1.60
--- loncom/interface/lonpickcourse.pm:1.59 Thu Nov 16 08:02:45 2006
+++ loncom/interface/lonpickcourse.pm Wed Nov 29 02:46:39 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Pick a course
#
-# $Id: lonpickcourse.pm,v 1.59 2006/11/16 13:02:45 raeburn Exp $
+# $Id: lonpickcourse.pm,v 1.60 2006/11/29 07:46:39 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -409,7 +409,8 @@
undef,undef,$type);
} else {
$r->print('<br />');
- foreach my $cid (sort(&Apache::loncommon::findallcourses())) {
+ my %coursehash = &Apache::loncommon::findallcourses();
+ foreach my $cid (sort(keys(%coursehash))) {
$courses{$cid} = $env{'course.'.$cid.'.description'};
}
}
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.61 loncom/interface/lonannounce.pm:1.62
--- loncom/interface/lonannounce.pm:1.61 Mon Oct 9 21:52:45 2006
+++ loncom/interface/lonannounce.pm Wed Nov 29 02:46:39 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Announce
#
-# $Id: lonannounce.pm,v 1.61 2006/10/10 01:52:45 albertel Exp $
+# $Id: lonannounce.pm,v 1.62 2006/11/29 07:46:39 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -358,7 +358,8 @@
# ----------------------------------------------------- Summarize all calendars
sub get_all_calendars {
my %allcal=();
- foreach my $course (sort(&Apache::loncommon::findallcourses())) {
+ my %courses = &Apache::loncommon::findallcourses();
+ foreach my $course (sort(keys(%courses))) {
%allcal=(%allcal,&readcalendar($course));
}
return %allcal;
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.809 loncom/lonnet/perl/lonnet.pm:1.810
--- loncom/lonnet/perl/lonnet.pm:1.809 Tue Nov 28 14:46:00 2006
+++ loncom/lonnet/perl/lonnet.pm Wed Nov 29 02:46:40 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.809 2006/11/28 19:46:00 raeburn Exp $
+# $Id: lonnet.pm,v 1.810 2006/11/29 07:46:40 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3554,12 +3554,21 @@
# ------------------------------------------------- Check for a user privilege
sub allowed {
- my ($priv,$uri,$symb)=@_;
+ my ($priv,$uri,$symb,$role)=@_;
my $ver_orguri=$uri;
$uri=&deversion($uri);
my $orguri=$uri;
$uri=&declutter($uri);
+ if ($priv eq 'evb') {
+# Evade communication block restrictions for specified role in a course
+ if ($env{'user.priv.'.$role} =~/evb\&([^\:]*)/) {
+ return $1;
+ } else {
+ return;
+ }
+ }
+
if (defined($env{'allowed.'.$priv})) { return $env{'allowed.'.$priv}; }
# Free bre access to adm and meta resources
if (((($uri=~/^adm\//) && ($uri !~ m{/(?:smppg|bulletinboard)$}))
@@ -7715,7 +7724,7 @@
=item *
-allowed($priv,$uri,$symb) : check for a user privilege; returns codes for allowed actions
+allowed($priv,$uri,$symb,$role) : check for a user privilege; returns codes for allowed actions
F: full access
U,I,K: authentication modes (cxx only)
'': forbidden
Index: loncom/auth/roles.tab
diff -u loncom/auth/roles.tab:1.50 loncom/auth/roles.tab:1.51
--- loncom/auth/roles.tab:1.50 Tue Nov 21 16:38:44 2006
+++ loncom/auth/roles.tab Wed Nov 29 02:46:41 2006
@@ -2,22 +2,22 @@
dc:s bre:sma:adv:mcr:srm
dc:d cli&UIK:cau&UIK:cca&UIK:caa&UIK:cdg&UIK:mau:ccc&U:cin&UIK:cta&UIK:cep&UIK:ccr&UIK:cst&UIK:cad&UIK:csc&UIK:dro:mky:psa:usc:mpq
cc:s bre:sma:mcr:vsa:adv:vcl
-cc:c cin&IK:cta&IK:cep&IK:ccr&IK:cst&IK:are:cre:ere:vgr:gan:srm:opa:mgr:mqg:mgq:rin:pch:plc:mdc:usc:vsa:vcl:mdg:vcg:pav:pfo:whn
+cc:c cin&IK:cta&IK:cep&IK:ccr&IK:cst&IK:are:cre:ere:vgr:gan:dcm:evb:srm:opa:mgr:mqg:mgq:rin:pch:plc:mdc:usc:vsa:vcl:mdg:vcg:pav:pfo:whn
in:s sma:vgr:adv:vcl
-in:c vgr:mgr:mqg:mgq:gan:dcm:srm:pch&C:plc&C:dch:pac:rin:las:opa:bre:vcl:vcg:pav:pfo:whn
+in:c vgr:mgr:mqg:mgq:gan:dcm:evb:srm:pch&C:plc&C:dch:pac:rin:las:opa:bre:vcl:vcg:pav:pfo:whn
ta:d sma
ta:c bre&RL:vgr&CR:mgr&CR:mqg&CR:pch&C:plc&C:dch:pac:vcg:pfo:whn
ep:s adv
ep:d sma
-ep:c bre&R:mgr&R:mqg&R:dcm:las:pav:pfo
+ep:c bre&R:mgr&R:mqg&R:dcm:evb:las:pav:pfo
cr:s adv&SR:bre&S
cr:d sma
-cr:c bre&R:vgr&SCR:mgr&SCR:mqg&SCR:mgq&SCR:gan&SCR:dcm&SC:srm&SC:pch:plc:dch&S:pac:rin&S:las&SR:opa&SR:mdc&SR:cst&IK:pav&C:pfo&C:whn&C
+cr:c bre&R:vgr&SCR:mgr&SCR:mqg&SCR:mgq&SCR:gan&SCR:dcm&SC:evb&SC:srm&SC:pch:plc:dch&S:pac:rin&S:las&SR:opa&SR:mdc&SR:cst&IK:pav&C:pfo&C:whn&C
st:d sma&L
st:c bre&RXL:pch&CL:plc&CL:pac&CL
ad:s adv
ad:d sma
-ad:c bre:gan:vgr:srm
+ad:c bre:gan:vgr:dcm:evb:srm
li:s gan:sma:adv
li:d mme
au:s gan:sma:bre:cre:adv:pav:pfo
Index: loncom/auth/rolesplain.tab
diff -u loncom/auth/rolesplain.tab:1.28 loncom/auth/rolesplain.tab:1.29
--- loncom/auth/rolesplain.tab:1.28 Wed Nov 22 20:47:09 2006
+++ loncom/auth/rolesplain.tab Wed Nov 29 02:46:41 2006
@@ -59,6 +59,7 @@
mgq:Modify grade queue
gan:Generate anonymous statistics
dcm:Disable all communication among students
+evb:Evade communication blocking
sma:Send internal email
srm:Send broadcast and receipt-required email
mdc:Edit/Modify DOCS
--raeburn1164786404--