version 1.49.2.17, 2015/03/11 00:28:28
|
version 1.49.2.18, 2015/05/22 16:39:43
|
Line 217 use Apache::lonhtmlcommon();
|
Line 217 use Apache::lonhtmlcommon();
|
use Apache::lonconfigsettings; |
use Apache::lonconfigsettings; |
use Apache::lonrelrequtils; |
use Apache::lonrelrequtils; |
use Apache::lonparmset; |
use Apache::lonparmset; |
|
use Apache::courseclassifier; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use LONCAPA qw(:DEFAULT :match); |
use LONCAPA qw(:DEFAULT :match); |
|
|
Line 540 sub handler {
|
Line 541 sub handler {
|
\@prefs_order,\%prefs,\%values, |
\@prefs_order,\%prefs,\%values, |
$cnum,undef,\@allitems,'coursepref'); |
$cnum,undef,\@allitems,'coursepref'); |
} elsif ($phase eq 'display') { |
} elsif ($phase eq 'display') { |
my $jscript = &get_jscript($cid,$cdom,$phase,$crstype); |
my $jscript = &get_jscript($cid,$cdom,$phase,$crstype,\%values); |
my @allitems = &get_allitems(%prefs); |
my @allitems = &get_allitems(%prefs); |
&Apache::lonconfigsettings::display_settings($r,$cdom,$phase,$context, |
&Apache::lonconfigsettings::display_settings($r,$cdom,$phase,$context, |
\@prefs_order,\%prefs,\%values,undef,$jscript,\@allitems,$crstype,'coursepref'); |
\@prefs_order,\%prefs,\%values,undef,$jscript,\@allitems,$crstype,'coursepref'); |
Line 786 sub process_changes {
|
Line 787 sub process_changes {
|
my @clonedoms; |
my @clonedoms; |
if (exists($env{'form.cloners_activate'})) { |
if (exists($env{'form.cloners_activate'})) { |
my $actnum = $env{'form.cloners_activate'}; |
my $actnum = $env{'form.cloners_activate'}; |
if ($actnum ne '') { |
if ($actnum ne '-1') { |
if ($env{'form.cloners_dom_'.$actnum} ne '') { |
if ($env{'form.cloners_dom_'.$actnum} ne '') { |
my $clonedom = $env{'form.cloners_dom_'.$actnum}; |
my $clonedom = $env{'form.cloners_dom_'.$actnum}; |
if (&check_clone($clonedom,$disallowed) eq 'ok') { |
if (&check_clone($clonedom,$disallowed) eq 'ok') { |
Line 804 sub process_changes {
|
Line 805 sub process_changes {
|
my $clonedom = $env{'form.cloners_dom_'.$i}; |
my $clonedom = $env{'form.cloners_dom_'.$i}; |
if (&check_clone($clonedom,$disallowed) eq 'ok') { |
if (&check_clone($clonedom,$disallowed) eq 'ok') { |
if (!grep(/^\*:\Q$clonedom\E$/,@clonedoms)) { |
if (!grep(/^\*:\Q$clonedom\E$/,@clonedoms)) { |
push (@clonedoms,'*:'.$clonedom); |
push(@clonedoms,'*:'.$clonedom); |
} |
} |
} |
} |
} |
} |
Line 850 sub process_changes {
|
Line 851 sub process_changes {
|
} |
} |
} |
} |
} |
} |
|
if (ref($values) eq 'HASH') { |
|
my (@code_order,%codedefaults); |
|
&Apache::lonnet::auto_instcode_defaults($cdom,\%codedefaults, |
|
\@code_order); |
|
my $clonebycode; |
|
if ($env{'form.cloners_instcode'}) { |
|
if (@code_order > 0) { |
|
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
|
my %local_to_standard; |
|
for (my $i=0; $i<@code_order; $i++) { |
|
$local_to_standard{$code_order[$i]} = $standardnames[$i]; |
|
} |
|
foreach my $item (@code_order) { |
|
my $key = $local_to_standard{$item}; |
|
if ($key ne '') { |
|
if ($env{'form.'.$key}) { |
|
$clonebycode .= $key.'='.&escape($env{'form.'.$key}).'&'; |
|
} |
|
} |
|
} |
|
$clonebycode =~ s/\&$//; |
|
} |
|
} |
|
if ($clonebycode) { |
|
if ($newvalues{$entry}) { |
|
$newvalues{$entry} .= ','.$clonebycode; |
|
} else { |
|
$newvalues{$entry} = $clonebycode; |
|
} |
|
} |
|
} |
} |
} |
if (ref($disallowed) eq 'HASH') { |
if (ref($disallowed) eq 'HASH') { |
if (ref($disallowed->{'cloners'}) eq 'HASH') { |
if (ref($disallowed->{'cloners'}) eq 'HASH') { |
Line 1684 sub get_course {
|
Line 1716 sub get_course {
|
} |
} |
|
|
sub get_jscript { |
sub get_jscript { |
my ($cid,$cdom,$phase,$crstype) = @_; |
my ($cid,$cdom,$phase,$crstype,$settings) = @_; |
my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom,$crstype); |
my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom,$crstype); |
my ($jscript,$categorize_js,$loncaparev_js); |
my ($jscript,$categorize_js,$loncaparev_js,$instcode_js); |
my $stubrowse_js = &Apache::loncommon::studentbrowser_javascript(); |
my $stubrowse_js = &Apache::loncommon::studentbrowser_javascript(); |
my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset'); |
my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset'); |
my $cloners_js = &cloners_javascript($phase); |
my $cloners_js = &cloners_javascript($phase); |
|
my @code_order; |
|
if ($crstype ne 'Community') { |
|
if (ref($settings) eq 'HASH') { |
|
my %codedefaults; |
|
&Apache::lonnet::auto_instcode_defaults($cdom,\%codedefaults, |
|
\@code_order); |
|
if (@code_order > 0) { |
|
if ($phase eq 'display') { |
|
my @actions = &Apache::loncommon::get_env_multiple('form.actions'); |
|
if (grep(/^courseinfo$/,@actions)) { |
|
if ($settings->{'cloners'} ne '') { |
|
unless ($settings->{'cloners'} eq '*') { |
|
my @cloners = split(/,/,$settings->{'cloners'}); |
|
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
|
my %local_to_standard; |
|
for (my $i=0; $i<@code_order; $i++) { |
|
$local_to_standard{$code_order[$i]} = $standardnames[$i]; |
|
} |
|
foreach my $cloner (@cloners) { |
|
if (($cloner !~ /^\Q*:\E$match_domain$/) && |
|
($cloner !~ /^$match_username\:$match_domain$/)) { |
|
foreach my $item (split(/\&/,$cloner)) { |
|
my ($key,$val) = split(/\=/,$item); |
|
$val = &unescape($val); |
|
foreach my $code (@code_order) { |
|
if ($key eq $local_to_standard{$code}) { |
|
$env{'form.'.$key} = $val; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
my @codetitles; |
|
(undef,$instcode_js) = |
|
&Apache::courseclassifier::instcode_selectors($cdom,'display',undef, |
|
\@codetitles); |
|
$instcode_js .= <<ENDSCRIPT; |
|
function toggleCloners(callerradio) { |
|
if (document.getElementById('LC_cloners_instcode')) { |
|
if (callerradio.value == 1) { |
|
document.getElementById('LC_cloners_instcode').style.display = "block"; |
|
} else { |
|
uncheckOfficialLists(); |
|
document.getElementById('LC_cloners_instcode').style.display = "none"; |
|
} |
|
} |
|
} |
|
|
|
if (!document.getElementsByClassName) { |
|
function getElementsByClassName(node, classname) { |
|
var a = []; |
|
var re = new RegExp('(^| )'+classname+'( |$)'); |
|
var els = node.getElementsByTagName("*"); |
|
for(var i=0,j=els.length; i<j; i++) |
|
if(re.test(els[i].className))a.push(els[i]); |
|
return a; |
|
} |
|
} |
|
|
|
function uncheckOfficialLists() { |
|
var codepicks; |
|
if (document.getElementsByClassName) { |
|
codepicks = document.getElementsByClassName('LC_cloners_instcodes'); |
|
} else { |
|
codepicks = getElementsByClassName(document.body,'LC_cloners_instcodes'); |
|
} |
|
if (codepicks.length) { |
|
for (var i=0; i<codepicks.length; i++) { |
|
codepicks[i].selectedIndex = 0; |
|
} |
|
} |
|
} |
|
|
|
ENDSCRIPT |
|
} |
|
} |
|
} |
if ($can_categorize) { |
if ($can_categorize) { |
$categorize_js = <<ENDSCRIPT; |
$categorize_js = <<ENDSCRIPT; |
function catsbrowser() { |
function catsbrowser() { |
Line 1732 ENDSCRIPT
|
Line 1845 ENDSCRIPT
|
$jscript = '<script type="text/javascript" language="Javascript">'."\n". |
$jscript = '<script type="text/javascript" language="Javascript">'."\n". |
'// <![CDATA['."\n". |
'// <![CDATA['."\n". |
$browse_js."\n".$categorize_js."\n".$loncaparev_js."\n". |
$browse_js."\n".$categorize_js."\n".$loncaparev_js."\n". |
$cloners_js."\n". |
$cloners_js."\n".$instcode_js. |
$syllabus_js."\n".'//]]>'."\n". |
$syllabus_js."\n".'//]]>'."\n". |
'</script>'."\n".$stubrowse_js."\n"; |
'</script>'."\n".$stubrowse_js."\n"; |
return $jscript; |
return $jscript; |
Line 1768 function update_cloners(caller,num) {
|
Line 1881 function update_cloners(caller,num) {
|
if (document.$formname.cloners_activate[i].value == '0') { |
if (document.$formname.cloners_activate[i].value == '0') { |
document.$formname.cloners_activate[i].checked = false; |
document.$formname.cloners_activate[i].checked = false; |
} |
} |
if (document.$formname.cloners_activate[i].value == '') { |
if (document.$formname.cloners_activate[i].value == '-1') { |
document.$formname.cloners_activate[i].checked = true; |
document.$formname.cloners_activate[i].checked = true; |
} |
} |
} |
} |
Line 1825 sub print_courseinfo {
|
Line 1938 sub print_courseinfo {
|
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
unless ((ref($settings) eq 'HASH') && (ref($ordered) eq 'ARRAY') && (ref($itemtext) eq 'HASH')) { |
return; |
return; |
} |
} |
my ($cathash,$categoriesform,$autocoowner); |
my ($cathash,$categoriesform,$autocoowner,$clonedefaults); |
my %domconf = |
my %domconf = |
&Apache::lonnet::get_dom('configuration',['coursecategories','autoenroll'],$cdom); |
&Apache::lonnet::get_dom('configuration', |
|
['coursecategories','autoenroll','coursedefaults'],$cdom); |
if (ref($domconf{'coursecategories'}) eq 'HASH') { |
if (ref($domconf{'coursecategories'}) eq 'HASH') { |
$cathash = $domconf{'coursecategories'}{'cats'}; |
$cathash = $domconf{'coursecategories'}{'cats'}; |
if (ref($cathash) eq 'HASH') { |
if (ref($cathash) eq 'HASH') { |
Line 1839 sub print_courseinfo {
|
Line 1953 sub print_courseinfo {
|
if (ref($domconf{'autoenroll'}) eq 'HASH') { |
if (ref($domconf{'autoenroll'}) eq 'HASH') { |
$autocoowner = $domconf{'autoenroll'}{'co-owners'}; |
$autocoowner = $domconf{'autoenroll'}{'co-owners'}; |
} |
} |
|
my ($currcanclone,@code_order,$cloner_instcode); |
|
my %codedefaults; |
|
&Apache::lonnet::auto_instcode_defaults($cdom,\%codedefaults, |
|
\@code_order); |
|
if ($settings->{'cloners'}) { |
|
unless ($settings->{'cloners'} eq '*') { |
|
my @currclone = split(/,/,$settings->{'cloners'}); |
|
foreach my $item (@currclone) { |
|
unless ($item eq '*') { |
|
if (($item !~ /\:/) && ($item =~ /=/)) { |
|
$cloner_instcode = 1; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if (ref($domconf{'coursedefaults'}) eq 'HASH') { |
|
my $canclone = $domconf{'coursedefaults'}{'canclone'}; |
|
if (ref($canclone) eq 'HASH') { |
|
if (ref($canclone->{'instcode'}) eq 'ARRAY') { |
|
if ($settings->{'internal.coursecode'}) { |
|
my @posscodes; |
|
if (@code_order > 0) { |
|
$currcanclone = 'instcode'; |
|
foreach my $item (@{$canclone->{'instcode'}}) { |
|
if (grep(/^\Q$item\E$/,@code_order)) { |
|
push(@posscodes,$item); |
|
} |
|
} |
|
my $codestr = join(' + ',@posscodes); |
|
$clonedefaults = &mt('Default for official courses is to also allow cloning if [_1] match in cloner and cloned.', |
|
'"<span class="LC_nobreak" style="font-style:italic">'.$codestr.'</span>"').'<br />'; |
|
} |
|
} |
|
} |
|
} elsif ($canclone eq 'domain') { |
|
$clonedefaults = &mt('Default is for any course requester in [_1] domain to be able to clone.', |
|
'<span class="LC_nobreak" style="font-style:italic">'.$cdom.'</span>').'<br />'; |
|
$currcanclone = 'domain'; |
|
} |
|
if ($clonedefaults) { |
|
if ($settings->{'cloners'} ne '') { |
|
$clonedefaults .= '<br />'.&mt('Default does [_1]not[_2] currently apply because values have been set in the course.','<b>','</b>'); |
|
} else { |
|
$clonedefaults .= &mt('Default is disregarded if [_1]any[_2] values are set here in the course.','<i>','</i>'); |
|
} |
|
$clonedefaults = '<br /><br />'.$clonedefaults; |
|
} |
|
} |
if (!defined($categoriesform)) { |
if (!defined($categoriesform)) { |
$categoriesform = &mt('No categories defined in this domain.'); |
$categoriesform = &mt('No categories defined in this domain.'); |
} |
} |
|
|
my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom,$crstype); |
my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom,$crstype); |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
Line 1889 sub print_courseinfo {
|
Line 2051 sub print_courseinfo {
|
}, |
}, |
'cloners' => { |
'cloners' => { |
text => '<b>'.&mt($itemtext->{'cloners'}).'</b><br />'. |
text => '<b>'.&mt($itemtext->{'cloners'}).'</b><br />'. |
&mt('Owner and Coordinators included automatically'), |
&mt('Owner and Coordinators included automatically'). |
|
$clonedefaults, |
input => 'textbox', |
input => 'textbox', |
size => '40' |
size => '40' |
}, |
}, |
Line 1960 sub print_courseinfo {
|
Line 2123 sub print_courseinfo {
|
} |
} |
$datatable .= 'onchange="javascript:update_cloners('. |
$datatable .= 'onchange="javascript:update_cloners('. |
"'cloners_all'".');" />'.&mt('Yes').'</label>'. |
"'cloners_all'".');" />'.&mt('Yes').'</label>'. |
(' 'x2).'<input type="radio" name="cloners_all" value="0" '; |
(' 'x2).'<label>'. |
|
'<input type="radio" name="cloners_all" value="0" '; |
if ($settings->{$item} ne '*') { |
if ($settings->{$item} ne '*') { |
$datatable .= ' checked="checked" '; |
$datatable .= ' checked="checked" '; |
} |
} |
$datatable .= ' onchange="javascript:update_cloners('. |
$datatable .= ' onchange="javascript:update_cloners('. |
"'cloners_all'".');"/>'.&mt('No').'</label></td>'. |
"'cloners_all'".');" />'.&mt('No').'</label></td>'. |
&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::end_data_table(). |
&Apache::loncommon::end_data_table(). |
'<table><tr><td align="left"><b>'.&mt('Or'). |
'<table><tr><td align="left"><b>'.&mt('Or'). |
Line 1973 sub print_courseinfo {
|
Line 2137 sub print_courseinfo {
|
&Apache::loncommon::start_data_table(); |
&Apache::loncommon::start_data_table(); |
my @cloners; |
my @cloners; |
if ($settings->{$item} eq '') { |
if ($settings->{$item} eq '') { |
$datatable .= &new_cloners_dom_row($cdom,'0'); |
my $default; |
|
if ($currcanclone eq 'domain') { |
|
$default = '0'; |
|
} |
|
$datatable .= &new_cloners_dom_row($cdom,'0',$default); |
} elsif ($settings->{$item} ne '*') { |
} elsif ($settings->{$item} ne '*') { |
my @entries = split(/,/,$settings->{$item}); |
my @entries = split(/,/,$settings->{$item}); |
if (@entries > 0) { |
if (@entries > 0) { |
Line 2032 sub print_courseinfo {
|
Line 2200 sub print_courseinfo {
|
$items{$item}{'size'}). |
$items{$item}{'size'}). |
'</td>'.&Apache::loncommon::end_data_table_row(). |
'</td>'.&Apache::loncommon::end_data_table_row(). |
&Apache::loncommon::end_data_table(); |
&Apache::loncommon::end_data_table(); |
|
if (@code_order > 0) { |
|
my (%cat_items,@codetitles,%cat_titles,%cat_order); |
|
my ($jscript,$totcodes,$numtitles,$lasttitle) = |
|
&Apache::courseclassifier::instcode_selectors_data($cdom,'display', |
|
\%cat_items,\@codetitles, |
|
\%cat_titles,\%cat_order); |
|
my $showncodes = 'off'; |
|
my $checkedoff = ' checked="checked"'; |
|
my $checkedon = ''; |
|
if ($cloner_instcode) { |
|
$checkedon = $checkedoff; |
|
$checkedoff = ''; |
|
$showncodes = 'on'; |
|
} |
|
$datatable .= '<table><tr><td align="left"><b>'.&mt('And'). |
|
'</b></td></tr></table>'. |
|
&Apache::loncommon::start_data_table(). |
|
&Apache::loncommon::start_data_table_row(). |
|
'<td align="left"><span class="LC_nobreak">'. |
|
&mt('Cloning by official course(s) based on course category').(' 'x2). |
|
'<label>'. |
|
'<input type="radio" name="cloners_instcode" value="1" onclick="toggleCloners(this);"'.$checkedon.' />'.&mt('Yes').'</label>'. |
|
(' '). |
|
'<label>'. |
|
'<input type="radio" name="cloners_instcode" value="0" onclick="toggleCloners(this);"'.$checkedoff.' />'.&mt('No').'</label>'. |
|
&Apache::courseclassifier::build_instcode_selectors($numtitles, |
|
$lasttitle,\%cat_items,\@codetitles,\%cat_titles,\%cat_order, |
|
$showncodes,'LC_cloners_instcodes','LC_cloners_instcode'). |
|
'</td>'.&Apache::loncommon::end_data_table_row(). |
|
&Apache::loncommon::end_data_table(); |
|
} |
} elsif ($item eq 'rolenames') { |
} elsif ($item eq 'rolenames') { |
$datatable .= '</td><td align="right">'. |
$datatable .= '</td><td align="right">'. |
&Apache::loncommon::start_data_table(); |
&Apache::loncommon::start_data_table(); |
Line 2153 sub print_courseinfo {
|
Line 2352 sub print_courseinfo {
|
} |
} |
|
|
sub new_cloners_dom_row { |
sub new_cloners_dom_row { |
my ($newdom,$num) = @_; |
my ($newdom,$num,$default) = @_; |
my $output; |
my ($output,$checkedon,$checkedoff); |
if ($newdom ne '') { |
if ($newdom ne '') { |
|
if ($num eq $default) { |
|
$checkedon = 'checked="checked" '; |
|
} else { |
|
$checkedoff = 'checked="checked" '; |
|
} |
$output .= &Apache::loncommon::start_data_table_row(). |
$output .= &Apache::loncommon::start_data_table_row(). |
'<td valign="top"><span class="LC_nobreak">'. |
'<td valign="top"><span class="LC_nobreak">'. |
&mt('Any user in domain:').' <b>'.$newdom.'</b>'. |
&mt('Any user in domain:').' <b>'.$newdom.'</b>'. |
(' 'x2).'<label><input type="radio" '. |
(' 'x2).'<label><input type="radio" '. |
'name="cloners_activate" value="'.$num.'" '. |
'name="cloners_activate" value="'.$num.'" '.$checkedon. |
'onchange="javascript:update_cloners('. |
'onchange="javascript:update_cloners('. |
"'cloners_activate','$num'".');" />'. |
"'cloners_activate','$num'".');" />'. |
&mt('Yes').'</label>'.(' 'x2). |
&mt('Yes').'</label>'.(' 'x2). |
'<label><input type="radio" '. |
'<label><input type="radio" '. |
'name="cloners_activate" value="" checked="checked" '. |
'name="cloners_activate" value="-1" '.$checkedoff. |
'onchange="javascript:update_cloners('. |
'onchange="javascript:update_cloners('. |
"'cloners_activate','$num'".');" />'. |
"'cloners_activate','$num'".');" />'. |
&mt('No').'</label><input type="hidden" name="cloners_dom_'. |
&mt('No').'</label><input type="hidden" name="cloners_dom_'. |
Line 4416 sub change_clone {
|
Line 4620 sub change_clone {
|
foreach my $currclone (@allowclone) { |
foreach my $currclone (@allowclone) { |
if (!grep(/^$currclone$/,@$oldcloner)) { |
if (!grep(/^$currclone$/,@$oldcloner)) { |
if ($currclone ne '*') { |
if ($currclone ne '*') { |
my ($uname,$udom) = split(/:/,$currclone); |
if ($currclone =~ /:/) { |
if ($uname && $udom && $uname ne '*') { |
my ($uname,$udom) = split(/:/,$currclone); |
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
if ($uname && $udom && $uname ne '*') { |
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
if ($currclonecrs{'cloneable'} !~ /\Q$clone_crs\E/) { |
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
if ($currclonecrs{'cloneable'} eq '') { |
if ($currclonecrs{'cloneable'} !~ /\Q$clone_crs\E/) { |
$currclonecrs{'cloneable'} = $clone_crs; |
if ($currclonecrs{'cloneable'} eq '') { |
} else { |
$currclonecrs{'cloneable'} = $clone_crs; |
$currclonecrs{'cloneable'} .= ','.$clone_crs; |
} else { |
|
$currclonecrs{'cloneable'} .= ','.$clone_crs; |
|
} |
|
&Apache::lonnet::put('environment',\%currclonecrs,$udom,$uname); |
} |
} |
&Apache::lonnet::put('environment',\%currclonecrs,$udom,$uname); |
|
} |
} |
} |
} |
} |
} |
Line 4436 sub change_clone {
|
Line 4642 sub change_clone {
|
foreach my $oldclone (@$oldcloner) { |
foreach my $oldclone (@$oldcloner) { |
if (!grep(/^\Q$oldclone\E$/,@allowclone)) { |
if (!grep(/^\Q$oldclone\E$/,@allowclone)) { |
if ($oldclone ne '*') { |
if ($oldclone ne '*') { |
my ($uname,$udom) = split(/:/,$oldclone); |
if ($oldclone =~ /:/) { |
if ($uname && $udom && $uname ne '*' ) { |
my ($uname,$udom) = split(/:/,$oldclone); |
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
if ($uname && $udom && $uname ne '*' ) { |
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { |
my %newclonecrs = (); |
my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); |
if ($currclonecrs{'cloneable'} =~ /\Q$clone_crs\E/) { |
my %newclonecrs = (); |
if ($currclonecrs{'cloneable'} =~ /,/) { |
if ($currclonecrs{'cloneable'} =~ /\Q$clone_crs\E/) { |
my @currclonecrs = split/,/,$currclonecrs{'cloneable'}; |
if ($currclonecrs{'cloneable'} =~ /,/) { |
foreach my $crs (@currclonecrs) { |
my @currclonecrs = split/,/,$currclonecrs{'cloneable'}; |
if ($crs ne $clone_crs) { |
foreach my $crs (@currclonecrs) { |
$newclonecrs{'cloneable'} .= $crs.','; |
if ($crs ne $clone_crs) { |
|
$newclonecrs{'cloneable'} .= $crs.','; |
|
} |
} |
} |
|
$newclonecrs{'cloneable'} =~ s/,$//; |
|
} else { |
|
$newclonecrs{'cloneable'} = ''; |
} |
} |
$newclonecrs{'cloneable'} =~ s/,$//; |
&Apache::lonnet::put('environment',\%newclonecrs,$udom,$uname); |
} else { |
|
$newclonecrs{'cloneable'} = ''; |
|
} |
} |
&Apache::lonnet::put('environment',\%newclonecrs,$udom,$uname); |
|
} |
} |
} |
} |
} |
} |