Annotation of loncom/html/adm/helper/resettimes.helper, revision 1.7
1.1 albertel 1: <helper title="Reset Access Times" requiredpriv="mgr">
2: <state name="START" title="Select Scope">
3: <message>
4: <message_text>Select </message_text>
5: </message>
6: <choices variable="harry">
1.7 ! albertel 7: <choice computer='1' nextstate="Student">Reset times on one or more folders/maps, resources or the course for a single student.</choice>
! 8: <choice computer='0' nextstate="Class">Reset times on a single folder/map, resource or the course for a section or the whole class.</choice>
1.1 albertel 9: </choices>
10: </state>
11: <state name="Student" title="Select Student">
12: <message nextstate="SelectAccess">
13: <message_text>Choose a student:<br /></message_text>
14: </message>
15: <student variable='stu1' coursepersonnel='true' activeonly='true' />
16: </state>
17:
18: <state name="SelectAccess">
1.2 albertel 19: <message nextstate="ConfirmStu">
1.7 ! albertel 20: <message_text>This is a list of first access times and what was accessed, plese select those you want deleted.</message_text>
1.2 albertel 21: </message>
1.1 albertel 22: <choices variable='delete' multichoice='true'>
23: <exec>
24: my ($uname,$udom,$sec,$fullname)=split(':',$helper->{'VARS'}{'stu1'});
25: my %times=&Apache::lonnet::dump('firstaccesstimes',$udom,$uname,
1.3 albertel 26: "^$env{'request.course.id'}\0");
1.1 albertel 27: foreach my $res (sort(keys(%times))) {
28: my (undef,$symb)=split("\0",$res);
29: my $escsymb=&Apache::lonnet::escape($symb);
1.7 ! albertel 30: my $title =
! 31: ($symb ne 'course') ? &Apache::lonnet::gettitle($symb)
! 32: : $env{'course.'.$env{'request.course.id'}.'.description'};
1.1 albertel 33: my $time=&Apache::lonlocal::locallocaltime($times{$res});
1.2 albertel 34: my $description="<a href='/adm/navmaps?postsymb=".&Apache::lonnet::escape($symb)."'>$title</a> on $time";
1.1 albertel 35: push(@{$state->{CHOICES}},[$description,$escsymb]);
36: }
37: </exec>
38: </choices>
39: </state>
40:
1.2 albertel 41: <state name="ConfirmStu">
42: <message nextstate="FinishStu">
43: <message_text>Will remove access times from user <ul></message_text>
44: </message>
45: <eval>
46: my ($uname,$udom,undef,$fullname)=split(':',$helper->{'VARS'}{'stu1'});
47: if (!$fullname) { $fullname="$uname\@$udom"; }
48: return '<li>'.$fullname.'</li>';
49: </eval>
1.7 ! albertel 50: <message><message_text></ul> for <ul></message_text></message>
1.2 albertel 51: <eval>
52: my $list;
53: my @symbs=split(/\|\|\|/,$helper->{'VARS'}{'delete'});
54: foreach my $escsymb (@symbs) {
55: my $symb=&Apache::lonnet::unescape($escsymb);
1.7 ! albertel 56: my $title =
! 57: ($symb ne 'course') ? &Apache::lonnet::gettitle($symb)
! 58: : $env{'course.'.$env{'request.course.id'}.'.description'};
! 59: $list.='<li>'.$title.'</li>';
1.2 albertel 60: }
61: return $list;
62: </eval>
63: </state>
64:
1.1 albertel 65: <state name="FinishStu" title="Processing">
66: <final>
67: <finalcode>
68: if ($helper->{'STATE'} ne 'FinishStu') { return; }
69: my $result;
1.3 albertel 70: my $courseid=$env{'request.course.id'};
1.1 albertel 71: my ($uname,$udom,$sec,$fullname)=split(':',$helper->{'VARS'}{'stu1'});
72: &Apache::lonnet::logthis($helper->{'VARS'}{'delete'});
73: foreach my $escsymb (split(/\|\|\|/,$helper->{'VARS'}{'delete'})) {
74: my $symb=&Apache::lonnet::unescape($escsymb);
75: my $res=&Apache::lonnet::del('firstaccesstimes',
76: ["$courseid\0$symb"],$udom,$uname);
1.7 ! albertel 77: my $title =
! 78: ($symb ne 'course') ? &Apache::lonnet::gettitle($symb)
! 79: : $env{'course.'.$env{'request.course.id'}.'.description'};
1.1 albertel 80: $result.="Removing access time from ".
1.7 ! albertel 81: $title.": ".$res.'</li><li>';
1.1 albertel 82: }
83: $result=~s/<li>$//;
84: return $result;
85: </finalcode>
86: <exitpage>/adm/flip?postdata=return:</exitpage>
87: </final>
88: </state>
89:
90: <state name="Class">
91: <message nextstate="SelectMap">
92: </message>
93: <student variable='stu1' coursepersonnel='true' activeonly='true' multichoice='true' />
94: </state>
95:
1.4 albertel 96: <state name="SelectMap" title="Select a folder/map">
1.6 albertel 97: <resource variable="res2" includecourse="true">
1.7 ! albertel 98: <filterfunc>return (($res->is_map() && $res->map_contains_problem())
! 99: ||$res->is_problem() );</filterfunc>
1.1 albertel 100: <valuefunc>return $res->symb()</valuefunc>
101: <nextstate>ShowPlan</nextstate>
102: </resource>
103: </state>
104:
105: <state name="ShowPlan" title="Processing">
106: <message nextstate="FINISH"><message_text>Will remove access times for <ul></message_text></message>
107:
108: <eval>
109: return '<li>'.&Apache::lonnet::gettitle($helper->{'VARS'}{'res2'}).'</li>';
110: </eval>
111: <message><message_text></ul> from users <ul></message_text></message>
112: <eval>
113: my $list;
114: my @names=split(/\|\|\|/,$helper->{'VARS'}{'stu1'});
115: foreach my $name (@names) {
116: my ($uname,$udom,$sec,$fullname)=split(':',$name);
117: if (!$fullname) { $fullname="$uname\@$udom"; }
118: $list.='<li>'.$fullname.'</li>';
119: }
120: return $list;
121: </eval>
122: </state>
123:
124: <state name="FINISH" title="Processing">
125: <final>
126: <finalcode>
127: if ($helper->{'STATE'} ne 'FINISH') { return; }
128: my $result;
129: my $symb=$helper->{'VARS'}{'res2'};
1.3 albertel 130: my $key=$env{'request.course.id'}."\0".$symb;
1.1 albertel 131: my @names=split(/\|\|\|/,$helper->{'VARS'}{'stu1'});
132: foreach my $name (@names) {
133: my ($uname,$udom,$sec,$fullname)=split(':',$name);
134: if (!$fullname) { $fullname="$uname\@$udom"; }
135: my %times=&Apache::lonnet::get('firstaccesstimes',
136: [$key],$udom,$uname);
137: if (!$times{$key}) {
138: $result.="No Access times found for student ".$fullname;
139: } else {
140: $result.="Removing access times ".
141: &Apache::lonlocal::locallocaltime($times{$key}).
142: " found for student ".$fullname.": ";
143: $result.=&Apache::lonnet::del('firstaccesstimes',
144: [$key],$udom,$uname);
145: }
146: $result.="</li>\n<li>";
147: }
148: $result=~s/<li>$//;
149: return $result;
150: </finalcode>
151: <exitpage>/adm/flip?postdata=return:</exitpage></final>
152: </state>
153: </helper>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>