Annotation of rat/lonpageflip.pm, revision 1.68

1.1       www         1: # The LearningOnline Network with CAPA
                      2: #
                      3: # Page flip handler
                      4: #
1.68    ! albertel    5: # $Id: lonpageflip.pm,v 1.67 2006/03/19 23:06:00 albertel 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: 
                     30: package Apache::lonpageflip;
                     31: 
                     32: use strict;
1.68    ! albertel   33: use LONCAPA;
1.4       www        34: use Apache::Constants qw(:common :http REDIRECT);
1.53      albertel   35: use Apache::lonnet;
1.1       www        36: use HTML::TokeParser;
                     37: use GDBM_File;
                     38: 
1.3       www        39: # ========================================================== Module Global Hash
                     40:   
1.1       www        41: my %hash;
1.34      www        42: 
                     43: sub cleanup {
                     44:     if (tied(%hash)){
                     45: 	&Apache::lonnet::logthis('Cleanup pageflip: hash');
                     46:         unless (untie(%hash)) {
                     47: 	    &Apache::lonnet::logthis('Failed cleanup pageflip: hash');
                     48:         }
                     49:     }
1.63      albertel   50:     return OK;
1.34      www        51: }
1.1       www        52: 
1.3       www        53: sub addrid {
1.4       www        54:     my ($current,$new,$condid)=@_;
                     55:     unless ($condid) { $condid=0; }
1.27      www        56: 
1.3       www        57: 	if ($current) {
1.5       www        58: 	    $current.=','.$new;
1.3       www        59:         } else {
1.5       www        60:             $current=''.$new;
1.3       www        61:         }
1.27      www        62: 
1.3       www        63:     return $current;
1.25      www        64: }
                     65: 
                     66: sub fullmove {
                     67:     my ($rid,$mapurl,$direction)=@_;
1.53      albertel   68:     if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'.db',
1.28      albertel   69:                         &GDBM_READER(),0640)) {
1.25      www        70: 	($rid,$mapurl)=&move($rid,$mapurl,$direction);
                     71:         untie(%hash);
                     72:     }
                     73:     return($rid,$mapurl);
1.1       www        74: }
                     75: 
1.50      albertel   76: sub hash_src {
                     77:     my ($id)=@_;
1.56      albertel   78:     my ($mapid,$resid)=split(/\./,$id);
                     79:     my $symb=&Apache::lonnet::encode_symb($hash{'map_id_'.$mapid},
                     80: 					  $resid,$hash{'src_'.$id});
1.50      albertel   81:     if ($hash{'encrypted_'.$id}) {
1.56      albertel   82: 	return (&Apache::lonenc::encrypted($hash{'src_'.$id}),
                     83: 		&Apache::lonenc::encrypted($symb));
1.50      albertel   84:     }
1.56      albertel   85:     return ($hash{'src_'.$id},$symb);
1.50      albertel   86: }
                     87: 
