Diff for /loncom/interface/lonparmset.pm between versions 1.522.2.28.4.2 and 1.522.2.28.4.5

version 1.522.2.28.4.2, 2022/02/21 18:21:11 version 1.522.2.28.4.5, 2022/05/27 18:17:11
Line 945  function validateParms() { Line 945  function validateParms() {
     var dlKeyRegExp = /^deeplink_key_/;      var dlKeyRegExp = /^deeplink_key_/;
     var dlMenusRegExp = /^deeplink_menus_/;      var dlMenusRegExp = /^deeplink_menus_/;
     var dlCollsRegExp = /^deeplink_colls_/;      var dlCollsRegExp = /^deeplink_colls_/;
       var dlTargetRegExp = /^deeplink_target_/;
     var patternIP = /[\[\]\*\.a-zA-Z\d\-]+/;      var patternIP = /[\[\]\*\.a-zA-Z\d\-]+/;
     if ((document.parmform.elements.length != 'undefined')  && (document.parmform.elements.length) != 'null') {      if ((document.parmform.elements.length != 'undefined')  && (document.parmform.elements.length) != 'null') {
         if (document.parmform.elements.length) {          if (document.parmform.elements.length) {
Line 1075  function validateParms() { Line 1076  function validateParms() {
                             }                              }
                             document.parmform.elements['set_'+identifier].value += posslinkmenu;                              document.parmform.elements['set_'+identifier].value += posslinkmenu;
                         }                          }
                       } else if (dlTargetRegExp.text(name)) {
                           var identifier =  name.replace(dlTargetExp,'');
                           var idx = document.parmform.elements[i].selectedIndex;
                           if (idx > 0) {
                               var possdeeplink = document.parmform.elements[i].options[idx].value
                               possdeeplink = possdeeplink.replace(/^\s+|\s+$/g,'');
                               if (document.parmform.elements['set_'+identifier].value) {
                                   possdeeplink = ','+possdeeplink;
                               }
                               document.parmform.elements['set_'+identifier].value += possdeeplink;
                           }
                     }                      }
                 }                  }
             }              }
