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

version 1.25, 2002/05/21 18:18:07 version 1.27, 2002/05/22 20:39:59
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 353  sub smpedt { Line 354  sub smpedt {
    my @targetselect=();     my @targetselect=();
    undef @importselect;     undef @importselect;
    undef @targetselect;     undef @targetselect;
    if (defined($ENV{'form.import'})) {     if (defined($ENV{'form.importsel'})) {
        if (ref($ENV{'form.import'})) {         if (ref($ENV{'form.importsel'})) {
    @importselect=sort(@{$ENV{'form.import'}});     @importselect=sort(@{$ENV{'form.importsel'}});
        } else {         } else {
            @importselect=($ENV{'form.import'});             @importselect=($ENV{'form.importsel'});
        }         }
    }     }
    if (defined($ENV{'form.target'})) {     if (defined($ENV{'form.target'})) {
Line 683  function idxcheck(mode) { Line 684  function idxcheck(mode) {
   
    function viewimport() {     function viewimport() {
        openview((document.forms.simpleedit.curimpdetail.value.split('&'))         openview((document.forms.simpleedit.curimpdetail.value.split('&'))
                 [document.forms.simpleedit.import.selectedIndex+1]);                  [document.forms.simpleedit.importsel.selectedIndex+1]);
    }     }
   
 </script>  </script>
Line 720  after selected Line 721  after selected
 <hr><input type=button onClick="javascript:viewtarget()" value="View">  <hr><input type=button onClick="javascript:viewtarget()" value="View">
 </td></tr>  </td></tr>
   
 <tr><td bgcolor="#FFFFCC"><select name="import" multiple>  <tr><td bgcolor="#FFFFCC"><select name="importsel" size=10 multiple>
 $importwindow  $importwindow
 </select>  </select>
 </td>  </td>
Line 734  Copy selected<br> Line 735  Copy selected<br>
 Paste after selected<br>  Paste after selected<br>
 <input type=submit name=paste value='-->'>  <input type=submit name=paste value='-->'>
 </td>  </td>
 <td bgcolor="#FFFFCC"><select name="target" multiple>  <td bgcolor="#FFFFCC"><select name="target" size=10 multiple>
 $targetwindow  $targetwindow
 </select>  </select>
 </table>  </table>
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.27


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