1.15      www        88: sub move {
                     89:     my ($rid,$mapurl,$direction)=@_;
1.23      www        90:     my $startoutrid=$rid;
1.15      www        91: 
                     92:     my $next='';
                     93: 
                     94:               my $mincond=1;
                     95:               my $posnext='';
                     96:               if ($direction eq 'forward') {
                     97: # --------------------------------------------------------------------- Forward
1.33      www        98:                   while ($hash{'type_'.$rid} eq 'finish') {
                     99: 	             $rid=$hash{'ids_'.$hash{'map_id_'.(split(/\./,$rid))[0]}};
1.15      www       100:                   }
1.61      albertel  101: 		  foreach my $id (split(/\,/,$hash{'to_'.$rid})) {
1.64      albertel  102: 		     my $condition= $hash{'conditions_'.$hash{'goesto_'.$id}};
                    103: 		     my $rescond  = &Apache::lonnet::docondval($condition);
                    104: 		     my $linkcond = &Apache::lonnet::directcondval($hash{'condid_'.$hash{'undercond_'.$id}});
                    105: 		     my $thiscond = ($rescond<$linkcond)?$rescond:$linkcond;
                    106: 		     if ($thiscond>=$mincond) {
1.15      www       107: 		          if ($posnext) {
1.61      albertel  108: 		             $posnext.=','.$id.':'.$thiscond;
1.15      www       109:                           } else {
1.61      albertel  110:                              $posnext=$id.':'.$thiscond;
1.15      www       111: 		          }
                    112:                           if ($thiscond>$mincond) { $mincond=$thiscond; }
                    113: 	              }
1.61      albertel  114:                   } 
                    115: 		  foreach my $id (split(/\,/,$posnext))  {
                    116:                       my ($linkid,$condval)=split(/\:/,$id);
1.15      www       117:                       if ($condval>=$mincond) {
                    118: 		          $next=&addrid($next,$hash{'goesto_'.$linkid},
                    119:                                 $hash{'condid_'.$hash{'undercond_'.$linkid}});
                    120:                       }
1.61      albertel  121:                   }
1.15      www       122:                   if ($hash{'is_map_'.$next}) {
1.23      www       123: # This jumps to the beginning of a new map (going down level)
1.15      www       124:                       if (
                    125:       $hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$next}}} eq 'sequence') {
                    126: 			  $mapurl=$hash{'src_'.$next};
                    127: 			  $next=$hash{'map_start_'.$hash{'src_'.$next}};
1.47      raeburn   128:                      } elsif (
                    129: # This jumps back up from an empty sequence, to a page up one level
                    130:                          $hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$next}}} eq 'page') {
                    131:                          $mapurl=$hash{'map_id_'.(split(/\./,$next))[0]};
1.15      www       132:                      }
1.23      www       133:                   } elsif 
                    134:                     ((split(/\./,$startoutrid))[0]!=(split(/\./,$next))[0]) {
                    135: # This comes up from a map (coming up one level);
                    136: 		      $mapurl=$hash{'map_id_'.(split(/\./,$next))[0]};
1.61      albertel  137: 		  }
1.15      www       138:               } elsif ($direction eq 'back') {
                    139: # ------------------------------------------------------------------- Backwards
1.33      www       140:                  while ($hash{'type_'.$rid} eq 'start') {
                    141: 	             $rid=$hash{'ids_'.$hash{'map_id_'.(split(/\./,$rid))[0]}};
                    142: 		 }
1.62      albertel  143: 		 foreach my $id (split(/\,/,$hash{'from_'.$rid})) {
1.64      albertel  144: 		     my $condition= $hash{'conditions_'.$hash{'comesfrom_'.$id}};
                    145: 		     my $rescond  = &Apache::lonnet::docondval($condition);
                    146: 		     my $linkcond = &Apache::lonnet::directcondval($hash{'condid_'.$hash{'undercond_'.$id}});
                    147: 		     my $thiscond = ($rescond<$linkcond)?$rescond:$linkcond;
1.62      albertel  148: 		     if ($thiscond>=$mincond) {
                    149: 			 if ($posnext) {
                    150: 		             $posnext.=','.$id.':'.$thiscond;
                    151: 			 } else {
                    152:                              $posnext=$id.':'.$thiscond;
                    153: 			 }
                    154: 			 if ($thiscond>$mincond) { $mincond=$thiscond; }
                    155: 		     }
                    156: 		 } 
                    157: 		 foreach my $id (split(/\,/,$posnext)) {
                    158: 		     my ($linkid,$condval)=split(/\:/,$id);
                    159: 		     if ($condval>=$mincond) {
                    160: 			 $next=&addrid($next,$hash{'comesfrom_'.$linkid},
                    161: 				       $hash{'condid_'.$hash{'undercond_'.$linkid}});
                    162: 		     }
                    163: 		 }
1.15      www       164:                   if ($hash{'is_map_'.$next}) {
1.24      www       165: # This jumps to the end of a new map (going down one level)
1.15      www       166:                       if (
                    167:       $hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$next}}} eq 'sequence') {
                    168: 			  $mapurl=$hash{'src_'.$next};
                    169: 			  $next=$hash{'map_finish_'.$hash{'src_'.$next}};
1.47      raeburn   170:                       } elsif (
                    171:       $hash{'map_type_'.$hash{'map_pc_'.$hash{'src_'.$next}}} eq 'page') {
                    172: # This jumps back up from an empty sequence, to a page up one level
                    173:                           $mapurl=$hash{'map_id_'.(split(/\./,$next))[0]};
                    174:                       }
