Diff for /loncom/interface/groupsort.pm between versions 1.60 and 1.66

version 1.60, 2007/07/25 23:10:23 version 1.66, 2010/05/03 13:53:47
Line 37  use GDBM_File; Line 37  use GDBM_File;
 use Apache::loncommon;  use Apache::loncommon;
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::lonnet;  use Apache::lonnet;
 use LONCAPA();  use LONCAPA;
   
 my $iconpath; # variable to be accessible to multiple subroutines  my $iconpath; # variable to be accessible to multiple subroutines
 my %hash; # variable to tie to user specific database  my %hash; # variable to tie to user specific database
Line 206  sub handler { Line 206  sub handler {
     
    &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
      ['acts','mode','readfile','recover','bookmarks']);       ['acts','mode','readfile','recover','bookmarks']);
     # color scheme  
     my $fileclr = '#ffffe6';  
     my $titleclr = '#ddffff';  
   
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      $r->send_http_header;
Line 229  function finish_import() { Line 226  function finish_import() {
     for (var num=0; num<document.forms.groupsort.fnum.value; num++) {      for (var num=0; num<document.forms.groupsort.fnum.value; num++) {
  $begincondition   $begincondition
  opener.document.forms.simpleedit.importdetail.value+='&'+   opener.document.forms.simpleedit.importdetail.value+='&'+
               escape(eval("document.forms.groupsort.title"+num+".value"))+'='+                eval("document.forms.groupsort.title"+num+".value")+'='+
       escape(eval("document.forms.groupsort.filelink"+num+".value"))+'='+        eval("document.forms.groupsort.filelink"+num+".value")+'='+
       escape(eval("document.forms.groupsort.id"+num+".value"));        eval("document.forms.groupsort.id"+num+".value");
  $endcondition   $endcondition
     }      }
     opener.document.forms.simpleedit.submit();      opener.document.forms.simpleedit.submit();
Line 310  END Line 307  END
   
     my $ctr = 0;      my $ctr = 0;
     my $clen = scalar(@resources);      my $clen = scalar(@resources);
       my $title = '';
       if ($env{'form.recover'}) {
           $title = 'Recover Removed Resources';
       } else {
           $title = 'Sort Imported Resources';
       }
       if ($env{'form.bookmarks'}) {
           $title = 'Import Resources from Bookmarks';
       }
     if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) {      if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) {
  my %lt=&Apache::lonlocal::texthash(   my %lt=&Apache::lonlocal::texthash(
  'fin'=> 'Finalize order of resources',   'fin'=> 'Finalize order of resources',
Line 317  END Line 323  END
  'cs' => 'Continue Search',   'cs' => 'Continue Search',
  'fi' => 'Finish Import',   'fi' => 'Finish Import',
  're' => 'Recover Checked',   're' => 'Recover Checked',
    'ip' => 'Import Checked',
  'ca' => 'Cancel',   'ca' => 'Cancel',
  'co' => 'Change Order',   'co' => 'Change Order',
  'ti' => 'Title',   'ti' => 'Title',
  'pa' => 'Path',   'pa' => 'Path',
                 'in' => 'Include'                  'in' => 'Include'
  );   );
  my $title = ($env{'form.recover'}) ? 'Recover Removed Resources'  
                                            : 'Sort Imported Resources';  
  $r->print(&Apache::loncommon::start_page($title, $js));   $r->print(&Apache::loncommon::start_page($title, $js));
    $r->print('<h1>'.&mt($title).'</h1>');
   
  $r->print(<<END);   $r->print(<<END);
 <form method='post' action='/adm/groupsort' name='groupsort'  <form method='post' action='/adm/groupsort' name='groupsort'
Line 341  END Line 348  END
   
         $r->print(&Apache::loncommon::inhibit_menu_check('input'));          $r->print(&Apache::loncommon::inhibit_menu_check('input'));
         # ---          # ---
       
         if ($env{'form.recover'}) {          my $buttontext = $lt{'re'};
           if ($env{'form.bookmarks'}) {
               $buttontext = $lt{'ip'}
           }
           if ($env{'form.recover'} || $env{'form.bookmarks'}) {
     $r->print(<<END);      $r->print(<<END);
 <input type="button" name="alter" value="$lt{'re'}"  <input type="button" name="alter" value="$buttontext"
  onClick="finish_import()" />&nbsp;   onClick="finish_import()" />&nbsp;
 <input type="button" name="alter" value="$lt{'ca'}" onClick="self.close()" />  <input type="button" name="alter" value="$lt{'ca'}" onClick="self.close()" />
 END  END
Line 353  END Line 364  END
     my $resurl =       my $resurl = 
  &Apache::loncommon::escape_single(&Apache::loncommon::lastresurl());   &Apache::loncommon::escape_single(&Apache::loncommon::lastresurl());
     $r->print(<<END);      $r->print(<<END);
 <b><font color="#888888">$lt{'fin'}</font></b>  <h2>$lt{'fin'}</h2>
   <div>
 <input type="button" name="alter" value="$lt{'ci'}"  <input type="button" name="alter" value="$lt{'ci'}"
  onClick="window.location='$resurl?inhibitmenu=yes&amp;catalogmode=import'" />&nbsp;   onClick="window.location='$resurl?inhibitmenu=yes&amp;catalogmode=import'" />&nbsp;
 <input type="button" name="altersearch" value="$lt{'cs'}"  <input type="button" name="altersearch" value="$lt{'cs'}"
Line 361  END Line 373  END
 <input type="button" name="alter" value="$lt{'fi'}"  <input type="button" name="alter" value="$lt{'fi'}"
  onClick="finish_import()" />&nbsp;   onClick="finish_import()" />&nbsp;
 <input type="button" name="alter" value="$lt{'ca'}" onClick="self.close()" />  <input type="button" name="alter" value="$lt{'ca'}" onClick="self.close()" />
   </div>
   <br />
 END  END
         }          }
         $r->print("<table border='0'><tr><td bgcolor='#eeeeee'>");  
  $r->print("<table border=0><tr>\n");          # Only display header if content exists
  if (($env{'form.readfile'}) || ($env{'form.bookmarks'})) {           if ($clen > 0) {
     $r->print("<td bgcolor='$titleclr'><b>$lt{'in'}</b></td>\n");              $r->print(&Apache::loncommon::start_data_table()
  } else {                        .&Apache::loncommon::start_data_table_header_row());
     $r->print("<td colspan='2' bgcolor='$titleclr'><b>$lt{'co'}</b></td>\n");               if (($env{'form.readfile'}) || ($env{'form.bookmarks'})) { 
  }                  $r->print("<th>$lt{'in'}</th>\n");
  $r->print("<td colspan='2' bgcolor='$titleclr'><b>$lt{'ti'}</b></td>\n");              } else { 
  $r->print("<td bgcolor='$titleclr'><b>$lt{'pa'}</b></td></tr>\n");                  $r->print('<th colspan="2">'.$lt{'co'}.'</th>'."\n"); 
               }
               $r->print('<th colspan="2">'.$lt{'ti'}.'</th>'."\n");
               $r->print("<th>$lt{'pa'}</th>");
               $r->print(&Apache::loncommon::end_data_table_header_row()."\n");
           } else {
               my $errtxt = '';
               if ($env{'form.recover'}) {
                   $errtxt = 'There are no resources to recover.';
               } else {
                   $errtxt = 'There are no resources to import.';
               }
               if ($env{'form.bookmarks'}) {
                   $errtxt = 'There are no resources in your bookmarks to import.';
               }
               $r->print('<p class="LC_info">'.&mt($errtxt).'</p>');
           }
     } else {      } else {
  $r->print(&Apache::loncommon::start_page(undef,$js,   $r->print(&Apache::loncommon::start_page(undef,$js,
  {'only_body' => 1}));   {'only_body' => 1}));
   #       $r->print('<h1>'.&mt($title).'</h1>');
  $r->print(<<END);   $r->print(<<END);
 <form method='post' action='/adm/groupsort' name='groupsort'  <form method='post' action='/adm/groupsort' name='groupsort'
       enctype='application/x-www-form-urlencoded'>        enctype='application/x-www-form-urlencoded'>
Line 390  END Line 421  END
  $ctr++;   $ctr++;
  my $iconname=&Apache::loncommon::icon($resource->{'url'});   my $iconname=&Apache::loncommon::icon($resource->{'url'});
  if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) {   if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) {
     $r->print("<tr><td bgcolor='$fileclr'>");      $r->print(&Apache::loncommon::start_data_table_row()
                        ."<td>");
             if (($env{'form.readfile'}) || ($env{'form.bookmarks'})) {              if (($env{'form.readfile'}) || ($env{'form.bookmarks'})) {
  $r->print(&checkbox($ctr-1));   $r->print(&checkbox($ctr-1));
     } else {      } else {
Line 402  END Line 434  END
  if (($clen > 1)  || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) {   if (($clen > 1)  || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) {
     $r->print("</td>");      $r->print("</td>");
             unless (($env{'form.readfile'}) || ($env{'form.bookmarks'})) {              unless (($env{'form.readfile'}) || ($env{'form.bookmarks'})) {
  $r->print("<td bgcolor='$fileclr'>".   $r->print("<td>".
   &select_box($clen,$ctr).    &select_box($clen,$ctr).
   "</td>");    "</td>");
     }      }
     $r->print("<td bgcolor='$fileclr'>");      $r->print("<td>");
     $r->print("<img src='$iconname' />");      $r->print("<img src='$iconname' />");
     $r->print("</td><td bgcolor='$fileclr'>");      $r->print("</td><td>");
     $r->print($resource->{'title'}.$resource->{'notes'}."</td><td bgcolor='$fileclr'>\n");      $r->print($resource->{'title'}.$resource->{'notes'}."</td><td>\n");
     $r->print($resource->{'url'}."</td></tr>\n");      $r->print($resource->{'url'}."</td>"
                        .&Apache::loncommon::end_data_table_row()
                        ."\n");
  }    } 
     }      }
     if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) {      if (($clen > 1) || ($env{'form.readfile'}) || ($env{'form.bookmarks'})) {
  $r->print("</table></td></tr></table></form>");          if ($clen > 0) {
               $r->print(&Apache::loncommon::end_data_table());
           }
           $r->print('</form>');
     } else {      } else {
  $r->print(<<END);   $r->print(<<END);
 <script type="text/javascript">  <script type="text/javascript">
Line 431  END Line 468  END
 # --------------------------------------- Hidden values (returns scalar string)  # --------------------------------------- Hidden values (returns scalar string)
 sub hidden {  sub hidden {
     my ($sel,$title,$filelink,$id) = @_;      my ($sel,$title,$filelink,$id) = @_;
     my $string = '<input type="hidden" name="title'.$sel.'" value="'.$title.      my $string = '<input type="hidden" name="title'.$sel.'" value="'.
  '" />';   &escape($title).'" />';
     $filelink=~s|^/ext/|http://|;      $filelink=~s|^/ext/|http://|;
     $string .= '<input type="hidden" name="filelink'.$sel.'" value="'.      $string .= '<input type="hidden" name="filelink'.$sel.'" value="'.
  $filelink.'" />';   &escape($filelink).'" />';
     $string .= '<input type="hidden" name="id'.$sel.'" value="'.$id.'" />';      $string .= '<input type="hidden" name="id'.$sel.'" value="'.&escape($id).'" />';
     return $string;      return $string;
 }  }
   
Line 489  sub checkbox { Line 526  sub checkbox {
 1;  1;
   
 __END__  __END__
   
   =pod
   
   =head1 NAME
   
   Apache::groupsort.pm
   
   =head1 SYNOPSIS
   
   Implements a second phase of importing
   multiple resources into the RAT. Allows for
   reordering the sequence of resources
   
   This is part of the LearningOnline Network with CAPA project
   described at http://www.lon-capa.org.
   
   
   =head1 NOTABLE SUBROUTINES
   
   =over
   
   =item 
   
   =back
   
   =cut
   

Removed from v.1.60  
changed lines
  Added in v.1.66


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