Annotation of rat/lonpage.pm, revision 1.118
1.1 www 1: # The LearningOnline Network with CAPA
2: # Page Handler
3: #
1.118 ! raeburn 4: # $Id: lonpage.pm,v 1.117 2016/07/18 19:29:24 raeburn Exp $
1.29 www 5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
1.30 harris41 28: ###
1.1 www 29:
1.88 jms 30:
31:
32:
1.1 www 33: package Apache::lonpage;
34:
35: use strict;
36: use Apache::Constants qw(:common :http);
1.70 albertel 37: use Apache::lonnet;
1.30 harris41 38: use Apache::loncommon();
1.102 raeburn 39: use Apache::lonhtmlcommon;
1.21 www 40: use Apache::lonxml();
1.57 raeburn 41: use Apache::lonlocal;
1.49 www 42: use Apache::lonmenu;
1.111 raeburn 43: use Apache::lonhomework;
1.112 raeburn 44: use Apache::lonparmset;
1.6 www 45: use HTML::TokeParser;
1.1 www 46: use GDBM_File;
1.39 www 47: use Apache::lonsequence;
1.75 www 48: use lib '/home/httpd/lib/perl/';
49: use LONCAPA;
50:
1.1 www 51:
1.2 www 52: # -------------------------------------------------------------- Module Globals
53: my %hash;
54: my @rows;
1.6 www 55:
56: # ------------------------------------------------------------------ Euclid gcd
57:
58: sub euclid {
59: my ($e,$f)=@_;
60: my $a; my $b; my $r;
61: if ($e>$f) { $b=$e; $r=$f; } else { $r=$e; $b=$f; }
62: while ($r!=0) {
63: $a=$b; $b=$r;
64: $r=$a%$b;
65: }
66: return $b;
67: }
1.2 www 68:
69: # ------------------------------------------------------------ Build page table
70:
71: sub tracetable {
72: my ($sofar,$rid,$beenhere)=@_;
73: my $further=$sofar;
1.57 raeburn 74: my $randomout=0;
1.70 albertel 75: unless ($env{'request.role.adv'}) {
1.57 raeburn 76: $randomout = $hash{'randomout_'.$rid};
77: }
1.2 www 78: unless ($beenhere=~/\&$rid\&/) {
1.57 raeburn 79: $beenhere.=$rid.'&';
80: unless ($randomout) {
81: if (defined($hash{'is_map_'.$rid})) {
82: if ((defined($hash{'map_start_'.$hash{'src_'.$rid}})) &&
83: (defined($hash{'map_finish_'.$hash{'src_'.$rid}}))) {
84: my $frid=$hash{'map_finish_'.$hash{'src_'.$rid}};
85: $sofar=
86: &tracetable($sofar,$hash{'map_start_'.$hash{'src_'.$rid}},
1.87 albertel 87: '&'.$frid.$beenhere);
1.57 raeburn 88: $sofar++;
89: if ($hash{'src_'.$frid}) {
90: my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$frid});
91: if (($brepriv eq '2') || ($brepriv eq 'F')) {
92: if (defined($rows[$sofar])) {
93: $rows[$sofar].='&'.$frid;
94: } else {
95: $rows[$sofar]=$frid;
96: }
97: }
98: }
99: }
100: } else {
101: $sofar++;
102: if ($hash{'src_'.$rid}) {
103: my $brepriv=&Apache::lonnet::allowed('bre',$hash{'src_'.$rid});
104: if (($brepriv eq '2') || ($brepriv eq 'F')) {
105: if (defined($rows[$sofar])) {
106: $rows[$sofar].='&'.$rid;
107: } else {
108: $rows[$sofar]=$rid;
109: }
110: }
111: }
112: }
113: }
114:
115: if (defined($hash{'to_'.$rid})) {
116: my $mincond=1;
117: my $next='';
118: foreach (split(/\,/,$hash{'to_'.$rid})) {
119: my $thiscond=
1.11 www 120: &Apache::lonnet::directcondval($hash{'condid_'.$hash{'undercond_'.$_}});
1.57 raeburn 121: if ($thiscond>=$mincond) {
122: if ($next) {
123: $next.=','.$_.':'.$thiscond;
124: } else {
125: $next=$_.':'.$thiscond;
126: }
127: if ($thiscond>$mincond) { $mincond=$thiscond; }
128: }
129: }
130: foreach (split(/\,/,$next)) {
131: my ($linkid,$condval)=split(/\:/,$_);
132: if ($condval>=$mincond) {
133: my $now=&tracetable($sofar,$hash{'goesto_'.$linkid},$beenhere);
134: if ($now>$further) { $further=$now; }
135: }
136: }
137: }
1.2 www 138: }
139: return $further;
140: }
141:
1.1 www 142: # ================================================================ Main Handler
143:
144: sub handler {
145: my $r=shift;
146:
1.3 www 147: # ------------------------------------------- Set document type for header only
1.1 www 148:
1.3 www 149: if ($r->header_only) {
1.70 albertel 150: if ($env{'browser.mathml'}) {
1.53 www 151: &Apache::loncommon::content_type($r,'text/xml');
1.3 www 152: } else {
1.53 www 153: &Apache::loncommon::content_type($r,'text/html');
1.3 www 154: }
155: $r->send_http_header;
156: return OK;
157: }
1.43 sakharuk 158:
1.39 www 159: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
160: ['forceselect','launch']);
1.43 sakharuk 161: my $number_of_columns = 1;
1.37 sakharuk 162: my $requrl=$r->uri;
1.70 albertel 163: my $target = $env{'form.grade_target'};
1.94 raeburn 164:
165: # Short term solution: define target as 'tex_answer' when retrieving answers
166: # for resources in a .page when generating printouts.
167: # A better long-term fix would be to modify the way problem rendering, and
168: # answer rendering are retrieved for individual resources when printing a .page,
169: # so rendered problem and answer are sequential for individual resources in
170: # the .page
171: #
172: if ($target eq 'answer') {
173: if ($env{'form.answer_output_mode'} eq 'tex') {
174: $target = 'tex_answer';
175: }
176: }
1.55 www 177: # &Apache::lonnet::logthis("Got a target of $target");
1.54 albertel 178: if ($target eq 'meta') {
179: &Apache::loncommon::content_type($r,'text/html');
180: $r->send_http_header;
181: return OK;
182: }
1.1 www 183: # ----------------------------------------------------------------- Tie db file
1.70 albertel 184: if (($env{'request.course.fn'}) && (!$env{'form.forceselect'})) {
185: my $fn=$env{'request.course.fn'};
1.1 www 186: if (-e "$fn.db") {
1.44 albertel 187: if (tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER(),0640)) {
1.1 www 188: # ------------------------------------------------------------------- Hash tied
189: my $firstres=$hash{'map_start_'.$requrl};
190: my $lastres=$hash{'map_finish_'.$requrl};
191: if (($firstres) && ($lastres)) {
1.111 raeburn 192: # ------------------------------------------------------------- Countdown Timer
193: my $now = time;
1.112 raeburn 194: my ($pagefirstaccess,%hastimeleft,%countdowndisp,%donebutton,
1.114 raeburn 195: %donebtnextra,%buttonbytime,$donetime,$symbtosetdone);
1.111 raeburn 196: my ($pagesymb,$courseid,$domain,$name)=&Apache::lonnet::whichuser();
1.114 raeburn 197: unless ($pagesymb) {
198: $pagesymb=&Apache::lonnet::symbread($requrl);
199: }
1.113 musolffc 200: if ($pagesymb && ($courseid ne '') && ($domain ne '') && ($name ne '')) {
1.111 raeburn 201: my %times=&Apache::lonnet::get('firstaccesstimes',
202: [$courseid."\0".$pagesymb],
203: $domain,$name);
204: if ($times{$courseid."\0".$pagesymb} =~ /^\d+$/) {
205: $pagefirstaccess = $times{$courseid."\0".$pagesymb};
1.112 raeburn 206: if ($pagefirstaccess && $env{'form.LC_interval_done'} eq 'true') {
207: $donetime = $now - $pagefirstaccess;
208: }
1.111 raeburn 209: }
210: }
1.112 raeburn 211:
1.1 www 212: # ----------------------------------------------------------------- Render page
213:
1.3 www 214: @rows=();
1.2 www 215:
1.45 www 216: &tracetable(0,$firstres,'&');
1.2 www 217:
1.9 www 218: # ------------------------------------------------------------ Add to symb list
219:
1.2 www 220: my $i;
1.9 www 221: my %symbhash=();
222: for ($i=0;$i<=$#rows;$i++) {
223: if ($rows[$i]) {
224: my @colcont=split(/\&/,$rows[$i]);
1.73 albertel 225: foreach my $rid (@colcont) {
226: my ($mapid,$resid)=split(/\./,$rid);
227: $symbhash{$hash{'src_'.$rid}}=
228: [$hash{'src_'.$rid},$resid];
1.112 raeburn 229: if (($donetime) && ($symbtosetdone eq '')) {
230: my $src = $hash{'src_'.$rid};
231: if ($hash{'encrypted_'.$rid}) {
232: $src=&Apache::lonenc::encrypted($src);
233: }
234: my ($mapid,$resid)=split(/\./,$rid);
235: my $symb=&Apache::lonnet::encode_symb($hash{'map_id_'.$mapid},$resid,$src);
236: if ($src =~ /$LONCAPA::assess_re/) {
237: my @interval=&Apache::lonnet::EXT("resource.0.interval",$symb);
238: if (@interval > 1) {
1.114 raeburn 239: if (($interval[1] eq 'map') && ($pagefirstaccess)) {
240: my ($timelimit) = ($interval[0] =~ /^(\d+)/);
241: if ($timelimit) {
242: if ($pagefirstaccess + $timelimit > $now) {
243: $symbtosetdone = $symb;
244: }
1.112 raeburn 245: }
246: }
247: }
248: }
249: }
1.30 harris41 250: }
1.9 www 251: }
252: }
253: &Apache::lonnet::symblist($requrl,%symbhash);
254:
255: # ------------------------------------------------------------------ Page parms
256:
1.4 www 257: my $j;
1.6 www 258: my $lcm=1;
259: my $contents=0;
1.7 www 260: my $nforms=0;
1.96 raeburn 261: my $nuploads=0;
1.110 raeburn 262: my $ntimers=0;
1.96 raeburn 263: my %turninpaths;
264: my %multiresps;
265: my $turninparent;
1.6 www 266:
267: my %ssibody=();
268: my %ssibgcolor=();
269: my %ssitext=();
270: my %ssilink=();
271: my %ssivlink=();
272: my %ssialink=();
1.14 www 273:
1.6 www 274: my %cellemb=();
1.99 raeburn 275: my %cellexternal=();
1.3 www 276:
1.7 www 277: my $allscript='';
278: my $allmeta='';
279:
280: my $isxml=0;
281: my $xmlheader='';
282: my $xmlbody='';
283:
1.112 raeburn 284: # ---------------------------------------------------------- Handle Done button
285:
286: # Set the event timer to zero if the "done button" was clicked.
287: if ($donetime && $symbtosetdone) {
288: &Apache::lonparmset::storeparm_by_symb_inner($symbtosetdone,'0_interval',
289: 2,$donetime,'date_interval',
290: $name,$domain);
291: undef($env{'form.LC_interval_done'});
292: }
293:
1.3 www 294: # --------------------------------------------- Get SSI output, post parameters
295:
1.2 www 296: for ($i=0;$i<=$#rows;$i++) {
1.4 www 297: if ($rows[$i]) {
1.6 www 298: $contents++;
1.3 www 299: my @colcont=split(/\&/,$rows[$i]);
1.6 www 300: $lcm*=($#colcont+1)/euclid($lcm,($#colcont+1));
1.30 harris41 301: foreach (@colcont) {
1.3 www 302: my $src=$hash{'src_'.$_};
1.99 raeburn 303: my ($extension)=($src=~/\.(\w+)$/);
304: $cellexternal{$_}=($hash{'ext_'.$_} eq 'true:');
1.61 albertel 305: if ($hash{'encrypted_'.$_}) {
306: $src=&Apache::lonenc::encrypted($src);
307: }
308: $cellemb{$_}=
309: &Apache::loncommon::fileembstyle($extension);
1.99 raeburn 310: if ($cellexternal{$_}) {
311: unless (($target eq 'tex') || ($target eq 'tex_answer')) {
312: $ssibody{$_} = <<ENDEXT;
313: <iframe src="$src" width="100%">No iframe support!</iframe>
314: ENDEXT
315: }
316: } elsif ($cellemb{$_} eq 'ssi') {
1.3 www 317: # --------------------------------------------------------- This is an SSI cell
1.64 albertel 318: my ($mapid,$resid)=split(/\./,$_);
319: my $symb=&Apache::lonnet::encode_symb($hash{'map_id_'.$mapid},$resid,$src);
320:
1.5 www 321: my $prefix=$_.'_';
1.101 raeburn 322: my $idprefix= join('_',($mapid,$resid,''));
1.64 albertel 323: my %posthash=('request.prefix' => $prefix,
1.71 albertel 324: 'LONCAPA_INTERNAL_no_discussion' => 'true',
1.64 albertel 325: 'symb' => $symb);
1.94 raeburn 326: if (($env{'form.grade_target'} eq 'tex') ||
327: ($env{'form.answer_output_mode'} eq 'tex')) {
1.70 albertel 328: $posthash{'grade_target'}=$env{'form.grade_target'};
329: $posthash{'textwidth'}=$env{'form.textwidth'};
330: $posthash{'problem_split'}=$env{'form.problem_split'};
331: $posthash{'latex_type'}=$env{'form.latex_type'};
332: $posthash{'rndseed'}=$env{'form.rndseed'};
1.94 raeburn 333: $posthash{'answer_output_mode'} = $env{'form.answer_output_mode'};
1.56 sakharuk 334: }
1.72 albertel 335: my $submitted=exists($env{'form.all_submit'});
336: if (!$submitted) {
337: foreach my $key (keys(%env)) {
338: if ($key=~/^form.\Q$prefix\Esubmit_/) {
339: $submitted=1;last;
340: }
341: }
342: }
343: if ($submitted) {
344: foreach my $key (keys(%env)) {
345: if ($key=~/^form.\Q$prefix\E/) {
346: my $name=$key;
347: $name=~s/^form.\Q$prefix\E//;
348: $posthash{$name}=$env{$key};
349: }
350: }
351: if (exists($env{'form.all_submit'})) {
352: $posthash{'all_submit'}='yes';
353: }
1.7 www 354: }
1.5 www 355: my $output=Apache::lonnet::ssi($src,%posthash);
1.77 albertel 356: $output=~s|//(\s*<!--)? BEGIN LON-CAPA Internal.+?// END LON-CAPA Internal\s*(-->)?\s||gs;
1.94 raeburn 357: if (($target eq 'tex') || ($target eq 'tex_answer')) {
1.118 ! raeburn 358: $output =~ s/^([^&]+)\\begin\{document}//;
! 359: $output =~ s/\\end\{document}//;
1.92 foxr 360: # $output = '\parbox{\minipagewidth}{ '.$output.' }';
1.46 sakharuk 361: #some additional cleanup necessary for LateX (due to limitations of table environment
362: $output =~ s/(\\vskip\s*\d+mm)\s*(\\\\)+/$1/g;
363: }
1.107 raeburn 364: my $matheditor;
365: if ($output =~ /\Qjavascript:LC_mathedit_HWVAL_\E/) {
366: $matheditor = 'dragmath';
367: } elsif ($output =~ /LCmathField/) {
368: $matheditor = 'lcmath';
369: }
1.6 www 370: my $parser=HTML::TokeParser->new(\$output);
371: my $token;
1.12 www 372: my $thisdir=$src;
1.6 www 373: my $bodydef=0;
1.7 www 374: my $thisxml=0;
1.12 www 375: my @rlinks=();
1.7 www 376: if ($output=~/\?xml/) {
377: $isxml=1;
378: $thisxml=1;
379: $output=~
380: /((?:\<(?:\?xml|\!DOC|html)[^\>]*(?:\>|\>\]\>)\s*)+)\<body[^\>]*\>/si;
381: $xmlheader=$1;
382: }
1.12 www 383: while ($token=$parser->get_token) {
384: if ($token->[0] eq 'S') {
385: if ($token->[1] eq 'a') {
386: if ($token->[2]->{'href'}) {
387: $rlinks[$#rlinks+1]=
388: $token->[2]->{'href'};
389: }
390: } elsif ($token->[1] eq 'img') {
391: $rlinks[$#rlinks+1]=
392: $token->[2]->{'src'};
393: } elsif ($token->[1] eq 'embed') {
394: $rlinks[$#rlinks+1]=
395: $token->[2]->{'src'};
396: } elsif ($token->[1] eq 'base') {
397: $thisdir=$token->[2]->{'href'};
398: } elsif ($token->[1] eq 'body') {
1.7 www 399: $bodydef=1;
400: $ssibgcolor{$_}=$token->[2]->{'bgcolor'};
401: $ssitext{$_}=$token->[2]->{'text'};
402: $ssilink{$_}=$token->[2]->{'link'};
403: $ssivlink{$_}=$token->[2]->{'vlink'};
404: $ssialink{$_}=$token->[2]->{'alink'};
405: if ($thisxml) {
406: $xmlbody=$token->[4];
407: }
1.12 www 408: } elsif ($token->[1] eq 'meta') {
1.28 albertel 409: if ($token->[4] !~ m:/>$:) {
1.7 www 410: $allmeta.="\n".$token->[4].'</meta>';
1.28 albertel 411: } else {
412: $allmeta.="\n".$token->[4];
413: }
1.12 www 414: } elsif (($token->[1] eq 'script') &&
415: ($bodydef==0)) {
1.7 www 416: $allscript.="\n\n"
417: .$parser->get_text('/script');
1.6 www 418: }
1.12 www 419: }
420: }
1.6 www 421: if ($output=~/\<body[^\>]*\>(.*)/si) {
422: $output=$1;
423: }
424: $output=~s/\<\/body\>.*//si;
1.7 www 425: if ($output=~/\<form/si) {
1.110 raeburn 426: my $hastimer;
1.7 www 427: $nforms++;
428: $output=~s/\<form[^\>]*\>//gsi;
429: $output=~s/\<\/form[^\>]*\>//gsi;
1.96 raeburn 430: if ($output=~/\<input[^\>]+name\s*=\s*[\'\"]*HWFILE/) {
431: $nuploads++;
432: }
1.110 raeburn 433: if ($output=~/\<input[^\>]+name\s*=\s*[\'\"]*accessbutton/) {
434: $ntimers++;
435: $hastimer = 1;
436: }
1.17 www 437: $output=~
1.80 albertel 438: s/\<((?:input|select|button|textarea)[^\>]+)name\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\>]*)\>/\<$1 name="$prefix$2" $3\>/gsi;
1.101 raeburn 439: $output=~
440: s/\<((?:input|select|button|textarea)[^\>]+)id\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\>]*)\>/\<$1 id="$idprefix$2" $3\>/gsi;
1.110 raeburn 441: if ($hastimer) {
442: $output=~
443: s/\<(input[^\>]+name=\Q"$prefix\Eaccessbutton"[^\>]+)(?:\Qdocument.markaccess.submit();\E)([^\>]*)\>/\<$1pageTimer(this.form,'$prefix')$2\>/gsi;
444: $output=~ s/\<(input[^\>]+name=\Q"$prefix\Emarkaccess"[^\>]+value=["'])(?:yes)(['"][^\>]*)\>/\<$1$2\>/gsi;
445: }
1.107 raeburn 446: if ($matheditor eq 'dragmath') {
447: $output=~
448: s/(\Qjavascript:LC_mathedit_\E)(HWVAL_)([^'"]+?)(\(['"]*)(\QHWVAL_\E\3['"]\)\;void\(0\)\;)/$1$idprefix$2$3$4$idprefix$5/g;
449: $output=~
450: s/(function\s+LC_mathedit_)(HWVAL_)([^'"]+?)(\s+\(LCtextline\))/$1$idprefix$2$3$4/g;
451: } elsif ($matheditor eq 'lcmath') {
452: $output=~
453: s/(var\s+LCmathField\s+=\s+document\.getElementById\(['"])([^'"]+?)(['"]\)\;)/$1$idprefix$2$3/g;
454: }
1.105 raeburn 455: $output=~
456: s/(\Q<div id="msg_\E)(\Qsubmit_\E)([^"]*)(\Q" style="display:none">\E)/<input type="hidden" name="$prefix$2$3_pressed" id="$idprefix$2$3_pressed" value="" \/>$1$idprefix$2$3$4/g;
457: $output=~
458: s/(\Q<td class="LC_status_\E)(\Qsubmit_\E)([^\"]*)(\s*[^\"]*"\>)/$1$idprefix$2$3$4/g;
1.96 raeburn 459: if ($nuploads) {
460: $output=~
461: s/\<(input[^\>]+name=\"\Q$prefix\EHWFILE[^\>]+)\s*id\s*\=\s*[\'\"]*([^\'\"]+)[\'\"]*([^\)]*)\>/\<$1 id="$prefix$2" $3\>/gsi;
462: ($turninpaths{$prefix},$multiresps{$prefix}) =
463: &Apache::loncommon::get_turnedin_filepath($symb,$env{'user.name'},$env{'user.domain'});
464: if ($turninparent eq '') {
465: $turninparent = $turninpaths{$prefix};
466: $turninparent =~ s{(/[^/]+)$}{};
467: }
468: }
1.95 raeburn 469: $output=~
470: s/\<((?:input|select)[^\>]+\Qjavascript:setSubmittedPart\E)\(\s*[\'\"]([^\'\"]+)[\'\"]*\s*\)/\<$1('$2','$prefix')/gsi;
1.108 raeburn 471: $output=~
472: s/\<(input[^\>]+\Qonfocus=\"javascript:disableAutoComplete\E)\(\'([^\']+)\'\)(;\")/\<$1('$idprefix$2')$3/gsi;
1.111 raeburn 473: unless ($hastimer) {
474: if ($src =~ /$LONCAPA::assess_re/) {
475: %Apache::lonhomework::history =
476: &Apache::lonnet::restore($symb,$courseid,$domain,$name);
477: my $type = 'problem';
478: if ($src =~ /\.task$/) {
479: $type = 'Task';
480: }
481: my ($status,$accessmsg,$slot_name,$slot) =
1.117 raeburn 482: &Apache::lonhomework::check_slot_access('0',$type,$symb);
1.111 raeburn 483: undef(%Apache::lonhomework::history);
484: my $probstatus = &Apache::lonnet::EXT("resource.0.problemstatus",$symb);
485: if (($status eq 'CAN_ANSWER') || (($status eq 'CANNOT_ANSWER') &&
1.114 raeburn 486: (($probstatus eq 'no') || ($probstatus eq 'no_feedback_ever'))) ||
487: (($status eq 'NOT_YET_VIEWED') && ($posthash{'markaccess'} eq 'yes'))) {
1.111 raeburn 488: my ($slothastime,$timerhastime);
489: if ($slot_name ne '') {
490: if (ref($slot) eq 'HASH') {
491: if (($slot->{'starttime'} < $now) &&
492: ($slot->{'endtime'} > $now)) {
493: $slothastime = $now - $slot->{'endtime'};
494: }
495: }
496: }
497: my $duedate = &Apache::lonnet::EXT("resource.0.duedate",$symb);
498: my @interval=&Apache::lonnet::EXT("resource.0.interval",$symb);
499: if (@interval > 1) {
1.114 raeburn 500: my $first_access;
1.115 raeburn 501: if ($interval[1] eq 'map') {
502: my $ignorecache;
503: if ($env{'form.'.$prefix.'markaccess'} eq 'yes') {
504: $ignorecache = 1;
1.114 raeburn 505: }
1.115 raeburn 506: $first_access=&Apache::lonnet::get_first_access($interval[1],undef,$pagesymb,$ignorecache);
507: if (($first_access) && (!$pagefirstaccess)) {
508: $pagefirstaccess = $first_access;
1.114 raeburn 509: }
1.115 raeburn 510: } else {
511: $first_access=&Apache::lonnet::get_first_access($interval[1],$symb);
512: }
513: if ($first_access > 0) {
1.114 raeburn 514: my ($timelimit) = ($interval[0] =~ /^(\d+)/);
1.115 raeburn 515: if ($timelimit) {
516: my $timeremains = $timelimit + $first_access - $now;
517: if ($timeremains > 0) {
518: $timerhastime = $timeremains;
519: }
1.111 raeburn 520: }
521: }
522: }
523: if (($duedate && $duedate > $now) ||
524: (!$duedate && $timerhastime > 0) ||
525: ($slot_name ne '' && $slothastime)) {
526: if ((@interval > 1 && $timerhastime) ||
527: ($type eq 'Task' && $slothastime)) {
528: $countdowndisp{$symb} = 'inline';
529: if ((@interval > 1) && ($timerhastime)) {
530: $hastimeleft{$symb} = $timerhastime;
1.112 raeburn 531: if ($pagefirstaccess) {
1.114 raeburn 532: my ($timelimit,$usesdone,$donebuttontext,$proctor,$secret);
533: ($timelimit,my $donesuffix) = split(/_/,$interval[0],2);
534: if ($donesuffix =~ /^done\:([^\:]+)\:(.*)$/) {
535: $usesdone = 'done';
536: $donebuttontext = $1;
537: (undef,$proctor,$secret) = split(/_/,$2);
538: } elsif ($donesuffix =~ /^done(|_.+)$/) {
539: $donebuttontext = &mt('Done');
540: ($usesdone,$proctor,$secret) = split(/_/,$donesuffix);
541: }
542: if ($usesdone eq 'done') {
543: $donebutton{$symb} = $timelimit;
544: push(@{$buttonbytime{$timelimit}},$symb);
545: $donebtnextra{$symb} = {
546: text => $donebuttontext,
547: proctor => $proctor,
548: secret => $secret,
549: type => $interval[1],
550: };
551: }
1.112 raeburn 552: }
1.111 raeburn 553: } else {
554: $hastimeleft{$symb} = $slothastime;
555: }
556: } else {
557: $hastimeleft{$symb} = $duedate - $now;
558: $countdowndisp{$symb} = 'none';
559: }
1.112 raeburn 560: unless ($donebutton{$symb}) {
1.114 raeburn 561: $donebutton{$symb} = 0;
1.112 raeburn 562: }
1.111 raeburn 563: }
564: }
565: }
566: }
1.7 www 567: }
1.12 www 568: $thisdir=~s/\/[^\/]*$//;
1.30 harris41 569: foreach (@rlinks) {
1.91 raeburn 570: unless (($_=~/^https?\:\/\//i) ||
1.31 albertel 571: ($_=~/^\//) ||
572: ($_=~/^javascript:/i) ||
573: ($_=~/^mailto:/i) ||
574: ($_=~/^\#/)) {
1.12 www 575: my $newlocation=
576: &Apache::lonnet::hreflocation($thisdir,$_);
577: $output=~s/(\"|\'|\=\s*)$_(\"|\'|\s|\>)/$1$newlocation$2/;
578: }
1.30 harris41 579: }
1.24 www 580: # -------------------------------------------------- Deal with Applet codebases
581: $output=~s/(\<applet[^\>]+)(codebase\=[^\S\>]+)*([^\>]*)\>/$1.($2?$2:' codebase="'.$thisdir.'"').$3.'>'/gei;
1.5 www 582: $ssibody{$_}=$output;
1.3 www 583: # ---------------------------------------------------------------- End SSI cell
584: }
1.30 harris41 585: }
1.4 www 586: }
1.2 www 587: }
1.6 www 588: unless ($contents) {
1.53 www 589: &Apache::loncommon::content_type($r,'text/html');
1.3 www 590: $r->send_http_header;
1.74 albertel 591: $r->print(&Apache::loncommon::start_page(undef,undef,
592: {'force_register' => 1,}));
1.59 raeburn 593: $r->print(&mt('This page is either empty or it only contains resources that are currently hidden').'. ');
1.74 albertel 594: $r->print('<br /><br />'.&mt('Please use the LON-CAPA navigation arrows to move to another item in the course').
595: &Apache::loncommon::end_page());
1.3 www 596: } else {
597: # ------------------------------------------------------------------ Build page
1.7 www 598:
599: # ---------------------------------------------------------------- Send headers
1.94 raeburn 600: unless (($target eq 'tex') || ($target eq 'tex_answer')) {
1.37 sakharuk 601: if ($isxml) {
1.53 www 602: &Apache::loncommon::content_type($r,'text/xml');
1.37 sakharuk 603: } else {
1.53 www 604: &Apache::loncommon::content_type($r,'text/html');
1.37 sakharuk 605: }
1.74 albertel 606: $r->send_http_header;
1.7 www 607: # ------------------------------------------------------------------------ Head
1.37 sakharuk 608: if ($allscript) {
1.85 albertel 609: $allscript =
610: "\n".'<script type="text/javascript">'."\n".
611: $allscript.
612: "\n</script>\n";
1.37 sakharuk 613: }
1.96 raeburn 614: if (($nforms) && ($nuploads)) {
615: $allscript .= &Apache::lonhtmlcommon::file_submissionchk_js(\%turninpaths,\%multiresps);
616: }
1.101 raeburn 617: if (($nforms) && (&Apache::lonhtmlcommon::htmlareabrowser())) {
618: my %textarea_args = (
619: dragmath => 'math',
620: );
621: $allscript .= &Apache::lonhtmlcommon::htmlareaselectactive(\%textarea_args);
622: }
1.110 raeburn 623: if ($ntimers) {
624: $allscript .= '<script type="text/javascript">'."\n".
625: '// <![CDATA['."\n".
626: 'function pageTimer(form,prefix) {'."\n".
627: " form.elements[prefix+'markaccess'].value = 'yes';\n".
628: " form.submit();\n".
629: '}'."\n".
630: '// ]]>'.
631: "\n</script>\n";
632: }
1.111 raeburn 633: if (keys(%hastimeleft)) {
634: my (%uniquetimes,%uniquedisplays);
635: foreach my $item (values(%hastimeleft)) {
636: if (exists($uniquetimes{$item})) {
637: $uniquetimes{$item} ++;
638: } else {
639: $uniquetimes{$item} = 1;
640: }
641: }
1.114 raeburn 642: if (scalar(keys(%uniquetimes)) == 1) {
643: my (%uniquedisplays,%uniquedones,$currdisp,$donebuttontime,
644: $donebuttonextras);
1.111 raeburn 645: if (keys(%countdowndisp)) {
646: foreach my $item (values(%countdowndisp)) {
647: if (exists($uniquedisplays{$item})) {
648: $uniquedisplays{$item} ++;
649: } else {
650: $uniquedisplays{$item} = 1;
651: }
652: }
653: my @countdowndisplay = keys(%uniquedisplays);
654: if (scalar(@countdowndisplay) == 1) {
655: $currdisp = $countdowndisplay[0];
656: }
657: }
1.112 raeburn 658: if (keys(%donebutton)) {
659: foreach my $item (values(%donebutton)) {
660: if (exists($uniquedones{$item})) {
661: $uniquedones{$item} ++;
662: } else {
663: $uniquedones{$item} = 1;
664: }
665: }
666: my @donebuttons = sort { $ <=> $b } (keys(%uniquedones));
667: if (scalar(@donebuttons) == 1) {
668: if ($donebuttons[0]) {
669: $donebuttontime = $donebuttons[0];
1.114 raeburn 670: if (ref($buttonbytime{$donebuttontime}) eq 'ARRAY') {
671: $donebuttonextras = $donebtnextra{$buttonbytime{$donebuttontime}->[0]};
672: }
1.112 raeburn 673: }
674: }
675: }
1.114 raeburn 676: &add_countdown_timer($currdisp,$donebuttontime,$donebuttonextras);
1.111 raeburn 677: }
678: }
1.7 www 679: # ------------------------------------------------------------------ Start body
1.85 albertel 680: $r->print(&Apache::loncommon::start_page(undef,$allscript,
1.74 albertel 681: {'force_register' => 1,
682: 'bgcolor' => '#ffffff',}));
1.7 www 683: # ------------------------------------------------------------------ Start form
1.37 sakharuk 684: if ($nforms) {
1.96 raeburn 685: my $fmtag = '<form name="lonhomework" method="post" enctype="multipart/form-data"';
686: if ($nuploads) {
687: my $multi;
688: if ($nuploads > 1) {
689: $multi = 1;
690: }
691: $fmtag .= 'onsubmit="return file_submission_check(this,'."'$turninparent','$multi'".');"';
692: }
693: $fmtag .= ' action="'.
1.61 albertel 694: &Apache::lonenc::check_encrypt($requrl)
1.105 raeburn 695: .'" id="LC_page">';
1.96 raeburn 696: $r->print($fmtag);
1.40 sakharuk 697: }
1.94 raeburn 698: } elsif (($target eq 'tex') || ($target eq 'tex_answer')) {
1.92 foxr 699: # I think this is not needed as the header
700: # will be put in for each of the page parts
701: # by the londefdef.pm now that we are opening up
702: # the parts of a page.
703: #$r->print('\documentclass{article}
704: # \newcommand{\keephidden}[1]{}
705: # \usepackage[dvips]{graphicx}
706: # \usepackage{epsfig}
707: # \usepackage{calc}
708: # \usepackage{longtable}
709: # \begin{document}');
1.40 sakharuk 710: }
1.7 www 711: # ----------------------------------------------------------------- Start table
1.94 raeburn 712: if (($target eq 'tex') || ($target eq 'tex_answer')) {
1.92 foxr 713: # # $r->print('\begin{longtable}INSERTTHEHEADOFLONGTABLE\endfirsthead\endhead ');
1.43 sakharuk 714: if ($number_of_columns le $lcm) {$number_of_columns=$lcm;};
1.40 sakharuk 715: } else {
1.63 albertel 716: $r->print('<table width="100%" cols="'.$lcm.'" border="0">');
1.37 sakharuk 717: }
1.78 www 718: # generate rows
1.5 www 719: for ($i=0;$i<=$#rows;$i++) {
720: if ($rows[$i]) {
1.94 raeburn 721: unless (($target eq 'tex') || ($target eq 'tex_answer')) {
1.37 sakharuk 722: $r->print("\n<tr>");
723: }
1.4 www 724: my @colcont=split(/\&/,$rows[$i]);
1.6 www 725: my $avespan=$lcm/($#colcont+1);
726: for ($j=0;$j<=$#colcont;$j++) {
727: my $rid=$colcont[$j];
1.83 albertel 728: my $metainfo =&get_buttons(\%hash,$rid).'<br />';
1.94 raeburn 729: unless (($target eq 'tex') || ($target eq 'tex_answer')) {
1.37 sakharuk 730: $r->print('<td colspan="'.$avespan.'"');
731: }
1.99 raeburn 732: if (($cellemb{$rid} eq 'ssi') || ($cellexternal{$rid})) {
1.94 raeburn 733: unless (($target eq 'tex') || ($target eq 'tex_answer')) {
1.37 sakharuk 734: if ($ssibgcolor{$rid}) {
735: $r->print(' bgcolor="'.
736: $ssibgcolor{$rid}.'"');
737: }
738: $r->print('>'.$metainfo.'<font');
739:
740: if ($ssitext{$rid}) {
741: $r->print(' text="'.$ssitext{$rid}.'"');
742: }
743: if ($ssilink{$rid}) {
744: $r->print(' link="'.$ssilink{$rid}.'"');
745: }
746: if ($ssitext{$rid}) {
747: $r->print(' vlink="'.$ssivlink{$rid}.'"');
748: }
749: if ($ssialink{$rid}) {
750: $r->print(' alink="'.$ssialink{$rid}.'"');
751: }
752: $r->print('>');
753: }
1.99 raeburn 754: unless (($cellexternal{$rid}) &&
755: ($target eq 'tex') && ($target eq 'tex_answer')) {
756: $r->print($ssibody{$rid});
757: }
1.94 raeburn 758: unless (($target eq 'tex') || ($target eq 'tex_answer')) {
1.37 sakharuk 759: $r->print('</font>');
1.41 www 760: }
1.70 albertel 761: if ($env{'course.'.
762: $env{'request.course.id'}.
1.41 www 763: '.pageseparators'} eq 'yes') {
1.94 raeburn 764: unless (($target eq 'tex') || ($target eq 'tex_answer')) {
1.41 www 765: $r->print('<hr />');
1.77 albertel 766: }
1.37 sakharuk 767: }
768: } elsif ($cellemb{$rid} eq 'img') {
1.14 www 769: $r->print('>'.$metainfo.'<img src="'.
1.77 albertel 770: $hash{'src_'.$rid}.'" />');
1.13 www 771: } elsif ($cellemb{$rid} eq 'emb') {
1.14 www 772: $r->print('>'.$metainfo.'<embed src="'.
1.13 www 773: $hash{'src_'.$rid}.'"></embed>');
1.60 raeburn 774: } elsif (&Apache::lonnet::declutter($hash{'src_'.$rid}) !~/\.(sequence|page)$/) {
1.104 raeburn 775: $r->print($metainfo.'<b>'.$hash{'title_'.$rid}.'</b><br />');
776: unless ($cellemb{$rid} eq 'wrp') {
777: $r->print(&mt('It is recommended that you use an up-to-date virus scanner before handling this file.'));
778: }
779: $r->print('</p><p><table>'.
780: &Apache::londocs::entryline(0,
781: &mt("Click to download or use your browser's Save Link function"),
782: '/'.&Apache::lonnet::declutter($hash{'src_'.$rid})).
783: '</table></p><br />');
1.13 www 784: }
1.94 raeburn 785: unless (($target eq 'tex') || ($target eq 'tex_answer')) {
1.37 sakharuk 786: $r->print('</td>');
1.40 sakharuk 787: } else {
1.92 foxr 788: # for (my $incol=1;$incol<=$avespan;$incol++) {
789: # $r->print(' & ');
790: # }
1.37 sakharuk 791: }
1.4 www 792: }
1.94 raeburn 793: unless (($target eq 'tex') || ($target eq 'tex_answer')) {
1.37 sakharuk 794: $r->print('</tr>');
1.40 sakharuk 795: } else {
1.92 foxr 796: # $r->print('REMOVETHEHEADOFLONGTABLE\\\\');
1.37 sakharuk 797: }
1.5 www 798: }
1.4 www 799: }
1.94 raeburn 800: unless (($target eq 'tex') || ($target eq 'tex_answer')) {
1.37 sakharuk 801: $r->print("\n</table>");
1.40 sakharuk 802: } else {
1.92 foxr 803: # $r->print('\end{longtable}\strut');
1.37 sakharuk 804: }
1.7 www 805: # ---------------------------------------------------------------- Submit, etc.
806: if ($nforms) {
1.106 raeburn 807: my $class;
808: if ($nforms > 1) {
809: $class = ' class="LC_hwk_submit"';
1.110 raeburn 810: if ($ntimers) {
811: $nforms = 1;
812: $class = '';
813: }
1.106 raeburn 814: }
1.7 www 815: $r->print(
1.103 bisitz 816: '<input name="all_submit" value="'.&mt('Submit All').'" type="'.
1.106 raeburn 817: (($nforms>1)?'submit':'hidden').'"'.$class.' id="all_submit" />'.
818: '<div id="msg_all_submit" style="display:none">'.
819: &mt('Processing your submission ...').'</div></form>');
1.7 www 820: }
1.94 raeburn 821: unless (($target eq 'tex') || ($target eq 'tex_answer')) {
1.76 albertel 822: $r->print(&Apache::loncommon::end_page({'discussion'
823: => 1,}));
1.40 sakharuk 824: } else {
825: $r->print('\end{document}'.$number_of_columns);
826: }
1.66 albertel 827: &Apache::lonnet::symblist($requrl,%symbhash);
1.69 albertel 828: my ($map,$id,$url)=&Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
829: &Apache::lonnet::symblist($map,'last_known'=>[$url,$id]);
1.3 www 830: # -------------------------------------------------------------------- End page
831: }
1.1 www 832: # ------------------------------------------------------------- End render page
833: } else {
1.67 albertel 834: &Apache::loncommon::content_type($r,'text/html');
1.3 www 835: $r->send_http_header;
1.39 www 836: &Apache::lonsequence::viewmap($r,$requrl);
1.1 www 837: }
838: # ------------------------------------------------------------------ Untie hash
839: unless (untie(%hash)) {
840: &Apache::lonnet::logthis("<font color=blue>WARNING: ".
841: "Could not untie coursemap $fn (browse).</font>");
842: }
843: # -------------------------------------------------------------------- All done
844: return OK;
845: # ----------------------------------------------- Errors, hash could no be tied
846: }
847: }
848: }
1.67 albertel 849: &Apache::loncommon::content_type($r,'text/html');
1.39 www 850: $r->send_http_header;
851: &Apache::lonsequence::viewmap($r,$requrl);
852: return OK;
1.1 www 853: }
854:
1.83 albertel 855: sub get_buttons {
856: my ($hash,$rid) = @_;
857:
858: my $metainfo = '';
859: my $esrc=&Apache::lonnet::declutter($hash->{'src_'.$rid});
860: my ($mapid,$resid)=split(/\./,$rid);
861: my $symb=&Apache::lonnet::encode_symb($hash->{'map_id_'.$mapid},
862: $resid,
863: $hash->{'src_'.$rid});
1.109 raeburn 864: unless ($env{'request.role.adv'}) {
865: if (&Apache::lonnet::EXT('resource.0.buttonshide',$symb)) {
866: return;
867: }
868: }
1.83 albertel 869: if ($hash->{'encrypted_'.$rid}) {
870: $symb=&Apache::lonenc::encrypted($symb);
871: $esrc=&Apache::lonenc::encrypted($esrc);
872: }
873: if ($hash->{'src_'.$rid} !~ m-^/uploaded/-
1.99 raeburn 874: && $hash->{'src_'.$rid} !~ m{^https?://}
1.83 albertel 875: && !$env{'request.enc'}
876: && ($env{'request.role.adv'}
877: || !$hash->{'encrypted_'.$rid})) {
878: $metainfo .='<a name="'.&escape($symb).'" />'.
879: '<a href="'.$hash->{'src_'.$rid}.'.meta'.'" target="LONcatInfo">'.
1.100 bisitz 880: '<img src="/res/adm/pages/catalog.png" class="LC_icon"'.
881: ' alt="'.&mt('Show Metadata').'"'.
882: ' title="'.&mt('Show Metadata').'" />'.
1.83 albertel 883: '</a>';
884: }
1.99 raeburn 885: if (($hash->{'src_'.$rid} !~ m{^/uploaded/}) &&
886: ($hash->{'src_'.$rid} !~ m{^https?://})) {
1.98 raeburn 887: $metainfo .= '<a href="/adm/evaluate?postdata='.
888: &escape($esrc).
889: '" target="LONcatInfo">'.
1.100 bisitz 890: '<img src="/res/adm/pages/eval.png" class="LC_icon"'.
891: ' alt="'.&mt('Provide my evaluation of this resource').'"'.
892: ' title="'.&mt('Provide my evaluation of this resource').'" />'.
1.98 raeburn 893: '</a>';
894: }
1.97 www 895: if (($hash->{'src_'.$rid}=~/$LONCAPA::assess_re/) &&
1.83 albertel 896: ($hash->{'src_'.$rid} !~ m-^/uploaded/-)) {
897:
898: if (&Apache::lonnet::allowed('mgr',$env{'request.course.id'})) {
899: $metainfo.=
900: '<a href="/adm/grades?symb='.&escape($symb).
901: # '&command=submission" target="LONcatInfo">'.
902: '&command=submission">'.
1.100 bisitz 903: '<img src="/adm/lonMisc/subm_button.png" class="LC_icon"'.
904: ' alt="'.&mt('View Submissions for a Student or a Group of Students').'"'.
905: ' title="'.&mt('View Submissions for a Student or a Group of Students').'" />'.
1.83 albertel 906: '</a>'.
907: '<a href="/adm/grades?symb='.&escape($symb).
908: # '&command=gradingmenu" target="LONcatInfo">'.
909: '&command=gradingmenu">'.
1.100 bisitz 910: '<img src="/res/adm/pages/pgrd.png" class="LC_icon"'.
911: ' alt="'.&mt('Content Grades').'"'.
912: ' title="'.&mt('Content Grades').'" />'.
1.83 albertel 913: '</a>';
914: }
915: if (&Apache::lonnet::allowed('opa',$env{'request.course.id'})) {
916: $metainfo.=
917: '<a href="/adm/parmset?symb='.&escape($symb).
918: # '" target="LONcatInfo">'.
919: '" >'.
1.100 bisitz 920: '<img src="/adm/lonMisc/pprm_button.png" class="LC_icon"'.
921: ' alt="'.&mt('Content Settings').'"'.
922: ' title="'.&mt('Content Settings').'" />'.
1.83 albertel 923: '</a>';
924: }
925: }
1.102 raeburn 926: if (($env{'request.course.id'}) && (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) {
927: my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
928: my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
929: my $file=&Apache::lonnet::declutter($hash->{'src_'.$rid});
930: my ($cfile,$home,$switchserver,$forceedit,$forceview) =
931: &Apache::lonnet::can_edit_resource($file,$cnum,$cdom,$hash->{'src_'.$rid},$symb);
932: if ($cfile ne '') {
933: my $jscall = &Apache::lonhtmlcommon::jump_to_editres($cfile,$home,$switchserver,
934: $forceedit,1,$symb,undef,
935: &escape($env{'form.title'}));
936: if ($jscall) {
937: my $icon = 'pcstr.png';
938: my $label = &mt('Edit');
939: my $title = &mt('Edit this resource');
940: my $pic = '<img src="'.&Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$icon).'"'.
941: ' class="LC_icon" alt="'.$label.'" title="'.$title.'" />';
942: $metainfo .= ' <a href="javascript:'.$jscall.';">'.$pic.'</a>';
943: }
944: }
945: }
1.83 albertel 946: return $metainfo;
947: }
948:
1.111 raeburn 949: sub add_countdown_timer {
1.114 raeburn 950: my ($currdisp,$donebuttontime,$donebuttonextras) = @_;
1.112 raeburn 951: my ($collapse,$expand,$alttxt,$title,$donebutton);
1.111 raeburn 952: if ($currdisp eq 'inline') {
953: $collapse = '► ';
954: } else {
955: $expand = '◄ ';
956: }
1.112 raeburn 957: if ($donebuttontime) {
1.114 raeburn 958: my ($type,$proctor,$donebuttontext);
959: if (ref($donebuttonextras) eq 'HASH') {
960: $proctor = $donebuttonextras->{'proctor'};
961: $donebuttontext = $donebuttonextras->{'text'};
962: $type = $donebuttonextras->{'type'};
963: } else {
964: $donebuttontext = &mt('Done');
1.116 raeburn 965: $type = 'map';
1.114 raeburn 966: }
967: $donebutton =
968: &Apache::lonmenu::done_button_js($type,'','',$proctor,$donebuttontext);
1.112 raeburn 969: }
1.111 raeburn 970: unless ($env{'environment.icons'} eq 'iconsonly') {
971: $alttxt = &mt('Timer');
972: $title = $alttxt.' ';
973: }
974: my $desc = &mt('Countdown to due date/time');
975: my $output = <<END;
1.112 raeburn 976: $donebutton
1.111 raeburn 977: <a href="javascript:toggleCountdown();" class="LC_menubuttons_link">
978: <span id="ddcountcollapse" class="LC_menubuttons_inline_text">
979: $collapse
980: </span></a>
981: <span id="duedatecountdown" class="LC_menubuttons_inline_text" style="display: $currdisp;"></span>
982: <a href="javascript:toggleCountdown();" class="LC_menubuttons_link">
983: <span id="ddcountexpand" class="LC_menubuttons_inline_text" >$expand</span>
984: <img src="/res/adm/pages/timer.png" title="$desc" class="LC_icon" alt="$alttxt" /><span class="LC_menubuttons_inline_text">$title</span></a>
985: END
986: &Apache::lonhtmlcommon::clear_breadcrumb_tools();
987: &Apache::lonhtmlcommon::add_breadcrumb_tool('tools',$output);
988: return;
989: }
990:
991:
1.1 www 992: 1;
993: __END__
994:
995:
1.89 jms 996: =head1 NAME
997:
998: Apache::lonpage - Page Handler
999:
1000: =head1 SYNOPSIS
1001:
1002: Invoked by /etc/httpd/conf/srm.conf:
1003:
1004: <LocationMatch "^/res/.*\.page$>
1005: SetHandler perl-script
1006: PerlHandler Apache::lonpage
1007: </LocationMatch>
1008:
1009: =head1 INTRODUCTION
1010:
1011: This module renders a .page resource.
1012:
1013: This is part of the LearningOnline Network with CAPA project
1014: described at http://www.lon-capa.org.
1015:
1016: =head1 HANDLER SUBROUTINE
1017:
1018: This routine is called by Apache and mod_perl.
1019:
1020: =over 4
1021:
1022: =item *
1023:
1024: set document type for header only
1025:
1026: =item *
1027:
1028: tie db file
1029:
1030: =item *
1031:
1032: render page
1033:
1034: =item *
1035:
1036: add to symb list
1037:
1038: =item *
1039:
1040: page parms
1041:
1042: =item *
1043:
1044: Get SSI output, post parameters
1.1 www 1045:
1.89 jms 1046: =item *
1047:
1048: SSI cell rendering
1049:
1050: =item *
1051:
1052: Deal with Applet codebases
1053:
1054: =item *
1055:
1056: Build page
1057:
1058: =item *
1059:
1060: send headers
1061:
1062: =item *
1063:
1064: start body
1065:
1066: =item *
1067:
1068: start form
1069:
1070: =item *
1071:
1072: start table
1073:
1074: =item *
1075:
1076: submit element, etc, render page, untie hash
1077:
1078: =back
1079:
1080: =head1 OTHER SUBROUTINES
1081:
1082: =over 4
1083:
1084: =item *
1085:
1086: euclid() : Euclid's method for determining the greatest common denominator.
1087:
1088: =item *
1089:
1090: tracetable() : Build page table.
1091:
1092: =back
1093:
1094: =cut
1.1 www 1095:
1096:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>