Diff for /loncom/interface/lonparmset.pm between versions 1.203 and 1.206

version 1.203, 2005/06/03 14:25:49 version 1.206, 2005/06/03 21:19:04
Line 451  sub startpage { Line 451  sub startpage {
   
     my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','',      my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','',
                                             'onUnload="pclose()"');                                              'onUnload="pclose()"');
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Table');      my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Table Mode Parameter Setting');
     my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '.      my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '.
         &Apache::loncommon::selectstudent_link('parmform','uname','udom');          &Apache::loncommon::selectstudent_link('parmform','uname','udom');
     my $selscript=&Apache::loncommon::studentbrowser_javascript();      my $selscript=&Apache::loncommon::studentbrowser_javascript();
Line 463  sub startpage { Line 463  sub startpage {
     'oi'    => "or ID",      'oi'    => "or ID",
     'ad'    => "at Domain"      'ad'    => "at Domain"
        );         );
     my $overallhelp=  
  &Apache::loncommon::help_open_menu('','Setting Parameters','Course_Setting_Parameters','',10,'Instructor Interface');  
     my $assessparmhelp=&Apache::loncommon::help_open_topic("Cascading_Parameters","Assessment Parameters");  
     my $html=&Apache::lonxml::xmlbegin();      my $html=&Apache::lonxml::xmlbegin();
     $r->print(<<ENDHEAD);      $r->print(<<ENDHEAD);
 $html  $html
Line 516  $selscript Line 513  $selscript
 </head>  </head>
 $bodytag  $bodytag
 $breadcrumbs  $breadcrumbs
 $overallhelp  
 ENDHEAD  ENDHEAD
     my %sectionhash=();      my %sectionhash=();
     my $sections='';      my $sections='';
