[LON-CAPA-cvs] cvs: loncom /interface loncoursequeueadmin.pm loncreatecourse.pm lonrequestcourse.pm

raeburn raeburn@source.lon-capa.org
Wed, 18 Nov 2009 19:15:45 -0000


This is a MIME encoded message

--raeburn1258571745
Content-Type: text/plain

raeburn		Wed Nov 18 19:15:45 2009 EDT

  Modified files:              
    /loncom/interface	loncreatecourse.pm lonrequestcourse.pm 
                     	loncoursequeueadmin.pm 
  Log:
  - Accommodate Communities.
  
  
--raeburn1258571745
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20091118191545.txt"

Index: loncom/interface/loncreatecourse.pm
diff -u loncom/interface/loncreatecourse.pm:1.133 loncom/interface/loncreatecourse.pm:1.134
--- loncom/interface/loncreatecourse.pm:1.133	Wed Nov  4 14:12:19 2009
+++ loncom/interface/loncreatecourse.pm	Wed Nov 18 19:15:44 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Create a course
 #
-# $Id: loncreatecourse.pm,v 1.133 2009/11/04 14:12:19 raeburn Exp $
+# $Id: loncreatecourse.pm,v 1.134 2009/11/18 19:15:44 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -111,15 +111,15 @@
 		     &Apache::loncommon::selectcourse_link
 	     ('ccrs','clonecourse','clonedomain',undef,undef,undef,$crstype);
     my $coursebrowserjs=&Apache::loncommon::coursebrowser_javascript($env{'request.role.domain'});
-    my ($enroll_table,$access_table,$krbdef,$krbdefdom,$krbform,$intform,$locform,
+    my ($enroll_table,$krbdef,$krbdefdom,$krbform,$intform,$locform,
         $javascript_validations);
+    my $starttime = time;
+    my $endtime = time+(6*30*24*60*60); # 6 months from now, approx
+    my $access_table = &Apache::lonuserutils::date_setting_table($starttime,
+                                             $endtime,'create_defaultdates');
     if ($crstype eq 'Course') {
-        my $starttime = time;
-        my $endtime = time+(6*30*24*60*60); # 6 months from now, approx
         $enroll_table = &Apache::lonuserutils::date_setting_table($starttime,
                                               $endtime,'create_enrolldates');
-        $access_table = &Apache::lonuserutils::date_setting_table($starttime,
-                                             $endtime,'create_defaultdates');
         ($krbdef,$krbdefdom) =
         &Apache::loncommon::get_kerberos_defaults($defdom);
         $javascript_validations=&Apache::lonuserutils::javascript_validations(
@@ -202,8 +202,8 @@
                     'dacu' => "Duration of automated classlist updates",
                     'dads' => 'Default Access Dates for Students',
                     'dacc' => "Default start and end dates for student access",
-                    'psam' => "Please select the Authentication mechanism",
-                    'pcda' => "Please choose the default authentication method to be used by new users added to this LON-CAPA domain by the automated enrollment process",
+                    'psam' => "Authentication mechanism",
+                    'pcda' => "Default authentication method for new users added to this domain by the automated enrollment process",
                     'nech' => "Notification of enrollment changes",
                     'nccl' => "Notification to course coordinator via LON-CAPA message when enrollment changes occur during the automated update?",
                     'ndcl' => "Notification to domain coordinator via LON-CAPA message when enrollment changes occur during the automated update?",
@@ -719,14 +719,14 @@
                      help => 'Batch_Creation',
                  },
                    { internal_name => 'requestdisplay',
-                     name => &mt('Approve or reject course requests'),
+                     name => &mt('Approve or reject requests'),
                      short_description =>
-    &mt('Display course creation requests submitted by authorized users, held pending approval by a Domain Coordinator.'),
+    &mt('Display course and community creation requests submitted by authorized users, held pending approval by a Domain Coordinator.'),
                    },
                    { internal_name => 'creationlog',
-                     name => &mt('View course creation log'),
+                     name => &mt('View creation log'),
                      short_description =>
-    &mt('Display information about when, how and by whom courses were created in this domain.'),
+    &mt('Display information about when, how and by whom courses and communities were created in this domain.'),
                    },
     );
     my $options;
Index: loncom/interface/lonrequestcourse.pm
diff -u loncom/interface/lonrequestcourse.pm:1.39 loncom/interface/lonrequestcourse.pm:1.40
--- loncom/interface/lonrequestcourse.pm:1.39	Wed Nov  4 17:42:17 2009
+++ loncom/interface/lonrequestcourse.pm	Wed Nov 18 19:15:44 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Request a course
 #
-# $Id: lonrequestcourse.pm,v 1.39 2009/11/04 17:42:17 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.40 2009/11/18 19:15:44 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -157,7 +157,7 @@
 
     my @invalidcrosslist;
     my %trail = (
-                 crstype       => 'Course Request Action',
+                 crstype       => 'Request Action',
                  codepick      => 'Category',
                  courseinfo    => 'Description',
                  enrollment    => 'Access Dates',
@@ -192,16 +192,30 @@
                     if (($udom =~ /^$match_domain$/) && ($uname =~ /^$match_username$/)) {
                         $result = &retrieve_settings($dom,$cnum,$udom,$uname);
                     } else {
-                        $warning = &mt('Invalid username or domain for course requestor');
+                        if ($env{'form.crstype'} eq 'community') {
+                            $warning = &mt('Invalid username or domain for community requestor');
+                        } else {
+                            $warning = &mt('Invalid username or domain for course requestor');
+                        }
                     }
                 } else {
-                    $warning = &mt('No information was found for this course request.');
+                    if ($env{'form.crstype'} eq 'community') {
+                        $warning = &mt('No information was found for this community request.');
+                    } else {
+                        $warning = &mt('No information was found for this course request.');
+                    }
                 }
             } else {
                 $warning = &mt('No course request ID provided.');
             }
         } else {
-            $warning = &mt('You do not have rights to view course request information.');
+            if ($env{'form.crstype'} eq 'any') {
+               $warning = &mt('You do not have rights to view course or community request information.');
+            } elsif ($env{'form.crstype'} eq 'community') {
+                $warning = &mt('You do not have rights to view community request information.');
+            } else {
+                $warning = &mt('You do not have rights to view course request information.');
+            }
         }
     } elsif ((defined($state)) && (defined($action))) {
         if (($action eq 'view') && ($state eq 'details')) {
@@ -287,9 +301,9 @@
                                         \@invalidcrosslist);
             }
         } else {
-            $r->print(&header('Course Requests').$crumb.
+            $r->print(&header('Course/Community Requests').$crumb.
                       '<div class="LC_warning">'.
-                      &mt('You do not have privileges to request creation of courses.').
+                      &mt('You do not have privileges to request creation of courses or communities.').
                       '</div>'.&Apache::loncommon::end_page());
         }
     } elsif ($action eq 'view') {
@@ -302,8 +316,8 @@
     } elsif ($action eq 'display') {
         if ($warning ne '') {
             my $args = { only_body => 1 };
-            $r->print(&header('Course Requests','','',$args).$crumb.
-                      '<h3>'.&mt('Course Request Details').'</h3>'.
+            $r->print(&header('Course/Community Requests','','',$args).$crumb.
+                      '<h3>'.&mt('Course/Community Request Details').'</h3>'.
                       '<div class="LC_warning">'.$warning.'</div>'.
                       &close_popup_form());
         } else {
@@ -387,7 +401,7 @@
                 if ($$state eq $states->{$action}[$i]) {
                     &Apache::lonhtmlcommon::add_breadcrumb(
                        {text=>"$trail->{$$state}"});
-                    $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests');
+                    $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course/Community Requests','Course_Requests');
                     last;
                 } else {
                     if (($$state eq 'process') || ($$state eq 'removal')) {
@@ -407,12 +421,12 @@
         } else {
             &Apache::lonhtmlcommon::add_breadcrumb(
                     {text=>'Pick Action'});
-            $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests');
+            $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course/Community Requests','Course_Requests');
         }
     } else {
         &Apache::lonhtmlcommon::add_breadcrumb(
                 {text=>'Pick Action'});
-        $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests');
+        $crumb = &Apache::lonhtmlcommon::breadcrumbs('Course/Community Requests','Course_Requests');
     }
     return ($page,$crumb,$newinstcode,$codechk,$checkedcode,$description);
 }
@@ -691,8 +705,8 @@
                 $domaintitle = &mt('Course Domain');
             }
         } elsif ($can_request->{'community'}) {
-            $pagetitle = 'Course/Community Requests';
-            $pageinfo = &mt('Request creation of a new course or community, or review your pending requests.');
+            $pagetitle = 'Community Requests';
+            $pageinfo = &mt('Request creation of a new course, or review your pending requests.');
             $domaintitle = &mt('Community Domain');
         } else {
             $pagetitle = 'Course/Community Requests';
@@ -817,7 +831,13 @@
         } elsif ($state eq 'personnel') {
             $js .= "\n".&section_check_javascript()."\n".&personnel_lcsec_js();
         }
