[LON-CAPA-cvs] cvs: rat / lonratedt.pm
www
lon-capa-cvs@mail.lon-capa.org
Wed, 08 Jun 2005 16:10:02 -0000
www Wed Jun 8 12:10:02 2005 EDT
Modified files:
/rat lonratedt.pm
Log:
* never recycle IDs, including zombies
* just because it's not replicated does not mean it does not exist
Index: rat/lonratedt.pm
diff -u rat/lonratedt.pm:1.67 rat/lonratedt.pm:1.68
--- rat/lonratedt.pm:1.67 Wed Jun 8 11:44:51 2005
+++ rat/lonratedt.pm Wed Jun 8 12:10:01 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Edit Handler for RAT Maps
#
-# $Id: lonratedt.pm,v 1.67 2005/06/08 15:44:51 www Exp $
+# $Id: lonratedt.pm,v 1.68 2005/06/08 16:10:01 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -448,6 +448,12 @@
return $output.'</form><hr>';
}
+# ----------------------------------------------------- Get an unused res index
+
+sub unusedindex {
+ return 1+($#resources>$#zombies?$#resources:$#zombies);
+}
+
# ----------------------------------------------------------- Paste into target
# modifies @order, @resources
@@ -460,7 +466,7 @@
$name=&Apache::lonnet::unescape($name);
$url=&Apache::lonnet::unescape($url);
if ($url) {
- my $idx=$#resources+1;
+ my $idx=&unusedindex();
$insertorder[$#insertorder+1]=$idx;
my $ext='false';
if ($url=~/^http\:\/\//) { $ext='true'; }
@@ -506,7 +512,7 @@
$resources[$order[0]]=$name.':'.$url.':'.$ext.':start:res';
# Make sure this has at least start and finish
if ($#order==0) {
- $resources[$#resources+1]='::false';
+ $resources[&unusedindex()]='::false';
$order[1]=$#resources;
}
# Make the last one a finish resource
@@ -1178,11 +1184,7 @@
'" /></td><td>'.&Apache::lonratsrv::qtescape($title).
'</td><td>'.$filename.'</td><td>');
if ($url) {
- if (-e $resfilepath) {
- $r->print('<a href="'.$resurl.'">'.&mt('Resource space').'</a>');
- } else {
- $r->print(&mt('unpublished'));
- }
+ $r->print('<a href="'.$resurl.'">'.&mt('Resource space').'</a>');
}
$r->print('</td><td>');
if ($url) {