version 1.27, 2002/05/22 20:39:59
|
version 1.31.2.2, 2002/09/04 19:11:24
|
Line 36 use strict;
|
Line 36 use strict;
|
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::lonratsrv; |
use Apache::lonratsrv; |
|
use Apache::lonsequence; |
|
|
my @order; |
use vars qw(@order @resources); |
my @resources; |
|
|
|
|
|
# Mapread read maps into global arrays @links and @resources, determines status |
# Mapread read maps into global arrays @links and @resources, determines status |
Line 67 sub mapread {
|
Line 67 sub mapread {
|
if ($command eq 'objlinks') { |
if ($command eq 'objlinks') { |
$links[$number]=$content; |
$links[$number]=$content; |
} |
} |
|
if ($command eq 'objparms') { |
|
return('Map has resource parameters. Use advanced editor.',1); |
|
} |
} |
} |
# ------------------------------------------------------- Is this a linear map? |
# ------------------------------------------------------- Is this a linear map? |
my @starters=(); |
my @starters=(); |
Line 129 sub mapread {
|
Line 132 sub mapread {
|
} |
} |
|
|
# ---------------------------------------------- Read a map as well as possible |
# ---------------------------------------------- Read a map as well as possible |
|
# Also used by the sequence handler |
|
# Call lonsequence::attemptread to read from resource space |
|
# |
sub attemptread { |
sub attemptread { |
my $fn=shift; |
my $fn=shift; |
|
|
Line 263 ENDDOCUMENT
|
Line 268 ENDDOCUMENT
|
# ---------------------------------------------------------------- Make buttons |
# ---------------------------------------------------------------- Make buttons |
|
|
sub buttons { |
sub buttons { |
if ($ENV{'form.forceselect'}) { return ''; } |
|
my $adv=shift; |
my $adv=shift; |
my $output='<form method=post>'; |
my $output='<form method=post>'; |
if ($adv==1) { |
if ($adv==1) { |
Line 313 sub startfinish {
|
Line 317 sub startfinish {
|
} |
} |
my ($name,$url,$ext)=split(/\:/,$resources[$order[0]]); |
my ($name,$url,$ext)=split(/\:/,$resources[$order[0]]); |
$resources[$order[0]]=$name.':'.$url.':'.$ext.':start:res'; |
$resources[$order[0]]=$name.':'.$url.':'.$ext.':start:res'; |
|
if ($#order==0) { |
|
$resources[$#resources+1]='::false'; |
|
$order[1]=$#resources; |
|
} |
my ($name,$url,$ext)=split(/\:/,$resources[$order[$#order]]); |
my ($name,$url,$ext)=split(/\:/,$resources[$order[$#order]]); |
$resources[$order[$#order]]=$name.':'.$url.':'.$ext.':finish:res'; |
$resources[$order[$#order]]=$name.':'.$url.':'.$ext.':finish:res'; |
} |
} |
Line 442 sub smpedt {
|
Line 450 sub smpedt {
|
} |
} |
|
|
foreach ( |
foreach ( |
&attemptread(&Apache::lonnet::filelocation('',$ENV{'form.importmap'}))) { |
&Apache::lonsequence::attemptread(&Apache::lonnet::filelocation('',$ENV{'form.importmap'}))) { |
my ($name,$url)=split(/\:/,$_); |
my ($name,$url)=split(/\:/,$_); |
if ($url) { |
if ($url) { |
$importdetail.='&'.&Apache::lonnet::escape($name).'='. |
$importdetail.='&'.&Apache::lonnet::escape($name).'='. |
Line 539 sub smpedt {
|
Line 547 sub smpedt {
|
# ------------------------------------------------------------ Assemble windows |
# ------------------------------------------------------------ Assemble windows |
|
|
my $idx=-1; |
my $idx=-1; |
my $importwindow=join("\n",map { |
$importdetail='&'.$importdetail; |
|
$importdetail=~s/^\&+/\&/; |
|
my $importwindow= |
|
'<option value="-1"> ---- Import and Paste Area ---- </option>'. |
|
join("\n",map { |
$idx++; |
$idx++; |
if ($_) { |
if ($_) { |
my ($name,$url)=split(/\=/,$_); |
my ($name,$url)=split(/\=/,$_); |
Line 551 sub smpedt {
|
Line 563 sub smpedt {
|
} split(/\&/,$importdetail)); |
} split(/\&/,$importdetail)); |
|
|
$idx=0; |
$idx=0; |
my $targetwindow=join("\n",map { |
my $targetwindow= |
|
'<option value="0"> ------- Target Edit Map ------- </option>'. |
|
join("\n",map { |
my ($name,$url)=split(/\:/,$resources[$_]); |
my ($name,$url)=split(/\:/,$resources[$_]); |
unless ($name) { $name=(split(/\//,$url))[-1]; } |
unless ($name) { $name=(split(/\//,$url))[-1]; } |
unless ($name) { $name='EMPTY'; } |
unless ($name) { $name='EMPTY'; } |
Line 692 function idxcheck(mode) {
|
Line 706 function idxcheck(mode) {
|
<body bgcolor='#FFFFFF'> |
<body bgcolor='#FFFFFF'> |
$buttons |
$buttons |
<font color=red>$errtext</font> |
<font color=red>$errtext</font> |
|
<h1>$url</h1> |
<form name=simpleedit method=post> |
<form name=simpleedit method=post> |
<input type=hidden name=forcesmp value=1> |
<input type=hidden name=forcesmp value=1> |
<table> |
<table> |
Line 765 ENDNODIR
|
Line 780 ENDNODIR
|
|
|
sub viewmap { |
sub viewmap { |
my ($r,$url,$adv,$errtext)=@_; |
my ($r,$url,$adv,$errtext)=@_; |
$r->print('<html>'); |
$r->print('<html><body bgcolor="#FFFFFF">'.&buttons($adv)); |
if ($ENV{'form.forceselect'}) { $r->print(<<ENDSCRIPT); |
|
<script> |
|
|
|
function select_group() { |
|
window.location="/adm/groupsort?catalogmode=groupimport&mode=rat&acts="+document.forms.fileattr.acts.value; |
|
} |
|
|
|
function queue(val) { |
|
if (eval("document.forms."+val+".filelink.checked")) { |
|
var l=val.length; |
|
var v=val.substring(4,l); |
|
document.forms.fileattr.acts.value+='1a'+v+'b'; |
|
} |
|
else { |
|
var l=val.length; |
|
var v=val.substring(4,l); |
|
document.forms.fileattr.acts.value+='0a'+v+'b'; |
|
} |
|
} |
|
|
|
|
|
|
|
</script> |
|
ENDSCRIPT |
|
} |
|
$r->print('<body bgcolor="#FFFFFF">'.&buttons($adv)); |
|
if ($ENV{'form.forceselect'}) { $r->print(<<ENDSELECT); |
|
<form name=fileattr><input type=hidden name=acts value=''> |
|
<input type="button" name="close" value='CLOSE' onClick="self.close()"> |
|
<input type="button" name="groupimport" value='GROUP IMPORT' |
|
onClick="javascript:select_group()"> |
|
</form> |
|
ENDSELECT |
|
} |
|
if ($errtext) { |
if ($errtext) { |
$r->print($errtext.'<hr>'); |
$r->print($errtext.'<hr>'); |
} |
} |
Line 807 ENDSELECT
|
Line 788 ENDSELECT
|
foreach (&attemptread(&Apache::lonnet::filelocation('',$url))) { |
foreach (&attemptread(&Apache::lonnet::filelocation('',$url))) { |
if (defined($_)) { |
if (defined($_)) { |
$idx++; |
$idx++; |
if ($ENV{'form.forceselect'}) { |
|
$r->print('<form name="form'.$idx.'">'); |
|
} |
|
my ($title,$url)=split(/\:/,$_); |
my ($title,$url)=split(/\:/,$_); |
$title=~s/\&colon\;/\:/g; |
$title=~s/\&colon\;/\:/g; |
$url=~s/\&colon\;/\:/g; |
$url=~s/\&colon\;/\:/g; |
unless ($title) { $title=(split(/\//,$url))[-1] }; |
unless ($title) { $title=(split(/\//,$url))[-1] }; |
unless ($title) { $title='<i>Empty</i>'; } |
unless ($title) { $title='<i>Empty</i>'; } |
if ($url) { |
if ($url) { |
if ($ENV{'form.forceselect'}) { |
|
$r->print(<<ENDCHECKBOX); |
|
<input type='checkbox' name='filelink' |
|
value='$url' onClick='javascript:queue("form$idx")' > |
|
<input type='hidden' name='title' value='$title'> |
|
ENDCHECKBOX |
|
} |
|
$r->print('<a href="'.&Apache::lonratsrv::qtescape($url).'">'); |
$r->print('<a href="'.&Apache::lonratsrv::qtescape($url).'">'); |
} |
} |
$r->print(&Apache::lonratsrv::qtescape($title)); |
$r->print(&Apache::lonratsrv::qtescape($title)); |
if ($url) { $r->print('</a>'); } |
if ($url) { $r->print('</a>'); } |
if ($ENV{'form.forceselect'}) { |
$r->print('<br>'); |
$r->print('</form>'); |
|
} else { |
|
$r->print('<br>'); |
|
} |
|
} |
} |
} |
} |
$r->print('</body></html>'); |
$r->print('</body></html>'); |
Line 845 sub handler {
|
Line 812 sub handler {
|
$r->send_http_header; |
$r->send_http_header; |
|
|
return OK if $r->header_only; |
return OK if $r->header_only; |
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
|
['forceselect']); |
|
|
|
my $url=$r->uri; |
my $url=$r->uri; |
my $fn=&Apache::lonnet::filelocation('',$url); |
my $fn=&Apache::lonnet::filelocation('',$url); |