[LON-CAPA-cvs] cvs: doc /loncapafiles loncapafiles.lpml loncom/auth lonroles.pm loncom/html/res/adm/pages edit-redo-22x22.png edit-undo-22x22.png list-add-22x22.png rcrs-22x22.png role_hotlist-22x22.png selfenrl-queue-22x22.png start-here-22x22.png loncom/interface loncoursequeueadmin.pm lonpreferences.pm

raeburn raeburn at source.lon-capa.org
Thu Aug 16 13:03:06 EDT 2012


raeburn		Thu Aug 16 17:03:06 2012 EDT

  Added files:                 
    /loncom/html/res/adm/pages	edit-redo-22x22.png edit-undo-22x22.png 
                              	list-add-22x22.png rcrs-22x22.png 
                              	role_hotlist-22x22.png 
                              	selfenrl-queue-22x22.png 
                              	start-here-22x22.png 

  Modified files:              
    /loncom/auth	lonroles.pm 
    /loncom/interface	lonpreferences.pm loncoursequeueadmin.pm 
    /doc/loncapafiles	loncapafiles.lpml 
  Log:
  - Functions List for Roles page
    - access to tools appropriate for current user:
      (show/hide expired roles, check for role changes, request course/community,
       request authoring space, show queued requests (course/author/self-enroll),
       hot list config).
    - lonpreferences.pm 
      - returnurl = /adm/roles when using rolespref modifies behavior
      - clean up display (simplification of wording).
    - lonroles.pm
      - Individual buttons for display, changes, author space moved to functions.
      - new routine -- &roles_from_env() -gets hash of roles -used by &gather_roles().   
  
  
-------------- next part --------------
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.273 loncom/auth/lonroles.pm:1.274
--- loncom/auth/lonroles.pm:1.273	Wed Aug 15 16:56:52 2012
+++ loncom/auth/lonroles.pm	Thu Aug 16 17:02:46 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.273 2012/08/15 16:56:52 raeburn Exp $
+# $Id: lonroles.pm,v 1.274 2012/08/16 17:02:46 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -211,9 +211,17 @@
         $update = $then;
     }
 
+    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
+
+# -------------------------------------------------- Check if setting hot list 
+    my $hotlist;
+    if ($env{'form.action'} eq 'verify_and_change_rolespref') {
+        $hotlist = &Apache::lonpreferences::verify_and_change_rolespref($r);
+    }
+
 # -------------------------------------------------------- Check for new roles
     my $updateresult;
-    if ($env{'form.doupdate'}) {
+    if ($env{'form.state'} eq 'doupdate') {
         my $show_course=&Apache::loncommon::show_course();
         my $checkingtxt;
         if ($show_course) {
@@ -221,7 +229,7 @@
         } else {
             $checkingtxt = &mt('Checking for new roles ...');
         }
-        $updateresult = '<span class="LC_info">'.$checkingtxt.'</span>';
+        $updateresult = $checkingtxt;
         $updateresult .= &update_session_roles();
         &Apache::lonnet::appenv({'user.update.time'  => $now});
         $update = $now;
@@ -230,14 +238,13 @@
 
 # -------------------------------------------------- Check for author requests
     my $reqauthor;
-    if ($env{'form.requestauthor'}) {
+    if ($env{'form.state'} eq 'requestauthor') {
        $reqauthor = &Apache::loncoursequeueadmin::process_reqauthor(\$update);
     }
 
     my $envkey;
     my %dcroles = ();
     my $numdc = &check_fordc(\%dcroles,$update,$then);
-    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
     my $loncaparev = $Apache::lonnet::perlvar{'lonVersion'};
 
 # ================================================================== Roles Init
@@ -654,15 +661,20 @@
         $recent = &mt('Recent Courses');
     }
     my $brcrum =[{href=>"/adm/roles",text=>$crumbtext}];
+
+    my %roles_in_env;
+    my $showcount = &roles_from_env(\%roles_in_env,$update); 
+
     my $swinfo=&Apache::lonmenu::rawconfig();
     my $start_page=&Apache::loncommon::start_page($pagetitle,undef,{bread_crumbs=>$brcrum});
+    my $funcs = &get_roles_functions($showcount);
     my $standby=&mt('Role selected. Please stand by.');
     $standby=~s/\n/\\n/g;
-    my $noscript='<span class="LC_error">'.&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.').'<br />'.&mt('As this is not the case, most functionality in the system will be unavailable.').'</span><br />';
+    my $noscript='<br /><span class="LC_error">'.&mt('Use of LON-CAPA requires Javascript to be enabled in your web browser.').'<br />'.&mt('As this is not the case, most functionality in the system will be unavailable.').'</span><br />';
 
     $r->print(<<ENDHEADER);
 $start_page
-<br />
+$funcs
 <noscript>
 $noscript
 </noscript>
@@ -685,16 +697,17 @@
     }
 }
 
