version 1.230, 2006/12/06 19:06:40
|
version 1.231, 2006/12/08 00:28:59
|
Line 107 sub list_discussion {
|
Line 107 sub list_discussion {
|
$crs.='_'.$env{'request.course.sec'}; |
$crs.='_'.$env{'request.course.sec'}; |
} |
} |
$crs=~s/\_/\//g; |
$crs=~s/\_/\//g; |
unless ($ressymb) { $ressymb=&Apache::lonnet::symbread(); } |
unless ($ressymb) { $ressymb=&Apache::lonnet::symbread(); } |
unless ($ressymb) { return ''; } |
unless ($ressymb) { return ''; } |
$ressymb=&wrap_symb($ressymb); |
$ressymb=&wrap_symb($ressymb); |
my $encsymb=&Apache::lonenc::check_encrypt($ressymb); |
my $encsymb=&Apache::lonenc::check_encrypt($ressymb); |
Line 2816 sub adddiscuss {
|
Line 2816 sub adddiscuss {
|
$contrib{'anonymous'}='true'; |
$contrib{'anonymous'}='true'; |
} |
} |
if (($symb) && ($email)) { |
if (($symb) && ($email)) { |
|
my $now = time; |
if ($env{'form.editdisc'}) { |
if ($env{'form.editdisc'}) { |
$contrib{'ip'}=$ENV{'REMOTE_ADDR'}; |
$contrib{'ip'}=$ENV{'REMOTE_ADDR'}; |
$contrib{'host'}=$Apache::lonnet::perlvar{'lonHostID'}; |
$contrib{'host'}=$Apache::lonnet::perlvar{'lonHostID'}; |
$contrib{'timestamp'} = time; |
$contrib{'timestamp'} = $now; |
$contrib{'history'} = ''; |
$contrib{'history'} = ''; |
my $numoldver = 0; |
my $numoldver = 0; |
my ($oldsymb,$oldidx)=split(/\:\:\:/,$env{'form.editdisc'}); |
my ($oldsymb,$oldidx)=split(/\:\:\:/,$env{'form.editdisc'}); |
Line 2870 sub adddiscuss {
|
Line 2871 sub adddiscuss {
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
} |
} |
my %storenewentry=($symb => time); |
my %storenewentry=($symb => $now); |
$status.='<br />'.&mt('Updating discussion time').': '. |
$status.='<br />'.&mt('Updating discussion time').': '. |
&Apache::lonnet::put('discussiontimes',\%storenewentry, |
&Apache::lonnet::put('discussiontimes',\%storenewentry, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
Line 2891 sub adddiscuss {
|
Line 2892 sub adddiscuss {
|
return $status.'<br />'; |
return $status.'<br />'; |
} |
} |
|
|
|
sub get_discussion_info { |
|
my ($idx,%contrib) = @_; |
|
my $changelast = 0; |
|
my $count = 0; |
|
my $hiddenflag = 0; |
|
my $deletedflag = 0; |
|
my ($hidden,$deleted,%info,$newlastdisc); |
|
my $version = $contrib{'version'}; |
|
if ($version) { |
|
for (my $id=$version; $id>0; $id--) { |
|
my $vkeys=$contrib{$id.':keys'}; |
|
my @keys=split(/:/,$vkeys); |
|
if (grep(/^hidden$/,@keys)) { |
|
if (!$hiddenflag) { |
|
$hidden = $contrib{$id.':hidden'}; |
|
$hiddenflag = 1; |
|
} |
|
} elsif (grep(/^deleted$/,@keys)) { |
|
if (!$deletedflag) { |
|
$deleted = $contrib{$id.':deleted'}; |
|
$deletedflag = 1; |
|
} |
|
} else { |
|
if (($hidden !~/\.$id\./) && ($deleted !~/\.$id\./)) { |
|
$count++; |
|
$info{$count}{'id'} = $id; |
|
$info{$count}{'timestamp'}=$contrib{$id.':timestamp'}; |
|
} |
|
} |
|
} |
|
if ($info{'1'}{'id'} == $idx) { |
|
$changelast = 1; |
|
if ($count > 1) { |
|
$newlastdisc = $info{'2'}{'timestamp'}; |
|
} else { |
|
$newlastdisc = 0; |
|
} |
|
} |
|
} |
|
return ($changelast,$newlastdisc); |
|
} |
|
|
# ----------------------------------------------------------- Preview function |
# ----------------------------------------------------------- Preview function |
|
|
sub show_preview { |
sub show_preview { |
Line 3559 ENDREDIR
|
Line 3602 ENDREDIR
|
if ( ($env{'form.hide'}) && (!$seeid) ) { |
if ( ($env{'form.hide'}) && (!$seeid) ) { |
$newhash{'studenthidden'} = $currentstudenthidden; |
$newhash{'studenthidden'} = $currentstudenthidden; |
} |
} |
|
if ($env{'form.hide'}) { |
|
my $changelast = 0; |
|
my $newlast; |
|
($changelast,$newlast) = &get_discussion_info($idx,%contrib); |
|
if ($changelast) { |
|
&Apache::lonnet::put('discussiontimes',{$symb => $newlast}, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
} |
|
} |
&Apache::lonnet::store(\%newhash,$symb,$env{'request.course.id'}, |
&Apache::lonnet::store(\%newhash,$symb,$env{'request.course.id'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
Line 3588 ENDREDIR
|
Line 3640 ENDREDIR
|
my %contrib=&Apache::lonnet::restore($symb,$env{'request.course.id'}, |
my %contrib=&Apache::lonnet::restore($symb,$env{'request.course.id'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
my ($changelast,$newlast) = &get_discussion_info($idx,%contrib); |
|
if ($changelast) { |
|
&Apache::lonnet::put('discussiontimes',{$symb => $newlast}, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'}); |
|
} |
my %newhash=('deleted' => $contrib{'deleted'}.".$idx."); |
my %newhash=('deleted' => $contrib{'deleted'}.".$idx."); |
&Apache::lonnet::store(\%newhash,$symb,$env{'request.course.id'}, |
&Apache::lonnet::store(\%newhash,$symb,$env{'request.course.id'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |