Diff for /loncom/interface/lonparmset.pm between versions 1.387 and 1.417

version 1.387, 2007/11/17 02:50:49 version 1.417, 2008/12/01 18:13:55
Line 44  This module sets coursewide and assessme Line 44  This module sets coursewide and assessme
   
 =head1 INTERNAL SUBROUTINES  =head1 INTERNAL SUBROUTINES
   
 =over 4  =over
   
 =cut  
   
 ###################################################################  
 ###################################################################  
   
 package Apache::lonparmset;  
   
 use strict;  
 use Apache::lonnet;  
 use Apache::Constants qw(:common :http REDIRECT);  
 use Apache::lonhtmlcommon();  
 use Apache::loncommon;  
 use GDBM_File;  
 use Apache::lonhomework;  
 use Apache::lonxml;  
 use Apache::lonlocal;  
 use Apache::lonnavmaps;  
 use Apache::longroup;  
 use Apache::lonrss;  
 use LONCAPA qw(:DEFAULT :match);  
   
   
 ##################################################  
 ##################################################  
   
 =pod  =pod
   
 =item parmval  =item parmval()
   
 Figure out a cascading parameter.  Figure out a cascading parameter.
   
Line 98  Returns:  A list, the first item is the Line 73  Returns:  A list, the first item is the
 2 - Map or Folder level for specific student  2 - Map or Folder level for specific student
 1 - resource level for specific student  1 - resource level for specific student
   
   =item parmval_by_symb()
   
   =item reset_caches()
   
   =item cacheparmhash() 
   
   =item parmhash()
   
   =item symbcache()
   
   =item preset_defaults()
   
   =item date_sanity_info()
   
   =item storeparm()
   
   Store a parameter by symb
   
       Takes
       - symb
       - name of parameter
       - level
       - new value
       - new type
       - username
       - userdomain
   
   =item log_parmset()
   
   =item storeparm_by_symb_inner()
   
   =item valout()
   
   Format a value for output.
   
   Inputs:  $value, $type, $editable
   
   Returns: $value, formatted for output.  If $type indicates it is a date,
   localtime($value) is returned.
   $editable will return an icon to click on
   
   =item plink()
   
   Produces a link anchor.
   
   Inputs: $type,$dis,$value,$marker,$return,$call
   
   Returns: scalar with html code for a link which will envoke the 
   javascript function 'pjump'.
   
   =item page_js()
   
   =item startpage()
   
   =item print_row()
   
   =item print_td()
   
   =item print_usergroups()
   
   =item parm_control_group()
   
   =item extractResourceInformation() : 
   
   Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes.
   
   Input: See list below:
   
   =item * B<ids> : An array that will contain all of the ids in the course.
   
   =item * B<typep> : hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>.
   
   =item * B<keyp> : hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id
   
   =item * B<allparms> : hash, name of parameter->display value (what is the display value?)
   
   =item * B<allparts> : hash, part identification->text representation of part, where the text representation is "[Part $part]"
   
   =item * B<allkeys> : hash, full key to part->display value (what's display value?)
   
   =item * B<allmaps> : hash, ???
   
   =item * B<fcat> : ???
   
   =item * B<defp> : hash, ???
   
   =item * B<mapp> : ??
   
   =item * B<symbp> : hash, id->full sym?
   
   
   
   =item isdateparm()
   
   =item parmmenu()
   
   =item partmenu()
   
   =item usermenu()
   
   =item displaymenu()
   
   =item mapmenu()
   
   =item levelmenu()
   
   =item sectionmenu()
   
   =item keysplit()
   
   =item keysinorder()
   
   =item keysinorder_bytype()
   
   =item keysindisplayorder()
   
   =item standardkeyorder()
   
   =item assessparms() : 
   
   Show assessment data and parameters.  This is a large routine that should
   be simplified and shortened... someday.
   
   Inputs: $r
   
   Returns: nothing
   
   Variables used (guessed by Jeremy):
   
   =item * B<pscat>: ParameterS CATegories? ends up a list of the types of parameters that exist, e.g., tol, weight, acc, opendate, duedate, answerdate, sig, maxtries, type.
   
   =item * B<psprt>: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts?
   
   =item * B<@catmarker> contains list of all possible parameters including part #s
   
   =item * B<$fullkeyp> contains the full part/id # for the extraction of proper parameters
   
   =item * B<$tempkeyp> contains part 0 only (no ids - ie, subparts)
           When storing information, store as part 0
           When requesting information, request from full part
   
   =item crsenv()
   
   Show and set course data and parameters.  This is a large routine that should
   be simplified and shortened... someday.
   
   Inputs: $r
   
   Returns: nothing
   
   =item can_modify_catsettings()
   
   =item assign_course_categories()
   
   =item tablestart()
   
   =item tableend()
   
   =item extractuser()
   
   =item parse_listdata_key()
   
   =item listdata()
   
   =item date_interval_selector()
   
   =item get_date_interval_from_form()
   
   =item default_selector()
   
   =item string_selector()
   
   =item dateshift()
   
   =item newoverview()
   
   =item secgroup_lister()
   
   =item overview()
   
   =item clean_parameters()
   
   =item date_shift_one()
   
   =item date_shift_two()
   
   =item parse_key()
   
   =item check_cloners() :
   
   Checks if new users included in list of allowed cloners
   are valid users.  Replaces supplied list with 
   cleaned list containing only users with valid usernames
   and domains.
   
   Inputs: $clonelist, $oldcloner 
   where $clonelist is ref to array of requested cloners,
   and $oldcloner is ref to array of currently allowed
   cloners.
   
   Returns: string - comma separated list of requested
   cloners (username:domain) who do not exist in system.
   
   =item change_clone() :
   
   Modifies the list of courses a user can clone (stored
   in the user's environment.db file), called when a
   change is made to the list of users allowed to clone
   a course.
   
   Inputs: $action,$cloner
   where $action is add or drop, and $cloner is identity of 
   user for whom cloning ability is to be changed in course. 
   
   
   =item check_cloners()
   
   =item change_clone()
   
   =item header()
   
   Output html header for page
   
   =item print_main_menu()
   
   =item output_row()
   
   Set portfolio metadata
   
   =item order_meta_fields()
   
   =item addmetafield()
   
   =item setrestrictmeta()
   
   =item get_added_meta_fieldnames()
   
   =item get_deleted_meta_fieldnames()
   
   =item defaultsetter()
   
   =item components()
   
   =item load_parameter_names()
   
   =item parm_change_log()
   
   =item handler() : 
   
   Main handler.  Calls &assessparms and &crsenv subroutines.
   
   
   =back
   
 =cut  =cut
   
 ##################################################  ###################################################################
   ###################################################################
   
   package Apache::lonparmset;
   
   use strict;
   use Apache::lonnet;
   use Apache::Constants qw(:common :http REDIRECT);
   use Apache::lonhtmlcommon();
   use Apache::loncommon;
   use GDBM_File;
   use Apache::lonhomework;
   use Apache::lonxml;
   use Apache::lonlocal;
   use Apache::lonnavmaps;
   use Apache::longroup;
   use Apache::lonrss;
   use LONCAPA qw(:DEFAULT :match);
   
   
 sub parmval {  sub parmval {
     my ($what,$id,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_;      my ($what,$id,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_;
     return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec,      return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec,
Line 302  sub reset_caches { Line 550  sub reset_caches {
     }      }
 }  }
   
   
   
 sub preset_defaults {  sub preset_defaults {
     my $type=shift;      my $type=shift;
     if (&rulescache($type.'_action') eq 'default') {      if (&rulescache($type.'_action') eq 'default') {
Line 316  sub preset_defaults { Line 566  sub preset_defaults {
     }      }
 }  }
   
 ##################################################  
   
   
 sub date_sanity_info {  sub date_sanity_info {
    my $checkdate=shift;     my $checkdate=shift;
Line 325  sub date_sanity_info { Line 576  sub date_sanity_info {
    my $crsprefix='course.'.$env{'request.course.id'}.'.';     my $crsprefix='course.'.$env{'request.course.id'}.'.';
    if ($env{$crsprefix.'default_enrollment_end_date'}) {     if ($env{$crsprefix.'default_enrollment_end_date'}) {
       if ($checkdate>$env{$crsprefix.'default_enrollment_end_date'}) {        if ($checkdate>$env{$crsprefix.'default_enrollment_end_date'}) {
          $result.='<br />'.&mt('After course enrollment end!');           $result.='<div class="LC_warning">'
                    .&mt('After course enrollment end!')
                    .'</div>';
       }        }
    }     }
    if ($env{$crsprefix.'default_enrollment_start_date'}) {     if ($env{$crsprefix.'default_enrollment_start_date'}) {
       if ($checkdate<$env{$crsprefix.'default_enrollment_start_date'}) {        if ($checkdate<$env{$crsprefix.'default_enrollment_start_date'}) {
          $result.='<br />'.&mt('Before course enrollment start!');           $result.='<div class="LC_warning">'
                    .&mt('Before course enrollment start!')
                    .'</div>';
       }        }
    }     }
   # Preparation for additional warnings about dates in the past/future.
   # An improved, more context sensitive version is recommended,
   # e.g. warn for due and answer dates which are defined before the corresponding open date, etc.
   #   if ($checkdate<time) {
   #      $result.='<div class="LC_info">'
   #              .'('.&mt('in the past').')'
   #              .'</div>';
   #      }
   #   if ($checkdate>time) {
   #      $result.='<div class="LC_info">'
   #              .'('.&mt('in the future').')'
   #              .'</div>';
   #      }
    return $result;     return $result;
 }  }
 ##################################################  ##################################################
Line 354  sub storeparm { Line 622  sub storeparm {
     &storeparm_by_symb(&symbcache($sresid),$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,'',$cgroup);      &storeparm_by_symb(&symbcache($sresid),$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,'',$cgroup);
 }  }
   
 #  
 # Store a parameter by symb  
 #  
 # Takes  
 # - symb  
 # - name of parameter  
 # - level  
 # - new value  
 # - new type  
 # - username  
 # - userdomain  
 my %recstack;  my %recstack;
 sub storeparm_by_symb {  sub storeparm_by_symb {
     my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$recflag,$cgroup)=@_;      my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$recflag,$cgroup)=@_;
Line 519  sub storeparm_by_symb_inner { Line 776  sub storeparm_by_symb_inner {
     return '';      return '';
 }  }
   
 ##################################################  
 ##################################################  
   
 =pod  
   
 =item valout  
   
 Format a value for output.  
   
 Inputs:  $value, $type, $editable  
   
 Returns: $value, formatted for output.  If $type indicates it is a date,  
 localtime($value) is returned.  
 $editable will return an icon to click on  
   
 =cut  
   
 ##################################################  
 ##################################################  
 sub valout {  sub valout {
     my ($value,$type,$editable)=@_;      my ($value,$type,$editable)=@_;
     my $result = '';      my $result = '';
Line 551  sub valout { Line 790  sub valout {
     } else {      } else {
         if ($type eq 'date_interval') {          if ($type eq 'date_interval') {
             my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value);              my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value);
               my @timer;
             $year=$year-70;              $year=$year-70;
             $mday--;              $mday--;
             if ($year) {              if ($year) {
  $result.=$year.' yrs ';  #               $result.=&mt('[quant,_1,yr]',$year).' ';
                   push(@timer,&mt('[quant,_1,yr]',$year));
             }              }
             if ($mon) {              if ($mon) {
  $result.=$mon.' mths ';  #               $result.=&mt('[quant,_1,mth]',$mon).' ';
                   push(@timer,&mt('[quant,_1,mth]',$mon));
             }              }
             if ($mday) {              if ($mday) {
  $result.=$mday.' days ';  #               $result.=&mt('[quant,_1,day]',$mday).' ';
                   push(@timer,&mt('[quant,_1,day]',$mday));
             }              }
             if ($hour) {              if ($hour) {
  $result.=$hour.' hrs ';  #               $result.=&mt('[quant,_1,hr]',$hour).' ';
                   push(@timer,&mt('[quant,_1,hr]',$hour));
             }              }
             if ($min) {              if ($min) {
  $result.=$min.' mins ';  #               $result.=&mt('[quant,_1,min]',$min).' ';
                   push(@timer,&mt('[quant,_1,min]',$min));
             }              }
             if ($sec) {              if ($sec) {
  $result.=$sec.' secs ';  #               $result.=&mt('[quant,_1,sec]',$sec).' ';
                   push(@timer,&mt('[quant,_1,sec]',$sec));
               }
   #           $result=~s/\s+$//;
               if (!@timer) { # Special case: all entries 0 -> display "0 secs" intead of empty field to keep this field editable
                   push(@timer,&mt('[quant,_1,sec]',0));
             }              }
             $result=~s/\s+$//;              $result.=join(", ",@timer);
         } elsif (&isdateparm($type)) {          } elsif (&isdateparm($type)) {
             $result = &Apache::lonlocal::locallocaltime($value).              $result = &Apache::lonlocal::locallocaltime($value).
  &date_sanity_info($value);   &date_sanity_info($value);
Line 583  sub valout { Line 833  sub valout {
     return $result;      return $result;
 }  }
   
 ##################################################  
 ##################################################  
   
 =pod  
   
 =item plink  
   
 Produces a link anchor.  
   
 Inputs: $type,$dis,$value,$marker,$return,$call  
   
 Returns: scalar with html code for a link which will envoke the   
 javascript function 'pjump'.  
   
 =cut  
   
 ##################################################  
 ##################################################  
 sub plink {  sub plink {
     my ($type,$dis,$value,$marker,$return,$call)=@_;      my ($type,$dis,$value,$marker,$return,$call)=@_;
     my $winvalue=$value;      my $winvalue=$value;
Line 683  sub startpage { Line 916  sub startpage {
     my %loaditems = ('onunload' => "pclose()",      my %loaditems = ('onunload' => "pclose()",
      'onload'   => "group_or_section('cgroup')",);       'onload'   => "group_or_section('cgroup')",);
   
       if ((($env{'form.command'} eq 'set') && ($env{'form.url'})
        && (!$env{'form.dis'})) || ($env{'form.symb'})) {
    &Apache::lonhtmlcommon::add_breadcrumb({help=>'Problem_Parameters',
       text=>"Problem Parameters"});
       } else {
    &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable',
      text=>"Table Mode",
      help => 'Course_Setting_Parameters'});
       }
     my $start_page =       my $start_page = 
  &Apache::loncommon::start_page('Set/Modify Course Parameters',   &Apache::loncommon::start_page('Set/Modify Course Parameters',
        &page_js(),         &page_js(),
Line 899  sub parm_control_group { Line 1141  sub parm_control_group {
     return($coursereply,$resultitem,$resultgroup,$resultlevel,$resulttype);      return($coursereply,$resultitem,$resultgroup,$resultlevel,$resulttype);
 }  }
   
 =pod  
   
 =item B<extractResourceInformation>: Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes.  
   
 Input: See list below:  
   
 =over 4  
   
 =item B<ids>: An array that will contain all of the ids in the course.  
   
 =item B<typep>: hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>.  
   
 =item B<keyp>: hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id  
   
 =item B<allparms>: hash, name of parameter->display value (what is the display value?)  
   
 =item B<allparts>: hash, part identification->text representation of part, where the text representation is "[Part $part]"  
   
 =item B<allkeys>: hash, full key to part->display value (what's display value?)  
   
 =item B<allmaps>: hash, ???  
   
 =item B<fcat>: ???  
   
 =item B<defp>: hash, ???  
   
 =item B<mapp>: ??  
   
 =item B<symbp>: hash, id->full sym?  
   
 =back  
   
 =cut  
   
 sub extractResourceInformation {  sub extractResourceInformation {
     my $ids = shift;      my $ids = shift;
Line 973  sub extractResourceInformation { Line 1183  sub extractResourceInformation {
     if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) {      if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) {
  my $display= &Apache::lonnet::metadata($srcf,$key.'.display');   my $display= &Apache::lonnet::metadata($srcf,$key.'.display');
  my $parmdis = $display;   my $parmdis = $display;
  $parmdis =~ s/\[Part.*$//g;   $parmdis =~ s/\s*\[Part.*$//g;
  $$allparms{$name}=$parmdis;   $$allparms{$name}=$parmdis;
  if (ref($defkeytype)) {   if (ref($defkeytype)) {
     $$defkeytype{$name}=      $$defkeytype{$name}=
Line 985  sub extractResourceInformation { Line 1195  sub extractResourceInformation {
 # allparts is a hash of all parts  # allparts is a hash of all parts
 #  #
     my $part= &Apache::lonnet::metadata($srcf,$key.'.part');      my $part= &Apache::lonnet::metadata($srcf,$key.'.part');
     $$allparts{$part} = "Part: $part";      $$allparts{$part} = &mt('Part: [_1]',$part);
 #  #
 # Remember all keys going with this resource  # Remember all keys going with this resource
 #  #
Line 1010  sub extractResourceInformation { Line 1220  sub extractResourceInformation {
     $$mapp{$mapid}=$$mapp{$id};      $$mapp{$mapid}=$$mapp{$id};
     $$allmaps{$mapid}=$$mapp{$id};      $$allmaps{$mapid}=$$mapp{$id};
     if ($mapid eq '1') {      if ($mapid eq '1') {
  $$maptitles{$mapid}='Main Course Documents';   $$maptitles{$mapid}=&mt('Main Course Documents');
     } else {      } else {
  $$maptitles{$mapid}=   $$maptitles{$mapid}=
     &Apache::lonnet::gettitle($$mapp{$id});          &Apache::lonnet::gettitle($$mapp{$id});    
Line 1025  sub extractResourceInformation { Line 1235  sub extractResourceInformation {
 }  }
   
   
 ##################################################  
 ##################################################  
   
 sub isdateparm {  sub isdateparm {
     my $type=shift;      my $type=shift;
Line 1107  ENDSCRIPT Line 1315  ENDSCRIPT
  if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {   if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {
     $r->print(' checked');      $r->print(' checked');
  }   }
  $r->print('>'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey}   $r->print('>'.($$allparms{$tempkey}=~/\S/ ? &mt($$allparms{$tempkey})
                                   : $tempkey)                                    : &mt($tempkey))
   .'</label></td>');    .'</label></td>');
   $cnt++;    $cnt++;
         if ($cnt==3) {          if ($cnt==3) {
Line 1116  ENDSCRIPT Line 1324  ENDSCRIPT
     $cnt=0;      $cnt=0;
  }   }
     }      }
     $r->print('      $r->print('</tr>'
 </tr><tr id=\"LC_parm_overview_parm_menu_selectors\"><td>               .'<tr id=\"LC_parm_overview_parm_menu_selectors\">'
 <a href="javascript:checkall(true, \'pscat\')">Select&nbsp;All</a><br />               .'<td valign="top">'
 <a href="javascript:checkstandard()">Select&nbsp;Common&nbsp;Only</a>               .'<fieldset><legend><b>'.&mt('Parameter Selection').'</b></legend>'
 </td><td>               .'<span class="LC_nobreak">'
 <a href="javascript:checkdates()">Add&nbsp;Problem&nbsp;Dates</a>               .'&bull; <a href="javascript:checkall(true, \'pscat\')">'.&mt('Select All').'</a>'
 <a href="javascript:checkcontdates()">Add&nbsp;Content&nbsp;Dates</a><br />               .'</span>'
 <a href="javascript:checkdisset()">Add&nbsp;Discussion&nbsp;Settings</a>               .'<br />'
 <a href="javascript:checkvisi()">Add&nbsp;Visibilities</a><br />               .'<span class="LC_nobreak">'
 <a href="javascript:checkparts()">Add&nbsp;Part&nbsp;Parameters</a>               .'&bull; <a href="javascript:checkstandard()">'.&mt('Select Common Only').'</a>'
 </td><td>               .'</span>'
 <a href="javascript:checkall(false, \'pscat\')">Unselect&nbsp;All</a>               .'<br />'
 </td>               .'<span class="LC_nobreak">'
 ');               .'&bull; <a href="javascript:checkall(false, \'pscat\')">'.&mt('Unselect All').'</a>'
     $r->print('</tr></table>');               .'</span>'
                .'</fieldset>'
                .'</td>'
                .'<td colspan="2" valign="top">'
                .'<fieldset><legend><b>'.&mt('Add Selection for...').'</b></legend>'
                .'<span class="LC_nobreak">'
                .'&bull; <a href="javascript:checkdates()">'.&mt('Problem Dates').'</a>'
                .'</span>'
                .'<span class="LC_nobreak">'
                .' &bull; <a href="javascript:checkcontdates()">'.&mt('Content Dates').'</a>'
                .'</span>'
   #            .'<br />'
                .'<span class="LC_nobreak">'
                .' &bull; <a href="javascript:checkdisset()">'.&mt('Discussion Settings').'</a>'
                .'</span>'
                .'<span class="LC_nobreak">'
                .' &bull; <a href="javascript:checkvisi()">'.&mt('Visibilities').'</a>'
                .'</span>'
   #            .'<br />'
                .'<span class="LC_nobreak">'
                .' &bull; <a href="javascript:checkparts()">'.&mt('Part Parameters').'</a>'
                .'</span>'
                .'</fieldset>'
                .'</td>'
                .'</tr></table>'
       );
 }  }
   
 sub partmenu {  sub partmenu {
     my ($r,$allparts,$psprt)=@_;      my ($r,$allparts,$psprt)=@_;
     $r->print('<select multiple name="psprt" size="8">');      $r->print('<select multiple name="psprt" size="8">');
     $r->print('<option value="all"');      $r->print('<option value="all"');
     $r->print(' selected') unless (@{$psprt});      $r->print(' selected="selected"') unless (@{$psprt});
     $r->print('>'.&mt('All Parts').'</option>');      $r->print('>'.&mt('All Parts').'</option>');
     my %temphash=();      my %temphash=();
     foreach (@{$psprt}) { $temphash{$_}=1; }      foreach (@{$psprt}) { $temphash{$_}=1; }
Line 1147  sub partmenu { Line 1380  sub partmenu {
  unless ($tempkey =~ /\./) {   unless ($tempkey =~ /\./) {
     $r->print('<option value="'.$tempkey.'"');      $r->print('<option value="'.$tempkey.'"');
     if ($$psprt[0] eq "all" ||  $temphash{$tempkey}) {      if ($$psprt[0] eq "all" ||  $temphash{$tempkey}) {
  $r->print(' selected');   $r->print(' selected="selected"');
     }      }
     $r->print('>'.$$allparts{$tempkey}.'</option>');      $r->print('>'.$$allparts{$tempkey}.'</option>');
  }   }
Line 1160  sub usermenu { Line 1393  sub usermenu {
     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();
     my %lt=&Apache::lonlocal::texthash(  
     'se'    => "Section",  
                     'gr'    => "Group",  
     'fu'    => "For User",  
     'oi'    => "or ID",  
     'ad'    => "at Domain"  
        );  
     my $sections='';      my $sections='';
     my %sectionhash = &Apache::loncommon::get_sections();      my %sectionhash = &Apache::loncommon::get_sections();
   
     my $groups;      my $groups;
     my %grouphash = &Apache::longroup::coursegroups();      my %grouphash = &Apache::longroup::coursegroups();
   
       my $g_s_header='';
       my $g_s_footer='';
   
     if (%sectionhash) {      if (%sectionhash) {
         $sections=$lt{'se'}.': <select name="csec"';          $sections=&mt('Section:').' <select name="csec"';
         if (%grouphash && $parmlev ne 'full') {          if (%grouphash && $parmlev ne 'full') {
             $sections .= qq| onchange="group_or_section('csec')" |;              $sections .= qq| onchange="group_or_section('csec')" |;
         }          }
Line 1186  sub usermenu { Line 1416  sub usermenu {
         }          }
         $sections.='</select>';          $sections.='</select>';
     }      }
   
     if (%sectionhash && %grouphash && $parmlev ne 'full') {      if (%sectionhash && %grouphash && $parmlev ne 'full') {
         $sections .= '&nbsp;or&nbsp;';          $sections .= '&nbsp;'.&mt('or').'&nbsp;';
         $sections .= qq|          $sections .= qq|
 <script type="text/javascript">  <script type="text/javascript">
 function group_or_section(caller) {  function group_or_section(caller) {
Line 1214  function group_or_section(caller) { Line 1445  function group_or_section(caller) {
     }       } 
   
     if (%grouphash) {      if (%grouphash) {
         $groups=$lt{'gr'}.': <select name="cgroup"';          $groups=&mt('Group:').' <select name="cgroup"';
         if (%sectionhash && $env{'form.action'} eq 'settable') {          if (%sectionhash && $env{'form.action'} eq 'settable') {
             $groups .= qq| onchange="group_or_section('cgroup')" |;              $groups .= qq| onchange="group_or_section('cgroup')" |;
         }          }
Line 1236  function group_or_section(caller) { Line 1467  function group_or_section(caller) {
         }          }
         $groups.='</select>';          $groups.='</select>';
     }      }
     $r->print(<<ENDMENU);  
 <b>      if (%sectionhash || %grouphash) {
 $sections          $g_s_header='<fieldset><legend>'.&mt('Group/Section').'</legend><div>';
 $groups          $g_s_footer='</div></fieldset>';
 <br />      }
 $lt{'fu'}   
 <input type="text" value="$uname" size="12" name="uname" />      $r->print('<b>'
 $lt{'oi'}               .$g_s_header
 <input type="text" value="$id" size="12" name="id" />                .$sections
 $lt{'ad'}               .$groups
 $chooseopt               .$g_s_footer
 </b>               .'<fieldset><legend>'.&mt('User').'</legend><div>'
 ENDMENU               .&mt('For User [_1] or Student/Employee ID [_2] at Domain [_3]'
                    ,'<input type="text" value="'.$uname.'" size="12" name="uname" />'
                    ,'<input type="text" value="'.$id.'" size="12" name="id" /> '
                    ,$chooseopt)
                .'</div></fieldset>'
                .'</b>'
       );
 }  }
   
 sub displaymenu {  sub displaymenu {
Line 1256  sub displaymenu { Line 1493  sub displaymenu {
     $r->print('<table border="1"><tr><th>'.&mt('Select Parameters to View').'</th><th>'.      $r->print('<table border="1"><tr><th>'.&mt('Select Parameters to View').'</th><th>'.
      &mt('Select Parts to View').'</th></tr><tr><td>');         &mt('Select Parts to View').'</th></tr><tr><td>');  
     &parmmenu($r,$allparms,$pscat,$keyorder);      &parmmenu($r,$allparms,$pscat,$keyorder);
     $r->print('</td><td>');      $r->print('</td><td valign="top" align="center">');
     &partmenu($r,$allparts,$psprt);      &partmenu($r,$allparts,$psprt);
     $r->print('</td></tr></table>');      $r->print('</td></tr></table>');
 }  }
Line 1268  sub mapmenu { Line 1505  sub mapmenu {
     $r->print('<option value="all">'.&mt('All Maps or Folders').'</option>');      $r->print('<option value="all">'.&mt('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="selected"'); }
  $r->print('>'.$$maptitles{$_}.($$allmaps{$_}!~/^uploaded/?' ['.$$allmaps{$_}.']':'').'</option>');   $r->print('>'.$$maptitles{$_}.($$allmaps{$_}!~/^uploaded/?' ['.$$allmaps{$_}.']':'').'</option>');
     }      }
     $r->print("</select>");      $r->print("</select>");
Line 1282  sub levelmenu { Line 1519  sub levelmenu {
     foreach (reverse sort keys %{$alllevs}) {      foreach (reverse sort keys %{$alllevs}) {
  $r->print('<option value="'.$$alllevs{$_}.'"');   $r->print('<option value="'.$$alllevs{$_}.'"');
  if ($parmlev eq $$alllevs{$_}) {   if ($parmlev eq $$alllevs{$_}) {
     $r->print(' selected');       $r->print(' selected="selected"'); 
  }   }
  $r->print('>'.$_.'</option>');   $r->print('>'.&mt($_).'</option>');
     }      }
     $r->print("</select>");      $r->print("</select>");
 }  }
Line 1300  sub sectionmenu { Line 1537  sub sectionmenu {
  $r->print('    <option value="'.$s.'"');   $r->print('    <option value="'.$s.'"');
  foreach (@{$selectedsections}) {   foreach (@{$selectedsections}) {
     if ($s eq $_) {      if ($s eq $_) {
  $r->print(' selected');   $r->print(' selected="selected"');
  last;   last;
     }      }
  }   }
Line 1319  sub groupmenu { Line 1556  sub groupmenu {
  $r->print('    <option value="'.$group.'"');   $r->print('    <option value="'.$group.'"');
  foreach (@{$selectedgroups}) {   foreach (@{$selectedgroups}) {
     if ($group eq $_) {      if ($group eq $_) {
  $r->print(' selected');   $r->print(' selected="selected"');
  last;   last;
     }      }
  }   }
Line 1398  sub standardkeyorder { Line 1635  sub standardkeyorder {
             'parameter_0_discusshide' => 20);              'parameter_0_discusshide' => 20);
 }  }
   
 ##################################################  
 ##################################################  
   
 =pod  
   
 =item assessparms  
   
 Show assessment data and parameters.  This is a large routine that should  
 be simplified and shortened... someday.  
   
 Inputs: $r  
   
 Returns: nothing  
   
 Variables used (guessed by Jeremy):  
   
 =over 4  
   
 =item B<pscat>: ParameterS CATegories? ends up a list of the types of parameters that exist, e.g., tol, weight, acc, opendate, duedate, answerdate, sig, maxtries, type.  
   
 =item B<psprt>: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts?  
   
 =item B<allmaps>:  
   
 =back  
   
 =cut  
   
 ##################################################  
 ##################################################  
 sub assessparms {  sub assessparms {
   
     my $r=shift;      my $r=shift;
Line 1881  ENDTABLEHEADFOUR Line 2089  ENDTABLEHEADFOUR
 #---------------------------------------------------- print header information  #---------------------------------------------------- print header information
                 my $foldermap=&mt($maptitle=~/^uploaded/?'Folder':'Map');                  my $foldermap=&mt($maptitle=~/^uploaded/?'Folder':'Map');
                 my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':'');                  my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':'');
                 $r->print(<<ENDMAPONE);                  my $tmp="";
 <center><h4>  
 Set Defaults for All Resources in $foldermap<br />  
 <font color="red"><i>$showtitle</i></font><br />  
 Specifically for  
 ENDMAPONE  
                 if ($uname) {                  if ($uname) {
     my $person=&Apache::loncommon::plainname($uname,$udom);      my $person=&Apache::loncommon::plainname($uname,$udom);
                     $r->print(&mt("User")." <font color=\"red\"><i>$uname \($person\) </i></font> ".                      $tmp.=&mt("User")." <font color=\"red\"><i>$uname \($person\) </i></font> ".
                         &mt('in')." \n");                          &mt('in')." \n";
                 } else {                  } else {
                     $r->print("<font color=\"red\"><i>".&mt('all').'</i></font> '.&mt('users in')." \n");                      $tmp.="<font color=\"red\"><i>".&mt('all').'</i></font> '.&mt('users in')." \n";
                 }                  }
                 if ($cgroup) {                  if ($cgroup) {
                     $r->print(&mt("Group")." <font color=\"red\"><i>$cgroup".                      $tmp.=&mt("Group")." <font color=\"red\"><i>$cgroup".
                               "</i></font> ".&mt('of')." \n");                                "</i></font> ".&mt('of')." \n";
                     $csec = '';                      $csec = '';
                 } elsif ($csec) {                  } elsif ($csec) {
                     $r->print(&mt("Section")." <font color=\"red\"><i>$csec".                      $tmp.=&mt("Section")." <font color=\"red\"><i>$csec".
                               "</i></font> ".&mt('of')." \n");                                "</i></font> ".&mt('of')." \n";
                 }                  }
                 $r->print("<font color=\"red\"><i>$coursename</i></font><br />");                  $r->print('<div align="center"><h4>'
                 $r->print("</h4>\n");                           .&mt('Set Defaults for All Resources in [_1]Specifically for [_2][_3]'
                                ,$foldermap.'<br /><font color="red"><i>'.$showtitle.'</i></font><br />'
                                ,$tmp
                                ,'<font color="red"><i>'.$coursename.'</i></font>'
                                )
                            ."<br /></h4>\n"
                            );
 #---------------------------------------------------------------- print table  #---------------------------------------------------------------- print table
                 $r->print('<p><table border="2">');                  $r->print('<p><table border="2">');
                 $r->print('<tr><th>'.&mt('Parameter Name').'</th>');                  $r->print('<tr><th>'.&mt('Parameter Name').'</th>');
Line 1916  ENDMAPONE Line 2125  ENDMAPONE
                            \%type,\%display,$defbgone,$defbgtwo,$defbgthree,                             \%type,\%display,$defbgone,$defbgtwo,$defbgthree,
                            $parmlev,$uname,$udom,$csec,$cgroup);                             $parmlev,$uname,$udom,$csec,$cgroup);
                 }                  }
                 $r->print("</table></center>");                  $r->print("</table></div>");
             } # end each map              } # end each map
         } # end of $parmlev eq map          } # end of $parmlev eq map
 #--------------------------------- Entry for parm level general (Course level)  #--------------------------------- Entry for parm level general (Course level)
Line 1999  ENDMAPONE Line 2208  ENDMAPONE
 } # end sub assessparms  } # end sub assessparms
   
   
 ##################################################  
 ##################################################  
   
 =pod  
   
 =item crsenv  
   
 Show and set course data and parameters.  This is a large routine that should  
 be simplified and shortened... someday.  
   
 Inputs: $r  
   
 Returns: nothing  
   
 =cut  
   
 ##################################################  
 ##################################################  
 sub crsenv {  sub crsenv {
     my $r=shift;      my $r=shift;
     my $setoutput='';      my $setoutput='';
   
       &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=crsenv',
    text=>"Course Environment"});
     my $breadcrumbs =       my $breadcrumbs = 
  &Apache::lonhtmlcommon::breadcrumbs('Edit Course Environment');   &Apache::lonhtmlcommon::breadcrumbs('Edit Course Environment');
     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 (%crsinfo,$chome);
   
     #      #
     # Go through list of changes      # Go through list of changes
     foreach (keys %env) {      foreach (keys %env) {
Line 2120  sub crsenv { Line 2316  sub crsenv {
             my $put_result = &Apache::lonnet::put('environment',              my $put_result = &Apache::lonnet::put('environment',
                                                   {$name=>$value},$dom,$crs);                                                    {$name=>$value},$dom,$crs);
             if ($put_result eq 'ok') {              if ($put_result eq 'ok') {
                 $setoutput.=&mt('Set').' <b>'.$name.'</b> '.&mt('to').' <b>'.$value.'</b>.<br />';                  $setoutput.=&mt('Set').' <b>'.$name.'</b> '.&mt('to').' <b>';
                   if ($name =~ /^default_enrollment_(start|end)_date$/) {
                       $setoutput .= &Apache::lonlocal::locallocaltime($value);
                   } elsif ($name eq 'categories') {
                       $setoutput .= $env{'form.categories_display'};
                   } else {
                       $setoutput .= $value;
                   }
                   $setoutput .= '</b>.<br />';
                 if ($name eq 'cloners') {                  if ($name eq 'cloners') {
                     &change_clone($value,\@oldcloner);                      &change_clone($value,\@oldcloner);
                 }                  }
                 # Update environment and nohist_courseids.db                  # Update environment and nohist_courseids.db
                   if (($name eq 'description') || ($name eq 'cloners') || 
                       ($name eq 'hidefromcat') || ($name eq 'categories')) {
                       if ($chome eq '') {
                           %crsinfo =
                               &Apache::lonnet::courseiddump($dom,'.',1,'.','.',
                                                    $crs,undef,undef,'.');
                           $chome = &Apache::lonnet::homeserver($crs,$dom);
                       }
                   }
                 if ($name eq 'description' && defined($value)) {                  if ($name eq 'description' && defined($value)) {
                     my %crsinfo =                       &Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.description' => $value});
                         &Apache::lonnet::courseiddump($dom,'.',1,'.','.',  
                                                  $crs,undef,undef,'Course');  
                     &Apache::lonnet::appenv('course.'.$env{'request.course.id'}.'.description' => $value);  
                     if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') {                      if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') {
                         $crsinfo{$env{'request.course.id'}}{'description'} = $value;                           $crsinfo{$env{'request.course.id'}}{'description'} = $value; 
                         my $chome = &Apache::lonnet::homeserver($crs,$dom);                          my $putresult =
                               &Apache::lonnet::courseidput($dom,\%crsinfo,
                                                            $chome,'notime');
                       }
                   }
                   if (($name eq 'cloners') || ($name eq 'hidefromcat') || ($name eq 'categories')) {
                       if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') {
                           &Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.'.$name => $value});
                           $crsinfo{$env{'request.course.id'}}{$name} = $value;
                         my $putresult =                          my $putresult =
                             &Apache::lonnet::courseidput($dom,\%crsinfo,                              &Apache::lonnet::courseidput($dom,\%crsinfo,
                                                          $chome,'notime');                                                           $chome,'notime');
Line 2188  sub crsenv { Line 2406  sub crsenv {
     my $SelectStyleFile=&mt('Select Style File');      my $SelectStyleFile=&mt('Select Style File');
     my $SelectSpreadsheetFile=&mt('Select Spreadsheet File');      my $SelectSpreadsheetFile=&mt('Select Spreadsheet File');
     my $output='';      my $output='';
       my $can_categorize;
     if (! exists($values{'con_lost'})) {      if (! exists($values{'con_lost'})) {
         my %descriptions=          my %descriptions=
     ('url'            => '<b>'.&mt('Top Level Map').'</b> '.      ('url'            => '<b>'.&mt('Top Level Map').'</b><br />'.
                                  '<a href="javascript:openbrowser'.                                   '<a href="javascript:openbrowser'.
                                  "('envform','url','sequence')\">".                                   "('envform','url','sequence')\">".
                                  &mt('Select Map').'</a><br /><span class="LC_warning"> '.                                   &mt('Select Map').'</a><br /><span class="LC_warning"> '.
                                  &mt('Modification may make assessment data inaccessible').                                   &mt('Modification may make assessment data inaccessible!').
                                  '</span>',                                   '</span>',
              'description'    => '<b>'.&mt('Course Description').'</b>',               'description'    => '<b>'.&mt('Course Description').'</b>',
              'courseid'       => '<b>'.&mt('Course ID or number').               'courseid'       => '<b>'.&mt('Course ID or number').
                                  '</b><br />'.                                   '</b><br />'.
                                  '('.&mt('internal').', '.&mt('optional').')',                                   '('.&mt('internal, optional').')',
              'cloners'        => '<b>'.&mt('Users allowed to clone course').'</b><br /><tt>(user:domain,user:domain,*:domain)</tt><br />'.&mt('Users with active Course Coordinator role in course are permitted to clone and need not be included.<br />               'cloners'        => '<b>'.&mt('Users allowed to clone course').'</b><br />'
 Use *:domain to allow course to be cloned by anyone in the specified domain.<br />                                  .'("<tt>'.&mt('user:domain,user:domain,*:domain').'</tt>")<br />'
 Use * to allow unrestricted cloning in all domains.'),                                  .&mt('Users with active Course Coordinator role in this course are permitted to clone and need not be included.').'<br />'
                                   .&mt('Use [_1] to allow course to be cloned by anyone in the specified domain.','"<tt>*:domain</tt>"').'<br />'
                                   .&mt('Use [_1] to allow unrestricted cloning in all domains.','"<tt>*</tt>"'),
              'grading'        => '<b>'.&mt('Grading').'</b><br />'.               'grading'        => '<b>'.&mt('Grading').'</b><br />'.
                                  '<tt>"standard", "external", or "spreadsheet"</tt> '.&Apache::loncommon::help_open_topic('GradingOptions'),                                   &mt('[_1], [_2], or [_3]','"<tt>standard</tt>"','"<tt>external</tt>"','"<tt>spreadsheet</tt>"').&Apache::loncommon::help_open_topic('GradingOptions'),
      'task_grading'   => '<b>'.&mt('Bridge Task Grading').'</b><br />'.       'task_grading'   => '<b>'.&mt('Bridge Task Grading').'</b><br />'
                                  &mt('Instructors and TAs in sections, when grading bridge tasks, should be allowed to grade other sections, "[_1]" they are allowed (this is the default), "[_2]" no, they can only grade their own section','<tt>any</tt>','<tt>section</tt>'),                                  .&mt('Instructors and TAs in sections, when grading bridge tasks, should be allowed to grade other sections.').'<br />'
              'default_xml_style' => '<b>'.&mt('Default XML Style File').'</b> '.                                  .'('.&mt('[_1]: they are allowed (this is the default). [_2]: no, they can only grade their own section.','"<tt>any</tt>"','"<tt>section</tt>"').')',
                'default_xml_style' => '<b>'.&mt('Default XML Style File').'</b><br />'.
                     '<a href="javascript:openbrowser'.                      '<a href="javascript:openbrowser'.
                     "('envform','default_xml_style'".                      "('envform','default_xml_style'".
                     ",'sty')\">$SelectStyleFile</a><br />",                      ",'sty')\">$SelectStyleFile</a><br />",
              'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question').               'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question').'</b><br />'
                                  '</b><br />(<tt>user:domain,'.                                  .'("<tt>'.&mt('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>',
              'question.email.text' => '<b>'.&mt('Custom Text for Resource Content Question Option in Feedback').               'comment.email'  => '<b>'.&mt('Feedback Addresses for Course Content Comments').'</b><br />'
                                  '</b>',                                  .'("<tt>'.&mt('user:domain,user:domain(section;section;...;*;...),...').'</tt>")',
              'comment.email'  => '<b>'.&mt('Feedback Addresses for Course Content Comments').'</b><br />'.               'comment.email.text' => '<b>'.&mt('Custom Text for Course Content Option in Feedback').'</b>',
                                  '(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)',               'policy.email'   => '<b>'.&mt('Feedback Addresses for Course Policy').'</b><br />'
              'comment.email.text' => '<b>'.&mt('Custom Text for Course Content Option in Feedback').                                   .'("<tt>'.&mt('user:domain,user:domain(section;section;...;*;...),...').'</tt>")',
                                  '</b>',               'policy.email.text' => '<b>'.&mt('Custom Text for Course Policy Option in Feedback').'</b>',
              'policy.email'   => '<b>'.&mt('Feedback Addresses for Course Policy').'</b>'.               'hideemptyrows'  => '<b>'.&mt('Hide Empty Rows in Spreadsheets').'</b><br />'
                                  '<br />(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)',                                  .'('.&mt('[_1] for default hiding','"<tt>yes</tt>"').')',
              'policy.email.text' => '<b>'.&mt('Custom Text for Course Policy Option in Feedback').               'pageseparators'  => '<b>'.&mt('Visibly Separate Items on Pages').'</b><br />'
                                  '</b>',                                   .'('.&mt('[_1] for visible separation.','"<tt>yes</tt>"').' '
              'hideemptyrows'  => '<b>'.&mt('Hide Empty Rows in Spreadsheets').'</b><br />'.                                   .&mt('Changes will not show until next login.').')',
                                  '('.&mt('"[_1]" for default hiding','<tt>yes</tt>').')',               'student_classlist_view' => '<b>'.&mt('Allow students to view classlist.').'</b><br />'
              'pageseparators'  => '<b>'.&mt('Visibly Separate Items on Pages').'</b><br />'.                                          .'('.&mt('[_1]: students can view all sections. [_2]: students can only view their own section. blank or [_3] prevents student view.','"<tt>all</tt>"','"<tt>section</tt>"','"<tt>disabled</tt>"').')',
                                  '('.&mt('"[_1]" for visible separation','<tt>yes</tt>').', '.               'student_classlist_portfiles' => '<b>'.&mt('Include link to accessible portfolio files').'</b><br />'
                                  &mt('changes will not show until next login').')',                                               .'('.&mt('[_1] for link to each a listing of each student\'s files.','"<tt>yes</tt>"').')',
              'student_classlist_view' => '<b>'.&mt('Allow students to view classlist.').'</b><br />'.&mt('("all":students can view all sections,"section":students can only view their own section.blank or "disabled" prevents student view.)'),               'student_classlist_opt_in' => '<b>'.&mt("Student's agreement needed for listing in student-viewable roster").'</b><br />'
              'student_classlist_portfiles' => '<b>'.&mt('Include link to accessible portfolio files').'</b><br />'.&mt('"[_1]" for link to each a listing of each student\'s files.','<tt>yes</tt>'),                                             .'('.&mt('[_1] to require students to opt-in to listing in the roster (on the roster page).','"<tt>yes</tt>"').')',
              'student_classlist_opt_in' => '<b>'.&mt("Student's agreement needed for listing in student-viewable roster").'</b><br />'.&mt('"[_1]" to require students to opt-in to listing in the roster (on the roster page).','<tt>yes</tt>'),               'plc.roles.denied'=> '<b>'.&mt('Disallow live chatroom use for Roles').'</b><br />'
              'plc.roles.denied'=> '<b>'.&mt('Disallow live chatroom use for Roles').                                   .'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"<tt>st</tt>"','"<tt>ta</tt>"','"<tt>in</tt>"').')<br />'
                                   '</b><br />("<tt>st</tt>": '.                                   .'("<tt>'.&mt('role,role,...').'</tt>") '
                                   &mt('student').', "<tt>ta</tt>": '.                           .Apache::loncommon::help_open_topic("Course_Disable_Discussion"),
                                   'TA, "<tt>in</tt>": '.  
                                   &mt('instructor').';<br /><tt>'.&mt('role,role,...').'</tt>) '.  
        Apache::loncommon::help_open_topic("Course_Disable_Discussion"),  
              'plc.users.denied' =>                'plc.users.denied' => 
                           '<b>'.&mt('Disallow live chatroom use for Users').'</b><br />'.                            '<b>'.&mt('Disallow live chatroom use for Users').'</b><br />'.
                                  '(<tt>user:domain,user:domain,...</tt>)',                                    '("<tt>'.&mt('user:domain,user:domain,...').'</tt>")',
   
              'pch.roles.denied'=> '<b>'.&mt('Disallow Resource Discussion for Roles').               'pch.roles.denied'=> '<b>'.&mt('Disallow Resource Discussion for Roles').'</b><br />'
                                   '</b><br />("<tt>st</tt>": '.                                   .'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"<tt>st</tt>"','"<tt>ta</tt>"','"<tt>in</tt>"')
                                   'student, "<tt>ta</tt>": '.                                   .'("<tt>'.&mt('role,role,...').'</tt>") '
                                   'TA, "<tt>in</tt>": '.                                   .Apache::loncommon::help_open_topic("Course_Disable_Discussion"),
                                   'instructor;<br /><tt>role,role,...</tt>) '.  
        Apache::loncommon::help_open_topic("Course_Disable_Discussion"),  
              'pch.users.denied' =>                'pch.users.denied' => 
                           '<b>'.&mt('Disallow Resource Discussion for Users').'</b><br />'.                            '<b>'.&mt('Disallow Resource Discussion for Users').'</b><br />'.
                                  '(<tt>user:domain,user:domain,...</tt>)',                                   '("<tt>'.&mt('user:domain,user:domain,...').'</tt>")',
              'spreadsheet_default_classcalc'                'spreadsheet_default_classcalc' 
                  => '<b>'.&mt('Default Course Spreadsheet').'</b> '.                   => '<b>'.&mt('Default Course Spreadsheet').'</b> '.
                     '<a href="javascript:openbrowser'.                      '<a href="javascript:openbrowser'.
                     "('envform','spreadsheet_default_classcalc'".                      "('envform','spreadsheet_default_classcalc'".
                     ",'spreadsheet')\">$SelectSpreadsheetFile</a><br />",                      ",'spreadsheet')\">$SelectSpreadsheetFile</a><br />",
              'spreadsheet_default_studentcalc'                'spreadsheet_default_studentcalc' 
                  => '<b>'.&mt('Default Student Spreadsheet').'</b> '.                   => '<b>'.&mt('Default Student Spreadsheet').'</b><br />'.
                     '<a href="javascript:openbrowser'.                      '<a href="javascript:openbrowser'.
                     "('envform','spreadsheet_default_calc'".                      "('envform','spreadsheet_default_calc'".
                     ",'spreadsheet')\">$SelectSpreadsheetFile</a><br />",                      ",'spreadsheet')\">$SelectSpreadsheetFile</a><br />",
Line 2268  Use * to allow unrestricted cloning in a Line 2485  Use * to allow unrestricted cloning in a
                     ",'spreadsheet')\">$SelectSpreadsheetFile</a><br />",                      ",'spreadsheet')\">$SelectSpreadsheetFile</a><br />",
      'allow_limited_html_in_feedback'       'allow_limited_html_in_feedback'
          => '<b>'.&mt('Allow limited HTML in discussion posts').'</b><br />'.           => '<b>'.&mt('Allow limited HTML in discussion posts').'</b><br />'.
             '('.&mt('Set value to "[_1]" to allow',"<tt>yes</tt>").')',              '('.&mt('Set value to [_1] to allow.','"<tt>yes</tt>"').')',
              'allow_discussion_post_editing'               'allow_discussion_post_editing'
                  => '<b>'.&mt('Allow users with specified roles to edit/delete their own discussion posts').'</b><br />"<tt>st</tt>": '.                   => '<b>'.&mt('Allow users with specified roles to edit/delete their own discussion posts').'</b><br />'
                                   &mt('student').', "<tt>ta</tt>": '.                     .'('.&mt('[_1]: student, [_2]: TA, [_3]: instructor','"<tt>st</tt>"','"<tt>ta</tt>"','"<tt>in</tt>"').')<br />'
                                   'TA, "<tt>in</tt>": '.                     .'('.&mt('Set value to [_1] to allow all roles.','"<tt>yes</tt>"').')'
                                   &mt('instructor').';&nbsp;(<tt>'.&mt('role:section,role:section,..., e.g., st:001,st:002,in,cc would permit students in sections 001 and 002 and instructors in any section, and course coordinators to edit their own posts.').'</tt>)<br />'.                     .'("<tt>'.&mt('role:section,role:section,...').'</tt>")<br />'
                     '('.&mt('or set value to "[_1]" to allow all roles',"<tt>yes</tt>").')',                     .'('.&mt('Example: "<tt>st:001,st:002,in,cc</tt>" would permit students in sections 001 and 002 and instructors in any section, and course coordinators to edit their own posts.').')',
      'rndseed'       'rndseed'
          => '<b>'.&mt('Randomization algorithm used').'</b> <br />'.           => '<b>'.&mt('Randomization algorithm used').'</b><br />'
                     '<span class="LC_error">'.&mt('Modifying this will make problems').' '.                     .'<span class="LC_error">'
                     &mt('have different numbers and answers').'</span>',                     .&mt('Modifying this will make problems have different numbers and answers!')
                      .'</span>',
      'receiptalg'       'receiptalg'
          => '<b>'.&mt('Receipt algorithm used').'</b> <br />'.           => '<b>'.&mt('Receipt algorithm used').'</b> <br />'.
                     &mt('This controls how receipt numbers are generated.'),                      &mt('This controls how receipt numbers are generated.'),
              'suppress_tries'               'suppress_tries'
                  => '<b>'.&mt('Suppress number of tries in printing').'</b><br />'.                   => '<b>'.&mt('Suppress number of tries in printing').'</b><br />'.
                     ' ('.&mt('"[_1]" to suppress, anything else to not suppress','<tt>yes</tt>').')',                      ' ('.&mt('[_1] to suppress, anything else to not suppress','"<tt>yes</tt>"').')',
              'problem_stream_switch'               'problem_stream_switch'
                  => '<b>'.&mt('Allow problems to be split over pages').'</b><br />'.                   => '<b>'.&mt('Allow problems to be split over pages').'</b><br />'.
                     ' ('.&mt('"[_1]" if allowed, anything else if not','<tt>yes</tt>').')',                      ' ('.&mt('[_1] if allowed, anything else if not','"<tt>yes</tt>"').')',
              'default_paper_size'                'default_paper_size' 
                  => '<b>'.&mt('Default paper type').'</b><br />'.                   => '<b>'.&mt('Default paper type').'</b><br />'.
                     ' ('.&mt('supported types').': Letter [8 1/2x11 in], Legal [8 1/2x14 in],'.                       ' ('.&mt('supported types').': Letter [8 1/2x11 in], Legal [8 1/2x14 in],'. 
                     ' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'.                       ' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'. 
                     ' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])',                      ' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])',
      'print_header_format'       'print_header_format'
          => &mtn('<b> Print header format; substitutions </b>:  %n student name %c course id %a assignment note, numbers after the % limit the field size.').'</b>',           => ' <b>'.&mt('Print header format').'</b><br />'
                      .&mt('Substitutions:<br />[_1]: student name, [_2]: course id, [_3]: assignment note. Numbers after the <tt>%</tt> limit the field size.','"<tt>%n</tt>"','"<tt>%c</tt>"','"<tt>%a</tt>"'),
              'default_enrollment_start_date' => '<b>'.&mt('Default beginning date for student access.').'</b>',               'default_enrollment_start_date' => '<b>'.&mt('Default beginning date for student access.').'</b>',
              'default_enrollment_end_date'   => '<b>'.&mt('Default ending date for student access.').'</b>',               'default_enrollment_end_date'   => '<b>'.&mt('Default ending date for student access.').'</b>',
              'nothideprivileged'   => '<b>'.&mt('Privileged users that should not be hidden on staff listings').'</b>'.               'nothideprivileged'   => '<b>'.&mt('Privileged users that should not be hidden on staff listings').'</b><br />'
                                  '<br />(<tt>user:domain,user:domain,...</tt>)',                                       .'("<tt>'.&mt('user:domain,user:domain,*:domain').'</tt>")',
              'languages' => '<b>'.&mt('Languages used').'</b>',               'languages' => '<b>'.&mt('Languages used').'</b>',
              'disable_receipt_display'               'disable_receipt_display'
                  => '<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').'</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>').')',           => '<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 2317  Use * to allow unrestricted cloning in a Line 2536  Use * to allow unrestricted cloning in a
          => '<b>'.&mt('Default set of options to pass to tth/m when converting tex').'</b>',           => '<b>'.&mt('Default set of options to pass to tth/m when converting tex').'</b>',
   
      'texengine'       'texengine'
          => '<b>'.&mt('Force all students in the course to use a specific math rendering engine.').'</b><br />'.&mt('(Valid options are [_1].)','"tth", "jsMath", "mimetex"').'</b>',           => '<b>'.&mt('Force all students in the course to use a specific math rendering engine.').'</b><br />'
              );                      .'('.&mt('[_1], [_2] (Convert to Images), [_3] (TeX to HTML), or blank for student\'s preference','"<tt>jsMath</tt>"','"<tt>mimetex</tt>"','"<tt>tth</tt>"').')',
         my @Display_Order = ('url','description','courseid','cloners','grading',               'timezone'
                    => '<b>'.&mt('Timezone in which the course takes place').'</b>',
   
                'suppress_embed_prompt'
                    => '<b>'.&mt('Suppress prompt to upload items referenced in a web page being uploaded to portfolio, when current role is student.').'</b><br />'.
                       ' ('.&mt('[_1] to suppress, anything else to not suppress','"<tt>yes</tt>"').')',
                'hidefromcat'
                    => '<b>'.&mt('Exclude from course catalog').'</b><br />'.
                       ' ('.&mt('[_1] to exclude, anything else to include - included if assigned an institutional code, or manually catagorized','"<tt>yes</tt>"').')',
                'categories'
                    => '<b>'.&mt('Categorize course').'</b> <a href="javascript:catsbrowser()">'.
                       &mt('Display Categories').'</a>',
                'datelocale' 
                    => '<b>'.&mt('Locale used for course calendar').'</b>',
                );
           my @Display_Order = ('url','description','courseid','cloners');
           (my $can_toggle_cat,$can_categorize) = &can_modify_catsettings($dom);
           if ($can_toggle_cat) {
               push(@Display_Order,'hidefromcat');
           }
           if ($can_categorize) {
               push(@Display_Order,'categories');
           }
           push (@Display_Order,('grading',
                              'externalsyllabus',                               'externalsyllabus',
                              'default_xml_style','pageseparators',                               'default_xml_style','pageseparators',
                              'question.email','question.email.text','comment.email','comment.email.text','policy.email','policy.email.text',                               'question.email','question.email.text','comment.email',
                                'comment.email.text','policy.email','policy.email.text',
                              'student_classlist_view',                               'student_classlist_view',
                              'student_classlist_opt_in',                               'student_classlist_opt_in',
                              'student_classlist_portfiles',                               'student_classlist_portfiles',
Line 2331  Use * to allow unrestricted cloning in a Line 2574  Use * to allow unrestricted cloning in a
                              'allow_limited_html_in_feedback',                               'allow_limited_html_in_feedback',
                              'allow_discussion_post_editing',                               'allow_discussion_post_editing',
                              'languages',                               'languages',
                                'timezone',
                                'datelocale',
      'nothideprivileged',       'nothideprivileged',
                              'rndseed',                               'rndseed',
                              'receiptalg',                               'receiptalg',
                              'problem_stream_switch',                               'problem_stream_switch',
      'suppress_tries',       'suppress_tries',
                                'suppress_embed_prompt',
                              'default_paper_size',                               'default_paper_size',
      'print_header_format',       'print_header_format',
                              'disable_receipt_display',                               'disable_receipt_display',
Line 2349  Use * to allow unrestricted cloning in a Line 2595  Use * to allow unrestricted cloning in a
      'texengine',       'texengine',
      'disablesigfigs',       'disablesigfigs',
      'disableexampointprint',       'disableexampointprint',
      'task_messages','task_grading',       'task_messages','task_grading'));
                              );  
  foreach my $parameter (sort(keys(%values))) {   foreach my $parameter (sort(keys(%values))) {
             unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./)) {              unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./) ||
                       ($parameter =~ m/^selfenroll_/) || ($parameter =~ /_selfenroll$/)
                       || ($parameter eq 'type')) {
                 if (! $descriptions{$parameter}) {                  if (! $descriptions{$parameter}) {
                     $descriptions{$parameter}=$parameter;                      $descriptions{$parameter}=$parameter;
                     push(@Display_Order,$parameter);                      push(@Display_Order,$parameter);
Line 2375  Use * to allow unrestricted cloning in a Line 2622  Use * to allow unrestricted cloning in a
                                                         $values{$parameter},                                                          $values{$parameter},
                                                         $onchange).                                                          $onchange).
                                                         '</td>';                                                          '</td>';
               } elsif ($parameter eq 'timezone') {
                   my $includeempty = 1;
                   my $timezone = &Apache::lonlocal::gettimezone();
                   $output .= '<td>'.
                       &Apache::loncommon::select_timezone($parameter.'_value',
                                                           $timezone,
                                                           $onchange,$includeempty).'</td>';
               } elsif ($parameter eq 'datelocale') {
                   my $includeempty = 1;
                   my $locale_obj = &Apache::lonlocal::getdatelocale();
                   my $currdatelocale;
                   if (ref($locale_obj)) {
                       $currdatelocale = $locale_obj->id();
                   }
                   $output .= '<td>'.
                       &Apache::loncommon::select_datelocale($parameter.'_value',
                                                             $currdatelocale,
                                                             $onchange,$includeempty).'</td>'; 
               } elsif ($parameter eq 'categories') {
                   my $catdisplay;
                   if ($values{'categories'} ne '') {
                       my @curritems = split(/\&/,$values{'categories'});
                       foreach my $item (@curritems) {
                           my ($name,$parent,$pos) = split(/:/,$item);
                           $catdisplay .= &unescape($name).'&';
                       }
                       $catdisplay =~ s/\&$//;
                   } 
                   $output .= '<td>'.
                              '<input type="hidden" name="categories_value" value="'.
                              $values{'categories'}.'" />'.
                              '<input type="textbox" name="categories_display" value="'.
                              $catdisplay.'" readonly="readonly" size="40" /></td>';
             } else {              } else {
                 $output .= '<td>'.                  $output .= '<td>'.
                     &Apache::lonhtmlcommon::textbox($parameter.'_value',                      &Apache::lonhtmlcommon::textbox($parameter.'_value',
Line 2401  Use * to allow unrestricted cloning in a Line 2681  Use * to allow unrestricted cloning in a
     my %lt=&Apache::lonlocal::texthash(      my %lt=&Apache::lonlocal::texthash(
     'par'   => 'Parameter',      'par'   => 'Parameter',
     'val'   => 'Value',      'val'   => 'Value',
     'set'   => 'Set',      'set'   => 'Set?',
     'sce'   => 'Set Course Environment'      'sav'   => 'Save'
        );         );
   
     my $Parameter=&mt('Parameter');      my $Parameter=&mt('Parameter');
     my $Value=&mt('Value');      my $Value=&mt('Value');
     my $Set=&mt('Set');      my $Set=&mt('Set');
     my $browse_js=      my ($jscript,$categorize_js);
  '<script type="text/javascript" language="Javascript">'.      my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset');
  &Apache::loncommon::browser_and_searcher_javascript('parmset').      if ($can_categorize) {
  '</script>';          $categorize_js = <<ENDSCRIPT;
       function catsbrowser() {
       var catswin = null;
       var url = '/adm/parmset?action=categorizecourse';
       if (!catswin || catswin.closed) {
           catswin=window.open(url,'categorieswin','height=480,width=600,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
       } else {
           catswin.focus();
       }
   } 
   ENDSCRIPT
       }
       $jscript = '<script type="text/javascript" language="Javascript">'."\n".
                  $browse_js."\n".$categorize_js."\n".'</script>';
     my $start_page =       my $start_page = 
  &Apache::loncommon::start_page('Set Course Environment',   &Apache::loncommon::start_page('Set Course Environment',
        $browse_js);         $jscript);
     my $end_page =       my $end_page = 
  &Apache::loncommon::end_page();   &Apache::loncommon::end_page();
     my $end_table=&Apache::loncommon::end_data_table();      my $end_table=&Apache::loncommon::end_data_table();
Line 2424  $start_page Line 2716  $start_page
 $breadcrumbs  $breadcrumbs
 <form method="post" action="/adm/parmset?action=crsenv" name="envform">  <form method="post" action="/adm/parmset?action=crsenv" name="envform">
 $setoutput  $setoutput
   <div><input type="submit" name="crsenv" value="$lt{'sav'}" /></div>
 $start_table  $start_table
 $start_header_row  $start_header_row
 <th>$lt{'par'}</th><th>$lt{'val'}</th><th>$lt{'set'}?</th>  <th>$lt{'par'}</th><th>$lt{'val'}</th><th>$lt{'set'}</th>
 $end_header_row  $end_header_row
 $output  $output
 $end_table  $end_table
 <input type="submit" name="crsenv" value="$lt{'sce'}" />  <input type="submit" name="crsenv" value="$lt{'sav'}" />
 </form>  </form>
 $end_page  $end_page
 ENDENV  ENDENV
 }  }
   
   sub can_modify_catsettings {
       my ($dom) = @_;
       my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom);
       my ($can_toggle_cat,$can_categorize);
       if (ref($domconf{'coursecategories'}) eq 'HASH') {
           if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') {
               $can_toggle_cat = 1;
           }
           if ($domconf{'coursecategories'}{'categorize'} eq 'crs') {
               $can_categorize = 1;
           }
       }
       return ($can_toggle_cat,$can_categorize);
   }
   
   sub assign_course_categories {
       my ($r) = @_;
       my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
       my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
       my $hascats = 0;
       my $cathash;
       my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$cdom);
       if (ref($domconf{'coursecategories'}) eq 'HASH') {
           $cathash = $domconf{'coursecategories'}{'cats'};
           if (ref($cathash) eq 'HASH') {
               $hascats = 1;   
           }
       }
       my $catwin_js;
       if ($hascats) {
           my $alert = &mt('Use \"Save\" in the main window to save course categories');
           $catwin_js = <<ENDSCRIPT;
   <script type="text/javascript">
   
   function updateCategories() {
       var newcategories = '';
       var unescapedcats = '';
       if (document.chgcats.usecategory.length) {
           for (var i=0; i<document.chgcats.usecategory.length; i++) {
               if (document.chgcats.usecategory[i].checked == true) {
                   newcategories = newcategories + document.chgcats.usecategory[i].value + '&';
                   unescapedcats = unescapedcats + document.chgcats.catname[i].value + ' & ';
               }
           }
           if (newcategories.length > 0) {
               newcategories = newcategories.slice(0,-1);
           }
           if (unescapedcats.length > 0) {
               unescapedcats = unescapedcats.slice(0,-3);
           }
       } else {
            if (document.chgcats.usecategory.checked == true) {
                newcategories = document.chgcats.usecategory.value;
                unescapedcats = document.chgcats.catname.value;
            }
       }
       opener.document.envform.categories_value.value = newcategories;
       opener.document.envform.categories_display.value = unescapedcats;
       opener.document.envform.categories_setparmval.checked = true;
       alert("$alert");
       self.close();
       return;
   }
   
   </script>
   ENDSCRIPT
       } else {
           my $onload; 
       }
       my $start_page =
           &Apache::loncommon::start_page('Course Categories',$catwin_js,
                                          {'only_body'      => 1,});
       my $end_page = &Apache::loncommon::end_page();
       my $categoriesform = '<h3>'.&mt('Categorize Course').'</h3>';
       if ($hascats) {
           my %currsettings =
               &Apache::lonnet::get('environment',['hidefromcat','categories'],$cdom,$cnum);
           $categoriesform .= &mt('Assign one or more categories to this course.').'<br /><br />'.
                                  '<form name="chgcats" action="/adm/parmset" method="post">'."\n"
                                  .&Apache::loncommon::assign_categories_table($cathash,
                                                          $currsettings{'categories'})."\n"
                                  .'<br /><input type="button" name="changes" value="'
                                  .&mt('Copy to main window').'" '
                                  .'onclick="javascript:updateCategories()" /></form><br />';
       } else {
           $categoriesform .= &mt('No categories defined for this domain');
       }
       $r->print($start_page.$categoriesform.$end_page);
       return;
   }
   
 ##################################################  ##################################################
 # Overview mode  # Overview mode
 ##################################################  ##################################################
Line 2599  sub parse_listdata_key { Line 2984  sub parse_listdata_key {
  $realm=~s/\.type//;   $realm=~s/\.type//;
     }      }
     # split into resource+part and parameter name      # split into resource+part and parameter name
     my ($res, $parm) = ($realm=~/^(.*)\.(.*)$/);      my ($res,    $parm) = ($realm=~/^(.*)\.(.*)$/);
     my ($res, $part) = ($res  =~/^(.*)\.(.*)$/);         ($res, my $part) = ($res  =~/^(.*)\.(.*)$/);
     return ($student,$res,$part,$parm);      return ($student,$res,$part,$parm);
 }  }
   
Line 2729  sub listdata { Line 3114  sub listdata {
       $$resourcedata{$thiskey},        $$resourcedata{$thiskey},
       '',1,'','').        '',1,'','').
 '<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'.  '<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'.
   (($$resourcedata{$thiskey}!=0)?'<span class="LC_nobreak"><a href="/adm/parmset?&action=dateshift1&timebase='.$$resourcedata{$thiskey}.'">'.
   &mt('Shift all dates based on this date').'</a></span>':'').
 &date_sanity_info($$resourcedata{$thiskey})  &date_sanity_info($$resourcedata{$thiskey})
   );    );
     } elsif ($thistype eq 'date_interval') {      } elsif ($thistype eq 'date_interval') {
Line 2798  my %strings = Line 3185  my %strings =
  [ 'no', 'No' ]],   [ 'no', 'No' ]],
      'string_problemstatus'       'string_problemstatus'
              => [[ 'yes', 'Yes' ],               => [[ 'yes', 'Yes' ],
  [ 'answer', 'Yes, and show correct answer if they exceed the maxium number of tries.' ],   [ 'answer', 'Yes, and show correct answer if they exceed the maximum number of tries.' ],
  [ 'no', 'No, don\'t show correct/incorrect feedback.' ],   [ 'no', 'No, don\'t show correct/incorrect feedback.' ],
  [ 'no_feedback_ever', 'No, show no feedback at all.' ]],   [ 'no_feedback_ever', 'No, show no feedback at all.' ]],
      );       );
Line 2824  sub string_selector { Line 3211  sub string_selector {
     return $result;      return $result;
 }  }
   
   #
   # Shift all start and end dates by $shift
   #
   
   sub dateshift {
       my ($shift)=@_;
       my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
       my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
       my %data=&Apache::lonnet::dump('resourcedata',$dom,$crs);
   # ugly retro fix for broken version of types
       foreach my $key (keys %data) {
           if ($key=~/\wtype$/) {
               my $newkey=$key;
               $newkey=~s/type$/\.type/;
               $data{$newkey}=$data{$key};
               delete $data{$key};
           }
       }
       my %storecontent=();
   # go through all parameters and look for dates
       foreach my $key (keys %data) {
          if ($data{$key.'.type'}=~/^date_(start|end)$/) {
             my $newdate=$data{$key}+$shift;
             $storecontent{$key}=$newdate;
          }
       }
       my $reply=&Apache::lonnet::cput
                   ('resourcedata',\%storecontent,$dom,$crs);
       if ($reply eq 'ok') {
          &log_parmset(\%storecontent);
       }
       &Apache::lonnet::devalidatecourseresdata($crs,$dom);
       return $reply;
   }
   
 sub newoverview {  sub newoverview {
     my ($r) = @_;      my ($r) = @_;
   
     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'};
       &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
       text=>"Overview Mode"});
     my $start_page = &Apache::loncommon::start_page('Set Parameters');      my $start_page = &Apache::loncommon::start_page('Set Parameters');
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview');      my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview');
     $r->print(<<ENDOVER);      $r->print(<<ENDOVER);
Line 2989  sub overview { Line 3413  sub overview {
     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'};
   
       &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
    text=>"Overview Mode"});
     my $start_page=&Apache::loncommon::start_page('Modify Parameters');      my $start_page=&Apache::loncommon::start_page('Modify Parameters');
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview');      my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview');
     $r->print(<<ENDOVER);      $r->print(<<ENDOVER);
Line 3023  sub clean_parameters { Line 3449  sub clean_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'};
   
       &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=cleanparameters',
       text=>"Clean Parameters"});
     my $start_page=&Apache::loncommon::start_page('Clean Parameters');      my $start_page=&Apache::loncommon::start_page('Clean Parameters');
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Clean');      my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Clean');
     $r->print(<<ENDOVER);      $r->print(<<ENDOVER);
Line 3043  ENDOVER Line 3471  ENDOVER
     $r->print('<h3>'.      $r->print('<h3>'.
       &mt('These parameters refer to resources that do not exist.').        &mt('These parameters refer to resources that do not exist.').
       '</h3>'.        '</h3>'.
       '<input type="submit" value="'.&mt('Delete Checked Parameters').'" />'.'<br />'.        '<input type="submit" value="'.&mt('Delete Selected').'" />'.'<br />'.
       '<br />');        '<br />');
     $r->print(&Apache::loncommon::start_data_table().      $r->print(&Apache::loncommon::start_data_table().
       '<tr>'.        '<tr>'.
Line 3096  ENDOVER Line 3524  ENDOVER
  }   }
     }      }
     $r->print(&Apache::loncommon::end_data_table().'<p>'.      $r->print(&Apache::loncommon::end_data_table().'<p>'.
       '<input type="submit" value="'.&mt('Delete Checked Parameters').'" />'.        '<input type="submit" value="'.&mt('Delete Selected').'" />'.
       '</p></form>'.        '</p></form>'.
       &Apache::loncommon::end_page());        &Apache::loncommon::end_page());
 }  }
   
   sub date_shift_one {
       my ($r) = @_;
       my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
       my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
   
       &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'},
       text=>"Shifting Dates"});
       my $start_page=&Apache::loncommon::start_page('Shift Dates');
       my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift');
       $r->print(<<ENDOVER);
   $start_page
   $breadcrumbs
   ENDOVER
       $r->print('<form name="shiftform" method="post">'.
                 '<table><tr><td>'.&mt('Currently set date:').'</td><td>'.
                 &Apache::lonlocal::locallocaltime($env{'form.timebase'}).'</td></tr>'.
                 '<tr><td>'.&mt('Shifted date:').'</td><td>'.
                       &Apache::lonhtmlcommon::date_setter('shiftform',
                                                           'timeshifted',
                                                           $env{'form.timebase'},,
                                                           '').
                 '</td></tr></table>'.
                 '<input type="hidden" name="action" value="dateshift2" />'.
                 '<input type="hidden" name="timebase" value="'.$env{'form.timebase'}.'" />'.
                 '<input type="submit" value="'.&mt('Shift all dates accordingly').'" /></form>');
       $r->print(&Apache::loncommon::end_page());
   }
   
   sub date_shift_two {
       my ($r) = @_;
       my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
       my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
       &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'},
       text=>"Shifting Dates"});
       my $start_page=&Apache::loncommon::start_page('Shift Dates');
       my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift');
       $r->print(<<ENDOVER);
   $start_page
   $breadcrumbs
   ENDOVER
       my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted');
       $r->print(&mt('Shifting all dates such that [_1] becomes [_2]',
                 &Apache::lonlocal::locallocaltime($env{'form.timebase'}),
                 &Apache::lonlocal::locallocaltime($timeshifted)));
       my $delta=$timeshifted-$env{'form.timebase'};
       &dateshift($delta);
       $r->print(&Apache::loncommon::end_page());
   }
   
 sub parse_key {  sub parse_key {
     my ($key) = @_;      my ($key) = @_;
     my %data;      my %data;
Line 3140  sub parse_key { Line 3617  sub parse_key {
     return %data;      return %data;
 }  }
   
 ##################################################  
 ##################################################  
   
 =pod  
   
 =item check_cloners  
   
 Checks if new users included in list of allowed cloners  
 are valid users.  Replaces supplied list with   
 cleaned list containing only users with valid usernames  
 and domains.  
   
 Inputs: $clonelist, $oldcloner   
 where $clonelist is ref to array of requested cloners,  
 and $oldcloner is ref to array of currently allowed  
 cloners.  
   
 Returns: string - comma separated list of requested  
 cloners (username:domain) who do not exist in system.  
   
 =item change_clone  
   
 Modifies the list of courses a user can clone (stored  
 in the user's environment.db file), called when a  
 change is made to the list of users allowed to clone  
 a course.  
   
 Inputs: $action,$cloner  
 where $action is add or drop, and $cloner is identity of   
 user for whom cloning ability is to be changed in course.   
   
 =cut  
   
 ##################################################  
 ##################################################  
   
 sub extract_cloners {  sub extract_cloners {
     my ($clonelist,$allowclone) = @_;      my ($clonelist,$allowclone) = @_;
Line 3291  sub change_clone { Line 3734  sub change_clone {
 }  }
   
   
 ##################################################  
 ##################################################  
   
 =pod  
   
 =item * header  
   
 Output html header for page  
   
 =cut  
   
 ##################################################  
 ##################################################  
 sub header {  sub header {
     return &Apache::loncommon::start_page('Parameter Manager');      return &Apache::loncommon::start_page('Parameter Manager');
 }  }
 ##################################################  
 ##################################################  
   
 sub print_main_menu {  sub print_main_menu {
     my ($r,$parm_permission)=@_;      my ($r,$parm_permission)=@_;
     #      #
       $r->print(&header());
       $r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Manager'));
     $r->print(<<ENDMAINFORMHEAD);      $r->print(<<ENDMAINFORMHEAD);
 <form method="post" enctype="multipart/form-data"  <form method="post" enctype="multipart/form-data"
       action="/adm/parmset" name="studentform">        action="/adm/parmset" name="studentform">
Line 3322  ENDMAINFORMHEAD Line 3756  ENDMAINFORMHEAD
     my $vgr  = &Apache::lonnet::allowed('vgr',$env{'request.course.id'});      my $vgr  = &Apache::lonnet::allowed('vgr',$env{'request.course.id'});
     my $mgr  = &Apache::lonnet::allowed('mgr',$env{'request.course.id'});      my $mgr  = &Apache::lonnet::allowed('mgr',$env{'request.course.id'});
   
   
     my @menu =      my @menu =
         ( { divider=>'Settings for Your Course',          ( { categorytitle=>'Settings for this Course',
   },      items => [
           { text => 'Set Course Environment',    { linktext => 'Course Environment',
     action => 'crsenv',      url => '/adm/parmset?action=crsenv',
             permission => $parm_permission,      permission => $parm_permission,
             help => 'Course_Environment',      linktitle =>'Edit environment settings for this course.'  ,
             },      icon => 'preferences-desktop-remote-desktop.png'  ,
           { text => 'Set Portfolio Metadata',      #help => 'Course_Environment',
     action => 'setrestrictmeta',      },
             permission => $parm_permission,    { linktext => 'Portfolio Metadata',
             },      url => '/adm/parmset?action=setrestrictmeta',
   { text => 'Manage Course Slots',      permission => $parm_permission,
     url => '/adm/slotrequest?command=showslots',      linktitle => 'Restrict metadata for this course.' ,
     permission => $vgr,      icon =>'contact-new.png'   ,
             },      },
   { text => 'Reset Student Access Times',    { linktext => 'Manage Course Slots',
     url => '/adm/helper/resettimes.helper',      url => '/adm/slotrequest?command=showslots',
     permission => $mgr,      permission => $vgr,
             },      linktitle =>'Manage slots for this course.'  ,
       icon => 'format-justify-fill.png'  ,
           { text => 'Set Parameter Setting Default Actions',      },
             action => 'setdefaults',    { linktext => 'Reset Student Access Times',
             permission => $parm_permission,      url => '/adm/helper/resettimes.helper',
             },                permission => $mgr,
   { divider => 'New and Existing Parameter Settings for Your Resources',      linktitle =>'Reset access times for folders/maps, resources or the course.'  ,
     },      icon => 'start-here.png'  ,
           { text => 'Set/Modify Resource Parameters - Helper Mode',      },
             url => '/adm/helper/parameter.helper',  
             permission => $parm_permission,    { linktext => 'Set Parameter Setting Default Actions',
             help => 'Parameter_Helper',      url => '/adm/parmset?action=setdefaults',
             },      permission => $parm_permission,
    { text => 'Set/Modify Resource Parameters - Overview Mode',      linktitle =>'Set default actions for parameters.'  ,
             action => 'newoverview',      icon => 'folder-new.png'  ,
             permission => $parm_permission,      }]},          
             help => 'Parameter_Overview',    { categorytitle => 'New and Existing Parameter Settings for Resources',
             },      items => [
           { text => 'Set/Modify Resource Parameters - Table Mode',    { linktext => 'Edit Resource Parameters - Helper Mode',
             action => 'settable',      url => '/adm/helper/parameter.helper',
             permission => $parm_permission,      permission => $parm_permission,
             help => 'Table_Mode',      linktitle =>'Set/Modify resource parameters in helper mode.'  ,
             },      icon => 'dialog-information.png'  ,
            { divider => 'Existing Parameter Settings for Your Resources',      #help => 'Parameter_Helper',
   },      },
   { text => 'Modify Resource Parameters - Overview Mode',    { linktext => 'Edit Resource Parameters - Overview Mode',
             action => 'setoverview',      url => '/adm/parmset?action=newoverview',
             permission => $parm_permission,      permission => $parm_permission,
             help => 'Parameter_Overview',      linktitle =>'Set/Modify resource parameters in overview mode.'  ,
      },                icon => 'edit-find.png'  ,
   { text => 'Parameter Change Log and Course Blog Posting/User Notification',      #help => 'Parameter_Overview',
             action => 'parameterchangelog',      },
             permission => $parm_permission,    { linktext => 'Edit Resource Parameters - Table Mode',
             },      url => '/adm/parmset?action=settable',
       permission => $parm_permission,
       linktitle =>'Set/Modify resource parameters in table mode.'  ,
       icon => 'edit-copy.png'  ,
       #help => 'Table_Mode',
       }]},
              { categorytitle => 'Existing Parameter Settings for Resources',
        items => [
     { linktext => 'Modify Resource Parameters - Overview Mode',
       url => '/adm/parmset?action=setoverview',
       permission => $parm_permission,
       linktitle =>'Set/Modify existing resource parameters in overview mode.'  ,
       icon => 'preferences-desktop-wallpaper.png'  ,
       #help => 'Parameter_Overview',
       },          
     { linktext => 'Change Log',
       url => '/adm/parmset?action=parameterchangelog',
       permission => $parm_permission,
       linktitle =>'View parameter and course blog posting/user notification change log.'  ,
       icon => 'emblem-system.png'   ,
       }]}
           );            );
     my $menu_html = '';      $r->print(&Apache::lonhtmlcommon::generate_menu(@menu));
     foreach my $menu_item (@menu) {  
  if ($menu_item->{'divider'}) {  
     $menu_html .= '<h3>'.&mt($menu_item->{'divider'}).'</h3>';  
     next;  
  }  
         next if (! $menu_item->{'permission'});  
         $menu_html.='<p>';  
         $menu_html.='<span class="LC_parm_menu_item">';  
         if (exists($menu_item->{'url'})) {  
             $menu_html.=qq{<a href="$menu_item->{'url'}">};  
         } else {  
             $menu_html.=  
                 qq{<a href="/adm/parmset?action=$menu_item->{'action'}">};  
         }  
         $menu_html.= &mt($menu_item->{'text'}).'</a></span>';  
         if (exists($menu_item->{'help'})) {  
             $menu_html.=  
                 &Apache::loncommon::help_open_topic($menu_item->{'help'});  
         }  
         $menu_html.='</p>'.$/;  
     }  
     $r->print($menu_html);  
     return;      return;
 }  }
 ### Set portfolio metadata  
   
   
 sub output_row {  sub output_row {
     my ($r, $field_name, $field_text, $added_flag) = @_;      my ($r, $field_name, $field_text, $added_flag) = @_;
     my $output;      my $output;
Line 3456  sub output_row { Line 3891  sub output_row {
     }      }
     return ($output);      return ($output);
 }  }
   
   
   
 sub order_meta_fields {  sub order_meta_fields {
     my ($r)=@_;      my ($r)=@_;
     my $idx = 1;      my $idx = 1;
     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'};
     $r->print(&Apache::loncommon::start_page('Order Metadata Fields'));      $r->print(&Apache::loncommon::start_page('Order Metadata Fields'));
       &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata',
       text=>"Add Metadata Field"});
     &Apache::lonhtmlcommon::add_breadcrumb      &Apache::lonhtmlcommon::add_breadcrumb
             ({href=>"/adm/parmset?action=setrestrictmeta",              ({href=>"/adm/parmset?action=setrestrictmeta",
               text=>"Restrict Metadata"},                text=>"Restrict Metadata"},
Line 3501  sub order_meta_fields { Line 3941  sub order_meta_fields {
  my $ordered_fields = join ",", @neworder;   my $ordered_fields = join ",", @neworder;
         my $put_result = &Apache::lonnet::put('environment',          my $put_result = &Apache::lonnet::put('environment',
                            {'metadata.addedorder'=>$ordered_fields},$dom,$crs);                             {'metadata.addedorder'=>$ordered_fields},$dom,$crs);
  &Apache::lonnet::appenv('course.'.$env{'request.course.id'}.'.metadata.addedorder' => $ordered_fields);   &Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.metadata.addedorder' => $ordered_fields});
     }      }
     my $fields = &get_added_meta_fieldnames($env{'request.course.id'});      my $fields = &get_added_meta_fieldnames($env{'request.course.id'});
     my $ordered_fields;      my $ordered_fields;
Line 3538  sub order_meta_fields { Line 3978  sub order_meta_fields {
     $r->print('</table>');      $r->print('</table>');
     return 'ok';      return 'ok';
 }  }
   
   
 sub continue {  sub continue {
     my $output;      my $output;
     $output .= '<form action="" method="post">';      $output .= '<form action="" method="post">';
Line 3545  sub continue { Line 3987  sub continue {
     $output .= '<input type="submit" value="Continue" />';      $output .= '<input type="submit" value="Continue" />';
     return ($output);      return ($output);
 }  }
   
   
 sub addmetafield {  sub addmetafield {
     my ($r)=@_;      my ($r)=@_;
       &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata',
       text=>"Add Metadata Field"});
     $r->print(&Apache::loncommon::start_page('Add Metadata Field'));      $r->print(&Apache::loncommon::start_page('Add Metadata Field'));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Add Metadata Field'));      $r->print(&Apache::lonhtmlcommon::breadcrumbs('Add Metadata Field'));
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};      my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
Line 3591  sub addmetafield { Line 4037  sub addmetafield {
     }      }
     $r->print('</form>');      $r->print('</form>');
 }  }
   
   
   
 sub setrestrictmeta {  sub setrestrictmeta {
     my ($r)=@_;      my ($r)=@_;
     my $next_meta;      my $next_meta;
     my $output;      my $output;
     my $item_num;      my $item_num;
     my $put_result;      my $put_result;
       &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta',
       text=>"Restrict Metadata"});
     $r->print(&Apache::loncommon::start_page('Restrict Metadata'));      $r->print(&Apache::loncommon::start_page('Restrict Metadata'));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata'));      $r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata'));
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};      my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
Line 3674  ENDenv Line 4125  ENDenv
     $r->print(&Apache::loncommon::end_page());      $r->print(&Apache::loncommon::end_page());
     return 'ok';      return 'ok';
 }  }
 ##################################################  
   
   
 sub get_added_meta_fieldnames {  sub get_added_meta_fieldnames {
     my ($cid) = @_;      my ($cid) = @_;
     my %fields;      my %fields;
Line 3687  sub get_added_meta_fieldnames { Line 4140  sub get_added_meta_fieldnames {
     }      }
     return \%fields;      return \%fields;
 }  }
   
   
   
 sub get_deleted_meta_fieldnames {  sub get_deleted_meta_fieldnames {
     my ($cid) = @_;      my ($cid) = @_;
     my %fields;      my %fields;
Line 3704  sub get_deleted_meta_fieldnames { Line 4160  sub get_deleted_meta_fieldnames {
 sub defaultsetter {  sub defaultsetter {
     my ($r) = @_;      my ($r) = @_;
   
       &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults',
       text=>"Set Defaults"});
     my $start_page =       my $start_page = 
  &Apache::loncommon::start_page('Parameter Setting Default Actions');   &Apache::loncommon::start_page('Parameter Setting Default Actions');
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Defaults');      my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Defaults');
Line 3900  sub components { Line 4358  sub components {
 }  }
   
 my %standard_parms;  my %standard_parms;
   
   
 sub load_parameter_names {  sub load_parameter_names {
     open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab");      open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab");
     while (my $configline=<$config>) {      while (my $configline=<$config>) {
Line 3929  sub standard_parameter_names { Line 4389  sub standard_parameter_names {
     }      }
 }  }
   
 #  
 # Parameter Change Log  
 #  
   
   
 sub parm_change_log {  sub parm_change_log {
     my ($r)=@_;      my ($r)=@_;
       &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable',
    text=>"Parameter Change Log"});
     $r->print(&Apache::loncommon::start_page('Parameter Change Log'));      $r->print(&Apache::loncommon::start_page('Parameter Change Log'));
     $r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Change Log'));      $r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Change Log'));
   
Line 4097  sub check_for_course_info { Line 4556  sub check_for_course_info {
     return 0;      return 0;
 }  }
   
 ##################################################  
 ##################################################  
   
 =pod  
   
 =item * handler  
   
 Main handler.  Calls &assessparms and &crsenv subroutines.  
   
 =cut  
   
 ##################################################  
 ##################################################  
   
 sub handler {  sub handler {
     my $r=shift;      my $r=shift;
   
     &reset_caches();      &reset_caches();
   
     if ($r->header_only) {      &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;  
     }  
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
     ['action','state',      ['action','state',
                                              'pres_marker',                                               'pres_marker',
                                              'pres_value',                                               'pres_value',
                                              'pres_type',                                               'pres_type',
                                              'udom','uname','symb','serial']);                                               'udom','uname','symb','serial','timebase']);
   
   
     &Apache::lonhtmlcommon::clear_breadcrumbs();      &Apache::lonhtmlcommon::clear_breadcrumbs();
Line 4144  sub handler { Line 4589  sub handler {
     my $exists = &check_for_course_info();      my $exists = &check_for_course_info();
   
     if ($env{'request.course.id'} &&  $parm_permission && $exists) {      if ($env{'request.course.id'} &&  $parm_permission && $exists) {
   
         # Start Page  
         &Apache::loncommon::content_type($r,'text/html');  
         $r->send_http_header;  
   
   
         #          #
         # Main switch on form.action and form.state, as appropriate          # Main switch on form.action and form.state, as appropriate
         #          #
Line 4157  sub handler { Line 4596  sub handler {
         #  the table mode          #  the table mode
         if ((($env{'form.command'} eq 'set') && ($env{'form.url'})          if ((($env{'form.command'} eq 'set') && ($env{'form.url'})
      && (!$env{'form.dis'})) || ($env{'form.symb'})) {       && (!$env{'form.dis'})) || ($env{'form.symb'})) {
             &Apache::lonhtmlcommon::add_breadcrumb({help=>'Problem_Parameters',  
     text=>"Problem Parameters"});  
     &assessparms($r);      &assessparms($r);
   
         } elsif (! exists($env{'form.action'})) {          } elsif (! exists($env{'form.action'})) {
             $r->print(&header());  
             $r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Manager'));  
             &print_main_menu($r,$parm_permission);              &print_main_menu($r,$parm_permission);
         } elsif ($env{'form.action'} eq 'crsenv' && $parm_permission) {          } elsif ($env{'form.action'} eq 'crsenv') {
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=crsenv',  
     text=>"Course Environment"});  
             &crsenv($r);               &crsenv($r); 
         } elsif ($env{'form.action'} eq 'setoverview' && $parm_permission) {          } elsif ($env{'form.action'} eq 'setoverview') {
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',  
     text=>"Overview Mode"});  
     &overview($r);      &overview($r);
  } elsif ($env{'form.action'} eq 'addmetadata' && $parm_permission) {   } elsif ($env{'form.action'} eq 'addmetadata') {
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata',  
     text=>"Add Metadata Field"});  
     &addmetafield($r);      &addmetafield($r);
  } elsif ($env{'form.action'} eq 'ordermetadata' && $parm_permission) {   } elsif ($env{'form.action'} eq 'ordermetadata') {
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata',  
     text=>"Add Metadata Field"});  
     &order_meta_fields($r);      &order_meta_fields($r);
         } elsif ($env{'form.action'} eq 'setrestrictmeta' && $parm_permission) {          } elsif ($env{'form.action'} eq 'setrestrictmeta') {
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta',  
     text=>"Restrict Metadata"});  
     &setrestrictmeta($r);      &setrestrictmeta($r);
         } elsif ($env{'form.action'} eq 'newoverview' && $parm_permission) {          } elsif ($env{'form.action'} eq 'newoverview') {
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',  
     text=>"Overview Mode"});  
     &newoverview($r);      &newoverview($r);
         }  elsif ($env{'form.action'} eq 'setdefaults' && $parm_permission) {          } elsif ($env{'form.action'} eq 'setdefaults') {
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults',  
     text=>"Set Defaults"});  
     &defaultsetter($r);      &defaultsetter($r);
  } elsif ($env{'form.action'} eq 'settable' && $parm_permission) {   } elsif ($env{'form.action'} eq 'settable') {
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable',  
     text=>"Table Mode",  
     help => 'Course_Setting_Parameters'});  
     &assessparms($r);      &assessparms($r);
         } elsif ($env{'form.action'} eq 'parameterchangelog' && $parm_permission) {          } elsif ($env{'form.action'} eq 'parameterchangelog') {
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable',  
     text=>"Parameter Change Log"});  
     &parm_change_log($r);      &parm_change_log($r);
         } elsif ($env{'form.action'} eq 'cleanparameters' && $parm_permission) {          } elsif ($env{'form.action'} eq 'cleanparameters') {
             &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=cleanparameters',  
     text=>"Clean Parameters"});  
     &clean_parameters($r);      &clean_parameters($r);
  }                 } elsif ($env{'form.action'} eq 'dateshift1') {
               &date_shift_one($r);
           } elsif ($env{'form.action'} eq 'dateshift2') {
               &date_shift_two($r);
    } elsif ($env{'form.action'} eq 'categorizecourse') {
               &assign_course_categories($r);
           } 
     } else {      } else {
 # ----------------------------- Not in a course, or not allowed to modify parms  # ----------------------------- Not in a course, or not allowed to modify parms
  if ($exists) {   if ($exists) {
Line 4226  sub handler { Line 4645  sub handler {
 1;  1;
 __END__  __END__
   
 =pod  
   
 =back  
   
 =cut  
   
   
   

Removed from v.1.387  
changed lines
  Added in v.1.417


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