version 1.88, 2006/06/14 18:56:58
|
version 1.91, 2006/06/22 23:22:41
|
Line 298 sub rolesprefchanger {
|
Line 298 sub rolesprefchanger {
|
$options .= "<option $select>$i</option>\n"; |
$options .= "<option $select>$i</option>\n"; |
} |
} |
|
|
$r->print(<<ENDSCREEN); |
# Get list of recent roles and display with checkbox in front |
<p>Some LON-CAPA users have a long list of roles. The Recent Roles Hotlist |
my $roles_check_list = ''; |
feature keeps track of the last N roles which have been |
my $role_key=''; |
visited and places a table of these at the top of the roles page. |
if ($env{'environment.recentroles'}) { |
People with very few roles should leave this feature disabled. |
my %recent_roles = |
</p> |
&Apache::lonhtmlcommon::get_recent('roles',$env{'environment.recentrolesn'}); |
|
my %frozen_roles = |
|
&Apache::lonhtmlcommon::get_recent_frozen('roles',$env{'environment.recentrolesn'}); |
|
|
|
$roles_check_list .= |
|
&Apache::loncommon::start_data_table(). |
|
&Apache::loncommon::start_data_table_header_row(). |
|
"<th>".&mt('Freeze Role')."</th>". |
|
"<th>".&mt('Role')."</td>". |
|
&Apache::loncommon::end_data_table_header_row(). |
|
"\n"; |
|
my $count; |
|
foreach $role_key (sort(keys(%recent_roles))) { |
|
my $checked = ""; |
|
my $value = $recent_roles{$role_key}; |
|
if ($frozen_roles{$role_key}) { |
|
$checked = "checked=\"checked\""; |
|
} |
|
# get course information |
|
my ($role,$rest) = split(/\./, $role_key); |
|
my $trole = &Apache::lonnet::plaintext($role); |
|
my ($tdomain,$other,$tsection)= |
|
split(/\//,Apache::lonnet::declutter($rest)); |
|
my $tother = '-'; |
|
if ($role =~ /cc|st|in|ta/ ) { |
|
my %newhash=&Apache::lonnet::coursedescription($tdomain."_".$other); |
|
$tother = " - ".$newhash{'description'}; |
|
} elsif ($role =~ /dc/) { |
|
$tother = ""; |
|
} else { |
|
$tother = " - $other"; |
|
} |
|
|
|
my $section=""; |
|
if ($tsection) { |
|
$section = " - Section/Group: $tsection"; |
|
} |
|
$count++; |
|
$roles_check_list .= |
|
&Apache::loncommon::start_data_table_row(). |
|
'<td class="LC_table_cell_checkbox">'. |
|
"<input type=\"checkbox\" $checked name=\"freezeroles\"". |
|
" id=\"freezeroles$count\" value=\"$role_key\" /></td>". |
|
"<td><label for=\"freezeroles$count\">". |
|
"$trole - $tdomain $tother $section</label></td>". |
|
&Apache::loncommon::end_data_table_row(). "\n"; |
|
} |
|
$roles_check_list .= "</table>\n"; |
|
} |
|
|
<form name="prefs" action="/adm/preferences" method="post"> |
$r->print(' |
|
<p>'.&mt('Some LON-CAPA users have a long list of roles. The Recent Roles Hotlist feature keeps track of the last N roles which have been visited and places a table of these at the top of the roles page. People with very few roles should leave this feature disabled.').' |
|
</p> |
|
<form name="prefs" action="/adm/preferences" method="POST"> |
<input type="hidden" name="action" value="verify_and_change_rolespref" /> |
<input type="hidden" name="action" value="verify_and_change_rolespref" /> |
<br /><label>Enable Recent Roles Hotlist: |
<br /><label>'.&mt('Enable Recent Roles Hotlist:').' |
<input type="checkbox" $checked name="recentroles" value="true" /></label> |
<input type="checkbox" '.$checked.' name="recentroles" value="true" /></label> |
<br />Number of roles in Hotlist: |
<br />'.&mt('Number of roles in Hotlist:').' |
<select name="recentrolesn" size="1"> |
<select name="recentrolesn" size="1"> |
$options |
'.$options.' |
</select> |
</select> |
|
<p>'.&mt('This list below can be used to <q>freeze</q> roles on your screen. Those marked as frozen will not be removed from the list, even if they have not been used recently.').' |
|
</p> |
|
'.$roles_check_list.' |
<br /> |
<br /> |
<input type="submit" value="Change" /> |
<input type="submit" value="'.&mt('Change').'" /> |
</form> |
</form>'); |
ENDSCREEN |
|
} |
} |
|
|
sub verify_and_change_rolespref { |
sub verify_and_change_rolespref { |
Line 326 sub verify_and_change_rolespref {
|
Line 379 sub verify_and_change_rolespref {
|
# Recent Roles Hotlist Flag |
# Recent Roles Hotlist Flag |
my $hotlist_flag = $env{'form.recentroles'}; |
my $hotlist_flag = $env{'form.recentroles'}; |
my $hotlist_n = $env{'form.recentrolesn'}; |
my $hotlist_n = $env{'form.recentrolesn'}; |
my $message=''; |
my $message='<hr />'; |
if ($hotlist_flag) { |
if ($hotlist_flag) { |
&Apache::lonnet::put('environment',{'recentroles' => $hotlist_flag}); |
&Apache::lonnet::put('environment',{'recentroles' => $hotlist_flag}); |
&Apache::lonnet::appenv('environment.recentroles' => $hotlist_flag); |
&Apache::lonnet::appenv('environment.recentroles' => $hotlist_flag); |
$message='Recent Roles Hotlist is Enabled'; |
$message=&mt('Recent Roles Hotlist is Enabled'); |
} else { |
} else { |
&Apache::lonnet::del('environment',['recentroles']); |
&Apache::lonnet::del('environment',['recentroles']); |
&Apache::lonnet::delenv('environment\.recentroles'); |
&Apache::lonnet::delenv('environment\.recentroles'); |
$message='Recent Roles Hotlist is Disabled'; |
$message=&mt('Recent Roles Hotlist is Disabled'); |
} |
} |
if ($hotlist_n) { |
if ($hotlist_n) { |
&Apache::lonnet::put('environment',{'recentrolesn' => $hotlist_n}); |
&Apache::lonnet::put('environment',{'recentrolesn' => $hotlist_n}); |
&Apache::lonnet::appenv('environment.recentrolesn' => $hotlist_n); |
&Apache::lonnet::appenv('environment.recentrolesn' => $hotlist_n); |
if ($hotlist_flag) { |
if ($hotlist_flag) { |
$message.="<br />Display $hotlist_n Most Recent Roles\n"; |
$message.="<br />". |
|
&mt('Display [_1] Most Recent Roles',$hotlist_n)."\n"; |
|
} |
|
} |
|
|
|
# Get list of froze roles and list of recent roles |
|
my @freeze_list = &Apache::loncommon::get_env_multiple('form.freezeroles'); |
|
my %freeze = (); |
|
foreach my $key (@freeze_list) { |
|
$freeze{$key}='1'; |
|
} |
|
|
|
my %recent_roles = |
|
&Apache::lonhtmlcommon::get_recent('roles',$env{'environment.recentrolesn'}); |
|
my %frozen_roles = |
|
&Apache::lonhtmlcommon::get_recent_frozen('roles',$env{'environment.recentrolesn'}); |
|
|
|
# Unset any roles that were previously frozen but aren't in list |
|
|
|
foreach my $role_key (sort(keys(%recent_roles))) { |
|
if (($frozen_roles{$role_key}) && (!exists($freeze{$role_key}))) { |
|
$message .= "<br />".&mt('Unfreezing Role: [_1]',$role_key)."\n"; |
|
&Apache::lonhtmlcommon::store_recent('roles',$role_key,' ',0); |
|
} |
|
} |
|
|
|
# Freeze selected roles |
|
foreach my $role_key (@freeze_list) { |
|
if (!$frozen_roles{$role_key}) { |
|
$message .= "<br />".&mt('Freezing Role: [_1]',$role_key)."\n"; |
|
&Apache::lonhtmlcommon::store_recent('roles', |
|
$role_key,' ',1); |
} |
} |
} |
} |
|
$message .= "<hr /><br />\n"; |
|
|
$r->print(<<ENDRPSCREEN); |
$r->print(<<ENDRPSCREEN); |
$message |
$message |