[LON-CAPA-cvs] cvs: loncom /interface loncoursegroups.pm

raeburn raeburn@source.lon-capa.org
Fri, 06 Nov 2009 19:49:26 -0000


This is a MIME encoded message

--raeburn1257536966
Content-Type: text/plain

raeburn		Fri Nov  6 19:49:26 2009 EDT

  Modified files:              
    /loncom/interface	loncoursegroups.pm 
  Log:
  - Accommodate Communities.
  
  
--raeburn1257536966
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20091106194926.txt"

Index: loncom/interface/loncoursegroups.pm
diff -u loncom/interface/loncoursegroups.pm:1.103 loncom/interface/loncoursegroups.pm:1.104
--- loncom/interface/loncoursegroups.pm:1.103	Wed Sep  9 04:31:53 2009
+++ loncom/interface/loncoursegroups.pm	Fri Nov  6 19:49:26 2009
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursegroups.pm,v 1.103 2009/09/09 04:31:53 raeburn Exp $
+# $Id: loncoursegroups.pm,v 1.104 2009/11/06 19:49:26 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -54,7 +54,7 @@
     if (! ($env{'request.course.fn'})) {
         # Not in a course
         $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;
     }
 
@@ -537,7 +537,7 @@
 
     if (ref($stored{'autorole'}) eq 'ARRAY') {
         foreach my $role (@{$stored{'autorole'}}) {
-            unless ($role eq 'cc') {
+            unless (($role eq 'cc') || ($role eq 'co')) {
                 $elements{'modify'}{'change_settings'}{'sec_'.$role} = 
                                                                    'selectbox';
             }
@@ -1086,7 +1086,7 @@
             &add_members_form($r,$cdom,$cnum,$action,$state,$page,$startdate,
                               $enddate,$groupname,$description,$granularity,
                               $quota,$sectioncount,$tools,$functions,$stored,
-                              $states,$navbuttons,$gpterm,$ucgpterm);
+                              $states,$navbuttons,$gpterm,$ucgpterm,$crstype);
         } elsif ($state eq 'pick_members') {
             &choose_members_form($r,$cdom,$cnum,$action,$state,$page,
                                  $groupname,$description,$granularity,$quota,
@@ -1119,31 +1119,36 @@
         my %stored = &retrieve_settings($cdom,$cnum,$groupname,$action);
         if ($state eq 'verify') {
             &verify_delete($r,$groupname,$state,$action,$page,$states,
-                           \%stored);
+                           \%stored,$crstype);
         } elsif ($state eq 'result') {
-            &delete_group($r,$cdom,$cnum,$groupname);
+            &delete_group($r,$cdom,$cnum,$groupname,$crstype);
         }
     } elsif ($action eq 'reenable') {
         my %stored = &retrieve_settings($cdom,$cnum,$groupname,$action);
         if ($state eq 'verify') {
             &verify_reenable($r,$groupname,$state,$action,$page,$states,
-                           \%stored);
+                           \%stored,$crstype);
         } elsif ($state eq 'result') {
-            &reenable_group($r,$cdom,$cnum,$groupname);
+            &reenable_group($r,$cdom,$cnum,$groupname,$crstype);
         }
     }
 }
 
 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(&mt('You have requested deletion of the group [_1].'
                  ,'<i>'.$stored->{'description'}.'</i>').
               '<br /><br />'.&mt('When a group is deleted the following occurs:').'<ul>'.
               '<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 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.'));
+              '<li>'.&mt('The group ceases to be available either for viewing or for modification of group settings and membership.').'</li>');
+    if ($crstype eq 'Community') {
+        $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 $nexttext = &mt('Delete group');
     my $prev;
@@ -1156,7 +1161,7 @@
 }
 
 sub delete_group {
-    my ($r,$cdom,$cnum,$groupname) = @_;
+    my ($r,$cdom,$cnum,$groupname,$crstype) = @_;
     my %membership = &Apache::lonnet::get_group_membership($cdom,$cnum,
                                                            $groupname);
     my $now = time;
@@ -1198,22 +1203,24 @@
                  .&mt('Group deletion failed because deletion of [_1] out of [_2] members failed.'
                      ,$num_fail,$num_users)
                  .'</div>');
