version 1.129, 2020/12/13 02:00:49
|
version 1.131, 2025/03/22 20:34:49
|
Line 118 sub handler {
|
Line 118 sub handler {
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
|
$r->print(&display_header($command,\%checkallowed)); |
my $udom = $env{'user.domain'}; |
|
my $uname = $env{'user.name'}; |
|
my $cid = $env{'request.course.id'}; |
|
my $store_result = &store_display_settings($uname,$udom,$cid,\%checkallowed); |
|
my $store_error; |
|
|
|
unless ($store_result eq 'ok') { |
|
my $lctype = lc(&Apache::loncommon::course_type()); |
|
&Apache::lonnet::logthis('Error saving whatsnew settings: '. |
|
$store_result.' for '.'user '.$uname.':'.$udom.' in '.$lctype.' '.$cid); |
|
$store_error = '<span class="LC_error">' |
|
.&mt('Unable to save visibility settings due to [_1]', |
|
$store_result) |
|
.'</span>'; |
|
} |
|
|
|
$r->print(&display_header($command,$uname,$udom,$cid,\%checkallowed)); |
|
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
Line 185 sub handler {
|
Line 201 sub handler {
|
("What's New?",#'Course_Action_Items_Display' |
("What's New?",#'Course_Action_Items_Display' |
)); |
)); |
} |
} |
&display_main_box($r,$command,$refpage,\%checkallowed,$cdom,$crs); |
&display_main_box($r,$command,$refpage,\%checkallowed,$cdom,$crs,$store_error); |
return OK; |
return OK; |
} |
} |
|
|
Line 196 sub handler {
|
Line 212 sub handler {
|
#------------------------------ |
#------------------------------ |
|
|
sub display_main_box { |
sub display_main_box { |
my ($r,$command,$refpage,$checkallowed,$cdom,$crs) = @_; |
my ($r,$command,$refpage,$checkallowed,$cdom,$crs,$store_error) = @_; |
my $domain=&Apache::loncommon::determinedomain(); |
my $domain=&Apache::loncommon::determinedomain(); |
my $function = &Apache::loncommon::get_users_function(); |
my $function = &Apache::loncommon::get_users_function(); |
my $lctype = lc(&Apache::loncommon::course_type()); |
my $lctype = lc(&Apache::loncommon::course_type()); |
Line 245 sub display_main_box {
|
Line 261 sub display_main_box {
|
crslogin => \%crslogins, |
crslogin => \%crslogins, |
sessions => \%sessions, |
sessions => \%sessions, |
); |
); |
my %initpage = &Apache::lonlocal::texthash ( |
my %initpage = ( |
firstres => "first resource in the $lctype", |
firstres => "first resource in the $lctype", |
whatsnew => "What's New Page", |
whatsnew => "What's New Page", |
userpref => 'your general user preferences', |
userpref => 'your general user preferences', |
Line 277 sub display_main_box {
|
Line 293 sub display_main_box {
|
&display_interval_config($r,$refpage,\%interval_titles,'sessions'); |
&display_interval_config($r,$refpage,\%interval_titles,'sessions'); |
} else { |
} else { |
&display_actions_box($r,$command,$refpage,\%threshold_titles, |
&display_actions_box($r,$command,$refpage,\%threshold_titles, |
\%interval_titles,\%initpage,$cdom,$crs,$checkallowed); |
\%interval_titles,\%initpage,$cdom,$crs, |
|
$checkallowed,$store_error); |
} |
} |
my $end_page = &Apache::loncommon::end_page(); |
my $end_page = &Apache::loncommon::end_page(); |
$r->print(<<END_OF_BLOCK); |
$r->print(<<END_OF_BLOCK); |
Line 296 END_OF_BLOCK
|
Line 313 END_OF_BLOCK
|
#------------------------------- |
#------------------------------- |
|
|
sub display_header { |
sub display_header { |
my ($command,$checkallowed) = @_; |
my ($command,$uname,$udom,$cid,$checkallowed) = @_; |
|
|
my $scripttag; |
my $scripttag; |
unless ($command eq 'chgthreshold' || $command eq 'chginterval' || |
my $args = {}; |
$command eq 'chgoldroleinterval' || |
my %loadentries; |
$command eq 'chgnewroleinterval' || $command eq 'chgcrslogininterval') { |
|
$scripttag = <<"END"; |
if ($command eq 'courseinit') { |
|
$scripttag = <<"END"; |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
function toggleCourseInit(form) { |
|
if (document.getElementById('courseinit_by_course')) { |
|
var radioelem = form.elements['courseinit_control']; |
|
if (radioelem.length) { |
|
for (var i=0; i<radioelem.length; i++) { |
|
if (radioelem[i].checked) { |
|
if (radioelem[i].value == 'coursespecific') { |
|
document.getElementById('courseinit_by_course').style.display = 'inline'; |
|
} else { |
|
document.getElementById('courseinit_by_course').style.display = 'none'; |
|
} |
|
break; |
|
} |
|
} |
|
} |
|
} |
|
return; |
|
} |
|
// ]]> |
|
</script> |
|
END |
|
$loadentries{'onload'} = 'toggleCourseInit(document.courseinitswitch);'; |
|
} else { |
|
unless (($command eq 'chgthreshold' && $checkallowed->{'abovethreshold'}) || |
|
($command eq 'chginterval' && $checkallowed->{'versionchanges'}) || |
|
($command eq 'chgdisc' && $checkallowed->{'coursediscussion'}) || |
|
($command eq 'chgoldroleinterval' && $checkallowed->{'oldroles'}) || |
|
($command eq 'chgnewroleinterval' && $checkallowed->{'newroles'}) || |
|
($command eq 'chgcrslogininterval' && $checkallowed->{'crslogin'}) || |
|
($command eq 'chgsessionlimit' && $checkallowed->{'sessions'})) { |
|
my %display_settings = &get_display_settings($uname,$udom,$cid); |
|
$scripttag = <<"END"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
function change_display(caller,change) { |
function change_display(caller,change) { |
Line 312 function change_display(caller,change) {
|
Line 364 function change_display(caller,change) {
|
|
|
function changeAll(change) { |
function changeAll(change) { |
END |
END |
foreach my $item (keys(%{$checkallowed})) { |
foreach my $item (keys(%{$checkallowed})) { |
if ($item =~ /_section$/) { next; } |
if ($item =~ /_section$/) { next; } |
if ($$checkallowed{$item}) { |
if ($$checkallowed{$item}) { |
$scripttag.='document.visible.display_'.$item.'.value=change'. |
$scripttag.='document.visible.display_'.$item.'.value=change'. |
"\n"; |
"\n"; |
|
} |
} |
} |
} |
$scripttag.=<<"ENDTOGG"; |
$scripttag.=<<"ENDTOGG"; |
|
document.visible.submit(); |
document.visible.submit(); |
} |
} |
|
|
Line 375 function toggledetails(prefix) {
|
Line 427 function toggledetails(prefix) {
|
// ]]> |
// ]]> |
</script> |
</script> |
ENDTOGG |
ENDTOGG |
|
if (($checkallowed->{'crslogin'}) && ($display_settings{$cid.':crslogin'} ne 'hide')) { |
|
$loadentries{'onload'} = "toggledetails('login');"; |
|
} |
|
if (($checkallowed->{'sessions'}) && ($display_settings{$cid.':sessions'} ne 'hide')) { |
|
$loadentries{'onload'} .= "toggledetails('session');"; |
|
} |
|
} |
} |
} |
my $course_type=&Apache::loncommon::course_type(); |
my $course_type=&Apache::loncommon::course_type(); |
|
if (keys(%loadentries)) { |
|
$args->{'add_entries'} = \%loadentries; |
|
} |
return &Apache::loncommon::start_page("What's New?", |
return &Apache::loncommon::start_page("What's New?", |
$scripttag); |
$scripttag,$args); |
} |
} |
|
|
#------------------------------- |
#------------------------------- |
Line 390 ENDTOGG
|
Line 452 ENDTOGG
|
|
|
sub display_actions_box { |
sub display_actions_box { |
my ($r,$command,$refpage,$threshold_titles,$interval_titles,$initpage, |
my ($r,$command,$refpage,$threshold_titles,$interval_titles,$initpage, |
$cdom,$crs,$checkallowed) = @_; |
$cdom,$crs,$checkallowed,$store_error) = @_; |
my $udom = $env{'user.domain'}; |
my $udom = $env{'user.domain'}; |
my $uname = $env{'user.name'}; |
my $uname = $env{'user.name'}; |
my $cid = $env{'request.course.id'}; |
my $cid = $env{'request.course.id'}; |
Line 467 sub display_actions_box {
|
Line 529 sub display_actions_box {
|
} |
} |
$header .= &mt('Page set to be displayed after you have selected a role in this '.$lctype).'.' |
$header .= &mt('Page set to be displayed after you have selected a role in this '.$lctype).'.' |
.' <span class="LC_nobreak">' |
.' <span class="LC_nobreak">' |
.&mt('Currently: [_1].','<i>'.$currinit.'</i>') |
.&mt('Currently: [_1].','<span class="LC_cusr_emph">'.$currinit.'</span>') |
.' ' |
.' ' |
.&mt('[_1]Change[_2] for just [_3]this '.$lctype.'[_4] or for [_5]all your courses/communities[_6].' |
.&mt('[_1]Change[_2] for just [_3]this '.$lctype.'[_4] or for [_5]all your courses/communities[_6].' |
,'<b>' |
,'<b>' |
Line 490 sub display_actions_box {
|
Line 552 sub display_actions_box {
|
$result = &store_discussion_setting($uname,$udom,$cid); |
$result = &store_discussion_setting($uname,$udom,$cid); |
} |
} |
|
|
my $store_result=&store_display_settings($uname,$udom,$cid,$checkallowed); |
if ($store_error) { |
|
$result = $store_error; |
unless ($store_result eq 'ok') { |
|
&Apache::lonnet::logthis('Error saving whatsnew settings: '. |
|
$store_result.' for '.'user '.$uname.':'.$udom.' in '.$lctype.' '.$cid); |
|
$result .= '<span class="LC_error">' |
|
.&mt('Unable to save visibility settings due to [_1]', |
|
$store_result) |
|
.'</span>'; |
|
} |
} |
|
|
if ($result) { |
if ($result) { |
Line 690 sub display_actions_box {
|
Line 745 sub display_actions_box {
|
if ($show{'sessions'}) { |
if ($show{'sessions'}) { |
$sessioncount = &getsessions($cdom,$crs,\%sessions,$timediff{'sessions'},$classlist); |
$sessioncount = &getsessions($cdom,$crs,\%sessions,$timediff{'sessions'},$classlist); |
} |
} |
$r->print(qq|<a href="javascript:changeAll('hide');">$lt{'hial'}</a> |
my $showhideall = <<"END"; |
<a href="javascript:changeAll('show');">$lt{'shal'}</a> |
<span class="LC_nobreak"><a href="javascript:changeAll('hide');">$lt{'hial'}</a> |
<form method="post" name="visible" action="/adm/whatsnew">\n|); |
<a href="javascript:changeAll('show');">$lt{'shal'}</a></span> |
|
END |
|
$r->print(&Apache::loncommon::head_subbox($showhideall)); |
|
$r->print(qq|<form method="post" name="visible" action="/adm/whatsnew">\n|); |
|
|
foreach my $item (keys(%{$checkallowed})) { |
foreach my $item (keys(%{$checkallowed})) { |
if ($item =~ /_section$/) { next; } |
if ($item =~ /_section$/) { next; } |
if ($$checkallowed{$item}) { |
if ($$checkallowed{$item}) { |
Line 769 sub display_threshold_config {
|
Line 828 sub display_threshold_config {
|
my $onchange = 'onfocus="javascript:window.document.forms'. |
my $onchange = 'onfocus="javascript:window.document.forms'. |
"['thresholdform'].elements['".$parameter."_setparmval']". |
"['thresholdform'].elements['".$parameter."_setparmval']". |
'.checked=true;"'; |
'.checked=true;"'; |
|
my $aria_textbox = ' aria-label="'.&mt('Threshold value for [_1]', |
|
$threshold_titles{$type}).'"'; |
|
my $aria_checkbox = ' aria-label="'.&mt('Change threshold value for [_1]', |
|
$threshold_titles{$type}).'"'; |
$r->print(&Apache::loncommon::start_data_table_row()."\n". |
$r->print(&Apache::loncommon::start_data_table_row()."\n". |
'<td>'.$threshold_titles{$type}.'</td>'."\n". |
'<td>'.$threshold_titles{$type}.'</td>'."\n". |
'<td>'.&Apache::lonhtmlcommon::textbox($parameter.'_value', |
'<td>'.&Apache::lonhtmlcommon::textbox($parameter.'_value', |
$threshold{$type}, |
$threshold{$type}, |
10,$onchange).'</td>'."\n". |
10,$onchange.$aria_textbox).'</td>'."\n". |
'<td>'. |
'<td>'. |
&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval'). |
&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval', |
|
'','',$aria_checkbox). |
'</td>'."\n". |
'</td>'."\n". |
&Apache::loncommon::end_data_table_row()); |
&Apache::loncommon::end_data_table_row()); |
} |
} |
Line 829 sub display_interval_config {
|
Line 893 sub display_interval_config {
|
<input type="hidden" name="intervaltype" value="'.$context.'" /> |
<input type="hidden" name="intervaltype" value="'.$context.'" /> |
<input type="hidden" name="refpage" value="'.$refpage.'" />'. |
<input type="hidden" name="refpage" value="'.$refpage.'" />'. |
&mt('Display:').' |
&mt('Display:').' |
<select name="interval"> |
<select name="interval" aria-label="'.&mt('Choose time window').'"> |
<option value="" selected="selected">'.&mt('Select').'</option> |
<option value="" selected="selected">'.&mt('Select').'</option> |
'); |
'); |
if (ref($interval_titles) eq 'HASH') { |
if (ref($interval_titles) eq 'HASH') { |
Line 917 sub courseinit_config {
|
Line 981 sub courseinit_config {
|
my ($control,$current) = &curr_courseinit(); |
my ($control,$current) = &curr_courseinit(); |
my @chgstate = ('userpref','coursespecific'); |
my @chgstate = ('userpref','coursespecific'); |
my @chgentry = ('firstres','whatsnew'); |
my @chgentry = ('firstres','whatsnew'); |
|
my $courseinitsty = 'display:none;'; |
|
if ($control eq 'coursespecific') { |
|
$courseinitsty = 'display:inline;'; |
|
} |
my $lctype = lc(&Apache::loncommon::course_type()); |
my $lctype = lc(&Apache::loncommon::course_type()); |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
'chwp' => "Choose which page will be displayed when you enter this $lctype after selecting a role.", |
'chwp' => "Choose which page will be displayed when you enter this $lctype after selecting a role.", |
'cuva' => 'Current value is determined by', |
|
'anis' => 'and is set to display', |
|
'padc' => 'Page display controlled by', |
'padc' => 'Page display controlled by', |
'chce' => 'Choose '.$lctype.' entry', |
'chce' => "Choose $lctype entry", |
'moce' => 'Save', |
'moce' => 'Save', |
); |
); |
$r->print(<<"END"); |
$lt{'cuva'} = &mt('Current value is determined by[_1]'.$initpage->{$control}.'[_2] and is set to display[_1]'.$initpage->{$current}.'[_2].', |
|
': <span class="LC_cusr_emph">','</span>'); |
|
$r->print(<<"END"); |
<br />$lt{'chwp'} |
<br />$lt{'chwp'} |
<br />$lt{'cuva'}: <b> |
<br />$lt{'cuva'} |
$$initpage{$control}</b> $lt{'anis'} <b> |
<br /><br /> |
$$initpage{$current}</b>.<br /><br /> |
|
<form method="post" name="courseinitswitch" action="/adm/whatsnew"> |
<form method="post" name="courseinitswitch" action="/adm/whatsnew"> |
<input type="hidden" name="command" value="newcourseinit" /> |
<input type="hidden" name="command" value="newcourseinit" /> |
<input type="hidden" name="refpage" value="$refpage" /> |
<input type="hidden" name="refpage" value="$refpage" /> |
$lt{'padc'}: |
<fieldset style="display:inline"><legend>$lt{'padc'}</legend> |
END |
END |
foreach my $choice (@chgstate) { |
foreach my $choice (@chgstate) { |
my $chkstring; |
my $chkstring; |
if ($choice eq $control) { |
if ($choice eq $control) { |
$chkstring = ' checked="checked" '; |
$chkstring = ' checked="checked" '; |
} |
} |
$r->print('<span class="LC_nobreak"><label><input type="radio" name="courseinit_control" value="'. |
$r->print('<span class="LC_nobreak"><label><input type="radio" name="courseinit_control" value="'. |
$choice.'"'.$chkstring.'/>'.$$initpage{$choice}. |
$choice.'"'.$chkstring.' onclick="toggleCourseInit(this.form);" />'.&mt($initpage->{$choice}). |
' </label></span>'); |
' </label></span>'); |
} |
} |
$r->print('<br /><br />'.&mt('If').' '.$$initpage{'coursespecific'}. |
$r->print('</fieldset><fieldset id="courseinit_by_course" style="'.$courseinitsty.'">'. |
' - <br />'.$lt{'chce'}.": \n"); |
'<legend>'.$lt{'chce'}.'</legend>'."\n"); |
foreach my $choice (@chgentry) { |
foreach my $choice (@chgentry) { |
my $chkstring; |
my $chkstring; |
if (($choice eq $current) && ($control eq 'coursespecific')) { |
if (($choice eq $current) && ($control eq 'coursespecific')) { |
$chkstring = ' checked="checked" '; |
$chkstring = ' checked="checked" '; |
} |
} |
$r->print('<span class="LC_nobreak"><label><input type="radio" name="courseinit_page" value="'. |
$r->print('<span class="LC_nobreak"><label><input type="radio" name="courseinit_page" value="'. |
$choice.'"'.$chkstring.'/>'.$$initpage{$choice}. |
$choice.'"'.$chkstring.'/>'.&mt($initpage->{$choice}). |
' </label></span>'); |
' </label></span> '); |
} |
} |
$r->print('<br /><br /><input type="submit" name="display" value="'. |
$r->print('</fieldset><br /><br /><input type="submit" name="display" value="'. |
$lt{'moce'}.'" /></form>'); |
$lt{'moce'}.'" /></form>'); |
return; |
return; |
} |
} |
Line 1250 sub check_thresholds {
|
Line 1317 sub check_thresholds {
|
<td>'.$stats{$part}{degdiff}.'</td> |
<td>'.$stats{$part}{degdiff}.'</td> |
<td>'.$lastreset{$part}.'</td>'; |
<td>'.$lastreset{$part}.'</td>'; |
if ($checkallowed->{'resetcounters'}) { |
if ($checkallowed->{'resetcounters'}) { |
|
my $aria = ' aria-label="'.&mt('Reset counter for [_1] (part [_2])', |
|
$$triggered{$symb}{title},$part).'"'; |
$$triggered{$symb}{text}[$partcount] .= |
$$triggered{$symb}{text}[$partcount] .= |
'<td><input type="checkbox" name="'.$resetname.'" />'. |
'<td><input type="checkbox" name="'.$resetname.'"'.$aria.' />'. |
'<input type="hidden" name="'.$resettitle.'" value="'.&escape($$triggered{$symb}{title}).'" /></td>'; |
'<input type="hidden" name="'.$resettitle.'" value="'.&escape($$triggered{$symb}{title}).'" /></td>'; |
} |
} |
$partcount ++; |
$partcount ++; |
Line 1917 sub display_abovethreshold {
|
Line 1986 sub display_abovethreshold {
|
$r->print('<tr'.$css_class.'>'. |
$r->print('<tr'.$css_class.'>'. |
'<td class="LC_first_item" '.$rowspan.'><a href="'.$linkurl.'">'. |
'<td class="LC_first_item" '.$rowspan.'><a href="'.$linkurl.'">'. |
$$triggered{$res}{title}.'</a></td>'); |
$$triggered{$res}{title}.'</a></td>'); |
if (ref($$triggered{$res}{text}) eq 'ARRAY') { |
if (ref($$triggered{$res}{text}) eq 'ARRAY') { |
$r->print($$triggered{$res}{text}[0]); |
$r->print($$triggered{$res}{text}[0]); |
} |
} |
$r->print('</tr>'); |
$r->print('</tr>'); |
if (ref($$triggered{$res}{text}) eq 'ARRAY') { |
if (ref($$triggered{$res}{text}) eq 'ARRAY') { |
if (@{$$triggered{$res}{text}} > 1) { |
if (@{$$triggered{$res}{text}} > 1) { |
for (my $i=1; $i<@{$$triggered{$res}{text}}; $i++) { |
for (my $i=1; $i<@{$$triggered{$res}{text}}; $i++) { |
Line 2382 sub store_courseinit_setting {
|
Line 2451 sub store_courseinit_setting {
|
$result = &Apache::lonhtmlcommon::confirm_success(&mt("Page displayed after role selection in $lctype now set by [_1]user's global preferences[_2].",'<b>','</b>')); |
$result = &Apache::lonhtmlcommon::confirm_success(&mt("Page displayed after role selection in $lctype now set by [_1]user's global preferences[_2].",'<b>','</b>')); |
} else { |
} else { |
$result = &Apache::lonhtmlcommon::confirm_success(&mt('Page displayed after role selection in this '.$lctype.' set to [_1].' |
$result = &Apache::lonhtmlcommon::confirm_success(&mt('Page displayed after role selection in this '.$lctype.' set to [_1].' |
,'<b>'.$$initpage{$env{'form.courseinit_page'}}.'</b>')); |
,'<b>'.&mt($initpage->{$env{'form.courseinit_page'}}).'</b>')); |
} |
} |
} else { |
} else { |
&Apache::lonnet::logthis('Error saving whatsnew courseinit '. |
&Apache::lonnet::logthis('Error saving whatsnew courseinit '. |
Line 2395 sub store_courseinit_setting {
|
Line 2464 sub store_courseinit_setting {
|
'<tt>'.$outcome.'</tt>'),1); |
'<tt>'.$outcome.'</tt>'),1); |
} else { |
} else { |
$result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set page display, after role selection, for this '.$lctype.' to [_1] due to [_2].' |
$result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set page display, after role selection, for this '.$lctype.' to [_1] due to [_2].' |
,'<b>'.$$initpage{$env{'form.courseinit_page'}}.'</b>' |
,'<b>'.&mt($initpage->{$env{'form.courseinit_page'}}).'</b>' |
,'<tt>'.$outcome.'</tt>'),1); |
,'<tt>'.$outcome.'</tt>'),1); |
} |
} |
} |
} |