Diff for /loncom/homework/inputtags.pm between versions 1.156 and 1.162

version 1.156, 2005/01/31 22:00:40 version 1.162, 2005/03/31 21:32:52
Line 222  sub start_textline { Line 222  sub start_textline {
  if ($addchars) {   if ($addchars) {
     $result.=&addchars('HWVAL_'.$id,$addchars);      $result.=&addchars('HWVAL_'.$id,$addchars);
  }   }
  $result.= '<input type="text" name="HWVAL_'.$id.'" value="'.   my $readonly=&Apache::lonxml::get_param('readonly',$parstack,
    $safeeval);
    if (lc($readonly) eq 'yes') {
       $readonly=' readonly="readonly" ';
    } else {
       $readonly='';
    }
    $result.= '<input type="text" '.$readonly.' name="HWVAL_'.$id.'" value="'.
     $oldresponse.'" size="'.$size.'" maxlength="'.$maxlength.'" />';      $oldresponse.'" size="'.$size.'" maxlength="'.$maxlength.'" />';
     }      }
  } else {   } else {
Line 233  sub start_textline { Line 240  sub start_textline {
     } elsif ($target eq 'edit') {      } elsif ($target eq 'edit') {
  $result=&Apache::edit::tag_start($target,$token);   $result=&Apache::edit::tag_start($target,$token);
  $result.=&Apache::edit::text_arg('Size:','size',$token,'5').   $result.=&Apache::edit::text_arg('Size:','size',$token,'5').
     &Apache::edit::text_arg      &Apache::edit::text_arg('Click-On Texts (comma sep):',
     ('Click-On Texts (comma sep):','addchars',$token,10)."</td></tr>";      'addchars',$token,10);
  $result.=&Apache::edit::end_table;          $result.=&Apache::edit::select_arg('Readonly:','readonly',
      ['no','yes'],$token);
    $result.=&Apache::edit::end_row();
    $result.=&Apache::edit::end_table();
     } elsif ($target eq 'modified') {      } elsif ($target eq 'modified') {
  my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,'size','addchars');   my $constructtag=&Apache::edit::get_new_args($token,$parstack,
        $safeeval,'size',
        'addchars','readonly');
  if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }   if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
     } elsif ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') {      } elsif ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') {
  my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval);   my $size = &Apache::lonxml::get_param('size',$parstack,$safeeval);
Line 282  sub end_hiddenline { Line 294  sub end_hiddenline {
     return "";      return "";
 }  }
   
   # $part -> partid
   # $id -> responseid
   # $uploadefiletypes -> comma seperated list of extensions allowed or * for any
   # $which -> 'uploadedonly'  -> only newly uploaded files
   #           'portfolioonly' -> only allow files from portfolio
   #           'both' -> allow files from either location
   # returns a table row <tr> 
   sub file_selector {
       my ($part,$id,$uploadedfiletypes,$which)=@_;
       if (!$uploadedfiletypes) { return ''; }
       my $result;
       
       $result.='<tr><td>';
       if ($uploadedfiletypes ne '*') {
    $result.=
       &mt('Allowed filetypes: <b>[_1]</b>',$uploadedfiletypes).'<br />';
       }
       if ($which eq 'uploadonly' || $which eq 'both') { 
    $result.=&mt('Submit a file: (only one file can be uploaded)').
       ' <br /><input type="file" size="50" name="HWFILE'.
       $part.'_'.$id.'" /><br />';
    my $uploadedfile= &HTML::Entities::encode($Apache::lonhomework::history{"resource.$part.$id.uploadedfile"},'<>&"');
   
    if ($uploadedfile) {
       my $url=$Apache::lonhomework::history{"resource.$part.$id.uploadedurl"};
       push (@Apache::lonxml::extlinks,$url);
       &Apache::lonnet::allowuploaded('/adm/essayresponse',$url);
       my $icon=&Apache::loncommon::icon($url);
       my $curfile='<a href="'.$url.'"><img src="'.$icon.
    '" border="0" />'.$uploadedfile.'</a>';
       $result.=&mt('Currently submitted: <tt>[_1]</tt>',$curfile);
    } else {
       #$result.=&mt('(Hand in a file you have prepared on your computer)');
    }
       }
       if ( $which eq 'both') { 
    $result.='<br />'.'<strong>'.&mt('OR:').'</strong><br />';
       }
       if ($which eq 'portfolioonly' || $which eq 'both') { 
    $result.='<a href='."'".'javascript:void(window.open("/adm/portfolio?mode=selectfile&amp;fieldname=HWPORT'.$part.'_'.$id.'","cat","height=600,width=800,scrollbars=1,resizable=1,menubar=2,location=1"))'."'".'>'.
       &mt('Select Portfolio Files').'</a><br />'.
       '<input type="text" size="50" name="HWPORT'.$part.'_'.$id.'" value="" />'.
       '<br />';
    if ($Apache::lonhomework::history{"resource.$part.$id.portfiles"}=~/[^\s]/){
       my @filelist;
       foreach my $file (split(',',&Apache::lonnet::unescape($Apache::lonhomework::history{"resource.$part.$id.portfiles"}))) {
    my (undef,undef,$domain,$user)=&Apache::lonxml::whichuser();
    my $url="/uploaded/$domain/$user/portfolio$file";
    my $icon=&Apache::loncommon::icon($url);
    push(@filelist,'<a href="'.$url.'"><img src="'.$icon.
        '" border="0" />'.$file.'</a>');
       }
       $result.=&mt("Portfolio files previously selected: <strong>[_1]</strong>",join(', ',@filelist));
    }
       }
       $result.='</td></tr>'; 
       return $result;
   }
   
 sub checkstatus {  sub checkstatus {
     my ($value,$awardref,$msgref)=@_;      my ($value,$awardref,$msgref)=@_;
     for (my $i=0;$i<=$#$awardref;$i++) {      for (my $i=0;$i<=$#$awardref;$i++) {
Line 417  sub decideoutput { Line 488  sub decideoutput {
     } elsif ($award eq 'MISORDERED_RANK') {      } elsif ($award eq 'MISORDERED_RANK') {
  $message = &mt('You have provided an invalid ranking');   $message = &mt('You have provided an invalid ranking');
  if ($target ne 'tex') {   if ($target ne 'tex') {
     $message.=', '.&mt('please refer to').' '.&Apache::loncommon::help_open_topic('Ranking_Problems','help on ranking problems').'.';      $message.=', '.&mt('please refer to').' '.&Apache::loncommon::help_open_topic('Ranking_Problems','help on ranking problems');
  }   }
  $bgcolor=$possiblecolors{'not_charged_try'};   $bgcolor=$possiblecolors{'not_charged_try'};
  $button=1;   $button=1;

Removed from v.1.156  
changed lines
  Added in v.1.162


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