Diff for /loncom/interface/lonparmset.pm between versions 1.121 and 1.128

version 1.121, 2003/09/03 21:24:32 version 1.128, 2003/10/08 18:08:11
Line 937  sub assessparms { Line 937  sub assessparms {
         $r->print("</select></td>\n");          $r->print("</select></td>\n");
   
         $r->print('</tr>');          $r->print('</tr>');
    if ($parmlev ne 'general') {
         $r->print('<tr><td>Select Enclosing Map or Folder</td>');      $r->print('<tr><td>Select Enclosing Map or Folder</td>');
         $r->print('<td colspan="2"><select name="pschp">');      $r->print('<td colspan="2"><select name="pschp">');
         $r->print('<option value="all">All Maps or Folders</option>');      $r->print('<option value="all">All Maps or Folders</option>');
         foreach (sort {$allmaps{$a} cmp $allmaps{$b}} keys %allmaps) {      foreach (sort {$allmaps{$a} cmp $allmaps{$b}} keys %allmaps) {
             $r->print('<option value="'.$_.'"');   $r->print('<option value="'.$_.'"');
             if (($pschp eq $_)) { $r->print(' selected'); }   if (($pschp eq $_)) { $r->print(' selected'); }
             $r->print('>'.$maptitles{$_}.($allmaps{$_}!~/^uploaded/?'  ['.$allmaps{$_}.']':'').'</option>');   $r->print('>'.$maptitles{$_}.($allmaps{$_}!~/^uploaded/?'  ['.$allmaps{$_}.']':'').'</option>');
         }      }
         $r->print("</select></td></tr>\n");      $r->print("</select></td></tr>\n");
    }
     } else {      } else {
         my ($map,$id,$resource)=split(/___/,$pssymb);          my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb);
         $r->print("<tr><td>Specific Resource</td><td>$resource</td>");          $r->print("<tr><td>Specific Resource</td><td>$resource</td>");
         $r->print('<td><input type="submit" name="dis" value="'.$submitmessage.'"></td>');          $r->print('<td><input type="submit" name="dis" value="'.$submitmessage.'"></td>');
         $r->print('</tr>');          $r->print('</tr>');
Line 1152  ENDTABLEHEADFOUR Line 1153  ENDTABLEHEADFOUR
                     my $totalparms=scalar keys %name;                      my $totalparms=scalar keys %name;
                     if ($totalparms>0) {                      if ($totalparms>0) {
                         my $firstrow=1;                          my $firstrow=1;
    my $title=$bighash{'title_'.$rid};
    $title=~s/\&colon;/:/g;
                         $r->print('<tr><td bgcolor='.$defbgone.                          $r->print('<tr><td bgcolor='.$defbgone.
                              ' rowspan='.$totalparms.                               ' rowspan='.$totalparms.
                              '><tt><font size=-1>'.                               '><tt><font size=-1>'.
Line 1160  ENDTABLEHEADFOUR Line 1162  ENDTABLEHEADFOUR
                              '</font></tt><p><b>'.                               '</font></tt><p><b>'.
                              "<a href=\"javascript:openWindow('/res/".$uri.                               "<a href=\"javascript:openWindow('/res/".$uri.
                              "', 'metadatafile', '450', '500', 'no', 'yes')\";".                               "', 'metadatafile', '450', '500', 'no', 'yes')\";".
                              " TARGET=_self>$bighash{'title_'.$rid}");                               " TARGET=_self>$title");
   
                         if ($thistitle) {                          if ($thistitle) {
                             $r->print(' ('.$thistitle.')');                              $r->print(' ('.$thistitle.')');
Line 1666  ENDENV Line 1668  ENDENV
 }  }
 ##################################################  ##################################################
   
   my $tableopen;
   
   sub tablestart {
       if ($tableopen) {
    return '';
       } else {
    $tableopen=1;
    return '<table border="2"><tr><th>Parameter</th><th>Delete</th><th>Set to ...</th></tr>';
       }
   }
   
   sub tableend {
       if ($tableopen) {
    $tableopen=0;
    return '</table>';
       } else {
    return'';
       }
   }
   
 sub overview {  sub overview {
     my $r=shift;      my $r=shift;
     my $bodytag=&Apache::loncommon::bodytag(      my $bodytag=&Apache::loncommon::bodytag(
                              'Set/Modify Course Assessment Parameters');                               'Set/Modify Course Assessment Parameters');
     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'};
     my %resourcedata=&Apache::lonnet::dump('resourcedata',$dom,$crs);  
     $r->print(<<ENDOVER);      $r->print(<<ENDOVER);
 <html>  <html>
 <head>  <head>
 <title>LON-CAPA Course Environment</title>  <title>LON-CAPA Course Environment</title>
 </head>  </head>
 $bodytag  $bodytag
 <form method="post" action="/adm/parmset" name="overview">  <form method="post" action="/adm/parmset" name="overviewform">
 <input type="hidden" name="overview" value="1" />  <input type="hidden" name="overview" value="1" />
 ENDOVER  ENDOVER
     foreach (sort keys %resourcedata) {  # Setting
  $r->print($_.' - '.$resourcedata{$_}.'<br />');      my %olddata=&Apache::lonnet::dump('resourcedata',$dom,$crs);
       my %newdata=();
       undef %newdata;
       my @deldata=();
       undef @deldata;
       foreach (keys %ENV) {
    if ($_=~/^form\.([a-z]+)\_(.+)$/) {
       my $cmd=$1;
       my $thiskey=$2;
       if ($cmd eq 'set') {
    my $data=$ENV{$_};
    if ($olddata{$thiskey} ne $data) { $newdata{$thiskey}=$data; }
       } elsif ($cmd eq 'del') {
    push (@deldata,$thiskey);
       } elsif ($cmd eq 'datepointer') {
    my $data=&Apache::lonhtmlcommon::get_date_from_form($ENV{$_});
    if ($olddata{$thiskey} ne $data) { $newdata{$thiskey}=$data; }
       }
    }
     }      }
     $r->print('</form></body></html>');  # Store
       &Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs);
       &Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs);
   # Read and display
       my %resourcedata=&Apache::lonnet::dump('resourcedata',$dom,$crs);
       my $oldsection='';
       my $oldrealm='';
       my $oldpart='';
       my $pointer=0;
       $tableopen=0;
       foreach my $thiskey (sort keys %resourcedata) {
    if ($resourcedata{$thiskey.'.type'}) {
       my ($course,$middle,$part,$name)=
    ($thiskey=~/^(\w+)\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);
       my $section='All Students';
       if ($middle=~/^\[(.*)\]\./) {
    $section='Group/Section: '.$1;
    $middle=~s/^\[(.*)\]\.//;
       }
       $middle=~s/\.$//;
       my $realm='<font color="red">All Resources</font>';
       if ($middle=~/^(.+)\_\_\_\(all\)$/) {
    $realm='<font color="green">Folder/Map: '.&Apache::lonnet::gettitle($1).'</font>';
       } elsif ($middle) {
    $realm='<font color="orange">Resource: '.&Apache::lonnet::gettitle($middle).'</font>';
       }
       if ($section ne $oldsection) {
    $r->print(&tableend()."\n<hr /><h1>$section</h1>");
    $oldsection=$section;
    $oldrealm='';
       }
       if ($realm ne $oldrealm) {
    $r->print(&tableend()."\n<h2>$realm</h2>");
    $oldrealm=$realm;
    $oldpart='';
       }
       if ($part ne $oldpart) {
    $r->print(&tableend().
     "\n<h3><font color='blue'>Part: $part</font></h3>");
    $oldpart=$part;
       }
   #
   # Ready to print
   #
       $r->print(&tablestart().'<tr><td><b>'.$name.
         ':</b></td><td><input type="checkbox" name="del_'.
         $thiskey.'" /></td><td>');
       if ($resourcedata{$thiskey.'.type'}=~/^date/) {
    my $jskey='key_'.$pointer;
    $pointer++;
    $r->print(
     &Apache::lonhtmlcommon::date_setter('overviewform',
         $jskey,
         $resourcedata{$thiskey}).
   '<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'
     );
       } else {
    $r->print(
     '<input type="text" name="set_'.$thiskey.'" value="'.
     $resourcedata{$thiskey}.'">');
       }
       $r->print('</td></tr>');
    }
       }
       
       $r->print(&tableend().
         '<p><input type="submit" value="Modify Parameters" /></p></form></body></html>');
 }  }
   
 ##################################################  ##################################################
Line 1706  sub handler { Line 1811  sub handler {
     my $r=shift;      my $r=shift;
   
     if ($r->header_only) {      if ($r->header_only) {
  $r->content_type('text/html');   &Apache::loncommon::content_type($r,'text/html');
  $r->send_http_header;   $r->send_http_header;
  return OK;   return OK;
     }      }
Line 1717  sub handler { Line 1822  sub handler {
     if (($ENV{'request.course.id'}) &&       if (($ENV{'request.course.id'}) && 
  (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'}))) {   (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'}))) {
   
         $r->content_type('text/html');          &Apache::loncommon::content_type($r,'text/html');
         $r->send_http_header;          $r->send_http_header;
     
         $coursename=$ENV{'course.'.$ENV{'request.course.id'}.'.description'};          $coursename=$ENV{'course.'.$ENV{'request.course.id'}.'.description'};

Removed from v.1.121  
changed lines
  Added in v.1.128


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