--- loncom/xml/londefdef.pm 2007/06/05 22:37:58 1.366 +++ loncom/xml/londefdef.pm 2007/06/22 00:11:32 1.369 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.366 2007/06/05 22:37:58 albertel Exp $ +# $Id: londefdef.pm,v 1.369 2007/06/22 00:11:32 albertel Exp $ # # # Copyright Michigan State University Board of Trustees @@ -481,13 +481,21 @@ sub start_accessrule { ('realm',$parstack,$safeeval,undef,1); my $role=&Apache::lonxml::get_param ('role',$parstack,$safeeval,undef,1); - $realm=~s/\s+//g; - $realm=~s/\//\_/g; - $realm=~s/^\_//; - $realm=~s/\W/\;/g; - $role=~s/\s+//g; - $role=~s/\//\_/g; - $role=~s/\W/\;/g; + my ($dom,$crs,$sec)=split(/\_/,$realm); + $dom = &LONCAPA::clean_domain($dom); + my $type=&Apache::lonxml::get_param + ('type',$parstack,$safeeval,undef,1); + if ($type eq 'user') { + $crs = &LONCAPA::clean_username($crs); + } else { + $crs = &LONCAPA::clean_courseid($crs); + } + $sec =~s/\W//; + $realm = $dom; + if ($crs =~ /\S/) { $realm .= '_'.$crs; } + if ($sec =~ /\S/) { $realm .= '_'.$sec; } + $role=~s/\W//g; + if ($target eq 'web') { my $args=''; if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; } @@ -498,7 +506,7 @@ sub start_accessrule { } } if ($target eq 'meta') { - $currentstring=''.$eff.':'.$realm.':'.$role.''; + $currentstring=''.$eff.':'.$realm.':'.$role.':'.$type.''; } return $currentstring; } @@ -3001,9 +3009,10 @@ sub start_img { # And here's where the semi-quote breaks down: allow the user # to edit the beast as well by rendering the problem for edit: } elsif ($target eq 'edit') { + my $only = join(',',&Apache::loncommon::filecategorytypes('Pictures')); $currentstring .=&Apache::edit::tag_start($target,$token); $currentstring .=&Apache::edit::text_arg('Image Url:','src',$token,70). - &Apache::edit::browse('src',undef,'alt').' '. + &Apache::edit::browse('src',undef,'alt',$only).' '. &Apache::edit::search('src',undef,'alt').'
'; $currentstring .=&Apache::edit::text_arg('Description:','alt',$token,70).'
'; $currentstring .=&Apache::edit::text_arg('width (pixel):','width',$token,5);