Diff for /loncom/interface/domainprefs.pm between versions 1.216 and 1.223

version 1.216, 2013/12/24 19:15:10 version 1.223, 2014/01/08 17:18:11
Line 95  institutional affiliation in the domain Line 95  institutional affiliation in the domain
 but is now also used to manage availability of user tools:   but is now also used to manage availability of user tools: 
 i.e., blogs, aboutme page, and portfolios, and the course request tool,  i.e., blogs, aboutme page, and portfolios, and the course request tool,
 used by course owners to request creation of a course, and to display/store  used by course owners to request creation of a course, and to display/store
 default quota sizes for authoring spaces.  default quota sizes for Authoring Spaces.
   
 Outputs: 1  Outputs: 1
   
Line 334  sub handler { Line 334  sub handler {
                               col2 => ''}],                                col2 => ''}],
                  },                   },
         'requestauthor' =>          'requestauthor' =>
                  {text => 'Request authoring space',                   {text => 'Request Authoring Space',
                   help => 'Domain_Configuration_Request_Author',                    help => 'Domain_Configuration_Request_Author',
                   header => [{col1 => 'User affiliation',                    header => [{col1 => 'User affiliation',
                               col2 => 'Availability/Processing of requests',},                                col2 => 'Availability/Processing of requests',},
Line 420  sub handler { Line 420  sub handler {
     if ($phase eq 'process') {      if ($phase eq 'process') {
         my $result = &Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order,          my $result = &Apache::lonconfigsettings::make_changes($r,$dom,$phase,$context,\@prefs_order,
                                                               \%prefs,\%domconfig,$confname,\@roles);                                                                \%prefs,\%domconfig,$confname,\@roles);
         if (ref($result) eq 'HASH') {          if ((ref($result) eq 'HASH') && (keys(%{$result}))) { 
             $r->rflush();              $r->rflush();
             &devalidate_remote_domconfs($dom,$result);              &devalidate_remote_domconfs($dom,$result);
         }          }
Line 2002  sub print_requestmail { Line 2002  sub print_requestmail {
     if ($action eq 'requestcourses') {      if ($action eq 'requestcourses') {
         $text = &mt('Receive notification of course requests requiring approval');          $text = &mt('Receive notification of course requests requiring approval');
     } else {      } else {
         $text = &mt('Receive notification of authoring space requests requiring approval')          $text = &mt('Receive notification of Authoring Space requests requiring approval')
     }      }
     $datatable = '<tr '.$css_class.'>'.      $datatable = '<tr '.$css_class.'>'.
                  ' <td>'.$text.'</td>'.                   ' <td>'.$text.'</td>'.
Line 2022  sub print_requestmail { Line 2022  sub print_requestmail {
 sub print_studentcode {  sub print_studentcode {
     my ($settings,$rowtotal) = @_;      my ($settings,$rowtotal) = @_;
     my $rownum = 0;       my $rownum = 0; 
     my %choices;      my ($output,%current);
     $choices{'uniquecode'} = &mt('Generate unique six character code as course identifier?');      my @crstypes = ('official','unofficial','community','textbook');
     my @toggles = ('uniquecode');      if (ref($settings->{'uniquecode'}) eq 'HASH') {
     my %defaultchecked = ('uniquecode'  => 'off');          foreach my $type (@crstypes) {
     (my $reports,$rownum) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,              $current{$type} = $settings->{'uniquecode'}{$type};
                                                \%choices,$rownum);          }
     $$rowtotal += $rownum;      }
     return $reports;      $output .= '<tr>'.
                  '<td class="LC_left_item">'.&mt('Generate unique six character code as course identifier?').'</td>'.
                  '<td class="LC_left_item">';
       foreach my $type (@crstypes) {
           my $check = ' ';
           if ($current{$type}) {
               $check = ' checked="checked" ';
           }
           $output .= '<span class="LC_nobreak"><label>'.
                      '<input type="checkbox" name="uniquecode" value="'.$type.'"'.$check.'/>'.
                      &mt($type).'</label></span>'.('&nbsp;'x2).' ';
       }
       $output .= '</td></tr>';
       $$rowtotal ++;
       return $output;
 }  }
   
 sub print_textbookcourses {  sub print_textbookcourses {
Line 2054  sub print_textbookcourses { Line 2068  sub print_textbookcourses {
     my $confname = $dom.'-domainconfig';      my $confname = $dom.'-domainconfig';
     my $switchserver = &check_switchserver($dom,$confname);      my $switchserver = &check_switchserver($dom,$confname);
     my $maxnum = scalar(keys(%ordered));      my $maxnum = scalar(keys(%ordered));
     my $datatable;      my $datatable = &textbookcourses_javascript(\%ordered);
     if (keys(%ordered)) {      if (keys(%ordered)) {
         my @items = sort { $a <=> $b } keys(%ordered);          my @items = sort { $a <=> $b } keys(%ordered);
         for (my $i=0; $i<@items; $i++) {          for (my $i=0; $i<@items; $i++) {
Line 2074  sub print_textbookcourses { Line 2088  sub print_textbookcourses {
                     $imgsrc = '<img src="'.$imagethumb.'" alt="'.&mt('Textbook image').'" />';                      $imgsrc = '<img src="'.$imagethumb.'" alt="'.&mt('Textbook image').'" />';
                 }                  }
             }              }
             my $chgstr = ' onchange="javascript:reorderBooks(this.form,'."'','$key','$i'".');"';              my $chgstr = ' onchange="javascript:reorderBooks(this.form,'."'$key'".');"';
             $datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'              $datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'
                          .'<select name="'.$key.'"'.$chgstr.'>';                           .'<select name="'.$key.'"'.$chgstr.'>';
             for (my $k=0; $k<=$maxnum; $k++) {              for (my $k=0; $k<=$maxnum; $k++) {
Line 2115  sub print_textbookcourses { Line 2129  sub print_textbookcourses {
         }          }
     }      }
     $css_class = $itemcount%2?' class="LC_odd_row"':'';      $css_class = $itemcount%2?' class="LC_odd_row"':'';
     my $chgstr = ' onchange="javascript:reorderBooks(this.form,'."'','addbook_pos','$maxnum'".');"';      my $chgstr = ' onchange="javascript:reorderBooks(this.form,'."'addbook_pos'".');"';
     $datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n".      $datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n".
                   '<input type="hidden" name="book_maxnum" value="'.$maxnum.'" />'."\n".                    '<input type="hidden" name="book_maxnum" value="'.$maxnum.'" />'."\n".
                   '<select name="addbook_pos"'.$chgstr.'>';                    '<select name="addbook_pos"'.$chgstr.'>';
Line 2154  sub print_textbookcourses { Line 2168  sub print_textbookcourses {
     return $datatable;      return $datatable;
 }  }
   
   sub textbookcourses_javascript {
       my ($textbooks) = @_;
       return unless(ref($textbooks) eq 'HASH');
       my $num = scalar(keys(%{$textbooks}));
       my @jsarray;
       foreach my $item (sort {$a <=> $b } (keys(%{$textbooks}))) {
           push(@jsarray,$textbooks->{$item});
       }
       my $jstext = '    var textbooks = Array('."'".join("','",@jsarray)."'".');'."\n";
       return <<"ENDSCRIPT";
   <script type="text/javascript">
   // <![CDATA[
   function reorderBooks(form,item) {
       var changedVal;
   $jstext 
       var newpos = 'addbook_pos';
       var current = new Array;
       var maxh = 1 + $num;
       var current = new Array;
       var newitemVal = form.elements[newpos].options[form.elements[newpos].selectedIndex].value;
       if (item == newpos) {
           changedVal = newitemVal;
       } else {
           changedVal = form.elements[item].options[form.elements[item].selectedIndex].value;
           current[newitemVal] = newpos;
       }
       for (var i=0; i<textbooks.length; i++) {
           var elementName = textbooks[i];
           if (elementName != item) {
               if (form.elements[elementName]) {
                   var currVal = form.elements[elementName].options[form.elements[elementName].selectedIndex].value;
                   current[currVal] = elementName;
               }
           }
       }
       var oldVal;
       for (var j=0; j<maxh; j++) {
           if (current[j] == undefined) {
               oldVal = j;
           }
       }
       if (oldVal < changedVal) {
           for (var k=oldVal+1; k<=changedVal ; k++) {
              var elementName = current[k];
              form.elements[elementName].selectedIndex = form.elements[elementName].selectedIndex - 1;
           }
       } else {
           for (var k=changedVal; k<oldVal; k++) {
               var elementName = current[k];
               form.elements[elementName].selectedIndex = form.elements[elementName].selectedIndex + 1;
           }
       }
       return;
   }
   
   // ]]>
   </script>
   
   ENDSCRIPT
   }
   
 sub print_autoenroll {  sub print_autoenroll {
     my ($dom,$settings,$rowtotal) = @_;      my ($dom,$settings,$rowtotal) = @_;
     my $autorun = &Apache::lonnet::auto_run(undef,$dom),      my $autorun = &Apache::lonnet::auto_run(undef,$dom),
Line 4471  sub print_serverstatuses { Line 4546  sub print_serverstatuses {
 sub serverstatus_pages {  sub serverstatus_pages {
     return ('userstatus','lonstatus','loncron','server-status','codeversions',      return ('userstatus','lonstatus','loncron','server-status','codeversions',
             'checksums','clusterstatus','metadata_keywords','metadata_harvest',              'checksums','clusterstatus','metadata_keywords','metadata_harvest',
             'takeoffline','takeonline','showenv','toggledebug','ping','domconf');              'takeoffline','takeonline','showenv','toggledebug','ping','domconf',
               'uniquecodes');
 }  }
   
 sub coursecategories_javascript {  sub coursecategories_javascript {
Line 6048  sub modify_quotas { Line 6124  sub modify_quotas {
         my @approvalnotify = &Apache::loncommon::get_env_multiple('form.reqapprovalnotify');          my @approvalnotify = &Apache::loncommon::get_env_multiple('form.reqapprovalnotify');
         @approvalnotify = sort(@approvalnotify);          @approvalnotify = sort(@approvalnotify);
         $confhash{'notify'}{'approval'} = join(',',@approvalnotify);          $confhash{'notify'}{'approval'} = join(',',@approvalnotify);
         if ($env{'form.uniquecode'}) {          my @crstypes = ('official','unofficial','community','textbook');
             $confhash{'uniquecode'} = 1;          my @hasuniquecode = &Apache::loncommon::get_env_multiple('form.uniquecode');
         } else {          foreach my $type (@hasuniquecode) {
             $confhash{'uniquecode'} = '';              if (grep(/^\Q$type\E$/,@crstypes)) {
                   $confhash{'uniquecode'}{$type} = 1;
               }
         }          }
         my ($newbook,@allpos);          my ($newbook,@allpos);
         if ($context eq 'requestcourses') {          if ($context eq 'requestcourses') {
Line 6086  sub modify_quotas { Line 6164  sub modify_quotas {
                     $changes{'notify'}{'approval'} = 1;                      $changes{'notify'}{'approval'} = 1;
                 }                  }
             }              }
             if ($domconfig{$action}{'uniquecode'}) {              if (ref($domconfig{$action}{'uniquecode'}) eq 'HASH') {
                 unless ($confhash{'uniquecode'}) {                  if (ref($confhash{'uniquecode'}) eq 'HASH') {
                     $changes{'uniquecode'} = 1;                      foreach my $crstype (keys(%{$domconfig{$action}{'uniquecode'}})) {
                 }                          unless ($confhash{'uniquecode'}{$crstype}) {
             } else {                              $changes{'uniquecode'} = 1;
                 if ($confhash{'uniquecode'}) {                          }
                     $changes{'uniquecode'} = 1;                      }
                 }                      unless ($changes{'uniquecode'}) {
                           foreach my $crstype (keys(%{$confhash{'uniquecode'}})) {
                               unless ($domconfig{$action}{'uniquecode'}{$crstype}) {
                                   $changes{'uniquecode'} = 1;
                               }
                           }
                       }
                  } else {
                      $changes{'uniquecode'} = 1;
                  }
               } elsif (ref($confhash{'uniquecode'}) eq 'HASH') {
                   $changes{'uniquecode'} = 1;
             }              }
             if ($context eq 'requestcourses') {              if ($context eq 'requestcourses') {
                 if (ref($domconfig{$action}{'textbooks'}) eq 'HASH') {                  if (ref($domconfig{$action}{'textbooks'}) eq 'HASH') {
Line 6155  sub modify_quotas { Line 6244  sub modify_quotas {
             if ($confhash{'notify'}{'approval'}) {              if ($confhash{'notify'}{'approval'}) {
                 $changes{'notify'}{'approval'} = 1;                  $changes{'notify'}{'approval'} = 1;
             }              }
             if ($confhash{'uniquecode'}) {              if (ref($confhash{'uniquecode'} eq 'HASH')) {
                 $changes{'uniquecode'} = 1;                  $changes{'uniquecode'} = 1;
             }              }
         }          }
Line 6376  sub modify_quotas { Line 6465  sub modify_quotas {
                     $resulttext .= '</ul></li>';                      $resulttext .= '</ul></li>';
                 }                  }
                 if (ref($changes{'authorquota'}) eq 'HASH') {                  if (ref($changes{'authorquota'}) eq 'HASH') {
                     $resulttext .= '<li>'.&mt('Authoring space default quotas').'<ul>';                      $resulttext .= '<li>'.&mt('Authoring Space default quotas').'<ul>';
                     foreach my $type (@{$types},'default') {                      foreach my $type (@{$types},'default') {
                         if (defined($changes{'authorquota'}{$type})) {                          if (defined($changes{'authorquota'}{$type})) {
                             my $typetitle = $usertypes->{$type};                              my $typetitle = $usertypes->{$type};
Line 6483  sub modify_quotas { Line 6572  sub modify_quotas {
             if ($action eq 'requestcourses') {              if ($action eq 'requestcourses') {
                 my @offon = ('off','on');                  my @offon = ('off','on');
                 if ($changes{'uniquecode'}) {                  if ($changes{'uniquecode'}) {
                     $resulttext .= '<li>'.                      if (ref($confhash{'uniquecode'}) eq 'HASH') {
                                    &mt('Generation of six character code as course identifier for distribution to students set to '.                          my $codestr = join(' ',map{ &mt($_); } sort(keys(%{$confhash{'uniquecode'}})));
                                        $offon[$env{'form.uniquecode'}]).                          $resulttext .= '<li>'.
                                    '</li>';                                         &mt('Generation of six character code as course identifier for distribution to students set to on for: [_1].','<b>'.$codestr.'</b>').
                                          '</li>';
                       } else {
                           $resulttext .= '<li>'.&mt('Generation of six character code as course identifier for distribution to students set to off.').
                                          '</li>';
                       }
                 }                  }
                 if (ref($changes{'textbooks'}) eq 'HASH') {                  if (ref($changes{'textbooks'}) eq 'HASH') {
                     $resulttext .= '<li>'.&mt('Available textbooks updated').'<ul>';                      $resulttext .= '<li>'.&mt('Available textbooks updated').'<ul>';
Line 9204  sub active_dc_picker { Line 9298  sub active_dc_picker {
                       '<input type="'.$inputtype.'" name="'.$name.'"'.                        '<input type="'.$inputtype.'" name="'.$name.'"'.
                       ' value="'.$domcoord[$i].'"'.$check.' />'.$user;                        ' value="'.$domcoord[$i].'"'.$check.' />'.$user;
             if ($user ne $dcname.':'.$dcdom) {              if ($user ne $dcname.':'.$dcdom) {
                 $table .=  ' ('.$dcname.':'.$dcdom.')'.                  $table .=  ' ('.$dcname.':'.$dcdom.')';
                            '</label></span></td>';  
             }              }
               $table .= '</label></span></td>';
         }          }
         $table .= '</tr></table>';          $table .= '</tr></table>';
     } elsif ($numdcs == 1) {      } elsif ($numdcs == 1) {
           my ($dcname,$dcdom) = split(':',$domcoord[0]);
           my $user = &Apache::loncommon::plainname($dcname,$dcdom);
         if ($inputtype eq 'radio') {          if ($inputtype eq 'radio') {
             $table .= '<input type="hidden" name="'.$name.'" value="'.$domcoord[0].'" />';              $table .= '<input type="hidden" name="'.$name.'" value="'.$domcoord[0].'" />'.$user;
               if ($user ne $dcname.':'.$dcdom) {
                   $table .=  ' ('.$dcname.':'.$dcdom.')';
               }
         } else {          } else {
             my $check;              my $check;
             if (exists($currhash{$domcoord[0]})) {              if (exists($currhash{$domcoord[0]})) {
                 $check = ' checked="checked"';                  $check = ' checked="checked"';
             }              }
             $table .= '<input type="checkbox" name="'.$name.'" '.              $table .= '<span class="LC_nobreak"><label>'.
                       'value="'.$domcoord[0].'"'.$check.' />';                        '<input type="checkbox" name="'.$name.'" '.
                         'value="'.$domcoord[0].'"'.$check.' />'.$user;
               if ($user ne $dcname.':'.$dcdom) {
                   $table .=  ' ('.$dcname.':'.$dcdom.')';
               }
               $table .= '</label></span>';
             $rows ++;              $rows ++;
         }          }
     }      }

Removed from v.1.216  
changed lines
  Added in v.1.223


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