[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface groupsort.pm

raeburn raeburn at source.lon-capa.org
Sun Jun 3 22:17:35 EDT 2012


raeburn		Mon Jun  4 02:17:35 2012 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	groupsort.pm 
  Log:
  - For 2.11.
  - Reverse changes in 1.68.6.1. Bookmarks replaced by Stored Links.
  
  
Index: loncom/interface/groupsort.pm
diff -u loncom/interface/groupsort.pm:1.68.6.1 loncom/interface/groupsort.pm:1.68.6.2
--- loncom/interface/groupsort.pm:1.68.6.1	Wed May  2 19:10:13 2012
+++ loncom/interface/groupsort.pm	Mon Jun  4 02:17:35 2012
@@ -2,7 +2,7 @@
 # The LON-CAPA group sort handler
 # Allows for sorting prior to import into RAT.
 #
-# $Id: groupsort.pm,v 1.68.6.1 2012/05/02 19:10:13 raeburn Exp $
+# $Id: groupsort.pm,v 1.68.6.2 2012/06/04 02:17:35 raeburn Exp $
 # 
 # Copyright Michigan State University Board of Trustees
 #
@@ -181,31 +181,13 @@
     }
 }
 
-# --------------------------------------------------------- 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 @@
     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 @@
 
     if ($env{'form.readfile'}) {
 	&readfromfile($r,\@resources);
-    } elsif ($env{'form.bookmarks'}) {
-        &readfrombookmarks($r,\@resources);
     } else {
 	&readfromdb($r,\@resources);
     }
@@ -313,10 +293,7 @@
     } 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 @@
 <input type="hidden" name="newval" value="" />
 <input type="hidden" name="mode" value="$env{'form.mode'}" />
 <input type="hidden" name="readfile" value="$env{'form.readfile'}" />
-<input type="hidden" name="bookmarks" value="$env{'form.bookmarks'}" />
 <input type="hidden" name="recover" value="$env{'form.recover'}" />
 END
 
@@ -350,10 +326,7 @@
         # ---
 
         my $buttontext = $lt{'re'};
-        if ($env{'form.bookmarks'}) {
-            $buttontext = $lt{'ip'}
-        }
-        if ($env{'form.recover'} || $env{'form.bookmarks'}) {
+        if ($env{'form.recover'}) {
 	    $r->print(<<END);
 <input type="button" name="alter" value="$buttontext"
  onClick="finish_import()" /> 
@@ -397,9 +370,6 @@
             } else {
                 $errtxt = 'There are no resources to import.';
             }
-            if ($env{'form.bookmarks'}) {
-                $errtxt = 'There are no resources in your bookmarks to import.';
-            }
             $r->print('<p class="LC_info">'.&mt($errtxt).'</p>');
         }
     } else {
@@ -420,10 +390,10 @@
     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()
                      ."<td>");
-            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 @@
 	}
 	$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("</td>");
-            unless (($env{'form.readfile'}) || ($env{'form.bookmarks'})) {
+            unless (($env{'form.readfile'})) {
 		$r->print("<td>".
 			  &select_box($clen,$ctr).
 			  "</td>");
@@ -447,7 +417,7 @@
                      ."\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());
         }




More information about the LON-CAPA-cvs mailing list