Line 639  sub print_row { Line 635  sub print_row {
     if ($parmlev eq 'full') {      if ($parmlev eq 'full') {
         my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}.          my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}.
                                         '.'.$$name{$which},$$symbp{$rid});                                          '.'.$$name{$which},$$symbp{$rid});
   
 # this doesn't seem to work, and I don't think is correct  
 #    my $sessionvaltype=&Apache::lonnet::EXT('resource.'.$$part{$which}.  
 #                                      '.'.$$name{$which}.'.type',$symbp{$rid});  
 # this seems to work  
         my $sessionvaltype=$typeoutpar[$result];          my $sessionvaltype=$typeoutpar[$result];
         if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; }          if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; }
         $r->print('<td bgcolor=#999999 align="center"><font color=#FFFFFF>'.          $r->print('<td bgcolor=#999999 align="center"><font color=#FFFFFF>'.
Line 943  sub assessparms { Line 934  sub assessparms {
   
 # ---------------------------------------------------------- Anything to store?  # ---------------------------------------------------------- Anything to store?
     if ($env{'form.pres_marker'}) {      if ($env{'form.pres_marker'}) {
  $message.=&storeparm(split(/\&/,$env{'form.pres_marker'}),          my @markers=split(/\&\&\&/,$env{'form.pres_marker'});
      $env{'form.pres_value'},          my @values=split(/\&\&\&/,$env{'form.pres_value'});
      $env{'form.pres_type'},          my @types=split(/\&\&\&/,$env{'form.pres_type'});
                              $uname,$udom,$csec);   for (my $i=0;$i<=$#markers;$i++) {
       $message.=&storeparm(split(/\&/,$markers[$i]),
    $values[$i],
    $types[$i],
    $uname,$udom,$csec);
    }
 # ---------------------------------------------------------------- Done storing  # ---------------------------------------------------------------- Done storing
  $message.='<h3>'.&mt('Changes can take up to 10 minutes before being active for all students.').&Apache::loncommon::help_open_topic('Caching').'</h3>';   $message.='<h3>'.&mt('Changes can take up to 10 minutes before being active for all students.').&Apache::loncommon::help_open_topic('Caching').'</h3>';
     }      }
Line 970  sub assessparms { Line 966  sub assessparms {
   
     &startpage($r,$id,$udom,$csec,$uname,scalar(keys(%allkeys)));      &startpage($r,$id,$udom,$csec,$uname,scalar(keys(%allkeys)));
   
 #    if ($env{'form.url'}) {  
 # $r->print('<input type="hidden" value="'.$env{'form.url'}.  
 #  '" name="url"><input type="hidden" name="command" value="set">');  
 #    }  
     $r->print('<input type="hidden" value="true" name="prevvisit">');      $r->print('<input type="hidden" value="true" name="prevvisit">');
   
     foreach ('tolerance','date_default','date_start','date_end',      foreach ('tolerance','date_default','date_start','date_end',
Line 1885  ENDOVER Line 1877  ENDOVER
     $r->print('<h2><font color="red">'.      $r->print('<h2><font color="red">'.
       &mt('Error deleting parameters').'</font></h2>');        &mt('Error deleting parameters').'</font></h2>');
  }   }
    &Apache::lonnet::devalidatecourseresdata($crs,$dom);
     }      }
     if ($putentries) {      if ($putentries) {
  if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') {   if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') {
Line 1893  ENDOVER Line 1886  ENDOVER
     $r->print('<h2><font color="red">'.      $r->print('<h2><font color="red">'.
       &mt('Error storing parameters').'</font></h2>');        &mt('Error storing parameters').'</font></h2>');
  }   }
    &Apache::lonnet::devalidatecourseresdata($crs,$dom);
       }
   # Read coursedata
       my $resourcedata=&Apache::lonnet::get_courseresdata($crs,$dom);
   # Read userdata
   
       my $classlist=&Apache::loncoursedata::get_classlist();
       foreach (keys %$classlist) {
           # the following undefs are for 'domain', and 'username' respectively.
           if ($_=~/^(\w+)\:(\w+)$/) {
       my ($tuname,$tudom)=($1,$2);
       my $useropt=&Apache::lonnet::get_userresdata($tuname,$tudom);
               foreach my $userkey (keys %{$useropt}) {
    if ($userkey=~/^$env{'request.course.id'}/) {
                       my $newkey=$userkey;
       $newkey=~s/^($env{'request.course.id'}\.)/$1\[useropt\:$tuname\:$tudom\]\./;
       $$resourcedata{$newkey}=$$useropt{$userkey};
    }
       }
    }
     }      }
 # Read and display  
     my %resourcedata=&Apache::lonnet::dump('resourcedata',$dom,$crs);  
     my $oldsection='';      my $oldsection='';
     my $oldrealm='';      my $oldrealm='';
     my $oldpart='';      my $oldpart='';
     my $pointer=0;      my $pointer=0;
     $tableopen=0;      $tableopen=0;
     my $foundkeys=0;      my $foundkeys=0;
     foreach my $thiskey (sort keys %resourcedata) {      foreach my $thiskey (sort keys %{$resourcedata}) {
  if ($resourcedata{$thiskey.'.type'}) {   if ($$resourcedata{$thiskey.'.type'}) {
       $r->print($thiskey);
     my ($course,$middle,$part,$name)=      my ($course,$middle,$part,$name)=
  ($thiskey=~/^(\w+)\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);   ($thiskey=~/^(\w+)\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);
     my $section=&mt('All Students');      my $section=&mt('All Students');
     if ($middle=~/^\[(.*)\]\./) {      if ($middle=~/^\[(.*)\]\./) {
  $section=&mt('Group/Section').': '.$1;   my $issection=$1;
    if ($issection=~/^useropt\:(\w+)\:(\w+)/) {
       $section=&mt('User').": ".&Apache::loncommon::plainname($1,$2);
    } else {
       $section=&mt('Group/Section').': '.$issection;
    }
  $middle=~s/^\[(.*)\]\.//;   $middle=~s/^\[(.*)\]\.//;
     }      }
     $middle=~s/\.$//;      $middle=~s/\.$//;
Line 1941  ENDOVER Line 1959  ENDOVER
       ':</b></td><td><input type="checkbox" name="del_'.        ':</b></td><td><input type="checkbox" name="del_'.
       $thiskey.'" /></td><td>');        $thiskey.'" /></td><td>');
     $foundkeys++;      $foundkeys++;
     if ($resourcedata{$thiskey.'.type'}=~/^date/) {      if ($$resourcedata{$thiskey.'.type'}=~/^date/) {
  my $jskey='key_'.$pointer;   my $jskey='key_'.$pointer;
  $pointer++;   $pointer++;
  $r->print(   $r->print(
   &Apache::lonhtmlcommon::date_setter('overviewform',    &Apache::lonhtmlcommon::date_setter('overviewform',
       $jskey,        $jskey,
       $resourcedata{$thiskey}).        $$resourcedata{$thiskey}).
 '<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'  '<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'
   );    );
     } else {      } else {
  $r->print(   $r->print(
   '<input type="text" name="set_'.$thiskey.'" value="'.    '<input type="text" name="set_'.$thiskey.'" value="'.
   $resourcedata{$thiskey}.'">');    $$resourcedata{$thiskey}.'">');
     }      }
     $r->print('</td></tr>');      $r->print('</td></tr>');
  }   }
Line 2088  ENDMAINFORMHEAD Line 2106  ENDMAINFORMHEAD
     my @menu =      my @menu =
         (          (
           { text => 'Set Course Environment Parameters',            { text => 'Set Course Environment Parameters',
             help => 'Course_Setting_Parameters',      action => 'crsenv',
             action => 'crsenv',  
             permission => $parm_permission,              permission => $parm_permission,
             },              },
           { text => 'Set/Modify Course Assessment Parameters - Helper Mode',            { text => 'Set/Modify Course Assessment Parameters - Helper Mode',
Line 2103  ENDMAINFORMHEAD Line 2120  ENDMAINFORMHEAD
           { text => 'Set/Modify Course Assessment Parameters - Table Mode',            { text => 'Set/Modify Course Assessment Parameters - Table Mode',
             action => 'settable',              action => 'settable',
             permission => $parm_permission,              permission => $parm_permission,
               help => 'Cascading_Parameters',
             },              },
 #          { text => 'Set Parameter Default Preferences',  #          { text => 'Set Parameter Default Preferences',
 #            help => 'Course_View_Class_List',  #            help => 'Course_View_Class_List',
Line 2157  sub handler { Line 2175  sub handler {
  return OK;   return OK;
     }      }
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
     ['action','state']);      ['action','state',
                                                'pres_marker',
                                                'pres_value',
                                                'pres_type',
                                                'udom','uname']);
   
   
     &Apache::lonhtmlcommon::clear_breadcrumbs();      &Apache::lonhtmlcommon::clear_breadcrumbs();
     &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/parmset",      &Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/parmset",
     text=>"Parameter Manager",      text=>"Parameter Manager",
     faq=>9,      faq=>10,
     bug=>'Instructor Interface'});      bug=>'Instructor Interface'});
   
 # ----------------------------------------------------- Needs to be in a course  # ----------------------------------------------------- Needs to be in a course
Line 2208  sub handler { Line 2230  sub handler {
     &overview($r);      &overview($r);
         } elsif ($env{'form.action'} eq 'settable' && $parm_permission) {          } elsif ($env{'form.action'} eq 'settable' && $parm_permission) {
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable',              &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable',
     text=>"Table Mode"});      text=>"Table Mode",
       help => 'Course_Setting_Parameters'});
     &assessparms($r);      &assessparms($r);
         }          }
                   

Removed from v.1.203  
changed lines
  Added in v.1.206


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