--- loncom/interface/lonsimplepage.pm 2004/02/11 00:22:21 1.15 +++ loncom/interface/lonsimplepage.pm 2004/04/30 23:13:52 1.17 @@ -1,7 +1,7 @@ # The LearningOnline Network # Simple Page Editor # -# $Id: lonsimplepage.pm,v 1.15 2004/02/11 00:22:21 albertel Exp $ +# $Id: lonsimplepage.pm,v 1.17 2004/04/30 23:13:52 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -84,7 +84,7 @@ ENDDOCUMENT # ------------------------------------------------------------ Get query string &Apache::loncommon::get_unprocessed_cgi - ($ENV{'QUERY_STRING'},['forcestudent','register']); + ($ENV{'QUERY_STRING'},['forcestudent','forceedit','register']); # ----------------------------------------------------- Force menu registration my $addentries=''; if ($ENV{'form.register'}) { @@ -95,6 +95,8 @@ ENDDOCUMENT # --------------------------------------------------------------- Force Student my $forcestudent=''; if ($ENV{'form.forcestudent'} ||$ENV{'form.grade_target'} eq 'tex' ) { $forcestudent='student'; }; + my $forceedit=''; + if ($ENV{'form.forceedit'}) { $forceedit='edit'; } my %syllabus=&Apache::lonnet::dump('smppage_'.$marker,$dom,$crs); @@ -107,21 +109,30 @@ ENDDOCUMENT } my $allowed=&Apache::lonnet::allowed('mdc',$ENV{'request.course.id'}); + my $privileged=$allowed; + if (($syllabus{'uploaded.lastmodified'}) && (!$forceedit)) { + $forcestudent='student'; + } if ($forcestudent) { $allowed=0; } - if ($allowed) { - if ($ENV{'form.grade_target'} ne 'tex') { - $r->print('

'. - &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes','Help with filling in text boxes').'
Show Student View'. + if ($ENV{'form.grade_target'} ne 'tex') { + 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) { + $r->print(''.&mt('Edit').''); + } } if (($ENV{'form.uploaddoc.filename'}) && ($ENV{'form.storeupl'}) && ($allowed)) { if ($ENV{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/i) { - $syllabus{'uploaded.photourl'}= - &Apache::lonnet::userfileupload('uploaddoc',1); + if ($syllabus{'uploaded.photourl'}) { + &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'}); + } + $syllabus{'uploaded.photourl'}= + &Apache::lonnet::userfileupload('uploaddoc',1,'simplepage'); } $syllabus{'uploaded.lastmodified'}=time; &Apache::lonnet::put('smppage_'.$marker,\%syllabus,$dom,$crs); @@ -141,14 +152,16 @@ ENDDOCUMENT if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) { if ($syllabus{'uploaded.photourl'}) { if ($ENV{'form.grade_target'} ne 'tex') { - $r->print(''); } } if ($allowed && ($ENV{'form.grade_target'} ne 'tex')) { $r->print( '
'. + ''. '

Upload a Photo

'. ''. ''.