--- loncom/interface/lonfeedback.pm 2001/08/10 14:45:11 1.14 +++ loncom/interface/lonfeedback.pm 2001/11/06 11:55:11 1.18 @@ -15,7 +15,7 @@ # 2/13 Guy Albertelli # 7/25 Gerd Kortemeyer # 7/26 Guy Albertelli -# 7/26,8/10 Gerd Kortemeyer +# 7/26,8/10,10/1,11/5,11/6 Gerd Kortemeyer package Apache::lonfeedback; @@ -83,7 +83,7 @@ sub mail_screen { Please check at least one of the following feedback types: $options
My question/comment/feedback:

-

@@ -263,11 +263,22 @@ sub send_msg { 'Feedback '.$feedurl,$email,$citations) eq 'ok') { $status.='
Error sending message to '.$_.'
'; } else { - #$status.='
Message sent to '.$_.'
'; $sendsomething++; } } - } keys %to; + } keys %to; + + my %record=&Apache::lonnet::restore('_feedback'); + my ($temp)=keys %record; + unless ($temp=~/^error\:/) { + my %newrecord=(); + $newrecord{'resource'}=$feedurl; + $newrecord{'subnumber'}=$record{'subnumber'}+1; + unless (&Apache::lonnet::cstore(\%newrecord,'_feedback') eq 'ok') { + $status.='
Not registered
'; + } + } + return ($status,$sendsomething); } @@ -284,10 +295,17 @@ sub adddiscuss { $status='Adding to class discussion'.($anon?' (anonymous)':'').': '. &Apache::lonnet::store(\%contrib,$symb,$ENV{'request.course.id'}, $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, - $ENV{'course.'.$ENV{'request.course.id'}.'.num'}). - '
'; + $ENV{'course.'.$ENV{'request.course.id'}.'.num'}); + } + my %record=&Apache::lonnet::restore('_discussion'); + my ($temp)=keys %record; + unless ($temp=~/^error\:/) { + my %newrecord=(); + $newrecord{'resource'}=$symb; + $newrecord{'subnumber'}=$record{'subnumber'}+1; + $status.=' '.&Apache::lonnet::cstore(\%newrecord,'_discussion'); } - return $status; + return $status.'
'; } sub handler { @@ -297,7 +315,53 @@ sub handler { $r->send_http_header; return OK; } - + +# --------------------------- Get query string for limited number of parameters + + map { + my ($name, $value) = split(/=/,$_); + $value =~ tr/+/ /; + $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; + if (($name eq 'hide') || ($name eq 'unhide')) { + unless ($ENV{'form.'.$name}) { + $ENV{'form.'.$name}=$value; + } + } + } (split(/&/,$ENV{'QUERY_STRING'})); + + if (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) { +# ----------------------------------------------------------------- Hide/unhide + $r->content_type('text/html'); + $r->send_http_header; + + my $entry=$ENV{'form.hide'}?$ENV{'form.hide'}:$ENV{'form.unhide'}; + + my ($symb,$idx)=split(/\:\:\:/,$entry); + my ($map,$ind,$url)=split(/\_\_\_/,$symb); + + my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'}, + $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, + $ENV{'course.'.$ENV{'request.course.id'}.'.num'}); + + + my $currenthidden=$contrib{'hidden'}; + + if ($ENV{'form.hide'}) { + $currenthidden.='.'.$idx.'.'; + } else { + $currenthidden=~s/\.$idx\.//g; + } + my %newhash=('hidden' => $currenthidden); + + &Apache::lonnet::store(\%newhash,$symb,$ENV{'request.course.id'}, + $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, + $ENV{'course.'.$ENV{'request.course.id'}.'.num'}); + + &redirect_back($r,'/res/'.$url,'Changed discussion status

','0'); + + + } else { +# ------------------------------------------------------------- Normal feedback my $feedurl=$ENV{'form.postdata'}; $feedurl=~s/^http\:\/\///; $feedurl=~s/^$ENV{'SERVER_NAME'}//; @@ -375,6 +439,7 @@ sub handler { # Ambiguous Problem Resource $r->internal_redirect('/adm/ambiguous'); } +} return OK; }