--- loncom/interface/lonsimplepage.pm 2006/07/20 03:11:52 1.45 +++ loncom/interface/lonsimplepage.pm 2007/05/02 01:33:49 1.50 @@ -1,7 +1,7 @@ # The LearningOnline Network # Simple Page Editor # -# $Id: lonsimplepage.pm,v 1.45 2006/07/20 03:11:52 raeburn Exp $ +# $Id: lonsimplepage.pm,v 1.50 2007/05/02 01:33:49 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -38,6 +38,7 @@ use Apache::lonlocal; use Apache::lonprintout; use Apache::lonxml; use Apache::longroup; +use HTML::Entities(); use LONCAPA; sub handler { @@ -149,8 +150,13 @@ sub handler { $r->print(&grouppage_breadcrumbs($dom,$crs,$group,$group_desc)); } if ((!$group_home_edit) && (!$group_home_view) && - (!$group_view_perm) && (!$group_edit_perm)) { + (!$group_view_perm) && (!$group_edit_perm)) { &display_group_links($r,$target,$group,'view',$refarg,%groupinfo); + if ($env{'form.grade_target'} ne 'tex') { + $r->print(&Apache::loncommon::end_page()); + } else { + $r->print('\end{document}'); + } return OK; } } else { @@ -164,6 +170,13 @@ sub handler { } return OK; } + my ($blocked,$blocktext) = + &Apache::loncommon::blocking_status('groups'); + if ($blocked) { + $r->print($blocktext); + $r->print(&Apache::loncommon::end_page()); + return OK; + } } my $allowed; @@ -182,7 +195,7 @@ sub handler { } if ($forcestudent or $target eq 'tex') { $allowed=0; } - + if ($allowed) { $r->print('

'. &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes','Help with filling in text boxes').'
'.&mt('Show Student View').''. @@ -220,14 +233,14 @@ sub handler { &Apache::lonnet::put($namespace,\%syllabus,$dom,$crs); } if (($allowed) && ($env{'form.storesyl'})) { - foreach (keys %syllabusfields) { - my $field=$env{'form.'.$_}; + foreach my $syl_field (keys(%syllabusfields)) { + my $field=$env{'form.'.$syl_field}; chomp($field); $field=~s/\s+$//s; $field=~s/^\s+//s; $field=~s/\$//s; $field=&Apache::lonfeedback::clear_out_html($field,1); - $syllabus{$_}=$field; + $syllabus{$syl_field}=$field; } $syllabus{'uploaded.lastmodified'}=time; &Apache::lonnet::put($namespace,\%syllabus,$dom,$crs); @@ -235,8 +248,8 @@ sub handler { # ---------------------------------------------------------------- Get syllabus if ((($syllabus{'uploaded.lastmodified'}) && - (($group ne '' && ($group_home_view || $group_edit_perm || - $group_view_perm)) || ($group eq ''))) || ($allowed)) { + (($group ne '' && ($group_home_view || $group_edit_perm || + $group_view_perm)) || ($group eq ''))) || ($allowed)) { if ($syllabus{'uploaded.photourl'}) { &Apache::lonnet::allowuploaded('/adm/smppg', $syllabus{'uploaded.photourl'}); @@ -253,13 +266,14 @@ sub handler { '

'. ''. '

Upload a Photo

'. - ''. - ''. + ''. + ''. '
'); } - foreach (sort keys %syllabusfields) { - if (($syllabus{$_}) || ($allowed)) { - my $message=$syllabus{$_}; + foreach my $field (sort(keys(%syllabusfields))) { + if (($syllabus{$field}) || ($allowed) || + ($field eq 'abb_links' && $group ne '')) { + my $message=$syllabus{$field}; &Apache::lonfeedback::newline_to_br(\$message); $message =~s/(https*\:\/\/[^\s]+)/\\$1\<\/tt\>\<\/a\>/g; @@ -267,13 +281,13 @@ sub handler { $message=&Apache::lonspeller::markeduptext($message); } $message=&Apache::lontexconvert::msgtexconverted($message); - if ($_ eq 'abb_links' && $group ne '') { - $r->print('
'); + if ($field eq 'abb_links' && $group ne '') { + $r->print('
'); &display_group_links($r,$target,$group,'edit',$refarg, %groupinfo); $r->print('
'); - } elsif ($_ eq 'aaa_title') { + } elsif ($field eq 'aaa_title') { if ($target ne 'tex') { $r->print('

'.$message.'

'); } else { @@ -283,21 +297,21 @@ sub handler { if ($allowed) { if ($env{'form.grade_target'} ne 'tex') { $r->print( - '
Title
'); + '
Title
'); } else { my $safeinit; - $r->print(&Apache::lonxml::xmlparse($r,'tex',$syllabus{$_},$safeinit)); + $r->print(&Apache::lonxml::xmlparse($r,'tex',$syllabus{$field},$safeinit)); } } } else { - if (($_ ne 'bbb_content') || ($allowed)) { + if (($field ne 'bbb_content') || ($allowed)) { if ($target ne 'tex') { - $r->print('

'.$syllabusfields{$_}.'

'); + $r->print('

'.$syllabusfields{$field}.'

'); } else { my $safeinit; - $r->print(&Apache::lonxml::xmlparse($r,'tex','

'.$syllabusfields{$_}.'

')); + $r->print(&Apache::lonxml::xmlparse($r,'tex','

'.$syllabusfields{$field}.'

')); } } if ($target ne 'tex') { @@ -309,12 +323,12 @@ sub handler { } if ($allowed) { if ($target ne 'tex') { - $r->print('
'); + $r->print('
'); } else { my $safeinit; - $r->print(&Apache::lonxml::xmlparse($r,'tex',$syllabus{$_},$safeinit)); + $r->print(&Apache::lonxml::xmlparse($r,'tex',$syllabus{$field},$safeinit)); } } }