--- loncom/html/adm/helper/newslot.helper 2015/09/23 23:05:04 1.31 +++ loncom/html/adm/helper/newslot.helper 2015/09/27 22:35:50 1.32 @@ -220,12 +220,18 @@ usable for any resource. - restricted to resources in a specific folder/composite page. - restricted to a specific resource. + restricted to resources in specific folder(s)/composite page(s). + restricted to specific resource(s). my $default=&{$helper->{DATA}{origslot}}('symb'); if ($default) { - if ($default =~ /\.(page|sequence)$/) { + my @symbs; + if ($default =~ /,/) { + @symbs = split(/\s*,\s*/,$default); + } else { + @symbs = ($default); + } + if (grep(/\.(page|sequence)$/,@symbs)) { return 'map'; } else { return 'resource'; @@ -255,11 +261,17 @@ PROCTOR - - return $res->is_problem() + + return $res->is_map() || $res->is_problem() + return $res->is_problem() return $res->symb() - return &{$helper->{DATA}{origslot}}('symb'); + my @defaults; + my $default=&{$helper->{DATA}{origslot}}('symb'); + if ($default) { + @defaults=(split(/\s*,\s*/,$default)); + } + return @defaults; @@ -268,11 +280,16 @@ PROCTOR - + return $res->is_map() return $res->symb() - return &{$helper->{DATA}{origslot}}('symb'); + my @defaults; + my $default=&{$helper->{DATA}{origslot}}('symb'); + if ($default) { + @defaults=(split(/\s*,\s*/,$default)); + } + return @defaults; @@ -314,16 +331,16 @@ - Select sections to limit slot availability to:
    +

Select sections to limit slot availability to:

   
- return join('|||', + return join('|||', split(',',&{$helper->{DATA}{origslot}}('allowedsections')));
- Select users to limit slot availability to:
    +

Select users to limit slot availability to:

   
@@ -346,7 +363,7 @@ $slot{$which} = $helper->{'VARS'}{$which}; } - foreach my $which ('ip','description','maxspace','secret','symb') { + foreach my $which ('ip','description','maxspace','secret') { if ( $helper->{'VARS'}{$which} =~/\S/ ) { $slot{$which} = $helper->{'VARS'}{$which}; } @@ -361,6 +378,17 @@ } } + if (($helper->{'VARS'}{'restricttosymb'} =~ /^(map|resource)$/) && + ($helper->{'VARS'}{'symb'} =~ /\S/)) { + my @symbs; + foreach my $symb (split(/\|\|\|/, $helper->{'VARS'}{'symb'})) { + push(@symbs,$symb); + } + # make sure the symbs are unique + my %symbs = map { ($_,1) } @symbs; + $slot{'symb'}=join(',',sort(keys(%symbs))); + } + if ( $helper->{'VARS'}{'startreserve'} > 0) { $slot{'startreserve'} = $helper->{'VARS'}{'startreserve'}; } @@ -384,7 +412,7 @@ my ($uname,$udomain)=split(/:/,$user); push(@names,"$uname:$udomain"); } - # make sure the usernmaes are unique + # make sure the usernames are unique my %proctors = map { ($_,1) } @names; $slot{'proctor'}=join(',',sort(keys(%proctors))); } @@ -425,13 +453,26 @@ "\n".'
  • Type: '.$slot{'type'}.'
  • '; my %labels = map {($_->[0],$_->[1])} &Apache::slotrequest::csvupload_fields(); - foreach my $which ('ip','description','maxspace','secret','symb', + foreach my $which ('ip','description','maxspace','secret', 'allowedsections','allowedusers') { if (exists($slot{$which})) { $result.="\n".'
  • '.$labels{$which}.': '. &HTML::Entities::encode($slot{$which}).'
  • '; } } + if (exists($slot{'symb'})) { + $result.="\n".'
  • '.$labels{'symb'}.': '; + if ($slot{'symb'} =~ /,/) { + $result.='
      '; + foreach my $symb (split(/\s*,\s*/,$slot{'symb'})) { + $result.='
    • '.&HTML::Entities::encode($symb).'
    • '; + } + $result.='
    '; + } else { + $result.=&HTML::Entities::encode($slot{'symb'}); + } + $result.='
  • '; + } if (exists($slot{'startreserve'})) { $result.="\n".'
  • '.$labels{'startreserve'}.': '. &Apache::lonlocal::locallocaltime($slot{'startreserve'}).'
  • ';