--- loncom/xml/lonxml.pm 2002/02/26 21:00:38 1.154
+++ loncom/xml/lonxml.pm 2002/03/21 20:51:10 1.159
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.154 2002/02/26 21:00:38 albertel Exp $
+# $Id: lonxml.pm,v 1.159 2002/03/21 20:51:10 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -64,6 +64,7 @@ qw(@pwd @outputstack $redirection $impor
use strict;
use HTML::TokeParser;
use HTML::TreeBuilder;
+use HTML::Entities;
use Safe;
use Safe::Hole;
use Math::Cephes qw(:trigs :hypers :bessels erf erfc);
@@ -316,12 +317,16 @@ sub fontsettings() {
sub registerurl {
my $forcereg=shift;
+ my $target = shift;
+ my $result = '';
if ($ENV{'request.publicaccess'}) {
return
'';
}
if ($Apache::lonxml::registered && !$forcereg) { return ''; }
$Apache::lonxml::registered=1;
+ my $nothing='';
+ if ($ENV{'browser.type'} eq 'explorer') { $nothing='javascript:void(0);'; }
if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) {
my $hwkadd='';
if ($ENV{'REQUEST_URI'}=~/\.(problem|exam|quiz|assess|survey|form)$/) {
@@ -347,13 +352,13 @@ ENDGRDS
ENDPARM
}
}
- return (<
// BEGIN LON-CAPA Internal
function LONCAPAreg() {
- menu=window.open("","LONCAPAmenu");
+ menu=window.open("$nothing","LONCAPAmenu","",false);
menu.clearTimeout(menu.menucltim);
menu.currentURL=window.location.pathname;
menu.currentStale=0;
@@ -380,7 +385,7 @@ ENDPARM
}
function LONCAPAstale() {
- menu=window.open("","LONCAPAmenu");
+ menu=window.open("$nothing","LONCAPAmenu","",false);
menu.currentStale=1;
menu.switchbutton
(3,1,'reload.gif','return','location','go(currentURL)');
@@ -399,13 +404,13 @@ ENDPARM
ENDREGTHIS
} else {
- return (<
// BEGIN LON-CAPA Internal
function LONCAPAreg() {
- menu=window.open("","LONCAPAmenu");
+ menu=window.open("$nothing","LONCAPAmenu","",false);
menu.currentStale=1;
menu.clearbut(2,1);
menu.clearbut(2,3);
@@ -426,8 +431,52 @@ ENDREGTHIS
// END LON-CAPA Internal
ENDDONOTREGTHIS
-
}
+ if ($target eq 'edit') {
+ # Javascript routines for construction space:
+ # openbrowser and opensearcher will start the file browser
+ # (lonindexer) and searcher (lonsearchcat) respectively.
+ # Inputs are the name of the html form being used
+ # and the name of the element the selected URL should
+ # be placed in.
+ $result .=<<"ENDBROWSERSCRIPT";
+
+ENDBROWSERSCRIPT
+ }
+ return $result;
}
sub loadevents() {
@@ -1041,7 +1090,7 @@ SIMPLECONTENT
sub inserteditinfo {
my ($result,$filecontents)=@_;
- $filecontents =~ s::</textarea>:ig;
+ $filecontents = &HTML::Entities::encode($filecontents);
# my $editheader='Edit below
';
my $editfooter=(<
@@ -1204,6 +1253,7 @@ sub get_param {
if ( ! $context ) { $context = -1; }
my $args ='';
if ( $#$parstack > (-2-$context) ) { $args=$$parstack[$context]; }
+ if ( ! $args ) { return undef; }
if ( $args =~ /my \$$param=\"/ ) {
return &Apache::run::run("{$args;".'return $'.$param.'}',$safeeval); #'
} else {