-        $r->print(&header('Request a course',$js.$jscript,$loaditems,$jsextra).$crumb);
+        my $title;
+        if ($env{'form.crstype'} eq 'community') {
+            $title = 'Request a community';
+        } else {
+            $title = 'Request a course';
+        }
+        $r->print(&header($title,$js.$jscript,$loaditems,$jsextra).$crumb);
         &print_request_form($r,$action,$state,$page,$states,$dom,$newinstcode,
                             $codechk,$checkedcode,$description,$invalidcrosslist);
     } elsif ($action eq 'view') {
@@ -834,11 +854,26 @@
         } elsif ($state eq 'cancel') {
             $jsextra = &viewcancel_javascript($formname);
         }
-        $r->print(&header('Manage course requests',$js.$jscript.$jsextra,$loaditems).
-                  $crumb);
+        my $title;
+        if ($env{'form.crstype'} eq 'community') {
+            $title = 'Manage community requests';
+        } else {
+            $title = 'Manage course requests';
+        }
+        $r->print(&header($title,$js.$jscript.$jsextra,$loaditems).$crumb);
         my $form = '<form method="post" name="'.$formname.'" action="/adm/requestcourse" />';
         if ($state eq 'pick_request') {
-            $r->print('<h3>'.&mt('Pending course requests').'</h3><div>'."\n".$form."\n".
+            my $title;
+            if ($env{'form.crstype'} eq 'community') {
+                $title = &mt('Pending community requests');
+            } elsif ($env{'form.crstype'} eq 'official') {
+                $title = &mt('Pending requests for official courses');
+            } elsif ($env{'form.crstype'} eq 'unofficial') {
+                $title = &mt('Pending requests for unofficial courses');
+            } else {
+                $title = &mt('Pending course/community requests'); 
+            }
+            $r->print('<h3>'.$title.'</h3><div>'."\n".$form."\n".
                       &print_request_status($dom).'</form></div>');
         } elsif ($state eq 'details') {
             my (@codetitles,%cat_titles,%cat_order,@code_order,$instcode,$code_chk);
@@ -850,7 +885,13 @@
                 &Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles,
                                                          \%cat_order,\@code_order);
             }
