version 1.929, 2007/12/05 20:06:34
|
version 1.935, 2007/12/21 04:34:50
|
Line 1635 sub ssi_body {
|
Line 1635 sub ssi_body {
|
&ssi($filelink,%form)); |
&ssi($filelink,%form)); |
$output=~s|//(\s*<!--)? BEGIN LON-CAPA Internal.+?// END LON-CAPA Internal\s*(-->)?\s||gs; |
$output=~s|//(\s*<!--)? BEGIN LON-CAPA Internal.+?// END LON-CAPA Internal\s*(-->)?\s||gs; |
$output=~s/^.*?\<body[^\>]*\>//si; |
$output=~s/^.*?\<body[^\>]*\>//si; |
$output=~s/(.*)\<\/body\s*\>.*?$/$1/si; |
$output=~s/\<\/body\s*\>.*?$//si; |
return $output; |
return $output; |
} |
} |
|
|
Line 2427 sub get_course_adv_roles {
|
Line 2427 sub get_course_adv_roles {
|
} |
} |
|
|
sub get_my_roles { |
sub get_my_roles { |
my ($uname,$udom,$context,$types,$roles,$roledoms)=@_; |
my ($uname,$udom,$context,$types,$roles,$roledoms,$withsec)=@_; |
unless (defined($uname)) { $uname=$env{'user.name'}; } |
unless (defined($uname)) { $uname=$env{'user.name'}; } |
unless (defined($udom)) { $udom=$env{'user.domain'}; } |
unless (defined($udom)) { $udom=$env{'user.domain'}; } |
my %dumphash; |
my %dumphash; |
Line 2486 sub get_my_roles {
|
Line 2486 sub get_my_roles {
|
} |
} |
} |
} |
} |
} |
$returnhash{$username.':'.$domain.':'.$role}=$tstart.':'.$tend; |
if ($withsec) { |
|
$returnhash{$username.':'.$domain.':'.$role.':'.$section} = |
|
$tstart.':'.$tend; |
|
} else { |
|
$returnhash{$username.':'.$domain.':'.$role}=$tstart.':'.$tend; |
|
} |
} |
} |
return %returnhash; |
return %returnhash; |
} |
} |
Line 4843 sub auto_run {
|
Line 4848 sub auto_run {
|
$response = 1; |
$response = 1; |
} |
} |
} else { |
} else { |
my $homeserver = &homeserver($cnum,$cdom); |
my $homeserver; |
$response = &reply('autorun:'.$cdom,$homeserver); |
if (&is_course($cdom,$cnum)) { |
|
$homeserver = &homeserver($cnum,$cdom); |
|
} else { |
|
$homeserver = &domain($cdom,'primary'); |
|
} |
|
if ($homeserver ne 'no_host') { |
|
$response = &reply('autorun:'.$cdom,$homeserver); |
|
} |
} |
} |
return $response; |
return $response; |
} |
} |
Line 5250 sub assignrole {
|
Line 5262 sub assignrole {
|
} else { |
} else { |
my $cwosec=$url; |
my $cwosec=$url; |
$cwosec=~s/^\/($match_domain)\/($match_courseid)\/.*/$1\/$2/; |
$cwosec=~s/^\/($match_domain)\/($match_courseid)\/.*/$1\/$2/; |
unless ((&allowed('c'.$role,$cwosec)) || &allowed('c'.$role,$udom)) { |
if (!(&allowed('c'.$role,$cwosec)) && !(&allowed('c'.$role,$udom))) { |
&logthis('Refused assignrole: '. |
my $refused; |
$udom.' '.$uname.' '.$url.' '.$role.' '.$end.' '.$start.' by '. |
if (($env{'request.course.sec'} ne '') && ($role eq 'st')) { |
$env{'user.name'}.' at '.$env{'user.domain'}); |
if (!(&allowed('c'.$role,$url))) { |
return 'refused'; |
$refused = 1; |
|
} |
|
} else { |
|
$refused = 1; |
|
} |
|
if ($refused) { |
|
&logthis('Refused assignrole: '.$udom.' '.$uname.' '.$url. |
|
' '.$role.' '.$end.' '.$start.' by '. |
|
$env{'user.name'}.' at '.$env{'user.domain'}); |
|
return 'refused'; |
|
} |
} |
} |
$mrole=$role; |
$mrole=$role; |
} |
} |
Line 6612 sub EXT {
|
Line 6634 sub EXT {
|
([$courselevelr,'resource'], |
([$courselevelr,'resource'], |
[$courselevelm,'map' ], |
[$courselevelm,'map' ], |
[$courselevel, 'course' ])); |
[$courselevel, 'course' ])); |
if (defined($userreply)) { return $userreply; } |
if (defined($userreply)) { return &get_reply($userreply); } |
|
|
# ------------------------------------------------ second, check some of course |
# ------------------------------------------------ second, check some of course |
my $coursereply; |
my $coursereply; |
Line 7973 sub filelocation {
|
Line 7995 sub filelocation {
|
} |
} |
} |
} |
$location=~s://+:/:g; # remove duplicate / |
$location=~s://+:/:g; # remove duplicate / |
while ($location=~m:/\.\./:) {$location=~ s:/[^/]+/\.\./:/:g;} #remove dir/.. |
while ($location=~m{/\.\./}) { |
|
if ($location =~ m{/[^/]+/\.\./}) { |
|
$location=~ s{/[^/]+/\.\./}{/}g; |
|
} else { |
|
$location=~ s{/\.\./}{/}g; |
|
} |
|
} #remove dir/.. |
while ($location=~m:/\./:) {$location=~ s:/\./:/:g;} #remove /./ |
while ($location=~m:/\./:) {$location=~ s:/\./:/:g;} #remove /./ |
return $location; |
return $location; |
} |
} |
Line 8839 explanation of a user role term
|
Line 8867 explanation of a user role term
|
|
|
=item * |
=item * |
|
|
get_my_roles($uname,$udom,$context,$types,$roles,$roledoms) : |
get_my_roles($uname,$udom,$context,$types,$roles,$roledoms,$withsec) : |
All arguments are optional. Returns a hash of a roles, either for |
All arguments are optional. Returns a hash of a roles, either for |
co-author/assistant author roles for a user's Construction Space |
co-author/assistant author roles for a user's Construction Space |
(default), or if $context is 'userroles', roles for the user himself, |
(default), or if $context is 'userroles', roles for the user himself, |
In the hash, keys are set to colon-sparated $uname,$udom,and $role, |
In the hash, keys are set to colon-separated $uname,$udom,$role, and |
and value is set to colon-separated start and end times for the role. |
(optionally) if $withsec is true, a fourth colon-separated item - $section. |
If no username and domain are specified, will default to current |
For each key, value is set to colon-separated start and end times for |
user/domain. Types, roles, and roledoms are references to arrays, |
the role. If no username and domain are specified, will default to |
|
current user/domain. Types, roles, and roledoms are references to arrays |
of role statuses (active, future or previous), roles |
of role statuses (active, future or previous), roles |
(e.g., cc,in, st etc.) and domains of the roles which can be used |
(e.g., cc,in, st etc.) and domains of the roles which can be used |
to restrict the list of roles reported. If no array ref is |
to restrict the list of roles reported. If no array ref is |