Annotation of loncom/interface/lonwhatsnew.pm, revision 1.80
1.2 albertel 1: #
1.80 ! raeburn 2: # $Id: lonwhatsnew.pm,v 1.79 2008/07/09 15:16:14 raeburn Exp $
1.2 albertel 3: #
4: # Copyright Michigan State University Board of Trustees
5: #
6: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
7: #
8: # LON-CAPA is free software; you can redistribute it and/or modify
9: # it under the terms of the GNU General Public License as published by
10: # the Free Software Foundation; either version 2 of the License, or
11: # (at your option) any later version.
12: #
13: # LON-CAPA is distributed in the hope that it will be useful,
14: # but WITHOUT ANY WARRANTY; without even the implied warranty of
15: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: # GNU General Public License for more details.
17: #
18: # You should have received a copy of the GNU General Public License
19: # along with LON-CAPA; if not, write to the Free Software
20: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21: #
22: # /home/httpd/html/adm/gpl.txt
23: #
24: # http://www.lon-capa.org/
25: #
26:
27:
1.1 raeburn 28: package Apache::lonwhatsnew;
29:
30: use strict;
31: use lib qw(/home/httpd/lib/perl);
32: use Apache::lonnet;
1.3 albertel 33: use Apache::loncommon();
34: use Apache::lonhtmlcommon();
1.1 raeburn 35: use Apache::lonlocal;
1.3 albertel 36: use Apache::loncoursedata();
37: use Apache::lonnavmaps();
1.18 raeburn 38: use Apache::lonuserstate;
1.77 raeburn 39: use Apache::lonuserutils;
1.1 raeburn 40: use Apache::Constants qw(:common :http);
41: use Time::Local;
1.24 albertel 42: use GDBM_File;
1.55 www 43: use lib '/home/httpd/lib/perl/';
44: use LONCAPA;
1.1 raeburn 45:
46: #----------------------------
47: # handler
48: #
49: #----------------------------
50:
51: sub handler {
52: my $r = shift;
1.7 raeburn 53: if ($r->header_only) {
54: &Apache::loncommon::content_type($r,'text/html');
55: $r->send_http_header;
56: return OK;
57: }
1.39 raeburn 58: &Apache::loncommon::get_unprocessed_cgi(
59: $ENV{'QUERY_STRING'},['command','refpage']);
1.1 raeburn 60:
1.36 raeburn 61: my $command = $env{'form.command'};
1.39 raeburn 62: my $refpage = $env{'form.refpage'};
1.1 raeburn 63:
1.44 albertel 64: my %checkallowed = ( coursenormalmail => 1,
65: coursecritmail => 1, );
66: foreach my $perm_check (['whn','whatsnew',1],
67: ['pch','coursediscussion',1],
68: ['mgr','handgrading',1],
69: ['vgr','abovethreshold',1],
70: ['opa','haserrors',1],
71: ['mdc','versionchanges',0],
1.77 raeburn 72: ['vcl','newroles',1],
73: ['vcl','oldroles',1],
1.44 albertel 74: ) {
75: my ($perm,$key,$check_section) = @{ $perm_check };
76: my $scope = $env{'request.course.id'};
77: if (!($checkallowed{$key} = &Apache::lonnet::allowed($perm,$scope))) {
78: $scope .= '/'.$env{'request.course.sec'};
79: if ( $check_section ) {
80: $checkallowed{$key} = &Apache::lonnet::allowed($perm,$scope);
81: }
82: if ($checkallowed{$key}) {
83: $checkallowed{$key.'_section'} = $env{'request.course.sec'};
84: }
85: }
86: }
1.43 albertel 87:
1.44 albertel 88: if ( ! $env{'request.course.fn'} || ! $checkallowed{'whatsnew'}) {
1.43 albertel 89: # Not in a course, or no whn priv in course
1.42 raeburn 90: $env{'user.error.msg'}="/adm/whatsnew::whn:0:0:Cannot display what's new page";
1.1 raeburn 91: return HTTP_NOT_ACCEPTABLE;
92: }
93:
1.44 albertel 94: &Apache::loncommon::content_type($r,'text/html');
95: $r->send_http_header;
1.36 raeburn 96:
97: $r->print(&display_header($command,\%checkallowed));
98:
1.7 raeburn 99: &Apache::lonhtmlcommon::clear_breadcrumbs();
1.36 raeburn 100: &Apache::lonhtmlcommon::add_breadcrumb
101: ({href=>'/adm/whatsnew',
102: text=>"Display Action Items"});
1.44 albertel 103: if (($command eq 'chgthreshold') && $checkallowed{'abovethreshold'}) {
1.7 raeburn 104: &Apache::lonhtmlcommon::add_breadcrumb
1.73 raeburn 105: ({href=>'/adm/whatsnew?command=chgthreshold&refpage='.$refpage,
1.13 raeburn 106: text=>"Change thresholds"});
1.7 raeburn 107: $r->print(&Apache::lonhtmlcommon::breadcrumbs
1.54 albertel 108: ("What's New?",#'Course_Action_Items_Thresholds'
1.49 albertel 109: ));
1.44 albertel 110: } elsif (($command eq 'chginterval') && $checkallowed{'versionchanges'} ) {
1.36 raeburn 111: &Apache::lonhtmlcommon::add_breadcrumb
1.73 raeburn 112: ({href=>'/adm/whatsnew?command=chginterval&refpage='.$refpage,
1.36 raeburn 113: text=>"Change interval"});
114: $r->print(&Apache::lonhtmlcommon::breadcrumbs
1.54 albertel 115: ("What's New?",#'Course_Action_Items_Intervals'
1.49 albertel 116: ));
1.44 albertel 117: } elsif (($command eq 'chgdisc') && $checkallowed{'coursediscussion'}) {
1.39 raeburn 118: &Apache::lonhtmlcommon::add_breadcrumb
1.73 raeburn 119: ({href=>'/adm/whatsnew?command=chgdisc&refpage='.$refpage,
1.39 raeburn 120: text=>"Change discussion display"});
121: $r->print(&Apache::lonhtmlcommon::breadcrumbs
1.54 albertel 122: ("What's New?",#'Course_Action_Items_Intervals'
1.49 albertel 123: ));
1.39 raeburn 124: } elsif ($command eq 'courseinit') {
125: &Apache::lonhtmlcommon::add_breadcrumb
1.73 raeburn 126: ({href=>'/adm/whatsnew?command=courseinit&refpage='.$refpage,
1.39 raeburn 127: text=>"Course initialization preference"});
128: $r->print(&Apache::lonhtmlcommon::breadcrumbs
1.54 albertel 129: ("What's New?",#'Course_Action_Items_Initialization'
1.49 albertel 130: ));
1.77 raeburn 131: } elsif ($command eq 'chgoldroleinterval' && $checkallowed{'oldroles'}) {
132: &Apache::lonhtmlcommon::add_breadcrumb
133: ({href=>'/adm/whatsnew?command=chgoldroleinterval&refpage='.$refpage,
134: text=>"Change interval"});
135: $r->print(&Apache::lonhtmlcommon::breadcrumbs
136: ("What's New?",#'Course_Action_Items_Intervals'
137: ));
138: } elsif ($command eq 'chgnewroleinterval' && $checkallowed{'newroles'}) {
139: &Apache::lonhtmlcommon::add_breadcrumb
140: ({href=>'/adm/whatsnew?command=chgnewroleinterval&refpage='.$refpage,
141: text=>"Change interval"});
142: $r->print(&Apache::lonhtmlcommon::breadcrumbs
143: ("What's New?",#'Course_Action_Items_Intervals'
144: ));
1.7 raeburn 145: } else {
146: $r->print(&Apache::lonhtmlcommon::breadcrumbs
1.54 albertel 147: ("What's New?",#'Course_Action_Items_Display'
1.49 albertel 148: ));
1.7 raeburn 149: }
1.39 raeburn 150: &display_main_box($r,$command,$refpage,\%checkallowed);
1.14 albertel 151: return OK;
1.1 raeburn 152: }
153:
154: #------------------------------
155: # display_main_box
156: #
157: # Display all the elements within the main box
158: #------------------------------
159:
160: sub display_main_box {
1.39 raeburn 161: my ($r,$command,$refpage,$checkallowed) = @_;
1.1 raeburn 162: my $domain=&Apache::loncommon::determinedomain();
1.40 raeburn 163: my $function = &Apache::loncommon::get_users_function();
1.59 albertel 164: my $lctype = lc(&Apache::loncommon::course_type());
1.7 raeburn 165: $r->print('<table width="100%" border="0" cellpadding="5" cellspacing="0"><tr><td width="100%">');
1.13 raeburn 166:
1.39 raeburn 167: my %threshold_titles = &Apache::lonlocal::texthash (
1.13 raeburn 168: av_attempts => 'Average number of attempts',
169: degdiff => 'Degree of difficulty',
170: numstudents => 'Total number of students with submissions',
171: );
1.78 bisitz 172: my %versions = (
1.77 raeburn 173: -1 => "version changes since start of $lctype",
174: 2592000 => 'version changes since last month',
175: 604800 => 'version changes since last week',
176: 86400 => 'version changes since yesterday',
177: );
1.78 bisitz 178: my %newroles = (
1.77 raeburn 179: -1 => "roles which have become active since start of $lctype",
180: 2592000 => 'roles which have become active since last month',
181: 604800 => 'roles which have become active since last week',
182: 86400 => 'roles which have become active since yesterday',
183: );
1.78 bisitz 184: my %oldroles = (
1.77 raeburn 185: -1 => "roles which expired since start of $lctype",
186: 2592000 => 'roles which expired since last month',
187: 604800 => 'roles which expired since last week',
188: 86400 => 'roles which expired since yesterday',
189: );
190: my %interval_titles = (
191: versions => \%versions,
192: newroles => \%newroles,
193: oldroles => \%oldroles,
1.36 raeburn 194: );
1.39 raeburn 195: my %initpage = &Apache::lonlocal::texthash (
1.56 raeburn 196: firstres => "first resource in the $lctype",
1.39 raeburn 197: whatsnew => "what's new? page",
198: userpref => 'your general user preferences',
1.56 raeburn 199: coursespecific => "specific setting for this $lctype",
1.39 raeburn 200: );
1.15 raeburn 201: my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
202: my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
203:
1.44 albertel 204: if (($command eq 'chgthreshold')
205: && $checkallowed->{'abovethreshold'}) {
1.69 raeburn 206: &display_threshold_config($r,$refpage,\%threshold_titles,
1.36 raeburn 207: $cdom,$crs);
1.44 albertel 208: } elsif (($command eq 'chginterval')
209: && $checkallowed->{'versionchanges'}) {
1.77 raeburn 210: &display_interval_config($r,$refpage,\%interval_titles,'versions');
1.44 albertel 211: } elsif (($command eq 'chgdisc')
212: && $checkallowed->{'coursediscussion'}) {
1.39 raeburn 213: &display_discussion_config($r,$refpage);
214: } elsif ($command eq 'courseinit') {
215: &courseinit_config($r,$refpage,\%initpage);
1.77 raeburn 216: } elsif (($command eq 'chgnewroleinterval')
217: && $checkallowed->{'newroles'}) {
218: &display_interval_config($r,$refpage,\%interval_titles,'newroles');
219: } elsif (($command eq 'chgoldroleinterval')
220: && $checkallowed->{'oldroles'}) {
221: &display_interval_config($r,$refpage,\%interval_titles,'oldroles');
1.1 raeburn 222: } else {
1.69 raeburn 223: &display_actions_box($r,$command,$refpage,\%threshold_titles,
1.39 raeburn 224: \%interval_titles,\%initpage,$cdom,$crs,$checkallowed);
1.1 raeburn 225: }
1.52 albertel 226: my $end_page = &Apache::loncommon::end_page();
1.1 raeburn 227: $r->print(<<END_OF_BLOCK);
228: </td>
229: </tr>
230: </table><br />
1.52 albertel 231: $end_page
1.1 raeburn 232: END_OF_BLOCK
233: }
234:
235: #-------------------------------
236: # display_header
237: #
238: # Display the header information and set
239: # up the HTML
240: #-------------------------------
241:
1.39 raeburn 242: sub display_header {
1.36 raeburn 243: my ($command,$checkallowed) = @_;
1.52 albertel 244:
1.36 raeburn 245: my $scripttag;
1.77 raeburn 246: unless ($command eq 'chgthreshold' || $command eq 'chginterval' ||
247: $command eq 'chgoldroleinterval' || $command eq 'chgnewroleinterval') {
1.36 raeburn 248: $scripttag = <<"END";
249: <script type="text/javascript">
250: function change_display(caller,change) {
251: caller.value = change;
1.77 raeburn 252: document.visible.submit();
1.36 raeburn 253: }
254:
255: function changeAll(change) {
256: END
257: foreach my $item (keys(%{$checkallowed})) {
1.44 albertel 258: if ($item =~ /_section$/) { next; }
1.39 raeburn 259: if ($$checkallowed{$item}) {
260: $scripttag.='document.visible.display_'.$item.'.value=change'.
261: "\n";
262: }
1.36 raeburn 263: }
264: $scripttag.='document.visible.submit();
265: }
266: </script>
267: ';
268: }
1.58 albertel 269: my $course_type=&Apache::loncommon::course_type();
270: return &Apache::loncommon::start_page($course_type.' Action Items',
271: $scripttag);
1.1 raeburn 272: }
273:
274: #-------------------------------
275: # display_actions_box
276: #
277: # Display the action items
278: #
279: #-------------------------------
280:
1.39 raeburn 281: sub display_actions_box {
1.69 raeburn 282: my ($r,$command,$refpage,$threshold_titles,$interval_titles,$initpage,
283: $cdom,$crs,$checkallowed) = @_;
1.36 raeburn 284: my $udom = $env{'user.domain'};
285: my $uname = $env{'user.name'};
286: my $cid = $env{'request.course.id'};
1.59 albertel 287: my $crstype = &Apache::loncommon::course_type();
1.56 raeburn 288: my $lctype = lc($crstype);
289: my %stulabel = (
290: 'Course' => 'students',
291: 'Group' => 'members',
292: );
1.36 raeburn 293: my %lt = &Apache::lonlocal::texthash(
1.60 raeburn 294: 'yacc' => 'You are accessing an invalid course',
1.36 raeburn 295: 'gtfr' => 'Go to first resource',
296: 'hial' => 'Hide all',
297: 'shal' => 'Show all',
298: );
299:
1.1 raeburn 300: my %unread = ();
301: my %ungraded = ();
302: my %bombed = ();
1.11 raeburn 303: my %triggered = ();
1.33 raeburn 304: my %changed = ();
1.1 raeburn 305: my @newmsgs = ();
306: my @critmsgs = ();
307: my @newdiscussions = ();
308: my @tograde = ();
309: my @bombs = ();
1.11 raeburn 310: my @warnings = ();
1.33 raeburn 311: my $msgcount = 0;
312: my $critmsgcount = 0;
1.77 raeburn 313: my $expirecount;
314: my %expired;
315: my $activecount;
316: my %activated;
1.16 raeburn 317: my %res_title = ();
1.33 raeburn 318: my %show = ();
319: my $needitems = 0;
320: my $boxcount = 0;
1.1 raeburn 321:
1.39 raeburn 322: my $result;
323: if ($command eq 'newcourseinit') {
324: $result = &store_courseinit_setting($uname,$udom,$cid,$initpage);
325: }
326:
1.64 banghart 327: my %threshold = ();
1.39 raeburn 328: my %pagedesc = &Apache::lonlocal::texthash (
329: firstres => 'First resource',
1.40 raeburn 330: whatsnew => "What's New? page",
1.39 raeburn 331: userpref => 'user preference',
1.56 raeburn 332: coursespecific => $lctype.' only',
1.39 raeburn 333: default => 'default',
334: );
335:
336: my ($initcontrol,$initdisp) = &curr_courseinit();
337: my $currinit = $pagedesc{$initdisp}.' ('.$pagedesc{$initcontrol}.')';
1.13 raeburn 338:
1.36 raeburn 339: unless ($cid) {
1.73 raeburn 340: $r->print('<p><span style="text-align: center; font-weight: bold;">'.$lt{'yacc'}.'</span></p>');
1.1 raeburn 341: return;
342: }
1.33 raeburn 343:
1.39 raeburn 344: if ($refpage eq 'start') {
345: if (tie(my %bighash,'GDBM_File',$env{'request.course.fn'}.'.db',
1.36 raeburn 346: &GDBM_READER(),0640)) {
1.39 raeburn 347: my $furl=$bighash{'first_url'};
348: untie(%bighash);
1.73 raeburn 349: $r->print('<span style="font-size: larger;"><a href="'.$furl.'">'.$lt{'gtfr'}.
350: '</a></span><br />');
1.39 raeburn 351: }
1.36 raeburn 352: }
1.74 bisitz 353: $r->print(&mt('Page set to be displayed after you have selected a role in this '.$lctype).'.'
354: .' <span class="LC_nobreak">'
1.78 bisitz 355: .&mt('Currently: [_1].','<i>'.$currinit.'</i>')
356: .' '
1.74 bisitz 357: .&mt('<b>Change</b> for just [_1]this course[_2]'
358: .' or for all [_3]your courses[_2].'
359: ,'<a href="/adm/whatsnew?command=courseinit&refpage='.$refpage.'">'
360: ,'</a>'
361: ,'<a href="/adm/preferences?action=changecourseinit&refpage='.$refpage.'">')
362: .' </span><br /><hr />');
1.56 raeburn 363:
1.36 raeburn 364: if ($command eq 'reset') {
365: $result = &process_reset($cdom,$crs);
366: } elsif ($command eq 'update') {
1.39 raeburn 367: $result = &process_update($uname,$udom,$threshold_titles);
1.36 raeburn 368: } elsif ($command eq 'newinterval') {
369: $result = &store_interval_setting($uname,$udom,$cid,$interval_titles);
1.39 raeburn 370: } elsif ($command eq 'newdiscconf') {
371: $result = &store_discussion_setting($uname,$udom,$cid);
1.36 raeburn 372: }
373:
374: my $store_result=&store_display_settings($uname,$udom,$cid,$checkallowed);
375:
376: unless ($store_result eq 'ok') {
1.71 albertel 377: &Apache::lonnet::logthis('Error saving whatsnew settings: '.
1.56 raeburn 378: $store_result.' for '.'user '.$uname.':'.$udom.' in '.$lctype.' '.$cid);
1.71 albertel 379: $result .= &mt('Unable to save visibility settings due to [_1]',
1.36 raeburn 380: $store_result);
381: }
382:
383: if ($result) {
384: $r->print($result.'<hr width="100%" />');
385: }
386: $r->rflush();
387:
1.77 raeburn 388: my (%timediff,%interval);
389: my %display_settings = &get_display_settings($uname,$udom,$cid);
390: $timediff{'versions'} = $display_settings{$cid.':interval'};
391: unless (defined($timediff{'versions'})) { $timediff{'versions'} = 604800; }
392: $interval{'versions'} = $interval_titles->{'versions'}->{$timediff{'versions'}};
393:
394: my %headings = &Apache::lonlocal::texthash(
395: coursediscussion => 'Unread '.$lctype.' discussion posts',
396: handgrading => 'Problems requiring handgrading',
397: haserrors => 'Problems with errors',
398: coursenormalmail => 'New '.$lctype.' messages',
399: coursecritmail => 'New critical messages in '.$lctype,
400: );
401:
402: if ($timediff{'versions'} == -1) {
1.78 bisitz 403: $headings{'versionchanges'} = &mt('Resources in '.$lctype.' with version changes since start of '.$lctype);
1.77 raeburn 404: } elsif ($timediff{'versions'} == 2592000) {
1.78 bisitz 405: $headings{'versionchanges'} = &mt('Resources in '.$lctype.' with version changes since last month');
1.77 raeburn 406: } elsif ($timediff{'versions'} == 604800) {
1.78 bisitz 407: $headings{'versionchanges'} = &mt('Resources in '.$lctype.' with version changes since last week');
1.77 raeburn 408: } elsif ($timediff{'versions'} == 86400) {
1.78 bisitz 409: $headings{'versionchanges'} = &mt('Resources in '.$lctype.' with version changes since yesterday');
1.77 raeburn 410: }
411:
412: $timediff{'oldroles'} = $display_settings{$cid.':oldroleinterval'};
413: unless (defined($timediff{'oldroles'})) { $timediff{'oldroles'} = 604800; }
414: $interval{'oldroles'} = $interval_titles->{'oldroles'}->{$timediff{'oldroles'}};
415:
416: if ($timediff{'oldroles'} == -1) {
1.78 bisitz 417: $headings{'oldroles'} = &mt('Roles for which access to '.$lctype.' has expired since start of '.$lctype);
1.77 raeburn 418: } elsif ($timediff{'oldroles'} == 2592000) {
1.78 bisitz 419: $headings{'oldroles'} = &mt('Roles for which access to '.$lctype.' has expired since last month');
1.77 raeburn 420: } elsif ($timediff{'oldroles'} == 604800) {
1.78 bisitz 421: $headings{'oldroles'} = &mt('Roles for which access to '.$lctype.' has expired since last week');
1.77 raeburn 422: } elsif ($timediff{'oldroles'} == 86400) {
1.78 bisitz 423: $headings{'oldroles'} = &mt('Roles for which access to '.$lctype.' has expired since yesterday');
1.77 raeburn 424: }
425:
426: $timediff{'newroles'} = $display_settings{$cid.':newroleinterval'};
427: unless (defined($timediff{'newroles'})) { $timediff{'newroles'} = 604800; }
428: $interval{'newroles'} = $interval_titles->{'newroles'}->{$timediff{'newroles'}};
429:
430: if ($timediff{'newroles'} == -1) {
1.78 bisitz 431: $headings{'newroles'} = &mt('Roles for which access to '.$lctype.' has become available since start of '.$lctype);
1.77 raeburn 432: } elsif ($timediff{'newroles'} == 2592000) {
1.78 bisitz 433: $headings{'newroles'} = &mt('Roles for which access to '.$lctype.' has become available since last month');
1.77 raeburn 434: } elsif ($timediff{'newroles'} == 604800) {
1.78 bisitz 435: $headings{'newroles'} = &mt('Roles for which access to '.$lctype.' has become available since last week');
1.77 raeburn 436: } elsif ($timediff{'newroles'} == 86400) {
1.78 bisitz 437: $headings{'newroles'} = &mt('Roles for which access to '.$lctype.' has become available since yesterday');
1.77 raeburn 438: }
1.33 raeburn 439:
1.35 raeburn 440: my $now = time;
1.77 raeburn 441: if ($timediff{'versions'} == -1) {
442: $timediff{'versions'} = time;
443: }
444: my $starttime = $now - $timediff{'versions'};
445:
446: if ($timediff{'newroles'} == -1) {
447: $timediff{'newroles'} = time;
448: }
449: my $activatedstart = $now - $timediff{'newroles'};
450:
451: if ($timediff{'oldroles'} == -1) {
452: $timediff{'oldroles'} = time;
453: }
454: my $expiredstart = $now - $timediff{'oldroles'};
455:
1.39 raeburn 456: my $countunread = $display_settings{$cid.':countunread'};
457: unless (defined($countunread)) {
458: $countunread = 'on';
459: }
1.36 raeburn 460: if ($$checkallowed{'abovethreshold'}) {
1.39 raeburn 461: &get_curr_thresholds(\%threshold,$uname,$udom,$cid,$cdom,$crs);
1.33 raeburn 462: }
463:
1.59 albertel 464: $headings{'abovethreshold'} =
1.80 ! raeburn 465: &mt('(Problems with av. attempts ≥ [_1] or deg. difficulty ≥ [_2]) [_3] and total number of '.$stulabel{$crstype}.' with submissions ≥ [_4]',
1.59 albertel 466: $threshold{'av_attempts'},$threshold{'degdiff'},
1.80 ! raeburn 467: '<br />',$threshold{'numstudents'});
1.33 raeburn 468:
1.77 raeburn 469: my @actionorder = ('handgrading','haserrors','abovethreshold','versionchanges','coursediscussion','coursenormalmail','coursecritmail','newroles','oldroles');
1.33 raeburn 470:
1.36 raeburn 471: foreach my $key (keys(%{$checkallowed})) {
1.44 albertel 472: if ($key =~ /_section$/) { next; }
1.33 raeburn 473: $show{$key} = 0;
1.36 raeburn 474: if ($$checkallowed{$key}) {
475: unless ($display_settings{$cid.':'.$key} eq 'hide') {
1.33 raeburn 476: $show{$key} = 1;
477: }
478: }
479: }
480:
481: foreach my $item (@actionorder) {
1.77 raeburn 482: unless ($item eq 'coursenormalmail' || $item eq 'coursecritmail' ||
483: $item eq 'newroles' || $item eq 'oldroles') {
1.33 raeburn 484: if ($show{$item}) {
485: $needitems = 1;
486: last;
487: }
488: }
489: }
490:
491: if ($needitems) {
1.68 raeburn 492: &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread);
1.1 raeburn 493: }
1.33 raeburn 494: if ($show{'coursenormalmail'}) {
1.50 raeburn 495: $msgcount = &getnormalmail(\@newmsgs);
1.7 raeburn 496: }
1.33 raeburn 497: if ($show{'coursecritmail'}) {
1.50 raeburn 498: $critmsgcount = &getcritmail(\@critmsgs);
1.11 raeburn 499: }
1.77 raeburn 500: if ($show{'oldroles'}) {
501: $expirecount = &getexpired(\%expired,$expiredstart,'previous');
502: }
503: if ($show{'newroles'}) {
504: $activecount = &getactivated(\%activated,$activatedstart,'active');
505: }
1.36 raeburn 506: $r->print(qq|<a href="javascript:changeAll('hide');">$lt{'hial'}</a>
507: <a href="javascript:changeAll('show');">$lt{'shal'}</a>
508: <form method="post" name="visible" action="/adm/whatsnew">\n|);
509: foreach my $item (keys(%{$checkallowed})) {
1.44 albertel 510: if ($item =~ /_section$/) { next; }
1.36 raeburn 511: if ($$checkallowed{$item}) {
512: $r->print('<input type="hidden" name="display_'.$item.'" />'."\n");
513: }
514: }
1.1 raeburn 515:
1.73 raeburn 516: $r->print('<input type="hidden" name="refpage" value="'.$refpage.'" /></form><table class="LC_double_column"><tr><td class="LC_left_col">');
1.1 raeburn 517:
1.33 raeburn 518: my $displayed = 0;
1.40 raeburn 519: my $totalboxes = 0;
520: foreach my $key (keys(%{$checkallowed})) {
1.44 albertel 521: if ($key =~ /_section$/) { next; }
522: if ($key eq 'whatsnew' ) { next; } # whatsnew check creates no box
1.40 raeburn 523: if ($$checkallowed{$key}) {
524: $totalboxes ++;
525: }
526: }
1.77 raeburn 527: my $halfway = 4;
528: # my $halfway = int($totalboxes/2) + $totalboxes%2;
1.33 raeburn 529: foreach my $actionitem (@actionorder) {
1.36 raeburn 530: if ($$checkallowed{$actionitem}) {
1.33 raeburn 531: if ($displayed == $halfway) {
1.73 raeburn 532: $r->print('</td><td> </td><td class="LC_right_col" >');
1.1 raeburn 533: }
1.77 raeburn 534: &display_launcher($r,$actionitem,$refpage,$checkallowed,\%show,\%headings,\%res_title,\@tograde,\%ungraded,\@bombs,\%bombed,\%changed,\@warnings,\%triggered,\@newdiscussions,\%unread,$msgcount,\@newmsgs,$critmsgcount,\@critmsgs,\%interval,$countunread,\%expired,$expirecount,\%activated,$activecount,$crstype);
1.33 raeburn 535: $displayed ++;
1.1 raeburn 536: }
537: }
538: $r->print('
1.33 raeburn 539: </td>
540: </tr>
1.73 raeburn 541: </table>
542: ');
1.1 raeburn 543: }
544:
1.11 raeburn 545: #-------------------------------
1.36 raeburn 546: # display_threshold_config
1.11 raeburn 547: #
1.13 raeburn 548: # Display the threshold setting screen
1.11 raeburn 549: #
550: #-------------------------------
551:
1.36 raeburn 552: sub display_threshold_config {
1.69 raeburn 553: my ($r,$refpage,$threshold_titles,$cdom,$crs) = @_;
1.39 raeburn 554: my $uname = $env{'user.name'};
555: my $udom = $env{'user.dom'};
556: my $cid = $env{'request.course.id'};
1.13 raeburn 557: my %threshold = ();
558: my $rowColor1 = "#ffffff";
559: my $rowColor2 = "#eeeeee";
560: my $rowColor;
561:
562: my @thresholditems = ("av_attempts","degdiff","numstudents");
1.39 raeburn 563: my %threshold_titles = &Apache::lonlocal::texthash(
1.13 raeburn 564: av_attempts => 'Average number of attempts',
565: degdiff => 'Degree of difficulty',
566: numstudents => 'Total number of students with submissions',
567: );
1.39 raeburn 568: &get_curr_thresholds(\%threshold,$uname,$udom,$cid,$cdom,$crs);
1.13 raeburn 569:
1.68 raeburn 570: $r->print('<br /><form name="thresholdform" method="post" action="/adm/whatsnew">'.
571: &Apache::loncommon::start_data_table().
572: &Apache::loncommon::start_data_table_header_row().
1.70 raeburn 573: '<th>'.&mt('Threshold Name').'</th>'."\n".
574: '<th>'.&mt('Current value').'</th>'."\n".
575: '<th>'.&mt('Change?').'</th>'."\n".
1.68 raeburn 576: &Apache::loncommon::end_data_table_header_row());
1.13 raeburn 577: foreach my $type (@thresholditems) {
1.39 raeburn 578: my $parameter = $env{'request.course.id'}.':threshold_'.$type;
1.13 raeburn 579: # onchange is javascript to automatically check the 'Set' button.
580: my $onchange = 'onFocus="javascript:window.document.forms'.
581: "['thresholdform'].elements['".$parameter."_setparmval']".
582: '.checked=true;"';
1.68 raeburn 583: $r->print(&Apache::loncommon::start_data_table_row()."\n".
584: '<td>'.$threshold_titles{$type}.'</td>'."\n".
585: '<td>'.&Apache::lonhtmlcommon::textbox($parameter.'_value',
1.13 raeburn 586: $threshold{$type},
1.68 raeburn 587: 10,$onchange).'</td>'."\n".
588: '<td>'.
589: &Apache::lonhtmlcommon::checkbox($parameter.'_setparmval').
590: '</td>'."\n".
591: &Apache::loncommon::end_data_table_row());
1.13 raeburn 592: }
1.68 raeburn 593: $r->print(&Apache::loncommon::end_data_table()."\n".
1.74 bisitz 594: '<br /><input type="submit" name="threshold" value="'.&mt('Make changes').'" />
1.36 raeburn 595: <input type="hidden" name="command" value="update" />
1.39 raeburn 596: <input type="hidden" name="refpage" value="'.$refpage.'" />
1.13 raeburn 597: </form>');
1.11 raeburn 598: }
599:
1.36 raeburn 600: #-------------------------------
601: # display_interval_config
602: #
603: # Display the interval setting screen
604: #
605: #-------------------------------
606:
607: sub display_interval_config {
1.77 raeburn 608: my ($r,$refpage,$interval_titles,$context) = @_;
609: my $setting = 'interval';
610: if ($context eq 'oldroles') {
611: $setting = 'oldroleinterval';
612: } elsif ($context eq 'newroles') {
613: $setting = 'newroleinterval';
614: }
1.59 albertel 615: my $lctype = lc(&Apache::loncommon::course_type());
1.39 raeburn 616: my $current = &get_current($env{'user.name'},$env{'user.domain'},
1.77 raeburn 617: $env{'request.course.id'},$setting);
618: if ($context eq 'oldroles') {
619: $r->print('<br />'.&mt('Choose the time window to use to display roles for which access to the '.$lctype.' expired.').'<br />');
620: } elsif ($context eq 'newroles') {
621: $r->print('<br />'.&mt('Choose the time window to use to display roles for which access to the '.$lctype.' became available.').'<br />');
622: } else {
623: $r->print('<br />'.&mt('Choose the time window to use to display resources in the '.$lctype.' with version changes.').'<br />');
624: }
1.36 raeburn 625: unless ($current eq '') {
1.77 raeburn 626: if (ref($interval_titles->{$context}) eq 'HASH') {
627: $r->print(' '.&mt('Current value is "[_1]".','<b>'.
628: $interval_titles->{$context}->{$current}.'</b>').'<br />');
629: }
1.36 raeburn 630: }
1.77 raeburn 631: $r->print('<br />
1.36 raeburn 632: <form method="post" name="intervalswitch" action="/adm/whatsnew">
633: <input type="hidden" name="command" value="newinterval" />
1.77 raeburn 634: <input type="hidden" name="intervaltype" value="'.$context.'" />
635: <input type="hidden" name="refpage" value="'.$refpage.'" />'.
636: &mt('Display:').'
1.36 raeburn 637: <select name="interval">
1.78 bisitz 638: <option value="" selected="selected">'.&mt('Select').'</option>
1.36 raeburn 639: ');
1.77 raeburn 640: if (ref($interval_titles) eq 'HASH') {
641: if (ref($interval_titles->{$context}) eq 'HASH') {
642: foreach my $key (reverse sort ({$a cmp $b} (keys(%{$interval_titles->{$context}})))) {
1.78 bisitz 643: $r->print('<option value="'.$key.'">'.&mt($interval_titles->{$context}->{$key}).
1.77 raeburn 644: '</option>'."\n");
645: }
646: }
1.36 raeburn 647: }
648: $r->print('</select>
649: <input type="submit" name="display" value="'.
650: &mt('Change interval').'" /></form>');
651: return;
652: }
653:
1.39 raeburn 654: #----------------------------------------------
655: # display_discussion_config
656: #
657: # Display the discussion display setting screen
658: #
659: #----------------------------------------------
660:
661: sub display_discussion_config {
662: my ($r,$refpage) = @_;
663: my $current = &get_current($env{'user.name'},$env{'user.domain'},
664: $env{'request.course.id'},'countunread');
665: if ($current eq '') {
666: $current = 'on';
667: }
1.47 raeburn 668: my %opposite = (
669: 'on' => 'off',
670: 'off' => 'on',
671: );
672: $r->print('<script type="text/javascript">
673: function toggle_countunread(choice) {
674: if (choice == "unchanged") {
675: document.discussionswitch.command.value = "";
676: }
677: document.discussionswitch.submit();
678: }
679: </script>');
1.70 raeburn 680: $r->print('<br />'.&mt('Choose whether or not to display a count of the number of new posts for each resource or bulletin board which has unread posts.').'<br />'.&mt("This can increase the time taken to gather data for the '<i>What's New?</i>' page by a few seconds.").' '.&mt("Currently set to <b>$current</b>."));
1.39 raeburn 681: $r->print('<br /><br />
1.47 raeburn 682: <form method="post" name="discussionswitch" action="/adm/whatsnew">
1.39 raeburn 683: <input type="hidden" name="command" value="newdiscconf" />
684: <input type="hidden" name="refpage" value="'.$refpage.'" />
1.47 raeburn 685: <input type="hidden" name="countunread" value="'.$opposite{$current}.'" />
1.39 raeburn 686: ');
1.47 raeburn 687: $r->print('<br/>
688: <input type="button" name="display" value="'.
1.74 bisitz 689: &mt('Change to [_1]',&mt($opposite{$current})).'"
1.47 raeburn 690: onclick="javascript:toggle_countunread('."'change'".')" />
691:  
692: <input type="button" name="nochange" value="'.
693: &mt("No change").'"
694: onclick="javascript:toggle_countunread('."'unchanged'".')" />
695: </form>');
1.39 raeburn 696: return;
697: }
698:
699: #---------------------------------------------------
700: # courseinit_config
701: #
702: # Set page displayed when course loads after
703: # selecting a role in the course from the roles page.
704: #
705: #---------------------------------------------------
706:
707: sub courseinit_config {
708: my ($r,$refpage,$initpage) = @_;
709: my ($control,$current) = &curr_courseinit();
710: my @chgstate = ('userpref','coursespecific');
711: my @chgentry = ('firstres','whatsnew');
1.59 albertel 712: my $lctype = lc(&Apache::loncommon::course_type());
1.39 raeburn 713: my %lt = &Apache::lonlocal::texthash(
1.56 raeburn 714: 'chwp' => "Choose which page will be displayed when you enter this $lctype after selecting a role.",
1.39 raeburn 715: 'cuva' => 'Current value is determined by',
716: 'anis' => 'and is set to display',
717: 'padc' => 'Page display controlled by',
1.56 raeburn 718: 'chce' => 'Choose '.$lctype.' entry',
719: 'moce' => 'Modify '.$lctype.' entry',
1.39 raeburn 720: );
721: $r->print(<<"END");
722: <br />$lt{'chwp'}
723: <br />$lt{'cuva'}: <b>
724: $$initpage{$control}</b> $lt{'anis'} <b>
725: $$initpage{$current}</b>.<br /><br />
726: <form method="post" name="courseinitswitch" action="/adm/whatsnew">
727: <input type="hidden" name="command" value="newcourseinit" />
728: <input type="hidden" name="refpage" value="$refpage" />
1.56 raeburn 729: $lt{'padc'}:
1.39 raeburn 730: END
731: foreach my $choice (@chgstate) {
1.56 raeburn 732: my $chkstring;
733: if ($choice eq $control) {
734: $chkstring = ' checked="checked" ';
735: }
1.73 raeburn 736: $r->print('<span class="LC_nobreak"><label><input type="radio" name="courseinit_control" value="'.
1.56 raeburn 737: $choice.'"'.$chkstring.'/>'.$$initpage{$choice}.
1.73 raeburn 738: ' </label></span>');
1.39 raeburn 739: }
740: $r->print('<br /><br />'.&mt('If').' '.$$initpage{'coursespecific'}.
1.56 raeburn 741: ' - <br />'.$lt{'chce'}.": \n");
1.39 raeburn 742: foreach my $choice (@chgentry) {
1.56 raeburn 743: my $chkstring;
744: if (($choice eq $current) && ($control eq 'coursespecific')) {
745: $chkstring = ' checked="checked" ';
746: }
1.73 raeburn 747: $r->print('<span class="LC_nobreak"><label><input type="radio" name="courseinit_page" value="'.
1.56 raeburn 748: $choice.'"'.$chkstring.'/>'.$$initpage{$choice}.
1.73 raeburn 749: ' </label></span>');
1.39 raeburn 750: }
751: $r->print('<br /><br /><input type="submit" name="display" value="'.
752: $lt{'moce'}.'" /></form>');
753: return;
754: }
755:
756: sub curr_courseinit {
757: my $current = &get_current($env{'user.name'},$env{'user.domain'},
758: $env{'request.course.id'},'courseinit');
759: my $control;
1.40 raeburn 760: if ($current) {
761: $control = 'coursespecific';
762: } else {
1.39 raeburn 763: $control = 'userpref';
1.40 raeburn 764: my %userenv = &Apache::lonnet::get('environment',
765: ['course_init_display']);
766: if (exists($userenv{'course_init_display'})) {
767: $current = $userenv{'course_init_display'};
768: }
769: unless ($current) {
1.39 raeburn 770: $current = 'whatsnew';
771: }
772: }
773: return ($control,$current);
774: }
775:
1.33 raeburn 776: sub display_launcher {
1.69 raeburn 777: my ($r,$action,$refpage,$checkallowed,$show,$headings,$res_title,
1.68 raeburn 778: $tograde,$ungraded,$bombs,$bombed,$changed,$warnings,$triggered,
779: $newdiscussions,$unread,$msgcount,$newmsgs,$critmsgcount,$critmsgs,
1.77 raeburn 780: $interval,$countunread,$expired,$expirecount,$activated,$activecount,
781: $crstype) = @_;
1.33 raeburn 782:
783: if ($$checkallowed{$action}) {
1.69 raeburn 784: &start_box($r,$show,$headings,$action,$refpage,$action);
1.33 raeburn 785: if ($$show{$action}) {
786: if ($action eq 'handgrading') { # UNGRADED ITEMS
1.68 raeburn 787: &display_handgrade($r,$tograde,$ungraded);
1.33 raeburn 788: } elsif ($action eq 'haserrors') { # BOMBS
1.68 raeburn 789: &display_haserrors($r,$bombs,$bombed,$res_title);
1.33 raeburn 790: } elsif ($action eq 'versionchanges') { # VERSION CHANGES
1.77 raeburn 791: &display_versionchanges($r,$changed,$res_title,$interval->{'versions'});
1.33 raeburn 792: } elsif ($action eq 'abovethreshold') { # DEGDIFF/AV. TRIES TRIGGERS
1.39 raeburn 793: &display_abovethreshold($r,$refpage,$warnings,$triggered,
1.61 albertel 794: $res_title);
1.33 raeburn 795: } elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION
796: &display_coursediscussion($r,$newdiscussions,$unread,
1.68 raeburn 797: $countunread,$res_title);
1.33 raeburn 798: } elsif ($action eq 'coursenormalmail') { # NORMAL MESSAGES
1.68 raeburn 799: &display_coursenormalmail($r,$msgcount,$newmsgs);
1.33 raeburn 800: } elsif ($action eq 'coursecritmail') { # CRITICAL MESSAGES
1.68 raeburn 801: &display_coursecritmail($r,$critmsgcount,$critmsgs);
1.77 raeburn 802: } elsif ($action eq 'newroles') { # ACTIVATED ROLES
803: &display_rolechanges($r,$activecount,$activated,$interval->{'newroles'},
804: $crstype);
805: } elsif ($action eq 'oldroles') { # EXPIRED ROLES
806: &display_rolechanges($r,$expirecount,$expired,$interval->{'oldroles'},
807: $crstype);
1.33 raeburn 808: }
809: }
810: &end_box($r);
811: }
812: return;
813: }
814:
1.1 raeburn 815: sub getitems {
1.33 raeburn 816: my ($unread,$ungraded,$bombed,$triggered,$changed,$newdiscussions,
1.68 raeburn 817: $tograde,$bombs,$warnings,$threshold,$cdom,$crs,$res_title,$show,
818: $starttime,$countunread) = @_;
1.1 raeburn 819: my $navmap = Apache::lonnavmaps::navmap->new();
1.26 albertel 820: # force retrieve Resource to seed the part id cache we'll need it later
1.37 raeburn 821: my @allres=$navmap->retrieveResources(undef,
822: sub {if ($_[0]->is_problem) { $_[0]->parts();} return 1;});
1.33 raeburn 823: my %resourcetracker;
1.37 raeburn 824: my $discussiontime;
1.33 raeburn 825:
826: # Resource version changes
827: if ($$show{'versionchanges'}) {
828: &checkversions($cdom,$crs,$navmap,$changed,$starttime);
829: }
830:
831: if ($$show{'abovethreshold'}) {
832: %resourcetracker = &Apache::lonnet::dump('nohist_resourcetracker',
833: $cdom,$crs);
834: }
1.1 raeburn 835:
836: foreach my $resource (@allres) {
837: my $result = '';
838: my $applies = 0;
839: my $symb = $resource->symb();
1.33 raeburn 840: %{$$bombed{$symb}} = ();
1.1 raeburn 841: %{$$ungraded{$symb}} = ();
1.11 raeburn 842: %{$$triggered{$symb}} = ();
843: $$triggered{$symb}{numparts} = 0;
1.66 raeburn 844: if ($resource->encrypted()) {
845: $$triggered{$symb}{'enclink'} = $resource->link();
846: $$triggered{$symb}{'encsymb'} = $resource->shown_symb();
847: }
1.1 raeburn 848: my $title = $resource->compTitle();
1.16 raeburn 849: $$res_title{$symb} = $title;
1.8 albertel 850: my $ressymb = $resource->wrap_symb();
1.33 raeburn 851:
1.37 raeburn 852: # Check if there are unread discussion postings
1.33 raeburn 853: if ($$show{'coursediscussion'}) {
1.51 albertel 854: &check_discussions($resource,$symb,$ressymb,$title,
855: $newdiscussions,$unread,$countunread);
1.33 raeburn 856: }
1.1 raeburn 857:
858: # Check for ungraded problems
859: if ($resource->is_problem()) {
1.33 raeburn 860: if ($$show{'handgrading'}) {
861: &check_handgraded($resource,$symb,$title,$cdom,$crs,$ungraded,
862: $tograde);
863: }
1.1 raeburn 864: }
865:
866: # Check for bombs
1.33 raeburn 867: if ($$show{'haserrors'}) {
868: &check_bombed($resource,$symb,$title,$bombs,$bombed);
869: }
870:
871: # Maxtries and degree of difficulty for problem parts, unless handgradeable
872: if ($$show{'abovethreshold'}) {
1.61 albertel 873: &check_thresholds($resource,$symb,\%resourcetracker,
874: $triggered,$threshold,$warnings);
1.33 raeburn 875: }
876:
877: }
878: }
879:
880: sub check_discussions {
1.51 albertel 881: my ($resource,$symb,$ressymb,$title,$newdiscussions,$unread,
882: $countunread) = @_;
883:
884: if (!$resource->hasDiscussion()) { return; }
1.37 raeburn 885:
1.51 albertel 886: %{$$unread{$ressymb}} = ();
887: $$unread{$ressymb}{'title'} = $title;
888: $$unread{$ressymb}{'symb'} = $symb;
1.66 raeburn 889: if ($resource->encrypted()) {
890: $$unread{$ressymb}{'enclink'} = $resource->link();
891: $$unread{$ressymb}{'encsymb'} = $resource->shown_symb();
892: }
1.51 albertel 893: push(@{$newdiscussions}, $ressymb);
894:
895: $$unread{$ressymb}{'lastpost'} = $resource->last_post_time();
896:
897: if ($countunread eq 'on') {
1.67 raeburn 898: $$unread{$ressymb}{'unreadcount'} =
899: $resource->discussion_info('unread');
1.33 raeburn 900: }
901: }
902:
903: sub check_handgraded {
904: my ($resource,$symb,$title,$cdom,$cnum,$ungraded,$tograde) = @_;
905: if ($resource->is_problem()) {
906: my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);
907: my $partlist=$resource->parts();
908: my $handgradeable;
909: foreach my $part (@$partlist) {
1.31 raeburn 910: if ($resource->handgrade($part) eq 'yes') {
1.33 raeburn 911: $handgradeable=1; last;
1.31 raeburn 912: }
1.33 raeburn 913: }
914: if ($handgradeable) {
1.35 raeburn 915: my @ungraded = &Apache::bridgetask::get_queue_symb_status(
1.33 raeburn 916: 'gradingqueue',$symb,$cdom,$cnum);
917: if (@ungraded > 0) {
918: $$ungraded{$symb}{count} = scalar(@ungraded);
919: $$ungraded{$symb}{title} = $title;
1.66 raeburn 920: if ($resource->encrypted()) {
921: $$ungraded{$symb}{'enclink'} = $resource->link();
922: $$ungraded{$symb}{'encsymb'} = $resource->shown_symb();
923: }
924: push(@{$tograde},$symb);
1.11 raeburn 925: }
926: }
1.33 raeburn 927: }
928: }
929:
930: sub check_bombed {
931: my ($resource,$symb,$title,$bombs,$bombed) = @_;
932: if ($resource->getErrors()) {
933: my $errors = $resource->getErrors();
934: $errors =~ s/^,//;
935: my @bombs = split(/,/, $errors);
936: my $errorcount = scalar(@bombs);
937: my $errorlink = '<a href="/adm/email?display='.
1.55 www 938: &escape($bombs[0]).'">'.
1.33 raeburn 939: $title.'</a>';
940: $$bombed{$symb}{errorcount} = $errorcount;
941: $$bombed{$symb}{errorlink} = $errorlink;
942: push(@{$bombs}, $symb);
943: }
944: }
945:
946: sub check_thresholds {
1.61 albertel 947: my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings) = @_;
1.33 raeburn 948: # Compile maxtries and degree of difficulty for problem parts, unless handgradeable
949: my @parts = @{$resource->parts()};
950: my %stats;
951: my %lastreset = ();
952: my $warning = 0;
953: foreach my $part (@parts) {
954: if ($resource->handgrade($part) eq 'yes') {
955: next;
956: }
1.48 raeburn 957: if ($resource->is_survey($part)) {
958: next;
959: }
1.33 raeburn 960: %{$stats{$part}} = ();
961: my ($attempts,$users,$corrects,$degdiff,$av_attempts);
962: if (exists($$resourcetracker{$symb."\0".$part."\0attempts"})) {
963: $attempts = $$resourcetracker{$symb."\0".$part."\0attempts"};
964: }
965: if (exists($$resourcetracker{$symb."\0".$part."\0users"})) {
966: $users = $$resourcetracker{$symb."\0".$part."\0users"};
967: }
968: if (exists($$resourcetracker{$symb."\0".$part."\0correct"})) {
969: $corrects = $$resourcetracker{$symb."\0".$part."\0correct"};
970: }
971: if ($attempts > 0) {
972: $degdiff = 1 - ($corrects/$attempts);
973: $degdiff = sprintf("%.2f",$degdiff);
974: }
975: if ($users > 0) {
976: $av_attempts = $attempts/$users;
977: $av_attempts = sprintf("%.2f",$av_attempts);
978: }
979: if ((($degdiff ne '' && $degdiff >= $$threshold{'degdiff'}) || ($av_attempts ne '' && $av_attempts >= $$threshold{'av_attempts'})) && ($users >= $$threshold{'numstudents'})) {
980: $stats{$part}{degdiff} = $degdiff;
981: $stats{$part}{attempts} = $av_attempts;
982: $stats{$part}{users} = $users;
983: $lastreset{$part} = $$resourcetracker{$symb."\0".$part."\0resettime"};
984: if ($lastreset{$part}) {
985: $lastreset{$part} = &Apache::lonnavmaps::timeToHumanString($lastreset{$part});
1.11 raeburn 986: }
1.33 raeburn 987: $warning = 1;
988: }
989: }
990: if ($warning) {
991: $$triggered{$symb}{title} = $resource->title;
1.62 raeburn 992: my $partcount = 0;
993: @{$$triggered{$symb}{text}} = ();
1.33 raeburn 994: foreach my $part (@parts) {
995: if (exists($stats{$part}{users})) {
1.55 www 996: my $resetname = 'reset_'.&escape($symb."\0".$part);
997: my $resettitle = 'title_'.&escape($symb."\0".$part);
1.33 raeburn 998: if (@parts > 1) {
1.62 raeburn 999: $$triggered{$symb}{text}[$partcount] = '
1.74 bisitz 1000: <td>'.&mt('part - ').$part.'</td>';
1.33 raeburn 1001: } else {
1.62 raeburn 1002: $$triggered{$symb}{text}[$partcount] = '
1.74 bisitz 1003: <td>'.&mt('single part').'</td>';
1.11 raeburn 1004: }
1.62 raeburn 1005: $$triggered{$symb}{text}[$partcount] .= '
1.61 albertel 1006: <td>'.$stats{$part}{users}.'</td>
1007: <td>'.$stats{$part}{attempts}.'</td>
1008: <td>'.$stats{$part}{degdiff}.'</td>
1009: <td>'.$lastreset{$part}.'</td>
1.62 raeburn 1010: <td><input type="checkbox" name="'.$resetname.'" /><input type="hidden" name="'.$resettitle.'" value="'.&escape($$triggered{$symb}{title}).'" /></td>';
1011: $partcount ++;
1.11 raeburn 1012: }
1.62 raeburn 1013: $$triggered{$symb}{numparts} = $partcount;
1.11 raeburn 1014: }
1.33 raeburn 1015: push(@{$warnings},$symb);
1.1 raeburn 1016: }
1017: }
1018:
1.33 raeburn 1019:
1.13 raeburn 1020: sub get_curr_thresholds {
1.39 raeburn 1021: my ($threshold,$uname,$udom,$cid,$cdom,$crs) = @_;
1.64 banghart 1022: # set default values
1023: %$threshold = (av_attempts => 2,
1024: degdiff => 0.5,
1025: numstudents => 2
1026: );
1.39 raeburn 1027: my %thresholdsettings = &Apache::lonnet::dump('nohist_whatsnew',$udom,
1028: $uname,$cid.':threshold');
1029: my $thresholdcount = 0;
1030: my ($tmp) = %thresholdsettings;
1.40 raeburn 1031: unless ($tmp =~ /^(con_lost|error|no_such_host)/i) {
1.39 raeburn 1032: foreach my $item (keys %{$threshold}) {
1033: if (exists($thresholdsettings{$cid.':threshold_'.$item})) {
1034: $$threshold{$item} =
1035: $thresholdsettings{$cid.':threshold_'.$item};
1036: $thresholdcount ++;
1037: }
1038: }
1.13 raeburn 1039: }
1.39 raeburn 1040: if ($thresholdcount == 3) {
1041: return;
1.13 raeburn 1042: }
1.39 raeburn 1043: my %coursesettings = &Apache::lonnet::dump('environment',
1044: $cdom,$crs,'internal.threshold');
1045: my ($temp) = %coursesettings;
1.40 raeburn 1046: unless ($temp =~ /^(con_lost|error|no_such_host)/i) {
1.39 raeburn 1047: foreach my $item (keys %{$threshold}) {
1048: unless (exists($thresholdsettings{$cid.':threshold_'.$item})) {
1049: if (exists($coursesettings{'internal.threshold_'.$item})) {
1050: $$threshold{$item} =
1051: $coursesettings{'internal.threshold_'.$item};
1052: }
1053: }
1054: }
1.13 raeburn 1055: }
1.39 raeburn 1056: return;
1.13 raeburn 1057: }
1058:
1.39 raeburn 1059: sub get_current {
1060: my ($uname,$udom,$cid,$caller) = @_;
1061: my $currvalue;
1062: my %settings = &Apache::lonnet::dump('nohist_whatsnew',$udom,$uname,$cid.
1063: ':'.$caller);
1.36 raeburn 1064: my ($tmp) = %settings;
1.40 raeburn 1065: unless ($tmp =~ /^(con_lost|error|no_such_host)/i) {
1.39 raeburn 1066: $currvalue = $settings{$cid.':'.$caller};
1.36 raeburn 1067: }
1.39 raeburn 1068: return $currvalue;
1.36 raeburn 1069: }
1070:
1.13 raeburn 1071: sub process_reset {
1072: my ($dom,$crs) = @_;
1.39 raeburn 1073: my $result = '<b>'.&mt('Counters reset for following problems (and parts):').
1074: '</b><br />';
1.13 raeburn 1075: my @agg_types = ('attempts','users','correct');
1.39 raeburn 1076: my %agg_titles = &Apache::lonlocal::texthash (
1.13 raeburn 1077: attempts => 'Number of submissions',
1078: users => 'Students with submissions',
1079: correct => 'Number of correct submissions',
1080: );
1081: my @resets = ();
1082: my %titles = ();
1.17 albertel 1083: foreach my $key (keys(%env)) {
1.13 raeburn 1084: next if ($key !~ /^form\.reset_(.+)$/);
1.55 www 1085: my $title = &unescape($env{'form.title_'.$1});
1086: my $reset_item = &unescape($1);
1.13 raeburn 1087: my %curr_aggregates = &Apache::lonnet::dump('nohist_resourcetracker',$dom,$crs,$reset_item);
1088: my %aggregates = ();
1.17 albertel 1089: my ($symb,$part) = split(/\0/,$reset_item);
1.13 raeburn 1090: foreach my $type (@agg_types) {
1091: $aggregates{$reset_item."\0".$type} = 0;
1092: }
1.17 albertel 1093: $aggregates{$reset_item."\0".'resettime'} = time;
1.13 raeburn 1094: my $putresult = &Apache::lonnet::put('nohist_resourcetracker',\%aggregates,
1095: $dom,$crs);
1096: if ($putresult eq 'ok') {
1097: $result .= $title.' -part '.$part.': ';
1098: my %new_aggregates = &Apache::lonnet::dump('nohist_resourcetracker',$dom,$crs,$reset_item);
1099: foreach my $type (@agg_types) {
1100: $result .= $agg_titles{$type}.' = '.$new_aggregates{$reset_item."\0".$type}.'; ';
1101: }
1102: $result =~ s/; $//;
1103: $result .= '<br />';
1104: } else {
1.14 albertel 1105: $result = $title.' -part '.$part.': '.&mt('Unable to reset counters to zero due to [_1]',$putresult).'.<br />'."\n";
1.13 raeburn 1106: }
1107: }
1108: return $result;
1109: }
1110:
1111: sub process_update {
1.39 raeburn 1112: my ($uname,$udom,$threshold_titles) = @_;
1.74 bisitz 1113: my $setoutput = '<b>'.&mt('Changes to threshold(s) for problem tracking:').'</b><br />';
1.13 raeburn 1114: foreach (keys %env) {
1115: next if ($_!~/^form\.(.+)\_setparmval$/);
1116: my $name = $1;
1117: my $value = $env{'form.'.$name.'_value'};
1.65 banghart 1118: if ($name && defined($value) && ($value ne '')) {
1.39 raeburn 1119: my $put_result = &Apache::lonnet::put('nohist_whatsnew',
1120: {$name=>$value},$udom,$uname);
1.13 raeburn 1121:
1.39 raeburn 1122: my ($shortname) = ($name =~ /^\Q$env{'request.course.id'}\E:threshold_(.+)$/);
1.13 raeburn 1123: if ($put_result eq 'ok') {
1.14 albertel 1124: $setoutput.=&mt('Set threshold for [_1] to [_2]',
1125: '<b>'.$$threshold_titles{$shortname}.'</b>',
1126: '<b>'.$value.'</b>').'<br />';
1127: } else {
1128: $setoutput.=&mt('Unable to set threshold for [_1] to [_2] due to [_3].',
1129: '<b>'.$name.'</b>','<b>'.$value.'</b>',
1130: '<tt>'.$put_result.'</tt>').'<br />';
1.13 raeburn 1131: }
1132: }
1133: }
1134: return $setoutput;
1135: }
1136:
1.33 raeburn 1137: sub getnormalmail {
1138: my ($newmsgs) = @_;
1.1 raeburn 1139: # Check for unread mail in course
1140: my $msgcount = 0;
1.3 albertel 1141:
1.10 raeburn 1142: my @messages = sort(&Apache::lonnet::getkeys('nohist_email'));
1.3 albertel 1143: foreach my $message (@messages) {
1.55 www 1144: my $msgid=&escape($message);
1.10 raeburn 1145: my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)=
1.1 raeburn 1146: &Apache::lonmsg::unpackmsgid($msgid);
1.10 raeburn 1147: if (($fromcid) && ($fromcid eq $env{'request.course.id'})) {
1.1 raeburn 1148: if (defined($sendtime) && $sendtime!~/error/) {
1149: my $numsendtime = $sendtime;
1150: $sendtime = &Apache::lonlocal::locallocaltime($sendtime);
1151: if ($status eq 'new') {
1.10 raeburn 1152: $msgcount ++;
1153: if ($shortsubj eq '') {
1154: $shortsubj = &mt('No subject');
1155: }
1.1 raeburn 1156: push(@{$newmsgs}, {
1157: msgid => $msgid,
1158: sendtime => $sendtime,
1.10 raeburn 1159: shortsub => $shortsubj,
1.1 raeburn 1160: from => $fromname,
1161: fromdom => $fromdom
1162: });
1163: }
1164: }
1165: }
1166: }
1.33 raeburn 1167: return $msgcount;
1168: }
1.1 raeburn 1169:
1.33 raeburn 1170: sub getcritmail {
1171: my ($critmsgs) = @_;
1.1 raeburn 1172: # Check for critical messages in course
1173: my %what=&Apache::lonnet::dump('critical');
1174: my $result = '';
1175: my $critmsgcount = 0;
1.3 albertel 1176: foreach my $msgid (sort(keys(%what))) {
1.10 raeburn 1177: my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)=
1178: &Apache::lonmsg::unpackmsgid($msgid);
1179: if (($fromcid) && ($fromcid eq $env{'request.course.id'})) {
1.1 raeburn 1180: if (defined($sendtime) && $sendtime!~/error/) {
1181: my $numsendtime = $sendtime;
1182: $sendtime = &Apache::lonlocal::locallocaltime($sendtime);
1183: $critmsgcount ++;
1.10 raeburn 1184: if ($shortsubj eq '') {
1185: $shortsubj = &mt('No subject');
1186: }
1.1 raeburn 1187: push(@{$critmsgs}, {
1188: msgid => $msgid,
1189: sendtime => $sendtime,
1.10 raeburn 1190: shortsub => $shortsubj,
1.1 raeburn 1191: from => $fromname,
1192: fromdom => $fromdom
1193: });
1194: }
1195: }
1196: }
1.33 raeburn 1197: return $critmsgcount;
1198: }
1199:
1.77 raeburn 1200: sub getexpired {
1201: my ($rolechgs,$rolechgtime,$status) = @_;
1202: my $expirecount = &getrolechanges($rolechgs,$rolechgtime,$status);
1203: return $expirecount;
1204: }
1205:
1206: sub getactivated {
1207: my ($rolechgs,$rolechgtime,$status) = @_;
1208: my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
1209: my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
1210: my $now = time();
1211: my $context = 'course';
1212: my ($permission,$allowed) =
1213: &Apache::lonuserutils::get_permission($context);
1214: my $viewablesec = &Apache::lonuserutils::viewable_section($permission);
1215: my %changes=&Apache::lonnet::dump('nohist_rolelog',$cdom,$cnum);
1216: my (%stucounted,%advcounted);
1217: my $activatedcount = 0;
1218: if (keys(%changes) > 0) {
1219: foreach my $chg (sort { $b <=> $a } (keys(%changes))) {
1220: if (ref($changes{$chg}) eq 'HASH') {
1221: my $timestamp = $changes{$chg}{'exe_time'};
1222: if ($timestamp) {
1.79 raeburn 1223: if ($rolechgtime > 0) {
1224: if ($timestamp < $rolechgtime) {
1.77 raeburn 1225: last;
1226: }
1227: }
1228: if (ref($changes{$chg}{'logentry'}) eq 'HASH') {
1229: next if ($changes{$chg}{'delflag'});
1230: my $start = $changes{$chg}{'logentry'}{'start'};
1231: my $end = $changes{$chg}{'logentry'}{'end'};
1232: my $section = $changes{$chg}{'logentry'}{'section'};
1233: my $role = $changes{$chg}{'logentry'}{'role'};
1234: my $uname = $changes{$chg}{'uname'};
1235: my $udom = $changes{$chg}{'udom'};
1236: next if ($end && $end <= $now);
1237: if (($viewablesec ne '') && ($section ne '')) {
1238: next if ($viewablesec ne $section);
1239: }
1240: next if ($start >= $timestamp);
1241: if ($role eq 'st') {
1242: $stucounted{$uname.':'.$udom.':'.$section} = $start.':'.$end;
1243: } else {
1244: $advcounted{$uname.':'.$udom.':'.$role.':'.$section} = $start.':'.$end;
1245: }
1246: my %chginfo = (
1247: 'section' => $section,
1248: 'uname' => $uname,
1249: 'udom' => $udom,
1250: 'role' => $role,
1251: 'status' => $status,
1252: );
1253: $activatedcount ++;
1254: push (@{$rolechgs->{$timestamp}},\%chginfo);
1255: }
1256: }
1257: }
1258: }
1259: }
1260: $activatedcount += &getrolechanges($rolechgs,$rolechgtime,$status,\%stucounted,\%advcounted);
1261: return $activatedcount;
1262: }
1263:
1264: sub getrolechanges {
1265: my ($rolechgs,$rolechgtime,$status,$stucountref,$advcountref) = @_;
1266: my (%stucounted,%advcounted);
1267: if (ref($stucountref) eq 'HASH') {
1268: %stucounted = %{$stucountref};
1269: }
1270: if (ref($advcountref) eq 'HASH') {
1271: %advcounted = %{$advcountref};
1272: }
1273: my $withsec = 1;
1274: my $hidepriv = 1;
1275: my $context = 'course';
1276: my @statuses = ($status);
1277: my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
1278: my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
1279: my $now = time();
1280: my ($permission,$allowed) =
1281: &Apache::lonuserutils::get_permission($context);
1282: my $viewablesec = &Apache::lonuserutils::viewable_section($permission);
1283: my $classlist = &Apache::loncoursedata::get_classlist();
1284: my $secidx = &Apache::loncoursedata::CL_SECTION();
1285: my $startidx = &Apache::loncoursedata::CL_START();
1286: my $endidx = &Apache::loncoursedata::CL_END();
1287: my $rolechgcount = 0;
1288: foreach my $key (keys(%{$classlist})) {
1289: my ($userstatus,$eventtime);
1290: my $student = $classlist->{$key};
1291: if (ref($student) eq 'ARRAY') {
1292: my $start = $student->[$startidx];
1293: my $end = $student->[$endidx];
1294: my $sec = $student->[$secidx];
1295: my ($stuname,$studom) = split(/:/,$key);
1296: if ($status eq 'active') {
1297: if (exists($stucounted{$key.':'.$sec})) {
1298: next;
1299: }
1300: }
1301: if (($end == 0) || ($end > $start)) {
1302: if ($start <= $now) {
1303: if ($end && $end < $now) {
1304: if ($rolechgtime > 0) {
1305: if ($end > $rolechgtime) {
1306: $userstatus = 'previous';
1307: }
1308: } else {
1309: $userstatus = 'previous';
1310: }
1311: } else {
1312: if ($rolechgtime > 0) {
1313: if ($start >= $rolechgtime) {
1314: $userstatus = 'active';
1315: }
1316: } else {
1317: $userstatus = 'active';
1318: }
1319: }
1320: }
1321: }
1322: next if ($userstatus ne $status);
1323: if ($status eq 'active') {
1324: $eventtime = $start;
1325: } else {
1326: $eventtime = $end;
1327: }
1328: if (($viewablesec ne '') && ($sec ne '')) {
1329: next if ($viewablesec ne $sec);
1330: }
1331: my %chginfo = (
1332: 'section' => $sec,
1333: 'uname' => $stuname,
1334: 'udom' => $studom,
1335: 'role' => 'st',
1336: 'status' => $userstatus,
1337: );
1338: $rolechgcount ++;
1339: push (@{$rolechgs->{$eventtime}},\%chginfo);
1340: }
1341: }
1342: my %advrolehash = &Apache::lonnet::get_my_roles($cnum,$cdom,undef,
1343: \@statuses,undef,undef,$withsec,$hidepriv);
1344: foreach my $item (keys(%advrolehash)) {
1345: my ($userstatus,$eventtime);
1346: my ($uname,$udom,$role,$section) = split(/:/,$item,-1);
1347: my ($start,$end) = split(/:/,$advrolehash{$item});
1348: if ($start eq '-1' && $end eq '-1') {
1349: next;
1350: } else {
1351: if ($status eq 'active') {
1352: if (exists($advcounted{$item})) {
1353: next;
1354: }
1355: }
1356: if (($end == 0) || ($end > $start)) {
1357: if ($start <= $now) {
1358: if ($end && $end < $now) {
1359: if ($rolechgtime > 0) {
1360: if ($end > $rolechgtime) {
1361: $userstatus = 'previous';
1362: }
1363: } else {
1364: $userstatus = 'previous';
1365: }
1366: } else {
1367: if ($rolechgtime > 0) {
1368: if ($start >= $rolechgtime) {
1369: $userstatus = 'active';
1370: }
1371: } else {
1372: $userstatus = 'active';
1373: }
1374: }
1375: }
1376: }
1377: next if ($userstatus ne $status);
1378: if ($status eq 'active') {
1379: $eventtime = $start;
1380: } else {
1381: $eventtime = $end;
1382: }
1383: }
1384: if (($viewablesec ne '') && ($section ne '')) {
1385: next if ($viewablesec ne $section);
1386: }
1387: my %chginfo = (
1388: 'section' => $section,
1389: 'uname' => $uname,
1390: 'udom' => $udom,
1391: 'role' => $role,
1392: 'status' => $userstatus,
1393: );
1394: $rolechgcount ++;
1395: push (@{$rolechgs->{$eventtime}},\%chginfo);
1396: }
1397: return $rolechgcount;
1398: }
1.33 raeburn 1399:
1400: sub checkversions {
1401: my ($cdom,$crs,$navmap,$changed,$starttime) = @_;
1402: my %changes=&Apache::lonnet::dump('versionupdate',$cdom,$crs);
1403: my ($tmp) = keys(%changes);
1.40 raeburn 1404: unless ($tmp =~ /^(con_lost|error|no_such_host)/i) {
1.33 raeburn 1405: if (keys(%changes) > 0) {
1406: foreach my $key (sort(keys(%changes))) {
1407: if ($changes{$key} > $starttime) {
1408: my $version;
1409: my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);
1410: my $currentversion=&Apache::lonnet::getversion($key);
1411: my $revdate =
1412: &Apache::lonnet::metadata($root.'.'.$extension,
1413: 'lastrevisiondate');
1414: $revdate = &Apache::lonlocal::locallocaltime($revdate);
1415: my $linkurl=&Apache::lonnet::clutter($key);
1416: my $usedversion=$navmap->usedVersion('version_'.$linkurl);
1417: my @resources = $navmap->getResourceByUrl($linkurl,1);
1418: if (($usedversion) && ($usedversion ne 'mostrecent')) {
1419: $version = $usedversion;
1420: } else {
1421: $version = $currentversion;
1422: }
1423: foreach my $res (@resources) {
1.35 raeburn 1424: if (ref($res) eq 'Apache::lonnavmaps::resource') {
1425: my $symb = $res->symb();
1426: %{$$changed{$symb}} = (
1.33 raeburn 1427: current => $currentversion,
1428: version => $version,
1429: revdate => $revdate,
1.35 raeburn 1430: );
1431: }
1.33 raeburn 1432: }
1433: }
1434: }
1435: }
1436: }
1437: return;
1438: }
1439:
1440: sub display_handgrade {
1.68 raeburn 1441: my ($r,$tograde,$ungraded) = @_;
1.33 raeburn 1442: my %lt = &Apache::lonlocal::texthash(
1443: 'prna' => 'Problem Name',
1444: 'nmun' => 'Number ungraded',
1445: 'nopr' => 'No problems require handgrading',
1446: );
1447: if (@{$tograde} > 0) {
1.68 raeburn 1448: $r->print('<tr class="LC_info_row"><td class="LC_left_item">'.
1449: $lt{'prna'}.'</td><td class="LC_right_item">'.
1450: $lt{'nmun'}.'</td></tr>');
1.33 raeburn 1451: my $rowNum = 0;
1452: foreach my $res (@{$tograde}) {
1.68 raeburn 1453: $rowNum ++;
1454: my $css_class = $rowNum%2?' class="LC_odd_row"':'';
1.33 raeburn 1455: my ($map,$id,$url)=&Apache::lonnet::decode_symb($res);
1456: my $linkurl=&Apache::lonnet::clutter($url);
1.55 www 1457: $linkurl .= '?symb='.&escape($res);
1.66 raeburn 1458: if ($$ungraded{$res}{'enclink'}) {
1459: $linkurl =
1460: $$ungraded{$res}{'enclink'}.'?symb='.$$ungraded{$res}{'encsymb'};
1461: }
1.68 raeburn 1462: $r->print('<tr'.$css_class.'><td><a href="'.$linkurl.'">'.$$ungraded{$res}{title}.'</a></td><td class="LC_right_item">'.$$ungraded{$res}{count}.'</td></tr>');
1.33 raeburn 1463: }
1464: } else {
1.68 raeburn 1465: $r->print('<tr class="LC_empty_row"><td>'.$lt{'nopr'}.'</td></tr>');
1.33 raeburn 1466: }
1467: }
1468:
1469: sub display_haserrors {
1.68 raeburn 1470: my ($r,$bombs,$bombed,$res_title) = @_;
1.33 raeburn 1471: my $bombnum = 0;
1472: my %lt = &Apache::lonlocal::texthash(
1473: reso => 'Resource',
1474: nmer => 'Number of errors',
1475: noer => 'No problems with errors',
1476: );
1477: if (@{$bombs} > 0) {
1.68 raeburn 1478: $r->print('<tr class="LC_info_row"><td class="LC_left_item">'.
1479: $lt{'reso'}.'</td><td class="LC_right_item">'.
1480: $lt{'nmer'}.'</td></tr>');
1.33 raeburn 1481: @{$bombs} = sort { &cmp_title($a,$b,$res_title) } @{$bombs};
1482: foreach my $bomb (@{$bombs}) {
1483: $bombnum ++;
1.68 raeburn 1484: my $css_class = $bombnum%2?' class="LC_odd_row"':'';
1485: $r->print('<tr'.$css_class.'><td>'.$$bombed{$bomb}{errorlink}.
1486: '</td><td class="LC_right_item">'.
1487: $$bombed{$bomb}{errorcount}.'</td></tr>');
1.33 raeburn 1488: }
1489: } else {
1.68 raeburn 1490: $r->print('<tr class="LC_empty_row"><td>'.$lt{'noer'}.'</td></tr>');
1.33 raeburn 1491: }
1492: return;
1493: }
1494:
1495: sub display_abovethreshold {
1.56 raeburn 1496: my ($r,$refpage,$warnings,$triggered,$res_title) = @_;
1.33 raeburn 1497: my %lt = &Apache::lonlocal::texthash(
1498: reso => 'Resource',
1499: part => 'Part',
1500: nust => 'Num. students',
1501: avat => 'Av. Attempts',
1502: dedi => 'Deg. Diff',
1503: lare => 'Last Reset',
1504: reco => 'Reset Count?',
1505: rese => 'Reset counters to 0',
1506: nopr => 'No problems satisfy threshold criteria',
1507: );
1508: if (@{$warnings} > 0) {
1509: @{$warnings} = sort { &cmp_title($a,$b,$res_title) } @{$warnings};
1.36 raeburn 1510: $r->print('<form name="reset_tracking" method="post" action="/adm/whatsnew">'.
1.39 raeburn 1511: ' <input type="hidden" name="command" value="reset" />'."\n".
1512: ' <input type="hidden" name="refpage" value="'.$refpage.'" />'.
1513: "\n");
1.61 albertel 1514: $r->print('<tr class="LC_info_row">'.
1.68 raeburn 1515: '<td class="LC_left_item">'.$lt{'reso'}.'</td>'.
1.61 albertel 1516: '<td>'.$lt{'part'}.'</td><td>'.$lt{'nust'}.'</td>'.
1517: '<td>'.$lt{'avat'}.'</td><td>'.$lt{'dedi'}.'</td>'.
1.68 raeburn 1518: '<td>'.$lt{'lare'}.'</td><td class="LC_right_item">'.
1519: $lt{'reco'}.'</td></tr>');
1.61 albertel 1520: my $row;
1.33 raeburn 1521: foreach my $res (@{$warnings}) {
1.61 albertel 1522: $row++;
1.33 raeburn 1523: my ($map,$id,$url)=&Apache::lonnet::decode_symb($res);
1524: my $linkurl=&Apache::lonnet::clutter($url);
1525: my $rowspan;
1526: if ($$triggered{$res}{numparts} > 1) {
1527: $rowspan = 'rowspan="'.$$triggered{$res}{numparts}.'"';
1528: }
1.55 www 1529: $linkurl .= '?symb='.&escape($res);
1.66 raeburn 1530: if ($$triggered{$res}{'enclink'}) {
1531: $linkurl =
1532: $$triggered{$res}{'enclink'}.'?symb='.$$triggered{$res}{'encsymb'};
1533: }
1.68 raeburn 1534: my $css_class = $row%2?' class="LC_odd_row"':'';
1535: $r->print('<tr'.$css_class.'>'.
1.61 albertel 1536: '<td class="LC_first_item" '.$rowspan.'><a href="'.$linkurl.'">'.
1.62 raeburn 1537: $$triggered{$res}{title}.'</a></td>');
1538: if (ref($$triggered{$res}{text}) eq 'ARRAY') {
1539: $r->print($$triggered{$res}{text}[0]);
1540: }
1541: $r->print('</tr>');
1542: if (ref($$triggered{$res}{text}) eq 'ARRAY') {
1543: if (@{$$triggered{$res}{text}} > 1) {
1544: for (my $i=1; $i<@{$$triggered{$res}{text}}; $i++) {
1545: $r->print('<tr class="'.$css_class.'">'.
1546: $$triggered{$res}{text}[$i].'</tr>');
1547: }
1548: }
1549: }
1.33 raeburn 1550: }
1.68 raeburn 1551: $r->print('<tr class="LC_info_row"><td colspan="7" class="LC_right_item"><br /><input type="submit" name="counters" value="'.$lt{'rese'}.'" /></td></tr></form>');
1.33 raeburn 1552: } else {
1.63 albertel 1553: $r->print('<tr class="LC_empty_row"><td>'.$lt{'nopr'}.'</td></tr>');
1.33 raeburn 1554: }
1555: }
1556:
1557: sub display_versionchanges {
1.68 raeburn 1558: my ($r,$changed,$res_title,$interval) = @_;
1.33 raeburn 1559: my %lt = &Apache::lonlocal::texthash(
1560: 'reso' => 'Resource',
1561: 'revd' => 'Last revised',
1562: 'newv' => 'New version',
1563: 'veru' => 'Version used',
1564: );
1565: if (keys(%{$changed}) > 0) {
1.68 raeburn 1566: $r->print('<tr class="LC_info_row"><td class="LC_left_item">'.
1567: $lt{'reso'}.'</td><td>'.$lt{'revd'}.'</td><td>'.
1568: $lt{'newv'}.'</td><td class="LC_right_item">'.
1569: $lt{'veru'}.'</td></tr>');
1.33 raeburn 1570: my @changes = sort { &cmp_title($a,$b,$res_title) } keys(%{$changed});
1571: my $changenum = 0;
1572: foreach my $item (@changes) {
1.68 raeburn 1573: $changenum ++;
1574: my $css_class = $changenum%2?' class="LC_odd_row"':'';
1.33 raeburn 1575: my ($map,$id,$url)=&Apache::lonnet::decode_symb($item);
1576: my $linkurl=&Apache::lonnet::clutter($url);
1.55 www 1577: $linkurl .= '?symb='.&escape($item);
1.33 raeburn 1578:
1.68 raeburn 1579: $r->print('<tr'.$css_class.'><td><a href="'.$linkurl.'">'.
1580: $$res_title{$item}.'</a></td><td>'.
1581: $$changed{$item}{'revdate'}.'</td><td>'.
1582: $$changed{$item}{'current'}.'</td><td>'.
1583: $$changed{$item}{'version'}.'</td></tr>');
1.33 raeburn 1584: }
1585: } else {
1.78 bisitz 1586: $r->print('<tr class="LC_empty_row"><td>'
1587: .&mt('No '.$interval).'</td></tr>');
1.33 raeburn 1588: }
1589: return;
1590: }
1.77 raeburn 1591:
1592: sub display_rolechanges {
1593: my ($r,$chgcount,$changed,$interval,$crstype) = @_;
1594: my $now = time();
1595: my %lt = &Apache::lonlocal::texthash(
1596: 'user' => 'User',
1597: 'tich' => 'Time of change',
1598: 'role' => 'Role',
1599: 'sec' => 'Section',
1600: 'status' => 'Status',
1601: );
1602: if ($chgcount) {
1603: $r->print('<tr class="LC_info_row">'.
1604: '<td class="LC_left_item">'.$lt{'tich'}.'</td>'.
1605: '<td class="LC_left_item">'.$lt{'user'}.'</td>'.
1606: '<td class="LC_left_item">'.$lt{'role'}.'</td>'.
1607: '<td class="LC_left_item">'.$lt{'sec'}.'</td>'.
1608: '<td class="LC_left_item">'.$lt{'status'}.'</td></tr>');
1609: if (ref($changed) eq 'HASH') {
1610: my @changes = sort { $b <=> $a } (keys(%{$changed}));
1611: my $changenum = 0;
1612: foreach my $item (@changes) {
1613: if (ref($changed->{$item}) eq 'ARRAY') {
1614: foreach my $chg (@{$changed->{$item}}) {
1615: if (ref($chg) eq 'HASH') {
1616: my $section;
1617: my $role =
1618: &Apache::lonnet::plaintext($chg->{'role'},$crstype);
1619: my $status = &mt($chg->{'status'});
1620: if ($chg->{'section'} eq '') {
1621: $section = &mt('none');
1622: } else {
1623: $section = $chg->{'section'};
1624: }
1625: my $uname = $chg->{'uname'};
1626: my $udom = $chg->{'udom'};
1627: $changenum ++;
1628: my $css_class = $changenum%2?' class="LC_odd_row"':'';
1629: my $link =
1630: &Apache::loncommon::aboutmewrapper(&Apache::loncommon::plainname($uname,$udom),$uname,$udom);
1631: $r->print('<tr'.$css_class.'>'.
1632: '<td>'.&Apache::lonlocal::locallocaltime($item).'</td>'.
1633: '<td>'.$link.'</td>'.
1634: '<td>'.$role.'</td>'.
1635: '<td>'.$section.'</td>'.
1636: '<td>'.$status.'</td></tr>');
1637: }
1638: }
1639: }
1640: }
1641: }
1642: } else {
1.78 bisitz 1643: $r->print('<tr class="LC_empty_row"><td>'
1644: .&mt('There are no '.$interval).'</td></tr>');
1.77 raeburn 1645: }
1646: return;
1647: }
1.33 raeburn 1648:
1649: sub display_coursediscussion {
1.68 raeburn 1650: my ($r,$newdiscussions,$unread,$countunread,$res_title) = @_;
1.59 albertel 1651: my $lctype = lc(&Apache::loncommon::course_type());
1.33 raeburn 1652: my %lt = &Apache::lonlocal::texthash(
1653: 'loca' => 'Location',
1654: 'type' => 'Type',
1655: 'numn' => 'Number of new posts',
1.56 raeburn 1656: 'noun' => 'No unread posts in '.$lctype.' discussions',
1.37 raeburn 1657: 'tmlp' => 'Time of last post',
1.33 raeburn 1658: );
1659: if (@{$newdiscussions} > 0) {
1.68 raeburn 1660: $r->print('<tr class="LC_info_row"><td class="LC_left_item">'.
1661: $lt{'loca'}.'</td><td>'.
1662: $lt{'type'}.'</td>');
1.39 raeburn 1663: if ($countunread eq 'on') {
1.68 raeburn 1664: $r->print('<td>'.$lt{'tmlp'}.'</td>'.
1665: '<td class="LC_right_item">'.$lt{'numn'}.'</td>');
1.37 raeburn 1666: } else {
1.68 raeburn 1667: $r->print('<td class="LC_right_item">'.$lt{'tmlp'}.'</td>');
1.37 raeburn 1668: }
1669: $r->print("</tr>\n");
1.33 raeburn 1670: @{$newdiscussions} = sort { &cmp_title($a,$b,$res_title) }
1671: @{$newdiscussions};
1672: my $rowNum = 0;
1673: foreach my $ressymb (@{$newdiscussions}) {
1.68 raeburn 1674: $rowNum ++;
1.33 raeburn 1675: my $forum_title = $$unread{$ressymb}{'title'};
1676: my $type = 'Resource';
1677: my $feedurl=&Apache::lonfeedback::get_feedurl($ressymb);
1.66 raeburn 1678: my $disclink = $feedurl.'?symb='.$$unread{$ressymb}{symb};
1.33 raeburn 1679: if ($feedurl =~ /bulletinboard/) {
1680: $type = 'Bulletin Board';
1681: }
1.66 raeburn 1682: if ($$unread{$ressymb}{'enclink'}) {
1683: $disclink = $$unread{$ressymb}{'enclink'}.'?symb='.$$unread{$ressymb}{'encsymb'};
1684: }
1.68 raeburn 1685: my $css_class = $rowNum%2?' class="LC_odd_row"':'';
1.37 raeburn 1686: my $lastpost = &Apache::lonnavmaps::timeToHumanString(
1687: $$unread{$ressymb}{'lastpost'});
1.70 raeburn 1688: $r->print('<tr'.$css_class.'><td><a href="'.$disclink.'">'.$forum_title.'</a> </td><td>'.&mt($type).' </td>');
1.39 raeburn 1689: if ($countunread eq 'on') {
1.37 raeburn 1690: my $unreadnum = $$unread{$ressymb}{'unreadcount'};
1.68 raeburn 1691: $r->print('<td>'.$lastpost.'</td><td class="LC_right_item">'.
1692: $unreadnum.' </td>');
1.37 raeburn 1693: } else {
1.68 raeburn 1694: $r->print('<td class="LC_right_item">'.$lastpost.'</td>');
1.33 raeburn 1695: }
1.37 raeburn 1696: $r->print("</tr>\n");
1.33 raeburn 1697: }
1698: } else {
1.68 raeburn 1699: $r->print('<tr class="LC_empty_row"><td>'.$lt{'noun'}.'</td></tr>');
1.33 raeburn 1700: }
1701: }
1702:
1703: sub display_coursenormalmail {
1.68 raeburn 1704: my ($r,$msgcount,$newmsgs) = @_;
1.59 albertel 1705: my $lctype = lc(&Apache::loncommon::course_type());
1.33 raeburn 1706: if ($msgcount > 0) {
1.68 raeburn 1707: $r->print('<tr class="LC_info_row"><td class="LC_left_item">'.
1708: &mt('Number').'</td><td>'.&mt('Subject').'</td><td>'.
1709: &mt('Sender').'</td><td class="LC_right_item">'.
1710: &mt('Date/Time').'</td></tr>');
1711: my $mailcount = 0;
1.33 raeburn 1712: foreach my $msg (@{$newmsgs}) {
1713: $mailcount ++;
1.68 raeburn 1714: my $css_class = $mailcount%2?' class="LC_odd_row"':'';
1.76 raeburn 1715: $r->print('<tr'.$css_class.'><td>'.$mailcount
1716: .'. </td><td><a href="/adm/email?display='
1717: .$msg->{'msgid'}.'">'
1718: .$msg->{'shortsub'}.'</a> </td><td> '
1719: .$msg->{'from'}.':'.$msg->{'fromdom'}.' </td><td>'
1720: .$msg->{'sendtime'}.'</td></tr>');
1.33 raeburn 1721: }
1722: } else {
1.68 raeburn 1723: $r->print('<tr class="LC_empty_row"><td>'.
1724: &mt('No new '.$lctype.' messages').'</td></tr>');
1.33 raeburn 1725: }
1726: }
1727:
1728: sub display_coursecritmail {
1.68 raeburn 1729: my ($r,$critmsgcount,$critmsgs) = @_;
1.59 albertel 1730: my $lctype = lc(&Apache::loncommon::course_type());
1.33 raeburn 1731: if ($critmsgcount > 0) {
1.68 raeburn 1732: $r->print('<tr class="LC_info_row"><td class="LC_left_item">'.
1733: &mt('Number').'</td><td>'.&mt('Subject').'</td><td>'.
1734: &mt('Sender').'</td><td class="LC_right_item">'.
1735: &mt('Date/Time').'</td></tr>');
1736: my $mailcount = 0;
1.33 raeburn 1737: foreach my $msg (@{$critmsgs}) {
1738: $mailcount ++;
1.68 raeburn 1739: my $css_class = $mailcount%2?' class="LC_odd_row"':'';
1740: $r->print('<tr'.$css_class.'><td>'.$mailcount.
1741: '. </td><td><a href="/adm/email?folder=critical">'.
1742: $msg->{'shortsub'}.'</a> </td><td> '.
1.72 albertel 1743: $msg->{'from'}.':'.$msg->{'fromdom'}.' </td><td>'.
1.68 raeburn 1744: $msg->{'sendtime'}.'</td></tr>');
1.33 raeburn 1745: }
1746: } else {
1.68 raeburn 1747: $r->print('<tr class="LC_empty_row"><td>'.
1748: &mt('No unread critical messages in '.$lctype).
1749: '</td></tr>');
1.33 raeburn 1750: }
1.1 raeburn 1751: }
1752:
1753: sub cmp_title {
1.16 raeburn 1754: my ($a,$b,$res_title) = @_;
1755: my ($atitle,$btitle) = (lc($$res_title{$a}),lc($$res_title{$b}));
1.1 raeburn 1756: $atitle=~s/^\s*//;
1757: $btitle=~s/^\s*//;
1758: return $atitle cmp $btitle;
1759: }
1760:
1.33 raeburn 1761: sub get_display_settings {
1.36 raeburn 1762: my ($uname,$udom,$cid) = @_;
1.33 raeburn 1763: my %settings = &Apache::lonnet::dump('nohist_whatsnew',$udom,$uname,$cid);
1764: my ($tmp) = keys(%settings);
1.40 raeburn 1765: if ($tmp=~ /^(con_lost|error|no_such_host)/i) {
1.33 raeburn 1766: %settings = ();
1.41 raeburn 1767: unless ($tmp =~ /^error: 2 /) {
1.59 albertel 1768: my $lctype = lc(&Apache::loncommon::course_type());
1.41 raeburn 1769: &Apache::lonnet::logthis('Error retrieving whatsnew settings: '.
1.56 raeburn 1770: $tmp.' for '.$uname.':'.$udom.' for '.$lctype.': '.$cid);
1.33 raeburn 1771: }
1772: }
1773: return %settings;
1774: }
1775:
1.36 raeburn 1776: sub store_display_settings {
1777: my ($uname,$udom,$cid,$checkallowed) = @_;
1778: my %whatsnew_settings;
1779: my $result;
1780: foreach my $key (keys(%{$checkallowed})) {
1.44 albertel 1781: if ($key =~ /_section$/) { next; }
1.36 raeburn 1782: if (exists($env{'form.display_'.$key})) {
1783: unless ($env{'form.display_'.$key} eq '') {
1784: $whatsnew_settings{$cid.':'.$key} = $env{'form.display_'.$key};
1785: }
1786: }
1787: }
1788: if (keys(%whatsnew_settings)) {
1789: $result = &Apache::lonnet::put('nohist_whatsnew',\%whatsnew_settings,
1790: $udom,$uname);
1791: } else {
1792: $result = 'ok';
1793: }
1794: return $result;
1795: }
1796:
1797: sub store_interval_setting {
1798: my ($uname,$udom,$cid,$interval_titles) = @_;
1799: my %interval_settings = ();
1800: my $result;
1.77 raeburn 1801: my $context = $env{'form.intervaltype'};
1802: if ($env{'form.interval'} ne '') {
1803: if ($context eq 'oldroles') {
1804: $interval_settings{$cid.':oldroleinterval'} = $env{'form.interval'};
1805: } elsif ($context eq 'newroles') {
1806: $interval_settings{$cid.':newroleinterval'} = $env{'form.interval'};
1807: } else {
1808: $interval_settings{$cid.':interval'} = $env{'form.interval'};
1809: }
1.36 raeburn 1810: my $outcome = &Apache::lonnet::put('nohist_whatsnew',
1811: \%interval_settings,$udom,$uname);
1812: if ($outcome eq 'ok') {
1.77 raeburn 1813: if (ref($interval_titles->{$context}) eq 'HASH') {
1814: $result = &mt('New filter setting: [_1].','<b>'.
1815: $interval_titles->{$context}->{$env{'form.interval'}}.'</b>').'<br />';
1816: }
1.36 raeburn 1817: } else {
1.59 albertel 1818: my $lctype = lc(&Apache::loncommon::course_type());
1.77 raeburn 1819: &Apache::lonnet::logthis('Error saving whatsnew '.$context.' interval setting'.
1.56 raeburn 1820: ' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid);
1.36 raeburn 1821: $result = &mt('Unable to set interval to [_1] due to [_2].',
1.77 raeburn 1822: '<b>'.$interval_titles->{$context}->{$env{'form.interval'}}.'</b>',
1.36 raeburn 1823: '<tt>'.$outcome.'</tt>.<br />');
1824: }
1825: }
1826: return $result;
1827: }
1828:
1.39 raeburn 1829: sub store_discussion_setting {
1830: my ($uname,$udom,$cid) = @_;
1831: my %discussion_settings;
1832: my $result;
1833: if (defined($env{'form.countunread'})) {
1834: $discussion_settings{$cid.':countunread'} = $env{'form.countunread'};
1835: my $outcome = &Apache::lonnet::put('nohist_whatsnew',
1836: \%discussion_settings,$udom,$uname);
1837: if ($outcome eq 'ok') {
1838: $result = &mt('Count unread posts in discussions display set to [_1]',
1.74 bisitz 1839: '<b>'.&mt($env{'form.countunread'}).'</b>').'<br />';
1.39 raeburn 1840:
1841: } else {
1.59 albertel 1842: my $lctype = lc(&Apache::loncommon::course_type());
1.71 albertel 1843: &Apache::lonnet::logthis('Error saving whatsnew countunread setting'.
1.56 raeburn 1844: ' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid);
1.39 raeburn 1845: $result = &mt('Unable to set "number unread posts display" to [_1]'.
1846: ' due to [_2].',
1.74 bisitz 1847: '<b>'.&mt($env{'form.countunread'}).'</b>',
1.39 raeburn 1848: '<tt>'.$outcome.'</tt>.<br />');
1849: }
1850: }
1851: return $result;
1852: }
1853:
1854: sub store_courseinit_setting {
1855: my ($uname,$udom,$cid,$initpage) = @_;
1856: my %courseinit_settings;
1857: my $page_control;
1858: my $result;
1859: if (defined($env{'form.courseinit_control'})) {
1860: if ($env{'form.courseinit_control'} eq 'userpref') {
1861: $courseinit_settings{$cid.':courseinit'} = '';
1862: $page_control = 'global preferences';
1863: } else {
1864: if (defined($env{'form.courseinit_page'})) {
1865: $courseinit_settings{$cid.':courseinit'} =
1866: $env{'form.courseinit_page'};
1867: $page_control = 'course specific setting';
1868: }
1869: }
1870: if ($page_control) {
1.59 albertel 1871: my $lctype = lc(&Apache::loncommon::course_type());
1.39 raeburn 1872: my $outcome = &Apache::lonnet::put('nohist_whatsnew',
1873: \%courseinit_settings,$udom,$uname);
1874: if ($outcome eq 'ok') {
1875: if ($page_control eq 'global preferences') {
1.59 albertel 1876: $result = &mt("Page displayed after role selection in $lctype now set by <b>user's global preferences</b>.");
1.39 raeburn 1877: } else {
1.59 albertel 1878: $result = &mt('Page displayed after role selection in this '.$lctype.' set to <b>[_2]</b>',$lctype,$$initpage{$env{'form.courseinit_page'}});
1.39 raeburn 1879: }
1880: } else {
1.71 albertel 1881: &Apache::lonnet::logthis('Error saving whatsnew courseinit '.
1.39 raeburn 1882: 'setting: '.$outcome.' for '.$uname.
1.56 raeburn 1883: ':'.$udom.' in '.$lctype.' '.$cid);
1.39 raeburn 1884: if ($page_control eq 'global preferences') {
1885: $result = &mt('Unable to set control of page display to [_1]'.
1886: ' due to [_2].',
1887: '<b>'.$page_control.'</b>',
1888: '<tt>'.$outcome.'</tt>.<br />');
1889: } else {
1.59 albertel 1890: $result = &mt('Unable to set page display, after role selection, for this '.$lctype.' to <b>[_2]</b> due to <tt>[_3]</tt>.<br />',
1.56 raeburn 1891: $$initpage{$env{'form.courseinit_page'}},$outcome);
1.39 raeburn 1892: }
1893: }
1894: }
1895: }
1896: return $result;
1897: }
1898:
1.33 raeburn 1899: sub start_box {
1.69 raeburn 1900: my ($r,$show,$heading,$caller,$refpage) = @_;
1.33 raeburn 1901: my %lt = &Apache::lonlocal::texthash(
1902: chth => 'Change thresholds?',
1903: chin => 'Change interval?',
1.39 raeburn 1904: chop => 'Change options?',
1.33 raeburn 1905: );
1.68 raeburn 1906: my $showhide;
1.33 raeburn 1907: if ($$show{$caller}) {
1.36 raeburn 1908: $showhide = '<b><a href="javascript:change_display(document.visible.'.
1.70 raeburn 1909: 'display_'.$caller.",'hide'".');">'.
1910: &mt('Hide').'</a></b>';
1.33 raeburn 1911:
1912: } else {
1.36 raeburn 1913: $showhide = '<b><a href="javascript:change_display(document.visible.'.
1.70 raeburn 1914: 'display_'.$caller.",'show'".');">'.
1915: &mt('Show').'</a></b>';
1.33 raeburn 1916: }
1917:
1918: $r->print('
1.68 raeburn 1919: <table class="LC_nested_outer">
1.33 raeburn 1920: <tr>
1.73 raeburn 1921: <th class="LC_left_item">'.$$heading{$caller}.'</th>
1.68 raeburn 1922: <th class="LC_right_item">'.$showhide.'</th>
1923: </tr>');
1.33 raeburn 1924: if (($caller eq 'abovethreshold') && ($$show{$caller})) {
1.40 raeburn 1925: if ($$show{$caller}) {
1926: $r->print('
1.33 raeburn 1927: <tr>
1.68 raeburn 1928: <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgthreshold&refpage='.$refpage.'">'.$lt{'chth'}.'</a></td>
1.33 raeburn 1929: </tr>');
1.40 raeburn 1930: }
1.33 raeburn 1931: } elsif (($caller eq 'versionchanges') && ($$show{$caller})) {
1.40 raeburn 1932: if ($$show{$caller}) {
1933: $r->print('
1.33 raeburn 1934: <tr>
1.68 raeburn 1935: <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chginterval&refpage='.$refpage.'">'.$lt{'chin'}.'</a></td>
1.39 raeburn 1936: </tr>');
1.40 raeburn 1937: }
1.39 raeburn 1938: } elsif ($caller eq 'coursediscussion') {
1.40 raeburn 1939: if ($$show{$caller}) {
1940: $r->print('
1.39 raeburn 1941: <tr>
1.68 raeburn 1942: <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgdisc&refpage='.$refpage.'">'.$lt{'chop'}.'</a></td>
1.33 raeburn 1943: </tr>');
1.40 raeburn 1944: }
1.77 raeburn 1945: } elsif (($caller eq 'newroles') && ($$show{$caller})) {
1946: if ($$show{$caller}) {
1947: $r->print('
1948: <tr>
1949: <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgnewroleinterval&refpage='.$refpage.'">'.$lt{'chin'}.'</a></td>
1950: </tr>');
1951: }
1952: } elsif (($caller eq 'oldroles') && ($$show{$caller})) {
1953: if ($$show{$caller}) {
1954: $r->print('
1955: <tr>
1956: <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgoldroleinterval&refpage='.$refpage.'">'.$lt{'chin'}.'</a></td>
1957: </tr>');
1958: }
1.33 raeburn 1959: }
1.61 albertel 1960: $r->print('
1.33 raeburn 1961: <tr>
1.68 raeburn 1962: <td colspan="2">
1963: <table class="LC_nested">
1.33 raeburn 1964: ');
1965: return;
1966: }
1967:
1968: sub end_box {
1969: my ($r) = shift;
1970: $r->print('
1971: </table>
1972: </td>
1973: </tr>
1974: </table><br />');
1975: return;
1976: }
1977:
1.7 raeburn 1978: 1;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>