Diff for /loncom/interface/lonmeta.pm between versions 1.72 and 1.79

version 1.72, 2004/04/15 18:06:29 version 1.79, 2004/06/16 14:30:15
Line 175  sub fieldnames { Line 175  sub fieldnames {
          'owner' => 'Publisher/Owner',           'owner' => 'Publisher/Owner',
          'copyright' => 'Copyright/Distribution',           'copyright' => 'Copyright/Distribution',
          'customdistributionfile' => 'Custom Distribution File',           'customdistributionfile' => 'Custom Distribution File',
            'sourceavail' => 'Source Availible',
            'sourcerights' => 'Source Custom Distribution File',
          'obsolete' => 'Obsolete',           'obsolete' => 'Obsolete',
          'obsoletereplacement' => 'Suggested Replacement for Obsolete File',           'obsoletereplacement' => 'Suggested Replacement for Obsolete File',
          'count'      => 'Network-wide number of accesses (hits)',           'count'      => 'Network-wide number of accesses (hits)',
Line 193  sub fieldnames { Line 195  sub fieldnames {
          'technical'  => 'Resource is technically correct',            'technical'  => 'Resource is technically correct', 
          'avetries'   => 'Average number of tries till solved',           'avetries'   => 'Average number of tries till solved',
          'stdno'      => 'Total number of students who have worked on this problem',           'stdno'      => 'Total number of students who have worked on this problem',
          'difficulty' => 'Degree of difficulty'           'difficulty' => 'Degree of difficulty',
            'disc'       => 'Degree of discrimination',
          );           );
 }  }
   
