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

bisitz bisitz at source.lon-capa.org
Wed Jan 15 13:49:19 EST 2014


bisitz		Wed Jan 15 18:49:19 2014 EDT

  Modified files:              
    /loncom/interface	coursecatalog.pm 
  Log:
  - Improved and consistent navigation and layout by using actionbox
  - Error style for error message
  - Simplified code for "no match" message
  
  
Index: loncom/interface/coursecatalog.pm
diff -u loncom/interface/coursecatalog.pm:1.77 loncom/interface/coursecatalog.pm:1.78
--- loncom/interface/coursecatalog.pm:1.77	Mon Dec 30 01:33:21 2013
+++ loncom/interface/coursecatalog.pm	Wed Jan 15 18:49:19 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler for displaying the course catalog interface
 #
-# $Id: coursecatalog.pm,v 1.77 2013/12/30 01:33:21 raeburn Exp $
+# $Id: coursecatalog.pm,v 1.78 2014/01/15 18:49:19 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -236,26 +236,25 @@
              ({href=>"javascript:document.$formname.submit()",
               text=>$brtextone},
              {text=>$brtexttwo});
-    $r->print(&Apache::lonhtmlcommon::breadcrumbs('Course/Community Catalog'));
-    $r->print('<br />');
-    if ($env{'form.currcat_0'} eq 'communities::0') {
-        $r->print(&mt('Detailed community information:'));
-    } else {
-        $r->print(&mt('Detailed course information:'));
-    }
-    $r->print('<br /><br />'.
-              &print_course_listing($codedom,undef,$trails,$allitems,undef,$codetitles).
-              '<br /><br />');
-    $r->print('<form name="'.$formname.'" method="post" action="/adm/coursecatalog">'.
-              '<a href = "javascript:document.coursecatalog.submit()">');
-    if ($env{'form.currcat_0'} eq 'communities::0') {
-        $r->print(&mt('Back to community listing'));
-    } else {
-        $r->print(&mt('Back to course listing'));
-    }
-    $r->print('</a>'.
-              &Apache::lonhtmlcommon::echo_form_input(['coursenum','catalogfilter',
-                                                       'showdetails','courseid']).'</form>');
+    $r->print(
+        &Apache::lonhtmlcommon::breadcrumbs('Course/Community Catalog').
+        '<h2>'.
+        (($env{'form.currcat_0'} eq 'communities::0') ?
+            &mt('Detailed community information:') :
+            &mt('Detailed course information:')).
+        '</h2>'.
+        &print_course_listing($codedom,undef,$trails,$allitems,undef,$codetitles).
+        '<br />'.
+        '<form name="'.$formname.'" method="post" action="/adm/coursecatalog">'.
+        &Apache::lonhtmlcommon::actionbox([
+            '<a href = "javascript:document.coursecatalog.submit()">'.
+            (($env{'form.currcat_0'} eq 'communities::0') ?
+                &mt('Back to community listing') : &mt('Back to course listing')).
+            '</a>'
+        ]).
+        &Apache::lonhtmlcommon::echo_form_input(['coursenum','catalogfilter',
+                                                 'showdetails','courseid']).
+        '</form>');
     return;
 }
 
@@ -822,11 +821,13 @@
                                                  $env{'form.coursenum'},
                                                  undef,undef,'.',1);
         if (keys(%courses) == 0) {
+            $output = '<p class="LC_error">';
             if ($env{'form.currcat_0'} eq 'communities::0') {
                 $output .= &mt('The courseID provided does not match a community in this domain.');
             } else { 
                 $output .= &mt('The courseID provided does not match a course in this domain.');
             }
+            $output .= '</p>';
             return $output;
         }
     } else {
@@ -836,17 +837,13 @@
             %courses = &search_courselist($domain,$subcats);
         }
         if (keys(%courses) == 0) {
+            $output = '<p class="LC_info">';
             if ($env{'form.currcat_0'} eq 'communities::0') {
-                $output =
-                    '<p class="LC_info">'
-                   .&mt('No communities match the criteria you selected.')
-                   .'</p>';
+                $output .= &mt('No communities match the criteria you selected.');
             } else {
-                $output =
-                    '<p class="LC_info">'
-                   .&mt('No courses match the criteria you selected.')
-                   .'</p>';
+                $output .= &mt('No courses match the criteria you selected.');
             }
+            $output .= '</p>';
             return $output;
         }
         if (($knownuser) && (!$env{'form.showdetails'}) && (!&user_is_dc($domain))) {




More information about the LON-CAPA-cvs mailing list