[LON-CAPA-cvs] cvs: loncom /interface londocs.pm
bisitz
bisitz at source.lon-capa.org
Wed Dec 5 08:50:32 EST 2012
bisitz Wed Dec 5 13:50:32 2012 EDT
Modified files:
/loncom/interface londocs.pm
Log:
- Corrected unbalanced tags:
- Added missing div closures for list_symbs, verifycontent, checkversions
- Removed unneeded <b> closures (rev. 1.329, 1.479)
- Corrected closure of identifiers table row (rev. 1.484)
- Check/Set Resource Versions:
- Corrected header/standard row closure (rev. 1.479)
- Removed now unneeded calculations and table tags for former way how to list the versions
- XHTML: <br> closure (rev. 1.479)
- Added missing <form> closure (rev. 1.479)
- XHTML: "selected" in options (rev. 1.329) and improved spacing
- Corrected preselection of "all" option (rev. 1.88)
- URL for "Diffs": encoding
- Early escape for resources to skip
-------------- next part --------------
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.520 loncom/interface/londocs.pm:1.521
--- loncom/interface/londocs.pm:1.520 Tue Dec 4 00:39:48 2012
+++ loncom/interface/londocs.pm Wed Dec 5 13:50:32 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.520 2012/12/04 00:39:48 raeburn Exp $
+# $Id: londocs.pm,v 1.521 2012/12/05 13:50:32 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2627,7 +2627,7 @@
$r->print('<span class="LC_error">'.&mt('connection down').'</span>');
} elsif ($result eq 'not_found') {
unless ($url=~/\$/) {
- $r->print('<span class="LC_error">'.&mt('not found').'</b></span>');
+ $r->print('<span class="LC_error">'.&mt('not found').'</span>');
} else {
$r->print('<span class="LC_error">'.&mt('unable to verify variable URL').'</span>');
}
@@ -2673,7 +2673,7 @@
$r->print(&Apache::loncommon::start_data_table_row().
'<td>'.$res->compTitle().'</td>'.
'<td>'.$res->symb().'</td>'.
- &Apache::loncommon::start_data_table_row());
+ &Apache::loncommon::end_data_table_row());
$count ++;
}
if (!$count) {
@@ -2683,6 +2683,7 @@
}
$r->print(&Apache::loncommon::end_data_table());
}
+ $r->print(&endContentScreen());
}
@@ -2713,6 +2714,7 @@
}
&untiehash();
$r->print('<p class="LC_success">'.&mt('Done').'</p>');
+ $r->print(&endContentScreen());
}
@@ -2792,7 +2794,7 @@
if ($env{'form.timerange'} eq 'all') {
# show all documents
$header=&mt('All Documents in '.$crstype);
- $allsel=1;
+ $allsel=' selected="selected"';
foreach my $key (keys(%hash)) {
if ($key=~/^ids\_(\/res\/.+)$/) {
my $src=$1;
@@ -2813,19 +2815,19 @@
.&mt('seconds');
if ($env{'form.timerange'}==-1) {
$seltext='since start of course';
- $startsel='selected';
+ $startsel=' selected="selected"';
$env{'form.timerange'}=time;
}
$starttime=time-$env{'form.timerange'};
if ($env{'form.timerange'}==2592000) {
$seltext=&mt('during the last month').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
- $monthsel='selected';
+ $monthsel=' selected="selected"';
} elsif ($env{'form.timerange'}==604800) {
$seltext=&mt('during the last week').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
- $weeksel='selected';
+ $weeksel=' selected="selected"';
} elsif ($env{'form.timerange'}==86400) {
$seltext=&mt('since yesterday').' ('.&Apache::lonlocal::locallocaltime($starttime).')';
- $daysel='selected';
+ $daysel=' selected="selected"';
}
$header=&mt('Content changed').' '.$seltext;
} else {
@@ -2863,11 +2865,11 @@
<fieldset>
<legend>$lt{'cd'}</legend>
<select name="timerange">
-<option value='all' $allsel>$lt{'al'}</option>
-<option value="-1" $startsel>$lt{'st'}</option>
-<option value="2592000" $monthsel>$lt{'lm'}</option>
-<option value="604800" $weeksel>$lt{'lw'}</option>
-<option value="86400" $daysel>$lt{'sy'}</option>
+<option value='all'$allsel>$lt{'al'}</option>
+<option value="-1"$startsel>$lt{'st'}</option>
+<option value="2592000"$monthsel>$lt{'lm'}</option>
+<option value="604800"$weeksel>$lt{'lw'}</option>
+<option value="86400"$daysel>$lt{'sy'}</option>
</select>
<input type="submit" name="display" value="$lt{'sd'}" />
</fieldset>
@@ -2883,111 +2885,93 @@
<hr />
<h4>$lt{'vers'}</h4>
<input type="submit" name="setversions" value="$lt{'save'}" />
-<table border="0">
ENDHEADERS
#number of columns for version history
- my $num_ver_col = 1;
$r->print(
- &Apache::loncommon::start_data_table().
- &Apache::loncommon::start_data_table_header_row().
- '<th>'.&mt('Resources').'</th>'.
- "<th>$lt{'mr'}</th>".
- "<th>$lt{'ve'}</th>".
- "<th>$lt{'vu'}</th>".
- '<th colspan="'.$num_ver_col.'">'.&mt('History').'</th>'.
- '</b>');
+ &Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table_header_row().
+ '<th>'.&mt('Resources').'</th>'.
+ "<th>$lt{'mr'}</th>".
+ "<th>$lt{'ve'}</th>".
+ "<th>$lt{'vu'}</th>".
+ '<th>'.&mt('History').'</th>'.
+ &Apache::loncommon::end_data_table_header_row()
+ );
foreach my $key (sort(keys(%changes))) {
#excludes not versionable problems from resource version history:
- if ($changes{$key}>$starttime && $key !~ /^\/res\/lib\/templates/) {
- my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);
- my $currentversion=&Apache::lonnet::getversion($key);
- if ($currentversion<0) {
- $currentversion='<span class="LC_error">'.&mt('Could not be determined.').'</span>';
- }
- my $linkurl=&Apache::lonnet::clutter($key);
+ next unless ($changes{$key}>$starttime && $key !~ /^\/res\/lib\/templates/);
+ my ($root,$extension)=($key=~/^(.*)\.(\w+)$/);
+ my $currentversion=&Apache::lonnet::getversion($key);
+ if ($currentversion<0) {
+ $currentversion='<span class="LC_error">'.&mt('Could not be determined.').'</span>';
+ }
+ my $linkurl=&Apache::lonnet::clutter($key);
$r->print(
- &Apache::loncommon::end_data_table_header_row().
&Apache::loncommon::start_data_table_row().
- '<td><b>'.&Apache::lonnet::gettitle($linkurl).'</b><br>'.
+ '<td><b>'.&Apache::lonnet::gettitle($linkurl).'</b><br />'.
'<a href="'.$linkurl.'" target="cat">'.$linkurl.'</a></td>'.
- '<td align="right">'.$currentversion.'<span class="LC_fontsize_medium"><br>('.
+ '<td align="right">'.$currentversion.'<span class="LC_fontsize_medium"><br />('.
&Apache::lonlocal::locallocaltime(&Apache::lonnet::metadata($root.'.'.$extension,'lastrevisiondate')).')</span></td>'.
- '<td align="right">');
-# Used in course
- my $usedversion=$hash{'version_'.$linkurl};
- if (($usedversion) && ($usedversion ne 'mostrecent')) {
- if($usedversion != $currentversion){
+ '<td align="right">'
+ );
+ # Used in course
+ my $usedversion=$hash{'version_'.$linkurl};
+ if (($usedversion) && ($usedversion ne 'mostrecent')) {
+ if ($usedversion != $currentversion) {
$r->print('<span class="LC_warning">'.$usedversion.'</span>');
- }else{
+ } else {
$r->print($usedversion);
}
- } else {
- $r->print($currentversion);
- }
- $r->print('</td><td title="'.$lt{'vu'}.'">');
-# Set version
- $r->print(&Apache::loncommon::select_form($setversions{$linkurl},
- 'set_version_'.$linkurl,
- {'select_form_order' =>
- ['',1..$currentversion,'mostrecent'],
- '' => '',
- 'mostrecent' => &mt('most recent'),
- map {$_,$_} (1..$currentversion)}));
- my $lastold=1;
- for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
- my $url=$root.'.'.$prevvers.'.'.$extension;
- if (&Apache::lonnet::metadata($url,'lastrevisiondate')<
- $starttime) {
- $lastold=$prevvers;
- }
- }
- #
- # Code to figure out how many version entries should go in
- # each of the four columns
- my $entries_per_col = 0;
- my $num_entries = ($currentversion-$lastold);
- if ($num_entries % $num_ver_col == 0) {
- $entries_per_col = $num_entries/$num_ver_col;
} else {
- $entries_per_col = $num_entries/$num_ver_col + 1;
+ $r->print($currentversion);
}
- my $entries_count = 0;
- $r->print('<td valign="top"><span class="LC_fontsize_medium">');
- my $cols_output = 1;
- for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
- my $url=$root.'.'.$prevvers.'.'.$extension;
- $r->print('<span class="LC_nobreak"><a href="'.&Apache::lonnet::clutter($url).
- '">'.&mt('Version').' '.$prevvers.'</a> ('.
- &Apache::lonlocal::locallocaltime(
- &Apache::lonnet::metadata($url,
- 'lastrevisiondate')
- ).
- ')');
- if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') {
- $r->print(' <a href="/adm/diff?filename='.
- &Apache::lonnet::clutter($root.'.'.$extension).
- '&versionone='.$prevvers.
- '" target="diffs">'.&mt('Diffs').'</a>');
- }
- $r->print('</span><br />');
- if (++$entries_count % $entries_per_col == 0) {
- $r->print('</span></td>');
- if ($cols_output != $num_ver_col) {
- $r->print('<td valign="top"><span class="LC_fontsize_medium">');
- $cols_output++;
- }
- }
- }
- while($cols_output++ < $num_ver_col) {
- $r->print('</span></td><td>');
+ $r->print('</td><td title="'.$lt{'vu'}.'">');
+ # Set version
+ $r->print(&Apache::loncommon::select_form(
+ $setversions{$linkurl},
+ 'set_version_'.$linkurl,
+ {'select_form_order' => ['',1..$currentversion,'mostrecent'],
+ '' => '',
+ 'mostrecent' => &mt('most recent'),
+ map {$_,$_} (1..$currentversion)}));
+ my $lastold=1;
+ for (my $prevvers=1;$prevvers<$currentversion;$prevvers++) {
+ my $url=$root.'.'.$prevvers.'.'.$extension;
+ if (&Apache::lonnet::metadata($url,'lastrevisiondate')<$starttime) {
+ $lastold=$prevvers;
+ }
+ }
+ $r->print('</td>');
+ # List all available versions
+ $r->print('<td valign="top"><span class="LC_fontsize_medium">');
+ for (my $prevvers=$lastold;$prevvers<$currentversion;$prevvers++) {
+ my $url=$root.'.'.$prevvers.'.'.$extension;
+ $r->print(
+ '<span class="LC_nobreak">'
+ .'<a href="'.&Apache::lonnet::clutter($url).'">'
+ .&mt('Version [_1]',$prevvers).'</a>'
+ .' ('.&Apache::lonlocal::locallocaltime(
+ &Apache::lonnet::metadata($url,'lastrevisiondate'))
+ .')');
+ if (&Apache::loncommon::fileembstyle($extension) eq 'ssi') {
+ $r->print(
+ ' <a href="/adm/diff?filename='.
+ &Apache::lonnet::clutter($root.'.'.$extension).
+ &HTML::Entities::encode('&versionone='.$prevvers,'"<>&').
+ '" target="diffs">'.&mt('Diffs').'</a>');
}
- }
+ $r->print('</span><br />');
+ }
+ $r->print('</span></td>'.&Apache::loncommon::end_data_table_row());
}
- $r->print('</td>'.&Apache::loncommon::end_data_table_row().
- &Apache::loncommon::end_data_table().
- '<input type="submit" name="setversions" value="'.$lt{'save'}.'" />');
+ $r->print(
+ &Apache::loncommon::end_data_table().
+ '<input type="submit" name="setversions" value="'.$lt{'save'}.'" />'.
+ '</form>'
+ );
&untiehash();
+ $r->print(&endContentScreen());
}
sub mark_hash_old {
More information about the LON-CAPA-cvs
mailing list