[LON-CAPA-cvs] cvs: loncom /homework grades.pm /interface lonhtmlcommon.pm

www www@source.lon-capa.org
Mon, 12 Apr 2010 01:22:49 -0000


www		Mon Apr 12 01:22:49 2010 EDT

  Modified files:              
    /loncom/homework	grades.pm 
    /loncom/interface	lonhtmlcommon.pm 
  Log:
  Saving my work ...
  
  
Index: loncom/homework/grades.pm
diff -u loncom/homework/grades.pm:1.608 loncom/homework/grades.pm:1.609
--- loncom/homework/grades.pm:1.608	Sun Apr 11 22:53:23 2010
+++ loncom/homework/grades.pm	Mon Apr 12 01:22:44 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # The LON-CAPA Grading handler
 #
-# $Id: grades.pm,v 1.608 2010/04/11 22:53:23 www Exp $
+# $Id: grades.pm,v 1.609 2010/04/12 01:22:44 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -9194,28 +9194,16 @@
            &mt('It is recommended that you [_1]re-initialize the course[_2] and then return to this grading page.','<a href="/adm/roles?selectrole=1&newrole='.$env{'request.role'}.'">','</a>').
            '</div>';
 }
-sub startpage{
-    my ($r,$crumbs,$symb,$onlyfolderflag) = @_;
 
-    unshift(@$crumbs,  {href=>"/adm/grades?command=gradingmenu&symb=".&HTML::Entities::encode($symb,'<>&"'),text=>"Grading"});
+sub startpage {
+    my ($r,$symb,$crumbs,$onlyfolderflag) = @_;
+    my $breadcrumbs= [{href=>"/adm/grades?command=gradingmenu&symb=".&HTML::Entities::encode($symb,'<>&"'),text=>"Grading"}];
+#    if ($crumbs) {
+#       push(@$breadcrumbs,$crumbs);
+#    }
     $r->print(&Apache::loncommon::start_page('Grading',undef,
-                                          {'bread_crumbs' => $crumbs}));
-    if ($env{'form.symb'}) {
-       my $symb=$env{'form.symb'};
-       my $title=&Apache::lonnet::gettitle($symb);
-       $r->print(&Apache::loncommon::start_data_table());
-       unless ($onlyfolderflag) {
-          $r->print(&Apache::loncommon::start_data_table_row().
-                    '<th>'.&mt('Resource:').'</th><td>'.$title.'</td>'.
-                    &Apache::loncommon::end_data_table_row());
-       }
-       my ($map,$id,$resource)=&Apache::lonnet::decode_symb($symb);
-       my $folder=&Apache::lonnet::gettitle($map);
-       $r->print(&Apache::loncommon::start_data_table_row().
-                    '<th>'.&mt('Folder:').'</th><td>'.$folder.'</td>'.
-                    &Apache::loncommon::end_data_table_row().
-                    &Apache::loncommon::end_data_table());
-    }
+                                          {'bread_crumbs' => $breadcrumbs}));
+    $r->print(&Apache::lonhtmlcommon::resource_info_box($symb,$onlyfolderflag));
 }
 
 sub handler {
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.269 loncom/interface/lonhtmlcommon.pm:1.270
--- loncom/interface/lonhtmlcommon.pm:1.269	Mon Mar 15 05:37:47 2010
+++ loncom/interface/lonhtmlcommon.pm	Mon Apr 12 01:22:49 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common html routines
 #
-# $Id: lonhtmlcommon.pm,v 1.269 2010/03/15 05:37:47 raeburn Exp $
+# $Id: lonhtmlcommon.pm,v 1.270 2010/04/12 01:22:49 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1767,7 +1767,6 @@
 
 } # End: row_count block for pick_box
 
-
 sub role_select_row {
     my ($roles,$title,$css_class,$show_separate_custom,$cdom,$cnum) = @_;
     my $crstype = 'Course';
@@ -1990,6 +1989,30 @@
 }
 
 
+sub resource_info_box {
+   my ($symb,$onlyfolderflag)=@_;
+   my $return='';
+   if ($symb) {
+       my $title=&Apache::lonnet::gettitle($symb);
+       $return=&Apache::loncommon::start_data_table();
+       unless ($onlyfolderflag) {
+          $return.=&Apache::loncommon::start_data_table_row().
+                    '<th>'.&mt('Resource:').'</th><td>'.$title.'</td>'.
+                    &Apache::loncommon::end_data_table_row();
+       }
+       my ($map,$id,$resource)=&Apache::lonnet::decode_symb($symb);
+       my $folder=&Apache::lonnet::gettitle($map);
+       $return.=&Apache::loncommon::start_data_table_row().
+                    '<th>'.&mt('Folder:').'</th><td>'.$folder.'</td>'.
+                    &Apache::loncommon::end_data_table_row().
+                    &Apache::loncommon::end_data_table();
+    } else {
+       $return='<p><span class="LC_error">'.&mt('No context provided.').'</span></p>';
+    }
+    return $return;
+
+}
+
 ##############################################
 ##############################################