File:  [LON-CAPA] / rat / lonratedt.pm
Revision 1.58: download - view: text, annotated - select for diffs
Mon Apr 26 17:50:37 2004 UTC (20 years ago) by www
Branches: MAIN
CVS tags: version_1_1_99_0, HEAD
Bug #883: Being able to set parameters in DOCS

    1: # The LearningOnline Network with CAPA
    2: # Edit Handler for RAT Maps
    3: #
    4: # $Id: lonratedt.pm,v 1.58 2004/04/26 17:50:37 www Exp $
    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: #
   28: 
   29: 
   30: package Apache::lonratedt;
   31: 
   32: =pod
   33: 
   34: =head1 NAME
   35: 
   36: Apache::lonratedt: advanced resource assembly tool
   37: 
   38: =head1 SYNOPSIS
   39: 
   40: lonratedt provides the routines and the handler for the Advanced
   41:     Resource Assembly Tool (RAT), and ties the various pieces together
   42:     with Javascript.
   43: 
   44: =head1 OVERVIEW
   45: 
   46: =head2 Map Representation
   47: 
   48: =begin latex
   49: 
   50: %
   51: \begin{figure}
   52: \begin{center}\includegraphics[%
   53:   width=0.55\paperwidth,bb = 0 0 200 100, draft, type=eps]{Map_Example}\end{center}
   54: 
   55: 
   56: \caption{\label{Map_In_Advanced_Editor}Example of a Map in the Advanced Editor}
   57: \end{figure}
   58: %
   59: \begin{figure}
   60: \begin{lyxcode}
   61: <map>
   62: 
   63: ~~<resource~id=\char`\"{}1\char`\"{}
   64: 
   65: ~~~~src=\char`\"{}/res/msu/korte/phy231welcome.html\char`\"{}
   66: 
   67: ~~~~type=\char`\"{}start\char`\"{}
   68: 
   69: ~~~~title=\char`\"{}Start\char`\"{}>
   70: 
   71: ~~~~</resource>
   72: 
   73: ~~<resource~id=\char`\"{}2\char`\"{}
   74: 
   75: ~~~~src=\char`\"{}\char`\"{}~type=\char`\"{}finish\char`\"{}
   76: 
   77: ~~~~title=\char`\"{}Finish\char`\"{}>
   78: 
   79: ~~~~</resource>
   80: 
   81: ~~<resource~id=\char`\"{}6\char`\"{}
   82: 
   83: ~~~~src=\char`\"{}/res/msu/korte/tests/units.problem\char`\"{}
   84: 
   85: ~~~~type=\char`\"{}mandatory\char`\"{}
   86: 
   87: ~~~~title=\char`\"{}Physical~Units~Test\char`\"{}>
   88: 
   89: ~~~~</resource>
   90: 
   91: ~~<resource~id=\char`\"{}9\char`\"{}
   92: 
   93: ~~~~src=\char`\"{}/res/msu/korte/chapters/onedim.sequence\char`\"{}
   94: 
   95: ~~~~title=\char`\"{}Motion~in~One~Dimension\char`\"{}>
   96: 
   97: ~~~~</resource>
   98: 
   99: ~~<resource~id=\char`\"{}11\char`\"{}
  100: 
  101: ~~~~src=\char`\"{}/res/msu/bauer/bridges/units.sequence\char`\"{}
  102: 
  103: ~~~~title=\char`\"{}Physical~Units~Refresher\char`\"{}>
  104: 
  105: ~~~~</resource>
  106: 
  107: ~~<condition~id=\char`\"{}19\char`\"{}
  108: 
  109: ~~~~type=\char`\"{}stop\char`\"{}
  110: 
  111: ~~~~value=\char`\"{}user.assessments{[}this./res/msu/korte/tests/units.problem{]}.status=solved\char`\"{}>
  112: 
  113: ~~~~</condition>
  114: 
  115: ~~<link~from=\char`\"{}1\char`\"{}~to=\char`\"{}6\char`\"{}></link>
  116: 
  117: ~~<link~from=\char`\"{}6\char`\"{}~to=\char`\"{}9\char`\"{}~condition=\char`\"{}19\char`\"{}></link>
  118: 
  119: ~~<link~from=\char`\"{}6\char`\"{}~to=\char`\"{}11\char`\"{}></link>
  120: 
  121: ~~<link~from=\char`\"{}11\char`\"{}~to=\char`\"{}6\char`\"{}></link>
  122: 
  123: ~~</map>
  124: \end{lyxcode}
  125: 
  126: \caption{\label{XML}XML for Map in Figure \ref{Map_In_Advanced_Editor}}
  127: \end{figure}
  128: 
  129: =end latex
  130: 
  131: Fig. "XML for Map in Figure" shows the XML representation of the
  132: resource map shown in Fig. "Example of a Map in the Advanced Editor",
  133: which is the format in which maps are stored. In the figure, however,
  134: additional graphical map layout information generated by the Advanced
  135: Resource Assembly Tool is not displayed. This graphical information is
  136: optional to re-generate the same graphical layout when the map is
  137: brought up again in the Resource Assembly Tool, and is not needed for
  138: any other system functionality.
  139: 
  140: Maps can be generated by tools other than the Resource Assembly
  141: Tool. In particular, an author might have some other representation of
  142: a course sequence, which can be converted into a map using scripts. If
  143: this map then were to be brought up in the Resource Assembly Tool, the
  144: Tool would automatically generate a graphical layout for it. Each
  145: entry of the map (resources, conditions and links) is stored in a
  146: separate tag.
  147: 
  148: Resources and conditionsX<conditions> have to have unique ID
  149: numbers. These numbers are automatically generated by the Resource
  150: Assembly Tool when the entry is first created, or added to the entries
  151: when a map generated outside the Resource Assembly Tool is first
  152: retrieved. They can also be assigned by custom scripts or added in by
  153: hand.
  154: 
  155: In the XML example, entry 1 is the start resource of the map. When
  156: this map is accessed, the source (src) URL of this tag will be the
  157: first resource rendered. Entry 2 is the finish resource of this
  158: map. This resource will be the last resource in the sequence of
  159: resources. Entry 6 is a problem resource with the given URL and title,
  160: as well as the priority "mandatory". Entry 19 is a condition, which is
  161: used by the link between entries 6, the problem, and 9, a
  162: sequence. I<The final syntax for conditions has not yet been
  163: determined.>
  164: 
  165: =cut
  166: 
  167: use strict;
  168: use Apache::Constants qw(:common);
  169: use Apache::lonnet;
  170: use Apache::lonratsrv;
  171: use Apache::lonsequence;
  172: use Apache::loncommon;
  173: use Apache::lonlocal;
  174: use File::Copy;
  175: 
  176: use vars qw(@order @resources @resparms);
  177: 
  178: 
  179: # Mapread read maps into global arrays @links and @resources, determines status
  180: # sets @order - pointer to resources in right order
  181: # sets @resources - array with the resources with correct idx
  182: #
  183: sub mapread {
  184:     my $fn=shift;
  185: 
  186:     my @links;
  187:     undef @links;
  188:     undef @resources;
  189:     undef @order;
  190:     undef @resparms;
  191:     @resources=('');
  192:     @order=();
  193:     @resparms=();
  194: 
  195:     my ($outtext,$errtext)=&Apache::lonratsrv::loadmap($fn,'');
  196:     if ($errtext) { return ($errtext,2); }
  197: 
  198: # -------------------------------------------------------------------- Read map
  199:     foreach (split(/\<\&\>/,$outtext)) {
  200: 	my ($command,$number,$content)=split(/\<\:\>/,$_);
  201:         if ($command eq 'objcont') {
  202: 	    $resources[$number]=$content;
  203:         }
  204:         if ($command eq 'objlinks') {
  205:             $links[$number]=$content;
  206:         }
  207:         if ($command eq 'objparms') {
  208: 	    if ($resparms[$number]) {
  209: 		$resparms[$number].='&&&'.$content;
  210: 	    } else {
  211: 		$resparms[$number]=$content;
  212: 	    }
  213:         }
  214:     }
  215: # ------------------------------------------------------- Is this a linear map?
  216:     my @starters=();
  217:     my @endings=();
  218:     undef @starters;
  219:     undef @endings;
  220: 
  221:     foreach (@links) {
  222:         if (defined($_)) {
  223: 	    my ($start,$end,$cond)=split(/\:/,$_);
  224:             if ((defined($starters[$start])) || (defined($endings[$end]))) { 
  225: 		return
  226:                  (&mt('Map has branchings. Use advanced editor.'),1);
  227:             }
  228: 	    $starters[$start]=1;
  229: 	    $endings[$end]=1;
  230: 	    if ($cond) {
  231: 		return
  232:                  (&mt('Map has conditions. Use advanced editor.'),1);
  233:             }
  234: 	}
  235: 
  236:     }
  237:     for (my $i=1; $i<=$#resources; $i++) {
  238:         if (defined($resources[$i])) {
  239: 	    unless (($starters[$i]) || ($endings[$i])) {
  240:                 return
  241: 		 (&mt('Map has unconnected resources. Use advanced editor.'),1);
  242:             }
  243:         }
  244:     }
  245: # ---------------------------------------------- Did we just read an empty map?
  246:     if ($#resources<1) {
  247:         undef $resources[0];
  248: 	$resources[1]=':::start';
  249:         $resources[2]=':::finish';
  250:     }
  251: # -------------------------------------------------- This is a linear map, sort
  252: 
  253:     my $startidx=0;
  254:     my $endidx=0;
  255:     for (my $i=0; $i<=$#resources; $i++) {
  256:         if (defined($resources[$i])) {
  257:             my ($title,$url,$ext,$type)=split(/\:/,$resources[$i]);
  258: 	    if ($type eq 'start') { $startidx=$i; }
  259:             if ($type eq 'finish') { $endidx=$i; }
  260:         }
  261:     }
  262:     my $k=0;
  263:     my $currentidx=$startidx;
  264:     $order[$k]=$currentidx;
  265:     for (my $i=0; $i<=$#resources; $i++) {
  266:         foreach (@links) {
  267: 	    my ($start,$end)=split(/\:/,$_);
  268:             if ($start==$currentidx) {
  269: 		$currentidx=$end;
  270:                 $k++;
  271:                 $order[$k]=$currentidx;
  272:                 last;
  273:             }
  274:         }
  275:         if ($currentidx==$endidx) { last; }
  276:     }
  277:     return $errtext;
  278: }
  279: 
  280: # ---------------------------------------------- Read a map as well as possible
  281: # Also used by the sequence handler
  282: # Call lonsequence::attemptread to read from resource space
  283: #
  284: sub attemptread {
  285:     my $fn=shift;
  286: 
  287:     my @links;
  288:     undef @links;
  289:     my @theseres;
  290:     undef @theseres;
  291: 
  292:     my ($outtext,$errtext)=&Apache::lonratsrv::loadmap($fn,'');
  293:     if ($errtext) { return @theseres }
  294: 
  295: # -------------------------------------------------------------------- Read map
  296:     foreach (split(/\<\&\>/,$outtext)) {
  297: 	my ($command,$number,$content)=split(/\<\:\>/,$_);
  298:         if ($command eq 'objcont') {
  299: 	    $theseres[$number]=$content;
  300:         }
  301:         if ($command eq 'objlinks') {
  302:             $links[$number]=$content;
  303:         }
  304:     }
  305: 
  306: # --------------------------------------------------------------- Sort, sort of
  307: 
  308:     my @objsort=();
  309:     undef @objsort;
  310: 
  311:     my @data1=();
  312:     my @data2=();
  313:     undef @data1;
  314:     undef @data2;
  315: 
  316:     my $k;
  317:     my $kj;
  318:     my $j;
  319:     my $ij;
  320: 
  321:    for ($k=1;$k<=$#theseres;$k++) {
  322:       if (defined($theseres[$k])) {
  323:          $objsort[$#objsort+1]=$k;
  324:       }
  325:    }
  326: 
  327:    for ($k=1;$k<=$#links;$k++) {
  328:      if (defined($links[$k])) {
  329:       @data1=split(/\:/,$links[$k]);
  330:       $kj=-1;
  331:       for (my $j=0;$j<=$#objsort;$j++) {
  332:          if ((split(/\:/,$objsort[$j]))[0]==$data1[0]) {
  333:             $kj=$j;
  334:          }
  335:       }
  336:       if ($kj!=-1) { $objsort[$kj].=':'.$data1[1]; }
  337:      }
  338:    }
  339:     for ($k=0;$k<=$#objsort;$k++) {
  340:       for ($j=0;$j<=$#objsort;$j++) {
  341:         if ($k!=$j) {
  342:           @data1=split(/\:/,$objsort[$k]);
  343:           @data2=split(/\:/,$objsort[$j]);
  344:           my $dol=$#data1+1;
  345:           my $dtl=$#data2+1;
  346:           if ($dol+$dtl<1000) {
  347:            for ($kj=1;$kj<$dol;$kj++) {
  348:              if ($data1[$kj]==$data2[0]) {
  349:                 for ($ij=1;$ij<$dtl;$ij++) {
  350:                    $data1[$#data1+1]=$data2[$ij];
  351:                 }
  352:              }
  353:            }
  354:            for ($kj=1;$kj<$dtl;$kj++) {
  355:              if ($data2[$kj]==$data1[0]) {
  356:                  for ($ij=1;$ij<$dol;$ij++) {
  357:                     $data2[$#data2+1]=$data1[$ij];
  358:                  }
  359:              }
  360:            }
  361:            $objsort[$k]=join(':',@data1);
  362:            $objsort[$j]=join(':',@data2);
  363:           }
  364:          }
  365:       } 
  366:   }
  367: # ---------------------------------------------------------------- Now sort out
  368: 
  369:     @objsort=sort {
  370:       my @data1=split(/\:/,$a);
  371:       my @data2=split(/\:/,$b);
  372:       my $rvalue=0;
  373:       my $k;
  374:       for ($k=1;$k<=$#data1;$k++) {
  375:          if ($data1[$k]==$data2[0]) { $rvalue--; }
  376:       }
  377:       for ($k=1;$k<=$#data2;$k++) {
  378:          if ($data2[$k]==$data1[0]) { $rvalue++; }
  379:       }
  380:       if ($rvalue==0) { $rvalue=$#data2-$#data1; }
  381:       $rvalue;
  382:     } @objsort;
  383: 
  384:     my @outres=();
  385:     undef @outres;
  386: 
  387:     for ($k=0;$k<=$#objsort;$k++) {
  388: 	$outres[$k]=$theseres[(split(/\:/,$objsort[$k]))[0]];
  389:     }
  390:     return @outres;
  391: }
  392: 
  393: # --------------------------------------------------------- Build up RAT screen
  394: sub ratedt {
  395:   my ($r,$url)=@_;
  396:   $r->print(<<ENDDOCUMENT);
  397: 
  398: <html>
  399: <head>
  400: <script language="JavaScript">
  401:     var flag=0;
  402: </script>
  403: </head>
  404: <frameset rows="1,50,*" border=0>
  405: <frame name=server src="$url/loadonly/ratserver" noresize noscroll>
  406: <frame name=code src="/adm/rat/code.html">
  407: <frame name=mapout src="/adm/rat/map.html">
  408: </frameset>
  409: </html>
  410: 
  411: ENDDOCUMENT
  412: }
  413: 
  414: # ---------------------------------------------------------------- Make buttons
  415: 
  416: sub buttons {
  417:     my $adv=shift;
  418:     my $output='<form method=post>';     
  419:     if ($adv==1) {
  420: 	$output.='<input type=submit name=forceadv value="'.&mt('Edit').'">'.
  421: 	    &Apache::loncommon::help_open_topic('Sequence_Advanced_Editor_Creation');;
  422:     } else {
  423:         unless ($adv==2) {
  424:            $output.='<input type=submit name=forcesmp value="'.&mt('Simple Edit').'">'.
  425: 	    &Apache::loncommon::help_open_topic('Sequence_Simple_Editor_Creation');
  426:         }
  427: 	$output.='<input type=submit name=forceadv value="'.&mt('Advanced Edit').'">'.
  428: 	    &Apache::loncommon::help_open_topic('Sequence_Advanced_Editor_Creation');
  429:     }
  430:     return $output.'</form><hr>';
  431: }
  432: 
  433: # ----------------------------------------------------------- Paste into target
  434: # modifies @order, @resources
  435: 
  436: sub pastetarget {
  437:     my ($after,@which)=@_;
  438:     my @insertorder=();
  439:     foreach (@which) {
  440:         if (defined($_)) {
  441: 	    my ($name,$url)=split(/\=/,$_);
  442:             $name=&Apache::lonnet::unescape($name);
  443:             $url=&Apache::lonnet::unescape($url);
  444:             if ($url) {
  445: 	       my $idx=$#resources+1;
  446:                $insertorder[$#insertorder+1]=$idx;
  447:                my $ext='false';
  448:                if ($url=~/^http\:\/\//) { $ext='true'; }
  449:                $url=~s/\:/\&colon;/g;
  450:                $name=~s/\:/\&colon;/g;
  451:                $resources[$idx]=$name.':'.$url.':'.$ext.':normal:res';
  452: 	   }
  453:         }
  454:     }
  455:     my @oldorder=splice(@order,$after);
  456:     @order=(@order,@insertorder,@oldorder);
  457: }
  458: 
  459: # ------------------------------------------------ Get start and finish correct
  460: # modifies @resources
  461: 
  462: sub startfinish {
  463: # Remove all start and finish
  464:     foreach (@order) {
  465: 	my ($name,$url,$ext)=split(/\:/,$resources[$_]);
  466:         if ($url=~/http\&colon\:\/\//) { $ext='true'; }
  467:         $resources[$_]=$name.':'.$url.':'.$ext.':normal:res';
  468:     }
  469: # Garbage collection
  470:     my $stillchange=1;
  471:      while (($#order>1) && ($stillchange)) {
  472:        $stillchange=0;
  473:        for (my $i=0;$i<=$#order;$i++) {
  474:  	  my ($name,$url,$ext)=split(/\:/,$resources[$order[$i]]);
  475:           unless ($url) {
  476: # Take out empty resource
  477:               for (my $j=$i+1;$j<=$#order;$j++) {
  478:                   $order[$j-1]=$order[$j];
  479: 	      }
  480:               $#order--;
  481: 	      $stillchange=1;
  482:               last;
  483:           }
  484:        }
  485:     }
  486: # Put in a start resource
  487:    my ($name,$url,$ext)=split(/\:/,$resources[$order[0]]);
  488:    $resources[$order[0]]=$name.':'.$url.':'.$ext.':start:res';
  489: # Make sure this has at least start and finish
  490:    if ($#order==0) {
  491:        $resources[$#resources+1]='::false';
  492:        $order[1]=$#resources;
  493:    }
  494: # Make the last one a finish resource
  495:    ($name,$url,$ext)=split(/\:/,$resources[$order[$#order]]);
  496:    $resources[$order[$#order]]=$name.':'.$url.':'.$ext.':finish:res';
  497: }
  498: 
  499: # ------------------------------------------------------------------- Store map
  500: 
  501: sub storemap {
  502:     my $realfn=shift;
  503:     my $fn=$realfn;
  504: # unless this is forced to work from the original file, use a temporary file
  505: # instead
  506:     unless (shift) {
  507:        $fn=$realfn.'.tmp';
  508:        unless (-e $fn) {
  509: 	  copy($realfn,$fn);
  510:        }
  511:     }
  512: # store data either into tmp or real file
  513:     &startfinish();
  514:     my $output='graphdef<:>no';
  515:     my $k=1;
  516:     for (my $i=0; $i<=$#order; $i++) {
  517:         if (defined($resources[$order[$i]])) {
  518: 	    $output.='<&>objcont<:>'.$order[$i].'<:>'.$resources[$order[$i]];
  519:         }
  520: 	if (defined($resparms[$order[$i]])) {
  521: 	    foreach (split('&&&',$resparms[$order[$i]])) {
  522: 		if ($_) {
  523: 		    $output.='<&>objparms<:>'.$order[$i].'<:>'.$_;
  524: 		}
  525: 	    }
  526: 	}
  527:         if (defined($order[$i+1])) {
  528: 	    if (defined($resources[$order[$i+1]])) {
  529:                $output.='<&>objlinks<:>'.$k.'<:>'.
  530: 		   $order[$i].':'.$order[$i+1].':0';
  531: 	       $k++;
  532:             }
  533:         }
  534:     }
  535:     $output=~s/http\&colon\;\/\///g;
  536:     $ENV{'form.output'}=$output;
  537:     return 
  538:      &Apache::lonratsrv::loadmap($fn,&Apache::lonratsrv::savemap($fn,''));
  539: }
  540: 
  541: # ------------------------------------------ Store and get parameters in global
  542: 
  543: sub storeparameter {
  544:     my ($to,$name,$value,$ptype)=@_;
  545:     my $newentry='';
  546:     my $nametype='';
  547:     foreach (split('&&&',$resparms[$to])) {
  548: 	my ($thistype,$thisname,$thisvalue)=split('___',$_);
  549: 	if ($thisname) {
  550: 	    unless ($thisname eq $name) {
  551: 		$newentry.=$_.'&&&';
  552: 	    } else {
  553: 		$nametype=$thistype;
  554: 	    }
  555: 	}
  556:     }
  557:     unless ($ptype) { $ptype=$nametype; }
  558:     unless ($ptype) { $ptype='string'; }
  559:     $newentry.=$ptype.'___'.$name.'___'.$value;
  560:     $resparms[$to]=$newentry;
  561: }
  562: 
  563: sub delparameter {
  564:     my ($to,$name)=@_;
  565:     my $newentry='';
  566:     my $nametype='';
  567:     foreach (split('&&&',$resparms[$to])) {
  568: 	my ($thistype,$thisname,$thisvalue)=split('___',$_);
  569: 	if ($thisname) {
  570: 	    unless ($thisname eq $name) {
  571: 		$newentry.=$_.'&&&';
  572: 	    }
  573: 	}
  574:     }
  575:     $resparms[$to]=$newentry;
  576: }
  577: 
  578: sub getparameter {
  579:     my ($to,$name)=@_;
  580:     my $value=undef;
  581:     my $ptype=undef;
  582:     foreach (split('&&&',$resparms[$to])) {
  583: 	my ($thistype,$thisname,$thisvalue)=split('___',$_);
  584: 	if ($thisname eq $name) {
  585: 	    $value=$thisvalue;
  586: 	    $ptype=$thistype;
  587: 	}
  588:     }
  589:     return ($value,$ptype);
  590: }
  591: 
  592: # ----------------------------------------------------------------- Edit script
  593: sub editscript {
  594:     my $mode=shift;
  595:     my $resurl=&Apache::loncommon::lastresurl();
  596:     return(<<ENDSCRIPT);
  597: var srch;
  598: var srchflag=-1; // 1 means currently open
  599:                  // 0 means closed (but has been open)
  600:                  // -1 means never yet opened/defined
  601: var srchmode='';
  602: 
  603: var idx;
  604: var idxflag=-1; // 1 means currently open
  605:                  // 0 means closed (but has been open)
  606:                  // -1 means never yet opened/defined
  607: var idxmode='';
  608: 
  609: // ------------------------------------------------------ Clears indexer window
  610: function idxclear() {
  611:   idx.document.clear();
  612: }
  613: 
  614: // ------------------------------------------------------- Clears search window
  615: function srchclear() {
  616:   srch.document.clear();
  617: }
  618: 
  619: // ------------------------------------------------------ Closes indexer window
  620: function idxclose() {
  621:   if (idx && !idx.closed) {
  622:     idxflag=0;
  623:     idx.close();
  624:   }
  625: }
  626: 
  627: // ------------------------------------------------------- Closes search window
  628: function srchclose() {
  629:   if (srch && !srch.closed) {
  630:     srchflag=0;
  631:     srch.close();
  632:   }
  633: }
  634: 
  635: // -------------------------------------------------------- Open indexer window
  636: function idxopen(mode) {
  637:    var options="scrollbars=1,resizable=1,menubar=0";
  638:    idxmode=mode;
  639:    idxflag=1;
  640:    idx=open("$resurl/?launch=1&mode=$mode&catalogmode="+mode,"idxout",options);
  641:    idx.focus();
  642: }
  643: 
  644: // --------------------------------------------------------- Open search window
  645: function srchopen(mode) {
  646:    var options="scrollbars=1,resizable=1,menubar=0";
  647:    srchmode=mode;
  648:    srchflag=1;
  649:    srch=open("/adm/searchcat?launch=1&mode=$mode&catalogmode="+mode,"srchout",options);
  650:    srch.focus();
  651: }
  652: // ----------------------------------------------------- launch indexer browser
  653: function groupsearch() {
  654:    srchcheck('groupsearch');
  655: }
  656: 
  657: function groupimport() {
  658:    idxcheck('groupimport');
  659: }
  660: // ------------------------------------------------------- Do srch status check
  661: function srchcheck(mode) {
  662:    if (!srch || srch.closed || srchmode!=mode) {
  663:       srchopen(mode);
  664:    }
  665:    srch.focus();
  666: }
  667: 
  668: // -------------------------------------------------------- Do idx status check
  669: function idxcheck(mode) {
  670:    if (!idx || idx.closed || idxmode!=mode) {
  671:       idxopen(mode);
  672:    }
  673:    idx.focus();
  674: }
  675: 
  676: 
  677:     var editbrowser;
  678:     function openbrowser(formname,elementname,only,omit) {
  679:         var url = '$resurl/?';
  680:         if (editbrowser == null) {
  681:             url += 'launch=1&';
  682:         }
  683:         url += 'catalogmode=interactive&';
  684:         url += 'mode=edit&';
  685:         url += 'form=' + formname + '&';
  686:         if (only != null) {
  687:             url += 'only=' + only + '&';
  688:         } 
  689:         if (omit != null) {
  690:             url += 'omit=' + omit + '&';
  691:         }
  692:         url += 'element=' + elementname + '';
  693:         var title = 'Browser';
  694:         var options = 'scrollbars=1,resizable=1,menubar=0';
  695:         options += ',width=700,height=600';
  696:         editbrowser = open(url,title,options,'1');
  697:         editbrowser.focus();
  698:     }
  699: ENDSCRIPT
  700: }
  701: # ------------------------------------------------------- Simple edit processor
  702: 
  703: sub smpedt {
  704:    my ($r,$url,$errtext)=@_;
  705:    my $buttons=&buttons(2);
  706:    my $tmpfn=&Apache::lonnet::filelocation('',$url).'.tmp';
  707:    my $targetmsg='';
  708:    if ($ENV{'form.save'}) {
  709:        $targetmsg='<b>Saving ...</b><br>';
  710:        copy($tmpfn,&Apache::lonnet::filelocation('',$url));
  711:        unlink($tmpfn);
  712:        my ($errtext,$fatal)=
  713:                            &mapread(&Apache::lonnet::filelocation('',$url),'');
  714:    }
  715:    if ($ENV{'form.revert'}) {
  716:        $targetmsg='<b>Reverting ...</b><br>';
  717:        unlink($tmpfn);
  718:        my ($errtext,$fatal)=
  719:                            &mapread(&Apache::lonnet::filelocation('',$url),'');
  720:    }
  721:    if (-e $tmpfn) {
  722:       $targetmsg=
  723:         '<b><font color="red">'.&mt('You are working with an unsaved version of your map.').'</font></b><br>';
  724:       my ($errtext,$fatal)=&mapread($tmpfn,'');
  725:    }
  726: # ---------------------------------------------------------- Process form input
  727: 
  728:    my @importselect=();
  729:    my @targetselect=();
  730:    undef @importselect;
  731:    undef @targetselect;
  732:    if (defined($ENV{'form.importsel'})) {
  733:        if (ref($ENV{'form.importsel'})) {
  734: 	   @importselect=sort(@{$ENV{'form.importsel'}});
  735:        } else {
  736:            @importselect=($ENV{'form.importsel'});
  737:        }
  738:    }
  739:    if (defined($ENV{'form.target'})) {
  740:        if (ref($ENV{'form.target'})) {
  741: 	   @targetselect=sort(@{$ENV{'form.target'}});
  742:        } else {
  743:            @targetselect=($ENV{'form.target'});
  744:        }
  745:    }
  746: # ============================================================ Process commands
  747: 
  748:    my $targetdetail=$ENV{'form.targetdetail'};
  749:    my $importdetail=$ENV{'form.curimpdetail'};
  750: 
  751: # ---------------------------------------------------- Importing from groupsort
  752:    if (($ENV{'form.importdetail'}) && (!$ENV{'form.impfortarget'})) {
  753: 
  754:        $importdetail='';
  755:        my @curimport=split(/\&/,$ENV{'form.curimpdetail'});
  756: 
  757:        my $lastsel;
  758: 
  759:        if (defined($importselect[-1])) {
  760: 	   $lastsel=$importselect[-1];
  761:        } else {
  762:            $lastsel=$#curimport;
  763:        }
  764: 
  765:        for (my $i=0;$i<=$lastsel;$i++) {
  766:            my ($name,$url)=split(/\=/,$curimport[$i]);
  767:            if ($url) {
  768:               $importdetail.='&'.$name.'='.$url;
  769: 	   }
  770:        }
  771: 
  772:       $importdetail.='&'.$ENV{'form.importdetail'};
  773: 
  774:        for (my $i=$lastsel+1;$i<=$#curimport;$i++) {
  775:            my ($name,$url)=split(/\=/,$curimport[$i]);
  776:            if ($url) {
  777:               $importdetail.='&'.$name.'='.$url;
  778: 	  }
  779:        }
  780:        $importdetail=~s/\&+/\&/g;
  781:        $importdetail=~s/^\&//;
  782: 
  783: # ------------------------------------------------------------------- Clear all
  784:    } elsif ($ENV{'form.clear'}) {
  785:        $importdetail='';
  786: # ------------------------------------------------------------ Discard selected
  787:    } elsif ($ENV{'form.discard'}) {
  788:        $importdetail='';
  789:        my @curimport=split(/\&/,$ENV{'form.curimpdetail'});
  790:        foreach (@importselect) {
  791: 	   $curimport[$_]='';
  792:        }
  793:        for (my $i=0;$i<=$#curimport;$i++) {
  794:            my ($name,$url)=split(/\=/,$curimport[$i]);
  795:            if ($url) {
  796:               $importdetail.='&'.$name.'='.$url;
  797: 	   }
  798:        }
  799: # --------------------------------------------------------- Loading another map
  800:    } elsif ($ENV{'form.loadmap'}) {
  801:        $importdetail='';
  802:        my @curimport=split(/\&/,$ENV{'form.curimpdetail'});
  803: 
  804:        my $lastsel;
  805: 
  806:        if (defined($importselect[-1])) {
  807: 	   $lastsel=$importselect[-1];
  808:        } else {
  809:            $lastsel=$#curimport;
  810:        }
  811: 
  812:        for (my $i=0;$i<=$lastsel;$i++) {
  813:            my ($name,$url)=split(/\=/,$curimport[$i]);
  814:            if ($url) {
  815:               $importdetail.='&'.$name.'='.$url;
  816: 	   }
  817:        }
  818: 
  819:        foreach (
  820:     &Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$ENV{'form.importmap'}))) {
  821: 	   my ($name,$url)=split(/\:/,$_);
  822:            if ($url) {
  823:               $importdetail.='&'.&Apache::lonnet::escape($name).'='.
  824: 		 	         &Apache::lonnet::escape($url);
  825: 	  }
  826:        }
  827: 
  828:        for (my $i=$lastsel+1;$i<=$#curimport;$i++) {
  829:            my ($name,$url)=split(/\=/,$curimport[$i]);
  830:            if ($url) {
  831:               $importdetail.='&'.$name.'='.$url;
  832: 	  }
  833:        }
  834:        $importdetail=~s/\&+/\&/g;
  835:        $importdetail=~s/^\&//;
  836: 
  837: # ------------------------------------------------ Groupimport/search to target
  838:    } elsif ($ENV{'form.importdetail'}) {
  839:        my $lastsel;
  840:        if (defined($targetselect[-1])) {
  841: 	   $lastsel=$targetselect[-1];
  842:        } else {
  843:            $lastsel=$#order+1;
  844:        }
  845:        &pastetarget($lastsel,split(/\&/,$ENV{'form.importdetail'}));
  846:        &storemap(&Apache::lonnet::filelocation('',$url));
  847: # ------------------------------------------------------------------------- Cut
  848:    } elsif (($ENV{'form.cut'}) || ($ENV{'form.copy'})) {
  849:        $importdetail='';
  850:        my @curimport=split(/\&/,$ENV{'form.curimpdetail'});
  851: 
  852:        my $lastsel;
  853: 
  854:        if (defined($importselect[-1])) {
  855: 	   $lastsel=$importselect[-1];
  856:        } else {
  857:            $lastsel=$#curimport;
  858:        }
  859: 
  860:        for (my $i=0;$i<=$lastsel;$i++) {
  861:            my ($name,$url)=split(/\=/,$curimport[$i]);
  862:            if ($url) {
  863:               $importdetail.='&'.$name.'='.$url;
  864: 	   }
  865:        }
  866: 
  867:        foreach (@targetselect) {
  868: 	   my ($name,$url)=split(/\:/,$resources[$order[$_-1]]);
  869:            if ($url) {
  870:               $importdetail.='&'.&Apache::lonnet::escape($name).'='.
  871: 		 	         &Apache::lonnet::escape($url);
  872: 	  }
  873:        }
  874: 
  875:        for (my $i=$lastsel+1;$i<=$#curimport;$i++) {
  876:            my ($name,$url)=split(/\=/,$curimport[$i]);
  877:            if ($url) {
  878:               $importdetail.='&'.$name.'='.$url;
  879: 	  }
  880:        }
  881:        $importdetail=~s/\&+/\&/g;
  882:        $importdetail=~s/^\&//;
  883: 
  884:        if ($ENV{'form.cut'}) {
  885:            my @neworder=();
  886:            for (my $i=0;$i<=$#order;$i++) {
  887:                my $include=1;
  888:                foreach (@targetselect) {
  889: 		   if ($_-1==$i) { $include=0; }
  890:                }
  891:                if ($include) { $neworder[$#neworder+1]=$order[$i]; }
  892:            }
  893:            @order=@neworder;
  894:            &storemap(&Apache::lonnet::filelocation('',$url));      
  895:        }
  896: 
  897: # ----------------------------------------------------------------------- Paste
  898:    } elsif ($ENV{'form.paste'}) {
  899:        my $lastsel;
  900:        if (defined($targetselect[-1])) {
  901: 	   $lastsel=$targetselect[-1];
  902:        } else {
  903:            $lastsel=$#order+1;
  904:        }
  905:        my @newsequence;
  906:        my @curimport=split(/\&/,$ENV{'form.curimpdetail'});
  907:        foreach (@importselect) {
  908:           $newsequence[$#newsequence+1]=$curimport[$_];
  909:        }
  910:        &pastetarget($lastsel,@newsequence);
  911:        &storemap(&Apache::lonnet::filelocation('',$url));
  912: # -------------------------------------------------------------------- Move up 
  913:    } elsif ($ENV{'form.moveup'}) {
  914:        foreach (sort @targetselect) {
  915:            if ($_-1>0) {
  916:               my $movethis=$order[$_-1];
  917:               $order[$_-1]=$order[$_-2];
  918:               $order[$_-2]=$movethis;
  919: 	  }
  920:        }
  921:        &storemap(&Apache::lonnet::filelocation('',$url));
  922: # ------------------------------------------------------------------ Move down
  923:    } elsif ($ENV{'form.movedown'}) {
  924:        foreach (reverse sort @targetselect) {
  925:            if ($_-1<$#order) {
  926:               my $movethis=$order[$_-1];
  927:               $order[$_-1]=$order[$_];
  928:               $order[$_]=$movethis;
  929: 	   }
  930:        }
  931:        &storemap(&Apache::lonnet::filelocation('',$url));
  932: # --------------------------------------------------------------------- Rename
  933:    } elsif ($ENV{'form.renameres'}) {
  934:        my $residx=$Apache::lonratedt::order[$ENV{'form.renameidx'}-1];
  935:        my ($name,@resrest)=split(/\:/,$Apache::lonratedt::resources[$residx]);
  936:        $name=$ENV{'form.renametitle'};
  937:        $name=~s/\:/\&colon\;/g;
  938:        $Apache::lonratedt::resources[$residx]=$name.':'.join(':',@resrest);
  939:        &storemap(&Apache::lonnet::filelocation('',$url));
  940:    }
  941: # ------------------------------------------------------------ Assemble windows
  942:    
  943:    my $idx=-1;
  944:    $importdetail='&'.$importdetail;
  945:    $importdetail=~s/^\&+/\&/;
  946:    my $importwindow=
  947:        '<option value="-1"> ---- '.&mt('Import and Paste Area').' ---- </option>'.
  948:      join("\n",map {
  949:        $idx++;
  950:        if ($_) { 
  951:           my ($name,$url)=split(/\=/,$_);
  952:           unless ($name) { $name=(split(/\//,$url))[-1]; }
  953:           unless ($name) { $name='EMPTY'; }
  954:           '<option value="'.$idx.'">'.&Apache::lonnet::unescape($name).
  955:                                     '</option>';
  956:       }
  957:    } split(/\&/,$importdetail));
  958: 
  959:    $idx=0;
  960:    $targetdetail='';
  961:    my $targetwindow=       
  962:        '<option value="0"> ------- '.&mt('Target Edit Map').' ------- </option>'.
  963:      join("\n",map { 
  964:        my ($name,$url)=split(/\:/,$resources[$_]);
  965:        unless ($name) {  $name=(split(/\//,$url))[-1]; }
  966:        unless ($name) { $name='EMPTY'; }
  967:        $targetdetail.='&'.&Apache::lonnet::escape($name).'='.
  968: 	                  &Apache::lonnet::escape($url);
  969:        $idx++;
  970:        $name=~s/\&colon;/\:/g;
  971:        '<option value="'.$idx.'">'.$name.'</option>';
  972:    } @order);
  973: 
  974: # ----------------------------------------------------- Start simple RAT screen
  975:    my $editscript=&editscript('simple');
  976:    my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef,1).
  977:        &Apache::loncommon::help_open_topic('Sequence_Simple_Editor_Creation').
  978:        &Apache::loncommon::help_open_faq(6).
  979:        &Apache::loncommon::help_open_bug('RAT');
  980:    my %lt=&Apache::lonlocal::texthash(
  981: 				      'sa' => 'Save',
  982: 				      'nt' => 'New Title',
  983: 				      'se' => 'Search',
  984: 				      'im' => 'Import',
  985: 				      'vi' => 'View',
  986: 				      'lm' => 'Load Map',
  987: 				      'ds' => 'Discard Selected',
  988: 				      'ca' => 'Clear All',
  989: 				      'ta' => 'Temporary Assembly Workspace',
  990: 				      'rv' => 'Revert to Last Saved',
  991:                                       'sa' => 'Save',
  992:                                       'mu' => 'Move Up',
  993:                                       'md' => 'Move Down',
  994:                                       're' => 'Rename',
  995:                                       'as' => 'after selected',
  996:                                       'cs' => 'Cut selected',
  997:                                       'ps' => 'Copy selected',
  998:                                       'pas' => 'Paste after selected',
  999: 				      );
 1000:    $r->print(<<ENDSMPHEAD);
 1001: <html>
 1002: <head>
 1003: <script>
 1004: 
 1005:    $editscript
 1006: 
 1007:    function openview(entry) {
 1008:        var url=unescape((entry.split('='))[1]);
 1009:        var parts=new Array;
 1010:        parts=url.split('&colon;');
 1011:        url=parts.join(':');
 1012:        if (url) { open(url,'cat'); }
 1013:    }
 1014: 
 1015:    function viewtarget() {
 1016:        openview((document.forms.simpleedit.targetdetail.value.split('&'))
 1017:                 [document.forms.simpleedit.target.selectedIndex]);
 1018:    }
 1019: 
 1020:    function viewimport() {
 1021:        openview((document.forms.simpleedit.curimpdetail.value.split('&'))
 1022:                 [document.forms.simpleedit.importsel.selectedIndex]);
 1023:    }
 1024: 
 1025:    function renametarget() {
 1026:        var selidx=document.forms.simpleedit.target.selectedIndex;
 1027:        var entry=(document.forms.simpleedit.targetdetail.value.split('&'))
 1028:                 [selidx];
 1029:        var oldname=unescape((entry.split('='))[0]);
 1030:        var nameparts=oldname.split('&colon;');
 1031:        oldname=unescape(nameparts.join(':'));
 1032:        nameparts=oldname.split('&#34;');
 1033:        oldname=unescape(nameparts.join('"'));
 1034:        nameparts=oldname.split('&#39;');
 1035:        oldname=unescape(nameparts.join("'"));
 1036:        newtitle=prompt('$lt{'nt'}',oldname);
 1037:        if (newtitle) {
 1038:            document.forms.simpleedit.renameres.value=1;
 1039:            document.forms.simpleedit.renameidx.value=selidx;
 1040:            document.forms.simpleedit.renametitle.value=newtitle;
 1041: 	   document.forms.simpleedit.submit();
 1042:        }
 1043:    }
 1044: 
 1045: </script>
 1046: </head>                 
 1047: $bodytag
 1048: $buttons
 1049: <font color=red>$errtext</font>
 1050: <form name=simpleedit method=post>
 1051: <input type=hidden name=forcesmp value=1>
 1052: <input type=hidden name=renameres value=0>
 1053: <input type=hidden name=renametitle value=''>
 1054: <input type=hidden name=renameidx value=0>
 1055: <table>
 1056:     <tr><th width="40%">$lt{'ta'}</th>
 1057: <th>&nbsp;</th>
 1058: <th width="40%">File: $url</th></tr>
 1059: <tr><td bgcolor="#FFFFCC">
 1060: <input type=button onClick="javascript:groupsearch()" value="$lt{'se'}">
 1061: <input type=button onClick="javascript:groupimport();" value="$lt{'im'}">
 1062: $lt{'as'}
 1063: <hr>
 1064: <input type=text size=20 name=importmap>
 1065: <input type=button 
 1066: onClick="javascript:openbrowser('simpleedit','importmap','sequence,page','')"
 1067: value="Select Map"><input type=submit name=loadmap value="$lt{'lm'}"><hr>
 1068: <input type=submit name="discard" value="$lt{'ds'}">
 1069: <input type=submit name="clear" value="$lt{'ca'}">
 1070: <input type=button onClick="javascript:viewimport()" value="$lt{'vi'}">
 1071: 
 1072:     </td><td>&nbsp;</td><td bgcolor="#FFFFCC">
 1073: 
 1074: <input type=button onClick=
 1075: "javascript:impfortarget.value=1;groupsearch()" value="$lt{'se'}">
 1076: <input type=button onClick=
 1077: "javascript:impfortarget.value=1;groupimport();" value="$lt{'im'}">
 1078: $lt{'as'}
 1079: <hr>
 1080: <input type=submit name="moveup" value="$lt{'mu'}">
 1081: <input type=submit name="movedown" value="$lt{'md'}">
 1082: <input type=button onClick="javascript:renametarget()" value="$lt{'re'}">
 1083: <hr>$targetmsg
 1084: <input type=submit name="revert" value="$lt{'rv'}">
 1085: <input type=submit name="save" value="$lt{'sa'}">
 1086: <input type=button onClick="javascript:viewtarget()" value="$lt{'vi'}">
 1087: </td></tr>
 1088: 
 1089: <tr><td bgcolor="#FFFFCC"><select name="importsel" size=10 multiple>
 1090: $importwindow
 1091: </select>
 1092: </td>
 1093: <td bgcolor="#FFFFAA" align="center">
 1094: $lt{'cs'}<br>
 1095: <input type=submit name=cut value='<<<'><p>
 1096: <hr>
 1097: $lt{'ps'}<br>
 1098: <input type=submit name=copy value='<--'><p>
 1099: <hr>
 1100: $lt{'pas'}<br>
 1101: <input type=submit name=paste value='-->'>
 1102: </td>
 1103: <td bgcolor="#FFFFCC"><select name="target" size=10 multiple>
 1104: $targetwindow
 1105: </select>
 1106: </table>
 1107: <input type=hidden name=importdetail value="">
 1108: <input type=hidden name=curimpdetail value="$importdetail">
 1109: <input type=hidden name=targetdetail value="$targetdetail">
 1110: <input type=hidden name=impfortarget value="0">
 1111: </form>
 1112: </body></html>
 1113: ENDSMPHEAD
 1114: }
 1115: 
 1116: # ----------------------------------------------------------------- No such dir
 1117: sub nodir {
 1118:    my ($r,$dir)=@_;
 1119:    $dir=~s/^\/home\/\w+\/public\_html//;
 1120:    $r->print(<<ENDNODIR);
 1121: <html>
 1122: <body bgcolor='#FFFFFF'>
 1123: <h1>No such directory: $dir</h1>
 1124: </body>
 1125: </html>
 1126: ENDNODIR
 1127: }
 1128: 
 1129: # ---------------------------------------------------------------- View Handler
 1130: 
 1131: sub viewmap {
 1132:     my ($r,$url,$adv,$errtext)=@_;
 1133:     $r->print('<html>'.
 1134:      &Apache::loncommon::bodytag('Edit Content of a Map').
 1135: 	      &Apache::loncommon::help_open_faq(6).
 1136: 	      &Apache::loncommon::help_open_bug('RAT').
 1137: 	      &buttons($adv));
 1138:     if ($errtext) {
 1139: 	$r->print($errtext.'<hr />');
 1140:     }
 1141:     my $idx=0;
 1142:     $r->print('<h1>'.$url.'</h1>');
 1143:     if ($adv) {
 1144: 	$r->print('<p><b><font color="red">'.&mt('Map contents are not shown in order.').'</font></b></p><br />');
 1145:     }
 1146:     foreach (&attemptread(&Apache::lonnet::filelocation('',$url))) {
 1147: 	if (defined($_)) {
 1148:             $idx++;
 1149: 	    my ($title,$url)=split(/\:/,$_);
 1150:             $title=~s/\&colon\;/\:/g;
 1151:             $url=~s/\&colon\;/\:/g;
 1152:             unless ($title) { $title=(split(/\//,$url))[-1] };
 1153:             unless ($title) { $title='<i>Empty</i>'; }
 1154:             if ($url) {
 1155: 		$r->print('<a href="'.&Apache::lonratsrv::qtescape($url).'">');
 1156:             }
 1157:             $r->print(&Apache::lonratsrv::qtescape($title));
 1158:             if ($url) { $r->print('</a>'); }
 1159: 	    $r->print('<br>');
 1160:         }
 1161:     }
 1162:     $r->print('</body></html>');
 1163: }
 1164: 
 1165: # ================================================================ Main Handler
 1166: 
 1167: sub handler {
 1168:   my $r=shift;
 1169:   &Apache::loncommon::content_type($r,'text/html');
 1170:   $r->send_http_header;
 1171: 
 1172:   return OK if $r->header_only;
 1173:   my $target = $ENV{'form.grade_target'};
 1174:   if ($target eq 'meta') {
 1175:       &Apache::loncommon::content_type($r,'text/html');
 1176:       $r->send_http_header;
 1177:       return OK;
 1178:   }
 1179:   
 1180:   my $url=$r->uri;
 1181:   my $fn=&Apache::lonnet::filelocation('',$url);
 1182: 
 1183:   my ($dir)=($fn=~/^(.+)\/[^\/]+$/);
 1184:   unless (-e $dir) {
 1185:       &nodir($r,$dir);
 1186:       return OK;
 1187:   }
 1188: 
 1189: # ------------------------------------------- Determine which tools can be used
 1190:   my $adv=0;
 1191: 
 1192:   unless ($ENV{'form.forcesmp'}) {
 1193:      if ($ENV{'form.forceadv'}) {
 1194:         $adv=1;
 1195:      } elsif (my $fh=Apache::File->new($fn)) {
 1196: 	 my $allmap=join('',<$fh>);
 1197:          $adv=($allmap=~/\<map[^\>]+mode\s*\=\s*(\'|\")rat/is);
 1198:      }
 1199:   }
 1200: 
 1201:   my $errtext='';
 1202:   my $fatal=0;
 1203: 
 1204: # -------------------------------------------------------------------- Load map
 1205:   ($errtext,$fatal)=&mapread($fn,$errtext);
 1206: 
 1207:   if ($fatal==1) { $adv=1; }
 1208: 
 1209: # ----------------------------------- adv==1 now means "graphical MUST be used"
 1210: 
 1211:   if ($ENV{'form.forceadv'}) {
 1212:       &ratedt($r,$url);
 1213:   } elsif ($ENV{'form.forcesmp'}) {
 1214:       &smpedt($r,$url,$errtext);
 1215:   } else {
 1216:       &viewmap($r,$url,$adv,$errtext);
 1217:   }
 1218:   return OK;
 1219: }
 1220: 
 1221: 1;
 1222: __END__
 1223: 
 1224: 
 1225: 
 1226: 
 1227: 
 1228: 
 1229: 

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