-            $r->print('<h3>'.&mt('Course Request Details').'</h3><div>'."\n".$form."\n".
+            my $title;
+            if ($env{'form.crstype'} eq 'community') {
+                $title = &mt('Community Request Details');
+            } else {
+                $title = &mt('Course Request Details');
+            }
+            $r->print('<h3>'.$title.'</h3><div>'."\n".$form."\n".
                       &print_review($dom,\@codetitles,\%cat_titles,\%cat_order,
                                     \@code_order)."\n".
                       '<input name="origcnum" value="'.$origcnum.'" type="hidden" />'."\n");
@@ -867,8 +908,14 @@
                                 $navtxt{'next'},$state,$other,$navtxt{'other'});
             $r->print('</form>');
         } elsif ($state eq 'cancel') {
+            my $title;
+            if ($env{'form.crstype'} eq 'community') {
+                $title = &mt('Cancel community request');
+            } else {
+                $title = &mt('Cancel course request');
+            }
             my ($result,$output) = &print_cancel_request($dom,$env{'form.origcnum'});
-            $r->print('<h3>'.&mt('Cancel course request').'</h3><div>'."\n".$form."\n".
+            $r->print('<h3>'.$title.'</h3><div>'."\n".$form."\n".
                       $output);
             my @excluded = &get_excluded_elements($dom,$states,'view','cancel');
             $r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'</div>');
@@ -917,7 +964,11 @@
                       '<input type="hidden" name="showdom" value="'.$dom.'" />'."\n".
                       '<input type="hidden" name="orignum" value="'.$cnum.'" />'."\n");
             if ($result eq 'ok') {
-                $r->print(&mt('Your course request has been cancelled.'));
+                if ($env{'form.crstype'} eq 'community') {
+                    $r->print(&mt('Your community request has been cancelled.'));
+                } else {
+                    $r->print(&mt('Your course request has been cancelled.'));
+                }
             } else {
                 $r->print('<div class="LC_error">'.
                           &mt('The request cancellation process was not complete.').
@@ -932,8 +983,16 @@
             &Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles,
                                                      \%cat_order,\@code_order);
         }
-        $r->print(&header('Course Request','','','',{ 'only_body' => 1}).
-                  $crumb."\n".'<h3>'.&mt('Course Request Details').'</h3>'.
+        my ($title,$header);
+        if ($env{'form.crstype'} eq 'community') {
+            $title = 'Community Request';
+            $header = &mt('Community Request');
+        } else {
+            $title = 'Course Request';
+            $header = &mt('Course Request');
+        }
+        $r->print(&header($title,'','','',{ 'only_body' => 1}).
+                  $crumb."\n".'<h3>'.$header.'</h3>'.
                   &print_review($dom,\@codetitles,\%cat_titles,\%cat_order,
                                 \@code_order,$uname,$udom)."\n".'</div>'.
                   &close_popup_form());
@@ -1289,10 +1348,18 @@
         }
         &Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles,
                                                  \%cat_order,\@code_order);
-        $r->print('<h3>'.&mt('Review course request details before submission').'</h3>'.
-                  &print_review($dom,\@codetitles,\%cat_titles,\%cat_order,\@code_order,'','',\@disallowed,\%disallowmsg).
+        if ($crstype eq 'community') {
+            $r->print('<h3>'.&mt('Review community request details before submission').'</h3>');
+        } else {
+            $r->print('<h3>'.&mt('Review course request details before submission').'</h3>');
+        }
+        $r->print(&print_review($dom,\@codetitles,\%cat_titles,\%cat_order,\@code_order,'','',\@disallowed,\%disallowmsg).
                   '<input type="hidden" name="cnum" value="'.$cnum.'" />');
-        $navtxt{'next'} = &mt('Submit course request');
+        if ($crstype eq 'community') {
+            $navtxt{'next'} = &mt('Submit community request');
+        } else {
+            $navtxt{'next'} = &mt('Submit course request');
+        }
     }  elsif ($state eq 'process') {
         if ($crstype eq 'official') {
             &Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles,
@@ -1457,7 +1524,7 @@
             }
             if ($crosslist_form) { 
                 $crosslist_form .= 
-                    &Apache::lonhtmlcommon::row_title(&mt('Add another?')).
+                    &Apache::lonhtmlcommon::row_title(&mt('Add another')).
                     '<input name="crosslisttotal" type="hidden" value="'.$crosslisttotal.'" />'.
                     '<input name="addcrosslist" type="checkbox" value="'.$crosslisttotal.'"'.
                     ' onclick="javascript:nextPage(document.'.$formname.",'".$env{'form.state'}.
@@ -1722,13 +1789,17 @@
             &Apache::loncommon::help_open_topic('Course_Request_Rolesection').'&nbsp;'.&mt('LON-CAPA Section(s)').'<br />'.$sectionselector.'</td>'."\n".
             '</tr></table>'.&Apache::lonhtmlcommon::row_closure();
     }
-    $output .= &Apache::lonhtmlcommon::row_title(&mt('Add another?')).
+    $output .= &Apache::lonhtmlcommon::row_title(&mt('Add another')).
                '<input name="persontotal" type="hidden" value="'.$persontotal.'" />'.
                '<input name="addperson" type="checkbox" value="'.$persontotal.'"'.
                ' onclick="javascript:nextPage(document.'.$formname.",'".$env{'form.state'}.
                "'".');" />'.&mt('Add?').&Apache::lonhtmlcommon::row_closure(1).
-               &Apache::lonhtmlcommon::end_pick_box().'</div>'.
-               '<p>'.&mt('You may also add users later, once the course has been created, by using the "Manage course users" link, accessible from the "Main Menu".').'</p>';
+               &Apache::lonhtmlcommon::end_pick_box().'</div>';
+    if ($crstype eq 'community') {
+        $output .= '<p>'.&mt('You may also add users later, once the community has been created, by using the "Manage community users" link, accessible from the "Main Menu".').'</p>';
+    } else {
+        $output .= '<p>'.&mt('You may also add users later, once the course has been created, by using the "Manage course users" link, accessible from the "Main Menu".').'</p>';
+    }
     return $output;
 }
 
