version 1.552, 2007/07/17 23:10:14
|
version 1.564.2.1, 2007/08/24 07:20:22
|
Line 334 sub studentbrowser_javascript {
|
Line 334 sub studentbrowser_javascript {
|
return (<<'ENDSTDBRW'); |
return (<<'ENDSTDBRW'); |
<script type="text/javascript" language="Javascript" > |
<script type="text/javascript" language="Javascript" > |
var stdeditbrowser; |
var stdeditbrowser; |
function openstdbrowser(formname,uname,udom,roleflag) { |
function openstdbrowser(formname,uname,udom,roleflag,ignorefilter) { |
var url = '/adm/pickstudent?'; |
var url = '/adm/pickstudent?'; |
var filter; |
var filter; |
eval('filter=document.'+formname+'.'+uname+'.value;'); |
if (!ignorefilter) { |
|
eval('filter=document.'+formname+'.'+uname+'.value;'); |
|
} |
if (filter != null) { |
if (filter != null) { |
if (filter != '') { |
if (filter != '') { |
url += 'filter='+filter+'&'; |
url += 'filter='+filter+'&'; |
Line 365 sub selectstudent_link {
|
Line 367 sub selectstudent_link {
|
return ''; |
return ''; |
} |
} |
return "<a href='".'javascript:openstdbrowser("'.$form.'","'.$unameele. |
return "<a href='".'javascript:openstdbrowser("'.$form.'","'.$unameele. |
'","'.$udomele.'");'."'>".&mt('Select User')."</a>"; |
'","'.$udomele.'","","1");'."'>".&mt('Select User')."</a>"; |
} |
} |
if ($env{'request.role'}=~/^(au|dc|su)/) { |
if ($env{'request.role'}=~/^(au|dc|su)/) { |
return "<a href='".'javascript:openstdbrowser("'.$form.'","'.$unameele. |
return "<a href='".'javascript:openstdbrowser("'.$form.'","'.$unameele. |
Line 802 ENDOUTPUT
|
Line 804 ENDOUTPUT
|
sub help_open_menu { |
sub help_open_menu { |
my ($topic,$component_help,$faq,$bug,$stayOnPage,$width,$height,$text) |
my ($topic,$component_help,$faq,$bug,$stayOnPage,$width,$height,$text) |
= @_; |
= @_; |
&Apache::lonnet::logthis("stayonpage is $stayOnPage"); |
|
$stayOnPage = 0 if (not defined $stayOnPage); |
$stayOnPage = 0 if (not defined $stayOnPage); |
# formerly only used pop-up help (stayOnPage = 0) |
# formerly only used pop-up help (stayOnPage = 0) |
# if environment.remote is on (using remote control UI) |
# if environment.remote is on (using remote control UI) |
Line 1423 sub select_level_form {
|
Line 1424 sub select_level_form {
|
|
|
=pod |
=pod |
|
|
=item * select_dom_form($defdom,$name,$includeempty) |
=item * select_dom_form($defdom,$name,$includeempty,$showdomdesc) |
|
|
Returns a string containing a <select name='$name' size='1'> form to |
Returns a string containing a <select name='$name' size='1'> form to |
allow a user to select the domain to preform an operation in. |
allow a user to select the domain to preform an operation in. |
Line 1432 See loncreateuser.pm for an example invo
|
Line 1433 See loncreateuser.pm for an example invo
|
If the $includeempty flag is set, it also includes an empty choice ("no domain |
If the $includeempty flag is set, it also includes an empty choice ("no domain |
selected"); |
selected"); |
|
|
|
If the $showdomdesc flag is set, the domain name is followed by the domain description. |
|
|
=cut |
=cut |
|
|
#------------------------------------------- |
#------------------------------------------- |
sub select_dom_form { |
sub select_dom_form { |
my ($defdom,$name,$includeempty) = @_; |
my ($defdom,$name,$includeempty,$showdomdesc) = @_; |
my @domains = sort {lc($a) cmp lc($b)} (&Apache::lonnet::all_domains()); |
my @domains = sort {lc($a) cmp lc($b)} (&Apache::lonnet::all_domains()); |
if ($includeempty) { @domains=('',@domains); } |
if ($includeempty) { @domains=('',@domains); } |
my $selectdomain = "<select name=\"$name\" size=\"1\">\n"; |
my $selectdomain = "<select name=\"$name\" size=\"1\">\n"; |
foreach my $dom (@domains) { |
foreach my $dom (@domains) { |
$selectdomain.="<option value=\"$dom\" ". |
$selectdomain.="<option value=\"$dom\" ". |
($dom eq $defdom ? 'selected="selected" ' : ''). |
($dom eq $defdom ? 'selected="selected" ' : '').'>'.$dom; |
">$dom</option>\n"; |
if ($showdomdesc) { |
|
if ($dom ne '') { |
|
my $domdesc = &Apache::lonnet::domain($dom,'description'); |
|
if ($domdesc ne '') { |
|
$selectdomain .= ' ('.$domdesc.')'; |
|
} |
|
} |
|
} |
|
$selectdomain .= "</option>\n"; |
} |
} |
$selectdomain.="</select>"; |
$selectdomain.="</select>"; |
return $selectdomain; |
return $selectdomain; |
Line 2243 sub track_student_link {
|
Line 2254 sub track_student_link {
|
$target = ''; |
$target = ''; |
} |
} |
if ($start) { $link.='&start='.$start; } |
if ($start) { $link.='&start='.$start; } |
|
$title = &mt($title); |
|
$linktext = &mt($linktext); |
return qq{<a href="$link" title="$title" $target>$linktext</a>}. |
return qq{<a href="$link" title="$title" $target>$linktext</a>}. |
&help_open_topic('View_recent_activity'); |
&help_open_topic('View_recent_activity'); |
} |
} |
Line 3395 Inputs:
|
Line 3407 Inputs:
|
|
|
=item * $args, optional argument valid values are |
=item * $args, optional argument valid values are |
no_auto_mt_title -> prevents &mt()ing the title arg |
no_auto_mt_title -> prevents &mt()ing the title arg |
|
inherit_jsmath -> when creating popup window in a page, |
|
should it have jsmath forced on by the |
|
current page |
|
|
=back |
=back |
|
|
Line 3451 sub bodytag {
|
Line 3466 sub bodytag {
|
|
|
# construct main body tag |
# construct main body tag |
my $bodytag = "<body $extra_body_attr>". |
my $bodytag = "<body $extra_body_attr>". |
&Apache::lontexconvert::init_math_support(); |
&Apache::lontexconvert::init_math_support($args->{'inherit_jsmath'}); |
|
|
if ($bodyonly) { |
if ($bodyonly) { |
return $bodytag; |
return $bodytag; |
Line 4709 Inputs: $title - optional title for the
|
Line 4724 Inputs: $title - optional title for the
|
|
|
no_auto_mt_title -> prevent &mt()ing the title arg |
no_auto_mt_title -> prevent &mt()ing the title arg |
|
|
|
inherit_jsmath -> when creating popup window in a page, |
|
should it have jsmath forced on by the |
|
current page |
|
|
=cut |
=cut |
|
|
sub start_page { |
sub start_page { |
Line 5532 sub get_secgrprole_info {
|
Line 5551 sub get_secgrprole_info {
|
return (\@sections,\@groups,$allroles,$rolehash,$accesshash); |
return (\@sections,\@groups,$allroles,$rolehash,$accesshash); |
} |
} |
|
|
|
sub user_picker { |
|
my ($dom,$srch,$forcenewuser) = @_; |
|
my $currdom = $dom; |
|
my %curr_selected = ( |
|
srchin => 'dom', |
|
srchby => 'uname', |
|
); |
|
my $srchterm; |
|
if (ref($srch) eq 'HASH') { |
|
if ($srch->{'srchby'} ne '') { |
|
$curr_selected{'srchby'} = $srch->{'srchby'}; |
|
} |
|
if ($srch->{'srchin'} ne '') { |
|
$curr_selected{'srchin'} = $srch->{'srchin'}; |
|
} |
|
if ($srch->{'srchtype'} ne '') { |
|
$curr_selected{'srchtype'} = $srch->{'srchtype'}; |
|
} |
|
if ($srch->{'srchdomain'} ne '') { |
|
$currdom = $srch->{'srchdomain'}; |
|
} |
|
$srchterm = $srch->{'srchterm'}; |
|
} |
|
my %lt=&Apache::lonlocal::texthash( |
|
'doma' => 'Domain/institution to search', |
|
'uname' => 'username', |
|
'lastname' => 'last name', |
|
'lastfirst' => 'last name, first name', |
|
'crs' => 'in this course', |
|
'dom' => 'in this domain', |
|
'alc' => 'all LON-CAPA', |
|
'instd' => 'in institutional directory', |
|
'exact' => 'is', |
|
'contains' => 'contains', |
|
); |
|
my $domform = &select_dom_form($currdom,'srchdomain',1,1); |
|
my $srchinsel = ' <select name="srchin">'; |
|
|
|
my @srchins = ('crs','dom','alc','instd'); |
|
|
|
foreach my $option (@srchins) { |
|
# FIXME 'alc' option unavailable until |
|
# loncreateuser::print_user_query_page() |
|
# has been completed. |
|
next if ($option eq 'alc'); |
|
next if ($option eq 'crs' && !$env{'request.course.id'}); |
|
if ($curr_selected{'srchin'} eq $option) { |
|
$srchinsel .= ' |
|
<option value="'.$option.'" selected="selected">'.$lt{$option}.'</option>'; |
|
} else { |
|
$srchinsel .= ' |
|
<option value="'.$option.'">'.$lt{$option}.'</option>'; |
|
} |
|
} |
|
$srchinsel .= "\n </select>\n"; |
|
|
|
my $srchbysel = ' <select name="srchby">'; |
|
foreach my $option ('uname','lastname','lastfirst') { |
|
if ($curr_selected{'srchby'} eq $option) { |
|
$srchbysel .= ' |
|
<option value="'.$option.'" selected="selected">'.$lt{$option}.'</option>'; |
|
} else { |
|
$srchbysel .= ' |
|
<option value="'.$option.'">'.$lt{$option}.'</option>'; |
|
} |
|
} |
|
$srchbysel .= "\n </select>\n"; |
|
|
|
my $srchtypesel = ' <select name="srchtype">'; |
|
foreach my $option ('exact','contains') { |
|
if ($curr_selected{'srchtype'} eq $option) { |
|
$srchtypesel .= ' |
|
<option value="'.$option.'" selected="selected">'.$lt{$option}.'</option>'; |
|
} else { |
|
$srchtypesel .= ' |
|
<option value="'.$option.'">'.$lt{$option}.'</option>'; |
|
} |
|
} |
|
$srchtypesel .= "\n </select>\n"; |
|
|
|
my ($newuserscript,$new_user_create); |
|
|
|
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\');" /> </p>'; |
|
$newuserscript = <<"ENDSCRIPT"; |
|
|
|
function setSearch(createnew) { |
|
if (createnew == 1) { |
|
for (var i=0; i<document.crtuser.srchby.length; i++) { |
|
if (document.crtuser.srchby.options[i].value == 'uname') { |
|
document.crtuser.srchby.selectedIndex = i; |
|
} |
|
} |
|
for (var i=0; i<document.crtuser.srchin.length; i++) { |
|
if ( document.crtuser.srchin.options[i].value == 'dom') { |
|
document.crtuser.srchin.selectedIndex = i; |
|
} |
|
} |
|
for (var i=0; i<document.crtuser.srchtype.length; i++) { |
|
if (document.crtuser.srchtype.options[i].value == 'exact') { |
|
document.crtuser.srchtype.selectedIndex = i; |
|
} |
|
} |
|
for (var i=0; i<document.crtuser.srchdomain.length; i++) { |
|
if (document.crtuser.srchdomain.options[i].value == '$env{'request.role.domain'}') { |
|
document.crtuser.srchdomain.selectedIndex = i; |
|
} |
|
} |
|
} |
|
} |
|
ENDSCRIPT |
|
|
|
} |
|
|
|
my $output = <<"END_BLOCK"; |
|
<script type="text/javascript"> |
|
function validateEntry() { |
|
|
|
var checkok = 1; |
|
var srchin; |
|
for (var i=0; i<document.crtuser.srchin.length; i++) { |
|
if ( document.crtuser.srchin[i].checked ) { |
|
srchin = document.crtuser.srchin[i].value; |
|
} |
|
} |
|
|
|
var srchtype = document.crtuser.srchtype.options[document.crtuser.srchtype.selectedIndex].value; |
|
var srchby = document.crtuser.srchby.options[document.crtuser.srchby.selectedIndex].value; |
|
var srchdomain = document.crtuser.srchdomain.options[document.crtuser.srchdomain.selectedIndex].value; |
|
var srchterm = document.crtuser.srchterm.value; |
|
var srchin = document.crtuser.srchin.options[document.crtuser.srchin.selectedIndex].value; |
|
var msg = ""; |
|
|
|
if (srchterm == "") { |
|
checkok = 0; |
|
msg += "You must include some text to search for.\\n"; |
|
} |
|
|
|
if (srchtype== 'contains') { |
|
if (srchterm.length < 3) { |
|
checkok = 0; |
|
msg += "The text you are searching for must contain at least three characters when using a 'contains' type search.\\n"; |
|
} |
|
} |
|
if (srchin == 'instd') { |
|
if (srchdomain == '') { |
|
checkok = 0; |
|
msg += "You must choose a domain when using an institutional directory search.\\n"; |
|
} |
|
} |
|
if (srchin == 'dom') { |
|
if (srchdomain == '') { |
|
checkok = 0; |
|
msg += "You must choose a domain when using a domain search.\\n"; |
|
} |
|
} |
|
if (srchby == 'lastfirst') { |
|
if (srchterm.indexOf(",") == -1) { |
|
checkok = 0; |
|
msg += "When using searching by last,first you must include a comma as separator between last name and first name.\\n"; |
|
} |
|
if (srchterm.indexOf(",") == srchterm.length -1) { |
|
checkok = 0; |
|
msg += "When searching by last,first you must include at least one character in the first name.\\n"; |
|
} |
|
} |
|
if (checkok == 0) { |
|
alert("The following need to be corrected before the search can be run:\\n"+msg); |
|
return; |
|
} |
|
if (checkok == 1) { |
|
document.crtuser.submit(); |
|
} |
|
} |
|
|
|
$newuserscript |
|
|
|
</script> |
|
|
|
$new_user_create |
|
|
|
<table> |
|
<tr> |
|
<td>$srchbysel |
|
$srchtypesel |
|
<input type="text" size="15" name="srchterm" value="$srchterm" /> |
|
$srchinsel |
|
</td> |
|
</tr> |
|
<tr> |
|
<td>$lt{'doma'}: $domform</td> |
|
</td> |
|
</tr> |
|
</table> |
|
<br /> |
|
END_BLOCK |
|
|
|
return $output; |
|
} |
|
|
|
|
|
|
=pod |
=pod |
|
|
=back |
=back |
Line 5789 sub record_sep {
|
Line 6010 sub record_sep {
|
$i++; |
$i++; |
} |
} |
} else { |
} else { |
my @allfields; |
my $separator=','; |
if ($env{'form.upfiletype'} eq 'semisv') { |
if ($env{'form.upfiletype'} eq 'semisv') { |
@allfields=split(/;/,$record,-1); |
$separator=';'; |
} else { |
|
@allfields=split(/\,/,$record,-1); |
|
} |
} |
my $i=0; |
my $i=0; |
my $j; |
# the character we are looking for to indicate the end of a quote or a record |
for ($j=0;$j<=$#allfields;$j++) { |
my $looking_for=$separator; |
my $field=$allfields[$j]; |
# do not add the characters to the fields |
if ($field=~/^\s*(\"|\')/) { |
my $ignore=0; |
my $delimiter=$1; |
# we just encountered a separator (or the beginning of the record) |
while (($field!~/$delimiter$/) && ($j<$#allfields)) { |
my $just_found_separator=1; |
$j++; |
# store the field we are working on here |
$field.=','.$allfields[$j]; |
my $field=''; |
} |
# work our way through all characters in record |
$field=~s/^\s*$delimiter//; |
foreach my $character ($record=~/(.)/g) { |
$field=~s/$delimiter\s*$//; |
if ($character eq $looking_for) { |
} |
if ($character ne $separator) { |
$components{&takeleft($i)}=$field; |
# Found the end of a quote, again looking for separator |
$i++; |
$looking_for=$separator; |
|
$ignore=1; |
|
} else { |
|
# Found a separator, store away what we got |
|
$components{&takeleft($i)}=$field; |
|
$i++; |
|
$just_found_separator=1; |
|
$ignore=0; |
|
$field=''; |
|
} |
|
next; |
|
} |
|
# single or double quotation marks after a separator indicate beginning of a quote |
|
# we are now looking for the end of the quote and need to ignore separators |
|
if ((($character eq '"') || ($character eq "'")) && ($just_found_separator)) { |
|
$looking_for=$character; |
|
next; |
|
} |
|
# ignore would be true after we reached the end of a quote |
|
if ($ignore) { next; } |
|
if (($just_found_separator) && ($character=~/\s/)) { next; } |
|
$field.=$character; |
|
$just_found_separator=0; |
} |
} |
|
# catch the very last entry, since we never encountered the separator |
|
$components{&takeleft($i)}=$field; |
} |
} |
return %components; |
return %components; |
} |
} |
Line 6669 sub commit_studentrole {
|
Line 6912 sub commit_studentrole {
|
############################################################ |
############################################################ |
############################################################ |
############################################################ |
|
|
|
sub check_clone { |
|
my ($args) = @_; |
|
my $cloneid='/'.$args->{'clonedomain'}.'/'.$args->{'clonecourse'}; |
|
my ($clonecrsudom,$clonecrsunum)= &LONCAPA::split_courseid($cloneid); |
|
my $clonehome=&Apache::lonnet::homeserver($clonecrsunum,$clonecrsudom); |
|
my $clonemsg; |
|
my $can_clone = 0; |
|
|
|
if ($clonehome eq 'no_host') { |
|
$clonemsg = &mt('Attempting to clone non-existing [_1]', |
|
$args->{'crstype'}); |
|
} else { |
|
my %clonedesc = &Apache::lonnet::coursedescription($cloneid,{'one_time' => 1}); |
|
if ($env{'request.role.domain'} eq $args->{'form.clonedomain'}) { |
|
$can_clone = 1; |
|
} else { |
|
my %clonehash = &Apache::lonnet::get('environment',['cloners'], |
|
$args->{'clonedomain'},$args->{'clonecourse'}); |
|
my @cloners = split(/,/,$clonehash{'cloners'}); |
|
my %roleshash = |
|
&Apache::lonnet::get_my_roles($args->{'ccuname'}, |
|
$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('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'}); |
|
} |
|
} |
|
} |
|
|
|
return ($can_clone, $clonemsg, $cloneid, $clonehome); |
|
} |
|
|
sub construct_course { |
sub construct_course { |
my ($args,$logmsg,$courseid,$crsudom,$crsunum,$udom,$uname,$context) = @_; |
my ($args,$logmsg,$courseid,$crsudom,$crsunum,$udom,$uname,$context) = @_; |
my $outcome; |
my $outcome; |
Line 6676 sub construct_course {
|
Line 6953 sub construct_course {
|
if ($context eq 'auto') { |
if ($context eq 'auto') { |
$linefeed = "\n"; |
$linefeed = "\n"; |
} |
} |
|
|
|
# |
|
# Are we cloning? |
|
# |
|
my ($can_clone, $clonemsg, $cloneid, $clonehome); |
|
if (($args->{'clonecourse'}) && ($args->{'clonedomain'})) { |
|
($can_clone, $clonemsg, $cloneid, $clonehome) = &check_clone($args); |
|
if ($context ne 'auto') { |
|
$clonemsg = '<span class="LC_error">'.$clonemsg.'</span>'; |
|
} |
|
$outcome .= $clonemsg.$linefeed; |
|
|
|
if (!$can_clone) { |
|
return (0,$outcome); |
|
} |
|
} |
|
|
# |
# |
# Open course |
# Open course |
# |
# |
Line 6696 sub construct_course {
|
Line 6990 sub construct_course {
|
# if anyone ever decides to not show this, and Utils::Course::new |
# if anyone ever decides to not show this, and Utils::Course::new |
# will need to be suitably modified. |
# will need to be suitably modified. |
$outcome .= &mt('New LON-CAPA [_1] ID: [_2]',$crstype,$$courseid).$linefeed; |
$outcome .= &mt('New LON-CAPA [_1] ID: [_2]',$crstype,$$courseid).$linefeed; |
|
|
# |
# |
# Check if created correctly |
# Check if created correctly |
# |
# |
($$crsudom,$$crsunum)= &LONCAPA::split_courseid($$courseid); |
($$crsudom,$$crsunum)= &LONCAPA::split_courseid($$courseid); |
my $crsuhome=&Apache::lonnet::homeserver($$crsunum,$$crsudom); |
my $crsuhome=&Apache::lonnet::homeserver($$crsunum,$$crsudom); |
$outcome .= &mt('Created on').': '.$crsuhome.$linefeed; |
$outcome .= &mt('Created on').': '.$crsuhome.$linefeed; |
|
|
# |
# |
# Are we cloning? |
# Do the cloning |
# |
# |
my $cloneid=''; |
if ($can_clone && $cloneid) { |
if (($args->{'clonecourse'}) && ($args->{'clonedomain'})) { |
$clonemsg = &mt('Cloning [_1] from [_2]',$crstype,$clonehome); |
my $can_clone = 0; |
if ($context ne 'auto') { |
$cloneid='/'.$args->{'clonedomain'}.'/'.$args->{'clonecourse'}; |
$clonemsg = '<span class="LC_success">'.$clonemsg.'</span>'; |
my ($clonecrsudom,$clonecrsunum)= &LONCAPA::split_courseid($cloneid); |
} |
my $clonehome=&Apache::lonnet::homeserver($clonecrsunum,$clonecrsudom); |
$outcome .= $clonemsg.$linefeed; |
my $clonemsg; |
my %oldcenv=&Apache::lonnet::dump('environment',$$crsudom,$$crsunum); |
if ($clonehome eq 'no_host') { |
|
$clonemsg = &mt('Attempting to clone non-existing [_1]',$crstype); |
|
if ($context eq 'auto') { |
|
$outcome .= $clonemsg; |
|
} else { |
|
$outcome .= '<font color="red">'.$clonemsg.'</font>'; |
|
} |
|
$outcome .= $linefeed; |
|
} else { |
|
my %clonedesc = &Apache::lonnet::coursedescription($cloneid,{'one_time' => 1}); |
|
if ($env{'request.role.domain'} eq $args->{'form.clonedomain'}) { |
|
$can_clone = 1; |
|
} else { |
|
my %clonehash = &Apache::lonnet::get('environment',['cloners'], |
|
$args->{'clonedomain'},$args->{'clonecourse'}); |
|
my @cloners = split(/,/,$clonehash{'cloners'}); |
|
my %roleshash = |
|
&Apache::lonnet::get_my_roles($args->{'ccuname'}, |
|
$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('The new course was not cloned from an existing course because the course owner ([_1]) does not have cloning rights in the existing course ([_2]).',$args->{'ccuname'}.':'.$args->{'ccdomain'},$clonedesc{'description'}); |
|
if ($context eq 'auto') { |
|
$outcome .= $clonemsg; |
|
} else { |
|
$outcome .= '<font color="red">'.$clonemsg.'</font>'; |
|
} |
|
$outcome .= $linefeed; |
|
} |
|
} |
|
} |
|
if ($can_clone) { |
|
$clonemsg = &mt('Cloning [_1] from [_2]',$crstype,$clonehome); |
|
if ($context eq 'auto') { |
|
$outcome = $clonemsg; |
|
} else { |
|
$outcome .= '<font color="green">'.$clonemsg.'</font>'; |
|
} |
|
$outcome .= $linefeed; |
|
my %oldcenv=&Apache::lonnet::dump('environment',$$crsudom,$$crsunum); |
|
# Copy all files |
# Copy all files |
&Apache::lonclonecourse::copycoursefiles($cloneid,$$courseid); |
&Apache::lonclonecourse::copycoursefiles($cloneid,$$courseid); |
# Restore URL |
# Restore URL |
$cenv{'url'}=$oldcenv{'url'}; |
$cenv{'url'}=$oldcenv{'url'}; |
# Restore title |
# Restore title |
$cenv{'description'}=$oldcenv{'description'}; |
$cenv{'description'}=$oldcenv{'description'}; |
# restore grading mode |
# restore grading mode |
if (defined($oldcenv{'grading'})) { |
if (defined($oldcenv{'grading'})) { |
$cenv{'grading'}=$oldcenv{'grading'}; |
$cenv{'grading'}=$oldcenv{'grading'}; |
} |
|
# Mark as cloned |
|
$cenv{'clonedfrom'}=$cloneid; |
|
delete($cenv{'default_enrollment_start_date'}); |
|
delete($cenv{'default_enrollment_end_date'}); |
|
} |
} |
|
# Mark as cloned |
|
$cenv{'clonedfrom'}=$cloneid; |
|
delete($cenv{'default_enrollment_start_date'}); |
|
delete($cenv{'default_enrollment_end_date'}); |
} |
} |
|
|
# |
# |
# Set environment (will override cloned, if existing) |
# Set environment (will override cloned, if existing) |
# |
# |
Line 6878 sub construct_course {
|
Line 7130 sub construct_course {
|
' ('.$lt{'adby'}.')'; |
' ('.$lt{'adby'}.')'; |
if ($context eq 'auto') { |
if ($context eq 'auto') { |
$outcome .= $badclass_msg.$linefeed; |
$outcome .= $badclass_msg.$linefeed; |
$outcome .= '<font color="red">'.$badclass_msg.$linefeed.'<ul>'."\n"; |
$outcome .= '<div class="LC_warning">'.$badclass_msg.$linefeed.'<ul>'."\n"; |
foreach my $item (@badclasses) { |
foreach my $item (@badclasses) { |
if ($context eq 'auto') { |
if ($context eq 'auto') { |
$outcome .= " - $item\n"; |
$outcome .= " - $item\n"; |
Line 6889 sub construct_course {
|
Line 7141 sub construct_course {
|
if ($context eq 'auto') { |
if ($context eq 'auto') { |
$outcome .= $linefeed; |
$outcome .= $linefeed; |
} else { |
} else { |
$outcome .= "</ul><br /><br /></font>\n"; |
$outcome .= "</ul><br /><br /></div>\n"; |
} |
} |
} |
} |
} |
} |
Line 6911 sub construct_course {
|
Line 7163 sub construct_course {
|
if ($context eq 'auto') { |
if ($context eq 'auto') { |
$outcome .= $krb_msg; |
$outcome .= $krb_msg; |
} else { |
} else { |
$outcome .= '<font color="red" size="+1">'.$krb_msg.'</font>'; |
$outcome .= '<span class="LC_error">'.$krb_msg.'</span>'; |
} |
} |
$outcome .= $linefeed; |
$outcome .= $linefeed; |
} |
} |
Line 7009 sub construct_course {
|
Line 7261 sub construct_course {
|
if ($errtext) { $fatal=2; } |
if ($errtext) { $fatal=2; } |
$outcome .= ($fatal?$errtext:'write ok').$linefeed; |
$outcome .= ($fatal?$errtext:'write ok').$linefeed; |
} |
} |
return $outcome; |
|
|
return (1,$outcome); |
} |
} |
|
|
############################################################ |
############################################################ |