version 1.76, 2008/05/07 00:10:59
|
version 1.104, 2009/11/06 19:49:26
|
Line 54 sub handler {
|
Line 54 sub handler {
|
if (! ($env{'request.course.fn'})) { |
if (! ($env{'request.course.fn'})) { |
# Not in a course |
# Not in a course |
$env{'user.error.msg'}= |
$env{'user.error.msg'}= |
"/adm/coursegroups:mdg:0:0:Cannot edit or view course groups"; |
"/adm/coursegroups:mdg:0:0:Cannot edit or view course/community groups"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
|
|
Line 75 sub handler {
|
Line 75 sub handler {
|
my $crstype = &Apache::loncommon::course_type(); |
my $crstype = &Apache::loncommon::course_type(); |
|
|
my %functions = ( |
my %functions = ( |
email => 'E-mail', |
email => 'Send Messages', |
discussion => 'Discussion boards', |
discussion => 'Discussion Boards', |
chat => 'Chat', |
chat => 'Chat Room', |
files => 'File repository', |
files => 'Group Portfolio', |
roster => 'Membership roster', |
roster => 'Membership Roster', |
homepage => $ucgpterm.' home page', |
homepage => $ucgpterm.' home page', |
); |
); |
|
|
Line 111 sub handler {
|
Line 111 sub handler {
|
$crstype); |
$crstype); |
} |
} |
} else { |
} else { |
$r->print(&mt('You do not have [_1] administration '. |
$r->print('<div class="LC_warning">' |
'privileges in this [_2]',$gpterm,lc($crstype))); |
.&mt('You do not have '.$gpterm.' administration ' |
|
.'privileges in this '.lc($crstype).'.') |
|
.'</div>'); |
} |
} |
} else { |
} else { |
&print_main_menu($r,$cdom,$cnum,\%functions,\%idx,$view_permission, |
&print_main_menu($r,$cdom,$cnum,\%functions,\%idx,$view_permission, |
Line 139 function openGroupRoster(group,status) {
|
Line 141 function openGroupRoster(group,status) {
|
rosterbrowser = open(url,title,options,'1'); |
rosterbrowser = open(url,title,options,'1'); |
rosterbrowser.focus(); |
rosterbrowser.focus(); |
}\n|; |
}\n|; |
$r->print(&header('Groups',$jscript,$action,$state)); |
$r->print(&header('My Space',$jscript,$action,$state)); |
if ($env{'form.refpage'} eq 'cusr') { |
if ($env{'form.refpage'} eq 'cusr') { |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"/adm/createuser", |
({href=>"/adm/createuser", |
Line 346 END
|
Line 348 END
|
'<td>'.$functionality.'</td>'. |
'<td>'.$functionality.'</td>'. |
'<td align="right">'.$quota.'</td>'. |
'<td align="right">'.$quota.'</td>'. |
'<td align="right">'.$totalmembers.'</td>'. |
'<td align="right">'.$totalmembers.'</td>'. |
'<td align="right"><nobr>'.&mt('Files: ').$totalfiles.'</nobr><br /><nobr>'.&mt('Folders: ').$totaldirs.'</nobr></td>'. |
'<td align="right">'. |
|
'<span class="LC_nobreak">'.&mt('Files: [_1]',$totalfiles).'</span><br />'. |
|
'<span class="LC_nobreak">'.&mt('Folders: [_1]',$totaldirs).'</span>'. |
|
'</td>'. |
'<td align="right">'.$boards.'</td>'. |
'<td align="right">'.$boards.'</td>'. |
'<td align="right">'.$diskuse.'</td>'. |
'<td align="right">'.$diskuse.'</td>'. |
&Apache::loncommon::end_data_table_row()); |
&Apache::loncommon::end_data_table_row()); |
Line 390 END
|
Line 395 END
|
} |
} |
} |
} |
} else { |
} else { |
$r->print(&mt('You are not currently a member of any '. |
$r->print(&mt('You are not currently a member of any active '.$gpterm.'s in this '.lc($crstype).'.')); |
'active [_1]s in this [_2]',$gpterm, |
|
lc($crstype))); |
|
} |
} |
} |
} |
return; |
return; |
Line 406 sub group_administration {
|
Line 409 sub group_administration {
|
my @types = (); |
my @types = (); |
my @roles = (); |
my @roles = (); |
my @sections = (); |
my @sections = (); |
my @buildsections = (); |
|
my %users = (); |
my %users = (); |
my %userdata = (); |
my %userdata = (); |
my @members = (); |
my @members = (); |
Line 535 sub group_administration {
|
Line 537 sub group_administration {
|
|
|
if (ref($stored{'autorole'}) eq 'ARRAY') { |
if (ref($stored{'autorole'}) eq 'ARRAY') { |
foreach my $role (@{$stored{'autorole'}}) { |
foreach my $role (@{$stored{'autorole'}}) { |
unless ($role eq 'cc') { |
unless (($role eq 'cc') || ($role eq 'co')) { |
$elements{'modify'}{'change_settings'}{'sec_'.$role} = |
$elements{'modify'}{'change_settings'}{'sec_'.$role} = |
'selectbox'; |
'selectbox'; |
} |
} |
Line 566 sub group_administration {
|
Line 568 sub group_administration {
|
} |
} |
if (defined($env{'form.sectionpick'})) { |
if (defined($env{'form.sectionpick'})) { |
@sections=&Apache::loncommon::get_env_multiple('form.sectionpick'); |
@sections=&Apache::loncommon::get_env_multiple('form.sectionpick'); |
if (grep/^all$/,@sections) { |
|
@buildsections = sort {$a cmp $b} keys(%sectioncount); |
|
} else { |
|
@buildsections = @sections; |
|
} |
|
} |
} |
} |
} |
|
|
if (($state eq 'pick_members') || ($state eq 'pick_privs') || ($state eq 'change_privs')) { |
if (($state eq 'pick_members') || ($state eq 'pick_privs') || ($state eq 'change_privs')) { |
&build_members_list($cdom,$cnum,\@types,\@roles,\@buildsections,\%users, |
&build_members_list($cdom,$cnum,\@types,\@roles,\@sections,\%users, |
\%userdata); |
\%userdata); |
} |
} |
if ($state eq 'pick_members') { |
if ($state eq 'pick_members') { |
Line 788 sub group_administration {
|
Line 785 sub group_administration {
|
} |
} |
var maxposs = '.sprintf("%.2f",$maxposs).'; |
var maxposs = '.sprintf("%.2f",$maxposs).'; |
if (newquota > maxposs) { |
if (newquota > maxposs) { |
alert("The file repository quota you entered for this group ("+newquota+" Mb) exceeds the maximum possible ("+maxposs+" Mb). Please enter a smaller number."); |
alert("The group portfolio quota you entered for this group ("+newquota+" Mb) exceeds the maximum possible ("+maxposs+" Mb). Please enter a smaller number."); |
return; |
return; |
} |
} |
var re_quota = '.$float_check.'; |
var re_quota = '.$float_check.'; |
Line 807 sub group_administration {
|
Line 804 sub group_administration {
|
} |
} |
} |
} |
if (warn_zero == 1) { |
if (warn_zero == 1) { |
alert("You have indicated that the file repository should be enabled, but you have set the respository quota to 0 Mb.\nThis will prevent any upload of files.\nPlease set a value or disable the repository feature."); |
alert("You have indicated that the group portfolio should be enabled, but you have set the respository quota to 0 Mb.\nThis will prevent any upload of files.\nPlease set a value or disable the repository feature."); |
return; |
return; |
} |
} |
} |
} |
Line 918 function changeSort(caller) {
|
Line 915 function changeSort(caller) {
|
result => 'Re-enabled' |
result => 'Re-enabled' |
); |
); |
my %navbuttons = &Apache::lonlocal::texthash( |
my %navbuttons = &Apache::lonlocal::texthash( |
gtns => 'Go to next step', |
gtns => 'Next',#'Go to next step', |
gtps => 'Go to previous step', |
gtps => 'Back',#'Go to previous step', |
crgr => 'Create '.$gpterm, |
crgr => 'Create '.$gpterm, |
mose => 'Modify settings', |
mose => 'Save',#'Modify settings', |
gtpp => 'Go to previous page', |
gtpp => 'Back',#'Go to previous page', |
adme => 'Add members', |
adme => 'Add members', |
); |
); |
if ((($action eq 'create') || ($action eq 'modify') || ($action eq 'delete') || ($action eq 'reenable')) && |
if ((($action eq 'create') || ($action eq 'modify') || ($action eq 'delete') || ($action eq 'reenable')) && |
Line 1089 sub display_control {
|
Line 1086 sub display_control {
|
&add_members_form($r,$cdom,$cnum,$action,$state,$page,$startdate, |
&add_members_form($r,$cdom,$cnum,$action,$state,$page,$startdate, |
$enddate,$groupname,$description,$granularity, |
$enddate,$groupname,$description,$granularity, |
$quota,$sectioncount,$tools,$functions,$stored, |
$quota,$sectioncount,$tools,$functions,$stored, |
$states,$navbuttons,$gpterm,$ucgpterm); |
$states,$navbuttons,$gpterm,$ucgpterm,$crstype); |
} elsif ($state eq 'pick_members') { |
} elsif ($state eq 'pick_members') { |
&choose_members_form($r,$cdom,$cnum,$action,$state,$page, |
&choose_members_form($r,$cdom,$cnum,$action,$state,$page, |
$groupname,$description,$granularity,$quota, |
$groupname,$description,$granularity,$quota, |
Line 1122 sub display_control {
|
Line 1119 sub display_control {
|
my %stored = &retrieve_settings($cdom,$cnum,$groupname,$action); |
my %stored = &retrieve_settings($cdom,$cnum,$groupname,$action); |
if ($state eq 'verify') { |
if ($state eq 'verify') { |
&verify_delete($r,$groupname,$state,$action,$page,$states, |
&verify_delete($r,$groupname,$state,$action,$page,$states, |
\%stored); |
\%stored,$crstype); |
} elsif ($state eq 'result') { |
} elsif ($state eq 'result') { |
&delete_group($r,$cdom,$cnum,$groupname); |
&delete_group($r,$cdom,$cnum,$groupname,$crstype); |
} |
} |
} elsif ($action eq 'reenable') { |
} elsif ($action eq 'reenable') { |
my %stored = &retrieve_settings($cdom,$cnum,$groupname,$action); |
my %stored = &retrieve_settings($cdom,$cnum,$groupname,$action); |
if ($state eq 'verify') { |
if ($state eq 'verify') { |
&verify_reenable($r,$groupname,$state,$action,$page,$states, |
&verify_reenable($r,$groupname,$state,$action,$page,$states, |
\%stored); |
\%stored,$crstype); |
} elsif ($state eq 'result') { |
} elsif ($state eq 'result') { |
&reenable_group($r,$cdom,$cnum,$groupname); |
&reenable_group($r,$cdom,$cnum,$groupname,$crstype); |
} |
} |
} |
} |
} |
} |
|
|
sub verify_delete { |
sub verify_delete { |
my ($r,$groupname,$formname,$action,$page,$states,$stored) = @_; |
my ($r,$groupname,$formname,$action,$page,$states,$stored,$crstype) = @_; |
$r->print(&Apache::lonhtmlcommon::echo_form_input([])); |
$r->print(&Apache::lonhtmlcommon::echo_form_input([])); |
$r->print(&mt("You have requested deletion of the following group: ").'<i>'. |
$r->print(&mt('You have requested deletion of the group [_1].' |
$stored->{'description'}.'</i>'. |
,'<i>'.$stored->{'description'}.'</i>'). |
'<br /><br />'.&mt('When a group is deleted the following occurs:').'<ul>'. |
'<br /><br />'.&mt('When a group is deleted the following occurs:').'<ul>'. |
'<li>'.&mt('All group membership is terminated.').'</li>'. |
'<li>'.&mt('All group membership is terminated.').'</li>'. |
'<li>'.&mt('The group ceases to be available either for viewing or for modification of group settings and membership.').'</li>'. |
'<li>'.&mt('The group ceases to be available either for viewing or for modification of group settings and membership.').'</li>'); |
'<li>'.&mt('The group folder is removed from the folder containing it - normally this is the "Course Groups" folder which contains folders for all groups in the course.').'</li>'. |
if ($crstype eq 'Community') { |
'</ul>'.&mt('Although a deleted group is no longer accessible, the group name used for the group will be reserved, and will not be available for assignment to a new group in the same course in the future.')); |
$r->print( '<li>'.&mt("The group folder is removed from the folder containing it - normally this is the 'Community Groups' folder which contains folders for all groups in the community.").'</li>'. |
|
'</ul>'.&mt("Although a deleted group is no longer accessible, the group name used for the group will be reserved, and will not be available for assignment to a new group in the same community in the future.")); |
|
} else { |
|
$r->print( '<li>'.&mt("The group folder is removed from the folder containing it - normally this is the 'Course Groups' folder which contains folders for all groups in the course.").'</li>'. |
|
'</ul>'.&mt("Although a deleted group is no longer accessible, the group name used for the group will be reserved, and will not be available for assignment to a new group in the same course in the future.")); |
|
} |
my $prevtext = &mt('Go back'); |
my $prevtext = &mt('Go back'); |
my $nexttext = &mt('Delete group'); |
my $nexttext = &mt('Delete group'); |
my $prev; |
my $prev; |
Line 1159 sub verify_delete {
|
Line 1161 sub verify_delete {
|
} |
} |
|
|
sub delete_group { |
sub delete_group { |
my ($r,$cdom,$cnum,$groupname) = @_; |
my ($r,$cdom,$cnum,$groupname,$crstype) = @_; |
my %membership = &Apache::lonnet::get_group_membership($cdom,$cnum, |
my %membership = &Apache::lonnet::get_group_membership($cdom,$cnum, |
$groupname); |
$groupname); |
my $now = time; |
my $now = time; |
Line 1169 sub delete_group {
|
Line 1171 sub delete_group {
|
my @deleted; |
my @deleted; |
my @undeleted; |
my @undeleted; |
my %usersettings; |
my %usersettings; |
|
my $context = 'deletegroup'; |
foreach my $key (sort(keys(%membership))) { |
foreach my $key (sort(keys(%membership))) { |
if ($key =~ /^\Q$groupname\E:([^:]+:[^:]+)$/) { |
if ($key =~ /^\Q$groupname\E:([^:]+:[^:]+)$/) { |
my $user = $1; |
my $user = $1; |
Line 1196 sub delete_group {
|
Line 1199 sub delete_group {
|
\%usersettings); |
\%usersettings); |
} |
} |
if ($num_fail > 0) { |
if ($num_fail > 0) { |
$r->print(&mt('Group deletion failed because deletion of [_1] out of [_2] members failed.',$num_fail,$num_users)); |
$r->print('<div class="LC_error">' |
|
.&mt('Group deletion failed because deletion of [_1] out of [_2] members failed.' |
|
,$num_fail,$num_users) |
|
.'</div>'); |
} else { |
} else { |
my ($result,$message) = |
my ($result,$message) = |
&Apache::lonnet::toggle_coursegroup_status($cdom,$cnum, |
&Apache::lonnet::toggle_coursegroup_status($cdom,$cnum, |
$groupname,'delete'); |
$groupname,'delete'); |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
my $outcome = &modify_folders($cdom,$cnum,$groupname); |
my $outcome = &modify_folders($cdom,$cnum,$groupname,$crstype); |
if ($outcome eq '') { |
if ($outcome eq '') { |
$r->print(&mt('Group successfully deleted.')); |
$r->print('<div class="LC_success">' |
|
.&mt('Group successfully deleted.') |
|
.'</div>'); |
} else { |
} else { |
$r->print(&mt("Although the group was deleted, an error ([_1]) occurred when removing the group's folder from the 'Course Groups' folder.",$outcome)); |
$r->print('<div class="LC_error">'); |
|
if ($crstype eq 'Comunity') { |
|
$r->print(&mt("Although the group was deleted, an error occurred when removing the group's folder from the 'Community Groups' folder: [_1]",$outcome)); |
|
} else { |
|
$r->print(&mt("Although the group was deleted, an error occurred when removing the group's folder from the 'Course Groups' folder: [_1]",$outcome)); |
|
} |
|
$r->print('</div>'); |
} |
} |
} else { |
} else { |
$r->print(&mt('Group deletion failed.')); |
$r->print('<div class="LC_error">' |
|
.&mt('Group deletion failed.') |
|
.'</div>'); |
} |
} |
} |
} |
return; |
return; |
} |
} |
|
|
sub reenable_folder { |
sub reenable_folder { |
my ($cdom,$cnum,$groupname,$description) = @_; |
my ($cdom,$cnum,$groupname,$description,$crstype) = @_; |
my $outcome; |
my $outcome; |
my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/'; |
my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/'; |
my $allgrpsmap = $crspath.'group_allfolders.sequence'; |
my $allgrpsmap = $crspath.'group_allfolders.sequence'; |
my $foldertitle = &mt('Course Folder -').$description; |
my $foldertitle; |
|
if ($crstype eq 'Community') { |
|
$foldertitle = &mt("Community Folder -[_1]",$description); |
|
} else { |
|
$foldertitle = &mt("Course Folder -[_1]",$description); |
|
} |
my $mapurl = $crspath.'group_folder_'. |
my $mapurl = $crspath.'group_folder_'. |
$groupname.'.sequence'; |
$groupname.'.sequence'; |
my ($errtext,$fatal)=&LONCAPA::map::mapread($allgrpsmap); |
my ($errtext,$fatal)=&LONCAPA::map::mapread($allgrpsmap); |
if ($fatal) { |
if ($fatal) { |
$outcome=&mt('Error reading contents of parent folder to group'). |
$outcome='<div class="LC_error">' |
" ($allgrpsmap): $errtext".'<br />'; |
.&mt('An error occurred when reading contents of parent folder to group:') |
|
."<br />($allgrpsmap): $errtext" |
|
.'</div>'; |
} else { |
} else { |
my $idx=&LONCAPA::map::getresidx($mapurl); |
my $idx=&LONCAPA::map::getresidx($mapurl); |
$LONCAPA::map::resources[$idx] = $foldertitle.':'.$mapurl. |
$LONCAPA::map::resources[$idx] = $foldertitle.':'.$mapurl. |
Line 1235 sub reenable_folder {
|
Line 1257 sub reenable_folder {
|
$LONCAPA::map::order[1+$#LONCAPA::map::order]=$idx; |
$LONCAPA::map::order[1+$#LONCAPA::map::order]=$idx; |
my ($outtext,$errtext) = &LONCAPA::map::storemap($allgrpsmap,1); |
my ($outtext,$errtext) = &LONCAPA::map::storemap($allgrpsmap,1); |
if ($errtext) { |
if ($errtext) { |
$outcome = &mt('Error saving updated parent folder to group'). |
$outcome='<div class="LC_error">' |
"- $allgrpsmap - $errtext".'<br />'; |
.&mt('An error occurred when saving updated parent folder to group:' |
|
,"<br />$allgrpsmap - $errtext") |
|
.'</div>'; |
} else { |
} else { |
my ($furl,$ferr) = |
my ($furl,$ferr) = |
&Apache::lonuserstate::readmap($cdom.'/'.$cnum); |
&Apache::lonuserstate::readmap($cdom.'/'.$cnum); |
Line 1246 sub reenable_folder {
|
Line 1270 sub reenable_folder {
|
} |
} |
|
|
sub modify_folders { |
sub modify_folders { |
my ($cdom,$cnum,$groupname) = @_; |
my ($cdom,$cnum,$groupname,$crstype) = @_; |
my $outcome; |
my ($outcome,$groupmap,$groupmapres,$map,$id,$src); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $groupmap = '/uploaded/'.$cdom.'/'.$cnum.'/'.'group_folder_'. |
if (!defined($navmap)) { |
|
$outcome = '<div class="LC_error">'; |
|
if ($crstype eq 'Community') { |
|
$outcome .= &mt("Error reading community contents.").' '. |
|
&mt("You need to re-initialize the community."); |
|
} else { |
|
$outcome .= &mt("Error reading course contents.").' '. |
|
&mt("You need to re-initialize the course."); |
|
} |
|
$outcome .= '</div>'; |
|
return $outcome; |
|
} |
|
$groupmap = '/uploaded/'.$cdom.'/'.$cnum.'/'.'group_folder_'. |
$groupname.'.sequence'; |
$groupname.'.sequence'; |
my $groupmapres = $navmap->getResourceByUrl($groupmap); |
$groupmapres = $navmap->getResourceByUrl($groupmap); |
my ($map,$id,$src); |
|
if ($groupmapres) { |
if ($groupmapres) { |
($map,$id,$src)=&Apache::lonnet::decode_symb($groupmapres->symb()); |
($map,$id,$src)=&Apache::lonnet::decode_symb($groupmapres->symb()); |
} |
} |
Line 1261 sub modify_folders {
|
Line 1296 sub modify_folders {
|
$map = '/'.$map; |
$map = '/'.$map; |
my ($errtext,$fatal) = &LONCAPA::map::mapread($map); |
my ($errtext,$fatal) = &LONCAPA::map::mapread($map); |
if ($fatal) { |
if ($fatal) { |
$outcome=&mt('Error reading contents of parent folder to group'). |
$outcome='<div class="LC_error">' |
" ($map): $errtext".'<br />'; |
.&mt('An error occurred when reading contents of parent folder to group:') |
|
."<br />($map): $errtext" |
|
.'</div>'; |
} else { |
} else { |
my $idx = 0; |
my $idx = 0; |
my $grpidx; |
my $grpidx; |
Line 1285 sub modify_folders {
|
Line 1322 sub modify_folders {
|
$#LONCAPA::map::order--; |
$#LONCAPA::map::order--; |
my ($outtext,$errtext) = &LONCAPA::map::storemap($map,1); |
my ($outtext,$errtext) = &LONCAPA::map::storemap($map,1); |
if ($errtext) { |
if ($errtext) { |
$outcome = &mt('Error saving updated parent folder to group'). "- $map - $errtext".'<br />'; |
$outcome='<div class="LC_error">' |
|
.&mt('An error occurred when saving updated parent folder to group:') |
|
."<br />$map - $errtext" |
|
.'</div>'; |
} else { |
} else { |
my ($furl,$ferr) = |
my ($furl,$ferr) = |
&Apache::lonuserstate::readmap($cdom.'/'.$cnum); |
&Apache::lonuserstate::readmap($cdom.'/'.$cnum); |
Line 1297 sub modify_folders {
|
Line 1337 sub modify_folders {
|
} |
} |
|
|
sub verify_reenable { |
sub verify_reenable { |
my ($r,$groupname,$formname,$action,$page,$states,$stored) = @_; |
my ($r,$groupname,$formname,$action,$page,$states,$stored,$crstype) = @_; |
$r->print(&Apache::lonhtmlcommon::echo_form_input([])); |
$r->print(&Apache::lonhtmlcommon::echo_form_input([])); |
$r->print(&mt("You have requested enabling the following previously deleted group: ").'<i>'. |
$r->print(&mt('You have requested enabling the previously deleted group [_1].' |
$stored->{'description'}.'</i>'. |
,'<i>'.$stored->{'description'}.'</i>'). |
'<br /><br />'.&mt('When a deleted group is re-enabled the following occurs:').'<ul>'. |
'<br /><br />'.&mt('When a deleted group is re-enabled the following occurs:').'<ul>'. |
'<li>'.&mt('Group settings and membership at the time the group was deleted are reinstated.').'</li>'. |
'<li>'.&mt('Group settings and membership at the time the group was deleted are reinstated.').'</li><li>'); |
'<li>'.&mt('A group folder is added to the "Course Groups" folder which contains folders for all groups in the course.').'</li></ul>'); |
if ($crstype eq 'Community') { |
|
$r->print(&mt("A group folder is added to the 'Community Groups' folder which contains folders for all groups in the community.")); |
|
} else { |
|
$r->print(&mt("A group folder is added to the 'Course Groups' folder which contains folders for all groups in the course.")); |
|
} |
|
$r->print('</li></ul>'); |
my $prevtext = &mt('Go back'); |
my $prevtext = &mt('Go back'); |
my $nexttext = &mt('Reenable group'); |
my $nexttext = &mt('Reenable group'); |
my $prev; |
my $prev; |
Line 1316 sub verify_reenable {
|
Line 1361 sub verify_reenable {
|
} |
} |
|
|
sub reenable_group { |
sub reenable_group { |
my ($r,$cdom,$cnum,$groupname) = @_; |
my ($r,$cdom,$cnum,$groupname,$crstype) = @_; |
my %groups = |
my %groups = |
&Apache::longroup::coursegroups($cdom,$cnum,$groupname, |
&Apache::longroup::coursegroups($cdom,$cnum,$groupname, |
'deleted_groups'); |
'deleted_groups'); |
if (keys(%groups) == 0) { |
if (keys(%groups) == 0) { |
$r->print(&mt('The group ([_1]) was not re-enabled, because it is not a deleted group.<br />Perhaps it has already been re-enabled?',$groupname)); |
$r->print(&mt('The group [_1] was not re-enabled, because it is not a deleted group.[_2]Perhaps it has already been re-enabled?','<i>'.$groupname.'</i>'),'<br />'); |
return; |
return; |
} |
} |
my %groupinfo = |
my %groupinfo = |
Line 1339 sub reenable_group {
|
Line 1384 sub reenable_group {
|
my $num_users = 0; |
my $num_users = 0; |
my $num_ok = 0; |
my $num_ok = 0; |
my $num_fail = 0; |
my $num_fail = 0; |
|
my $context = 'reenablegroup'; |
my (%usersettings,@enabled,@unenabled); |
my (%usersettings,@enabled,@unenabled); |
my ($result,$message) = |
my ($result,$message) = |
&Apache::lonnet::toggle_coursegroup_status($cdom,$cnum,$groupname, |
&Apache::lonnet::toggle_coursegroup_status($cdom,$cnum,$groupname, |
Line 1375 $context) eq 'ok') {
|
Line 1421 $context) eq 'ok') {
|
&Apache::lonnet::modify_coursegroup_membership($cdom,$cnum, |
&Apache::lonnet::modify_coursegroup_membership($cdom,$cnum, |
\%usersettings); |
\%usersettings); |
if ($roster_result eq 'ok') { |
if ($roster_result eq 'ok') { |
$r->print(&mt('Membership reinstated for [_1] users, each with start and end dates for group access set to defaults: [_2] and [_3]',$num_ok,$showstart,$showend).'<br />'); |
$r->print('<div class="LC_success">' |
|
.&mt('Membership reinstated for [quant,_1,user], each with start and end dates for group access set to defaults: [_2] and [_3]',$num_ok,$showstart,$showend) |
|
.'</div>'); |
} |
} |
} else { |
} else { |
$r->print(&mt('A problem occurred when trying to reinstate [_1] of the [_2] members of the pre-existing group.',$num_fail,$num_users).'<br />'); |
$r->print('<div class="LC_error">' |
|
.&mt('A problem occurred when trying to reinstate [_1] of the [_2] members of the pre-existing group.',$num_fail,$num_users) |
|
.'</div>'); |
} |
} |
} else { |
} else { |
$r->print(&mt('There were no group members to reinstate, as none were removed when the group was deleted.').'<br />'); |
$r->print('<div class="LC_info">' |
|
.&mt('There were no group members to reinstate, as none were removed when the group was deleted.') |
|
.'</div>'); |
} |
} |
my $outcome = &reenable_folder($cdom,$cnum,$groupname,$description); |
my $outcome = &reenable_folder($cdom,$cnum,$groupname,$description,$crstype); |
if ($outcome eq '') { |
if ($outcome eq '') { |
$r->print(&mt('Group successfully re-enabled.')); |
$r->print('<div class="LC_success">' |
|
.&mt('Group successfully re-enabled.') |
|
.'</div>'); |
} else { |
} else { |
$r->print(&mt("Although the group was re-enabled, an error ([_1]) occurred when adding the group's folder to the 'Course Groups' folder.",$outcome)); |
$r->print('<div class="LC_error">'); |
|
if ($crstype eq 'Comunity') { |
|
$r->print(&mt("Although the group was re-enabled, an error occurred when adding the group's folder to the 'Community Groups' folder: [_1]",$outcome)); |
|
} else { |
|
$r->print(&mt("Although the group was re-enabled, an error occurred when adding the group's folder to the 'Course Groups' folder: [_1]",$outcome)); |
|
} |
|
$r->print('</div>'); |
} |
} |
} else { |
} else { |
$r->print(&mt('Re-enabling group failed')); |
$r->print('<div class="LC_error">' |
|
.&mt('Re-enabling group failed.') |
|
.'</div>'); |
} |
} |
return; |
return; |
} |
} |
Line 1404 sub header {
|
Line 1466 sub header {
|
{'add_entries' => $loaditems,}); |
{'add_entries' => $loaditems,}); |
my $output = <<"END"; |
my $output = <<"END"; |
$start_page |
$start_page |
<form method="POST" name="$state"> |
<form method="post" name="$state"> |
|
|
END |
END |
if ($action eq 'create' || $action eq 'modify') { |
if ($action eq 'create' || $action eq 'modify') { |
Line 1523 sub open_list_window {
|
Line 1585 sub open_list_window {
|
my ($group,$status,$count,$text) = @_; |
my ($group,$status,$count,$text) = @_; |
my $entry; |
my $entry; |
if ($count > 0) { |
if ($count > 0) { |
$entry = '<nobr><a href="javascript:openGroupRoster('. |
$entry = '<span class="LC_nobreak"><a href="javascript:openGroupRoster('. |
"'$group','$status'".')">'.$text.'</a> - '.$count. |
"'$group','$status'".')">'.$text.'</a> - '.$count. |
'</nobr><br />'; |
'</span><br />'; |
} else { |
} else { |
$entry = '<nobr>'.$text.' - '.$count.'</nobr><br />'; |
$entry = '<span class="LC_nobreak">'.$text.' - '.$count.'</span><br />'; |
} |
} |
return $entry; |
return $entry; |
} |
} |
Line 1543 sub general_settings_form {
|
Line 1605 sub general_settings_form {
|
&access_date_settings($r,$action,$formname,$stored,2,$gpterm,$ucgpterm); |
&access_date_settings($r,$action,$formname,$stored,2,$gpterm,$ucgpterm); |
if ($action eq 'create') { |
if ($action eq 'create') { |
&membership_options($r,$cdom,$cnum,$action,$formname,$sectioncount,3, |
&membership_options($r,$cdom,$cnum,$action,$formname,$sectioncount,3, |
$gpterm,$ucgpterm); |
$gpterm,$ucgpterm,$crstype); |
$nexttext = $$navbuttons{'gtns'}; |
$nexttext = $$navbuttons{'gtns'}; |
} else { |
} else { |
my @available = (); |
my @available = (); |
Line 1552 sub general_settings_form {
|
Line 1614 sub general_settings_form {
|
@{$tools} = sort(keys(%{$functions})); |
@{$tools} = sort(keys(%{$functions})); |
&privilege_specificity($r,$action,3,$tools,$stored,$toolprivs, |
&privilege_specificity($r,$action,3,$tools,$stored,$toolprivs, |
$fixedprivs,\@available,$formname, |
$fixedprivs,\@available,$formname, |
$gpterm,$ucgpterm); |
$gpterm,$ucgpterm,$functions,$crstype); |
&mapping_options($r,$action,$formname,$page,$sectioncount, |
&mapping_options($r,$action,$formname,$page,$sectioncount, |
$states,$stored,$navbuttons,4,5, |
$states,$stored,$navbuttons,4,5, |
$gpterm,$ucgpterm,$crstype,$cdom,$cnum); |
$gpterm,$ucgpterm,$crstype,$cdom,$cnum); |
Line 1576 sub groupsettings_options {
|
Line 1638 sub groupsettings_options {
|
'lett' => 'Letters, numbers and underscore only', |
'lett' => 'Letters, numbers and underscore only', |
'doyo' => 'Different subsets of the chosen collaborative tools '. |
'doyo' => 'Different subsets of the chosen collaborative tools '. |
'for different group members?', |
'for different group members?', |
|
'gran' => 'Granularity', |
|
'dquo' => 'Disk quota', |
); |
); |
my ($crsquota,$freespace,$maxposs) = &get_quota_constraints($action,$stored); |
my ($crsquota,$freespace,$maxposs) = &get_quota_constraints($action,$stored); |
&topic_bar($r,$image,$lt{'gnde'}); |
$r->print(&Apache::lonhtmlcommon::topic_bar($image,$lt{'gnde'})); |
$r->print(' |
|
<table class="LC_descriptive_input"> |
# Group Name |
<tr> |
$r->print(&Apache::lonhtmlcommon::start_pick_box() |
<td class="LC_description">'.$lt{'gnam'}.':</td> |
.&Apache::lonhtmlcommon::row_title($lt{'gnam'}) |
<td colspan="5"> |
); |
'); |
|
if ($action eq 'create') { |
if ($action eq 'create') { |
$r->print('<input type="text" name="groupname" size="25" /> ('. |
$r->print('<input type="text" name="groupname" size="25" />' |
$lt{'lett'}.')'); |
.' <span class="LC_nobreak">(' |
|
.$lt{'lett'}.')</span>' |
|
); |
} else { |
} else { |
$r->print('<input type="hidden" name="groupname" value="'. |
$r->print('<input type="hidden" name="groupname" value="'. |
$env{'form.groupname'}.'" />'.$env{'form.groupname'}); |
$env{'form.groupname'}.'" />'.$env{'form.groupname'}); |
} |
} |
$r->print(<<"END"); |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
</td> |
|
<tr> |
# Group Title |
<tr> |
$r->print(&Apache::lonhtmlcommon::row_title($lt{'desc'}) |
<td class="LC_description">$lt{'desc'}:</td> |
.'<input type="text" name="description" size="40" value="" />' |
<td colspan="5"><input type="text" name="description" size="40" |
.&Apache::lonhtmlcommon::row_closure() |
value="" /> |
); |
</td> |
|
<tr> |
# Collaborative Tools |
<tr> |
|
<td class="LC_description">$lt{'func'}:</td> |
|
END |
|
my $numitems = keys(%{$functions}); |
my $numitems = keys(%{$functions}); |
my $halfnum = int($numitems/2); |
my $halfnum = int($numitems/2); |
my $remnum = $numitems%2; |
my $remnum = $numitems%2; |
Line 1611 END
|
Line 1673 END
|
$halfnum ++; |
$halfnum ++; |
} |
} |
my @allfunctions = sort(keys (%{$functions})); |
my @allfunctions = sort(keys (%{$functions})); |
for (my $i=0; $i<$halfnum; $i++) { |
|
$r->print('<td><label><input type="checkbox" name="tool" value="'. |
$r->print(&Apache::lonhtmlcommon::row_title($lt{'func'}) |
$allfunctions[$i].'" /> '. |
.'<div>' |
$$functions{$allfunctions[$i]}.'</label></td> |
.'<input type="button" value="'.&mt('check all').'"' |
<td> </td><td> </td>'); |
.' onclick="javascript:checkAll(document.'.$formname.'.tool)" />' |
} |
.' <input type="button" value="'.&mt('uncheck all').'"' |
$r->print('<td><input type="button" value="check all" '. |
.' onclick="javascript:uncheckAll(document.'.$formname.'.tool)" />' |
'onclick="javascript:checkAll(document.'.$formname.'.tool)" />'. |
.'</div>' |
'</td></tr><tr><td> </td>'); |
.'<table cellpadding="5px"><tr>' # FIXME Get rid of inflexible table (-> float) |
for (my $j=$halfnum; $j<@allfunctions; $j++) { |
); |
$r->print('<td><label><input type="checkbox" name="tool" value="'. |
for (my $i=0; $i<@allfunctions; $i++) { |
$allfunctions[$j].'" /> '. |
$r->print('<td><label><span class="LC_nobreak">' |
$$functions{$allfunctions[$j]}.'</label></td> |
.'<input type="checkbox" name="tool" value="' |
<td> </td><td> </td>'); |
.$allfunctions[$i].'" /> ' |
} |
.&mt($$functions{$allfunctions[$i]}) |
if ($remnum) { |
.'</span></label></td>' |
$r->print('<td> </td>'); |
); |
|
if ($i == $halfnum - 1) { |
|
$r->print('</tr><tr>'); |
|
} |
} |
} |
$r->print(' |
$r->print('</tr></table>' |
<td> |
.&Apache::lonhtmlcommon::row_closure() |
<input type="button" value="uncheck all" |
); |
onclick="javascript:uncheckAll(document.'.$formname.'.tool)" /> |
|
</td> |
# Granularity |
</tr> |
$r->print(&Apache::lonhtmlcommon::row_title($lt{'gran'}) |
<tr> |
.$lt{'doyo'}.'<br />' |
<td class="LC_description">'.&mt('Granularity:').'</td> |
.'<label>' |
<td colspan="10">'.$lt{'doyo'}.' <label><input type="radio" name="granularity" value="Yes" />'.&mt('Yes').'</label> <label><input type="radio" name="granularity" value="No" checked="checked" />'.&mt('No').'</label>'); |
.'<input type="radio" name="granularity" value="Yes" />'.&mt('Yes') |
|
.'</label> <label>' |
|
.'<input type="radio" name="granularity" value="No" checked="checked" />'.&mt('No') |
|
.'</label>' |
|
); |
if ($action eq 'modify') { |
if ($action eq 'modify') { |
$r->print(' ('.&mt('Currently set to "[_1]"', |
$r->print(' <span class="LC_nobreak">(' |
$$stored{'granularity'}).')'); |
.&mt('Currently set to [_1].' |
|
,'"'.&mt($$stored{'granularity'}).'"') |
|
.')</span>' |
|
); |
} |
} |
$r->print(' |
$r->print(&Apache::lonhtmlcommon::row_closure()); |
</td> |
|
</tr> |
# Disk Quota |
<tr> |
$r->print(&Apache::lonhtmlcommon::row_title($lt{'dquo'})); |
<td class="LC_description">'.&mt('Disk quota: ').'</td><td colspan="10">'); |
|
if ($action eq 'create') { |
if ($action eq 'create') { |
$r->print(&mt('If you enable the file repository for the [_1], allocate a disk quota.',$gpterm)); |
$r->print('<span class="LC_info">' |
|
.&mt('If you enable the group portfolio for the '.$gpterm |
|
.', allocate a disk quota.') |
|
.'</span>' |
|
); |
} else { |
} else { |
$r->print(&mt('Quota allocated to file repository:')); |
$r->print(&mt('Quota allocated to group portfolio:')); |
} |
} |
$r->print(' <input type="text" name="quota" size="4" />Mb'); |
$r->print(' '.&mt('[_1] Mb','<input type="text" name="quota" size="4" />')); |
if ($action eq 'create') { |
if ($action eq 'create') { |
$r->print('<br />'. |
$r->print('<br />' |
&mt('A total of [_1] Mb can be divided amongst all [_2]s in the '. |
.&mt('A total of [_1] Mb can be divided amongst all '.$gpterm.'s in the ' |
'[_3], and [_4] Mb are currently unallocated.',$crsquota, |
.lc($crstype).', and [_2] Mb are currently unallocated.' |
$gpterm,lc($crstype),sprintf("%.2f",$freespace))); |
,$crsquota,sprintf("%.2f",$freespace)) |
|
); |
} else { |
} else { |
$r->print(' ('.&mt('The quota is currently [_1] Mb', |
$r->print(' ('.&mt('The quota is currently [_1] Mb', |
$$stored{'quota'}).').'); |
$$stored{'quota'}).').'); |
|
|
$r->print('<br />'.&mt('The quota can be increased to [_1] Mb, '. |
$r->print('<br />' |
'by adding all unallocated space for [_2]s in the [_3].', |
.&mt('The quota can be increased to [_1] Mb, ' |
sprintf("%.2f",$maxposs),$gpterm,lc($crstype))); |
.'by adding all unallocated space for '.$gpterm.'s in the '.lc($crstype).'.' |
|
,sprintf("%.2f",$maxposs))); |
} |
} |
$r->print(' |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
</td> |
|
</tr> |
$r->print(&Apache::lonhtmlcommon::end_pick_box()); |
</table> |
|
'); |
|
return; |
return; |
} |
} |
|
|
Line 1691 sub get_quota_constraints {
|
Line 1767 sub get_quota_constraints {
|
} |
} |
|
|
sub membership_options { |
sub membership_options { |
my ($r,$cdom,$cnum,$action,$state,$sectioncount,$image,$gpterm,$ucgpterm)=@_; |
my ($r,$cdom,$cnum,$action,$state,$sectioncount,$image,$gpterm,$ucgpterm,$crstype)=@_; |
my $crstype = &Apache::loncommon::course_type(); |
|
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'pipa' => 'Build a list of users for selection of group members', |
'pipa' => 'Build a list of users for selection of group members', |
'gmem' => "Group membership selection list criteria:", |
'gmem' => 'Group membership selection list criteria:', |
'picr' => 'Pick the criteria to use to build a list of '. |
'picr' => 'Pick the criteria to use to build a list of course users from which you will select members of the new group.', |
lc($crstype).' users from which you will select ', |
'pica' => 'Pick the criteria to use to build a list of course users from which you will select additional members of the group.', |
'meof' => "members of the new group.", |
'ifno' => 'If you do not wish to add members when you first create the group, there is no need to pick any criteria.', |
'admg' => "additional members of the group.", |
'asub' => 'A subsequent step will also allow you to specify automatic adding/dropping of group members triggered by specified user role and section <i>changes</i> in the course.', |
'ifno' => "If you do not wish to add members when you first ". |
|
"create the group, there is no need to pick any criteria.", |
|
'asub' => "A subsequent step will also allow you to specify automatic adding/dropping of group members triggered by specified user role and section <i>changes</i> in the course.", |
|
'acty' => 'Access types', |
'acty' => 'Access types', |
'coro' => $crstype.' roles', |
'coro' => 'Course roles', |
'cose' => $crstype.' sections', |
'cose' => 'Course sections', |
); |
); |
|
if ($crstype eq 'Community') { |
|
$lt{'picr'} = &mt('Pick the criteria to use to build a list of community participants from which you will select '); |
|
$lt{'asub'} = &mt('A subsequent step will also allow you to specify automatic adding/dropping of group members triggered by specified user role and section [_1]changes[_2] in the course.','<i>','</i>'); |
|
$lt{'coro'} = &mt('Community roles'); |
|
$lt{'cose'} = &mt('Community sections'); |
|
} else { |
|
$lt{'asub'} = &mt('A subsequent step will also allow you to specify automatic adding/dropping of group members triggered by specified user role and section [_1]changes[_2] in the course.','<i>','</i>'); |
|
} |
my %status_types = ( |
my %status_types = ( |
active => &mt('Currently has access'), |
active => &mt('Currently has access'), |
previous => &mt('Previously had access'), |
previous => &mt('Previously had access'), |
future => &mt('Will have future access'), |
future => &mt('Will have future access'), |
); |
); |
|
|
my @roles = ('st','cc','in','ta','ep','cr'); |
my @roles = ('st'); |
|
if ($crstype eq 'Community') { |
|
push(@roles,'co'); |
|
} else { |
|
push(@roles,'cc'); |
|
} |
|
push (@roles,('in','ta','ep','ad','cr')); |
|
|
my @sections = keys(%{$sectioncount}); |
my @sections = keys(%{$sectioncount}); |
|
|
&topic_bar($r,$image,$lt{'pipa'}); |
$r->print(&Apache::lonhtmlcommon::topic_bar($image,$lt{'pipa'}).' |
$r->print(' |
<b>'.$lt{'gmem'}.'</b><br />'); |
<b>'.$lt{'gmem'}.'</b><br />'.$lt{'picr'}); |
|
if ($action eq 'create') { |
if ($action eq 'create') { |
$r->print($lt{'meof'}.'<br />'.$lt{'ifno'}.'<br />'.$lt{'asub'}); |
$r->print($lt{'picr'}.'<br />'.$lt{'ifno'}.'<br />'.$lt{'asub'}); |
} else { |
} else { |
$r->print($lt{'admg'}); |
$r->print($lt{'pica'}); |
} |
} |
$r->print(' |
$r->print(' |
<br /> |
<br /> |
Line 1768 sub sections_selection {
|
Line 1853 sub sections_selection {
|
} |
} |
} |
} |
my $output = ' |
my $output = ' |
<select name="'.$elementname.'" multiple="true" size="'.$numvisible.'"> |
<select name="'.$elementname.'" multiple="multiple" size="'.$numvisible.'"> |
'.$section_sel.' |
'.$section_sel.' |
</select>'; |
</select>'; |
return $output; |
return $output; |
Line 1776 sub sections_selection {
|
Line 1861 sub sections_selection {
|
|
|
sub access_date_settings { |
sub access_date_settings { |
my ($r,$action,$formname,$stored,$image,$gpterm,$ucgpterm) = @_; |
my ($r,$action,$formname,$stored,$image,$gpterm,$ucgpterm) = @_; |
my %lt = &Apache::lonlocal::texthash( |
my $sten = &mt("Default start and end dates for $gpterm access"); |
'sten' => "Default start and end dates for $gpterm access", |
|
); |
|
my $starttime = time; |
my $starttime = time; |
my $endtime = time+(6*30*24*60*60); # 6 months from now, approx |
my $endtime = time+(6*30*24*60*60); # 6 months from now, approx |
if ($action eq 'modify') { |
if ($action eq 'modify') { |
Line 1788 sub access_date_settings {
|
Line 1871 sub access_date_settings {
|
} |
} |
} |
} |
my ($table) = &date_setting_table($starttime,$endtime,$formname); |
my ($table) = &date_setting_table($starttime,$endtime,$formname); |
&topic_bar($r,$image,$lt{'sten'}); |
$r->print(&Apache::lonhtmlcommon::topic_bar($image,$sten).' |
$r->print(' |
|
'.$table.' |
'.$table.' |
'); |
'); |
return; |
return; |
Line 1842 sub choose_members_form {
|
Line 1924 sub choose_members_form {
|
} |
} |
} |
} |
&privilege_specificity($r,$action,$specimg,$tools,$stored,$toolprivs, |
&privilege_specificity($r,$action,$specimg,$tools,$stored,$toolprivs, |
$fixedprivs,\@available,$formname,$gpterm,$ucgpterm); |
$fixedprivs,\@available,$formname,$gpterm,$ucgpterm, |
|
$functions,$crstype); |
my $newusers = &pick_new_members($r,$action,$formname,\@available,$idx, |
my $newusers = &pick_new_members($r,$action,$formname,\@available,$idx, |
$stored,$memimg,$users,$userdata, |
$stored,$memimg,$users,$userdata, |
$granularity,\%origmembers,$gpterm, |
$granularity,\%origmembers,$gpterm, |
Line 1906 sub print_current_settings {
|
Line 1989 sub print_current_settings {
|
ygrs => "Your group selections - ", |
ygrs => "Your group selections - ", |
tfwa => "The following settings will apply to the group:", |
tfwa => "The following settings will apply to the group:", |
difn => 'Different collaborative tools<br />for different members:', |
difn => 'Different collaborative tools<br />for different members:', |
stda => 'Start date', |
stda => 'Start date:', |
enda => 'End date:', |
enda => 'End date:', |
); |
); |
my $showstart = &Apache::lonlocal::locallocaltime($startdate); |
my $showstart = &Apache::lonlocal::locallocaltime($startdate); |
Line 1939 sub print_current_settings {
|
Line 2022 sub print_current_settings {
|
<td valign="top">'.$description.'</td> |
<td valign="top">'.$description.'</td> |
<td> |
<td> |
'); |
'); |
|
|
if (@{$available} > 0) { |
if (@{$available} > 0) { |
$r->print(&mt('<b>Available for assignment to members:</b>'). |
$r->print('<b>'.&mt('Available for assignment to members:').'</b>'); |
'<table class="LC_group_priv"><tr>'); |
$r->print('<ul>'); |
my $rowcell = int(@{$available}/2) + @{$available}%2; |
|
for (my $i=0; $i<@{$available}; $i++) { |
for (my $i=0; $i<@{$available}; $i++) { |
if (@{$available} > 3) { |
$r->print('<li>'.&mt($$functions{$$available[$i]}).'</li>'); |
if ($i==$rowcell) { |
|
$r->print('</tr><tr>'); |
|
} |
|
} |
|
$r->print('<td>'.$$functions{$$available[$i]}. |
|
'</td><td> </td>'); |
|
} |
} |
if ((@{$available} > 3) && (@{$available}%2)) { |
$r->print('</ul>'); |
$r->print('<td> </td><td> </td>'); |
|
} |
|
$r->print('</tr></table><br />'); |
|
} |
} |
|
|
if (@{$unavailable} > 0) { |
if (@{$unavailable} > 0) { |
$r->print(&mt('<b>Unavailable for assignment:</b>'). |
$r->print('<b>'.&mt('Unavailable for assignment:').'</b>'); |
'<table class="LC_group_priv"><tr>'); |
$r->print('<ul>'); |
my $rowcell = int(@{$unavailable}/2) + @{$unavailable}%2; |
for (my $i=0; $i<@{$unavailable}; $i++) { |
for (my $j=0; $j<@{$unavailable}; $j++) { |
$r->print('<li>'.&mt($$functions{$$unavailable[$i]}).'</li>'); |
if (@{$unavailable} > 3) { |
|
if ($j==$rowcell) { |
|
$r->print('</tr><tr>'); |
|
} |
|
} |
|
$r->print('<td>'.$$functions{$$unavailable[$j]}. |
|
'</td><td> </td>'); |
|
} |
|
if ((@{$unavailable} > 3) && (@{$unavailable}%2)) { |
|
$r->print('<td> </td><td> </td>'); |
|
} |
} |
$r->print('</tr></table>'); |
$r->print('</ul>'); |
} |
} |
|
|
|
my $quota_text=&mt('[_1] Mb',$quota); |
|
my $granu_text=&mt($granularity); |
$r->print(<<"END"); |
$r->print(<<"END"); |
</td> |
</td> |
<td valign="top"><b>$lt{'difn'}</b> $granularity</td> |
<td valign="top"><b>$lt{'difn'}</b> $granu_text</td> |
<td valign="top">$quota Mb</td> |
<td valign="top">$quota_text</td> |
<td valign="top"><b>$lt{'stda'}</b> $showstart<br /> |
<td valign="top"><b>$lt{'stda'}</b> $showstart<br /> |
<b>$lt{'enda'}</b> $showend |
<b>$lt{'enda'}</b> $showend |
</td> |
</td> |
Line 2001 sub pick_new_members {
|
Line 2069 sub pick_new_members {
|
'nnew' => "There are no users to add as new members, as all users". |
'nnew' => "There are no users to add as new members, as all users". |
" matching the specified type(s), role(s), and ". |
" matching the specified type(s), role(s), and ". |
"section(s) are already affiliated with this group.", |
"section(s) are already affiliated with this group.", |
'yoma' => 'You may need to use the '."'".'modify existing, past or '. |
'yoma' => "You may need to use the 'modify existing, past or ". |
'future members'."'".' page if you need to re-enable '. |
"future members' page if you need to re-enable ". |
'or activate access for previous or future members.', |
"or activate access for previous or future members.", |
); |
); |
my %members; |
my %members; |
my $totalusers = 0; |
my $totalusers = 0; |
Line 2027 sub pick_new_members {
|
Line 2095 sub pick_new_members {
|
$r->print(&check_uncheck_tools($r,$available)); |
$r->print(&check_uncheck_tools($r,$available)); |
} |
} |
} |
} |
&topic_bar($r,$img,$lt{'gpme'}); |
$r->print(&Apache::lonhtmlcommon::topic_bar($img,$lt{'gpme'})); |
if (keys(%members) > 0) { |
if (keys(%members) > 0) { |
$r->print(' |
$r->print(' |
<table> |
<table> |
Line 2035 sub pick_new_members {
|
Line 2103 sub pick_new_members {
|
&check_uncheck_buttons($r,$formname,'member',$lt{'addm'}); |
&check_uncheck_buttons($r,$formname,'member',$lt{'addm'}); |
if (@{$available} > 0 && $granularity eq 'Yes') { |
if (@{$available} > 0 && $granularity eq 'Yes') { |
$r->print('<td> |
$r->print('<td> |
<fieldset><legend><b>'.$lt{'setf'}.'</b></legend> |
<fieldset><legend>'.$lt{'setf'}.'</legend> |
<nobr> |
<span class="LC_nobreak"> |
<input type="button" value="check all" |
<input type="button" value="'.&mt('check all').'" |
onclick="javascript:checkAllTools(document.'.$formname.')" /> |
onclick="javascript:checkAllTools(document.'.$formname.')" /> |
|
|
<input type="button" value="uncheck all" |
<input type="button" value="'.&mt('uncheck all').'" |
onclick="javascript:uncheckAllTools(document.'.$formname.')" /> |
onclick="javascript:uncheckAllTools(document.'.$formname.')" /> |
</nobr> |
</span> |
</fieldset></td>'); |
</fieldset></td>'); |
} |
} |
$r->print('</tr></table> |
$r->print('</tr></table> |
Line 2065 sub pick_new_members {
|
Line 2133 sub pick_new_members {
|
if ($granularity eq 'Yes') { |
if ($granularity eq 'Yes') { |
$r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense LC_data_table_highlight').' |
$r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense LC_data_table_highlight').' |
<td colspan="6"> </td> |
<td colspan="6"> </td> |
<td align="center"><nobr><b>'.&mt('All:').'</b> '); |
<td align="center"><span class="LC_nobreak"><b>'.&mt('All:').'</b> '); |
foreach my $tool (@{$available}) { |
foreach my $tool (@{$available}) { |
$r->print('<label><input type="checkbox" name="togglefunc" '. |
$r->print('<label><input type="checkbox" name="togglefunc" '. |
'onclick="javascript:toggleTools(document.'.$formname.'.user_'.$tool.',this);"'. |
'onclick="javascript:toggleTools(document.'.$formname.'.user_'.$tool.',this);"'. |
' value="'.$tool.'">'.'<b>'.$tool.'</b></label> '); |
' value="'.$tool.'">'.'<b>'.$tool.'</b></label> '); |
} |
} |
$r->print('</nobr></td></tr>'); |
$r->print('</span></td></tr>'); |
} |
} |
} |
} |
my %Sortby = (); |
my %Sortby = (); |
Line 2105 sub pick_new_members {
|
Line 2173 sub pick_new_members {
|
'<td>'.$id.'</td>'. |
'<td>'.$id.'</td>'. |
'<td>'.$section.'</td>'); |
'<td>'.$section.'</td>'); |
if (@{$available} > 0) { |
if (@{$available} > 0) { |
$r->print('<td align="center"><nobr>'. |
$r->print('<td align="center"><span class="LC_nobreak">'. |
' '); |
' '); |
foreach my $tool (@{$available}) { |
foreach my $tool (@{$available}) { |
if ($granularity eq 'Yes') { |
if ($granularity eq 'Yes') { |
Line 2116 sub pick_new_members {
|
Line 2184 sub pick_new_members {
|
$tool.'" value="'.$user.'" />'.$tool.' '); |
$tool.'" value="'.$user.'" />'.$tool.' '); |
} |
} |
} |
} |
$r->print('</nobr></td>'); |
$r->print('</span></td>'); |
} |
} |
$r->print(&Apache::loncommon::end_data_table_row()."\n"); |
$r->print(&Apache::loncommon::end_data_table_row()."\n"); |
} |
} |
Line 2134 sub pick_new_members {
|
Line 2202 sub pick_new_members {
|
|
|
sub privilege_specificity { |
sub privilege_specificity { |
my ($r,$action,$img,$tools,$stored,$toolprivs,$fixedprivs,$available, |
my ($r,$action,$img,$tools,$stored,$toolprivs,$fixedprivs,$available, |
$formname,$gpterm,$ucgpterm) = @_; |
$formname,$gpterm,$ucgpterm,$functions,$crstype) = @_; |
my %lt = &Apache::lonlocal::texthash ( |
my %lt = &Apache::lonlocal::texthash ( |
'uprv' => 'User privileges for collaborative tools', |
'uprv' => 'User privileges for collaborative tools', |
'frty' => 'For each collaborative tool you have chosen to include, '. |
'frty' => 'For each collaborative tool you have chosen to include, '. |
Line 2168 sub privilege_specificity {
|
Line 2236 sub privilege_specificity {
|
'oppr' => 'Optional privileges', |
'oppr' => 'Optional privileges', |
'defp' => 'The default privileges new members will receive are:', |
'defp' => 'The default privileges new members will receive are:', |
); |
); |
|
if ($crstype eq 'Community') { |
|
$lt{'thes'} = &mt('These will be the privileges given to members assigned in the future via automatic group assignment for users who receive specific sections/roles in the community '); |
|
} |
my $totaloptionalprivs = 0; |
my $totaloptionalprivs = 0; |
foreach my $tool (@{$tools}) { |
foreach my $tool (@{$tools}) { |
foreach my $priv (sort(keys(%{$$toolprivs{$tool}}))) { |
foreach my $priv (sort(keys(%{$$toolprivs{$tool}}))) { |
Line 2176 sub privilege_specificity {
|
Line 2247 sub privilege_specificity {
|
} |
} |
} |
} |
} |
} |
&topic_bar($r,$img,$lt{'uprv'}); |
$r->print(&Apache::lonhtmlcommon::topic_bar($img,$lt{'uprv'})); |
if ((($action eq 'create') && (@{$available} > 0)) || |
if ((($action eq 'create') && (@{$available} > 0)) || |
(($action eq 'modify') && ($formname eq 'change_settings'))) { |
(($action eq 'modify') && ($formname eq 'change_settings'))) { |
my %specific = ( |
my %specific = ( |
Line 2203 sub privilege_specificity {
|
Line 2274 sub privilege_specificity {
|
if ($totaloptionalprivs) { |
if ($totaloptionalprivs) { |
$r->print(' |
$r->print(' |
<br /> |
<br /> |
<label><nobr><input type="radio" name="specificity" value="No" '.$specific{'No'}.' /> '.$lt{'algm'}.'</nobr></label><br /> |
<label><span class="LC_nobreak"><input type="radio" name="specificity" value="No" '.$specific{'No'}.' /> '.$lt{'algm'}.'</span></label><br /> |
<label><nobr><input type="radio" name="specificity" value="Yes" '.$specific{'Yes'}.' /> '.$lt{'smgp'}.'</nobr></label><br /><br />'); |
<label><span class="LC_nobreak"><input type="radio" name="specificity" value="Yes" '.$specific{'Yes'}.' /> '.$lt{'smgp'}.'</span></label><br /><br />'); |
} else { |
} else { |
$r->print('<input type="hidden" name="specificity" value="No" />'); |
$r->print('<input type="hidden" name="specificity" value="No" />'); |
} |
} |
Line 2231 sub privilege_specificity {
|
Line 2302 sub privilege_specificity {
|
$r->print($lt{'algm'}.'<br /><br />'); |
$r->print($lt{'algm'}.'<br /><br />'); |
} |
} |
&default_privileges($r,$action,$tools,$toolprivs,$fixedprivs, |
&default_privileges($r,$action,$tools,$toolprivs,$fixedprivs, |
$available); |
$available,$functions); |
} else { |
} else { |
if ($action eq 'create') { |
if ($action eq 'create') { |
$r->print($lt{'asyo'}); |
$r->print($lt{'asyo'}); |
Line 2255 sub privilege_specificity {
|
Line 2326 sub privilege_specificity {
|
} |
} |
|
|
sub default_privileges { |
sub default_privileges { |
my ($r,$action,$tools,$toolprivs,$fixedprivs,$available) = @_; |
my ($r,$action,$tools,$toolprivs,$fixedprivs,$available,$functions) = @_; |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'addp' => 'Additional privileges', |
'addp' => 'Additional privileges', |
'fixp' => 'Fixed privileges', |
'fixp' => 'Fixed privileges', |
Line 2264 sub default_privileges {
|
Line 2335 sub default_privileges {
|
); |
); |
$r->print(&Apache::lonhtmlcommon::start_pick_box('LC_group_priv_box'). |
$r->print(&Apache::lonhtmlcommon::start_pick_box('LC_group_priv_box'). |
&Apache::lonhtmlcommon::row_title($lt{'func'},undef, |
&Apache::lonhtmlcommon::row_title($lt{'func'},undef, |
'LC_groups_functionality')); |
'LC_groups_functionality')); |
$r->print(join('</td><td class="LC_groups_functionality">',@{$tools})); |
my @tableHeader; |
|
foreach my $key (sort(keys(%{$functions}))){ |
|
push (@tableHeader,&mt($functions->{$key})); |
|
} |
|
$r->print(join('</td><td class="LC_groups_functionality">', @tableHeader)); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
$r->print(&Apache::lonhtmlcommon::row_closure(1)); |
my $fixed = ''; |
my $fixed = ''; |
my $dynamic = ''; |
my $dynamic = ''; |
Line 2280 sub default_privileges {
|
Line 2355 sub default_privileges {
|
if ($fixed ne '') { |
if ($fixed ne '') { |
$fixed .= '</td><td class="LC_groups_fixed">'; |
$fixed .= '</td><td class="LC_groups_fixed">'; |
} |
} |
$fixed .= '<input type="hidden" name="defpriv" value="'.$priv.'" /><nobr>'.$$toolprivs{$tool}{$priv}.' '; |
$fixed .= '<input type="hidden" name="defpriv" value="'.$priv.'" />' |
|
.'<span class="LC_nobreak">'.&mt($$toolprivs{$tool}{$priv}).' '; |
if ($action eq 'modify') { |
if ($action eq 'modify') { |
if (grep(/^$tool$/,@{$available})) { |
if (grep(/^$tool$/,@{$available})) { |
$fixed .= '<small>'.&mt('(on)').'<small> '; |
$fixed .= '<small>'.&mt('(on)').'<small> '; |
Line 2288 sub default_privileges {
|
Line 2364 sub default_privileges {
|
$fixed .= '<small>'.&mt('(off)').'<small> '; |
$fixed .= '<small>'.&mt('(off)').'<small> '; |
} |
} |
} |
} |
$fixed .= '</nobr>'; |
$fixed .= '</span>'; |
} else { |
} else { |
$privcount++; |
$privcount++; |
if ($privcount == 3) { |
if ($privcount == 3) { |
$dynamic .= '</tr> |
$dynamic .= '</tr> |
<tr>'."\n"; |
<tr>'."\n"; |
} |
} |
$dynamic .= '<td><nobr><label><input type="checkbox" name="defpriv" value="'.$priv.'" />'.$$toolprivs{$tool}{$priv}.'</label></nobr></td>'."\n"; |
$dynamic .= '<td><span class="LC_nobreak"><label><input type="checkbox" name="defpriv" value="'.$priv.'" />'.&mt($$toolprivs{$tool}{$priv}).'</label></span></td>'."\n"; |
} |
} |
} |
} |
if ($privcount == 0) { |
if ($privcount == 0) { |
$dynamic .= '<td>None</td>'."\n"; |
$dynamic .= '<td>'.&mt('None').'</td>'."\n"; |
} |
} |
if ($privcount < 3) { |
if ($privcount < 3) { |
$dynamic .= '<td> </td>'."\n"; |
$dynamic .= '<td> </td>'."\n"; |
Line 2417 sub change_members_form {
|
Line 2493 sub change_members_form {
|
$r->print(' |
$r->print(' |
<br /> |
<br /> |
'); |
'); |
&topic_bar($r,1,$lt{'grse'}); |
$r->print(&Apache::lonhtmlcommon::topic_bar(1,$lt{'grse'})); |
&print_current_settings($r,$action,$functions,$startdate,$enddate, |
&print_current_settings($r,$action,$functions,$startdate,$enddate, |
$groupname,$description,$granularity,$quota, |
$groupname,$description,$granularity,$quota, |
\@available,\@unavailable,$gpterm,$ucgpterm); |
\@available,\@unavailable,$gpterm,$ucgpterm); |
&topic_bar($r,2,$lt{'mogm'}); |
$r->print(&Apache::lonhtmlcommon::topic_bar(2,$lt{'mogm'})); |
my $numcurrent = ¤t_membership($r,$cdom,$cnum,$formname,$groupname, |
my $numcurrent = ¤t_membership($r,$cdom,$cnum,$formname,$groupname, |
\@available,\@unavailable,$fixedprivs, |
\@available,\@unavailable,$fixedprivs, |
$granularity,$specificity); |
$granularity,$specificity); |
Line 2479 sub current_membership {
|
Line 2555 sub current_membership {
|
$r->print(&check_uncheck_tools($r,$available)); |
$r->print(&check_uncheck_tools($r,$available)); |
$r->print(' |
$r->print(' |
<td> |
<td> |
<nobr> |
<span class="LC_nobreak"> |
<fieldset><legend><b>'.$lt{'curf'}.'</b></legend> |
<fieldset><legend>'.$lt{'curf'}.'</legend> |
<input type="button" value="check all" |
<input type="button" value="'.&mt('check all').'" |
onclick="javascript:checkAllTools(document.'.$formname.')" /> |
onclick="javascript:checkAllTools(document.'.$formname.')" /> |
|
|
<input type="button" value="uncheck all" |
<input type="button" value="'.&mt('uncheck all').'" |
onclick="javascript:uncheckAllTools(document.'.$formname.')" /> |
onclick="javascript:uncheckAllTools(document.'.$formname.')" /> |
</fieldset> |
</fieldset> |
</nobr> |
</span> |
</td> |
</td> |
'); |
'); |
} |
} |
Line 2522 END
|
Line 2598 END
|
if ($granularity eq 'Yes') { |
if ($granularity eq 'Yes') { |
$r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense LC_data_table_highlight').' |
$r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense LC_data_table_highlight').' |
<td colspan="7"> </td> |
<td colspan="7"> </td> |
<td colspan="'.$colspan.'" align="center"><nobr><b>'.&mt('All:'). |
<td colspan="'.$colspan.'" align="center"><span class="LC_nobreak"><b>'.&mt('All:'). |
'</b> '); |
'</b> '); |
foreach my $tool (@{$available}) { |
foreach my $tool (@{$available}) { |
$r->print('<label><input type="checkbox" name="togglefunc"'. |
$r->print('<label><input type="checkbox" name="togglefunc"'. |
' onclick="javascript:toggleTools(document.'.$formname.'.user_'.$tool.',this);"'. |
' onclick="javascript:toggleTools(document.'.$formname.'.user_'.$tool.',this);"'. |
' value="'.$tool.'" />'.'<b>'.$tool.'</b></label> '); |
' value="'.$tool.'" />'.'<b>'.$tool.'</b></label> '); |
} |
} |
$r->print('</nobr></td></tr>'); |
$r->print('</span></td></tr>'); |
} |
} |
} |
} |
my %Sortby = (); |
my %Sortby = (); |
Line 2557 END
|
Line 2633 END
|
$r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense').' |
$r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense').' |
<td>'); |
<td>'); |
if ($$current{$user}{changestate} eq 'reenable') { |
if ($$current{$user}{changestate} eq 'reenable') { |
$r->print('<nobr><label>'. |
$r->print('<span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="reenable" value="'.$user.'" />'. |
'<input type="checkbox" name="reenable" value="'.$user.'" />'. |
$lt{'reen'}.'</label></nobr><br />'); |
$lt{'reen'}.'</label></span><br />'); |
} elsif ($$current{$user}{changestate} eq 'expire') { |
} elsif ($$current{$user}{changestate} eq 'expire') { |
$r->print('<nobr><label>'. |
$r->print('<span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="expire" value="'.$user.'" />'. |
'<input type="checkbox" name="expire" value="'.$user.'" />'. |
$lt{'expi'}.'</label></nobr><br />'); |
$lt{'expi'}.'</label></span><br />'); |
} elsif ($$current{$user}{changestate} eq 'activate') { |
} elsif ($$current{$user}{changestate} eq 'activate') { |
$r->print('<nobr><label>'. |
$r->print('<span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="activate" value="'.$user.'" />'. |
'<input type="checkbox" name="activate" value="'.$user.'" />'. |
$lt{'acti'}.'</label></nobr><br />'); |
$lt{'acti'}.'</label></span><br />'); |
} |
} |
$r->print('<nobr><label>'. |
$r->print('<span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="deletion" value="'.$user.'" />'. |
'<input type="checkbox" name="deletion" value="'.$user.'" />'. |
$lt{'dele'}.'</label></nobr>'); |
$lt{'dele'}.'</label></span>'); |
if ($specificity eq 'Yes') { |
if ($specificity eq 'Yes') { |
$r->print('<br /><nobr><label>'. |
$r->print('<br /><span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="changepriv" value="'.$user.'" />'.$lt{'chpr'}. |
'<input type="checkbox" name="changepriv" value="'.$user.'" />'.$lt{'chpr'}. |
'</label></nobr>'); |
'</label></span>'); |
} |
} |
$r->print(' |
$r->print(' |
</td>'. |
</td>'. |
Line 2586 END
|
Line 2662 END
|
'<td>'.$start.'</td>'. |
'<td>'.$start.'</td>'. |
'<td>'.$end.'</td>'); |
'<td>'.$end.'</td>'); |
if ($hastools) { |
if ($hastools) { |
$r->print('<td align="left"><nobr>'. |
$r->print('<td align="left"><span class="LC_nobreak">'. |
' '); |
' '); |
foreach my $tool (@{$$current{$user}{currtools}}) { |
foreach my $tool (@{$$current{$user}{currtools}}) { |
if ($granularity eq 'Yes') { |
if ($granularity eq 'Yes') { |
Line 2602 END
|
Line 2678 END
|
} |
} |
$r->print(' '); |
$r->print(' '); |
} |
} |
$r->print('</nobr></td>'); |
$r->print('</span></td>'); |
} |
} |
if ($addtools) { |
if ($addtools) { |
$r->print('<td align="left">'); |
$r->print('<td align="left">'); |
if ($granularity eq 'Yes') { |
if ($granularity eq 'Yes') { |
foreach my $tool (@{$$current{$user}{newtools}}) { |
foreach my $tool (@{$$current{$user}{newtools}}) { |
$r->print('<nobr><label><input type="checkbox" |
$r->print('<span class="LC_nobreak"><label><input type="checkbox" |
name="user_'.$tool.'" value="'. |
name="user_'.$tool.'" value="'. |
$user.'" />'.$tool. |
$user.'" />'.$tool. |
'</label></nobr> '); |
'</label></span> '); |
} |
} |
} else { |
} else { |
foreach my $tool (@{$$current{$user}{newtools}}) { |
foreach my $tool (@{$$current{$user}{newtools}}) { |
$r->print('<nobr><input type="hidden" |
$r->print('<span class="LC_nobreak"><input type="hidden" |
name="user_'. $tool.'" value="'. |
name="user_'. $tool.'" value="'. |
$user.'" />'.$tool. |
$user.'" />'.$tool. |
'</nobr> '); |
'</span> '); |
} |
} |
} |
} |
$r->print('</td>'); |
$r->print('</td>'); |
Line 2638 sub check_uncheck_buttons {
|
Line 2714 sub check_uncheck_buttons {
|
$r->print(' |
$r->print(' |
<td '.$colspan.'> |
<td '.$colspan.'> |
<fieldset> |
<fieldset> |
<legend><b>'.$title.'</b></legend> |
<legend>'.$title.'</legend> |
<nobr> |
<span class="LC_nobreak"> |
<input type="button" value="check all" |
<input type="button" value="'.&mt('check all').'" |
onclick="javascript:checkAll(document.'.$formname.'.'.$field.')" /> |
onclick="javascript:checkAll(document.'.$formname.'.'.$field.')" /> |
|
|
<input type="button" value="uncheck all" |
<input type="button" value="'.&mt('uncheck all').'" |
onclick="javascript:uncheckAll(document.'.$formname.'.'.$field.')" /> |
onclick="javascript:uncheckAll(document.'.$formname.'.'.$field.')" /> |
</nobr> |
</span> |
</fieldset> |
</fieldset> |
</td> |
</td> |
'); |
'); |
Line 2671 sub change_privs_form {
|
Line 2747 sub change_privs_form {
|
} else { |
} else { |
$nexttext = $$navbuttons{'mose'}; |
$nexttext = $$navbuttons{'mose'}; |
} |
} |
&topic_bar($r,3,&mt('Members to delete or expire')); |
$r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('Members to delete or expire'))); |
my $exp_or_del = 0; |
my $exp_or_del = 0; |
if (ref($$memchg{'deletion'}) eq 'ARRAY') { |
if (ref($$memchg{'deletion'}) eq 'ARRAY') { |
if (@{$$memchg{'deletion'}} > 0) { |
if (@{$$memchg{'deletion'}} > 0) { |
Line 2699 sub change_privs_form {
|
Line 2775 sub change_privs_form {
|
$r->print($lt{'nome'}.'<br />'); |
$r->print($lt{'nome'}.'<br />'); |
} |
} |
|
|
&topic_bar($r,4,&mt('Setting optional privileges for specific group members')); |
$r->print(&Apache::lonhtmlcommon::topic_bar(4,&mt('Setting optional privileges for specific group members'))); |
|
|
my $numchgs = &member_privileges_form($r,$action,$formname,$tools, |
my $numchgs = &member_privileges_form($r,$action,$formname,$tools, |
$toolprivs,$fixedprivs,$userdata, |
$toolprivs,$fixedprivs,$userdata, |
Line 2718 sub change_privs_form {
|
Line 2794 sub change_privs_form {
|
sub add_members_form { |
sub add_members_form { |
my ($r,$cdom,$cnum,$action,$formname,$page,$startdate,$enddate,$groupname, |
my ($r,$cdom,$cnum,$action,$formname,$page,$startdate,$enddate,$groupname, |
$description,$granularity,$quota,$sectioncount,$tools,$functions, |
$description,$granularity,$quota,$sectioncount,$tools,$functions, |
$stored,$states,$navbuttons,$gpterm,$ucgpterm)=@_; |
$stored,$states,$navbuttons,$gpterm,$ucgpterm,$crstype)=@_; |
$r->print(' <br />'); |
$r->print(' <br />'); |
my @available = (); |
my @available = (); |
my @unavailable = (); |
my @unavailable = (); |
Line 2727 sub add_members_form {
|
Line 2803 sub add_members_form {
|
$groupname,$description,$granularity,$quota, |
$groupname,$description,$granularity,$quota, |
\@available,\@unavailable,$gpterm,$ucgpterm); |
\@available,\@unavailable,$gpterm,$ucgpterm); |
&membership_options($r,$cdom,$cnum,$action,$formname,$sectioncount,1,$gpterm, |
&membership_options($r,$cdom,$cnum,$action,$formname,$sectioncount,1,$gpterm, |
$ucgpterm); |
$ucgpterm,$crstype); |
my $nexttext = $$navbuttons{'gtns'}; |
my $nexttext = $$navbuttons{'gtns'}; |
my $prevtext = $$navbuttons{'gtpp'}; |
my $prevtext = $$navbuttons{'gtpp'}; |
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext, |
&display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext, |
Line 2756 sub choose_privs_form {
|
Line 2832 sub choose_privs_form {
|
$nexttext = $$navbuttons{'adme'}; |
$nexttext = $$navbuttons{'adme'}; |
} |
} |
|
|
&topic_bar($r,6,&mt('Setting optional privileges for specific group members')); |
$r->print(&Apache::lonhtmlcommon::topic_bar(6,&mt('Setting optional privileges for specific group members'))); |
|
|
&member_privileges_form($r,$action,$formname,$tools,$toolprivs, |
&member_privileges_form($r,$action,$formname,$tools,$toolprivs, |
$fixedprivs,$userdata,$usertools,$idx,undef, |
$fixedprivs,$userdata,$usertools,$idx,undef, |
Line 2845 sub member_privileges_form {
|
Line 2921 sub member_privileges_form {
|
'members being added or modified, '. |
'members being added or modified, '. |
'there are no optional privileges to set '. |
'there are no optional privileges to set '. |
'for specific members.', |
'for specific members.', |
'algr' => 'All new group members will receive the same privileges.', 'ifex' => 'If previously expired members are being re-enabled, or '. |
'algr' => 'All new group members will receive the same privileges.', |
|
'ifex' => 'If previously expired members are being re-enabled, or '. |
'if access for future members is being activated now, '. |
'if access for future members is being activated now, '. |
'previously set privileges will be preserved.', |
'previously set privileges will be preserved.', |
'asno' => 'As no group members are being added, '. |
'asno' => 'As no group members are being added, '. |
Line 2921 sub member_privileges_form {
|
Line 2998 sub member_privileges_form {
|
foreach my $tool (@{$tools}) { |
foreach my $tool (@{$tools}) { |
if (@{$showboxes{$tool}} > 0) { |
if (@{$showboxes{$tool}} > 0) { |
$r->print('<td valign="top">'); |
$r->print('<td valign="top">'); |
$r->print('<table class="thinborder"><tr>'. |
$r->print('<fieldset><legend>'.&mt($tool).'</legend>'); |
'<th colspan="'.$colspan.'">'. |
$r->print('<table><tr>'); |
$tool.'</th></tr><tr>'); |
|
my $privcount = 0; |
my $privcount = 0; |
foreach my $priv (@{$showboxes{$tool}}) { |
foreach my $priv (@{$showboxes{$tool}}) { |
$privcount ++; |
$privcount ++; |
Line 2937 sub member_privileges_form {
|
Line 3013 sub member_privileges_form {
|
} else { |
} else { |
$r->print('<td>'); |
$r->print('<td>'); |
} |
} |
$r->print(qq| |
$r->print( |
<fieldset><legend><b>$$toolprivs{$tool}{$priv}</b></legend> |
'<fieldset><legend>'.&mt($$toolprivs{$tool}{$priv}).'</legend>' |
<nobr> |
.'<span class="LC_nobreak">' |
<input type="button" value="check all" |
.' <input type="button" value="'.&mt('check all').'"' |
onclick="javascript:checkAll(document.$formname.userpriv_$priv)" /> |
.' onclick="javascript:checkAll(document.'.$formname.'.userpriv_'.$priv.')" />' |
|
.' ' |
<input type="button" value="uncheck all" |
.'<input type="button" value="'.&mt('uncheck all').'"' |
onclick="javascript:uncheckAll(document.$formname.userpriv_$priv)" /> |
.' onclick="javascript:uncheckAll(document.'.$formname.'.userpriv_'.$priv.')" />' |
</nobr></fieldset><br />|); |
.'</span></fieldset><br />' |
|
); |
$r->print('</td>'); |
$r->print('</td>'); |
if ($privcount < @{$showboxes{$tool}}) { |
if ($privcount < @{$showboxes{$tool}}) { |
if (@{$showboxes{$tool}} > 2) { |
if (@{$showboxes{$tool}} > 2) { |
Line 2957 sub member_privileges_form {
|
Line 3034 sub member_privileges_form {
|
} |
} |
} |
} |
} |
} |
$r->print('</tr></table></td><td> </td>'); |
$r->print('</tr></table></fieldset></td><td> </td>'); |
} |
} |
} |
} |
$r->print('</tr></table>'); |
$r->print('</tr></table>'); |
Line 3057 sub process_request {
|
Line 3134 sub process_request {
|
&process_membership($r,$cdom,$cnum,$action,$state,$groupname,$tools, |
&process_membership($r,$cdom,$cnum,$action,$state,$groupname,$tools, |
$enddate,$startdate,$userdata,$idx,$toolprivs, |
$enddate,$startdate,$userdata,$idx,$toolprivs, |
$usertools,$specificity,\@defprivs,$memchg,$gpterm, |
$usertools,$specificity,\@defprivs,$memchg,$gpterm, |
$ucgpterm); |
$ucgpterm,$crstype); |
} |
} |
return; |
return; |
} |
} |
Line 3089 sub write_group_data {
|
Line 3166 sub write_group_data {
|
} |
} |
if ($quota !~ /^\d*\.?\d*$/) { |
if ($quota !~ /^\d*\.?\d*$/) { |
$quota = 0; |
$quota = 0; |
$r->print(&mt('The value you entered for the quota for the file repository in this [_1] contained invalid characters, so it has been set to 0 Mb. You can change this by modifying the [_1] settings.<br />',$gpterm)); |
$r->print('<div class="LC_warning">' |
|
.&mt('The value you entered for the quota for the group portfolio in this '.$gpterm |
|
.' contained invalid characters, so it has been set to 0 Mb. You can change this by' |
|
.' modifying the '.$gpterm.' settings.') |
|
.'</div>'); |
} |
} |
if ($quota > $maxposs) { |
if ($quota > $maxposs) { |
$quota = $maxposs; |
$quota = $maxposs; |
$r->print(&mt('The value you entered for the quota for the file repository in this [_1] exceeded the maximum possible value, so it has been set to [_2] Mb (the maximum possible value).<br />',$gpterm,sprintf("%.2f",$maxposs))); |
$r->print('<div class="LC_warning">' |
|
.&mt('The value you entered for the quota for the group portfolio in this '.$gpterm |
|
.' exceeded the maximum possible value, so it has been set to [_1] Mb ' |
|
.'(the maximum possible value).',sprintf("%.2f",$maxposs)) |
|
.'</div>'); |
} |
} |
my %groupinfo = ( |
my %groupinfo = ( |
description => $esc_description, |
description => $esc_description, |
Line 3158 sub write_group_data {
|
Line 3243 sub write_group_data {
|
my $result = &add_group_folder($cdom,$cnum,$now,$groupname,$action, |
my $result = &add_group_folder($cdom,$cnum,$now,$groupname,$action, |
$description,$tools,\%groupinfo, |
$description,$tools,\%groupinfo, |
$gpterm,$ucgpterm,$crstype); |
$gpterm,$ucgpterm,$crstype); |
if ($result ne 'ok') { |
if ($result eq 'ok') { |
$r->print(&mt('A problem occurred when creating folders for the new [_1].<br />[_2]<br />',$gpterm,$result)); |
$r->print('<div class="LC_success">' |
|
.&mt($ucgpterm.' [_1] was created.','<i>'.$groupname.'</i>') |
|
.'</div>'); |
|
} else { |
|
$r->print('<div class="LC_error">' |
|
.&mt('A problem occurred when creating folders for the new '.$gpterm.' [_1]:' |
|
,'<i>'.$groupname.'</i>') |
|
.'<br />'.$result |
|
.'</div>'); |
} |
} |
$r->print(&mt('[_1] [_2] was created.<br />',$ucgpterm,$groupname)); |
|
} elsif ($action eq 'modify') { |
} elsif ($action eq 'modify') { |
my (@oldtools,@newtools); |
my (@oldtools,@newtools); |
if (ref($$stored{'tool'}) eq 'ARRAY') { |
if (ref($$stored{'tool'}) eq 'ARRAY') { |
Line 3175 sub write_group_data {
|
Line 3267 sub write_group_data {
|
my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/'; |
my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/'; |
my $boardsmap = $crspath.'group_boards_'.$groupname.'.sequence'; |
my $boardsmap = $crspath.'group_boards_'.$groupname.'.sequence'; |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $bbmapres = $navmap->getResourceByUrl($boardsmap); |
my ($bbmapres,$error); |
undef($navmap); |
if (defined($navmap)) { |
if (!$bbmapres) { |
$bbmapres = $navmap->getResourceByUrl($boardsmap); |
my $grpmap = $crspath.'group_folder_'.$groupname.'.sequence'; |
undef($navmap); |
my $disctitle = &mt('Discussion Boards'); |
if (!$bbmapres) { |
my $outcome = &map_updater($cdom,$cnum,'group_boards_'. |
my $grpmap = $crspath.'group_folder_'.$groupname.'.sequence'; |
$groupname.'.sequence','bbseq', |
my $disctitle = &mt('Discussion Boards'); |
$disctitle,$grpmap); |
my $outcome = &map_updater($cdom,$cnum,'group_boards_'. |
my ($furl,$ferr) = |
$groupname.'.sequence','bbseq', |
&Apache::lonuserstate::readmap($cdom.'/'.$cnum); |
$disctitle,$grpmap); |
$navmap = Apache::lonnavmaps::navmap->new(); |
my ($furl,$ferr) = |
# modify parameter |
&Apache::lonuserstate::readmap($cdom.'/'.$cnum); |
if ($outcome eq 'ok') { |
# modify parameter |
my $parm_result = &parm_setter($navmap,$cdom,$boardsmap, |
if ($outcome eq 'ok') { |
$groupname); |
$navmap = Apache::lonnavmaps::navmap->new(); |
if ($parm_result) { |
if (defined($navmap)) { |
$r->print(&mt('Error while setting parameters '. |
my $parm_result = &parm_setter($navmap,$cdom,$boardsmap, |
'for Discussion Boards folder: '. |
$groupname); |
'[_1]<br />.',$parm_result)); |
if ($parm_result) { |
|
$error = &mt('An error occurred while setting parameters ' |
|
.'for Discussion Boards folder: ' |
|
.'[_1]',$parm_result); |
|
} else { |
|
$r->print('<div class="LC_success">'. |
|
&mt('Discussion Boards Folder created.') |
|
.'</div>'); |
|
} |
|
undef($navmap); |
|
} else { |
|
if ($crstype eq 'Community') { |
|
$error = &mt("An error occurred while setting parameters '. |
|
'for Discussion Boards folder: '. |
|
'Could not retrieve community information"); |
|
} else { |
|
$error = &mt("An error occurred while setting parameters '. |
|
'for Discussion Boards folder: '. |
|
'Could not retrieve course information"); |
|
} |
|
} |
} else { |
} else { |
$r->print(&mt('Discussion Boards Folder created.<br />')); |
$r->print($outcome); |
} |
} |
|
} |
|
} else { |
|
$error = &mt("An error occurred while retrieving the contents of the group's folder.").'<br />'; |
|
if ($crstype eq 'Community') { |
|
$error .= &mt("You need to re-initialize the community."); |
|
|
} else { |
} else { |
$r->print($outcome); |
$error .= &mt("You need to re-initialize the course."); |
} |
} |
undef($navmap); |
} |
|
if ($error ne '') { |
|
$r->print('<div class="LC_error">'.$error.'</div>'); |
} |
} |
} |
} |
$r->print(&mt('[_1] [_2] was updated.<br />',$ucgpterm,$groupname)); |
$r->print('<div class="LC_success">' |
|
.&mt($ucgpterm.' [_1] was updated.','<i>'.$groupname.'</i>') |
|
.'</div>'); |
} |
} |
} else { |
} else { |
my %actiontype = ( |
my %actiontype = ( |
Line 3213 sub write_group_data {
|
Line 3335 sub write_group_data {
|
&Apache::lonnet::logthis("Failed to store $gpterm $groupname ". |
&Apache::lonnet::logthis("Failed to store $gpterm $groupname ". |
'in '.lc($crstype).': '.$cnum. |
'in '.lc($crstype).': '.$cnum. |
' in domain: '.$cdom); |
' in domain: '.$cdom); |
$r->print(&mt('An error occurred when [_1] the [_2]. '. |
$r->print('<div class="LC_error">' |
'Please try again.',$actiontype{$action},$gpterm)); |
.&mt('An error occurred when [_1] the '.$gpterm.'. ' |
|
.'Please try again.',$actiontype{$action}) |
|
.'</div>'); |
} |
} |
return $result; |
return $result; |
} |
} |
Line 3222 sub write_group_data {
|
Line 3346 sub write_group_data {
|
sub process_membership { |
sub process_membership { |
my ($r,$cdom,$cnum,$action,$state,$groupname,$tools,$enddate,$startdate, |
my ($r,$cdom,$cnum,$action,$state,$groupname,$tools,$enddate,$startdate, |
$userdata,$idx,$toolprivs,$usertools,$specificity,$defprivs,$memchg, |
$userdata,$idx,$toolprivs,$usertools,$specificity,$defprivs,$memchg, |
$gpterm,$ucgpterm)=@_; |
$gpterm,$ucgpterm,$crstype)=@_; |
my %usersettings = (); |
my %usersettings = (); |
my %added= (); |
my %added= (); |
my %failed = (); |
my %failed = (); |
Line 3233 sub process_membership {
|
Line 3357 sub process_membership {
|
my %curr_start = (); |
my %curr_start = (); |
my %curr_end = (); |
my %curr_end = (); |
my %tooltype = (); |
my %tooltype = (); |
|
my $context = 'processgroupmembership'; |
|
|
foreach my $tool (@{$tools}) { |
foreach my $tool (@{$tools}) { |
foreach my $priv (sort(keys(%{$$toolprivs{$tool}}))) { |
foreach my $priv (sort(keys(%{$$toolprivs{$tool}}))) { |
Line 3302 sub process_membership {
|
Line 3427 sub process_membership {
|
$curr_privs{$user}; |
$curr_privs{$user}; |
if (&Apache::lonnet::modify_group_roles($cdom,$cnum,$groupname, |
if (&Apache::lonnet::modify_group_roles($cdom,$cnum,$groupname, |
$user,$now,$savestart, |
$user,$now,$savestart, |
$curr_privs{$user},''',$context) eq 'ok') { |
$curr_privs{$user},'',$context) eq 'ok') { |
push(@{$added{'expired'}},$user); |
push(@{$added{'expired'}},$user); |
$num_ok ++; |
$num_ok ++; |
} else { |
} else { |
Line 3406 sub process_membership {
|
Line 3531 sub process_membership {
|
} |
} |
if ($num_fail) { |
if ($num_fail) { |
foreach my $type (sort(keys(%failed))) { |
foreach my $type (sort(keys(%failed))) { |
$r->print(&mt('The following users could not be [_1], because an error occurred:<br />',$type)); |
$r->print('<div class="LC_error">' |
|
.&mt("The following users could not be $type, because an error occurred:") |
|
.'</div>'); |
foreach my $user (@{$failed{$type}}) { |
foreach my $user (@{$failed{$type}}) { |
$r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'<br />'); |
$r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'<br />'); |
} |
} |
Line 3414 sub process_membership {
|
Line 3541 sub process_membership {
|
$r->print('<br />'); |
$r->print('<br />'); |
} |
} |
if (@unchanged > 0) { |
if (@unchanged > 0) { |
$r->print(&mt('No change occurred for the following users:<br />')); |
$r->print(&mt('No change occurred for the following users:').'<br />'); |
foreach my $user (sort(@unchanged)) { |
foreach my $user (sort(@unchanged)) { |
$r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'<br />'); |
$r->print($$userdata{$user}[$$idx{fullname}].' - '.$user.'<br />'); |
} |
} |
$r->print('<br />'); |
$r->print('<br />'); |
} |
} |
if ($roster_result eq 'ok') { |
if ($roster_result eq 'ok') { |
$r->print('<br />'.&mt('[_1] membership list updated.',$ucgpterm)); |
$r->print('<div class="LC_success">' |
$r->print('<p>'.&mt("Any currently logged in course users affected by the changes you made to group membership or privileges for the [_1] group will need to log out and log back in for their LON-CAPA sessions to reflect these changes.",$groupname).'</p>'); |
.&mt($ucgpterm.' membership list updated.') |
|
.'</div>'); |
|
$r->print('<p class="LC_info">'); |
|
if ($crstype eq 'Community') { |
|
$r->print(&mt("Any currently logged in community users affected by the changes you made" |
|
.' to group membership or privileges for the [_1] group will need to log out' |
|
.' and log back in for their LON-CAPA sessions to reflect these changes.' |
|
,'<i>'.$groupname.'</i>')); |
|
|
|
} else { |
|
$r->print(&mt("Any currently logged in course users affected by the changes you made" |
|
.' to group membership or privileges for the [_1] group will need to log out' |
|
.' and log back in for their LON-CAPA sessions to reflect these changes.' |
|
,'<i>'.$groupname.'</i>')); |
|
} |
|
$r->print('</p>'); |
} else { |
} else { |
$r->print('<br />'.&mt('An error occurred while updating the [_1] membership list -',$gpterm).$roster_result.'<br />'); |
$r->print('<div class="LC_error">' |
|
.&mt("An error occurred while updating the $gpterm membership list:") |
|
.'<br />'.$roster_result |
|
.'</div>'); |
} |
} |
return; |
return; |
} |
} |
Line 3440 sub mapping_options {
|
Line 3585 sub mapping_options {
|
'adds' => "If automatic $gpterm enrollment is enabled, when a user is newly assigned a ".lc($crstype)."-wide or section-specific role, he/she will automatically be added as a member of the $gpterm, with start and end access dates defined by the default dates set for the $gpterm, unless he/she is already a $gpterm member, with access dates that permit either current or future $gpterm access.", |
'adds' => "If automatic $gpterm enrollment is enabled, when a user is newly assigned a ".lc($crstype)."-wide or section-specific role, he/she will automatically be added as a member of the $gpterm, with start and end access dates defined by the default dates set for the $gpterm, unless he/she is already a $gpterm member, with access dates that permit either current or future $gpterm access.", |
'drops' => "If automatic $gpterm disenrollment is enabled, when a user's role is expired, access to the $gpterm will be terminated unless the user continues to have other ".lc($crstype)."-wide or section-specific active or future roles which receive automatic membership in the $gpterm.", |
'drops' => "If automatic $gpterm disenrollment is enabled, when a user's role is expired, access to the $gpterm will be terminated unless the user continues to have other ".lc($crstype)."-wide or section-specific active or future roles which receive automatic membership in the $gpterm.", |
'pirs' => "Pick roles and sections for automatic $gpterm enrollment", |
'pirs' => "Pick roles and sections for automatic $gpterm enrollment", |
'curr' => 'Currently set to', |
|
'on' => 'on', |
'on' => 'on', |
'off' => 'off', |
'off' => 'off', |
'auad' => "Automatically enable $gpterm membership when roles are added?", |
'auad' => "Automatically enable $gpterm membership when roles are added?", |
Line 3463 sub automapping {
|
Line 3607 sub automapping {
|
if (exists($$stored{'autodrop'})) { |
if (exists($$stored{'autodrop'})) { |
$drop = $$stored{'autodrop'}; |
$drop = $$stored{'autodrop'}; |
} |
} |
&topic_bar($r,$image,$$lt{'endi'}); |
$r->print(&Apache::lonhtmlcommon::topic_bar($image,$$lt{'endi'}).' |
$r->print(' |
|
<b>'.$$lt{'gmma'}.':</b><br />'.$$lt{'adds'}.'<br />'.$$lt{'drops'}.'<br /><br /> |
<b>'.$$lt{'gmma'}.':</b><br />'.$$lt{'adds'}.'<br />'.$$lt{'drops'}.'<br /><br /> |
<nobr>'.$$lt{'auad'}.': |
<span class="LC_nobreak">'.$$lt{'auad'}.': |
<label><input type="radio" name="autoadd" value="on" />on </label><label><input type="radio" name="autoadd" value="off" checked="checked" />off</label>'); |
<label><input type="radio" name="autoadd" value="on" />'.&mt('on').' </label><label><input type="radio" name="autoadd" value="off" checked="checked" />'.&mt('off').'</label>'); |
if ($action eq 'modify') { |
if ($action eq 'modify') { |
$r->print(' ('.$$lt{'curr'}.' <b>'.$$lt{$add}.'</b>)'); |
$r->print(' ('.&mt('Currently set to [_1].','<b>'.$$lt{$add}.'</b>').')'); |
} |
} |
$r->print(' |
$r->print(' |
</nobr><br /> |
</span><br /> |
<nobr>'.$$lt{'auex'}.': |
<span class="LC_nobreak">'.$$lt{'auex'}.': |
<label><input type="radio" name="autodrop" value="on" />on </label><label><input type="radio" name="autodrop" value="off" checked="checked" />off</label>'); |
<label><input type="radio" name="autodrop" value="on" />'.&mt('on').' </label><label><input type="radio" name="autodrop" value="off" checked="checked" />'.&mt('off').'</label>'); |
if ($action eq 'modify') { |
if ($action eq 'modify') { |
$r->print(' ('.$$lt{'curr'}.' <b>'.$$lt{$drop}.'</b>)'); |
$r->print(' ('.&mt('Currently set to [_1].','<b>'.$$lt{$drop}.'</b>').')'); |
} |
} |
$r->print('</nobr><br /><br />'.$$lt{'mapr'}); |
$r->print('</span><br /><br />'.$$lt{'mapr'}); |
} |
} |
|
|
sub mapping_settings { |
sub mapping_settings { |
Line 3491 sub mapping_settings {
|
Line 3634 sub mapping_settings {
|
} else { |
} else { |
@sections = ('all','none'); |
@sections = ('all','none'); |
} |
} |
&topic_bar($r,$image,$$lt{'pirs'}); |
$r->print(&Apache::lonhtmlcommon::topic_bar($image,$$lt{'pirs'})); |
my @roles = &standard_roles(); |
my @roles = &standard_roles($crstype); |
my %customroles = &Apache::lonhtmlcommon::course_custom_roles($cdom,$cnum); |
my %customroles = &Apache::lonhtmlcommon::course_custom_roles($cdom,$cnum); |
$r->print(&Apache::loncommon::start_data_table(). |
$r->print(&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_header_row()); |
&Apache::loncommon::start_data_table_header_row()); |
Line 3535 sub print_autorole_item {
|
Line 3678 sub print_autorole_item {
|
my ($role,$roletitle,$sections) = @_; |
my ($role,$roletitle,$sections) = @_; |
my $sections_sel; |
my $sections_sel; |
if (@{$sections} > 0) { |
if (@{$sections} > 0) { |
if ($role eq 'cc') { |
if (($role eq 'cc') || ($role eq 'co')) { |
$sections_sel = '<td align="right">'. |
$sections_sel = '<td align="right">'. |
&mt('all sections').'<input type="hidden" '. |
&mt('all sections').'<input type="hidden" '. |
'name="sec_cc" value="all" /></td>'; |
'name="sec_'.$role.'" value="all" /></td>'; |
} else { |
} else { |
$sections_sel='<td align="right">'. |
$sections_sel='<td align="right">'. |
§ions_selection($sections,'sec_'.$role). |
§ions_selection($sections,'sec_'.$role). |
Line 3554 sub print_autorole_item {
|
Line 3697 sub print_autorole_item {
|
} |
} |
|
|
sub standard_roles { |
sub standard_roles { |
my @roles = ('cc','in','ta','ep','st'); |
my ($crstype) = @_; |
|
my @roles = qw(in ta ep ad st); |
|
if ($crstype eq 'Community') { |
|
unshift(@roles,'co'); |
|
} else { |
|
unshift(@roles,'cc'); |
|
} |
return @roles; |
return @roles; |
} |
} |
|
|
Line 3638 sub member_privs_entries {
|
Line 3787 sub member_privs_entries {
|
if ($privcount == 3) { |
if ($privcount == 3) { |
$dynamic .= '</tr><tr>'; |
$dynamic .= '</tr><tr>'; |
} |
} |
$dynamic .='<td><nobr><label><input type="checkbox" '. |
$dynamic .='<td><span class="LC_nobreak"><label><input type="checkbox" '. |
'name="userpriv_'.$priv.'" value="'.$user.'"'; |
'name="userpriv_'.$priv.'" value="'.$user.'"'; |
if (grep/^\Q$priv\E$/,@{$defprivs}) { |
if (grep/^\Q$priv\E$/,@{$defprivs}) { |
$dynamic .= ' checked="checked" '; |
$dynamic .= ' checked="checked" '; |
} |
} |
$dynamic .= ' />'.$$toolprivs{$tool}{$priv}. |
$dynamic .= ' />'.$$toolprivs{$tool}{$priv}. |
'</label></nobr></td>'; |
'</label></span></td>'; |
} |
} |
} |
} |
$r->print('<tr><td colspan="2"><nobr>'.$fixed.'</nobr></td></tr><tr>'.$dynamic.'</tr></table></td>'); |
$r->print('<tr><td colspan="2"><span class="LC_nobreak">'.$fixed.'</span></td></tr><tr>'.$dynamic.'</tr></table></td>'); |
} else { |
} else { |
$r->print('<td valign="top"><table width="100%"><tr><th colspan="2">'.$tool.'</th></tr><tr><td> </td></tr><tr><td> </td></tr></table></td>'); |
$r->print('<td valign="top"><table width="100%"><tr><th colspan="2">'.$tool.'</th></tr><tr><td> </td></tr><tr><td> </td></tr></table></td>'); |
} |
} |
Line 3673 sub date_setting_table {
|
Line 3822 sub date_setting_table {
|
'startdate',$starttime); |
'startdate',$starttime); |
my $endform = &Apache::lonhtmlcommon::date_setter($formname, |
my $endform = &Apache::lonhtmlcommon::date_setter($formname, |
'enddate',$endtime); |
'enddate',$endtime); |
my $perpetual = |
my $perpetual = ' <span class="LC_nobreak"><label>' |
'<nobr><label><input type="checkbox" name="no_end_date" />'. |
.'<input type="checkbox" name="no_end_date" />' |
&mt('None').'</label></nobr>'; |
.&mt('No end date') |
my $table = "<table class=\"LC_descriptive_input\">\n". |
.'</label></span>'; |
'<tr><td class="LC_description">'.&mt('Start:').'</td>'. |
my $table = &Apache::lonhtmlcommon::start_pick_box() |
'<td>'.$startform.'</td>'. |
.&Apache::lonhtmlcommon::row_title(&mt('Start Date')) |
'<td> </td>'."</tr>\n". |
.$startform |
'<tr><td class="LC_description">'.&mt('End:').'</td>'. |
.&Apache::lonhtmlcommon::row_closure() |
'<td>'.$endform.'</td>'. |
.&Apache::lonhtmlcommon::row_title(&mt('End Date')) |
'<td>'.$perpetual.'</td>'."</tr>\n". |
.$endform |
"</table>\n"; |
.$perpetual |
|
.&Apache::lonhtmlcommon::row_closure(1) |
|
.&Apache::lonhtmlcommon::end_pick_box(); |
return $table; |
return $table; |
} |
} |
|
|
Line 3691 sub add_group_folder {
|
Line 3842 sub add_group_folder {
|
my ($cdom,$cnum,$now,$groupname,$action,$description,$tools,$groupinfo, |
my ($cdom,$cnum,$now,$groupname,$action,$description,$tools,$groupinfo, |
$gpterm,$ucgpterm,$crstype) = @_; |
$gpterm,$ucgpterm,$crstype) = @_; |
if ($cdom eq '' || $cnum eq '') { |
if ($cdom eq '' || $cnum eq '') { |
return &mt('Error: invalid course domain or number - group folder creation failed'); |
my $error = '<span class="LC_error">'; |
|
if ($crstype eq 'Community') { |
|
$error .= &mt("Error: invalid community domain or number - group folder creation failed."); |
|
} else { |
|
$error .= &mt("Error: invalid course domain or number - group folder creation failed."); |
|
} |
|
$error .= '</span>'; |
|
return $error; |
} |
} |
my ($outcome,$allgrpsmap,$grpmap,$boardsmap,$grppage,$warning); |
my ($outcome,$allgrpsmap,$grpmap,$boardsmap,$grppage,$warning); |
my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/'; |
my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/'; |
Line 3701 sub add_group_folder {
|
Line 3859 sub add_group_folder {
|
# check if group_allfolders.sequence exists. |
# check if group_allfolders.sequence exists. |
my $mapcontents = &Apache::lonnet::getfile($allgrpsmap); |
my $mapcontents = &Apache::lonnet::getfile($allgrpsmap); |
if ($mapcontents eq '-1') { #file does not exist; |
if ($mapcontents eq '-1') { #file does not exist; |
my $grpstitle = &mt('[_1] [_2]s',$crstype,$ucgpterm); |
my $grpstitle = &mt("$crstype $ucgpterm".'s'); |
my $topmap_url = '/'.$env{'course.'.$env{'request.course.id'}.'.url'}; |
my $topmap_url = '/'.$env{'course.'.$env{'request.course.id'}.'.url'}; |
$topmap_url =~ s|/+|/|g; |
$topmap_url =~ s|/+|/|g; |
if ($topmap_url =~ m|^/uploaded|) { |
if ($topmap_url =~ m|^/uploaded|) { |
$outcome = &map_updater($cdom,$cnum,'group_allfolders.sequence', |
$outcome = &map_updater($cdom,$cnum,'group_allfolders.sequence', |
'toplevelgroup',$grpstitle,$topmap_url); |
'toplevelgroup',$grpstitle,$topmap_url); |
} else { |
} else { |
$outcome = &mt('Non-standard course - folder for all groups not added.'); |
$outcome = '<span class="LC_warning">' |
|
.&mt('Non-standard course - folder for all groups not added.') |
|
.'</span>'; |
} |
} |
if ($outcome ne 'ok') { |
if ($outcome ne 'ok') { |
my $delresult = &release_folder_lock($cdom,$cnum,'group_allfolders'); |
my $delresult = &release_folder_lock($cdom,$cnum,'group_allfolders'); |
if ($delresult ne 'ok') { |
if ($delresult ne 'ok') { |
$warning = $delresult; |
$warning = $delresult; |
} |
} |
return $outcome; |
return $outcome.$warning; |
} |
} |
} |
} |
my $delresult = &release_folder_lock($cdom,$cnum,'group_allfolders'); |
my $delresult = &release_folder_lock($cdom,$cnum,'group_allfolders'); |
Line 3723 sub add_group_folder {
|
Line 3883 sub add_group_folder {
|
$warning = $delresult ; |
$warning = $delresult ; |
} |
} |
} else { |
} else { |
$outcome = &mt('Could not obtain exclusive lock to check status of the folder for all groups. No group folder added.'); |
$outcome = '<span class="LC_error">' |
|
.&mt('Could not obtain exclusive lock to check status of the folder for all groups. No group folder added.') |
|
.'</span>'; |
return $outcome; |
return $outcome; |
} |
} |
my $grpfolder = &mt($ucgpterm.' Folder - [_1]',$description); |
my $grpfolder = &mt($ucgpterm.' Folder - [_1]',$description); |
Line 3754 sub add_group_folder {
|
Line 3916 sub add_group_folder {
|
} |
} |
my ($furl,$ferr)= &Apache::lonuserstate::readmap($cdom.'/'.$cnum); |
my ($furl,$ferr)= &Apache::lonuserstate::readmap($cdom.'/'.$cnum); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
if (!defined($navmap)) { |
|
$warning .= '<span class="LC_error">'; |
|
if ($crstype eq 'Community') { |
|
$warning .= &mt("Error retrieving community contents"). |
|
' '.&mt("You need to re-initialize the community."); |
|
} else { |
|
$warning .= &mt("Error retrieving course contents"). |
|
' '.&mt("You need to re-initialize the course."); |
|
} |
|
$warning .= '</span>'; |
|
return $warning; |
|
} |
# modify parameters |
# modify parameters |
my $parm_result; |
my $parm_result; |
if ($action eq 'create') { |
if ($action eq 'create') { |
Line 3799 sub release_folder_lock {
|
Line 3973 sub release_folder_lock {
|
my @del_lock = ($folder_name."\0".'locked_folder'); |
my @del_lock = ($folder_name."\0".'locked_folder'); |
my $dellockoutcome=&Apache::lonnet::del('coursegroups',\@del_lock,$cdom,$cnum); |
my $dellockoutcome=&Apache::lonnet::del('coursegroups',\@del_lock,$cdom,$cnum); |
if ($dellockoutcome ne 'ok') { |
if ($dellockoutcome ne 'ok') { |
return ('<br />'.&mt('Warning: failed to release lock for folder: [_1].',$folder_name).'<br />'); |
return ('<div class="LC_error">' |
|
.&mt('Warning: failed to release lock for folder: [_1].','<tt>'.$folder_name.'</tt>') |
|
.'</div>' |
|
); |
} else { |
} else { |
return 'ok'; |
return 'ok'; |
} |
} |
Line 3814 sub map_updater {
|
Line 3991 sub map_updater {
|
my $newmapurl=&Apache::lonnet::finishuserfileupload($cnum,$cdom,$itemname, |
my $newmapurl=&Apache::lonnet::finishuserfileupload($cnum,$cdom,$itemname, |
$newfile); |
$newfile); |
if ($newmapurl !~ m|^/uploaded|) { |
if ($newmapurl !~ m|^/uploaded|) { |
$outcome = &mt('Error uploading new folder.')." ($newfile): $newmapurl".'<br />'; |
$outcome = '<div class="LC_error">' |
|
.&mt('Error uploading new folder.')." ($newfile): $newmapurl" |
|
.'</div>'; |
return $outcome; |
return $outcome; |
} |
} |
my ($errtext,$fatal)=&LONCAPA::map::mapread($parentmap); |
my ($errtext,$fatal)=&LONCAPA::map::mapread($parentmap); |
if ($fatal) { |
if ($fatal) { |
$outcome = &mt('Error reading contents of parent folder')." ($parentmap): $errtext".'<br />'; |
$outcome = '<div class="LC_error">' |
|
.&mt('Error reading contents of parent folder.')." ($parentmap): $errtext" |
|
.'</div>'; |
return $outcome; |
return $outcome; |
} else { |
} else { |
my $newidx=&LONCAPA::map::getresidx($newmapurl); |
my $newidx=&LONCAPA::map::getresidx($newmapurl); |
Line 3828 sub map_updater {
|
Line 4009 sub map_updater {
|
$LONCAPA::map::order[1+$#LONCAPA::map::order]=$newidx; |
$LONCAPA::map::order[1+$#LONCAPA::map::order]=$newidx; |
my ($outtext,$errtext) = &LONCAPA::map::storemap($parentmap,1); |
my ($outtext,$errtext) = &LONCAPA::map::storemap($parentmap,1); |
if ($errtext) { |
if ($errtext) { |
$outcome = &mt('Error saving updated parent folder')." ($parentmap): $errtext".'<br />'; |
$outcome = '<div class="LC_error">' |
|
.&mt('Error saving updated parent folder.')." ($parentmap): $errtext" |
|
.'</div>'; |
return $outcome; |
return $outcome; |
} |
} |
} |
} |
Line 3848 sub new_map {
|
Line 4031 sub new_map {
|
} |
} |
|
|
sub parm_setter { |
sub parm_setter { |
my ($navmap,$cdom,$url,$groupname) = @_; |
my ($navmap,$cdom,$url,$groupname,$crstype) = @_; |
my $allresults; |
if (!defined($navmap)) { |
|
my $allresults; |
|
if ($crstype eq 'Community') { |
|
$allresults = &mt("Parameters not set for [_1] because the contents of the community could not be retrieved.",$url).' '. |
|
&mt("You need to reinitialize the community."); |
|
} else { |
|
$allresults = &mt("Parameters not set for [_1] because the contents of the course could not be retrieved.",$url).' '. |
|
&mt("You need to reinitialize the course."); |
|
|
|
} |
|
return '<div class="LC_warning">'.$allresults.'</div>'; |
|
} |
my %hide_settings = ( |
my %hide_settings = ( |
'course' => { |
'course' => { |
'num' => 13, |
'num' => 13, |
Line 3862 sub parm_setter {
|
Line 4056 sub parm_setter {
|
}, |
}, |
); |
); |
my $res = $navmap->getResourceByUrl($url); |
my $res = $navmap->getResourceByUrl($url); |
|
my $allresults; |
if ($res) { |
if ($res) { |
my $symb = $res->symb(); |
my $symb = $res->symb(); |
foreach my $level (keys(%hide_settings)) { |
foreach my $level (keys(%hide_settings)) { |
Line 3878 sub parm_setter {
|
Line 4073 sub parm_setter {
|
} |
} |
} |
} |
} else { |
} else { |
$allresults = &mt('Parameters not set for [_1] because the resource was not recognized as part of the course',$url).'<br />'; |
$allresults = '<div class="LC_warning">'; |
|
if ($crstype eq 'Community') { |
|
$allresults .= &mt("Parameters not set for [_1] because the resource was not recognized as part of the community.",'<tt>'.$url.'</tt>'); |
|
} else { |
|
$allresults .= &mt('Parameters not set for [_1] because the resource was not recognized as part of the course.','<tt>'.$url.'</tt>'); |
|
} |
|
$allresults .= '</div>'; |
} |
} |
return $allresults; |
return $allresults; |
} |
} |
Line 3992 sub validate_groupname {
|
Line 4193 sub validate_groupname {
|
return; |
return; |
} |
} |
|
|
sub topic_bar { |
|
my ($r,$imgnum,$title) = @_; |
|
$r->print(' |
|
<div class="LC_topic_bar"> |
|
<img alt="'.&mt('Step [_1]',$imgnum). |
|
'"src="/res/adm/pages/bl_step'.$imgnum.'.gif" /> |
|
<span>'.$title.'</span> |
|
</div> |
|
'); |
|
return; |
|
} |
|
|
|
sub check_changes { |
sub check_changes { |
my ($member_changes,$memchg) = @_; |
my ($member_changes,$memchg) = @_; |
my %exclusions; |
my %exclusions; |