@@ -1800,10 +1871,18 @@
               '<input type="hidden" name="showdom" value="" />'."\n".
               '<input type="hidden" name="cnum" value="" />'."\n";
     if (@sortedtimes > 0) {
+        my $desctitle;
+        if ($env{'form.crstype'} eq 'any') {
+            $desctitle = &mt('Course/Community Description')
+        } elsif ($env{'form.crstype'} eq 'community') {
+            $desctitle = &mt('Community Description')
+        } else {
+            $desctitle = &mt('Course Description');
+        }
         $output .= &Apache::loncommon::start_data_table().
                    &Apache::loncommon::start_data_table_header_row().
                    '<th>'.&mt('Action').'</th>'.
-                   '<th>'.&mt('Course Description').'</th>'.
+                   '<th>'.$desctitle.'</th>'.
                    '<th>'.&mt('Domain').'</th>';
         if ($env{'form.crstype'} eq 'any') {
             $output .= '<th>'.&mt('Type').'</th>';
@@ -1851,7 +1930,13 @@
         }
         $output .= &Apache::loncommon::end_data_table();
     } else {
-        $output .= '<div>'.&mt('You have no matching course requests awaiting approval by a Domain Coordinator or held in a queue pending administrative action at your institution.').'</div>';
+        if ($env{'form.crstype'} eq 'any') {
+$output .= '<div>'.&mt('You have no matching course or community requests awaiting approval by a Domain Coordinator or held in a queue pending administrative action at your institution.').'</div>';
+        } elsif ($env{'form.crstype'} eq 'community') {
+            $output .= '<div>'.&mt('You have no matching community requests awaiting approval by a Domain Coordinator or held in a queue pending administrative action at your institution.').'</div>';
+        } else {
+            $output .= '<div>'.&mt('You have no matching course requests awaiting approval by a Domain Coordinator or held in a queue pending administrative action at your institution.').'</div>';
+        }
     }
     $output .= '
 <br /><input type="button" name="prev" value="'.&mt('Back').'" onclick="javascript:backPage(document.'.$formname.",'crstype'".')" />';
@@ -1892,8 +1977,12 @@
                       '<td>'.$showtype.'</td>'.
                       &Apache::loncommon::end_data_table_row().
                       &Apache::loncommon::end_data_table().
-                      '<br /><div class="LC_warning">'.
-                      &mt('Cancelling the request will remove it from the queue of pending course requests').'</div>';
+                      '<br /><div class="LC_warning">';
+            if ($crstype eq 'community') {
+                $output .= &mt('Cancelling the request will remove it from the queue of pending community requests').'</div>';
+            } else {
+                $output .= &mt('Cancelling the request will remove it from the queue of pending course requests').'</div>';
+            }
             $result = 'ok';
         } else {
             $output = '<div class="LC_error">'.&mt('No record exists for the course ID').'</div>';
@@ -2266,8 +2355,10 @@
 
 ENDJS
     my $title = &mt('Brief Course Description');
+    my $clonetitle = &mt('Clone content and settings from an existing course?');
     if ($crstype eq 'community') {
         $title = &mt('Brief Community Description');
+        $clonetitle = &mt('Clone content and settings from an existing community?');
     }
     my $output .= $js_validate."\n".'<div>'.&Apache::lonhtmlcommon::start_pick_box().
                   &Apache::lonhtmlcommon::row_headline().
@@ -2285,7 +2376,7 @@
     $output .= $home_server_pick.
                &Apache::lonhtmlcommon::row_closure().
                &Apache::lonhtmlcommon::row_headline().
-               '<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Clone').'&nbsp;'.&mt('Clone content and settings from an existing course?').'</h3>'. 
+               '<h3>'.&Apache::loncommon::help_open_topic('Course_Request_Clone').'&nbsp;'.$clonetitle.'</h3>'. 
                &Apache::lonhtmlcommon::row_closure(1).
                &clone_form($dom,$formname,$crstype).
                &Apache::lonhtmlcommon::end_pick_box().'</div>'."\n";