Line 223  sub prettyprint { Line 226  sub prettyprint {
     if ($type eq 'copyright') {      if ($type eq 'copyright') {
  return &Apache::loncommon::copyrightdescription($value);   return &Apache::loncommon::copyrightdescription($value);
     }      }
       # Copyright
       if ($type eq 'sourceavail') {
    return &Apache::loncommon::source_copyrightdescription($value);
       }
     # MIME      # MIME
     if ($type eq 'mime') {      if ($type eq 'mime') {
         return '<img src="'.&Apache::loncommon::icon($value).'" />&nbsp;'.          return '<img src="'.&Apache::loncommon::icon($value).'" />&nbsp;'.
Line 283  sub prettyprint { Line 290  sub prettyprint {
  return &evalgraph($value);   return &evalgraph($value);
     }      }
     # Difficulty      # Difficulty
     if ($type eq 'difficulty') {      if ($type eq 'difficulty' || $type eq 'disc') {
  return &diffgraph($value);   return &diffgraph($value);
     }      }
     # List of courses      # List of courses
Line 344  sub relatedfield { Line 351  sub relatedfield {
   
 sub prettyinput {  sub prettyinput {
     my ($type,$value,$fieldname,$formname,      my ($type,$value,$fieldname,$formname,
  $relatedsearchflag,$relatedsep,$relatedvalue)=@_;   $relatedsearchflag,$relatedsep,$relatedvalue,$size)=@_;
       if (! defined($size)) {
           $size = 80;
       }
     # Language      # Language
     if ($type eq 'language') {      if ($type eq 'language') {
  return &selectbox($fieldname,   return &selectbox($fieldname,
Line 361  sub prettyinput { Line 371  sub prettyinput {
   (&Apache::loncommon::copyrightids)).    (&Apache::loncommon::copyrightids)).
                               &relatedfield(0,$relatedsearchflag,$relatedsep);                                &relatedfield(0,$relatedsearchflag,$relatedsep);
     }      }
       # Source Copyright
       if ($type eq 'sourceavail') {
    return &selectbox($fieldname,
     $value,
     \&Apache::loncommon::source_copyrightdescription,
     (&Apache::loncommon::source_copyrightids)).
                                 &relatedfield(0,$relatedsearchflag,$relatedsep);
       }
     # Gradelevels      # Gradelevels
     if (($type eq 'lowestgradelevel') ||      if (($type eq 'lowestgradelevel') ||
  ($type eq 'highestgradelevel')) {   ($type eq 'highestgradelevel')) {
Line 389  sub prettyinput { Line 407  sub prettyinput {
     ",'rights')\">".&mt('Select').'</a>'.      ",'rights')\">".&mt('Select').'</a>'.
             &relatedfield(0,$relatedsearchflag,$relatedsep);               &relatedfield(0,$relatedsearchflag,$relatedsep); 
     }      }
       # Source Customdistribution file
       if ($type eq 'sourcerights') {
    return '<input type="text" name="'.$fieldname.
       '" size="60" value="'.$value.'" /><a href="javascript:openbrowser'.
       "('".$formname."','".$fieldname."'".
       ",'rights')\">".&mt('Select').'</a>'.
               &relatedfield(0,$relatedsearchflag,$relatedsep); 
       }
     # Dates      # Dates
     if (($type eq 'creationdate') ||      if (($type eq 'creationdate') ||
  ($type eq 'lastrevisiondate')) {   ($type eq 'lastrevisiondate')) {
Line 400  sub prettyinput { Line 426  sub prettyinput {
     $value=~s/^\s+//gs;      $value=~s/^\s+//gs;
     $value=~s/\s+$//gs;      $value=~s/\s+$//gs;
     $value=~s/\s+/ /gs;      $value=~s/\s+/ /gs;
     $value=~s/\"/\&quod\;/gs;      $value=~s/\"/\&quot\;/gs;
     return       return 
         '<input type="text" name="'.$fieldname.'" size="80" '.          '<input type="text" name="'.$fieldname.'" size="'.$size.'" '.
         'value="'.$value.'" />'.          'value="'.$value.'" />'.
         &relatedfield(1,$relatedsearchflag,$relatedsep,$fieldname,          &relatedfield(1,$relatedsearchflag,$relatedsep,$fieldname,
                       $relatedvalue);                         $relatedvalue); 
Line 414  sub handler { Line 440  sub handler {
     #      #
     my $uri=$r->uri;      my $uri=$r->uri;
     #      #
     # Check to see if this server is overloaded  
     my $loaderror=&Apache::lonnet::overloaderror($r);  
     if ($loaderror) {   
         return $loaderror;  
     }  
     #  
     # Check to see if original resource server is overloaded  
     my ($resdomain,$resuser)=  
         (&Apache::lonnet::declutter($uri)=~/^(\w+)\/(\w+)\//);  
     $loaderror=&Apache::lonnet::overloaderror  
         ($r,&Apache::lonnet::homeserver($resuser,$resdomain));  
     if ($loaderror) {   
         return $loaderror;  
     }  
     #  
     # Set document type      # Set document type
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      $r->send_http_header;
     return OK if $r->header_only;      return OK if $r->header_only;
     #      #
       my ($resdomain,$resuser)=
           (&Apache::lonnet::declutter($uri)=~/^(\w+)\/(\w+)\//);
     $r->print('<html><head><title>'.      $r->print('<html><head><title>'.
               'Catalog Information'.                'Catalog Information'.
               '</title></head>');                '</title></head>');
Line 551  sub present_uneditable_metadata { Line 564  sub present_uneditable_metadata {
              'lastrevisiondate',                'lastrevisiondate', 
              'owner',                'owner', 
              'copyright',                'copyright', 
              'customdistributionfile',                'customdistributionfile',
                'sourceavail',
                'sourcerights', 
              'obsolete',                'obsolete', 
              'obsoletereplacement') {               'obsoletereplacement') {
         $table.='<tr><td bgcolor="#AAAAAA">'.$lt{$_}.          $table.='<tr><td bgcolor="#AAAAAA">'.$lt{$_}.
Line 613  sub print_dynamic_metadata { Line 628  sub print_dynamic_metadata {
     }      }
     #      #
     # Assessment statistics      # Assessment statistics
     if ($uri=~/\.(problem|exam|quiz|assess|survey|form)$/ &&      if ($uri=~/\.(problem|exam|quiz|assess|survey|form)$/) {
         (exists($dynmeta{'stdno'}) ||          if (exists($dynmeta{'stdno'}) ||
          exists($dynmeta{'avetries'}) ||              exists($dynmeta{'avetries'}) ||
          exists($dynmeta{'difficulty'}))) {              exists($dynmeta{'difficulty'}) ||
         # This is an assessment, print assessment data              exists($dynmeta{'disc'})) {
         $r->print('<h4>'.&mt('Assessment Statistical Data').'</h4>'.              # This is an assessment, print assessment data
                   '<table cellspacing=2 border=0>');              $r->print('<h4>'.
         foreach ('stdno','avetries','difficulty') {                        &mt('Overall Assessment Statistical Data').
             $r->print('<tr><td bgcolor="#AAAAAA">'.$lt{$_}.'</td>'.                        '</h4>'.
                         '<table cellspacing=2 border=0>');
               $r->print('<tr><td bgcolor="#AAAAAA">'.$lt{'stdno'}.'</td>'.
                       '<td bgcolor="#CCCCCC">'.                        '<td bgcolor="#CCCCCC">'.
                       &prettyprint($_,sprintf('%5.2f',$dynmeta{$_})).'</td>'.                        &prettyprint('stdno',$dynmeta{'stdno'}).
                       "</tr>\n");                        '</td>'."</tr>\n");
               foreach ('avetries','difficulty','disc') {
                   $r->print('<tr><td bgcolor="#AAAAAA">'.$lt{$_}.'</td>'.
                             '<td bgcolor="#CCCCCC">'.
                             &prettyprint($_,sprintf('%5.2f',$dynmeta{$_})).
                             '</td>'."</tr>\n");
               }
               $r->print('</table>');    
           }
           if (exists($dynmeta{'stats'})) {
               #
               # New assessment statistics
               $r->print('<h4>'.
                         &mt('Detailed Assessment Statistical Data').
                         '</h4>');
               my $table = '<table cellspacing=2 border=0>'.
                   '<tr>'.
                   '<th>Course</th>'.
                   '<th>Section(s)</th>'.
                   '<th>Num Students</th>'.
                   '<th>Mean Tries</th>'.
                   '<th>Degree of Difficulty</th>'.
                   '<th>Degree of Discrimination</th>'.
                   '<th>Time of computation</th>'.
                   '</tr>'.$/;
               foreach my $identifier (sort(keys(%{$dynmeta{'stats'}}))) {
                   my $data = $dynmeta{'stats'}->{$identifier};
                   my $course = $data->{'course'};
                   my %courseinfo = &Apache::lonnet::coursedescription($course);
                   if (! exists($courseinfo{'num'}) || $courseinfo{'num'} eq '') {
                       &Apache::lonnet::logthis('lookup for '.$course.' failed');
                       next;
                   }
                   $table .= '<tr>';
                   $table .= 
                       '<td><nobr>'.$courseinfo{'description'}.'</nobr></td>';
                   $table .= 
                       '<td align="right">'.$data->{'sections'}.'</td>';
                   $table .=
                       '<td align="right">'.$data->{'stdno'}.'</td>';
                   foreach ('avetries','difficulty','disc') {
                       $table .= '<td align="right">';
                       if (exists($data->{$_})) {
                           $table .= sprintf('%.2f',$data->{$_}).'&nbsp;';
                       } else {
                           $table .= '';
                       }
                       $table .= '</td>';
                   }
                   $table .=
                       '<td><nobr>'.
                       &Apache::lonlocal::locallocaltime($data->{'timestamp'}).
                       '</nobr></td>';
                   $table .=
                       '</tr>'.$/;
               }
               $table .= '</table>'.$/;
               $r->print($table);
           } else {
               $r->print('No new dynamic data found.');
         }          }
         $r->print('</table>');      
     } else {      } else {
         $r->print('<h4>'.&mt('No Assessment Statistical Data is available for this resource').'</h4>');          $r->print('<h4>'.
             &mt('No Assessment Statistical Data is available for this resource').
                     '</h4>');
     }      }
   
       #
       #
     if (exists($dynmeta{'clear'})   ||       if (exists($dynmeta{'clear'})   || 
         exists($dynmeta{'depth'})   ||           exists($dynmeta{'depth'})   || 
         exists($dynmeta{'helpful'}) ||           exists($dynmeta{'helpful'}) || 
Line 759  ENDEDIT Line 839  ENDEDIT
         foreach ('author','title','subject','keywords','abstract','notes',          foreach ('author','title','subject','keywords','abstract','notes',
                  'copyright','customdistributionfile','language',                   'copyright','customdistributionfile','language',
                  'standards',                   'standards',
                  'lowestgradelevel','highestgradelevel',                   'lowestgradelevel','highestgradelevel','sourceavail','sourcerights',
                  'obsolete','obsoletereplacement') {                   'obsolete','obsoletereplacement') {
             if (defined($ENV{'form.new_'.$_})) {              if (defined($ENV{'form.new_'.$_})) {
                 $Apache::lonpublisher::metadatafields{$_}=                  $Apache::lonpublisher::metadatafields{$_}=

Removed from v.1.72  
changed lines
  Added in v.1.79


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