version 1.13, 2002/05/13 19:23:52
|
version 1.16, 2002/05/14 15:19:13
|
Line 126 sub mapread {
|
Line 126 sub mapread {
|
return $errtext; |
return $errtext; |
} |
} |
|
|
|
# ---------------------------------------------- Read a map as well as possible |
|
|
|
sub attemptread { |
|
my $fn=shift; |
|
|
|
my @links; |
|
undef @links; |
|
my @theseres; |
|
undef @theseres; |
|
|
|
my ($outtext,$errtext)=&Apache::lonratsrv::loadmap($fn,''); |
|
if ($errtext) { return @theseres } |
|
|
|
# -------------------------------------------------------------------- Read map |
|
foreach (split(/\<\&\>/,$outtext)) { |
|
my ($command,$number,$content)=split(/\<\:\>/,$_); |
|
if ($command eq 'objcont') { |
|
$theseres[$number]=$content; |
|
} |
|
if ($command eq 'objlinks') { |
|
$links[$number]=$content; |
|
} |
|
} |
|
|
|
# --------------------------------------------------------------- Sort, sort of |
|
|
|
my $startidx=0; |
|
my $endidx=0; |
|
for (my $i=0; $i<=$#theseres; $i++) { |
|
if (defined($theseres[$i])) { |
|
my ($title,$url,$ext,$type)=split(/\:/,$theseres[$i]); |
|
if ($type eq 'start') { $startidx=$i; } |
|
if ($type eq 'finish') { $endidx=$i; } |
|
} |
|
} |
|
|
|
|
|
return @theseres; |
|
|
|
} |
|
|
|
|
# --------------------------------------------------------- Build up RAT screen |
# --------------------------------------------------------- Build up RAT screen |
sub ratedt { |
sub ratedt { |
my ($r,$url)=@_; |
my ($r,$url)=@_; |
Line 189 sub smpedt {
|
Line 231 sub smpedt {
|
} |
} |
# ============================================================ Process commands |
# ============================================================ Process commands |
|
|
my $targetdetail=''; |
my $targetdetail=$ENV{'form.targetdetail'}; |
my $importdetail=''; |
my $importdetail=$ENV{'form.curimpdetail'}; |
|
|
# ---------------------------------------------------- Importing from groupsort |
# ---------------------------------------------------- Importing from groupsort |
if ($ENV{'form.importdetail'}) { |
if (($ENV{'form.importdetail'}) && (!$ENV{'form.impfortarget'})) { |
|
|
|
$importdetail=''; |
my @curimport=split(/\&/,$ENV{'form.curimpdetail'}); |
my @curimport=split(/\&/,$ENV{'form.curimpdetail'}); |
|
|
my $lastsel; |
my $lastsel; |
Line 225 sub smpedt {
|
Line 268 sub smpedt {
|
$importdetail=~s/\&+/\&/g; |
$importdetail=~s/\&+/\&/g; |
$importdetail=~s/^\&//; |
$importdetail=~s/^\&//; |
|
|
# -------------------------------------------------------- |
# ------------------------------------------------------------------- Clear all |
|
} elsif ($ENV{'form.clear'}) { |
|
$importdetail=''; |
|
# ------------------------------------------------------------ Discard selected |
|
} elsif ($ENV{'form.discard'}) { |
|
$importdetail=''; |
|
my @curimport=split(/\&/,$ENV{'form.curimpdetail'}); |
|
foreach (@importselect) { |
|
$curimport[$_]=''; |
|
} |
|
for (my $i=0;$i<=$#curimport;$i++) { |
|
my ($name,$url)=split(/\=/,$curimport[$i]); |
|
if ($url) { |
|
$importdetail.='&'.&Apache::lonnet::escape($name).'='. |
|
&Apache::lonnet::escape($url); |
|
} |
|
} |
|
# --------------------------- |
} |
} |
|
|
# ------------------------------------------------------------ Assemble windows |
# ------------------------------------------------------------ Assemble windows |
Line 234 sub smpedt {
|
Line 294 sub smpedt {
|
my $importwindow=join("\n",map { |
my $importwindow=join("\n",map { |
$idx++; |
$idx++; |
if ($_) { |
if ($_) { |
my ($name)=split(/\=/,$_); |
my ($name,$url)=split(/\=/,$_); |
unless ($name) { $name='UNKNOWN'; } |
unless ($name) { $name=(split(/\//,$url))[-1]; } |
|
unless ($name) { $name='EMPTY'; } |
'<option value="'.$idx.'">'.&Apache::lonnet::unescape($name). |
'<option value="'.$idx.'">'.&Apache::lonnet::unescape($name). |
'</option>'; |
'</option>'; |
} |
} |
Line 244 sub smpedt {
|
Line 305 sub smpedt {
|
$idx=0; |
$idx=0; |
my $targetwindow=join("\n",map { |
my $targetwindow=join("\n",map { |
my ($name,$url)=split(/\:/,$resources[$_]); |
my ($name,$url)=split(/\:/,$resources[$_]); |
unless ($name) { $name='UNKNOWN'; } |
unless ($name) { $name=(split(/\//,$url))[-1]; } |
|
unless ($name) { $name='EMPTY'; } |
$targetdetail.='&'.&Apache::lonnet::escape($name).'='. |
$targetdetail.='&'.&Apache::lonnet::escape($name).'='. |
&Apache::lonnet::escape($url); |
&Apache::lonnet::escape($url); |
$idx++; |
$idx++; |
Line 334 function idxcheck(mode) {
|
Line 396 function idxcheck(mode) {
|
} |
} |
idx.focus(); |
idx.focus(); |
} |
} |
|
|
|
|
|
var editbrowser; |
|
function openbrowser(formname,elementname,only,omit) { |
|
var url = '/res/?'; |
|
if (editbrowser == null) { |
|
url += 'launch=1&'; |
|
} |
|
url += 'catalogmode=interactive&'; |
|
url += 'mode=edit&'; |
|
url += 'form=' + formname + '&'; |
|
if (only != null) { |
|
url += 'only=' + only + '&'; |
|
} |
|
if (omit != null) { |
|
url += 'omit=' + omit + '&'; |
|
} |
|
url += 'element=' + elementname + ''; |
|
var title = 'Browser'; |
|
var options = 'scrollbars=1,resizable=1,menubar=0'; |
|
options += ',width=700,height=600'; |
|
editbrowser = open(url,title,options,'1'); |
|
editbrowser.focus(); |
|
} |
</script> |
</script> |
</head> |
</head> |
<body bgcolor='#FFFFFF'> |
<body bgcolor='#FFFFFF'> |
Line 348 $buttons
|
Line 434 $buttons
|
<tr><td bgcolor="#FFFFCC"> |
<tr><td bgcolor="#FFFFCC"> |
<input type=button onClick="javascript:groupsearch()" value="Group Search"> |
<input type=button onClick="javascript:groupsearch()" value="Group Search"> |
<input type=button onClick="javascript:groupimport();" value="Group Import"> |
<input type=button onClick="javascript:groupimport();" value="Group Import"> |
|
after selected |
|
<hr> |
|
<input type=text size=20 name=importmap> |
|
<input type=button |
|
onClick="javascript:openbrowser('simpleedit','importmap','sequence,page','')" |
|
value="Browse"><input type=submit name=loadmap value="Load Map"><hr> |
|
<input type=submit name="discard" value="Discard Selected"> |
|
<input type=submit name="clear" value="Clear All"> |
<input type=button onClick="javascript:viewimport()" value="View"> |
<input type=button onClick="javascript:viewimport()" value="View"> |
|
|
</td><td> </td><td bgcolor="#FFFFCC"> |
</td><td> </td><td bgcolor="#FFFFCC"> |
<input type=button onClick="javascript:viewtarget()" value="View"> |
|
|
<input type=button onClick= |
|
"javascript:impfortarget.value=1;groupsearch()" value="Group Search"> |
|
<input type=button onClick= |
|
"javascript:impfortarget.value=1;groupimport();" value="Group Import"> |
|
after selected |
|
<hr><input type=button onClick="javascript:viewtarget()" value="View"> |
</td></tr> |
</td></tr> |
|
|
<tr><td bgcolor="#FFFFCC"><select name="import" multiple> |
<tr><td bgcolor="#FFFFCC"><select name="import" multiple> |
$importwindow |
$importwindow |
</select> |
</select> |
Line 370 $targetwindow
|
Line 472 $targetwindow
|
<input type=hidden name=importdetail value=""> |
<input type=hidden name=importdetail value=""> |
<input type=hidden name=curimpdetail value="$importdetail"> |
<input type=hidden name=curimpdetail value="$importdetail"> |
<input type=hidden name=targetdetail value="$targetdetail"> |
<input type=hidden name=targetdetail value="$targetdetail"> |
|
<input type=hidden name=impfortarget value="0"> |
</form> |
</form> |
</body></html> |
</body></html> |
ENDSMPHEAD |
ENDSMPHEAD |
Line 401 sub viewmap {
|
Line 504 sub viewmap {
|
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='<i>Unknown</i>'; } |
unless ($title) { $title=(split(/\//,$url))[-1] }; |
|
unless ($title) { $title='<i>Empty</i>'; } |
if ($url) { |
if ($url) { |
$r->print('<a href="'.&Apache::lonratsrv::qtescape($url).'">'); |
$r->print('<a href="'.&Apache::lonratsrv::qtescape($url).'">'); |
} |
} |