[LON-CAPA-cvs] cvs: loncom /interface londocs.pm
www
lon-capa-cvs@mail.lon-capa.org
Wed, 29 Oct 2003 21:21:55 -0000
www Wed Oct 29 16:21:55 2003 EDT
Modified files:
/loncom/interface londocs.pm
Log:
The "Set Versions to be Used" interface appears to work.
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.91 loncom/interface/londocs.pm:1.92
--- loncom/interface/londocs.pm:1.91 Tue Oct 28 16:50:02 2003
+++ loncom/interface/londocs.pm Wed Oct 29 16:21:55 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.91 2003/10/28 21:50:02 www Exp $
+# $Id: londocs.pm,v 1.92 2003/10/29 21:21:55 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -585,20 +585,49 @@
my %changes=();
my $starttime=0;
my $haschanged=0;
+ my %setversions=&Apache::lonnet::dump('resourceversions',
+ $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
+ $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
+
+ $hashtied=0;
+ &tiehash();
+ my %newsetversions=();
if ($ENV{'form.setmostrecent'}) {
$haschanged=1;
+ foreach (keys %hash) {
+ if ($_=~/^ids\_(\/res\/.+)$/) {
+ my $src=$1;
+ }
+ }
} elsif ($ENV{'form.setcurrent'}) {
$haschanged=1;
+ foreach (keys %hash) {
+ if ($_=~/^ids\_(\/res\/.+)$/) {
+ my $src=$1;
+ }
+ }
} elsif ($ENV{'form.setversions'}) {
$haschanged=1;
+ foreach (keys %ENV) {
+ if ($_=~/^form\.set_version_(.+)$/) {
+ my $src=$1;
+ &Apache::lonnet::logthis('Found: '.$1.' '.$ENV{$_});
+ if (($ENV{$_}) && ($ENV{$_} ne $setversions{$src})) {
+ $newsetversions{$src}=$ENV{$_};
+ }
+ }
+ }
}
if ($haschanged) {
- $r->print('<h1>'.&mt('Your Version Settings have been Stored').'</h1>');
+ if (&Apache::lonnet::put('resourceversions',\%newsetversions,
+ $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
+ $ENV{'course.'.$ENV{'request.course.id'}.'.num'}) eq 'ok') {
+ $r->print('<h1>'.&mt('Your Version Settings have been Stored').'</h1>');
+ } else {
+ $r->print('<h1><font color="red">'.&mt('An Error Occured while Attempting to Store your Version Settings').'</font></h1>');
+ }
&changewarning($r,'');
- return;
}
- $hashtied=0;
- &tiehash();
if ($ENV{'form.timerange'} eq 'all') {
# show all documents
$header=&mt('All Documents in Course');
@@ -642,6 +671,9 @@
$header=&mt('No content modifications yet.');
}
}
+ %setversions=&Apache::lonnet::dump('resourceversions',
+ $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
+ $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
my %lt=&Apache::lonlocal::texthash
('st' => 'Version changes since start of Course',
'lm' => 'Version changes since last Month',
@@ -671,7 +703,6 @@
<option value="86400" $daysel>$lt{'sy'}</option>
</select>
<input type="submit" name="display" value="$lt{'sd'}" />
-</form>
<h3>$header</h3>
<input type="submit" name="setversions" value="$lt{'sv'}" />
<table border="2">
@@ -701,7 +732,7 @@
}
$r->print('</font></td><td>');
# Set version
- $r->print(&Apache::loncommon::select_form($usedversion,
+ $r->print(&Apache::loncommon::select_form($setversions{$linkurl},
'set_version_'.$linkurl,
('' => '',
'current' => 'most recent',
@@ -732,7 +763,7 @@
$r->print('</ul></font></td></tr>');
}
}
- $r->print('</table>');
+ $r->print('</table></form>');
$r->print('<h1>'.&mt('Done').'.</h1>');
&untiehash();