--- loncom/interface/lonblockingmenu.pm	2013/01/04 05:45:50	1.9
+++ loncom/interface/lonblockingmenu.pm	2013/11/12 14:36:07	1.10
@@ -2,7 +2,7 @@
 # Routines for configuring blocking of access to collaborative functions, 
 # and specific resources during an exam
 #
-# $Id: lonblockingmenu.pm,v 1.9 2013/01/04 05:45:50 raeburn Exp $
+# $Id: lonblockingmenu.pm,v 1.10 2013/11/12 14:36:07 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -135,27 +135,6 @@ Outputs: 2
       $output - Information about changes made.
 
 
-=item &enumerate_course_contents()
-
-Create hashes of maps (for folders/pages) and symbs (for resources) in
-a course, where keys are numbers (starting with 1) and values are
-map url, or symb, for an iteration through the course, as seen by
-a Course Coordinator. Used to generate numerical IDs to facilitate
-storage of lists of maps or resources to be blocked during an exam.   
-
-Inputs: 3
-      $navmap - navmaps object
-
-      $map_url - reference to hash to contain URLs of maps in course
-
-      $resource_symb - reference to hash to contain symbs for
-                       resources in course
-
-Outputs: None
-
-Side Effects: $map_url and $resource_symb hashrefs are populated.
-
-
 =item &get_dates_from_form()
 
 Extract start and end dates from web form input for blocks with
@@ -388,6 +367,7 @@ use Apache::Constants qw(:common :http);
 use Apache::loncommon();
 use Apache::lonhtmlcommon();
 use Apache::lonparmset();
+use Apache::loncourserespicker();
 use HTML::Entities();
 use Apache::lonlocal;
 use lib '/home/httpd/lib/perl/';
@@ -664,7 +644,7 @@ sub blockstore {
     my $changestotal = 0;
     my $addtimer = 0;
     my %blocking = ();
-    my (%map_url,%resource_symb,$output);
+    my (%map_url,%resource_symb,%titles,$output);
     $output = '<h3>'.$lt{'head'}.'</h3>';
     if ($env{'form.blockaction'} eq 'modify') {
         foreach my $envkey (keys(%env)) {
@@ -690,7 +670,7 @@ sub blockstore {
         $output = $lt{'unna'}.' '.$lt{'ncwm'}.'</br>';
         return ($changestotal,$output);
     }
-    &enumerate_course_contents($navmap,\%map_url,\%resource_symb);
+    &Apache::loncourserespicker::enumerate_course_contents($navmap,\%map_url,\%resource_symb,\%titles,'examblock');
     foreach my $key (keys(%removals)) {
         my $hashkey = $env{'form.key_'.$key};
         &Apache::lonnet::del('comm_block',["$hashkey"],
@@ -800,34 +780,6 @@ sub blockstore {
     return ($changestotal,$output);
 }
 
-sub enumerate_course_contents {
-    my ($navmap,$map_url,$resource_symb) = @_;
-    if ((ref($navmap)) && (ref($map_url) eq 'HASH') && 
-        (ref($resource_symb) eq 'HASH')) {
-        my $it = $navmap->getIterator(undef,undef,undef,1,undef,undef);
-        my $count = 0;
-        while (my $curRes = $it->next()) {
-            if (ref($curRes)) {
-                $count ++;
-                my $symb = $curRes->symb();
-                my $ressymb = $symb;
-                if ($ressymb =~ m|adm/($match_domain)/($match_username)/(\d+)/bulletinboard$|) {
-                    unless ($ressymb =~ m|adm/wrapper/adm|) {
-                        $ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.
-                                   '/bulletinboard';
-                    }
-                }
-                if (($curRes->is_sequence()) || ($curRes->is_page())) {
-                    $map_url->{$count} = (&Apache::lonnet::decode_symb($symb))[2];
-                } else {
-                    $resource_symb->{$count} = $ressymb;
-                }
-            }
-        }
-    }
-    return;
-}
-
 sub get_dates_from_form {
     my $item = shift;
     my $startdate = &Apache::lonhtmlcommon::get_date_from_form('startdate_'.$item);
@@ -916,8 +868,8 @@ sub check_release_required {
 sub display_blocker_status {
     my ($r,$records,$ltext,$intervals,$navmap,$errormsg,$blockcount) = @_;
     my $parmcount = 0;
-    my (%map_url,%resource_symb,%lookups);
-    &enumerate_course_contents($navmap,\%map_url,\%resource_symb);
+    my (%map_url,%resource_symb,%titles,%lookups);
+    &Apache::loncourserespicker::enumerate_course_contents($navmap,\%map_url,\%resource_symb,\%titles,'examblock');
     %{$lookups{'maps'}} = reverse(%map_url);
     %{$lookups{'resources'}} = reverse(%resource_symb);
     my %lt = &Apache::lonlocal::texthash(