@@ -2744,7 +2835,11 @@
         $reqstatus = $disposition;
         my ($modified,$queued);
         if ($disposition eq 'rejected') {
-            $output = &mt('Your course request was rejected.');
+            if ($crstype eq 'community') {
+                $output = &mt('Your community request was rejected.');
+            } else {
+                $output = &mt('Your course request was rejected.');
+            }
             if ($message) {
                 $output .= '<div class="LC_warning">'.$message.'</div>';
             }
@@ -2768,14 +2863,22 @@
                 $reqstatus = 'created';
                 my $role_result = &update_requestors_roles($dom,$cnum,$crstype,$details,
                                                            \%longroles);
-                $output = '<p>'.&mt('Your course request has been processed and the course has been created.').
-                          '<br />'.$role_result.'</p>';
+                if ($crstype eq 'community') {
+                    $output = '<p>'.&mt('Your community request has been processed and the community has been created.');
+                } else {
+                    $output = '<p>'.&mt('Your course request has been processed and the course has been created.');
+                }
+                $output .= '<br />'.$role_result.'</p>';
                 $creationresult = 'created';
             } else {
-                $output = '<span class="LC_error">'.
-                          &mt('An error occurred when processing your course request.').
-                          '<br />'.
-                          &mt('You may want to review the request details and submit the request again.').
+                $output = '<span class="LC_error">';
+                if ($crstype eq 'community') {
+                    $output .= &mt('An error occurred when processing your community request.');
+                } else {
+                    $output .= &mt('An error occurred when processing your course request.');
+                }
+                $output .= '<br />'.
+                           &mt('You may want to review the request details and submit the request again.').
                           '</span>';
                 $creationresult = 'error';
             }
