');
- }
- if (($ENV{'form.uploaddoc.filename'}) &&
- ($ENV{'form.storeupl'}) && ($allowed)) {
- if ($ENV{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/) {
- $syllabus{'uploaded.photourl'}=
- &Apache::lonnet::userfileupload('uploaddoc',1);
- }
- $syllabus{'uploaded.lastmodified'}=time;
- &Apache::lonnet::put('smppage_'.$marker,\%syllabus,$dom,$crs);
- }
- if (($allowed) && ($ENV{'form.storesyl'})) {
- foreach (keys %syllabusfields) {
- my $field=$ENV{'form.'.$_};
- $field=~s/\s+$//s;
- $field=~s/\\<\;/g;
- $field=~s/\>/\>\;/g;
- $syllabus{$_}=$field;
- }
- $syllabus{'uploaded.lastmodified'}=time;
- &Apache::lonnet::put('smppage_'.$marker,\%syllabus,$dom,$crs);
- }
+ my $allowed;
+ if ($group ne '') {
+ $allowed = &Apache::lonnet::allowed('mdg',$env{'request.course.id'});
+ if (!$allowed) {
+ $allowed = &Apache::lonnet::allowed('mgh',$env{'request.course.id'}.
+ '/'.$marker);
+ }
+ } else {
+ $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});
+ }
+ my $privileged=$allowed;
+ if (($syllabus{'uploaded.lastmodified'}) && (!$forceedit)) {
+ $forcestudent='student';
+ }
+
+ 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').''.
+ &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'
');
+ } elsif ($privileged and $target ne 'tex') {
+ $r->print(''.&mt('Edit').'');
+ }
+ if (($env{'form.uploaddoc.filename'} and $target ne 'tex') &&
+ ($env{'form.storeupl'}) && ($allowed)) {
+ if ($env{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/i) {
+ if ($syllabus{'uploaded.photourl'}) {
+ &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});
+ }
+ if ($caller eq 'grppage') {
+ $syllabus{'uploaded.photourl'}=&Apache::lonnet::userfileupload(
+ 'uploaddoc',1,"grouppage/$marker");
+ } else {
+ $syllabus{'uploaded.photourl'}=
+ &Apache::lonnet::userfileupload('uploaddoc',1,'simplepage');
+ }
+ }
+ $syllabus{'uploaded.lastmodified'}=time;
+ &Apache::lonnet::put($namespace,\%syllabus,$dom,$crs);
+ }
+ if (($allowed) && ($env{'form.storesyl'})) {
+ foreach (keys %syllabusfields) {
+ my $field=$env{'form.'.$_};
+ chomp($field);
+ $field=~s/\s+$//s;
+ $field=~s/^\s+//s;
+ $field=~s/\ $//s;
+ $field=&Apache::lonfeedback::clear_out_html($field,1);
+ $syllabus{$_}=$field;
+ }
+ $syllabus{'uploaded.lastmodified'}=time;
+ &Apache::lonnet::put($namespace,\%syllabus,$dom,$crs);
+ }
# ---------------------------------------------------------------- Get syllabus
if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) {
- if ($syllabus{'uploaded.photourl'}) {
- $r->print('');
- }
- if ($allowed) {
- $r->print(
- '');
- }
- $r->print('
');
+ if ($syllabus{'uploaded.photourl'}) {
+ &Apache::lonnet::allowuploaded('/adm/'.$caller,
+ $syllabus{'uploaded.photourl'});
+
+ my $image='';
+ if ($target eq 'tex') {
+ $image=&Apache::lonxml::xmlparse($r,'tex',$image);
+ }
+ $r->print($image);
+ }
+ if ($allowed) {
+ $r->print(
+ '');
+ }
+ if ($env{'form.grade_target'} ne 'tex') {$r->print('');}
} else {
- $r->print('
No page information provided.
');
+ $r->print('
No page information provided.
');
+ }
+ if ($env{'form.grade_target'} ne 'tex') {
+ $r->print(&Apache::loncommon::end_page());
+ } else {
+ $r->print('\end{document}');
}
- $r->print('