version 1.65, 2005/04/07 06:56:27
|
version 1.68, 2005/06/08 16:10:01
|
Line 173 use Apache::loncommon;
|
Line 173 use Apache::loncommon;
|
use Apache::lonlocal; |
use Apache::lonlocal; |
use File::Copy; |
use File::Copy; |
|
|
use vars qw(@order @resources @resparms); |
use vars qw(@order @resources @resparms @zombies %revzombies); |
|
|
|
|
# Mapread read maps into global arrays @links and @resources, determines status |
# Mapread read maps into global arrays @links and @resources, determines status |
Line 188 sub mapread {
|
Line 188 sub mapread {
|
undef @resources; |
undef @resources; |
undef @order; |
undef @order; |
undef @resparms; |
undef @resparms; |
|
undef @zombies; |
|
undef %revzombies; |
|
|
@resources=(''); |
@resources=(''); |
@order=(); |
@order=(); |
@resparms=(); |
@resparms=(); |
|
@zombies=(); |
|
%revzombies=(); |
|
|
my ($outtext,$errtext)=&Apache::lonratsrv::loadmap($fn,''); |
my ($outtext,$errtext)=&Apache::lonratsrv::loadmap($fn,''); |
if ($errtext) { return ($errtext,2); } |
if ($errtext) { return ($errtext,2); } |
Line 199 sub mapread {
|
Line 204 sub mapread {
|
foreach (split(/\<\&\>/,$outtext)) { |
foreach (split(/\<\&\>/,$outtext)) { |
my ($command,$number,$content)=split(/\<\:\>/,$_); |
my ($command,$number,$content)=split(/\<\:\>/,$_); |
if ($command eq 'objcont') { |
if ($command eq 'objcont') { |
$resources[$number]=$content; |
my ($title,$src,$ext,$type)=split(/\:/,$content); |
|
if ($type ne 'zombie') { |
|
$resources[$number]=$content; |
|
} else { |
|
$zombies[$number]=$content; |
|
$revzombies{$src}=$number; |
|
} |
} |
} |
if ($command eq 'objlinks') { |
if ($command eq 'objlinks') { |
$links[$number]=$content; |
$links[$number]=$content; |
Line 296 sub attemptread {
|
Line 307 sub attemptread {
|
foreach (split(/\<\&\>/,$outtext)) { |
foreach (split(/\<\&\>/,$outtext)) { |
my ($command,$number,$content)=split(/\<\:\>/,$_); |
my ($command,$number,$content)=split(/\<\:\>/,$_); |
if ($command eq 'objcont') { |
if ($command eq 'objcont') { |
$theseres[$number]=$content; |
my ($title,$src,$ext,$type)=split(/\:/,$content); |
|
unless ($type eq 'zombie') { |
|
$theseres[$number]=$content; |
|
} |
} |
} |
if ($command eq 'objlinks') { |
if ($command eq 'objlinks') { |
$links[$number]=$content; |
$links[$number]=$content; |
Line 434 sub buttons {
|
Line 448 sub buttons {
|
return $output.'</form><hr>'; |
return $output.'</form><hr>'; |
} |
} |
|
|
|
# ----------------------------------------------------- Get an unused res index |
|
|
|
sub unusedindex { |
|
return 1+($#resources>$#zombies?$#resources:$#zombies); |
|
} |
|
|
# ----------------------------------------------------------- Paste into target |
# ----------------------------------------------------------- Paste into target |
# modifies @order, @resources |
# modifies @order, @resources |
|
|
Line 446 sub pastetarget {
|
Line 466 sub pastetarget {
|
$name=&Apache::lonnet::unescape($name); |
$name=&Apache::lonnet::unescape($name); |
$url=&Apache::lonnet::unescape($url); |
$url=&Apache::lonnet::unescape($url); |
if ($url) { |
if ($url) { |
my $idx=$#resources+1; |
my $idx=&unusedindex(); |
$insertorder[$#insertorder+1]=$idx; |
$insertorder[$#insertorder+1]=$idx; |
my $ext='false'; |
my $ext='false'; |
if ($url=~/^http\:\/\//) { $ext='true'; } |
if ($url=~/^http\:\/\//) { $ext='true'; } |
Line 492 sub startfinish {
|
Line 512 sub startfinish {
|
$resources[$order[0]]=$name.':'.$url.':'.$ext.':start:res'; |
$resources[$order[0]]=$name.':'.$url.':'.$ext.':start:res'; |
# Make sure this has at least start and finish |
# Make sure this has at least start and finish |
if ($#order==0) { |
if ($#order==0) { |
$resources[$#resources+1]='::false'; |
$resources[&unusedindex()]='::false'; |
$order[1]=$#resources; |
$order[1]=$#resources; |
} |
} |
# Make the last one a finish resource |
# Make the last one a finish resource |
Line 733 sub smpedt {
|
Line 753 sub smpedt {
|
} |
} |
# ---------------------------------------------------------- Process form input |
# ---------------------------------------------------------- Process form input |
|
|
my @importselect=(); |
my @importselect=&Apache::loncommon::get_env_multiple('form.importsel'); |
my @targetselect=(); |
my @targetselect=&Apache::loncommon::get_env_multiple('form.target'); |
undef @importselect; |
|
undef @targetselect; |
|
if (defined($env{'form.importsel'})) { |
|
if (ref($env{'form.importsel'})) { |
|
@importselect=sort(@{$env{'form.importsel'}}); |
|
} else { |
|
@importselect=($env{'form.importsel'}); |
|
} |
|
} |
|
if (defined($env{'form.target'})) { |
|
if (ref($env{'form.target'})) { |
|
@targetselect=sort(@{$env{'form.target'}}); |
|
} else { |
|
@targetselect=($env{'form.target'}); |
|
} |
|
} |
|
# ============================================================ Process commands |
# ============================================================ Process commands |
|
|
my $targetdetail=$env{'form.targetdetail'}; |
my $targetdetail=$env{'form.targetdetail'}; |
Line 1180 sub viewmap {
|
Line 1184 sub viewmap {
|
'" /></td><td>'.&Apache::lonratsrv::qtescape($title). |
'" /></td><td>'.&Apache::lonratsrv::qtescape($title). |
'</td><td>'.$filename.'</td><td>'); |
'</td><td>'.$filename.'</td><td>'); |
if ($url) { |
if ($url) { |
if (-e $resfilepath) { |
$r->print('<a href="'.$resurl.'">'.&mt('Resource space').'</a>'); |
$r->print('<a href="'.$resurl.'">'.&mt('Resource space').'</a>'); |
|
} else { |
|
$r->print(&mt('unpublished')); |
|
} |
|
} |
} |
$r->print('</td><td>'); |
$r->print('</td><td>'); |
if ($url) { |
if ($url) { |