Diff for /loncom/interface/lonparmset.pm between versions 1.358 and 1.364

version 1.358, 2007/01/15 22:53:00 version 1.364, 2007/03/20 00:08:09
Line 554  sub valout { Line 554  sub valout {
             }              }
             $result=~s/\s+$//;              $result=~s/\s+$//;
         } elsif (&isdateparm($type)) {          } elsif (&isdateparm($type)) {
             $result = localtime($value).&date_sanity_info($value);              $result = &Apache::lonlocal::locallocaltime($value).
    &date_sanity_info($value);
         } else {          } else {
             $result = $value;              $result = $value;
         }          }
Line 934  sub extractResourceInformation { Line 935  sub extractResourceInformation {
  $$typep{$id}=$1;   $$typep{$id}=$1;
  $$keyp{$id}='';   $$keyp{$id}='';
         $$uris{$id}=$srcf;          $$uris{$id}=$srcf;
  foreach (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) {   foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) {
     if ($_=~/^parameter\_(.*)/) {      next if ($key!~/^parameter_/);
  my $key=$_;  
 # Hidden parameters  # Hidden parameters
  if (&Apache::lonnet::metadata($srcf,$key.'.hidden') eq 'parm') {      next if (&Apache::lonnet::metadata($srcf,$key.'.hidden') eq 'parm');
     next;  
  }  
  my $display= &Apache::lonnet::metadata($srcf,$key.'.display');  
  my $name=&Apache::lonnet::metadata($srcf,$key.'.name');  
  my $part= &Apache::lonnet::metadata($srcf,$key.'.part');  
 #  #
 # allparms is a hash of parameter names  # allparms is a hash of parameter names
 #  #
       my $name=&Apache::lonnet::metadata($srcf,$key.'.name');
       if (!exists($$allparms{$name})) {
    my $display= &Apache::lonnet::metadata($srcf,$key.'.display');
  my $parmdis = $display;   my $parmdis = $display;
  $parmdis =~ s/\[Part.*$//g;   $parmdis =~ s/\[Part.*$//g;
                 $$allparms{$name}=$parmdis;   $$allparms{$name}=$parmdis;
  $$defkeytype{$name}=&Apache::lonnet::metadata($srcf,$key.'.type');   if (ref($defkeytype)) {
       $$defkeytype{$name}=
    &Apache::lonnet::metadata($srcf,$key.'.type');
    }
       }
   
 #  #
 # allparts is a hash of all parts  # allparts is a hash of all parts
 #  #
  $$allparts{$part} = "Part: $part";      my $part= &Apache::lonnet::metadata($srcf,$key.'.part');
       $$allparts{$part} = "Part: $part";
 #  #
 # Remember all keys going with this resource  # Remember all keys going with this resource
 #  #
  if ($$keyp{$id}) {      if ($$keyp{$id}) {
     $$keyp{$id}.=','.$key;   $$keyp{$id}.=','.$key;
  } else {      } else {
     $$keyp{$id}=$key;   $$keyp{$id}=$key;
  }      }
 #  #
 # Put in order  # Put in order
 #   # 
                 unless ($$keyorder{$key}) {      unless ($$keyorder{$key}) {
                     $$keyorder{$key}=$keyordercnt;   $$keyorder{$key}=$keyordercnt;
                     $keyordercnt++;   $keyordercnt++;
  }  
   
     }      }
  }   }
  $$mapp{$id}=  
     &Apache::lonnet::declutter($resource->enclosing_map_src());  
  $$mapp{$mapid}=$$mapp{$id};   if (!exists($$mapp{$mapid})) {
  $$allmaps{$mapid}=$$mapp{$id};      $$mapp{$id}=
  if ($mapid eq '1') {   &Apache::lonnet::declutter($resource->enclosing_map_src());
     $$maptitles{$mapid}='Main Course Documents';      $$mapp{$mapid}=$$mapp{$id};
       $$allmaps{$mapid}=$$mapp{$id};
       if ($mapid eq '1') {
    $$maptitles{$mapid}='Main Course Documents';
       } else {
    $$maptitles{$mapid}=
       &Apache::lonnet::gettitle($$mapp{$id});    
       }
       $$maptitles{$$mapp{$id}}=$$maptitles{$mapid};
       $$symbp{$mapid}=$$mapp{$id}.'___(all)';
  } else {   } else {
     $$maptitles{$mapid}=&Apache::lonnet::gettitle(&Apache::lonnet::clutter($$mapp{$id}));      $$mapp{$id} = $$mapp{$mapid};
  }   }
  $$maptitles{$$mapp{$id}}=$$maptitles{$mapid};  
  $$symbp{$id}=&Apache::lonnet::encode_symb($$mapp{$id},$resid,$srcf);   $$symbp{$id}=&Apache::lonnet::encode_symb($$mapp{$id},$resid,$srcf);
  $$symbp{$mapid}=$$mapp{$id}.'___(all)';  
     }      }
 }  }
   