-        
     } else {
         my ($result,$message) = 
              &Apache::lonnet::toggle_coursegroup_status($cdom,$cnum,
                                                         $groupname,'delete');
         if ($result eq 'ok') {
-            my $outcome = &modify_folders($cdom,$cnum,$groupname);
+            my $outcome = &modify_folders($cdom,$cnum,$groupname,$crstype);
             if ($outcome eq '') {
                 $r->print('<div class="LC_success">'
                          .&mt('Group successfully deleted.')
                          .'</div>');
             } else {
-                $r->print('<div class="LC_error">'
-                         .&mt("Although the group was deleted, an error occurred when removing"
-                             ." the group's folder from the 'Course Groups' folder: [_1]",$outcome)
-                         .'</div>');
+                $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 {
             $r->print('<div class="LC_error">'
@@ -1225,11 +1232,16 @@
 }
 
 sub reenable_folder {
-    my ($cdom,$cnum,$groupname,$description) = @_;
+    my ($cdom,$cnum,$groupname,$description,$crstype) = @_;
     my $outcome;
     my $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/';
     my $allgrpsmap = $crspath.'group_allfolders.sequence';
-    my $foldertitle = &mt('Course Folder -[_1]',$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_'.
                    $groupname.'.sequence';
     my ($errtext,$fatal)=&LONCAPA::map::mapread($allgrpsmap);
@@ -1258,14 +1270,19 @@
 }
 
 sub modify_folders {
-    my ($cdom,$cnum,$groupname) = @_;
+    my ($cdom,$cnum,$groupname,$crstype) = @_;
     my ($outcome,$groupmap,$groupmapres,$map,$id,$src);
     my $navmap = Apache::lonnavmaps::navmap->new();
     if (!defined($navmap)) {
-        $outcome = '<div class="LC_error">'.
-                   &mt('Error reading course contents.').' '.
-                   &mt('You need to re-initialize the course.').
-                   '</div>';
+        $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_'.
@@ -1320,13 +1337,18 @@
 }
 
 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(&mt('You have requested enabling the previously deleted group [_1].'
                  ,'<i>'.$stored->{'description'}.'</i>').
               '<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('A group folder is added to the "Course Groups" folder which contains folders for all groups in the course.').'</li></ul>');
+              '<li>'.&mt('Group settings and membership at the time the group was deleted are reinstated.').'</li><li>');
+    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 $nexttext = &mt('Reenable group');
     my $prev;
@@ -1339,7 +1361,7 @@
 }
 
 sub reenable_group {
-    my ($r,$cdom,$cnum,$groupname) = @_;
+    my ($r,$cdom,$cnum,$groupname,$crstype) = @_;
     my %groups = 
         &Apache::longroup::coursegroups($cdom,$cnum,$groupname,
                                         'deleted_groups');
@@ -1413,15 +1435,19 @@
                      .&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 '') {
             $r->print('<div class="LC_success">'
                      .&mt('Group successfully re-enabled.')
                      .'</div>');
         } else {
-            $r->print('<div class="LC_error">'
-                     .&mt("Although the group was re-enabled, an error occurred when adding the group's folder to the 'Course Groups' folder: [_1]",$outcome)
-                     .'</div>');
+            $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 {
         $r->print('<div class="LC_error">'
@@ -1579,7 +1605,7 @@
     &access_date_settings($r,$action,$formname,$stored,2,$gpterm,$ucgpterm);
     if ($action eq 'create') {
         &membership_options($r,$cdom,$cnum,$action,$formname,$sectioncount,3,
-                            $gpterm,$ucgpterm);
+                            $gpterm,$ucgpterm,$crstype);
         $nexttext = $$navbuttons{'gtns'};
     } else {
         my @available = ();
@@ -1588,7 +1614,7 @@
         @{$tools} = sort(keys(%{$functions}));
         &privilege_specificity($r,$action,3,$tools,$stored,$toolprivs,
 			       $fixedprivs,\@available,$formname,
-			       $gpterm,$ucgpterm,$functions);
+			       $gpterm,$ucgpterm,$functions,$crstype);
         &mapping_options($r,$action,$formname,$page,$sectioncount,
                          $states,$stored,$navbuttons,4,5,
 			 $gpterm,$ucgpterm,$crstype,$cdom,$cnum);
@@ -1741,38 +1767,48 @@
 }
 
 sub membership_options {
-    my ($r,$cdom,$cnum,$action,$state,$sectioncount,$image,$gpterm,$ucgpterm)=@_;
-    my $crstype = &Apache::loncommon::course_type();
+    my ($r,$cdom,$cnum,$action,$state,$sectioncount,$image,$gpterm,$ucgpterm,$crstype)=@_;
     my %lt = &Apache::lonlocal::texthash(
                 'pipa' => 'Build a list of users for selection of group members',
-                'gmem' => "Group membership selection list criteria:",
-                'picr' => 'Pick the criteria to use to build a list of '.
-                          lc($crstype).' users from which you will select ',
-                'meof' => "members of the new group.",
-                'admg' => "additional members of the group.",
-                '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.",
+                'gmem' => 'Group membership selection list criteria:',
+                'picr' => 'Pick the criteria to use to build a list of course users from which you will select members of the new group.',
+                'pica' => 'Pick the criteria to use to build a list of course users from which you will select additional members of the group.',
+                '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',
-                'coro' => $crstype.' roles',
-                'cose' => $crstype.' sections',
+                'coro' => 'Course roles',
+                '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 = (
                    active => &mt('Currently has access'),
                    previous => &mt('Previously had 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});
 
     $r->print(&Apache::lonhtmlcommon::topic_bar($image,$lt{'pipa'}).'
-     <b>'.$lt{'gmem'}.'</b><br />'.$lt{'picr'});
+     <b>'.$lt{'gmem'}.'</b><br />');
     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 {
-        $r->print($lt{'admg'});
+        $r->print($lt{'pica'});
     }
     $r->print('
      <br />
@@ -1889,7 +1925,7 @@
     }
     &privilege_specificity($r,$action,$specimg,$tools,$stored,$toolprivs,
                           $fixedprivs,\@available,$formname,$gpterm,$ucgpterm,
-                          $functions);
+                          $functions,$crstype);
     my $newusers = &pick_new_members($r,$action,$formname,\@available,$idx,
 				     $stored,$memimg,$users,$userdata,
 				     $granularity,\%origmembers,$gpterm,
@@ -2166,7 +2202,7 @@
 
 sub privilege_specificity {
     my ($r,$action,$img,$tools,$stored,$toolprivs,$fixedprivs,$available,
-	$formname,$gpterm,$ucgpterm,$functions) = @_;
+	$formname,$gpterm,$ucgpterm,$functions,$crstype) = @_;
     my %lt = &Apache::lonlocal::texthash (
       'uprv' => 'User privileges for collaborative tools',
       'frty' => 'For each collaborative tool you have chosen to include, '.
@@ -2200,6 +2236,9 @@
       'oppr' => 'Optional privileges',
       '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;
     foreach my $tool (@{$tools}) {
         foreach my $priv (sort(keys(%{$$toolprivs{$tool}}))) {
@@ -2755,7 +2794,7 @@
 sub add_members_form {
     my ($r,$cdom,$cnum,$action,$formname,$page,$startdate,$enddate,$groupname,
         $description,$granularity,$quota,$sectioncount,$tools,$functions,
-        $stored,$states,$navbuttons,$gpterm,$ucgpterm)=@_; 
+        $stored,$states,$navbuttons,$gpterm,$ucgpterm,$crstype)=@_;
     $r->print(' <br />');
     my @available = ();
     my @unavailable = ();
@@ -2764,7 +2803,7 @@
 			    $groupname,$description,$granularity,$quota,
 			    \@available,\@unavailable,$gpterm,$ucgpterm);
     &membership_options($r,$cdom,$cnum,$action,$formname,$sectioncount,1,$gpterm,
-                        $ucgpterm);
+                        $ucgpterm,$crstype);
     my $nexttext = $$navbuttons{'gtns'};
     my $prevtext = $$navbuttons{'gtpp'};
     &display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext,
@@ -3095,7 +3134,7 @@
         &process_membership($r,$cdom,$cnum,$action,$state,$groupname,$tools,
                             $enddate,$startdate,$userdata,$idx,$toolprivs,
                             $usertools,$specificity,\@defprivs,$memchg,$gpterm,
-                            $ucgpterm);
+                            $ucgpterm,$crstype);
     }
     return;
 }
@@ -3257,17 +3296,28 @@
                                 }
                                 undef($navmap);
                             } else {
-                                $error = &mt('An error occurred while setting parameters '.
+                                if ($crstype eq 'Community') {
+                                    $error = &mt("An error occurred while setting parameters '.
                                              'for Discussion Boards folder: '.
-                                             'Could not retrieve course information' );
+                                             'Could not retrieve community information");
+                                } else {
+                                    $error = &mt("An error occurred while setting parameters '.
+                                             'for Discussion Boards folder: '.
+                                             'Could not retrieve course information");
+                                }
                             }
                         } else {
                             $r->print($outcome);
                         }
                     }
                 } else {
-                    $error = &mt("An error occurred while retrieving the contents of the group's folder.").'<br />'.
-                             &mt('You need to re-initialize the course.');
+                    $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 {
+                        $error .= &mt("You need to re-initialize the course.");
+                    }
                 }
                 if ($error ne '') {
                     $r->print('<div class="LC_error">'.$error.'</div>');
@@ -3296,7 +3346,7 @@
 sub process_membership {
     my ($r,$cdom,$cnum,$action,$state,$groupname,$tools,$enddate,$startdate,
         $userdata,$idx,$toolprivs,$usertools,$specificity,$defprivs,$memchg,
-        $gpterm,$ucgpterm)=@_;
+        $gpterm,$ucgpterm,$crstype)=@_;
     my %usersettings = ();
     my %added= ();
     my %failed = ();
@@ -3501,13 +3551,20 @@
         $r->print('<div class="LC_success">'
                  .&mt($ucgpterm.' membership list updated.')
                  .'</div>');
-	$r->print('<p class="LC_info">'
-                 .&mt('Any currently logged in course users affected by the changes you made'
+	$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>')
-                 .'</p>'
-        );
+                     ,'<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 {
         $r->print('<div class="LC_error">'
                  .&mt("An error occurred while updating the $gpterm membership list:")
@@ -3578,7 +3635,7 @@
         @sections = ('all','none');
     }
     $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);
     $r->print(&Apache::loncommon::start_data_table().
 	      &Apache::loncommon::start_data_table_header_row());
@@ -3621,10 +3678,10 @@
     my ($role,$roletitle,$sections) = @_;
     my $sections_sel;
     if (@{$sections} > 0) {
-        if ($role eq 'cc') {
+        if (($role eq 'cc') || ($role eq 'co')) {
             $sections_sel = '<td align="right">'.
                             &mt('all sections').'<input type="hidden" '.
-                            'name="sec_cc" value="all" /></td>';
+                            'name="sec_'.$role.'" value="all" /></td>';
         } else {
             $sections_sel='<td align="right">'.
                           &sections_selection($sections,'sec_'.$role).
@@ -3640,7 +3697,13 @@
 } 
 
 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;
 }
 
@@ -3779,9 +3842,14 @@
     my ($cdom,$cnum,$now,$groupname,$action,$description,$tools,$groupinfo,
         $gpterm,$ucgpterm,$crstype) = @_;
     if ($cdom eq '' || $cnum eq '') {
-        return '<span class="LC_error">'
-              .&mt('Error: invalid course domain or number - group folder creation failed.')
-              .'</span>';
+        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 $crspath = '/uploaded/'.$cdom.'/'.$cnum.'/';
@@ -3849,8 +3917,16 @@
     my ($furl,$ferr)= &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
     my $navmap = Apache::lonnavmaps::navmap->new();
     if (!defined($navmap)) {
-        return $warning.'<span class="LC_error">'.&mt('Error retrieving course contents').
-               ' '.&mt('You need to re-initialize the course.').'</span>';
+        $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
     my $parm_result;
@@ -3955,14 +4031,18 @@
 }
 
 sub parm_setter {
-    my ($navmap,$cdom,$url,$groupname) = @_;
-    my $allresults;
+    my ($navmap,$cdom,$url,$groupname,$crstype) = @_;
     if (!defined($navmap)) {
-        $allresults = '<div class="LC_warning">'.
-                      &mt('Parameters not set for [_1] because the contents of the course could not be retrieved.',$url).' '.
-                      &mt('You need to reinitialize the course.').
-                      '</div>';
-        return $allresults;
+        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 = (
                            'course' =>  {
@@ -3976,6 +4056,7 @@
                                         },
                         );
     my $res = $navmap->getResourceByUrl($url);
+    my $allresults;
     if ($res) {
         my $symb = $res->symb();
         foreach my $level (keys(%hide_settings)) {
@@ -3992,10 +4073,13 @@
             }
         }
     } else {
-        $allresults = '<div class="LC_warning">' 
-                     .&mt('Parameters not set for [_1] because the resource was not recognized'
-                         .' as part of the course.','<tt>'.$url.'</tt>')
-                     .'</div>';
+        $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;
 }

--raeburn1257536966--