[LON-CAPA-cvs] cvs: loncom /interface lonfeedback.pm
raeburn
raeburn@source.lon-capa.org
Wed, 04 Nov 2009 17:45:49 -0000
This is a MIME encoded message
--raeburn1257356749
Content-Type: text/plain
raeburn Wed Nov 4 17:45:49 2009 EDT
Modified files:
/loncom/interface lonfeedback.pm
Log:
- Accommodate Communities.
- role names when filtering post by role type from &Apache::lonnet::plaintext()
- (C)course -> (C)community
(S)student -> (M)member
--raeburn1257356749
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20091104174549.txt"
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.277 loncom/interface/lonfeedback.pm:1.278
--- loncom/interface/lonfeedback.pm:1.277 Mon Oct 12 18:46:03 2009
+++ loncom/interface/lonfeedback.pm Wed Nov 4 17:45:49 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.277 2009/10/12 18:46:03 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.278 2009/11/04 17:45:49 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -172,6 +172,7 @@
my $cdom = $env{'course.'.$cid.'.domain'};
my $cnum = $env{'course.'.$cid.'.num'};
+ my $crstype = &Apache::loncommon::course_type();
# Get information about students and non-students in course for filtering display of posts
my %roleshash = ();
@@ -600,7 +601,7 @@
my %sort_types = ();
my %role_types = ();
my %status_types = ();
- &sort_filter_names(\%sort_types,\%role_types,\%status_types);
+ &sort_filter_names(\%sort_types,\%role_types,\%status_types,$crstype);
$discussion .= '<td><font size="-1"><b>'.&mt('Sorted by').'</b>: '.$sort_types{$sortposts}.'<br />';
if (defined($env{'form.totposters'})) {
@@ -726,13 +727,13 @@
&postingform_display($mode,$ressymb,$now,$subject,
$comment,$outputtarget,$attachnum,
$currnewattach,$currdelold,
- $group);
+ $group,$crstype);
}
} else {
$discussion.=
&postingform_display($mode,$ressymb,$now,$subject,
$comment,$outputtarget,$attachnum,
- $currnewattach,$currdelold);
+ $currnewattach,$currdelold,'',$crstype);
}
}
} else {
@@ -827,7 +828,7 @@
sub postingform_display {
my ($mode,$ressymb,$now,$subject,$comment,$outputtarget,$attachnum,
- $currnewattach,$currdelold,$group) = @_;
+ $currnewattach,$currdelold,$group,$crstype) = @_;
my $newattachmsg;
my %lt = &Apache::lonlocal::texthash(
'note' => 'Note: in anonymous discussion, your name is visible only to course faculty',
@@ -836,6 +837,9 @@
'poan' => 'Post Anonymous Discussion',
'newa' => 'New attachments',
);
+ if ($crstype eq 'Community') {
+ $lt{'note'} = &mt('Note: in anonymous discussion, your name is visible only to community facilitators');
+ }
my $postingform = (<<ENDDISCUSS);
<form action="/adm/feedback" method="post" name="mailform" enctype="multipart/form-data"> <input type="submit" name="discuss" value="$lt{'podi'}" />
<input type="submit" name="anondiscuss" value="$lt{'poan'}" /> <input type="hidden" name="symb" value="$ressymb" />
@@ -863,7 +867,7 @@
}
my $blockblog = &Apache::loncommon::blocking_status('blogs');
if (!$blockblog) {
- $postingform .= &add_blog_checkbox();
+ $postingform .= &add_blog_checkbox($crstype);
}
$postingform .= "</form>\n";
if ($outputtarget ne 'tex') {
@@ -2012,7 +2016,14 @@
my $group_sel = '';
my $numgroupvis = 5;
my %sectioncount = &Apache::loncommon::get_sections();
-
+ my @courseroles = qw(st ad ep ta in);
+ my $crstype = &Apache::loncommon::course_type();
+ my $ccrole = 'cc';
+ if ($crstype eq 'Community') {
+ $ccrole = 'co';
+ }
+ push(@courseroles,$ccrole);
+
if ($env{'request.course.sec'} !~ /^\s*$/) { #Restrict section choice to current section
@sections = ('all',$env{'request.course.sec'});
$numvisible = 2;
@@ -2075,7 +2086,7 @@
my %sort_types = ();
my %role_types = ();
my %status_types = ();
- &sort_filter_names(\%sort_types,\%role_types,\%status_types);
+ &sort_filter_names(\%sort_types,\%role_types,\%status_types,$crstype);
my $js = <<END;
<script type="text/javascript">
@@ -2164,10 +2175,11 @@
<select name="rolefilter" multiple="multiple" size="5">
<option value="all">$role_types{'all'}</option>
<option value="st">$role_types{'st'}</option>
- <option value="cc">$role_types{'cc'}</option>
+ <option value="$ccrole">$role_types{$ccrole}</option>
<option value="in">$role_types{'in'}</option>
<option value="ta">$role_types{'ta'}</option>
<option value="ep">$role_types{'ep'}</option>
+ <option value="ad">$role_types{'ad'}</option>
<option value="cr">$role_types{'cr'}</option>
</select>
</td>
@@ -2567,6 +2579,22 @@
sub screen_header {
my ($feedurl,$symb) = @_;
+ my $crscontent = &mt('Question/Comment/Feedback about course content');
+ my $crspolicy = &mt('Question/Comment/Feedback about course policy');
+ my $contribdisc = &mt('Contribution to course discussion of resource');
+ my $anoncontrib = &mt('Anonymous contribution to course discussion of resource');
+ my $namevis = &mt('name only visible to course faculty');
+ my $crstype;
+ if ($env{'request.course.id'}) {
+ $crstype = &Apache::loncommon::course_type();
+ if ($crstype eq 'Community') {
+ $crscontent = &mt('Question/Comment/Feedback about community content');
+ $crspolicy = &mt('Question/Comment/Feedback about community policy');
+ $contribdisc = &mt('Contribution to community discussion of resource');
+ $anoncontrib = &mt('Anonymous contribution to community discussion of resource');
+ $namevis = &mt('name only visible to community facilitators');
+ }
+ }
my $msgoptions='';
my $discussoptions='';
unless (($env{'form.replydisc'}) || ($env{'form.editdisc'})) {
@@ -2587,13 +2615,13 @@
if (&feedback_available(0,1)) {
$msgoptions.=
'<p><label><input type="radio" name="discuss" value="course" /> '.
- ($optionhash{'comment'}?$optionhash{'comment'}:&mt('Question/Comment/Feedback about course content')).
+ ($optionhash{'comment'}?$optionhash{'comment'}:$crscontent).
'</label></p>';
}
if (&feedback_available(0,0,1)) {
$msgoptions.=
'<p><label><input type="radio" name="discuss" value="policy" /> '.
- ($optionhash{'policy'}?$optionhash{'policy'}:&mt('Question/Comment/Feedback about course policy')).
+ ($optionhash{'policy'}?$optionhash{'policy'}:$crspolicy).
'</label></p>';
}
}
@@ -2604,14 +2632,14 @@
$env{'request.course.id'}.
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
$discussoptions='<label><input type="radio" name="discuss" value="nonanon" checked="checked" /> '.
- &mt('Contribution to course discussion of resource');
- $discussoptions.='</label><br /><label><input type="radio" name="discuss" value="anon" /> '.
- &mt('Anonymous contribution to course discussion of resource').
- ' <i>('.&mt('name only visible to course faculty').')</i></label> '.
+ $contribdisc.
+ '</label><br /><label><input type="radio" name="discuss" value="anon" /> '.
+ $anoncontrib.
+ ' <i>('.$namevis.')</i></label> '.
'<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>';
my $blockblog = &Apache::loncommon::blocking_status('blogs');
if (!$blockblog) {
- $discussoptions.= &add_blog_checkbox();
+ $discussoptions.= &add_blog_checkbox($crstype);
}
}
}
@@ -2674,6 +2702,9 @@
'orig' => 'Original screen output (if applicable)',
'corr' => 'Correct Answer(s) (if applicable)',
);
+ if (&Apache::loncommon::course_type() eq 'Community') {
+ $lt{'prev'} = &mt('Previous attempts of member (if applicable)');
+ }
my $email=<<"ENDEMAIL";
$message
ENDEMAIL
@@ -3255,7 +3286,8 @@
}
sub add_blog_checkbox {
- my ($checkstatus);
+ my ($crstype) = @_;
+ my $checkstatus;
if ($env{'form.blog'}) {
$checkstatus = 'checked="checked"';
}
@@ -3269,8 +3301,13 @@
}
}
</script><br />
-<label><input type="checkbox" name="blog" '.$checkstatus.' /> '.
-&mt('Add to my public course blog').'</label><br />'."\n";
+<label><input type="checkbox" name="blog" '.$checkstatus.' /> ';
+ if ($crstype eq 'Community') {
+ $output .= &mt('Add to my public community blog');
+ } else {
+ $output .= &mt('Add to my public course blog');
+ }
+ $output .= '</label><br />'."\n";
return $output;
}
@@ -3294,8 +3331,9 @@
}
sub sort_filter_names {
- my ($sort_types,$role_types,$status_types) = @_;
- %{$sort_types} = (
+ my ($sort_types,$role_types,$status_types,$crstype) = @_;
+ if (ref($sort_types) eq 'HASH') {
+ %{$sort_types} = (
ascdate => 'Date order - oldest first',
descdate => 'Date order - newest first',
thread => 'Threaded',
@@ -3303,22 +3341,28 @@
username => 'By domain and username',
lastfirst => 'By last name, first name'
);
- %{$role_types} = (
- all => 'All roles',
- st => 'Students',
- cc => 'Course Coordinators',
- in => 'Instructors',
- ta => 'TAs',
- ep => 'Exam proctors',
- ad => 'Administrators',
- cr => 'Custom roles'
- );
- %{$status_types} = (
+ }
+ my @courseroles = qw(st in ta ep ad);
+ if ($crstype eq 'Community') {
+ push(@courseroles,'co');
+ } else {
+ push(@courseroles,'cc');
+ }
+ if (ref($role_types) eq 'HASH') {
+ foreach my $role (@courseroles) {
+ $role_types->{$role} = &Apache::lonnet::plaintext($role,$crstype);
+ }
+ $role_types->{'all'} = 'All roles';
+ $role_types->{'cr'} = 'Custom role';
+ }
+ if (ref($status_types) eq 'HASH') {
+ %{$status_types} = (
all => 'Roles of any status',
Active => 'Only active roles',
Expired => 'Only past roles',
Future => 'Only future roles',
);
+ }
}
sub handler {
@@ -3852,7 +3896,11 @@
$env{'user.domain'},
'CourseBlog_'.$env{'request.course.id'},
$subject,$message,$feedurl,'public');
- $blog='<br />'.&mt('Added to my course blog').'<br />';
+ if (&Apache::loncommon::course_type() eq 'Community') {
+ $blog='<br />'.&mt('Added to my community blog').'<br />';
+ } else {
+ $blog='<br />'.&mt('Added to my course blog').'<br />';
+ }
}
# Receipt screen and redirect back to where came from
--raeburn1257356749--