Diff for /rat/lonratedt.pm between versions 1.25 and 1.26

version 1.25, 2002/05/21 18:18:07 version 1.26, 2002/05/22 13:31:22
Line 263  ENDDOCUMENT Line 263  ENDDOCUMENT
 # ---------------------------------------------------------------- Make buttons  # ---------------------------------------------------------------- Make buttons
   
 sub buttons {  sub buttons {
       if ($ENV{'form.forceselect'}) { return ''; }
     my $adv=shift;      my $adv=shift;
     my $output='<form method=post>';           my $output='<form method=post>';     
     if ($adv==1) {      if ($adv==1) {
Line 764  ENDNODIR Line 765  ENDNODIR
   
 sub viewmap {  sub viewmap {
     my ($r,$url,$adv,$errtext)=@_;      my ($r,$url,$adv,$errtext)=@_;
     $r->print('<html><body bgcolor="#FFFFFF">'.&buttons($adv));      $r->print('<html>');
       if ($ENV{'form.forceselect'}) { $r->print(<<ENDSCRIPT);
   <script>
   
   function select_group() {
       window.location="/adm/groupsort?catalogmode=groupimport&mode=rat&acts="+document.forms.fileattr.acts.value;
   }
   
   function queue(val) {
       if (eval("document.forms."+val+".filelink.checked")) {
    var l=val.length;
    var v=val.substring(4,l);
    document.forms.fileattr.acts.value+='1a'+v+'b';
       }
       else {
    var l=val.length;
    var v=val.substring(4,l);
    document.forms.fileattr.acts.value+='0a'+v+'b';
       }
   }
   
   
   
   </script>
   ENDSCRIPT
       }
       $r->print('<body bgcolor="#FFFFFF">'.&buttons($adv));
       if ($ENV{'form.forceselect'}) { $r->print(<<ENDSELECT);
   <form name=fileattr><input type=hidden name=acts value=''>
   <input type="button" name="close" value='CLOSE' onClick="self.close()">
   <input type="button" name="groupimport" value='GROUP IMPORT'
   onClick="javascript:select_group()">
   </form>   
   ENDSELECT
       }
     if ($errtext) {      if ($errtext) {
  $r->print($errtext.'<hr>');   $r->print($errtext.'<hr>');
     }      }
       my $idx=0;
     foreach (&attemptread(&Apache::lonnet::filelocation('',$url))) {      foreach (&attemptread(&Apache::lonnet::filelocation('',$url))) {
  if (defined($_)) {   if (defined($_)) {
               $idx++;
               if ($ENV{'form.forceselect'}) { 
    $r->print('<form name="form'.$idx.'">');
               }
     my ($title,$url)=split(/\:/,$_);      my ($title,$url)=split(/\:/,$_);
             $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>Empty</i>'; }
             if ($url) {              if ($url) {
    if ($ENV{'form.forceselect'}) {
       $r->print(<<ENDCHECKBOX);
   <input type='checkbox' name='filelink' 
   value='$url' onClick='javascript:queue("form$idx")' >
   <input type='hidden' name='title' value='$title'>
   ENDCHECKBOX
                   }
  $r->print('<a href="'.&Apache::lonratsrv::qtescape($url).'">');   $r->print('<a href="'.&Apache::lonratsrv::qtescape($url).'">');
             }              }
             $r->print(&Apache::lonratsrv::qtescape($title));              $r->print(&Apache::lonratsrv::qtescape($title));
             if ($url) { $r->print('</a>'); }              if ($url) { $r->print('</a>'); }
             $r->print('<br>');              if ($ENV{'form.forceselect'}) {
    $r->print('</form>');
               } else {
    $r->print('<br>');
               }
         }          }
     }      }
     $r->print('</body></html>');      $r->print('</body></html>');
Line 794  sub handler { Line 845  sub handler {
   $r->send_http_header;    $r->send_http_header;
   
   return OK if $r->header_only;    return OK if $r->header_only;
    
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                                             ['forceselect']);
   
   my $url=$r->uri;    my $url=$r->uri;
   my $fn=&Apache::lonnet::filelocation('',$url);    my $fn=&Apache::lonnet::filelocation('',$url);

Removed from v.1.25  
changed lines
  Added in v.1.26


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