-function setToUpdate(thisform) {
-    thisform.doupdate.value='1';
-    thisform.selectrole.value='';
-    thisform.submit();
-}
-
-function setToRequestAuthor(thisform) {
-    thisform.requestauthor.value='1';
-    thisform.selectrole.value='';
-    thisform.submit(); 
+function rolesView (caller) {
+    if ((caller == 'showall') || (caller == 'noshowall')) {
+        document.rolechoice.display.value = caller;
+    } else {
+        if ((caller == 'doupdate') || (caller == 'requestauthor') ||
+            (caller == 'queued')) { 
+            document.rolechoice.state.value = caller;
+        }
+    }
+    document.rolechoice.selectrole.value='';
+    document.rolechoice.submit();
 }
 
 // ]]>
@@ -763,115 +776,43 @@
 		  &Apache::loncommon::end_page());
 	return OK;
     } else {
-        if ($updateresult || $reqauthor) {
-            $r->print('<div>'.
-                      $updateresult.
-                      $reqauthor.
-                      '</div>');
+        if ($updateresult || $reqauthor || $hotlist) {
+            my $showresult = '<div>';
+            if ($updateresult) {
+                $showresult .= &Apache::lonhtmlcommon::confirm_success($updateresult);
+            }
+            if ($reqauthor) {
+                $showresult .= &Apache::lonhtmlcommon::confirm_success($reqauthor);
+            }
+            if ($hotlist) {
+                $showresult .= $hotlist;
+            } 
+            $showresult .= '</div>';
+            $r->print($showresult);
+        } elsif ($env{'form.state'} eq 'queued') {
+            $r->print(&get_queued());
         }
         if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) {
     	    $fn.='?'.$ENV{'REDIRECT_QUERY_STRING'};
         }
+        my $display = ($env{'form.display'} =~ /^(showall)$/);
         $r->print('<form method="post" name="rolechoice" action="'.(($fn)?$fn:$r->uri).'">');
         $r->print('<input type="hidden" name="orgurl" value="'.$fn.'" />');
         $r->print('<input type="hidden" name="selectrole" value="1" />');
         $r->print('<input type="hidden" name="newrole" value="" />');
+        $r->print('<input type="hidden" name="display" value="'.$display.'" />');
+        $r->print('<input type="hidden" name="state" value="" />');
     }
     $r->rflush();
 
     my (%roletext,%sortrole,%roleclass,%futureroles,%timezones);
     my ($countactive,$countfuture,$inrole,$possiblerole) = 
-        &gather_roles($update,$refresh,$now,$reinit,$nochoose,\%roletext,\%sortrole,\%roleclass,
-                      \%futureroles,\%timezones,$loncaparev);
+        &gather_roles($update,$refresh,$now,$reinit,$nochoose,\%roles_in_env,\%roletext,
+                      \%sortrole,\%roleclass,\%futureroles,\%timezones,$loncaparev);
     $refresh = $now;
     &Apache::lonnet::appenv({'user.refresh.time'  => $refresh});
