--- loncom/interface/groupsort.pm 2009/03/13 11:45:27 1.64 +++ loncom/interface/groupsort.pm 2010/05/03 13:53:47 1.66 @@ -2,7 +2,7 @@ # The LON-CAPA group sort handler # Allows for sorting prior to import into RAT. # -# $Id: groupsort.pm,v 1.64 2009/03/13 11:45:27 bisitz Exp $ +# $Id: groupsort.pm,v 1.66 2010/05/03 13:53:47 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -307,6 +307,15 @@ END my $ctr = 0; my $clen = scalar(@resources); + my $title = ''; + if ($env{'form.recover'}) { + $title = 'Recover Removed Resources'; + } else { + $title = 'Sort Imported Resources'; + } + if ($env{'form.bookmarks'}) { + $title = 'Import Resources from Bookmarks'; + } if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) { my %lt=&Apache::lonlocal::texthash( 'fin'=> 'Finalize order of resources', @@ -321,17 +330,9 @@ END 'pa' => 'Path', 'in' => 'Include' ); - my $title = ''; - if ($env{'form.recover'}) { - $title = 'Recover Removed Resources'; - } else { - $title = 'Sort Imported Resources'; - } - if ($env{'form.bookmarks'}) { - $title = 'Import Resources from Bookmarks'; - } $r->print(&Apache::loncommon::start_page($title, $js)); + $r->print('

'.&mt($title).'

'); $r->print(<print(&Apache::loncommon::inhibit_menu_check('input')); # --- - - if ($env{'form.recover'}) { + + my $buttontext = $lt{'re'}; + if ($env{'form.bookmarks'}) { + $buttontext = $lt{'ip'} + } + if ($env{'form.recover'} || $env{'form.bookmarks'}) { $r->print(<  END @@ -372,20 +377,35 @@ END
END } - $r->print(&Apache::loncommon::start_data_table() - .&Apache::loncommon::start_data_table_header_row()); - if (($env{'form.readfile'}) || ($env{'form.bookmarks'})) { - $r->print("$lt{'in'}\n"); - } else { - $r->print(''.$lt{'co'}.''."\n"); - } - $r->print(''.$lt{'ti'}.''."\n"); - $r->print("$lt{'pa'}"); - $r->print(&Apache::loncommon::end_data_table_header_row() - ."\n"); + + # Only display header if content exists + if ($clen > 0) { + $r->print(&Apache::loncommon::start_data_table() + .&Apache::loncommon::start_data_table_header_row()); + if (($env{'form.readfile'}) || ($env{'form.bookmarks'})) { + $r->print("$lt{'in'}\n"); + } else { + $r->print(''.$lt{'co'}.''."\n"); + } + $r->print(''.$lt{'ti'}.''."\n"); + $r->print("$lt{'pa'}"); + $r->print(&Apache::loncommon::end_data_table_header_row()."\n"); + } else { + my $errtxt = ''; + if ($env{'form.recover'}) { + $errtxt = 'There are no resources to recover.'; + } else { + $errtxt = 'There are no resources to import.'; + } + if ($env{'form.bookmarks'}) { + $errtxt = 'There are no resources in your bookmarks to import.'; + } + $r->print('

'.&mt($errtxt).'

'); + } } else { $r->print(&Apache::loncommon::start_page(undef,$js, {'only_body' => 1})); +# $r->print('

'.&mt($title).'

'); $r->print(< @@ -428,8 +448,10 @@ END } } if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) { - $r->print(&Apache::loncommon::end_data_table() - .""); + if ($clen > 0) { + $r->print(&Apache::loncommon::end_data_table()); + } + $r->print(''); } else { $r->print(<