--- loncom/interface/groupsort.pm 2010/05/03 13:53:47 1.66 +++ loncom/interface/groupsort.pm 2010/08/24 09:11:37 1.67 @@ -2,7 +2,7 @@ # The LON-CAPA group sort handler # Allows for sorting prior to import into RAT. # -# $Id: groupsort.pm,v 1.66 2010/05/03 13:53:47 bisitz Exp $ +# $Id: groupsort.pm,v 1.67 2010/08/24 09:11:37 wenzelju Exp $ # # Copyright Michigan State University Board of Trustees # @@ -181,31 +181,13 @@ sub readfromfile { } } -# --------------------------------------------------------- Read from bookmarks - -sub readfrombookmarks { - my ($r,$resources)=@_; - my %bookmarks=&Apache::lonnet::dump('bookmarks'); -# the bookmark "hash" is just one entry -# it's a javascript program code with arguments like ('title','url'); - my @bookmarks=($bookmarks{'bookmarks'}=~/\((?:\'([^\']+)\'\,\'([^\']+)\'|\"([^\"]+)\"\,\"([^\"]+)\")\)\;/g); - for (my $index=0;$index<($#bookmarks+1)/2;$index++) { - if ($bookmarks[$index*2+1]) { - my $url = $bookmarks[$index*2+1]; - my $name = $bookmarks[$index*2]; - $name =~ s/^LON\-CAPA\s+//; - - push(@{$resources},{'url' => $url, 'title' => $name}); - } - } -} # ---------------------------------------------------------------- Main Handler sub handler { my $r = shift; &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, - ['acts','mode','readfile','recover','bookmarks']); + ['acts','mode','readfile','recover']); &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; @@ -215,7 +197,7 @@ sub handler { my $finishimport=''; my $begincondition=''; my $endcondition=''; - if (($env{'form.readfile'}) || ($env{'form.bookmarks'})) { + if (($env{'form.readfile'})) { $begincondition='if (eval("document.forms.groupsort.include"+num+".checked")) {'; $endcondition='}'; } @@ -299,8 +281,6 @@ END if ($env{'form.readfile'}) { &readfromfile($r,\@resources); - } elsif ($env{'form.bookmarks'}) { - &readfrombookmarks($r,\@resources); } else { &readfromdb($r,\@resources); } @@ -313,10 +293,7 @@ END } else { $title = 'Sort Imported Resources'; } - if ($env{'form.bookmarks'}) { - $title = 'Import Resources from Bookmarks'; - } - if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) { + if (($clen > 1) || ($env{'form.readfile'})) { my %lt=&Apache::lonlocal::texthash( 'fin'=> 'Finalize order of resources', 'ci' => 'Continue Import', @@ -342,7 +319,6 @@ END - END @@ -350,10 +326,7 @@ END # --- my $buttontext = $lt{'re'}; - if ($env{'form.bookmarks'}) { - $buttontext = $lt{'ip'} - } - if ($env{'form.recover'} || $env{'form.bookmarks'}) { + if ($env{'form.recover'}) { $r->print(<  @@ -382,7 +355,7 @@ END if ($clen > 0) { $r->print(&Apache::loncommon::start_data_table() .&Apache::loncommon::start_data_table_header_row()); - if (($env{'form.readfile'}) || ($env{'form.bookmarks'})) { + if (($env{'form.readfile'})) { $r->print("$lt{'in'}\n"); } else { $r->print(''.$lt{'co'}.''."\n"); @@ -397,9 +370,6 @@ END } 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 { @@ -420,10 +390,10 @@ END foreach my $resource (@resources) { $ctr++; my $iconname=&Apache::loncommon::icon($resource->{'url'}); - if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) { + if (($clen > 1) || ($env{'form.readfile'})) { $r->print(&Apache::loncommon::start_data_table_row() .""); - if (($env{'form.readfile'}) || ($env{'form.bookmarks'})) { + if (($env{'form.readfile'})) { $r->print(&checkbox($ctr-1)); } else { $r->print(&movers($clen,$ctr)); @@ -431,9 +401,9 @@ END } $r->print(&hidden($ctr-1,$resource->{'title'},$resource->{'url'}, $resource->{'id'})); - if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) { + if (($clen > 1) || ($env{'form.readfile'})) { $r->print(""); - unless (($env{'form.readfile'}) || ($env{'form.bookmarks'})) { + unless (($env{'form.readfile'})) { $r->print("". &select_box($clen,$ctr). ""); @@ -447,7 +417,7 @@ END ."\n"); } } - if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) { + if (($clen > 1) || ($env{'form.readfile'})) { if ($clen > 0) { $r->print(&Apache::loncommon::end_data_table()); }