Line 2034  sub crsenv { Line 2044  sub crsenv {
         if ($name =~ /^default_enrollment_(start|end)_date$/) {          if ($name =~ /^default_enrollment_(start|end)_date$/) {
             $value=&Apache::lonhtmlcommon::get_date_from_form($name.'_value');              $value=&Apache::lonhtmlcommon::get_date_from_form($name.'_value');
         }          }
    #
           # Deal with the emails
           if ($name =~ /\.email$/) {
       my ($user,$domain) = split(/:/,$value);
       if (!defined($user) || !defined($domain)) {
    $setoutput.= '<br /> <span class="LC_error">'.
       &mt("Invalid email address specified, address must be of the form username:domain").
       '</span>';
    undef($value);
       } elsif (&Apache::lonnet::homeserver($user,$domain) eq 'no_host') {
    $setoutput.= '<br /> <span class="LC_error">'.
       &mt("Invalid email address specified, user [_1] is unknown.",$value).
       '</span>';
    undef($value);
       }
           }
         # Get existing cloners          # Get existing cloners
         my @oldcloner = ();          my @oldcloner = ();
         if ($name eq 'cloners') {          if ($name eq 'cloners') {
Line 2121  sub crsenv { Line 2147  sub crsenv {
              'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question').               'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question').
                                  '</b><br />(<tt>user:domain,'.                                   '</b><br />(<tt>user:domain,'.
                                  'user:domain(section;section;...;*;...),...</tt>)',                                   'user:domain(section;section;...;*;...),...</tt>)',
                'question.email.text' => '<b>'.&mt('Custom Text for Resource Content Question Option in Feedback').
                                    '</b>',
              'comment.email'  => '<b>'.&mt('Feedback Addresses for Course Content Comments').'</b><br />'.               'comment.email'  => '<b>'.&mt('Feedback Addresses for Course Content Comments').'</b><br />'.
                                  '(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)',                                   '(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)',
                'comment.email.text' => '<b>'.&mt('Custom Text for Course Content Option in Feedback').
                                    '</b>',
              'policy.email'   => '<b>'.&mt('Feedback Addresses for Course Policy').'</b>'.               'policy.email'   => '<b>'.&mt('Feedback Addresses for Course Policy').'</b>'.
                                  '<br />(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)',                                   '<br />(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)',
                'policy.email.text' => '<b>'.&mt('Custom Text for Course Policy Option in Feedback').
                                    '</b>',
              'hideemptyrows'  => '<b>'.&mt('Hide Empty Rows in Spreadsheets').'</b><br />'.               'hideemptyrows'  => '<b>'.&mt('Hide Empty Rows in Spreadsheets').'</b><br />'.
                                  '('.&mt('"[_1]" for default hiding','<tt>yes</tt>').')',                                   '('.&mt('"[_1]" for default hiding','<tt>yes</tt>').')',
              'pageseparators'  => '<b>'.&mt('Visibly Separate Items on Pages').'</b><br />'.               'pageseparators'  => '<b>'.&mt('Visibly Separate Items on Pages').'</b><br />'.
Line 2207  sub crsenv { Line 2239  sub crsenv {
                  => '<b>'.&mt('Disable display of problem receipts').'</b><br />'.                   => '<b>'.&mt('Disable display of problem receipts').'</b><br />'.
                     ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',                      ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',
      'task_messages'       'task_messages'
          => '<b>'.&mt('Send message to student when clicking Done on Tasks. [_1] to send a message only to student, [_2] to send message to student and add record to user information page for instructors. Leave blank to disable.','<tt>only_student</tt>','<tt>student_and_user_notes_screen</tt>').'</b>',           => '<b>'.&mt('Send message to student when clicking Done on Tasks').'</b><br /> ('.&mt('[_1] to send a message only to student, [_2] to send message to student and add record to user information page for instructors. Leave blank to disable.','<tt>only_student</tt>','<tt>student_and_user_notes_screen</tt>').')',
      'disablesigfigs'       'disablesigfigs'
          => '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'.           => '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'.
                     ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',                      ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',
Line 2222  sub crsenv { Line 2254  sub crsenv {
         my @Display_Order = ('url','description','courseid','cloners','grading',          my @Display_Order = ('url','description','courseid','cloners','grading',
                              'externalsyllabus',                               'externalsyllabus',
                              'default_xml_style','pageseparators',                               'default_xml_style','pageseparators',
                              'question.email','comment.email','policy.email',                               'question.email','question.email.text','comment.email','comment.email.text','policy.email','policy.email.text',
                              'student_classlist_view',                               'student_classlist_view',
                              'plc.roles.denied','plc.users.denied',                               'plc.roles.denied','plc.users.denied',
                              'pch.roles.denied','pch.users.denied',                               'pch.roles.denied','pch.users.denied',
Line 2875  ENDOVER Line 2907  ENDOVER
       '<td><input type="checkbox" name="del_'.$thiskey.'" /></td>'      );        '<td><input type="checkbox" name="del_'.$thiskey.'" /></td>'      );
           
     $r->print('<td>');      $r->print('<td>');
       my $display_value = $resourcedata->{$thiskey};
       if (&isdateparm($resourcedata->{$thiskey.'.type'})) {
    $display_value = 
       &Apache::lonlocal::locallocaltime($display_value);
       }
     $r->print(&mt('Parameter: "[_1]" with value: "[_2]"',      $r->print(&mt('Parameter: "[_1]" with value: "[_2]"',
   &standard_parameter_names($data{'parameter_name'}),    &standard_parameter_names($data{'parameter_name'}),
   $resourcedata->{$thiskey}));    $resourcedata->{$thiskey}));
Line 2899  ENDOVER Line 2936  ENDOVER
  $r->print(&mt('Resource: [_1] <br />&nbsp;&nbsp;&nbsp;with ID: [_2] <br />&nbsp;&nbsp;&nbsp;in folder [_3]',   $r->print(&mt('Resource: [_1] <br />&nbsp;&nbsp;&nbsp;with ID: [_2] <br />&nbsp;&nbsp;&nbsp;in folder [_3]',
       $url,$resid,$map));        $url,$resid,$map));
     }      }
     $r->print(&mt('Part: [_1]',$data{'parameter_part'}));      $r->print(' <br />&nbsp;&nbsp;&nbsp;'.&mt('Part: [_1]',$data{'parameter_part'}));
     $r->print('</td></tr>');      $r->print('</td></tr>');
   
  }   }
Line 3323  sub order_meta_fields { Line 3360  sub order_meta_fields {
     $r->print('</table>');      $r->print('</table>');
     return 'ok';      return 'ok';
 }  }
   sub continue {
       my $output;
       $output .= '<form action="" method="post">';
       $output .= '<input type="hidden" name="action" value="setrestrictmeta" />';
       $output .= '<input type="submit" value="Continue" />';
       return ($output);
   }
 sub addmetafield {  sub addmetafield {
     my ($r)=@_;      my ($r)=@_;
     $r->print(&Apache::loncommon::start_page('Add Metadata Field'));      $r->print(&Apache::loncommon::start_page('Add Metadata Field'));
Line 3340  sub addmetafield { Line 3384  sub addmetafield {
                                                                                   
             $r->print('Undeleted Metadata Field <strong>'.$env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.added'}."</strong> with result ".$put_result.'<br />');              $r->print('Undeleted Metadata Field <strong>'.$env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.added'}."</strong> with result ".$put_result.'<br />');
         }          }
         $r->print('<form action="" method="post">');          $r->print(&continue());
         $r->print('<input type="hidden" name="action" value="setrestrictmeta" />');  
         $r->print('<input type="submit" value="Continue" />');  
     } elsif (exists($env{'form.fieldname'})) {      } elsif (exists($env{'form.fieldname'})) {
         my $meta_field = $env{'form.fieldname'};          my $meta_field = $env{'form.fieldname'};
         my $display_field = $env{'form.fieldname'};          my $display_field = $env{'form.fieldname'};
Line 3352  sub addmetafield { Line 3394  sub addmetafield {
                             {'metadata.'.$meta_field.'.values'=>"",                              {'metadata.'.$meta_field.'.values'=>"",
                              'metadata.'.$meta_field.'.added'=>"$display_field",                               'metadata.'.$meta_field.'.added'=>"$display_field",
                              'metadata.'.$meta_field.'.options'=>""},$dom,$crs);                               'metadata.'.$meta_field.'.options'=>""},$dom,$crs);
         $r->print('Added new Metadata Field '.$env{'form.fieldname'}." with result ".$put_result);          $r->print('Added new Metadata Field <strong>'.$env{'form.fieldname'}."</strong> with result ".$put_result.'<br />');
           $r->print(&continue());
     } else {      } else {
         my $fields = &get_deleted_meta_fieldnames($env{'request.course.id'});          my $fields = &get_deleted_meta_fieldnames($env{'request.course.id'});
         if ($fields) {          if ($fields) {
Line 3367  sub addmetafield { Line 3410  sub addmetafield {
         $r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.<form method="post" action="/adm/parmset?action=addmetadata"');          $r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.<form method="post" action="/adm/parmset?action=addmetadata"');
         $r->print('<input type="text" name="fieldname" /><br />');          $r->print('<input type="text" name="fieldname" /><br />');
         $r->print('<input type="submit" value="Add Metadata Field" />');          $r->print('<input type="submit" value="Add Metadata Field" />');
         $r->print('</form>');  
     }      }
       $r->print('</form>');
 }  }
 sub setrestrictmeta {  sub setrestrictmeta {
     my ($r)=@_;      my ($r)=@_;

Removed from v.1.358  
changed lines
  Added in v.1.364


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