1.24      www       175:                   } elsif 
                    176:                     ((split(/\./,$startoutrid))[0]!=(split(/\./,$next))[0]) {
                    177: # This comes back up from a map (going up one level);
                    178: 		      $mapurl=$hash{'map_id_'.(split(/\./,$next))[0]};
1.15      www       179:                   }
                    180: 	      }
                    181:               return ($next,$mapurl);
                    182: }
                    183: 
1.54      albertel  184: sub navlaunch {
                    185:     my ($r)=@_;
                    186:     &Apache::loncommon::content_type($r,'text/html');
                    187:     &Apache::loncommon::no_cache($r);
                    188:     $r->send_http_header;
1.67      albertel  189:     $r->print(&Apache::loncommon::start_page('Launched'));   
1.54      albertel  190:     $r->print(<<ENDNAV);
                    191:     <p><a href="/adm/flip?postdata=firstres%3a">Goto first resource</a></p>
                    192:     <script type="text/javascript">
                    193: 	function collapse() {
                    194: 	    menu=window.open("/adm/navmaps?collapseExternal","loncapanav",
                    195: 			     "height=600,width=400,scrollbars=1");
                    196: 	    this.document.location='/adm/navmaps?turningOffExternal';
                    197: 	}
                    198:     </script>
1.55      albertel  199:     <p><a href="javascript:collapse();">Collapse external navigation window</a></p>
1.54      albertel  200: ENDNAV
1.67      albertel  201:     $r->print(&Apache::loncommon::end_page());
1.54      albertel  202: }
1.1       www       203: # ================================================================ Main Handler
                    204: 
                    205: sub handler {
1.2       www       206:    my $r=shift;
1.1       www       207: 
                    208: # ------------------------------------------- Set document type for header only
                    209: 
1.2       www       210:   if ($r->header_only) {
1.51      albertel  211:       &Apache::loncommon::content_type($r,'text/html');
                    212:       $r->send_http_header;
                    213:       return OK;
1.2       www       214:   }
                    215: 
1.5       www       216:   my %cachehash=(); 
                    217:   my $multichoice=0;
                    218:   my %multichoicehash=();
1.56      albertel  219:   my ($redirecturl,$redirectsymb);
1.4       www       220:   my $next='';
                    221:   my @possibilities=();
1.37      www       222:    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['postdata']);
1.53      albertel  223:   if (($env{'form.postdata'})&&($env{'request.course.fn'})) {
                    224:       $env{'form.postdata'}=~/(\w+)\:(.*)/;
1.2       www       225:       my $direction=$1;
1.40      www       226:       my $currenturl=$2;
1.50      albertel  227:       if ($currenturl=~m|^/enc/|) {
                    228: 	  $currenturl=&Apache::lonenc::unencrypted($currenturl);
                    229:       }
1.46      www       230:       $currenturl=~s/\.\d+\.(\w+)$/\.$1/;
1.54      albertel  231:       if ($direction eq 'firstres') {
                    232: 	  my $furl;
                    233: 	  if (tie(my %bighash,'GDBM_File',$env{'request.course.fn'}.'.db',
                    234: 		  &GDBM_READER(),0640)) {
                    235: 	      $furl=$bighash{'first_url'};
                    236: 	      untie(%bighash);
                    237: 	  }
                    238: 	  &Apache::loncommon::content_type($r,'text/html');
                    239: 	  $r->header_out(Location => 
                    240: 			 'http://'.$ENV{'HTTP_HOST'}.$furl);
                    241: 	     
                    242: 	  return REDIRECT;
                    243:       }
                    244:       if ($direction eq 'return' || $direction eq 'navlaunch') {
1.10      www       245: # -------------------------------------------------------- Return to last known
                    246:          my $last;
1.53      albertel  247:          if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',
1.28      albertel  248:                     &GDBM_READER(),0640)) {
1.10      www       249: 	     $last=$hash{'last_known'};
                    250:              untie(%hash);
                    251:          }
                    252:          my $newloc;
