\n";
+ my ($def,$name,$hashref,$onchange) = @_;
+ return unless (ref($hashref) eq 'HASH');
+ if ($onchange) {
+ $onchange = ' onchange="'.$onchange.'"';
+ }
+ my $selectform = "\n";
my @keys;
- if (exists($hash{'select_form_order'})) {
- @keys=@{$hash{'select_form_order'}};
+ if (exists($hashref->{'select_form_order'})) {
+ @keys=@{$hashref->{'select_form_order'}};
} else {
- @keys=sort(keys(%hash));
+ @keys=sort(keys(%{$hashref}));
}
foreach my $key (@keys) {
$selectform.=
'&').'" '.
($key eq $def ? 'selected="selected" ' : '').
- ">".$hash{$key}." \n";
+ ">".$hashref->{$key}."\n";
}
$selectform.=" ";
return $selectform;
@@ -1902,9 +1912,9 @@ sub display_filter {
&mt('Filter [_1]',
&select_form($env{'form.displayfilter'},
'displayfilter',
- ('currentfolder' => 'Current folder/page',
+ {'currentfolder' => 'Current folder/page',
'containing' => 'Containing phrase',
- 'none' => 'None'))).
+ 'none' => 'None'})).
' ';
}
@@ -3247,7 +3257,7 @@ sub filecategoryselect {
my ($name,$value)=@_;
return &select_form($value,$name,
'' => &mt('Any category'),
- map { $_,$_ } sort(keys(%category_extensions)));
+ {'' => &mt('Any category'), map { $_,$_ } sort(keys(%category_extensions))});
}
=pod
@@ -3412,12 +3422,25 @@ sub get_previous_attempt {
}
$prevattempts=&start_data_table().&start_data_table_header_row();
$prevattempts.=''.&mt('History').' ';
+ my (%typeparts,%lasthidden);
+ my $showsurv=&Apache::lonnet::allowed('vas',$env{'request.course.id'});
foreach my $key (sort(keys(%lasthash))) {
my ($ign,@parts) = split(/\./,$key);
if ($#parts > 0) {
my $data=$parts[-1];
pop(@parts);
- $prevattempts.=''.&mt('Part ').join('.',@parts).' '.$data.' ';
+ if ($data eq 'type') {
+ unless ($showsurv) {
+ my $id = join(',',@parts);
+ $typeparts{$ign.'.'.$id} = $lasthash{$key};
+ if (($lasthash{$key} eq 'anonsurvey') || ($lasthash{$key} eq 'anonsurveycred')) {
+ $lasthidden{$ign.'.'.$id} = 1;
+ }
+ }
+ delete($lasthash{$key});
+ } else {
+ $prevattempts.=''.&mt('Part ').join('.',@parts).' '.$data.' ';
+ }
} else {
if ($#parts == 0) {
$prevattempts.=''.$parts[0].' ';
@@ -3429,21 +3452,90 @@ sub get_previous_attempt {
$prevattempts.=&end_data_table_header_row();
if ($getattempt eq '') {
for ($version=1;$version<=$returnhash{'version'};$version++) {
- $prevattempts.=&start_data_table_row().
- ''.&mt('Transaction [_1]',$version).' ';
- foreach my $key (sort(keys(%lasthash))) {
- my $value = &format_previous_attempt_value($key,
- $returnhash{$version.':'.$key});
- $prevattempts.=''.$value.' ';
- }
- $prevattempts.=&end_data_table_row();
+ my @hidden;
+ if (%typeparts) {
+ foreach my $id (keys(%typeparts)) {
+ if (($returnhash{$version.':'.$id.'.type'} eq 'anonsurvey') || ($returnhash{$version.':'.$id.'.type'} eq 'anonsurveycred')) {
+ push(@hidden,$id);
+ }
+ }
+ }
+ $prevattempts.=&start_data_table_row().
+ ''.&mt('Transaction [_1]',$version).' ';
+ if (@hidden) {
+ foreach my $key (sort(keys(%lasthash))) {
+ my $hide;
+ foreach my $id (@hidden) {
+ if ($key =~ /^\Q$id\E/) {
+ $hide = 1;
+ last;
+ }
+ }
+ if ($hide) {
+ my ($id,$data) = ($key =~ /^(.+)\.([^.]+)$/);
+ if (($data eq 'award') || ($data eq 'awarddetail')) {
+ my $value = &format_previous_attempt_value($key,
+ $returnhash{$version.':'.$key});
+ $prevattempts.=''.$value.' ';
+ } else {
+ $prevattempts.=' ';
+ }
+ } else {
+ if ($key =~ /\./) {
+ my $value = &format_previous_attempt_value($key,
+ $returnhash{$version.':'.$key});
+ $prevattempts.=''.$value.' ';
+ } else {
+ $prevattempts.=' ';
+ }
+ }
+ }
+ } else {
+ foreach my $key (sort(keys(%lasthash))) {
+ my $value = &format_previous_attempt_value($key,
+ $returnhash{$version.':'.$key});
+ $prevattempts.=''.$value.' ';
+ }
+ }
+ $prevattempts.=&end_data_table_row();
}
}
+ my @currhidden = keys(%lasthidden);
$prevattempts.=&start_data_table_row().''.&mt('Current').' ';
foreach my $key (sort(keys(%lasthash))) {
- my $value = &format_previous_attempt_value($key,$lasthash{$key});
- if ($key =~/$regexp$/ && (defined &$gradesub)) {$value = &$gradesub($value)}
- $prevattempts.=''.$value.' ';
+ if (%typeparts) {
+ my $hidden;
+ foreach my $id (@currhidden) {
+ if ($key =~ /^\Q$id\E/) {
+ $hidden = 1;
+ last;
+ }
+ }
+ if ($hidden) {
+ my ($id,$data) = ($key =~ /^(.+)\.([^.]+)$/);
+ if (($data eq 'award') || ($data eq 'awarddetail')) {
+ my $value = &format_previous_attempt_value($key,$lasthash{$key});
+ if ($key =~/$regexp$/ && (defined &$gradesub)) {
+ $value = &$gradesub($value);
+ }
+ $prevattempts.=''.$value.' ';
+ } else {
+ $prevattempts.=' ';
+ }
+ } else {
+ my $value = &format_previous_attempt_value($key,$lasthash{$key});
+ if ($key =~/$regexp$/ && (defined &$gradesub)) {
+ $value = &$gradesub($value);
+ }
+ $prevattempts.=''.$value.' ';
+ }
+ } else {
+ my $value = &format_previous_attempt_value($key,$lasthash{$key});
+ if ($key =~/$regexp$/ && (defined &$gradesub)) {
+ $value = &$gradesub($value);
+ }
+ $prevattempts.=''.$value.' ';
+ }
}
$prevattempts.= &end_data_table_row().&end_data_table();
} else {
@@ -3616,10 +3708,13 @@ sub submlink {
}
if (!$symb) { $symb=&Apache::lonnet::symbread(); }
$symb=&escape($symb);
- if ($target) { $target="target=\"$target\""; }
- return ''.$text.' ';
+ if ($target) { $target=" target=\"$target\""; }
+ return
+ ''.$text.' ';
}
##############################################
@@ -3741,7 +3836,9 @@ sub findallcourses {
$udom = $env{'user.domain'};
}
if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) {
- my %roleshash = &Apache::lonnet::dump('roles',$udom,$uname);
+ my $extra = &Apache::lonnet::freeze_escape({'skipcheck' => 1});
+ my %roleshash = &Apache::lonnet::dump('roles',$udom,$uname,'.',undef,
+ $extra);
if (!%roles) {
%roles = (
cc => 1,
@@ -4146,16 +4243,39 @@ sub get_domainconf {
if (defined($cached)) { return %{$result}; }
my %domconfig = &Apache::lonnet::get_dom('configuration',
- ['login','rolecolors'],$udom);
+ ['login','rolecolors','autoenroll'],$udom);
my (%designhash,%legacy);
if (keys(%domconfig) > 0) {
if (ref($domconfig{'login'}) eq 'HASH') {
if (keys(%{$domconfig{'login'}})) {
foreach my $key (keys(%{$domconfig{'login'}})) {
if (ref($domconfig{'login'}{$key}) eq 'HASH') {
- foreach my $img (keys(%{$domconfig{'login'}{$key}})) {
- $designhash{$udom.'.login.'.$key.'_'.$img} =
- $domconfig{'login'}{$key}{$img};
+ if ($key eq 'loginvia') {
+ if (ref($domconfig{'login'}{'loginvia'}) eq 'HASH') {
+ my @ids = &Apache::lonnet::current_machine_ids();
+ foreach my $hostname (@ids) {
+ if (ref($domconfig{'login'}{'loginvia'}{$hostname}) eq 'HASH') {
+ if ($domconfig{'login'}{'loginvia'}{$hostname}{'server'}) {
+ my $server = $domconfig{'login'}{'loginvia'}{$hostname}{'server'};
+ $designhash{$udom.'.login.loginvia'} = $server;
+ if ($domconfig{'login'}{'loginvia'}{$hostname}{'serverpath'} eq 'custom') {
+
+ $designhash{$udom.'.login.loginvia_'.$hostname} = $server.':'.$domconfig{'login'}{'loginvia'}{$hostname}{'custompath'};
+ } else {
+ $designhash{$udom.'.login.loginvia_'.$hostname} = $server.':'.$domconfig{'login'}{'loginvia'}{$hostname}{'serverpath'};
+ }
+ if ($domconfig{'login'}{'loginvia'}{$hostname}{'exempt'}) {
+ $designhash{$udom.'.login.loginvia_exempt_'.$hostname} = $domconfig{'login'}{'loginvia'}{$hostname}{'exempt'};
+ }
+ }
+ }
+ }
+ }
+ } else {
+ foreach my $img (keys(%{$domconfig{'login'}{$key}})) {
+ $designhash{$udom.'.login.'.$key.'_'.$img} =
+ $domconfig{'login'}{$key}{$img};
+ }
}
} else {
$designhash{$udom.'.login.'.$key}=$domconfig{'login'}{$key};
@@ -4182,6 +4302,11 @@ sub get_domainconf {
} else {
$legacy{'rolecolors'} = 1;
}
+ if (ref($domconfig{'autoenroll'}) eq 'HASH') {
+ if ($domconfig{'autoenroll'}{'co-owners'}) {
+ $designhash{$udom.'.autoassign.co-owners'}=$domconfig{'autoenroll'}{'co-owners'};
+ }
+ }
if (keys(%legacy) > 0) {
my %legacyhash = &get_legacy_domconf($udom);
foreach my $item (keys(%legacyhash)) {
@@ -4459,6 +4584,11 @@ sub bodytag {
my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,
$no_nav_bar,$bgcolor,$no_inline_link,$args)=@_;
+ my $public;
+ if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public'))
+ || ($env{'user.name'} eq '') && ($env{'user.domain'} eq '')) {
+ $public = 1;
+ }
if (!$args->{'no_auto_mt_title'}) { $title = &mt($title); }
$function = &get_users_function() if (!$function);
@@ -4508,12 +4638,12 @@ sub bodytag {
}
my $name = &plainname($env{'user.name'},$env{'user.domain'});
- if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {
+ if ($public) {
undef($role);
} else {
$name = &aboutmewrapper($name,$env{'user.name'},$env{'user.domain'});
}
-
+
my $titleinfo = ''.$title.' ';
#
# Extra info if you are the DC
@@ -4567,7 +4697,7 @@ sub bodytag {
$bodytag .= qq|$realm $dc_info
|;
#don't show menus for public users
- if($env{'user.name'} ne 'public' && $env{'user.domain'} ne 'public'){
+ if (!$public){
$bodytag .= Apache::lonmenu::secondary_menu();
$bodytag .= Apache::lonmenu::serverform();
$bodytag .= Apache::lonhtmlcommon::scripttag('', 'end');
@@ -4623,7 +4753,7 @@ ENDBODY
sub dc_courseid_toggle {
my ($dc_info) = @_;
- return ' '.
+ return ' '.
''.
&mt('(More ...)').' '.
''.$dc_info.'
';
@@ -4739,10 +4869,6 @@ sub standard_css {
my $vlink = &designparm($function.'.vlink', $domain);
my $link = &designparm($function.'.link', $domain);
- my $loginbg = &designparm('login.sidebg',$domain);
- my $bgcol = &designparm('login.bgcol',$domain);
- my $textcol = &designparm('login.textcol',$domain);
-
my $sans = 'Verdana,Arial,Helvetica,sans-serif';
my $mono = 'monospace';
my $data_table_head = $sidebg;
@@ -4761,13 +4887,21 @@ sub standard_css {
my $table_header = '#DDDDDD';
my $feedback_link_bg = '#BBBBBB';
my $lg_border_color = '#C8C8C8';
+ my $button_hover = '#BF2317';
my $border = ($env{'browser.type'} eq 'explorer' ||
$env{'browser.type'} eq 'safari' ) ? '0 2px 0 2px'
: '0 3px 0 4px';
-
return < td.LC_browser_file,
table.LC_data_table tr > td.LC_browser_file_published {
@@ -5288,23 +5451,23 @@ table.LC_data_table tr > td.LC_roles_is
}
table.LC_data_table tr > td.LC_roles_future {
- background: #FFFF77;
+ border-right: 8px solid #FFFF77;
}
table.LC_data_table tr > td.LC_roles_will {
- background: #FFAA77;
+ border-right: 8px solid #FFAA77;
}
table.LC_data_table tr > td.LC_roles_expired {
- background: #FF7777;
+ border-right: 8px solid #FF7777;
}
table.LC_data_table tr > td.LC_roles_will_not {
- background: #AAFF77;
+ border-right: 8px solid #AAFF77;
}
table.LC_data_table tr > td.LC_roles_selected {
- background: #11CC55;
+ border-right: 8px solid #11CC55;
}
span.LC_current_location {
@@ -5339,6 +5502,14 @@ span.LC_parm_symb {
color: #AAAAAA;
}
+ul.LC_parm_parmlist li {
+ display: inline-block;
+ padding: 0.3em 0.8em;
+ vertical-align: top;
+ width: 150px;
+ border-top:1px solid $lg_border_color;
+}
+
td.LC_parm_overview_level_menu,
td.LC_parm_overview_map_menu,
td.LC_parm_overview_parm_selectors,
@@ -5766,56 +5937,41 @@ div.LC_clear_float_footer {
}
div.LC_grade_show_user {
- margin-top: 20px;
- border: 1px solid black;
+/* border-left: 5px solid $sidebg; */
+ border-top: 5px solid #000000;
+ margin: 50px 0 0 0;
+ padding: 15px 0 5px 10px;
}
-div.LC_grade_user_name {
- background: #DDDDEE;
- border-bottom: 1px solid black;
- font-weight: bold;
- font-size: large;
+div.LC_grade_show_user_odd_row {
+/* border-left: 5px solid #000000; */
}
-div.LC_grade_show_user_odd_row div.LC_grade_user_name {
- background: #DDEEDD;
+div.LC_grade_show_user div.LC_Box {
+ margin-right: 50px;
}
-div.LC_grade_show_problem,
div.LC_grade_submissions,
div.LC_grade_message_center,
-div.LC_grade_info_links,
-div.LC_grade_assign {
+div.LC_grade_info_links {
margin: 5px;
width: 99%;
background: #FFFFFF;
}
-div.LC_grade_show_problem_header,
div.LC_grade_submissions_header,
-div.LC_grade_message_center_header,
-div.LC_grade_assign_header {
+div.LC_grade_message_center_header {
font-weight: bold;
font-size: large;
}
-div.LC_grade_show_problem_problem,
div.LC_grade_submissions_body,
-div.LC_grade_message_center_body,
-div.LC_grade_assign_body {
+div.LC_grade_message_center_body {
border: 1px solid black;
width: 99%;
background: #FFFFFF;
}
-span.LC_grade_check_note {
- font-weight: normal;
- font-size: medium;
- display: inline;
- position: absolute;
- right: 1em;
-}
-
table.LC_scantron_action {
width: 100%;
}
@@ -5849,15 +6005,8 @@ div.LC_edit_problem_header_title {
}
table.LC_edit_problem_header_title {
- font-size: larger;
- font-weight: bold;
width: 100%;
- border-color: $pgbg;
- border-style: solid;
- border-width: $border;
background: $tabbg;
- border-collapse: collapse;
- padding: 0;
}
div.LC_edit_problem_discards {
@@ -5890,13 +6039,6 @@ div.LC_createcourse {
display:none;
}
-/* ---- Remove when done ----
-# The following styles is part of the redesign of LON-CAPA and are
-# subject to change during this project.
-# Don't rely on their current functionality as they might be
-# changed or removed.
-# --------------------------*/
-
a:hover,
ol.LC_primary_menu a:hover,
ol#LC_MenuBreadcrumbs a:hover,
@@ -5904,7 +6046,7 @@ ol#LC_PathBreadcrumbs a:hover,
ul#LC_secondary_menu a:hover,
.LC_FormSectionClearButton input:hover
ul.LC_TabContent li:hover a {
- color:#BF2317;
+ color:$button_hover;
text-decoration:none;
}
@@ -5971,7 +6113,7 @@ fieldset > legend {
#LC_nav_bar {
float: left;
- margin: 0;
+ margin: 0 0 2px 0;
}
#LC_realm {
@@ -5986,6 +6128,11 @@ fieldset > legend {
font-style: normal;
}
+/* Preliminary fix to hide nav_bar inside bookmarks window */
+#LC_bookmarks #LC_nav_bar {
+ display:none;
+}
+
ol.LC_primary_menu {
float: right;
margin: 0;
@@ -6016,6 +6163,30 @@ ol.LC_primary_menu a {
text-decoration: none;
}
+ol.LC_docs_parameters {
+ margin-left: 0;
+ padding: 0;
+ list-style: none;
+}
+
+ol.LC_docs_parameters li {
+ margin: 0;
+ padding-right: 20px;
+ display: inline;
+}
+
+ol.LC_docs_parameters li:before {
+ content: "\\002022 \\0020";
+}
+
+li.LC_docs_parameters_title {
+ font-weight: bold;
+}
+
+ol.LC_docs_parameters li.LC_docs_parameters_title:before {
+ content: "";
+}
+
ul#LC_secondary_menu {
clear: both;
color: $fontmenu;
@@ -6055,14 +6226,15 @@ ul#LC_secondary_menu li a {
}
ul.LC_TabContent {
- min-height:1.5em;
+ min-height:20px;
}
ul.LC_TabContent li {
vertical-align:middle;
- padding: 0 10px 0 10px;
+ padding: 0 16px 0 10px;
background-color:$tabbg;
border-bottom:solid 1px $lg_border_color;
+ border-right: solid 1px $font;
}
ul.LC_TabContent .right {
@@ -6075,16 +6247,33 @@ ul.LC_TabContent li {
text-decoration:none;
font-size:95%;
font-weight:bold;
- padding-right: 16px;
+ min-height:20px;
+}
+
+ul.LC_TabContent li a:hover,
+ul.LC_TabContent li a:focus {
+ color: $button_hover;
+ background:none;
+ outline:none;
+}
+
+ul.LC_TabContent li:hover {
+ color: $button_hover;
+ cursor:pointer;
}
-ul.LC_TabContent li:hover,
ul.LC_TabContent li.active {
+ color: $font;
background:#FFFFFF url(/adm/lonIcons/open.gif) no-repeat scroll right center;
- border-bottom:solid 2px #FFFFFF;
- padding-right: 16px;
+ border-bottom:solid 1px #FFFFFF;
+ cursor: default;
}
+ul.LC_TabContent li.active a {
+ color:$font;
+ background:#FFFFFF;
+ outline: none;
+}
#maincoursedoc {
clear:both;
}
@@ -6103,6 +6292,10 @@ ul.LC_TabContentBigger li {
color: #737373;
}
+ul.LC_TabContentBigger li.active {
+ position: relative;
+ top: 1px;
+}
ul.LC_TabContentBigger li a {
background:url('/adm/lonIcons/tabbgleft.gif') left bottom no-repeat;
@@ -6111,31 +6304,33 @@ ul.LC_TabContentBigger li a {
text-align: center;
display: block;
text-decoration: none;
+ outline: none;
}
-ul.LC_TabContentBigger li:hover a,
ul.LC_TabContentBigger li.active a {
background:url('/adm/lonIcons/tabbgleft.gif') left top no-repeat;
color:$font;
- text-decoration: underline;
}
-
ul.LC_TabContentBigger li b {
background: url('/adm/lonIcons/tabbgright.gif') no-repeat right bottom;
display: block;
float: left;
padding: 0 30px;
+ border-bottom: 1px solid $lg_border_color;
+}
+
+ul.LC_TabContentBigger li:hover b {
+ color:$button_hover;
}
-ul.LC_TabContentBigger li:hover b,
ul.LC_TabContentBigger li.active b {
background:url('/adm/lonIcons/tabbgright.gif') right top no-repeat;
color:$font;
- border-bottom: 1px solid #FFFFFF;
+ border: 0;
+ cursor:default;
}
-
ul.LC_CourseBreadcrumbs {
background: $sidebg;
line-height: 32px;
@@ -6165,6 +6360,14 @@ ul.LC_CourseBreadcrumbs li a {
font-size:90%;
}
+ol#LC_MenuBreadcrumbs h1 {
+ display: inline;
+ font-size: 90%;
+ line-height: 2.5em;
+ margin: 0;
+ padding: 0;
+}
+
ol#LC_PathBreadcrumbs li a {
text-decoration:none;
font-size:100%;
@@ -6261,52 +6464,6 @@ div.LC_columnSection>* {
overflow:hidden;
}
-.LC_loginpage_container {
- text-align:left;
- margin : 0 auto;
- width:90%;
- padding: 10px;
- height: auto;
- background-color:#FFFFFF;
- border:1px solid #CCCCCC;
-}
-
-
-.LC_loginpage_loginContainer {
- float:left;
- width: 182px;
- padding: 2px;
- border:1px solid #CCCCCC;
- background-color:$loginbg;
-}
-
-.LC_loginpage_loginContainer h2 {
- margin-top: 0;
- display:block;
- background:$bgcol;
- color:$textcol;
- padding-left:5px;
-}
-
-.LC_loginpage_loginInfo {
- float:left;
- width:182px;
- border:1px solid #CCCCCC;
- padding:2px;
-}
-
-.LC_loginpage_space {
- clear: both;
- margin-bottom: 20px;
- border-bottom: 1px solid #CCCCCC;
-}
-
-.LC_loginpage_floatLeft {
- float: left;
- width: 200px;
- margin: 0;
-}
-
table em {
font-weight: bold;
font-style: normal;
@@ -6553,10 +6710,6 @@ Inputs: none
sub xml_begin {
my $output='';
- if ($env{'internal.start_page'}==1) {
- &Apache::lonhtmlcommon::init_htmlareafields();
- }
-
if ($env{'browser.mathml'}) {
$output=''
#.''."\n"
@@ -6851,15 +7004,26 @@ sub simple_error_page {
{
my @row_count;
+
+ sub start_data_table_count {
+ unshift(@row_count, 0);
+ return;
+ }
+
+ sub end_data_table_count {
+ shift(@row_count);
+ return;
+ }
+
sub start_data_table {
my ($add_class) = @_;
my $css_class = (join(' ','LC_data_table',$add_class));
- unshift(@row_count,0);
+ &start_data_table_count();
return ''."\n";
}
sub end_data_table {
- shift(@row_count);
+ &end_data_table_count();
return '
'."\n";;
}
@@ -7038,7 +7202,8 @@ role status: active, previous or future.
sub check_user_status {
my ($udom,$uname,$cdom,$crs,$role,$sec) = @_;
- my %userinfo = &Apache::lonnet::dump('roles',$udom,$uname);
+ my $extra = &Apache::lonnet::freeze_escape({'skipcheck' => 1});
+ my %userinfo = &Apache::lonnet::dump('roles',$udom,$uname,'.',undef,$extra);
my @uroles = keys %userinfo;
my $srchstr;
my $active_chk = 'none';
@@ -8077,6 +8242,10 @@ sub get_institutional_codes {
return;
}
+sub get_standard_codeitems {
+ return ('Year','Semester','Department','Number','Section');
+}
+
=pod
=head1 Slot Helpers
@@ -10013,19 +10182,19 @@ sub check_clone {
my $clonehome=&Apache::lonnet::homeserver($clonecrsunum,$clonecrsudom);
my $clonemsg;
my $can_clone = 0;
- my $lctype = lc($args->{'type'});
+ my $lctype = lc($args->{'crstype'});
if ($lctype ne 'community') {
$lctype = 'course';
}
if ($clonehome eq 'no_host') {
- if ($args->{'type'} eq 'Community') {
+ if ($args->{'crstype'} eq 'Community') {
$clonemsg = &mt('No new community created.').$linefeed.&mt('A new community could not be cloned from the specified original - [_1] - because it is a non-existent community.',$args->{'clonecourse'}.':'.$args->{'clonedomain'});
} else {
$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'});
}
} else {
my %clonedesc = &Apache::lonnet::coursedescription($cloneid,{'one_time' => 1});
- if ($args->{'type'} eq 'Community') {
+ if ($args->{'crstype'} eq 'Community') {
if ($clonedesc{'type'} ne 'Community') {
$clonemsg = &mt('No new community created.').$linefeed.&mt('A new community could not be cloned from the specified original - [_1] - because it is a course not a community.',$args->{'clonecourse'}.':'.$args->{'clonedomain'});
return ($can_clone, $clonemsg, $cloneid, $clonehome);
@@ -10044,7 +10213,7 @@ sub check_clone {
$can_clone = 1;
} else {
my $ccrole = 'cc';
- if ($args->{'type'} eq 'Community') {
+ if ($args->{'crstype'} eq 'Community') {
$ccrole = 'co';
}
my %roleshash =
@@ -10053,9 +10222,11 @@ sub check_clone {
'userroles',['active'],[$ccrole],
[$args->{'clonedomain'}]);
if (($roleshash{$args->{'clonecourse'}.':'.$args->{'clonedomain'}.':'.$ccrole}) || (grep(/^\Q$args->{'ccuname'}\E:\Q$args->{'ccdomain'}\E$/,@cloners))) {
- $can_clone = 1;
- } else {
- if ($args->{'type'} eq 'Community') {
+ $can_clone = 1;
+ } elsif (&Apache::lonnet::is_course_owner($args->{'clonedomain'},$args->{'clonecourse'},$args->{'ccuname'},$args->{'ccdomain'})) {
+ $can_clone = 1;
+ } else {
+ if ($args->{'crstype'} eq 'Community') {
$clonemsg = &mt('No new community created.').$linefeed.&mt('The new community could not be cloned from the existing community because the new community owner ([_1]) does not have cloning rights in the existing community ([_2]).',$args->{'ccuname'}.':'.$args->{'ccdomain'},$clonedesc{'description'});
} 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'});
@@ -10114,11 +10285,19 @@ sub construct_course {
# if anyone ever decides to not show this, and Utils::Course::new
# will need to be suitably modified.
$outcome .= &mt('New LON-CAPA [_1] ID: [_2]',$crstype,$$courseid).$linefeed;
+ if ($$courseid =~ /^error:/) {
+ return (0,$outcome);
+ }
+
#
# Check if created correctly
#
($$crsudom,$$crsunum)= &LONCAPA::split_courseid($$courseid);
my $crsuhome=&Apache::lonnet::homeserver($$crsunum,$$crsudom);
+ if ($crsuhome eq 'no_host') {
+ $outcome .= &mt('Course creation failed, unrecognized course home server.').$linefeed;
+ return (0,$outcome);
+ }
$outcome .= &mt('Created on').': '.$crsuhome.$linefeed;
#
@@ -10137,6 +10316,10 @@ sub construct_course {
$cenv{'url'}=$oldcenv{'url'};
# Restore title
$cenv{'description'}=$oldcenv{'description'};
+# Restore creation date, creator and creation context.
+ $cenv{'internal.created'}=$oldcenv{'internal.created'};
+ $cenv{'internal.creator'}=$oldcenv{'internal.creator'};
+ $cenv{'internal.creationcontext'}=$oldcenv{'internal.creationcontext'};
# Mark as cloned
$cenv{'clonedfrom'}=$cloneid;
# Need to clone grading mode
@@ -10383,7 +10566,7 @@ sub construct_course {
$title=&mt('Syllabus');
$url='/public/'.$$crsudom.'/'.$$crsunum.'/syllabus';
} else {
- $title=&mt('Navigate Contents');
+ $title=&mt('Table of Contents');
$url='/adm/navmaps';
}
@@ -10613,16 +10796,20 @@ sub init_user_environment {
$initial_env{"browser.interface"} = $form->{'interface'};
$env{'browser.interface'}=$form->{'interface'};
}
+ my %is_adv = ( is_adv => $env{'user.adv'} );
+ my %domdef = &Apache::lonnet::get_domain_defaults($domain);
foreach my $tool ('aboutme','blog','portfolio') {
$userenv{'availabletools.'.$tool} =
- &Apache::lonnet::usertools_access($username,$domain,$tool,'reload');
+ &Apache::lonnet::usertools_access($username,$domain,$tool,'reload',
+ undef,\%userenv,\%domdef,\%is_adv);
}
foreach my $crstype ('official','unofficial','community') {
$userenv{'canrequest.'.$crstype} =
&Apache::lonnet::usertools_access($username,$domain,$crstype,
- 'reload','requestcourses');
+ 'reload','requestcourses',
+ \%userenv,\%domdef,\%is_adv);
}
$env{'user.environment'} = "$lonids/$cookie.id";