version 1.574, 2007/08/30 20:24:15
|
version 1.578, 2007/09/03 15:34:12
|
Line 3505 sub bodytag {
|
Line 3505 sub bodytag {
|
if (!$realm) { $realm=' '; } |
if (!$realm) { $realm=' '; } |
# Set messages |
# Set messages |
my $messages=&domainlogo($domain); |
my $messages=&domainlogo($domain); |
# Port for miniserver |
|
my $lonhttpdPort=$Apache::lonnet::perlvar{'lonhttpdPort'}; |
|
if (!defined($lonhttpdPort)) { $lonhttpdPort='8080'; } |
|
|
|
my $extra_body_attr = &make_attr_string($forcereg,\%design); |
my $extra_body_attr = &make_attr_string($forcereg,\%design); |
|
|
Line 3625 ENDROLE
|
Line 3622 ENDROLE
|
|
|
my $imgsrc = $img; |
my $imgsrc = $img; |
if ($img =~ /^\/adm/) { |
if ($img =~ /^\/adm/) { |
$imgsrc = 'http://'.$ENV{'HTTP_HOST'}.':'.$lonhttpdPort.$img; |
$imgsrc = &lonhttpdurl($img); |
} |
} |
my $upperleft='<img src="'.$imgsrc.'" alt="'.$function.'" />'; |
my $upperleft='<img src="'.$imgsrc.'" alt="'.$function.'" />'; |
|
|
Line 4501 span.LC_nobreak {
|
Line 4498 span.LC_nobreak {
|
white-space: nowrap; |
white-space: nowrap; |
} |
} |
|
|
|
span.LC_cusr_emph { |
|
font-style: italic; |
|
} |
|
|
table.LC_docs_documents { |
table.LC_docs_documents { |
background: #BBBBBB; |
background: #BBBBBB; |
border-width: 0px; |
border-width: 0px; |
Line 5628 sub user_picker {
|
Line 5629 sub user_picker {
|
'lastname' => 'last name', |
'lastname' => 'last name', |
'lastfirst' => 'last name, first name', |
'lastfirst' => 'last name, first name', |
'crs' => 'in this course', |
'crs' => 'in this course', |
'dom' => 'in selected domain', |
'dom' => 'in selected LON-CAPA domain', |
'alc' => 'all LON-CAPA', |
'alc' => 'all LON-CAPA', |
'instd' => 'in institutional directory for selected domain', |
'instd' => 'in institutional directory for selected domain', |
'exact' => 'is', |
'exact' => 'is', |
Line 5691 sub user_picker {
|
Line 5692 sub user_picker {
|
my ($newuserscript,$new_user_create); |
my ($newuserscript,$new_user_create); |
|
|
if ($forcenewuser) { |
if ($forcenewuser) { |
$new_user_create = '<p> <input type="submit" name="forcenew" value="'.&HTML::Entities::encode(&mt('Make new user "[_1]"',$srchterm),'<>&"').'" onclick="javascript:setSearch(\'1\','.$caller.');" /> </p>'; |
if (ref($srch) eq 'HASH') { |
|
if ($srch->{'srchby'} eq 'uname' && $srch->{'srchtype'} eq 'exact' && $srch->{'srchin'} eq 'dom' && $srch->{'srchdomain'} eq $env{'request.role.domain'}) { |
|
$new_user_create = '<p> <input type="submit" name="forcenew" value="'.&HTML::Entities::encode(&mt('Make new user "[_1]"',$srchterm),'<>&"').'" onclick="javascript:setSearch(\'1\','.$caller.');" /> </p>'; |
|
} |
|
} |
|
|
$newuserscript = <<"ENDSCRIPT"; |
$newuserscript = <<"ENDSCRIPT"; |
|
|
function setSearch(createnew,callingForm) { |
function setSearch(createnew,callingForm) { |
Line 5817 END_BLOCK
|
Line 5823 END_BLOCK
|
return $output; |
return $output; |
} |
} |
|
|
|
|
|
|
=pod |
=pod |
|
|
=back |
=back |
Line 6979 sub commit_studentrole {
|
Line 6983 sub commit_studentrole {
|
############################################################ |
############################################################ |
|
|
sub check_clone { |
sub check_clone { |
my ($args) = @_; |
my ($args,$linefeed) = @_; |
my $cloneid='/'.$args->{'clonedomain'}.'/'.$args->{'clonecourse'}; |
my $cloneid='/'.$args->{'clonedomain'}.'/'.$args->{'clonecourse'}; |
my ($clonecrsudom,$clonecrsunum)= &LONCAPA::split_courseid($cloneid); |
my ($clonecrsudom,$clonecrsunum)= &LONCAPA::split_courseid($cloneid); |
my $clonehome=&Apache::lonnet::homeserver($clonecrsunum,$clonecrsudom); |
my $clonehome=&Apache::lonnet::homeserver($clonecrsunum,$clonecrsudom); |
Line 6987 sub check_clone {
|
Line 6991 sub check_clone {
|
my $can_clone = 0; |
my $can_clone = 0; |
|
|
if ($clonehome eq 'no_host') { |
if ($clonehome eq 'no_host') { |
$clonemsg = &mt('Attempting to clone non-existing [_1]', |
$clonemsg = &mt('No new course created.').$linefeed.&mt('A new course could not be cloned from the specified original - [_1] - because it is a non-existent course.',$args->{'clonecourse'}.':'.$args->{'clonedomain'}); |
$args->{'crstype'}); |
|
} else { |
} else { |
my %clonedesc = &Apache::lonnet::coursedescription($cloneid,{'one_time' => 1}); |
my %clonedesc = &Apache::lonnet::coursedescription($cloneid,{'one_time' => 1}); |
if ($env{'request.role.domain'} eq $args->{'clonedomain'}) { |
if ($env{'request.role.domain'} eq $args->{'clonedomain'}) { |
Line 6997 sub check_clone {
|
Line 7000 sub check_clone {
|
my %clonehash = &Apache::lonnet::get('environment',['cloners'], |
my %clonehash = &Apache::lonnet::get('environment',['cloners'], |
$args->{'clonedomain'},$args->{'clonecourse'}); |
$args->{'clonedomain'},$args->{'clonecourse'}); |
my @cloners = split(/,/,$clonehash{'cloners'}); |
my @cloners = split(/,/,$clonehash{'cloners'}); |
my %roleshash = |
if (grep(/^\*$/,@cloners)) { |
&Apache::lonnet::get_my_roles($args->{'ccuname'}, |
$can_clone = 1; |
$args->{'ccdomain'},'userroles',['active'],['cc'], |
} elsif (grep(/^\*\:\Q$args->{'ccdomain'}\E$/,@cloners)) { |
[$args->{'clonedomain'}]); |
$can_clone = 1; |
if (($roleshash{$args->{'clonecourse'}.':'.$args->{'clonedomain'}.':cc'}) || (grep(/^\Q$args->{'ccuname'}\E:\Q$args->{'ccdomain'}\E$/,@cloners))) { |
} else { |
$can_clone = 1; |
my %roleshash = |
} else { |
&Apache::lonnet::get_my_roles($args->{'ccuname'}, |
$clonemsg = &mt('The new course was not cloned from an existing course because the new course owner ([_1]) does not have cloning rights in the existing course ([_2]).',$args->{'ccuname'}.':'.$args->{'ccdomain'},$clonedesc{'description'}); |
$args->{'ccdomain'}, |
|
'userroles',['active'],['cc'], |
|
[$args->{'clonedomain'}]); |
|
if (($roleshash{$args->{'clonecourse'}.':'.$args->{'clonedomain'}.':cc'}) || (grep(/^\Q$args->{'ccuname'}\E:\Q$args->{'ccdomain'}\E$/,@cloners))) { |
|
$can_clone = 1; |
|
} else { |
|
$clonemsg = &mt('No new course created.').$linefeed.&mt('The new course could not be cloned from the existing course because the new course owner ([_1]) does not have cloning rights in the existing course ([_2]).',$args->{'ccuname'}.':'.$args->{'ccdomain'},$clonedesc{'description'}); |
|
} |
} |
} |
} |
} |
} |
} |
|
|
return ($can_clone, $clonemsg, $cloneid, $clonehome); |
return ($can_clone, $clonemsg, $cloneid, $clonehome); |
} |
} |
|
|
Line 7025 sub construct_course {
|
Line 7034 sub construct_course {
|
# |
# |
my ($can_clone, $clonemsg, $cloneid, $clonehome); |
my ($can_clone, $clonemsg, $cloneid, $clonehome); |
if (($args->{'clonecourse'}) && ($args->{'clonedomain'})) { |
if (($args->{'clonecourse'}) && ($args->{'clonedomain'})) { |
($can_clone, $clonemsg, $cloneid, $clonehome) = &check_clone($args); |
($can_clone, $clonemsg, $cloneid, $clonehome) = &check_clone($args,$linefeed); |
if ($context ne 'auto') { |
if ($context ne 'auto') { |
$clonemsg = '<span class="LC_error">'.$clonemsg.'</span>'; |
if ($clonemsg ne '') { |
|
$clonemsg = '<span class="LC_error">'.$clonemsg.'</span>'; |
|
} |
} |
} |
$outcome .= $clonemsg.$linefeed; |
$outcome .= $clonemsg.$linefeed; |
|
|
Line 7371 sub icon {
|
Line 7382 sub icon {
|
return &lonhttpdurl($iconname); |
return &lonhttpdurl($iconname); |
} |
} |
|
|
sub lonhttpdurl { |
sub lonhttpd_port { |
my ($url)=@_; |
|
my $lonhttpd_port=$Apache::lonnet::perlvar{'lonhttpdPort'}; |
my $lonhttpd_port=$Apache::lonnet::perlvar{'lonhttpdPort'}; |
if (!defined($lonhttpd_port)) { $lonhttpd_port='8080'; } |
if (!defined($lonhttpd_port)) { $lonhttpd_port='8080'; } |
|
|
# IE doesn't like a secure page getting images from a non-secure |
# IE doesn't like a secure page getting images from a non-secure |
# port (when logging we haven't parsed the browser type so default |
# port (when logging we haven't parsed the browser type so default |
# back to secure |
# back to secure |
if ((!exists($env{'browser.type'}) || $env{'browser.type'} eq 'explorer') |
if ((!exists($env{'browser.type'}) || $env{'browser.type'} eq 'explorer') |
&& $ENV{'SERVER_PORT'} == 443) { |
&& $ENV{'SERVER_PORT'} == 443) { |
|
return 443; |
|
} |
|
return $lonhttpd_port; |
|
|
|
} |
|
|
|
sub lonhttpdurl { |
|
my ($url)=@_; |
|
|
|
my $lonhttpd_port = &lonhttpd_port(); |
|
if ($lonhttpd_port == 443) { |
return 'https://'.$ENV{'SERVER_NAME'}.$url; |
return 'https://'.$ENV{'SERVER_NAME'}.$url; |
} |
} |
return 'http://'.$ENV{'SERVER_NAME'}.':'.$lonhttpd_port.$url; |
return 'http://'.$ENV{'SERVER_NAME'}.':'.$lonhttpd_port.$url; |