Diff for /loncom/interface/lonparmset.pm between versions 1.340 and 1.341

version 1.340, 2006/10/13 00:20:19 version 1.341, 2006/10/13 17:17:14
Line 3220  sub order_meta_fields { Line 3220  sub order_meta_fields {
     my $idx = 1;      my $idx = 1;
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};      my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};      my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
    $r->print(&Apache::loncommon::start_page('Order Metadata Fields'));      $r->print(&Apache::loncommon::start_page('Order Metadata Fields'));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Order Metadata Fields'));      $r->print(&Apache::lonhtmlcommon::breadcrumbs('Order Metadata Fields'));
     if ($env{'form.storeorder'}) {      if ($env{'form.storeorder'}) {
         my $newpos = $env{'form.newpos'} - 1;          my $newpos = $env{'form.newpos'} - 1;
Line 3228  sub order_meta_fields { Line 3228  sub order_meta_fields {
         my @neworder = ();          my @neworder = ();
         my @oldorder = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'};          my @oldorder = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'};
         my $i;          my $i;
           if ($newpos > $currentpos) {
         if ($newpos>$currentpos) {  
         # moving stuff up          # moving stuff up
             for ($i=0;$i<$currentpos;$i++) {              for ($i=0;$i<$currentpos;$i++) {
         $neworder[$i]=$oldorder[$i];          $neworder[$i]=$oldorder[$i];
Line 3255  sub order_meta_fields { Line 3254  sub order_meta_fields {
        }         }
         }          }
  my $ordered_fields = join ",", @neworder;   my $ordered_fields = join ",", @neworder;
    $env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'} = $ordered_fields;
         my $put_result = &Apache::lonnet::put('environment',          my $put_result = &Apache::lonnet::put('environment',
                             {'metadata.addedorder'=>$ordered_fields},$dom,$crs);                                      {'metadata.addedorder'=>$ordered_fields},$dom,$crs); 
   
   
   
   
   
         $r->print($env{'form.currentpos'}.' becomes '.$env{'form.newpos'});  
     }      }
     my $fields = &get_added_meta_fieldnames();      my $fields = &get_added_meta_fieldnames();
       my $ordered_fields;
     my @fields_in_order = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'};      my @fields_in_order = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'};
     if (!@fields_in_order) {      if (!@fields_in_order) {
         # no order found, pick sorted order then create metadata.addedorder key.          # no order found, pick sorted order then create metadata.addedorder key.
         foreach my $key (sort keys %$fields) {          foreach my $key (sort keys %$fields) {
             push @fields_in_order, $key;              push @fields_in_order, $key;
             my $ordered_fields = join ",", @fields_in_order;              $ordered_fields = join ",", @fields_in_order;
             my $put_result = &Apache::lonnet::put('environment',  
                             {'metadata.addedorder'=>$ordered_fields},$dom,$crs);          
         }          }
     }          my $put_result = &Apache::lonnet::put('environment',
                               {'metadata.addedorder'=>$ordered_fields},$dom,$crs); 
       } 
     $r->print('<table>');      $r->print('<table>');
     my $num_fields = scalar(@fields_in_order);      my $num_fields = scalar(@fields_in_order);
     foreach my $key (@fields_in_order) {      foreach my $key (@fields_in_order) {
Line 3296  sub order_meta_fields { Line 3291  sub order_meta_fields {
         $idx ++;          $idx ++;
     }      }
     $r->print('</table>');      $r->print('</table>');
       
     return 'ok';      return 'ok';
 }  }
 sub addmetafield {  sub addmetafield {

Removed from v.1.340  
changed lines
  Added in v.1.341


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