version 1.19, 2009/01/30 16:13:04
|
version 1.31, 2016/03/11 22:11:22
|
Line 1
|
Line 1
|
# The LearningOnline Network with CAPA |
# The LearningOnline Network with CAPA |
# accessor routines used to provide information about course groups |
# accessor routines used to provide information about course groups |
# |
# |
|
# $Id$ |
|
# |
# Copyright Michigan State University Board of Trustees |
# Copyright Michigan State University Board of Trustees |
# |
# |
# This file is part of the LearningOnline Network with CAPA (LON-CAPA). |
# This file is part of the LearningOnline Network with CAPA (LON-CAPA). |
Line 29 package Apache::longroup;
|
Line 31 package Apache::longroup;
|
use strict; |
use strict; |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use LONCAPA; |
|
|
############################################### |
############################################### |
=pod |
=pod |
Line 215 for the course is included amongst the u
|
Line 218 for the course is included amongst the u
|
and would trigger membership in teh same group(s) |
and would trigger membership in teh same group(s) |
|
|
If role is being added, will add any group memberships specified |
If role is being added, will add any group memberships specified |
for auto-group population, unless use is already a group member. |
for auto-group population, unless user is already a group member. |
Uses default group privileges and default start and end group access |
Uses default group privileges and default start and end group access |
times. |
times. |
|
|
Line 249 sub group_changes {
|
Line 252 sub group_changes {
|
} else { |
} else { |
$cid = $url; |
$cid = $url; |
} |
} |
my $courseid = $cid; |
|
$courseid =~ s|^/||; |
|
$courseid =~ s|/|_|; |
|
my %crshash=&Apache::lonnet::coursedescription($cid); |
my %crshash=&Apache::lonnet::coursedescription($cid); |
$cdom = $crshash{'domain'}; |
$cdom = $crshash{'domain'}; |
$cnum = $crshash{'num'}; |
$cnum = $crshash{'num'}; |
Line 289 sub group_changes {
|
Line 289 sub group_changes {
|
if (@changegroups > 0) { |
if (@changegroups > 0) { |
my %currpriv; |
my %currpriv; |
my %roleshash = &Apache::lonnet::dump('roles',$udom,$uname,$cid); |
my %roleshash = &Apache::lonnet::dump('roles',$udom,$uname,$cid); |
if (my $tmp = &Apache::lonnet::error(%roleshash)) { |
if (keys(%roleshash) > 0) { |
&Apache::lonnet::logthis('Error retrieving roles: '.$tmp. |
|
' for '.$uname.':'.$udom); |
|
} else { |
|
my $group_privs = ''; |
my $group_privs = ''; |
foreach my $group (@changegroups) { |
foreach my $group (@changegroups) { |
if ($chgtype eq 'add') { |
if ($chgtype eq 'add') { |
Line 438 sub group_changes {
|
Line 435 sub group_changes {
|
|
|
sub get_fixed_privs { |
sub get_fixed_privs { |
my $fixedprivs = { |
my $fixedprivs = { |
communication => {sgm => 1}, |
email => {sgm => 1}, |
discussion => {vgb => 1}, |
discussion => {vgb => 1}, |
chat => {pgc => 1}, |
chat => {pgc => 1}, |
files => {rgf => 1}, |
files => {rgf => 1}, |
Line 453 sub get_fixed_privs {
|
Line 450 sub get_fixed_privs {
|
sub get_tool_privs { |
sub get_tool_privs { |
my ($gpterm) = @_; |
my ($gpterm) = @_; |
my $toolprivs = { |
my $toolprivs = { |
communication => { |
email => { |
sgm => 'Send '.$gpterm.' message', |
sgm => 'Send '.$gpterm.' message', |
sgb => 'Broadcast message', |
sgb => 'Broadcast message', |
}, |
}, |
Line 465 sub get_tool_privs {
|
Line 462 sub get_tool_privs {
|
vgb => 'View boards', |
vgb => 'View boards', |
}, |
}, |
chat => { |
chat => { |
pgc => 'Chat', |
pgc => 'Chat Room', |
}, |
}, |
files => { |
files => { |
rgf => 'Retrieve', |
rgf => 'Retrieve', |
Line 685 sub get_group_bbinfo {
|
Line 682 sub get_group_bbinfo {
|
|
|
############################################### |
############################################### |
|
|
|
sub get_group_link { |
|
my ($cdom,$cnum,$group,$navmap,$view_permission,$refarg) = @_; |
|
if (ref($navmap)) { |
|
my $map = "uploaded/$cdom/$cnum/group_folder_"."$group.sequence"; |
|
my $mapres = $navmap->getResourceByUrl("/$map"); |
|
my $hidden; |
|
if (ref($mapres)) { |
|
if ((!$view_permission) && ($mapres->randomout())) { |
|
$hidden = 1; |
|
} |
|
} |
|
my $url = "adm/$cdom/$cnum/$group/smppg"; |
|
my $idx = '1'; |
|
my $symb = $map.'___'.$idx.'___'.$url; |
|
my $res = $navmap->getBySymb($symb); |
|
$url = "/$url"; |
|
$map = "/$map"; |
|
my $link; |
|
if (ref($res)) { |
|
if ((!$view_permission) && ($res->randomout())) { |
|
$hidden = 1; |
|
} else { |
|
$hidden = 0; |
|
if ($refarg) { |
|
$link = $url.'?'.$refarg; |
|
} else { |
|
$link = $res->link(); |
|
$link .= (($link=~/\?/)?'&':'?').'symb='.$res->shown_symb(); |
|
} |
|
} |
|
} elsif (&Apache::lonnet::is_on_map($url)) { |
|
unless ($hidden) { |
|
$link = $url; |
|
if ($refarg) { |
|
$link = $url.'?'.$refarg; |
|
} |
|
} |
|
} |
|
if (wantarray) { |
|
return ($link,$hidden); |
|
} else { |
|
return $link; |
|
} |
|
} |
|
return; |
|
} |
|
|
|
############################################### |
|
|
|
sub display_group_links { |
|
my ($r,$target,$group,$context,$refarg,$numtoolsref,$hidehdr,%groupinfo) = @_; |
|
my @available = (); |
|
my %menu = (); |
|
%{$menu{'email'}} = ( |
|
text => 'Group Message', |
|
href => '/adm/email?compose=group&group='.$group. |
|
$refarg, |
|
); |
|
%{$menu{'discussion'}} = ( |
|
text => 'Discussion Boards', |
|
href => '/adm/groupboards?group='.$group.$refarg, |
|
); |
|
%{$menu{'chat'}} = ( |
|
text => 'Group Chat Room', |
|
href => "javascript:group_chat('$group')", |
|
); |
|
%{$menu{'files'}} = ( |
|
text => 'Group Portfolio', |
|
href => '/adm/coursegrp_portfolio?group='.$group. |
|
$refarg, |
|
); |
|
%{$menu{'roster'}} = ( |
|
text => 'Membership Roster', |
|
href => '/adm/grouproster?group='.$group.$refarg, |
|
); |
|
foreach my $tool (sort(keys(%menu))) { |
|
if ($groupinfo{functions}{$tool} eq 'on') { |
|
push(@available,$tool); |
|
} |
|
} |
|
my $output = ''; |
|
if (ref($numtoolsref) eq 'SCALAR') { |
|
$$numtoolsref = scalar(@available); |
|
} |
|
if (@available > 0) { |
|
if ($target eq 'tex') { |
|
$output = '<table cellspacing="4" cellpadding="4">'; |
|
} else { |
|
$output = &Apache::loncommon::start_data_table(); |
|
} |
|
foreach my $tool (@available) { |
|
if ($target eq 'tex') { |
|
$output .= '<tr><td>'.&mt($menu{$tool}{text}).'</td></tr>'; |
|
} else { |
|
$output .= &Apache::loncommon::start_data_table_row() |
|
.'<td><a href="'.$menu{$tool}{href}.'">' |
|
.&mt($menu{$tool}{text}).'</a></td>' |
|
.&Apache::loncommon::end_data_table_row(); |
|
} |
|
} |
|
if ($target eq 'tex') { |
|
$output .= '</table>'; |
|
} else { |
|
$output .= &Apache::loncommon::end_data_table(); |
|
} |
|
if ($target eq 'tex') { |
|
$output = &Apache::lonxml::xmlparse($r,'tex',&mt('Available functions').'<br /><br />'.$output); |
|
} else { |
|
unless ($hidehdr) { |
|
$output = '<h3>'.&mt('Available Group Tools').'</h3>'.$output; |
|
} |
|
} |
|
} else { |
|
if ($context eq 'edit') { |
|
$output = &mt('No group functionality.'); |
|
} else { |
|
$output = &mt('No group functionality (e.g., e-mail, discussion, chat room or file upload) is currently available to you in this group: [_1].', |
|
'<b>'.&unescape($groupinfo{'description'}).'</b>'); |
|
} |
|
if ($target eq 'tex') { |
|
$output = &Apache::lonxml::xmlparse($r,'tex',$output); |
|
} |
|
} |
|
return $output; |
|
} |
|
|
1; |
1; |
|
|