version 1.8, 2002/05/10 18:58:04
|
version 1.9, 2002/05/10 19:46:52
|
Line 52 sub mapread {
|
Line 52 sub mapread {
|
my ($outtext,$errtext)=&Apache::lonratsrv::loadmap($fn,''); |
my ($outtext,$errtext)=&Apache::lonratsrv::loadmap($fn,''); |
if ($errtext) { return ($errtext,2); } |
if ($errtext) { return ($errtext,2); } |
|
|
|
# -------------------------------------------------------------------- Read map |
foreach (split(/\<\&\>/,$outtext)) { |
foreach (split(/\<\&\>/,$outtext)) { |
my ($command,$parms)=split(/\<\:\>/,$_); |
my ($command,$number,$content)=split(/\<\:\>/,$_); |
my @item=split(/\:/,$parms); |
|
if ($command eq 'objcont') { |
if ($command eq 'objcont') { |
|
$resources[$number]=$content; |
} |
} |
if ($command eq 'objlinks') { |
if ($command eq 'objlinks') { |
if (defined($links[$item[0]])) { |
$links[$number]=$content; |
|
} |
|
} |
|
# ------------------------------------------------------- Is this a linear map? |
|
my @starters=(); |
|
my @endings=(); |
|
undef @starters; |
|
undef @endings; |
|
|
|
foreach (@links) { |
|
if (defined($_)) { |
|
my ($start,$end,$cond)=split(/\:/,$_); |
|
if ((defined($starters[$start])) || (defined($endings[$end]))) { |
return |
return |
('Map too complex, has branchings. Use advanced editor.',1); |
('Map too complex, has branchings. Use advanced editor.',1); |
} |
} |
if ($links[$item[2]]) { |
$starters[$start]=1; |
|
$endings[$end]=1; |
|
if ($cond) { |
return |
return |
('Map too complex, has conditions. Use advanced editor.',1); |
('Map too complex, has conditions. Use advanced editor.',1); |
} |
} |
$links[$item[0]]=$item[1]; |
|
} |
} |
|
|
} |
} |
Line 227 ENDNODIR
|
Line 241 ENDNODIR
|
sub viewmap { |
sub viewmap { |
my ($r,$adv)=@_; |
my ($r,$adv)=@_; |
$r->print('<html><body bgcolor="#FFFFFF">'.&buttons($adv)); |
$r->print('<html><body bgcolor="#FFFFFF">'.&buttons($adv)); |
|
foreach (@resources) { |
|
if (defined($_)) { |
|
my ($title,$url)=split(/\:/,$_); |
|
$title=~s/\&colon\;/\:/g; |
|
$url=~s/\&colon\;/\:/g; |
|
unless ($title) { $title='<i>Unknown</i>'; } |
|
if ($url) { |
|
$r->print('<a href="'.&Apache::lonratsrv::qtescape($url).'">'); |
|
} |
|
$r->print(&Apache::lonratsrv::qtescape($title)); |
|
if ($url) { $r->print('</a>'); } |
|
$r->print('<br>'); |
|
} |
|
} |
$r->print('</body></html>'); |
$r->print('</body></html>'); |
} |
} |
|
|