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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Fri, 04 Jul 2008 15:40:06 -0000


raeburn		Fri Jul  4 11:40:06 2008 EDT

  Modified files:              
    /loncom/interface	coursecatalog.pm 
  Log:
  - xhtml
  - &mt()
  - Show access dates for self-enrollers on "details" page if different from general defaults for student access.  
  
  
Index: loncom/interface/coursecatalog.pm
diff -u loncom/interface/coursecatalog.pm:1.33 loncom/interface/coursecatalog.pm:1.34
--- loncom/interface/coursecatalog.pm:1.33	Mon Jun 30 00:07:06 2008
+++ loncom/interface/coursecatalog.pm	Fri Jul  4 11:40:04 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler for displaying the course catalog interface
 #
-# $Id: coursecatalog.pm,v 1.33 2008/06/30 04:07:06 raeburn Exp $
+# $Id: coursecatalog.pm,v 1.34 2008/07/04 15:40:04 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -341,13 +341,12 @@
           text=>"Select courses"});
         $r->print(&Apache::lonhtmlcommon::breadcrumbs('Select courses'));
     }
-    $r->print('<table border="0"><tr>'.
-              '<form name="coursecatdom" method="post" action="/adm/coursecatalog">'.
-              '<td><b>'.&mt('Domain:').'</b></td><td>'.
+    $r->print('<form name="coursecatdom" method="post" action="/adm/coursecatalog">'.
+              '<table border="0"><tr><td><b>'.&mt('Domain:').'</b></td><td>'.
               &Apache::loncommon::select_dom_form($codedom,'showdom','',1).
-	      '&nbsp;<input type="submit" name="godom" value="'.&mt('Change').'"></td></form></tr>'.
-	      '<tr><form name="coursecats" method="post" action="/adm/coursecatalog">'.
-              $catlinks.'</form></tr></table>');
+	      '&nbsp;<input type="submit" name="godom" value="'.&mt('Change').'" /></td></tr></table></form>'.
+	      '<form name="coursecats" method="post" action="/adm/coursecatalog">'.
+              '<table border="0"><tr>'.$catlinks.'</tr></table></form>');
     return;
 }
 
@@ -383,7 +382,7 @@
         if (ref($cats[0]) eq 'ARRAY') {
             if ((@{$cats[0]} == 1) && ($cats[0][0] eq 'instcode')) {
                 $catlinks .= &mt('Official courses (with institutional codes)').
-                             '<input type="hidden" name="currcat_0" value="instcode::0">';
+                             '<input type="hidden" name="currcat_0" value="instcode::0" />';
                 $env{'form.currcat_0'} = 'instcode::0';
             } else {
                 $catlinks .= '<select name="currcat_0">'."\n";
@@ -414,7 +413,7 @@
             }
         } else {
             $catlinks .= &mt('Official courses (with institutional codes)').
-                         '<input type="hidden" name="currcat_0" value="instcode::0">';
+                         '<input type="hidden" name="currcat_0" value="instcode::0" />';
             $env{'form.currcat_0'} = 'instcode::0';
         }
     } else {
@@ -860,7 +859,7 @@
             if ( defined($coursehash{'default_enrollment_end_date'}) ) {
                 $endaccess = &Apache::lonlocal::locallocaltime($coursehash{'default_enrollment_end_date'});
                 if ($coursehash{'default_enrollment_end_date'} == 0) {
-                    $endaccess = "No ending date";
+                    $endaccess = &mt('No ending date');
                 }
             }
             if ($startaccess) {
@@ -869,6 +868,33 @@
             if ($endaccess) {
                 $accessdates .= &mt('<i>To:</i> ').$endaccess.'<br />';
             }
+            if (($selfenroll_types ne '') && 
+                ($selfenroll_end > 0 && $selfenroll_end > $now)) {
+                my ($selfenroll_start_access,$selfenroll_end_access);
+                if (($coursehash{'default_enrollment_start_date'} ne 
+                     $coursehash{'internal.selfenroll_start_access'}) ||
+                   ($coursehash{'default_enrollment_end_date'} ne 
+                    $coursehash{'internal.selfenroll_end_access'})) {
+                    if ( defined($coursehash{'internal.selfenroll_start_access'}) ) {
+                        $selfenroll_start_access = &Apache::lonlocal::locallocaltime($coursehash{'internal.selfenroll_start_access'});
+                    }
+                    if ( defined($coursehash{'default_enrollment_end_date'}) ) {
+                        $selfenroll_end_access = &Apache::lonlocal::locallocaltime($coursehash{'internal.selfenroll_end_access'});
+                        if ($coursehash{'internal.selfenroll_end_access'} == 0) {
+                            $selfenroll_end_access = &mt('No ending date');
+                        }
+                    }
+                    if ($selfenroll_start_access || $selfenroll_end_access) {
+                        $accessdates .= '<br/><br /><i>'.&mt('Self-enrollers:').'</i><br />';
+                        if ($selfenroll_start_access) {
+                            $accessdates .= &mt('<i>From:</i> ').$selfenroll_start_access.'<br />';
+                        }
+                        if ($selfenroll_end_access) {
+                            $accessdates .= &mt('<i>To:</i> ').$selfenroll_end_access.'<br />';
+                        }
+                    }
+                }
+            }
             $courseinfo{$course}{'access'} = $accessdates;
         }
         if ($xlist_items eq '') {