# The LearningOnline Network # Bulletin Board Handler # # $Id: lonbulletin.pm,v 1.35 2006/04/10 19:59:53 albertel Exp $ # # Copyright Michigan State University Board of Trustees # # This file is part of the LearningOnline Network with CAPA (LON-CAPA). # # LON-CAPA is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # LON-CAPA is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with LON-CAPA; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # /home/httpd/html/adm/gpl.txt # # http://www.lon-capa.org/ # package Apache::lonbulletin; use strict; use Apache::Constants qw(:common); use Apache::loncommon; use Apache::lonnet; use Apache::lontexconvert; use Apache::lonfeedback; use Apache::lonlocal; sub handler { my $r = shift; &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; return OK if $r->header_only; my $target=$env{'form.grade_target'}; # ------------------------------------------------------------ Print the screen if ($target eq 'tex') { $r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'})); } my (undef,undef,undef,undef,$marker)=split(/\//,$r->uri); # Is this even in a course? if (!$env{'request.course.id'}) { &Apache::loncommon::simple_error_page($r,'Not in a course', 'Not in a course'); return OK; } $marker=~s/\D//g; if (!$marker) { &Apache::loncommon::simple_error_page($r,'Invalid Call', 'Invalid Call'); return OK; } my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; # --------------------------------------------------------- The syllabus fields my %syllabusfields=&Apache::lonlocal::texthash( 'aaa_title' => 'Topic', 'bbb_content' => 'Task', 'ccc_webreferences' => 'Web References'); # ------------------------------------------------------------ Get Query String &Apache::loncommon::get_unprocessed_cgi ($ENV{'QUERY_STRING'},['forcestudent','forceedit','register','origpage']); # ----------------------------------------------------- Force menu registration my %addentries; if ($env{'form.origpage'}) { $addentries{'onload'} = "document.location='#newpost';"; } # --------------------------------------------------------------- Force Student my $forcestudent=''; if ($env{'form.forcestudent'}) { $forcestudent='student'; } my $forceedit=''; if ($env{'form.forceedit'}) { $forceedit='edit'; } my %syllabus=&Apache::lonnet::dump('bulletinpage_'.$marker,$dom,$crs); # --------------------------------------- There is such a user, get environment if ($target ne 'tex') { my $start_page = &Apache::loncommon::start_page("Bulletin Board/Discussion",undef, {'function' => $forcestudent, 'add_entries' => \%addentries, 'domain' => $dom, 'force_register' => $env{'form.register'}}); $r->print($start_page); } my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'}); my $privileged=$allowed; if (($syllabus{'uploaded.lastmodified'}) && (!$forceedit)) { $forcestudent='student'; } if ($target ne 'tex') { $r->print('
'); }
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('No page information provided.').' '); } if ($target ne 'tex') { $r->print(' |