[LON-CAPA-cvs] cvs: loncom /interface londocs.pm
www
lon-capa-cvs@mail.lon-capa.org
Tue, 28 Oct 2003 21:50:02 -0000
www Tue Oct 28 16:50:02 2003 EDT
Modified files:
/loncom/interface londocs.pm
Log:
Continued work on versions - the "Set ..." buttons don't do anything yet.
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.90 loncom/interface/londocs.pm:1.91
--- loncom/interface/londocs.pm:1.90 Mon Oct 27 19:57:50 2003
+++ loncom/interface/londocs.pm Tue Oct 28 16:50:02 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.90 2003/10/28 00:57:50 www Exp $
+# $Id: londocs.pm,v 1.91 2003/10/28 21:50:02 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -576,8 +576,6 @@
my $r=shift;
$r->print('<html><head><title>Check Versions</title></head>'.
&Apache::loncommon::bodytag('Check Course Document Versions'));
- $hashtied=0;
- &tiehash();
my $header='';
my $startsel='';
my $monthsel='';
@@ -586,9 +584,25 @@
my $allsel='';
my %changes=();
my $starttime=0;
+ my $haschanged=0;
+ if ($ENV{'form.setmostrecent'}) {
+ $haschanged=1;
+ } elsif ($ENV{'form.setcurrent'}) {
+ $haschanged=1;
+ } elsif ($ENV{'form.setversions'}) {
+ $haschanged=1;
+ }
+ if ($haschanged) {
+ $r->print('<h1>'.&mt('Your Version Settings have been Stored').'</h1>');
+ &changewarning($r,'');
+ return;
+ }
+ $hashtied=0;
+ &tiehash();
if ($ENV{'form.timerange'} eq 'all') {
# show all documents
$header=&mt('All Documents in Course');
+ $allsel=1;
foreach (keys %hash) {
if ($_=~/^ids\_(\/res\/.+)$/) {
my $src=$1;
@@ -633,16 +647,22 @@
'lm' => 'Version changes since last Month',
'lw' => 'Version changes since last Week',
'sy' => 'Version changes since Yesterday',
- 'al' => 'All Resources',
+ 'al' => 'All Resources (possibly large output)',
'sd' => 'Display',
'fi' => 'File',
'md' => 'Modification Date',
'mr' => 'Most recently published Version',
've' => 'Version used in Course',
- 'vu' => 'Set Version to be used in Course',
+ 'vu' => 'Set Version to be used in Course',
+'sv' => 'Set Versions to be used in Course according to Selections below',
+'sm' => 'Keep all Resources up-to-date with most recent Versions (default)',
+'sc' => 'Set all Resource Versions to current Version (Fix Versions)',
'di' => 'Differences');
$r->print(<<ENDHEADERS);
<form action="/adm/coursedocs" method="post">
+<input type="hidden" name="versions" value="1" />
+<input type="submit" name="setmostrecent" value="$lt{'sm'}" />
+<input type="submit" name="setcurrent" value="$lt{'sc'}" /><hr />
<select name="timerange">
<option value='all' $allsel>$lt{'al'}</option>
<option value="-1" $startsel>$lt{'st'}</option>
@@ -650,21 +670,24 @@
<option value="604800" $weeksel>$lt{'lw'}</option>
<option value="86400" $daysel>$lt{'sy'}</option>
</select>
-<input type="submit" name="versions" value="$lt{'sd'}" />
+<input type="submit" name="display" value="$lt{'sd'}" />
</form>
<h3>$header</h3>
+<input type="submit" name="setversions" value="$lt{'sv'}" />
<table border="2">
<tr>
<th>$lt{'fi'}</th><th>$lt{'md'}</th><th>$lt{'mr'}</th>
<th>$lt{'ve'}</th><th>$lt{'vu'}</th><th>$lt{'di'}</th></tr>
ENDHEADERS
- foreach (keys %changes) {
+ foreach (sort keys %changes) {
if ($changes{$_}>$starttime) {
my ($root,$extension)=($_=~/^(.*)\.(\w+)$/);
my $currentversion=&Apache::lonnet::getversion($_);
my $linkurl=&Apache::lonnet::clutter($_);
$r->print(
- '<tr><td><a href="'.$linkurl.'" target="cat">'.$linkurl.
+ '<tr><td><b>'.
+ &Apache::lonnet::gettitle($linkurl).
+ '</b><br /><a href="'.$linkurl.'" target="cat">'.$linkurl.
'</a></td><td>'.
&Apache::lonlocal::locallocaltime($changes{$_}).
'</td><td><font size="+2">'.
@@ -681,9 +704,9 @@
$r->print(&Apache::loncommon::select_form($usedversion,
'set_version_'.$linkurl,
('' => '',
- 'current' => 'current',
+ 'current' => 'most recent',
map {$_,$_} (1..$currentversion))));
- $r->print('</td><td>');
+ $r->print('</td><td><font size="1"><ul>');
my $lastold=1;
for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
my $url=$root.'.'.$prevvers.'.'.$extension;
@@ -694,19 +717,19 @@
}
for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
my $url=$root.'.'.$prevvers.'.'.$extension;
- $r->print('<a href="'.&Apache::lonnet::clutter($url).
- '">'.&mt('Version').' '.$prevvers.' ('.
+ $r->print('<li><a href="'.&Apache::lonnet::clutter($url).
+ '">'.&mt('Version').' '.$prevvers.'</a> ('.
&Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($url,'lastrevisiondate')).
- ')</a>');
+ ')');
if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') {
$r->print(' <a href="/adm/diff?filename='.
&Apache::lonnet::clutter($root.'.'.$extension).
'&versionone='.$prevvers.
'">'.&mt('Diffs').'</a>');
}
- $r->print('<br />');
+ $r->print('</li>');
}
- $r->print('</td></tr>');
+ $r->print('</ul></font></td></tr>');
}
}
$r->print('</table>');
@@ -715,6 +738,19 @@
&untiehash();
}
+sub changewarning {
+ my ($r,$postexec)=@_;
+ $r->print(
+'<script>function reinit(tf) { tf.submit();'.$postexec.' }</script>'.
+'<form method="post" action="/adm/roles" target="loncapaclient">'.
+'<input type="hidden" name="orgurl" value="/adm/coursedocs" /><input type="hidden" name="selectrole" value="1" /><h3><font color="red">'.
+&mt('Changes will become active for your current session after').
+' <input type="hidden" name="'.
+$ENV{'request.role'}.'" value="1" /><input type="button" value="'.
+&mt('re-initializing course').'" onClick="reinit(this.form)"/>'.&mt(', or the next time you log in.').
+$help{'Caching'}.'</font></h3></form>');
+}
+
# ================================================================ Main Handler
sub handler {
my $r = shift;
@@ -962,15 +998,7 @@
$hadchanges=0;
&editor($r,$coursenum,$coursedom,$folder,$allowed);
if ($hadchanges) {
- $r->print(
-'<script>function reinit(tf) { tf.submit();'.$postexec.' }</script>'.
-'<form method="post" action="/adm/roles" target="loncapaclient">'.
-'<input type="hidden" name="orgurl" value="/adm/coursedocs" /><input type="hidden" name="selectrole" value="1" /><h3><font color="red">'.
-&mt('Changes will become active for your current session after').
-' <input type="hidden" name="'.
-$ENV{'request.role'}.'" value="1" /><input type="button" value="'.
-&mt('re-initializing course').'" onClick="reinit(this.form)"/>'.&mt(', or the next time you log in.').
-$help{'Caching'}.'</font></h3></form>');
+ &changewarning($r,$postexec);
}
my $folderseq='/uploaded/'.$coursedom.'/'.$coursenum.'/default_'.time.
'.sequence';