-    my $updatebutton = &mt('Check for role changes');
-    my $show_course=&Apache::loncommon::show_course();
-    if ($show_course) {
-        $updatebutton = &mt('Check for new courses');
-    }
-    my $do_update;
-    unless (($env{'form.source'} eq 'login') || ($env{'form.doupdate'})) {
-        $do_update = '<input type="hidden" name="doupdate" value="" />'.
-                     '<input type="button" name="update" value="'.
-                     $updatebutton.'" onclick="javascript:setToUpdate(this.form)" />';
-    }
-    my ($requestauthor,$requestcrs);
-    unless ($reqauthor) {
-        if ($env{'environment.canrequest.author'}) {
-            unless (&Apache::loncoursequeueadmin::is_active_author()) {
-                my ($status,$timestamp) = split(/:/,$env{'environment.requestauthorqueued'});
-                if ($status eq 'approval') {
-                    $requestauthor = &mt('A request for authoring space submitted on [_1] is awaiting approval',&Apache::lonlocal::locallocaltime($timestamp)); 
-                } elsif (($status eq 'approved') && ($do_update)) {
-                    my %roleshash = &Apache::lonnet::get_my_roles($env{'user.name'},$env{'user.domain'},'userroles',
-                                                                  ['active'],['au'],[$env{'user.domain'}]);
-                    if (keys(%roleshash)) {
-                        $requestauthor = &mt('Your request for an author role has been approved.').'<br />';
-                        if ($show_course) {
-                            $requestauthor .= &mt('Use the "Check for new courses" button to update your list of roles.');
-                        } else {
-                            $requestauthor .= &mt('Use the "Check for new roles" button to update your list of roles.'); 
-                        }
-                        $requestauthor = '<span class="LC_info">'.$requestauthor.'</span>';
-                    }
-                }
-                unless ($requestauthor) {
-                    $requestauthor = 
-                        '<input type="hidden" name="requestauthor" value="" />'.
-                        '<input type="button" name="reqauthor" value="'.
-                        &mt('Request author space').'" '. 
-                        'onclick="javascript:setToRequestAuthor(this.form)" />';
-                }
-            }
-        }
-    }
-    my $do_update;
-    unless (($env{'form.source'} eq 'login') || ($env{'form.doupdate'})) {
-        $do_update = '<input type="hidden" name="doupdate" value="" />'.
-                     '<input type="button" name="update" value="'.
-                     $updatebutton.'" onclick="javascript:setToUpdate(this.form)" />';
-    }
-    if ($env{'user.adv'}) {
-        my $showall = '<label><input type="checkbox" name="showall"';
-        if ($env{'form.showall'}) { 
-            $showall .= ' checked="checked" ';
-        }
-        $showall .= ' />'.&mt('Show all roles').'</label> '.
-                    '<input type="submit" value="'.&mt('Update display').'" />';
-        if ($do_update || $requestauthor) {
-            $r->print('<div class="LC_left_float"><fieldset>'.
-                      '<legend>'. &mt('Display').'</legend>'.
-                      $showall.'</fieldset></div>');
-            if ($do_update) {
-                $r->print('<div class="LC_left_float">'.
-                          '<fieldset><legend>'.&mt('Changes?').'</legend>'.
-                          $do_update.'</fieldset></div>');
-            }
-            if ($requestauthor) {
-                $r->print('<div class="LC_left_float">'.
-                          '<fieldset><legend>'.&mt('Add author role').'</legend>'.
-                          $requestauthor.'</fieldset>');
-            }
-            $r->print('</div><br clear="all" />');
-        } else {
-            $r->print($showall);
-        }
-    } else {
-        if ($do_update && $requestauthor) {
-            $r->print('<div class="LC_left_float">'.
-                      '<fieldset><legend>'.&mt('Changes?').'</legend>'.
-                      $do_update.'</fieldset></div>'.
-                      '<div class="LC_left_float">'.
-                      '<fieldset><legend>'.&mt('Add author role').'</legend>'.
-                      $requestauthor.'</fieldset></div><br clear="all" />');
-        } elsif ($do_update) {
-            $r->print('<p>'.$do_update.'</p>');
-        } elsif ($requestauthor) {
-            $r->print('<p>'.$requestauthor.'</p>');
-        }
+    unless ($env{'user.adv'}) { 
         if ($countactive > 0) {
-            $r->print(&Apache::loncoursequeueadmin::queued_selfenrollment());
             my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description');
             my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); 
             $r->print(
@@ -1049,19 +990,38 @@
     return OK;
 }
 
+sub roles_from_env {
+    my ($roleshash,$update) = @_;
+    my $count = 0;
+    if (ref($roleshash) eq 'HASH') {
+        foreach my $envkey (keys(%env)) {
+            if ($envkey =~ m{^user\.role\.(\w+)[./]}) {
+                next if ($1 eq 'gr');
+                $roleshash->{$envkey} = $env{$envkey};
+                my ($start,$end) = split(/\./,$env{$envkey});
+                unless ($end && $end<$update) {
+                    $count ++;
+                }
+            }
+        }
+    }
+    return $count;
+}
+
 sub gather_roles {
-    my ($update,$refresh,$now,$reinit,$nochoose,$roletext,$sortrole,$roleclass,$futureroles,$timezones,$loncaparev) = @_;
+    my ($update,$refresh,$now,$reinit,$nochoose,$roles_in_env,$roletext,$sortrole,$roleclass,$futureroles,
+        $timezones,$loncaparev) = @_;
     my ($countactive,$countfuture,$inrole,$possiblerole) = (0,0,0,'');
     my $advanced = $env{'user.adv'};
     my $tryagain = $env{'form.tryagain'};
     my @ids = &Apache::lonnet::current_machine_ids();
-    foreach my $envkey (sort(keys(%env))) {
-        my $button = 1;
-        my $switchserver='';
-        my $switchwarning;
-        my ($role_text,$role_text_end,$sortkey);
-        if ($envkey=~/^user\.role\./) {
-            my ($role,$where,$trolecode,$tstart,$tend,$tremark,$tstatus,$tpstart,$tpend);
+    if (ref($roles_in_env) eq 'HASH') {
+        foreach my $envkey (sort(keys(%{$roles_in_env}))) {
+            my $button = 1;
+            my $switchserver='';
+            my $switchwarning;
+            my ($role_text,$role_text_end,$sortkey,$role,$where,$trolecode,$tstart,
+                $tend,$tremark,$tstatus,$tpstart,$tpend);
             &Apache::lonnet::role_status($envkey,$update,$refresh,$now,\$role,\$where,
                                          \$trolecode,\$tstatus,\$tstart,\$tend);
             next if (!defined($role) || $role eq '' || $role =~ /^gr/);
@@ -1075,7 +1035,7 @@
             if (($tstatus eq 'is')
                 || ($tstatus eq 'selected')
                 || ($tstatus eq 'future')
-                || ($env{'form.showall'})) {
+                || ($env{'form.display'} eq 'showall')) {
                 my $timezone = &role_timezone($where,$timezones);
                 if ($tstart) {
                     $tpstart=&Apache::lonlocal::locallocaltime($tstart,$timezone);
@@ -2208,7 +2168,7 @@
     }
     if (($oldsec) && (@newsec > 0)) {
         if (@newsec > 1) {
-            $msg = '<div class="LC_warning">'.&mt('The section has changed for your current role. Log-out and log-in again to select a role for the new section.').'</div>';
+            $msg = '<p class="LC_warning">'.&mt('The section has changed for your current role. Log-out and log-in again to select a role for the new section.').'</p>';
         } else {
             my $newrole = $env{'request.role'};
             if ($newsec[0] eq 'none') {
@@ -2246,13 +2206,13 @@
             $msg .= '</form></p>';
         }
     } elsif ($currrole_expired) {
-        $msg .= '<div class="LC_warning">';
+        $msg .= '<p class="LC_warning">';
         if (&Apache::loncommon::show_course()) {
             $msg .= &mt('Your role in the current course has expired.');
         } else {
             $msg .= &mt('Your current role has expired.');
         }
-        $msg .= '<br />'.&mt('However you can continue to use this role until you logout, click the "Re-Select" button, or your session has been idle for more than 24 hours.').'</div>';
+        $msg .= '<br />'.&mt('However you can continue to use this role until you logout, click the "Re-Select" button, or your session has been idle for more than 24 hours.').'</p>';
     }
     if (!@changed_roles || !(keys(%changed_groups))) {
         my ($rolesmsg,$groupsmsg);
@@ -2534,6 +2494,131 @@
     return $is_active;
 }
 
+sub get_roles_functions {
+    my ($rolescount) = @_;
+    my @links;
+    if ($env{'user.adv'}) {
+        if ($env{'form.display'} eq 'showall') {
+            push(@links,["javascript:rolesView('noshowall');",'edit-redo-22x22',&mt('Exclude expired roles')]);
+        } else {
+            push(@links,["javascript:rolesView('showall');",'edit-undo-22x22',&mt('Include expired roles')]);
+        }
+    }
+    push(@links,["javascript:rolesView('doupdate');",'start-here-22x22',&mt('Check for changes')]);
+    if ($env{'environment.canrequest.author'}) {
+        unless (&Apache::loncoursequeueadmin::is_active_author()) {
+            push(@links,["javascript:rolesView('requestauthor');",'list-add-22x22',&mt('Request author role')]);
+        }
+    }
+    if (&Apache::lonmenu::check_for_rcrs()) {
+        push(@links,['/adm/requestcourse','rcrs-22x22',&mt('Request course')]);
+    }
+    if ($env{'form.state'} eq 'queued') {
+        push(@links,["javascript:rolesView('noqueued');",'selfenrl-queue-22x22',&mt('Hide queued')]);
+    } else {
+        push(@links,["javascript:rolesView('queued');",'selfenrl-queue-22x22',&mt('Show queued')]);
+    }
+    if (($rolescount > 3) || ($env{'environment.recentroles'})) {
+        push(@links,['/adm/preferences?action=changerolespref&returnurl=/adm/roles','role_hotlist-22x22',&mt('Hotlist')]);
+    }
+    
+    my $funcs = &Apache::lonhtmlcommon::start_funclist();
+    foreach my $link (@links) {
+        $funcs .= &Apache::lonhtmlcommon::add_item_funclist(
+                      '<a href="'.$link->[0].'" class="LC_menubuttons_link">'.
+                      '<img src="/res/adm/pages/'.$link->[1].'.png" class="LC_icon" alt="'.$link->[2].'" />'.
+                      $link->[2].'</a>');
+    }
+    $funcs .= &Apache::lonhtmlcommon::end_funclist();
+    return &Apache::loncommon::head_subbox($funcs);
+}
+
+sub get_queued {
+    my ($output,%reqcrs);
+    my ($types,$typenames) = &Apache::loncommon::course_types();
+    my %statusinfo = &Apache::lonnet::dump('courserequests',$env{'user.domain'},
+                                           $env{'user.name'},'^status:');
+    foreach my $key (keys(%statusinfo)) {
+        next unless (($statusinfo{$key} eq 'approval') || ($statusinfo{$key} eq 'pending'));
+        (undef,my($cdom,$cnum)) = split(':',$key);
+        my $requestkey = $cdom.'_'.$cnum;
+        if ($requestkey =~ /^($match_domain)_($match_courseid)$/) {
+            my %history = &Apache::lonnet::restore($requestkey,'courserequests',
+                                                   $env{'user.domain'},$env{'user.name'});
+            next if ((exists($history{'status'})) && ($history{'status'} eq 'created'));
+            my $reqtime = $history{'reqtime'};
+            my $lastupdate = $history{'timestamp'};
+            my $showtype = $history{'crstype'};
+            if (defined($typenames->{$history{'crstype'}})) {
+                $showtype = $typenames->{$history{'crstype'}};
+            }
+            my $description;
+            if (ref($history{'details'}) eq 'HASH') {
+                $description = $history{details}{'cdescr'};
+            }
+            @{$reqcrs{$reqtime}} = ($description,$showtype); 
+        }
+    }
+    my @sortedtimes = sort {$a <=> $b} (keys(%reqcrs));
+    if (@sortedtimes > 0) {
+        $output .= '<p><b>'.&mt('Course/Community requests').'</b><br />'.
+                   &Apache::loncommon::start_data_table().
+                   &Apache::loncommon::start_data_table_header_row().
+                   '<th>'.&mt('Date requested').'</th>'.
+                   '<th>'.&mt('Course title').'</th>'.
+                   '<th>'.&mt('Course type').'</th>';
+                   &Apache::loncommon::end_data_table_header_row();
+        foreach my $reqtime (@sortedtimes) {
+            next unless (ref($reqcrs{$reqtime}) eq 'ARRAY');
+            $output .= &Apache::loncommon::start_data_table_row().
+                       '<td>'.&Apache::lonlocal::locallocaltime($reqtime).'</td>'.
+                       '<td>'.join('</td><td>',@{$reqcrs{$reqtime}}).'</td>'.
+                       &Apache::loncommon::end_data_table_row();
+        }
+        $output .= &Apache::loncommon::end_data_table().
+                   '<br /></p>';
+    }
+    my $queuedselfenroll = &Apache::loncoursequeueadmin::queued_selfenrollment(1);
+    if ($queuedselfenroll) {
+        $output .= '<p><b>'.&mt('Enrollment requests').'</b><br />'.
+                   $queuedselfenroll.'<br /></p>';
+    }
+    if ($env{'environment.canrequest.author'}) {
+        unless (&Apache::loncoursequeueadmin::is_active_author()) {
+            my $requestauthor;
+            my ($status,$timestamp) = split(/:/,$env{'environment.requestauthorqueued'});
+            if (($status eq 'approval') || ($status eq 'approved')) {
+                $output .= '<p><b>'.&mt('Author role request').'</b><br />';
+                if ($status eq 'approval') {
+                    $output .= &mt('A request for authoring space submitted on [_1] is awaiting approval',
+                                  &Apache::lonlocal::locallocaltime($timestamp));
+                } elsif ($status eq 'approved') {
+                    my %roleshash =
+                        &Apache::lonnet::get_my_roles($env{'user.name'},$env{'user.domain'},'userroles',
+                                                      ['active'],['au'],[$env{'user.domain'}]);
+                    if (keys(%roleshash)) {
+                        $output .= '<span class="LC_info">'.
+                                   &mt('Your request for an author role has been approved.').'<br />'.
+                                   &mt('Use the "Check for changes" link to update your list of roles.').
+                                   '</span>';
+                    }
+                }
+                $output .= '</p>';
+            }
+        }
+    }
+    unless ($output) {
+        if ($env{'environment.canrequest.author'} || $env{'environment.canrequest.official'} ||
+            $env{'environment.canrequest.unofficial'} || $env{'environment.canrequest.community'}) {
+            $output = &mt('No requests for courses, communities or authoring currently queued');
+        } else {
+            $output = &mt('No enrollment requests currently queued awaiting approval');
+        }
+    }
+    return '<div class="LC_left_float"><fieldset><legend>'.&mt('Queued requests').'</legend>'.
+           $output.'</fieldset></div><br clear="all" />';
+}
+
 1;
 __END__
 
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.197 loncom/interface/lonpreferences.pm:1.198
--- loncom/interface/lonpreferences.pm:1.197	Tue May 15 01:41:27 2012
+++ loncom/interface/lonpreferences.pm	Thu Aug 16 17:02:55 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.197 2012/05/15 01:41:27 raeburn Exp $
+# $Id: lonpreferences.pm,v 1.198 2012/08/16 17:02:55 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -354,16 +354,25 @@
     my $domain     = $env{'user.domain'};
     my %userenv = &Apache::lonnet::get
         ('environment',['recentroles','recentrolesn']);
+    my $brtext = 'Change '.$role.' Page Pref';
+    my $brtitle;
+    if ($env{'form.returnurl'} eq '/adm/roles') {
+        $brtext = 'Configure Hotlist';
+    } else {
+        $brtitle = $brtext;
+    }
     Apache::lonhtmlcommon::add_breadcrumb(
 	    {	href => '/adm/preferences?action=changerolespref',
-                text => 'Change '.$role.' Page Pref'});
+                text => $brtext});
     $r->print(Apache::loncommon::start_page('Content Display Settings'));
-    $r->print(Apache::lonhtmlcommon::breadcrumbs('Change '.$role.' Page Pref'));
+    $r->print(Apache::lonhtmlcommon::breadcrumbs($brtitle));
     my $hotlist_flag=$userenv{'recentroles'};
     my $hotlist_n=$userenv{'recentrolesn'};
-    my $checked;
+    my ($checkedon,$checkedoff);
     if ($hotlist_flag) {
-	$checked = 'checked="checked"';
+	$checkedon = 'checked="checked"';
+    } else {
+        $checkedoff = 'checked="checked"';
     }
     
     if (!$hotlist_n) { $hotlist_n=3; }
@@ -390,7 +399,7 @@
 	    &Apache::loncommon::start_data_table().
 	    &Apache::loncommon::start_data_table_header_row().
 	    "<th>".&mt('Freeze '.$role)."</th>".
-	    "<th>".&mt($role)."</td>".
+	    "<th>".&mt($role)."</th>".
 	    &Apache::loncommon::end_data_table_header_row().
 	    "\n";
 	my $count;
@@ -413,28 +422,51 @@
         $roles_check_list .= "</table>\n";
     }
 
+    my $actionurl = '/adm/preferences';
+    if ($env{'form.returnurl'} eq '/adm/roles') {
+        $actionurl = '/adm/roles';
+    }
+    $r->print('<h3>'.&mt('Recent Roles Hotlist').'</h3>');
+    unless ($checkedon) {
+        $r->print(&mt('LON-CAPA users with several '.$lc_role.'s may wish to enable the Hotlist.').'<br />');
+    }
     $r->print('
-<p>'.&mt('Some LON-CAPA users have a long list of '.$lc_role.'s. The Recent '.$role.'s Hotlist feature keeps track of the last N '.$lc_role.'s which have been visited and places a table of these at the top of the '.$lc_role.'s page. People with very few '.$lc_role.'s should leave this feature disabled.').'
-</p>
-<form name="prefs" action="/adm/preferences" method="post">
+<form name="prefs" action="'.$actionurl.'" method="post">
 <input type="hidden" name="action" value="verify_and_change_rolespref" />
-<br />'.
-'<h2>'.&mt('Recent '.$role.'s Hotlist').'</h2>'.
+<input type="hidden" name="returnurl" value="'.$env{'form.returnurl'}.'" />
+<div class="LC_left_float"><h4>'.&mt('Hotlist options').'</h4>
+<p>'.
+&mt('When enabled, the Hotlist keeps track of the last N '.$lc_role.'s visited.').'<br />'.
+&mt('Those N '.$lc_role.'s are then shown in a table at the top of the '.$lc_role.'s page.').'</p>'.
 &Apache::lonhtmlcommon::start_pick_box().
-&Apache::lonhtmlcommon::row_title('<label for="Hotlist">'.&mt('Enable Recent '.$role.'s Hotlist').'</label>').
-'<input id="Hotlist" type="checkbox"'.$checked.' name="recentroles" value="true" />'.
+&Apache::lonhtmlcommon::row_title(&mt('Use Recent '.$role.'s Hotlist')).
+'<span class="LC_nobreak">
+<label><input id="Hotliston" type="radio" '.$checkedon.' name="recentroles" value="1" />'.&mt('Yes').'</label>'.
+(' 'x2).
+'<label><input id="Hotlistoff" type="radio" '.$checkedoff.' name="recentroles" value="0" />'.&mt('No').'</label>
+</span>'.
 &Apache::lonhtmlcommon::row_closure().
 &Apache::lonhtmlcommon::row_title('<label for="NumberOfRoles">'.&mt('Number of '.$role.'s in Hotlist').'</label>').
 '<select name="recentrolesn" size="1" id ="NumberOfRoles">'.
-$options.
-'</select>'.
+$options.'
+</select>'.
 &Apache::lonhtmlcommon::row_closure(1).
-&Apache::lonhtmlcommon::end_pick_box().
-'<br/><h2>'.&mt('Freeze Roles').'</h2>'.
-'<p>'.&mt('This list below can be used to <q>freeze</q> '.$lc_role.'s on your screen. Those marked as frozen will not be removed from the list, even if they have not been used recently.').'
+&Apache::lonhtmlcommon::end_pick_box().'
+</div>');
+    if ($roles_check_list) { 
+        $r->print('<div class="LC_left_float">
+<h4>'.&mt('Freeze Roles').'</h4>
+<p>'.&mt('The table below can be used to [_1]freeze[_2] '.$lc_role.'s in the Hotlist.','<q>','</q>').'<br />'.
+&mt('Those marked frozen will not be removed from the list, even if not recently used.').'
 </p>
 '.$roles_check_list.'
-<br />
+</div>');
+     } else {
+         $r->print('<br clear="all" />'.
+                   &mt('Once the Hotlist contains recently visited '.$lc_role.'s, you can return to this page to also set frozen roles.'));
+     }
+     $r->print('
+<br clear="all" />
 <input type="submit" value="'.&mt('Save').'" />
 </form>');
 }
@@ -525,7 +557,11 @@
         }
     }
     $message=&Apache::loncommon::confirmwrapper($message);
-    &print_main_menu($r, $message);
+    if ($env{'form.returnurl'} eq '/adm/roles') {
+        return $message;
+    } else {
+        &print_main_menu($r, $message);
+    }
 }
 
 
@@ -2176,11 +2212,19 @@
                                    ['action','wysiwyg','returnurl','refpage']);
     #
     Apache::lonhtmlcommon::clear_breadcrumbs();
+    my ($brlink,$brtxt,$brhelp);
+    if (($env{'form.action'} eq 'changerolespref') && ($env{'form.returnurl'} eq '/adm/roles')) {
+        $brlink ='/adm/roles';
+        $brtxt = 'User Roles';
+    } else {
+        $brlink ='/adm/preferences';
+        $brtxt = 'Set User Preferences';
+        $brhelp = 'Prefs_About_Me,Prefs_Language,Prefs_Screen_Name_Nickname,Change_Colors,Change_Password,Prefs_Messages,Change_Discussion_Display';   
+    }
     Apache::lonhtmlcommon::add_breadcrumb
-        ({href => '/adm/preferences',
-          text => 'Set User Preferences',
-          help =>
-          'Prefs_About_Me,Prefs_Language,Prefs_Screen_Name_Nickname,Change_Colors,Change_Password,Prefs_Messages,Change_Discussion_Display'});
+        ({href => $brlink,
+          text => $brtxt,
+          help => $brhelp,});
     if(!exists $env{'form.action'}) {
 	    &print_main_menu($r);
     }elsif($env{'form.action'} eq 'changepass'){
Index: loncom/interface/loncoursequeueadmin.pm
diff -u loncom/interface/loncoursequeueadmin.pm:1.31 loncom/interface/loncoursequeueadmin.pm:1.32
--- loncom/interface/loncoursequeueadmin.pm:1.31	Wed Aug 15 14:37:13 2012
+++ loncom/interface/loncoursequeueadmin.pm	Thu Aug 16 17:02:55 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Utilities to administer domain course requests and course self-enroll requests
 #
-# $Id: loncoursequeueadmin.pm,v 1.31 2012/08/15 14:37:13 raeburn Exp $
+# $Id: loncoursequeueadmin.pm,v 1.32 2012/08/16 17:02:55 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1556,7 +1556,7 @@
     }
     if (keys(%reqs_by_date)) {
         unless ($notitle) {
-            $output .= '<b>'.&mt('Enrollment requests pending Course Coordinator approval').'</b><br />';
+            $output .= '<br /><b>'.&mt('Enrollment requests pending Course Coordinator approval').'</b><br />';
         }
         $output .= &Apache::loncommon::start_data_table().
                    &Apache::loncommon::start_data_table_header_row().
@@ -1804,10 +1804,8 @@
     my ($is_active_author,$offer_author);
     if ($env{'environment.canrequest.author'}) {
         unless (&is_active_author()) {
-            if ($env{'environment.canrequest.author'}) {
-                unless (&reqauthor_check() =~ /^approval:\d+$/) {
-                    $offer_author = 1;
-                }
+            unless (&reqauthor_check() =~ /^approval:\d+$/) {
+                $offer_author = 1;
             }
         }
     }
Index: doc/loncapafiles/loncapafiles.lpml
diff -u doc/loncapafiles/loncapafiles.lpml:1.806 doc/loncapafiles/loncapafiles.lpml:1.807
--- doc/loncapafiles/loncapafiles.lpml:1.806	Mon Jul 30 01:37:22 2012
+++ doc/loncapafiles/loncapafiles.lpml	Thu Aug 16 17:03:06 2012
@@ -2,7 +2,7 @@
  "http://lpml.sourceforge.net/DTD/lpml.dtd">
 <!-- loncapafiles.lpml -->
 
-<!-- $Id: loncapafiles.lpml,v 1.806 2012/07/30 01:37:22 raeburn Exp $ -->
+<!-- $Id: loncapafiles.lpml,v 1.807 2012/08/16 17:03:06 raeburn Exp $ -->
 
 <!--
 
@@ -7445,8 +7445,10 @@
 edit-find.png;
 edit-mode-22x22.png;
 edit-redo.png;
+edit-redo-22x22.png;
 edit-select-all.png;
 edit-undo.png;
+edit-undo-22x22.png;
 emblem-photos.png;
 emblem-readonly.png;
 emblem-system.png;
@@ -7467,6 +7469,7 @@
 imsexport.png;
 link-new-22x22.png;
 list-add.png;
+list-add-22x22.png;
 log.png;
 mail-message-new.png;
 mail-reply-all.png;
@@ -7483,17 +7486,21 @@
 preferences-desktop-theme.png;
 preferences-desktop-wallpaper.png;
 preferences-system-windows.png;
+rcrs-22x22.png;
 receipt_number.png;
 recover.png;
 remotecontrol.png;
 resversion.png;
+role_hotlist-22x22.png;
 save-22x22.png;
 scoreupfrm.png;
 selfenrl-queue.png;
+selfenrl-queue-22x22.png;
 sequence.png;
 simple.png;
 simpprob.png;
 start-here.png;
+start-here-22x22.png;
 subtimpl.png;
 syllabus.png;
 symbs.png;


More information about the LON-CAPA-cvs mailing list