@@ -2808,7 +2911,12 @@
                 my $putresult = &Apache::lonnet::newput_dom('courserequestqueue',$request,
                                                             $dom);
                 if ($putresult eq 'ok') {
-                    $output = &mt('Your course request has been recorded.').'<br />'.
+                    if ($crstype eq 'community') {
+                        $output .= &mt('Your community request has been recorded.');
+                    } else {
+                        $output .= &mt('Your course request has been recorded.') 
+                    }
+                    $output .= '<br />'.
                               &notification_information($disposition,$req_notifylist,
                                                         $cnum,$now);
                 } else {
@@ -2840,8 +2948,12 @@
             &Apache::lonnet::logthis("Error saving course request status for  $requestkey (for $env{'user.name'}:$env{'user.domain'}) - $statusresult");
         }
         if ($modified && $queued && $storeresult eq 'ok') {
-            $output .= '<p>'.&mt('Your course request has been updated').'</p>'.
-                       &notification_information($disposition,$req_notifylist,$cnum,$now);
+            if ($crstype eq 'community') {
+                $output .= '<p>'.&mt('Your community request has been updated').'</p>';
+            } else {
+                $output .= '<p>'.&mt('Your course request has been updated').'</p>';
+            }
+            $output .= &notification_information($disposition,$req_notifylist,$cnum,$now);
         }
         if ($validationerror ne '') {
             $output .= '<span class="LC_warning">'.&mt('An error occurred validating your request with institutional data sources: [_1].',$validationerror).'</p>';
Index: loncom/interface/loncoursequeueadmin.pm
diff -u loncom/interface/loncoursequeueadmin.pm:1.11 loncom/interface/loncoursequeueadmin.pm:1.12
--- loncom/interface/loncoursequeueadmin.pm:1.11	Wed Nov  4 17:42:17 2009
+++ loncom/interface/loncoursequeueadmin.pm	Wed Nov 18 19:15:45 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Utilities to administer domain course requests and course self-enroll requests 
 #
-# $Id: loncoursequeueadmin.pm,v 1.11 2009/11/04 17:42:17 raeburn Exp $
+# $Id: loncoursequeueadmin.pm,v 1.12 2009/11/18 19:15:45 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -67,12 +67,12 @@
 
 sub send_selfserve_notification {
     my ($notifylist,$textstr,$cid,$contextdesc,$timestamp,$context,$sender,
-        $approvedlist,$rejectedlist) = @_;
+        $approvedlist,$rejectedlist,$crstype) = @_;
 # FIXME locallocaltime needs to be able to take $sender_lh as an argument
 #       so this can be localized to the recipients date display format/time zone
     $timestamp =&Apache::lonlocal::locallocaltime($timestamp);
     my $msgcc;
-    my ($rawsubj,@rawmsg,$subject,$message,$reviewer);
+    my ($rawsubj,@rawmsg,$subject,$message,$reviewer,$msgtxt);
     if ($context eq 'coursemanagers') {
         $rawsubj = 'Self-enrollment requests processed';
         push(@rawmsg,{
@@ -80,9 +80,9 @@
                       args => ["\n  $contextdesc"],
                      });
     } elsif ($context eq 'domainmanagers') {
-        $rawsubj = 'Course requests reviewed';
+        $rawsubj = 'Course/Community requests reviewed';
         push(@rawmsg,{
-                      mt  => 'Course creation requests in the following domain: [_1] have been reviewed.',
+                      mt  => 'Course/Community creation requests in the following domain: [_1] have been reviewed.',
                       args => ["\n  $contextdesc"],
                      });
         if (ref($textstr) eq 'ARRAY') {
@@ -90,8 +90,13 @@
         }
     } elsif ($context eq 'enroller') {
         $rawsubj = 'Enrollment request';
+        if ($crstype eq 'community') {
+            $msgtxt = 'Your request for enrollment in the following community: [_1]requested on [_2]has been reviewed by a Coordinator.'
+        } else {
+            $msgtxt = 'Your request for enrollment in the following course: [_1]requested on [_2]has been reviewed by a Course Coordinator.';
+        } 
         push(@rawmsg,{
-                      mt  => 'Your request for enrollment in the following course: [_1]requested on [_2]has been reviewed by a Course Coordinator.',
+                      mt  => $msgtxt,
                       args => ["\n  ".$contextdesc.",\n",$timestamp.",\n"],
 
                      });
@@ -99,9 +104,15 @@
             push(@rawmsg,@{$textstr});
         }
     } elsif ($context eq 'courserequestor') {
-        $rawsubj = 'Course request';
+        if ($crstype eq 'Community') {
+            $rawsubj = 'Community request';
+            $msgtxt = 'Your request for creation of the following community: [_1]requested on [_2]has been reviewed by a Domain Coordinator.';
+        } else {
+            $rawsubj = 'Course request';
+            $msgtxt = 'Your request for creation of the following course: [_1]requested on [_2]has been reviewed by a Domain Coordinator.';
+        }
         push(@rawmsg,{
-                      mt  => 'Your request for creation of the following course: [_1]requested on [_2]has been reviewed by a Domain Coordinator.',
+                      mt  => $msgtxt,
                       args => ["\n".$contextdesc.",\n",$timestamp.",\n"],
 
                      });
@@ -109,35 +120,44 @@
             push(@rawmsg,@{$textstr});
         }
     } elsif ($context eq 'coursereq') {
-        $rawsubj = 'Course request to review', 
+        if ($crstype eq 'community') {
+            $rawsubj = 'Community request to review';
+            $msgtxt = 'Creation of the following community: [_1]was requested by [_2] on [_3].';
+        } else {
+            $rawsubj = 'Course request to review';
+            $msgtxt = 'Creation of the following course: [_1]was requested by [_2] on [_3].';
+        }
         push(@rawmsg,{
-                      mt  => 'Creation of the following course: [_1]was requested by [_2] on [_3].',
+                      mt  => $msgtxt,
                       args => ["\n  $contextdesc\n",$textstr,$timestamp],
                      },
                      {
-                      mt =>'[_1]As Domain Coordinator, use: [_2]Main Menu -> Create a new course -> Approve or reject course requests[_3]to display a list of pending requests, which you can either approve or reject.',
+                      mt =>'[_1]As Domain Coordinator, use: [_2]Main Menu -> Course and community creation -> Approve or reject requests[_3]to display a list of pending requests, which you can either approve or reject.',
                       args => ["\n","\n\n  ","\n\n"],
                      });
     } elsif ($context eq 'selfenrollreq') {
         $rawsubj = 'Self-enrollment request';
+        if ($crstype eq 'community') {
+            $msgtxt = 'Enrollment in the following community: [_1] was requested by [_2] on [_3].'
+        } else {
+            $msgtxt = 'Enrollment in the following course: [_1] was requested by [_2] on [_3].'
+        }
         push(@rawmsg,{
-                      mt  => 'Enrollment in the following course: [_1] was requested by [_2] on [_3].',
+                      mt  => $msgtxt,
                       args => ["\n  $contextdesc\n",$textstr,$timestamp."\n"],
                      });
-        if ($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Community') {
-            push(@rawmsg,
-                     {
-                      mt =>'As Coordinator, use: [_1]Main Menu -> Manage Course Users -> Enrollment Requests[_2]to display a list of pending enrollment requests, which you can either approve or reject.',
-                      args => ["  \n\n","\n"],
-                     });
+        my $directions;  
+        if ($crstype eq 'community') {
+            $directions = 'As Coordinator, use: [_1]Main Menu -> Manage Community Users -> Enrollment Requests[_2]to display a list of pending enrollment requests, which you can either approve or reject.';
         } else {
-            push(@rawmsg,
+            $directions = 'As Course Coordinator, use: [_1]Main Menu -> Manage Course Users -> Enrollment Requests[_2]to display a list of pending enrollment requests, which you can either approve or reject.';
+        }
+        push(@rawmsg,
                      {
-                      mt =>'As Course Coordinator, use: [_1]Main Menu -> Manage Course Users -> Enrollment Requests[_2]to display a list of pending enrollment requests, which you can either approve or reject.',
+                      mt   => $directions,
                       args => ["  \n\n","\n"],
                      });
 
-        }
     }
     my @to_notify = split(/,/,$notifylist);
     my $numsent = 0;
@@ -235,12 +255,12 @@
         if ($context eq 'course') {
             $output .= '<th>'.&mt('Section').'</th>'.
                        '<th>'.&mt('Date requested').'</th>';
+        } else {
             %crstypes = &Apache::lonlocal::texthash (
                             official   => 'Official course',
                             unofficial => 'Unofficial course',
                             community  => 'Community',
                         );
-        } else {
             $output .= '<th>'.&mt('Type').'</th>'.
                        '<th>'.&mt('Date requested').'</th>'.
                        '<th>'.&mt('Details').'</th>';
@@ -332,7 +352,7 @@
         if ($context eq 'course') {
             $output .= &mt('There are currently no enrollment requests.');
         } else {
-            $output .= &mt('There are currently no course requests awaiting approval.');
+            $output .= &mt('There are currently no course or community requests awaiting approval.');
         }
     }
     return $output;
@@ -346,7 +366,7 @@
         @existing,@missingreq,@invalidusers,@limitexceeded,@completed,
         @processing_errors,@warn_approves,@warn_rejects,@approvals,
         @rejections,@rejectionerrors,@nopermissions,%courseroles,
-        %communityroles,%domdefs);
+        %communityroles,%domdefs,%approvalmsg,%rejectionmsg,$crstype);
     @approvals = &Apache::loncommon::get_env_multiple('form.approvereq');
     @rejections = &Apache::loncommon::get_env_multiple('form.rejectreq');
     $now = time;