1.53      albertel  253:          if (($last) && (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'.db',
1.36      www       254:                         &GDBM_READER(),0640))) {
1.52      albertel  255:             my ($murl,$id,$fn)=&Apache::lonnet::decode_symb($last);
1.50      albertel  256: 	    $id=$hash{'map_pc_'.&Apache::lonnet::clutter($murl)}.'.'.$id;
                    257: 	    $newloc=$hash{'src_'.$id};
                    258: 	    if ($newloc) {
                    259: 		if ($hash{'encrypted_'.$id}) { $newloc=&Apache::lonenc::encrypted($newloc); }
                    260: 			      
                    261: 	    } else {
1.57      www       262: 		$newloc='/adm/navmaps';
1.50      albertel  263: 	    }
1.36      www       264:             untie %hash;
1.10      www       265:          } else {
1.57      www       266: 	    $newloc='/adm/navmaps';
1.10      www       267:          }  
1.57      www       268: 	 if ($newloc eq '/adm/navmaps' && $direction eq 'navlaunch') {
1.54      albertel  269: 	     &navlaunch($r);
                    270: 	     return OK;
                    271: 	 } else {
                    272: 	     &Apache::loncommon::content_type($r,'text/html');
                    273: 	     $r->header_out(Location => 
                    274: 			    'http://'.$ENV{'HTTP_HOST'}.$newloc);
                    275: 	     
                    276: 	     return REDIRECT;
                    277: 	 }
1.10      www       278:       }
1.2       www       279:       $currenturl=~s/^http\:\/\///;
                    280:       $currenturl=~s/^[^\/]+//;
1.35      www       281: #
                    282: # Is the current URL on the map? If not, start with last known URL
                    283: #
                    284:       unless (&Apache::lonnet::is_on_map($currenturl)) {
1.7       www       285: 	 my $last;
1.53      albertel  286:          if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',
1.28      albertel  287:                     &GDBM_READER(),0640)) {
1.7       www       288: 	     $last=$hash{'last_known'};
                    289:              untie(%hash);
                    290:          }
                    291:          if ($last) {
1.52      albertel  292: 	     $currenturl=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($last))[2]);
1.7       www       293: 	 } else {
1.54      albertel  294: 	     if ($direction eq 'return') {
                    295: 		 &Apache::loncommon::content_type($r,'text/html');
                    296: 		 $r->header_out(Location => 
                    297: 				'http://'.$ENV{'HTTP_HOST'}.'/adm/noidea.html');
                    298: 		 return REDIRECT;
                    299: 	     } else {
                    300: 		 &navlaunch($r);
                    301: 		 return OK;
                    302: 	     }
1.7       www       303:          }
                    304:       }