Line 2673  sub assessparms { Line 2685  sub assessparms {
         my $chome = $env{'course.'.$env{'request.course.id'}.'.home'};          my $chome = $env{'course.'.$env{'request.course.id'}.'.home'};
         my ($got_chostname,$chostname,$cmajor,$cminor);          my ($got_chostname,$chostname,$cmajor,$cminor);
         my $totalstored = 0;          my $totalstored = 0;
           my $totalskippeduser = 0;
         my $now = time;          my $now = time;
         for (my $i=0;$i<=$#markers;$i++) {          for (my $i=0;$i<=$#markers;$i++) {
             my ($needsrelease,$needsnewer,$name);              my ($needsrelease,$needsnewer,$name);
Line 2681  sub assessparms { Line 2694  sub assessparms {
             }              }
             if ($markers[$i] =~ /\&(6|5|4)$/) {              if ($markers[$i] =~ /\&(6|5|4)$/) {
                 next if ($noeditgrp);                  next if ($noeditgrp);
               } elsif ($markers[$i] =~ /\&(3|2|1)$/) {
                   if ($uname eq '') {
                       $totalskippeduser ++;
                       next;
                   }
             }              }
             if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) {              if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) {
                 my (@ok_slots,@fail_slots,@del_slots);                  my (@ok_slots,@fail_slots,@del_slots);
Line 2758  sub assessparms { Line 2776  sub assessparms {
 # ---------------------------------------------------------------- Done storing  # ---------------------------------------------------------------- Done storing
         if ($totalstored) {          if ($totalstored) {
             $message.='<p class="LC_warning">'              $message.='<p class="LC_warning">'
                        .&mt('Changes for [quant,_1,parameter] saved.',$totalstored)
                        .'<br />'
                      .&mt('Changes can take up to 10 minutes before being active for all students.')                       .&mt('Changes can take up to 10 minutes before being active for all students.')
                      .&Apache::loncommon::help_open_topic('Caching')                       .&Apache::loncommon::help_open_topic('Caching')
                      .'</p>';                       .'</p>';
           } else {
               $message.='<p class="LC_info">'.&mt('No parameter changes saved.').'</p>';
           }
           if ($totalskippeduser) {
               $message .= '<p class="LC_warning">';
               if ($uhome eq 'no_host') {
                   $message .= &mt('Changes for [quant,_1,user-specific parameter] not saved because the username or ID was invalid.',
                                   $totalskippeduser);
               } elsif ($env{'form.userroles'} eq 'any') {
                   $message .= &mt('Changes for [quant,_1,user-specific parameter] not saved because the user does not have a course role.',
                                   $totalskippeduser);
               } else {
                   $message .= &mt('Changes for [quant,_1,user-specific parameter] not saved because the user is not a student.',
                                   $totalskippeduser);
               }
               $message .= '</p>';
         }          }
     }      }
 #----------------------------------------------- if all selected, fill in array  #----------------------------------------------- if all selected, fill in array
Line 2783  sub assessparms { Line 2819  sub assessparms {
   
     # ----- Start Parameter Selection      # ----- Start Parameter Selection
   
     # Hide parm selection?      # Hide parm selection and possibly table?
       my ($tablejs,$tabledivsty);
       if (((($env{'form.uname'} ne '') || ($env{'form.id'} ne '')) && ($uname eq '')) &&
           ($env{'form.dis'}) && ($pssymb eq '')) {
           $tablejs = 'document.getElementById('."'parmtable'".').style.display = "";';
           $tabledivsty = ' style="display:none"';
       }
     $r->print(<<ENDPARMSELSCRIPT);      $r->print(<<ENDPARMSELSCRIPT);
 <script type="text/javascript">  <script type="text/javascript">
 // <![CDATA[  // <![CDATA[
 function parmsel_show() {  function parmsel_show() {
   document.getElementById('parmsel').style.display = "";    document.getElementById('parmsel').style.display = "";
   document.getElementById('parmsellink').style.display = "none";    document.getElementById('parmsellink').style.display = "none";
     $tablejs
 }  }
 // ]]>  // ]]>
 </script>  </script>
Line 2901  ENDPARMSELSCRIPT Line 2944  ENDPARMSELSCRIPT
         if ($parm_permission->{'edit'}) {          if ($parm_permission->{'edit'}) {
             undef($readonly);              undef($readonly);
         }          }
           $r->print('<div id="parmtable"'.$tabledivsty.'>');
   
         if ($parmlev eq 'full') {          if ($parmlev eq 'full') {
 #  #
Line 3309  ENDMAPONE Line 3353  ENDMAPONE
                      .'</center>'                       .'</center>'
             );              );
         } # end of $parmlev eq general          } # end of $parmlev eq general
           $r->print('</div>');
     }      }
     $r->print('</form>');      $r->print('</form>');
     $r->print(&Apache::loncommon::end_page());      $r->print(&Apache::loncommon::end_page());
Line 3929  sub string_deeplink_selector { Line 3974  sub string_deeplink_selector {
     my ($thiskey, $showval, $readonly) = @_;      my ($thiskey, $showval, $readonly) = @_;
     my (@components,%values,@current,%titles,%options,%optiontext,%defaults,      my (@components,%values,@current,%titles,%options,%optiontext,%defaults,
         %selectnull,%domlti,%crslti,@possmenus);          %selectnull,%domlti,%crslti,@possmenus);
     @components = ('state','others','listing','scope','protect','menus');      @components = ('state','others','listing','scope','protect','menus','target');
     %titles = &Apache::lonlocal::texthash (      %titles = &Apache::lonlocal::texthash (
                   state   => 'Access status',                    state   => 'Access status',
                   others  => 'Hide other resources',                    others  => 'Hide other resources',
Line 3937  sub string_deeplink_selector { Line 3982  sub string_deeplink_selector {
                   scope   => 'Access scope for link',                    scope   => 'Access scope for link',
                   protect => 'Link protection',                    protect => 'Link protection',
                   menus   => 'Menu Items Displayed',                    menus   => 'Menu Items Displayed',
                     target  => 'Embedded?',
               );                );
     %options = (      %options = (
                    state   => ['only','off','both'],                     state   => ['only','off','both'],
Line 3945  sub string_deeplink_selector { Line 3991  sub string_deeplink_selector {
                    scope   => ['res','map','rec'],                     scope   => ['res','map','rec'],
                    protect => ['none','key','ltid','ltic'],                     protect => ['none','key','ltid','ltic'],
                    menus   => ['std','colls'],                     menus   => ['std','colls'],
                      target  => ['_self','_top'],
                );                 );
     %optiontext = &Apache::lonlocal::texthash (      %optiontext = &Apache::lonlocal::texthash (
                     only       => 'deep only',                      only       => 'deep only',
Line 3966  sub string_deeplink_selector { Line 4013  sub string_deeplink_selector {
                     ltid       => 'LTI access (domain)' ,                      ltid       => 'LTI access (domain)' ,
                     std        => 'Standard (all menus)',                      std        => 'Standard (all menus)',
                     colls      => 'Numbered collection',                      colls      => 'Numbered collection',
                       _self      => 'Embedded',
                       _top       => 'Not embedded',
                   );                    );
     %selectnull = &Apache::lonlocal::texthash (      %selectnull = &Apache::lonlocal::texthash (
                     ltic => 'Select Launcher',                      ltic => 'Select Launcher',
Line 3981  sub string_deeplink_selector { Line 4030  sub string_deeplink_selector {
         ($values{'scope'}) = ($current[3] =~ /^(res|map|rec)$/);          ($values{'scope'}) = ($current[3] =~ /^(res|map|rec)$/);
         ($values{'protect'}) = ($current[4] =~ /^(key:[a-zA-Z\d_.!\@#\$%^&*()+=-]+|ltic:\d+|ltid:\d+)$/);          ($values{'protect'}) = ($current[4] =~ /^(key:[a-zA-Z\d_.!\@#\$%^&*()+=-]+|ltic:\d+|ltid:\d+)$/);
         ($values{'menus'}) = ($current[5] =~ /^(\d+)$/);          ($values{'menus'}) = ($current[5] =~ /^(\d+)$/);
           ($values{'target'}) = ($current[6] =~ /^(_self|_top)$/);
     } else {      } else {
         $defaults{'state'} = 'off',          $defaults{'state'} = 'off',
         $defaults{'others'} = 'unhide',          $defaults{'others'} = 'unhide',
Line 3988  sub string_deeplink_selector { Line 4038  sub string_deeplink_selector {
         $defaults{'scope'} = 'res';          $defaults{'scope'} = 'res';
         $defaults{'protect'} = 'none';          $defaults{'protect'} = 'none';
         $defaults{'menus'} = '0';          $defaults{'menus'} = '0';
           $defaults{'target'} = '_top';
     }      }
     my $disabled;      my $disabled;
     if ($readonly) {      if ($readonly) {
Line 4167  my %strings = Line 4218  my %strings =
              => [['_allowfrom_','Hostname(s), or IP(s) from which access is allowed'],               => [['_allowfrom_','Hostname(s), or IP(s) from which access is allowed'],
                  ['_denyfrom_','Hostname(s) or IP(s) from which access is disallowed']],                   ['_denyfrom_','Hostname(s) or IP(s) from which access is disallowed']],
      'string_deeplink'       'string_deeplink'
              => [['on','Set choices for link protection, resource listing, access scope, and shown menu items']],               => [['on','Set choices for link protection, resource listing, access scope, shown menu items, and embedding']],
      );       );
   
 my %stringmatches = (  my %stringmatches = (
Line 4175  my %stringmatches = ( Line 4226  my %stringmatches = (
               => [['_allowfrom_','[^\!]+'],                => [['_allowfrom_','[^\!]+'],
                   ['_denyfrom_','\!']],                    ['_denyfrom_','\!']],
          'string_deeplink'           'string_deeplink'
               => [['on','^(only|off|both)\,(hide|unhide)\,(full|absent|grades|details|datestatus)\,(res|map|rec)\,(none|key\:\w+|ltic\:\d+|ltid\:\d+)\,(\d+|)$']],                => [['on','^(only|off|both)\,(hide|unhide)\,(full|absent|grades|details|datestatus)\,(res|map|rec)\,(none|key\:\w+|ltic\:\d+|ltid\:\d+)\,(\d+|)\,_(self|top)$']],
     );      );
   
 my %stringtypes = (  my %stringtypes = (

Removed from v.1.522.2.28.4.2  
changed lines
  Added in v.1.522.2.28.4.5


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