--- loncom/interface/lonfeedback.pm 2005/11/10 11:31:04 1.173 +++ loncom/interface/lonfeedback.pm 2006/05/10 22:47:22 1.203 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.173 2005/11/10 11:31:04 www Exp $ +# $Id: lonfeedback.pm,v 1.203 2006/05/10 22:47:22 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -39,6 +39,7 @@ use Apache::lonnet; use Apache::lonhtmlcommon(); use Apache::lonnavmaps; use Apache::lonenc(); +use Apache::lonrss(); use HTML::LCParser(); use Apache::lonspeller(); use Cwd; @@ -725,7 +726,7 @@ ENDDISCUSS if ($outputtarget ne 'tex') { $discussion.=&generate_attachments_button('',$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,'',$mode); if (@currnewattach > 0) { - $newattachmsg .= 'New attachments
'; + $newattachmsg .= '
New attachments
'; if (@currnewattach > 1) { $newattachmsg .= '
    '; foreach my $item (@currnewattach) { @@ -743,17 +744,22 @@ ENDDISCUSS } } } else { + $discussion.='
    '; if (&discussion_open($status) && &Apache::lonnet::allowed('pch', $env{'request.course.id'}. ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { if ($outputtarget ne 'tex') { - $discussion.='
    '. ''. - &mt('Post Discussion').'
    '; - } + &mt('Post Discussion').'
    '; + } } + $discussion.=''. + &mt('Send Message').'
    '; } return $discussion; } @@ -905,16 +911,16 @@ sub build_posting_display { } else { @{$$namesort{$lastname}{$firstname}} = ("$idx"); } - if ($env{'course.'.$env{'request.course.id'}.'.allow_discussion_post_editing'} =~ m/yes/i) { + if (&editing_allowed()) { if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) { $sender.=' '.&mt('Edit').''; unless ($seeid) { - $sender.=" '; } } @@ -924,22 +930,22 @@ sub build_posting_display { unless ($studenthidden) { $sender.=' '.&mt('Make Visible').''; } } else { $sender.=' '.&mt('Hide').''; } $sender.=' '.&mt('Delete').''; @@ -975,8 +981,8 @@ sub build_posting_display { ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { $sender.=' '.&mt('Reply').''; } @@ -1196,11 +1202,7 @@ sub get_post_contents { if ($type eq 'allversions' || $type eq 'export') { $start = 0; if ($$contrib{$idx.':history'}) { - if ($$contrib{$idx.':history'} =~ m/:/) { - @postversions = split/:/,$$contrib{$idx.':history'}; - } else { - @postversions = ("$$contrib{$idx.':history'}"); - } + @postversions = split(/:/,$$contrib{$idx.':history'}); } &get_post_versions($messages,$$contrib{$idx.':message'},1); &get_post_versions($subjects,$$contrib{$idx.':subject'},1); @@ -1256,7 +1258,7 @@ END } } if ($type eq 'allversions') { - $discussion.=(''); + $discussion.=''; return $discussion; } else { return; @@ -1304,10 +1306,9 @@ sub replicate_attachments { sub mail_screen { my ($r,$feedurl,$options) = @_; if (exists($env{'form.origpage'})) { - &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss']); + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['subject','comment','currnewattach','addnewattach','deloldattach','delnewattach','timestamp','idx','anondiscuss','discuss','blog']); } - my $bodytag=&Apache::loncommon::bodytag('Resource Feedback and Discussion', - '','onLoad="window.focus();setposttype();"'); + my $title=&Apache::lonnet::gettitle($feedurl); if (!$title) { $title = $feedurl; } my $quote=''; @@ -1327,12 +1328,15 @@ sub mail_screen { my $attachnum = 0; my $anonchk = (<print(< -The LearningOnline Network with CAPA - -$htmlheader + my $js= < // - -$bodytag +END + + my %onload = ('onload' => 'window.focus();setposttype();'); + my $start_page= + &Apache::loncommon::start_page('Resource Feedback and Discussion',$js, + {'add_entries' => \%onload}); + + $r->print(<$title
    @@ -1577,7 +1568,7 @@ END $r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver)); if ($attachnum > 0) { if (@currnewattach > 0) { - $newattachmsg .= 'New attachments
    '; + $newattachmsg .= '
    New attachments
    '; if (@currnewattach > 1) { $newattachmsg .= '
      '; foreach my $item (@currnewattach) { @@ -1600,7 +1591,8 @@ END } $r->print(&generate_preview_button(). &Apache::lonhtmlcommon::htmlareaselectactive('comment'). - ''); + &Apache::loncommon::end_page()); + } sub print_display_options { @@ -1611,11 +1603,8 @@ sub print_display_options { my $function = &Apache::loncommon::get_users_function(); my $tabcolor = &Apache::loncommon::designparm($function.'.tabbg', $env{'user.domain'}); - my $bodytag=&Apache::loncommon::bodytag('Discussion options', - '',''); my %lt = &Apache::lonlocal::texthash( - 'dido' => 'Discussion display options', 'pref' => 'Display Preference', 'curr' => 'Current setting ', 'actn' => 'Action', @@ -1673,13 +1662,9 @@ sub print_display_options { $currtogg = $lt{'toggon'}; $disctogg = 'toggon'; } - my $html=&Apache::lonxml::xmlbegin(); - $r->print(< -$lt{'dido'} - - - -$bodytag - +END + + + my $start_page = + &Apache::loncommon::start_page('Discussion display options',$js); + my $end_page = + &Apache::loncommon::end_page(); + $r->print(< $lt{'sdpf'}
      $lt{'prca'}
      1. $lt{'whpo'}
      2. $lt{'unwh'}
      3. $lt{'wipa'}

      - - - - -
      - - - - -
      - - - - - +END + $r->print(&Apache::loncommon::start_data_table()); + $r->print(< + - +END + $r->print(&Apache::loncommon::start_data_table_row()); + $r->print(<$lt{'disa'} - +END + $r->print(&Apache::loncommon::end_data_table_row()); + $r->print(&Apache::loncommon::start_data_table_row()); + $r->print(<$lt{'npmr'} - +END + $r->print(&Apache::loncommon::end_data_table_row()); + $r->print(&Apache::loncommon::start_data_table_row()); + $r->print(<$lt{'dotm'} - -
      $lt{'pref'}$lt{'curr'}$lt{'actn'}?$lt{'pref'} + $lt{'curr'} + $lt{'actn'}?
      $lt{$discdisp}
      $lt{$discmark}
      $lt{$disctogg}
      -
      -
      +END + $r->print(&Apache::loncommon::end_data_table_row()); + $r->print(&Apache::loncommon::end_data_table()); + $r->print(<
      @@ -1798,8 +1790,7 @@ $lt{'sdpf'}
      $lt{'prca'}
      1. $l

      2. - - +$end_page END return; } @@ -1811,23 +1802,21 @@ sub print_sortfilter_options { $r->send_http_header; &Apache::lonenc::check_encrypt(\$symb); - my @sections = (); + my @sections; my $section_sel = ''; - my $numsections = 0; my $numvisible = 5; - my %sectioncount = (); - - $numsections = &Apache::loncommon::get_sections($env{'course.'.$env{'request.course.id'}.'.domain'},$env{'course.'.$env{'request.course.id'}.'.num'},\%sectioncount); + my %sectioncount = &Apache::loncommon::get_sections(); if ($env{'request.course.sec'} !~ /^\s*$/) { #Restrict section choice to current section @sections = ('all',$env{'request.course.sec'}); $numvisible = 2; } else { @sections = sort {$a cmp $b} keys(%sectioncount); - unshift(@sections,'all'); # Put 'all' at the front of the list - if ($numsections < 4) { - $numvisible = $numsections + 1; + if (scalar(@sections) < 4) { + $numvisible = scalar(@sections) + 1; } + unshift(@sections,'all'); # Put 'all' at the front of the list + } foreach (@sections) { $section_sel .= "