@@ -355,6 +375,7 @@
         $namespace = 'selfenrollrequests';
         $beneficiary = 'enroller';
         $cid = $env{'request.course.id'};
+        $crstype = lc(&Apache::loncommon::course_type());
         my $chome = &Apache::lonnet::homeserver($cnum,$cdom);
         $hostname = &Apache::lonnet::hostname($chome);
         $protocol = $Apache::lonnet::protocol{$chome};
@@ -391,16 +412,33 @@
                 $notifylist = $domconfig{'requestcourses'}{'notify'}{'approval'};
             }
         }
-        $approvedmsg = [{
+        $approvalmsg{'course'} = 
+                        [{
                             mt => 'Your course request has been approved.',
                         },
                         {
                             mt   => 'Visit [_1], to log-in and access the course',
                             args => [$protocol.'://'.$hostname],
                         }];
-        $rejectedmsg =  [{
+        $rejectionmsg{'course'} =
+                        [{
                             mt => 'Your course request has not been approved.',
                         }];
+
+        $approvalmsg{'community'} = 
+                        [{
+                            mt => 'Your community request has been approved.',
+                        },
+                        {
+                            mt   => 'Visit [_1], to log-in and access the community',
+                            args => [$protocol.'://'.$hostname],
+                        }];
+
+        $rejectionmsg{'community'} = 
+                        [{
+                            mt => 'Your community request has not been approved.',
+                        }];
+
         %domdefs = &Apache::lonnet::get_domain_defaults($cdom);
         my @roles = &Apache::lonuserutils::roles_by_context('course');
         foreach my $role (@roles) {
@@ -450,7 +488,7 @@
                         $stucounts->{'allstudents'} ++;
                         $stucounts->{'selfenrolled'} ++;
                         &send_selfserve_notification($uname.':'.$udom,$approvedmsg,
-                                       $cid,$coursedesc,$now,$beneficiary,$sender);
+                                       $cid,$coursedesc,$now,$beneficiary,$sender,undef,undef,$crstype);
                         my %userrequest = (
                             $cdom.'_'.$cnum => {
                                 timestamp   => $now,
@@ -477,7 +515,7 @@
                 if (&Apache::lonnet::homeserver($cnum,$cdom) eq 'no_host') {
                     my $ownername = $requesthash{$cnum.'_approval'}{'ownername'};
                     my $ownerdom = $requesthash{$cnum.'_approval'}{'ownerdom'};
-                    my $crstype = $requesthash{$cnum.'_approval'}{'crstype'};
+                    $crstype = $requesthash{$cnum.'_approval'}{'crstype'};
                     my $coursedesc = $requesthash{$cnum.'_approval'}{'description'};
                     my $longroles = \%courseroles;
                     if ($crstype eq 'community') {
@@ -510,9 +548,14 @@
                                                       \$newusermsg,\$addresult,\$enrollcount,
                                                       \$response,\$keysmsg,\%domdefs,$longroles);
                             if ($result eq 'created') {
+                                if ($crstype eq 'community') {
+                                    $approvedmsg = $approvalmsg{'community'};
+                                } else {
+                                    $approvedmsg = $approvalmsg{'course'};
+                                }
                                 push(@completed,$cnum);
                                 &send_selfserve_notification($ownername.':'.$ownerdom,$approvedmsg,
-                                              $cid,$coursedesc,$now,$beneficiary,$sender);
+                                              $cid,$coursedesc,$now,$beneficiary,$sender,undef,undef,$crstype);
                                 my %reqhash = (
                                                 reqtime     => $history{'reqtime'},
                                                 crstype     => $history{'crstype'},
@@ -565,7 +608,7 @@
             if ($context eq 'course') {
                 my $user = $item;
                 &send_selfserve_notification($user,$rejectedmsg,$cid,$coursedesc,
-                                             $now,$beneficiary,$sender);
+                                             $now,$beneficiary,$sender,undef,undef,$crstype);
                 my ($uname,$udom) = split(/:/,$user);
                 my %userrequest = (
                     $cdom.'_'.$cnum => {
@@ -587,9 +630,15 @@
                         my $ownername = $requesthash{$cnum.'_approval'}{'ownername'};
                         my $ownerdom = $requesthash{$cnum.'_approval'}{'ownerdom'};
                         my $coursedesc = $requesthash{$cnum.'_approval'}{'description'};
+                        $crstype = $requesthash{$cnum.'_approval'}{'crstype'};
+                        if ($crstype eq 'community') {
+                            $rejectedmsg = $rejectionmsg{'community'};
+                        } else {
+                            $rejectedmsg = $rejectionmsg{'course'};
+                        }
                         &send_selfserve_notification($ownername.':'.$ownerdom,$rejectedmsg,
                                                      $cid,$coursedesc,$now,$beneficiary,
-                                                     $sender);
+                                                     $sender,undef,undef,$crstype);
                         my %history =
                             &Apache::lonnet::restore($requestkey,'courserequests',
                                                      $ownerdom,$ownername);
@@ -646,7 +695,11 @@
                 $chgmsg = "'Action was taken on the following enrollment requests by [_1].',$namelink";
                 if (@completed) {
                     $approvedlist = join("\n",@completed);
-                    $output .= '<p>'.&mt('The following were enrolled in the course:').'<ul>';
+                    if ($crstype eq 'community') {
+                        $output .= '<p>'.&mt('The following were enrolled in the community:').'<ul>';
+                    } else {
+                        $output .= '<p>'.&mt('The following were enrolled in the course:').'<ul>';
+                    }
                     foreach my $user (@completed) {
                         my ($uname,$udom) = split(/:/,$user);
                         my $userlink =
@@ -666,13 +719,13 @@
                 if ($notifylist ne '') {
                     &send_selfserve_notification($notifylist,$chgmsg,$cid,$coursedesc,
                                                  $now,'coursemanagers',$sender,
-                                                 $approvedlist,$rejectedlist);
+                                                 $approvedlist,$rejectedlist,$crstype);
                 }
             } else {
-                $chgmsg = "'Action was taken on the following course requests by [_1].',$namelink";
+                $chgmsg = "'Action was taken on the following course and community requests by [_1].',$namelink";
                 if (@completed) {
                     $approvedlist = join("\n",@completed);
-                    $output .= '<p>'.&mt('The following courses were created:').'<ul>';
+                    $output .= '<p>'.&mt('The following courses/communities were created:').'<ul>';
                     foreach my $cnum (@completed) {
                         my $showcourse;
                         if (ref($requesthash{$cnum.'_approval'})) {
@@ -703,7 +756,7 @@
                 if ($notifylist ne '') {
                     &send_selfserve_notification($notifylist,$chgmsg,$cid,$domdesc,
                                                  $now,'domainmanagers',$sender,
-                                                 $approvedlist,$rejectedlist);
+                                                 $approvedlist,$rejectedlist,$crstype);
                 }
             }
         }
@@ -716,7 +769,7 @@
             }
             $output .= '</ul></p>';
         } else {
-            $output .= '<p>'.&mt('The following course creation requests were deleted because the course has already been created:').'<ul>';
+            $output .= '<p>'.&mt('The following course/community creation requests were deleted because the course or community has already been created:').'<ul>';
             foreach my $cnum (@existing) {
                 my $showcourse;
                 my %coursehash = &Apache::lonnet::coursedescription($cdom.'/'.$cnum);
@@ -738,7 +791,7 @@
             }
             $output .= '</ul></p>';
         } else {
-            $output .= '<p>'.&mt('The following course creation requests were ignored because the request is no longer in the course request queue:').'<ul>';
+            $output .= '<p>'.&mt('The following course/community creation requests were ignored because the request is no longer in the queue:').'<ul>';
             foreach my $cnum (@missingreq) {
                 $output .= '<li>'.$cnum.'</li>';
             }
@@ -765,7 +818,7 @@
         }
     }
     if (@nopermissions) {
-        $output .= '<p>'.&mt('The following course creation requests could not be processed because the course owner does hot have rights to create this type of course:').'<ul>';
+        $output .= '<p>'.&mt('The following course/community creation requests could not be processed because the owner does not have rights to create this type of course:').'<ul>';
         foreach my $cnum (@nopermissions) {
             my $showcourse;
             if (ref($requesthash{$cnum.'_approval'})) {
@@ -785,7 +838,7 @@
             }
             $output .= '</ul></p>';
         } else {
-            $output .= '<p>'.&mt('The following course creation requests could not be processed because an error occurred:').'<ul>';
+            $output .= '<p>'.&mt('The following course/community creation requests could not be processed because an error occurred:').'<ul>';
             foreach my $cnum (@processing_errors) {
                 my $showcourse;
                 if (ref($requesthash{$cnum.'_approval'})) {
@@ -799,7 +852,7 @@
         }
     }
     if (@rejectionerrors) {
-        $output .= '<p>'.&mt('The following course creation request rejections could not be fully processed because an error occurred:').'<ul>';
+        $output .= '<p>'.&mt('The following course/community creation request rejections could not be fully processed because an error occurred:').'<ul>';
         foreach my $cnum (@rejectionerrors) {
             my $showcourse;
             if (ref($requesthash{$cnum.'_approval'})) {
@@ -819,7 +872,7 @@
             }
             $output .= '</ul></p>';
         } else {
-            $output .= '<p>'.&mt("For the following course requests an error occurred when updating the requestor's own course requests record:").'<ul>';
+            $output .= '<p>'.&mt("For the following course/community requests an error occurred when updating the requestor's own requests record:").'<ul>';
             foreach my $cnum (@warn_approves,@warn_rejects) {
                 my $showcourse;
                 if (ref($requesthash{$cnum.'_approval'})) {
@@ -869,10 +922,6 @@
         $ownername = $env{'user.name'};
         $ownerdom  = $env{'user.domain'};
     }
-    my $type = 'Course';
-    if ($crstype eq 'community') {
-        $type = 'Community';
-    }
     my $owneremail;
     my %emails = &Apache::loncommon::getemails($ownername,$ownerdom);
     foreach my $email ('permanentemail','critnotification','notification') {
@@ -957,7 +1006,7 @@
     my ($uname,$udom,$clonecrs,$clonedom,$crstype) = @_;
     my $canclone;
     my $ccrole = 'cc';
-    if ($crstype eq 'Community') {
+    if ($crstype eq 'community') {
         $ccrole = 'co';
     }
     my %roleshash = &Apache::lonnet::get_my_roles($uname,$udom,'userroles',['active'],

--raeburn1258571745--