1.3       www       305: # ------------------------------------------- Do we have any idea where we are?
                    306:       my $position;
                    307:       if ($position=Apache::lonnet::symbread($currenturl)) {
                    308: # ------------------------------------------------------------------------- Yes
1.41      www       309: 	  my ($startoutmap,$mapnum,$thisurl)=&Apache::lonnet::decode_symb($position);
1.52      albertel  310:           $cachehash{$startoutmap}{$thisurl}=[$thisurl,$mapnum];
1.23      www       311:           $cachehash{$startoutmap}{'last_known'}=
1.52      albertel  312:                              [&Apache::lonnet::declutter($currenturl),$mapnum];
1.20      albertel  313: 
1.5       www       314: # ============================================================ Tie the big hash
1.53      albertel  315:           if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'.db',
1.28      albertel  316:                         &GDBM_READER(),0640)) {
1.29      www       317:               my $rid=$hash{'map_pc_'.&Apache::lonnet::clutter($startoutmap)}.
                    318:                       '.'.$mapnum;
1.14      www       319: 
1.15      www       320: # ------------------------------------------------- Move forward, backward, etc
1.22      www       321:               my $endupmap;
                    322:               ($next,$endupmap)=&move($rid,$startoutmap,$direction);
1.15      www       323: # -------------------------------------- Do we have one and only one empty URL?
                    324:               my $safecount=0;
1.26      www       325:               while (($next) && ($next!~/\,/) && 
1.48      albertel  326:                      ((!$hash{'src_'.$next}) || 
1.53      albertel  327: 		      ((!$env{'request.role.adv'}) && $hash{'randomout_'.$next}))
1.26      www       328:                      && ($safecount<10000)) {
1.22      www       329:                   ($next,$endupmap)=&move($next,$endupmap,$direction);
1.15      www       330:                   $safecount++;
                    331:               }
1.22      www       332: # We are now at at least one non-empty URL
1.4       www       333: # ----------------------------------------------------- Check out possibilities
                    334:               if ($next) {
                    335:                   @possibilities=split(/\,/,$next);
                    336:                   if ($#possibilities==0) {
1.5       www       337: # ---------------------------------------------- Only one possibility, redirect
1.56      albertel  338: 	              ($redirecturl,$redirectsymb)=&hash_src($next);
1.52      albertel  339:                       $cachehash{$endupmap}{$redirecturl}=
                    340: 			  [$redirecturl,(split(/\./,$next))[1]];
1.4       www       341:                   } else {
1.5       www       342: # ------------------------ There are multiple possibilities for a next resource
                    343:                       $multichoice=1;
1.62      albertel  344: 		      foreach my $id (@possibilities) {
                    345: 			  $multichoicehash{'src_'.$id}=$hash{'src_'.$id};
                    346:                           $multichoicehash{'title_'.$id}=$hash{'title_'.$id};
                    347:                           $multichoicehash{'type_'.$id}=$hash{'type_'.$id};
                    348:                           (my $first, my $second) = $id =~ /(\d+).(\d+)/;
                    349:                           my $symbSrc = Apache::lonnet::declutter($hash{'src_'.$id});
                    350:                           $multichoicehash{'symb_'.$id} = 
1.32      bowersj2  351:                               Apache::lonnet::declutter($hash{'map_id_'.$first}.'___'.
                    352:                                                         $second.'___'.$symbSrc);
                    353:                                                          
1.62      albertel  354:                           my ($choicemap,$choiceres)=split(/\./,$id);
1.52      albertel  355: 			  my $map=&Apache::lonnet::declutter($hash{'src_'.$choicemap});
1.62      albertel  356: 			  my $url=$multichoicehash{'src_'.$id};
1.52      albertel  357:                           $cachehash{$map}{$url}=[$url,$choiceres];
1.62      albertel  358:                       }
1.4       www       359:                   }
1.5       www       360: 	      } else {
                    361: # -------------------------------------------------------------- No place to go
                    362:                   $multichoice=-1;
1.4       www       363:               }
1.5       www       364: # ----------------- The program must come past this point to untie the big hash
1.3       www       365: 	      untie(%hash);
1.5       www       366: # --------------------------------------------------------- Store position info
1.52      albertel  367:               $cachehash{$startoutmap}{'last_direction'}=[$direction,'notasymb'];
1.19      www       368:               foreach my $thismap (keys %cachehash) {
1.52      albertel  369: 		  my $mapnum=$cachehash{$thismap}->{'mapnum'};
                    370: 		  delete($cachehash{$thismap}->{'mapnum'});
                    371: 		  &Apache::lonnet::symblist($thismap,
                    372: 					    %{$cachehash{$thismap}});
1.19      www       373: 	      }
1.5       www       374: # ============================================== Do not return before this line
1.4       www       375:               if ($redirecturl) {
1.5       www       376: # ----------------------------------------------------- There is a URL to go to
1.38      www       377: 		  if ($direction eq 'forward') {
                    378:                      &Apache::lonnet::linklog($currenturl,$redirecturl);
                    379: 		  }
                    380: 		  if ($direction eq 'back') {
                    381:                      &Apache::lonnet::linklog($redirecturl,$currenturl);
                    382: 		  }
1.31      www       383: # ------------------------------------------------- Check for critical messages
1.53      albertel  384: 		  if ((time-$env{'user.criticalcheck.time'})>300) {
1.31      www       385:                      my @what=&Apache::lonnet::dump
1.53      albertel  386:                                   ('critical',$env{'user.domain'},
                    387:                                               $env{'user.name'});
1.31      www       388:                      if ($what[0]) {
                    389: 	                if (($what[0] ne 'con_lost') && 
                    390:                             ($what[0]!~/^error\:/)) {
                    391: 	                   $redirecturl='/adm/email?critical=display';
1.56      albertel  392: 			   $redirectsymb='';
1.31      www       393:                         }
                    394:                      }
                    395:                      &Apache::lonnet::appenv('user.criticalcheck.time'=>time);
                    396: 		  }
                    397: 
1.51      albertel  398: 		  &Apache::loncommon::content_type($r,'text/html');
1.56      albertel  399: 		  my $url='http://'.$ENV{'HTTP_HOST'}.$redirecturl;
1.66      albertel  400: 		  $url = &add_get_param($url, { 'symb' => $redirectsymb});
1.56      albertel  401:                   $r->header_out(Location => $url);
1.4       www       402:                   return REDIRECT;
1.5       www       403: 	      } else {
                    404: # --------------------------------------------------------- There was a problem
1.51      albertel  405:                   &Apache::loncommon::content_type($r,'text/html');
1.8       www       406:                   $r->send_http_header;
1.59      www       407: 		  my %lt=&Apache::lonlocal::texthash('title' => 'End of Sequence',
                    408: 						     'explain' =>
                    409: 						     'You have reached the end of the sequence of materials.',
                    410: 						     'back' => 'Go Back',
                    411: 						     'nav' => 'Navigate Course Content',
                    412: 						     'wherenext' =>
                    413: 						     'There are several possibilities of where to go next',
                    414: 						     'pick' =>
                    415: 						     'Please click on the the resource you intend to access',
                    416: 						     'titleheader' => 'Title',
                    417: 						     'type' => 'Type');
1.8       www       418:                   if ($#possibilities>0) {
1.67      albertel  419: 		      my $start_page=
                    420: 			  &Apache::loncommon::start_page('Multiple Resources');
1.8       www       421:                      $r->print(<<ENDSTART);
1.67      albertel  422: $start_page
1.59      www       423: <h3>$lt{'wherenext'}</h3>
1.8       www       424: <p>
1.59      www       425: $lt{'pick'}:
1.8       www       426: <p>
                    427: <table border=2>
1.59      www       428: <tr><th>$lt{'titleheader'}</th><th>$lt{'type'}</th></tr>
1.8       www       429: ENDSTART
1.62      albertel  430:                      foreach my $id (@possibilities) {
1.8       www       431:                         $r->print(
                    432:                               '<tr><td><a href="'.
1.66      albertel  433: 				  &add_get_param($multichoicehash{'src_'.$id},
                    434: 						 {'symb' =>
                    435: 						      $multichoicehash{'symb_'.$id},
                    436: 						  }).'">'.
1.62      albertel  437:                               $multichoicehash{'title_'.$id}.
                    438:                               '</a></td><td>'.$multichoicehash{'type_'.$id}.
1.8       www       439: 			      '</td></tr>');
1.26      www       440:                      }
1.59      www       441:                      $r->print('</table>');
1.8       www       442:                   } else {
1.67      albertel  443: 		      my $start_page=
                    444: 			  &Apache::loncommon::start_page('No Resource');
1.59      www       445: 		      $r->print(<<ENDNONE);
1.67      albertel  446: $start_page
1.59      www       447: <h3>$lt{'title'}</h3>
                    448: <p>$lt{'explain'}</p>
                    449: ENDNONE
                    450: 		  }
                    451: 		  $r->print(<<ENDMENU);
1.37      www       452: <ul>
1.59      www       453: <li><a href="/adm/flip?postdata=return:">$lt{'back'}</a></li>
                    454: <li><a href="/adm/navmaps">$lt{'nav'}</a></li>
1.67      albertel  455: </ul>
1.59      www       456: ENDMENU
1.67      albertel  457:                   $r->print(&Apache::loncommon::end_page());
1.59      www       458:                   return OK;
                    459: 	      }
1.5       www       460: 	  } else {
                    461: # ------------------------------------------------- Problem, could not tie hash
1.53      albertel  462:               $env{'user.error.msg'}="/adm/flip:bre:0:1:Course Data Missing";
1.5       www       463:               return HTTP_NOT_ACCEPTABLE; 
1.3       www       464:           }
1.5       www       465:       } else {
                    466: # ---------------------------------------- No, could not determine where we are
1.42      albertel  467: 	  $r->internal_redirect('/adm/ambiguous');
1.2       www       468:       }
1.5       www       469:   } else {
1.2       www       470: # -------------------------- Class was not initialized or page fliped strangely
1.53      albertel  471:       $env{'user.error.msg'}="/adm/flip:bre:0:0:Choose Course";
1.2       www       472:       return HTTP_NOT_ACCEPTABLE; 
                    473:   } 
1.1       www       474: }
                    475: 
                    476: 1;
                    477: __END__
                    478: 
                    479: 
                    480: 
                    481: 
                    482: 
                    483: 
                    484: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>