Diff for /rat/lonratedt.pm between versions 1.55 and 1.71

version 1.55, 2004/04/24 15:05:16 version 1.71, 2005/06/08 18:49:38
Line 33  package Apache::lonratedt; Line 33  package Apache::lonratedt;
   
 =head1 NAME  =head1 NAME
   
 Apache::lonratedt: advanced resource assembly tool  Apache::lonratedt: simple resource assembly tool
   
 =head1 SYNOPSIS  =head1 SYNOPSIS
   
Line 173  use Apache::loncommon; Line 173  use Apache::loncommon;
 use Apache::lonlocal;  use Apache::lonlocal;
 use File::Copy;  use File::Copy;
   
 use vars qw(@order @resources @resparms);  use vars qw(@order @resources @resparms @zombies);
   
   
 # Mapread read maps into global arrays @links and @resources, determines status  # Mapread read maps into global arrays @links and @resources, determines status
Line 187  sub mapread { Line 187  sub mapread {
     undef @links;      undef @links;
     undef @resources;      undef @resources;
     undef @order;      undef @order;
       undef @resparms;
       undef @zombies;
   
     @resources=('');      @resources=('');
     @order=();      @order=();
       @resparms=();
       @zombies=();
   
     my ($outtext,$errtext)=&Apache::lonratsrv::loadmap($fn,'');      my ($outtext,$errtext)=&Apache::lonratsrv::loadmap($fn,'');
     if ($errtext) { return ($errtext,2); }      if ($errtext) { return ($errtext,2); }
Line 197  sub mapread { Line 202  sub mapread {
     foreach (split(/\<\&\>/,$outtext)) {      foreach (split(/\<\&\>/,$outtext)) {
  my ($command,$number,$content)=split(/\<\:\>/,$_);   my ($command,$number,$content)=split(/\<\:\>/,$_);
         if ($command eq 'objcont') {          if ($command eq 'objcont') {
     $resources[$number]=$content;      my ($title,$src,$ext,$type)=split(/\:/,$content);
       if ($ext eq 'cond') { next; }
       if ($type ne 'zombie') {
    $resources[$number]=$content;
       } else {
    $zombies[$number]=$content;
       }
         }          }
         if ($command eq 'objlinks') {          if ($command eq 'objlinks') {
             $links[$number]=$content;              $links[$number]=$content;
Line 294  sub attemptread { Line 305  sub attemptread {
     foreach (split(/\<\&\>/,$outtext)) {      foreach (split(/\<\&\>/,$outtext)) {
  my ($command,$number,$content)=split(/\<\:\>/,$_);   my ($command,$number,$content)=split(/\<\:\>/,$_);
         if ($command eq 'objcont') {          if ($command eq 'objcont') {
     $theseres[$number]=$content;      my ($title,$src,$ext,$type)=split(/\:/,$content);
       unless ($type eq 'zombie') {
    $theseres[$number]=$content;
       }
         }          }
         if ($command eq 'objlinks') {          if ($command eq 'objlinks') {
             $links[$number]=$content;              $links[$number]=$content;
Line 391  sub attemptread { Line 405  sub attemptread {
 # --------------------------------------------------------- Build up RAT screen  # --------------------------------------------------------- Build up RAT screen
 sub ratedt {  sub ratedt {
   my ($r,$url)=@_;    my ($r,$url)=@_;
     my $frameset = '<frameset rows="1,70,*" border="0">';
     if ($env{'environment.remote'} eq 'off') {
         $frameset = '<frameset rows="1,250,*" border="0">';
     }
   $r->print(<<ENDDOCUMENT);    $r->print(<<ENDDOCUMENT);
   
 <html>  <html>
Line 399  sub ratedt { Line 417  sub ratedt {
     var flag=0;      var flag=0;
 </script>  </script>
 </head>  </head>
 <frameset rows="1,50,*" border=0>  $frameset
 <frame name=server src="$url/loadonly/ratserver" noresize noscroll>  <frame name=server src="$url/loadonly/ratserver" noresize noscroll>
 <frame name=code src="/adm/rat/code.html">  <frame name=code src="$url/loadonly/adveditmenu">
 <frame name=mapout src="/adm/rat/map.html">  <frame name=mapout src="/adm/rat/map.html">
 </frameset>  </frameset>
 </html>  </html>
Line 428  sub buttons { Line 446  sub buttons {
     return $output.'</form><hr>';      return $output.'</form><hr>';
 }  }
   
   # ------------------------------------- Revive zombie idx or get unused number
   
   sub getresidx {
       my $url=shift;
       my $max=1+($#resources>$#zombies?$#resources:$#zombies);
       unless ($url) { return $max; }
       for (my $i=0; $i<=$#zombies; $i++) {
    my ($title,$src,$ext,$type)=split(/\:/,$zombies[$i]);
    if ($src eq $url) {
       undef $zombies[$i];
       return $i;
    }
       }
       return $max;
   }
   
   # --------------------------------------------------------------- Make a zombie
   
   sub makezombie {
       my $idx=shift;
       my ($name,$url,$ext)=split(/\:/,$resources[$idx]);
       $zombies[$idx]=$name.':'.$url.':'.$ext.':zombie';
   }
   
 # ----------------------------------------------------------- Paste into target  # ----------------------------------------------------------- Paste into target
 # modifies @order, @resources  # modifies @order, @resources
   
Line 440  sub pastetarget { Line 482  sub pastetarget {
             $name=&Apache::lonnet::unescape($name);              $name=&Apache::lonnet::unescape($name);
             $url=&Apache::lonnet::unescape($url);              $url=&Apache::lonnet::unescape($url);
             if ($url) {              if ($url) {
        my $idx=$#resources+1;         my $idx=&getresidx($url);
                $insertorder[$#insertorder+1]=$idx;                 $insertorder[$#insertorder+1]=$idx;
                my $ext='false';                 my $ext='false';
                if ($url=~/^http\:\/\//) { $ext='true'; }                 if ($url=~/^http\:\/\//) { $ext='true'; }
Line 486  sub startfinish { Line 528  sub startfinish {
    $resources[$order[0]]=$name.':'.$url.':'.$ext.':start:res';     $resources[$order[0]]=$name.':'.$url.':'.$ext.':start:res';
 # Make sure this has at least start and finish  # Make sure this has at least start and finish
    if ($#order==0) {     if ($#order==0) {
        $resources[$#resources+1]='::false';         $resources[&getresidx()]='::false';
        $order[1]=$#resources;         $order[1]=$#resources;
    }     }
 # Make the last one a finish resource  # Make the last one a finish resource
Line 530  sub storemap { Line 572  sub storemap {
             }              }
         }          }
     }      }
       for (my $i=0; $i<=$#zombies; $i++) {
           if (defined($zombies[$i])) {
       $output.='<&>objcont<:>'.$i.'<:>'.$zombies[$i];
           }
       }
     $output=~s/http\&colon\;\/\///g;      $output=~s/http\&colon\;\/\///g;
     $ENV{'form.output'}=$output;      $env{'form.output'}=$output;
     return       return 
      &Apache::lonratsrv::loadmap($fn,&Apache::lonratsrv::savemap($fn,''));       &Apache::lonratsrv::loadmap($fn,&Apache::lonratsrv::savemap($fn,''));
 }  }
   
   # ------------------------------------------ Store and get parameters in global
   
   sub storeparameter {
       my ($to,$name,$value,$ptype)=@_;
       my $newentry='';
       my $nametype='';
       foreach (split('&&&',$resparms[$to])) {
    my ($thistype,$thisname,$thisvalue)=split('___',$_);
    if ($thisname) {
       unless ($thisname eq $name) {
    $newentry.=$_.'&&&';
       } else {
    $nametype=$thistype;
       }
    }
       }
       unless ($ptype) { $ptype=$nametype; }
       unless ($ptype) { $ptype='string'; }
       $newentry.=$ptype.'___'.$name.'___'.$value;
       $resparms[$to]=$newentry;
   }
   
   sub delparameter {
       my ($to,$name)=@_;
       my $newentry='';
       my $nametype='';
       foreach (split('&&&',$resparms[$to])) {
    my ($thistype,$thisname,$thisvalue)=split('___',$_);
    if ($thisname) {
       unless ($thisname eq $name) {
    $newentry.=$_.'&&&';
       }
    }
       }
       $resparms[$to]=$newentry;
   }
   
   sub getparameter {
       my ($to,$name)=@_;
       my $value=undef;
       my $ptype=undef;
       foreach (split('&&&',$resparms[$to])) {
    my ($thistype,$thisname,$thisvalue)=split('___',$_);
    if ($thisname eq $name) {
       $value=$thisvalue;
       $ptype=$thistype;
    }
       }
       return ($value,$ptype);
   }
   
   # ----------------------------------------------------------------- Edit script
 sub editscript {  sub editscript {
     my $mode=shift;      my $mode=shift;
     my $resurl=&Apache::loncommon::lastresurl();      my $resurl=&Apache::loncommon::lastresurl();
Line 651  sub smpedt { Line 750  sub smpedt {
    my $buttons=&buttons(2);     my $buttons=&buttons(2);
    my $tmpfn=&Apache::lonnet::filelocation('',$url).'.tmp';     my $tmpfn=&Apache::lonnet::filelocation('',$url).'.tmp';
    my $targetmsg='';     my $targetmsg='';
    if ($ENV{'form.save'}) {     if ($env{'form.save'}) {
        $targetmsg='<b>Saving ...</b><br>';  
        copy($tmpfn,&Apache::lonnet::filelocation('',$url));         copy($tmpfn,&Apache::lonnet::filelocation('',$url));
        unlink($tmpfn);         unlink($tmpfn);
        my ($errtext,$fatal)=         my ($errtext,$fatal)=
                            &mapread(&Apache::lonnet::filelocation('',$url),'');                             &mapread(&Apache::lonnet::filelocation('',$url),'');
          unless ($fatal) {
      $targetmsg='<b>'.&mt('Saved.').'</b><br />';
          } else {
      $targetmsg='<b>'.&mt('An error occured while saving.').'</b><br />';
          }
    }     }
    if ($ENV{'form.revert'}) {     if ($env{'form.revert'}) {
        $targetmsg='<b>Reverting ...</b><br>';         $targetmsg='<b>'.&mt('Reverted.').'</b><br />';
        unlink($tmpfn);         unlink($tmpfn);
        my ($errtext,$fatal)=         my ($errtext,$fatal)=
                            &mapread(&Apache::lonnet::filelocation('',$url),'');                             &mapread(&Apache::lonnet::filelocation('',$url),'');
Line 671  sub smpedt { Line 774  sub smpedt {
    }     }
 # ---------------------------------------------------------- Process form input  # ---------------------------------------------------------- Process form input
   
    my @importselect=();     my @importselect=&Apache::loncommon::get_env_multiple('form.importsel');
    my @targetselect=();     my @targetselect=&Apache::loncommon::get_env_multiple('form.target');
    undef @importselect;  
    undef @targetselect;  
    if (defined($ENV{'form.importsel'})) {  
        if (ref($ENV{'form.importsel'})) {  
    @importselect=sort(@{$ENV{'form.importsel'}});  
        } else {  
            @importselect=($ENV{'form.importsel'});  
        }  
    }  
    if (defined($ENV{'form.target'})) {  
        if (ref($ENV{'form.target'})) {  
    @targetselect=sort(@{$ENV{'form.target'}});  
        } else {  
            @targetselect=($ENV{'form.target'});  
        }  
    }  
 # ============================================================ Process commands  # ============================================================ Process commands
   
    my $targetdetail=$ENV{'form.targetdetail'};     my $targetdetail=$env{'form.targetdetail'};
    my $importdetail=$ENV{'form.curimpdetail'};     my $importdetail=$env{'form.curimpdetail'};
   
 # ---------------------------------------------------- Importing from groupsort  # ---------------------------------------------------- Importing from groupsort
    if (($ENV{'form.importdetail'}) && (!$ENV{'form.impfortarget'})) {     if (($env{'form.importdetail'}) && (!$env{'form.impfortarget'})) {
   
        $importdetail='';         $importdetail='';
        my @curimport=split(/\&/,$ENV{'form.curimpdetail'});         my @curimport=split(/\&/,$env{'form.curimpdetail'});
   
        my $lastsel;         my $lastsel;
   
Line 715  sub smpedt { Line 802  sub smpedt {
    }     }
        }         }
   
       $importdetail.='&'.$ENV{'form.importdetail'};        $importdetail.='&'.$env{'form.importdetail'};
   
        for (my $i=$lastsel+1;$i<=$#curimport;$i++) {         for (my $i=$lastsel+1;$i<=$#curimport;$i++) {
            my ($name,$url)=split(/\=/,$curimport[$i]);             my ($name,$url)=split(/\=/,$curimport[$i]);
Line 727  sub smpedt { Line 814  sub smpedt {
        $importdetail=~s/^\&//;         $importdetail=~s/^\&//;
   
 # ------------------------------------------------------------------- Clear all  # ------------------------------------------------------------------- Clear all
    } elsif ($ENV{'form.clear'}) {     } elsif ($env{'form.clear'}) {
        $importdetail='';         $importdetail='';
 # ------------------------------------------------------------ Discard selected  # ------------------------------------------------------------ Discard selected
    } elsif ($ENV{'form.discard'}) {     } elsif ($env{'form.discard'}) {
        $importdetail='';         $importdetail='';
        my @curimport=split(/\&/,$ENV{'form.curimpdetail'});         my @curimport=split(/\&/,$env{'form.curimpdetail'});
        foreach (@importselect) {         foreach (@importselect) {
    $curimport[$_]='';     $curimport[$_]='';
        }         }
Line 743  sub smpedt { Line 830  sub smpedt {
    }     }
        }         }
 # --------------------------------------------------------- Loading another map  # --------------------------------------------------------- Loading another map
    } elsif ($ENV{'form.loadmap'}) {     } elsif ($env{'form.loadmap'}) {
        $importdetail='';         $importdetail='';
        my @curimport=split(/\&/,$ENV{'form.curimpdetail'});         my @curimport=split(/\&/,$env{'form.curimpdetail'});
   
        my $lastsel;         my $lastsel;
   
Line 763  sub smpedt { Line 850  sub smpedt {
        }         }
   
        foreach (         foreach (
     &Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$ENV{'form.importmap'}))) {      &Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$env{'form.importmap'}))) {
    my ($name,$url)=split(/\:/,$_);     my ($name,$url)=split(/\:/,$_);
            if ($url) {             if ($url) {
               $importdetail.='&'.&Apache::lonnet::escape($name).'='.                $importdetail.='&'.&Apache::lonnet::escape($name).'='.
Line 781  sub smpedt { Line 868  sub smpedt {
        $importdetail=~s/^\&//;         $importdetail=~s/^\&//;
   
 # ------------------------------------------------ Groupimport/search to target  # ------------------------------------------------ Groupimport/search to target
    } elsif ($ENV{'form.importdetail'}) {     } elsif ($env{'form.importdetail'}) {
        my $lastsel;         my $lastsel;
        if (defined($targetselect[-1])) {         if (defined($targetselect[-1])) {
    $lastsel=$targetselect[-1];     $lastsel=$targetselect[-1];
        } else {         } else {
            $lastsel=$#order+1;             $lastsel=$#order+1;
        }         }
        &pastetarget($lastsel,split(/\&/,$ENV{'form.importdetail'}));         &pastetarget($lastsel,split(/\&/,$env{'form.importdetail'}));
        &storemap(&Apache::lonnet::filelocation('',$url));         &storemap(&Apache::lonnet::filelocation('',$url));
 # ------------------------------------------------------------------------- Cut  # ------------------------------------------------------------------------- Cut
    } elsif (($ENV{'form.cut'}) || ($ENV{'form.copy'})) {     } elsif (($env{'form.cut'}) || ($env{'form.copy'})) {
        $importdetail='';         $importdetail='';
        my @curimport=split(/\&/,$ENV{'form.curimpdetail'});         my @curimport=split(/\&/,$env{'form.curimpdetail'});
   
        my $lastsel;         my $lastsel;
   
Line 827  sub smpedt { Line 914  sub smpedt {
        $importdetail=~s/\&+/\&/g;         $importdetail=~s/\&+/\&/g;
        $importdetail=~s/^\&//;         $importdetail=~s/^\&//;
   
        if ($ENV{'form.cut'}) {         if ($env{'form.cut'}) {
            my @neworder=();             my @neworder=();
            for (my $i=0;$i<=$#order;$i++) {             for (my $i=0;$i<=$#order;$i++) {
                my $include=1;                 my $include=1;
                foreach (@targetselect) {                 foreach (@targetselect) {
    if ($_-1==$i) { $include=0; }     if ($_-1==$i) { $include=0; }
                }                 }
                if ($include) { $neworder[$#neworder+1]=$order[$i]; }                 if ($include) { 
      $neworder[$#neworder+1]=$order[$i]; 
          } else {
      &makezombie($order[$i]);
          }
            }             }
            @order=@neworder;             @order=@neworder;
            &storemap(&Apache::lonnet::filelocation('',$url));                   &storemap(&Apache::lonnet::filelocation('',$url));      
        }         }
   
 # ----------------------------------------------------------------------- Paste  # ----------------------------------------------------------------------- Paste
    } elsif ($ENV{'form.paste'}) {     } elsif ($env{'form.paste'}) {
        my $lastsel;         my $lastsel;
        if (defined($targetselect[-1])) {         if (defined($targetselect[-1])) {
    $lastsel=$targetselect[-1];     $lastsel=$targetselect[-1];
Line 849  sub smpedt { Line 940  sub smpedt {
            $lastsel=$#order+1;             $lastsel=$#order+1;
        }         }
        my @newsequence;         my @newsequence;
        my @curimport=split(/\&/,$ENV{'form.curimpdetail'});         my @curimport=split(/\&/,$env{'form.curimpdetail'});
        foreach (@importselect) {         foreach (@importselect) {
           $newsequence[$#newsequence+1]=$curimport[$_];            $newsequence[$#newsequence+1]=$curimport[$_];
        }         }
        &pastetarget($lastsel,@newsequence);         &pastetarget($lastsel,@newsequence);
        &storemap(&Apache::lonnet::filelocation('',$url));         &storemap(&Apache::lonnet::filelocation('',$url));
 # -------------------------------------------------------------------- Move up   # -------------------------------------------------------------------- Move up 
    } elsif ($ENV{'form.moveup'}) {     } elsif ($env{'form.moveup'}) {
        foreach (sort @targetselect) {         foreach (sort @targetselect) {
            if ($_-1>0) {             if ($_-1>0) {
               my $movethis=$order[$_-1];                my $movethis=$order[$_-1];
Line 866  sub smpedt { Line 957  sub smpedt {
        }         }
        &storemap(&Apache::lonnet::filelocation('',$url));         &storemap(&Apache::lonnet::filelocation('',$url));
 # ------------------------------------------------------------------ Move down  # ------------------------------------------------------------------ Move down
    } elsif ($ENV{'form.movedown'}) {     } elsif ($env{'form.movedown'}) {
        foreach (reverse sort @targetselect) {         foreach (reverse sort @targetselect) {
            if ($_-1<$#order) {             if ($_-1<$#order) {
               my $movethis=$order[$_-1];                my $movethis=$order[$_-1];
Line 876  sub smpedt { Line 967  sub smpedt {
        }         }
        &storemap(&Apache::lonnet::filelocation('',$url));         &storemap(&Apache::lonnet::filelocation('',$url));
 # --------------------------------------------------------------------- Rename  # --------------------------------------------------------------------- Rename
    } elsif ($ENV{'form.renameres'}) {     } elsif ($env{'form.renameres'}) {
        my $residx=$Apache::lonratedt::order[$ENV{'form.renameidx'}-1];         my $residx=$Apache::lonratedt::order[$env{'form.renameidx'}-1];
        my ($name,@resrest)=split(/\:/,$Apache::lonratedt::resources[$residx]);         my ($name,@resrest)=split(/\:/,$Apache::lonratedt::resources[$residx]);
        $name=$ENV{'form.renametitle'};         $name=$env{'form.renametitle'};
        $name=~s/\:/\&colon\;/g;         $name=~s/\:/\&colon\;/g;
        $Apache::lonratedt::resources[$residx]=$name.':'.join(':',@resrest);         $Apache::lonratedt::resources[$residx]=$name.':'.join(':',@resrest);
        &storemap(&Apache::lonnet::filelocation('',$url));         &storemap(&Apache::lonnet::filelocation('',$url));
Line 919  sub smpedt { Line 1010  sub smpedt {
   
 # ----------------------------------------------------- Start simple RAT screen  # ----------------------------------------------------- Start simple RAT screen
    my $editscript=&editscript('simple');     my $editscript=&editscript('simple');
    my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef,1).     my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef,
        &Apache::loncommon::help_open_topic('Sequence_Simple_Editor_Creation').   ($env{'environment.remote'} ne 'off')).
        &Apache::loncommon::help_open_faq(6).         &Apache::loncommon::help_open_menu('','Sequence_Simple_Editor_Creation','Sequence_Simple_Editor_Creation','',6,'RAT');
        &Apache::loncommon::help_open_bug('RAT');  
    my %lt=&Apache::lonlocal::texthash(     my %lt=&Apache::lonlocal::texthash(
       'sa' => 'Save',        'sa' => 'Save',
       'nt' => 'New Title',        'nt' => 'New Title',
Line 1078  sub viewmap { Line 1168  sub viewmap {
     my ($r,$url,$adv,$errtext)=@_;      my ($r,$url,$adv,$errtext)=@_;
     $r->print('<html>'.      $r->print('<html>'.
      &Apache::loncommon::bodytag('Edit Content of a Map').       &Apache::loncommon::bodytag('Edit Content of a Map').
       &Apache::loncommon::help_open_faq(6).        &Apache::loncommon::help_open_menu('','','','',6,'RAT').
       &Apache::loncommon::help_open_bug('RAT').  
       &buttons($adv));        &buttons($adv));
     if ($errtext) {      if ($errtext) {
  $r->print($errtext.'<hr />');   $r->print($errtext.'<hr />');
Line 1089  sub viewmap { Line 1178  sub viewmap {
     if ($adv) {      if ($adv) {
  $r->print('<p><b><font color="red">'.&mt('Map contents are not shown in order.').'</font></b></p><br />');   $r->print('<p><b><font color="red">'.&mt('Map contents are not shown in order.').'</font></b></p><br />');
     }      }
       $r->print( '<table border="0" cellspacing="2" cellpadding="4">'.
                  '<tr bgcolor="#DDDDDD"><th>'.&mt('Type').'</th>'.
                  '<th>'.&mt('Title in map').'</th>'.
                  '<th>'.&mt('Filename of resource').'</th>'.
                  '<th>'.&mt('Link to published resource').'</th>'.
                  '<th>'.&mt('Link to resource in Construction Space').'</th>'.
                  '</tr>');
       my @backgroundColors = ("#FFFFFF", "#F6F6F6");
     foreach (&attemptread(&Apache::lonnet::filelocation('',$url))) {      foreach (&attemptread(&Apache::lonnet::filelocation('',$url))) {
  if (defined($_)) {   if (defined($_)) {
             $idx++;              $idx++;
     my ($title,$url)=split(/\:/,$_);      my ($title,$url,$cond)=split(/\:/,$_);
       if ($cond eq 'cond') { next; }
             $title=~s/\&colon\;/\:/g;              $title=~s/\&colon\;/\:/g;
             $url=~s/\&colon\;/\:/g;              $url=~s/\&colon\;/\:/g;
             unless ($title) { $title=(split(/\//,$url))[-1] };              unless ($title) { $title=(split(/\//,$url))[-1] };
             unless ($title) { $title='<i>Empty</i>'; }              unless ($title) { $title='<i>'.&mt('Empty').'</i>'; }
               my $resurl = &Apache::lonratsrv::qtescape($url);
               my $resfilepath = $Apache::lonnet::perlvar{'lonDocRoot'}.$resurl;
               my $filename; 
               if ($resurl =~ m#/([^/]+)$#) {
                   $filename = $1;
               }
               my $cstrurl = $resurl;
               $cstrurl =~ s#^/res/[^/]+/([^/]+)/#/priv/$1/#;
               my $bgcol = $idx%2; 
               $r->print('<tr bgcolor='.$backgroundColors[$bgcol].'><td>'.
                         '<img src="'.&Apache::loncommon::icon($resfilepath).
                         '" /></td><td>'.&Apache::lonratsrv::qtescape($title).
                         '</td><td>'.$filename.'</td><td>');
               if ($url) {
    $r->print('<a href="'.$resurl.'">'.&mt('Resource space').'</a>');
               }
               $r->print('</td><td>');
             if ($url) {              if ($url) {
  $r->print('<a href="'.&Apache::lonratsrv::qtescape($url).'">');                 $r->print('<a href="'.$cstrurl.'">'.
                            &mt('Construction space').'</a>');
             }              }
             $r->print(&Apache::lonratsrv::qtescape($title));              $r->print('</td></tr>'."\n");
             if ($url) { $r->print('</a>'); }  
     $r->print('<br>');  
         }          }
     }      }
       $r->print('</table>');
     $r->print('</body></html>');      $r->print('</body></html>');
 }  }
   
Line 1116  sub handler { Line 1231  sub handler {
   $r->send_http_header;    $r->send_http_header;
   
   return OK if $r->header_only;    return OK if $r->header_only;
   my $target = $ENV{'form.grade_target'};    my $target = $env{'form.grade_target'};
   if ($target eq 'meta') {    if ($target eq 'meta') {
       &Apache::loncommon::content_type($r,'text/html');        &Apache::loncommon::content_type($r,'text/html');
       $r->send_http_header;        $r->send_http_header;
Line 1135  sub handler { Line 1250  sub handler {
 # ------------------------------------------- Determine which tools can be used  # ------------------------------------------- Determine which tools can be used
   my $adv=0;    my $adv=0;
   
   unless ($ENV{'form.forcesmp'}) {    unless ($env{'form.forcesmp'}) {
      if ($ENV{'form.forceadv'}) {       if ($env{'form.forceadv'}) {
         $adv=1;          $adv=1;
      } elsif (my $fh=Apache::File->new($fn)) {       } elsif (my $fh=Apache::File->new($fn)) {
  my $allmap=join('',<$fh>);   my $allmap=join('',<$fh>);
Line 1154  sub handler { Line 1269  sub handler {
   
 # ----------------------------------- adv==1 now means "graphical MUST be used"  # ----------------------------------- adv==1 now means "graphical MUST be used"
   
   if ($ENV{'form.forceadv'}) {    if ($env{'form.forceadv'}) {
       &ratedt($r,$url);        &ratedt($r,$url);
   } elsif ($ENV{'form.forcesmp'}) {    } elsif ($env{'form.forcesmp'}) {
       &smpedt($r,$url,$errtext);        &smpedt($r,$url,$errtext);
   } else {    } else {
       &viewmap($r,$url,$adv,$errtext);        &viewmap($r,$url,$adv,$errtext);

Removed from v.1.55  
changed lines
  Added in v.1.71


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