--- loncom/interface/lonbulletin.pm 2009/11/26 05:21:43 1.50 +++ loncom/interface/lonbulletin.pm 2010/03/29 13:34:40 1.59 @@ -1,7 +1,7 @@ # The LearningOnline Network # Bulletin Board Handler # -# $Id: lonbulletin.pm,v 1.50 2009/11/26 05:21:43 faziophi Exp $ +# $Id: lonbulletin.pm,v 1.59 2010/03/29 13:34:40 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -177,7 +177,6 @@ sub handler { if (($syllabus{'uploaded.lastmodified'}) && (!$forceedit)) { $forcestudent='student'; } - if ($target ne 'tex') { $r->print('
'); } if ($forcestudent or $target eq 'tex') { $allowed=0; } if ($allowed) { @@ -185,17 +184,30 @@ sub handler { if (($group ne '') && ($env{'form.group'} eq $group)) { $query_str.='&group='.$group.'&'.$refarg; } - $r->print( - '

'. - &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes',&mt('Help with filling in text boxes')).'
'.&mt('Show Student View').''. - &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'

'); - } elsif ($privileged and $target ne 'tex') { + if ($env{'form.register'}) { + $query_str .= '&register='.$env{'form.register'}; + } + #Function Box for Edit Mode. + my $functionbox = &Apache::lonhtmlcommon::start_funclist(); + $functionbox .= &Apache::lonhtmlcommon::add_item_funclist( + ''.&mt('Show Student View').''. + &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView')); + $functionbox.=&Apache::lonhtmlcommon::end_funclist(); + $r->print(&Apache::loncommon::head_subbox($functionbox).&Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes',&mt('Help with filling in text boxes'))); + } elsif ($privileged and $target ne 'tex') { my $query_str = 'forceedit=edit'; if (($group ne '') && ($env{'form.group'} eq $group)) { $query_str.='&group='.$group.'&'.$refarg; } - $r->print('' - .&mt('Edit').''); + if ($env{'form.register'}) { + $query_str .= '&register='.$env{'form.register'}; + } + #Functionbox for Student view. + my $functionbox = &Apache::lonhtmlcommon::start_funclist(); + $functionbox .= &Apache::lonhtmlcommon::add_item_funclist( + "".&mt('Edit').""); + $functionbox.=&Apache::lonhtmlcommon::end_funclist(); + $r->print(&Apache::loncommon::head_subbox($functionbox)); } if (($env{'form.uploaddoc.filename'}) && @@ -228,78 +240,67 @@ sub handler { &Apache::lonnet::put('bulletinpage_'.$marker,\%syllabus,$dom,$crs); } -# ---------------------------------------------------------------- Get syllabus +# ---------------------------------------------------------------- Get discussion board if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) { + #Print Topic as Heading + my $titletext=&HTML::Entities::encode($syllabus{'aaa_title'},'<>&"');; + if ($target ne 'tex') { + $r->print('

'.$titletext.'

'); + } else { + $r->print('\\\\\textbf{'.&Apache::lonxml::xmlparse($r,'tex',$titletext).'}\\\\'); + } + #Outputbox and Inputbox for Topic + if ($allowed) { + $r->print('
'); + &Apache::lontemplate::print_start_template($r,&mt('Title'),'LC_Box'); + $r->print($titletext); + $r->print("
"); + &Apache::lontemplate::print_textarea_template($r, $syllabus{'aaa_title'}, + 'aaa_title', Apache::lontemplate->RICH_TEXT_ALWAYS_OFF); + &Apache::lontemplate::print_saveall_template($r); + $r->print("
"); + &Apache::lontemplate::print_end_template($r); + } if ($syllabus{'uploaded.photourl'}) { &Apache::lonnet::allowuploaded('/adm/syllabus', $syllabus{'uploaded.photourl'}); - $r->print(''); } + my @htmlids=(); + #Outputbox and Inputbox for Image upload if ($allowed) { + my $message = ''.&mt('Image').''; + &Apache::lontemplate::print_start_template($r, &mt('Upload a Photo'),'LC_Box'); + $r->print($message); + $r->print("

"); $r->print( - ''. ''. - '

'.&mt('Upload a Photo').'

'. ''. ''. - '
'. ''); + &Apache::lontemplate::print_end_template($r); } - foreach my $field (sort(keys(%syllabusfields))) { - if (($syllabus{$field}) || ($allowed)) { - my $message=$syllabus{$field}; - if (&Apache::lonfeedback::newline_to_br($message)) { - &Apache::lonfeedback::newline_to_br(\$message); - } - $message - =~s/(https*\:\/\/[^\s]+)/\\$1\<\/tt\>\<\/a\>/g; - if ($allowed) { - $message=&Apache::lonspeller::markeduptext($message); - } - $message=&Apache::lontexconvert::msgtexconverted($message); - unless ($field eq 'aaa_title') { - if (($field ne 'bbb_content') || ($allowed)) { - if ($target ne 'tex') { - $r->print('

'.$syllabusfields{$field}.'

'); - } else { - $r->print('\\\\\textbf{'.$syllabusfields{$field}.'}\\\\'); - } - } - if ($target ne 'tex') { - $r->print('
'. - $message.'
'); - } else { - $r->print(' '.&Apache::lonxml::xmlparse($r,'tex',$message).' '); - } - if ($allowed) { - $r->print('
'); - } - } else { - if ($target ne 'tex') { - $r->print('

'.$message.'

'); - } else { - $r->print('\\\\\textbf{'.&Apache::lonxml::xmlparse($r,'tex',$message).'}\\\\'); - } - if ($allowed) { - $r->print( - '
'.&mt('Topic').'
'); - } - } - } - } + #Image in Student view. + elsif($syllabus{'uploaded.photourl'} && $target ne 'tex'){ + $r->print(''.&mt('Image').''); + } + + my %custom_handlers = ( 'aaa_title' => sub {} ); + @htmlids = &Apache::lontemplate::print_template_fields($r, \%syllabus, \%syllabusfields, + $target, $allowed, Apache::lontemplate->RICH_TEXT_DETECT_HTML, \%custom_handlers); if ($allowed) { - $r->print(''); + $r->print(''. + &Apache::lonhtmlcommon::htmlareaselectactive(@htmlids)); + } + if ($target ne 'tex'){ + $r->print('



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



')); } - if ($target ne 'tex') {$r->print('

');} else {$r->print('\\\\');} } else { $r->print('

'.&mt('No page information provided.').'

'); } - if ($target ne 'tex') { $r->print('
'); } + #Lists discussion posts and box for a new discussion post. if ($target ne 'tex') { $r->print(&Apache::lonfeedback::list_discussion ('board','OPEN','bulletin___'.$marker.'___'.