Annotation of rat/lonpageflip.pm, revision 1.76
1.1 www 1: # The LearningOnline Network with CAPA
2: #
3: # Page flip handler
4: #
1.76 ! jms 5: # $Id: lonpageflip.pm,v 1.75 2008/03/12 02:45:50 raeburn Exp $
1.18 www 6: #
7: # Copyright Michigan State University Board of Trustees
8: #
9: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
10: #
11: # LON-CAPA is free software; you can redistribute it and/or modify
12: # it under the terms of the GNU General Public License as published by
13: # the Free Software Foundation; either version 2 of the License, or
14: # (at your option) any later version.
15: #
16: # LON-CAPA is distributed in the hope that it will be useful,
17: # but WITHOUT ANY WARRANTY; without even the implied warranty of
18: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19: # GNU General Public License for more details.
20: #
21: # You should have received a copy of the GNU General Public License
22: # along with LON-CAPA; if not, write to the Free Software
23: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24: #
25: # /home/httpd/html/adm/gpl.txt
26: #
27: # http://www.lon-capa.org/
28: #
1.1 www 29:
1.76 ! jms 30: =pod
! 31:
! 32: =head1 NAME
! 33:
! 34: Apache::lonpageflip
! 35:
! 36: =head1 SYNOPSIS
! 37:
! 38: Deals with forward, backward, and other page flips.
! 39:
! 40: This is part of the LearningOnline Network with CAPA project
! 41: described at http://www.lon-capa.org.
! 42:
! 43: =head1 OVERVIEW
! 44:
! 45: (empty)
! 46:
! 47: =head1 SUBROUTINES
! 48:
! 49: =over cleanup()
! 50:
! 51: =item addrid()
! 52:
! 53: =item fullmove()
! 54:
! 55: =item hash_src()
! 56:
! 57: =item move()
! 58:
! 59: =item get_next_possible_move()
! 60:
! 61: =item navlaunch()
! 62:
! 63: =item first_accessible_resource()
! 64:
! 65: =item handler()
! 66:
! 67: =back
! 68:
! 69: =cut
! 70:
! 71:
1.1 www 72: package Apache::lonpageflip;
73:
74: use strict;
1.68 albertel 75: use LONCAPA;
1.4 www 76: use Apache::Constants qw(:common :http REDIRECT);
1.53 albertel 77: use Apache::lonnet;
1.70 albertel 78: use Apache::loncommon();
1.1 www 79: use HTML::TokeParser;
80: use GDBM_File;
81:
1.3 www 82: # ========================================================== Module Global Hash
83:
1.1 www 84: my %hash;
1.34 www 85:
86: sub cleanup {
87: if (tied(%hash)){
88: &Apache::lonnet::logthis('Cleanup pageflip: hash');
89: unless (untie(%hash)) {
90: &Apache::lonnet::logthis('Failed cleanup pageflip: hash');
91: }
92: }
1.63 albertel 93: return OK;
1.34 www 94: }
1.1 www 95:
1.3 www 96: sub addrid {
1.4 www 97: my ($current,$new,$condid)=@_;
98: unless ($condid) { $condid=0; }
1.27 www 99:
1.3 www 100: if ($current) {
1.5 www 101: $current.=','.$new;
1.3 www 102: } else {
1.5 www 103: $current=''.$new;
1.3 www 104: }
1.27 www 105:
1.3 www 106: return $current;
1.25 www 107: }
108:
109: sub fullmove {
110: my ($rid,$mapurl,$direction)=@_;
1.53 albertel 111: if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'.db',
1.28 albertel 112: &GDBM_READER(),0640)) {
1.25 www 113: ($rid,$mapurl)=&move($rid,$mapurl,$direction);
114: untie(%hash);
115: }
116: return($rid,$mapurl);
1.1 www 117: }
118:
1.50 albertel 119: sub hash_src {
120: my ($id)=@_;
1.56 albertel 121: my ($mapid,$resid)=split(/\./,$id);
122: my $symb=&Apache::lonnet::encode_symb($hash{'map_id_'.$mapid},
123: $resid,$hash{'src_'.$id});
1.50 albertel 124: if ($hash{'encrypted_'.$id}) {
1.56 albertel 125: return (&Apache::lonenc::encrypted($hash{'src_'.$id}),
126: &Apache::lonenc::encrypted($symb));
1.50 albertel 127: }
1.56 albertel 128: return ($hash{'src_'.$id},$symb);
1.50 albertel 129: }
130:
1.15 www 131: sub move {
1.72 albertel 132: my ($next,$endupmap,$direction) = @_;
133: my $safecount=0;
134: my $allowed=0;
135: do {
136: ($next,$endupmap)=&get_next_possible_move($next,$endupmap,$direction);
137:
138: my $url = $hash{'src_'.$next};
139: my ($mapid,$resid)=split(/\./,$next);
140: my $symb = &Apache::lonnet::encode_symb($hash{'map_id_'.$mapid},
141: $resid,$url);
142: if ($url eq '' || $symb eq '') {
143: $allowed = 0;
144: } else {
145: my $priv = &Apache::lonnet::allowed('bre',$url,$symb);
146: $allowed = (($priv eq 'F') || ($priv eq '2'));
147: }
148: $safecount++;
149: } while ( ($next)
150: && ($next!~/\,/)
151: && (
152: (!$hash{'src_'.$next})
153: || (
154: (!$env{'request.role.adv'})
155: && $hash{'randomout_'.$next}
156: )
157: || (!$allowed)
158: )
159: && ($safecount<10000));
160:
161: return ($next,$endupmap);
162: }
163:
164: sub get_next_possible_move {
1.15 www 165: my ($rid,$mapurl,$direction)=@_;
1.23 www 166: my $startoutrid=$rid;
1.15 www 167:
168: my $next='';
169:
170: my $mincond=1;
171: my $posnext='';
172: if ($direction eq 'forward') {
173: # --------------------------------------------------------------------- Forward
1.33 www 174: while ($hash{'type_'.$rid} eq 'finish') {
175: $rid=$hash{'ids_'.$hash{'map_id_'.(split(/\./,$rid))[0]}};
1.15 www 176: }
1.61 albertel 177: foreach my $id (split(/\,/,$hash{'to_'.$rid})) {
1.64 albertel 178: my $condition= $hash{'conditions_'.$hash{'goesto_'.$id}};
179: my $rescond = &Apache::lonnet::docondval($condition);
180: my $linkcond = &Apache::lonnet::directcondval($hash{'condid_'.$hash{'undercond_'.$id}});
181: my $thiscond = ($rescond<$linkcond)?$rescond:$linkcond;
182: if ($thiscond>=$mincond) {
1.15 www 183: if ($posnext) {
1.61 albertel 184: $posnext.=','.$id.':'.$thiscond;
1.15 www 185: } else {
1.61 albertel 186: $posnext=$id.':'.$thiscond;
1.15 www 187: }
188: if ($thiscond>$mincond) { $mincond=$thiscond; }
189: }
1.61 albertel 190: }
191: foreach my $id (split(/\,/,$posnext)) {
192: my ($linkid,$condval)=split(/\:/,$id);
1.15 www 193: if ($condval>=$mincond) {
194: $next=&addrid($next,$hash{'goesto_'.$linkid},
195: $hash{'condid_'.$hash{'undercond_'.$linkid}});
196: }
1.61 albertel 197: }
1.15 www 198: if ($hash{'is_map_'.$next}) {
1.23 www 199: # This jumps to the beginning of a new map (going down level)
1.15 www 200: if (
201: $hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$next}}} eq 'sequence') {
202: $mapurl=$hash{'src_'.$next};
203: $next=$hash{'map_start_'.$hash{'src_'.$next}};
1.47 raeburn 204: } elsif (
205: # This jumps back up from an empty sequence, to a page up one level
206: $hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$next}}} eq 'page') {
207: $mapurl=$hash{'map_id_'.(split(/\./,$next))[0]};
1.15 www 208: }
1.23 www 209: } elsif
210: ((split(/\./,$startoutrid))[0]!=(split(/\./,$next))[0]) {
211: # This comes up from a map (coming up one level);
212: $mapurl=$hash{'map_id_'.(split(/\./,$next))[0]};
1.61 albertel 213: }
1.15 www 214: } elsif ($direction eq 'back') {
215: # ------------------------------------------------------------------- Backwards
1.33 www 216: while ($hash{'type_'.$rid} eq 'start') {
217: $rid=$hash{'ids_'.$hash{'map_id_'.(split(/\./,$rid))[0]}};
218: }
1.62 albertel 219: foreach my $id (split(/\,/,$hash{'from_'.$rid})) {
1.64 albertel 220: my $condition= $hash{'conditions_'.$hash{'comesfrom_'.$id}};
221: my $rescond = &Apache::lonnet::docondval($condition);
222: my $linkcond = &Apache::lonnet::directcondval($hash{'condid_'.$hash{'undercond_'.$id}});
223: my $thiscond = ($rescond<$linkcond)?$rescond:$linkcond;
1.62 albertel 224: if ($thiscond>=$mincond) {
225: if ($posnext) {
226: $posnext.=','.$id.':'.$thiscond;
227: } else {
228: $posnext=$id.':'.$thiscond;
229: }
230: if ($thiscond>$mincond) { $mincond=$thiscond; }
231: }
232: }
233: foreach my $id (split(/\,/,$posnext)) {
234: my ($linkid,$condval)=split(/\:/,$id);
235: if ($condval>=$mincond) {
236: $next=&addrid($next,$hash{'comesfrom_'.$linkid},
237: $hash{'condid_'.$hash{'undercond_'.$linkid}});
238: }
239: }
1.15 www 240: if ($hash{'is_map_'.$next}) {
1.24 www 241: # This jumps to the end of a new map (going down one level)
1.15 www 242: if (
243: $hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$next}}} eq 'sequence') {
244: $mapurl=$hash{'src_'.$next};
245: $next=$hash{'map_finish_'.$hash{'src_'.$next}};
1.47 raeburn 246: } elsif (
247: $hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$next}}} eq 'page') {
248: # This jumps back up from an empty sequence, to a page up one level
249: $mapurl=$hash{'map_id_'.(split(/\./,$next))[0]};
250: }
1.24 www 251: } elsif
252: ((split(/\./,$startoutrid))[0]!=(split(/\./,$next))[0]) {
253: # This comes back up from a map (going up one level);
254: $mapurl=$hash{'map_id_'.(split(/\./,$next))[0]};
1.15 www 255: }
256: }
257: return ($next,$mapurl);
258: }
259:
1.54 albertel 260: sub navlaunch {
261: my ($r)=@_;
262: &Apache::loncommon::content_type($r,'text/html');
263: &Apache::loncommon::no_cache($r);
264: $r->send_http_header;
1.67 albertel 265: $r->print(&Apache::loncommon::start_page('Launched'));
1.54 albertel 266: $r->print(<<ENDNAV);
267: <p><a href="/adm/flip?postdata=firstres%3a">Goto first resource</a></p>
268: <script type="text/javascript">
269: function collapse() {
270: menu=window.open("/adm/navmaps?collapseExternal","loncapanav",
271: "height=600,width=400,scrollbars=1");
272: this.document.location='/adm/navmaps?turningOffExternal';
273: }
274: </script>
1.55 albertel 275: <p><a href="javascript:collapse();">Collapse external navigation window</a></p>
1.54 albertel 276: ENDNAV
1.67 albertel 277: $r->print(&Apache::loncommon::end_page());
1.54 albertel 278: }
1.69 www 279:
280: sub first_accessible_resource {
281: my $furl;
282: if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'.db',
283: &GDBM_READER(),0640)) {
284: $furl=$hash{'first_url'};
1.74 albertel 285: my %args;
286: my ($url,$args) = split(/\?/,$furl);
287: foreach my $pair (split(/\&/,$args)) {
288: my ($name,$value) = split(/=/,$pair);
289: $args{&unescape($name)} = &unescape($value);
290: }
291: if (!&Apache::lonnet::allowed('bre',$url,$args{'symb'})) {
1.69 www 292: # Wow, we cannot see this ... move forward to the next one that we can see
293: my ($newrid,$newmap)=&move($hash{'first_rid'},$hash{'first_mapurl'},'forward');
294: # Build the new URL
1.73 albertel 295: my ($newmapid,$newresid)=split(/\./,$newrid);
1.69 www 296: my $symb=&Apache::lonnet::encode_symb($newmap,$newresid,$hash{'src_'.$newrid});
297: $furl=&add_get_param($hash{'src_'.$newrid},{ 'symb' => $symb });
298: if ($hash{'encrypted_'.$newrid}) {
299: $furl=&Apache::lonenc::encrypted($furl);
300: }
301: }
302: untie(%hash);
303: return $furl;
304: } else {
305: return '/adm/navmaps';
306: }
307: }
308:
1.1 www 309: # ================================================================ Main Handler
310:
311: sub handler {
1.2 www 312: my $r=shift;
1.1 www 313:
314: # ------------------------------------------- Set document type for header only
315:
1.2 www 316: if ($r->header_only) {
1.51 albertel 317: &Apache::loncommon::content_type($r,'text/html');
318: $r->send_http_header;
319: return OK;
1.2 www 320: }
321:
1.5 www 322: my %cachehash=();
323: my $multichoice=0;
324: my %multichoicehash=();
1.56 albertel 325: my ($redirecturl,$redirectsymb);
1.4 www 326: my $next='';
327: my @possibilities=();
1.37 www 328: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['postdata']);
1.53 albertel 329: if (($env{'form.postdata'})&&($env{'request.course.fn'})) {
330: $env{'form.postdata'}=~/(\w+)\:(.*)/;
1.2 www 331: my $direction=$1;
1.40 www 332: my $currenturl=$2;
1.50 albertel 333: if ($currenturl=~m|^/enc/|) {
334: $currenturl=&Apache::lonenc::unencrypted($currenturl);
335: }
1.46 www 336: $currenturl=~s/\.\d+\.(\w+)$/\.$1/;
1.54 albertel 337: if ($direction eq 'firstres') {
1.69 www 338: my $furl=&first_accessible_resource();
1.54 albertel 339: &Apache::loncommon::content_type($r,'text/html');
340: $r->header_out(Location =>
1.71 albertel 341: &Apache::lonnet::absolute_url().$furl);
1.54 albertel 342:
343: return REDIRECT;
344: }
345: if ($direction eq 'return' || $direction eq 'navlaunch') {
1.10 www 346: # -------------------------------------------------------- Return to last known
347: my $last;
1.53 albertel 348: if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',
1.28 albertel 349: &GDBM_READER(),0640)) {
1.10 www 350: $last=$hash{'last_known'};
351: untie(%hash);
352: }
353: my $newloc;
1.53 albertel 354: if (($last) && (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'.db',
1.36 www 355: &GDBM_READER(),0640))) {
1.52 albertel 356: my ($murl,$id,$fn)=&Apache::lonnet::decode_symb($last);
1.50 albertel 357: $id=$hash{'map_pc_'.&Apache::lonnet::clutter($murl)}.'.'.$id;
358: $newloc=$hash{'src_'.$id};
359: if ($newloc) {
360: if ($hash{'encrypted_'.$id}) { $newloc=&Apache::lonenc::encrypted($newloc); }
361:
362: } else {
1.57 www 363: $newloc='/adm/navmaps';
1.50 albertel 364: }
1.36 www 365: untie %hash;
1.10 www 366: } else {
1.57 www 367: $newloc='/adm/navmaps';
1.10 www 368: }
1.57 www 369: if ($newloc eq '/adm/navmaps' && $direction eq 'navlaunch') {
1.54 albertel 370: &navlaunch($r);
371: return OK;
372: } else {
373: &Apache::loncommon::content_type($r,'text/html');
374: $r->header_out(Location =>
1.71 albertel 375: &Apache::lonnet::absolute_url().$newloc);
1.54 albertel 376:
377: return REDIRECT;
378: }
1.10 www 379: }
1.2 www 380: $currenturl=~s/^http\:\/\///;
381: $currenturl=~s/^[^\/]+//;
1.35 www 382: #
383: # Is the current URL on the map? If not, start with last known URL
384: #
385: unless (&Apache::lonnet::is_on_map($currenturl)) {
1.7 www 386: my $last;
1.53 albertel 387: if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',
1.28 albertel 388: &GDBM_READER(),0640)) {
1.7 www 389: $last=$hash{'last_known'};
390: untie(%hash);
391: }
392: if ($last) {
1.52 albertel 393: $currenturl=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($last))[2]);
1.7 www 394: } else {
1.54 albertel 395: if ($direction eq 'return') {
396: &Apache::loncommon::content_type($r,'text/html');
397: $r->header_out(Location =>
1.71 albertel 398: &Apache::lonnet::absolute_url().
1.70 albertel 399: '/adm/noidea.html');
1.54 albertel 400: return REDIRECT;
401: } else {
402: &navlaunch($r);
403: return OK;
404: }
1.7 www 405: }
406: }
1.3 www 407: # ------------------------------------------- Do we have any idea where we are?
408: my $position;
409: if ($position=Apache::lonnet::symbread($currenturl)) {
410: # ------------------------------------------------------------------------- Yes
1.41 www 411: my ($startoutmap,$mapnum,$thisurl)=&Apache::lonnet::decode_symb($position);
1.52 albertel 412: $cachehash{$startoutmap}{$thisurl}=[$thisurl,$mapnum];
1.23 www 413: $cachehash{$startoutmap}{'last_known'}=
1.52 albertel 414: [&Apache::lonnet::declutter($currenturl),$mapnum];
1.20 albertel 415:
1.5 www 416: # ============================================================ Tie the big hash
1.53 albertel 417: if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'.db',
1.28 albertel 418: &GDBM_READER(),0640)) {
1.29 www 419: my $rid=$hash{'map_pc_'.&Apache::lonnet::clutter($startoutmap)}.
420: '.'.$mapnum;
1.14 www 421:
1.15 www 422: # ------------------------------------------------- Move forward, backward, etc
1.22 www 423: my $endupmap;
424: ($next,$endupmap)=&move($rid,$startoutmap,$direction);
1.15 www 425: # -------------------------------------- Do we have one and only one empty URL?
1.22 www 426: # We are now at at least one non-empty URL
1.4 www 427: # ----------------------------------------------------- Check out possibilities
428: if ($next) {
429: @possibilities=split(/\,/,$next);
430: if ($#possibilities==0) {
1.5 www 431: # ---------------------------------------------- Only one possibility, redirect
1.56 albertel 432: ($redirecturl,$redirectsymb)=&hash_src($next);
1.52 albertel 433: $cachehash{$endupmap}{$redirecturl}=
434: [$redirecturl,(split(/\./,$next))[1]];
1.4 www 435: } else {
1.5 www 436: # ------------------------ There are multiple possibilities for a next resource
437: $multichoice=1;
1.62 albertel 438: foreach my $id (@possibilities) {
439: $multichoicehash{'src_'.$id}=$hash{'src_'.$id};
440: $multichoicehash{'title_'.$id}=$hash{'title_'.$id};
441: $multichoicehash{'type_'.$id}=$hash{'type_'.$id};
442: (my $first, my $second) = $id =~ /(\d+).(\d+)/;
443: my $symbSrc = Apache::lonnet::declutter($hash{'src_'.$id});
444: $multichoicehash{'symb_'.$id} =
1.32 bowersj2 445: Apache::lonnet::declutter($hash{'map_id_'.$first}.'___'.
446: $second.'___'.$symbSrc);
447:
1.62 albertel 448: my ($choicemap,$choiceres)=split(/\./,$id);
1.52 albertel 449: my $map=&Apache::lonnet::declutter($hash{'src_'.$choicemap});
1.62 albertel 450: my $url=$multichoicehash{'src_'.$id};
1.52 albertel 451: $cachehash{$map}{$url}=[$url,$choiceres];
1.62 albertel 452: }
1.4 www 453: }
1.5 www 454: } else {
455: # -------------------------------------------------------------- No place to go
456: $multichoice=-1;
1.4 www 457: }
1.5 www 458: # ----------------- The program must come past this point to untie the big hash
1.3 www 459: untie(%hash);
1.5 www 460: # --------------------------------------------------------- Store position info
1.52 albertel 461: $cachehash{$startoutmap}{'last_direction'}=[$direction,'notasymb'];
1.19 www 462: foreach my $thismap (keys %cachehash) {
1.52 albertel 463: my $mapnum=$cachehash{$thismap}->{'mapnum'};
464: delete($cachehash{$thismap}->{'mapnum'});
465: &Apache::lonnet::symblist($thismap,
466: %{$cachehash{$thismap}});
1.19 www 467: }
1.5 www 468: # ============================================== Do not return before this line
1.4 www 469: if ($redirecturl) {
1.5 www 470: # ----------------------------------------------------- There is a URL to go to
1.38 www 471: if ($direction eq 'forward') {
472: &Apache::lonnet::linklog($currenturl,$redirecturl);
473: }
474: if ($direction eq 'back') {
475: &Apache::lonnet::linklog($redirecturl,$currenturl);
476: }
1.31 www 477: # ------------------------------------------------- Check for critical messages
1.53 albertel 478: if ((time-$env{'user.criticalcheck.time'})>300) {
1.31 www 479: my @what=&Apache::lonnet::dump
1.53 albertel 480: ('critical',$env{'user.domain'},
481: $env{'user.name'});
1.31 www 482: if ($what[0]) {
483: if (($what[0] ne 'con_lost') &&
484: ($what[0]!~/^error\:/)) {
485: $redirecturl='/adm/email?critical=display';
1.56 albertel 486: $redirectsymb='';
1.31 www 487: }
488: }
1.75 raeburn 489: &Apache::lonnet::appenv({'user.criticalcheck.time'=>time});
1.31 www 490: }
491:
1.51 albertel 492: &Apache::loncommon::content_type($r,'text/html');
1.71 albertel 493: my $url=&Apache::lonnet::absolute_url().$redirecturl;
1.66 albertel 494: $url = &add_get_param($url, { 'symb' => $redirectsymb});
1.56 albertel 495: $r->header_out(Location => $url);
1.4 www 496: return REDIRECT;
1.5 www 497: } else {
498: # --------------------------------------------------------- There was a problem
1.51 albertel 499: &Apache::loncommon::content_type($r,'text/html');
1.8 www 500: $r->send_http_header;
1.59 www 501: my %lt=&Apache::lonlocal::texthash('title' => 'End of Sequence',
502: 'explain' =>
503: 'You have reached the end of the sequence of materials.',
504: 'back' => 'Go Back',
505: 'nav' => 'Navigate Course Content',
506: 'wherenext' =>
507: 'There are several possibilities of where to go next',
508: 'pick' =>
509: 'Please click on the the resource you intend to access',
510: 'titleheader' => 'Title',
511: 'type' => 'Type');
1.8 www 512: if ($#possibilities>0) {
1.67 albertel 513: my $start_page=
514: &Apache::loncommon::start_page('Multiple Resources');
1.8 www 515: $r->print(<<ENDSTART);
1.67 albertel 516: $start_page
1.59 www 517: <h3>$lt{'wherenext'}</h3>
1.8 www 518: <p>
1.59 www 519: $lt{'pick'}:
1.8 www 520: <p>
521: <table border=2>
1.59 www 522: <tr><th>$lt{'titleheader'}</th><th>$lt{'type'}</th></tr>
1.8 www 523: ENDSTART
1.62 albertel 524: foreach my $id (@possibilities) {
1.8 www 525: $r->print(
526: '<tr><td><a href="'.
1.66 albertel 527: &add_get_param($multichoicehash{'src_'.$id},
528: {'symb' =>
529: $multichoicehash{'symb_'.$id},
530: }).'">'.
1.62 albertel 531: $multichoicehash{'title_'.$id}.
532: '</a></td><td>'.$multichoicehash{'type_'.$id}.
1.8 www 533: '</td></tr>');
1.26 www 534: }
1.59 www 535: $r->print('</table>');
1.8 www 536: } else {
1.67 albertel 537: my $start_page=
538: &Apache::loncommon::start_page('No Resource');
1.59 www 539: $r->print(<<ENDNONE);
1.67 albertel 540: $start_page
1.59 www 541: <h3>$lt{'title'}</h3>
542: <p>$lt{'explain'}</p>
543: ENDNONE
544: }
545: $r->print(<<ENDMENU);
1.37 www 546: <ul>
1.59 www 547: <li><a href="/adm/flip?postdata=return:">$lt{'back'}</a></li>
548: <li><a href="/adm/navmaps">$lt{'nav'}</a></li>
1.67 albertel 549: </ul>
1.59 www 550: ENDMENU
1.67 albertel 551: $r->print(&Apache::loncommon::end_page());
1.59 www 552: return OK;
553: }
1.5 www 554: } else {
555: # ------------------------------------------------- Problem, could not tie hash
1.53 albertel 556: $env{'user.error.msg'}="/adm/flip:bre:0:1:Course Data Missing";
1.5 www 557: return HTTP_NOT_ACCEPTABLE;
1.3 www 558: }
1.5 www 559: } else {
560: # ---------------------------------------- No, could not determine where we are
1.42 albertel 561: $r->internal_redirect('/adm/ambiguous');
1.2 www 562: }
1.5 www 563: } else {
1.2 www 564: # -------------------------- Class was not initialized or page fliped strangely
1.53 albertel 565: $env{'user.error.msg'}="/adm/flip:bre:0:0:Choose Course";
1.2 www 566: return HTTP_NOT_ACCEPTABLE;
567: }
1.1 www 568: }
569:
570: 1;
571: __END__
572:
573:
574:
575:
576:
577:
578:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>